@danielkalen/simplybind
Version:
Magically simple, framework-less one-way/two-way data binding for frontend/backend in ~5kb.
2 lines (1 loc) • 18.4 kB
JavaScript
!function(){var x,u,F,q,G,m,H,v,y,r,w,Q,g,I,J,K,z,L,p,R,n,S,A,T,M,N,h,B,C,U,D,O,E,P,k,t;Q=function(){var a;return a=document.createEvent("Event"),a.initEvent("change",!0,!1),a._sb=!0,a},y="push pop shift unshift splice reverse sort".split(" "),L=function(){return"sb_"+Math.floor(1e12*(1+Math.random())).toString(16)},p=function(){return Object.create(null)},v=function(a,b){return-1!==a.indexOf(b)},g={iD:function(a){return"undefined"!=typeof a},iO:function(a){return"object"==typeof a&&a},iS:function(a){return"string"==typeof a},iN:function(a){return"number"==typeof a},iF:function(a){return"function"==typeof a},iBI:function(a){return a instanceof u},iB:function(a){return a instanceof x},isI:function(a){return g.iO(a)&&g.iN(a.length)},doM:function(a){return a.nodeName&&1===a.nodeType},doI:function(a){return a=a.nodeName.toUpperCase(),"INPUT"===a||"TEXTAREA"===a||"SELECT"===a},doR:function(a){return"radio"===a.type},doC:function(a){return"checkbox"===a.type},eC:function(a){return a instanceof NodeList||a instanceof HTMLCollection||g.iD(jQuery)&&a instanceof jQuery},eAS:function(a){var b;return b=a[0].type,[].filter.call(a,function(a){return a.type===b}).length===a.length}},D=function(a,b){var c,d;for(c in b)d=b[c],g.iD(n[c])&&(a.options[c]=d);return a.mPL()},z=function(a,b){var c,d,e,f,l;for(l=Object.keys(b),f=[],c=0,e=l.length;c<e;c++)d=l[c],f.push(a[d]=b[d]);return f},w={txN:{},set:function(a,b){var c,d;return b?Object.defineProperty(a.object,"_sb_ID",{configurable:!0,value:a.ID}):(d=a.selc,a.object._sb_map?a.object._sb_map[d]=a.ID:(c={},c[d]=a.ID,Object.defineProperty(a.object,"_sb_map",{configurable:!0,value:c})))},get:function(a,b,c,d){return b?r[a._sb_ID]:d&&a[0]._sb_map&&(b=r[a[0]._sb_map[c]],b.gB)?b.gB:a._sb_map&&a._sb_map[c]?r[a._sb_map[c]]:void 0}},K=/[.*+?^${}()|[\]\\]/g,C=B=null,O=function(){var a,b,c;return c=n.placeholder[0].replace(K,"\\$&"),a=n.placeholder[1].replace(K,"\\$&"),b="[^"+a+"]+",B=new RegExp(c+"("+b+")"+a,"g"),C=new RegExp(""+c+b+a,"g")},H=function(a,b,c){var d,e,f,l,g;for(g="",f=e=0,l=a.length;e<l;f=++e)d=a[f],g+=d,c[f]&&(g+=b[c[f]]);return g},E=function(a){throw Error("SimplyBind: "+(J[a]||a))},t=function(a,b){var c,d;if(!n.silent)return c=R(b),d=J[a],console.warn("SimplyBind: "+(d+("\n\n"+c)))},k=function(a){return E("You can't use/invoke ."+a+"() at this sG",!0)},P=function(a,b){return E("Invalid argument/s ("+b+") passed to ."+a+"()",!0)},R=function(a){return(Error().stack||"").split("\n").slice(a+3).join("\n")},J={erIP:"SimplyBind() and .to() only accept a function, an array, a bound object, a string, or a number.",erFN:"Only functions are allowed for .transform/.condition/All()",erEV:"Invalid argument number in .ofEvent()",erOD:"You can only pass a single DOM element to a binding",erMX:"'checked' of Mixed list of element cannot be bound",erEL:"Empty element lists cannot be bound"},r={},n={silent:!1,liveProps:!0,dispatchEvents:!1,updateEvenIfUndefined:!1,updateEvenIfSame:!1,updateOnBind:!0,mutateInherited:!1,trackArrayChildren:!1,simpleSelector:!1,promiseTransforms:!1,placeholder:["{{","}}"]},O(),m=function(a,b,c){return(a||0===a)&&(g.iS(a)||g.iN(a)||g.iF(a)||a instanceof Array)||g.iBI(a)||E("erIP"),!g.iO(a)||a instanceof Array?new u(null,0,null,a,c,b):new u(a._,1)},x=function(a,b,c,d){return z(this,c),this.type=b,this.object=a,this.ID=L(),this.value=this.VLo=null,this.deps=[],this.dM={1:p(),2:p()},this.dPH=p(),this.mPH=p(),this.tfms=p(),this.cnds=p(),this.atEV=[],this.mC&&(this.cH=p(),this.object.forEach(function(a){return function(b){var c;return c=a.cH[b.value]=m("checked").of(b)._,c.aD(a).aTF(a.ID,function(){return c}),c.gB=a}}(this))),"Event"!==this.type&&(a=this.fDV(d),g.iD(a)||"ObjectProp"!==this.type||(this.object[this.prop]=a=null),this.value=this.VLo=a,this.placeholder&&!this.pVL&&this.sPH()),this.mPL(),this.aEV(),this.object instanceof Array&&"Array"!==this.type&&(this.aBI=a=w.get(this.object,!0))&&a.options.trackArrayChildren&&!v(a.tC,this.prop)&&(a.tC.push(this.prop),m(this.prop).of(this.object).to(a.uS)),r[this.ID]=this},u=function(a,b,c,d,e,f){var l,V,h,k;switch(c&&z(this,c),this.sG=b||0,null==this.pX&&(this.pX=[]),null==this.sT&&(this.sT={}),this.sG){case 0:this.opts=f||(f={}),this.options={};for(k in n)this.options[k]=null!=f[k]?f[k]:n[k];g.iF(d)?(this.sG=1,a=this.createBP(d,"Func",!0,e)):d instanceof Array?(this.sG=1,a=this.createBP(d,"Array",!0)):(g.iN(d)&&(d=d.toString()),this.selc=this.prop=d,this.options.simpleSelector||(v(this.selc,":")&&(d=this.prop.split(":"),this.desc=d[0],this.prop=d[1]),v(this.selc,".")&&(d=this.prop.split("."),this.prop=d[0],this.placeholder=d.slice(1).join(".")),this.selc=this.prop));break;case 1:if(!a){if(b=(a=d!==window&&g.isI(d))?d[0]:d){if((this.doM=g.doM(b))&&("checked"===this.prop?(h=b&&g.doR(b),l=!h&&b&&g.doC(b)):"value"===this.prop&&(V=g.doI(b)),a&&"multi"!==this.desc))if(1===d.length)d=d[0];else{if((h||l)&&!g.eAS(d))return t("erMX",3);h||l?(this.mC=!0,d=[].slice.call(d)):(d=d[0],t("erOD",3))}}else a&&g.eC(d)&&t("erEL",3);a=function(){switch(!1){case!this.sT.hEN:return"Event";case!V:return"DOMValue";case!h:return"DOMRadio";case!l:return"DOMCheckbox";case!(this.doM&&"textContent"===this.prop):return"DOMText";case"attr"!==this.desc:return"DOMAttr";default:return"ObjectProp"}}.call(this),a="multi"===this.desc?new G(d,a,this):this.createBP(d,a)}}return this.sOB(a)},x.prototype={mPL:function(a){var b,c,d,e;if(this.options.liveProps)if(b=this,"ObjectProp"===this.type){if(d=Object.getOwnPropertyDescriptor(this.object,this.prop)||{},(e=(e=this.options.mutateInherited||d&&d.configurable)&&this.object.constructor!==CSSStyleDeclaration)&&!this.live||a)return this.live=!0,a=d.get?d.get:function(){return b.value},e=d.set?function(a){return b.sV(a),d.set(a)}:function(a){return b.sV(a)},Object.defineProperty(this.object,this.prop,{configurable:!0,enumerable:d.enumerable,get:a,set:e})}else if("Array"===this.type&&(this.live||(this.live=!0,y.forEach(function(a){return Object.defineProperty(b.value,a,{configurable:!0,value:function(){var c;return c=Array.prototype[a].apply(b.value,arguments),b.uAD(),c}})})),this.options.trackArrayChildren&&!this.tC))return this.tC=[],this.uS=function(){return b.uAD()},c={updateOnBind:!1},this.value.forEach(function(a,d){return b.tC.push(""+d),m(d,c).of(b.value).to(b.uS)})},aD:function(a,b){var c,d,e,f;if(a.isMulti)for(f=a.bindings,d=0,e=f.length;d<e;d++)c=f[d],this.aD(c);else this.dM[1][a.ID]||(this.dM[1][a.ID]=a,this.deps.push(a)),this.placeholder?this.mPH[a.ID]=this.placeholder:this.mPH[a.ID]&&delete this.mPH[a.ID],a.placeholder&&(this.dPH[a.ID]=a.placeholder),b?this.dM[2][a.ID]=a:a.dM[1][this.ID]&&(a.aD(this,!0),this.aD(a,!0));return this},rD:function(a,b){var c,d,e,f;if(a.isMulti)for(f=a.bindings,d=0,e=f.length;d<e;d++)c=f[d],this.rD(c,b);else this.dM[1][a.ID]&&(this.deps.splice(this.deps.indexOf(a),1),delete this.dM[1][a.ID],delete this.dPH[a.ID]),b&&(a.rD(this),delete this.dM[2][a.ID])},rAD:function(a){var b,c,d,e;for(e=this.deps.slice(),c=0,d=e.length;c<d;c++)b=e[c],this.rD(b,a);if(a||0===Object.keys(this.dM[2]).length)return this.DES()},DES:function(){var a,b,c,d;if(delete r[this.ID],"ObjectProp"===this.type||"DOMText"===this.type)Object.defineProperty(this.object,this.prop,{value:this.value,writable:!0}),delete this.object._sb_map,delete this.object._sb_ID;else if("Event"===this.type){for(d=this.atEV,b=0,c=d.length;b<c;b++)a=d[b],this.urEVE(a,this.cEM.remove);delete this.object._sb_map}else if("Array"===this.type)for(delete this.object._sb_ID,a=0,b=y.length;a<b;a++)c=y[a],delete this.object[c];else"Func"===this.type&&delete this.object._sb_ID},fDV:function(a){var b,c,d,e;switch(e=this.type,!1){case"Func"!==e:if(!a)return this.object();break;case"Array"!==e:return this.object;case"DOMAttr"!==e:return this.object.getAttribute(this.prop)||"";case!this.mC:d=[],c=this.cH;for(b in c)if(a=c[b],a.object.checked){if("DOMRadio"===e)return b;d.push(b)}return d;default:return this.object[this.prop]}},sV:function(a,b,c,d){var e,f,l,h,k;if(null==c&&(c=this),f=b?this.pVL[b]:this.value,this.tfS&&(a=this.tfS(a)),f=a!==f||this.options.updateEvenIfSame,h="undefined"!=typeof a||this.options.updateEvenIfUndefined,(f&&h||this.evN)&&"Array"!==this.type){switch(f=this.value,b?(this.pVL[b]=l=a,this.value=a=H(this.pCT,this.pVL,this.pIM)):this.value=a,this.type){case"ObjectProp":this.live||(this.object[this.prop]=a);break;case"Func":f=this.VLp,this.VLp=a,this.value=this.object(a,f);break;case"Event":d||(this.evC=c,this.eE(a),this.evC=null);break;case"DOMValue":this.object.value!==this.value&&(this.object.value=this.value,this.eCE());break;case"DOMRadio":if(this.mC)if(e=g.iB(a)?a:this.cH[a])for(k in this.value=e.object.value,a=this.cH)b=a[k],b.sV(b.ID===e.ID,null,c);else this.value=f;else this.value=!!this.value,this.object.checked!==this.value&&(this.object.checked=this.value),this.value&&this.eCE();break;case"DOMCheckbox":if(this.mC){for(k=!g.iB(a),a=[].concat(a),l=b=0,f=a.length;b<f;l=++b)h=a[l],a[l]=g.iB(h)?h:this.cH[h];f=[],h=this.cH;for(e in h)b=h[e],l=k?v(a,b):b.value,b.sV(l,null,c),l&&f.push(e);this.value=f}else this.value=!!this.value,this.object.checked!==this.value&&(this.object.checked=this.value,this.eCE());break;case"DOMText":this.aTNR(this.object,b,l);break;case"DOMAttr":this.object.setAttribute(this.prop,this.value)}d&&this.evC||this.uAD(c)}},uAD:function(a){var b,c,d,e;if(this.deps.length){if(this.thR){if(+new Date-this.thLU<this.thR)return clearTimeout(this.thT),this.thT=setTimeout(function(b){return function(){return b.uAD(a)}}(this),this.thR);this.thLU=+new Date}for(e=this.deps,c=0,d=e.length;c<d;c++)b=e[c],this.uD(b,a)}},uD:function(a,b){var c,d,e,f;if(c=null===this.value&&"Event"===this.type,!(b&&(b===a||b!==this&&b.dM[1][a.ID])||c)&&(b||(b=this),c=(c=this.mPH[a.ID])?this.pVL[c]:this.value,e=(d=this.dPH[a.ID])?a.pVL[d]:a.value,f=c,f=this.apT(a,d,c,e),this.cC(a,d,c,e)))return this.options.promiseTransforms&&null!=f&&g.iF(f.then)?f.then(function(c){return function(c){return a.sV(c,d,b)}}(this)):a.sV(f,d,b)},pTF:function(a,b){var c,d,e,f;if(g.iF(a)){for(c=0,d=b.length;c<d;c++)e=b[c],e=e._||e,e.isMulti?this.pTF(a,e.bindings):(f=e.ID,f+=e.placeholder?"."+e.placeholder:"",this.aTF(f,a),this.dM[2][e.ID]&&e.aTF(this.ID,a),(this.options.updateOnBind||"Func"===this.type)&&this.uD(e));return!0}return t("erFN",2)},apT:function(a,b,c,d){return this.hTfs?(a=a.ID,b&&(a+="."+b),this.tfms[a]?this.tfms[a](c,d):c):c},aTF:function(a,b){return this.hTfs=!0,this.tfms[a]=b},pCN:function(a,b){var c,d,e,f;if(g.iF(a)){for(c=0,d=b.length;c<d;c++)e=b[c],e=e._||e,e.isMulti?this.pCN(a,e.bindings):(f=e.ID,f+=e.placeholder?"."+e.placeholder:"",this.aCND(f,a),this.dM[2][e.ID]&&e.aCND(this.ID,a));return!0}return t("erFN",2)},cC:function(a,b,c,d){return!this.hCs||(a=a.ID,b&&(a+="."+b),!this.cnds[a]||this.cnds[a](c,d))},aCND:function(a,b){return this.hCs=!0,this.cnds[a]=b},sPH:function(){var a;if(this.pVL=p(),this.pIM=p(),this.pCT=[],g.iS(this.VLo)&&(this.pCT=this.VLo.split(C),a=0,this.value=this.VLo.replace(B,function(b){return function(c,d){return b.pIM[a++]=d,b.pVL[d]=d}}(this))),this.doM&&"textContent"===this.prop)return this.sTNP()},sTNP:function(a){var b,c,d,e,f,g,h,k,m,n;for(null==a&&(a=this.object),m=a.childNodes,c=0,f=m.length;c<f;c++)g=m[c],3!==g.nodeType?this.sTNP(g):(h=L(),k=g.textContent,b=!1,n=p(),e=p(),a=k.split(C),d=0,k.replace(B,function(a){return function(c,f){return b=!0,e[d++]=f,n[f]=a.pVL[f]}}(this)),b||(n=null),Object.defineProperty(g,"_sb_ID",{configurable:!0,value:h}),w.txN[h]=[k,a,n,e])},gTNV:function(a,b,c){var d;return!!(a=w.txN[a._sb_ID])&&((d=a[2])?(d[b]=c,H(a[1],a[2],a[3])):a[0])},aTNR:function(a,b,c){var d,e,f,g;if(this.placeholder)for(g=a.childNodes,a=0,d=g.length;a<d;a++)f=g[a],3!==f.nodeType?this.aTNR(f,b,c):(e=this.gTNV(f,b,c))&&(f.textContent=e);else a.textContent=this.value},aPI:function(a){return this.rPI(),this.PI=setInterval(function(a){return function(){var c;return c=a.fDV(),a.sV(c)}}(this),a)},rPI:function(){return clearInterval(this.PI),this.PI=null},aEV:function(a,b){return this.object.addEventListener(a,function(a){return function(d){if(!d._sb)return a.sV(d.target[b])}}(this),!1)},eCE:function(){if(this.options.dispatchEvents)return this.object.dispatchEvent(Q())},aEV:function(){return this.evN?this.rEVE(this.evN,this.cEM.in):"DOMValue"===this.type?(this.aEV("input","value"),this.aEV("change","value")):this.mC||"DOMRadio"!==this.type&&"DOMCheckbox"!==this.type?void 0:this.aEV("change","checked")},rEVE:function(a,b){if(!v(this.atEV,a))return this.atEV.push(a),this.iEM(a,b||"addEventListener","addEventListener")},urEVE:function(a,b){var c;if(c=this.atEV.indexOf(a),-1!==c)return this.atEV.splice(c,1),this.iEM(a,b||"removeEventListener","removeEventListener")},iEM:function(a,b,c){var d;return d=this.object,(this.doM&&g.iD(jQuery)&&"on"===b||"off"===b)&&(d=jQuery(this.object)),d[b]||(b=c),this.evH||(this.evH=S.bind(this)),"function"==typeof d[b]?d[b](a,this.evH):void 0},eE:function(a){var b,c;return c=this.object,b=this.cEM.out||"dispatchEvent",this.doM&&g.iD(jQuery)&&"trigger"===b&&(c=jQuery(this.object)),c[b]||(b="dispatchEvent"),"dispatchEvent"===b?(this.evO||(this.evO=document.createEvent("Event"),this.evO.initEvent(this.evN,!0,!0)),this.evO.boundData=a,c[b](this.evO)):c[b](this.evN,a)}},S=function(){var a;return a="Event"===this.type?arguments[this.prop]:this.fDV(),this.sV(a,null,this.evC,!0)},F={new:function(a,b){return new u(this._,a,this,b)},sOB:function(a){return this._=a,Object.defineProperties(this,{ID:{get:function(){return a.ID}},value:{get:function(){return a.value}},original:{get:function(){return a.objects||a.object}},dependents:{get:function(){return a.deps.slice().map(function(a){return a.object})}},lpX:{get:function(){return this.pX[this.pX.length-1]}}})},createBP:function(a,b,c,d,e){var f;return this.object=a,(f=w.get(a,c,this.selc,this.mC))?this.patchCachedBP(f):(a=new x(a,b,e||this,d),w.set(a,c),a)},patchCachedBP:function(a){return(a.placeholder=this.placeholder)&&!a.pVL&&(a.VLo=a.fDV(),a.sPH()),"ObjectProp"!==a.type||this.prop in this.object||a.mPL(!0),D(a,this.opts),a}},u.prototype=Object.create(F),q={of:function(a){var b;return 0!==this.sG&&2!==this.sG&&k(h[0]),g.iO(a)||g.iF(a)||P(h[0],a),g.iBI(a)&&(a=a.object),2===this.sG&&(this.pX[this.pX.length-1]=b=this.lpX.of(a),this.sT.hIB=!0,this.sT.hTf=!1,this._.aD(b._),M(this._,b._)),this.new(this.sG+1,a)},ofEvent:function(a,b,c){return 0!==this.sG||this.sT.hEN?k(h[1]):a&&g.iS(a)?isNaN(parseInt(this.prop))&&t("erEV",1):P(h[1],a),this.sT.hEN=!0,this.evN=a,this.selc=this.prop+"#"+this.evN,this.cEM={in:b,out:c},this},to:function(a,b){var c;return(1!==this.sG||this.sT.hIB)&&k(h[2]),this.pX.push(c=I(this,a,b)),0===c.sG?c=2:(c=3,this.sT.hIB=!0),this.new(c)},and:function(a,b){var c;return 3===this.sG&&this.sT.hIB&&!this.sT.hMTf||k(h[3]),this.pX.push(c=I(this,a,b)),0===c.sG?c=2:(c=3,this.sT.hTf=!1),this.new(c)},toEvent:function(a,b,c,d){return 1!==this.sG&&k(h[4]),this.pX.push(m(0,d).ofEvent(a,c,b)),this.new(2)},chainTo:function(a,b){return 3!==this.sG&&k(h[5]),m(this.lpX).to(a,b)},set:function(a){return 0!==this.sG&&2!==this.sG||k(h[6]),this._.sV(a,this.placeholder),this},get:function(){return 0!==this.sG&&2!==this.sG||k(h[7]),this.placeholder?this._.pVL[this.placeholder]:this._.value},transformSelf:function(a){return(1!==this.sG||1===this.sG&&"Array"===this._.type)&&k(h[8]),g.iF(a)?(this._.tfS=a,this._.options.updateOnBind&&(a=this._.isMulti?this.value[0]:this.value,this._.sV(a))):t("erFN",1),this},transform:function(a){return(3!==this.sG||this.sT.hTf||this.sT.hMTf)&&k(h[9]),this.sT.hTf=this._.pTF(a,this.pX.slice(-1))||!1,this.new(3)},transformAll:function(a){return(3!==this.sG||this.sT.hTf||this.sT.hMTf)&&k(h[10]),this.sT.hMTf=this._.pTF(a,this.pX)||!1,this.new(3)},condition:function(a){return 3!==this.sG&&k(h[11]),this._.pCN(a,this.pX.slice(-1)),this.new(3)},conditionAll:function(a){return 3!==this.sG&&k(h[12]),this._.pCN(a,this.pX),this.new(3)},bothWays:function(a){var b,c,d,e;return(3!==this.sG||this.sT.hMTf)&&k(h[13]),d=this.lpX,e=d._.aD(this._,!0),c=this._.tfms[d.ID],b=this._.cnds[d.ID],(c||a)&&(c=g.iF(a)?a:c)&&!1!==a&&e.aTF(this.ID,c),b&&e.aCND(this.ID,b),this._.aD(d._,!0),this},unBind:function(a){var b,c,d,e;for(3!==this.sG&&k(h[14]),e=this.pX,b=0,c=e.length;b<c;b++)d=e[b],this._.rD(d._,a);return this},pollEvery:function(a){return 3===this.sG&&"Event"!==this._.type||k(h[15]),this._.aPI(a),this},stopPolling:function(){return 3!==this.sG&&k(h[16]),this._.rPI(),this},updateDepsOnEvent:function(a,b){return 3!==this.sG&&k(h[17]),this._.rEVE(a,b),this},removeEvent:function(a,b){return 3!==this.sG&&k(h[18]),this._.urEVE(a,b),this},throttle:function(a){return 1!==this.sG&&3!==this.sG&&k(h[19]),a&&g.iN(a)?this._.thR=a:!1===a&&delete this._.thR,this},setOption:function(a,b){var c,d,e,f,g;for(c={},c[""+a]=b,e=c,D(this._,e),g=this.pX,c=0,d=g.length;c<d;c++)f=g[c],D(f._,e);return this}},q.update=q.set,q.twoWay=q.bothWays,q.pipe=q.chainTo,h=Object.keys(q),A=0;for(T=h.length;A<T;A++)N=h[A],u.prototype[N]=q[N];return I=function(a,b,c){return null==c&&(c={}),b=m(b,c,!0),0!==b.sG&&(a._.aD(b._,a),M(a._,b._)),b},M=function(a,b){if(a.options.updateOnBind||"Func"===a.type)return a.uD(b)},G=function(a,b,c){var d,e,f,g;for(z(this,c),this.isMulti=!0,this.type=b,this.bindings=d=[],e=0,f=a.length;e<f;e++)g=a[e],d.push(this.createBP(g,b,null,null,c));return Object.defineProperties(this,{ID:{value:d[0].ID},options:{value:d[0].options},tfms:{value:d[0].tfms},cnds:{value:d[0].cnds},pVL:{get:function(){return d[0].pVL}},value:{get:function(){return d.map(function(a){return a.value})}},thR:{set:function(a){return d.forEach(function(b){return b.thR=a})}},tfS:{set:function(a){return d.forEach(function(b){return b.tfS=a})}}})},U=G.prototype=Object.create(F),Object.keys(x.prototype).forEach(function(a){return U[a]=function(b,c){var d,e,f,g,h;for(g=this.bindings,h=[],e=0,f=g.length;e<f;e++)d=g[e],h.push(d[a](b,c));return h}}),Object.defineProperties(m,{version:{value:"1.4.6"},options:{get:function(){var a,b,c;a={};for(b in n)c=n[b],a[b]=c;return a}}}),m.setOption=function(a,b){if(g.iD(n[a])&&(n[a]=b,"placeholder"===a))return O()},m.setOptions=function(a){var b,c;for(b in a)c=a[b],m.setOption(b,c)},m.unBindAll=function(a,b){var c,d,e;if(a&&(g.iO(a)||g.iF(a))&&(g.isI(a)&&!a._sb_ID&&a[0]&&g.doM(a[0])&&(a=a[0]),e=a._sb_map,a._sb_ID&&r[a._sb_ID].rAD(b),e))for(d in e)c=e[d],r[c].rAD(b)},window.SimplyBind=m}();