ractive
Version:
Next-generation DOM manipulation
2 lines • 201 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):function(){var n=t.Ractive,i=e();t.Ractive=i,i.noConflict=function(){return t.Ractive=n,i}}()}(this,function(){"use strict";function t(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function e(e){for(var n=[],i=arguments.length-1;i-->0;)n[i]=arguments[i+1];for(var r=0;r<n.length;r++){var s=n[r];for(var a in s)a in e||!t(s,a)||(e[a]=s[a])}return e}function n(e){void 0===e&&(e={});var n=[];for(var i in e)t(e,i)&&n.push([i,e[i]]);return n}function i(t,e){return null===t&&null===e?!0:h(t)||h(e)?!1:t===e}function r(t){return!isNaN(parseFloat(t))&&isFinite(t)}function s(t){return t&&"[object Object]"===Is.call(t)}function a(t){return!(!t||!h(t)&&!u(t)||o(t))}function o(t){return t instanceof Date}function h(t){return"object"==typeof t}function u(t){return"function"==typeof t}function l(t){return"string"==typeof t}function c(t){return"number"==typeof t}function d(t){return void 0===t}function f(){}function p(t,e){return t.replace(/%s/g,function(){return e.shift()})}function m(t){for(var e=[],n=arguments.length-1;n-->0;)e[n]=arguments[n+1];throw t=p(t,e),new Error(t)}function v(){Ns.DEBUG&&Js.apply(null,arguments)}function g(t){for(var e=[],n=arguments.length-1;n-->0;)e[n]=arguments[n+1];t=p(t,e),Xs(t,e)}function y(t){for(var e=[],n=arguments.length-1;n-->0;)e[n]=arguments[n+1];t=p(t,e),ia[t]||(ia[t]=!0,Xs(t,e))}function b(){Ns.DEBUG&&g.apply(null,arguments)}function w(){Ns.DEBUG&&y.apply(null,arguments)}function k(t,e,n){var i=_(t,e,n);return i?i[t][n]:null}function _(t,e,n){for(;e;){if(n in e[t])return e;if(e.isolated)return null;e=e.parent}}function x(t,e,n,i){if(t===e)return null;if(i){var r=k("interpolators",n,i);if(r)return r(t,e)||null;m(ha(i,"interpolator"))}return ua.number(t,e)||ua.array(t,e)||ua.object(t,e)||null}function E(t){return l(t)?t.replace(da,"\\$&"):t}function C(t){return t?t.replace(la,".$1"):""}function A(t){var e,n=[];for(t=C(t);e=ca.exec(t);){var i=e.index+e[1].length;n.push(t.substr(0,i)),t=t.substr(i+1)}return n.push(t),n}function N(t){return l(t)?t.replace(fa,"$1$2"):t}function T(t,e){var n=t.indexOf(e);-1===n&&t.push(e)}function j(t,e){for(var n=0,i=t.length;i>n;n++)if(t[n]==e)return!0;return!1}function S(t,e){var n;if(!Rs(t)||!Rs(e))return!1;if(t.length!==e.length)return!1;for(n=t.length;n--;)if(t[n]!==e[n])return!1;return!0}function O(t){return l(t)?[t]:d(t)?[]:t}function V(t,e){if(t){var n=t.indexOf(e);-1!==n&&t.splice(n,1)}}function M(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];for(var n=t.concat.apply([],t),i=n.length;i--;){var r=n.indexOf(n[i]);~r&&i>r&&n.splice(i,1)}return n}function I(t){for(var e=[],n=t.length;n--;)e[n]=t[n];return e}function R(t,e){for(var n=t.length,i=0;n>i;i++){var r=e(t[i]);if(r)return r}}function K(t,e,n){var i=t,r=e;n&&(i=i.map(n),r=r.map(n));var s=i.length,a={},o=0,h=i.map(function(t){var e,n=o;do{if(e=r.indexOf(t,n),-1===e)return-1;n=e+1}while(a[e]===!0&&s>n);return e===o&&(o+=1),a[e]=!0,e}),u=h.oldLen=i.length;if(h.newLen=r.length,u===h.newLen){var l=0;for(l;u>l&&h[l]===l;l++);l===u&&(h.same=!0)}return h}function B(t,e){if(!/this/.test(t.toString()))return t;var n=pa.call(t,e);for(var i in t)n[i]=t[i];return n}function P(t,e,n){return n&&u(e)&&t.parent&&t.parent.isRoot?(t.boundValue||(t.boundValue=B(e._r_unbound||e,t.parent.ractive)),t.boundValue):e}function L(t){t.updateFromBindings(!0)}function F(t){for(var e=t.length;e--;)if(t[e].bound){var n=t[e].owner;if(n){var i="checked"===n.name?n.node.checked:n.node.value;return{value:i}}}}function D(t){if(t){var e=ma[t];ma[t]=[];for(var n=e.length;n--;)e[n]();var i=va[t];for(va[t]=[],n=i.length;n--;)i[n].model.register(i[n].item)}else D("early"),D("mark")}function U(t,e,n,i){t.shuffling=!0;for(var r=t.source().length!==t.source().value.length,s=e.length;s--;){var a=e[s];s!==a&&(r=!0,s in t.childByKey&&t.childByKey[s].rebind(~a?t.joinKey(a):void 0,t.childByKey[s],!i))}for(t.links.forEach(function(t){return t.shuffle(e)}),n||D("early"),s=t.deps.length;s--;)t.deps[s].shuffle&&t.deps[s].shuffle(e);t[n?"marked":"mark"](),n||D("mark"),r&&t.notifyUpstream(),t.shuffling=!1}function H(t,e){e!==t.dataModel&&(e&&e.viewmodel&&e.viewmodel.isRoot&&t.childByKey.data?(t.childByKey.data.link(e.viewmodel,"data"),t.dataModel=e):t.dataModel&&(t.childByKey.data.unlink(),t.dataModel=!0))}function q(){ka.push(wa=[])}function z(){var t=ka.pop();return wa=ka[ka.length-1],t}function $(t){wa&&T(wa,t)}function G(t){t.bind()}function W(t){t.cancel()}function Q(t){t.destroyed()}function Y(t){t.handleChange()}function Z(t){t.mark()}function J(t){t.mark(!0)}function X(t){t.marked()}function tt(t){t.markedAll()}function et(t){t.render()}function nt(t){t.shuffled()}function it(t){t.teardown()}function rt(t){t.unbind()}function st(t){t.unrender()}function at(t){t.update()}function ot(t){return t.toString()}function ht(t){return t.toString(!0)}function ut(t,e,n,i){var r=t.r||t;if(!r||!l(r))return e;if("."===r||"@"===r[0]||(e||n).isKey||(e||n).isKeypath)return e;var s=r.split("/"),a=A(s[s.length-1]),o=a[a.length-1],h=e||n;h&&1===a.length&&o!==h.key&&i&&(a=lt(o,i)||a);for(var u=a.length,c=!0,d=!1;h&&u--;)h.shuffling&&(d=!0),a[u]!=h.key&&(c=!1),h=h.parent;return!e&&c&&d?n:e&&!c&&d?n:e}function lt(t,e){for(;e;){var n=e.aliases;if(n&&n[t]){for(var i=(e.owner.iterations?e.owner:e).owner.template.z,r=0;r<i.length;r++)if(i[r].n===t){var s=i[r].x;if(!s.r)return!1;var a=s.r.split("/");return A(a[a.length-1])}return}e=e.componentParent||e.parent}}function ct(t,e){void 0===e&&(e=0);for(var n=new Array(e);e--;)n[e]="_"+e;return new Function([],"return function ("+n.join(",")+"){return("+t+");};")()}function dt(t,e){return Ea[t]?Ea[t]:Ea[t]=mt(t,e)}function ft(t){if(t){var e=t.e;e&&Ms(e).forEach(function(t){Ea[t]||(Ea[t]=e[t])})}}function pt(t,e,n){t||m("Missing Ractive.parse - cannot parse "+e+". "+n)}function mt(t,e){return pt(ct,"new expression function",Na),ct(t,e)}function vt(t,e){pt(Ca,'compution string "${str}"',Ta);var n=Ca(t,{expression:!0});return function(){return n.e.apply(e,n.r.map(function(t){return e.get(t)}))}}function gt(t,e,n){var i,r,s,a,o;return u(n)&&(i=B(n,t),s=n.toString(),a=!0),l(n)&&(i=vt(n,t),s=n),h(n)&&(l(n.get)?(i=vt(n.get,t),s=n.get):u(n.get)?(i=B(n.get,t),s=n.get.toString(),a=!0):m("`%s` computation must have a `get()` method",e),u(n.set)&&(r=B(n.set,t),o=n.set.toString())),{getter:i,setter:r,getterString:s,setterString:o,getterUseStack:a}}function yt(t){!t.started||t.outros.length||t.outroChildren||(t.outrosComplete||(t.outrosComplete=!0,t.parent&&t.parent.decrementOutros(t),bt(t)&&t.detachNodes()),t.intros.length||t.totalChildren||(u(t.callback)&&t.callback(),t.parent&&!t.notifiedTotal&&(t.notifiedTotal=!0,t.parent.decrementTotal())))}function bt(t){return!t||t.outrosComplete&&bt(t.parent)}function wt(t){var e=t.detachQueue,n=kt(t);if(n.length){var i,r,s=e.length,a=0,o=t.detachQueue=[];t:for(;s--;){for(i=e[s].node,a=n.length;a--;)if(r=n[a].element.node,r===i||r.contains(i)||i.contains(r)){o.push(e[s]);continue t}e[s].detach()}}else t.detachNodes()}function kt(t,e){var n=e;if(n){for(var i=t.children.length;i--;)n=kt(t.children[i],n);return t.outros.length&&(n=n.concat(t.outros)),n}n=[];for(var r=t;r.parent;)r=r.parent;return kt(r,n)}function _t(t){t.dispatch()}function xt(){var t=Ma.immediateObservers;Ma.immediateObservers=[],t.forEach(_t);var e,n=Ma.fragments.length;for(t=Ma.fragments,Ma.fragments=[];n--;)e=t[n],e.update();Ma.transitionManager.ready(),t=Ma.deferredObservers,Ma.deferredObservers=[],t.forEach(_t);var i=Ma.tasks;for(Ma.tasks=[],n=0;n<i.length;n+=1)i[n]();return Ma.fragments.length||Ma.immediateObservers.length||Ma.deferredObservers.length||Ma.tasks.length?xt():void 0}function Et(){Ia.start();var t,e,n=performance.now();for(t=0;t<Ra.length;t+=1)e=Ra[t],e.tick(n)||Ra.splice(t--,1);Ia.end(),Ra.length?requestAnimationFrame(Et):Ka=!1}function Ct(e,n){var i={};if(!n)return e;n+=".";for(var r in e)t(e,r)&&(i[n+r]=e[r]);return i}function At(t){var e;return La[t]||(e=t?t+".":"",La[t]=function(n,i){var r;return l(n)?(r={},r[e+n]=i,r):h(n)?e?Ct(n,t):n:void 0}),La[t]}function Nt(t){for(var e=[],n=0;n<t.length;n++)e[n]=(t.childByKey[n]||{}).value;return e}function Tt(t){for(var e=t;e&&!e.context&&!e.aliases;)e=e.parent;return e}function jt(e,n){var i=e;if("."===n)return e.findContext();if("~"===n[0])return e.ractive.viewmodel.joinAll(A(n.slice(2)));if("."===n[0]||"^"===n[0]){for(var r=e,s=n.split("/"),a="^^"===s[0];r&&!r.context;)r=St(r);for(var o=r&&r.context;r&&"^^"===s[0];){for(s.shift(),r=r.isIteration?r.parent.parent:St(r);r&&!r.context;)r=St(r);o=r&&r.context}if(!o&&a)throw new Error("Invalid context parent reference ('"+n+"'). There is not context at that level.");for(;"."===s[0]||".."===s[0];){var h=s.shift();".."===h&&(o=!o.parent&&o.proxy&&o.target?o.target.parent:o.parent)}return n=s.join("/"),"."===n[0]&&(n=n.slice(1)),o.joinAll(A(n))}var l=A(n);if(l.length){var c=l.shift();if("@"===c[0]){if("@this"===c||"@"===c)return e.ractive.viewmodel.getRactiveModel().joinAll(l);if("@index"===c||"@key"===c){l.length&&Mt(c);var d=Ot(e);return d&&d["get"+("i"===c[1]?"Index":"Key")]()}if("@last"===c){var f=Ot(e);return f&&f.parent.getLast()}if("@global"===c)return za.joinAll(l);if("@shared"===c)return qa.joinAll(l);if("@keypath"===c||"@rootpath"===c){for(var p="r"===n[1]?e.ractive.root:null,m=e;m&&(!m.context||m.isRoot&&m.ractive.component&&(p||!m.ractive.isolated));)m=m.isRoot?m.componentParent:m.parent;return m.getKeypath(p)}if("@context"===c)return new Ha(e.getContext(),"context").joinAll(l);if("@local"===c)return e.getContext()._data.joinAll(l);if("@style"===c)return e.ractive.constructor._cssModel.joinAll(l);if("@helpers"===c)return e.ractive.viewmodel.getHelpers().joinAll(l);if("@macro"===c){var v=Vt(e);return v?new Ha(v,"macro").joinAll(l):void 0}throw new Error("Invalid special reference '"+c+"'")}if(c&&!l.length){var g=e.ractive.viewmodel.getHelpers();if(g.has(c))return g.joinKey(c)}var y=Tt(e);y=y&&y.context?y.context:e.findContext();for(var w,k=!1,_=e.ractive.warnAboutAmbiguity,x=0;e;){if(e.isIteration&&(c===e.parent.keyRef?w=e.getKey():c===e.parent.indexRef&&(w=e.getIndex()),w&&l.length&&Mt(c)),!w&&e.aliases&&t(e.aliases,c)&&(w=e.aliases[c]),!w&&e.context&&e.context.has(c)&&(w=e.context.joinKey(c),k?_&&b("'"+n+"' resolved but is ambiguous and will create a mapping to a parent component."):_&&x&&b("'"+n+"' resolved but is ambiguous.")),w)return k&&(w=i.ractive.viewmodel.createLink(c,w,c,{implicit:!0})),l.length>0&&u(w.joinAll)&&(w=w.joinAll(l)),w;e.context&&!e.aliases&&(x=1),e.ractive.isolated||e.owner&&e.owner.containerFragment||!(e.componentParent||!e.parent&&e.ractive.component)?e=e.parent:(e=e.componentParent||e.ractive.component.up,k=!0)}var E=i.ractive;return E.resolveInstanceMembers&&"data"!==c&&c in E?E.viewmodel.getRactiveModel().joinKey(c).joinAll(l):(_&&b("'"+n+"' is ambiguous and did not resolve."),y.joinKey(c).joinAll(l))}}function St(t){return t&&(!t.ractive.isolated&&!(t.owner&&t.owner.containerFragment)&&(t.componentParent||!t.parent&&t.ractive.component)||t.parent)}function Ot(t){for(var e,n=t;!n.isIteration&&(e=St(n));)n=e;return n.isIteration&&n}function Vt(t){for(var e=t;e;){if(e.owner.handle)return e.owner.handle;e=St(e)}}function Mt(t){throw new Error("An index or key reference ("+t+") cannot have child properties")}function It(t){for(var e=[],n=arguments.length-1;n-->0;)e[n]=arguments[n+1];var i=t.fragment||t._fakeFragment||(t._fakeFragment=new Ga(t));return i.getContext.apply(i,e)}function Rt(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return this.ctx||(this.ctx=new $a.Context(this)),t.unshift(Ss(this.ctx)),js.apply(null,t)}function Kt(t){for(var e=t;e&&!e.context;)e=e.parent;return e?e:t&&t.ractive.fragment}function Bt(t,e){var n=Qa,i=e&&e.deep,r=e&&e.shuffle,s=Ia.start();e&&"keep"in e&&(Qa=e.keep);for(var a=t.length;a--;){var o=t[a][0],h=t[a][1],u=t[a][2];if(!o)throw Ia.end(),new Error("Failed to set invalid keypath '"+u+"'");if(i)Ft(o,h);else if(r){var l=h,c=o.get();if(l||(l=c),d(c))o.set(l);else{if(!Rs(c)||!Rs(l))throw Ia.end(),new Error("You cannot merge an array with a non-array");var f=Dt(r);o.merge(l,f)}}else o.set(h)}return Ia.end(),Qa=n,1===t.length?s.then(function(){return t[0][1]}):s}function Pt(t,e,n,i){if(!n&&("."===e[0]||"^"===e[1]))return b("Attempted to set a relative keypath from a non-relative context. You can use a context object to set relative keypaths."),[];var r=A(e),s=n||t.viewmodel;return Ya.test(e)?s.findMatches(r):s===t.viewmodel?!t.component||t.isolated||s.has(r[0])||"@"===e[0]||!e[0]||i?[s.joinAll(r)]:[jt(t.fragment||new Ga(t),e)]:[s.joinAll(r)]}function Lt(e,n,i,r){var a=[];if(s(n)){var o=function(i){t(n,i)&&a.push.apply(a,Pt(e,i,null,r).map(function(t){return[t,n[i],i]}))};for(var h in n)o(h)}else a.push.apply(a,Pt(e,n,null,r).map(function(t){return[t,i,n]}));return a}function Ft(e,n){var i=e.get(!1,Za);if(null==i||!h(n)||o(n))return e.set(n);if(!h(i))return e.set(n);for(var r in n)t(n,r)&&Ft(e.joinKey(r),n[r])}function Dt(t){if(t===!0)return null;if(u(t))return t;if(l(t))return Ja[t]||(Ja[t]=function(e){return e[t]});throw new Error("If supplied, options.compare must be a string, function, or true")}function Ut(t,e,n,i){if(!l(e)||!r(n))throw new Error("Bad arguments");var s=Lt(t,e,n,i&&i.isolated);return Bt(s.map(function(t){var e=t[0],n=t[1],i=e.get();if(!r(n)||!r(i))throw new Error(Xa);return[e,i+n]}))}function Ht(t,e,n){var i=c(e)?e:1,r=h(e)?e:n;return Ut(this,t,i,r)}function qt(t){var e=Promise.resolve(t);return Os(e,"stop",{value:f}),e}function zt(t,e){t=t||{};var n;return t.easing&&(n=u(t.easing)?t.easing:e.easing[t.easing]),{easing:n||to,duration:"duration"in t?t.duration:400,complete:t.complete||f,step:t.step||f,interpolator:t.interpolator}}function $t(t,e,n,r){r=zt(r,t);var s=e.get();if(i(s,n))return r.complete(r.to),qt(n);var a=x(s,n,t,r.interpolator);return a?e.animate(s,n,r,a):(Ia.start(),e.set(n),Ia.end(),qt(n))}function Gt(t,e,n){if(h(t)){var i=Ms(t);throw new Error("ractive.animate(...) no longer supports objects. Instead of ractive.animate({\n "+i.map(function(e){return"'"+e+"': "+t[e]}).join("\n ")+"\n}, {...}), do\n\n"+i.map(function(e){return"ractive.animate('"+e+"', "+t[e]+", {...});"}).join("\n")+"\n")}return $t(this,this.viewmodel.joinAll(A(t)),e,n)}function Wt(t,e){t.event&&t._eventQueue.push(t.event),t.event=e}function Qt(t){t._eventQueue.length?t.event=t._eventQueue.pop():t.event=null}function Yt(t,e){var n=e?eo:no;if(n[t])return n[t];var i=t.split("."),r=[],s=!1;e&&(i.unshift("this"),s=!0);for(var a=Math.pow(2,i.length)-(e?1:0),o=0;a>o;o++){for(var h=[],u=0;u<i.length;u++)h.push(1&o>>u?"*":i[u]);r.unshift(h.join("."))}return s&&(i.length>2?r.push.apply(r,Yt(t,!1)):(r.push("*"),r.push(t))),n[t]=r,r}function Zt(t,e,n,i){if(void 0===i&&(i=[]),e){n.name=e,i.unshift(n);var r=t._nsSubs?Yt(e,!0):["*",e];return Jt(t,r,n,i,!0)}}function Jt(t,e,n,i,r){void 0===r&&(r=!1);var s=!0;if(r||t._nsSubs){Wt(t,n);for(var a=e.length;a--;)e[a]in t._subs&&(s=Xt(t,t._subs[e[a]],n,i)&&s);Qt(t)}if(t.parent&&s){if(r&&t.component){var o=t.component.name+"."+e[e.length-1];e=Yt(o,!1),n&&!n.component&&(n.component=t)}s=Jt(t.parent,e,n,i)}return s}function Xt(t,e,n,i){var r=null,s=!1;e=e.slice();for(var a=0,o=e.length;o>a;a+=1)e[a].off||e[a].handler.apply(t,i)!==!1||(s=!0);return n&&s&&(r=n.event)&&(r.preventDefault&&r.preventDefault(),r.stopPropagation&&r.stopPropagation()),!s}function te(t,e){return t[e._guid]||(t[e._guid]=[])}function ee(t,e){var n=te(t.queue,e);for(t.hook.fire(e);n.length;)ee(t,n.shift());delete t.queue[e._guid]}function ne(t,e){void 0===e&&(e=null);var n=[];return ie(t,e,n,t.ractive),n}function ie(t,e,n,i){if(t.isAnchor)e&&t.name!==e||n.push(t);else if(t.items)t.items.forEach(function(t){return ie(t,e,n,i)});else if(t.iterations)t.iterations.forEach(function(t){return ie(t,e,n,i)});else if(!t.fragment||t.component&&t.fragment.ractive!==i){if(t.instance&&t.instance.fragment){var r=[];ie(t.instance.fragment,e,r,i),r.forEach(function(t){return t.ractive===i&&n.push(t)})}}else ie(t.fragment,e,n,i)}function re(t,e){void 0===e&&(e=null);var n=ne(t.fragment,e),i={},r=t._children.byName;n.forEach(function(t){var e=t.name;e in i||(i[e]=0);var n=i[e],s=(r[e]||[])[n];s&&s.lastBound!==t&&(s.lastBound&&s.lastBound.removeChild(s),t.addChild(s)),i[e]++})}function se(t){t.instance.fragment.rendered&&(t.shouldDestroy=!0,t.instance.unrender()),t.instance.el=null}function ae(t,e){void 0===e&&(e={});var n,i=this._children;if(t.parent&&t.parent!==this)throw new Error("Instance "+t._guid+" is already attached to a different instance "+t.parent._guid+". Please detach it from the other instance using detachChild first.");if(t.parent)throw new Error("Instance "+t._guid+" is already attached to this instance.");var r={instance:t,ractive:this,name:e.name||t.constructor.name||"Ractive",target:e.target||!1,bubble:oe,findNextNode:he};if(r.nameOption=e.name,r.target){var s;(s=i.byName[r.target])||(s=[],this.set("@this.children.byName."+r.target,s)),n=e.prepend?0:void 0!==e.insertAt?e.insertAt:s.length}else r.up=this.fragment,r.external=!0;t.parent=this,t.root=this.root,t.component=r,i.push(r);var a=Ia.start(),o=t.viewmodel.getRactiveModel();return o.joinKey("parent",{lastLink:!1}).link(this.viewmodel.getRactiveModel()),o.joinKey("root",{lastLink:!1}).link(this.root.viewmodel.getRactiveModel()),ao.attachchild.fire(t),r.target?(se(r),this.splice("@this.children.byName."+r.target,n,0,r),re(this,r.target)):t.isolated||t.viewmodel.attached(this.fragment),Ia.end(),a.ractive=t,a.then(function(){return t})}function oe(){Ia.addFragment(this.instance.fragment)}function he(){return this.anchor?this.anchor.findNextNode():void 0}function ue(t,e){this.computed[t]=e,(l(e)||u(e))&&(e=this.computed[t]={get:e});var n=A(t);if(!~t.indexOf("*")){var i=n.pop();return this.viewmodel.joinAll(n).compute(i,e)}e.pattern=new RegExp("^"+n.map(function(t){return t.replace(/\*\*/g,"(.+)").replace(/\*/g,"((?:\\\\.|[^\\.])+)")}).join("\\.")+"$")}function le(t,e){var n=Ia.start(),i=ue.call(this,t,e);if(i){var r=A(t);1!==r.length||i.isReadonly||i.set(this.viewmodel.value[r[0]]);var s=r.reduce(function(t,e){return t&&t.childByKey[e]},this.viewmodel);s&&(s.rebind(i,s,!1),s.parent&&delete s.parent.childByKey[s.key],D())}return Ia.end(),n}function ce(){return this.isDetached?this.el:(this.el&&V(this.el.__ractive_instances__,this),this.el=this.fragment.detach(),this.isDetached=!0,ao.detach.fire(this),this.el)}function de(t){for(var e,n,i=this._children,r=i.length;r--;)if(i[r].instance===t){n=r,e=i[r];break}if(!e||t.parent!==this)throw new Error("Instance "+t._guid+" is not attached to this instance.");var s=Ia.start();e.anchor&&e.anchor.removeChild(e),t.isolated||t.viewmodel.detached(),i.splice(n,1),e.target&&(this.splice("@this.children.byName."+e.target,i.byName[e.target].indexOf(e),1),re(this,e.target));var a=t.viewmodel.getRactiveModel();return a.joinKey("parent",{lastLink:!1}).unlink(),a.joinKey("root",{lastLink:!1}).link(a),t.root=t,t.parent=null,t.component=null,ao.detachchild.fire(t),Ia.end(),s.ractive=t,s.then(function(){return t})}function fe(t,e){var n=this;if(void 0===e&&(e={}),!this.rendered)throw new Error("Cannot call ractive.find('"+t+"') unless instance is rendered to the DOM");var i=this.fragment.find(t,e);if(i)return i;if(e.remote)for(var r=0;r<this._children.length;r++)if(n._children[r].instance.fragment.rendered&&(i=n._children[r].instance.find(t,e)))return i}function pe(t,e){if(void 0===e&&(e={}),!this.rendered)throw new Error("Cannot call ractive.findAll('"+t+"', ...) unless instance is rendered to the DOM");return Rs(e.result)||(e.result=[]),this.fragment.findAll(t,e),e.remote&&this._children.forEach(function(n){!n.target&&n.instance.fragment&&n.instance.fragment.rendered&&n.instance.findAll(t,e)}),e.result}function me(t,e){return!e&&h(t)&&(e=t,t=""),e=e||{},Rs(e.result)||(e.result=[]),this.fragment.findAllComponents(t,e),e.remote&&this._children.forEach(function(n){!n.target&&n.instance.fragment&&n.instance.fragment.rendered&&(t&&n.name!==t||e.result.push(n.instance),n.instance.findAllComponents(t,e))}),e.result}function ve(t,e){var n=this;void 0===e&&(e={}),h(t)&&(e=t,t="");var i=this.fragment.findComponent(t,e);if(i)return i;if(e.remote){if(!t&&this._children.length)return this._children[0].instance;for(var r=0;r<this._children.length;r++)if(!n._children[r].target){if(n._children[r].name===t)return n._children[r].instance;if(i=n._children[r].instance.findComponent(t,e))return i}}}function ge(t){return this.container?this.container.component&&this.container.component.name===t?this.container:this.container.findContainer(t):null}function ye(t){return this.parent?this.parent.component&&this.parent.component.name===t?this.parent:this.parent.findParent(t):null}function be(t,e,n){for(void 0===e&&(e=!0);t&&(t.type!==co||n&&t.name!==n)&&(!e||t.type!==go&&t.type!==mo);)t=t.owner?t.owner:t.component||t["yield"]?t.containerFragment||t.component.up:t.parent?t.parent:t.up?t.up:void 0;return t}function we(t,e,n){var i=[],r=ke(t,e,n);if(!r)return null;var s=r.length-2-r[1],a=Math.min(t,r[0]),o=a+r[1];i.startIndex=a;var h;for(h=0;a>h;h+=1)i.push(h);for(;o>h;h+=1)i.push(-1);for(;t>h;h+=1)i.push(h+s);return 0!==s?i.touchedFrom=r[0]:i.touchedFrom=t,i}function ke(t,e,n){switch(e){case"splice":for(void 0!==n[0]&&n[0]<0&&(n[0]=t+Math.max(n[0],-t)),d(n[0])&&(n[0]=0);n.length<2;)n.push(t-n[0]);return c(n[1])||(n[1]=t-n[0]),n[1]=Math.min(n[1],t-n[0]),n;case"sort":case"reverse":return null;case"pop":return t?[t-1,1]:[0,0];case"push":return[t,0].concat(n);case"shift":return[0,t?1:0];case"unshift":return[0,0].concat(n)}}function _e(t){function e(t){for(var e=[],i=arguments.length-1;i-->0;)e[i]=arguments[i+1];return n(this.viewmodel.joinAll(A(t)),e)}function n(e,n){var i=e.get();if(!Rs(i)){if(d(i)){i=[];var r=Po[t].apply(i,n),s=Ia.start().then(function(){return r});return e.set(i),Ia.end(),s}throw new Error("shuffle array method "+t+" called on non-array at "+e.getKeypath())}var a=we(i.length,t,n),o=Po[t].apply(i,n),h=Ia.start().then(function(){return o});return h.result=o,a?e.shuffle?e.shuffle(a):e.mark():e.set(o),Ia.end(),h}return{path:e,model:n}}function xe(t,e,n){e.parent&&e.parent.wrapper&&e.parent.adapt();var i=Ia.start();return e.mark(n&&n.force),e.notifyUpstream(),Ia.end(),ao.update.fire(t,e),i}function Ee(t,e){var n,i;return l(t)?(i=A(t),n=e):n=t,xe(this,i?this.viewmodel.joinAll(i):this.viewmodel,n)}function Ce(e,n,i){var r=[];if(s(n))for(var a in n)t(n,a)&&r.push([Ae(e,a).model,n[a]]);else r.push([Ae(e,n).model,i]);return r}function Ae(t,e){var n=t.fragment;return l(e)?{model:jt(n,e),instance:n.ractive}:{model:n.findContext(),instance:e}}function Ne(t,e){return t.events&&t.events.find&&t.events.find(function(t){return~t.template.n.indexOf(e)})}function Te(t){for(var e=[],n=arguments.length-1;n-->0;)e[n]=arguments[n+1];var i;if(e[0]instanceof Wo){var r=e.shift();i=Ss(r),js(i,r)}else i=!h(e[0])||null!==e[0]&&e[0].constructor!==Object?Wo.forRactive(this):Wo.forRactive(this,e.shift());return Zt(this,t,i,e)}function je(t,e){if(!l(t))return this.viewmodel.get(!0,t);var n,i=A(t),r=i[0];return this.viewmodel.has(r)||this.component&&!this.isolated&&(n=jt(this.fragment||new Ga(this),r)),n=this.viewmodel.joinAll(i),n.get(!0,e)}function Se(){return $o.f?$o.f.getContext():void 0}function Oe(t){l(t)&&ah&&(t=ah.call(document,t));var e;if(t){if(t._ractive)return t._ractive.proxy.getContext();if(!(e=t.__ractive_instances__))return Oe(t.parentNode);if(1===e.length)return It(e[0])}}function Ve(t,e){return t?(l(t)&&(t=this.find(t,e)),Oe(t)):It(this)}function Me(t){return ph?t:{is:t}}function Ie(){return Ps.createDocumentFragment()}function Re(t){var e;if(t&&"boolean"!=typeof t){if(!Bs||!Ps||!t)return null;if(t.nodeType)return t;if(l(t)){if(e=Ps.getElementById(t),!e&&Ps.querySelector)try{e=Ps.querySelector(t)}catch(n){}if(e&&e.nodeType)return e}return t[0]&&t[0].nodeType?t[0]:null}}function Ke(t){return t&&"unknown"!=typeof t.parentNode&&t.parentNode&&t.parentNode.removeChild(t),t}function Be(t){return null==t||c(t)&&isNaN(t)||!t.toString?"":""+t}function Pe(t){return Be(t).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}function Le(t,e){if(!this.fragment.rendered)throw new Error("The API has changed - you must call `ractive.render(target[, anchor])` to render your Ractive instance. Once rendered you can use `ractive.insert()`.");if(t=Re(t),e=Re(e)||null,!t)throw new Error("You must specify a valid target to insert into");t.insertBefore(this.detach(),e),this.el=t,(t.__ractive_instances__||(t.__ractive_instances__=[])).push(this),this.isDetached=!1,Fe(this)}function Fe(t){ao.insert.fire(t),t.findAllComponents("*").forEach(function(t){Fe(t.instance)})}function De(t,e,n){var i,r=n&&(n.ractive||n.instance)||this,s=A(t);!r.viewmodel.has(s[0])&&r.component&&(i=jt(r.component.up,s[0]),i=i.joinAll(s.slice(1)));var a=i||r.viewmodel.joinAll(s),o=this.viewmodel.joinAll(A(e),{lastLink:!1});if(Ue(a,o)||Ue(o,a))throw new Error("A keypath cannot be linked to itself.");var h=Ia.start();return o.link(a,n&&n.keypath||t),Ia.end(),h}function Ue(t,e){for(var n=e;n;){if(n===t||n.owner===t)return!0;n=n.target||n.parent}}function He(t,e){var n=e&&t.model?t.model.get():t.newValue;try{t.oldValue=t.oldFn?t.oldFn.call(t.oldContext,void 0,n,t.keypath):n}catch(i){b("Failed to execute observer oldValue callback for '"+this.keypath+"': "+(i.message||i)),t.oldValue=n}}function qe(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return t.map(E).join(".")}function ze(t){return A(t).map(N)}function $e(t,e,n){var i=t.oldValues;t.oldFn?(n||(t.oldValues={}),Ms(e).forEach(function(n){var r=[i[n],e[n],n],s=t.pattern.exec(n);s&&r.push.apply(r,s.slice(1)),t.oldValues[n]=t.oldFn.apply(t.oldContext,r)})):n?Ms(e).forEach(function(t){return i[t]=e[t]}):t.oldValues=e}function Ge(){return-1}function We(t,e,n){var i,r,a=this,o=[];s(t)?(i=t,r=e||{}):u(t)?(i={"":t},r=e||{}):(i={},i[t]=e,r=n||{});var h=!1;return Ms(i).forEach(function(t){var e=i[t],n=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return h?void 0:e.apply(this,t)},s=t.split(" ");s.length>1&&(s=s.filter(function(t){return t})),s.forEach(function(t){r.keypath=t;var e=Qe(a,t,n,r);e&&o.push(e)})}),this._observers.push.apply(this._observers,o),{cancel:function(){return o.forEach(function(t){return t.cancel()})},isSilenced:function(){return h},silence:function(){return h=!0},resume:function(){return h=!1}}}function Qe(t,e,n,i){var r=A(e),s=r.indexOf("*");~s||(s=r.indexOf("**")),i.fragment=i.fragment||t.fragment;var a;if(i.fragment?~r[0].indexOf(".*")?(a=i.fragment.findContext(),s=0,r[0]=r[0].slice(1)):a=0===s?i.fragment.findContext():jt(i.fragment,r[0]):a=t.viewmodel.joinKey(r[0]),a||(a=t.viewmodel.joinKey(r[0])),~s){var o=r.indexOf("**");return~o&&(o+1!==r.length||~r.indexOf("*"))?void w("Recursive observers may only specify a single '**' at the end of the path."):(a=a.joinAll(r.slice(1,s)),new yh(t,a,r.slice(s),n,i))}return a=a.joinAll(r.slice(1)),i.array?new wh(t,a,n,i):new mh(t,a,n,i)}function Ye(t,e,n){return s(t)||u(t)?(n=js(e||{},_h),this.observe(t,n)):(n=js(n||{},_h),this.observe(t,e,n))}function Ze(t,e){var n=this;if(t){var i=t.split(" ").map(xh).filter(Eh);i.forEach(function(t){var i=n._subs[t];if(i&&e){var r=i.find(function(t){return t.callback===e});r&&(V(i,r),r.off=!0,t.indexOf(".")&&n._nsSubs--)}else i&&(t.indexOf(".")&&(n._nsSubs-=i.length),i.length=0)})}else this._subs={};return this}function Je(e,n){var i=this,r=h(e)?e:{};l(e)&&(r[e]=n);var s=!1,a=[],o=function(e){var n=r[e],o=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return s?void 0:n.apply(this,t)},h={callback:n,handler:o};if(t(r,e)){var u=e.split(" ").map(xh).filter(Eh);u.forEach(function(t){(i._subs[t]||(i._subs[t]=[])).push(h),t.indexOf(".")&&i._nsSubs++,a.push([t,h])})}};for(var u in r)o(u);return{cancel:function(){return a.forEach(function(t){return i.off(t[0],t[1].callback)})},isSilenced:function(){return s},silence:function(){return s=!0},resume:function(){return s=!1}}}function Xe(t,e){var n=this.on(t,function(){e.apply(this,arguments),n.cancel()});return n}function tn(t,e){void 0===e&&(e={});var n=A(t);if(this.viewmodel.has(n[0])){var i=this.viewmodel.joinAll(n);if(!i.isLink)return;for(;(i=i.target)&&e.canonical!==!1&&i.isLink;);if(i)return{ractive:i.root.ractive,keypath:i.getKeypath()}}}function en(t){return void 0===t?Vh:Vh=t}function nn(t){Th.push(t),jh=!0}function rn(t){var e=hn();e&&(t||jh)&&(Vh?Th.forEach(function(t){var e=an(t.id);if(e){var n=sn(t.id);Oh?e.styleSheet.cssText!==n&&(e.styleSheet.cssText=n):e.innerHTML!==n&&(e.innerHTML=n)}}):Oh?e.styleSheet.cssText=sn(null):e.innerHTML=sn(null),jh=!1)}function sn(t){t&&!Rs(t)&&(t=[t]);var e=t?Th.filter(function(e){return~t.indexOf(e.id)}):Th;return e.forEach(function(t){return t.applied=!0}),e.reduce(function(t,e){return""+(t?t+"\n\n/* {"+e.id+"} */\n"+e.styles:"")},Nh)}function an(t){return Ps&&(Ps.querySelector('[data-ractive-css="'+t+'"]')||on(t))}function on(t){if(Ps){var e=Ps.createElement("style");return e.type="text/css",e.setAttribute("data-ractive-css",t||""),Ps.getElementsByTagName("head")[0].appendChild(e),null===Oh&&(Oh=!!e.styleSheet),e}}function hn(){return Sh||(Sh=on()),Sh}function un(t,e,n){void 0===n&&(n=[]);var i=[],r=function(t){return t.replace(Kh,function(t,e){return i[e]})};return t=t.replace(Rh,function(t){return"\x00"+(i.push(t)-1)}).replace(Ih,""),n.forEach(function(e){t=t.replace(e,function(t){return"\x00"+(i.push(t)-1)})}),e(t,r)}function ln(t){return t.trim()}function cn(t){return t.str}function dn(t,e){for(var n,i=[];n=Dh.exec(t);)i.push({str:n[0],base:n[1],modifiers:n[2]});for(var r=i.map(cn),s=[],a=i.length;a--;){var o=r.slice(),h=i[a];o[a]=h.base+e+h.modifiers||"";var u=r.slice();u[a]=e+" "+u[a],s.push(o.join(" "),u.join(" "))}return s.join(", ")}function fn(t,e){var n,i='[data-ractive-css~="{'+e+'}"]';return n=Hh.test(t)?t.replace(Hh,i):un(t,function(t,e){return t=t.replace(Ph,"$&").replace(Bh,function(t,e){if(Uh.test(e))return t;var n=e.split(",").map(ln),r=n.map(function(t){return dn(t,i)}).join(", ")+" ";return t.replace(e,r)}).replace(Lh,""),e(t)},[Fh])}function pn(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}function mn(){return pn()+pn()+"-"+pn()+"-"+pn()+"-"+pn()+"-"+pn()+pn()+pn()}function vn(t,e,n){var i=h(t)?e:n,r=this._cssModel;r.locked=!0;var s=Bt(Lt({viewmodel:r},t,e,!0),i);r.locked=!1;var a=Ia.start();return this.extensions.forEach(function(t){var e=t._cssModel;e.mark(),e.downstreamChanged("",1)}),Ia.end(),gn(this,!i||i.apply!==!1),s.then(function(){return a})}function gn(t,e){var n=yn(t),i=t.extensions.map(function(t){return gn(t,!1)}).reduce(function(t,e){return e||t},!1);if(e&&(n||i)){var r=t._cssDef;(!r||r&&r.applied)&&rn(!0)}return n||i}function yn(t){var e=t.css;if(u(e)){var n=t._cssDef,i=wn(t,e),r=n.transform?fn(i,n.id):i;if(n.styles!==r)return n.styles=r,!0}}function bn(t){for(var e=t,n=[];e;)e.prototype.cssId&&n.push(e.prototype.cssId),e=e.Parent;return n}function wn(t,e){if(l(e))return e;var n=t.cssData,i=t._cssModel,r=function(t){return i.joinAll(A(t)).get()};r.__proto__=n;var s=e.call(t,r);return l(s)?s:""}function kn(t,e,n){var i=t.css===!0?"":l(t.css)&&!zh.test(t.css)?Re(t.css)||t.css:t.css,r=i,s=t.cssId||mn();h(i)?(i="textContent"in i?i.textContent:i.innerHTML,r=i):u(i)&&(r=i,i=wn(e,i));var a={transform:"noCSSTransform"in t?!t.noCSSTransform:!t.noCssTransform};Os(e,"_cssDef",{configurable:!0,value:a}),Os(e,"css",{get:function(){return r},set:function(t){r=t;var n=wn(e,r),i=a.styles;a.styles=a.transform?fn(n,s):n,a.applied&&i!==a.styles&&rn(!0)}}),a.styles=a.transform?fn(i,s):i,a.id=n.cssId=s,e._cssIds.push(s),nn(e._cssDef)}function _n(t){t&&t.constructor!==Object&&(u(t)||(h(t)?b("If supplied, options.data should be a plain JavaScript object - using a non-POJO as the root object may work, but is discouraged"):m("data option must be an object or a function, `"+t+"` is not valid")));
}function xn(){return{}}function En(t,e){_n(e);var n=u(t);e||n||(e=xn);var i=u(e);return n||i?function(){var r=i?Cn(e,this):e,s=n?Cn(t,this):t;return An(r,s)}:An(e,t)}function Cn(t,e){var n=t.call(e);if(n)return h(n)||m("Data function must return an object"),n.constructor!==Object&&w("Data function returned something other than a plain JavaScript object. This might work, but is strongly discouraged"),n}function An(t,e){if(t&&e){for(var n in e)n in t||(t[n]=e[n]);return t}return t||e}function Nn(t){var e=t._config.template;if(e&&e.fn){var n=Tn(t,e.fn);return n!==e.result?(e.result=n,n):void 0}}function Tn(t,e){return e.call(t,{fromId:ja.fromId,isParsed:ja.isParsed,parse:function(e,n){return void 0===n&&(n=ja.getParseOptions(t)),ja.parse(e,n)}})}function jn(t,e){return l(t)?t=Sn(t,e):(On(t),ft(t)),t}function Sn(t,e){return"#"===t[0]&&(t=ja.fromId(t)),ja.parseFor(t,e)}function On(t){if(void 0==t)throw new Error("The template cannot be "+t+".");if(!c(t.v))throw new Error("The template parser was passed a non-string template, but the template doesn't have a version. Make sure you're passing in the template you think you are.");if(t.v!==Wh)throw new Error("Mismatched template version (expected "+Wh+", got "+t.v+") Please ensure you are using the latest version of Ractive.js in your build process as well as in your app")}function Vn(e,n,i){if(n)for(var r in n)(i||!t(e,r))&&(e[r]=n[r])}function Mn(t,e,n){function i(){var t=In(i._parent,e),r="_super"in this,s=this._super;this._super=t;var a=n.apply(this,arguments);return r?this._super=s:delete this._super,a}return/_super/.test(n)?(i._parent=t,i._method=n,i):n}function In(t,e){if(e in t){var n=t[e];return u(n)?n:function(){return n}}return f}function Rn(t,e,n){return"options."+t+" has been deprecated in favour of options."+e+"."+(n?" You cannot specify both options, please use options."+e+".":"")}function Kn(t,e,n){if(e in t){if(n in t)throw new Error(Rn(e,n,!0));b(Rn(e,n)),t[n]=t[e]}}function Bn(t){Kn(t,"beforeInit","onconstruct"),Kn(t,"init","onrender"),Kn(t,"complete","oncomplete"),Kn(t,"eventDefinitions","events"),Rs(t.adaptors)&&Kn(t,"adaptors","adapt")}function Pn(e,n,i,r,s){Bn(r);for(var a in r)if(t(ru,a)){var o=r[a];"el"!==a&&u(o)?b(a+" is a Ractive option that does not expect a function and will be ignored","init"===e?i:null):i[a]=o}if(i.append&&i.enhance)throw new Error("Cannot use append and enhance at the same time");tu.forEach(function(t){t[e](n,i,r,s)}),Mh[e](n,i,r,s),Qh[e](n,i,r,s),$h[e](n,i,r,s),Ln(n.prototype,i,r)}function Ln(e,n,i){for(var r in i)if(!su[r]&&t(i,r)){var s=i[r];u(s)&&((r in od||"on"===r.slice(0,2)&&r.slice(2)in ao&&r in n)&&!ou.test(s.toString())&&b("Overriding Ractive prototype function '"+r+"' without calling the '"+ou+"' method can be very dangerous."),s=Mn(e,r,s)),n[r]=s}}function Fn(t){var e={};return t.forEach(function(t){return e[t]=!0}),e}function Dn(t){return t.replace(du,function(t,e){var n;return n="#"!==e[0]?lu[e]:"x"===e[1]?parseInt(e.substring(2),16):parseInt(e.substring(1),10),n?pu(Hn(n)):t})}function Un(t){return t.replace(gu,"&").replace(mu,"<").replace(vu,">")}function Hn(t){return t?10===t?32:128>t?t:159>=t?cu[t-128]:55296>t?t:57343>=t?yu:65535>=t?t:fu?t>=65536&&131071>=t?t:t>=131072&&196607>=t?t:yu:yu:yu}function qn(t){return t.replace(/([A-Z])/g,function(t,e){return"-"+e.toLowerCase()})}function zn(t){return l(t)?un(t,function(t,e){return t.split(";").filter(function(t){return!!t.trim()}).map(e).reduce(function(t,e){var n=e.indexOf(":"),i=e.substr(0,n).trim();return t[i]=e.substr(n+1).trim(),t},{})}):{}}function $n(t){for(var e=t.split(_u),n=e.length;n--;)e[n]||e.splice(n,1);return e}function Gn(t){var e=t.element,n=t.name;if("value"===n){if(t.interpolator&&(t.interpolator.bound=!0),"select"===e.name&&"value"===n)return e.getAttribute("multiple")?Wn:Qn;if("textarea"===e.name)return Xn;if(null!=e.getAttribute("contenteditable"))return Yn;if("input"===e.name){var i=e.getAttribute("type");if("file"===i)return f;if("radio"===i&&e.binding&&"name"===e.binding.attribute.name)return Zn;if(~xu.indexOf(i))return Xn}return Jn}var r=e.node;if(t.isTwoway&&"name"===n){if("radio"===r.type)return ti;if("checkbox"===r.type)return ei}if("style"===n)return ni;if(0===n.indexOf("style-"))return ii;if("class"===n&&(!r.namespaceURI||r.namespaceURI===oh))return ri;if(0===n.indexOf("class-"))return si;if(t.isBoolean){var s=e.getAttribute("type");return!t.interpolator||"checked"!==n||"checkbox"!==s&&"radio"!==s||(t.interpolator.bound=!0),ai}return t.namespace&&t.namespace!==t.node.namespaceURI?hi:oi}function Wn(t){var e=this.getValue();Rs(e)||(e=[e]);var n=this.node.options,i=n.length;if(t)for(;i--;)n[i].selected=!1;else for(;i--;){var r=n[i],s=r._ractive?r._ractive.value:r.value;r.selected=j(e,s)}}function Qn(t){var e=this.getValue();if(!this.locked){this.node._ractive.value=e;var n=this.node.options,i=n.length,r=!1;if(t)for(;i--;)n[i].selected=!1;else for(;i--;){var s=n[i],a=s._ractive?s._ractive.value:s.value;if(s.disabled&&s.selected&&(r=!0),a==e)return void(s.selected=!0)}r||(this.node.selectedIndex=-1)}}function Yn(t){var e=this.getValue();this.locked||(t?this.node.innerHTML="":this.node.innerHTML=d(e)?"":e)}function Zn(t){var e=this.node,n=e.checked,i=this.getValue();return t?e.checked=!1:(e.value=this.node._ractive.value=i,e.checked=this.element.compare(i,this.element.getAttribute("name")),void(n&&!e.checked&&this.element.binding&&this.element.binding.rendered&&this.element.binding.group.model.set(this.element.binding.group.getValue())))}function Jn(t){if(!this.locked)if(t)this.node.removeAttribute("value"),this.node.value=this.node._ractive.value=null;else{var e=this.getValue();this.node.value=this.node._ractive.value=e,this.node.setAttribute("value",Be(e))}}function Xn(t){if(!this.locked)if(t)this.node._ractive.value="",this.node.removeAttribute("value");else{var e=this.getValue();this.node._ractive.value=e;var n=Be(e);this.node.value!==n&&(this.node.value=n),this.node.setAttribute("value",n)}}function ti(t){t?this.node.checked=!1:this.node.checked=this.element.compare(this.getValue(),this.element.binding.getValue())}function ei(t){var e=this,n=e.element,i=e.node,r=n.binding,s=this.getValue(),a=n.getAttribute("value");if(Rs(s)){for(var o=s.length;o--;)if(n.compare(a,s[o]))return void(r.isChecked=i.checked=!0);r.isChecked=i.checked=!1}else r.isChecked=i.checked=n.compare(s,a)}function ni(t){for(var e=t?{}:zn(this.getValue()||""),n=this.node.style,i=Ms(e),r=this.previous||[],s=0;s<i.length;){if(i[s]in n){var a=e[i[s]].replace("!important","");n.setProperty(i[s],a,a.length!==e[i[s]].length?"important":"")}s++}for(s=r.length;s--;)!~i.indexOf(r[s])&&r[s]in n&&n.setProperty(r[s],"","");this.previous=i}function ii(t){if(this.style||(this.style=qn(this.name.substr(6))),!t||this.node.style.getPropertyValue(this.style)===this.last){var e=t?"":Be(this.getValue()),n=e.replace("!important","");this.node.style.setProperty(this.style,n,n.length!==e.length?"important":""),this.last=this.node.style.getPropertyValue(this.style)}}function ri(t){var e=t?[]:$n(Be(this.getValue())),n=this.node.className;n=void 0!==n.baseVal?n.baseVal:n;var i=$n(n),r=this.previous||[],s=e.concat(i.filter(function(t){return!~r.indexOf(t)})).join(" ");s!==n&&(l(this.node.className)?this.node.className=s:this.node.className.baseVal=s),this.previous=e}function si(t){var e=this.name.substr(6),n=this.node.className;n=void 0!==n.baseVal?n.baseVal:n;var i=$n(n),r=t?!1:this.getValue();this.inlineClass||(this.inlineClass=e),r&&!~i.indexOf(e)?i.push(e):!r&&~i.indexOf(e)&&i.splice(i.indexOf(e),1),l(this.node.className)?this.node.className=i.join(" "):this.node.className.baseVal=i.join(" ")}function ai(t){if(!this.locked)if(t)this.useProperty&&(this.node[this.propertyName]=!1),this.node.removeAttribute(this.propertyName);else if(this.useProperty)this.node[this.propertyName]=this.getValue();else{var e=this.getValue();e?this.node.setAttribute(this.propertyName,l(e)?e:""):this.node.removeAttribute(this.propertyName)}}function oi(t){t?this.node.getAttribute(this.name)===this.value&&this.node.removeAttribute(this.name):(this.value=Be(this.getString()),this.node.setAttribute(this.name,this.value))}function hi(t){t?this.value===this.node.getAttributeNS(this.namespace,this.name.slice(this.name.indexOf(":")+1))&&this.node.removeAttributeNS(this.namespace,this.name.slice(this.name.indexOf(":")+1)):(this.value=Be(this.getString()),this.node.setAttributeNS(this.namespace,this.name.slice(this.name.indexOf(":")+1),this.value))}function ui(){return Au}function li(t,e){if(Tu.test(t))return[];var n=e?"svg":"div";return t?(Cu.innerHTML="<"+n+" "+t+"></"+n+">")&&I(Cu.childNodes[0].attributes):[]}function ci(t,e){for(var n=t.length;n--;)if(t[n].name===e.name)return!1;return!0}function di(t,e){for(var n="xmlns:"+e;t;){if(t.hasAttribute&&t.hasAttribute(n))return t.getAttribute(n);t=t.parentNode}return fh[e]}function fi(){return ju}function pi(t,e,n){0===e?t.value=!0:"true"===e?t.value=!0:"false"===e||"0"===e?t.value=!1:t.value=e;var i=t.element[t.flag];return t.element[t.flag]=t.value,n&&!t.element.attributes.binding&&i!==t.value&&t.element.recreateTwowayBinding(),t.value}function mi(t){bu.call(this,t)}function vi(){var t=this;return this.torndown?(b("ractive.teardown() was called on a Ractive instance that was already torn down"),Promise.resolve()):(this.shouldDestroy=!0,gi(this,function(){return t.fragment.rendered?t.unrender():Promise.resolve()}))}function gi(t,e){t.torndown=!0,t.fragment.unbind(),t._observers.slice().forEach(W),t.el&&t.el.__ractive_instances__&&V(t.el.__ractive_instances__,t);var n=e();return ao.teardown.fire(t),n.then(function(){ao.destruct.fire(t),t.viewmodel.teardown()}),n}function yi(t,e){if(t.applyValue=function(t){this.parent.value[e]=t,t&&t.viewmodel?(this.link(t.viewmodel.getRactiveModel(),e),this._link.markedAll()):(this.link(Ss(_a),e),this._link.markedAll())},"root"===e){var n=t.mark;t.mark=function(t){this._marking||(this._marking=!0,n.apply(this,t),this._marking=!1)}}return t.applyValue(t.parent.ractive[e],e),t._link.set=function(e){return t.applyValue(e)},t._link.applyValue=function(e){return t.applyValue(e)},t._link}function bi(t,e){t._link&&t._link.implicit&&t._link.isDetached()&&t.attach(e);for(var n in t.childByKey)if(t.value)if(n in t.value)bi(t.childByKey[n],e);else if(!t.childByKey[n]._link||t.childByKey[n]._link.isDetached()){var i=jt(e,n);i&&t.childByKey[n].link(i,n,{implicit:!0})}}function wi(t){t._link&&t._link.implicit&&t.unlink();for(var e in t.childByKey)wi(t.childByKey[e])}function ki(t,e,i){var r=(t.constructor["_"+i]||[]).concat(n(e[i]||[])),s="on"===i?"once":i+"Once";r.forEach(function(e){var n=e[0],r=e[1];u(r)?t[i](n,r):h(r)&&u(r.handler)&&t[r.once?s:i](n,r.handler,Ss(r))})}function _i(e,n){Ns.DEBUG&&ta(),Ei(e),Ci(e),ki(e,n,"on"),!t(n,"delegate")&&e.parent&&e.parent.delegate!==e.delegate&&(e.delegate=!1),Rs(n.use)&&e.use.apply(e,n.use.filter(function(t){return t.construct})),ao.construct.fire(e,n),n.onconstruct&&n.onconstruct.call(e,It(e),n);for(var i=Ku.length;i--;){var r=Ku[i];e[r]=js(Ss(e.constructor[r]||null),n[r])}for(i=Bu.length;i--;){var s=Bu[i];e[s]=js(Ss(e.constructor.prototype[s]),n[s])}e._attributePartial&&(e.partials["extra-attributes"]=e._attributePartial,delete e._attributePartial);var a=new Ru({adapt:xi(e,e.adapt,n),data:Gh.init(e.constructor,e,n),ractive:e});e.adapt=a.adaptors,e.viewmodel=a;for(var o in e.computed)ue.call(e,o,e.computed[o])}function xi(t,e,n){function i(e){return l(e)&&(e=k("adaptors",t,e),e||m(ha(e,"adaptor"))),e}e=e.map(i);var r=O(n.adapt).map(i),s=[e,r];return t.parent&&!t.isolated&&s.push(t.parent.viewmodel.adaptors),M.apply(null,s)}function Ei(t){t._guid="r-"+Pu++,t._subs=Ss(null),t._nsSubs=0,t._config={},t.event=null,t._eventQueue=[],t._observers=[],t._children=[],t._children.byName={},t.children=t._children,t.component||(t.root=t,t.parent=t.container=null)}function Ci(t){var e=t.component,n=t.constructor.attributes;if(n&&e){var i=e.template,r=i.m?i.m.slice():[],s=r.filter(function(t){return t.t===vo}).map(function(t){return t.n});n.required.forEach(function(t){~s.indexOf(t)||b("Component '"+e.name+"' requires attribute '"+t+"' to be provided")});for(var a=n.optional.concat(n.required),o=[],h=r.length;h--;){var u=r[h];u.t!==vo||~a.indexOf(u.n)?n.mapAll||u.t!==Io&&u.t!==Ro&&u.t!==Ko||o.unshift(r.splice(h,1)[0]):n.mapAll?o.unshift({t:vo,n:u.n,f:[{t:ho,r:"~/"+u.n}]}):o.unshift(r.splice(h,1)[0])}o.length&&(e.template={t:i.t,e:i.e,f:i.f,m:r,p:i.p}),t._attributePartial=o}}function Ai(t){this.item&&this.removeChild(this.item);var e=t.instance;t.anchor=this,t.up=this.up,t.name=t.nameOption||this.name,this.name=t.name,e.isolated||e.viewmodel.attached(this.up),this.rendered&&Ti(this,t)}function Ni(t){this.item===t&&(ji(this,t),this.name=this.template.n)}function Ti(t,e){if(t.rendered){e.shouldDestroy=!1,e.up=t.up,t.item=e,t.instance=e.instance;var n=t.up.findNextNode(t);e.instance.fragment.rendered&&e.instance.unrender(),e.partials=e.instance.partials,e.instance.partials=js(Ss(e.partials),e.partials,t._partials),e.instance.fragment.unbind(!0),e.instance.fragment.componentParent=t.up,e.instance.fragment.bind(e.instance.viewmodel),t.attributes.forEach(G),t.eventHandlers.forEach(G),t.attributes.forEach(et),t.eventHandlers.forEach(et);var i=t.up.findParentNode();Zr(e.instance,i,i.contains(n)?n:null,t.occupants),e.lastBound!==t&&(e.lastBound=t)}}function ji(t,e){t.rendered&&(e.shouldDestroy=!0,e.instance.unrender(),t.eventHandlers.forEach(st),t.attributes.forEach(st),t.eventHandlers.forEach(rt),t.attributes.forEach(rt),e.instance.el=e.instance.anchor=null,e.instance.fragment.componentParent=null,e.up=null,e.anchor=null,t.item=null,t.instance=null)}function Si(){var t=Fu;Fu=[],t.forEach(re)}function Oi(t){t.deps.length||t.refs||t.links.length||t.teardown()}function Vi(t,e,n,i){void 0===i&&(i={}),e&&e.f&&e.f.s&&(i.register?(t.model=new zu(n,e.f),t.model.register(t)):t.fn=dt(e.f.s,e.f.r.length))}function Mi(t,e,n,i){return void 0===i&&(i={}),e.f.r.map(function(t,e){var r;return i.specialRef&&(r=i.specialRef(t,e))?r:r=jt(n,t)})}function Ii(t){t.model&&t.model.unregister(t)}function Ri(){this._ractive.binding.handleChange()}function Ki(t,e,n){var i=t+"-bindingGroup";return e[i]||(e[i]=new nl(i,e,n))}function Bi(){var t=this,e=this.bindings.filter(function(t){return t.node&&t.node.checked}).map(function(t){return t.element.getAttribute("value")}),n=[];return e.forEach(function(e){t.bindings[0].arrayContains(n,e)||n.push(e)}),n}function Pi(){Ri.call(this);var t=this._ractive.binding.model.get();this.value=void 0==t?"":t}function Li(t){var e;return function(){var n=this;e&&clearTimeout(e),e=setTimeout(function(){var t=n._ractive.binding;t.rendered&&Ri.call(n),e=null},t)}}function Fi(t){return t.selectedOptions?I(t.selectedOptions):t.options?I(t.options).filter(function(t){return t.selected}):[]}function Di(t){return cl[t]||(cl[t]=[])}function Ui(){var t=this.bindings.filter(function(t){return t.node.checked});return t.length>0?t[0].element.getAttribute("value"):void 0}function Hi(t){return t&&t.template.f&&1===t.template.f.length&&!t.template.f[0].s?t.template.f[0].t===ho?!0:(t.template.f[0].t===uo&&b("It is not possible create a binding using a triple mustache."),!1):!1}function qi(t){var e=t.name,n=t.attributeByName;if("input"===e||"textarea"===e||"select"===e||n.contenteditable){var i=Hi(n.value),r=Hi(n.contenteditable),s=t.getAttribute("contenteditable");if((s||r)&&i)return al;if("input"===e){var a=t.getAttribute("type");if("radio"===a){var o=Hi(n.name),h=Hi(n.checked);return o&&h?(b("A radio input can have two-way binding on its name attribute, or its checked attribute - not both",{ractive:t.root}),fl):o?fl:h?dl:null}if("checkbox"===a){var u=Hi(n.name),l=Hi(n.checked);return u&&l?el:u?sl:l?el:null}return"file"===a&&i?hl:"number"===a&&i?ll:"range"===a&&i?ll:i?ol:null}return"select"===e&&i?t.getAttribute("multiple")?ul:pl:"textarea"===e&&i?ol:null}}function zi(t){var e=t.attributeByName.name;return"radio"===t.getAttribute("type")&&(e||{}).interpolator&&t.getAttribute("value")===e.interpolator.model.get()}function $i(t){var e=t.toString();return e?" "+e:""}function Gi(t){var e=t.getAttribute("xmlns");if(e)return e;if("svg"===t.name)return uh;var n=t.parent;return n?"foreignobject"===n.name?oh:n.node.namespaceURI:t.ractive.el.namespaceURI}function Wi(){gl=!0}function Qi(){yl=!0}function Yi(){bl=!0}function Zi(t){var e,n=t.type,i=t.currentTarget,r=i._ractive&&i._ractive.proxy,s=t.target,a=!0,o=!1;gl=yl=bl=!1;var h=t.stopPropagation,u=t.stopImmediatePropagation,l=t.preventDefault;for(t.stopPropagation=Wi,t.stopImmediatePropagation=Qi,t.preventDefault=Yi;a&&s&&s!==i;){var c=s._ractive&&s._ractive.proxy;if(c&&c.up.delegate===r&&Ji(t,s,i)&&(e=c.listeners&&c.listeners[n]))for(var d=e.length,f=0;d>f;f++){if(a=e[f].call(s,t)!==!1&&a,yl){a=!1;break}gl&&(a=!1),bl&&!o&&(o=!0,l.call(t))}s=s.parentNode||s.correspondingUseElement}return a&&(a=!gl&&!yl),gl&&h.call(t),yl&&u.call(t),t.stopPropagation=h,t.stopImmediaitePropagation=u,t.preventDefault=l,a}function Ji(t,e,n){if(wl&&t instanceof wl)for(var i=e;i&&i!==n;){if(i.disabled)return!1;i=i.parentNode||i.correspondingUseElement}return!0}function Xi(t){var e,n=this,i=this._ractive.proxy;if(i.listeners&&(e=i.listeners[t.type]))for(var r=e.length,s=0;r>s;s++)e[s]&&e[s].call(n,t)}function tr(){var t=this._ractive.proxy;Ia.start(),t.formBindings.forEach(er),Ia.end()}function er(t){t.model.set(t.resetValue)}function nr(t,e,n,i){if(n){var r=n[0];if(r&&3===r.nodeType){var s=r.nodeValue.indexOf(i);n.shift(),0===s?r.nodeValue.length!==i.length&&n.unshift(r.splitText(i.length)):r.nodeValue=i}else r=t.node=Ps.createTextNode(i),n[0]?e.insertBefore(r,n[0]):e.appendChild(r);t.node=r}else t.node||(t.node=Ps.createTextNode(i)),e.appendChild(t.node)}function ir(t){t.base&&t.base.unregister(t.proxy),t.models&&t.models.forEach(function(e){e.unregister&&e.unregister(t)})}function rr(t){var e,n,i=t.deps.length;f