// Backbone.ModelBinder v1.1.1 // (c) 2020 Bart Wood // Distributed Under MIT License !function(t){"function"==typeof define&&define.amd?define(["underscore","jquery","backbone"],t):"undefined"!=typeof module&&module.exports?module.exports=t(require("underscore"),require("jquery"),require("backbone")):t(_,jQuery,Backbone)}(function(s,u,d){if(!d)throw new Error("Please include Backbone.js before Backbone.ModelBinder.js");return d.ModelBinder=function(){s.bindAll.apply(s,[this].concat(s.functions(this)))},d.ModelBinder.SetOptions=function(t){d.ModelBinder.options=t},d.ModelBinder.VERSION="1.1.1",d.ModelBinder.Constants={},d.ModelBinder.Constants.ModelToView="ModelToView",d.ModelBinder.Constants.ViewToModel="ViewToModel",s.extend(d.ModelBinder.prototype,{bind:function(t,e,i,n){this.unbind(),this._model=t,this._rootEl=e,this._setOptions(n),this._model||this._throwException("model must be specified"),this._rootEl||this._throwException("rootEl must be specified"),i?(this._attributeBindings=u.extend(!0,{},i),this._initializeAttributeBindings(),this._initializeElBindings()):this._initializeDefaultBindings(),this._bindModelToView(),this._bindViewToModel()},bindCustomTriggers:function(t,e,i,n,o){this._triggers=i,this.bind(t,e,n,o)},unbind:function(){this._unbindModelToView(),this._unbindViewToModel(),this._attributeBindings&&(delete this._attributeBindings,this._attributeBindings=void 0)},_setOptions:function(t){this._options=s.extend({boundAttribute:"name"},d.ModelBinder.options,t),this._options.modelSetOptions||(this._options.modelSetOptions={}),this._options.modelSetOptions.changeSource="ModelBinder",this._options.changeTriggers||(this._options.changeTriggers={"":"change","[contenteditable]":"blur"}),this._options.initialCopyDirection||(this._options.initialCopyDirection=d.ModelBinder.Constants.ModelToView)},_initializeAttributeBindings:function(){var t,e,i,n;for(t in this._attributeBindings){for(e=this._attributeBindings[t],s.isString(e)?i={elementBindings:[{selector:e}]}:s.isArray(e)?i={elementBindings:e}:s.isObject(e)?i={elementBindings:[e]}:this._throwException("Unsupported type passed to Model Binder "+i),n=0;n