!function(){var moduleFactory=function($){var module=this;$.require().script("mvc/controller").done(function(){var exports=function(){$.Controller($.globalNamespace+".Tie",{setup:function(el){return this._super(el,{}),$.makeArray(arguments)},init:function(el,inst,attr,type){if(!type){var controllers=this.element.data("controllers")||{};for(var name in controllers){var controller=controllers[name];if("function"==typeof controller.val){type=name;break}}}this.type=type,this.attr=attr,this.inst=inst,this.bind(inst,attr,"attrChanged"),this.bind(inst,"destroyed","modelDestroyed");
var value=inst.attr(attr);this.lastValue=value,type?(this.bind(this.element.data("controllers")[type],"destroyed","destroy"),this.element[type]("val",value)):this.element.val(value)},attrChanged:function(inst,ev,val){val!==this.lastValue&&(this.setVal(val),this.lastValue=val)},modelDestroyed:function(){this.destroy()},setVal:function(val){this.type?this.element[this.type]("val",val):this.element.val(val)},change:function(el,ev,val){this.type||void 0!==val||(val=this.element.val()),this.inst.attr(this.attr,val,null,this.proxy("setBack"))
},setBack:function(){this.setVal(this.lastValue)},destroy:function(){this.inst=null,this._destroyed||this._super()}})};exports(),module.resolveWith(exports)})};dispatch("mvc/tie").containing(moduleFactory).to("Foundry/2.1 Modules")}();