constraintjs
Advanced tools
Comparing version 0.9.8-beta2 to 0.9.8-beta3
@@ -1,4 +0,4 @@ | ||
/* constraintjs - v0.9.8-beta1 (http://cjs.from.so/) */ | ||
var cjs=function(a){"use strict";var b,c,d=Array.prototype,e=Object.prototype,f=(Function.prototype,String.prototype),g=d.slice,h=e.toString,i=d.concat,j=d.push,k=d.some,l=d.indexOf,m=(d.lastIndexOf,d.every),n=d.forEach,o=Object.keys,p=d.filter,q=d.reduce,r=d.map,s=f.trim,t=function(a,b){return function(){return a.apply(b,arguments)}},u=function(a){var b=P(arguments,1);return function(){return a.apply(this,b)}},v=function(a){return s?s.call(a):String(a).replace(/^\s+|\s+$/g,"")},w=a.document,x=function(b,c){return a.setTimeout(b,c)},y=function(b,c){return a.clearTimeout(b,c)},z={"+":function(a){return+a},"-":function(a){return-a},"~":function(a){return~a},"!":function(a){return!a}},A={"===":function(a,b){return a===b},"!==":function(a,b){return a!==b},"==":function(a,b){return a==b},"!=":function(a,b){return a!=b},">":function(a,b){return a>b},">=":function(a,b){return a>=b},"<":function(a,b){return b>a},"<=":function(a,b){return b>=a},"+":function(a,b){return a+b},"-":function(a,b){return a-b},"*":function(a,b){return a*b},"/":function(a,b){return a/b},"%":function(a,b){return a%b},"^":function(a,b){return a^b},"&&":function(a,b){return a&&b},"||":function(a,b){return a||b},"&":function(a,b){return a&b},"|":function(a,b){return a|b},"<<":function(a,b){return a<<b},">>":function(a,b){return a>>b},">>>":function(a,b){return a>>>b}};!w||"textContent"in w.createElement("div")?(b=function(a){return a.textContent},c=function(a,b){a.textContent=b}):(b=function(a){return a&&3===a.nodeType?a.nodeValue:a.innerText},c=function(a,b){a&&3===a.nodeType?a.nodeValue=b:a.innerText=b});var B,C,D,E,F,G,H=function(a,b,c){a.addEventListener?a.addEventListener(b,c):a.attachEvent("on"+b,c)},I=function(a,b,c){a.removeEventListener?a.removeEventListener(b,c):a.detachEvent("on"+b,c)},J={},K=function(){var a=0;return function(){return a++}}(),L=function(a){return X(a)?U(a)?a.slice():ga({},a):a},M=o||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b,c=[],d=0;for(b in a)ba.call(a,b)&&(c[d++]=b);return c},N=function(a,b){return a?void 0===b?a[a.length-1]:g.call(a,Math.max(a.length-b,0)):void 0},O=function(a,b,c){var d=!1;return a?k&&a.some===k?a.some(b,c):(da(a,function(a,e,f){return d||(d=b.call(c,a,e,f))?J:void 0}),!!d):d},P=function(a,b){return g.call(a,void 0===b?1:b)},Q=function(a,b,c){b=b||_;var d=!0;return a?m&&a.every===m?a.every(b,c):(da(a,function(a,e,f){return(d=d&&b.call(c,a,e,f))?void 0:J}),!!d):d},R=function(a,b,c){return b&&Q(a,U)?i.apply(c,a):(da(a,function(a){U(a)||$(a)?b?j.apply(c,a):R(a,b,c):c.push(a)}),c)},S=function(a,b){return R(a,b,[])},T=function(a){return"[object Number]"===h.call(a)},U=Array.isArray||function(a){return"[object Array]"===h.call(a)},V=function(a){return"[object Function]"===h.call(a)},W=function(a){return"[object String]"===h.call(a)},X=function(a){return a===Object(a)},Y=function(a){return!(!a||1!==a.nodeType)},Z=function(a){return!!(a&&a.nodeType>0)},$=function(a){return"[object Arguments]"===h.call(a)},_=function(a){return a},aa=function(a){return a?U(a)?g.call(a):$(a)?g.call(a):a.toArray&&V(a.toArray)?a.toArray():ea(a,_):[]},ba=e.hasOwnProperty,ca=function(a,b){return ba.call(a,b)},da=function(a,b,c){var d,e;if(a){if(n&&a.forEach===n)a.forEach(b,c);else if(a.length===+a.length){for(d=0,e=a.length;e>d;d++)if(b.call(c,a[d],d,a)===J)return}else{var f=M(a);for(d=0,e=f.length;e>d;d++)if(b.call(c,a[f[d]],f[d],a)===J)return}return a}},ea=function(a,b,c){var d=[];return a?r&&a.map===r?a.map(b,c):(da(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)}),a.length===+a.length&&(d.length=a.length),d):d},fa=function(a,b,c){var d=[];return a?p&&a.filter===p?a.filter(b,c):(da(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d):d},ga=function(a){return da(g.call(arguments,1),function(b){if(b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}),a},ha=function(a,b,c){var d,e=a.length;for(d=c||0;e>d;d++)if(b(a[d],d))return d;return-1},ia=function(a,b){return a===b},ja=function(a,b,c,d){return d||c||!l||a.indexOf!==l?(d=d||ia,ha(a,function(a){return d(b,a)},c)):a.indexOf(b)},ka=function(a,b){return la(a,ja(a,b))},la=function(a,b){return b>=0?a.splice(b,1)[0]:b},ma=function(a,b,c){var d=arguments.length>2;return a||(a=[]),q&&a.reduce===q?d?a.reduce(b,c):a.reduce(b):(da(a,function(a,d,e){c=b(c,a,d,e)}),c)},na=function(a,b,c,d){for(var e=c,f=a.length;f>e;){if(d(a[e],b))return e;e++}return-1},oa=function(a,b,c,d,e,f,g){var h=b[a],i=d[h]+1;return i=na(c,h,i>e?i:e,g||ia),0>i&&(i=f),d[h]=i,i},pa=function(a,b,c){var d,e,f,g={},h=0,i=0,j=0,k=a.length,l=b.length,m=new Array(l>k?l:k);if(0===l||0===k)return[];for(d=oa(0,a,b,g,h,l,c),f=0;k>f;f++)i=h===i?d:oa(f,a,b,g,h,l,c),d=oa(f+1,a,b,g,h,l,c),i>d?(f++,e=d):e=i,e===l||f===k?i=oa(f,a,b,g,h,l,c):(h=e,m[j]={item:a[f],indicies:[f,e]},j++);return m.slice(0,j)},qa=function(a,b,c){var d,e,f,g=L(b),h=a.length,i=b.length,j=[],k=0;if(0===i||0===h)return a;for(d=0;h>d;d+=1)if(f=a[d],e=ja(g,f,0,c),e>=0){if(la(g,e),0===--i){j.push.apply(j,P(a,d+1));break}}else j[k]=f,k++;return j},ra=function(a,b,c){var d,e,f,g=L(b),h=a.length,i=b.length,j=[];for(d=0;h>d&&i>0;d++)f=a[d],e=ja(g,f,0,c),e>=0&&(j.push([f,la(g,e)]),i--);return j},sa=function(a){var b=a[1].item;return{item:b,from:a[0].index,to:a[1].index,from_item:a[0].item,to_item:b}},ta=function(a){for(var b=0,c=a.length,d=[];c>b;)d[b]={item:a[b],index:b},b++;return d},ua=function(a){return{item:a.item,from:a.indicies[0],to:a.indicies[1]}},va=function(a){return a.index},wa=function(a){return a.to},xa=function(a){return{from:a.index,from_item:a.item}},ya=function(a,b,c){var d=c||ia,e=function(a,b){return d(a?a.item:a,b?b.item:b)},f=ta(a),g=ta(b),h=ea(pa(a,b),ua),i=qa(f,h,e),j=qa(g,h,e),k=ea(ra(i,j,e),sa);j=qa(j,k,e),i=qa(i,k,e);for(var l,m,n,o=ea(j,va),p=ea(k,wa),q=ea(h,wa),r=[],s=0,t=b.length;t>s;)n=b[s],(m=ja(o,s))>=0?(l=j[m],r[s]={to:s,to_item:n,item:n}):(m=ja(p,s))>=0?(l=k[m],r[s]={to:s,to_item:n,item:n,from:l.from,from_item:l.from_item}):(m=ja(q,s))>=0&&(l=h[m],r[s]={to:s,to_item:n,item:n,from:l.from,from_item:a[l.from]}),s++;return r.concat(ea(i,xa))},za=function(a){return a.hasOwnProperty("from")},Aa=function(a){return!za(a)},Ba=function(a){return a.hasOwnProperty("to")},Ca=function(a){return!Ba(a)},Da=function(a){return za(a)&&Ba(a)},Ea=function(a){return Da(a)&&a.from!==a.to},Fa=function(a,b){var c=za(a),d=za(b);return c&&d?a.from-b.from:d-c},Ga=function(a,b,c){var d=ya(a,b,c),e=L(d).sort(Fa),f=fa(d,Aa),g=fa(e,Ca).reverse(),h=fa(d,Ea),i=[];return da(g,function(a){la(e,a.from)}),da(f,function(a){e.splice(a.to,0,a)}),da(d,function(a,b){if(Da(a)&&e[b]!==a){var c=ja(e,a,b);e.splice(b,0,la(e,c)),i.push({move_from:c,insert_at:b,item:a.item,from:a.from,to:a.to})}}),e=null,{added:f,removed:g,moved:i,index_changed:h,mapping:d}},Ha=/-([a-z]|[0-9])/gi,Ia=/^-ms-/,Ja=function(a,b){return String(b).toUpperCase()},Ka=function(a){return a.replace(Ia,"ms-").replace(Ha,Ja)},La=a.cjs,Ma=function(a,b){return U(a)?new C(ga({value:a},b)):Lc(a)?Ma.inputValue(a):E(a)?new B(a,b):X(a)&&!V(a)?new D(ga({value:a},b)):new B(a,b)},Na=function(a){return E(a)?a.get():a},Oa={stack:[],check_on_nullified_ids:{},getValue:function(a,b){var c,d,e,f=this,g=Oa.stack,h=g.length;if(h>0&&(c=g[h-1],d=f._outEdges[c._id],e=c._tstamp+1,d?d.tstamp=e:f!==c&&f._options.auto_add_outgoing_dependencies!==!1&&c._options.auto_add_incoming_dependencies!==!1&&a!==!1&&(f._outEdges[c._id]=c._inEdges[f._id]={from:f,to:c,tstamp:e})),f._paused_info)return f._paused_info.temporaryValue;if(!f._valid){if(f._tstamp++,g[h]=f,f._valid=!0,f._options.cache_value!==!1){if(f._cached_value=f._options.literal?f._value:V(f._value)?f._value.call(f._options.context||f,f,b):Na(f._value),f._sync_value)f._cached_value=f._sync_value.value,delete f._sync_value;else if(Oa._paused_node&&Oa._paused_node.node===f)return f._paused_info=Oa._paused_node,delete Oa._paused_node,g.length=h,f._paused_info.temporaryValue}else V(f._value)&&f._value.call(f._options.context);g.length=h}return f._cached_value},pauseNodeGetter:function(a){Oa._paused_node={temporaryValue:a,node:this}},resumeNodeGetter:function(a){var b,c=this;Oa._paused_node&&Oa._paused_node.node===c?(delete Oa._paused_node,c._sync_value={value:a}):(b=Oa.stack,delete c._paused_info,c._tstamp++,c._valid=!0,Oa.stack=[c],c._options.cache_value!==!1?c._cached_value=c._options.literal?a:V(a)?a.call(c._options.context||c,c):Ma.get(a):V(c._value)&&a.call(c._options.context),Oa.nullify.apply(Oa,ea(c._outEdges,function(a){return a.to})),Oa.stack=b)},add_in_call_stack:function(a){var b=a.priority;if(a.in_call_stack++,a.node._num_listeners_in_call_stack++,T(b))for(var c,d,e=0,f=this.nullified_call_stack.length;f>e;){if(c=this.nullified_call_stack[e],c&&(d=c.priority,d===!1||b>d))return void this.nullified_call_stack.splice(e,0,a);e++}this.nullified_call_stack.push(a)},nullify:function(){var a,b,c,d,e,f,h,i,j,k,l=g.call(arguments),m=l.length,n=!this._is_nullifying;for(n&&(this._is_nullifying=!0),a=0;m>a;a+=1)if(e=l[a],l[a]=!1,e._valid&&(e._valid=!1,d=!0,e._options.cache_value===!1||e._options.check_on_nullify!==!0||this.check_on_nullified_ids[e._id]||(this.check_on_nullified_ids[e._id]=!0,f=e._options.equals||ia,h=e._cached_value,i=e.get(void 0,!0),f(h,i)&&(d=!1)),d)){j=e._changeListeners,da(j,this.add_in_call_stack,this),b=e._outEdges,k=e._id;for(c in b)if(ca(b,c)){var o=b[c],p=o.to;o.tstamp<p._tstamp?(delete e._outEdges[c],delete p._inEdges[k]):(l[m]=p,m+=1)}}n&&(this.check_on_nullified_ids={},this.semaphore>=0&&this.nullified_call_stack.length>0&&this.run_nullified_listeners(),delete this._is_nullifying)},removeDependency:function(a,b){delete a._outEdges[b._id],delete b._inEdges[a._id]},semaphore:0,wait:function(){this.semaphore-=1},signal:function(){this.semaphore+=1,this.semaphore>=0&&this.nullified_call_stack.length>0&&this.run_nullified_listeners()},nullified_call_stack:[],running_listeners:!1,clearEdges:function(a,b){var c,d=b!==!0,e=a._id,f=a._inEdges,g=a._outEdges;d&&this.wait();for(c in f)ca(f,c)&&(delete f[c].from._outEdges[e],delete f[c]);for(c in g)if(ca(g,c)){var h=g[c].to;d&&Oa.nullify(h),delete h._inEdges[e],delete g[c]}d&&this.signal()},run_nullified_listeners:function(){var b,c,d;if(!this.running_listeners){for(this.running_listeners=!0;this.nullified_call_stack.length>0;)if(b=this.nullified_call_stack.shift(),c=b.callback,d=b.context||a,b.in_call_stack--,b.node._num_listeners_in_call_stack--,Ma.__debug)c.apply(d,b.args);else try{c.apply(d,b.args)}catch(e){ca(a,"console")&&a.console.error(e)}this.running_listeners=!1}},remove_from_call_stack:function(a){for(;a.in_call_stack>0;)ka(this.nullified_call_stack,a),a.in_call_stack--,a.node._num_listeners_in_call_stack--}};B=function(b,c){this._options=ga({context:a},c),this._value=b,this._id=K(),this._outEdges={},this._inEdges={},this._changeListeners=[],this._tstamp=0,this._num_listeners_in_call_stack=0,this._options.literal||!V(this._value)&&!E(this._value)?(this._valid=!0,this._cached_value=this._value):(this._valid=!1,this._cached_value=void 0)},function(a){var b=a.prototype;b.get=Oa.getValue,b.set=function(a,b){var c=this._value;if(this._value=a,b&&b.silent===!0)return this;if(this._options.literal||!V(a)&&!E(a)){var d=this._options.equal||ia;d(c,a)||Oa.nullify(this)}else c!==a&&Oa.nullify(this);return this};var c=["context","literal"];b.setOption=function(a,b){var d;if(W(a))this._options[a]=b,d=ja(c,a)>=0;else{var e=e(a);ga(this._options,a),d=O(c,function(a){return e.indexOf(a)>=0})}return d?this.invalidate():this},b.invalidate=function(){return Oa.nullify(this),this},b.isValid=function(){return this._valid},b.remove=function(a){return Oa.clearEdges(this,a),this._valid=!1,this._cached_value=void 0,this},b.destroy=function(a){return this._num_listeners_in_call_stack>0&&da(this._changeListeners,function(a){return a.in_call_stack>0&&(Oa.remove_from_call_stack(a),0===this._num_listeners_in_call_stack)?J:void 0},this),this.remove(a),this._changeListeners=[],this},b.pauseGetter=function(){return Oa.pauseNodeGetter.apply(this,arguments),this},b.resumeGetter=function(){return Oa.resumeNodeGetter.apply(this,arguments),this},b.onChange=function(a,b){return this.onChangeWithPriority.apply(this,[!1].concat(aa(arguments)))},b.onChangeWithPriority=function(a,b,c){var d=g.call(arguments,3);return T(a)||(a=!1),this._changeListeners.push({callback:b,context:c,args:d,in_call_stack:0,node:this,priority:a}),this._options.run_on_add_listener!==!1&&this.get(!1),this},b.offChange=function(a,b){var c,d;for(d=this._changeListeners.length-1;d>=0;d-=1)if(c=this._changeListeners[d],c.callback===a&&(!b||c.context===b)){la(this._changeListeners,d),c.in_call_stack>0&&Oa.remove_from_call_stack(c),delete c.node;break}return this},b.inFSM=function(a,b){return da(b,function(b,c){a.on(c,function(){this.set(b)},this),a.is(c)&&this.set(b)},this),this},b.and=function(){var b=[this].concat(aa(arguments)),c=b.length;return new a(function(){for(var a,d=0;c>d;d++)if(!(a=Ma.get(b[d])))return!1;return a})},b.iif=function(b,c){var d=this;return new a(function(){return d.get()?Ma.get(b):Ma.get(c)})},b.or=function(){var b=[this].concat(aa(arguments)),c=b.length;return new a(function(){for(var a,d=0;c>d;d++)if(a=Ma.get(b[d]))return a;return!1})};var d=function(b){return function(){var c=[this].concat(aa(arguments));return new a(function(){return b.apply(this,ea(c,Ma.get))})}},e=function(a,b){return a?a[b]:void 0};b.prop=d(function(a){return ma(P(arguments),e,a)}),b.toInt=d(function(a){return parseInt.apply(this,arguments)}),b.toFloat=d(function(a){return parseFloat.apply(this,arguments)}),b.add=d(function(){return ma(arguments,A["+"],0)}),b.sub=d(function(a){return ma(P(arguments),A["-"],a)}),b.mul=d(function(a){return ma(P(arguments),A["*"],a)}),b.div=d(function(a){return ma(P(arguments),A["/"],a)}),da(["abs","acos","asin","atan","atan2","cos","max","min","sin","tan","pow","round","floor","ceil","sqrt","log","exp"],function(a){b[a]=d(t(Math[a],Math))}),da({u:{pos:"+",neg:"-",not:"!",bitwiseNot:"~"},bi:{eqStrict:"===",neqStrict:"!==",eq:"==",neq:"!=",gt:">",ge:">=",lt:"<",le:"<=",xor:"^",bitwiseAnd:"&",bitwiseOr:"|",mod:"%",rightShift:">>",leftShift:"<<",unsignedRightShift:">>>"}},function(a,c){var e="u"===c?z:A;da(a,function(a,c){b[c]=d(e[a])})}),b.typeOf=d(function(a){return typeof a}),b.instanceOf=d(function(a,b){return a instanceof b})}(B),E=function(a){return a instanceof B},ga(Ma,{constraint:function(a,b){return new B(a,b)},Constraint:B,isConstraint:E,inFSM:function(a,b){return(new B).inFSM(a,b)},get:function(a,b){return E(a)?a.get(b):F(a)?a.toArray():G(a)?a.toObject():a},wait:t(Oa.wait,Oa),signal:t(Oa.signal,Oa),removeDependency:Oa.removeDependency,arrayDiff:Ga,version:"0.9.8-beta1",toString:function(){return"ConstraintJS v"+Ma.version},__debug:!0,noConflict:ca(a,"cjs")?function(){return a.cjs===Ma&&(a.cjs=La),Ma}:function(){return delete a.cjs,Ma}});var Pa=function(a){return T(a)&&Math.round(a)===a&&a>=0};C=function(a){a=ga({equals:ia,value:[]},a),this._value=ea(a.value,function(a){return new B(a,{literal:!0})}),this._unsubstantiated_items=[],this.$len=new B(this._value.length),this.$equality_check=new B(a.equals,{literal:!0})},function(b){var c=b.prototype;b.BREAK={};var d=function(a,b){var c=a._value[b];return void 0===c&&(c=new B(void 0,{literal:!0}),a._unsubstantiated_items[b]=c),c.get()},e=function(a,b,c){Ma.wait();var d=a._value[b];if(void 0===d&&a._unsubstantiated_items[b]&&(d=a._value[b]=a._unsubstantiated_items[b],delete a._unsubstantiated_items[b]),E(d)){d.get();d.set(c)}else a._value[b]=new B(c,{literal:!0});return h(a),Ma.signal(),c},f=function(a,b){var c;for(Ma.wait();a._value.length>0;){c=a._value.pop();a._value.length;E(c)&&c.destroy(b)}return h(a,b),Ma.signal(),this},h=function(a,b){a.$len.set(a._value.length,b?{silent:!0}:!1)};c.setEqualityCheck=function(a){return this.$equality_check.set(a),this},c.forEach=function(c,e){var f,g=this.length();for(e=e||a,f=0;g>f;f+=1)if(c.call(e,d(this,f),f)===b.BREAK)return this;return this},c.map=function(b,c){var d=[];return c=c||a,this.forEach(function(a,e){d[e]=b.call(c,a,e)}),d},c.setValue=function(a){return Ma.wait(),f(this),this.push.apply(this,a),Ma.signal(),this},c.item=function(a,b){return 0===arguments.length?this.toArray():1===arguments.length?d(this,a):arguments.length>1?e(this,a,b):void 0},c.destroy=function(a){f(this,a),this.$len.destroy(a)},c.length=function(){return this.$len.get()},c.push=function(){var a,b=arguments.length,c=this._value.length;for(Ma.wait(),a=0;b>a;a++)e(this,c+a,arguments[a]);return Ma.signal(),this.length()},c.pop=function(){var a,b=this._value.pop();return Ma.wait(),E(b)&&(a=b.get(),b.destroy()),h(this),Ma.signal(),a},c.toArray=function(){return this.map(_)},c.indexWhere=function(a,b){var c,d,e=this.length();for(b=b||this,c=0;e>c;c+=1)if(d=this._value[c],a.call(b,d.get(),c))return c;return-1},c.lastIndexWhere=function(a,b){var c,d,e=this.length();for(b=b||this,c=e-1;c>=0;c-=1)if(d=this._value[c],a.call(b,d.get(),c))return c;return-1},c.indexOf=function(a,b){b=b||this.$equality_check.get();var c=function(c){return b(c,a)};return this.indexWhere(c)},c.lastIndexOf=function(a,b){b=b||this.$equality_check.get();var c=function(c){return b(c,a)};return this.lastIndexWhere(c)},c.some=function(a,b){return this.indexWhere(a,b)>=0},c.every=function(a,c){var d=!0;return this.forEach(function(){return a.apply(c,arguments)?void 0:(d=!1,b.BREAK)}),d},c.splice=function(a,b){var c;if(T(b)||(b=0),!Pa(a)||!Pa(b))throw new Error("index and howmany must be positive integers");var f=g.call(arguments,2),i=f.length;Ma.wait();var j=i-b,k=ea(this._value.slice(a,a+b),function(a){return a?a.get():void 0});if(0>j){var l=this._value.length,m=a+i,n=l+j;for(c=a;m>c;c+=1)e(this,c,f[c-a]);for(;n>c;c+=1)e(this,c,d(this,c-j));for(;l>c;c+=1){var o=this._value.pop();E(o)&&o.destroy()}}else for(c=this._value.length+j-1;c>=a;c-=1)a+i>c?e(this,c,f[c-a]):e(this,c,d(this,c-j));return 0!==j&&h(this),Ma.signal(),k},c.shift=function(){var a=this.splice(0,1);return a[0]},c.unshift=function(){return this.splice.apply(this,[0,0].concat(aa(arguments))),this.length()},c.concat=function(){var a=ea(arguments,function(a){return F(a)?a.toArray():a}),b=this.toArray();return b.concat.apply(b,a)},c.slice=function(){var a=this._value.slice.apply(this._value,arguments);return ea(a,function(a){return a?a.get():void 0})},c.itemConstraint=function(a){return new B(function(){return this.item(Ma.get(a))},{context:this})},da(["filter","join","sort","reverse","toString"],function(a){c[a]=function(){var b=this.toArray();return b[a].apply(b,arguments)}})}(C),F=function(a){return a instanceof C},ga(Ma,{array:function(a){return new C(a)},ArrayConstraint:C,isArrayConstraint:F});var Qa=function(a){return a+""},Ra=function(a){return function(b){return b[a]()}};D=function(a){a=ga({hash:Qa,valuehash:!1,equals:ia,valueequals:ia,value:{},keys:[],values:[],literal_values:!1,create_unsubstantiated:!0},a),a.keys=L(a.keys),a.values=L(a.values);var b={};da(a.keys,function(a){b[a]=!0}),da(a.value,function(c,d){b[d]||(a.keys.push(d),a.values.push(c))},this),b=!1,this._default_literal_values=!!a.literal_values,this.$equality_check=new B(a.equals,{literal:!0}),this.$vequality_check=new B(a.valueequals,{literal:!0}),this._hash=W(a.hash)?Ra(a.hash):a.hash,this._create_unsubstantiated=a.create_unsubstantiated,this._khash={},a.valuehash?(this._vhash={},V(a.valuehash)?this._valuehash=a.valuehash:W(a.valuehash)?this._valuehash=Ra(a.valuehash):this._valuehash=Qa):this._vhash=!1;var c=this._default_literal_values;this._ordered_values=ea(a.keys,function(b,d){var e=a.values[d],f={key:new B(b,{literal:!0}),value:new B(e,{literal:c}),index:new B(d,{literal:!0})},g=this._hash(b),h=this._khash[g];if(h?h.push(f):this._khash[g]=[f],this._vhash){var i=this._valuehash(e),j=this._vhash[i];j?j.push(f):this._vhash[i]=[f]}return f},this),this._unsubstantiated_values={},this.$keys=new B(function(){var a=[];return this.forEach(function(b,c,d){a[d]=c}),a},{context:this}),this.$values=new B(function(){var a=[];return this.forEach(function(b,c,d){a[d]=b}),a},{context:this}),this.$entries=new B(function(){var a=[];return this.forEach(function(b,c,d){a[d]={key:c,value:b}}),a},{context:this}),this.$size=new B(function(){return this._ordered_values.length},{context:this})},function(a){a.BREAK=C.BREAK;var b=a.prototype,c=function(a,b,c,d){var e=this._hash(a),f={h:e,hv:!1,i:-1,ui:-1,uhv:!1},g=this.$equality_check.get(),h=function(b,c){return g(b.key.get(),a)},i=this._khash[e];if(i){var j=ha(i,h);if(f.hv=i,j>=0)return f.i=j,f}if(b!==!1){var k=this._unsubstantiated_values[e],l=-1;if(k&&(f.uhv=k,l=ha(k,h),l>=0))return f.ui=l,f;if(c===!0){var m=(this._default_literal_values,{key:new B(a,{literal:!0}),value:new B(void 0,{literal:void 0===d?this._default_literal_values:!!d}),index:new B(-1,{literal:!0})});k?(l=k.length,k[l]=m):(l=0,this._unsubstantiated_values[e]=k=[m])}f.uhv=k||!1,f.ui=l}return f},d=function(a,b,c,d,f){var g,h,i,j,k=a.i,l=a.hv,m=a.h;if(k>=0){if(j=l[k],this._vhash){var n=j.value.get(),o=this._valuehash(n),p=this._vhash[o];if(h=this._valuehash(c),p){var q=p.length;for(g=0;q>g;g+=1)if(p[g]===j){p.splice(g,1),0===p.length&&delete this._vhash[o];break}}i=this._vhash[h],i?i.push(j):this._vhash[h]=[j]}if(j.value.set(c),Pa(d)){var r=j.index.get();if(r!==d){this._ordered_values.splice(r,1),this._ordered_values.splice(d,0,j);var s=Math.min(r,d),t=Math.max(r,d);for(g=s;t>=g;g+=1)e(this._ordered_values[g],g);this.$keys.invalidate()}}}else{Pa(d)||(d=this._ordered_values.length);var u=a.ui;if(u>=0){var v=a.uhv,w=v[u];v.splice(u,1),0===v.length&&delete this._unsubstantiated_values[m],j=w}else j={key:new B(b,{literal:!0}),value:new B(c,{literal:void 0===f?this._default_literal_values:!!f}),index:new B(d,{literal:!0})};for(l?l.push(j):l=this._khash[m]=[j],this._vhash&&(h=this._valuehash(c),i=this._vhash[h],i?i.push(j):this._vhash[h]=[j]),this._ordered_values.splice(d,0,j),u>=0&&(j.value.set(c),j.index.set(d)),g=d+1;g<this._ordered_values.length;g+=1)e(this._ordered_values[g],g);this.$size.invalidate(),this.$keys.invalidate()}this.$values.invalidate(),this.$entries.invalidate()},e=function(a,b){a.index.set(b)},f=function(a,b){da(a,function(a){a.key.destroy(b),a.value.destroy(b),a.index.destroy(b)})},g=function(a,b){this._ordered_values[a];f(this._ordered_values.splice(a,1),b),b!==!0&&this.$size.invalidate()};b.keys=function(){return this.$keys.get()},b.values=function(){return this.$values.get()},b.entries=function(){return this.$entries.get()},b.size=function(){return this.$size.get()},b.isEmpty=function(){return 0===this.size()},b.put=function(a,b,e,f){Ma.wait();var g=c.call(this,a,!0,!1,f);return d.call(this,g,a,b,e,f),Ma.signal(),this},b.remove=function(a,b){var d,f,h,i,j,k=c.call(this,a,!1,!1),l=k.i,m=k.hv;if(l>=0){if(Ma.wait(),f=m[l],h=f.index.get(),m.splice(l,1),0===m.length&&delete this._khash[k.h],this._vhash&&(i=this._valuehash(f.value.get()),j=this._vhash[i])){var n=j.length;for(d=0;n>d;d+=1)if(j[d]===f){j.splice(d,1),0===j.length&&delete this._vhash[i];break}}for(g.call(this,h,b),d=h;d<this._ordered_values.length;d+=1)e(this._ordered_values[d],d);b||(this.$size.invalidate(),this.$keys.invalidate(),this.$values.invalidate(),this.$entries.invalidate()),Ma.signal()}return this},b.get=function(a){var b=c.call(this,a,!0,this._create_unsubstantiated),d=b.i,e=b.hv;if(d>=0){var f=e[d];return f.value.get()}if(this._create_unsubstantiated){var g=b.uhv[b.ui];return g.value.get()}return void 0},b.item=function(a,b,c){return 0===arguments.length?this.toObject():1===arguments.length?this.get(a):this.put(a,b,c)},b.itemConstraint=function(a){return new B(function(){return this.get(Ma.get(a))},{context:this})},b.clear=function(a){if(this.size()>0){for(Ma.wait();this._ordered_values.length>0;)g.call(this,0,a);da(this._khash,function(a,b){delete this._khash[b]},this),this._vhash&&da(this._vhash,function(a,b){delete this._vhash[b]},this),a||(this.$keys.invalidate(),this.$values.invalidate(),this.$entries.invalidate(),this.$size.invalidate()),Ma.signal()}return this},b.forEach=function(b,c){var d,e,f=this.size(),g=this._ordered_values.slice();for(c=c||this,d=0;f>d&&(e=g[d],!e||b.call(c,e.value.get(),e.key.get(),e.index.get())!==a.BREAK);d+=1);return this},b.setEqualityCheck=function(a){return this.$equality_check.set(a),this},b.setValueEqualityCheck=function(a){return this.$vequality_check.set(a),this},b.setHash=function(a){Ma.wait(),this._hash=W(a)?Ra(a):a,this._khash={},da(this._ordered_values,function(a){var b=a.key.get(),c=this._hash(b),d=this._khash[c];d?d.push(a):this._khash[c]=[a]},this);var b={};return da(this._unsubstantiated_values,function(a){da(a,function(a){var c=a.key.get(),d=this._hash(c),e=this.new_unsubstatiated_values[d];e?e.push(a):b[d]=[a]},this)},this),this._unsubstantiated_values=b,Ma.signal(),this},b.setValueHash=function(a){return this._valuehash=W(a)?Ra(a):a,this._vhash={},this._valuehash&&da(this._ordered_values,function(a){var b=a.value.get(),c=this._valuehash(b),d=this._vhash[c];d?d.push(a):this._vhash[c]=[a]},this),this},b.indexOf=function(a){var b=c.call(this,a,!0,this._create_unsubstantiated),d=b.i,e=b.hv;if(d>=0){var f=e[d];return f.index.get()}if(b.ui>=0){var g=b.uhv[b.ui];return g.index.get()}return-1},b.getOrPut=function(a,b,e,f,g){var h,i,j,k=c.call(this,a,!0,!1,g),l=k.i,m=k.hv;k.h;return l>=0?(j=m[l],j.value.get()):(Ma.wait(),h=e||this,i=b.call(h,a),d.call(this,k,a,i,f,g),Ma.signal(),i)},b.has=function(a){var b=c.call(this,a,!0,this._create_unsubstantiated),d=b.i;if(d>=0)return!0;if(this._create_unsubstantiated){var e=b.uhv[b.ui];return e.index.get(),!1}return!1},b.moveIndex=function(a,b){var c;Ma.wait();var d=this._ordered_values[a];this._ordered_values.splice(a,1),this._ordered_values.splice(b,0,d);var f=Math.min(a,b),g=Math.max(a,b);for(c=f;g>=c;c+=1)e(this._ordered_values[c],c);return this.$keys.invalidate(),this.$values.invalidate(),this.$entries.invalidate(),Ma.signal(),this},b.move=function(a,b){var d=c.call(this,a,!1,!1),e=d.i;if(e>=0){var f=d.hv[e];this.moveIndex(f.index.get(),b)}return this},b.keyForValue=function(b,c){c=c||this.$vequality_check.get();var d;if(this._vhash){var e=this._valuehash(b),f=this._vhash[e];if(f){var g=f.length;for(d=0;g>d;d+=1){var h=f[d];if(c(h.value.get(),b))return h.key.get()}}return void 0}var i;return this.forEach(function(d,e){return c(b,d)?(i=e,a.BREAK):void 0}),i},b.destroy=function(a){Ma.wait(),this.clear(a),this.$equality_check.destroy(a),this.$vequality_check.destroy(a),this.$keys.destroy(a),this.$values.destroy(a),this.$entries.destroy(a),this.$size.destroy(a),Ma.signal()},b.toObject=function(a){var b={};return a=a||_,this.forEach(function(c,d){b[a(d)]=c}),b}}(D),G=function(a){return a instanceof D},ga(Ma,{map:function(a,b){return new D(a,b)},MapConstraint:D,isMapConstraint:G}),ga(Ma,{liven:function(b,c){c=ga({context:a,run_on_create:!0,pause_while_running:!1,priority:!1,on_destroy:!1},c);var d,e=new B(b,{context:c.context,cache_value:!1,auto_add_outgoing_dependencies:!1,run_on_add_listener:!1}),f=!1,g=function(){e.invalidate()},h=function(a){c.on_destroy&&c.on_destroy.call(c.context,a),e.destroy(a)},i=function(){return f===!1?(f=!0,e.offChange(d),!0):!1},j=function(){return f===!0?(f=!1,e.onChangeWithPriority(c.priority,d),c.run_on_create!==!1&&(Oa.semaphore>=0?e.get(!1):da(e._changeListeners,Oa.add_in_call_stack,Oa)),!0):!1};d=function(){c.pause_while_running&&i(),e.get(),c.pause_while_running&&j()},e.onChangeWithPriority(c.priority,d);var k={destroy:h,pause:i,resume:j,run:function(a){return d(a),this},invalidate:g,_constraint:e};return c.run_on_create!==!1&&(Oa.semaphore>=0?e.get(!1):da(e._changeListeners,Oa.add_in_call_stack,Oa)),k}});var Sa=function(){var a,b=arguments.length,c="";for(a=0;b>a;a+=1)c+=arguments[a];return c},Ta=function(a,b){var c,d=a.length;if(d===b.length){for(c=0;d>c;c+=1){var e=a[c],f=b[c];if(e!==f)return!1}return!0}return!1};ga(Ma,{memoize:function(b,c){c=ga({hash:Sa,equals:Ta,context:a,literal_values:!0},c),c.args_map=new D({hash:c.hash,equals:c.equals,literal_values:c.literal_values});var d=function(){var a=g.call(arguments),d=c.args_map.getOrPut(a,function(){return new B(function(){return b.apply(c.context,a)})});return d.get()};return d.destroy=function(a){c.args_map.forEach(function(b){b.destroy(a)}),c.args_map.destroy(a)},d.each=function(a){c.args_map.forEach(a)},d.options=c,d}});var Ua=function(a){if(Z(a))return a;var b=w.createTextNode(a);return b},Va=function(a,b,c){var d=b.childNodes;if(d.length<=c)b.appendChild(a);else{var e=d[c];b.insertBefore(a,e)}},Wa=function(a,b){var c,d=a.childNodes;return d.length>b?(c=d[b],a.removeChild(c),c):void 0},Xa=function(a,b,c){var d=a.childNodes;if(d.length>c){var e=d[c];return a&&(b>c&&b++,Va(e,a,b)),e}},Ya=function(b){return ca(a,"jQuery")?b instanceof a.jQuery:!1},Za=a.NodeList||!1,$a=Za?function(a){return a instanceof Za}:function(){return!1},_a=function(b){return U(b)?b:E(b)?_a(b.get()):F(b)?b.toArray():G(b)?b.values():Ya(b)?a.jQuery.makeArray(b):$a(b)?aa(b):[b]},ab=function(a){this.options=a,this.targets=a.targets;var b,c,d=a.setter,e=a.getter,f=a.init_val,g=function(){this._timeout_id=!1;var e=fa(_a(this.targets),Z);ca(a,"onChange")&&a.onChange.call(this,b,c),da(e,function(a){d.call(this,a,b,c)},this),c=b};this._throttle_delay=!1,this._timeout_id=!1,c=V(f)?f(_a(this.targets[0])):f,this.$live_fn=Ma.liven(function(){b=e(),this._throttle_delay?this._timeout_id||(this._timeout_id=x(t(g,this),this._throttle_delay)):g.call(this)},{context:this})};!function(a){var b=a.prototype;b.pause=function(){return this.$live_fn.pause(),this},b.resume=function(){return this.$live_fn.resume(),this},b.throttle=function(a){return this._throttle_delay=a>0?a:!1,this._timeout_id&&!this._throttle_delay&&(y(this._timeout_id),this._timeout_id=!1),this.$live_fn.run(),this},b.destroy=function(){this.$live_fn.destroy(),this.options.onDestroy&&this.options.onDestroy(),this.options.coreDestroy&&this.options.coreDestroy()}}(ab);var bb=function(a,b,c){return function(d){var e=g.call(arguments,1),f=Ma(function(){return a(e)}),h=new ab({targets:d,getter:t(f.get,f),setter:b,init_val:c,coreDestroy:function(){f.destroy()}});return h}},cb=function(a){return bb(function(a){return ea(a,Ma.get).join("")},function(b,c){a(b,c)})},db=function(a){return function(b){var c,d=g.call(arguments,1);if(0!==d.length){1===d.length?c=d[0]:d.length>1&&(c={},c[d[0]]=d[1]);var e=new ab({targets:b,setter:function(b,c){da(c,function(c,d){a(b,d,c)})},getter:function(){if(G(c))return c.toObject();var a={};return da(c,function(b,c){a[c]=Ma.get(b)}),a}});return e}}},eb=cb(function(a,b){c(a,b)}),fb=cb(function(a,b){a.innerHTML=b}),gb=cb(function(a,b){a.val=b}),hb=bb(function(a){return S(ea(a,Ma.get),!0)},function(a,b,c){var d=Ga(c,b),e=" "+a.className+" ";da(d.removed,function(a){e=e.replace(" "+a.from_item+" "," ")}),e+=ea(d.added,function(a){return a.item}).join(" "),e=v(e),a.className=e},[]),ib=bb(function(a){var b=ea(a,Ma.get);return ea(S(b,!0),Ua)},function(a,b,c){var d=Ga(c,b);da(d.removed,function(b){var c=Wa(a,b.from);this.options.onRemove&&this.options.onRemove.call(this,c,b.from)},this),da(d.added,function(b){var c=b.item;Va(c,a,b.to),this.options.onAdd&&this.options.onAdd.call(this,c,b.to)},this),da(d.moved,function(b){var c=Xa(a,b.to_index,b.from_index);this.options.onMove&&this.options.onMove.call(this,c,b.to_index,b.from_index)},this),this.options.onIndexChange&&da(d.index_changed,function(a){this.options.onIndexChange.call(this,a.item,a.to,a.from)},this)},function(a){return aa(a.childNodes)}),jb=db(function(a,b,c){a.style[Ka(b)]=c}),kb=db(function(a,b,c){Qb[b]&&!c?a.removeAttribute(b):a.setAttribute(b,c)}),lb=["keyup","input","paste","propertychange","change"],mb=function(a){var b;Y(a)?(a=[a],b=!1):b=!0;var c=Ma(function(){return b?ea(a,function(a){return a.value}):a[0].value}),d=(a.length,t(c.invalidate,c)),e=function(){da(lb,function(b){da(a,function(a){H(a,b,d)})})},f=function(){da(lb,function(b){da(a,function(a){I(a,b,d)})})},g=c.destroy;return c.destroy=function(){f(),g.call(c)},e(),c};ga(Ma,{bindText:eb,bindHTML:fb,bindValue:gb,bindChildren:ib, | ||
bindAttr:kb,bindCSS:jb,bindClass:hb,inputValue:mb,Binding:ab});var nb=function(a,b){this._fsm=a,this._name=b,this._id=K()};!function(a){var b=a.prototype;b.getName=function(){return this._name},b.id=function(){return this._id}}(nb);var ob=function(a,b,c,d){this._fsm=a,this._from=b,this._to=c,this._name=d,this._id=K(),this._event=!1};!function(a){var b=a.prototype;b.getFrom=function(){return this._from},b.getTo=function(){return this._to},b.getName=function(){return this._name},b.getFSM=function(){return this._fsm},b.id=function(){return this._id},b.destroy=function(){var a=this._event;a&&a._removeTransition(this),delete this._event,delete this._fsm,delete this._from,delete this._to},b.setEvent=function(a){this._event=a},b.run=function(){var a=this.getFSM();if(a&&a.is(this.getFrom())){var b=aa(arguments);b.unshift(this.getTo(),this),a._setState.apply(a,b)}}}(ob);var pb=function(a){this._state_name=a};!function(a){var b=a.prototype;b.matches=function(a){return this._state_name===a||a instanceof nb&&this._state_name===a.getName()}}(pb);var qb=function(){};!function(a){var b=a.prototype;b.matches=function(a){return!(a instanceof ob)}}(qb);var rb=function(a,b,c){this.is_pre=a,this.from_state_selector=b,this.to_state_selector=c};!function(a){var b=a.prototype;b.matches=function(a,b){if(a instanceof ob&&this.is_pre===b){var c=a.getFrom(),d=a.getTo();return this.from_state_selector.matches(c)&&this.to_state_selector.matches(d)}return!1}}(rb);var sb=function(){this.selectors=aa(arguments)};!function(a){var b=a.prototype;b.matches=function(){var a=arguments;return O(this.selectors,function(b){return b.matches.apply(b,a)})}}(sb);var tb=function(a){return"*"===a?new qb:new pb(a)},ub=function(a){var b=ea(a.split(","),function(a){return v(a)});if(1===b.length)return tb(b[0]);var c=ea(b,tb);return new sb(c)},vb=function(a,b,c){var d,e,f=ub(a),g=ub(c);return"<->"===b?(d=new rb(!1,f,g),e=new rb(!1,g,f),new sb(d,e)):">-<"===b?(d=new rb(!0,f,g),e=new rb(!0,g,f),new sb(d,e)):"->"===b?new rb(!1,f,g):">-"===b?new rb(!0,f,g):"<-"===b?new rb(!1,g,f):"-<"===b?new rb(!0,g,f):null},wb=/^([\sa-zA-Z0-9,\-_*]+)((<->|>-<|->|>-|<-|-<)([\sa-zA-Z0-9,\-_*]+))?$/,xb=function(a){var b=a.match(wb);if(null===b)return null;if(b[2]){var c=b[1],d=b[3],e=b[4];return vb(c,d,e)}var f=b[1];return ub(f)},yb=0,zb=function(b,c,d){this._context=d||a,this._selector=b,this._callback=c,this._id=yb++};!function(a){var b=a.prototype;b.interested_in=function(){return this._selector.matches.apply(this._selector,arguments)},b.run=function(){this._callback.apply(this._context,arguments)}}(zb);var Ab=function(){this._states={},this._transitions=[],this._curr_state=null,this._listeners=[],this._chain_state=null,this._did_transition=!1,this.state=Ma(function(){return this._curr_state?this._curr_state._name:null},{context:this}),this.addState.apply(this,S(arguments,!0))};!function(a){var b=a.prototype,c=function(a,b){return a._states[b]};b.addState=function(){var a;return da(arguments,function(b){a=c(this,b),a||(a=this._states[b]=new nb(this,b),null===this._curr_state&&(this._curr_state=a))},this),a&&(this._chain_state=a),this},b.getState=function(){return this.state.get()},b.addTransition=function(a,b,c){var d,e,f,g,h=!1;if(0===arguments.length)throw new Error("addTransition expects at least one argument");return 1===arguments.length?(h=!0,d=this._chain_state,e=a):2===arguments.length?V(b)||b instanceof Bb?(d=this._chain_state,e=a,g=b):(d=a,e=b,h=!0):(d=a,e=b,g=c),W(d)&&!ca(this._states,d)&&(this._states[d]=new nb(this,d)),W(e)&&!ca(this._states,e)&&(this._states[e]=new nb(this,e)),f=new ob(this,d,e),this._transitions.push(f),h?t(f.run,f):(g instanceof Bb?(g._addTransition(f),f.setEvent(g)):g.call(this,t(f.run,f),this),this)},b._setState=function(a,b,d){var e=this.getState(),f=W(a)?c(this,a):a,g=this._listeners.length>0?[d,b,f,e].concat(P(arguments,3)):!1;if(!f)throw new Error("Could not find state '"+a+"'");this.did_transition=!0,da(this._listeners,function(a){a.interested_in(b,!0)&&a.run.apply(a,g)}),this._curr_state=f,this.state.invalidate(),da(this._listeners,function(a){(a.interested_in(b,!1)||a.interested_in(f))&&a.run.apply(a,g)})},b.destroy=function(){this.state.destroy(),this._states={},da(this._transitions,function(a){a.destroy()}),this._transitions=[],this._curr_state=null},b.startsAt=function(a){var b=c(this,a);return b||(b=this._states[a]=new nb(this,a)),this.did_transition||(this._curr_state=b,this.state.invalidate()),this._chain_state=b,this},b.is=function(a){var b=this.getState();return null===b?!1:b===(W(a)?a:a.getName())},b.on=b.addEventListener=function(a,b,c){var d;if(W(a)){if(d=xb(a),null===d)throw new Error("Unrecognized format for state/transition spec.")}else d=a;var e=new zb(d,b,c);return this._listeners.push(e),this},b.off=b.removeEventListener=function(a){return this._listeners=fa(this._listeners,function(b){return b.callback!==a}),this}}(Ab),ga(Ma,{FSM:Ab,fsm:function(){return new Ab(arguments)},isFSM:function(a){return a instanceof Ab}});var Bb=function(a,b,c,d){this._listeners=[],this._transitions=[],this._on_add_transition=c,this._on_remove_transition=d,this._live_fns={},this._parent=a,this._parent&&this._parent._listeners.push({event:this,filter:b})};!function(b){var c=b.prototype;c.guard=function(a,b){if(!V(a)){var c=a;a=function(a){return a&&a[c]===b}}return new Bb(this,a)},c._addTransition=function(a){this._transitions.push(a),this._on_add_transition&&(this._live_fns[a.id()]=this._on_add_transition(a)),this._parent&&this._parent._on_add_transition&&this._parent._on_add_transition(a)},c._removeTransition=function(a){if(ka(this._transitions,a)&&this._on_remove_transition){this._on_remove_transition(a);var b=a.id();this._live_fns[b].destroy(),delete this._live_fns[b]}this._parent&&this._parent._on_remove_transition&&this._parent._on_remove_transition(a)},c._fire=function(){var b=arguments;da(this._transitions,function(a){a.run.apply(a,b)}),da(this._listeners,function(c){var d=c.event,e=c.filter;(!e||e.apply(a,b))&&d._fire.apply(d,b)})}}(Bb);var Cb=function(b){return b===a||Lc(b)},Db=function(a){return ea(a.split(" "),v)},Eb="timeout";ga(Ma,{CJSEvent:Bb,on:function(b){var c=arguments.length>1?P(arguments):a,d=new Bb(!1,!1,function(a){var d=[],e=!1,f=[],g=t(this._fire,this),h=a.getFSM(),i=a.getFrom(),j=new pb(i),k=new rb(!0,j,new qb),l=function(){da(f,function(a){if(a===Eb){e&&(y(e),e=!1);var b=Ma.get(c[0]);(!T(b)||0>b)&&(b=0),e=x(g,b)}else da(d,function(b){H(b,a,g)})})},m=function(){da(f,function(a){da(d,function(b){a===Eb?e&&(y(e),e=!1):I(b,a,g)})})},n=Ma.liven(function(){m(),f=Db(Ma.get(b)),d=S(ea(fa(_a(c),Cb),Nc,!0)),h.on(j,l).on(k,m),h.is(i)&&l()});return n});return d}});var Fb=function(a){var b={};return da(a.split(","),function(a){b[a]=!0}),b},Gb=/^<([\-A-Za-z0-9_]+)((?:\s+[a-zA-Z0-9_\-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^>\s]+)))?)*)\s*(\/?)>/,Hb=/^<\/([\-A-Za-z0-9_]+)[^>]*>/,Ib=/^\{\{([#=!>|{\/])?\s*((?:(?:"[^"]*")|(?:'[^']*')|[^\}])*)\s*(\/?)\}?\}\}/,Jb=/([\-A-Za-z0-9_]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^\/>\s]+)))?/g,Kb="hb",Lb="html",Mb=Fb("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed"),Nb=Fb("address,applet,blockquote,button,center,dd,del,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul"),Ob=Fb("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"),Pb=Fb("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"),Qb=Fb("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),Rb=Fb("script,style"),Sb="if",Tb="elif",Ub="else",Vb="state",Wb="each",Xb="with",Yb="fsm",Zb="unless",$b={};$b[Vb]={parent:[Yb]},$b[Tb]={parent:[Sb]},$b[Ub]={parent:[Sb,Wb]};var _b={};_b[Tb]={when_open_sibling:[Tb,Ub]},_b[Ub]={when_close_parent:[Sb,Wb],when_open_sibling:[]},_b[Vb]={when_open_sibling:[Vb]};var ac={};ac[Tb]={follows:[Tb],or_parent:[Sb]},ac[Ub]={follows:[Tb],or_parent:[Sb,Wb]},ac[Vb]={follows:[Vb],or_parent:[Yb]};var bc=function(a,b){function c(a,c,e,f){if(c=c.toLowerCase(),Nb[c])for(;n.last()&&Ob[n.last()];)d("",n.last());if(Pb[c]&&n.last()==c&&d("",c),f=Mb[c]||!!f,f||n.push({type:Lb,tag:c}),b.startHTML){var g=[];e.replace(Jb,function(a,b){var c=arguments[2]?arguments[2]:arguments[3]?arguments[3]:arguments[4]?arguments[4]:Qb[b]?b:"";g.push({name:b,value:c,escaped:c.replace(/(^|[^\\])"/g,'$1\\"')})}),b.startHTML(c,g,f)}}function d(a,b){g(b,Lb)}function e(){var a,b;for(a=n.length-1;a>=0;a--)if(b=n[a],b.type===Kb)return b;return void 0}function f(a,c,d){var f,h,i=rd(d);switch(i.type===Uc?i.body.length>0&&i.body[0].type===Vc&&(h=i.body[0].name):i.type===Vc&&(h=i.name),c){case"{":b.startHB(h,i,!0,!0);break;case">":b.partialHB(h,i);break;case"#":if(f=e(),f&&ca(_b,f.tag)){var k=_b[f.tag];ja(k.when_open_sibling,h)>=0&&(g(f.tag,Kb),f=e())}if(ca($b,h)){var l=$b[h];if(!f||ja(l.parent,f.tag)<0)throw new Error("'"+h+"' must be inside of a '"+l.parent+"' block")}if(ca(ac,h)){var m=ac[h];if(ja(m.follows,j)<0&&(!m.or_parent||ja(m.or_parent,f.tag)<0)){var o="'"+h+"' must follow a '"+m.follows[0]+"'";throw m.or_parent&&(o+=" or be inside of a '"+m.or_parent[0]+"' tag"),new Error(o)}}n.push({type:Kb,tag:h}),b.startHB(h,i,!1);break;case"/":g(h,Kb);break;case"!":break;default:b.startHB(h,i,!0,!1)}}function g(a,c){var d,e,f;for(e=n.length-1;e>=0&&(n[e].type!==c||n[e].tag!==a);e-=1);if(e>=0){for(d=n.length-1;d>=e;d--)f=n[d],f.type===Kb?b.endHB&&b.endHB(f.tag):b.endHTML&&b.endHTML(f.tag);n.length=e}c===Kb&&(j=a)}var h,i,j,k,l,m,n=[],o=a;n.last=function(){return this[this.length-1]};for(var p=function(a,c){return c=c.replace(/<!--(.*?)-->/g,"$1").replace(/<!\[CDATA\[(.*?)\]\]>/g,"$1"),b.chars&&b.chars(c),""};a;){if(l=!0,n.last()&&Rb[n.last()])a=a.replace(new RegExp("(.*)</"+n.last()+"[^>]*>"),p),d("",n.last());else if(0===a.indexOf("<!--")?(k=a.indexOf("-->"),k>=0&&(b.HTMLcomment&&b.HTMLcomment(a.substring(4,k)),a=a.substring(k+3),l=!1)):0===a.indexOf("</")?(m=a.match(Hb),m&&(a=a.substring(m[0].length),m[0].replace(Hb,d),l=!1)):0===a.indexOf("<")?(m=a.match(Gb),m&&(a=a.substring(m[0].length),m[0].replace(Gb,c),l=!1)):0===a.indexOf("{{")&&(m=a.match(Ib),m&&(a=a.substring(m[0].length),m[0].replace(Ib,f),l=!1)),l){h=a.indexOf("<"),i=a.indexOf("{{"),k=0>h?i:0>i?h:Math.min(h,i);var q=0>k?a:a.substring(0,k);a=0>k?"":a.substring(k),b.chars(q)}if(a==o)throw new Error("Parse Error: "+a);o=a}d()},cc=function(a){var b={children:[],type:ic},c=[b],d=!1,e=[],f=[];return bc(a,{startHTML:function(a,b,e){d={type:Lb,tag:a,attributes:b,unary:e,children:[]},N(c).children.push(d),e||c.push(d)},endHTML:function(a){d=c.pop()},HTMLcomment:function(a){d={type:jc,str:a},N(c).children.push(d)},chars:function(a){d={type:hc,str:a},N(c).children.push(d)},startHB:function(a,b,g,h){if(g)d={type:gc,obj:pc(b),literal:h,tag:a},N(c).children.push(d);else{var i=!0;switch(d={type:Kb,tag:a,children:[]},a){case Wb:d.parsed_content=qc(b),d.else_child=!1;break;case Zb:case Sb:d.reverse=a===Zb,d.sub_conditions=[],d.condition=qc(b),f.push(d);break;case Tb:case Ub:var j=N(c);j.type===Kb&&j.tag===Wb?j.else_child=d:N(f).sub_conditions.push(d),d.condition=a===Ub?oc:qc(b),i=!1;break;case Wb:case Yb:d.fsm_target=qc(b),d.sub_states={},e.push(d);break;case Vb:var k=b.body[1].name;N(e).sub_states[k]=d,i=!1;break;case Xb:d.content=qc(b)}i&&N(c).children.push(d),c.push(d)}},endHB:function(a){switch(a){case Sb:case Zb:f.pop();break;case Yb:e.pop()}c.pop()},partialHB:function(a,b){d={type:fc,tag:a,content:qc(b)},N(c).children.push(d)}}),b},dc=function(a){return a.type===gc&&a.literal},ec=function(a){return O(a,dc)},fc="partial_hb",gc="unary_hb",hc="chars",ic="root",jc="comment",kc="data-cjs-template-instance",lc=function(a){return a.outerHTML||function(a){var b,c=document.createElement("div");return c.appendChild(a.cloneNode(!0)),b=c.innerHTML,c=null,b}(a)},mc=function(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},nc=function(a,b,c,d){if(a){var e=[b.computed?sc(b,c,d):b.name];return Ma.isMapConstraint(a)?a.get(e):a[e]}return void 0},oc={},pc=function(a){return a.type===Uc?a.body[0]:a},qc=function(a){return{type:Uc,body:a.type===Uc?P(a.body):[]}},rc=function(a){return a.node||a.getNodes()},sc=function(b,c,d){var e,f,g,h,i,j,k;if(b)switch(b.type){case Yc:return Ma.get(N(d).this_exp);case Xc:return b.value;case $c:return e=z[b.operator],e?e(sc(b.argument,c,d)):void 0;case _c:case ad:return e=A[b.operator],e?e(sc(b.left,c,d),sc(b.right,c,d)):void 0;case Vc:if("@"===b.name.charAt(0)){for(j=b.name.slice(1),k=d.length-1;k>=0;k--)if(f=d[k].at,f&&ca(f,j)){i=f[j];break}}else i=Ma.isMapConstraint(c)?c.get(b.name):c[b.name];return E(i)?i.get():i;case Wc:return f=sc(b.object,c,d),nc(f,b.property,c,d);case Uc:return sc(b.body[0],c,d);case ed:return f=N(d).this_exp,nc(f,b.argument,c,d);case dd:return f=d&&d.length>1?d[d.length-2].this_exp:void 0,nc(f,b.argument,c,d);case bd:return sc(b.test,c,d)?sc(b.consequent,c,d):sc(b.alternate,c,d);case Zc:if(b.callee.type===Wc?(g=sc(b.callee.object,c,d),f=nc(g,b.callee.property,c,d)):(g=a,f=sc(b.callee,c,d)),f&&V(f))return h=ea(b.arguments,function(a){return sc(a,c,d)}),f.apply(g,h)}},tc=function(a){return mc(3===a.nodeType?b(a):lc(a))},uc=function(a,b,c){arguments;return Ma(function(){return ea(a,function(a){if(a.type===gc)return a.literal?sc(a.val,b,c):mc(sc(a.val,b,c)+"");var d=rc(a);return U(d)?ea(d,tc).join(""):tc(d)}).join("")})},vc=function(a,b){return Ma(function(){var b=[];return da(a,function(a){var c=rc(a);U(c)?b.push.apply(b,c):b.push(c)}),b})},wc=/^\{\{([^\}]+)\}\}/,xc=function(a,b,c){for(var d,e,f,g=!1,h=!1,i=[],j=0,k=!1;a.length>0;){if(d=a.indexOf("{"),0===d){if(e=a.match(wc)){i[j++]=Ma(u(sc,rd(e[1]),b,c)),a=a.substr(e[0].length),k=!1,g=!0;continue}d++}0>d&&(d=a.length),f=a.substr(0,d),a=a.substr(d),k?i[j-1]=i[j-1]+f:i[j++]=f,h=k=!0}return g?h||1!==i.length?Ma(function(){return ea(i,function(a){return E(a)?a.get():F(a)?a.join(" "):""+a}).join("")}):i[0]:i.join("")},yc={},zc=function(a,b){return a===b||a&&a.is_obj===yc&&a.key===b.key&&a.value===b.value},Ac=/^(data-)?cjs-out$/,Bc=/^(data-)?cjs-on-(\w+)$/,Cc=function(a,b){var c=P(arguments,2);da(a,function(a){ca(a,b)&&a[b].apply(a,c)})},Dc=function(a){Cc.apply(this,[a,"pause"].concat(P(arguments)))},Ec=function(a){Cc.apply(this,[a,"resume"].concat(P(arguments)))},Fc=function(a){Cc.apply(this,[a,"destroy"].concat(P(arguments)))},Gc=function(a){Cc.apply(this,[a,"onAdd"].concat(P(arguments)))},Hc=function(a){Cc.apply(this,[a,"onRemove"].concat(P(arguments)))},Ic=function(b,c,d,e){var f,g,h,i=b.type;if(i===hc)return{type:i,node:w.createTextNode(b.str)};if(i===ic||i===Lb){var j,k,l=arguments,m=[];if(f=ea(b.children,function(a){return Ic(a,c,d)}),i===ic)if(e)g=e;else{if(1===f.length&&b.children[0].type===Lb)return f[0];g=w.createElement("span")}else g=w.createElement(b.tag);if(da(b.attributes,function(a){var b=a.name,e=a.value;if(b.match(Ac))m.push(c[e]=mb(g));else if(j=b.match(Bc)){var f=j[2];H(g,f,t(c[e],Ma.get(N(d).this_exp)))}else{var h=xc(e,c,d);if(E(h))if("class"===a.name){var i=Ma(function(){var a=h.get();return a.split(" ")});m.push(h,i,hb(g,i))}else m.push(h,kb(g,b,h));else g.setAttribute(a.name,h)}}),ec(b.children)){var n=uc(f,c,d);k=fb(g,n),m.push(n,k)}else{var o=vc(f,l);k=ib(g,o),m.push(o,k)}return{node:g,type:i,onAdd:function(){Ec(m),Gc(f)},onRemove:function(){Dc(m),Hc(f)},pause:function(){Dc(f.concat(m))},resume:function(){Ec(f.concat(m))},destroy:function(){Fc(f.concat(m))}}}if(i===gc){var p,q,r=b.obj,s=Ma(function(){return sc(r,c,d)});if(!b.literal){var u=Ma.get(s);Lc(u)?p=Mc(u):(p=w.createTextNode(""+u),q=eb(p,s))}return{type:i,literal:b.literal,val:r,node:p,destroy:function(){q&&q.destroy(!0),s.destroy(!0)},pause:function(){q&&q.pause()},resume:function(){q&&q.resume()},onRemove:function(){this.pause()},onAdd:function(){this.resume()}}}if(i===Kb){var v=b.tag;if(v===Wb){var x,y=[],z=[];return h=[],{type:i,onRemove:function(){da(h,Hc)},onAdd:function(){da(h,Gc)},pause:function(){da(h,Dc)},resume:function(){da(h,Ec)},destroy:function(){da(h,Fc),h=[]},getNodes:function(){x=sc(b.parsed_content,c,d),F(x)&&(x=x.toArray()),U(x)?0===x.length&&b.else_child&&(x=[oc]):G(x)?(x=x.entries(),da(x,function(a){a.is_obj=yc})):(E(x)&&(x=x.get()),x=ea(x,function(a,b){return{key:b,value:a,is_obj:yc}}));var a=Ga(y,x,zc),e=[],f=[];y=x,da(a.index_changed,function(a){var b=z[a.from];b&&b.at&&b.at.index&&b.at.index.set(a.to)}),da(a.removed,function(a){var b=a.from,c=z[b];f.push.apply(f,h[b]),la(h,b),c&&c.at&&da(c.at,function(a){a.destroy(!0)})}),da(a.added,function(a){var f=a.item,g=a.to,i=f===oc,j=i?!1:f&&f.is_obj===yc?{this_exp:f.value,at:{key:Ma.constraint(f.key)}}:{this_exp:f,at:{index:Ma.constraint(g)}},k=i?d:d.concat(j),l=i?b.else_child.children:b.children,m=ea(l,function(a){return Ic(a,c,k)});h.splice(g,0,m),z.splice(g,0,j),e.push.apply(e,m)},this),da(a.moved,function(a){var b=a.from_index,c=a.to_index,d=(mdom[b],h[b]),e=z[b];la(h,b),h.splice(c,0,d),la(z,b),z.splice(c,0,e)}),Hc(f),Fc(f),Gc(e);var g=ea(h,function(a){var b=S(ea(a,function(a){return rc(a)}),!0);return b});return S(g,!0)}}}if(v===Sb||v===Zb){f=[],h=[];var A=-1;return{type:i,onRemove:function(){Hc(h)},onAdd:function(){Gc(h)},pause:function(){Dc(h)},resume:function(){Ec(h)},destroy:function(){A>=0&&(h=[],A=-1),da(f,Fc)},getNodes:function(){var a,e,g=b.sub_conditions.length,i=!!Ma.get(sc(b.condition,c,d)),j=!1;if(b.reverse&&(i=!i),i)a=0,j=b.children;else if(g>0)for(a=0;g>a;a++)if(i=b.sub_conditions[a],i.condition===oc||sc(i.condition,c,d)){j=i.children,a++;break}return A!==a&&Hc(h),j?(f[a]?h=f[a]:(j=0===a?b.children:b.sub_conditions[a-1].children,h=f[a]=ea(j,function(a){return Ic(a,c,d)})),e=S(ea(h,rc),!0)):e=h=[],A!==a&&Gc(h),A=a,e}}}if(v===Yb){var B={},C=!1;return h=[],{pause:function(){Dc(h)},resume:function(){Ec(h)},destroy:function(){C&&(Fc(h),h=[],C=!1)},onRemove:function(){this.pause()},onAdd:function(){this.resume()},type:i,getNodes:function(){var a,e=sc(b.fsm_target,c,d),f=e.getState(),g=function(a){return Ic(a,c,d)},i=[];C!==f&&Hc(h);for(a in b.sub_states)if(b.sub_states.hasOwnProperty(a)&&f===a){ca(B,a)||(B[a]=ea(b.sub_states[a].children,g)),h=B[a],i=S(ea(h,rc),!0);break}return C!==f&&Gc(h),C=f,i}}}if(v===Xb){var D=sc(b.content,c,d),I=d.concat({this_exp:D});return f=S(ea(b.children,function(a){return Ic(a,D,I)})),{pause:function(){Dc(f)},resume:function(){Ec(f)},onRemove:function(){Hc(f)},onAdd:function(){Gc(f)},destroy:function(){Fc(f)},node:S(ea(f,rc),!0)}}}else{if(i===fc){var J,K,L,M=b.content,O=function(){return M.type===Uc?ea(M.body,function(a){return sc(a,c,d)}):[sc(b.content,c,d)]},P=!1;if(ca(Jc,b.tag))J=Jc[b.tag],K=J.apply(a,O()),L=Tc(K);else{if(!ca(Kc,b.tag))throw new Error("Could not find partial with name '"+b.tag+"'");J=Kc[b.tag],L=J.apply(a,O()),K=L.node,P=!0}return{node:K,pause:function(){L&&L.pause(K)},destroy:function(){P?L.destroy(K):Ma.destroyTemplate(K)},onAdd:function(){L&&L.onAdd.apply(L,[K].concat(O()))},onRemove:function(){L&&L.onRemove(K)},resume:function(){L&&L.resume(K)}}}if(i===jc)return{node:w.createComment(b.str)}}return{node:[]}},Jc={},Kc={},Lc=function(a){return Ya(a)||$a(a)||Z(a)},Mc=function(a){return Ya(a)||$a(a)?a[0]:Z(a)?a:!1},Nc=function(a){return Ya(a)||$a(a)?aa(a):a},Oc=[],Pc=[],Qc=1,Rc=function(a,b){var c=this,d=Ic(c,a,[{this_exp:a}],Mc(b)),e=d.node,f=d.id=Qc++;return Pc[f]=d,Oc[f]=e,e.setAttribute(kc,f),e},Sc=function(a){var b=a.getAttribute(kc);return b||(b=ja(Oc,a)),b},Tc=function(a){var b=Sc(a);return b>=0?Pc[b]:!1};ga(Ma,{createTemplate:function(a){W(a)||(a=Ya(a)||$a(a)?a.length>0?v(b(a[0])):"":Y(a)?v(b(a)):""+a);var c=cc(a);return arguments.length>=2?Rc.apply(c,P(arguments)):t(Rc,c)},registerCustomPartial:function(a,b){return Kc[a]=function(){var a=Mc(b.createNode.apply(this,arguments));return{node:a,onAdd:function(){b.onAdd&&b.onAdd.apply(this,arguments)},onRemove:function(){b.onRemove&&b.onRemove.apply(this,arguments)},destroy:function(){b.destroyNode&&b.destroyNode.apply(this,arguments)},pause:function(){b.pause&&b.pause.apply(this,arguments)},resume:function(){b.resume&&b.resume.apply(this,arguments)}}},this},registerPartial:function(a,b){return Jc[a]=b,this},unregisterPartial:function(a){return delete Jc[a],delete Kc[a],this},destroyTemplate:function(a){var b=Sc(Mc(a)),c=b>=0?Pc[b]:!1;return c&&(delete Pc[b],c.destroy()),this},pauseTemplate:function(a){var b=Tc(a);return b&&b.pause(),this},resumeTemplate:function(a){var b=Tc(a);return b&&b.resume(),this},createParsedConstraint:function(a,b){return Ma(function(){try{var c=rd(Ma.get(a));return c.type===Xc?c.value:sc(c,b,[b])}catch(d){console.error(d)}})}});var Uc="Compound",Vc="Identifier",Wc="MemberExpression",Xc="Literal",Yc="ThisExpression",Zc="CallExpression",$c="UnaryExpression",_c="BinaryExpression",ad="LogicalExpression",bd="ConditionalExpression",cd="Array",dd="ParentExpression",ed="CurrLevelExpression",fd=46,gd=44,hd=39,id=34,jd=40,kd=41,ld=91,md=93,nd=63,od=59,pd=58,qd=function(a,b){var c=new Error(a+" at character "+b);throw c.index=b,c.dedscription=a,c},rd=function(){var a=!0,b={"-":a,"!":a,"~":a,"+":a},c={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},d=function(a){var b,c=0;for(var d in a)(b=d.length)>c&&a.hasOwnProperty(d)&&(c=b);return c},e=d(b),f=d(c),g={"true":!0,"false":!1,"null":null},h="this",i=function(a){return c[a]||0},j=function(a,b,c){var d="||"===a||"&&"===a?ad:_c;return{type:d,operator:a,left:b,right:c}},k=function(a){return a>=48&&57>=a},l=function(a){return 36===a||95===a||a>=65&&90>=a||64===a||a>=97&&122>=a},m=function(a){return 36===a||95===a||a>=65&&90>=a||a>=97&&122>=a||a>=48&&57>=a},n=function(a){for(var d,n,o=0,p=a.charAt,q=a.charCodeAt,r=function(b){return p.call(a,b)},s=function(b){return q.call(a,b)},t=a.length,u=function(){for(var a=s(o);32===a||9===a;)a=s(++o)},v=function(){var a,b,c=x();return u(),s(o)!==nd?c:(o++,a=v(),a||qd("Expected expression",o),u(),s(o)===pd?(o++,b=v(),b||qd("Expected expression",o),{type:bd,test:c,consequent:a,alternate:b}):void qd("Expected :",o))},w=function(){u();for(var b=a.substr(o,f),d=b.length;d>0;){if(c.hasOwnProperty(b))return o+=d,b;b=b.substr(0,--d)}return!1},x=function(){var a,b,c,d,e,f,g,h;if(f=y(),b=w(),!b)return f;for(e={value:b,prec:i(b)},g=y(),g||qd("Expected expression after "+b,o),d=[f,e,g];(b=w())&&(c=i(b),0!==c);){for(e={value:b,prec:c};d.length>2&&c<=d[d.length-2].prec;)g=d.pop(),b=d.pop().value,f=d.pop(),a=j(b,f,g),d.push(a);a=y(),a||qd("Expected expression after "+b,o),d.push(e,a)}for(h=d.length-1,a=d[h];h>1;)a=j(d[h-1].value,d[h-2],a),h-=2;return a},y=function(){var c,d,f;if(u(),c=s(o),c===fd&&47===a.charCodeAt(o+1))return o+=2,{type:ed,argument:y()};if(c===fd&&a.charCodeAt(o+1)===fd&&47===a.charCodeAt(o+2))return o+=3,{type:dd,argument:y()};if(k(c)||c===fd)return z();if(c===hd||c===id)return A();if(l(c)||c===jd)return D();for(d=a.substr(o,e),f=d.length;f>0;){if(b.hasOwnProperty(d))return o+=f,{type:$c,operator:d,argument:y(),prefix:!0};d=d.substr(0,--f)}return!1},z=function(){for(var a,b="";k(s(o));)b+=r(o++);if(s(o)===fd)for(b+=r(o++);k(s(o));)b+=r(o++);if(a=r(o),"e"===a||"E"===a){for(b+=r(o++),a=r(o),("+"===a||"-"===a)&&(b+=r(o++));k(s(o));)b+=r(o++);k(s(o-1))||qd("Expected exponent ("+b+r(o)+")",o)}return l(s(o))&&qd("Variable names cannot start with a number ("+b+r(o)+")",o),{type:Xc,value:parseFloat(b),raw:b}},A=function(){for(var a,b="",c=r(o++),d=!1;t>o;){if(a=r(o++),a===c){d=!0;break}if("\\"===a)switch(a=r(o++)){case"n":b+="\n";break;case"r":b+="\r";break;case"t":b+=" ";break;case"b":b+="\b";break;case"f":b+="\f";break;case"v":b+=""}else b+=a}return d||qd('Unclosed quote after "'+b+'"',o),{type:Xc,value:b,raw:c+b+c}},B=function(){var b,c=s(o),d=o;for(l(c)?o++:qd("Unexpected "+r(o),o);t>o&&(c=s(o),m(c));)o++;return b=a.slice(d,o),g.hasOwnProperty(b)?{type:Xc,value:g[b],raw:b}:b===h?{type:Yc}:{type:Vc,name:b}},C=function(a){for(var b,c,d=[];t>o;){if(u(),b=s(o),b===a){o++;break}b===gd?o++:(c=v(),c&&c.type!==Uc||qd("Expected comma",o),d.push(c))}return d},D=function(){var a,b;for(a=s(o),b=a===jd?E():B(),u(),a=s(o);a===fd||a===ld||a===jd;)o++,a===fd?(u(),b={type:Wc,computed:!1,object:b,property:B()}):a===ld?(b={type:Wc,computed:!0,object:b,property:v()},u(),a=s(o),a!==md&&qd("Unclosed [",o),o++):a===jd&&(b={type:Zc,arguments:C(kd),callee:b}),u(),a=s(o);return b},E=function(){o++;var a=v();return u(),s(o)===kd?(o++,a):void qd("Unclosed (",o)},F=function(){return o++,{type:cd,body:C(md)}},G=[];t>o;)d=s(o),d===od||d===gd?o++:d===ld&&(n=F())?G.push(n):(n=v())?G.push(n):t>o&&qd('Unexpected "'+r(o)+'"',o);return 1===G.length?G[0]:{type:Uc,body:G}};return n}();return Ma}(this);"undefined"!=typeof module&&module.exports&&(module.exports=cjs); | ||
/* constraintjs - v0.9.8-beta2 (http://cjs.from.so/) */ | ||
var cjs=function(a){"use strict";var b,c,d=Array.prototype,e=Object.prototype,f=(Function.prototype,String.prototype),g=d.slice,h=e.toString,i=d.concat,j=d.push,k=d.some,l=d.indexOf,m=(d.lastIndexOf,d.every),n=d.forEach,o=Object.keys,p=d.filter,q=d.reduce,r=d.map,s=f.trim,t=function(a,b){return function(){return a.apply(b,arguments)}},u=function(a){var b=P(arguments,1);return function(){return a.apply(this,b)}},v=function(a){return s?s.call(a):String(a).replace(/^\s+|\s+$/g,"")},w=a.document,x=function(b,c){return a.setTimeout(b,c)},y=function(b,c){return a.clearTimeout(b,c)},z={"+":function(a){return+a},"-":function(a){return-a},"~":function(a){return~a},"!":function(a){return!a}},A={"===":function(a,b){return a===b},"!==":function(a,b){return a!==b},"==":function(a,b){return a==b},"!=":function(a,b){return a!=b},">":function(a,b){return a>b},">=":function(a,b){return a>=b},"<":function(a,b){return b>a},"<=":function(a,b){return b>=a},"+":function(a,b){return a+b},"-":function(a,b){return a-b},"*":function(a,b){return a*b},"/":function(a,b){return a/b},"%":function(a,b){return a%b},"^":function(a,b){return a^b},"&&":function(a,b){return a&&b},"||":function(a,b){return a||b},"&":function(a,b){return a&b},"|":function(a,b){return a|b},"<<":function(a,b){return a<<b},">>":function(a,b){return a>>b},">>>":function(a,b){return a>>>b}};!w||"textContent"in w.createElement("div")?(b=function(a){return a.textContent},c=function(a,b){a.textContent=b}):(b=function(a){return a&&3===a.nodeType?a.nodeValue:a.innerText},c=function(a,b){a&&3===a.nodeType?a.nodeValue=b:a.innerText=b});var B,C,D,E,F,G,H=function(a,b,c){a.addEventListener?a.addEventListener(b,c):a.attachEvent("on"+b,c)},I=function(a,b,c){a.removeEventListener?a.removeEventListener(b,c):a.detachEvent("on"+b,c)},J={},K=function(){var a=0;return function(){return a++}}(),L=function(a){return X(a)?U(a)?a.slice():ga({},a):a},M=o||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b,c=[],d=0;for(b in a)ba.call(a,b)&&(c[d++]=b);return c},N=function(a,b){return a?void 0===b?a[a.length-1]:g.call(a,Math.max(a.length-b,0)):void 0},O=function(a,b,c){var d=!1;return a?k&&a.some===k?a.some(b,c):(da(a,function(a,e,f){return d||(d=b.call(c,a,e,f))?J:void 0}),!!d):d},P=function(a,b){return g.call(a,void 0===b?1:b)},Q=function(a,b,c){b=b||_;var d=!0;return a?m&&a.every===m?a.every(b,c):(da(a,function(a,e,f){return(d=d&&b.call(c,a,e,f))?void 0:J}),!!d):d},R=function(a,b,c){return b&&Q(a,U)?i.apply(c,a):(da(a,function(a){U(a)||$(a)?b?j.apply(c,a):R(a,b,c):c.push(a)}),c)},S=function(a,b){return R(a,b,[])},T=function(a){return"[object Number]"===h.call(a)},U=Array.isArray||function(a){return"[object Array]"===h.call(a)},V=function(a){return"[object Function]"===h.call(a)},W=function(a){return"[object String]"===h.call(a)},X=function(a){return a===Object(a)},Y=function(a){return!(!a||1!==a.nodeType)},Z=function(a){return!!(a&&a.nodeType>0)},$=function(a){return"[object Arguments]"===h.call(a)},_=function(a){return a},aa=function(a){return a?U(a)?g.call(a):$(a)?g.call(a):a.toArray&&V(a.toArray)?a.toArray():ea(a,_):[]},ba=e.hasOwnProperty,ca=function(a,b){return ba.call(a,b)},da=function(a,b,c){var d,e;if(a){if(n&&a.forEach===n)a.forEach(b,c);else if(a.length===+a.length){for(d=0,e=a.length;e>d;d++)if(b.call(c,a[d],d,a)===J)return}else{var f=M(a);for(d=0,e=f.length;e>d;d++)if(b.call(c,a[f[d]],f[d],a)===J)return}return a}},ea=function(a,b,c){var d=[];return a?r&&a.map===r?a.map(b,c):(da(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)}),a.length===+a.length&&(d.length=a.length),d):d},fa=function(a,b,c){var d=[];return a?p&&a.filter===p?a.filter(b,c):(da(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d):d},ga=function(a){return da(g.call(arguments,1),function(b){if(b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}),a},ha=function(a,b,c){var d,e=a.length;for(d=c||0;e>d;d++)if(b(a[d],d))return d;return-1},ia=function(a,b){return a===b},ja=function(a,b,c,d){return d||c||!l||a.indexOf!==l?(d=d||ia,ha(a,function(a){return d(b,a)},c)):a.indexOf(b)},ka=function(a,b){return la(a,ja(a,b))},la=function(a,b){return b>=0?a.splice(b,1)[0]:b},ma=function(a,b,c){var d=arguments.length>2;return a||(a=[]),q&&a.reduce===q?d?a.reduce(b,c):a.reduce(b):(da(a,function(a,d,e){c=b(c,a,d,e)}),c)},na=function(a,b,c,d){for(var e=c,f=a.length;f>e;){if(d(a[e],b))return e;e++}return-1},oa=function(a,b,c,d,e,f,g){var h=b[a],i=d[h]+1;return i=na(c,h,i>e?i:e,g||ia),0>i&&(i=f),d[h]=i,i},pa=function(a,b,c){var d,e,f,g={},h=0,i=0,j=0,k=a.length,l=b.length,m=new Array(l>k?l:k);if(0===l||0===k)return[];for(d=oa(0,a,b,g,h,l,c),f=0;k>f;f++)i=h===i?d:oa(f,a,b,g,h,l,c),d=oa(f+1,a,b,g,h,l,c),i>d?(f++,e=d):e=i,e===l||f===k?i=oa(f,a,b,g,h,l,c):(h=e,m[j]={item:a[f],indicies:[f,e]},j++);return m.slice(0,j)},qa=function(a,b,c){var d,e,f,g=L(b),h=a.length,i=b.length,j=[],k=0;if(0===i||0===h)return a;for(d=0;h>d;d+=1)if(f=a[d],e=ja(g,f,0,c),e>=0){if(la(g,e),0===--i){j.push.apply(j,P(a,d+1));break}}else j[k]=f,k++;return j},ra=function(a,b,c){var d,e,f,g=L(b),h=a.length,i=b.length,j=[];for(d=0;h>d&&i>0;d++)f=a[d],e=ja(g,f,0,c),e>=0&&(j.push([f,la(g,e)]),i--);return j},sa=function(a){var b=a[1].item;return{item:b,from:a[0].index,to:a[1].index,from_item:a[0].item,to_item:b}},ta=function(a){for(var b=0,c=a.length,d=[];c>b;)d[b]={item:a[b],index:b},b++;return d},ua=function(a){return{item:a.item,from:a.indicies[0],to:a.indicies[1]}},va=function(a){return a.index},wa=function(a){return a.to},xa=function(a){return{from:a.index,from_item:a.item}},ya=function(a,b,c){var d=c||ia,e=function(a,b){return d(a?a.item:a,b?b.item:b)},f=ta(a),g=ta(b),h=ea(pa(a,b),ua),i=qa(f,h,e),j=qa(g,h,e),k=ea(ra(i,j,e),sa);j=qa(j,k,e),i=qa(i,k,e);for(var l,m,n,o=ea(j,va),p=ea(k,wa),q=ea(h,wa),r=[],s=0,t=b.length;t>s;)n=b[s],(m=ja(o,s))>=0?(l=j[m],r[s]={to:s,to_item:n,item:n}):(m=ja(p,s))>=0?(l=k[m],r[s]={to:s,to_item:n,item:n,from:l.from,from_item:l.from_item}):(m=ja(q,s))>=0&&(l=h[m],r[s]={to:s,to_item:n,item:n,from:l.from,from_item:a[l.from]}),s++;return r.concat(ea(i,xa))},za=function(a){return a.hasOwnProperty("from")},Aa=function(a){return!za(a)},Ba=function(a){return a.hasOwnProperty("to")},Ca=function(a){return!Ba(a)},Da=function(a){return za(a)&&Ba(a)},Ea=function(a){return Da(a)&&a.from!==a.to},Fa=function(a,b){var c=za(a),d=za(b);return c&&d?a.from-b.from:d-c},Ga=function(a,b,c){var d=ya(a,b,c),e=L(d).sort(Fa),f=fa(d,Aa),g=fa(e,Ca).reverse(),h=fa(d,Ea),i=[];return da(g,function(a){la(e,a.from)}),da(f,function(a){e.splice(a.to,0,a)}),da(d,function(a,b){if(Da(a)&&e[b]!==a){var c=ja(e,a,b);e.splice(b,0,la(e,c)),i.push({move_from:c,insert_at:b,item:a.item,from:a.from,to:a.to})}}),e=null,{added:f,removed:g,moved:i,index_changed:h,mapping:d}},Ha=/-([a-z]|[0-9])/gi,Ia=/^-ms-/,Ja=function(a,b){return String(b).toUpperCase()},Ka=function(a){return a.replace(Ia,"ms-").replace(Ha,Ja)},La=a.cjs,Ma=function(a,b){return U(a)?new C(ga({value:a},b)):Lc(a)?Ma.inputValue(a):E(a)?new B(a,b):X(a)&&!V(a)?new D(ga({value:a},b)):new B(a,b)},Na=function(a){return E(a)?a.get():a},Oa={stack:[],check_on_nullified_ids:{},getValue:function(a,b){var c,d,e,f=this,g=Oa.stack,h=g.length;if(h>0&&(c=g[h-1],d=f._outEdges[c._id],e=c._tstamp+1,d?d.tstamp=e:f!==c&&f._options.auto_add_outgoing_dependencies!==!1&&c._options.auto_add_incoming_dependencies!==!1&&a!==!1&&(f._outEdges[c._id]=c._inEdges[f._id]={from:f,to:c,tstamp:e})),f._paused_info)return f._paused_info.temporaryValue;if(!f._valid){if(f._tstamp++,g[h]=f,f._valid=!0,f._options.cache_value!==!1){if(f._cached_value=f._options.literal?f._value:V(f._value)?f._value.call(f._options.context||f,f,b):Na(f._value),f._sync_value)f._cached_value=f._sync_value.value,delete f._sync_value;else if(Oa._paused_node&&Oa._paused_node.node===f)return f._paused_info=Oa._paused_node,delete Oa._paused_node,g.length=h,f._paused_info.temporaryValue}else V(f._value)&&f._value.call(f._options.context);g.length=h}return f._cached_value},pauseNodeGetter:function(a){Oa._paused_node={temporaryValue:a,node:this}},resumeNodeGetter:function(a){var b,c=this;Oa._paused_node&&Oa._paused_node.node===c?(delete Oa._paused_node,c._sync_value={value:a}):(b=Oa.stack,delete c._paused_info,c._tstamp++,c._valid=!0,Oa.stack=[c],c._options.cache_value!==!1?c._cached_value=c._options.literal?a:V(a)?a.call(c._options.context||c,c):Ma.get(a):V(c._value)&&a.call(c._options.context),Oa.nullify.apply(Oa,ea(c._outEdges,function(a){return a.to})),Oa.stack=b)},add_in_call_stack:function(a){var b=a.priority;if(a.in_call_stack++,a.node._num_listeners_in_call_stack++,T(b))for(var c,d,e=0,f=this.nullified_call_stack.length;f>e;){if(c=this.nullified_call_stack[e],c&&(d=c.priority,d===!1||b>d))return void this.nullified_call_stack.splice(e,0,a);e++}this.nullified_call_stack.push(a)},nullify:function(){var a,b,c,d,e,f,h,i,j,k,l=g.call(arguments),m=l.length,n=!this._is_nullifying;for(n&&(this._is_nullifying=!0),a=0;m>a;a+=1)if(e=l[a],l[a]=!1,e._valid&&(e._valid=!1,d=!0,e._options.cache_value===!1||e._options.check_on_nullify!==!0||this.check_on_nullified_ids[e._id]||(this.check_on_nullified_ids[e._id]=!0,f=e._options.equals||ia,h=e._cached_value,i=e.get(void 0,!0),f(h,i)&&(d=!1)),d)){j=e._changeListeners,da(j,this.add_in_call_stack,this),b=e._outEdges,k=e._id;for(c in b)if(ca(b,c)){var o=b[c],p=o.to;o.tstamp<p._tstamp?(delete e._outEdges[c],delete p._inEdges[k]):(l[m]=p,m+=1)}}n&&(this.check_on_nullified_ids={},this.semaphore>=0&&this.nullified_call_stack.length>0&&this.run_nullified_listeners(),delete this._is_nullifying)},removeDependency:function(a,b){delete a._outEdges[b._id],delete b._inEdges[a._id]},semaphore:0,wait:function(){this.semaphore-=1},signal:function(){this.semaphore+=1,this.semaphore>=0&&this.nullified_call_stack.length>0&&this.run_nullified_listeners()},nullified_call_stack:[],running_listeners:!1,clearEdges:function(a,b){var c,d=b!==!0,e=a._id,f=a._inEdges,g=a._outEdges;d&&this.wait();for(c in f)ca(f,c)&&(delete f[c].from._outEdges[e],delete f[c]);for(c in g)if(ca(g,c)){var h=g[c].to;d&&Oa.nullify(h),delete h._inEdges[e],delete g[c]}d&&this.signal()},run_nullified_listeners:function(){var b,c,d;if(!this.running_listeners){for(this.running_listeners=!0;this.nullified_call_stack.length>0;)if(b=this.nullified_call_stack.shift(),c=b.callback,d=b.context||a,b.in_call_stack--,b.node._num_listeners_in_call_stack--,Ma.__debug)c.apply(d,b.args);else try{c.apply(d,b.args)}catch(e){ca(a,"console")&&a.console.error(e)}this.running_listeners=!1}},remove_from_call_stack:function(a){for(;a.in_call_stack>0;)ka(this.nullified_call_stack,a),a.in_call_stack--,a.node._num_listeners_in_call_stack--}};B=function(b,c){this._options=ga({context:a},c),this._value=b,this._id=K(),this._outEdges={},this._inEdges={},this._changeListeners=[],this._tstamp=0,this._num_listeners_in_call_stack=0,this._options.literal||!V(this._value)&&!E(this._value)?(this._valid=!0,this._cached_value=this._value):(this._valid=!1,this._cached_value=void 0)},function(a){var b=a.prototype;b.get=Oa.getValue,b.set=function(a,b){var c=this._value;if(this._value=a,b&&b.silent===!0)return this;if(this._options.literal||!V(a)&&!E(a)){var d=this._options.equal||ia;d(c,a)||Oa.nullify(this)}else c!==a&&Oa.nullify(this);return this};var c=["context","literal"];b.setOption=function(a,b){var d;if(W(a))this._options[a]=b,d=ja(c,a)>=0;else{var e=e(a);ga(this._options,a),d=O(c,function(a){return e.indexOf(a)>=0})}return d?this.invalidate():this},b.invalidate=function(){return Oa.nullify(this),this},b.isValid=function(){return this._valid},b.remove=function(a){return Oa.clearEdges(this,a),this._valid=!1,this._cached_value=void 0,this},b.destroy=function(a){return this._num_listeners_in_call_stack>0&&da(this._changeListeners,function(a){return a.in_call_stack>0&&(Oa.remove_from_call_stack(a),0===this._num_listeners_in_call_stack)?J:void 0},this),this.remove(a),this._changeListeners=[],this},b.pauseGetter=function(){return Oa.pauseNodeGetter.apply(this,arguments),this},b.resumeGetter=function(){return Oa.resumeNodeGetter.apply(this,arguments),this},b.onChange=function(a,b){return this.onChangeWithPriority.apply(this,[!1].concat(aa(arguments)))},b.onChangeWithPriority=function(a,b,c){var d=g.call(arguments,3);return T(a)||(a=!1),this._changeListeners.push({callback:b,context:c,args:d,in_call_stack:0,node:this,priority:a}),this._options.run_on_add_listener!==!1&&this.get(!1),this},b.offChange=function(a,b){var c,d;for(d=this._changeListeners.length-1;d>=0;d-=1)if(c=this._changeListeners[d],c.callback===a&&(!b||c.context===b)){la(this._changeListeners,d),c.in_call_stack>0&&Oa.remove_from_call_stack(c),delete c.node;break}return this},b.inFSM=function(a,b){return da(b,function(b,c){a.on(c,function(){this.set(b)},this),a.is(c)&&this.set(b)},this),this},b.and=function(){var b=[this].concat(aa(arguments)),c=b.length;return new a(function(){for(var a,d=0;c>d;d++)if(!(a=Ma.get(b[d])))return!1;return a})},b.iif=function(b,c){var d=this;return new a(function(){return d.get()?Ma.get(b):Ma.get(c)})},b.or=function(){var b=[this].concat(aa(arguments)),c=b.length;return new a(function(){for(var a,d=0;c>d;d++)if(a=Ma.get(b[d]))return a;return!1})};var d=function(b){return function(){var c=[this].concat(aa(arguments));return new a(function(){return b.apply(this,ea(c,Ma.get))})}},e=function(a,b){return a?a[b]:void 0};b.prop=d(function(a){return ma(P(arguments),e,a)}),b.toInt=d(function(a){return parseInt.apply(this,arguments)}),b.toFloat=d(function(a){return parseFloat.apply(this,arguments)}),b.add=d(function(){return ma(arguments,A["+"],0)}),b.sub=d(function(a){return ma(P(arguments),A["-"],a)}),b.mul=d(function(a){return ma(P(arguments),A["*"],a)}),b.div=d(function(a){return ma(P(arguments),A["/"],a)}),da(["abs","acos","asin","atan","atan2","cos","max","min","sin","tan","pow","round","floor","ceil","sqrt","log","exp"],function(a){b[a]=d(t(Math[a],Math))}),da({u:{pos:"+",neg:"-",not:"!",bitwiseNot:"~"},bi:{eqStrict:"===",neqStrict:"!==",eq:"==",neq:"!=",gt:">",ge:">=",lt:"<",le:"<=",xor:"^",bitwiseAnd:"&",bitwiseOr:"|",mod:"%",rightShift:">>",leftShift:"<<",unsignedRightShift:">>>"}},function(a,c){var e="u"===c?z:A;da(a,function(a,c){b[c]=d(e[a])})}),b.typeOf=d(function(a){return typeof a}),b.instanceOf=d(function(a,b){return a instanceof b})}(B),E=function(a){return a instanceof B},ga(Ma,{constraint:function(a,b){return new B(a,b)},Constraint:B,isConstraint:E,inFSM:function(a,b){return(new B).inFSM(a,b)},get:function(a,b){return E(a)?a.get(b):F(a)?a.toArray():G(a)?a.toObject():a},wait:t(Oa.wait,Oa),signal:t(Oa.signal,Oa),removeDependency:Oa.removeDependency,arrayDiff:Ga,version:"0.9.8-beta2",toString:function(){return"ConstraintJS v"+Ma.version},__debug:!0,noConflict:ca(a,"cjs")?function(){return a.cjs===Ma&&(a.cjs=La),Ma}:function(){return delete a.cjs,Ma}});var Pa=function(a){return T(a)&&Math.round(a)===a&&a>=0};C=function(a){a=ga({equals:ia,value:[]},a),this._value=ea(a.value,function(a){return new B(a,{literal:!0})}),this._unsubstantiated_items=[],this.$len=new B(this._value.length),this.$equality_check=new B(a.equals,{literal:!0})},function(b){var c=b.prototype;b.BREAK={};var d=function(a,b){var c=a._value[b];return void 0===c&&(c=new B(void 0,{literal:!0}),a._unsubstantiated_items[b]=c),c.get()},e=function(a,b,c){Ma.wait();var d=a._value[b];if(void 0===d&&a._unsubstantiated_items[b]&&(d=a._value[b]=a._unsubstantiated_items[b],delete a._unsubstantiated_items[b]),E(d)){d.get();d.set(c)}else a._value[b]=new B(c,{literal:!0});return h(a),Ma.signal(),c},f=function(a,b){var c;for(Ma.wait();a._value.length>0;){c=a._value.pop();a._value.length;E(c)&&c.destroy(b)}return h(a,b),Ma.signal(),this},h=function(a,b){a.$len.set(a._value.length,b?{silent:!0}:!1)};c.setEqualityCheck=function(a){return this.$equality_check.set(a),this},c.forEach=function(c,e){var f,g=this.length();for(e=e||a,f=0;g>f;f+=1)if(c.call(e,d(this,f),f)===b.BREAK)return this;return this},c.map=function(b,c){var d=[];return c=c||a,this.forEach(function(a,e){d[e]=b.call(c,a,e)}),d},c.setValue=function(a){return Ma.wait(),f(this),this.push.apply(this,a),Ma.signal(),this},c.item=function(a,b){return 0===arguments.length?this.toArray():1===arguments.length?d(this,a):arguments.length>1?e(this,a,b):void 0},c.destroy=function(a){f(this,a),this.$len.destroy(a)},c.length=function(){return this.$len.get()},c.push=function(){var a,b=arguments.length,c=this._value.length;for(Ma.wait(),a=0;b>a;a++)e(this,c+a,arguments[a]);return Ma.signal(),this.length()},c.pop=function(){var a,b=this._value.pop();return Ma.wait(),E(b)&&(a=b.get(),b.destroy()),h(this),Ma.signal(),a},c.toArray=function(){return this.map(_)},c.indexWhere=function(a,b){var c,d,e=this.length();for(b=b||this,c=0;e>c;c+=1)if(d=this._value[c],a.call(b,d.get(),c))return c;return-1},c.lastIndexWhere=function(a,b){var c,d,e=this.length();for(b=b||this,c=e-1;c>=0;c-=1)if(d=this._value[c],a.call(b,d.get(),c))return c;return-1},c.indexOf=function(a,b){b=b||this.$equality_check.get();var c=function(c){return b(c,a)};return this.indexWhere(c)},c.lastIndexOf=function(a,b){b=b||this.$equality_check.get();var c=function(c){return b(c,a)};return this.lastIndexWhere(c)},c.some=function(a,b){return this.indexWhere(a,b)>=0},c.every=function(a,c){var d=!0;return this.forEach(function(){return a.apply(c,arguments)?void 0:(d=!1,b.BREAK)}),d},c.splice=function(a,b){var c;if(T(b)||(b=0),!Pa(a)||!Pa(b))throw new Error("index and howmany must be positive integers");var f=g.call(arguments,2),i=f.length;Ma.wait();var j=i-b,k=ea(this._value.slice(a,a+b),function(a){return a?a.get():void 0});if(0>j){var l=this._value.length,m=a+i,n=l+j;for(c=a;m>c;c+=1)e(this,c,f[c-a]);for(;n>c;c+=1)e(this,c,d(this,c-j));for(;l>c;c+=1){var o=this._value.pop();E(o)&&o.destroy()}}else for(c=this._value.length+j-1;c>=a;c-=1)a+i>c?e(this,c,f[c-a]):e(this,c,d(this,c-j));return 0!==j&&h(this),Ma.signal(),k},c.shift=function(){var a=this.splice(0,1);return a[0]},c.unshift=function(){return this.splice.apply(this,[0,0].concat(aa(arguments))),this.length()},c.concat=function(){var a=ea(arguments,function(a){return F(a)?a.toArray():a}),b=this.toArray();return b.concat.apply(b,a)},c.slice=function(){var a=this._value.slice.apply(this._value,arguments);return ea(a,function(a){return a?a.get():void 0})},c.itemConstraint=function(a){return new B(function(){return this.item(Ma.get(a))},{context:this})},da(["filter","join","sort","reverse","toString"],function(a){c[a]=function(){var b=this.toArray();return b[a].apply(b,arguments)}})}(C),F=function(a){return a instanceof C},ga(Ma,{array:function(a){return new C(a)},ArrayConstraint:C,isArrayConstraint:F});var Qa=function(a){return a+""},Ra=function(a){return function(b){return b[a]()}};D=function(a){a=ga({hash:Qa,valuehash:!1,equals:ia,valueequals:ia,value:{},keys:[],values:[],literal_values:!1,create_unsubstantiated:!0},a),a.keys=L(a.keys),a.values=L(a.values);var b={};da(a.keys,function(a){b[a]=!0}),da(a.value,function(c,d){b[d]||(a.keys.push(d),a.values.push(c))},this),b=!1,this._default_literal_values=!!a.literal_values,this.$equality_check=new B(a.equals,{literal:!0}),this.$vequality_check=new B(a.valueequals,{literal:!0}),this._hash=W(a.hash)?Ra(a.hash):a.hash,this._create_unsubstantiated=a.create_unsubstantiated,this._khash={},a.valuehash?(this._vhash={},V(a.valuehash)?this._valuehash=a.valuehash:W(a.valuehash)?this._valuehash=Ra(a.valuehash):this._valuehash=Qa):this._vhash=!1;var c=this._default_literal_values;this._ordered_values=ea(a.keys,function(b,d){var e=a.values[d],f={key:new B(b,{literal:!0}),value:new B(e,{literal:c}),index:new B(d,{literal:!0})},g=this._hash(b),h=this._khash[g];if(h?h.push(f):this._khash[g]=[f],this._vhash){var i=this._valuehash(e),j=this._vhash[i];j?j.push(f):this._vhash[i]=[f]}return f},this),this._unsubstantiated_values={},this.$keys=new B(function(){var a=[];return this.forEach(function(b,c,d){a[d]=c}),a},{context:this}),this.$values=new B(function(){var a=[];return this.forEach(function(b,c,d){a[d]=b}),a},{context:this}),this.$entries=new B(function(){var a=[];return this.forEach(function(b,c,d){a[d]={key:c,value:b}}),a},{context:this}),this.$size=new B(function(){return this._ordered_values.length},{context:this})},function(a){a.BREAK=C.BREAK;var b=a.prototype,c=function(a,b,c,d){var e=this._hash(a),f={h:e,hv:!1,i:-1,ui:-1,uhv:!1},g=this.$equality_check.get(),h=function(b,c){return g(b.key.get(),a)},i=this._khash[e];if(i){var j=ha(i,h);if(f.hv=i,j>=0)return f.i=j,f}if(b!==!1){var k=this._unsubstantiated_values[e],l=-1;if(k&&(f.uhv=k,l=ha(k,h),l>=0))return f.ui=l,f;if(c===!0){var m=(this._default_literal_values,{key:new B(a,{literal:!0}),value:new B(void 0,{literal:void 0===d?this._default_literal_values:!!d}),index:new B(-1,{literal:!0})});k?(l=k.length,k[l]=m):(l=0,this._unsubstantiated_values[e]=k=[m])}f.uhv=k||!1,f.ui=l}return f},d=function(a,b,c,d,f){var g,h,i,j,k=a.i,l=a.hv,m=a.h;if(k>=0){if(j=l[k],this._vhash){var n=j.value.get(),o=this._valuehash(n),p=this._vhash[o];if(h=this._valuehash(c),p){var q=p.length;for(g=0;q>g;g+=1)if(p[g]===j){p.splice(g,1),0===p.length&&delete this._vhash[o];break}}i=this._vhash[h],i?i.push(j):this._vhash[h]=[j]}if(j.value.set(c),Pa(d)){var r=j.index.get();if(r!==d){this._ordered_values.splice(r,1),this._ordered_values.splice(d,0,j);var s=Math.min(r,d),t=Math.max(r,d);for(g=s;t>=g;g+=1)e(this._ordered_values[g],g);this.$keys.invalidate()}}}else{Pa(d)||(d=this._ordered_values.length);var u=a.ui;if(u>=0){var v=a.uhv,w=v[u];v.splice(u,1),0===v.length&&delete this._unsubstantiated_values[m],j=w}else j={key:new B(b,{literal:!0}),value:new B(c,{literal:void 0===f?this._default_literal_values:!!f}),index:new B(d,{literal:!0})};for(l?l.push(j):l=this._khash[m]=[j],this._vhash&&(h=this._valuehash(c),i=this._vhash[h],i?i.push(j):this._vhash[h]=[j]),this._ordered_values.splice(d,0,j),u>=0&&(j.value.set(c),j.index.set(d)),g=d+1;g<this._ordered_values.length;g+=1)e(this._ordered_values[g],g);this.$size.invalidate(),this.$keys.invalidate()}this.$values.invalidate(),this.$entries.invalidate()},e=function(a,b){a.index.set(b)},f=function(a,b){da(a,function(a){a.key.destroy(b),a.value.destroy(b),a.index.destroy(b)})},g=function(a,b){this._ordered_values[a];f(this._ordered_values.splice(a,1),b),b!==!0&&this.$size.invalidate()};b.keys=function(){return this.$keys.get()},b.values=function(){return this.$values.get()},b.entries=function(){return this.$entries.get()},b.size=function(){return this.$size.get()},b.isEmpty=function(){return 0===this.size()},b.put=function(a,b,e,f){Ma.wait();var g=c.call(this,a,!0,!1,f);return d.call(this,g,a,b,e,f),Ma.signal(),this},b.remove=function(a,b){var d,f,h,i,j,k=c.call(this,a,!1,!1),l=k.i,m=k.hv;if(l>=0){if(Ma.wait(),f=m[l],h=f.index.get(),m.splice(l,1),0===m.length&&delete this._khash[k.h],this._vhash&&(i=this._valuehash(f.value.get()),j=this._vhash[i])){var n=j.length;for(d=0;n>d;d+=1)if(j[d]===f){j.splice(d,1),0===j.length&&delete this._vhash[i];break}}for(g.call(this,h,b),d=h;d<this._ordered_values.length;d+=1)e(this._ordered_values[d],d);b||(this.$size.invalidate(),this.$keys.invalidate(),this.$values.invalidate(),this.$entries.invalidate()),Ma.signal()}return this},b.get=function(a){var b=c.call(this,a,!0,this._create_unsubstantiated),d=b.i,e=b.hv;if(d>=0){var f=e[d];return f.value.get()}if(this._create_unsubstantiated){var g=b.uhv[b.ui];return g.value.get()}return void 0},b.item=function(a,b,c){return 0===arguments.length?this.toObject():1===arguments.length?this.get(a):this.put(a,b,c)},b.itemConstraint=function(a){return new B(function(){return this.get(Ma.get(a))},{context:this})},b.clear=function(a){if(this.size()>0){for(Ma.wait();this._ordered_values.length>0;)g.call(this,0,a);da(this._khash,function(a,b){delete this._khash[b]},this),this._vhash&&da(this._vhash,function(a,b){delete this._vhash[b]},this),a||(this.$keys.invalidate(),this.$values.invalidate(),this.$entries.invalidate(),this.$size.invalidate()),Ma.signal()}return this},b.forEach=function(b,c){var d,e,f=this.size(),g=this._ordered_values.slice();for(c=c||this,d=0;f>d&&(e=g[d],!e||b.call(c,e.value.get(),e.key.get(),e.index.get())!==a.BREAK);d+=1);return this},b.setEqualityCheck=function(a){return this.$equality_check.set(a),this},b.setValueEqualityCheck=function(a){return this.$vequality_check.set(a),this},b.setHash=function(a){Ma.wait(),this._hash=W(a)?Ra(a):a,this._khash={},da(this._ordered_values,function(a){var b=a.key.get(),c=this._hash(b),d=this._khash[c];d?d.push(a):this._khash[c]=[a]},this);var b={};return da(this._unsubstantiated_values,function(a){da(a,function(a){var c=a.key.get(),d=this._hash(c),e=this.new_unsubstatiated_values[d];e?e.push(a):b[d]=[a]},this)},this),this._unsubstantiated_values=b,Ma.signal(),this},b.setValueHash=function(a){return this._valuehash=W(a)?Ra(a):a,this._vhash={},this._valuehash&&da(this._ordered_values,function(a){var b=a.value.get(),c=this._valuehash(b),d=this._vhash[c];d?d.push(a):this._vhash[c]=[a]},this),this},b.indexOf=function(a){var b=c.call(this,a,!0,this._create_unsubstantiated),d=b.i,e=b.hv;if(d>=0){var f=e[d];return f.index.get()}if(b.ui>=0){var g=b.uhv[b.ui];return g.index.get()}return-1},b.getOrPut=function(a,b,e,f,g){var h,i,j,k=c.call(this,a,!0,!1,g),l=k.i,m=k.hv;k.h;return l>=0?(j=m[l],j.value.get()):(Ma.wait(),h=e||this,i=b.call(h,a),d.call(this,k,a,i,f,g),Ma.signal(),i)},b.has=function(a){var b=c.call(this,a,!0,this._create_unsubstantiated),d=b.i;if(d>=0)return!0;if(this._create_unsubstantiated){var e=b.uhv[b.ui];return e.index.get(),!1}return!1},b.moveIndex=function(a,b){var c;Ma.wait();var d=this._ordered_values[a];this._ordered_values.splice(a,1),this._ordered_values.splice(b,0,d);var f=Math.min(a,b),g=Math.max(a,b);for(c=f;g>=c;c+=1)e(this._ordered_values[c],c);return this.$keys.invalidate(),this.$values.invalidate(),this.$entries.invalidate(),Ma.signal(),this},b.move=function(a,b){var d=c.call(this,a,!1,!1),e=d.i;if(e>=0){var f=d.hv[e];this.moveIndex(f.index.get(),b)}return this},b.keyForValue=function(b,c){c=c||this.$vequality_check.get();var d;if(this._vhash){var e=this._valuehash(b),f=this._vhash[e];if(f){var g=f.length;for(d=0;g>d;d+=1){var h=f[d];if(c(h.value.get(),b))return h.key.get()}}return void 0}var i;return this.forEach(function(d,e){return c(b,d)?(i=e,a.BREAK):void 0}),i},b.destroy=function(a){Ma.wait(),this.clear(a),this.$equality_check.destroy(a),this.$vequality_check.destroy(a),this.$keys.destroy(a),this.$values.destroy(a),this.$entries.destroy(a),this.$size.destroy(a),Ma.signal()},b.toObject=function(a){var b={};return a=a||_,this.forEach(function(c,d){b[a(d)]=c}),b}}(D),G=function(a){return a instanceof D},ga(Ma,{map:function(a,b){return new D(a,b)},MapConstraint:D,isMapConstraint:G}),ga(Ma,{liven:function(b,c){c=ga({context:a,run_on_create:!0,pause_while_running:!1,priority:!1,on_destroy:!1},c);var d,e=new B(b,{context:c.context,cache_value:!1,auto_add_outgoing_dependencies:!1,run_on_add_listener:!1}),f=!1,g=function(){e.invalidate()},h=function(a){c.on_destroy&&c.on_destroy.call(c.context,a),e.destroy(a)},i=function(){return f===!1?(f=!0,e.offChange(d),!0):!1},j=function(){return f===!0?(f=!1,e.onChangeWithPriority(c.priority,d),c.run_on_create!==!1&&(Oa.semaphore>=0?e.get(!1):da(e._changeListeners,Oa.add_in_call_stack,Oa)),!0):!1};d=function(){c.pause_while_running&&i(),e.get(),c.pause_while_running&&j()},e.onChangeWithPriority(c.priority,d);var k={destroy:h,pause:i,resume:j,run:function(a){return d(a),this},invalidate:g,_constraint:e};return c.run_on_create!==!1&&(Oa.semaphore>=0?e.get(!1):da(e._changeListeners,Oa.add_in_call_stack,Oa)),k}});var Sa=function(){var a,b=arguments.length,c="";for(a=0;b>a;a+=1)c+=arguments[a];return c},Ta=function(a,b){var c,d=a.length;if(d===b.length){for(c=0;d>c;c+=1){var e=a[c],f=b[c];if(e!==f)return!1}return!0}return!1};ga(Ma,{memoize:function(b,c){c=ga({hash:Sa,equals:Ta,context:a,literal_values:!0},c),c.args_map=new D({hash:c.hash,equals:c.equals,literal_values:c.literal_values});var d=function(){var a=g.call(arguments),d=c.args_map.getOrPut(a,function(){return new B(function(){return b.apply(c.context,a)})});return d.get()};return d.destroy=function(a){c.args_map.forEach(function(b){b.destroy(a)}),c.args_map.destroy(a)},d.each=function(a){c.args_map.forEach(a)},d.options=c,d}});var Ua=function(a){if(Z(a))return a;var b=w.createTextNode(a);return b},Va=function(a,b,c){var d=b.childNodes;if(d.length<=c)b.appendChild(a);else{var e=d[c];b.insertBefore(a,e)}},Wa=function(a,b){var c,d=a.childNodes;return d.length>b?(c=d[b],a.removeChild(c),c):void 0},Xa=function(a,b,c){var d=a.childNodes;if(d.length>c){var e=d[c];return a&&(b>c&&b++,Va(e,a,b)),e}},Ya=function(b){return ca(a,"jQuery")?b instanceof a.jQuery:!1},Za=a.NodeList||!1,$a=Za?function(a){return a instanceof Za}:function(){return!1},_a=function(b){return U(b)?b:E(b)?_a(b.get()):F(b)?b.toArray():G(b)?b.values():Ya(b)?a.jQuery.makeArray(b):$a(b)?aa(b):[b]},ab=function(a){this.options=a,this.targets=a.targets;var b,c,d=a.setter,e=a.getter,f=a.init_val,g=function(){this._timeout_id=!1;var e=fa(_a(this.targets),Z);ca(a,"onChange")&&a.onChange.call(this,b,c),da(e,function(a){d.call(this,a,b,c)},this),c=b};this._throttle_delay=!1,this._timeout_id=!1,c=V(f)?f(_a(this.targets[0])):f,this.$live_fn=Ma.liven(function(){b=e(),this._throttle_delay?this._timeout_id||(this._timeout_id=x(t(g,this),this._throttle_delay)):g.call(this)},{context:this})};!function(a){var b=a.prototype;b.pause=function(){return this.$live_fn.pause(),this},b.resume=function(){return this.$live_fn.resume(),this},b.throttle=function(a){return this._throttle_delay=a>0?a:!1,this._timeout_id&&!this._throttle_delay&&(y(this._timeout_id),this._timeout_id=!1),this.$live_fn.run(),this},b.destroy=function(){this.$live_fn.destroy(),this.options.onDestroy&&this.options.onDestroy(),this.options.coreDestroy&&this.options.coreDestroy()}}(ab);var bb=function(a,b,c){return function(d){var e=g.call(arguments,1),f=Ma(function(){return a(e)}),h=new ab({targets:d,getter:t(f.get,f),setter:b,init_val:c,coreDestroy:function(){f.destroy()}});return h}},cb=function(a){return bb(function(a){return ea(a,Ma.get).join("")},function(b,c){a(b,c)})},db=function(a){return function(b){var c,d=g.call(arguments,1);if(0!==d.length){1===d.length?c=d[0]:d.length>1&&(c={},c[d[0]]=d[1]);var e=new ab({targets:b,setter:function(b,c){da(c,function(c,d){a(b,d,c)})},getter:function(){if(G(c))return c.toObject();var a={};return da(c,function(b,c){a[c]=Ma.get(b)}),a}});return e}}},eb=cb(function(a,b){c(a,b)}),fb=cb(function(a,b){a.innerHTML=b}),gb=cb(function(a,b){a.val=b}),hb=bb(function(a){return S(ea(a,Ma.get),!0)},function(a,b,c){var d=Ga(c,b),e=" "+a.className+" ";da(d.removed,function(a){e=e.replace(" "+a.from_item+" "," ")}),e+=ea(d.added,function(a){return a.item}).join(" "),e=v(e),a.className=e},[]),ib=bb(function(a){var b=ea(a,Ma.get);return ea(S(b,!0),Ua)},function(a,b,c){var d=Ga(c,b);da(d.removed,function(b){var c=Wa(a,b.from);this.options.onRemove&&this.options.onRemove.call(this,c,b.from)},this),da(d.added,function(b){var c=b.item;Va(c,a,b.to),this.options.onAdd&&this.options.onAdd.call(this,c,b.to)},this),da(d.moved,function(b){var c=Xa(a,b.to_index,b.from_index);this.options.onMove&&this.options.onMove.call(this,c,b.to_index,b.from_index)},this),this.options.onIndexChange&&da(d.index_changed,function(a){this.options.onIndexChange.call(this,a.item,a.to,a.from)},this)},function(a){return aa(a.childNodes)}),jb=db(function(a,b,c){a.style[Ka(b)]=c}),kb=db(function(a,b,c){Qb[b]&&!c?a.removeAttribute(b):a.setAttribute(b,c)}),lb=["keyup","input","paste","propertychange","change"],mb=function(a){var b;Y(a)?(a=[a],b=!1):b=!0;var c=Ma(function(){return b?ea(a,function(a){return a.value}):a[0].value}),d=(a.length,t(c.invalidate,c)),e=function(){da(lb,function(b){da(a,function(a){H(a,b,d)})})},f=function(){da(lb,function(b){da(a,function(a){I(a,b,d)})})},g=c.destroy;return c.destroy=function(){f(),g.call(c)},e(),c};ga(Ma,{bindText:eb,bindHTML:fb,bindValue:gb,bindChildren:ib, | ||
bindAttr:kb,bindCSS:jb,bindClass:hb,inputValue:mb,Binding:ab});var nb=function(a,b){this._fsm=a,this._name=b,this._id=K()};!function(a){var b=a.prototype;b.getName=function(){return this._name},b.id=function(){return this._id}}(nb);var ob=function(a,b,c,d){this._fsm=a,this._from=b,this._to=c,this._name=d,this._id=K(),this._event=!1};!function(a){var b=a.prototype;b.getFrom=function(){return this._from},b.getTo=function(){return this._to},b.getName=function(){return this._name},b.getFSM=function(){return this._fsm},b.id=function(){return this._id},b.destroy=function(){var a=this._event;a&&a._removeTransition(this),delete this._event,delete this._fsm,delete this._from,delete this._to},b.setEvent=function(a){this._event=a},b.run=function(){var a=this.getFSM();if(a&&a.is(this.getFrom())){var b=aa(arguments);b.unshift(this.getTo(),this),a._setState.apply(a,b)}}}(ob);var pb=function(a){this._state_name=a};!function(a){var b=a.prototype;b.matches=function(a){return this._state_name===a||a instanceof nb&&this._state_name===a.getName()}}(pb);var qb=function(){};!function(a){var b=a.prototype;b.matches=function(a){return!(a instanceof ob)}}(qb);var rb=function(a,b,c){this.is_pre=a,this.from_state_selector=b,this.to_state_selector=c};!function(a){var b=a.prototype;b.matches=function(a,b){if(a instanceof ob&&this.is_pre===b){var c=a.getFrom(),d=a.getTo();return this.from_state_selector.matches(c)&&this.to_state_selector.matches(d)}return!1}}(rb);var sb=function(){this.selectors=aa(arguments)};!function(a){var b=a.prototype;b.matches=function(){var a=arguments;return O(this.selectors,function(b){return b.matches.apply(b,a)})}}(sb);var tb=function(a){return"*"===a?new qb:new pb(a)},ub=function(a){var b=ea(a.split(","),function(a){return v(a)});if(1===b.length)return tb(b[0]);var c=ea(b,tb);return new sb(c)},vb=function(a,b,c){var d,e,f=ub(a),g=ub(c);return"<->"===b?(d=new rb(!1,f,g),e=new rb(!1,g,f),new sb(d,e)):">-<"===b?(d=new rb(!0,f,g),e=new rb(!0,g,f),new sb(d,e)):"->"===b?new rb(!1,f,g):">-"===b?new rb(!0,f,g):"<-"===b?new rb(!1,g,f):"-<"===b?new rb(!0,g,f):null},wb=/^([\sa-zA-Z0-9,\-_*]+)((<->|>-<|->|>-|<-|-<)([\sa-zA-Z0-9,\-_*]+))?$/,xb=function(a){var b=a.match(wb);if(null===b)return null;if(b[2]){var c=b[1],d=b[3],e=b[4];return vb(c,d,e)}var f=b[1];return ub(f)},yb=0,zb=function(b,c,d){this._context=d||a,this._selector=b,this._callback=c,this._id=yb++};!function(a){var b=a.prototype;b.interested_in=function(){return this._selector.matches.apply(this._selector,arguments)},b.run=function(){this._callback.apply(this._context,arguments)}}(zb);var Ab=function(){this._states={},this._transitions=[],this._curr_state=null,this._listeners=[],this._chain_state=null,this._did_transition=!1,this.state=Ma(function(){return this._curr_state?this._curr_state._name:null},{context:this}),this.addState.apply(this,S(arguments,!0))};!function(a){var b=a.prototype,c=function(a,b){return a._states[b]};b.addState=function(){var a;return da(arguments,function(b){a=c(this,b),a||(a=this._states[b]=new nb(this,b),null===this._curr_state&&(this._curr_state=a))},this),a&&(this._chain_state=a),this},b.getState=function(){return this.state.get()},b.addTransition=function(a,b,c){var d,e,f,g,h=!1;if(0===arguments.length)throw new Error("addTransition expects at least one argument");return 1===arguments.length?(h=!0,d=this._chain_state,e=a):2===arguments.length?V(b)||b instanceof Bb?(d=this._chain_state,e=a,g=b):(d=a,e=b,h=!0):(d=a,e=b,g=c),W(d)&&!ca(this._states,d)&&(this._states[d]=new nb(this,d)),W(e)&&!ca(this._states,e)&&(this._states[e]=new nb(this,e)),f=new ob(this,d,e),this._transitions.push(f),h?t(f.run,f):(g instanceof Bb?(g._addTransition(f),f.setEvent(g)):g.call(this,t(f.run,f),this),this)},b._setState=function(a,b,d){var e=this.getState(),f=W(a)?c(this,a):a,g=this._listeners.length>0?[d,b,f,e].concat(P(arguments,3)):!1;if(!f)throw new Error("Could not find state '"+a+"'");this.did_transition=!0,da(this._listeners,function(a){a.interested_in(b,!0)&&a.run.apply(a,g)}),this._curr_state=f,this.state.invalidate(),da(this._listeners,function(a){(a.interested_in(b,!1)||a.interested_in(f))&&a.run.apply(a,g)})},b.destroy=function(){this.state.destroy(),this._states={},da(this._transitions,function(a){a.destroy()}),this._transitions=[],this._curr_state=null},b.startsAt=function(a){var b=c(this,a);return b||(b=this._states[a]=new nb(this,a)),this.did_transition||(this._curr_state=b,this.state.invalidate()),this._chain_state=b,this},b.is=function(a){var b=this.getState();return null===b?!1:b===(W(a)?a:a.getName())},b.on=b.addEventListener=function(a,b,c){var d;if(W(a)){if(d=xb(a),null===d)throw new Error("Unrecognized format for state/transition spec.")}else d=a;var e=new zb(d,b,c);return this._listeners.push(e),this},b.off=b.removeEventListener=function(a){return this._listeners=fa(this._listeners,function(b){return b.callback!==a}),this}}(Ab),ga(Ma,{FSM:Ab,fsm:function(){return new Ab(arguments)},isFSM:function(a){return a instanceof Ab}});var Bb=function(a,b,c,d){this._listeners=[],this._transitions=[],this._on_add_transition=c,this._on_remove_transition=d,this._live_fns={},this._parent=a,this._parent&&this._parent._listeners.push({event:this,filter:b})};!function(b){var c=b.prototype;c.guard=function(a,b){if(!V(a)){var c=a;a=function(a){return a&&a[c]===b}}return new Bb(this,a)},c._addTransition=function(a){this._transitions.push(a),this._on_add_transition&&(this._live_fns[a.id()]=this._on_add_transition(a)),this._parent&&this._parent._on_add_transition&&this._parent._on_add_transition(a)},c._removeTransition=function(a){if(ka(this._transitions,a)&&this._on_remove_transition){this._on_remove_transition(a);var b=a.id();this._live_fns[b].destroy(),delete this._live_fns[b]}this._parent&&this._parent._on_remove_transition&&this._parent._on_remove_transition(a)},c._fire=function(){var b=arguments;da(this._transitions,function(a){a.run.apply(a,b)}),da(this._listeners,function(c){var d=c.event,e=c.filter;(!e||e.apply(a,b))&&d._fire.apply(d,b)})}}(Bb);var Cb=function(b){return b===a||Lc(b)},Db=function(a){return ea(a.split(" "),v)},Eb="timeout";ga(Ma,{CJSEvent:Bb,on:function(b){var c=arguments.length>1?P(arguments):a,d=new Bb(!1,!1,function(a){var d=[],e=!1,f=[],g=t(this._fire,this),h=a.getFSM(),i=a.getFrom(),j=new pb(i),k=new rb(!0,j,new qb),l=function(){da(f,function(a){if(a===Eb){e&&(y(e),e=!1);var b=Ma.get(c[0]);(!T(b)||0>b)&&(b=0),e=x(g,b)}else da(d,function(b){H(b,a,g)})})},m=function(){da(f,function(a){da(d,function(b){a===Eb?e&&(y(e),e=!1):I(b,a,g)})})},n=Ma.liven(function(){m(),f=Db(Ma.get(b)),d=S(ea(fa(_a(c),Cb),Nc,!0)),h.on(j,l).on(k,m),h.is(i)&&l()});return n});return d}});var Fb=function(a){var b={};return da(a.split(","),function(a){b[a]=!0}),b},Gb=/^<([\-A-Za-z0-9_]+)((?:\s+[a-zA-Z0-9_\-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^>\s]+)))?)*)\s*(\/?)>/,Hb=/^<\/([\-A-Za-z0-9_]+)[^>]*>/,Ib=/^\{\{([#=!>|{\/])?\s*((?:(?:"[^"]*")|(?:'[^']*')|[^\}])*)\s*(\/?)\}?\}\}/,Jb=/([\-A-Za-z0-9_]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^\/>\s]+)))?/g,Kb="hb",Lb="html",Mb=Fb("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed"),Nb=Fb("address,applet,blockquote,button,center,dd,del,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul"),Ob=Fb("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"),Pb=Fb("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"),Qb=Fb("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),Rb=Fb("script,style"),Sb="if",Tb="elif",Ub="else",Vb="state",Wb="each",Xb="with",Yb="fsm",Zb="unless",$b={};$b[Vb]={parent:[Yb]},$b[Tb]={parent:[Sb]},$b[Ub]={parent:[Sb,Wb]};var _b={};_b[Tb]={when_open_sibling:[Tb,Ub]},_b[Ub]={when_close_parent:[Sb,Wb],when_open_sibling:[]},_b[Vb]={when_open_sibling:[Vb]};var ac={};ac[Tb]={follows:[Tb],or_parent:[Sb]},ac[Ub]={follows:[Tb],or_parent:[Sb,Wb]},ac[Vb]={follows:[Vb],or_parent:[Yb]};var bc=function(a,b){function c(a,c,e,f){if(c=c.toLowerCase(),Nb[c])for(;n.last()&&Ob[n.last()];)d("",n.last());if(Pb[c]&&n.last()==c&&d("",c),f=Mb[c]||!!f,f||n.push({type:Lb,tag:c}),b.startHTML){var g=[];e.replace(Jb,function(a,b){var c=arguments[2]?arguments[2]:arguments[3]?arguments[3]:arguments[4]?arguments[4]:Qb[b]?b:"";g.push({name:b,value:c,escaped:c.replace(/(^|[^\\])"/g,'$1\\"')})}),b.startHTML(c,g,f)}}function d(a,b){g(b,Lb)}function e(){var a,b;for(a=n.length-1;a>=0;a--)if(b=n[a],b.type===Kb)return b;return void 0}function f(a,c,d){var f,h,i=rd(d);switch(i.type===Uc?i.body.length>0&&i.body[0].type===Vc&&(h=i.body[0].name):i.type===Vc&&(h=i.name),c){case"{":b.startHB(h,i,!0,!0);break;case">":b.partialHB(h,i);break;case"#":if(f=e(),f&&ca(_b,f.tag)){var k=_b[f.tag];ja(k.when_open_sibling,h)>=0&&(g(f.tag,Kb),f=e())}if(ca($b,h)){var l=$b[h];if(!f||ja(l.parent,f.tag)<0)throw new Error("'"+h+"' must be inside of a '"+l.parent+"' block")}if(ca(ac,h)){var m=ac[h];if(ja(m.follows,j)<0&&(!m.or_parent||ja(m.or_parent,f.tag)<0)){var o="'"+h+"' must follow a '"+m.follows[0]+"'";throw m.or_parent&&(o+=" or be inside of a '"+m.or_parent[0]+"' tag"),new Error(o)}}n.push({type:Kb,tag:h}),b.startHB(h,i,!1);break;case"/":g(h,Kb);break;case"!":break;default:b.startHB(h,i,!0,!1)}}function g(a,c){var d,e,f;for(e=n.length-1;e>=0&&(n[e].type!==c||n[e].tag!==a);e-=1);if(e>=0){for(d=n.length-1;d>=e;d--)f=n[d],f.type===Kb?b.endHB&&b.endHB(f.tag):b.endHTML&&b.endHTML(f.tag);n.length=e}c===Kb&&(j=a)}var h,i,j,k,l,m,n=[],o=a;n.last=function(){return this[this.length-1]};for(var p=function(a,c){return c=c.replace(/<!--(.*?)-->/g,"$1").replace(/<!\[CDATA\[(.*?)\]\]>/g,"$1"),b.chars&&b.chars(c),""};a;){if(l=!0,n.last()&&Rb[n.last()])a=a.replace(new RegExp("(.*)</"+n.last()+"[^>]*>"),p),d("",n.last());else if(0===a.indexOf("<!--")?(k=a.indexOf("-->"),k>=0&&(b.HTMLcomment&&b.HTMLcomment(a.substring(4,k)),a=a.substring(k+3),l=!1)):0===a.indexOf("</")?(m=a.match(Hb),m&&(a=a.substring(m[0].length),m[0].replace(Hb,d),l=!1)):0===a.indexOf("<")?(m=a.match(Gb),m&&(a=a.substring(m[0].length),m[0].replace(Gb,c),l=!1)):0===a.indexOf("{{")&&(m=a.match(Ib),m&&(a=a.substring(m[0].length),m[0].replace(Ib,f),l=!1)),l){h=a.indexOf("<"),i=a.indexOf("{{"),k=0>h?i:0>i?h:Math.min(h,i);var q=0>k?a:a.substring(0,k);a=0>k?"":a.substring(k),b.chars(q)}if(a==o)throw new Error("Parse Error: "+a);o=a}d()},cc=function(a){var b={children:[],type:ic},c=[b],d=!1,e=[],f=[];return bc(a,{startHTML:function(a,b,e){d={type:Lb,tag:a,attributes:b,unary:e,children:[]},N(c).children.push(d),e||c.push(d)},endHTML:function(a){d=c.pop()},HTMLcomment:function(a){d={type:jc,str:a},N(c).children.push(d)},chars:function(a){d={type:hc,str:a},N(c).children.push(d)},startHB:function(a,b,g,h){if(g)d={type:gc,obj:pc(b),literal:h,tag:a},N(c).children.push(d);else{var i=!0;switch(d={type:Kb,tag:a,children:[]},a){case Wb:d.parsed_content=qc(b),d.else_child=!1;break;case Zb:case Sb:d.reverse=a===Zb,d.sub_conditions=[],d.condition=qc(b),f.push(d);break;case Tb:case Ub:var j=N(c);j.type===Kb&&j.tag===Wb?j.else_child=d:N(f).sub_conditions.push(d),d.condition=a===Ub?oc:qc(b),i=!1;break;case Wb:case Yb:d.fsm_target=qc(b),d.sub_states={},e.push(d);break;case Vb:var k=b.body[1].name;N(e).sub_states[k]=d,i=!1;break;case Xb:d.content=qc(b)}i&&N(c).children.push(d),c.push(d)}},endHB:function(a){switch(a){case Sb:case Zb:f.pop();break;case Yb:e.pop()}c.pop()},partialHB:function(a,b){d={type:fc,tag:a,content:qc(b)},N(c).children.push(d)}}),b},dc=function(a){return a.type===gc&&a.literal},ec=function(a){return O(a,dc)},fc="partial_hb",gc="unary_hb",hc="chars",ic="root",jc="comment",kc="data-cjs-template-instance",lc=function(a){return a.outerHTML||function(a){var b,c=document.createElement("div");return c.appendChild(a.cloneNode(!0)),b=c.innerHTML,c=null,b}(a)},mc=function(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},nc=function(a,b,c,d){if(a){var e=b.computed?sc(b,c,d):b.name;return Ma.isMapConstraint(a)?a.get(e):a[e]}return void 0},oc={},pc=function(a){return a.type===Uc?a.body[0]:a},qc=function(a){return{type:Uc,body:a.type===Uc?P(a.body):[]}},rc=function(a){return a.node||a.getNodes()},sc=function(b,c,d){var e,f,g,h,i,j,k;if(b)switch(b.type){case Yc:return Ma.get(N(d).this_exp);case Xc:return b.value;case $c:return e=z[b.operator],e?e(sc(b.argument,c,d)):void 0;case _c:case ad:return e=A[b.operator],e?e(sc(b.left,c,d),sc(b.right,c,d)):void 0;case Vc:if("@"===b.name.charAt(0)){for(j=b.name.slice(1),k=d.length-1;k>=0;k--)if(f=d[k].at,f&&ca(f,j)){i=f[j];break}}else i=Ma.isMapConstraint(c)?c.get(b.name):c[b.name];return E(i)?i.get():i;case Wc:return f=sc(b.object,c,d),nc(f,b.property,c,d);case Uc:return sc(b.body[0],c,d);case ed:return f=N(d).this_exp,nc(f,b.argument,c,d);case dd:return f=d&&d.length>1?d[d.length-2].this_exp:void 0,nc(f,b.argument,c,d);case bd:return sc(b.test,c,d)?sc(b.consequent,c,d):sc(b.alternate,c,d);case Zc:if(b.callee.type===Wc?(g=sc(b.callee.object,c,d),f=nc(g,b.callee.property,c,d)):(g=a,f=sc(b.callee,c,d)),f&&V(f))return h=ea(b.arguments,function(a){return sc(a,c,d)}),f.apply(g,h)}},tc=function(a){return mc(3===a.nodeType?b(a):lc(a))},uc=function(a,b,c){arguments;return Ma(function(){return ea(a,function(a){if(a.type===gc)return a.literal?sc(a.val,b,c):mc(sc(a.val,b,c)+"");var d=rc(a);return U(d)?ea(d,tc).join(""):tc(d)}).join("")})},vc=function(a,b){return Ma(function(){var b=[];return da(a,function(a){var c=rc(a);U(c)?b.push.apply(b,c):b.push(c)}),b})},wc=/^\{\{([^\}]+)\}\}/,xc=function(a,b,c){for(var d,e,f,g=!1,h=!1,i=[],j=0,k=!1;a.length>0;){if(d=a.indexOf("{"),0===d){if(e=a.match(wc)){i[j++]=Ma(u(sc,rd(e[1]),b,c)),a=a.substr(e[0].length),k=!1,g=!0;continue}d++}0>d&&(d=a.length),f=a.substr(0,d),a=a.substr(d),k?i[j-1]=i[j-1]+f:i[j++]=f,h=k=!0}return g?h||1!==i.length?Ma(function(){return ea(i,function(a){return E(a)?a.get():F(a)?a.join(" "):""+a}).join("")}):i[0]:i.join("")},yc={},zc=function(a,b){return a===b||a&&a.is_obj===yc&&a.key===b.key&&a.value===b.value},Ac=/^(data-)?cjs-out$/,Bc=/^(data-)?cjs-on-(\w+)$/,Cc=function(a,b){var c=P(arguments,2);da(a,function(a){ca(a,b)&&a[b].apply(a,c)})},Dc=function(a){Cc.apply(this,[a,"pause"].concat(P(arguments)))},Ec=function(a){Cc.apply(this,[a,"resume"].concat(P(arguments)))},Fc=function(a){Cc.apply(this,[a,"destroy"].concat(P(arguments)))},Gc=function(a){Cc.apply(this,[a,"onAdd"].concat(P(arguments)))},Hc=function(a){Cc.apply(this,[a,"onRemove"].concat(P(arguments)))},Ic=function(b,c,d,e){var f,g,h,i=b.type;if(i===hc)return{type:i,node:w.createTextNode(b.str)};if(i===ic||i===Lb){var j,k,l=arguments,m=[];if(f=ea(b.children,function(a){return Ic(a,c,d)}),i===ic)if(e)g=e;else{if(1===f.length&&b.children[0].type===Lb)return f[0];g=w.createElement("span")}else g=w.createElement(b.tag);if(da(b.attributes,function(a){var b=a.name,e=a.value;if(b.match(Ac))m.push(c[e]=mb(g));else if(j=b.match(Bc)){var f=j[2];H(g,f,t(c[e],Ma.get(N(d).this_exp)))}else{var h=xc(e,c,d);if(E(h))if("class"===a.name){var i=Ma(function(){var a=h.get();return a.split(" ")});m.push(h,i,hb(g,i))}else m.push(h,kb(g,b,h));else g.setAttribute(a.name,h)}}),ec(b.children)){var n=uc(f,c,d);k=fb(g,n),m.push(n,k)}else{var o=vc(f,l);k=ib(g,o),m.push(o,k)}return{node:g,type:i,onAdd:function(){Ec(m),Gc(f)},onRemove:function(){Dc(m),Hc(f)},pause:function(){Dc(f.concat(m))},resume:function(){Ec(f.concat(m))},destroy:function(){Fc(f.concat(m))}}}if(i===gc){var p,q,r=b.obj,s=Ma(function(){return sc(r,c,d)});if(!b.literal){var u=Ma.get(s);Lc(u)?p=Mc(u):(p=w.createTextNode(""+u),q=eb(p,s))}return{type:i,literal:b.literal,val:r,node:p,destroy:function(){q&&q.destroy(!0),s.destroy(!0)},pause:function(){q&&q.pause()},resume:function(){q&&q.resume()},onRemove:function(){this.pause()},onAdd:function(){this.resume()}}}if(i===Kb){var v=b.tag;if(v===Wb){var x,y=[],z=[];return h=[],{type:i,onRemove:function(){da(h,Hc)},onAdd:function(){da(h,Gc)},pause:function(){da(h,Dc)},resume:function(){da(h,Ec)},destroy:function(){da(h,Fc),h=[]},getNodes:function(){x=sc(b.parsed_content,c,d),F(x)&&(x=x.toArray()),U(x)?0===x.length&&b.else_child&&(x=[oc]):G(x)?(x=x.entries(),da(x,function(a){a.is_obj=yc})):(E(x)&&(x=x.get()),x=ea(x,function(a,b){return{key:b,value:a,is_obj:yc}}));var a=Ga(y,x,zc),e=[],f=[];y=x,da(a.index_changed,function(a){var b=z[a.from];b&&b.at&&b.at.index&&b.at.index.set(a.to)}),da(a.removed,function(a){var b=a.from,c=z[b];f.push.apply(f,h[b]),la(h,b),c&&c.at&&da(c.at,function(a){a.destroy(!0)})}),da(a.added,function(a){var f=a.item,g=a.to,i=f===oc,j=i?!1:f&&f.is_obj===yc?{this_exp:f.value,at:{key:Ma.constraint(f.key)}}:{this_exp:f,at:{index:Ma.constraint(g)}},k=i?d:d.concat(j),l=i?b.else_child.children:b.children,m=ea(l,function(a){return Ic(a,c,k)});h.splice(g,0,m),z.splice(g,0,j),e.push.apply(e,m)},this),da(a.moved,function(a){var b=a.from_index,c=a.to_index,d=(mdom[b],h[b]),e=z[b];la(h,b),h.splice(c,0,d),la(z,b),z.splice(c,0,e)}),Hc(f),Fc(f),Gc(e);var g=ea(h,function(a){var b=S(ea(a,function(a){return rc(a)}),!0);return b});return S(g,!0)}}}if(v===Sb||v===Zb){f=[],h=[];var A=-1;return{type:i,onRemove:function(){Hc(h)},onAdd:function(){Gc(h)},pause:function(){Dc(h)},resume:function(){Ec(h)},destroy:function(){A>=0&&(h=[],A=-1),da(f,Fc)},getNodes:function(){var a,e,g=b.sub_conditions.length,i=!!Ma.get(sc(b.condition,c,d)),j=!1;if(b.reverse&&(i=!i),i)a=0,j=b.children;else if(g>0)for(a=0;g>a;a++)if(i=b.sub_conditions[a],i.condition===oc||sc(i.condition,c,d)){j=i.children,a++;break}return A!==a&&Hc(h),j?(f[a]?h=f[a]:(j=0===a?b.children:b.sub_conditions[a-1].children,h=f[a]=ea(j,function(a){return Ic(a,c,d)})),e=S(ea(h,rc),!0)):e=h=[],A!==a&&Gc(h),A=a,e}}}if(v===Yb){var B={},C=!1;return h=[],{pause:function(){Dc(h)},resume:function(){Ec(h)},destroy:function(){C&&(Fc(h),h=[],C=!1)},onRemove:function(){this.pause()},onAdd:function(){this.resume()},type:i,getNodes:function(){var a,e=sc(b.fsm_target,c,d),f=e.getState(),g=function(a){return Ic(a,c,d)},i=[];C!==f&&Hc(h);for(a in b.sub_states)if(b.sub_states.hasOwnProperty(a)&&f===a){ca(B,a)||(B[a]=ea(b.sub_states[a].children,g)),h=B[a],i=S(ea(h,rc),!0);break}return C!==f&&Gc(h),C=f,i}}}if(v===Xb){var D=sc(b.content,c,d),I=d.concat({this_exp:D});return f=S(ea(b.children,function(a){return Ic(a,D,I)})),{pause:function(){Dc(f)},resume:function(){Ec(f)},onRemove:function(){Hc(f)},onAdd:function(){Gc(f)},destroy:function(){Fc(f)},node:S(ea(f,rc),!0)}}}else{if(i===fc){var J,K,L,M=b.content,O=function(){return M.type===Uc?ea(M.body,function(a){return sc(a,c,d)}):[sc(b.content,c,d)]},P=!1;if(ca(Jc,b.tag))J=Jc[b.tag],K=J.apply(a,O()),L=Tc(K);else{if(!ca(Kc,b.tag))throw new Error("Could not find partial with name '"+b.tag+"'");J=Kc[b.tag],L=J.apply(a,O()),K=L.node,P=!0}return{node:K,pause:function(){L&&L.pause(K)},destroy:function(){P?L.destroy(K):Ma.destroyTemplate(K)},onAdd:function(){L&&L.onAdd.apply(L,[K].concat(O()))},onRemove:function(){L&&L.onRemove(K)},resume:function(){L&&L.resume(K)}}}if(i===jc)return{node:w.createComment(b.str)}}return{node:[]}},Jc={},Kc={},Lc=function(a){return Ya(a)||$a(a)||Z(a)},Mc=function(a){return Ya(a)||$a(a)?a[0]:Z(a)?a:!1},Nc=function(a){return Ya(a)||$a(a)?aa(a):a},Oc=[],Pc=[],Qc=1,Rc=function(a,b){var c=this,d=Ic(c,a,[{this_exp:a}],Mc(b)),e=d.node,f=d.id=Qc++;return Pc[f]=d,Oc[f]=e,e.setAttribute(kc,f),e},Sc=function(a){var b=a.getAttribute(kc);return b||(b=ja(Oc,a)),b},Tc=function(a){var b=Sc(a);return b>=0?Pc[b]:!1};ga(Ma,{createTemplate:function(a){W(a)||(a=Ya(a)||$a(a)?a.length>0?v(b(a[0])):"":Y(a)?v(b(a)):""+a);var c=cc(a);return arguments.length>=2?Rc.apply(c,P(arguments)):t(Rc,c)},registerCustomPartial:function(a,b){return Kc[a]=function(){var a=Mc(b.createNode.apply(this,arguments));return{node:a,onAdd:function(){b.onAdd&&b.onAdd.apply(this,arguments)},onRemove:function(){b.onRemove&&b.onRemove.apply(this,arguments)},destroy:function(){b.destroyNode&&b.destroyNode.apply(this,arguments)},pause:function(){b.pause&&b.pause.apply(this,arguments)},resume:function(){b.resume&&b.resume.apply(this,arguments)}}},this},registerPartial:function(a,b){return Jc[a]=b,this},unregisterPartial:function(a){return delete Jc[a],delete Kc[a],this},destroyTemplate:function(a){var b=Sc(Mc(a)),c=b>=0?Pc[b]:!1;return c&&(delete Pc[b],c.destroy()),this},pauseTemplate:function(a){var b=Tc(a);return b&&b.pause(),this},resumeTemplate:function(a){var b=Tc(a);return b&&b.resume(),this},createParsedConstraint:function(a,b){return Ma(function(){try{var c=rd(Ma.get(a));return c.type===Xc?c.value:sc(c,b,[b])}catch(d){console.error(d)}})}});var Uc="Compound",Vc="Identifier",Wc="MemberExpression",Xc="Literal",Yc="ThisExpression",Zc="CallExpression",$c="UnaryExpression",_c="BinaryExpression",ad="LogicalExpression",bd="ConditionalExpression",cd="Array",dd="ParentExpression",ed="CurrLevelExpression",fd=46,gd=44,hd=39,id=34,jd=40,kd=41,ld=91,md=93,nd=63,od=59,pd=58,qd=function(a,b){var c=new Error(a+" at character "+b);throw c.index=b,c.dedscription=a,c},rd=function(){var a=!0,b={"-":a,"!":a,"~":a,"+":a},c={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},d=function(a){var b,c=0;for(var d in a)(b=d.length)>c&&a.hasOwnProperty(d)&&(c=b);return c},e=d(b),f=d(c),g={"true":!0,"false":!1,"null":null},h="this",i=function(a){return c[a]||0},j=function(a,b,c){var d="||"===a||"&&"===a?ad:_c;return{type:d,operator:a,left:b,right:c}},k=function(a){return a>=48&&57>=a},l=function(a){return 36===a||95===a||a>=65&&90>=a||64===a||a>=97&&122>=a},m=function(a){return 36===a||95===a||a>=65&&90>=a||a>=97&&122>=a||a>=48&&57>=a},n=function(a){for(var d,n,o=0,p=a.charAt,q=a.charCodeAt,r=function(b){return p.call(a,b)},s=function(b){return q.call(a,b)},t=a.length,u=function(){for(var a=s(o);32===a||9===a;)a=s(++o)},v=function(){var a,b,c=x();return u(),s(o)!==nd?c:(o++,a=v(),a||qd("Expected expression",o),u(),s(o)===pd?(o++,b=v(),b||qd("Expected expression",o),{type:bd,test:c,consequent:a,alternate:b}):void qd("Expected :",o))},w=function(){u();for(var b=a.substr(o,f),d=b.length;d>0;){if(c.hasOwnProperty(b))return o+=d,b;b=b.substr(0,--d)}return!1},x=function(){var a,b,c,d,e,f,g,h;if(f=y(),b=w(),!b)return f;for(e={value:b,prec:i(b)},g=y(),g||qd("Expected expression after "+b,o),d=[f,e,g];(b=w())&&(c=i(b),0!==c);){for(e={value:b,prec:c};d.length>2&&c<=d[d.length-2].prec;)g=d.pop(),b=d.pop().value,f=d.pop(),a=j(b,f,g),d.push(a);a=y(),a||qd("Expected expression after "+b,o),d.push(e,a)}for(h=d.length-1,a=d[h];h>1;)a=j(d[h-1].value,d[h-2],a),h-=2;return a},y=function(){var c,d,f;if(u(),c=s(o),c===fd&&47===a.charCodeAt(o+1))return o+=2,{type:ed,argument:y()};if(c===fd&&a.charCodeAt(o+1)===fd&&47===a.charCodeAt(o+2))return o+=3,{type:dd,argument:y()};if(k(c)||c===fd)return z();if(c===hd||c===id)return A();if(l(c)||c===jd)return D();for(d=a.substr(o,e),f=d.length;f>0;){if(b.hasOwnProperty(d))return o+=f,{type:$c,operator:d,argument:y(),prefix:!0};d=d.substr(0,--f)}return!1},z=function(){for(var a,b="";k(s(o));)b+=r(o++);if(s(o)===fd)for(b+=r(o++);k(s(o));)b+=r(o++);if(a=r(o),"e"===a||"E"===a){for(b+=r(o++),a=r(o),("+"===a||"-"===a)&&(b+=r(o++));k(s(o));)b+=r(o++);k(s(o-1))||qd("Expected exponent ("+b+r(o)+")",o)}return l(s(o))&&qd("Variable names cannot start with a number ("+b+r(o)+")",o),{type:Xc,value:parseFloat(b),raw:b}},A=function(){for(var a,b="",c=r(o++),d=!1;t>o;){if(a=r(o++),a===c){d=!0;break}if("\\"===a)switch(a=r(o++)){case"n":b+="\n";break;case"r":b+="\r";break;case"t":b+=" ";break;case"b":b+="\b";break;case"f":b+="\f";break;case"v":b+=""}else b+=a}return d||qd('Unclosed quote after "'+b+'"',o),{type:Xc,value:b,raw:c+b+c}},B=function(){var b,c=s(o),d=o;for(l(c)?o++:qd("Unexpected "+r(o),o);t>o&&(c=s(o),m(c));)o++;return b=a.slice(d,o),g.hasOwnProperty(b)?{type:Xc,value:g[b],raw:b}:b===h?{type:Yc}:{type:Vc,name:b}},C=function(a){for(var b,c,d=[];t>o;){if(u(),b=s(o),b===a){o++;break}b===gd?o++:(c=v(),c&&c.type!==Uc||qd("Expected comma",o),d.push(c))}return d},D=function(){var a,b;for(a=s(o),b=a===jd?E():B(),u(),a=s(o);a===fd||a===ld||a===jd;)o++,a===fd?(u(),b={type:Wc,computed:!1,object:b,property:B()}):a===ld?(b={type:Wc,computed:!0,object:b,property:v()},u(),a=s(o),a!==md&&qd("Unclosed [",o),o++):a===jd&&(b={type:Zc,arguments:C(kd),callee:b}),u(),a=s(o);return b},E=function(){o++;var a=v();return u(),s(o)===kd?(o++,a):void qd("Unclosed (",o)},F=function(){return o++,{type:cd,body:C(md)}},G=[];t>o;)d=s(o),d===od||d===gd?o++:d===ld&&(n=F())?G.push(n):(n=v())?G.push(n):t>o&&qd('Unexpected "'+r(o)+'"',o);return 1===G.length?G[0]:{type:Uc,body:G}};return n}();return Ma}(this);"undefined"!=typeof module&&module.exports&&(module.exports=cjs); | ||
//# sourceMappingURL=cjs.min.js.map |
{ | ||
"name": "constraintjs", | ||
"version": "0.9.8-beta2", | ||
"version": "0.9.8-beta3", | ||
"description": "Constraint library for JavaScript", | ||
@@ -5,0 +5,0 @@ "author": "Stephen Oney <swloney@gmail.com> (http://from.so/)", |
@@ -31,3 +31,3 @@ var child_is_dynamic_html = function(child) { return child.type === UNARY_HB_TYPE && child.literal; }, | ||
if(object) { | ||
var nodeName = [prop_node.computed ? get_node_value(prop_node, context, lineage) : prop_node.name]; | ||
var nodeName = prop_node.computed ? get_node_value(prop_node, context, lineage) : prop_node.name; | ||
if(cjs.isMapConstraint(object)) { | ||
@@ -34,0 +34,0 @@ return object.get(nodeName); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1180670