ractive
Version:
Next-generation DOM manipulation
2 lines • 62.3 kB
JavaScript
!function(a){"use strict";var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,mb,nb,ob,pb="0.3.6",qb=a.document||null,rb={},sb={},tb={},ub={},vb={}.hasOwnProperty,wb=function(){},xb=a.console||{log:wb,warn:wb},yb={},zb="Missing Ractive.parse - cannot parse template. Either preparse or use the version that includes the parser",Ab=1,Bb=2,Cb=3,Db=4,Eb=7,Fb=8,Gb=15,Hb=30,Ib={unset:!0},Jb=qb?qb.createElement("div"):null,Kb={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};try{Object.defineProperty({},"test",{value:0}),Object.defineProperties({},{test:{value:0}}),qb&&(Object.defineProperty(Jb,"test",{value:0}),Object.defineProperties(Jb,{test:{value:0}})),F=Object.defineProperty,G=Object.defineProperties}catch(Lb){F=function(a,b,c){a[b]=c.value},G=function(a,b){var c;for(c in b)b.hasOwnProperty(c)&&F(a,c,b[c])},ob=!0}try{Object.create(null),H=Object.create,I=function(){return Object.create(null)}}catch(Lb){H=function(){var a=function(){};return function(b,c){var d;return a.prototype=b,d=new a,c&&Object.defineProperties(d,c),d}}(),I=function(){return{}}}var Mb,Nb,Ob,Pb=function(a){return a.replace(/[A-Z]/g,function(a){return"-"+a.toLowerCase()})};!function(){qb&&(void 0!==Jb.style.transition?(Nb="transition",Ob="transitionend",Mb=!0):void 0!==Jb.style.webkitTransition?(Nb="webkitTransition",Ob="webkitTransitionEnd",Mb=!0):Mb=!1)}(),function(a){var b=a.document;b&&(Date.now||(Date.now=function(){return+new Date}),b&&!b.createElementNS&&(b.createElementNS=function(a,c){if(a&&"http://www.w3.org/1999/xhtml"!==a)throw"This browser does not support namespaces other than http://www.w3.org/1999/xhtml";return b.createElement(c)}),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){var c;for(void 0===b&&(b=0),0>b&&(b+=this.length),0>b&&(b=0),c=this.length;c>b;b++)if(vb.call(this,b)&&this[b]===a)return b;return-1}),Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var c,d;for(c=0,d=this.length;d>c;c+=1)vb.call(this,c)&&a.call(b,this[c],c,this)}),Array.prototype.map||(Array.prototype.map=function(a,b){var c,d,e=[];for(c=0,d=this.length;d>c;c+=1)vb.call(this,c)&&(e[c]=a.call(b,this[c],c,this));return e}),Array.prototype.filter||(Array.prototype.filter=function(a,b){var c,d,e=[];for(c=0,d=this.length;d>c;c+=1)vb.call(this,c)&&a.call(b,this[c],c,this)&&(e[e.length]=this[c]);return e}),a.addEventListener||function(a,b){var c,d,e,f,g;c=function(a,b){var c,d=this;for(c in a)d[c]=a[c];d.currentTarget=b,d.target=a.srcElement||b,d.timeStamp=+new Date,d.preventDefault=function(){a.returnValue=!1},d.stopPropagation=function(){a.cancelBubble=!0}},d=function(a,b){var d,e,f=this;d=f.listeners||(f.listeners=[]),e=d.length,d[e]=[b,function(a){b.call(f,new c(a,f))}],f.attachEvent("on"+a,d[e][1])},e=function(a,b){var c,d,e=this;if(e.listeners)for(c=e.listeners,d=c.length;d--;)c[d][0]===b&&e.detachEvent("on"+a,c[d][1])},a.addEventListener=b.addEventListener=d,a.removeEventListener=b.removeEventListener=e,"Element"in a?(Element.prototype.addEventListener=d,Element.prototype.removeEventListener=e):(f=b.getElementsByTagName("head")[0],g=b.createElement("style"),f.insertBefore(g,f.firstChild),g.styleSheet.cssText="*{-ms-event-prototype:expression(!this.addEventListener&&(this.addEventListener=addEventListener)&&(this.removeEventListener=removeEventListener))}")}(a,b))}(a),function(){var a,b,c,d,e,f,g,h,i,j,k,l;Q=function(){var b,d,e=this.parentNode;return this.fragment?(b=a(this))?(this.interpolator=b,this.keypath=b.keypath||b.descriptor.r,(d=c(this))?(e._ractive.binding=d,this.twoway=!0,!0):!1):!1:!1},b=function(){this._ractive.binding.update()},a=function(a){var b;return 1!==a.fragment.items.length?null:(b=a.fragment.items[0],b.type!==Bb?null:b.keypath||b.ref?b:null)},c=function(a){var b=a.parentNode;if("SELECT"===b.tagName)return b.multiple?new f(a,b):new g(a,b);if("checkbox"===b.type||"radio"===b.type){if("name"===a.propertyName){if("checkbox"===b.type)return new i(a,b);if("radio"===b.type)return new h(a,b)}return"checked"===a.propertyName?new j(a,b):null}return"value"!==a.propertyName&&xb.warn("This is... odd"),"file"===a.parentNode.type?new k(a,b):new l(a,b)},f=function(a,c){d(this,a,c),c.addEventListener("change",b,!1)},f.prototype={update:function(){var a,b,c,d,e,f,g;for(a=this.attr,e=a.value||[],b=[],c=this.node.querySelectorAll("option:checked"),g=c.length,d=0;g>d;d+=1)b[b.length]=c[d]._ractive.value;for(f=g!==e.length,d=b.length;d--;)b[d]!==e[d]&&(f=!0);(f=!0)&&(a.receiving=!0,a.value=b,this.root.set(this.keypath,b),a.receiving=!1)},teardown:function(){this.node.removeEventListener("change",b,!1)}},g=function(a,c){d(this,a,c),c.addEventListener("change",b,!1)},g.prototype={update:function(){var a,b;a=this.node.querySelector("option:checked"),a&&(b=a._ractive.value,this.attr.receiving=!0,this.attr.value=b,this.root.set(this.keypath,b),this.attr.receiving=!1)},teardown:function(){this.node.removeEventListener("change",b,!1)}},h=function(a,c){d(this,a,c),c.name="{{"+a.keypath+"}}",c.addEventListener("change",b,!1),c.attachEvent&&c.addEventListener("click",b,!1)},h.prototype={update:function(){var a=this.node;a.checked&&(this.attr.receiving=!0,this.root.set(this.keypath,a._ractive?a._ractive.value:a.value),this.attr.receiving=!1)},teardown:function(){this.node.removeEventListener("change",b,!1),this.node.removeEventListener("click",b,!1)}},i=function(a,c){d(this,a,c),c.name="{{"+this.keypath+"}}",this.query='input[type="checkbox"][name="'+c.name+'"]',c.addEventListener("change",b,!1),c.attachEvent&&c.addEventListener("click",b,!1)},i.prototype={update:function(){var a,b,c,d,f,g;for(a=this.root.get(this.keypath),c=this.root.el.querySelectorAll(this.query),d=c.length,b=[],f=0;d>f;f+=1)g=c[f],g.checked&&(b[b.length]=g._ractive.value);e(a,b)||(this.attr.receiving=!0,this.root.set(this.keypath,b),this.attr.receiving=!1)},teardown:function(){this.node.removeEventListener("change",b,!1),this.node.removeEventListener("click",b,!1)}},j=function(a,c){d(this,a,c),c.addEventListener("change",b,!1),c.attachEvent&&c.addEventListener("click",b,!1)},j.prototype={update:function(){this.attr.receiving=!0,this.root.set(this.keypath,this.node.checked),this.attr.receiving=!1},teardown:function(){this.node.removeEventListener("change",b,!1),this.node.removeEventListener("click",b,!1)}},k=function(a,c){d(this,a,c),c.addEventListener("change",b,!1)},k.prototype={update:function(){this.attr.root.set(this.attr.keypath,this.attr.parentNode.files)},teardown:function(){this.node.removeEventListener("change",b,!1)}},l=function(a,c){d(this,a,c),c.addEventListener("change",b,!1),this.root.lazy||(c.addEventListener("input",b,!1),c.attachEvent&&c.addEventListener("keyup",b,!1))},l.prototype={update:function(){var a=this.attr,b=a.parentNode.value;+b+""===b&&-1===b.indexOf("e")&&(b=+b),a.receiving=!0,a.root.set(a.keypath,b),a.receiving=!1},teardown:function(){this.node.removeEventListener("change",b,!1),this.node.removeEventListener("input",b,!1),this.node.removeEventListener("keyup",b,!1)}},d=function(a,b,c){a.attr=b,a.node=c,a.root=b.root,a.keypath=b.keypath},e=function(a,b){var c;if(!s(a)||!s(b))return!1;if(a.length!==b.length)return!1;for(c=a.length;c--;)if(a[c]!==b[c])return!1;return!0}}(),function(){var a,b,c,d,e,f,g,h;P=function(){var d;if(!this.ready)return this;if(d=this.parentNode,"SELECT"===d.tagName&&"value"===this.name)return this.update=b,this.deferredUpdate=c,this.update();if(this.isFileInputValue)return this.update=a,this;if(this.twoway&&"name"===this.name){if("radio"===d.type)return this.update=f,this.update();if("checkbox"===d.type)return this.update=g,this.update()}return this.update=h,this.update()},a=function(){return this},c=function(){this.deferredUpdate=this.parentNode.multiple?e:d,this.deferredUpdate()},b=function(){return this.root._defSelectValues.push(this),this},d=function(){var a,b,c,d=this.fragment.getValue();for(this.value=d,a=this.parentNode.querySelectorAll("option"),c=a.length;c--;)if(b=a[c],b._ractive.value===d)return b.selected=!0,this;return this},e=function(){var a,b,c=this.fragment.getValue();for(s(c)||(c=[c]),a=this.parentNode.querySelectorAll("option"),b=a.length;b--;)a[b].selected=-1!==c.indexOf(a[b]._ractive.value);return this.value=c,this},f=function(){var a,b;return a=this.parentNode,b=this.fragment.getValue(),a.checked=b===a._ractive.value,this},g=function(){var a,b;return a=this.parentNode,b=this.fragment.getValue(),s(b)?(a.checked=-1!==b.indexOf(a._ractive.value),this):(a.checked=b===a._ractive.value,this)},h=function(){var a,b;if(a=this.parentNode,b=this.fragment.getValue(),this.isValueAttribute&&(a._ractive.value=b),void 0===b&&(b=""),b!==this.value){if(this.useProperty)return this.receiving||(a[this.propertyName]=b),this.value=b,this;if(this.namespace)return a.setAttributeNS(this.namespace,this.name,b),this.value=b,this;"id"===this.name&&(void 0!==this.value&&(this.root.nodes[this.value]=void 0),this.root.nodes[b]=a),a.setAttribute(this.name,b),this.value=b}return this}}(),J=function(a,b){var c,d,e;for(d in b)if(vb.call(b,d))for(e=d.split("-"),c=e.length;c--;)K(a,e[c],b[d],a.parentFragment.contextStack)},function(){var a,c,d,e,f,g,h,i;K=function(b,c,d,e,f){var g,h;g=b.ractify().events,h=g[c]||(g[c]=new a(b,c,e,f)),h.add(d)},a=function(a,c,d){var e;this.element=a,this.root=a.root,this.node=a.node,this.name=c,this.contextStack=d,this.proxies=[],(e=this.root.eventDefinitions[c]||b.eventDefinitions[c])?this.custom=e(this.node,i(c)):this.node.addEventListener(c,h,!1)},a.prototype={add:function(a){this.proxies[this.proxies.length]=new c(this.element,this.root,a,this.contextStack)},teardown:function(){var a;for(this.custom?this.custom.teardown():this.node.removeEventListener(this.name,h,!1),a=this.proxies.length;a--;)this.proxies[a].teardown()},fire:function(a){for(var b=this.proxies.length;b--;)this.proxies[b].fire(a)}},c=function(a,b,c,g){var h;return this.root=b,h=c.n||c,this.n="string"==typeof h?h:new $({descriptor:c.n,root:this.root,owner:a,contextStack:g}),c.a?(this.a=c.a,this.fire=e,void 0):c.d?(this.d=new $({descriptor:c.d,root:this.root,owner:a,contextStack:g}),this.fire=f,void 0):(this.fire=d,void 0)},c.prototype={teardown:function(){this.n.teardown&&this.n.teardown(),this.d&&this.d.teardown()},bubble:wb},d=function(a){this.root.fire(this.n.toString(),a)},e=function(a){this.root.fire(this.n.toString(),a,this.a)},f=function(a){this.root.fire(this.n.toString(),a,this.d.toJSON())},h=function(a){var b=this._ractive;b.events[a.type].fire({node:this,original:a,index:b.index,keypath:b.keypath,context:b.root.get(b.keypath)})},g={},i=function(a){return g[a]?g[a]:g[a]=function(b){var c=b.node._ractive;b.index=c.index,b.keypath=c.keypath,b.context=c.root.get(c.keypath),c.events[a].fire(b)}}}(),L=function(a,b,c,d){"string"!=typeof c.f||b&&b.namespaceURI&&b.namespaceURI!==Kb.html?"style"===c.e&&void 0!==b.styleSheet?(a.fragment=new $({descriptor:c.f,root:a.root,contextStack:a.parentFragment.contextStack,owner:a}),d&&(a.bubble=function(){b.styleSheet.cssText=a.fragment.toString()})):(a.fragment=new R({descriptor:c.f,root:a.root,parentNode:b,contextStack:a.parentFragment.contextStack,owner:a}),d&&b.appendChild(a.fragment.docFrag)):(a.html=c.f,d&&(b.innerHTML=a.html))},M=function(a,b){switch(a.ractify(),a.descriptor.e){case"select":case"textarea":return b.value&&b.value.bind(),void 0;case"input":if("radio"===a.node.type||"checkbox"===a.node.type){if(b.name&&b.name.bind())return a.node._ractive.binding.update(),void 0;if(b.checked&&b.checked.bind())return}if(b.value&&b.value.bind())return}},N=function(a,b){var c,d,e;a.attributes=[];for(c in b)vb.call(b,c)&&(d=b[c],e=new T({element:a,name:c,value:d,root:a.root,parentNode:a.node,contextStack:a.parentFragment.contextStack}),a.attributes[a.attributes.length]=e,("value"===c||"name"===c||"checked"===c)&&(a.attributes[c]=e),"name"!==c&&e.update());return a.attributes},O=function(a,b){return a.a&&a.a.xmlns?a.a.xmlns:"svg"===a.e.toLowerCase()?Kb.svg:b.namespaceURI},z=function(a,c,d,e,f){var g,h,i,j,k;c.transitionsEnabled&&("string"==typeof a?g=a:(g=a.n,a.a?h=a.a:a.d&&(i=new $({descriptor:a.d,root:c,owner:d,contextStack:d.parentFragment.contextStack}),h=i.toJSON(),i.teardown())),k=c.transitions[g]||b.transitions[g],k&&(j=c._transitionManager,j.push(d.node),k.call(c,d.node,function(){j.pop(d.node)},h,f)))},B=function(a,b){return a.components[b]},x=function(a,b){var c,d=[];for(c=qb.createElement("div"),c.innerHTML=a;c.firstChild;)d[d.length]=c.firstChild,b.appendChild(c.firstChild);return d},function(){var a,b,c;y=function(b,c,d,e,f){var g,h,i,j,k,l,m;for(i=c.descriptor.i,g=d;e>g;g+=1)h=c.fragments[g],j=g-f,k=g,l=c.keypath+"."+(g-f),m=c.keypath+"."+g,h.index+=f,a(h,i,j,k,f,l,m);p(b)},a=function(d,e,f,g,h,i,j){var k,l,m;for(d.indexRefs&&void 0!==d.indexRefs[e]&&(d.indexRefs[e]=g),k=d.contextStack.length;k--;)m=d.contextStack[k],m.substr(0,i.length)===i&&(d.contextStack[k]=m.replace(i,j));for(k=d.items.length;k--;)switch(l=d.items[k],l.type){case Eb:b(l,e,f,g,h,i,j);break;case Fb:a(l.fragment,e,f,g,h,i,j);break;case Db:case Bb:case Cb:c(l,e,f,g,h,i,j)}},b=function(b,c,d,e,f,g,h){var i,j;for(i=b.attributes.length;i--;)j=b.attributes[i],j.fragment&&(a(j.fragment,c,d,e,f,g,h),j.twoway&&j.updateBindings());if(b.proxyFrags)for(i=b.proxyFrags.length;i--;)a(b.proxyFrags[i],c,d,e,f,g,h);b.node._ractive&&(b.node._ractive.keypath.substr(0,g.length)===g&&(b.node._ractive.keypath=b.node._ractive.keypath.replace(g,h)),void 0!==c&&(b.node._ractive.index[c]=e)),b.fragment&&a(b.fragment,c,d,e,f,g,h)},c=function(b,c,d,e,f,g,h){var i;if(b.descriptor.x&&(b.keypath&&k(b),b.expressionResolver&&b.expressionResolver.teardown(),b.expressionResolver=new cb(b)),b.keypath?b.keypath.substr(0,g.length)===g&&(k(b),b.keypath=b.keypath.replace(g,h),j(b)):b.indexRef===c&&(b.value=e,b.render(e)),b.fragments)for(i=b.fragments.length;i--;)a(b.fragments[i],c,d,e,f,g,h)}}(),function(a){var b,c,d,e;db=function(a,d,e,f,g){var h,i;for(this.root=a,this.keypath=d,this.fn=c(e,f.length),this.values=[],this.refs=[],h=f.length;h--;)i=f[h],i[0]?this.values[h]=i[1]:this.refs[this.refs.length]=new b(a,i[1],this,h,g);this.selfUpdating=this.refs.length<=1},db.prototype={bubble:function(){this.selfUpdating?this.update():this.deferred||(this.root._defEvals[this.root._defEvals.length]=this,this.deferred=!0)},update:function(){var a;if(this.evaluating)return this;this.evaluating=!0;try{a=this.fn.apply(null,this.values)}catch(b){if(this.root.debug)throw b;a=void 0}return v(a,this.value)||(i(this.root,this.keypath),this.root._cache[this.keypath]=a,l(this.root,this.keypath),this.value=a),this.evaluating=!1,this},teardown:function(){for(;this.refs.length;)this.refs.pop().teardown();i(this.root,this.keypath),this.root._evaluators[this.keypath]=null},refresh:function(){this.selfUpdating||(this.deferred=!0);for(var a=this.refs.length;a--;)this.refs[a].update();this.deferred&&(this.update(),this.deferred=!1)}},b=function(a,b,c,d,f){var g;this.evaluator=c,this.keypath=b,this.root=a,this.argNum=d,this.type=Hb,this.priority=f,g=a.get(b),"function"==typeof g&&(g=g._wrapped||e(g,a)),this.value=c.values[d]=g,j(this)},b.prototype={update:function(){var a=this.root.get(this.keypath);"function"==typeof a&&(a=a._wrapped||e(a,this.root)),v(a,this.value)||(this.evaluator.values[this.argNum]=a,this.evaluator.bubble(),this.value=a)},teardown:function(){k(this)}},c=function(b,c){var d,e;if(b=b.replace(/\$\{([0-9]+)\}/g,"_$1"),a[b])return a[b];for(e=[];c--;)e[c]="_"+c;return d=new Function(e.join(","),"return("+b+")"),a[b]=d,d},d=/this/,e=function(a,b){var c;if(!d.test(a.toString()))return a._wrapped=a;F(a,"_wrapped",{value:function(){return a.apply(b,arguments)},writable:!0});for(c in a)vb.call(a,c)&&(a._wrapped[c]=a[c]);return a._wrapped}}({}),function(){var a,b;cb=function(b){var c,d,e,f,g;for(this.root=b.root,this.mustache=b,this.args=[],this.scouts=[],c=b.descriptor.x,g=b.parentFragment.indexRefs,this.str=c.s,e=this.unresolved=c.r?c.r.length:0,e||this.init(),d=0;e>d;d+=1)f=c.r[d],g&&void 0!==g[f]?this.resolveRef(d,!0,g[f]):this.scouts[this.scouts.length]=new a(this,f,b.contextStack,d)},cb.prototype={init:function(){this.keypath=b(this.str,this.args),this.createEvaluator(),this.mustache.resolve(this.keypath)},teardown:function(){for(;this.scouts.length;)this.scouts.pop().teardown()},resolveRef:function(a,b,c){this.args[a]=[b,c],--this.unresolved||this.init()},createEvaluator:function(){this.root._evaluators[this.keypath]?this.root._evaluators[this.keypath].refresh():(this.root._evaluators[this.keypath]=new db(this.root,this.keypath,this.str,this.args,this.mustache.priority),this.root._evaluators[this.keypath].update())}},a=function(a,b,c,d){var e,f;f=this.root=a.root,e=o(f,b,c),e?a.resolveRef(d,!1,e):(this.ref=b,this.argNum=d,this.resolver=a,this.contextStack=c,f._pendingResolution[f._pendingResolution.length]=this)},a.prototype={resolve:function(a){this.keypath=a,this.resolver.resolveRef(this.argNum,!1,a)},teardown:function(){this.keypath||h(this)}},b=function(a,b){var c;return c=a.replace(/\$\{([0-9]+)\}/g,function(a,c){return b[c][1]}),"("+c.replace(/[\.\[\]]/g,"-")+")"}}(),function(){var a,c;A=function(d,e){var f,g;if(g=a(d,e))return g;if(g=a(b,e))return g;if(qb&&(f=qb.getElementById(e),f&&"SCRIPT"===f.tagName)){if(!b.parse)throw new Error(zb);b.partials[e]=b.parse(f.innerHTML)}return g=b.partials[e],g?c(g):(d.debug&&xb&&xb.warn&&xb.warn('Could not find descriptor for partial "'+e+'"'),[])},a=function(a,d){if(a.partials[d]){if("string"==typeof a.partials[d]){if(!b.parse)throw new Error(zb);a.partials[d]=b.parse(a.partials[d])}return c(a.partials[d])}},c=function(a){return 1===a.length&&"string"==typeof a[0]?a[0]:a}}(),jb=function(a,b){var c,d,e,f,g;if(a.owner=b.owner,e=a.owner.parentFragment,a.root=b.root,a.parentNode=b.parentNode,a.contextStack=b.contextStack||[],a.owner.type===Db&&(a.index=b.index),e&&(f=e.indexRefs)){a.indexRefs=I();for(g in f)a.indexRefs[g]=f[g]}for(a.priority=e?e.priority+1:0,b.indexRef&&(a.indexRefs||(a.indexRefs={}),a.indexRefs[b.indexRef]=b.index),a.items=[],c=b.descriptor?b.descriptor.length:0,d=0;c>d;d+=1)a.items[a.items.length]=a.createItem({parentFragment:a,descriptor:b.descriptor[d],index:d})},C=function(a){var b,c,d;for(b=a.items.length;b--;)if(c=a.items[b],c.type!==Ab){if(c.type!==Bb)return!1;if(d)return!1;d=!0}return!0},gb=function(a,b){var c,d,e;e=a.parentFragment=b.parentFragment,a.root=e.root,a.contextStack=e.contextStack,a.descriptor=b.descriptor,a.index=b.index||0,a.priority=e.priority,e.parentNode&&(a.parentNode=e.parentNode),a.type=b.descriptor.t,b.descriptor.r&&(e.indexRefs&&void 0!==e.indexRefs[b.descriptor.r]?(d=e.indexRefs[b.descriptor.r],a.indexRef=b.descriptor.r,a.value=d,a.render(a.value)):(c=o(a.root,b.descriptor.r,a.contextStack),c?a.resolve(c):(a.ref=b.descriptor.r,a.root._pendingResolution[a.root._pendingResolution.length]=a,a.descriptor.n&&a.render(!1)))),b.descriptor.x&&(a.expressionResolver=new cb(a))},hb=function(){var a;a=this.root.get(this.keypath,!0),v(a,this.value)||(this.render(a),this.value=a)},ib=function(a){this.keypath=a,j(this),this.update(),this.expressionResolver&&(this.expressionResolver=null)},function(){var a,b,c,d;kb=function(e,f){var g;return g={descriptor:e.descriptor.f,root:e.root,parentNode:e.parentNode,owner:e},e.descriptor.n?(d(e,f,!0,g),void 0):(s(f)?a(e,f,g):t(f)?e.descriptor.i?b(e,f,g):c(e,g):d(e,f,!1,g),void 0)},a=function(a,b,c){var d,e,f;if(e=b.length,e<a.length)for(f=a.fragments.splice(e,a.length-e);f.length;)f.pop().teardown(!0);else if(e>a.length)for(d=a.length;e>d;d+=1)c.contextStack=a.contextStack.concat(a.keypath+"."+d),c.index=d,a.descriptor.i&&(c.indexRef=a.descriptor.i),a.fragments[d]=a.createFragment(c);a.length=e},b=function(a,b,c){var d,e;e=a.fragmentsById||(a.fragmentsById=I());for(d in e)void 0===b[d]&&(e[d].teardown(!0),e[d]=null);for(d in b)void 0===b[d]||e[d]||(c.contextStack=a.contextStack.concat(a.keypath+"."+d),c.index=d,a.descriptor.i&&(c.indexRef=a.descriptor.i),e[d]=a.createFragment(c))},c=function(a,b){a.length||(b.contextStack=a.contextStack.concat(a.keypath),b.index=0,a.fragments[0]=a.createFragment(b),a.length=1)},d=function(a,b,c,d){var e,f,g;if(f=s(b)&&0===b.length,e=c?f||!b:b&&!f){if(a.length||(d.contextStack=a.contextStack,d.index=0,a.fragments[0]=a.createFragment(d),a.length=1),a.length>1)for(g=a.fragments.splice(1);g.length;)g.pop().teardown(!0)}else a.length&&(a.teardownFragments(!0),a.length=0)}}(),function(a){var b=function(a,b,c){var d;if("string"==typeof b&&u(c)){if(d=a.get(b),void 0===d&&(d=0),u(d))a.set(b,d+c);else if(a.debug)throw new Error("Cannot add to a non-numeric value")}else if(a.debug)throw new Error("Bad arguments")};a.add=function(a,c){b(this,a,void 0===c?1:c)},a.subtract=function(a,c){b(this,a,void 0===c?-1:-c)},a.toggle=function(a){var b;if("string"==typeof a)b=this.get(a),this.set(a,!b);else if(this.debug)throw new Error("Bad arguments")}}(rb),function(a){var c,d;a.animate=function(a,b,d){var e,f,g;if("object"==typeof a){d=b||{},g=[];for(e in a)vb.call(a,e)&&(g[g.length]=c(this,e,a[e],d));return{stop:function(){for(;g.length;)g.pop().stop()}}}return d=d||{},f=c(this,a,b,d),{stop:function(){f.stop()}}},d={stop:wb},c=function(a,c,e,f){var g,h,i,j,k;for(k=a.get(c),j=lb.animations.length;j--;)i=lb.animations[j],i.root===a&&i.keypath===c&&i.stop();return v(k,e)?(f.complete&&f.complete(1,f.to),d):(f.easing&&(g="function"==typeof f.easing?f.easing:a.easing&&a.easing[f.easing]?a.easing[f.easing]:b.easing[f.easing],"function"!=typeof g&&(g=null)),h=void 0===f.duration?400:f.duration,i=new eb({keypath:c,from:k,to:e,root:a,duration:h,easing:g,step:f.step,complete:f.complete}),lb.push(i),a._animations[a._animations.length]=i,i)}}(rb),rb.bind=function(a){var b=this._bound;-1===b.indexOf(a)&&(b[b.length]=a,a.init(this))},rb.cancelFullscreen=function(){b.cancelFullscreen(this.el)},rb.find=function(a){return this.el?this.el.querySelector(a):null},rb.findAll=function(a){return this.el?this.el.querySelectorAll(a):[]},rb.fire=function(a){var b,c,d,e=this._subs[a];if(e)for(b=Array.prototype.slice.call(arguments,1),c=0,d=e.length;d>c;c+=1)e[c].apply(this,b)},function(a){var b;a.get=function(a){var c,d,e,f,g,h,i,j,k;if(!a)return this.data;if(c=this._cache,s(a)){if(!a.length)return this.data;e=a.slice(),f=e.join("."),k=!0}else{if(vb.call(c,a)&&c[a]!==Ib)return c[a];e=q(a),f=e.join(".")}return!vb.call(c,f)||c[f]===Ib||void 0===c[f]&&k?this._evaluators[f]?(j=this._evaluators[f].value,c[f]=j,j):(g=e.pop(),h=e.join("."),i=e.length?this.get(e):this.data,null!==i&&void 0!==i&&i!==Ib?(this.magic&&"object"==typeof i&&vb.call(i,g)&&(this._wrapped[f]||(this._wrapped[f]=b(i,g,this,f))),(d=this._cacheMap[h])?-1===d.indexOf(f)&&(d[d.length]=f):this._cacheMap[h]=[f],j=i[g],this.modifyArrays&&("("===f.charAt(0)||!s(j)||j._ractive&&j._ractive.setting||mb(j,f,this)),c[f]=j,j):void 0):c[f]},b=function(a,b,c,d){var e,f,g,h,i,j,k,l;if(f=Object.getOwnPropertyDescriptor(a,b)){if(f.set&&(k=f.set.ractives))return-1===k.indexOf(c)&&(k[k.length]=c),l=f.set[c._guid]||(f.set[c._guid]=[]),-1===l.indexOf(d)&&(l[l.length]=d),void 0;if(!f.configurable)throw new Error("Cannot configure property")}if(!f||vb.call(f,"value"))f&&(e=f.value),g=function(){return e},h=function(a){var b,c,d,f,g;for(e=a,b=h.ractives,f=b.length;f--;)if(c=b[f],!c.muggleSet){for(c.magicSet=!0,d=h[c._guid],g=d.length;g--;)c.set(d[g],a);c.magicSet=!1}},h.ractives=[c],h[c._guid]=[d],Object.defineProperty(a,b,{get:g,set:h,enumerable:!0,configurable:!0});else{if(f.set&&!f.get||!f.set&&f.get)throw new Error("Property with getter but no setter, or vice versa. I am confused.");if(f.set._ractive)return;i=f.get,j=f.set,h=function(a){j(a),c.muggleSet||(c.magicSet=!0,c.set(d,i()),c.magicSet=!1)},h[c._guid+d]=!0,Object.defineProperty(a,b,{get:i,set:h,enumerable:!0,configurable:!0})}return{teardown:function(){var c=a[b];Object.defineProperty(a,b,f),a[b]=c}}}}(rb),i=function(a,b){var c,d,e,f;if(a.modifyArrays&&"("!==b.charAt(0)&&(c=a._cache[b],s(c)&&!c._ractive.setting&&nb(c,b,a)),a._cache[b]=Ib,d=a._cacheMap[b])for(;d.length;)e=d.pop(),i(a,e),f=a._wrapped[e],f&&f.teardown(),a._wrapped[e]=null},l=function(a,b,c){var d;for(d=0;d<a._deps.length;d+=1)n(a,b,d,c)},n=function(a,b,c,d){var e,f,g,h;if(e=a._deps[c]){if(f=e[b])for(g=f.length;g--;)f[g].update();if(!d&&(h=a._depsMap[b]))for(g=h.length;g--;)n(a,h[g],c)}},m=function(a,b,c){var d,e,f;for(f=b.length,d=0;d<a._deps.length;d+=1)if(a._deps[d])for(e=f;e--;)n(a,b[e],d,c)},p=function(a){for(var b,c;a._defEvals.length;)b=a._defEvals.pop(),b.update().deferred=!1;for(;a._defAttrs.length;)c=a._defAttrs.pop(),c.update().deferred=!1;for(;a._defSelectValues.length;)a._defSelectValues.pop().deferredUpdate()},j=function(a){var b,c,d,e,f,g,h,i;for(g=a.root,h=a.keypath,i=a.priority,b=g._deps[i]||(g._deps[i]={}),c=b[h]||(b[h]=[]),c[c.length]=a,d=q(h);d.length;)d.pop(),e=d.join("."),f=g._depsMap[e]||(g._depsMap[e]=[]),void 0===f[h]&&(f[h]=0,f[f.length]=h),f[h]+=1,h=e},fb=function(a,b){var c,d;c=b.el?w(b.el):a.el,c&&!b.append&&(c.innerHTML=""),a._transitionManager=d=D(a,b.complete),a.fragment=new R({descriptor:a.template,root:a,owner:a,parentNode:c}),p(a),c&&c.appendChild(a.fragment.docFrag),a._transitionManager=null,d.ready()},o=function(a,b,c){var d,e,f,g,h,i;if("."===b)return c.length?c[c.length-1]:"";if("."===b.charAt(0))return c.length?c[c.length-1]+b:b.substring(1);for(d=q(b),e=d.pop(),c=c.concat();c.length;)if(f=c.pop(),g=q(f),h=a.get(g.concat(d)),"object"==typeof h&&null!==h&&vb.call(h,e)){i=f+"."+b;break}return i||void 0===a.get(b)||(i=b),i},h=function(a){if(a.keypath)k(a);else{var b=a.root._pendingResolution.indexOf(a);-1!==b&&a.root._pendingResolution.splice(b,1)}},k=function(a){var b,c,d,e,f,g,h;for(f=a.root,g=a.keypath,h=a.priority,b=f._deps[h][g],b.splice(b.indexOf(a),1),c=q(g);c.length;)c.pop(),d=c.join("."),e=f._depsMap[d],e[g]-=1,e[g]||(e.splice(e.indexOf(g),1),e[g]=void 0),g=d},rb.link=function(a){var b=this;return function(c){b.set(a,c)}},function(a){var b,c;a.observe=function(a,c,d){var e,f=[];if("object"==typeof a){d=c;for(e in a)vb.call(a,e)&&(c=a[e],f[f.length]=b(this,e,c,d));return{cancel:function(){for(;f.length;)f.pop().cancel()}}}return b(this,a,c,d)},b=function(a,b,d,e){var f;return f=new c(a,b,d,e),e&&e.init===!1||f.update(!0),j(f),{cancel:function(){k(f)}}},c=function(a,b,c,d){this.root=a,this.keypath=b,this.callback=c,this.priority=0,this.context=d&&d.context?d.context:a},c.prototype={update:function(a){var b;if(b=this.root.get(this.keypath,!0),!v(b,this.value)||a){try{this.callback.call(this.context,b,this.value)}catch(c){if(this.root.debug)throw c}this.value=b}}}}(rb),rb.off=function(a,b){var c,d;b||(a?this._subs[a]=[]:this._subs={}),c=this._subs[a],c&&(d=c.indexOf(b),-1!==d&&c.splice(d,1))},rb.on=function(a,b){var c,d,e=this;if("object"==typeof a){c=[];for(d in a)vb.call(a,d)&&(c[c.length]=this.on(d,a[d]));return{cancel:function(){for(;c.length;)c.pop().cancel()}}}return this._subs[a]?this._subs[a].push(b):this._subs[a]=[b],{cancel:function(){e.off(a,b)}}},rb.renderHTML=function(){return this.fragment.toString()},rb.requestFullscreen=function(){b.requestFullscreen(this.el)},function(a){var b,c;a.set=function(a,d,e){var f,g,h,i,j,k,l;if(g=[""],f=[],t(a)&&(e=d),k=this._transitionManager,this._transitionManager=l=D(this,e),t(a))for(h in a)vb.call(a,h)&&(j=q(h),i=j.join("."),d=a[h],b(this,i,j,d,f,g));else j=q(a),i=j.join("."),b(this,i,j,d,f,g);return f.length&&this._pendingResolution.length&&c(this),g.length&&m(this,g,!0),f.length&&m(this,f),p(this),this._transitionManager=k,l.ready(),this.setting||(this.setting=!0,"object"==typeof a?this.fire("set",a):this.fire("set",a,d),this.setting=!1),this},b=function(a,b,c,d,e,f){var g,h,j,k,l,m;if(k=c.slice(),l=[],g=a.get(b),g!==d){if(!a.magicSet){for(a.muggleSet=!0,j=a.data;c.length>1;)h=l[l.length]=c.shift(),j[h]||(m||(m=l.join(".")),j[h]=/^\s*[0-9]+\s*$/.test(c[0])?[]:{}),j=j[h];h=c[0],j[h]=d,a.muggleSet=!1}}else if("object"!=typeof d)return;for(i(a,m||b),e[e.length]=b;k.length>1;)k.pop(),b=k.join("."),-1===f.indexOf(b)&&(f[f.length]=b)},c=function(a){var b,c,d;for(b=a._pendingResolution.length;b--;)c=a._pendingResolution.splice(b,1)[0],(d=o(a,c.ref,c.contextStack))?c.resolve(d):a._pendingResolution[a._pendingResolution.length]=c}}(rb),rb.teardown=function(a){var b,c,d;for(this.fire("teardown"),d=this._transitionManager,this._transitionManager=c=D(this,a),this.fragment.teardown(!0);this._animations[0];)this._animations[0].stop();for(b in this._cache)i(this,b);for(;this._bound.length;)this.unbind(this._bound.pop());this._transitionManager=d,c.ready()},rb.toggleFullscreen=function(){b.isFullscreen(this.el)?this.cancelFullscreen():this.requestFullscreen()},rb.unbind=function(a){var b,c=this._bound;b=c.indexOf(a),-1!==b&&(c.splice(b,1),a.teardown(this))},rb.update=function(a,b){var c,d;return"function"==typeof a&&(b=a),d=this._transitionManager,this._transitionManager=c=D(this,b),i(this,a||""),l(this,a||""),p(this),this._transitionManager=d,c.ready(),"string"==typeof a?this.fire("update",a):this.fire("update"),this},sb.backbone=function(a,b){var c,d,e,f,g,h,i;return b&&(b+=".",g=new RegExp("^"+b.replace(/\./g,"\\.")),h=b.length),{init:function(j){b?(i=function(a){var c,d;d={};for(c in a)vb.call(a,c)&&(d[b+c]=a[c]);return d},f=function(a){c||(d=!0,j.set(i(a.changed)),d=!1)},e=function(b,e){d||g.test(b)&&(c=!0,a.set(b.substring(h),e),c=!1)}):(f=function(a){c||(d=!0,j.set(a.changed),d=!1)},e=function(b,e){d||(c=!0,a.set(b,e),c=!1)}),a.on("change",f),j.on("set",e),j.set(b?i(a.attributes):a.attributes)},teardown:function(b){a.off("change",f),b.off("set",e)}}},sb.backboneCollection=function(a,b){var c,d,e,f,g,h,i;return b&&(b+=".",g=new RegExp("^"+b.replace(/\./g,"\\.")),h=b.length),{init:function(h){b?(i=function(a){var c,d;for(c={},d=0;d<a.length;d++)c[b+d]=a[d];return c},f=function(a){"string"==typeof arguments[0]&&(a=arguments[1]),c||(d=!0,h.set(i(a.collection.toJSON())),d=!1)},e=function(b,e){d||g.test(b)&&(c=!0,a.reset(e),c=!1)}):(f=function(a){c||(d=!0,h.set(a.collection.toJSON()),d=!1)},e=function(b,e){d||(c=!0,a.reset(e),c=!1)}),a.on("all",f),h.on("set",e),h.set(b?i(a.toJSON()):a.toJSON())},teardown:function(b){a.off("change",f),b.off("set",e)}}},sb.statesman=function(a,b){var c,d,e,f,g,h,i;return b&&(b+=".",g=new RegExp("^"+b.replace(/\./g,"\\.")),h=b.length,i=function(a){var c,d;if(a){d={};for(c in a)vb.call(a,c)&&(d[b+c]=a[c]);return d}}),{init:function(j){var k;b?(f=function(a){c||(d=!0,a=i(a),j.set(a),d=!1)},j.twoway&&(e=function(b,e){d||g.test(b)&&(c=!0,a.set(b.substring(h),e),c=!1)})):(f=function(a){c||(d=!0,j.set(a),d=!1)},j.twoway&&(e=function(b,e){d||(c=!0,a.set(b,e),c=!1)})),a.on("change",f),j.twoway&&j.on("set",e),k=b?i(a.get()):a.get(),k&&j.set(b?i(a.get()):a.get())},teardown:function(b){a.off("change",f),b.off("set",e)}}},c={linear:function(a){return a},easeIn:function(a){return Math.pow(a,3)},easeOut:function(a){return Math.pow(a-1,3)+1},easeInOut:function(a){return(a/=.5)<1?.5*Math.pow(a,3):.5*(Math.pow(a-2,3)+2)}},tb.hover=function(a,b){var c,d;return c=function(c){b({node:a,original:c,hover:!0})},d=function(c){b({node:a,original:c,hover:!1})},a.addEventListener("mouseover",c,!1),a.addEventListener("mouseout",d,!1),{teardown:function(){a.removeEventListener("mouseover",c,!1),a.removeEventListener("mouseout",d,!1)}}},function(){var a=function(a){return function(b,c){var d;return b.addEventListener("keydown",d=function(d){var e=d.which||d.keyCode;e===a&&(d.preventDefault(),c({node:b,original:d}))},!1),{teardown:function(){b.removeEventListener("keydown",d,!1)}}}};tb.enter=a(13),tb.tab=a(9),tb.escape=a(27),tb.space=a(32)}(),tb.tap=function(a,b){var c,d,e,f;return e=5,f=400,c=function(c){var d,g,h,i,j,k,l;
(void 0===c.which||1===c.which)&&(g=c.clientX,h=c.clientY,d=this,i=c.pointerId,j=function(a){a.pointerId==i&&(b({node:d,original:a}),l())},k=function(a){a.pointerId==i&&(Math.abs(a.clientX-g)>=e||Math.abs(a.clientY-h)>=e)&&l()},l=function(){a.removeEventListener("MSPointerUp",j,!1),qb.removeEventListener("MSPointerMove",k,!1),qb.removeEventListener("MSPointerCancel",l,!1),a.removeEventListener("pointerup",j,!1),qb.removeEventListener("pointermove",k,!1),qb.removeEventListener("pointercancel",l,!1),a.removeEventListener("click",j,!1),qb.removeEventListener("mousemove",k,!1)},window.navigator.pointerEnabled?(a.addEventListener("pointerup",j,!1),qb.addEventListener("pointermove",k,!1),qb.addEventListener("pointercancel",l,!1)):window.navigator.msPointerEnabled?(a.addEventListener("MSPointerUp",j,!1),qb.addEventListener("MSPointerMove",k,!1),qb.addEventListener("MSPointerCancel",l,!1)):(a.addEventListener("click",j,!1),qb.addEventListener("mousemove",k,!1)),setTimeout(l,f))},window.navigator.pointerEnabled?a.addEventListener("pointerdown",c,!1):window.navigator.msPointerEnabled?a.addEventListener("MSPointerDown",c,!1):a.addEventListener("mousedown",c,!1),d=function(c){var d,g,h,i,j,k,l,m;1===c.touches.length&&(i=c.touches[0],g=i.clientX,h=i.clientY,d=this,j=i.identifier,l=function(a){var c;c=a.changedTouches[0],c.identifier!==j&&m(),a.preventDefault(),b({node:d,original:a}),m()},k=function(a){var b;(1!==a.touches.length||a.touches[0].identifier!==j)&&m(),b=a.touches[0],(Math.abs(b.clientX-g)>=e||Math.abs(b.clientY-h)>=e)&&m()},m=function(){a.removeEventListener("touchend",l,!1),window.removeEventListener("touchmove",k,!1),window.removeEventListener("touchcancel",m,!1)},a.addEventListener("touchend",l,!1),window.addEventListener("touchmove",k,!1),window.addEventListener("touchcancel",m,!1),setTimeout(m,f))},a.addEventListener("touchstart",d,!1),{teardown:function(){a.removeEventListener("pointerdown",c,!1),a.removeEventListener("MSPointerDown",c,!1),a.removeEventListener("mousedown",c,!1),a.removeEventListener("touchstart",d,!1)}}},function(){var a,c,e,f,g,h,i,j,k,l,m,n,o;d=function(a){var c,d=this;return c=function(a){l(this,c,a||{})},c.prototype=H(d.prototype),d!==b&&f(c,d),h(c,a),i(c),j(c,a),k(c),c.extend=d.extend,c},m=["data","partials","transitions","eventDefinitions","components"],n=["el","template","complete","modifyArrays","twoway","lazy","append","preserveWhitespace","sanitize","noIntro","transitionsEnabled"],o=m.concat(n),f=function(a,b){m.forEach(function(d){b[d]&&(a[d]=c(b[d]))}),n.forEach(function(c){void 0!==b[c]&&(a[c]=b[c])})},g=function(a,b){return/_super/.test(a)?function(){var c,d=this._super;return this._super=b,c=a.apply(this,arguments),this._super=d,c}:a},h=function(a,b){var c,d;m.forEach(function(c){var d=b[c];d&&(a[c]?e(a[c],d):a[c]=d)}),n.forEach(function(c){void 0!==b[c]&&(a[c]=b[c])});for(c in b)vb.call(b,c)&&!vb.call(a.prototype,c)&&-1===o.indexOf(c)&&(d=b[c],a.prototype[c]="function"==typeof d&&"function"==typeof a.prototype[c]?g(d,a.prototype[c]):d)},i=function(a){var c;if("string"==typeof a.template){if(!b.parse)throw new Error(zb);if("#"===a.template.charAt(0)&&qb){if(c=qb.getElementById(a.template.substring(1)),!c||"SCRIPT"!==c.tagName)throw new Error("Could not find template element ("+a.template+")");a.template=b.parse(c.innerHTML,a)}else a.template=b.parse(a.template,a)}},j=function(a,b){t(a.template)&&(a.partials||(a.partials={}),e(a.partials,a.template.partials),b.partials&&e(a.partials,b.partials),a.template=a.template.main)},k=function(a){var c,d;if(a.partials)for(c in a.partials)if(vb.call(a.partials,c)){if("string"==typeof a.partials[c]){if(!b.parse)throw new Error(zb);d=b.parse(a.partials[c],a)}else d=a.partials[c];a.partials[c]=d}},l=function(d,e,f){!f.template&&e.template&&(f.template=e.template),m.forEach(function(b){f[b]?a(f[b],e[b]):e[b]&&(f[b]=c(e[b]))}),n.forEach(function(a){void 0===f[a]&&void 0!==e[a]&&(f[a]=e[a])}),d.beforeInit&&d.beforeInit.call(d,f),b.call(d,f),d.init&&d.init.call(d,f)},a=function(a,b){var c;for(c in b)vb.call(b,c)&&!vb.call(a,c)&&(a[c]=b[c])},c=function(a){var b,c={};for(b in a)vb.call(a,b)&&(c[b]=a[b]);return c},e=function(a,b){var c;for(c in b)vb.call(b,c)&&(a[c]=b[c])}}(),f=function(a,c){return u(a)&&u(c)?b.interpolators.number(+a,+c):s(a)&&s(c)?b.interpolators.array(a,c):t(a)&&t(c)?b.interpolators.object(a,c):function(){return c}},g={number:function(a,b){var c=b-a;return c?function(b){return a+b*c}:function(){return a}},array:function(a,c){var d,e,f,g;for(d=[],e=[],g=f=Math.min(a.length,c.length);g--;)e[g]=b.interpolate(a[g],c[g]);for(g=f;g<a.length;g+=1)d[g]=a[g];for(g=f;g<c.length;g+=1)d[g]=c[g];return function(a){for(var b=f;b--;)d[b]=e[b](a);return d}},object:function(a,c){var d,e,f,g,h=[];f={},e={};for(g in a)vb.call(a,g)&&(vb.call(c,g)?(h[h.length]=g,e[g]=b.interpolate(a[g],c[g])):f[g]=a[g]);for(g in c)vb.call(c,g)&&!vb.call(a,g)&&(f[g]=c[g]);return d=h.length,function(a){for(var b,c=d;c--;)b=h[c],f[b]=e[b](a);return f}}};var Qb=I();G(Qb,{preserveWhitespace:{enumerable:!0,value:!1},append:{enumerable:!0,value:!1},twoway:{enumerable:!0,value:!0},modifyArrays:{enumerable:!0,value:!0},data:{enumerable:!0,value:{}},lazy:{enumerable:!0,value:!1},debug:{enumerable:!0,value:!1},transitions:{enumerable:!0,value:{}},eventDefinitions:{enumerable:!0,value:{}},noIntro:{enumerable:!0,value:!1},transitionsEnabled:{enumerable:!0,value:!0},magic:{enumerable:!0,value:!1}}),b=function(a){var c,d,e,f,g,h;for(c in Qb)vb.call(a,c)||(a[c]="object"==typeof Qb[c]?{}:Qb[c]);if(G(this,{_guid:{value:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b,c;return b=0|16*Math.random(),c="x"==a?b:8|3&b,c.toString(16)})},_subs:{value:I()},_cache:{value:{}},_cacheMap:{value:I()},_deps:{value:[]},_depsMap:{value:I()},_pendingResolution:{value:[]},_defAttrs:{value:[]},_defEvals:{value:[]},_defSelectValues:{value:[]},_evaluators:{value:I()},_bound:{value:[]},_transitionManager:{value:null,writable:!0},_animations:{value:[]},nodes:{value:{}},_wrapped:{value:I()}}),this.modifyArrays=a.modifyArrays,this.magic=a.magic,this.twoway=a.twoway,this.lazy=a.lazy,this.debug=a.debug,this.magic&&ob)throw new Error("Getters and setters (magic mode) are not supported in this browser");if(a.el&&(this.el=w(a.el),!this.el&&this.debug))throw new Error("Could not find container element");this.data={};for(c in a.data)vb.call(a.data,c)&&(this.data[c]=a.data[c]);if(this.partials={},this.components=a.components||{},this.transitions=a.transitions,this.eventDefinitions=a.eventDefinitions,a.bindings)if(s(a.bindings))for(e=0;e<a.bindings.length;e+=1)this.bind(a.bindings[e]);else this.bind(a.bindings);if(f=a.template,"string"==typeof f){if(!b.parse)throw new Error(zb);if("#"===f.charAt(0)&&qb){if(g=qb.getElementById(f.substring(1)),!g)throw new Error("Could not find template element ("+f+")");h=b.parse(g.innerHTML,a)}else h=b.parse(f,a)}else h=f;if(t(h)&&(this.partials=h.partials,h=h.main),h&&1===h.length&&"string"==typeof h[0]&&(h=h[0]),this.template=h,a.partials)for(c in a.partials)if(vb.call(a.partials,c)){if(d=a.partials[c],"string"==typeof d){if(!b.parse)throw new Error(zb);d=b.parse(d,a)}this.partials[c]=d}this.transitionsEnabled=a.noIntro?!1:a.transitionsEnabled,fb(this,{el:this.el,append:a.append,complete:a.complete}),this.transitionsEnabled=a.transitionsEnabled},function(){var a,b,d,e;qb&&(a=function(a,b){var c,d={};for(c=b.length;c--;)d[b[c]]=a[b[c]];return d},b=function(a,b,c,d){for(var e,f=b.length;f--;)e=b[f],a.style[e]=c&&c[e]?"function"==typeof c[e]?c[e](d):c[e]:0},d=function(a,b){var c;if(!b)return a;for(c in b)vb.call(b,c)&&(a[c]=b[c]);return a},Mb&&(e=function(e,f,g,h){return"string"==typeof e&&(e=[e]),function(i,j,k,l){var m,n,o,p,q,r,s,t,u,v,w;k=Rb(k),r=k.duration||f.duration,c=Pb(k.easing||f.easing),s=k.delay||0,t=l?g:h,u=l?h:g,n=window.getComputedStyle(i),q=i.getAttribute("style"),l?(v=i.style.position,w=i.style.visibility,i.style.position="absolute",i.style.visibility="hidden",setTimeout(function(){o=a(n,e),t=g,u=d(o,h),i.style.position=v,i.style.visibility=w,b(i,e,t,k),setTimeout(p,0)},s)):setTimeout(function(){o=a(n,e),t=d(o,h),u=g,b(i,e,t,k),setTimeout(p,0)},s),p=function(){i.style[Nb+"Duration"]=r/1e3+"s",i.style[Nb+"Properties"]=e.map(Pb).join(","),i.style[Nb+"TimingFunction"]=c,m=function(){i.removeEventListener(Ob,m,!1),l&&i.setAttribute("style",q||""),j()},i.addEventListener(Ob,m,!1),b(i,e,u,k)}}},ub.slide=e(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom","overflowY"],{duration:400,easing:"easeInOut"},{overflowY:"hidden"},{overflowY:"hidden"}),ub.fade=e("opacity",{duration:300,easing:"linear"}),ub.fly=e(["opacity","left","position"],{duration:400,easing:"easeOut"},{position:"relative",left:"-500px"},{position:"relative",left:0})))}();var Rb=function(a){return"fast"===a?{duration:200}:"slow"===a?{duration:600}:u(a)?{duration:+a}:a||{}};!function(a){var b,c,d;qb&&(c=function(a,b,e){var f,g;return 1===a.nodeType&&(a.style.display=a._display),3===a.nodeType?(d(a,b,e),void 0):(f=Array.prototype.slice.call(a.childNodes),g=function(){return f.length?(c(f.shift(),g,e),void 0):(1===a.nodeType&&a.setAttribute("style",a._style||""),b(),void 0)},g(),void 0)},d=function(a,b,c){var d,e,f,g;return d=a._hiddenData,(e=d.length)?(g=0,f=setInterval(function(){var c,h,i,j,k;c=d.substr(0,g),h=d.substring(g),i=/^\w+/.exec(h),j=i?i[0].length:0,k=new Array(j+1).join(" "),a.data=c+k,g===e&&(clearInterval(f),delete a._hiddenData,b()),g+=1},c),void 0):(b(),void 0)},b=function(a,b,d){var e,f,g,h;d=Rb(d),e=d.interval||(d.speed?1e3/d.speed:d.duration?a.textContent.length/d.duration:4),f=a.getAttribute("style"),g=window.getComputedStyle(a),a.style.visibility="hidden",setTimeout(function(){var i,j,k;j=g.width,i=g.height,k=g.visibility,h(a),setTimeout(function(){a.style.width=j,a.style.height=i,a.style.visibility="visible",c(a,function(){a.setAttribute("style",f||""),b()},e)},d.delay||0)}),h=function(a){var b,c;if(1===a.nodeType&&(a._style=a.getAttribute("style"),a._display=window.getComputedStyle(a).display,a.style.display="none"),3===a.nodeType)return a._hiddenData=""+a.data,a.data="",void 0;for(b=Array.prototype.slice.call(a.childNodes),c=b.length;c--;)h(b[c])}},a.typewriter=b)}(ub),function(a){var b,c,d;if(qb){if(a.fullscreenEnabled=qb.fullscreenEnabled||qb.mozFullScreenEnabled||qb.webkitFullscreenEnabled,!a.fullscreenEnabled)return a.requestFullscreen=a.cancelFullscreen=wb,void 0;Jb.requestFullscreen?b="requestFullscreen":Jb.mozRequestFullScreen?b="mozRequestFullScreen":Jb.webkitRequestFullscreen&&(b="webkitRequestFullscreen"),a.requestFullscreen=function(a){a[b]&&a[b]()},qb.cancelFullscreen?c="cancelFullscreen":qb.mozCancelFullScreen?c="mozCancelFullScreen":qb.webkitCancelFullScreen&&(c="webkitCancelFullScreen"),a.cancelFullscreen=function(){qb[c]()},void 0!==qb.fullscreenElement?d="fullscreenElement":void 0!==qb.mozFullScreenElement?d="mozFullScreenElement":void 0!==qb.webkitFullscreenElement&&(d="webkitFullscreenElement"),a.isFullscreen=function(a){return a===qb[d]}}}(b),eb=function(a){var c;this.startTime=Date.now();for(c in a)vb.call(a,c)&&(this[c]=a[c]);this.interpolator=b.interpolate(this.from,this.to),this.running=!0},eb.prototype={tick:function(){var a,b,c,d,e;return this.running?(d=Date.now(),a=d-this.startTime,a>=this.duration?(this.root.set(this.keypath,this.to),this.step&&this.step(1,this.to),this.complete&&this.complete(1,this.to),e=this.root._animations.indexOf(this),-1===e&&xb&&xb.warn&&xb.warn("Animation was not found"),this.root._animations.splice(e,1),this.running=!1,!1):(b=this.easing?this.easing(a/this.duration):a/this.duration,c=this.interpolator(b),this.root.set(this.keypath,c),this.step&&this.step(b,c),!0)):!1},stop:function(){var a;this.running=!1,a=this.root._animations.indexOf(this),-1===a&&xb&&xb.warn&&xb.warn("Animation was not found"),this.root._animations.splice(a,1)}},lb={animations:[],tick:function(){var a,b;for(a=0;a<this.animations.length;a+=1)b=this.animations[a],b.tick()||this.animations.splice(a--,1);this.animations.length?E(this.boundTick):this.running=!1},boundTick:function(){lb.tick()},push:function(a){this.animations[this.animations.length]=a,this.running||(this.running=!0,this.tick())}},function(a,b,c){var d,e;if(c.requestAnimationFrame)return E=c.requestAnimationFrame,void 0;for(d=0;d<a.length&&!E;++d)E=c[a[d]+"RequestAnimationFrame"];E||(e=c.setTimeout,E=function(a){var c,d,f;return c=Date.now(),d=Math.max(0,16-(c-b)),f=e(function(){a(c+d)},d),b=c+d,f})}(["ms","moz","webkit","o"],0,a),function(){var a,b,c,d,e,f;mb=function(a,c,d){var e,f,g;a._ractive?(e=a._ractive.roots,f=a._ractive.keypathsByGuid,f[d._guid]||(e[e.length]=d,f[d._guid]=[]),g=f[d._guid],-1===g.indexOf(c)&&(g[g.length]=c)):(F(a,"_ractive",{value:{roots:[d],keypathsByGuid:{}},configurable:!0}),a._ractive.keypathsByGuid[d._guid]=[c],b(a))},nb=function(a,b,d){var e,f,g,h;if(!a._ractive)throw new Error("Attempted to remove keypath from non-wrapped array. This error is unexpected - please send a bug report to @rich_harris");if(e=a._ractive.roots,f=a._ractive.keypathsByGuid,!f[d._guid])throw new Error("Ractive instance was not listed as a dependent of this array. This error is unexpected - please send a bug report to @rich_harris");if(g=f[d._guid],h=g.indexOf(b),-1===h)throw new Error("Attempted to unlink non-linked keypath from array. This error is unexpected - please send a bug report to @rich_harris");g.splice(h,1),g.length||(e.splice(e.indexOf(d),1),f[d._guid]=null),e.length||c(a)},a=function(a,b,c){var d,e,f,g,h,j;j=a._ractive.keypathsByGuid,d=function(a){for(var b=a.length;b--;)e(a[b])},e=function(a){var b,c=a._transitionManager;a._transitionManager=b=D(a,wb),f(a,j[a._guid]),a._transitionManager=c,b.ready()},f=function(a,b){for(var c=b.length;c--;)g(a,b[c])},g=function(d,e){var f,g,j,k,n,o,r;if("sort"===b||"reverse"===b)return d.set(e,a),void 0;for(i(d,e),n=[],o=[],r=0;r<d._deps.length;r+=1)if(f=d._deps[r],f&&(g=f[e])){for(h(d,e,g,n,o),p(d);n.length;)n.pop().smartUpdate(b,c);for(;o.length;)o.pop().update()}for(p(d),k=[],j=q(e);j.length;)j.pop(),k[k.length]=j.join(".");m(d,k,!0),l(d,e+".length",!0)},h=function(a,b,c,d,e){var f,g;for(f=c.length;f--;)g=c[f],g.type===Hb?g.update():g.keypath===b&&g.type===Db?d[d.length]=g:e[e.length]=g},d(a._ractive.roots)},d=[],f=["pop","push","reverse","shift","sort","splice","unshift"],f.forEach(function(b){var c=function(){var c=Array.prototype[b].apply(this,arguments);return this._ractive.setting=!0,a(this,b,arguments),this._ractive.setting=!1,c};F(d,b,{value:c})}),e={},e.__proto__?(b=function(a){a.__proto__=d},c=function(a){delete a._ractive,a.__proto__=Array.prototype}):(b=function(a){var b,c;for(b=f.length;b--;)c=f[b],F(a,c,{value:d[c],configurable:!0})},c=function(a){var b;for(b=f.length;b--;)delete a[f[b]];delete a._ractive})}(),function(){var a,b,c,d;a={"accept-charset":"acceptCharset",accesskey:"accessKey",bgcolor:"bgColor","class":"className",codebase:"codeBase",colspan:"colSpan",contenteditable:"contentEditable",datetime:"dateTime",dirname:"dirName","for":"htmlFor","http-equiv":"httpEquiv",ismap:"isMap",maxlength:"maxLength",novalidate:"noValidate",pubdate:"pubDate",readonly:"readOnly",rowspan:"rowSpan",tabindex:"tabIndex",usemap:"useMap"},T=function(a){return this.element=a.element,b(this,a.name),null===a.value||"string"==typeof a.value?(c(this,a),void 0):(this.root=a.root,this.parentNode=a.parentNode,this.parentFragment=this.element.parentFragment,this.fragment=new $({descriptor:a.value,root:this.root,owner:this,contextStack:a.contextStack}),this.parentNode&&("value"===this.name&&(a.element.ractify(),this.isValueAttribute=!0,"INPUT"===this.parentNode.tagName&&"file"===this.parentNode.type&&(this.isFileInputValue=!0)),d(this,a),this.selfUpdating=C(this.fragment),this.ready=!0),void 0)},T.prototype={bind:Q,update:P,updateBindings:function(){this.keypath=this.interpolator.keypath||this.interpolator.r,"name"===this.propertyName&&(this.parentNode.name="{{"+this.keypath+"}}")},teardown:function(){var a;if(this.boundEvents)for(a=this.boundEvents.length;a--;)this.parentNode.removeEventListener(this.boundEvents[a],this.updateModel,!1);this.fragment&&this.fragment.teardown()},bubble:function(){this.selfUpdating?this.update():!this.deferred&&this.ready&&(this.root._defAttrs[this.root._defAttrs.length]=this,this.deferred=!0)},toString:function(){var a;return null===this.value?this.name:this.fragment?(a=this.fragment.toString(),this.name+"="+JSON.stringify(a)):this.name+"="+JSON.stringify(this.value)}},b=function(a,b){var c,d;if(c=b.indexOf(":"),-1===c||(d=b.substr(0,c),"xmlns"===d))a.name=b;else if(b=b.substring(c+1),a.name=b,a.namespace=Kb[d],!a.namespace)throw'Unknown namespace ("'+d+'")'},c=function(a,b){b.parentNode&&(a.namespace?b.parentNode.setAttributeNS(a.namespace,b.name,b.value):b.parentNode.setAttribute(b.name,b.value),"id"===a.name&&(b.root.nodes[b.value]=b.parentNode),"value"===a.name&&(a.element.ractify().value=b.value)),a.value=b.value},d=function(b,c){var d;!b.parentNode||b.namespace||c.parentNode.namespaceURI&&c.parentNode.namespaceURI!==Kb.html||(d=a[b.name]||b.name,void 0!==c.parentNode[d]&&(b.propertyName=d),("boolean"==typeof c.parentNode[d]||"value"===d)&&(b.useProperty=!0))}}(),function(){var a;V=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w=this,x=this.parentFragment=b.parentFragment;if(c=x.root,this.type=Gb,this.name=b.descriptor.r,d=B(x.root,b.descriptor.e),e=d.twoway!==!1,i={},j=[],this.complexParameters=[],t=function(b,d){var e;if("string"!=typeof d){if(null===d)return i[b]=!0,void 0;if(1===d.length&&d[0].t===Bb&&d[0].r)return x.indexRefs&&void 0!==x.indexRefs[d[0].r]?(i[b]=x.indexRefs[d[0].r],void 0):(h=o(c,d[0].r,x.contextStack)||d[0].r,i[b]=c.get(h),j[j.length]=[b,h],void 0);e=new a(c,w,b,d,x.contextStack),w.complexParameters[w.complexParameters.length]=e,i[b]=e.value}else try{i[b]=JSON.parse(d)}catch(f){i[b]=d}},b.descriptor.a)for(r in b.descriptor.a)b.descriptor.a.hasOwnProperty(r)&&t(r,b.de