(function(){var e=function(e){var t=this;e.require().script("mvc/controller").done(function(){var n=function(){e.Controller(e.globalNamespace+".Tie",{setup:function(t){return this._super(t,{}),e.makeArray(arguments)},init:function(e,t,n,r){if(!r){var i=this.element.data("controllers")||{};for(var s in i){var o=i[s];if(typeof o.val=="function"){r=s;break}}}this.type=r,this.attr=n,this.inst=t,this.bind(t,n,"attrChanged"),this.bind(t,"destroyed","modelDestroyed");var u=t.attr(n);this.lastValue=u,r?(this.bind(this.element.data("controllers")[r],"destroyed","destroy"),this.element[r]("val",u)):this.element.val(u)},attrChanged:function(e,t,n){n!==this.lastValue&&(this.setVal(n),this.lastValue=n)},modelDestroyed:function(){this.destroy()},setVal:function(e){this.type?this.element[this.type]("val",e):this.element.val(e)},change:function(e,t,n){!this.type&&n===undefined&&(n=this.element.val()),this.inst.attr(this.attr,n,null,this.proxy("setBack"))},setBack:function(){this.setVal(this.lastValue)},destroy:function(){this.inst=null,this._destroyed||this._super()}})};n(),t.resolveWith(n)})};dispatch("mvc/tie").containing(e).to("Foundry/2.1 Modules")})();