Commit 5945668e authored by Rhsy's avatar Rhsy Committed by Sindre Sorhus

Close GH-286: update PlastronJS example.

parent d075d120
......@@ -4,6 +4,13 @@
<meta charset="utf-8">
<title>PlastronJS • TodoMVC</title>
<link rel="stylesheet" href="../../../assets/base.css">
<style type="text/css">
#filters.none li.none,
#filters.active li.active,
#filters.completed li.completed {
font-weight: bold;
}
</style>
<!--[if IE]>
<script src="../../../assets/ie.js"></script>
<![endif]-->
......@@ -21,14 +28,14 @@
</section>
<footer id="footer">
<span id="todo-count"><strong>0</strong> item left</span>
<ul id="filters">
<li>
<a class="selected" href="#/">All</a>
<ul id="filters" class="none">
<li class="none">
<a href="#/">All</a>
</li>
<li>
<li class="active">
<a href="#/active">Active</a>
</li>
<li>
<li class="completed">
<a href="#/completed">Completed</a>
</li>
</ul>
......
goog.require('goog.dom');
goog.require('goog.dom.classes');
goog.require('mvc.Collection');
goog.require('mvc.Router');
goog.require('todomvc.listcontrol');
goog.require('todomvc.listmodel');
......@@ -10,38 +7,22 @@ var todolist = new todomvc.listmodel();
// Create the control for the collection.
var todolistControl = new todomvc.listcontrol( todolist );
// HTML already there so use decorate.
todolistControl.decorate( goog.dom.getElement('todoapp') );
// Setup router
var router = new mvc.Router();
/**
* toggles selected class on filters list
*
* @param {string} chosenFilter selected filter by name.
*/
var toggleFilters = function( chosenFilter ) {
var filters = goog.dom.getElementsByTagNameAndClass( 'A', undefined,
goog.dom.getElement('filters') );
goog.array.forEach( filters, function( filter ) {
goog.dom.classes.enable( filter, 'selected',
goog.dom.getTextContent( filter ) === chosenFilter );
});
};
router.route( '/', function() {
todolistControl.setFilter( todomvc.listcontrol.Filter.ALL );
toggleFilters('All');
router.route( '{/}', function() {
todolist.set( 'filter', 'none' );
});
router.route( '/active', function() {
todolistControl.setFilter( todomvc.listcontrol.Filter.ACTIVE );
toggleFilters('Active');
todolist.set( 'filter', 'active' );
});
router.route( '/completed', function() {
todolistControl.setFilter( todomvc.listcontrol.Filter.COMPLETED );
toggleFilters('Completed');
todolist.set( 'filter', 'completed' );
});
(function(){function g(a){throw a;}var i=void 0,j=!0,k=null,m=!1,n,o=this;function aa(){}
(function(){function g(a){throw a;}var i=void 0,j=!0,k=null,l=!1,n,o=this;function aa(){}
function ba(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function q(a){return a!==i}function r(a){return"array"==ba(a)}function s(a){var b=ba(a);return"array"==b||"object"==b&&"number"==typeof a.length}function u(a){return"string"==typeof a}function ca(a){return"number"==typeof a}function da(a){return"function"==ba(a)}function ea(a){var b=typeof a;return"object"==b&&a!=k||"function"==b}function v(a){return a[fa]||(a[fa]=++ga)}
var fa="closure_uid_"+Math.floor(2147483648*Math.random()).toString(36),ga=0;function ha(a,b,c){return a.call.apply(a.bind,arguments)}function ia(a,b,c){a||g(Error());if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}
function x(a,b,c){x=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ha:ia;return x.apply(k,arguments)}var ja=Date.now||function(){return+new Date};function y(a,b){function c(){}c.prototype=b.prototype;a.j=b.prototype;a.prototype=new c;a.prototype.constructor=a};function ka(a,b){for(var c=1;c<arguments.length;c++)var d=(""+arguments[c]).replace(/\$/g,"$$$$"),a=a.replace(/\%s/,d);return a}function la(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")}var ma=/^[a-zA-Z0-9\-_.!~*'()]*$/;function na(a){if(!oa.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(pa,"&amp;"));-1!=a.indexOf("<")&&(a=a.replace(qa,"&lt;"));-1!=a.indexOf(">")&&(a=a.replace(ra,"&gt;"));-1!=a.indexOf('"')&&(a=a.replace(sa,"&quot;"));return a}var pa=/&/g,qa=/</g,ra=/>/g,sa=/\"/g,oa=/[&<>\"]/;var z=Array.prototype,A=z.indexOf?function(a,b,c){return z.indexOf.call(a,b,c)}:function(a,b,c){c=c==k?0:0>c?Math.max(0,a.length+c):c;if(u(a))return!u(b)||1!=b.length?-1:a.indexOf(b,c);for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},B=z.forEach?function(a,b,c){z.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=u(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},ta=z.filter?function(a,b,c){return z.filter.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=[],f=0,h=u(a)?a.split(""):
a,l=0;l<d;l++)if(l in h){var p=h[l];b.call(c,p,l,a)&&(e[f++]=p)}return e},C=z.map?function(a,b,c){return z.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=u(a)?a.split(""):a,h=0;h<d;h++)h in f&&(e[h]=b.call(c,f[h],h,a));return e},ua=z.some?function(a,b,c){return z.some.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=u(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return j;return m};function va(a,b){var c=wa(a,b);return 0>c?k:u(a)?a.charAt(c):a[c]}
function wa(a,b){for(var c=a.length,d=u(a)?a.split(""):a,e=0;e<c;e++)if(e in d&&b.call(i,d[e],e,a))return e;return-1}function xa(a,b){for(var c=u(a)?a.split(""):a,d=a.length-1;0<=d;d--)if(d in c&&b.call(i,c[d],d,a))return d;return-1}function ya(a,b){0<=A(a,b)||a.push(b)}function za(a,b,c){Aa(a,c,0,b)}function Ba(a,b){var c=A(a,b);0<=c&&z.splice.call(a,c,1)}function Ca(a,b){var c=wa(a,b);return 0<=c?(z.splice.call(a,c,1),j):m}function Da(a){return z.concat.apply(z,arguments)}
function Ea(a){if(r(a))return Da(a);for(var b=[],c=0,d=a.length;c<d;c++)b[c]=a[c];return b}function Fa(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c],e;if(r(d)||(e=s(d))&&d.hasOwnProperty("callee"))a.push.apply(a,d);else if(e)for(var f=a.length,h=d.length,l=0;l<h;l++)a[f+l]=d[l];else a.push(d)}}function Aa(a,b,c,d){z.splice.apply(a,Ga(arguments,1))}function Ga(a,b,c){return 2>=arguments.length?z.slice.call(a,b):z.slice.call(a,b,c)}
function Ia(a,b){if(!s(a)||!s(b)||a.length!=b.length)return m;for(var c=a.length,d=Ja,e=0;e<c;e++)if(!d(a[e],b[e]))return m;return j}function Ja(a,b){return a===b};var D,Ka,La,Ma;function Na(){return o.navigator?o.navigator.userAgent:k}Ma=La=Ka=D=m;var Oa;if(Oa=Na()){var Pa=o.navigator;D=0==Oa.indexOf("Opera");Ka=!D&&-1!=Oa.indexOf("MSIE");La=!D&&-1!=Oa.indexOf("WebKit");Ma=!D&&!La&&"Gecko"==Pa.product}var Qa=D,F=Ka,G=Ma,H=La,Ra;
a:{var Sa="",Ta;if(Qa&&o.opera)var Ua=o.opera.version,Sa="function"==typeof Ua?Ua():Ua;else if(G?Ta=/rv\:([^\);]+)(\)|;)/:F?Ta=/MSIE\s+([^\);]+)(\)|;)/:H&&(Ta=/WebKit\/(\S+)/),Ta)var Va=Ta.exec(Na()),Sa=Va?Va[1]:"";if(F){var Wa,Xa=o.document;Wa=Xa?Xa.documentMode:i;if(Wa>parseFloat(Sa)){Ra=""+Wa;break a}}Ra=Sa}var Ya={};
function J(a){var b;if(!(b=Ya[a])){b=0;for(var c=la(""+Ra).split("."),d=la(""+a).split("."),e=Math.max(c.length,d.length),f=0;0==b&&f<e;f++){var h=c[f]||"",l=d[f]||"",p=RegExp("(\\d*)(\\D*)","g"),w=RegExp("(\\d*)(\\D*)","g");do{var E=p.exec(h)||["","",""],t=w.exec(l)||["","",""];if(0==E[0].length&&0==t[0].length)break;b=((0==E[1].length?0:parseInt(E[1],10))<(0==t[1].length?0:parseInt(t[1],10))?-1:(0==E[1].length?0:parseInt(E[1],10))>(0==t[1].length?0:parseInt(t[1],10))?1:0)||((0==E[2].length)<(0==
t[2].length)?-1:(0==E[2].length)>(0==t[2].length)?1:0)||(E[2]<t[2]?-1:E[2]>t[2]?1:0)}while(0==b)}b=Ya[a]=0<=b}return b}var Za={};function $a(){return Za[9]||(Za[9]=F&&!!document.documentMode&&9<=document.documentMode)};var ab,bb=!F||$a();!G&&!F||F&&$a()||G&&J("1.9.1");var cb=F&&!J("9");function db(a){return(a=a.className)&&"function"==typeof a.split?a.split(/\s+/):[]}function eb(a,b){var c=db(a),d=Ga(arguments,1),e;e=c;for(var f=0,h=0;h<d.length;h++)0<=A(e,d[h])||(e.push(d[h]),f++);e=f==d.length;a.className=c.join(" ");return e}function fb(a,b){for(var c=db(a),d=Ga(arguments,1),e=c,f=0,h=0;h<e.length;h++)0<=A(d,e[h])&&(Aa(e,h--,1),f++);a.className=c.join(" ")};function K(a,b,c){for(var d in a)b.call(c,a[d],d,a)}function gb(a,b,c){var d={},e;for(e in a)b.call(c,a[e],e,a)&&(d[e]=a[e]);return d}function hb(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b}function ib(a,b){var c;(c=b in a)&&delete a[b];return c}function jb(a){var b=ba(a);if("object"==b||"array"==b){if(a.ob)return a.ob();var b="array"==b?[]:{},c;for(c in a)b[c]=jb(a[c]);return b}return a}var kb="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",");
function lb(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<kb.length;f++)c=kb[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};function mb(a){return a?new nb(L(a)):ab||(ab=new nb)}function M(a){return u(a)?document.getElementById(a):a}
function ob(a,b,c){c=c||document;a=a&&"*"!=a?a.toUpperCase():"";if(c.querySelectorAll&&c.querySelector&&(!H||"CSS1Compat"==document.compatMode||J("528"))&&(a||b))return c.querySelectorAll(a+(b?"."+b:""));if(b&&c.getElementsByClassName){c=c.getElementsByClassName(b);if(a){for(var d={},e=0,f=0,h;h=c[f];f++)a==h.nodeName&&(d[e++]=h);d.length=e;return d}return c}c=c.getElementsByTagName(a||"*");if(b){d={};for(f=e=0;h=c[f];f++)a=h.className,"function"==typeof a.split&&0<=A(a.split(/\s+/),b)&&(d[e++]=h);
d.length=e;return d}return c}function pb(a,b){K(b,function(b,d){"style"==d?a.style.cssText=b:"class"==d?a.className=b:"for"==d?a.htmlFor=b:d in qb?a.setAttribute(qb[d],b):0==d.lastIndexOf("aria-",0)?a.setAttribute(d,b):a[d]=b})}var qb={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",height:"height",width:"width",usemap:"useMap",frameborder:"frameBorder",maxlength:"maxLength",type:"type"};
function rb(a,b,c){function d(c){c&&b.appendChild(u(c)?a.createTextNode(c):c)}for(var e=2;e<c.length;e++){var f=c[e];s(f)&&!(ea(f)&&0<f.nodeType)?B(sb(f)?Ea(f):f,d):d(f)}}function tb(a){for(var b;b=a.firstChild;)a.removeChild(b)}function ub(a){a&&a.parentNode&&a.parentNode.removeChild(a)}function L(a){return 9==a.nodeType?a:a.ownerDocument||a.document}var vb={SCRIPT:1,STYLE:1,HEAD:1,IFRAME:1,OBJECT:1},wb={IMG:" ",BR:"\n"};
function xb(a,b,c){if(!(a.nodeName in vb))if(3==a.nodeType)c?b.push((""+a.nodeValue).replace(/(\r\n|\r|\n)/g,"")):b.push(a.nodeValue);else if(a.nodeName in wb)b.push(wb[a.nodeName]);else for(a=a.firstChild;a;)xb(a,b,c),a=a.nextSibling}function sb(a){if(a&&"number"==typeof a.length){if(ea(a))return"function"==typeof a.item||"string"==typeof a.item;if(da(a))return"function"==typeof a.item}return m}function yb(a,b){return zb(a,function(a){return!b||0<=A(db(a),b)})}
function zb(a,b){for(var c=0;a;){if(b(a))return a;a=a.parentNode;c++}return k}function nb(a){this.B=a||o.document||document}n=nb.prototype;n.w=function(a){return u(a)?this.B.getElementById(a):a};
n.xa=function(a,b,c){var d=this.B,e=arguments,f=e[0],h=e[1];if(!bb&&h&&(h.name||h.type)){f=["<",f];h.name&&f.push(' name="',na(h.name),'"');if(h.type){f.push(' type="',na(h.type),'"');var l={};lb(l,h);h=l;delete h.type}f.push(">");f=f.join("")}f=d.createElement(f);h&&(u(h)?f.className=h:r(h)?eb.apply(k,[f].concat(h)):pb(f,h));2<e.length&&rb(d,f,e);return f};n.createElement=function(a){return this.B.createElement(a)};n.createTextNode=function(a){return this.B.createTextNode(a)};
n.appendChild=function(a,b){a.appendChild(b)};n.$a=tb;function N(){}N.prototype.Pa=m;N.prototype.k=function(){this.Pa||(this.Pa=j,this.d())};N.prototype.d=function(){this.qb&&Ab.apply(k,this.qb)};function Ab(a){for(var b=0,c=arguments.length;b<c;++b){var d=arguments[b];s(d)?Ab.apply(k,d):d&&"function"==typeof d.k&&d.k()}};function O(a,b){this.type=a;this.currentTarget=this.target=b}y(O,N);O.prototype.d=function(){delete this.type;delete this.target;delete this.currentTarget};O.prototype.H=m;O.prototype.oa=j;!F||$a();var Bb=!F||$a();F&&J("8");!H||J("528");G&&J("1.9b")||F&&J("8")||Qa&&J("9.5")||H&&J("528");!G||J("8");function Cb(a){Cb[" "](a);return a}Cb[" "]=aa;function Db(a,b){a&&this.ka(a,b)}y(Db,O);n=Db.prototype;n.target=k;n.relatedTarget=k;n.offsetX=0;n.offsetY=0;n.clientX=0;n.clientY=0;n.screenX=0;n.screenY=0;n.button=0;n.keyCode=0;n.charCode=0;n.ctrlKey=m;n.altKey=m;n.shiftKey=m;n.metaKey=m;n.za=k;
n.ka=function(a,b){var c=this.type=a.type;O.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var d=a.relatedTarget;if(d){if(G){var e;a:{try{Cb(d.nodeName);e=j;break a}catch(f){}e=m}e||(d=k)}}else"mouseover"==c?d=a.fromElement:"mouseout"==c&&(d=a.toElement);this.relatedTarget=d;this.offsetX=H||a.offsetX!==i?a.offsetX:a.layerX;this.offsetY=H||a.offsetY!==i?a.offsetY:a.layerY;this.clientX=a.clientX!==i?a.clientX:a.pageX;this.clientY=a.clientY!==i?a.clientY:a.pageY;this.screenX=a.screenX||
0;this.screenY=a.screenY||0;this.button=a.button;this.keyCode=a.keyCode||0;this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.state=a.state;this.za=a;delete this.oa;delete this.H};n.d=function(){Db.j.d.call(this);this.relatedTarget=this.currentTarget=this.target=this.za=k};function Eb(){}var Fb=0;n=Eb.prototype;n.key=0;n.P=m;n.Ja=m;n.ka=function(a,b,c,d,e,f){da(a)?this.Ua=j:a&&a.handleEvent&&da(a.handleEvent)?this.Ua=m:g(Error("Invalid listener argument"));this.W=a;this.Ya=b;this.src=c;this.type=d;this.capture=!!e;this.S=f;this.Ja=m;this.key=++Fb;this.P=m};n.handleEvent=function(a){return this.Ua?this.W.call(this.S||this.src,a):this.W.handleEvent.call(this.W,a)};var P={},Q={},R={},S={};
function T(a,b,c,d,e){if(b){if(r(b)){for(var f=0;f<b.length;f++)T(a,b[f],c,d,e);return k}var d=!!d,h=Q;b in h||(h[b]={q:0,p:0});h=h[b];d in h||(h[d]={q:0,p:0},h.q++);var h=h[d],l=v(a),p;h.p++;if(h[l]){p=h[l];for(f=0;f<p.length;f++)if(h=p[f],h.W==c&&h.S==e){if(h.P)break;return p[f].key}}else p=h[l]=[],h.q++;f=Gb();f.src=a;h=new Eb;h.ka(c,f,a,b,d,e);c=h.key;f.key=c;p.push(h);P[c]=h;R[l]||(R[l]=[]);R[l].push(h);a.addEventListener?(a==o||!a.Oa)&&a.addEventListener(b,f,d):a.attachEvent(b in S?S[b]:S[b]=
"on"+b,f);return c}g(Error("Invalid event type"))}function Gb(){var a=Hb,b=Bb?function(c){return a.call(b.src,b.key,c)}:function(c){c=a.call(b.src,b.key,c);if(!c)return c};return b}function Ib(a,b,c,d,e){if(r(b))for(var f=0;f<b.length;f++)Ib(a,b[f],c,d,e);else{d=!!d;a:{f=Q;if(b in f&&(f=f[b],d in f&&(f=f[d],a=v(a),f[a]))){a=f[a];break a}a=k}if(a)for(f=0;f<a.length;f++)if(a[f].W==c&&a[f].capture==d&&a[f].S==e){Jb(a[f].key);break}}}
function Jb(a){if(!P[a])return m;var b=P[a];if(b.P)return m;var c=b.src,d=b.type,e=b.Ya,f=b.capture;c.removeEventListener?(c==o||!c.Oa)&&c.removeEventListener(d,e,f):c.detachEvent&&c.detachEvent(d in S?S[d]:S[d]="on"+d,e);c=v(c);e=Q[d][f][c];if(R[c]){var h=R[c];Ba(h,b);0==h.length&&delete R[c]}b.P=j;e.Wa=j;Kb(d,f,c,e);delete P[a];return j}
function Kb(a,b,c,d){if(!d.la&&d.Wa){for(var e=0,f=0;e<d.length;e++)d[e].P?d[e].Ya.src=k:(e!=f&&(d[f]=d[e]),f++);d.length=f;d.Wa=m;0==f&&(delete Q[a][b][c],Q[a][b].q--,0==Q[a][b].q&&(delete Q[a][b],Q[a].q--),0==Q[a].q&&delete Q[a])}}function Lb(a){var b,c=0,d=b==k;b=!!b;if(a==k)K(R,function(a){for(var e=a.length-1;0<=e;e--){var f=a[e];if(d||b==f.capture)Jb(f.key),c++}});else if(a=v(a),R[a])for(var a=R[a],e=a.length-1;0<=e;e--){var f=a[e];if(d||b==f.capture)Jb(f.key),c++}}
function Mb(a,b,c,d,e){var f=1,b=v(b);if(a[b]){a.p--;a=a[b];a.la?a.la++:a.la=1;try{for(var h=a.length,l=0;l<h;l++){var p=a[l];p&&!p.P&&(f&=Nb(p,e)!==m)}}finally{a.la--,Kb(c,d,b,a)}}return Boolean(f)}function Nb(a,b){var c=a.handleEvent(b);a.Ja&&Jb(a.key);return c}
function Hb(a,b){if(!P[a])return j;var c=P[a],d=c.type,e=Q;if(!(d in e))return j;var e=e[d],f,h;if(!Bb){var l;if(!(l=b))a:{l=["window","event"];for(var p=o;f=l.shift();)if(p[f]!=k)p=p[f];else{l=k;break a}l=p}f=l;l=j in e;p=m in e;if(l){if(0>f.keyCode||f.returnValue!=i)return j;a:{var w=m;if(0==f.keyCode)try{f.keyCode=-1;break a}catch(E){w=j}if(w||f.returnValue==i)f.returnValue=j}}w=new Db;w.ka(f,this);f=j;try{if(l){for(var t=[],Ha=w.currentTarget;Ha;Ha=Ha.parentNode)t.push(Ha);h=e[j];h.p=h.q;for(var I=
t.length-1;!w.H&&0<=I&&h.p;I--)w.currentTarget=t[I],f&=Mb(h,t[I],d,j,w);if(p){h=e[m];h.p=h.q;for(I=0;!w.H&&I<t.length&&h.p;I++)w.currentTarget=t[I],f&=Mb(h,t[I],d,m,w)}}else f=Nb(c,w)}finally{t&&(t.length=0),w.k()}return f}d=new Db(b,this);try{f=Nb(c,d)}finally{d.k()}return f};function U(){}y(U,N);n=U.prototype;n.Oa=j;n.ma=k;n.Ga=function(a){this.ma=a};n.addEventListener=function(a,b,c,d){T(this,a,b,c,d)};n.removeEventListener=function(a,b,c,d){Ib(this,a,b,c,d)};
n.dispatchEvent=function(a){var b=a.type||a,c=Q;if(b in c){if(u(a))a=new O(a,this);else if(a instanceof O)a.target=a.target||this;else{var d=a,a=new O(b,this);lb(a,d)}var d=1,e,c=c[b],b=j in c,f;if(b){e=[];for(f=this;f;f=f.ma)e.push(f);f=c[j];f.p=f.q;for(var h=e.length-1;!a.H&&0<=h&&f.p;h--)a.currentTarget=e[h],d&=Mb(f,e[h],a.type,j,a)&&a.oa!=m}if(m in c)if(f=c[m],f.p=f.q,b)for(h=0;!a.H&&h<e.length&&f.p;h++)a.currentTarget=e[h],d&=Mb(f,e[h],a.type,m,a)&&a.oa!=m;else for(e=this;!a.H&&e&&f.p;e=e.ma)a.currentTarget=
e,d&=Mb(f,e,a.type,m,a)&&a.oa!=m;a=Boolean(d)}else a=j;return a};n.d=function(){U.j.d.call(this);Lb(this);this.ma=k};function V(a){var b={schema:{},sync:k,attr:{}};a||(a={});a.attr=a.attr||{};K(a,function(c,d){q(b[d])||(a.attr[d]=c)});K(b,function(c,d){b[d]=a[d]||b[d]});this.m={};this.G={};this.b=b.schema||{};this.aa=b.sync;this.ga=[];this.ua={};this.Fa=[];this.Sa=aa;T(this,"change",this.wa,m,this);this.La=""+v(this);this.set(b.attr);this.dispatchEvent("load")}y(V,U);
function Ob(a,b){var c=b;if(u(b)){var d={number:ca,string:u,array:s};return function(a){d[b.toLowerCase()](a)||g(new Pb);return a}}if(c.exec)return x(function(a,b){a.exec(b)===k&&g(new Pb);return b},a,b);da(c)&&hb(c.prototype).length&&(c=function(a){var c=Object.getPrototypeOf(a).constructor;if(Object.getPrototypeOf(a).constructor==b)return a;for(;c.j;)if(c=c.j.constructor,c==b)return a;g(new Pb)});return c}n=V.prototype;n.ra=function(){var a=this.m,b={},c;for(c in a)b[c]=a[c];return b};
n.get=function(a,b){if(this.b[a]&&this.b[a].get){var c=this.b[a].get.apply(this,C(this.b[a].Fb||[],function(c){if(c===a)return this.m[a];c=this.get(c);return q(c)?c:b},this));return q(c)?c:b}return q(this.m[a])?this.m[a]:b};
n.set=function(a,b,c){var d=m;if(u(a)){var e={};e[a]=b;a=e}else c=b;K(a,function(a,b){if(q(a))try{this.m[b]=this.b[b]&&this.b[b].set?Ob(this,this.b[b].set).call(this,a,this):a,d=j}catch(c){c.vb?this.Sa(c):g(c)}else this.m[b]=a,this.G[b]!=this.m[b]&&(d=j)},this);return d?(c||(this.dispatchEvent("change"),this.G=jb(this.m),this.m=gb(this.m,function(a){return q(a)})),j):m};n.u=function(){this.dispatchEvent("change");this.G=jb(this.m)};
function Qb(a,b){return a.b[b]&&a.b[b].get?a.b[b].get.apply(a,C(a.b[b].Fb||[],function(a){return a===b?this.G[b]:Qb(this,a)},a)):a.G[b]}function Rb(a,b){a.b.title=a.b.title||{};a.b.title.set=x(b,a)}function Sb(a){var b=hb(gb(a.b,function(a,b){if(this.b[b].pb)return!this.b[b].pb(Qb(this,b),this.get(b));var e=Qb(this,b);return r(e)?!Ia(e,this.get(b)):Qb(this,b)!=this.get(b)},a));Fa(b,hb(gb(a.m,function(a,b){return q(this.b[b])?m:r(a)?!Ia(a,this.G[b]):a!==this.G[b]},a)));return b}
n.k=function(a){a&&this.aa.qa.remove(this.get("id"));this.dispatchEvent("unload");B(Ea(this.Fa),function(a){a(this)},this);this.d()};function Tb(a,b){a.Sa=b}n.save=function(){this.aa&&(!q(this.get("id"))?this.aa.create(this):this.aa.update(this))};n.wa=function(){var a=Sb(this);B(this.ga,function(b){ua(b.da,function(b){return 0<=A(a,b)})&&b.ha.apply(b.Ta,Da(C(b.da,function(a){return this.get(a)},this)))},this);K(this.ua,function(a){a(this)},this)};
n.fa=function(a,b){var a=x(a,b||this),c=v(a);this.Fa.push(a);return c};n.bind=function(a,b,c){u(a)&&(a=[a]);a={da:a,ha:b,Ta:c||this};a.Ka=v(a);this.ga.push(a);return a.Ka};n.t=function(a){return Ca(this.ga,function(b){return b.Ka==a})||ib(this.ua,a)||Ca(this.Fa,function(b){return v(b)==a})};n.ea=function(a,b){var c=x(a,b||this),d=v(c);this.ua[""+d]=c;return d};function Pb(){this.vb=j}y(Pb,Error);function W(a){var a=a||{},b={comparator:a.comparator||k,modelType:a.modelType||V,models:a.models||[]};ib(a,"comparator");ib(a,"modelType");ib(a,"models");this.a=[];this.Ma=b.comparator;this.Ea=[];this.Ia=[];this.ca=[];this.kb=[];this.Z=[];this.Eb=[];this.z=m;this.Va=b.modelType;V.call(this,a);B(b.models,function(a){this.add(a,i,j)},this)}y(W,V);n=W.prototype;n.sort=function(a){var b=m;if(this.Ma){var c=this.Ma;this.a.sort(function(a,e){var f=c(a.g,e.g);0<f&&(b=j);return f});this.z=this.z||b}a||this.dispatchEvent("change")};
n.add=function(a,b,c){ca(b)&&0>b&&(b=this.a.length+b);var d=m;if(r(a))return d=B(a.reverse(),function(){if(!va(this.a,function(b){return b.g==a})){this.A=this.z=d=j;var c=a.ea(x(function(){this.A=j;this.sort()},this)),e=a.fa(function(){this.remove(a)},this);za(this.a,{g:a,Ha:e,u:c},b||this.a.length);ya(this.ca,a)}},this),this.length=this.a.length,this.sort(j),d&&!c&&this.u(),d;if(!va(this.a,function(b){return b.g==a})){this.A=this.z=d=j;var e=a.ea(x(function(){this.A=j;this.sort()},this,m)),f=a.fa(function(){this.remove(a)},
this);za(this.a,{g:a,Ha:f,u:e},b||this.a.length);ya(this.ca,a);this.sort(j);c||this.u()}this.length=this.a.length;return d};
n.remove=function(a,b){if(r(a)){var c=m;B(a,function(a){var b=va(this.a,function(b){return b.g==a});b&&(this.A=this.z=j,a.t(b.Ha),a.t(b.u),Ba(this.a,b),c=j,ya(this.Z,{g:a,id:a.get("id")||a.La}))},this);this.length=this.a.length;this.sort(j);c&&!b&&this.u();return c}var d=va(this.a,function(b){return b.g==a});d&&(this.A=this.z=j,a.t(d.Ha),a.t(d.u),ya(this.Z,d),Ba(this.a,d),ya(this.Z,{g:a,id:a.get("id")||a.La}),this.sort(j),b||this.dispatchEvent("change"));this.length=this.a.length;return!!d};
function Ub(a,b){var c=C(a.a,function(a){return a.g});return b?ta(c,b):c}n.Da=function(a,b){var c=x(a,b||this);this.Ea.push(c);return v(c)};n.ta=function(a,b){var c=x(a,b||this);this.Ia.push(c);return v(c)};n.t=function(a){return Ca(this.Ea,function(b){return v(b)==a})||W.j.t.call(this,a)};
n.wa=function(){W.j.wa.call(this);this.z&&(B(Ea(this.Ea),function(a){a(this)},this),this.z=m);this.A&&(B(Ea(this.Ia),function(a){a(this)},this),this.b&&K(this.b,function(a,b){a.wb&&B(this.ga,function(a){0<=A(a.da,b)&&a.ha.apply(a.Ta,Da(C(a.da,function(a){return this.get(a)},this)))},this)},this),this.A=m);B(this.Eb,function(a){B(this.Z,function(b){a(b.g,b.id)})},this);this.Z=[];B(this.kb,function(a){B(this.ca,function(b){a(b)})},this);this.ca=[]};function Vb(a,b){this.U=a||1;this.ba=b||Wb;this.va=x(this.Gb,this);this.Ba=ja()}y(Vb,U);Vb.prototype.enabled=m;var Wb=o.window;n=Vb.prototype;n.e=k;n.setInterval=function(a){this.U=a;this.e&&this.enabled?(this.stop(),this.start()):this.e&&this.stop()};n.Gb=function(){if(this.enabled){var a=ja()-this.Ba;0<a&&a<0.8*this.U?this.e=this.ba.setTimeout(this.va,this.U-a):(this.dispatchEvent(Xb),this.enabled&&(this.e=this.ba.setTimeout(this.va,this.U),this.Ba=ja()))}};
n.start=function(){this.enabled=j;this.e||(this.e=this.ba.setTimeout(this.va,this.U),this.Ba=ja())};n.stop=function(){this.enabled=m;this.e&&(this.ba.clearTimeout(this.e),this.e=k)};n.d=function(){Vb.j.d.call(this);this.stop();delete this.ba};var Xb="tick";function X(a){this.sb=a;this.Aa=[]}y(X,N);var Yb=[];function Zb(a,b,c,d,e){r(c)||(Yb[0]=c,c=Yb);for(var f=0;f<c.length;f++)a.Aa.push(T(b,c[f],d||a,e||m,a.sb||a));return a}function $b(a){B(a.Aa,Jb);a.Aa.length=0}X.prototype.d=function(){X.j.d.call(this);$b(this)};X.prototype.handleEvent=function(){g(Error("EventHandler.handleEvent not implemented"))};function ac(){O.call(this,"navigate")}y(ac,O);function Y(a,b,c,d){a&&!b&&g(Error("Can't use invisible history without providing a blank page."));var e;c?e=c:(e="history_state"+bc,document.write(ka(cc,e,e)),e=M(e));this.ia=e;this.c=c?L(c)?L(c).parentWindow||L(c).defaultView:window:window;this.lb=this.c.location.href.split("#")[0];this.ja=b;F&&!b&&(this.ja="https"==window.location.protocol?"https:///":'javascript:""');this.e=new Vb(dc);this.R=!a;this.D=new X(this);if(a||F&&!ec)d?a=d:(a="history_iframe"+bc,b=this.ja?'src="'+na(this.ja)+'"':"",document.write(ka(fc,
a,b)),a=M(a)),this.L=a,this.ib=j;F&&!ec&&(Zb(this.D,this.c,"load",this.zb),this.fb=this.ya=m);this.R?gc(this,this.s(),j):hc(this,this.ia.value);bc++}y(Y,U);Y.prototype.v=m;Y.prototype.M=m;Y.prototype.V=k;var ec=F&&8<=document.documentMode||G&&J("1.9.2")||H&&J("532.1");n=Y.prototype;n.X=k;n.d=function(){Y.j.d.call(this);this.D.k();this.Q(m)};
n.Q=function(a){if(a!=this.v)if(F&&!ec&&!this.ya)this.fb=a;else if(a)if(Qa?Zb(this.D,this.c.document,ic,this.Cb):G&&Zb(this.D,this.c,"pageshow",this.Bb),ec&&this.R)Zb(this.D,this.c,"hashchange",this.Ab),this.v=j,this.dispatchEvent(new ac(this.s()));else{if(!F||this.ya)Zb(this.D,this.e,Xb,x(this.nb,this,j)),this.v=j,F||(this.V=this.s()),this.e.start(),this.dispatchEvent(new ac(this.s()))}else this.v=m,$b(this.D),this.e.stop()};n.zb=function(){this.ya=j;this.ia.value&&hc(this,this.ia.value,j);this.Q(this.fb)};
n.Bb=function(a){a.za.persisted&&(this.Q(m),this.Q(j))};n.Ab=function(){var a=jc(this.c);a!=this.V&&kc(this,a)};n.s=function(){return this.X!=k?this.X:this.R?jc(this.c):lc(this)||""};function jc(a){var a=a.location.href,b=a.indexOf("#");return 0>b?"":a.substring(b+1)}function gc(a,b,c){var d=a.c.location,a=a.lb,e=-1!=d.href.indexOf("#");if(F||e||b)a+="#"+b;a!=d.href&&(c?d.replace(a):d.href=a)}
function hc(a,b,c){if(a.ib||b!=lc(a))if(a.ib=m,b=""+b,b=!ma.test(b)?encodeURIComponent(b):b,F){var d=a.L.contentDocument||a.L.contentWindow.document;d.open("text/html",c?"replace":i);d.write(ka(mc,na(a.c.document.title),b));d.close()}else if(b=a.ja+"#"+b,a=a.L.contentWindow)c?a.location.replace(b):a.location.href=b}
function lc(a){if(F)return a=a.L.contentDocument||a.L.contentWindow.document,a.body?decodeURIComponent(a.body.innerHTML.replace(/\+/g," ")):k;var b=a.L.contentWindow;if(b){var c;try{c=decodeURIComponent(jc(b).replace(/\+/g," "))}catch(d){return a.M||(a.M!=j&&a.e.setInterval(nc),a.M=j),k}a.M&&(a.M!=m&&a.e.setInterval(dc),a.M=m);return c||k}return k}
n.nb=function(){if(this.R){var a=jc(this.c);a!=this.V&&kc(this,a)}if(!this.R||F&&!ec)if(a=lc(this)||"",this.X==k||a==this.X)this.X=k,a!=this.V&&kc(this,a)};function kc(a,b){a.V=a.ia.value=b;a.R?(F&&!ec&&hc(a,b),gc(a,b)):hc(a,b);a.dispatchEvent(new ac(a.s()))}n.Cb=function(){this.e.stop();this.e.start()};
var ic=["mousedown","keydown","mousemove"],mc="<title>%s</title><body>%s</body>",fc='<iframe id="%s" style="display:none" %s></iframe>',cc='<input type="text" name="%s" id="%s" style="display:none">',bc=0,dc=150,nc=1E4;function oc(a,b){this.c=a||window;this.gb=b||k;T(this.c,"popstate",this.O,m,this);T(this.c,"hashchange",this.O,m,this)}y(oc,U);n=oc.prototype;n.v=m;n.sa=j;n.Xa="/";n.Q=function(a){a!=this.v&&(this.v=a)&&this.dispatchEvent(new ac(this.s()))};n.s=function(){if(this.sa){var a=this.c.location.href,b=a.indexOf("#");return 0>b?"":a.substring(b+1)}return this.gb?this.gb.Ib(this.Xa,this.c.location):this.c.location.pathname.substr(this.Xa.length)};
n.d=function(){Ib(this.c,"popstate",this.O,m,this);this.sa&&Ib(this.c,"hashchange",this.O,m,this)};n.eb=function(a){this.sa!=a&&(a?T(this.c,"hashchange",this.O,m,this):Ib(this.c,"hashchange",this.O,m,this),this.sa=a)};n.O=function(){this.v&&this.dispatchEvent(new ac(this.s()))};function pc(a,b){var c=window;this.T=c.history&&c.history.pushState?new oc:new Y(!(!b||!a),b);this.T.eb&&this.T.eb(!a);T(this.T,"navigate",this.yb,m,this);this.T.Q(j);this.ab=[]}pc.prototype.$=function(a,b){u(a)&&(a=RegExp("^"+(""+a).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08").replace(/\\:\w+/g,"(\\w+)").replace(/\\\*/g,"(.*)").replace(/\\\[/g,"(").replace(/\\\]/g,")?")+"$"));this.ab.push({$:a,mb:b})};
pc.prototype.yb=function(){var a=this.T.s();B(this.ab||[],function(b){var c=b.$.exec(a);c&&b.mb.apply(this,c)},this)};function qc(){}(function(a){a.Ra=function(){return a.ub||(a.ub=new a)}})(qc);qc.prototype.xb=0;qc.Ra();function rc(a){this.I=a||mb()}y(rc,U);n=rc.prototype;n.tb=qc.Ra();n.K=k;n.i=m;n.h=k;n.l=k;n.o=k;n.f=k;n.n=k;n.jb=m;function sc(a){return a.K||(a.K=":"+(a.tb.xb++).toString(36))}n.w=function(){return this.h};function tc(a,b){a==b&&g(Error("Unable to set parent component"));b&&a.o&&a.K&&a.o.n&&a.K&&a.K in a.o.n&&a.o.n[a.K]&&a.o!=b&&g(Error("Unable to set parent component"));a.o=b;rc.j.Ga.call(a,b)}n.getParent=function(){return this.o};
n.Ga=function(a){this.o&&this.o!=a&&g(Error("Method not supported"));rc.j.Ga.call(this,a)};n.xa=function(){this.h=this.I.createElement("div")};n.C=function(){this.i=j;uc(this,function(a){!a.i&&a.w()&&a.C()})};function vc(a){uc(a,function(a){a.i&&vc(a)});a.J&&$b(a.J);a.i=m}n.d=function(){rc.j.d.call(this);this.i&&vc(this);this.J&&(this.J.k(),delete this.J);uc(this,function(a){a.k()});!this.jb&&this.h&&ub(this.h);this.o=this.l=this.h=this.n=this.f=k};function uc(a,b){a.f&&B(a.f,b,i)}
n.removeChild=function(a,b){if(a){var c=u(a)?a:sc(a),a=this.n&&c?(c in this.n?this.n[c]:i)||k:k;c&&a&&(ib(this.n,c),Ba(this.f,a),b&&(vc(a),a.h&&ub(a.h)),tc(a,k))}a||g(Error("Child is not in parent component"));return a};n.$a=function(a){for(;this.f&&0!=this.f.length;)this.removeChild(this.f?this.f[0]||k:k,a)};function Z(a){this.I=mb();this.l=a;this.r={Ca:{},F:{}};this.N=[]}y(Z,rc);n=Z.prototype;n.remove=function(){ub(this.w());this.k()};n.rb=function(a,b){this.r.F[a]&&B(this.r.F[a],function(a){b.H||(!a.bb.length||ua(a.bb,function(a){return da(a)?a(b):yb(b.target,a)}))&&a.ha.call(a.S,b)})};
function wc(a,b,c,d,e,f){var h=["blur","focus"];a.r||(a.r={Ca:{},F:{}});a.r.F[b]||(a.r.F[b]=[]);a.r.Ca[b]||(a.r.Ca[b]=Zb(a.J||(a.J=new X(a)),a.w(),b,x(a.rb,a,b),0<=A(h,b)));q(d)||(d=[]);c={bb:r(d)?d:[d],ha:c,hb:k,S:e||a,Db:f||50};c.hb=v(c);za(a.r.F[b],c,xa(a.r.F[b],function(a){return a.Db<=(f||50)})+1);return c.hb}n.click=function(a,b,c,d){return wc(this,"click",a,b,c,d)};
function xc(a,b){"-"==b.charAt(0)&&(b="."+b.substring(1));var c;if("."==b.charAt(0)){c=b.substring(1);var d=a.w(),e=d||document;c=(e.querySelectorAll&&e.querySelector&&(!H||"CSS1Compat"==document.compatMode||J("528"))?e.querySelectorAll("."+c):e.getElementsByClassName?e.getElementsByClassName(c):ob("*",c,d))||[]}else"#"==b.charAt(0)?c=[M(b)]:(c=b.replace(/\s.*/,""),d=0<b.indexOf(".")?b.replace(/.*\./,""):k,c=ob(c,d,a.w()));return c}
n.bind=function(a,b,c){a=this.l.bind(a,b,c||this);this.N.push(a);return a};n.ea=function(a,b){var c=this.l.ea(a,b||this);this.N.push(c);return c};n.fa=function(a,b){var c=this.l.fa(a,b||this);this.N.push(c);return c};n.ta=function(a,b){var c=this.l.ta(a,b||this);this.N.push(c);return c};n.Da=function(a,b){var c=this.l.Da(a,b||this);this.N.push(c);return c};n.t=function(a){return this.l.t(a)};n.d=function(){B(this.N,function(a){this.t(a)},this);this.r=k;Z.j.d.call(this)};F&&J(8);var yc={};"ScriptEngine"in o&&"JScript"==o.ScriptEngine()&&(o.ScriptEngineMajorVersion(),o.ScriptEngineMinorVersion(),o.ScriptEngineBuildVersion());function zc(a){return"object"===typeof a&&a&&0===a.Hb?a.content:(""+a).replace(Ac,Bc)}var Cc={"\x00":"&#0;",'"':"&quot;","&":"&amp;","'":"&#39;","<":"&lt;",">":"&gt;","\t":"&#9;","\n":"&#10;","\x0B":"&#11;","\u000c":"&#12;","\r":"&#13;"," ":"&#32;","-":"&#45;","/":"&#47;","=":"&#61;","`":"&#96;","\u0085":"&#133;","\u00a0":"&#160;","\u2028":"&#8232;","\u2029":"&#8233;"};function Bc(a){return Cc[a]}var Ac=/[\x00\x22\x26\x27\x3c\x3e]/g;function Dc(a){Z.call(this,a)}y(Dc,Z);
Dc.prototype.xa=function(){var a={g:this.l.ra()},b=new nb(k)||mb(),a="<li "+((a||yc).g.completed?'class="completed"':"")+'><div class="view"><input class="toggle" type="checkbox" '+((a||yc).g.completed?"checked":"")+"><label>"+zc((a||yc).g.title)+'</label><button class="destroy"></button></div><input class="edit" type="text" value=""></li>';var c=b.B,b=c.createElement("div");F?(b.innerHTML="<br>"+a,b.removeChild(b.firstChild)):b.innerHTML=a;if(1==b.childNodes.length)a=b.removeChild(b.firstChild);
else for(a=c.createDocumentFragment();b.firstChild;)a.appendChild(b.firstChild);this.h=a};
Dc.prototype.C=function(){var a=this.l;this.click(function(b){a.set("completed",b.target.checked)},"toggle");this.click(function(){a.k()},"destroy");wc(this,"dblclick",function(){var a=xc(this,".edit")[0];eb(this.w(),"editing");a.value=this.l.get("title");a.focus()},"view");var b=xc(this,".edit")[0];wc(this,"keyup",function(c){13===c.keyCode&&a.set("title",b.value)},"edit");wc(this,"blur",function(){a.set("title",b.value)},"edit")};function Ec(a){Z.call(this,a);this.Qa=Fc}y(Ec,Z);function Fc(){return j}function Gc(a){return!a.get("completed")}function Hc(a){return a.get("completed")}
Ec.prototype.C=function(){Ec.j.C.call(this);var a=this.l,b=xc(this,"input")[0];wc(this,"keyup",function(c){13===c.keyCode&&(c=la(b.value),""!==c&&(c=new a.Va({title:c}),a.add(c,0,i),b.value=""))},"todo-entry");this.click(function(){B(a.get("completed"),function(a){a.k()})},"clear-completed");this.click(function(b){var d=b.target.checked;B(Ub(a),function(a){a.set("completed",d)})},"toggle-all");this.ta(function(){this.refresh();a.save()},this);this.Da(function(){Ic(!!a.a.length)},this);Ic(!!a.a.length);
this.bind("completed",function(b){var d=M("todo-count"),e;e=a.a.length-b.length;e="<strong>"+zc(e)+"</strong> item"+(1!=e?"s":"")+" left";d.innerHTML=e;d=M("clear-completed");e="Clear completed ("+b.length+")";if("textContent"in d)d.textContent=e;else if(d.firstChild&&3==d.firstChild.nodeType){for(;d.lastChild!=d.firstChild;)d.removeChild(d.lastChild);d.firstChild.data=e}else tb(d),d.appendChild(L(d).createTextNode(e));d.style.display=b.length?"":"none";xc(this,".toggle-all")[0].checked=b.length===
a.a.length});a.aa.Za(a,i)};function Ic(a){var b=M("main"),c=ob("footer",i,i)[0];b.style.display=a?"":"none";c.style.display=a?"":"none"}function Jc(a){var b=Kc;b.Qa=a;b.refresh()}
Ec.prototype.refresh=function(){uc(this,function(a){a.k()});this.$a(j);B(Ub(this.l,this.Qa),function(a){var a=new Dc(a),b=this.f?this.f.length:0;a.i&&!this.i&&g(Error("Component already rendered"));(0>b||b>(this.f?this.f.length:0))&&g(Error("Child component index out of bounds"));if(!this.n||!this.f)this.n={},this.f=[];if(a.getParent()==this)this.n[sc(a)]=a,Ba(this.f,a);else{var c=this.n,d=sc(a);d in c&&g(Error('The object already contains the key "'+d+'"'));c[d]=a}tc(a,this);za(this.f,a,b);a.i&&
this.i&&a.getParent()==this?(c=this.h,c.insertBefore(a.w(),c.childNodes[b]||k)):this.i&&!a.i&&a.h&&a.C();b=M("todo-list");a.i&&g(Error("Component already rendered"));a.h||a.xa();b?b.insertBefore(a.h,k):a.I.B.body.appendChild(a.h);(!a.o||a.o.i)&&a.C()},this)};function Lc(a){a=""+a;if(/^\s*$/.test(a)?0:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r\u2028\u2029\x00-\x08\x10-\x1f\x80-\x9f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,"")))try{return eval("("+a+")")}catch(b){}g(Error("Invalid JSON string: "+a))}function Mc(){this.na=i}function Nc(a,b){var c=[];Oc(a,b,c);return c.join("")}
function Oc(a,b,c){switch(typeof b){case "string":Pc(b,c);break;case "number":c.push(isFinite(b)&&!isNaN(b)?b:"null");break;case "boolean":c.push(b);break;case "undefined":c.push("null");break;case "object":if(b==k){c.push("null");break}if(r(b)){var d=b.length;c.push("[");for(var e="",f=0;f<d;f++)c.push(e),e=b[f],Oc(a,a.na?a.na.call(b,""+f,e):e,c),e=",";c.push("]");break}c.push("{");d="";for(f in b)Object.prototype.hasOwnProperty.call(b,f)&&(e=b[f],"function"!=typeof e&&(c.push(d),Pc(f,c),c.push(":"),
Oc(a,a.na?a.na.call(b,f,e):e,c),d=","));c.push("}");break;case "function":break;default:g(Error("Unknown type: "+typeof b))}}var Qc={'"':'\\"',"\\":"\\\\","/":"\\/","\u0008":"\\b","\u000c":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},Rc=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g;
function Pc(a,b){b.push('"',a.replace(Rc,function(a){if(a in Qc)return Qc[a];var b=a.charCodeAt(0),e="\\u";16>b?e+="000":256>b?e+="00":4096>b&&(e+="0");return Qc[a]=e+b.toString(16)}),'"')};function Sc(){};function Tc(a){this.Y=a;this.cb=new Mc}n=Tc.prototype;n.Y=k;n.cb=k;n.set=function(a,b){q(b)?this.Y.set(a,Nc(this.cb,b)):this.Y.remove(a)};n.get=function(a){a=this.Y.get(a);if(a!==k)try{return Lc(a)}catch(b){g("Storage: Invalid value was encountered")}};n.remove=function(a){this.Y.remove(a)};function Uc(){}y(Uc,Sc);function Vc(a){this.pa=a}y(Vc,Uc);Vc.prototype.set=function(a,b){try{this.pa.setItem(a,b)}catch(c){g("Storage mechanism: Quota exceeded")}};Vc.prototype.get=function(a){a=this.pa.getItem(a);if(u(a)||a===k)return a;g("Storage mechanism: Invalid value was encountered")};Vc.prototype.remove=function(a){this.pa.removeItem(a)};function Wc(){var a=k;try{a=window.localStorage||k}catch(b){}this.pa=a}y(Wc,Vc);function Xc(){this.qa=new Tc(new Wc)}Xc.prototype.create=function(a){var b;this.Na=this.Na||0;b=this.Na++ +"|"+parseInt((new Date).getTime(),36);a.set("id",b)};Xc.prototype.Za=function(a){a.set(this.qa.get(a.get("id")))};Xc.prototype.update=function(a){this.qa.set(a.get("id"),a.ra())};function Yc(){Xc.call(this)}y(Yc,Xc);Yc.prototype.Za=function(a){var b=this.qa.get(a.get("id"))||[];B(b,function(b){b=new a.Va(b);a.add(b,0,j)});a.u()};function Zc(a){V.call(this,a);Rb(this,function(a){a=la(a);a.length||g(new Pb);return a});Tb(this,function(){this.k()})}y(Zc,V);function $c(){W.call(this,{id:"todos-plastronjs",sync:new Yc,schema:{completed:{get:function(){return Ub(this,function(a){return a.get("completed")})},wb:j}},modelType:Zc})}y($c,W);$c.prototype.ra=function(){return C(Ub(this),function(a){return a.ra()})};var ad=new $c,Kc=new Ec(ad),$=Kc,bd=M("todoapp");$.i&&g(Error("Component already rendered"));if(bd){$.jb=j;if(!$.I||$.I.B!=L(bd))$.I=mb(bd);$.h=bd;$.C()}else g(Error("Invalid element to decorate"));var cd=new pc;
function dd(a){var b=ob("A",i,M("filters"));B(b,function(b){var d;cb&&"innerText"in b?d=b.innerText.replace(/(\r\n|\r|\n)/g,"\n"):(d=[],xb(b,d,j),d=d.join(""));d=d.replace(/ \xAD /g," ").replace(/\xAD/g,"");d=d.replace(/\u200B/g,"");cb||(d=d.replace(/ +/g," "));" "!=d&&(d=d.replace(/^\s*/,""));d===a?eb(b,"selected"):fb(b,"selected")})}cd.$("/",function(){Jc(Fc);dd("All")});cd.$("/active",function(){Jc(Gc);dd("Active")});cd.$("/completed",function(){Jc(Hc);dd("Completed")});})();
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function q(a){return a!==i}function r(a){return"array"==ba(a)}function s(a){var b=ba(a);return"array"==b||"object"==b&&"number"==typeof a.length}function t(a){return"string"==typeof a}function ca(a){return"number"==typeof a}function u(a){return"function"==ba(a)}function x(a){var b=typeof a;return"object"==b&&a!=k||"function"==b}function y(a){return a[da]||(a[da]=++ea)}
var da="closure_uid_"+Math.floor(2147483648*Math.random()).toString(36),ea=0;function fa(a,b,c){return a.call.apply(a.bind,arguments)}function ga(a,b,c){a||g(Error());if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}
function z(a,b,c){z=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?fa:ga;return z.apply(k,arguments)}var ha=Date.now||function(){return+new Date};function A(a,b){function c(){}c.prototype=b.prototype;a.d=b.prototype;a.prototype=new c;a.prototype.constructor=a};function ia(){}ia.prototype.ob=l;ia.prototype.o=function(){this.ob||(this.ob=j,this.j())};ia.prototype.j=function(){this.Tb&&ja.apply(k,this.Tb)};function ja(a){for(var b=0,c=arguments.length;b<c;++b){var d=arguments[b];s(d)?ja.apply(k,d):d&&"function"==typeof d.o&&d.o()}};function ka(a,b){for(var c=1;c<arguments.length;c++)var d=(""+arguments[c]).replace(/\$/g,"$$$$"),a=a.replace(/\%s/,d);return a}function la(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")}var ma=/^[a-zA-Z0-9\-_.!~*'()]*$/;function na(a){if(!oa.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(pa,"&amp;"));-1!=a.indexOf("<")&&(a=a.replace(qa,"&lt;"));-1!=a.indexOf(">")&&(a=a.replace(ra,"&gt;"));-1!=a.indexOf('"')&&(a=a.replace(sa,"&quot;"));return a}var pa=/&/g,qa=/</g,ra=/>/g,sa=/\"/g,oa=/[&<>\"]/;var B=Array.prototype,C=B.indexOf?function(a,b,c){return B.indexOf.call(a,b,c)}:function(a,b,c){c=c==k?0:0>c?Math.max(0,a.length+c):c;if(t(a))return!t(b)||1!=b.length?-1:a.indexOf(b,c);for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},D=B.forEach?function(a,b,c){B.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=t(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},ta=B.filter?function(a,b,c){return B.filter.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=[],f=0,h=t(a)?a.split(""):
a,m=0;m<d;m++)if(m in h){var p=h[m];b.call(c,p,m,a)&&(e[f++]=p)}return e},E=B.map?function(a,b,c){return B.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=t(a)?a.split(""):a,h=0;h<d;h++)h in f&&(e[h]=b.call(c,f[h],h,a));return e};function ua(a,b,c){var d={};if(a.reduce)return c?a.reduce(z(b,c),d):a.reduce(b,d);var e=d;D(a,function(d,h){e=b.call(c,e,d,h,a)});return e}
var va=B.some?function(a,b,c){return B.some.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=t(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return j;return l};function wa(a,b){var c=xa(a,b);return 0>c?k:t(a)?a.charAt(c):a[c]}function xa(a,b){for(var c=a.length,d=t(a)?a.split(""):a,e=0;e<c;e++)if(e in d&&b.call(i,d[e],e,a))return e;return-1}function ya(a,b){for(var c=t(a)?a.split(""):a,d=a.length-1;0<=d;d--)if(d in c&&b.call(i,c[d],d,a))return d;return-1}
function za(a,b){0<=C(a,b)||a.push(b)}function Aa(a,b,c){Ba(a,c,0,b)}function Ca(a,b){var c=C(a,b);0<=c&&B.splice.call(a,c,1)}function F(a,b){var c=xa(a,b);return 0<=c?(B.splice.call(a,c,1),j):l}function Da(a){return B.concat.apply(B,arguments)}function G(a){if(r(a))return Da(a);for(var b=[],c=0,d=a.length;c<d;c++)b[c]=a[c];return b}
function Ea(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c],e;if(r(d)||(e=s(d))&&d.hasOwnProperty("callee"))a.push.apply(a,d);else if(e)for(var f=a.length,h=d.length,m=0;m<h;m++)a[f+m]=d[m];else a.push(d)}}function Ba(a,b,c,d){B.splice.apply(a,H(arguments,1))}function H(a,b,c){return 2>=arguments.length?B.slice.call(a,b):B.slice.call(a,b,c)}
function Fa(a){for(var b={},c=0,d=0;d<a.length;){var e=a[d++],f=x(e)?"o"+y(e):(typeof e).charAt(0)+e;Object.prototype.hasOwnProperty.call(b,f)||(b[f]=j,a[c++]=e)}a.length=c}function Ga(a,b){if(!s(a)||!s(b)||a.length!=b.length)return l;for(var c=a.length,d=Ha,e=0;e<c;e++)if(!d(a[e],b[e]))return l;return j}function Ha(a,b){return a===b}function Ia(a){for(var b=[],c=0;c<arguments.length;c++){var d=arguments[c];r(d)?b.push.apply(b,Ia.apply(k,d)):b.push(d)}return b};var Ja,Ka,La,Ma;function Na(){return o.navigator?o.navigator.userAgent:k}function Oa(){return o.navigator}Ma=La=Ka=Ja=l;var Pa;if(Pa=Na()){var Qa=Oa();Ja=0==Pa.indexOf("Opera");Ka=!Ja&&-1!=Pa.indexOf("MSIE");(La=!Ja&&-1!=Pa.indexOf("WebKit"))&&Pa.indexOf("Mobile");Ma=!Ja&&!La&&"Gecko"==Qa.product}var Ra=Ja,I=Ka,J=Ma,L=La,Ta,Ua=Oa();Ta=Ua&&Ua.platform||"";Ta.indexOf("Mac");Ta.indexOf("Win");Ta.indexOf("Linux");Oa()&&(Oa().appVersion||"").indexOf("X11");var Va;
a:{var Wa="",Xa;if(Ra&&o.opera)var Ya=o.opera.version,Wa="function"==typeof Ya?Ya():Ya;else if(J?Xa=/rv\:([^\);]+)(\)|;)/:I?Xa=/MSIE\s+([^\);]+)(\)|;)/:L&&(Xa=/WebKit\/(\S+)/),Xa)var Za=Xa.exec(Na()),Wa=Za?Za[1]:"";if(I){var $a,ab=o.document;$a=ab?ab.documentMode:i;if($a>parseFloat(Wa)){Va=""+$a;break a}}Va=Wa}var bb={};
function M(a){var b;if(!(b=bb[a])){b=0;for(var c=la(""+Va).split("."),d=la(""+a).split("."),e=Math.max(c.length,d.length),f=0;0==b&&f<e;f++){var h=c[f]||"",m=d[f]||"",p=RegExp("(\\d*)(\\D*)","g"),v=RegExp("(\\d*)(\\D*)","g");do{var K=p.exec(h)||["","",""],w=v.exec(m)||["","",""];if(0==K[0].length&&0==w[0].length)break;b=((0==K[1].length?0:parseInt(K[1],10))<(0==w[1].length?0:parseInt(w[1],10))?-1:(0==K[1].length?0:parseInt(K[1],10))>(0==w[1].length?0:parseInt(w[1],10))?1:0)||((0==K[2].length)<(0==
w[2].length)?-1:(0==K[2].length)>(0==w[2].length)?1:0)||(K[2]<w[2]?-1:K[2]>w[2]?1:0)}while(0==b)}b=bb[a]=0<=b}return b}var cb={};function db(){return cb[9]||(cb[9]=I&&!!document.documentMode&&9<=document.documentMode)};!I||db();var eb=!I||db();I&&M("8");!L||M("528");J&&M("1.9b")||I&&M("8")||Ra&&M("9.5")||L&&M("528");!J||M("8");function O(a,b){this.type=a;this.currentTarget=this.target=b}A(O,ia);O.prototype.j=function(){delete this.type;delete this.target;delete this.currentTarget};O.prototype.H=l;O.prototype.za=j;O.prototype.stopPropagation=function(){this.H=j};function fb(a){fb[" "](a);return a}fb[" "]=aa;function gb(a,b){a&&this.ta(a,b)}A(gb,O);n=gb.prototype;n.target=k;n.relatedTarget=k;n.offsetX=0;n.offsetY=0;n.clientX=0;n.clientY=0;n.screenX=0;n.screenY=0;n.button=0;n.keyCode=0;n.charCode=0;n.ctrlKey=l;n.altKey=l;n.shiftKey=l;n.metaKey=l;n.Q=k;
n.ta=function(a,b){var c=this.type=a.type;O.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var d=a.relatedTarget;if(d){if(J){var e;a:{try{fb(d.nodeName);e=j;break a}catch(f){}e=l}e||(d=k)}}else"mouseover"==c?d=a.fromElement:"mouseout"==c&&(d=a.toElement);this.relatedTarget=d;this.offsetX=L||a.offsetX!==i?a.offsetX:a.layerX;this.offsetY=L||a.offsetY!==i?a.offsetY:a.layerY;this.clientX=a.clientX!==i?a.clientX:a.pageX;this.clientY=a.clientY!==i?a.clientY:a.pageY;this.screenX=a.screenX||
0;this.screenY=a.screenY||0;this.button=a.button;this.keyCode=a.keyCode||0;this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.state=a.state;this.Q=a;delete this.za;delete this.H};n.stopPropagation=function(){gb.d.stopPropagation.call(this);this.Q.stopPropagation?this.Q.stopPropagation():this.Q.cancelBubble=j};
n.j=function(){gb.d.j.call(this);this.relatedTarget=this.currentTarget=this.target=this.Q=k};function hb(){}var ib=0;n=hb.prototype;n.key=0;n.W=l;n.kb=l;n.ta=function(a,b,c,d,e,f){u(a)?this.sb=j:a&&a.handleEvent&&u(a.handleEvent)?this.sb=l:g(Error("Invalid listener argument"));this.fa=a;this.wb=b;this.src=c;this.type=d;this.capture=!!e;this.ba=f;this.kb=l;this.key=++ib;this.W=l};n.handleEvent=function(a){return this.sb?this.fa.call(this.ba||this.src,a):this.fa.handleEvent.call(this.fa,a)};function P(a,b,c){for(var d in a)b.call(c,a[d],d,a)}function jb(a,b,c){var d={},e;for(e in a)b.call(c,a[e],e,a)&&(d[e]=a[e]);return d}function kb(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b}function lb(a,b){var c;(c=b in a)&&delete a[b];return c}function mb(a,b,c){b in a&&g(Error('The object already contains the key "'+b+'"'));a[b]=c}function nb(a,b,c){a[b]=c}function ob(a){var b={},c;for(c in a)b[c]=a[c];return b}
function pb(a){var b=ba(a);if("object"==b||"array"==b){if(a.Rb)return a.Rb();var b="array"==b?[]:{},c;for(c in a)b[c]=pb(a[c]);return b}return a}var qb="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",");function rb(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<qb.length;f++)c=qb[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var sb={},Q={},R={},tb={};
function S(a,b,c,d,e){if(b){if(r(b)){for(var f=0;f<b.length;f++)S(a,b[f],c,d,e);return k}var d=!!d,h=Q;b in h||(h[b]={u:0,t:0});h=h[b];d in h||(h[d]={u:0,t:0},h.u++);var h=h[d],m=y(a),p;h.t++;if(h[m]){p=h[m];for(f=0;f<p.length;f++)if(h=p[f],h.fa==c&&h.ba==e){if(h.W)break;return p[f].key}}else p=h[m]=[],h.u++;f=ub();f.src=a;h=new hb;h.ta(c,f,a,b,d,e);c=h.key;f.key=c;p.push(h);sb[c]=h;R[m]||(R[m]=[]);R[m].push(h);a.addEventListener?(a==o||!a.nb)&&a.addEventListener(b,f,d):a.attachEvent(b in tb?tb[b]:
tb[b]="on"+b,f);return c}g(Error("Invalid event type"))}function ub(){var a=vb,b=eb?function(c){return a.call(b.src,b.key,c)}:function(c){c=a.call(b.src,b.key,c);if(!c)return c};return b}function wb(a,b,c,d,e){if(r(b))for(var f=0;f<b.length;f++)wb(a,b[f],c,d,e);else{d=!!d;a:{f=Q;if(b in f&&(f=f[b],d in f&&(f=f[d],a=y(a),f[a]))){a=f[a];break a}a=k}if(a)for(f=0;f<a.length;f++)if(a[f].fa==c&&a[f].capture==d&&a[f].ba==e){xb(a[f].key);break}}}
function xb(a){if(!sb[a])return l;var b=sb[a];if(b.W)return l;var c=b.src,d=b.type,e=b.wb,f=b.capture;c.removeEventListener?(c==o||!c.nb)&&c.removeEventListener(d,e,f):c.detachEvent&&c.detachEvent(d in tb?tb[d]:tb[d]="on"+d,e);c=y(c);e=Q[d][f][c];if(R[c]){var h=R[c];Ca(h,b);0==h.length&&delete R[c]}b.W=j;e.tb=j;yb(d,f,c,e);delete sb[a];return j}
function yb(a,b,c,d){if(!d.ua&&d.tb){for(var e=0,f=0;e<d.length;e++)d[e].W?d[e].wb.src=k:(e!=f&&(d[f]=d[e]),f++);d.length=f;d.tb=l;0==f&&(delete Q[a][b][c],Q[a][b].u--,0==Q[a][b].u&&(delete Q[a][b],Q[a].u--),0==Q[a].u&&delete Q[a])}}function zb(a){var b,c=0,d=b==k;b=!!b;if(a==k)P(R,function(a){for(var e=a.length-1;0<=e;e--){var f=a[e];if(d||b==f.capture)xb(f.key),c++}});else if(a=y(a),R[a])for(var a=R[a],e=a.length-1;0<=e;e--){var f=a[e];if(d||b==f.capture)xb(f.key),c++}}
function Ab(a,b,c,d,e){var f=1,b=y(b);if(a[b]){a.t--;a=a[b];a.ua?a.ua++:a.ua=1;try{for(var h=a.length,m=0;m<h;m++){var p=a[m];p&&!p.W&&(f&=Bb(p,e)!==l)}}finally{a.ua--,yb(c,d,b,a)}}return Boolean(f)}function Bb(a,b){var c=a.handleEvent(b);a.kb&&xb(a.key);return c}
function vb(a,b){if(!sb[a])return j;var c=sb[a],d=c.type,e=Q;if(!(d in e))return j;var e=e[d],f,h;if(!eb){var m;if(!(m=b))a:{m=["window","event"];for(var p=o;f=m.shift();)if(p[f]!=k)p=p[f];else{m=k;break a}m=p}f=m;m=j in e;p=l in e;if(m){if(0>f.keyCode||f.returnValue!=i)return j;a:{var v=l;if(0==f.keyCode)try{f.keyCode=-1;break a}catch(K){v=j}if(v||f.returnValue==i)f.returnValue=j}}v=new gb;v.ta(f,this);f=j;try{if(m){for(var w=[],Sa=v.currentTarget;Sa;Sa=Sa.parentNode)w.push(Sa);h=e[j];h.t=h.u;for(var N=
w.length-1;!v.H&&0<=N&&h.t;N--)v.currentTarget=w[N],f&=Ab(h,w[N],d,j,v);if(p){h=e[l];h.t=h.u;for(N=0;!v.H&&N<w.length&&h.t;N++)v.currentTarget=w[N],f&=Ab(h,w[N],d,l,v)}}else f=Bb(c,v)}finally{w&&(w.length=0),v.o()}return f}d=new gb(b,this);try{f=Bb(c,d)}finally{d.o()}return f};function T(){}A(T,ia);n=T.prototype;n.nb=j;n.wa=k;n.cb=function(a){this.wa=a};n.addEventListener=function(a,b,c,d){S(this,a,b,c,d)};n.removeEventListener=function(a,b,c,d){wb(this,a,b,c,d)};
n.dispatchEvent=function(a){var b=a.type||a,c=Q;if(b in c){if(t(a))a=new O(a,this);else if(a instanceof O)a.target=a.target||this;else{var d=a,a=new O(b,this);rb(a,d)}var d=1,e,c=c[b],b=j in c,f;if(b){e=[];for(f=this;f;f=f.wa)e.push(f);f=c[j];f.t=f.u;for(var h=e.length-1;!a.H&&0<=h&&f.t;h--)a.currentTarget=e[h],d&=Ab(f,e[h],a.type,j,a)&&a.za!=l}if(l in c)if(f=c[l],f.t=f.u,b)for(h=0;!a.H&&h<e.length&&f.t;h++)a.currentTarget=e[h],d&=Ab(f,e[h],a.type,l,a)&&a.za!=l;else for(e=this;!a.H&&e&&f.t;e=e.wa)a.currentTarget=
e,d&=Ab(f,e,a.type,l,a)&&a.za!=l;a=Boolean(d)}else a=j;return a};n.j=function(){T.d.j.call(this);zb(this);this.wa=k};function Cb(a,b){this.da=a||1;this.la=b||Db;this.Ka=z(this.kc,this);this.Ra=ha()}A(Cb,T);Cb.prototype.enabled=l;var Db=o.window;n=Cb.prototype;n.l=k;n.setInterval=function(a){this.da=a;this.l&&this.enabled?(this.stop(),this.start()):this.l&&this.stop()};n.kc=function(){if(this.enabled){var a=ha()-this.Ra;0<a&&a<0.8*this.da?this.l=this.la.setTimeout(this.Ka,this.da-a):(this.dispatchEvent(Eb),this.enabled&&(this.l=this.la.setTimeout(this.Ka,this.da),this.Ra=ha()))}};
n.start=function(){this.enabled=j;this.l||(this.l=this.la.setTimeout(this.Ka,this.da),this.Ra=ha())};n.stop=function(){this.enabled=l;this.l&&(this.la.clearTimeout(this.l),this.l=k)};n.j=function(){Cb.d.j.call(this);this.stop();delete this.la};var Eb="tick";var Fb,Gb=!I||db();!J&&!I||I&&db()||J&&M("1.9.1");I&&M("9");function Hb(a){return(a=a.className)&&"function"==typeof a.split?a.split(/\s+/):[]}function Ib(a,b){var c=Hb(a),d=H(arguments,1),e;e=c;for(var f=0,h=0;h<d.length;h++)0<=C(e,d[h])||(e.push(d[h]),f++);e=f==d.length;a.className=c.join(" ");return e}function Jb(a,b){for(var c=Hb(a),d=H(arguments,1),e=c,f=0,h=0;h<e.length;h++)0<=C(d,e[h])&&(Ba(e,h--,1),f++);a.className=c.join(" ")};function Kb(a){return a?new Lb(Mb(a)):Fb||(Fb=new Lb)}function Nb(a){return t(a)?document.getElementById(a):a}function Ob(a,b,c){return Pb(a,b,c)}function Qb(a,b){var c=b||document;return c.querySelectorAll&&c.querySelector&&(!L||"CSS1Compat"==document.compatMode||M("528"))?c.querySelectorAll("."+a):c.getElementsByClassName?c.getElementsByClassName(a):Pb("*",a,b)}
function Pb(a,b,c){c=c||document;a=a&&"*"!=a?a.toUpperCase():"";if(c.querySelectorAll&&c.querySelector&&(!L||"CSS1Compat"==document.compatMode||M("528"))&&(a||b))return c.querySelectorAll(a+(b?"."+b:""));if(b&&c.getElementsByClassName){c=c.getElementsByClassName(b);if(a){for(var d={},e=0,f=0,h;h=c[f];f++)a==h.nodeName&&(d[e++]=h);d.length=e;return d}return c}c=c.getElementsByTagName(a||"*");if(b){d={};for(f=e=0;h=c[f];f++)a=h.className,"function"==typeof a.split&&0<=C(a.split(/\s+/),b)&&(d[e++]=h);
d.length=e;return d}return c}function Rb(a,b){P(b,function(b,d){"style"==d?a.style.cssText=b:"class"==d?a.className=b:"for"==d?a.htmlFor=b:d in Sb?a.setAttribute(Sb[d],b):0==d.lastIndexOf("aria-",0)?a.setAttribute(d,b):a[d]=b})}var Sb={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",height:"height",width:"width",usemap:"useMap",frameborder:"frameBorder",maxlength:"maxLength",type:"type"};
function Tb(a,b,c,d){function e(c){c&&b.appendChild(t(c)?a.createTextNode(c):c)}for(;d<c.length;d++){var f=c[d];s(f)&&!(x(f)&&0<f.nodeType)?D(Ub(f)?G(f):f,e):e(f)}}function Vb(a){var b=document,c=b.createElement("div");I?(c.innerHTML="<br>"+a,c.removeChild(c.firstChild)):c.innerHTML=a;if(1==c.childNodes.length)return c.removeChild(c.firstChild);for(a=b.createDocumentFragment();c.firstChild;)a.appendChild(c.firstChild);return a}function Wb(a,b){Tb(Mb(a),a,arguments,1)}
function Xb(a){for(var b;b=a.firstChild;)a.removeChild(b)}function Yb(a){a&&a.parentNode&&a.parentNode.removeChild(a)}function Zb(a,b){if(a.contains&&1==b.nodeType)return a==b||a.contains(b);if("undefined"!=typeof a.compareDocumentPosition)return a==b||Boolean(a.compareDocumentPosition(b)&16);for(;b&&a!=b;)b=b.parentNode;return b==a}function Mb(a){return 9==a.nodeType?a:a.ownerDocument||a.document}
function Ub(a){if(a&&"number"==typeof a.length){if(x(a))return"function"==typeof a.item||"string"==typeof a.item;if(u(a))return"function"==typeof a.item}return l}function Lb(a){this.P=a||o.document||document}n=Lb.prototype;n.v=function(a){return t(a)?this.P.getElementById(a):a};
n.O=function(a,b,c){var d=this.P,e=arguments,f=e[0],h=e[1];if(!Gb&&h&&(h.name||h.type)){f=["<",f];h.name&&f.push(' name="',na(h.name),'"');if(h.type){f.push(' type="',na(h.type),'"');var m={};rb(m,h);h=m;delete h.type}f.push(">");f=f.join("")}f=d.createElement(f);h&&(t(h)?f.className=h:r(h)?Ib.apply(k,[f].concat(h)):Rb(f,h));2<e.length&&Tb(d,f,e,2);return f};n.createElement=function(a){return this.P.createElement(a)};n.createTextNode=function(a){return this.P.createTextNode(a)};
n.appendChild=function(a,b){a.appendChild(b)};n.contains=Zb;function $b(a){this.Wb=a;this.Qa=[]}A($b,ia);var ac=[];function bc(a,b,c,d,e){r(c)||(ac[0]=c,c=ac);for(var f=0;f<c.length;f++)a.Qa.push(S(b,c[f],d||a,e||l,a.Wb||a));return a}function cc(a){D(a.Qa,xb);a.Qa.length=0}$b.prototype.j=function(){$b.d.j.call(this);cc(this)};$b.prototype.handleEvent=function(){g(Error("EventHandler.handleEvent not implemented"))};function dc(){O.call(this,"navigate")}A(dc,O);function U(a,b,c,d){a&&!b&&g(Error("Can't use invisible history without providing a blank page."));var e;c?e=c:(e="history_state"+ec,document.write(ka(fc,e,e)),e=Nb(e));this.ra=e;this.i=c?Mb(c)?Mb(c).parentWindow||Mb(c).defaultView:window:window;this.Kb=this.i.location.href.split("#")[0];this.sa=b;I&&!b&&(this.sa="https"==window.location.protocol?"https:///":'javascript:""');this.l=new Cb(gc);this.Y=!a;this.J=new $b(this);if(a||I&&!hc)d?a=d:(a="history_iframe"+ec,b=this.sa?'src="'+na(this.sa)+'"':
"",document.write(ka(ic,a,b)),a=Nb(a)),this.T=a,this.Fb=j;I&&!hc&&(bc(this.J,this.i,"load",this.dc),this.Cb=this.Pa=l);this.Y?jc(this,this.z(),j):kc(this,this.ra.value);ec++}A(U,T);U.prototype.B=l;U.prototype.U=l;U.prototype.ea=k;var hc=I&&8<=document.documentMode||J&&M("1.9.2")||L&&M("532.1");n=U.prototype;n.ga=k;n.j=function(){U.d.j.call(this);this.J.o();this.X(l)};
n.X=function(a){if(a!=this.B)if(I&&!hc&&!this.Pa)this.Cb=a;else if(a)if(Ra?bc(this.J,this.i.document,lc,this.gc):J&&bc(this.J,this.i,"pageshow",this.fc),hc&&this.Y)bc(this.J,this.i,"hashchange",this.ec),this.B=j,this.dispatchEvent(new dc(this.z()));else{if(!I||this.Pa)bc(this.J,this.l,Eb,z(this.Pb,this,j)),this.B=j,I||(this.ea=this.z()),this.l.start(),this.dispatchEvent(new dc(this.z()))}else this.B=l,cc(this.J),this.l.stop()};n.dc=function(){this.Pa=j;this.ra.value&&kc(this,this.ra.value,j);this.X(this.Cb)};
n.fc=function(a){a.Q.persisted&&(this.X(l),this.X(j))};n.ec=function(){var a=mc(this.i);a!=this.ea&&nc(this,a)};n.z=function(){return this.ga!=k?this.ga:this.Y?mc(this.i):oc(this)||""};function mc(a){var a=a.location.href,b=a.indexOf("#");return 0>b?"":a.substring(b+1)}function jc(a,b,c){var d=a.i.location,a=a.Kb,e=-1!=d.href.indexOf("#");if(I||e||b)a+="#"+b;a!=d.href&&(c?d.replace(a):d.href=a)}
function kc(a,b,c){if(a.Fb||b!=oc(a))if(a.Fb=l,b=""+b,b=!ma.test(b)?encodeURIComponent(b):b,I){var d=a.T.contentDocument||a.T.contentWindow.document;d.open("text/html",c?"replace":i);d.write(ka(pc,na(a.i.document.title),b));d.close()}else if(b=a.sa+"#"+b,a=a.T.contentWindow)c?a.location.replace(b):a.location.href=b}
function oc(a){if(I)return a=a.T.contentDocument||a.T.contentWindow.document,a.body?decodeURIComponent(a.body.innerHTML.replace(/\+/g," ")):k;var b=a.T.contentWindow;if(b){var c;try{var d=mc(b);c=decodeURIComponent(d.replace(/\+/g," "))}catch(e){return a.U||(a.U!=j&&a.l.setInterval(qc),a.U=j),k}a.U&&(a.U!=l&&a.l.setInterval(gc),a.U=l);return c||k}return k}
n.Pb=function(){if(this.Y){var a=mc(this.i);a!=this.ea&&nc(this,a)}if(!this.Y||I&&!hc)if(a=oc(this)||"",this.ga==k||a==this.ga)this.ga=k,a!=this.ea&&nc(this,a)};function nc(a,b){a.ea=a.ra.value=b;a.Y?(I&&!hc&&kc(a,b),jc(a,b)):kc(a,b);a.dispatchEvent(new dc(a.z()))}n.gc=function(){this.l.stop();this.l.start()};
var lc=["mousedown","keydown","mousemove"],pc="<title>%s</title><body>%s</body>",ic='<iframe id="%s" style="display:none" %s></iframe>',fc='<input type="text" name="%s" id="%s" style="display:none">',ec=0,gc=150,qc=1E4;function rc(a,b){this.i=a||window;this.Db=b||k;S(this.i,"popstate",this.V,l,this);S(this.i,"hashchange",this.V,l,this)}A(rc,T);n=rc.prototype;n.B=l;n.Da=j;n.vb="/";n.X=function(a){a!=this.B&&(this.B=a)&&this.dispatchEvent(new dc(this.z()))};n.z=function(){if(this.Da){var a=this.i.location.href,b=a.indexOf("#");return 0>b?"":a.substring(b+1)}return this.Db?this.Db.qc(this.vb,this.i.location):this.i.location.pathname.substr(this.vb.length)};
n.j=function(){wb(this.i,"popstate",this.V,l,this);this.Da&&wb(this.i,"hashchange",this.V,l,this)};n.Bb=function(a){this.Da!=a&&(a?S(this.i,"hashchange",this.V,l,this):wb(this.i,"hashchange",this.V,l,this),this.Da=a)};n.V=function(){this.B&&this.dispatchEvent(new dc(this.z()))};function sc(a,b,c,d){var e=window;this.ca=e.history&&e.history.pushState?new rc:new U(!(!b||!a),b,c,d);this.ca.Bb&&this.ca.Bb(!a);S(this.ca,"navigate",this.cc,l,this);this.yb=[];this.qa="";this.ca.X(j)}A(sc,T);
sc.prototype.ja=function(a,b,c){t(a)&&(a=RegExp("^"+(""+a).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08").replace(/\\:\w+/g,"(\\w+)").replace(/\\\*/g,"(.*)").replace(/\\\[/g,"(").replace(/\\\]/g,")?").replace(/\\\{/g,"(?:").replace(/\\\}/g,")?")+"$"));a={ja:a,Ob:b,Sb:c};tc(a,this.qa);this.yb.push(a)};function tc(a,b){var c=a.ja.exec(b);c&&a.Ob.apply(a.Sb,c)}
sc.prototype.cc=function(){var a=this.ca.z();a!=this.qa&&(this.dispatchEvent({type:"routeExpired",pc:this.qa,nc:a}),this.qa=a,D(this.yb||[],function(b){tc(b,a)},this))};function uc(){}(function(a){a.pb=function(){return a.Zb||(a.Zb=new a)}})(uc);uc.prototype.ac=0;uc.pb();function vc(a){this.aa=a||Kb()}A(vc,T);n=vc.prototype;n.Xb=uc.pb();n.S=k;n.g=l;n.f=k;n.c=k;n.s=k;n.b=k;n.m=k;n.Gb=l;function wc(a){return a.S||(a.S=":"+(a.Xb.ac++).toString(36))}n.v=function(){return this.f};n.ab=function(a){this.f=a};function xc(a,b){a==b&&g(Error("Unable to set parent component"));b&&a.s&&a.S&&a.s.m&&a.S&&a.S in a.s.m&&a.s.m[a.S]&&a.s!=b&&g(Error("Unable to set parent component"));a.s=b;vc.d.cb.call(a,b)}n.getParent=function(){return this.s};
n.cb=function(a){this.s&&this.s!=a&&g(Error("Method not supported"));vc.d.cb.call(this,a)};n.O=function(){this.f=this.aa.createElement("div")};function yc(a,b,c){a.g&&g(Error("Component already rendered"));a.f||a.O();b?b.insertBefore(a.f,c||k):a.aa.P.body.appendChild(a.f);(!a.s||a.s.g)&&a.C()}n.C=function(){this.g=j;zc(this,function(a){!a.g&&a.v()&&a.C()})};function Ac(a){zc(a,function(a){a.g&&Ac(a)});a.R&&cc(a.R);a.g=l}
n.j=function(){vc.d.j.call(this);this.g&&Ac(this);this.R&&(this.R.o(),delete this.R);zc(this,function(a){a.o()});!this.Gb&&this.f&&Yb(this.f);this.s=this.c=this.f=this.m=this.b=k};n.bb=function(a){this.c=a};
n.Z=function(a,b,c){a.g&&(c||!this.g)&&g(Error("Component already rendered"));(0>b||b>(this.b?this.b.length:0))&&g(Error("Child component index out of bounds"));if(!this.m||!this.b)this.m={},this.b=[];a.getParent()==this?(this.m[wc(a)]=a,Ca(this.b,a)):mb(this.m,wc(a),a);xc(a,this);Aa(this.b,a,b);a.g&&this.g&&a.getParent()==this?(c=this.D(),c.insertBefore(a.v(),c.childNodes[b]||k)):c?(this.f||this.O(),b=this.b?this.b[b+1]||k:k,yc(a,this.D(),b?b.f:k)):this.g&&!a.g&&a.f&&a.C()};n.D=function(){return this.f};
function zc(a,b){a.b&&D(a.b,b,i)}n.removeChild=function(a,b){if(a){var c=t(a)?a:wc(a),a=this.m&&c?(c in this.m?this.m[c]:i)||k:k;c&&a&&(lb(this.m,c),Ca(this.b,a),b&&(Ac(a),a.f&&Yb(a.f)),xc(a,k))}a||g(Error("Child is not in parent component"));return a};function V(a){V.d.constructor.apply(this,H(arguments,1));this.r={Sa:{},F:{}};this.ia=[];this.na=[];this.bb(a);this.xa=this.pa=k}A(V,vc);n=V.prototype;n.ab=function(a){V.d.ab.call(this,a);this.pa||(this.pa=a)};n.D=function(){return this.pa||V.d.D.call(this)};
n.bb=function(a,b){this.c&&D(E(this.ia,function(a){return a.id}),this.Eb,this);V.d.bb.call(this,a);D(this.ia,function(a){var d=a.K.apply(this,a.Hb);a.bound=d;a.k=d.k;a.a=z(this.a,this,d.id);a.id=d.id;!b&&!(0<=C([this.gb,this.ib,this.jb],a.K))&&a.k()},this)};n.remove=function(){Yb(this.v());this.o()};
n.Ub=function(a,b){this.r.F[a]&&D(this.r.F[a],function(a){if(!b.H&&(!a.zb.length||va(a.zb,function(a){if(u(a))return a(b);if(a=wa(W(this,a),function(a){return Zb(a,b.target)}))b.target=a;return a},this)))a.K.call(a.ba,b),a.stop&&b.stopPropagation()},this)};
function Bc(a,b,c,d,e,f,h){var m=["blur","focus"];a.r||(a.r={Sa:{},F:{}});a.r.F[b]||(a.r.F[b]=[]);a.r.Sa[b]||(a.r.Sa[b]=bc(a.R||(a.R=new $b(a)),a.v(),b,z(a.Ub,a,b),0<=C(m,b)));q(d)||(d=[]);d={zb:r(d)?d:[d],K:c,Ca:k,ba:e||a,hc:f||50,stop:h};d.Ca=y(d);Aa(a.r.F[b],d,ya(a.r.F[b],function(a){return a.hc<=(f||50)})+1);var p={k:z(function(a){var d=this.v();a&&(d=a);c.call(e||this,new O(b,d));return p},a),id:d.Ca,Wa:z(a.Wa,a,d.Ca)};return p}n.click=function(a,b,c,d,e){return Bc(this,"click",a,b,c,d,e)};
n.Wa=function(a){x(a)&&a.id&&(a=a.id);P(this.r.F,function(b){F(b,function(b){return b.Ca==a})})};function W(a,b){var c;c=c||a.v();if(!b)return[c];if(r(b))return c=Ia(E(b,function(a){return W(this,a)},a)),Fa(c),c;"-"==b.charAt(0)&&(b="."+b.substring(1));return"."==b.charAt(0)?Qb(b.substring(1),c)||[]:"#"==b.charAt(0)?[Nb(b.substring(1))]:G(Ob(la(b.replace(/\..*/,"")),0<b.indexOf(".")?b.replace(/.*\./,""):k,c))}function Cc(a){var b=Dc,c=Nb("todo-list");c&&(a.pa=c);return a.Ta(z(a.Jb,a,b,i)).k()}
n.Jb=function(a,b){var c=this.c.w(),d=this.b||[],e=E(d,function(a){return a.c}),f=ta(d,function(a){return!(0<=C(c,a.c))});0==d.length?D(c,function(b){this.Z(new a(b),this.b?this.b.length:0,j)},this):(D(f,function(a){this.removeChild(a,j);a.o()},this),D(c,function(b,c){if(0<=C(e,b))f=wa(d,function(a){return a.c==b}),(this.b?this.b[c]||k:k)!=f&&this.Z(f,c);else{var f=new a(b);f.O();this.Z(f,c,j)}},this));b&&b.call(this,this.D())};
n.Ib=function(a,b){var c=H(arguments,2)[0];if(a.M){var d={};a.data&&P(a.data,function(a,b){d[b]=u(a)?a(this):b},this);d.n=this.c.get(a.e);var e=a.M(d);D(W(this,b),function(a){"INPUT"==a.tagName&&"checkbox"!=a.getAttribute("type")?a.value!=e&&(a.value=e):"SELECT"==a.tagName?D(a.options,function(a){a.selected=a.value==e}):(Xb(a),Wb(a,Vb(e)))},this)}D(W(this,b),function(b){"INPUT"==b.tagName&&"checkbox"==b.getAttribute("type")&&(b.checked=this.c.get(a.e[0]))},this);if(q(a.Xa)){var f=a.Xa;D(W(this,b),
function(b){var d=f;c?Ib(b,d):Jb(b,d);a.bc&&(d=a.bc,!c?Ib(b,d):Jb(b,d))})}a.I&&(r(a.I)?D(W(this,b),function(b){D(a.I,function(d){d==a.Ma(c)?Ib(b,d):Jb(b,d)},this)},this):D(W(this,b),function(b){P(a.I,function(d,e){e==a.Ma(c)?Ib(b,d):Jb(b,d)},this)},this));a.show&&D(W(this,b),function(b){var d=a.show(c);b.style.display=d?"":"none"});if(a.A){var h={};h[a.A]=this.c.get(a.e[0]);D(W(this,b),function(b){q(h[a.A])?Rb(b,h):b.removeAttribute(a.A)})}a.jc&&a.jc.apply(this,E(a.e,function(){return this.c.get("key")},
this))};
function X(a,b,c){t(c)&&(c={M:c});if(t(c.M)){var d=c.M,e=d.match(/\{\$([^}]*)\}/g)||[],e=E(e,function(a){return a.substring(2,a.length-1)});c.M=function(a){var b=d;P(a.n,function(a,c){b=b.replace(RegExp("\\{\\$"+c+"\\}","g"),a)});return b};c.e=c.e||[];Ea(c.e,e);Fa(c.e)}c.I&&(c.Ma||(c.Ma=function(a){return a}),t(c.I)&&(c.I=[c.I]));c.show&&(c.e||(c.e=[]),t(c.show)&&Aa(c.e,c.show,0),u(c.show)||(c.show=function(a){return a}));r(c.e)||(c.e=[c.e]);var f=[];q(c.oc)||f.push(Bc(a,"blur",function(a){"INPUT"==a.target.tagName&&
"text"==a.target.getAttribute("type")?this.c.set(c.e[0],a.target.value):"SELECT"==a.target.tagName&&this.c.set(c.e[0],a.target.options[a.target.selectedIndex].value)},b));q(c.ub)||f.push(a.click(function(a){c.Xa?(this.c.set(c.e[0],!(0<=C(Hb(a.target),c.Xa))),a.stopPropagation()):"INPUT"==a.target.tagName&&"checkbox"==a.target.getAttribute("type")&&(this.c.set(c.e[0],a.target.checked),a.stopPropagation())},b,a,30));e=a.bind(c.e,function(){this.Ib.apply(this,Da([c,b],G(arguments)))}).k();e={id:y(f),
Nb:f,bound:e,k:e.k,a:z(function(){this.a(y(f))},a)};a.na.push(e)}n.bind=function(a,b,c){return Y(this,this.Mb,H(arguments,0))};n.Mb=function(a,b,c){return this.c.bind(a,b,c||this)};n.Ha=function(a,b){return Y(this,this.Lb,H(arguments,0))};n.Lb=function(a,b){return this.c.Ha(a,b||this)};n.fb=function(a,b){return Y(this,this.gb,H(arguments,0))};n.gb=function(a,b){return this.c.fb(a,b||this)};n.hb=function(a,b){return Y(this,this.ib,H(arguments,0))};n.ib=function(a,b){return this.c.hb(a,b||this)};
n.Ia=function(a,b){return Y(this,this.jb,H(arguments,0))};n.jb=function(a,b){return this.c.Ia(a,b||this)};function Y(a,b,c){var d=b.apply(a,c||[]),b={id:d.id,bound:d,k:d.k,a:z(a.a,a,d.id),K:b,Hb:c||[]};a.ia.push(b);return b}n.ma=function(a,b){return Y(this,this.N,H(arguments,0))};n.N=function(a,b){return this.c.ma(a,b||this)};n.Ta=function(a,b){return Y(this,this.G,H(arguments,0))};n.G=function(a,b){return this.c.Ta(a,b||this)};
n.a=function(a){F(this.ia,function(b){x(b)&&(b=b.id);return b==(a.id||a)});var b=wa(this.na,function(b){return b.id==(a.id||a)});b&&(D(b.Nb,function(a){this.Wa(a)},this),a=b.bound);Ca(this.na,b);return this.Eb(a)};n.Eb=function(a){return this.c.a(a)};n.j=function(){D(G(this.ia),function(a){a.a()},this);D(G(this.na),function(a){a.a()});V.d.j.call(this);this.r=k};
n.Z=function(a,b,c){if(I&&!M(9))V.d.Z.call(this,a,b,c);else{a.g&&(c||!this.g)&&g(Error("Component already rendered"));(0>b||b>(this.b?this.b.length:0))&&g(Error("Child component index out of bounds"));if(!this.m||!this.b)this.m={},this.b=[];a.getParent()==this?(nb(this.m,wc(a),a),Ca(this.b,a)):mb(this.m,wc(a),a);xc(a,this);Aa(this.b,a,b);if(c&&(!a.Yb||!this.Yb||a.getParent!=this)){this.f||this.O();var d=this.b?this.b[b+1]||k:k;yc(a,this.D(),d?d.f:k)}if(a.g&&this.g&&a.getParent()==this){var e=this.D();
this.xa?D(this.b,function(a,b){this.xa(e,a,b)},this):e.insertBefore(a.v(),e.childNodes[b]||k)}else!c&&this.g&&!a.g&&a.f&&a.f.parentNode&&a.C()}};n.removeChild=function(a,b){var c=V.d.removeChild.call(this,a,b);this.xa&&D(this.b,function(a,b){this.xa(this.D(),a,b)},this);return c};I&&M(8);function Ec(){var a=Fc,b=(new Lb(k)||Kb()).createElement("DIV");b.innerHTML=a(Gc,i,i);return 1==b.childNodes.length&&(a=b.firstChild,1==a.nodeType)?a:b}var Gc={};"ScriptEngine"in o&&"JScript"==o.ScriptEngine()&&(o.ScriptEngineMajorVersion(),o.ScriptEngineMinorVersion(),o.ScriptEngineBuildVersion());var Hc={"\x00":"&#0;",'"':"&quot;","&":"&amp;","'":"&#39;","<":"&lt;",">":"&gt;","\t":"&#9;","\n":"&#10;","\x0B":"&#11;","\u000c":"&#12;","\r":"&#13;"," ":"&#32;","-":"&#45;","/":"&#47;","=":"&#61;","`":"&#96;","\u0085":"&#133;","\u00a0":"&#160;","\u2028":"&#8232;","\u2029":"&#8233;"};function Ic(a){return Hc[a]}var Jc=/[\x00\x22\x26\x27\x3c\x3e]/g;function Fc(){return'<li><div class="view"><input class="toggle" type="checkbox"><label></label><button class="destroy"></button></div><input class="edit" type="text"></li>'}function Kc(a){return"<strong>"+("object"===typeof a.n.active&&a.n.active&&0===a.n.active.mc?a.n.active.content:(""+a.n.active).replace(Jc,Ic))+"</strong> item"+(1!=a.n.active?"s":"")+" left"};function Dc(a){V.call(this,a)}A(Dc,V);Dc.prototype.O=function(){this.ab(Ec())};Dc.prototype.C=function(){var a=this.c;X(this,".toggle","{$completed}");this.click(function(){a.o()},".destroy");X(this,"label","{$title}");var b=W(this,".edit")[0];Bc(this,"dblclick",function(){Ib(this.v(),"editing");b.focus()},".view");Bc(this,"keyup",function(a){13===a.keyCode&&a.target.blur()});Bc(this,"blur",function(){Jb(this.v(),"editing")});X(this,".edit","{$title}")};function Lc(a){V.call(this,a)}A(Lc,V);
Lc.prototype.C=function(){Lc.d.C.call(this);var a=this.c;Bc(this,"keyup",this.Vb,".todo-entry");X(this,"#clear-completed",{M:"Clear completed ({$completed})",ub:j,show:j});this.click(function(){D(a.w("completed"),function(a){a.o()})},".clear-completed");X(this,".toggle-all",{e:"allDone"});X(this,"ul",{e:"filter",I:["active","completed","none"]});X(this,"#todo-count",{M:Kc,e:"active"});X(this,["#main","footer"],{show:"total",ub:j});var b=Cc(this).k;this.bind("filter",b);this.ma(b)};
Lc.prototype.Vb=function(a){var b=a.target;if(13===a.keyCode){var c=la(b.value);c&&(a=this.c,c=new a.Va({title:c}),a.add(c,i,i),b.value="")}};function Mc(a){a=""+a;if(/^\s*$/.test(a)?0:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r\u2028\u2029\x00-\x08\x10-\x1f\x80-\x9f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,"")))try{return eval("("+a+")")}catch(b){}g(Error("Invalid JSON string: "+a))}function Nc(){this.ya=i}function Oc(a,b){var c=[];Pc(a,b,c);return c.join("")}
function Pc(a,b,c){switch(typeof b){case "string":Qc(b,c);break;case "number":c.push(isFinite(b)&&!isNaN(b)?b:"null");break;case "boolean":c.push(b);break;case "undefined":c.push("null");break;case "object":if(b==k){c.push("null");break}if(r(b)){var d=b.length;c.push("[");for(var e="",f=0;f<d;f++)c.push(e),e=b[f],Pc(a,a.ya?a.ya.call(b,""+f,e):e,c),e=",";c.push("]");break}c.push("{");d="";for(f in b)Object.prototype.hasOwnProperty.call(b,f)&&(e=b[f],"function"!=typeof e&&(c.push(d),Qc(f,c),c.push(":"),
Pc(a,a.ya?a.ya.call(b,f,e):e,c),d=","));c.push("}");break;case "function":break;default:g(Error("Unknown type: "+typeof b))}}var Rc={'"':'\\"',"\\":"\\\\","/":"\\/","\u0008":"\\b","\u000c":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},Sc=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g;
function Qc(a,b){b.push('"',a.replace(Sc,function(a){if(a in Rc)return Rc[a];var b=a.charCodeAt(0),e="\\u";16>b?e+="000":256>b?e+="00":4096>b&&(e+="0");return Rc[a]=e+b.toString(16)}),'"')};function Z(a){var b={schema:{},sync:k,attr:{}};a||(a={});a.attr=a.attr||{};P(a,function(c,d){q(b[d])||(a.attr[d]=c)});P(b,function(c,d){b[d]=a[d]||b[d]});this.q={};this.L={};this.h=b.schema||{};this.ka=b.sync;this.oa=[];this.Ja={};this.Ya=[];this.qb=aa;S(this,"change",this.La,l,this);this.Qb=""+y(this);this.set(b.attr);this.dispatchEvent("load")}A(Z,T);
function Tc(a,b){var c=b;if(t(b)){var d={number:ca,string:t,array:s};return function(a){d[b.toLowerCase()](a)||g(new Uc);return a}}if(c.exec)return z(function(a,b){a.exec(b)===k&&g(new Uc);return b},a,b);u(c)&&kb(c.prototype).length&&(c=function(a){x(a)||g(new Uc);var c=Object.getPrototypeOf(a).constructor;if(Object.getPrototypeOf(a).constructor==b)return a;for(;c.d;)if(c=c.d.constructor,c==b)return a;g(new Uc)});return c}n=Z.prototype;
n.eb=function(){var a=ob(this.q);D(kb(a),function(b){q(a[b])||delete a[b]});return a};n.get=function(a,b){if(r(a))return ua(a,function(a,c){a[c]=this.get(c,b);return a},this);if(this.h[a]&&this.h[a].get){var c=this.h[a].get.apply(this,E(this.h[a].ic||[],function(c){if(c===a)return this.q[a];c=this.get(c);return q(c)?c:b},this));return q(c)?c:b}return q(this.q[a])?this.q[a]:b};
n.set=function(a,b,c){var d=l;if(t(a)){var e={};e[a]=b;a=e}else c=b;P(a,function(a,b){if(q(a))try{this.q[b]=this.h[b]&&this.h[b].set?Tc(this,this.h[b].set).call(this,a,c):a;var e=this.h[b];if(q(e)&&u(e.Oa)){var p=e.Oa;u(p)&&!p(this.get(b),Vc(this,b))&&(d=j)}else this.get(b)!==Vc(this,b)&&(d=j)}catch(v){v.$b?this.qb(v):g(v)}else this.q[b]=a,this.L[b]!=this.q[b]&&(d=j)},this);return d?(c||(this.dispatchEvent("change"),this.L=pb(this.q),this.q=jb(this.q,function(a){return q(a)})),j):l};
n.$=function(){this.dispatchEvent("change");this.L=pb(this.q)};function Vc(a,b){return a.h[b]&&a.h[b].get?a.h[b].get.apply(a,E(a.h[b].ic||[],function(a){return a===b?this.L[b]:Vc(this,a)},a)):a.L[b]}function Wc(a,b){a.h.title=a.h.title||{};a.h.title.set=z(b,a)}
function Xc(a){var b=kb(jb(a.h,function(a,b){var e=this.h[b];if(e.Oa)return!e.Oa(Vc(this,b),this.get(b));e=Vc(this,b);return r(e)?!Ga(e,this.get(b)):Vc(this,b)!=this.get(b)},a));Ea(b,kb(jb(a.q,function(a,b){return q(this.h[b])?l:r(a)?!Ga(a,this.L[b]):a!==this.L[b]},a)));return b}n.o=function(a,b){a&&Yc(this.ka,this,b);this.dispatchEvent("unload");D(G(this.Ya),function(a){a(this)},this);this.j()};function Zc(a,b){a.qb=b}
n.save=function(a){this.ka&&(!q(this.get("id"))?this.ka.create(this,a):this.ka.update(this,a))};n.La=function(){var a=Xc(this);D(this.oa,function(b){va(b.A,function(b){return 0<=C(a,b)})&&b.K.apply(b.rb,Da(E(b.A,function(a){return this.get(a)},this)))},this);a.length&&P(this.Ja,function(a){a(this)},this)};n.Ia=function(a,b){var a=z(a,b||this),c=y(a);this.Ya.push(a);var d={k:function(){a();return d},id:c,a:z(this.a,this,c)};return d};
n.bind=function(a,b,c){t(a)&&(a=[a]);var d={A:a,K:b,rb:c||this};d.Na=y(d);this.oa.push(d);var e={k:z(function(){var d=E(a,function(a){return this.get(a)},this);d.push(this);b.apply(c||this,d);return e},this),id:d.Na,a:z(this.a,this,d.Na)};return e};n.a=function(a){x(a)&&a.id&&(a=a.id);return F(this.oa,function(b){return b.Na==a})||lb(this.Ja,a)||F(this.Ya,function(b){return y(b)==a})};
n.Ha=function(a,b){var c=z(a,b||this),d=y(c);this.Ja[""+d]=c;var a=z(a,b||this,this),e={k:function(){a();return e},id:d,a:z(this.a,this,d)};return e};function Uc(){this.$b=j}A(Uc,Error);function $c(a){var a=a||{},b={comparator:a.comparator||k,modelType:a.modelType||Z,models:a.models||[]};lb(a,"comparator");lb(a,"modelType");lb(a,"models");this.p=[];this.lb=b.comparator;this.Ua=[];this.Ga=[];this.Fa=[];this.Ea=[];this.$a=[];this.Za=[];this.G=l;this.Va=b.modelType;Z.call(this,a);D(b.models,function(a){this.add(a,i,j)},this)}A($c,Z);n=$c.prototype;
n.sort=function(a){var b=l;if(this.lb){var c=this.lb;this.p.sort(function(a,e){var f=c(a.n,e.n);0<f&&(b=j);return f});this.G=this.G||b}a||this.dispatchEvent("change")};
n.add=function(a,b,c){ca(b)&&0>b&&(b=this.p.length+b);var d=0,e=l;r(a)||(a=[a]);D(a,function(c){c instanceof Z||(c=new this.Va(c));if(!wa(this.p,function(a){return a.n==c})){this.N=this.G=e=j;var h=c.Ha(z(function(){this.N=j;this.sort()},this)),m=c.Ia(function(){this.remove(a)},this);Aa(this.p,{n:c,lc:m,$:h},ca(b)?b+d:this.p.length);d+=1;za(this.Fa,c)}},this);this.length=this.p.length;this.sort(j);e&&!c&&this.$();return e};
n.remove=function(a,b){r(a)||(a=[a]);var c=l;D(a,function(a){var b=wa(this.p,function(b){return b.n==a});b&&(this.N=this.G=j,a.a(b.lc),a.a(b.$),Ca(this.p,b),c=j,za(this.$a,{n:a,id:a.get("id")||a.Qb}))},this);this.length=this.p.length;c&&this.sort(j);c&&!b&&this.$();return c};n.w=function(a){if(t(a))var b=a,a=function(a){return a.get(b)};var c=E(this.p,function(a){return a.n});return a?ta(c,a):c};n.indexOf=function(a){return C(this.w(),a)};
n.Ta=function(a,b){var c=z(a,b||this);this.Ua.push(c);var c=y(c),a=z(a,b||this,this),d={k:function(){a();return d},id:c,a:z(this.a,this,c)};return d};n.ma=function(a,b){var c=z(a,b||this);this.Ga.push(c);var c=y(c),a=z(a,b||this,this),d={k:function(){a();return d},id:c,a:z(this.a,this,c)};return d};n.fb=function(a,b){var c=z(a,b||this);this.Ea.push(c);var c=y(c),a=z(a,b||this,this),d={k:function(){a();return d},id:c,a:z(this.a,this,c)};return d};
n.hb=function(a,b){var c=z(a,b||this);this.Za.push(c);var c=y(c),a=z(a,b||this,this),d={k:function(){a();return d},id:c,a:z(this.a,this,c)};return d};n.a=function(a){x(a)&&a.id&&(a=a.id);return F(this.Ua,function(b){return y(b)==a})||F(this.Ga,function(b){return y(b)==a})||F(this.Za,function(b){return y(b)==a})||F(this.Ea,function(b){return y(b)==a})||$c.d.a.call(this,a)};
n.La=function(){$c.d.La.call(this);this.G&&(D(G(this.Ua),function(a){a(this)},this),this.G=l);this.N&&(D(G(this.Ga),function(a){a(this)},this),this.h&&P(this.h,function(a,b){a.va&&D(this.oa,function(a){0<=C(a.A,b)&&a.K.apply(a.rb,Da(E(a.A,function(a){return this.get(a)},this)))},this)},this),this.N=l);D(this.Za,function(a){D(this.$a,function(b){a(b.n,b.id)})},this);this.$a=[];D(this.Ea,function(a){D(this.Fa,function(b){a(b)})},this);this.Fa=[]};function ad(){};function bd(a){this.ha=a;this.Ab=new Nc}n=bd.prototype;n.ha=k;n.Ab=k;n.set=function(a,b){q(b)?this.ha.set(a,Oc(this.Ab,b)):this.ha.remove(a)};n.get=function(a){a=this.ha.get(a);if(a!==k)try{return Mc(a)}catch(b){g("Storage: Invalid value was encountered")}};n.remove=function(a){this.ha.remove(a)};function cd(){}A(cd,ad);function dd(a){this.Aa=a}A(dd,cd);dd.prototype.set=function(a,b){try{this.Aa.setItem(a,b)}catch(c){g("Storage mechanism: Quota exceeded")}};dd.prototype.get=function(a){a=this.Aa.getItem(a);if(t(a)||a===k)return a;g("Storage mechanism: Invalid value was encountered")};dd.prototype.remove=function(a){this.Aa.removeItem(a)};function ed(){var a=k;try{a=window.localStorage||k}catch(b){}this.Aa=a}A(ed,dd);function fd(){this.Ba=new bd(new ed)}fd.prototype.create=function(a,b){var c;this.mb=this.mb||0;c=this.mb++ +"|"+parseInt((new Date).getTime(),36);a.set("id",c);u(b)&&b.call(a,a)};fd.prototype.xb=function(a,b){a.set(this.Ba.get(a.get("id")));u(b)&&b.call(a,a)};fd.prototype.update=function(a,b){this.Ba.set(a.get("id"),a.eb());u(b)&&b.call(a,a)};function Yc(a,b,c){a.Ba.remove(b.get("id"));u(c)&&c.call(b,b)};function gd(){fd.call(this)}A(gd,fd);gd.prototype.xb=function(a){var b=this.Ba.get(a.get("id"))||[];D(b,function(b){b=new a.Va(b);a.add(b,i,j)});a.$()};function hd(a){Z.call(this,a);Wc(this,function(a){a=la(a);a.length||g(new Uc);return a});Zc(this,function(){this.o()})}A(hd,Z);function id(){$c.call(this,{id:"todos-plastronjs",sync:new gd,schema:{completed:{get:function(){return this.w("completed").length},va:j},allDone:{get:function(){return this.p.length==this.w("completed").length},set:function(a){D(this.w("none"),function(b){b.set("completed",a)})},va:j},active:{get:function(){return this.p.length-this.w("completed").length},va:j},total:{get:function(){return this.p.length},va:j}},modelType:hd});this.ka.xb(this,i);this.ma(this.save)}A(id,$c);
var jd={none:function(){return j},active:function(a){return!a.get("completed")},completed:function(a){return a.get("completed")}};id.prototype.w=function(a){return id.d.w.call(this,jd[a||this.get("filter")])};id.prototype.eb=function(){return E(this.w("none"),function(a){return a.eb()})};var kd=new id,$=new Lc(kd),ld=Nb("todoapp");$.g&&g(Error("Component already rendered"));if(ld){$.Gb=j;if(!$.aa||$.aa.P!=Mb(ld))$.aa=Kb(ld);$.f=ld;$.C()}else g(Error("Invalid element to decorate"));var md=new sc;md.ja("{/}",function(){kd.set("filter","none")});md.ja("/active",function(){kd.set("filter","active")});md.ja("/completed",function(){kd.set("filter","completed")});})();
\ No newline at end of file
goog.provide('todomvc.listcontrol');
goog.require('goog.dom');
goog.require('goog.events.KeyCodes');
goog.require('goog.string');
goog.require('mvc.Control');
......@@ -17,27 +16,10 @@ goog.require('todomvc.todocontrol');
*/
todomvc.listcontrol = function( list ) {
goog.base( this, list );
this.filter_ = todomvc.listcontrol.Filter.ALL;
};
goog.inherits( todomvc.listcontrol, mvc.Control );
/**
* @enum {Function}
*/
todomvc.listcontrol.Filter = {
ALL: function() {
return true
},
ACTIVE: function( model ) {
return !model.get('completed')
},
COMPLETED: function( model ) {
return model.get('completed')
}
};
/**
* setup for event listeners.
*
......@@ -48,126 +30,80 @@ todomvc.listcontrol.prototype.enterDocument = function() {
var list = /** @type {Object} */(this.getModel());
// Create new model from text box
var input = this.getEls('input')[0];
this.on( goog.events.EventType.KEYUP, function( e ) {
// handle new note entry
this.on( goog.events.EventType.KEYUP, this.handleNewInput, '.todo-entry' );
// On return get trimmed text
if ( e.keyCode !== goog.events.KeyCodes.ENTER ) {
return;
}
var text = goog.string.trim( input.value );
if ( !text) {
return;
}
// Create new model
list.newModel({
'title': text
// update complete button based on completed
this.autobind('#clear-completed', {
template: 'Clear completed ({$completed})',
noClick: true, // click should not set completed
show: true // hide when completed == false
});
input.value = '';
}, 'todo-entry' );
// Clear completed
this.click(function( e ) {
goog.array.forEach( list.get('completed'), function( model ) {
this.click( function() {
goog.array.forEach( list.getModels( 'completed' ),
function( model ) {
model.dispose();
});
}, 'clear-completed' );
}, '.clear-completed' );
// Toggle completed
this.click(function( e ) {
var checked = e.target.checked;
goog.array.forEach( list.getModels(), function( model ) {
model.set( 'completed', checked );
// when to check the check all
this.autobind('.toggle-all', {
reqs: 'allDone'
});
}, 'toggle-all' );
// Refresh the view on changes that effect the models order
this.anyModelChange(function() {
this.refresh();
list.save();
}, this );
// Toggle footer and main body
this.modelChange(function() {
this.showMainFooter( !!list.getLength() );
}, this );
this.showMainFooter( !!list.getLength() );
// change classes of ULs based on filter
this.autobind( 'ul', {
reqs: 'filter',
reqClass: ['active', 'completed', 'none']
} );
// Update counts
this.bind( 'completed', function( completedModels ) {
// Update "left" count
soy.renderElement(goog.dom.getElement('todo-count'),
todomvc.templates.itemsLeft, {
left: list.getLength() - completedModels.length
// update the count based on active
this.autobind('#todo-count', {
template: todomvc.templates.itemsLeft,
reqs: 'active'
});
// Update clear button
var clearButton = goog.dom.getElement('clear-completed');
goog.dom.setTextContent( clearButton,
'Clear completed (' + completedModels.length + ')' );
goog.style.showElement( clearButton, completedModels.length );
// Update checkbox
var checkBox = this.getEls('.toggle-all')[0];
checkBox.checked = completedModels.length === list.getLength();
// show or hide based on the totals
this.autobind(['#main', 'footer'], {
show: 'total',
noClick: true
});
// Get the saved todos
list.fetch();
};
// autolists on modelChange and return refresh function
var refresh = this.autolist( todomvc.todocontrol,
goog.dom.getElement('todo-list') ).fire;
/**
* show or hide the footer.
*
* @param {boolean=} opt_hide whether to hide the footer.
*/
todomvc.listcontrol.prototype.showMainFooter = function( opt_hide ) {
var main = goog.dom.getElement('main');
var footer = goog.dom.getElementsByTagNameAndClass('footer')[0];
// if filter changes refresh view
this.bind( 'filter', refresh );
goog.style.showElement( main, opt_hide );
goog.style.showElement( footer, opt_hide );
// if anything changes save models and refresh view
this.anyModelChange( refresh );
};
/**
* sets the function to determine which children are returned by the control.
*
* @param {Function} filter to decide models returned.
* adds the input as a new item
*/
todomvc.listcontrol.prototype.setFilter = function( filter ) {
this.filter_ = filter;
this.refresh();
};
todomvc.listcontrol.prototype.handleNewInput = function( e ) {
var input = e.target;
// On return get trimmed text
if ( e.keyCode !== goog.events.KeyCodes.ENTER ) {
return;
}
/**
* refreshes the view of the childen.
*/
todomvc.listcontrol.prototype.refresh = function() {
var text = goog.string.trim( input.value );
if ( !text ) {
return;
}
// Dispose and remove all the children.
this.forEachChild(function( child ) {
child.dispose();
// Create new model
this.getModel().newModel({
'title': text
});
this.removeChildren( true );
// Create new controls for the models
goog.array.forEach( this.getModel().getModels(this.filter_),
function( model ) {
var newModelControl = new todomvc.todocontrol( model );
this.addChild( newModelControl );
newModelControl.render( goog.dom.getElement('todo-list') );
}, this );
input.value = '';
};
......@@ -15,7 +15,6 @@ goog.require('todomvc.templates');
*/
todomvc.todocontrol = function( model ) {
goog.base( this, model );
};
goog.inherits( todomvc.todocontrol, mvc.Control );
......@@ -27,10 +26,7 @@ goog.inherits( todomvc.todocontrol, mvc.Control );
* @inheritDoc
*/
todomvc.todocontrol.prototype.createDom = function() {
var el = soy.renderAsFragment( todomvc.templates.todoItem, {
model: this.getModel().toJson()
}, null );
var el = soy.renderAsElement( todomvc.templates.todoItem, null, null );
this.setElementInternal(/** @type {Element} */(el));
};
......@@ -45,31 +41,35 @@ todomvc.todocontrol.prototype.enterDocument = function() {
var model = this.getModel();
// Toggle complete
this.click(function( e ) {
model.set( 'completed', e.target.checked );
}, 'toggle' );
this.autobind('.toggle', '{$completed}');
// Delete the model
this.click(function( e ) {
model.dispose();
}, 'destroy' );
}, '.destroy' );
// keep label inline with title
this.autobind( 'label', '{$title}')
var inputEl = this.getEls('.edit')[0];
// Dblclick to edit
this.on( goog.events.EventType.DBLCLICK, function( e ) {
goog.dom.classes.add( this.getElement(), 'editing' );
inputEl.value = model.get('title');
inputEl.focus();
}, 'view' );
}, '.view' );
// Save on edit
// blur on enter
this.on( goog.events.EventType.KEYUP, function( e ) {
if ( e.keyCode === goog.events.KeyCodes.ENTER ) {
model.set( 'title', inputEl.value );
e.target.blur();
}
}, 'edit' );
});
// finish editing on blur
this.on( goog.events.EventType.BLUR, function( e ) {
model.set( 'title', inputEl.value );
}, 'edit' );
goog.dom.classes.remove( this.getElement(), 'editing' );
});
// bind the title and the edit input
this.autobind('.edit', '{$title}');
};
PlastronJS @ 3a58c34c
Subproject commit 3a58c34c673ae0c5ba60eda5727f0d8332cb7fcf
......@@ -12,13 +12,37 @@ goog.require('todomvc.todomodel');
todomvc.listmodel = function() {
var todosSchema = {
// number of completed
'completed': {
get: function() {
return this.getModels(function( mod ) {
return mod.get('completed');
return this.getModels( 'completed' ).length;
},
models: true
},
'allDone': {
get: function() {
return this.getLength() == this.getModels( 'completed' ).length;
},
set: function( done ) {
goog.array.forEach( this.getModels( 'none' ), function( model ) {
model.set( 'completed', done );
});
},
models: true
},
// number of active models
'active': {
get: function() {
return this.getLength() - this.getModels( 'completed' ).length;
},
models: true
},
// the total
'total': {
get: function() {
return this.getLength();
},
models: true
}
};
......@@ -28,15 +52,45 @@ todomvc.listmodel = function() {
'schema': todosSchema,
'modelType': todomvc.todomodel
});
// fetch from localstorage
this.fetch();
// save on any changes
this.anyModelChange( this.save );
};
goog.inherits( todomvc.listmodel, mvc.Collection );
todomvc.listmodel.Filter = {
'none': function() {
return true
},
'active': function( model ) {
return !model.get('completed')
},
'completed': function( model ) {
return model.get('completed')
}
};
/**
* return models based on current filter or filter given
*
* @inheritDoc
*/
todomvc.listmodel.prototype.getModels = function(opt_filter) {
return goog.base(this, 'getModels',
todomvc.listmodel.Filter[ opt_filter || this.get( 'filter' ) ] );
};
/**
* @return {Object} todos as json.
*/
todomvc.listmodel.prototype.toJson = function() {
return goog.array.map( this.getModels(), function( mod ) {
return goog.array.map( this.getModels( 'none' ), function( mod ) {
return mod.toJson();
});
};
......@@ -13,6 +13,7 @@ goog.require('mvc.Model.ValidateError');
todomvc.todomodel = function( opt_options ) {
goog.base( this, opt_options );
// title must have a length, also format to remove spaces
this.setter( 'title', function( title ) {
var updated = goog.string.trim( title );
......@@ -23,6 +24,7 @@ todomvc.todomodel = function( opt_options ) {
return updated;
});
// when a note title is no longer valid then remove it
this.errorHandler(function() {
this.dispose();
});
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -5,19 +5,5 @@
"output-wrapper": "(function(){%output%})();",
"mode": "ADVANCED",
"level": "VERBOSE",
"output-file": "js/compiled.js",
"define": {
"goog.LOCALE": "en_GB"
},
"checks": {
"checkRegExp": "WARNING",
"checkTypes": "WARNING",
"checkVars": "WARNING",
"deprecated": "WARNING",
"fileoverviewTags": "WARNING",
"invalidCasts": "WARNING",
"missingProperties": "WARNING",
"nonStandardJsDocs": "WARNING",
"undefinedVars": "WARNING"
}
"output-file": "js/compiled.js"
}
{namespace todomvc.templates}
/**
* @param model
*/
{template .todoItem}
<li {if $model['completed']}class="completed"{/if}>
<li>
<div class="view">
<input class="toggle" type="checkbox" {if $model['completed']}checked{/if}>
<label>{$model['title']}</label>
<input class="toggle" type="checkbox">
<label></label>
<button class="destroy"></button>
</div>
<input class="edit">
<input class="edit" type="text">
</li>
{/template}
/**
* @param left
* use template for the 's' logic.
* Used in autobind so gets data under model namespace.
*
* @param model
*/
{template .itemsLeft}
<strong>{$left}</strong> item{if $left != 1}s{/if} left
<strong>{$model['active']}</strong> item{if $model['active'] != 1}s{/if} left
{/template}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment