Commit 531d16dd authored by Chris Price's avatar Chris Price Committed by Sindre Sorhus

Closes #172: Closure app update. Fixes #155

parent 265fa96d
# TodoMVC Closure Architecture Example
## Introduction
An example making use of the [Closure toolkit](https://developers.google.com/closure/). Note this project breaks with the convention of the others and uses spaces in place of tabs withing JavaScript files. This is to comply with the Google style guidelines which the Closure Linter enforces (see Linting below).
## Running
A third party build tool called [Plovr](http://plovr.com/) is used to make running and compiling the code easier. To serve the code for development purposes (the example should run in compiled mode without using Plovr), first download the latest stable version from the [Plovr Google Code project](http://code.google.com/p/plovr/downloads/list) (at the time of writing plovr-4b3caf2b7d84.jar). Copy the file into the build folder, rename it plovr.jar and run the following command from this folder -
`java -jar build/plovr.jar serve plovr.json`
You'll also need to change the HTML file so that it references the served files instead of the compiled version (**make sure you comment out the compiled version otherwise it will not work**), to do this remove the compiled script reference and add the following -
`<script type="text/javascript" src="http://localhost:9810/compile?id=todomvc&mode=RAW"></script>`
This will serve up the javascript files in RAW mode which is ideal for rapid development and debugging. To run the compiler, and therefore all the associated type checks etc., change RAW for ADVANCED -
`<script type="text/javascript" src="http://localhost:9810/compile?id=todomvc&mode=ADVANCED"></script>`
## Linting
Whilst Plovr features many of the tools from the Closure toolkit, one very useful one that's missing is the linter. The linter checks for common mistakes in your code, e.g. unused dependencies, whitespace errors. One restriction with the linter is that it will only permit code that adheres to the [Google JavaScript style guide](http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml). In this case that means that we break with the project conventions and use space indentation instead of tabs.
The linter must be installed before use, the installation package is included in the build folder and the instructions are available on the [linter homepage](https://developers.google.com/closure/utilities/). Once installed run the following to check for errors -
`find . -name *.js | xargs gjslint`
(or whatever floats your OSs boat)
## Compiling
To compile the code from the command line run Plovr like so -
`java -jar build/plovr.jar build plovr.json > js/compiled.js`
This will overwrite the js/compiled.js file with the new version, be sure to change the script tag reference in the HTML page.
## Credits
Template by [Sindre Sorhus](http://github.com/sindresorhus)
Created by [Chris Price](http://www.scottlogic.co.uk/blog/chris/)
Part of [TodoMVC](http://todomvc.com)
## License
Public Domain
\ No newline at end of file
plovr-4b3caf2b7d84
\ No newline at end of file
<!doctype html> <!doctype html>
<html> <html lang="en">
<head> <head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Closure • TodoMVC</title> <title>Closure • TodoMVC</title>
<link href="css/todos.css" rel="stylesheet"> <link rel="stylesheet" href="../../assets/base.css">
<!--[if IE]> <!--[if IE]>
<script src="../../assets/ie.js"></script> <script src="../../assets/ie.js"></script>
<![endif]--> <![endif]-->
</head> </head>
<body> <body>
<div id="todoapp"> <section id="todoapp">
<div class="title"> <header id="header">
<h1>Todos</h1> <h1>todos</h1>
</div> <input id="new-todo" placeholder="What needs to be done?" autofocus>
<div class="content"> </header>
<div id="create-todo"> <section id="main">
<input id="new-todo" placeholder="What needs to be done?" type="text"> <input id="toggle-all" type="checkbox">
</div> <label for="toggle-all">Mark all as complete</label>
<div id="todos">
<ul id="todo-list"> <ul id="todo-list">
</ul> </ul>
</div> </section>
<div id="todo-stats"> <footer id="footer">
</div> <ul id="filters">
</div> <li>
</div> <a class="selected" href="#/">All</a>
<ul id="instructions"> </li>
<li>Click to edit a todo</li> <li>
<a href="#/active">Active</a>
</li>
<li>
<a href="#/completed">Completed</a>
</li>
</ul> </ul>
<div id="credits"> </footer>
Created by <a href="http://www.scottlogic.co.uk/blog/chris/">Chris Price</a> </section>
</div> <footer id="info">
<p>Double-click to edit a todo</p>
<p>Template by <a href="http://github.com/sindresorhus">Sindre Sorhus</a></p>
<p>Created by <a href="http://www.scottlogic.co.uk/blog/chris/">Chris Price</a></p>
<p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
</footer>
<script src="../../assets/base.js"></script> <script src="../../assets/base.js"></script>
<!-- The compiled version (to update run java -jar build/plovr.jar build plovr.json > web/compiled.js) --> <!-- The compiled version (to update run java -jar build/plovr.jar build plovr.json > js/compiled.js) -->
<script type="text/javascript" src="js/compiled.js"></script> <script type="text/javascript" src="js/compiled.js"></script>
<!-- The RAW development version (to serve the files run java -jar build/plovr.jar serve plovr.json) --> <!-- The RAW development version (to serve the files run java -jar build/plovr.jar serve plovr.json) -->
<!-- <script type="text/javascript" src="http://localhost:9810/compile?id=todomvc&mode=RAW"></script> --> <!-- <script type="text/javascript" src="http://localhost:9810/compile?id=todomvc&mode=RAW"></script> -->
......
goog.provide('todomvc');
goog.require('goog.History');
goog.require('goog.array');
goog.require('goog.dom.query');
goog.require('goog.events.EventType');
goog.require('goog.events.KeyCodes');
goog.require('goog.storage.Storage');
goog.require('goog.storage.mechanism.mechanismfactory');
goog.require('goog.string');
goog.require('goog.ui.Component');
goog.require('goog.ui.Control');
goog.require('todomvc.model.ToDoItem');
goog.require('todomvc.model.ToDoItemStore');
goog.require('todomvc.view');
goog.require('todomvc.view.ClearCompletedControlRenderer');
goog.require('todomvc.view.ItemCountControlRenderer');
goog.require('todomvc.view.ToDoItemControl');
goog.require('todomvc.view.ToDoListContainer');
/**
* @fileoverview The controller/business logic for the application.
*
* This file creates the interface and marshals changes from the interface
* to the model and back.
*/
/**
* @type {todomvc.model.ToDoItemStore}
*/
var itemStore = new todomvc.model.ToDoItemStore();
itemStore.addEventListener(todomvc.model.ToDoItemStore.ChangeEventType,
redraw);
/**
* @type {todomvc.view.ToDoListContainer}
*/
var container = new todomvc.view.ToDoListContainer();
container.decorate(document.getElementById('todo-list'));
/**
* @type {Element}
*/
var main = document.getElementById('main');
/**
* @type {Element}
*/
var footer = document.getElementById('footer');
/**
* @type {goog.ui.Control}
*/
var itemCountControl = new goog.ui.Control(null,
todomvc.view.ItemCountControlRenderer.getInstance());
itemCountControl.render(footer);
/**
* @type {goog.ui.Control}
*/
var clearCompletedControl = new goog.ui.Control(null,
todomvc.view.ClearCompletedControlRenderer.getInstance());
clearCompletedControl.render(footer);
goog.events.listen(clearCompletedControl,
goog.ui.Component.EventType.ACTION, function(e) {
// go backwards to avoid collection modification problems
goog.array.forEachRight(itemStore.getAll(), function(model) {
if (model.isDone()) {
itemStore.remove(model);
}
});
});
/**
* @type {Element}
*/
var toggleAll = document.getElementById('toggle-all');
goog.events.listen(toggleAll, goog.events.EventType.CLICK, function(e) {
/**
* @type {boolean}
*/
var state = toggleAll.checked;
goog.array.forEach(itemStore.getAll(), function(model) {
/**
* @type {!todomvc.model.ToDoItem}
*/
var updatedModel = new todomvc.model.ToDoItem(
model.getNote(), state, model.getId());
itemStore.addOrUpdate(updatedModel);
});
});
/**
* Enum for the three possible route values
* @enum {!string}
*/
todomvc.Route = {
ALL: '/',
ACTIVE: '/active',
COMPLETED: '/completed'
};
/**
* @type {!todomvc.Route}
*/
var currentRoute = todomvc.Route.ALL;
/**
* @type {!goog.History}
*/
var history = new goog.History();
goog.events.listen(history, goog.history.EventType.NAVIGATE,
function(e) {
// constrain the route to be one of the enum values
switch (e.token) {
case todomvc.Route.ALL:
case todomvc.Route.ACTIVE:
case todomvc.Route.COMPLETED:
if (e.token !== currentRoute) {
currentRoute = e.token;
redraw();
}
break;
default:
history.replaceToken(todomvc.Route.ALL);
break;
}
});
function redraw() {
container.removeChildren(true);
/**
* @type {Array.<todomvc.model.ToDoItem>}
*/
var items = itemStore.getAll();
goog.array.forEach(items, function(item) {
// filter based on current route
if ((currentRoute === todomvc.Route.ACTIVE && item.isDone()) ||
(currentRoute === todomvc.Route.COMPLETED && !item.isDone())) {
return;
}
/**
* @type {todomvc.view.ToDoItemControl}
*/
var control = new todomvc.view.ToDoItemControl();
control.setContent(item.getNote());
control.setChecked(item.isDone());
control.setModel(item);
container.addChild(control, true);
});
var doneCount = /** @type {number} */
(goog.array.reduce(items, function(count, model) {
return model.isDone() ? count + 1 : count;
}, 0));
var remainingCount = items.length - (doneCount);
toggleAll.checked = remainingCount === 0;
itemCountControl.setContent(remainingCount.toString());
clearCompletedControl.setContent(doneCount.toString());
clearCompletedControl.setVisible(doneCount > 0);
goog.style.showElement(main, items.length > 0);
goog.style.showElement(footer, items.length > 0);
/**
* @type {Array.<Element>}
*/
var routeLinks = /** @type {Array.<Element>} */
(goog.dom.query('#filters a'));
goog.array.forEach(routeLinks, function(link, i) {
if ((currentRoute === todomvc.Route.ALL && i === 0) ||
(currentRoute === todomvc.Route.ACTIVE && i === 1) ||
(currentRoute === todomvc.Route.COMPLETED && i === 2)) {
link.className = 'selected';
} else {
link.className = '';
}
});
}
goog.events.listen(container,
todomvc.view.ToDoItemControl.EventType.EDIT, function(e) {
/**
* @type {todomvc.view.ToDoItemControl}
*/
var control = e.target;
/**
* @type {todomvc.model.ToDoItem}
*/
var originalModel = /**@type {todomvc.model.ToDoItem} */
(control.getModel());
/**
* @type {!todomvc.model.ToDoItem}
*/
var updatedModel = new todomvc.model.ToDoItem(
(/**@type {!string} */ control.getContent()),
(/**@type {!boolean} */ control.isChecked()),
originalModel.getId());
itemStore.addOrUpdate(updatedModel);
});
goog.events.listen(container,
todomvc.view.ToDoItemControl.EventType.DESTROY, function(e) {
/**
* @type {todomvc.view.ToDoItemControl}
*/
var control = e.target;
/**
* @type {todomvc.model.ToDoItem}
*/
var model = (/**@type {todomvc.model.ToDoItem} */ control.getModel());
if (model !== null) {
itemStore.remove(model);
}
});
/**
* @type {Element}
*/
var newToDo = document.getElementById('new-todo');
goog.events.listen(newToDo, goog.events.EventType.KEYUP, function(e) {
if (e.keyCode !== goog.events.KeyCodes.ENTER) {
return;
}
// get the text
var value = goog.string.trim(newToDo.value);
if (value === '') {
return;
}
// clear the input box
newToDo.value = '';
// create the item
itemStore.addOrUpdate(new todomvc.model.ToDoItem(value));
});
itemStore.load();
history.setEnabled(true);
(function(){function e(a){throw a;}var h=void 0,j=!0,k=null,n=!1;function p(a){return function(){return this[a]}}function q(a){return function(){return a}}var s,t=this;function u(a){a.F=function(){return a.pb||(a.pb=new a)}} (function(){function f(a){throw a;}var i=void 0,j=!0,k=null,m=!1;function p(a){return function(){return this[a]}}function s(a){return function(){return a}}var u,v=this;function aa(a,b){var c=a.split("."),d=v;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)!c.length&&b!==i?d[e]=b:d=d[e]?d[e]:d[e]={}}function y(a){a.N=function(){return a.fc||(a.fc=new a)}}
function aa(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"; 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 v(a){return"array"==aa(a)}function ba(a){var b=aa(a);return"array"==b||"object"==b&&"number"==typeof a.length}function w(a){return"string"==typeof a}function x(a){return"function"==aa(a)}function ca(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; else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function z(a){return"array"==ba(a)}function ea(a){var b=ba(a);return"array"==b||"object"==b&&"number"==typeof a.length}function A(a){return"string"==typeof a}function fa(a){return"function"==ba(a)}function ga(a){var b=typeof a;return"object"==b&&a!=k||"function"==b}function ha(a){return a[ia]||(a[ia]=++ja)}var ia="closure_uid_"+Math.floor(2147483648*Math.random()).toString(36),ja=0;
function fa(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=Array.prototype.slice.call(arguments);b.unshift.apply(b,c);return a.apply(this,b)}}function A(a,b){function c(){}c.prototype=b.prototype;a.e=b.prototype;a.prototype=new c;a.prototype.constructor=a};function ga(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")}function ha(a){if(!ia.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(ja,"&amp;"));-1!=a.indexOf("<")&&(a=a.replace(ka,"&lt;"));-1!=a.indexOf(">")&&(a=a.replace(la,"&gt;"));-1!=a.indexOf('"')&&(a=a.replace(ma,"&quot;"));return a}var ja=/&/g,ka=/</g,la=/>/g,ma=/\"/g,ia=/[&<>\"]/;var B=Array.prototype,na=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(w(a))return!w(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},C=B.forEach?function(a,b,c){B.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,g=w(a)?a.split(""):a,f=0;f<d;f++)f in g&&b.call(c,g[f],f,a)};function oa(a){for(var b=pa,c=w(b)?b.split(""):b,d=b.length-1;0<=d;--d)d in c&&a.call(h,c[d],d,b)} function ka(a,b,c){return a.call.apply(a.bind,arguments)}function la(a,b,c){a||f(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 ma(a,b,c){ma=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ka:la;return ma.apply(k,arguments)}
function qa(a){var b=pa;if(b.reduce)return b.reduce(a,0);var c=0;C(b,function(d,g){c=a.call(h,c,d,g,b)});return c}var ra=B.every?function(a,b,c){return B.every.call(a,b,c)}:function(a,b,c){for(var d=a.length,g=w(a)?a.split(""):a,f=0;f<d;f++)if(f in g&&!b.call(c,g[f],f,a))return n;return j};function sa(a,b){return 0<=na(a,b)}function D(a,b){var c=na(a,b);0<=c&&B.splice.call(a,c,1)}function ta(a){return B.concat.apply(B,arguments)} function na(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=Array.prototype.slice.call(arguments);b.unshift.apply(b,c);return a.apply(this,b)}}var oa=Date.now||function(){return+new Date};function B(a,b){function c(){}c.prototype=b.prototype;a.d=b.prototype;a.prototype=new c;a.prototype.constructor=a};function pa(){}pa.prototype.ib=m;pa.prototype.M=function(){this.ib||(this.ib=j,this.g())};pa.prototype.g=function(){this.Vb&&qa.apply(k,this.Vb)};function qa(a){for(var b=0,c=arguments.length;b<c;++b){var d=arguments[b];ea(d)?qa.apply(k,d):d&&"function"==typeof d.M&&d.M()}};function ra(a,b){for(var c=1;c<arguments.length;c++)var d=(""+arguments[c]).replace(/\$/g,"$$$$"),a=a.replace(/\%s/,d);return a}function sa(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")}var ta=/^[a-zA-Z0-9\-_.!~*'()]*$/;function ua(a){if(!va.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(wa,"&amp;"));-1!=a.indexOf("<")&&(a=a.replace(xa,"&lt;"));-1!=a.indexOf(">")&&(a=a.replace(ya,"&gt;"));-1!=a.indexOf('"')&&(a=a.replace(za,"&quot;"));return a}var wa=/&/g,xa=/</g,ya=/>/g,za=/\"/g,va=/[&<>\"]/;var C=Array.prototype,Aa=C.indexOf?function(a,b,c){return C.indexOf.call(a,b,c)}:function(a,b,c){c=c==k?0:0>c?Math.max(0,a.length+c):c;if(A(a))return!A(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=C.forEach?function(a,b,c){C.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=A(a)?a.split(""):a,g=0;g<d;g++)g in e&&b.call(c,e[g],g,a)};function Da(a){for(var b=E.getAll(),c=A(b)?b.split(""):b,d=b.length-1;0<=d;--d)d in c&&a.call(i,c[d],d,b)}
function ua(a){if(v(a))return ta(a);for(var b=[],c=0,d=a.length;c<d;c++)b[c]=a[c];return b}function va(a,b,c,d){B.splice.apply(a,wa(arguments,1))}function wa(a,b,c){return 2>=arguments.length?B.slice.call(a,b):B.slice.call(a,b,c)};var xa,ya,za,Aa;function Ba(){return t.navigator?t.navigator.userAgent:k}Aa=za=ya=xa=n;var Ca;if(Ca=Ba()){var Da=t.navigator;xa=0==Ca.indexOf("Opera");ya=!xa&&-1!=Ca.indexOf("MSIE");za=!xa&&-1!=Ca.indexOf("WebKit");Aa=!xa&&!za&&"Gecko"==Da.product}var Ea=xa,E=ya,F=Aa,G=za,Fa=t.navigator,Ga=-1!=(Fa&&Fa.platform||"").indexOf("Mac"),Ha; function Ea(a,b){if(a.reduce)return a.reduce(b,0);var c=0;D(a,function(d,e){c=b.call(i,c,d,e,a)});return c}var Fa=C.every?function(a,b,c){return C.every.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=A(a)?a.split(""):a,g=0;g<d;g++)if(g in e&&!b.call(c,e[g],g,a))return m;return j};function Ga(a,b,c){for(var d=a.length,e=A(a)?a.split(""):a,g=0;g<d;g++)if(g in e&&b.call(c,e[g],g,a))return g;return-1}function Ha(a,b){return 0<=Aa(a,b)}
a:{var Ja="",Ka;if(Ea&&t.opera)var La=t.opera.version,Ja="function"==typeof La?La():La;else if(F?Ka=/rv\:([^\);]+)(\)|;)/:E?Ka=/MSIE\s+([^\);]+)(\)|;)/:G&&(Ka=/WebKit\/(\S+)/),Ka)var Ma=Ka.exec(Ba()),Ja=Ma?Ma[1]:"";if(E){var Na,Oa=t.document;Na=Oa?Oa.documentMode:h;if(Na>parseFloat(Ja)){Ha=""+Na;break a}}Ha=Ja}var Pa={}; function Ia(a){if(!z(a))for(var b=a.length-1;0<=b;b--)delete a[b];a.length=0}function Ja(a,b){var c=Aa(a,b);0<=c&&C.splice.call(a,c,1)}function Ka(a,b){var c=Ga(a,b,i);0<=c&&C.splice.call(a,c,1)}function La(a){return C.concat.apply(C,arguments)}function Ma(a){if(z(a))return La(a);for(var b=[],c=0,d=a.length;c<d;c++)b[c]=a[c];return b}function Na(a,b,c,d){C.splice.apply(a,Oa(arguments,1))}function Oa(a,b,c){return 2>=arguments.length?C.slice.call(a,b):C.slice.call(a,b,c)};var Pa,Qa,Ua,Va;function Wa(){return v.navigator?v.navigator.userAgent:k}Va=Ua=Qa=Pa=m;var Xa;if(Xa=Wa()){var Ya=v.navigator;Pa=0==Xa.indexOf("Opera");Qa=!Pa&&-1!=Xa.indexOf("MSIE");Ua=!Pa&&-1!=Xa.indexOf("WebKit");Va=!Pa&&!Ua&&"Gecko"==Ya.product}var Za=Pa,G=Qa,H=Va,I=Ua,$a=v.navigator,ab=-1!=($a&&$a.platform||"").indexOf("Mac"),bb;
function H(a){var b;if(!(b=Pa[a])){b=0;for(var c=ga(""+Ha).split("."),d=ga(""+a).split("."),g=Math.max(c.length,d.length),f=0;0==b&&f<g;f++){var i=c[f]||"",l=d[f]||"",m=RegExp("(\\d*)(\\D*)","g"),o=RegExp("(\\d*)(\\D*)","g");do{var z=m.exec(i)||["","",""],r=o.exec(l)||["","",""];if(0==z[0].length&&0==r[0].length)break;b=((0==z[1].length?0:parseInt(z[1],10))<(0==r[1].length?0:parseInt(r[1],10))?-1:(0==z[1].length?0:parseInt(z[1],10))>(0==r[1].length?0:parseInt(r[1],10))?1:0)||((0==z[2].length)<(0== a:{var cb="",db;if(Za&&v.opera)var eb=v.opera.version,cb="function"==typeof eb?eb():eb;else if(H?db=/rv\:([^\);]+)(\)|;)/:G?db=/MSIE\s+([^\);]+)(\)|;)/:I&&(db=/WebKit\/(\S+)/),db)var fb=db.exec(Wa()),cb=fb?fb[1]:"";if(G){var gb,hb=v.document;gb=hb?hb.documentMode:i;if(gb>parseFloat(cb)){bb=""+gb;break a}}bb=cb}var kb={};
r[2].length)?-1:(0==z[2].length)>(0==r[2].length)?1:0)||(z[2]<r[2]?-1:z[2]>r[2]?1:0)}while(0==b)}b=Pa[a]=0<=b}return b}var Qa={};function Ra(){return Qa[9]||(Qa[9]=E&&!!document.documentMode&&9<=document.documentMode)};function Sa(a,b,c,d,g){if(!E&&(!G||!H("525")))return j;if(Ga&&g)return Ta(a);if(g&&!d||!c&&(17==b||18==b)||E&&d&&b==a)return n;switch(a){case 13:return!(E&&Ra());case 27:return!G}return Ta(a)}function Ta(a){if(48<=a&&57>=a||96<=a&&106>=a||65<=a&&90>=a||G&&0==a)return j;switch(a){case 32:case 63:case 107:case 109:case 110:case 111:case 186:case 59:case 189:case 187:case 188:case 190:case 191:case 192:case 222:case 219:case 220:case 221:return j;default:return n}};var Ua,Va=!E||Ra();!F&&!E||E&&Ra()||F&&H("1.9.1");E&&H("9");function Wa(a){return(a=a.className)&&"function"==typeof a.split?a.split(/\s+/):[]}function Xa(a,b){var c=Wa(a),d=wa(arguments,1),g;g=c;for(var f=0,i=0;i<d.length;i++)sa(g,d[i])||(g.push(d[i]),f++);g=f==d.length;a.className=c.join(" ");return g}function Ya(a,b){var c=Wa(a),d=wa(arguments,1),g;g=c;for(var f=0,i=0;i<g.length;i++)sa(d,g[i])&&(va(g,i--,1),f++);g=f==d.length;a.className=c.join(" ");return g};function Za(a,b){for(var c in a)b.call(h,a[c],c,a)}function $a(a,b,c){b in a&&e(Error('The object already contains the key "'+b+'"'));a[b]=c}var ab="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",");function bb(a,b){for(var c,d,g=1;g<arguments.length;g++){d=arguments[g];for(c in d)a[c]=d[c];for(var f=0;f<ab.length;f++)c=ab[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};function cb(a){return a?new db(eb(a)):Ua||(Ua=new db)}function fb(a,b){Za(b,function(b,d){"style"==d?a.style.cssText=b:"class"==d?a.className=b:"for"==d?a.htmlFor=b:d in gb?a.setAttribute(gb[d],b):0==d.lastIndexOf("aria-",0)?a.setAttribute(d,b):a[d]=b})}var gb={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",height:"height",width:"width",usemap:"useMap",frameborder:"frameBorder",maxlength:"maxLength",type:"type"}; function J(a){var b;if(!(b=kb[a])){b=0;for(var c=sa(""+bb).split("."),d=sa(""+a).split("."),e=Math.max(c.length,d.length),g=0;0==b&&g<e;g++){var h=c[g]||"",l=d[g]||"",n=RegExp("(\\d*)(\\D*)","g"),o=RegExp("(\\d*)(\\D*)","g");do{var x=n.exec(h)||["","",""],q=o.exec(l)||["","",""];if(0==x[0].length&&0==q[0].length)break;b=((0==x[1].length?0:parseInt(x[1],10))<(0==q[1].length?0:parseInt(q[1],10))?-1:(0==x[1].length?0:parseInt(x[1],10))>(0==q[1].length?0:parseInt(q[1],10))?1:0)||((0==x[2].length)<(0==
function hb(a,b,c){function d(c){c&&b.appendChild(w(c)?a.createTextNode(c):c)}for(var g=2;g<c.length;g++){var f=c[g];ba(f)&&!(ca(f)&&0<f.nodeType)?C(ib(f)?ua(f):f,d):d(f)}}function jb(a){var b=document,c=b.createElement("div");E?(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 kb(a){for(var b;b=a.firstChild;)a.removeChild(b)} q[2].length)?-1:(0==x[2].length)>(0==q[2].length)?1:0)||(x[2]<q[2]?-1:x[2]>q[2]?1:0)}while(0==b)}b=kb[a]=0<=b}return b}var lb={};function mb(){return lb[9]||(lb[9]=G&&!!document.documentMode&&9<=document.documentMode)};var nb=!G||mb(),ob=!G||mb(),pb=G&&!J("8");!I||J("528");H&&J("1.9b")||G&&J("8")||Za&&J("9.5")||I&&J("528");!H||J("8");function K(a,b){this.type=a;this.currentTarget=this.target=b}B(K,pa);u=K.prototype;u.g=function(){delete this.type;delete this.target;delete this.currentTarget};u.ea=m;u.Ca=j;u.stopPropagation=function(){this.ea=j};u.preventDefault=function(){this.Ca=m};function qb(a){qb[" "](a);return a}qb[" "]=function(){};function rb(a,b){a&&this.za(a,b)}B(rb,K);var sb=[1,4,2];u=rb.prototype;u.target=k;u.relatedTarget=k;u.offsetX=0;u.offsetY=0;u.clientX=0;u.clientY=0;u.screenX=0;u.screenY=0;u.button=0;u.keyCode=0;u.charCode=0;u.ctrlKey=m;u.altKey=m;u.shiftKey=m;u.metaKey=m;u.xb=m;u.H=k;
function lb(a){a&&a.parentNode&&a.parentNode.removeChild(a)}function mb(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 eb(a){return 9==a.nodeType?a:a.ownerDocument||a.document} u.za=function(a,b){var c=this.type=a.type;K.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var d=a.relatedTarget;if(d){if(H){var e;a:{try{qb(d.nodeName);e=j;break a}catch(g){}e=m}e||(d=k)}}else"mouseover"==c?d=a.fromElement:"mouseout"==c&&(d=a.toElement);this.relatedTarget=d;this.offsetX=I||a.offsetX!==i?a.offsetX:a.layerX;this.offsetY=I||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||
function nb(a,b){if("textContent"in a)a.textContent=b;else if(a.firstChild&&3==a.firstChild.nodeType){for(;a.lastChild!=a.firstChild;)a.removeChild(a.lastChild);a.firstChild.data=b}else kb(a),a.appendChild(eb(a).createTextNode(b))}function ob(a){var b=a.getAttributeNode("tabindex");return b&&b.specified?(a=a.tabIndex,"number"==typeof a&&0<=a&&32768>a):n} 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.xb=ab?a.metaKey:a.ctrlKey;this.state=a.state;this.H=a;delete this.Ca;delete this.ea};function tb(a){return nb?0==a.H.button:"click"==a.type?j:!!(a.H.button&sb[0])}
function ib(a){if(a&&"number"==typeof a.length){if(ca(a))return"function"==typeof a.item||"string"==typeof a.item;if(x(a))return"function"==typeof a.item}return n}function db(a){this.A=a||t.document||document}s=db.prototype;s.ua=cb;s.a=function(a){return w(a)?this.A.getElementById(a):a}; u.stopPropagation=function(){rb.d.stopPropagation.call(this);this.H.stopPropagation?this.H.stopPropagation():this.H.cancelBubble=j};u.preventDefault=function(){rb.d.preventDefault.call(this);var a=this.H;if(a.preventDefault)a.preventDefault();else if(a.returnValue=m,pb)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};u.g=function(){rb.d.g.call(this);this.relatedTarget=this.currentTarget=this.target=this.H=k};function ub(){}var vb=0;u=ub.prototype;u.key=0;u.ga=m;u.Bb=m;u.za=function(a,b,c,d,e,g){fa(a)?this.Hb=j:a&&a.handleEvent&&fa(a.handleEvent)?this.Hb=m:f(Error("Invalid listener argument"));this.oa=a;this.Lb=b;this.src=c;this.type=d;this.capture=!!e;this.Sa=g;this.Bb=m;this.key=++vb;this.ga=m};u.handleEvent=function(a){return this.Hb?this.oa.call(this.Sa||this.src,a):this.oa.handleEvent.call(this.oa,a)};function wb(a,b){for(var c in a)b.call(i,a[c],c,a)}function xb(a,b,c){b in a&&f(Error('The object already contains the key "'+b+'"'));a[b]=c}var yb="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",");function zb(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 g=0;g<yb.length;g++)c=yb[g],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var Ab={},M={},N={},Bb={};
s.i=function(a,b,c){var d=this.A,g=arguments,f=g[0],i=g[1];if(!Va&&i&&(i.name||i.type)){f=["<",f];i.name&&f.push(' name="',ha(i.name),'"');if(i.type){f.push(' type="',ha(i.type),'"');var l={};bb(l,i);i=l;delete i.type}f.push(">");f=f.join("")}f=d.createElement(f);i&&(w(i)?f.className=i:v(i)?Xa.apply(k,[f].concat(i)):fb(f,i));2<g.length&&hb(d,f,g);return f};s.createElement=function(a){return this.A.createElement(a)};s.createTextNode=function(a){return this.A.createTextNode(a)}; function O(a,b,c,d,e){if(b){if(z(b)){for(var g=0;g<b.length;g++)O(a,b[g],c,d,e);return k}var d=!!d,h=M;b in h||(h[b]={D:0,B:0});h=h[b];d in h||(h[d]={D:0,B:0},h.D++);var h=h[d],l=ha(a),n;h.B++;if(h[l]){n=h[l];for(g=0;g<n.length;g++)if(h=n[g],h.oa==c&&h.Sa==e){if(h.ga)break;return n[g].key}}else n=h[l]=[],h.D++;g=Cb();g.src=a;h=new ub;h.za(c,g,a,b,d,e);c=h.key;g.key=c;n.push(h);Ab[c]=h;N[l]||(N[l]=[]);N[l].push(h);a.addEventListener?(a==v||!a.Db)&&a.addEventListener(b,g,d):a.attachEvent(b in Bb?Bb[b]:
s.appendChild=function(a,b){a.appendChild(b)};s.contains=mb;function pb(){}pb.prototype.Ha=n;pb.prototype.I=function(){this.Ha||(this.Ha=j,this.k())};pb.prototype.k=function(){this.eb&&qb.apply(k,this.eb)};function qb(a){for(var b=0,c=arguments.length;b<c;++b){var d=arguments[b];ba(d)?qb.apply(k,d):d&&"function"==typeof d.I&&d.I()}};var rb=!E||Ra(),sb=!E||Ra(),tb=E&&!H("8");!G||H("528");F&&H("1.9b")||E&&H("8")||Ea&&H("9.5")||G&&H("528");!F||H("8");function I(a,b){this.type=a;this.currentTarget=this.target=b}A(I,pb);s=I.prototype;s.k=function(){delete this.type;delete this.target;delete this.currentTarget};s.W=n;s.ja=j;s.stopPropagation=function(){this.W=j};s.preventDefault=function(){this.ja=n};function ub(a){ub[" "](a);return a}ub[" "]=function(){};function J(a,b){a&&this.ha(a,b)}A(J,I);var vb=[1,4,2];s=J.prototype;s.target=k;s.relatedTarget=k;s.offsetX=0;s.offsetY=0;s.clientX=0;s.clientY=0;s.screenX=0;s.screenY=0;s.button=0;s.keyCode=0;s.charCode=0;s.ctrlKey=n;s.altKey=n;s.shiftKey=n;s.metaKey=n;s.Pa=n;s.J=k; Bb[b]="on"+b,g);return c}f(Error("Invalid event type"))}function Cb(){var a=Db,b=ob?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 Eb(a,b,c,d,e){if(z(b))for(var g=0;g<b.length;g++)Eb(a,b[g],c,d,e);else if(d=!!d,a=Fb(a,b,d))for(g=0;g<a.length;g++)if(a[g].oa==c&&a[g].capture==d&&a[g].Sa==e){P(a[g].key);break}}
s.ha=function(a,b){var c=this.type=a.type;I.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var d=a.relatedTarget;if(d){if(F){var g;a:{try{ub(d.nodeName);g=j;break a}catch(f){}g=n}g||(d=k)}}else"mouseover"==c?d=a.fromElement:"mouseout"==c&&(d=a.toElement);this.relatedTarget=d;this.offsetX=G||a.offsetX!==h?a.offsetX:a.layerX;this.offsetY=G||a.offsetY!==h?a.offsetY:a.layerY;this.clientX=a.clientX!==h?a.clientX:a.pageX;this.clientY=a.clientY!==h?a.clientY:a.pageY;this.screenX=a.screenX|| function P(a){if(!Ab[a])return m;var b=Ab[a];if(b.ga)return m;var c=b.src,d=b.type,e=b.Lb,g=b.capture;c.removeEventListener?(c==v||!c.Db)&&c.removeEventListener(d,e,g):c.detachEvent&&c.detachEvent(d in Bb?Bb[d]:Bb[d]="on"+d,e);c=ha(c);e=M[d][g][c];if(N[c]){var h=N[c];Ja(h,b);0==h.length&&delete N[c]}b.ga=j;e.Jb=j;Gb(d,g,c,e);delete Ab[a];return j}
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.Pa=Ga?a.metaKey:a.ctrlKey;this.state=a.state;this.J=a;delete this.ja;delete this.W};function wb(a){return rb?0==a.J.button:"click"==a.type?j:!!(a.J.button&vb[0])} function Gb(a,b,c,d){if(!d.Ya&&d.Jb){for(var e=0,g=0;e<d.length;e++)d[e].ga?d[e].Lb.src=k:(e!=g&&(d[g]=d[e]),g++);d.length=g;d.Jb=m;0==g&&(delete M[a][b][c],M[a][b].D--,0==M[a][b].D&&(delete M[a][b],M[a].D--),0==M[a].D&&delete M[a])}}function Hb(a){var b,c=0,d=b==k;b=!!b;if(a==k)wb(N,function(a){for(var e=a.length-1;0<=e;e--){var g=a[e];if(d||b==g.capture)P(g.key),c++}});else if(a=ha(a),N[a])for(var a=N[a],e=a.length-1;0<=e;e--){var g=a[e];if(d||b==g.capture)P(g.key),c++}}
s.stopPropagation=function(){J.e.stopPropagation.call(this);this.J.stopPropagation?this.J.stopPropagation():this.J.cancelBubble=j};s.preventDefault=function(){J.e.preventDefault.call(this);var a=this.J;if(a.preventDefault)a.preventDefault();else if(a.returnValue=n,tb)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};s.k=function(){J.e.k.call(this);this.relatedTarget=this.currentTarget=this.target=this.J=k};function xb(){}var yb=0;s=xb.prototype;s.key=0;s.X=n;s.Sa=n;s.ha=function(a,b,c,d,g,f){x(a)?this.Wa=j:a&&a.handleEvent&&x(a.handleEvent)?this.Wa=n:e(Error("Invalid listener argument"));this.ba=a;this.$a=b;this.src=c;this.type=d;this.capture=!!g;this.xa=f;this.Sa=n;this.key=++yb;this.X=n};s.handleEvent=function(a){return this.Wa?this.ba.call(this.xa||this.src,a):this.ba.handleEvent.call(this.ba,a)};var zb={},K={},M={},Ab={}; function Fb(a,b,c){var d=M;return b in d&&(d=d[b],c in d&&(d=d[c],a=ha(a),d[a]))?d[a]:k}function Ib(a,b,c,d,e){var g=1,b=ha(b);if(a[b]){a.B--;a=a[b];a.Ya?a.Ya++:a.Ya=1;try{for(var h=a.length,l=0;l<h;l++){var n=a[l];n&&!n.ga&&(g&=Jb(n,e)!==m)}}finally{a.Ya--,Gb(c,d,b,a)}}return Boolean(g)}function Jb(a,b){var c=a.handleEvent(b);a.Bb&&P(a.key);return c}
function N(a,b,c,d,g){if(b){if(v(b)){for(var f=0;f<b.length;f++)N(a,b[f],c,d,g);return k}var d=!!d,i=K;b in i||(i[b]={z:0,v:0});i=i[b];d in i||(i[d]={z:0,v:0},i.z++);var i=i[d],l=y(a),m;i.v++;if(i[l]){m=i[l];for(f=0;f<m.length;f++)if(i=m[f],i.ba==c&&i.xa==g){if(i.X)break;return m[f].key}}else m=i[l]=[],i.z++;f=Bb();f.src=a;i=new xb;i.ha(c,f,a,b,d,g);c=i.key;f.key=c;m.push(i);zb[c]=i;M[l]||(M[l]=[]);M[l].push(i);a.addEventListener?(a==t||!a.Ta)&&a.addEventListener(b,f,d):a.attachEvent(b in Ab?Ab[b]: function Db(a,b){if(!Ab[a])return j;var c=Ab[a],d=c.type,e=M;if(!(d in e))return j;var e=e[d],g,h;if(!ob){var l;if(!(l=b))a:{l=["window","event"];for(var n=v;g=l.shift();)if(n[g]!=k)n=n[g];else{l=k;break a}l=n}g=l;l=j in e;n=m in e;if(l){if(0>g.keyCode||g.returnValue!=i)return j;a:{var o=m;if(0==g.keyCode)try{g.keyCode=-1;break a}catch(x){o=j}if(o||g.returnValue==i)g.returnValue=j}}o=new rb;o.za(g,this);g=j;try{if(l){for(var q=[],L=o.currentTarget;L;L=L.parentNode)q.push(L);h=e[j];h.B=h.D;for(var t=
Ab[b]="on"+b,f);return c}e(Error("Invalid event type"))}function Bb(){var a=Cb,b=sb?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 Db(a,b,c,d,g){if(v(b))for(var f=0;f<b.length;f++)Db(a,b[f],c,d,g);else if(d=!!d,a=Eb(a,b,d))for(f=0;f<a.length;f++)if(a[f].ba==c&&a[f].capture==d&&a[f].xa==g){O(a[f].key);break}} q.length-1;!o.ea&&0<=t&&h.B;t--)o.currentTarget=q[t],g&=Ib(h,q[t],d,j,o);if(n){h=e[m];h.B=h.D;for(t=0;!o.ea&&t<q.length&&h.B;t++)o.currentTarget=q[t],g&=Ib(h,q[t],d,m,o)}}else g=Jb(c,o)}finally{q&&(q.length=0),o.M()}return g}d=new rb(b,this);try{g=Jb(c,d)}finally{d.M()}return g};function Kb(){}B(Kb,pa);u=Kb.prototype;u.Db=j;u.bb=k;u.yb=function(a){this.bb=a};u.addEventListener=function(a,b,c,d){O(this,a,b,c,d)};u.removeEventListener=function(a,b,c,d){Eb(this,a,b,c,d)};
function O(a){if(!zb[a])return n;var b=zb[a];if(b.X)return n;var c=b.src,d=b.type,g=b.$a,f=b.capture;c.removeEventListener?(c==t||!c.Ta)&&c.removeEventListener(d,g,f):c.detachEvent&&c.detachEvent(d in Ab?Ab[d]:Ab[d]="on"+d,g);c=y(c);g=K[d][f][c];if(M[c]){var i=M[c];D(i,b);0==i.length&&delete M[c]}b.X=j;g.Xa=j;Fb(d,f,c,g);delete zb[a];return j} u.dispatchEvent=function(a){var b=a.type||a,c=M;if(b in c){if(A(a))a=new K(a,this);else if(a instanceof K)a.target=a.target||this;else{var d=a,a=new K(b,this);zb(a,d)}var d=1,e,c=c[b],b=j in c,g;if(b){e=[];for(g=this;g;g=g.bb)e.push(g);g=c[j];g.B=g.D;for(var h=e.length-1;!a.ea&&0<=h&&g.B;h--)a.currentTarget=e[h],d&=Ib(g,e[h],a.type,j,a)&&a.Ca!=m}if(m in c)if(g=c[m],g.B=g.D,b)for(h=0;!a.ea&&h<e.length&&g.B;h++)a.currentTarget=e[h],d&=Ib(g,e[h],a.type,m,a)&&a.Ca!=m;else for(e=this;!a.ea&&e&&g.B;e=e.bb)a.currentTarget=
function Fb(a,b,c,d){if(!d.Ca&&d.Xa){for(var g=0,f=0;g<d.length;g++)d[g].X?d[g].$a.src=k:(g!=f&&(d[f]=d[g]),f++);d.length=f;d.Xa=n;0==f&&(delete K[a][b][c],K[a][b].z--,0==K[a][b].z&&(delete K[a][b],K[a].z--),0==K[a].z&&delete K[a])}}function Gb(a){var b,c=0,d=b==k;b=!!b;if(a==k)Za(M,function(a){for(var f=a.length-1;0<=f;f--){var g=a[f];if(d||b==g.capture)O(g.key),c++}});else if(a=y(a),M[a])for(var a=M[a],g=a.length-1;0<=g;g--){var f=a[g];if(d||b==f.capture)O(f.key),c++}} e,d&=Ib(g,e,a.type,m,a)&&a.Ca!=m;a=Boolean(d)}else a=j;return a};u.g=function(){Kb.d.g.call(this);Hb(this);this.bb=k};function Lb(a,b){this.Aa=a||1;this.Ka=b||Mb;this.gb=ma(this.nc,this);this.sb=oa()}B(Lb,Kb);Lb.prototype.enabled=m;var Mb=v.window;u=Lb.prototype;u.l=k;u.setInterval=function(a){this.Aa=a;this.l&&this.enabled?(this.stop(),this.start()):this.l&&this.stop()};u.nc=function(){if(this.enabled){var a=oa()-this.sb;0<a&&a<0.8*this.Aa?this.l=this.Ka.setTimeout(this.gb,this.Aa-a):(this.dispatchEvent(Nb),this.enabled&&(this.l=this.Ka.setTimeout(this.gb,this.Aa),this.sb=oa()))}};
function Eb(a,b,c){var d=K;return b in d&&(d=d[b],c in d&&(d=d[c],a=y(a),d[a]))?d[a]:k}function Hb(a,b,c,d,g){var f=1,b=y(b);if(a[b]){a.v--;a=a[b];a.Ca?a.Ca++:a.Ca=1;try{for(var i=a.length,l=0;l<i;l++){var m=a[l];m&&!m.X&&(f&=Ib(m,g)!==n)}}finally{a.Ca--,Fb(c,d,b,a)}}return Boolean(f)}function Ib(a,b){var c=a.handleEvent(b);a.Sa&&O(a.key);return c} u.start=function(){this.enabled=j;this.l||(this.l=this.Ka.setTimeout(this.gb,this.Aa),this.sb=oa())};u.stop=function(){this.enabled=m;this.l&&(this.Ka.clearTimeout(this.l),this.l=k)};u.g=function(){Lb.d.g.call(this);this.stop();delete this.Ka};var Nb="tick";var Ob,Pb=!G||mb();!H&&!G||G&&mb()||H&&J("1.9.1");G&&J("9");function Qb(a){return(a=a.className)&&"function"==typeof a.split?a.split(/\s+/):[]}function Rb(a,b){var c=Qb(a),d=Oa(arguments,1),e;e=c;for(var g=0,h=0;h<d.length;h++)Ha(e,d[h])||(e.push(d[h]),g++);e=g==d.length;a.className=c.join(" ");return e}function Sb(a,b){var c=Qb(a),d=Oa(arguments,1),e;e=c;for(var g=0,h=0;h<e.length;h++)Ha(d,e[h])&&(Na(e,h--,1),g++);e=g==d.length;a.className=c.join(" ");return e};function Tb(a){return a?new Wb(Q(a)):Ob||(Ob=new Wb)}function Xb(a,b){wb(b,function(b,d){"style"==d?a.style.cssText=b:"class"==d?a.className=b:"for"==d?a.htmlFor=b:d in Yb?a.setAttribute(Yb[d],b):0==d.lastIndexOf("aria-",0)?a.setAttribute(d,b):a[d]=b})}var Yb={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",height:"height",width:"width",usemap:"useMap",frameborder:"frameBorder",maxlength:"maxLength",type:"type"};
function Cb(a,b){if(!zb[a])return j;var c=zb[a],d=c.type,g=K;if(!(d in g))return j;var g=g[d],f,i;if(!sb){var l;if(!(l=b))a:{l=["window","event"];for(var m=t;f=l.shift();)if(m[f]!=k)m=m[f];else{l=k;break a}l=m}f=l;l=j in g;m=n in g;if(l){if(0>f.keyCode||f.returnValue!=h)return j;a:{var o=n;if(0==f.keyCode)try{f.keyCode=-1;break a}catch(z){o=j}if(o||f.returnValue==h)f.returnValue=j}}o=new J;o.ha(f,this);f=j;try{if(l){for(var r=[],Ia=o.currentTarget;Ia;Ia=Ia.parentNode)r.push(Ia);i=g[j];i.v=i.z;for(var L= function Zb(a,b,c){function d(c){c&&b.appendChild(A(c)?a.createTextNode(c):c)}for(var e=2;e<c.length;e++){var g=c[e];ea(g)&&!(ga(g)&&0<g.nodeType)?D($b(g)?Ma(g):g,d):d(g)}}function ac(a){var b=document,c=b.createElement("div");G?(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 bc(a){for(var b;b=a.firstChild;)a.removeChild(b)}
r.length-1;!o.W&&0<=L&&i.v;L--)o.currentTarget=r[L],f&=Hb(i,r[L],d,j,o);if(m){i=g[n];i.v=i.z;for(L=0;!o.W&&L<r.length&&i.v;L++)o.currentTarget=r[L],f&=Hb(i,r[L],d,n,o)}}else f=Ib(c,o)}finally{r&&(r.length=0),o.I()}return f}d=new J(b,this);try{f=Ib(c,d)}finally{d.I()}return f};function Jb(a){this.Va=a;this.Ba=[]}A(Jb,pb);var Kb=[];function P(a,b,c,d){v(c)||(Kb[0]=c,c=Kb);for(var g=0;g<c.length;g++)a.Ba.push(N(b,c[g],d||a,n,a.Va||a));return a}function Q(a,b,c,d,g,f){if(v(c))for(var i=0;i<c.length;i++)Q(a,b,c[i],d,g,f);else{a:{d=d||a;f=f||a.Va||a;g=!!g;if(b=Eb(b,c,g))for(c=0;c<b.length;c++)if(!b[c].X&&b[c].ba==d&&b[c].capture==g&&b[c].xa==f){b=b[c];break a}b=k}b&&(b=b.key,O(b),D(a.Ba,b))}return a}function Lb(a){C(a.Ba,O);a.Ba.length=0} function cc(a){a&&a.parentNode&&a.parentNode.removeChild(a)}function dc(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 Q(a){return 9==a.nodeType?a:a.ownerDocument||a.document}
Jb.prototype.k=function(){Jb.e.k.call(this);Lb(this)};Jb.prototype.handleEvent=function(){e(Error("EventHandler.handleEvent not implemented"))};function Mb(){}A(Mb,pb);s=Mb.prototype;s.Ta=j;s.Da=k;s.Qa=function(a){this.Da=a};s.addEventListener=function(a,b,c,d){N(this,a,b,c,d)};s.removeEventListener=function(a,b,c,d){Db(this,a,b,c,d)}; function ec(a,b){if("textContent"in a)a.textContent=b;else if(a.firstChild&&3==a.firstChild.nodeType){for(;a.lastChild!=a.firstChild;)a.removeChild(a.lastChild);a.firstChild.data=b}else bc(a),a.appendChild(Q(a).createTextNode(b))}function fc(a){var b=a.getAttributeNode("tabindex");return b&&b.specified?(a=a.tabIndex,"number"==typeof a&&0<=a&&32768>a):m}
s.dispatchEvent=function(a){var b=a.type||a,c=K;if(b in c){if(w(a))a=new I(a,this);else if(a instanceof I)a.target=a.target||this;else{var d=a,a=new I(b,this);bb(a,d)}var d=1,g,c=c[b],b=j in c,f;if(b){g=[];for(f=this;f;f=f.Da)g.push(f);f=c[j];f.v=f.z;for(var i=g.length-1;!a.W&&0<=i&&f.v;i--)a.currentTarget=g[i],d&=Hb(f,g[i],a.type,j,a)&&a.ja!=n}if(n in c)if(f=c[n],f.v=f.z,b)for(i=0;!a.W&&i<g.length&&f.v;i++)a.currentTarget=g[i],d&=Hb(f,g[i],a.type,n,a)&&a.ja!=n;else for(g=this;!a.W&&g&&f.v;g=g.Da)a.currentTarget= function $b(a){if(a&&"number"==typeof a.length){if(ga(a))return"function"==typeof a.item||"string"==typeof a.item;if(fa(a))return"function"==typeof a.item}return m}function Wb(a){this.F=a||v.document||document}u=Wb.prototype;u.Pa=Tb;u.a=function(a){return A(a)?this.F.getElementById(a):a};
g,d&=Hb(f,g,a.type,n,a)&&a.ja!=n;a=Boolean(d)}else a=j;return a};s.k=function(){Mb.e.k.call(this);Gb(this);this.Da=k};var Nb=F?"MozUserSelect":G?"WebkitUserSelect":k;function Ob(a,b,c){c=!c?a.getElementsByTagName("*"):k;if(Nb){if(b=b?"none":"",a.style[Nb]=b,c)for(var a=0,d;d=c[a];a++)d.style[Nb]=b}else if(E||Ea)if(b=b?"on":"",a.setAttribute("unselectable",b),c)for(a=0;d=c[a];a++)d.setAttribute("unselectable",b)};function Pb(){}u(Pb);Pb.prototype.qb=0;Pb.F();function R(a){this.B=a||cb();this.ka=Qb}A(R,Mb);R.prototype.ob=Pb.F();var Qb=k;function Rb(a,b){switch(a){case 1:return b?"disable":"enable";case 2:return b?"highlight":"unhighlight";case 4:return b?"activate":"deactivate";case 8:return b?"select":"unselect";case 16:return b?"check":"uncheck";case 32:return b?"focus":"blur";case 64:return b?"open":"close"}e(Error("Invalid component state"))}s=R.prototype;s.aa=k;s.d=n;s.b=k;s.ka=k;s.ia=k;s.n=k;s.m=k;s.q=k;s.bb=n; u.j=function(a,b,c){var d=this.F,e=arguments,g=e[0],h=e[1];if(!Pb&&h&&(h.name||h.type)){g=["<",g];h.name&&g.push(' name="',ua(h.name),'"');if(h.type){g.push(' type="',ua(h.type),'"');var l={};zb(l,h);h=l;delete h.type}g.push(">");g=g.join("")}g=d.createElement(g);h&&(A(h)?g.className=h:z(h)?Rb.apply(k,[g].concat(h)):Xb(g,h));2<e.length&&Zb(d,g,e);return g};u.createElement=function(a){return this.F.createElement(a)};u.createTextNode=function(a){return this.F.createTextNode(a)};
function Sb(a){return a.aa||(a.aa=":"+(a.ob.qb++).toString(36))}function Tb(a,b){if(a.n&&a.n.q){var c=a.n.q,d=a.aa;d in c&&delete c[d];$a(a.n.q,b,a)}a.aa=b}s.a=p("b");function Ub(a){return a.Z||(a.Z=new Jb(a))}function Vb(a,b){a==b&&e(Error("Unable to set parent component"));b&&a.n&&a.aa&&Wb(a.n,a.aa)&&a.n!=b&&e(Error("Unable to set parent component"));a.n=b;R.e.Qa.call(a,b)}s.getParent=p("n");s.Qa=function(a){this.n&&this.n!=a&&e(Error("Method not supported"));R.e.Qa.call(this,a)};s.ua=p("B"); u.appendChild=function(a,b){a.appendChild(b)};u.Mb=bc;u.contains=dc;function gc(a){this.Fb=a;this.Xa=[]}B(gc,pa);var hc=[];function R(a,b,c,d){z(c)||(hc[0]=c,c=hc);for(var e=0;e<c.length;e++)a.Xa.push(O(b,c[e],d||a,m,a.Fb||a));return a}function S(a,b,c,d,e,g){if(z(c))for(var h=0;h<c.length;h++)S(a,b,c[h],d,e,g);else{a:{d=d||a;g=g||a.Fb||a;e=!!e;if(b=Fb(b,c,e))for(c=0;c<b.length;c++)if(!b[c].ga&&b[c].oa==d&&b[c].capture==e&&b[c].Sa==g){b=b[c];break a}b=k}b&&(b=b.key,P(b),Ja(a.Xa,b))}return a}function ic(a){D(a.Xa,P);a.Xa.length=0}
s.i=function(){this.b=this.B.createElement("div")};function Xb(a,b,c){a.d&&e(Error("Component already rendered"));a.b||a.i();b?b.insertBefore(a.b,c||k):a.B.A.body.appendChild(a.b);(!a.n||a.n.d)&&a.r()}s.P=function(a){this.d&&e(Error("Component already rendered"));if(a&&this.D(a)){this.bb=j;if(!this.B||this.B.A!=eb(a))this.B=cb(a);this.Ga(a);this.r()}else e(Error("Invalid element to decorate"))};s.D=q(j);s.Ga=function(a){this.b=a};s.r=function(){this.d=j;S(this,function(a){!a.d&&a.a()&&a.r()})}; gc.prototype.g=function(){gc.d.g.call(this);ic(this)};gc.prototype.handleEvent=function(){f(Error("EventHandler.handleEvent not implemented"))};function jc(a){K.call(this,"navigate");this.zb=a}B(jc,K);function kc(a,b,c,d){a&&!b&&f(Error("Can't use invisible history without providing a blank page."));var e;c?e=c:(e="history_state"+lc,document.write(ra(mc,e,e)),e=A(e)?document.getElementById(e):e);this.ya=e;this.P=c?Q(c)?Q(c).parentWindow||Q(c).defaultView:window:window;this.Tb=this.P.location.href.split("#")[0];this.Ta=b;G&&!b&&(this.Ta="https"==window.location.protocol?"https:///":'javascript:""');this.l=new Lb(nc);this.ha=!a;this.$=new gc(this);if(a||G&&!oc)d?a=d:(a="history_iframe"+lc,b=this.Ta?
s.R=function(){S(this,function(a){a.d&&a.R()});this.Z&&Lb(this.Z);this.d=n};s.k=function(){R.e.k.call(this);this.d&&this.R();this.Z&&(this.Z.I(),delete this.Z);S(this,function(a){a.I()});!this.bb&&this.b&&lb(this.b);this.n=this.ia=this.b=this.q=this.m=k};s.qa=function(a,b){this.Fa(a,Yb(this),b)}; 'src="'+ua(this.Ta)+'"':"",document.write(ra(pc,a,b)),a=A(a)?document.getElementById(a):a),this.ma=a,this.Qb=j;G&&!oc&&(R(this.$,this.P,"load",this.hc),this.Ob=this.jb=m);this.ha?qc(this,rc(this),j):sc(this,this.ya.value);lc++}B(kc,Kb);kc.prototype.p=m;kc.prototype.qa=m;kc.prototype.na=k;var oc=G&&8<=document.documentMode||H&&J("1.9.2")||I&&J("532.1");u=kc.prototype;u.pa=k;u.g=function(){kc.d.g.call(this);this.$.M();this.J(m)};
s.Fa=function(a,b,c){a.d&&(c||!this.d)&&e(Error("Component already rendered"));(0>b||b>Yb(this))&&e(Error("Child component index out of bounds"));if(!this.q||!this.m)this.q={},this.m=[];a.getParent()==this?(this.q[Sb(a)]=a,D(this.m,a)):$a(this.q,Sb(a),a);Vb(a,this);va(this.m,b,0,a);a.d&&this.d&&a.getParent()==this?(c=this.s(),c.insertBefore(a.a(),c.childNodes[b]||k)):c?(this.b||this.i(),b=T(this,b+1),Xb(a,this.s(),b?b.b:k)):this.d&&!a.d&&a.b&&a.r()};s.s=p("b"); u.J=function(a){if(a!=this.p)if(G&&!oc&&!this.jb)this.Ob=a;else if(a)if(Za?R(this.$,this.P.document,tc,this.lc):H&&R(this.$,this.P,"pageshow",this.jc),oc&&this.ha)R(this.$,this.P,"hashchange",this.ic),this.p=j,this.dispatchEvent(new jc(rc(this)));else{if(!G||this.jb)R(this.$,this.l,Nb,ma(this.Cb,this,j)),this.p=j,G||(this.na=rc(this)),this.l.start(),this.dispatchEvent(new jc(rc(this)))}else this.p=m,ic(this.$),this.l.stop()};u.hc=function(){this.jb=j;this.ya.value&&sc(this,this.ya.value,j);this.J(this.Ob)};
function Zb(a){if(a.ka==k){var b;a:{b=a.d?a.b:a.B.A.body;var c=eb(b);if(c.defaultView&&c.defaultView.getComputedStyle&&(b=c.defaultView.getComputedStyle(b,k))){b=b.direction||b.getPropertyValue("direction");break a}b=""}a.ka="rtl"==(b||((a.d?a.b:a.B.A.body).currentStyle?(a.d?a.b:a.B.A.body).currentStyle.direction:k)||(a.d?a.b:a.B.A.body).style&&(a.d?a.b:a.B.A.body).style.direction)}return a.ka}s.na=function(a){this.d&&e(Error("Component already rendered"));this.ka=a}; u.jc=function(a){a.H.persisted&&(this.J(m),this.J(j))};u.ic=function(){var a=uc(this.P);a!=this.na&&vc(this,a)};function rc(a){return a.pa!=k?a.pa:a.ha?uc(a.P):wc(a)||""}function uc(a){var a=a.location.href,b=a.indexOf("#");return 0>b?"":a.substring(b+1)}function qc(a,b,c){var d=a.P.location,a=a.Tb,e=-1!=d.href.indexOf("#");if(G||e||b)a+="#"+b;a!=d.href&&(c?d.replace(a):d.href=a)}
function Yb(a){return a.m?a.m.length:0}function Wb(a,b){return a.q&&b?(b in a.q?a.q[b]:h)||k:k}function T(a,b){return a.m?a.m[b]||k:k}function S(a,b,c){a.m&&C(a.m,b,c)}function $b(a,b){return a.m&&b?na(a.m,b):-1}s.removeChild=function(a,b){if(a){var c=w(a)?a:Sb(a),a=Wb(this,c);if(c&&a){var d=this.q;c in d&&delete d[c];D(this.m,a);b&&(a.R(),a.b&&lb(a.b));Vb(a,k)}}a||e(Error("Child is not in parent component"));return a};function ac(a,b){a&&bc(this,a,b)}A(ac,Mb);s=ac.prototype;s.b=k;s.za=k;s.Na=k;s.Aa=k;s.O=-1;s.N=-1; function sc(a,b,c,d){if(a.Qb||b!=wc(a))if(a.Qb=m,b=""+b,b=!ta.test(b)?encodeURIComponent(b):b,G){var e=a.ma.contentDocument||a.ma.contentWindow.document;e.open("text/html",c?"replace":i);e.write(ra(xc,ua(d||a.P.document.title),b));e.close()}else if(d=a.Ta+"#"+b,a=a.ma.contentWindow)c?a.location.replace(d):a.location.href=d}
var cc={3:13,12:144,63232:38,63233:40,63234:37,63235:39,63236:112,63237:113,63238:114,63239:115,63240:116,63241:117,63242:118,63243:119,63244:120,63245:121,63246:122,63247:123,63248:44,63272:46,63273:36,63275:35,63276:33,63277:34,63289:144,63302:45},dc={Up:38,Down:40,Left:37,Right:39,Enter:13,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,"U+007F":46,Home:36,End:35,PageUp:33,PageDown:34,Insert:45},ec={61:187,59:186},fc=E||G&&H("525");s=ac.prototype; function wc(a){if(G)return a=a.ma.contentDocument||a.ma.contentWindow.document,a.body?decodeURIComponent(a.body.innerHTML.replace(/\+/g," ")):k;var b=a.ma.contentWindow;if(b){var c;try{c=decodeURIComponent(uc(b).replace(/\+/g," "))}catch(d){return a.qa||(a.qa!=j&&a.l.setInterval(yc),a.qa=j),k}a.qa&&(a.qa!=m&&a.l.setInterval(nc),a.qa=m);return c||k}return k}
s.kb=function(a){if(G&&(17==this.O&&!a.ctrlKey||18==this.O&&!a.altKey))this.N=this.O=-1;fc&&!Sa(a.keyCode,this.O,a.shiftKey,a.ctrlKey,a.altKey)?this.handleEvent(a):this.N=F&&a.keyCode in ec?ec[a.keyCode]:a.keyCode};s.lb=function(){this.N=this.O=-1}; u.Cb=function(){if(this.ha){var a=uc(this.P);a!=this.na&&vc(this,a)}if(!this.ha||G&&!oc)if(a=wc(this)||"",this.pa==k||a==this.pa)this.pa=k,a!=this.na&&vc(this,a)};function vc(a,b){a.na=a.ya.value=b;a.ha?(G&&!oc&&sc(a,b),qc(a,b)):sc(a,b);a.dispatchEvent(new jc(rc(a)))}u.lc=function(){this.l.stop();this.l.start()};
s.handleEvent=function(a){var b=a.J,c,d;E&&"keypress"==a.type?(c=this.N,d=13!=c&&27!=c?b.keyCode:0):G&&"keypress"==a.type?(c=this.N,d=0<=b.charCode&&63232>b.charCode&&Ta(c)?b.charCode:0):Ea?(c=this.N,d=Ta(c)?b.keyCode:0):(c=b.keyCode||this.N,d=b.charCode||0,Ga&&63==d&&!c&&(c=191));var g=c,f=b.keyIdentifier;c?63232<=c&&c in cc?g=cc[c]:25==c&&a.shiftKey&&(g=9):f&&f in dc&&(g=dc[f]);a=g==this.O;this.O=g;b=new gc(g,d,a,b);try{this.dispatchEvent(b)}finally{b.I()}};s.a=p("b"); var tc=["mousedown","keydown","mousemove"],xc="<title>%s</title><body>%s</body>",pc='<iframe id="%s" style="display:none" %s></iframe>',mc='<input type="text" name="%s" id="%s" style="display:none">',lc=0,nc=150,yc=1E4;function zc(){return j};/*
function bc(a,b,c){a.Aa&&a.detach();a.b=b;a.za=N(a.b,"keypress",a,c);a.Na=N(a.b,"keydown",a.kb,c,a);a.Aa=N(a.b,"keyup",a.lb,c,a)}s.detach=function(){this.za&&(O(this.za),O(this.Na),O(this.Aa),this.Aa=this.Na=this.za=k);this.b=k;this.N=this.O=-1};s.k=function(){ac.e.k.call(this);this.detach()};function gc(a,b,c,d){d&&this.ha(d,h);this.type="key";this.keyCode=a;this.charCode=b;this.repeat=c}A(gc,J);function hc(a,b){a.setAttribute("role",b);a.tb=b};function U(){}var ic;u(U);s=U.prototype;s.i=function(a){var b=a.ua().i("div",this.Ja(a).join(" "),a.w);jc(a,b);return b};s.s=function(a){return a};s.Q=function(a,b,c){if(a=a.a?a.a():a)if(E&&!H("7")){var d=kc(Wa(a),b);d.push(b);fa(c?Xa:Ya,a).apply(k,d)}else c?Xa(a,b):Ya(a,b)};s.D=q(j); Portions of this code are from the Dojo Toolkit, received by
s.P=function(a,b){b.id&&Tb(a,b.id);var c=this.s(b);c&&c.firstChild?lc(a,c.firstChild.nextSibling?ua(c.childNodes):c.firstChild):a.w=k;var d=0,g=this.t(),f=this.t(),i=n,l=n,c=n,m=Wa(b);C(m,function(a){if(!i&&a==g)i=j,f==g&&(l=j);else if(!l&&a==f)l=j;else{var b=d;if(!this.ab){this.sa||mc(this);var c=this.sa,m={},o;for(o in c)m[c[o]]=o;this.ab=m}a=parseInt(this.ab[a],10);d=b|(isNaN(a)?0:a)}},this);a.f=d;i||(m.push(g),f==g&&(l=j));l||m.push(f);var o=a.C;o&&m.push.apply(m,o);if(E&&!H("7")){var z=kc(m); The Closure Library Authors under the BSD license. All other code is
0<z.length&&(m.push.apply(m,z),c=j)}if(!i||!l||o||c)b.className=m.join(" ");jc(a,b);return b};s.ya=function(a){Zb(a)&&this.na(a.a(),j);a.isEnabled()&&this.ca(a,a.h)};function jc(a,b){a.isEnabled()||V(b,1,j);a.f&8&&V(b,8,j);a.o&16&&V(b,16,!!(a.f&16));a.o&64&&V(b,64,!!(a.f&64))}s.la=function(a,b){Ob(a,!b,!E&&!Ea)};s.na=function(a,b){this.Q(a,this.t()+"-rtl",b)};s.S=function(a){var b;return a.o&32&&(b=a.j())?ob(b):n}; Copyright 2005-2009 The Closure Library Authors. All Rights Reserved.
s.ca=function(a,b){var c;if(a.o&32&&(c=a.j())){if(!b&&a.f&32){try{c.blur()}catch(d){}a.f&32&&a.ea(k)}ob(c)!=b&&(b?c.tabIndex=0:(c.tabIndex=-1,c.removeAttribute("tabIndex")))}};s.Y=function(a,b){a.style.display=b?"":"none"};s.p=function(a,b,c){var d=a.a();if(d){var g=nc(this,b);g&&this.Q(a,g,c);V(d,b,c)}};function V(a,b,c){ic||(ic={1:"disabled",8:"selected",16:"checked",64:"expanded"});(b=ic[b])&&a.setAttribute("aria-"+b,c)}
s.K=function(a,b){var c=this.s(a);if(c&&(kb(c),b))if(w(b))nb(c,b);else{var d=function(a){if(a){var b=eb(c);c.appendChild(w(a)?b.createTextNode(a):a)}};v(b)?C(b,d):ba(b)&&!("nodeType"in b)?C(ua(b),d):d(b)}};s.j=function(a){return a.a()};s.t=q("goog-control");s.Ja=function(a){var b=this.t(),c=[b],d=this.t();d!=b&&c.push(d);b=a.f;for(d=[];b;){var g=b&-b;d.push(nc(this,g));b&=~g}c.push.apply(c,d);(a=a.C)&&c.push.apply(c,a);E&&!H("7")&&c.push.apply(c,kc(c));return c}; The "New" BSD License:
function kc(a,b){var c=[];b&&(a=a.concat([b]));C([],function(d){ra(d,fa(sa,a))&&(!b||sa(d,b))&&c.push(d.join("_"))});return c}function nc(a,b){a.sa||mc(a);return a.sa[b]}function mc(a){var b=a.t();a.sa={1:b+"-disabled",2:b+"-hover",4:b+"-active",8:b+"-selected",16:b+"-checked",32:b+"-focused",64:b+"-open"}};function oc(a,b){a||e(Error("Invalid class name "+a));x(b)||e(Error("Invalid decorator function "+b));pc[a]=b}var qc={},pc={};function W(a,b,c){R.call(this,c);if(!b){for(var b=this.constructor,d;b;){d=y(b);if(d=qc[d])break;b=b.e?b.e.constructor:k}b=d?x(d.F)?d.F():new d:k}this.c=b;this.w=a}A(W,R);s=W.prototype;s.w=k;s.f=0;s.o=39;s.da=255;s.pa=0;s.h=j;s.C=k;s.fa=j;s.ra=n;s.Za=k;s.j=function(){return this.c.j(this)};s.va=function(){return this.u||(this.u=new ac)};s.Q=function(a,b){b?a&&(this.C?sa(this.C,a)||this.C.push(a):this.C=[a],this.c.Q(this,a,j)):a&&this.C&&(D(this.C,a),0==this.C.length&&(this.C=k),this.c.Q(this,a,n))};
s.i=function(){var a=this.c.i(this);this.b=a;var b=this.Za||h;b&&hc(a,b);this.ra||this.c.la(a,n);this.h||this.c.Y(a,n)};s.s=function(){return this.c.s(this.a())};s.D=function(a){return this.c.D(a)};s.Ga=function(a){this.b=a=this.c.P(this,a);var b=this.Za||h;b&&hc(a,b);this.ra||this.c.la(a,n);this.h="none"!=a.style.display}; Copyright (c) 2005-2009, The Dojo Foundation
s.r=function(){W.e.r.call(this);this.c.ya(this);if(this.o&-2&&(this.fa&&rc(this,j),this.o&32)){var a=this.j();if(a){var b=this.va();bc(b,a);P(P(P(Ub(this),b,"key",this.M),a,"focus",this.wa),a,"blur",this.ea)}}};function rc(a,b){var c=Ub(a),d=a.a();b?(P(P(P(P(c,d,"mouseover",a.Ma),d,"mousedown",a.$),d,"mouseup",a.ga),d,"mouseout",a.La),E&&P(c,d,"dblclick",a.Ua)):(Q(Q(Q(Q(c,d,"mouseover",a.Ma),d,"mousedown",a.$),d,"mouseup",a.ga),d,"mouseout",a.La),E&&Q(c,d,"dblclick",a.Ua))} All rights reserved.
s.R=function(){W.e.R.call(this);this.u&&this.u.detach();this.h&&this.isEnabled()&&this.c.ca(this,n)};s.k=function(){W.e.k.call(this);this.u&&(this.u.I(),delete this.u);delete this.c;this.C=this.w=k};s.K=function(a){this.c.K(this.a(),a);this.w=a};function lc(a,b){a.w=b}s.na=function(a){W.e.na.call(this,a);var b=this.a();b&&this.c.na(b,a)};s.la=function(a){this.ra=a;var b=this.a();b&&this.c.la(b,a)};
s.Y=function(a,b){if(b||this.h!=a&&this.dispatchEvent(a?"show":"hide")){var c=this.a();c&&this.c.Y(c,a);this.isEnabled()&&this.c.ca(this,a);this.h=a;return j}return n};s.isEnabled=function(){return!(this.f&1)};s.ma=function(a){var b=this.getParent();if((!b||"function"!=typeof b.isEnabled||b.isEnabled())&&X(this,1,!a))a||(this.setActive(n),this.G(n)),this.h&&this.c.ca(this,a),this.p(1,!a)};s.G=function(a){X(this,2,a)&&this.p(2,a)};s.setActive=function(a){X(this,4,a)&&this.p(4,a)}; Redistribution and use in source and binary forms, with or without
s.oa=function(a){X(this,8,a)&&this.p(8,a)};function sc(a,b){X(a,16,b)&&a.p(16,b)}s.Ea=function(a){X(this,32,a)&&this.p(32,a)};function tc(a,b){X(a,64,b)&&a.p(64,b)}s.p=function(a,b){this.o&a&&b!=!!(this.f&a)&&(this.c.p(this,a,b),this.f=b?this.f|a:this.f&~a)};function uc(a,b,c){a.d&&a.f&b&&!c&&e(Error("Component already rendered"));!c&&a.f&b&&a.p(b,n);a.o=c?a.o|b:a.o&~b}function Y(a,b){return!!(a.da&b)&&!!(a.o&b)} modification, are permitted provided that the following conditions are met:
function X(a,b,c){return!!(a.o&b)&&!!(a.f&b)!=c&&(!(a.pa&b)||a.dispatchEvent(Rb(b,c)))&&!a.Ha}s.Ma=function(a){(!a.relatedTarget||!mb(this.a(),a.relatedTarget))&&this.dispatchEvent("enter")&&this.isEnabled()&&Y(this,2)&&this.G(j)};s.La=function(a){if((!a.relatedTarget||!mb(this.a(),a.relatedTarget))&&this.dispatchEvent("leave"))Y(this,4)&&this.setActive(n),Y(this,2)&&this.G(n)};
s.$=function(a){if(this.isEnabled()&&(Y(this,2)&&this.G(j),wb(a)&&(!G||!Ga||!a.ctrlKey)))Y(this,4)&&this.setActive(j),this.c.S(this)&&this.j().focus();!this.ra&&wb(a)&&(!G||!Ga||!a.ctrlKey)&&a.preventDefault()};s.ga=function(a){this.isEnabled()&&(Y(this,2)&&this.G(j),this.f&4&&vc(this,a)&&Y(this,4)&&this.setActive(n))};s.Ua=function(a){this.isEnabled()&&vc(this,a)}; Redistributions of source code must retain the above copyright notice, this
function vc(a,b){Y(a,16)&&sc(a,!(a.f&16));Y(a,8)&&a.oa(j);Y(a,64)&&tc(a,!(a.f&64));var c=new I("action",a);b&&(c.altKey=b.altKey,c.ctrlKey=b.ctrlKey,c.metaKey=b.metaKey,c.shiftKey=b.shiftKey,c.Pa=b.Pa);return a.dispatchEvent(c)}s.wa=function(){Y(this,32)&&this.Ea(j)};s.ea=function(){Y(this,4)&&this.setActive(n);Y(this,32)&&this.Ea(n)};s.M=function(a){return this.h&&this.isEnabled()&&this.Ka(a)?(a.preventDefault(),a.stopPropagation(),j):n};s.Ka=function(a){return 13==a.keyCode&&vc(this,a)}; list of conditions and the following disclaimer.
x(W)||e(Error("Invalid component class "+W));x(U)||e(Error("Invalid renderer class "+U));var wc=y(W);qc[wc]=U;oc("goog-control",function(){return new W(k)});function xc(){this.Ya=yc.value;this.ta=n};E&&H(8);"ScriptEngine"in t&&"JScript"==t.ScriptEngine()&&(t.ScriptEngineMajorVersion(),t.ScriptEngineMinorVersion(),t.ScriptEngineBuildVersion());function zc(a){return"object"===typeof a&&a&&0===a.sb?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){return'<span class="number">'+zc(a.U)+'</span> <span class="word">'+(1<a.U?"items":"item")+"</span> left."}function Ec(a){return'<a href="#">Clear <span class="number-done">'+zc(a.U)+'</span> <span class="word-done">'+(1<a.U?"items":"item")+"</span></a>"};function Fc(){}A(Fc,U);u(Fc);Fc.prototype.i=function(a){var b='<span class="todo-clear">'+Ec({U:a.w})+"</span>",b=jb(b);jc(a,b);return b};Fc.prototype.D=q(n);Fc.prototype.K=function(a,b){a.innerHTML=Ec({U:b})};Fc.prototype.p=function(a,b,c){(a=a.a())&&V(a,b,c)};function Gc(){}A(Gc,U);u(Gc);Gc.prototype.i=function(a){var b='<span class="todo-count">'+Dc({U:a.w})+"</span>",b=jb(b);jc(a,b);return b};Gc.prototype.D=q(n);Gc.prototype.K=function(a,b){a.innerHTML=Dc({U:b})};Gc.prototype.p=function(a,b,c){(a=a.a())&&V(a,b,c)};function Hc(){}A(Hc,U);u(Hc);Hc.prototype.i=function(a){var b='<li><div><div class="display"><input class="check" type="checkbox" /><div class="todo-content" style="cursor: pointer;">'+zc(a.w)+'</div><span class="todo-destroy"></span></div><div class="edit"><input class="todo-input" type="text"/></div></div></li>',b=jb(b);jc(a,b);return b}; Redistributions in binary form must reproduce the above copyright notice,
Hc.prototype.p=function(a,b,c){var d=a.a();if(d){switch(b){case 16:this.Q(a,"done",c);(d?Ic(d).childNodes[0]:k).checked=c;break;case 8:this.Q(a,"editing",c)}V(d,b,c)}};Hc.prototype.j=function(a){return Jc(a.a())};function Ic(a){return a?a.childNodes[0].childNodes[0]:k}Hc.prototype.s=function(a){return a?Ic(a).childNodes[1]:k};function Jc(a){return a?a.childNodes[0].childNodes[1].childNodes[0]:k};function Z(a){W.call(this,"",Hc.F(),a);uc(this,16,j);uc(this,8,j);this.da&=-17;this.da&=-9;this.la(j)}A(Z,W);Z.prototype.r=function(){Z.e.r.call(this);P(Ub(this),this.a(),"click",function(a){a.preventDefault()})};Z.prototype.ga=function(a){Z.e.ga.call(this,a);this.isEnabled()&&(a.target===(this.a()?Ic(this.a()).childNodes[0]:k)?(sc(this,!(this.f&16)),this.dispatchEvent("edit")):a.target===(this.a()?Ic(this.a()).childNodes[2]:k)?this.dispatchEvent("destroy"):this.f&8||this.oa(j))}; this list of conditions and the following disclaimer in the documentation
Z.prototype.Ea=function(a){Z.e.Ea.call(this,a);!a&&this.f&8&&(this.K(Jc(this.a()).value),this.oa(n),this.dispatchEvent("edit"))};Z.prototype.oa=function(a){Z.e.oa.call(this,a);a&&(a=Jc(this.a()),a.value=this.w,a.focus())};function Kc(){}A(Kc,U);u(Kc);Kc.prototype.i=function(a){return a.ua().i("div",this.t())};Kc.prototype.P=function(a,b){b.id&&Tb(a,b.id);if("HR"==b.tagName){var c=b,b=this.i(a);c.parentNode&&c.parentNode.insertBefore(b,c);lb(c)}else Xa(b,this.t());return b};Kc.prototype.K=function(){};Kc.prototype.t=q("goog-menuseparator");function Lc(a,b){W.call(this,k,a||Kc.F(),b);uc(this,1,n);uc(this,2,n);uc(this,4,n);uc(this,32,n);this.f=1}A(Lc,W);Lc.prototype.r=function(){Lc.e.r.call(this);hc(this.a(),"separator")};oc("goog-menuseparator",function(){return new Lc});function Mc(){}u(Mc);function Nc(a,b){a&&(a.tabIndex=b?0:-1)}s=Mc.prototype;s.i=function(a){return a.ua().i("div",this.Ja(a).join(" "))};s.s=function(a){return a};s.D=function(a){return"DIV"==a.tagName};s.P=function(a,b){b.id&&Tb(a,b.id);var c=this.t(),d=n,g=Wa(b);g&&C(g,function(b){b==c?d=j:b&&(b==c+"-disabled"?a.ma(n):b==c+"-horizontal"?Oc(a,Pc):b==c+"-vertical"&&Oc(a,Qc))},this);d||Xa(b,c);Rc(a,this.s(b));return b}; and/or other materials provided with the distribution.
function Rc(a,b){if(b)for(var c=b.firstChild,d;c&&c.parentNode==b;){d=c.nextSibling;if(1==c.nodeType){var g;a:{g=h;for(var f=Wa(c),i=0,l=f.length;i<l;i++)if(g=f[i]in pc?pc[f[i]]():k)break a;g=k}g&&(g.b=c,a.isEnabled()||g.ma(n),a.qa(g),g.P(c))}else(!c.nodeValue||""==ga(c.nodeValue))&&b.removeChild(c);c=d}}s.ya=function(a){a=a.a();Ob(a,j,F);E&&(a.hideFocus=j)};s.j=function(a){return a.a()};s.t=q("goog-container"); Neither the name of the Dojo Foundation nor the names of its contributors
s.Ja=function(a){var b=this.t(),c=[b,a.V==Pc?b+"-horizontal":b+"-vertical"];a.isEnabled()||c.push(b+"-disabled");return c};function $(a,b,c){R.call(this,c);this.c=b||Mc.F();this.V=a||Qc}A($,R);var Pc="horizontal",Qc="vertical";s=$.prototype;s.Oa=k;s.u=k;s.c=k;s.V=k;s.h=j;s.L=j;s.Ia=j;s.l=-1;s.g=k;s.T=n;s.Ra=n;s.rb=j;s.H=k;s.j=function(){return this.Oa||this.c.j(this)};s.va=function(){return this.u||(this.u=new ac(this.j()))};s.i=function(){this.b=this.c.i(this)};s.s=function(){return this.c.s(this.a())};s.D=function(a){return this.c.D(a)};s.Ga=function(a){this.b=this.c.P(this,a);"none"==a.style.display&&(this.h=n)}; may be used to endorse or promote products derived from this software
s.r=function(){$.e.r.call(this);S(this,function(a){a.d&&Sc(this,a)},this);var a=this.a();this.c.ya(this);this.Y(this.h,j);P(P(P(P(P(P(P(P(Ub(this),this,"enter",this.ib),this,"highlight",this.jb),this,"unhighlight",this.nb),this,"open",this.mb),this,"close",this.gb),a,"mousedown",this.$),eb(a),"mouseup",this.hb),a,["mousedown","mouseup","mouseover","mouseout"],this.fb);this.S()&&Tc(this,j)}; without specific prior written permission.
function Tc(a,b){var c=Ub(a),d=a.j();b?P(P(P(c,d,"focus",a.wa),d,"blur",a.ea),a.va(),"key",a.M):Q(Q(Q(c,d,"focus",a.wa),d,"blur",a.ea),a.va(),"key",a.M)}s.R=function(){Uc(this,-1);this.g&&tc(this.g,n);this.T=n;$.e.R.call(this)};s.k=function(){$.e.k.call(this);this.u&&(this.u.I(),this.u=k);this.c=this.g=this.H=this.Oa=k};s.ib=q(j);
s.jb=function(a){var b=$b(this,a.target);if(-1<b&&b!=this.l){var c=T(this,this.l);c&&c.G(n);this.l=b;c=T(this,this.l);this.T&&c.setActive(j);this.rb&&this.g&&c!=this.g&&(c.o&64?tc(c,j):tc(this.g,n))}this.a().setAttribute("aria-activedescendant",a.target.a().id)};s.nb=function(a){a.target==T(this,this.l)&&(this.l=-1);this.a().setAttribute("aria-activedescendant","")};s.mb=function(a){if((a=a.target)&&a!=this.g&&a.getParent()==this)this.g&&tc(this.g,n),this.g=a}; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
s.gb=function(a){a.target==this.g&&(this.g=k)};s.$=function(a){this.L&&(this.T=j);var b=this.j();b&&ob(b)?b.focus():a.preventDefault()};s.hb=function(){this.T=n};s.fb=function(a){var b;a:{b=a.target;if(this.H)for(var c=this.a();b&&b!==c;){var d=b.id;if(d in this.H){b=this.H[d];break a}b=b.parentNode}b=k}if(b)switch(a.type){case "mousedown":b.$(a);break;case "mouseup":b.ga(a);break;case "mouseover":b.Ma(a);break;case "mouseout":b.La(a)}};s.wa=function(){}; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
s.ea=function(){Uc(this,-1);this.T=n;this.g&&tc(this.g,n)};s.M=function(a){return this.isEnabled()&&this.h&&(0!=Yb(this)||this.Oa)&&this.Ka(a)?(a.preventDefault(),a.stopPropagation(),j):n}; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
s.Ka=function(a){var b=T(this,this.l);if(b&&"function"==typeof b.M&&b.M(a)||this.g&&this.g!=b&&"function"==typeof this.g.M&&this.g.M(a))return j;if(a.shiftKey||a.ctrlKey||a.metaKey||a.altKey)return n;switch(a.keyCode){case 27:if(this.S())this.j().blur();else return n;break;case 36:Vc(this);break;case 35:Wc(this);break;case 38:if(this.V==Qc)Xc(this);else return n;break;case 37:if(this.V==Pc)Zb(this)?Yc(this):Xc(this);else return n;break;case 40:if(this.V==Qc)Yc(this);else return n;break;case 39:if(this.V== DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
Pc)Zb(this)?Xc(this):Yc(this);else return n;break;default:return n}return j};function Sc(a,b){var c=b.a(),c=c.id||(c.id=Sb(b));a.H||(a.H={});a.H[c]=b}s.qa=function(a,b){$.e.qa.call(this,a,b)};s.Fa=function(a,b,c){a.pa|=2;a.pa|=64;(this.S()||!this.Ra)&&uc(a,32,n);a.d&&n!=a.fa&&rc(a,n);a.fa=n;$.e.Fa.call(this,a,b,c);a.d&&this.d&&Sc(this,a);b<=this.l&&this.l++}; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
s.removeChild=function(a,b){if(a=w(a)?Wb(this,a):a){var c=$b(this,a);-1!=c&&(c==this.l?a.G(n):c<this.l&&this.l--);var d=a.a();d&&d.id&&this.H&&(c=this.H,d=d.id,d in c&&delete c[d])}c=a=$.e.removeChild.call(this,a,b);c.d&&j!=c.fa&&rc(c,j);c.fa=j;return a};function Oc(a,b){a.a()&&e(Error("Component already rendered"));a.V=b} DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
s.Y=function(a,b){if(b||this.h!=a&&this.dispatchEvent(a?"show":"hide")){this.h=a;var c=this.a();c&&(c.style.display=a?"":"none",this.S()&&Nc(this.j(),this.L&&this.h),b||this.dispatchEvent(this.h?"aftershow":"afterhide"));return j}return n};s.isEnabled=p("L");s.ma=function(a){if(this.L!=a&&this.dispatchEvent(a?"enable":"disable"))a?(this.L=j,S(this,function(a){a.cb?delete a.cb:a.ma(j)})):(S(this,function(a){a.isEnabled()?a.ma(n):a.cb=j}),this.T=this.L=n),this.S()&&Nc(this.j(),a&&this.h)};s.S=p("Ia"); SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
s.ca=function(a){a!=this.Ia&&this.d&&Tc(this,a);this.Ia=a;this.L&&this.h&&Nc(this.j(),a)};function Uc(a,b){var c=T(a,b);c?c.G(j):-1<a.l&&T(a,a.l).G(n)}s.G=function(a){Uc(this,$b(this,a))};function Vc(a){Zc(a,function(a,c){return(a+1)%c},Yb(a)-1)}function Wc(a){Zc(a,function(a,c){a--;return 0>a?c-1:a},0)}function Yc(a){Zc(a,function(a,c){return(a+1)%c},a.l)}function Xc(a){Zc(a,function(a,c){a--;return 0>a?c-1:a},a.l)} CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
function Zc(a,b,c){for(var c=0>c?$b(a,a.g):c,d=Yb(a),c=b.call(a,c,d),g=0;g<=d;){var f=T(a,c);if(f&&f.h&&f.isEnabled()&&f.o&2){Uc(a,c);break}g++;c=b.call(a,c,d)}};function $c(){}A($c,Mc);u($c);$c.prototype.D=function(a){return"UL"==a.tagName};$c.prototype.ya=function(){};function ad(a){$.call(this,Qc,$c.F(),a);this.ca(n);this.Ra=j}A(ad,$);ad.prototype.$=function(){this.L&&(this.T=j)};var pa=[],bd=document.getElementById("todo-stats"),cd=new W(k,Gc.F());Xb(cd,bd);var dd=new W(k,Fc.F());Xb(dd,bd);N(dd,"action",function(){oa(function(a){a.ta&&(D(pa,a),S(ed,function(b){b.ia===a&&ed.removeChild(b,j)}))});fd()});function fd(){var a=qa(function(a,b){return b.ta?a+1:a}),b=pa.length-a;cd.K(b);cd.Y(0<b);dd.K(a);dd.Y(0<a)}fd();var ed=new ad;ed.P(document.getElementById("todo-list"));N(ed,"edit",function(a){var a=a.target,b=a.ia;b.Ya=a.w;b.ta=!!(a.f&16);fd()}); OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
N(ed,"destroy",function(a){a=a.target;D(pa,a.ia);ed.removeChild(a,j);fd()});var yc=document.getElementById("new-todo");N(yc,"keyup",function(a){if(13===a.keyCode){var a=new xc,b=new Z;pa.push(a);b.K(a.Ya);sc(b,a.ta);b.ia=a;ed.qa(b,j);yc.value="";fd()}});})(); OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
var Ac=function(){function a(a,c){if(!a)return[];if(a.constructor==Array)return a;if(!A(a))return[a];if(A(c)&&(c=A(c)?document.getElementById(c):c,!c))return[];var c=c||document,e=c.ownerDocument||c.documentElement;Ba=c.contentType&&"application/xml"==c.contentType||Za&&(c.doctype||"[object XMLDocument]"==e.toString())||!!e&&(G?e.xml:c.xmlVersion||e.xmlVersion);return(e=d(a)(c))&&e.$a?e:b(e)}function b(a){if(a&&a.$a)return a;var b=[];if(!a||!a.length)return b;a[0]&&b.push(a[0]);if(2>a.length)return b;
ca++;if(G&&Ba){var c=ca+"";a[0].setAttribute("_zipIdx",c);for(var d=1,e;e=a[d];d++)a[d].getAttribute("_zipIdx")!=c&&b.push(e),e.setAttribute("_zipIdx",c)}else if(G&&a.Ub)try{for(d=1;e=a[d];d++)ib(e)&&b.push(e)}catch(g){}else{a[0]&&(a[0]._zipIdx=ca);for(d=1;e=a[d];d++)a[d]._zipIdx!=ca&&b.push(e),e._zipIdx=ca}return b}function c(a,b){if(!b)return 1;var c=ke(a);return!b[c]?b[c]=1:0}function d(a,b){if(Yc){var c=Zc[a];if(c&&!b)return c}if(c=$c[a])return c;var c=a.charAt(0),g=-1==a.indexOf(" ");0<=a.indexOf("#")&&
g&&(b=j);if(Yc&&!b&&-1==">~+".indexOf(c)&&(!G||-1==a.indexOf(":"))&&!(ad&&0<=a.indexOf("."))&&-1==a.indexOf(":contains")&&-1==a.indexOf("|=")){var h=0<=">~+".indexOf(a.charAt(a.length-1))?a+" *":a;return Zc[a]=function(b){try{9==b.nodeType||g||f("");var c=b.querySelectorAll(h);G?c.Ub=j:c.$a=j;return c}catch(e){return d(a,j)(b)}}}var l=a.split(/\s*,\s*/);return $c[a]=2>l.length?e(a):function(a){for(var b=0,c=[],d;d=l[b++];)c=c.concat(e(d)(a));return c}}function e(a){var b=bd(sa(a));if(1==b.length){var c=
g(b[0]);return function(a){if(a=c(a,[]))a.$a=j;return a}}return function(a){for(var a=Ra(a),c,d,e=b.length,Xc,h,Ub=0;Ub<e;Ub++){h=[];c=b[Ub];d=a.length-1;0<d&&(Xc={},h.$a=j);d=g(c);for(var l=0;c=a[l];l++)d(c,h,Xc);if(!h.length)break;a=h}return h}}function g(a){var b=cd[a.ra];if(b)return b;var c=a.Gb,c=c?c.ab:"",d=o(a,{ja:1}),e="*"==a.t,g=document.getElementsByClassName;if(c)g={ja:1},e&&(g.t=1),d=o(a,g),"+"==c?b=n(d):"~"==c?b=l(d):">"==c&&(b=h(d));else if(a.id)d=!a.Ib&&e?zc:o(a,{ja:1,id:1}),b=function(b,
c){var e=Tb(b).a(a.id),g;if(g=e&&d(e))if(!(g=9==b.nodeType)){for(g=e.parentNode;g&&!(g==b);)g=g.parentNode;g=!!g}if(g)return Ra(e,c)};else if(g&&/\{\s*\[native code\]\s*\}/.test(""+g)&&a.R.length&&!ad)var d=o(a,{ja:1,R:1,id:1}),q=a.R.join(" "),b=function(a,b){for(var c=Ra(0,b),e,g=0,h=a.getElementsByClassName(q);e=h[g++];)d(e,a)&&c.push(e);return c};else!e&&!a.Ib?b=function(b,c){for(var d=Ra(0,c),e,g=0,h=b.getElementsByTagName(a.mb());e=h[g++];)d.push(e);return d}:(d=o(a,{ja:1,t:1,id:1}),b=function(b,
c){for(var e=Ra(0,c),g,h=0,je=b.getElementsByTagName(a.mb());g=je[h++];)d(g,b)&&e.push(g);return e});return cd[a.ra]=b}function h(a){a=a||zc;return function(b,d,e){for(var g=0,h=b[dd];b=h[g++];)Sa(b)&&(!e||c(b,e))&&a(b,g)&&d.push(b);return d}}function l(a){return function(b,d,e){for(b=b[Ta];b;){if(Sa(b)){if(e&&!c(b,e))break;a(b)&&d.push(b)}b=b[Ta]}return d}}function n(a){return function(b,d,e){for(;b=b[Ta];)if(!jb||ib(b)){(!e||c(b,e))&&a(b)&&d.push(b);break}return d}}function o(a,b){if(!a)return zc;
var b=b||{},c=k;b.ja||(c=Ca(c,ib));b.t||"*"!=a.t&&(c=Ca(c,function(b){return b&&b.tagName==a.mb()}));b.R||D(a.R,function(a,b){var d=RegExp("(?:^|\\s)"+a+"(?:\\s|$)");c=Ca(c,function(a){return d.test(a.className)});c.count=b});b.fa||D(a.fa,function(a){var b=a.name;Vb[b]&&(c=Ca(c,Vb[b](b,a.value)))});b.Na||D(a.Na,function(a){var b,d=a.fb;a.type&&ed[a.type]?b=ed[a.type](d,a.tb):d.length&&(b=le(d));b&&(c=Ca(c,b))});b.id||a.id&&(c=Ca(c,function(b){return!!b&&b.id==a.id}));c||"default"in b||(c=zc);return c}
function x(a){return L(a)%2}function q(a){return!(L(a)%2)}function L(a){var b=a.parentNode,c=0,d=b[dd],e=a._i||-1,g=b._l||-1;if(!d)return-1;d=d.length;if(g==d&&0<=e&&0<=g)return e;b._l=d;e=-1;for(b=b.firstElementChild||b.firstChild;b;b=b[Ta])Sa(b)&&(b._i=++c,a===b&&(e=c));return e}function t(a){for(;a=a[Ta];)if(Sa(a))return m;return j}function fd(a){for(;a=a[me];)if(Sa(a))return m;return j}function da(a,b){return!a?"":"class"==b?a.className||"":"for"==b?a.htmlFor||"":"style"==b?a.style.cssText||"":
(Ba?a.getAttribute(b):a.getAttribute(b,2))||""}function ib(a){return 1==a.nodeType}function Ca(a,b){return!a?b:!b?a:function(){return a.apply(window,arguments)&&b.apply(window,arguments)}}function bd(a){function b(){0<=q&&(r.id=c(q,w).replace(/\\/g,""),q=-1);if(0<=o){var a=o==w?k:c(o,w);0>">~+".indexOf(a)?r.t=a:r.ab=a;o=-1}0<=n&&(r.R.push(c(n+1,w).replace(/\\/g,"")),n=-1)}function c(b,d){return sa(a.slice(b,d))}for(var a=0<=">~+".indexOf(a.slice(-1))?a+" * ":a+" ",d=[],e=-1,g=-1,h=-1,l=-1,n=-1,q=
-1,o=-1,x="",t="",L,w=0,da=a.length,r=k,F=k;x=t,t=a.charAt(w),w<da;w++)if("\\"!=x)if(r||(L=w,r={ra:k,fa:[],Na:[],R:[],t:k,ab:k,id:k,mb:function(){return Ba?this.mc:this.t}},o=w),0<=e)if("]"==t){F.fb?F.tb=c(h||e+1,w):F.fb=c(e+1,w);if((e=F.tb)&&('"'==e.charAt(0)||"'"==e.charAt(0)))F.tb=e.slice(1,-1);r.Na.push(F);F=k;e=h=-1}else"="==t&&(h=0<="|~^$*".indexOf(x)?x:"",F.type=h+t,F.fb=c(e+1,w-h.length),h=w+1);else 0<=g?")"==t&&(0<=l&&(F.value=c(g+1,w)),l=g=-1):"#"==t?(b(),q=w+1):"."==t?(b(),n=w):":"==t?
(b(),l=w):"["==t?(b(),e=w,F={}):"("==t?(0<=l&&(F={name:c(l+1,w),value:k},r.fa.push(F)),g=w):" "==t&&x!=t&&(b(),0<=l&&r.fa.push({name:c(l+1,w)}),r.Ib=r.fa.length||r.Na.length||r.R.length,r.pc=r.ra=c(L,w),r.mc=r.t=r.ab?k:r.t||"*",r.t&&(r.t=r.t.toUpperCase()),d.length&&d[d.length-1].ab&&(r.Gb=d.pop(),r.ra=r.Gb.ra+" "+r.ra),d.push(r),r=k);return d}function Ra(a,b){var c=b||[];a&&c.push(a);return c}var ad=I&&"BackCompat"==document.compatMode,dd=document.firstChild.children?"children":"childNodes",Ba=m,
ed={"*=":function(a,b){return function(c){return 0<=da(c,a).indexOf(b)}},"^=":function(a,b){return function(c){return 0==da(c,a).indexOf(b)}},"$=":function(a,b){return function(c){c=" "+da(c,a);return c.lastIndexOf(b)==c.length-b.length}},"~=":function(a,b){var c=" "+b+" ";return function(b){return 0<=(" "+da(b,a)+" ").indexOf(c)}},"|=":function(a,b){b=" "+b;return function(c){c=" "+da(c,a);return c==b||0==c.indexOf(b+"-")}},"=":function(a,b){return function(c){return da(c,a)==b}}},jb="undefined"==
typeof document.firstChild.nextElementSibling,Ta=!jb?"nextElementSibling":"nextSibling",me=!jb?"previousElementSibling":"previousSibling",Sa=jb?ib:zc,Vb={checked:function(){return function(a){return a.checked||a.attributes.checked}},"first-child":function(){return fd},"last-child":function(){return t},"only-child":function(){return function(a){return!fd(a)||!t(a)?m:j}},empty:function(){return function(a){for(var b=a.childNodes,a=a.childNodes.length-1;0<=a;a--){var c=b[a].nodeType;if(1===c||3==c)return m}return j}},
contains:function(a,b){var c=b.charAt(0);if('"'==c||"'"==c)b=b.slice(1,-1);return function(a){return 0<=a.innerHTML.indexOf(b)}},not:function(a,b){var c=bd(b)[0],d={ja:1};"*"!=c.t&&(d.t=1);c.R.length||(d.R=1);var e=o(c,d);return function(a){return!e(a)}},"nth-child":function(a,b){if("odd"==b)return x;if("even"==b)return q;if(-1!=b.indexOf("n")){var c=b.split("n",2),d=c[0]?"-"==c[0]?-1:parseInt(c[0],10):1,e=c[1]?parseInt(c[1],10):0,g=0,h=-1;0<d?0>e?e=e%d&&d+e%d:0<e&&(e>=d&&(g=e-e%d),e%=d):0>d&&(d*=
-1,0<e&&(h=e,e%=d));if(0<d)return function(a){a=L(a);return a>=g&&(0>h||a<=h)&&a%d==e};b=e}var l=parseInt(b,10);return function(a){return L(a)==l}}},le=G?function(a){var b=a.toLowerCase();"class"==b&&(a="className");return function(c){return Ba?c.getAttribute(a):c[a]||c[b]}}:function(a){return function(b){return b&&b.getAttribute&&b.hasAttribute(a)}},cd={},$c={},Zc={},Yc=!!document.querySelectorAll&&(!I||J("526")),ca=0,ke=G?function(a){return Ba?a.getAttribute("_uid")||a.setAttribute("_uid",++ca)||
ca:a.uniqueID}:function(a){return a._uid||(a._uid=++ca)};a.fa=Vb;return a}();aa("goog.dom.query",Ac);aa("goog.dom.query.pseudos",Ac.fa);function Bc(a,b,c,d,e){if(!G&&(!I||!J("525")))return j;if(ab&&e)return Cc(a);if(e&&!d||!c&&(17==b||18==b)||G&&d&&b==a)return m;switch(a){case 13:return!(G&&mb());case 27:return!I}return Cc(a)}function Cc(a){if(48<=a&&57>=a||96<=a&&106>=a||65<=a&&90>=a||I&&0==a)return j;switch(a){case 32:case 63:case 107:case 109:case 110:case 111:case 186:case 59:case 189:case 187:case 188:case 190:case 191:case 192:case 222:case 219:case 220:case 221:return j;default:return m}};function Dc(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){}f(Error("Invalid JSON string: "+a))}function Ec(){this.cb=i}function Fc(a,b){var c=[];Gc(a,b,c);return c.join("")}
function Gc(a,b,c){switch(typeof b){case "string":Hc(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(z(b)){var d=b.length;c.push("[");for(var e="",g=0;g<d;g++)c.push(e),e=b[g],Gc(a,a.cb?a.cb.call(b,""+g,e):e,c),e=",";c.push("]");break}c.push("{");d="";for(g in b)Object.prototype.hasOwnProperty.call(b,g)&&(e=b[g],"function"!=typeof e&&(c.push(d),Hc(g,c),c.push(":"),
Gc(a,a.cb?a.cb.call(b,g,e):e,c),d=","));c.push("}");break;case "function":break;default:f(Error("Unknown type: "+typeof b))}}var Ic={'"':'\\"',"\\":"\\\\","/":"\\/","\u0008":"\\b","\u000c":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},Jc=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g;
function Hc(a,b){b.push('"',a.replace(Jc,function(a){if(a in Ic)return Ic[a];var b=a.charCodeAt(0),e="\\u";16>b?e+="000":256>b?e+="00":4096>b&&(e+="0");return Ic[a]=e+b.toString(16)}),'"')};function Kc(){};function Lc(a){this.Ba=a;this.Nb=new Ec}u=Lc.prototype;u.Ba=k;u.Nb=k;u.set=function(a,b){b!==i?this.Ba.set(a,Fc(this.Nb,b)):this.Ba.remove(a)};u.get=function(a){a=this.Ba.get(a);if(a!==k)try{return Dc(a)}catch(b){f("Storage: Invalid value was encountered")}};u.remove=function(a){this.Ba.remove(a)};function Mc(){}B(Mc,Kc);function Nc(a){this.K=a}B(Nc,Mc);Nc.prototype.set=function(a,b){try{this.K.setItem(a,b)}catch(c){f("Storage mechanism: Quota exceeded")}};Nc.prototype.get=function(a){a=this.K.getItem(a);if(A(a)||a===k)return a;f("Storage mechanism: Invalid value was encountered")};Nc.prototype.remove=function(a){this.K.removeItem(a)};function Oc(){var a=k;try{a=window.localStorage||k}catch(b){}this.K=a}B(Oc,Nc);function Pc(a,b){a.style.display=b?"":"none"}var Qc=H?"MozUserSelect":I?"WebkitUserSelect":k;function Rc(a,b,c){c=!c?a.getElementsByTagName("*"):k;if(Qc){if(b=b?"none":"",a.style[Qc]=b,c)for(var a=0,d;d=c[a];a++)d.style[Qc]=b}else if(G||Za)if(b=b?"on":"",a.setAttribute("unselectable",b),c)for(a=0;d=c[a];a++)d.setAttribute("unselectable",b)};function Sc(){}y(Sc);Sc.prototype.gc=0;Sc.N();function T(a){this.G=a||Tb();this.Da=Tc}B(T,Kb);T.prototype.ec=Sc.N();var Tc=k;function Uc(a,b){switch(a){case 1:return b?"disable":"enable";case 2:return b?"highlight":"unhighlight";case 4:return b?"activate":"deactivate";case 8:return b?"select":"unselect";case 16:return b?"check":"uncheck";case 32:return b?"focus":"blur";case 64:return b?"open":"close"}f(Error("Invalid component state"))}u=T.prototype;u.S=k;u.e=m;u.b=k;u.Da=k;u.Za=k;u.q=k;u.m=k;u.u=k;u.Rb=m;
u.o=function(){return this.S||(this.S=":"+(this.ec.gc++).toString(36))};u.Ga=function(a){if(this.q&&this.q.u){var b=this.q.u,c=this.S;c in b&&delete b[c];xb(this.q.u,a,this)}this.S=a};u.a=p("b");function Vc(a){return a.ka||(a.ka=new gc(a))}function Wc(a,b){a==b&&f(Error("Unable to set parent component"));b&&a.q&&a.S&&gd(a.q,a.S)&&a.q!=b&&f(Error("Unable to set parent component"));a.q=b;T.d.yb.call(a,b)}u.getParent=p("q");
u.yb=function(a){this.q&&this.q!=a&&f(Error("Method not supported"));T.d.yb.call(this,a)};u.Pa=p("G");u.j=function(){this.b=this.G.createElement("div")};function hd(a,b,c){a.e&&f(Error("Component already rendered"));a.b||a.j();b?b.insertBefore(a.b,c||k):a.G.F.body.appendChild(a.b);(!a.q||a.q.e)&&a.v()}u.Y=function(a){this.e&&f(Error("Component already rendered"));if(a&&this.L(a)){this.Rb=j;if(!this.G||this.G.F!=Q(a))this.G=Tb(a);this.hb(a);this.v()}else f(Error("Invalid element to decorate"))};
u.L=s(j);u.hb=function(a){this.b=a};u.v=function(){this.e=j;id(this,function(a){!a.e&&a.a()&&a.v()})};u.aa=function(){id(this,function(a){a.e&&a.aa()});this.ka&&ic(this.ka);this.e=m};u.g=function(){T.d.g.call(this);this.e&&this.aa();this.ka&&(this.ka.M(),delete this.ka);id(this,function(a){a.M()});!this.Rb&&this.b&&cc(this.b);this.q=this.Za=this.b=this.u=this.m=k};u.La=function(a,b){this.eb(a,jd(this),b)};
u.eb=function(a,b,c){a.e&&(c||!this.e)&&f(Error("Component already rendered"));(0>b||b>jd(this))&&f(Error("Child component index out of bounds"));if(!this.u||!this.m)this.u={},this.m=[];a.getParent()==this?(this.u[a.o()]=a,Ja(this.m,a)):xb(this.u,a.o(),a);Wc(a,this);Na(this.m,b,0,a);a.e&&this.e&&a.getParent()==this?(c=this.w(),c.insertBefore(a.a(),c.childNodes[b]||k)):c?(this.b||this.j(),b=U(this,b+1),hd(a,this.w(),b?b.b:k)):this.e&&!a.e&&a.b&&a.v()};u.w=p("b");
function kd(a){if(a.Da==k){var b;a:{b=a.e?a.b:a.G.F.body;var c=Q(b);if(c.defaultView&&c.defaultView.getComputedStyle&&(b=c.defaultView.getComputedStyle(b,k))){b=b.direction||b.getPropertyValue("direction");break a}b=""}a.Da="rtl"==(b||((a.e?a.b:a.G.F.body).currentStyle?(a.e?a.b:a.G.F.body).currentStyle.direction:k)||(a.e?a.b:a.G.F.body).style&&(a.e?a.b:a.G.F.body).style.direction)}return a.Da}u.Ha=function(a){this.e&&f(Error("Component already rendered"));this.Da=a};
function jd(a){return a.m?a.m.length:0}function gd(a,b){return a.u&&b?(b in a.u?a.u[b]:i)||k:k}function U(a,b){return a.m?a.m[b]||k:k}function id(a,b,c){a.m&&D(a.m,b,c)}function ld(a,b){return a.m&&b?Aa(a.m,b):-1}u.removeChild=function(a,b){if(a){var c=A(a)?a:a.o(),a=gd(this,c);if(c&&a){var d=this.u;c in d&&delete d[c];Ja(this.m,a);b&&(a.aa(),a.b&&cc(a.b));Wc(a,k)}}a||f(Error("Child is not in parent component"));return a};
u.Mb=function(a){for(;this.m&&0!=this.m.length;)this.removeChild(U(this,0),a)};function md(a,b){a&&nd(this,a,b)}B(md,Kb);u=md.prototype;u.b=k;u.Va=k;u.qb=k;u.Wa=k;u.X=-1;u.W=-1;
var od={3:13,12:144,63232:38,63233:40,63234:37,63235:39,63236:112,63237:113,63238:114,63239:115,63240:116,63241:117,63242:118,63243:119,63244:120,63245:121,63246:122,63247:123,63248:44,63272:46,63273:36,63275:35,63276:33,63277:34,63289:144,63302:45},pd={Up:38,Down:40,Left:37,Right:39,Enter:13,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,"U+007F":46,Home:36,End:35,PageUp:33,PageDown:34,Insert:45},qd={61:187,59:186},rd=G||I&&J("525");u=md.prototype;
u.ac=function(a){if(I&&(17==this.X&&!a.ctrlKey||18==this.X&&!a.altKey))this.W=this.X=-1;rd&&!Bc(a.keyCode,this.X,a.shiftKey,a.ctrlKey,a.altKey)?this.handleEvent(a):this.W=H&&a.keyCode in qd?qd[a.keyCode]:a.keyCode};u.bc=function(){this.W=this.X=-1};
u.handleEvent=function(a){var b=a.H,c,d;G&&"keypress"==a.type?(c=this.W,d=13!=c&&27!=c?b.keyCode:0):I&&"keypress"==a.type?(c=this.W,d=0<=b.charCode&&63232>b.charCode&&Cc(c)?b.charCode:0):Za?(c=this.W,d=Cc(c)?b.keyCode:0):(c=b.keyCode||this.W,d=b.charCode||0,ab&&63==d&&!c&&(c=191));var e=c,g=b.keyIdentifier;c?63232<=c&&c in od?e=od[c]:25==c&&a.shiftKey&&(e=9):g&&g in pd&&(e=pd[g]);a=e==this.X;this.X=e;b=new sd(e,d,a,b);try{this.dispatchEvent(b)}finally{b.M()}};u.a=p("b");
function nd(a,b,c){a.Wa&&a.detach();a.b=b;a.Va=O(a.b,"keypress",a,c);a.qb=O(a.b,"keydown",a.ac,c,a);a.Wa=O(a.b,"keyup",a.bc,c,a)}u.detach=function(){this.Va&&(P(this.Va),P(this.qb),P(this.Wa),this.Wa=this.qb=this.Va=k);this.b=k;this.W=this.X=-1};u.g=function(){md.d.g.call(this);this.detach()};function sd(a,b,c,d){d&&this.za(d,i);this.type="key";this.keyCode=a;this.charCode=b;this.repeat=c}B(sd,rb);function td(a,b){a.setAttribute("role",b);a.qc=b};function V(){}var ud;y(V);u=V.prototype;u.j=function(a){var b=a.Pa().j("div",this.lb(a).join(" "),a.C);vd(a,b);return b};u.w=function(a){return a};u.Z=function(a,b,c){if(a=a.a?a.a():a)if(G&&!J("7")){var d=wd(Qb(a),b);d.push(b);na(c?Rb:Sb,a).apply(k,d)}else c?Rb(a,b):Sb(a,b)};u.L=s(j);
u.Y=function(a,b){b.id&&a.Ga(b.id);var c=this.w(b);c&&c.firstChild?xd(a,c.firstChild.nextSibling?Ma(c.childNodes):c.firstChild):a.C=k;var d=0,e=this.z(),g=this.z(),h=m,l=m,c=m,n=Qb(b);D(n,function(a){if(!h&&a==e)h=j,g==e&&(l=j);else if(!l&&a==g)l=j;else{var b=d;if(!this.Pb){this.Oa||yd(this);var c=this.Oa,n={},o;for(o in c)n[c[o]]=o;this.Pb=n}a=parseInt(this.Pb[a],10);d=b|(isNaN(a)?0:a)}},this);a.f=d;h||(n.push(e),g==e&&(l=j));l||n.push(g);var o=a.I;o&&n.push.apply(n,o);if(G&&!J("7")){var x=wd(n);
0<x.length&&(n.push.apply(n,x),c=j)}if(!h||!l||o||c)b.className=n.join(" ");vd(a,b);return b};u.Ua=function(a){kd(a)&&this.Ha(a.a(),j);a.isEnabled()&&this.sa(a,a.i)};function vd(a,b){a.isEnabled()||zd(b,1,j);a.f&8&&zd(b,8,j);a.s&16&&zd(b,16,!!(a.f&16));a.s&64&&zd(b,64,!!(a.f&64))}u.Ea=function(a,b){Rc(a,!b,!G&&!Za)};u.Ha=function(a,b){this.Z(a,this.z()+"-rtl",b)};u.ba=function(a){var b;return a.s&32&&(b=a.k())?fc(b):m};
u.sa=function(a,b){var c;if(a.s&32&&(c=a.k())){if(!b&&a.f&32){try{c.blur()}catch(d){}a.f&32&&a.va(k)}fc(c)!=b&&(b?c.tabIndex=0:(c.tabIndex=-1,c.removeAttribute("tabIndex")))}};u.ta=function(a,b){Pc(a,b)};u.r=function(a,b,c){var d=a.a();if(d){var e=Ad(this,b);e&&this.Z(a,e,c);zd(d,b,c)}};function zd(a,b,c){ud||(ud={1:"disabled",8:"selected",16:"checked",64:"expanded"});(b=ud[b])&&a.setAttribute("aria-"+b,c)}
u.T=function(a,b){var c=this.w(a);if(c&&(bc(c),b))if(A(b))ec(c,b);else{var d=function(a){if(a){var b=Q(c);c.appendChild(A(a)?b.createTextNode(a):a)}};z(b)?D(b,d):ea(b)&&!("nodeType"in b)?D(Ma(b),d):d(b)}};u.k=function(a){return a.a()};u.z=s("goog-control");u.lb=function(a){var b=this.z(),c=[b],d=this.z();d!=b&&c.push(d);b=a.f;for(d=[];b;){var e=b&-b;d.push(Ad(this,e));b&=~e}c.push.apply(c,d);(a=a.I)&&c.push.apply(c,a);G&&!J("7")&&c.push.apply(c,wd(c));return c};
function wd(a,b){var c=[];b&&(a=a.concat([b]));D([],function(d){Fa(d,na(Ha,a))&&(!b||Ha(d,b))&&c.push(d.join("_"))});return c}function Ad(a,b){a.Oa||yd(a);return a.Oa[b]}function yd(a){var b=a.z();a.Oa={1:b+"-disabled",2:b+"-hover",4:b+"-active",8:b+"-selected",16:b+"-checked",32:b+"-focused",64:b+"-open"}};function Bd(a,b){a||f(Error("Invalid class name "+a));fa(b)||f(Error("Invalid decorator function "+b));Cd[a]=b}var Dd={},Cd={};function W(a,b,c){T.call(this,c);if(!b){for(var b=this.constructor,d;b;){d=ha(b);if(d=Dd[d])break;b=b.d?b.d.constructor:k}b=d?fa(d.N)?d.N():new d:k}this.c=b;this.C=a}B(W,T);u=W.prototype;u.C=k;u.f=0;u.s=39;u.ua=255;u.Ja=0;u.i=j;u.I=k;u.wa=j;u.Ma=m;u.Kb=k;u.k=function(){return this.c.k(this)};u.Qa=function(){return this.A||(this.A=new md)};
u.Z=function(a,b){b?a&&(this.I?Ha(this.I,a)||this.I.push(a):this.I=[a],this.c.Z(this,a,j)):a&&this.I&&(Ja(this.I,a),0==this.I.length&&(this.I=k),this.c.Z(this,a,m))};u.j=function(){var a=this.c.j(this);this.b=a;var b=this.Kb||i;b&&td(a,b);this.Ma||this.c.Ea(a,m);this.i||this.c.ta(a,m)};u.w=function(){return this.c.w(this.a())};u.L=function(a){return this.c.L(a)};u.hb=function(a){this.b=a=this.c.Y(this,a);var b=this.Kb||i;b&&td(a,b);this.Ma||this.c.Ea(a,m);this.i="none"!=a.style.display};
u.v=function(){W.d.v.call(this);this.c.Ua(this);if(this.s&-2&&(this.wa&&Ed(this,j),this.s&32)){var a=this.k();if(a){var b=this.Qa();nd(b,a);R(R(R(Vc(this),b,"key",this.U),a,"focus",this.Ra),a,"blur",this.va)}}};function Ed(a,b){var c=Vc(a),d=a.a();b?(R(R(R(R(c,d,"mouseover",a.pb),d,"mousedown",a.la),d,"mouseup",a.xa),d,"mouseout",a.ob),G&&R(c,d,"dblclick",a.Eb)):(S(S(S(S(c,d,"mouseover",a.pb),d,"mousedown",a.la),d,"mouseup",a.xa),d,"mouseout",a.ob),G&&S(c,d,"dblclick",a.Eb))}
u.aa=function(){W.d.aa.call(this);this.A&&this.A.detach();this.i&&this.isEnabled()&&this.c.sa(this,m)};u.g=function(){W.d.g.call(this);this.A&&(this.A.M(),delete this.A);delete this.c;this.I=this.C=k};u.T=function(a){this.c.T(this.a(),a);this.C=a};function xd(a,b){a.C=b}u.Ha=function(a){W.d.Ha.call(this,a);var b=this.a();b&&this.c.Ha(b,a)};u.Ea=function(a){this.Ma=a;var b=this.a();b&&this.c.Ea(b,a)};
u.ta=function(a,b){if(b||this.i!=a&&this.dispatchEvent(a?"show":"hide")){var c=this.a();c&&this.c.ta(c,a);this.isEnabled()&&this.c.sa(this,a);this.i=a;return j}return m};u.isEnabled=function(){return!(this.f&1)};u.J=function(a){var b=this.getParent();if((!b||"function"!=typeof b.isEnabled||b.isEnabled())&&Fd(this,1,!a))a||(this.setActive(m),this.O(m)),this.i&&this.c.sa(this,a),this.r(1,!a)};u.O=function(a){Fd(this,2,a)&&this.r(2,a)};u.setActive=function(a){Fd(this,4,a)&&this.r(4,a)};
u.Ia=function(a){Fd(this,8,a)&&this.r(8,a)};function Gd(a,b){Fd(a,16,b)&&a.r(16,b)}u.Fa=function(a){Fd(this,32,a)&&this.r(32,a)};function Hd(a,b){Fd(a,64,b)&&a.r(64,b)}u.r=function(a,b){this.s&a&&b!=!!(this.f&a)&&(this.c.r(this,a,b),this.f=b?this.f|a:this.f&~a)};function Id(a,b,c){a.e&&a.f&b&&!c&&f(Error("Component already rendered"));!c&&a.f&b&&a.r(b,m);a.s=c?a.s|b:a.s&~b}function X(a,b){return!!(a.ua&b)&&!!(a.s&b)}
function Fd(a,b,c){return!!(a.s&b)&&!!(a.f&b)!=c&&(!(a.Ja&b)||a.dispatchEvent(Uc(b,c)))&&!a.ib}u.pb=function(a){(!a.relatedTarget||!dc(this.a(),a.relatedTarget))&&this.dispatchEvent("enter")&&this.isEnabled()&&X(this,2)&&this.O(j)};u.ob=function(a){if((!a.relatedTarget||!dc(this.a(),a.relatedTarget))&&this.dispatchEvent("leave"))X(this,4)&&this.setActive(m),X(this,2)&&this.O(m)};
u.la=function(a){if(this.isEnabled()&&(X(this,2)&&this.O(j),tb(a)&&(!I||!ab||!a.ctrlKey)))X(this,4)&&this.setActive(j),this.c.ba(this)&&this.k().focus();!this.Ma&&tb(a)&&(!I||!ab||!a.ctrlKey)&&a.preventDefault()};u.xa=function(a){this.isEnabled()&&(X(this,2)&&this.O(j),this.f&4&&Jd(this,a)&&X(this,4)&&this.setActive(m))};u.Eb=function(a){this.isEnabled()&&Jd(this,a)};
function Jd(a,b){X(a,16)&&Gd(a,!(a.f&16));X(a,8)&&a.Ia(j);X(a,64)&&Hd(a,!(a.f&64));var c=new K("action",a);b&&(c.altKey=b.altKey,c.ctrlKey=b.ctrlKey,c.metaKey=b.metaKey,c.shiftKey=b.shiftKey,c.xb=b.xb);return a.dispatchEvent(c)}u.Ra=function(){X(this,32)&&this.Fa(j)};u.va=function(){X(this,4)&&this.setActive(m);X(this,32)&&this.Fa(m)};u.U=function(a){return this.i&&this.isEnabled()&&this.nb(a)?(a.preventDefault(),a.stopPropagation(),j):m};u.nb=function(a){return 13==a.keyCode&&Jd(this,a)};
fa(W)||f(Error("Invalid component class "+W));fa(V)||f(Error("Invalid renderer class "+V));var Kd=ha(W);Dd[Kd]=V;Bd("goog-control",function(){return new W(k)});function Ld(a,b,c){this.vb=a;this.ia=b||m;this.S=c||0}Ld.prototype.o=p("S");Ld.prototype.Ga=function(a){this.S=a};function Md(){var a;a=new Oc;var b;a:{try{b=!!a.K&&!!a.K.getItem;break a}catch(c){}b=m}this.K=(a=b?a:k)?new Lc(a):k;this.V=[];this.ub=0}B(Md,Kb);Md.prototype.load=function(){if(this.K){Ia(this.V);var a=this.K.get("todos-closure");a&&D(a,function(a){a=new Ld(a.title,a.completed,a.id);a.o()>this.ub&&(this.ub=a.o());this.V.push(a)},this)}Nd(this,m)};function Od(a){var b=E,c=Ga(b.V,function(b){return a.o()===b.o()});-1===c?(0===a.o()&&a.Ga(++b.ub),b.V.push(a)):b.V[c]=a;Nd(b)}
Md.prototype.remove=function(a){Ka(this.V,function(b){return a.o()===b.o()});Nd(this)};function Nd(a,b){(b===i||b)&&Pd(a);a.dispatchEvent(new Qd(a))}Md.prototype.getAll=p("V");function Pd(a){if(a.K){var b=[];D(a.V,function(a){b.push({completed:a.ia,title:a.vb,id:a.o()})});a.K.set("todos-closure",b)}}function Qd(a){K.call(this,"change",a)}B(Qd,K);G&&J(8);"ScriptEngine"in v&&"JScript"==v.ScriptEngine()&&(v.ScriptEngineMajorVersion(),v.ScriptEngineMinorVersion(),v.ScriptEngineBuildVersion());function Rd(a){return"object"===typeof a&&a&&0===a.oc?a.content:(""+a).replace(Sd,Td)}var Ud={"\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 Td(a){return Ud[a]}var Sd=/[\x00\x22\x26\x27\x3c\x3e]/g;function Vd(a){return"<strong>"+Rd(a.wb)+"</strong> "+(1==a.wb?"item":"items")+" left"};function Wd(){}B(Wd,V);y(Wd);Wd.prototype.j=function(a){var b='<button id="clear-completed">'+("Clear completed ("+Rd(a.C)+")")+"</button>",b=ac(b);vd(a,b);return b};Wd.prototype.L=s(m);Wd.prototype.T=function(a,b){a.innerHTML="Clear completed ("+Rd(b)+")"};Wd.prototype.r=function(a,b,c){(a=a.a())&&zd(a,b,c)};function Xd(){}B(Xd,V);y(Xd);Xd.prototype.j=function(a){var b='<span id="todo-count">'+Vd({wb:a.C})+"</span>",b=ac(b);vd(a,b);return b};Xd.prototype.L=s(m);Xd.prototype.T=function(a,b){a.innerHTML=Vd({wb:b})};Xd.prototype.r=function(a,b,c){(a=a.a())&&zd(a,b,c)};function Yd(){}B(Yd,V);y(Yd);Yd.prototype.j=function(a){var b;b='<li><div class="view"><input class="toggle" type="checkbox" '+(a.f&16?"checked":"")+"><label>"+Rd(a.C)+'</label><button class="destroy"></button></div><input class="edit" value="Rule the web"></li>';b=ac(b);vd(a,b);this.r(a,a.f,j);return b};Yd.prototype.r=function(a,b,c){var d=a.a();if(d){switch(b){case 16:this.Z(a,"done",c);(d?(d?d.childNodes[0]:k).childNodes[0]:k).checked=c;break;case 8:this.Z(a,"editing",c)}zd(d,b,c)}};
Yd.prototype.k=function(a){return a.a()?a.a().childNodes[1]:k};Yd.prototype.w=function(a){return a?(a?a.childNodes[0]:k).childNodes[1]:k};function Y(a){W.call(this,"",Yd.N(),a);Id(this,16,j);Id(this,8,j);this.ua&=-17;this.ua&=-9;this.Ea(j)}B(Y,W);Y.prototype.v=function(){Y.d.v.call(this);R(Vc(this),this.a(),"click",function(a){a.preventDefault()});R(Vc(this),this.a(),"dblclick",function(){this.Ia(j)});var a=this.a()?this.a().childNodes[1]:k;R(Vc(this),a,"keyup",function(a){13===a.H.keyCode&&this.Fa(m)})};
Y.prototype.xa=function(a){Y.d.xa.call(this,a);this.isEnabled()&&(a.target===(this.a()?(this.a()?this.a().childNodes[0]:k).childNodes[0]:k)?(Gd(this,!(this.f&16)),this.dispatchEvent("edit")):a.target===(this.a()?(this.a()?this.a().childNodes[0]:k).childNodes[2]:k)&&this.dispatchEvent("destroy"))};Y.prototype.Fa=function(a){Y.d.Fa.call(this,a);!a&&this.f&8&&(a=sa((this.a()?this.a().childNodes[1]:k).value),""===a?this.dispatchEvent("destroy"):(this.T(a),this.Ia(m),this.dispatchEvent("edit")))};
Y.prototype.Ia=function(a){Y.d.Ia.call(this,a);a&&(a=this.a()?this.a().childNodes[1]:k,a.value=this.C,a.select())};function Zd(){}B(Zd,V);y(Zd);Zd.prototype.j=function(a){return a.Pa().j("div",this.z())};Zd.prototype.Y=function(a,b){b.id&&a.Ga(b.id);if("HR"==b.tagName){var c=b,b=this.j(a);c.parentNode&&c.parentNode.insertBefore(b,c);cc(c)}else Rb(b,this.z());return b};Zd.prototype.T=function(){};Zd.prototype.z=s("goog-menuseparator");function $d(a,b){W.call(this,k,a||Zd.N(),b);Id(this,1,m);Id(this,2,m);Id(this,4,m);Id(this,32,m);this.f=1}B($d,W);$d.prototype.v=function(){$d.d.v.call(this);td(this.a(),"separator")};Bd("goog-menuseparator",function(){return new $d});function ae(){}y(ae);function be(a,b){a&&(a.tabIndex=b?0:-1)}u=ae.prototype;u.j=function(a){return a.Pa().j("div",this.lb(a).join(" "))};u.w=function(a){return a};u.L=function(a){return"DIV"==a.tagName};u.Y=function(a,b){b.id&&a.Ga(b.id);var c=this.z(),d=m,e=Qb(b);e&&D(e,function(b){b==c?d=j:b&&(b==c+"-disabled"?a.J(m):b==c+"-horizontal"?ce(a,de):b==c+"-vertical"&&ce(a,ee))},this);d||Rb(b,c);fe(a,this.w(b));return b};
function fe(a,b){if(b)for(var c=b.firstChild,d;c&&c.parentNode==b;){d=c.nextSibling;if(1==c.nodeType){var e;a:{e=i;for(var g=Qb(c),h=0,l=g.length;h<l;h++)if(e=g[h]in Cd?Cd[g[h]]():k)break a;e=k}e&&(e.b=c,a.isEnabled()||e.J(m),a.La(e),e.Y(c))}else(!c.nodeValue||""==sa(c.nodeValue))&&b.removeChild(c);c=d}}u.Ua=function(a){a=a.a();Rc(a,j,H);G&&(a.hideFocus=j)};u.k=function(a){return a.a()};u.z=s("goog-container");
u.lb=function(a){var b=this.z(),c=[b,a.da==de?b+"-horizontal":b+"-vertical"];a.isEnabled()||c.push(b+"-disabled");return c};function Z(a,b,c){T.call(this,c);this.c=b||ae.N();this.da=a||ee}B(Z,T);var de="horizontal",ee="vertical";u=Z.prototype;u.rb=k;u.A=k;u.c=k;u.da=k;u.i=j;u.p=j;u.kb=j;u.n=-1;u.h=k;u.ca=m;u.Ab=m;u.kc=j;u.Q=k;u.k=function(){return this.rb||this.c.k(this)};u.Qa=function(){return this.A||(this.A=new md(this.k()))};u.j=function(){this.b=this.c.j(this)};u.w=function(){return this.c.w(this.a())};u.L=function(a){return this.c.L(a)};u.hb=function(a){this.b=this.c.Y(this,a);"none"==a.style.display&&(this.i=m)};
u.v=function(){Z.d.v.call(this);id(this,function(a){a.e&&ge(this,a)},this);var a=this.a();this.c.Ua(this);this.ta(this.i,j);R(R(R(R(R(R(R(R(Vc(this),this,"enter",this.Zb),this,"highlight",this.$b),this,"unhighlight",this.dc),this,"open",this.cc),this,"close",this.Xb),a,"mousedown",this.la),Q(a),"mouseup",this.Yb),a,["mousedown","mouseup","mouseover","mouseout"],this.Wb);this.ba()&&he(this,j)};
function he(a,b){var c=Vc(a),d=a.k();b?R(R(R(c,d,"focus",a.Ra),d,"blur",a.va),a.Qa(),"key",a.U):S(S(S(c,d,"focus",a.Ra),d,"blur",a.va),a.Qa(),"key",a.U)}u.aa=function(){ie(this,-1);this.h&&Hd(this.h,m);this.ca=m;Z.d.aa.call(this)};u.g=function(){Z.d.g.call(this);this.A&&(this.A.M(),this.A=k);this.c=this.h=this.Q=this.rb=k};u.Zb=s(j);
u.$b=function(a){var b=ld(this,a.target);if(-1<b&&b!=this.n){var c=U(this,this.n);c&&c.O(m);this.n=b;c=U(this,this.n);this.ca&&c.setActive(j);this.kc&&this.h&&c!=this.h&&(c.s&64?Hd(c,j):Hd(this.h,m))}this.a().setAttribute("aria-activedescendant",a.target.a().id)};u.dc=function(a){a.target==U(this,this.n)&&(this.n=-1);this.a().setAttribute("aria-activedescendant","")};u.cc=function(a){if((a=a.target)&&a!=this.h&&a.getParent()==this)this.h&&Hd(this.h,m),this.h=a};
u.Xb=function(a){a.target==this.h&&(this.h=k)};u.la=function(a){this.p&&(this.ca=j);var b=this.k();b&&fc(b)?b.focus():a.preventDefault()};u.Yb=function(){this.ca=m};u.Wb=function(a){var b;a:{b=a.target;if(this.Q)for(var c=this.a();b&&b!==c;){var d=b.id;if(d in this.Q){b=this.Q[d];break a}b=b.parentNode}b=k}if(b)switch(a.type){case "mousedown":b.la(a);break;case "mouseup":b.xa(a);break;case "mouseover":b.pb(a);break;case "mouseout":b.ob(a)}};u.Ra=function(){};
u.va=function(){ie(this,-1);this.ca=m;this.h&&Hd(this.h,m)};u.U=function(a){return this.isEnabled()&&this.i&&(0!=jd(this)||this.rb)&&this.nb(a)?(a.preventDefault(),a.stopPropagation(),j):m};
u.nb=function(a){var b=U(this,this.n);if(b&&"function"==typeof b.U&&b.U(a)||this.h&&this.h!=b&&"function"==typeof this.h.U&&this.h.U(a))return j;if(a.shiftKey||a.ctrlKey||a.metaKey||a.altKey)return m;switch(a.keyCode){case 27:if(this.ba())this.k().blur();else return m;break;case 36:ne(this);break;case 35:oe(this);break;case 38:if(this.da==ee)pe(this);else return m;break;case 37:if(this.da==de)kd(this)?qe(this):pe(this);else return m;break;case 40:if(this.da==ee)qe(this);else return m;break;case 39:if(this.da==
de)kd(this)?pe(this):qe(this);else return m;break;default:return m}return j};function ge(a,b){var c=b.a(),c=c.id||(c.id=b.o());a.Q||(a.Q={});a.Q[c]=b}u.La=function(a,b){Z.d.La.call(this,a,b)};u.eb=function(a,b,c){a.Ja|=2;a.Ja|=64;(this.ba()||!this.Ab)&&Id(a,32,m);a.e&&m!=a.wa&&Ed(a,m);a.wa=m;Z.d.eb.call(this,a,b,c);a.e&&this.e&&ge(this,a);b<=this.n&&this.n++};
u.removeChild=function(a,b){if(a=A(a)?gd(this,a):a){var c=ld(this,a);-1!=c&&(c==this.n?a.O(m):c<this.n&&this.n--);var d=a.a();d&&d.id&&this.Q&&(c=this.Q,d=d.id,d in c&&delete c[d])}c=a=Z.d.removeChild.call(this,a,b);c.e&&j!=c.wa&&Ed(c,j);c.wa=j;return a};function ce(a,b){a.a()&&f(Error("Component already rendered"));a.da=b}
u.ta=function(a,b){if(b||this.i!=a&&this.dispatchEvent(a?"show":"hide")){this.i=a;var c=this.a();c&&(Pc(c,a),this.ba()&&be(this.k(),this.p&&this.i),b||this.dispatchEvent(this.i?"aftershow":"afterhide"));return j}return m};u.isEnabled=p("p");u.J=function(a){if(this.p!=a&&this.dispatchEvent(a?"enable":"disable"))a?(this.p=j,id(this,function(a){a.Sb?delete a.Sb:a.J(j)})):(id(this,function(a){a.isEnabled()?a.J(m):a.Sb=j}),this.ca=this.p=m),this.ba()&&be(this.k(),a&&this.i)};u.ba=p("kb");
u.sa=function(a){a!=this.kb&&this.e&&he(this,a);this.kb=a;this.p&&this.i&&be(this.k(),a)};function ie(a,b){var c=U(a,b);c?c.O(j):-1<a.n&&U(a,a.n).O(m)}u.O=function(a){ie(this,ld(this,a))};function ne(a){re(a,function(a,c){return(a+1)%c},jd(a)-1)}function oe(a){re(a,function(a,c){a--;return 0>a?c-1:a},0)}function qe(a){re(a,function(a,c){return(a+1)%c},a.n)}function pe(a){re(a,function(a,c){a--;return 0>a?c-1:a},a.n)}
function re(a,b,c){for(var c=0>c?ld(a,a.h):c,d=jd(a),c=b.call(a,c,d),e=0;e<=d;){var g=U(a,c);if(g&&g.i&&g.isEnabled()&&g.s&2){ie(a,c);break}e++;c=b.call(a,c,d)}};function se(){}B(se,ae);y(se);se.prototype.L=function(a){return"UL"==a.tagName};se.prototype.Ua=function(){};function te(a){Z.call(this,ee,se.N(),a);this.sa(m);this.Ab=j}B(te,Z);te.prototype.la=function(){this.p&&(this.ca=j)};var E=new Md;E.addEventListener("change",ue);var ve=new te;ve.Y(document.getElementById("todo-list"));var we=document.getElementById("main"),xe=document.getElementById("footer"),ye=new W(k,Xd.N());hd(ye,xe);var ze=new W(k,Wd.N());hd(ze,xe);O(ze,"action",function(){Da(function(a){a.ia&&E.remove(a)})});var Ae=document.getElementById("toggle-all");O(Ae,"click",function(){var a=Ae.checked;D(E.getAll(),function(b){b=new Ld(b.vb,a,b.o());Od(b)})});var Be="/",Ce="/active",De="/completed",Ee=Be,$=new kc;
O($,"navigate",function(a){switch(a.zb){case Be:case Ce:case De:a.zb!==Ee&&(Ee=a.zb,ue());break;default:a=Be,rc($)!=a&&($.ha?(qc($,a,j),oc||G&&sc($,a,j,i),$.p&&$.Cb()):(sc($,a,j),$.pa=$.na=$.ya.value=a,$.dispatchEvent(new jc(a))))}});
function ue(){ve.Mb(j);var a=E.getAll();D(a,function(a){if(!(Ee===Ce&&a.ia||Ee===De&&!a.ia)){var b=new Y;b.T(a.vb);Gd(b,a.ia);b.Za=a;ve.La(b,j)}});var b=Ea(a,function(a,b){return b.ia?a+1:a}),c=a.length-b;Ae.checked=0===c;ye.T(c.toString());ze.T(b.toString());ze.ta(0<b);Pc(we,0<a.length);Pc(xe,0<a.length);a=Ac("#filters a");D(a,function(a,b){a.className=Ee===Be&&0===b||Ee===Ce&&1===b||Ee===De&&2===b?"selected":""})}O(ve,"edit",function(a){a=a.target;a=new Ld(a.C,!!(a.f&16),a.Za.o());Od(a)});
O(ve,"destroy",function(a){a=a.target.Za;a!==k&&E.remove(a)});var Fe=document.getElementById("new-todo");O(Fe,"keyup",function(a){13===a.keyCode&&(a=sa(Fe.value),""!==a&&(Fe.value="",Od(new Ld(a))))});E.load();$.J(j);})();
goog.require('goog.array');
goog.require('goog.events.EventType');
goog.require('goog.events.KeyCodes');
goog.require('goog.ui.Component');
goog.require('goog.ui.Control');
goog.require('todomvc.model.ToDoItem');
goog.require('todomvc.view');
goog.require('todomvc.view.ClearCompletedControlRenderer');
goog.require('todomvc.view.ItemCountControlRenderer');
goog.require('todomvc.view.ToDoItemControl');
goog.require('todomvc.view.ToDoListContainer');
/**
* @fileoverview The controller/business logic for the application.
*
* This file creates the interface and marshalls changes from the interface to the model and back.
*/
/**
* @type {Array.<todomvc.model.ToDoItem>}
*/
var items = [];
/**
* @type {Element}
*/
var todoStats = document.getElementById('todo-stats');
/**
* @type {goog.ui.Control}
*/
var itemCountControl = new goog.ui.Control(null, todomvc.view.ItemCountControlRenderer.getInstance());
itemCountControl.render(todoStats);
/**
* @type {goog.ui.Control}
*/
var clearCompletedControl = new goog.ui.Control(null, todomvc.view.ClearCompletedControlRenderer.getInstance());
clearCompletedControl.render(todoStats);
goog.events.listen(clearCompletedControl, goog.ui.Component.EventType.ACTION, function(e) {
// go backwards to avoid collection modification problems
goog.array.forEachRight(items, function(model) {
if (model.isDone()) {
goog.array.remove(items, model);
// do optimised model view sync
container.forEachChild(function(control) {
if (control.getModel() === model) {
container.removeChild(control, true);
}
});
}
});
updateStats();
});
function updateStats() {
var doneCount = goog.array.reduce(items, function(count, model) {
return model.isDone() ? count + 1 : count;
}, 0);
var remainingCount = items.length - (/**@type {number}*/ doneCount);
itemCountControl.setContent((/**@type {string}*/ remainingCount));
itemCountControl.setVisible(remainingCount > 0);
clearCompletedControl.setContent((/**@type {string}*/ doneCount));
clearCompletedControl.setVisible((/**@type {number}*/ doneCount) > 0);
}
updateStats();
/**
* @type {todomvc.view.ToDoListContainer}
*/
var container = new todomvc.view.ToDoListContainer();
container.decorate(document.getElementById('todo-list'));
goog.events.listen(container, todomvc.view.ToDoItemControl.EventType.EDIT, function(e) {
/**
* @type {todomvc.view.ToDoItemControl}
*/
var control = e.target;
/**
* @type {todomvc.model.ToDoItem}
*/
var model = (/**@type {todomvc.model.ToDoItem} */ control.getModel());
// do optimised model view sync
model.setNote((/**@type {!string} */ control.getContent()));
model.setDone((/**@type {!boolean} */ control.isChecked()));
updateStats();
});
goog.events.listen(container, todomvc.view.ToDoItemControl.EventType.DESTROY, function(e) {
/**
* @type {todomvc.view.ToDoItemControl}
*/
var control = e.target;
/**
* @type {todomvc.model.ToDoItem}
*/
var model = (/**@type {todomvc.model.ToDoItem} */ control.getModel());
// do optimised model view sync
goog.array.remove(items, model);
container.removeChild(control, true);
updateStats();
});
/**
* @type {Element}
*/
var newToDo = document.getElementById('new-todo');
goog.events.listen(newToDo, goog.events.EventType.KEYUP, function(e) {
if (e.keyCode === goog.events.KeyCodes.ENTER) {
/**
* @type {todomvc.model.ToDoItem}
*/
var model = new todomvc.model.ToDoItem(newToDo.value);
/**
* @type {todomvc.view.ToDoItemControl}
*/
var control = new todomvc.view.ToDoItemControl();
// do optimised model view sync
items.push(model);
control.setContent(model.getNote());
control.setChecked(model.isDone());
control.setModel(model);
container.addChild(control, true);
// clear the input box
newToDo.value = '';
updateStats();
}
});
\ No newline at end of file
...@@ -3,11 +3,12 @@ goog.provide('todomvc.model.ToDoItem'); ...@@ -3,11 +3,12 @@ goog.provide('todomvc.model.ToDoItem');
/** /**
* The model object representing a todo item. * The model object representing a todo item.
* *
* @param {!string} note the text associated with this item * @param {!string} note the text associated with this item.
* @param {!boolean=} opt_done is this item complete? defaults to false * @param {!boolean=} opt_done is this item complete? defaults to false.
* @param {!number=} opt_id the id for the item defaults to 0 meaning undefined.
* @constructor * @constructor
*/ */
todomvc.model.ToDoItem = function(note, opt_done) { todomvc.model.ToDoItem = function(note, opt_done, opt_id) {
/** /**
* note the text associated with this item * note the text associated with this item
* @private * @private
...@@ -21,10 +22,17 @@ todomvc.model.ToDoItem = function(note, opt_done) { ...@@ -21,10 +22,17 @@ todomvc.model.ToDoItem = function(note, opt_done) {
* @type {!boolean} * @type {!boolean}
*/ */
this.done_ = opt_done || false; this.done_ = opt_done || false;
/**
* the id for the item, or 0 if it is not yet defined
* @private
* @type {!number}
*/
this.id_ = opt_id || 0;
}; };
/** /**
* @return {!string} the text associated with this item * @return {!string} the text associated with this item.
*/ */
todomvc.model.ToDoItem.prototype.getNote = function() { todomvc.model.ToDoItem.prototype.getNote = function() {
return this.note_; return this.note_;
...@@ -38,7 +46,14 @@ todomvc.model.ToDoItem.prototype.isDone = function() { ...@@ -38,7 +46,14 @@ todomvc.model.ToDoItem.prototype.isDone = function() {
}; };
/** /**
* @param {!string} note the text associated with this item * @return {!number} the id for the item, or 0 if it is not yet defined.
*/
todomvc.model.ToDoItem.prototype.getId = function() {
return this.id_;
};
/**
* @param {!string} note the text associated with this item.
*/ */
todomvc.model.ToDoItem.prototype.setNote = function(note) { todomvc.model.ToDoItem.prototype.setNote = function(note) {
this.note_ = note; this.note_ = note;
...@@ -50,3 +65,10 @@ todomvc.model.ToDoItem.prototype.setNote = function(note) { ...@@ -50,3 +65,10 @@ todomvc.model.ToDoItem.prototype.setNote = function(note) {
todomvc.model.ToDoItem.prototype.setDone = function(done) { todomvc.model.ToDoItem.prototype.setDone = function(done) {
this.done_ = done; this.done_ = done;
}; };
/**
* @param {!number} id the id for the item, or 0 if it is not yet defined.
*/
todomvc.model.ToDoItem.prototype.setId = function(id) {
this.id_ = id;
};
goog.provide('todomvc.model.ToDoItemStore');
goog.require('goog.array');
goog.require('goog.events.Event');
goog.require('goog.events.EventTarget');
goog.require('goog.storage.Storage');
goog.require('goog.storage.mechanism.mechanismfactory');
goog.require('goog.string');
goog.require('goog.ui.Component');
goog.require('goog.ui.Control');
goog.require('todomvc.model.ToDoItem');
/**
* @constructor
* @extends {goog.events.EventTarget}
*/
todomvc.model.ToDoItemStore = function() {
var mechanism = goog.storage.mechanism.mechanismfactory
.createHTML5LocalStorage();
/**
* @type {goog.storage.Storage}
* @private
*/
this.storage_ = mechanism ? new goog.storage.Storage(mechanism) : null;
/**
* @type {!Array.<todomvc.model.ToDoItem>}
* @private
*/
this.items_ = [];
/**
* Fundamentally flawed approach to ID-ing but fine for demo
* @type {!number}
* @private
*/
this.maxId_ = 0;
};
goog.inherits(todomvc.model.ToDoItemStore, goog.events.EventTarget);
/**
* Load item list from storage
*/
todomvc.model.ToDoItemStore.prototype.load = function() {
if (!this.storage_) {
this.notify_(false);
return; // no storage = no loading!
}
goog.array.clear(this.items_);
/**
* @type {Array.<*>}
*/
var serializedItems = /** @type {Array.<*>} */
(this.storage_.get('todos-closure'));
if (!serializedItems) {
this.notify_(false);
return; // nothing in storage
}
goog.array.forEach(serializedItems, function(serializedItem) {
var item = new todomvc.model.ToDoItem(serializedItem['title'],
serializedItem['completed'], serializedItem['id']);
if (item.getId() > this.maxId_) {
this.maxId_ = item.getId();
}
this.items_.push(item);
}, this);
this.notify_(false);
};
/**
* @param {!todomvc.model.ToDoItem} updatedItem A prototype model to update.
*/
todomvc.model.ToDoItemStore.prototype.addOrUpdate = function(updatedItem) {
var idx = goog.array.findIndex(this.items_, function(item) {
return updatedItem.getId() === item.getId();
});
if (idx === -1) {
if (updatedItem.getId() === 0) {
updatedItem.setId(++this.maxId_);
}
this.items_.push(updatedItem);
} else {
this.items_[idx] = updatedItem;
}
this.notify_();
};
/**
* @param {!todomvc.model.ToDoItem} itemToRemove A prototype model to remove.
*/
todomvc.model.ToDoItemStore.prototype.remove = function(itemToRemove) {
goog.array.removeIf(this.items_, function(item) {
return itemToRemove.getId() === item.getId();
});
this.notify_();
};
/**
* @param {boolean=} opt_save whether to save to storage, defaults to true.
* @private
*/
todomvc.model.ToDoItemStore.prototype.notify_ = function(opt_save) {
// TODO delay until all changes have been made
if (!goog.isDef(opt_save) || opt_save) {
this.save_();
}
this.dispatchEvent(new todomvc.model.ToDoItemStore.ChangeEvent(this));
};
/**
* @return {Array.<todomvc.model.ToDoItem>} All of the stored items.
*/
todomvc.model.ToDoItemStore.prototype.getAll = function() {
return this.items_;
};
/**
* @private
*/
todomvc.model.ToDoItemStore.prototype.save_ = function() {
if (!this.storage_) {
return; // no storage = no saving!
}
/**
* @type {Array.<*>}
*/
var serializedItems = [];
goog.array.forEach(this.items_, function(item) {
serializedItems.push({
'completed' : item.isDone(),
'title': item.getNote(),
'id' : item.getId()
});
});
this.storage_.set('todos-closure', serializedItems);
};
/**
* @const
*/
todomvc.model.ToDoItemStore.ChangeEventType = 'change';
/**
* @constructor
* @extends {goog.events.Event}
* @param {todomvc.model.ToDoItemStore} target The item store.
*/
todomvc.model.ToDoItemStore.ChangeEvent = function(target) {
goog.events.Event.call(this,
todomvc.model.ToDoItemStore.ChangeEventType, target);
};
goog.inherits(todomvc.model.ToDoItemStore.ChangeEvent, goog.events.Event);
...@@ -13,7 +13,8 @@ goog.require('goog.ui.ControlRenderer'); ...@@ -13,7 +13,8 @@ goog.require('goog.ui.ControlRenderer');
todomvc.view.ClearCompletedControlRenderer = function() { todomvc.view.ClearCompletedControlRenderer = function() {
goog.ui.ControlRenderer.call(this); goog.ui.ControlRenderer.call(this);
}; };
goog.inherits(todomvc.view.ClearCompletedControlRenderer, goog.ui.ControlRenderer); goog.inherits(todomvc.view.ClearCompletedControlRenderer,
goog.ui.ControlRenderer);
// add getInstance method to todomvc.view.ClearCompletedControlRenderer // add getInstance method to todomvc.view.ClearCompletedControlRenderer
goog.addSingletonGetter(todomvc.view.ClearCompletedControlRenderer); goog.addSingletonGetter(todomvc.view.ClearCompletedControlRenderer);
...@@ -22,9 +23,10 @@ goog.addSingletonGetter(todomvc.view.ClearCompletedControlRenderer); ...@@ -22,9 +23,10 @@ goog.addSingletonGetter(todomvc.view.ClearCompletedControlRenderer);
* @param {goog.ui.Control} control Control to render. * @param {goog.ui.Control} control Control to render.
* @return {Element} Root element for the control. * @return {Element} Root element for the control.
*/ */
todomvc.view.ClearCompletedControlRenderer.prototype.createDom = function(control) { todomvc.view.ClearCompletedControlRenderer.prototype.createDom =
function(control) {
var html = todomvc.view.clearCompleted({ var html = todomvc.view.clearCompleted({
number : control.getContent() number: control.getContent()
}); });
var element = (/**@type {!Element}*/ goog.dom.htmlToDocumentFragment(html)); var element = (/**@type {!Element}*/ goog.dom.htmlToDocumentFragment(html));
this.setAriaStates(control, element); this.setAriaStates(control, element);
...@@ -35,17 +37,19 @@ todomvc.view.ClearCompletedControlRenderer.prototype.createDom = function(contro ...@@ -35,17 +37,19 @@ todomvc.view.ClearCompletedControlRenderer.prototype.createDom = function(contro
* @param {Element} element Element to decorate. * @param {Element} element Element to decorate.
* @return {boolean} Whether the renderer can decorate the element. * @return {boolean} Whether the renderer can decorate the element.
*/ */
todomvc.view.ClearCompletedControlRenderer.prototype.canDecorate = function(element) { todomvc.view.ClearCompletedControlRenderer.prototype.canDecorate =
function(element) {
return false; return false;
}; };
/** /**
* @param {Element} element Element to populate. * @param {Element} element Element to populate.
* @param {goog.ui.ControlContent} content Text caption or DOM * @param {goog.ui.ControlContent} content Text caption or DOM.
*/ */
todomvc.view.ClearCompletedControlRenderer.prototype.setContent = function(element, content) { todomvc.view.ClearCompletedControlRenderer.prototype.setContent =
function(element, content) {
element.innerHTML = todomvc.view.clearCompletedInner({ element.innerHTML = todomvc.view.clearCompletedInner({
number : content number: content
}); });
}; };
...@@ -56,7 +60,8 @@ todomvc.view.ClearCompletedControlRenderer.prototype.setContent = function(eleme ...@@ -56,7 +60,8 @@ todomvc.view.ClearCompletedControlRenderer.prototype.setContent = function(eleme
* @param {goog.ui.Component.State} state State to enable or disable. * @param {goog.ui.Component.State} state State to enable or disable.
* @param {boolean} enable Whether the control is entering or exiting the state. * @param {boolean} enable Whether the control is entering or exiting the state.
*/ */
todomvc.view.ClearCompletedControlRenderer.prototype.setState = function(control, state, enable) { todomvc.view.ClearCompletedControlRenderer.prototype.setState =
function(control, state, enable) {
var element = control.getElement(); var element = control.getElement();
if (element) { if (element) {
this.updateAriaState(element, state, enable); this.updateAriaState(element, state, enable);
......
...@@ -24,7 +24,7 @@ goog.addSingletonGetter(todomvc.view.ItemCountControlRenderer); ...@@ -24,7 +24,7 @@ goog.addSingletonGetter(todomvc.view.ItemCountControlRenderer);
*/ */
todomvc.view.ItemCountControlRenderer.prototype.createDom = function(control) { todomvc.view.ItemCountControlRenderer.prototype.createDom = function(control) {
var html = todomvc.view.itemCount({ var html = todomvc.view.itemCount({
number : control.getContent() number: control.getContent()
}); });
var element = (/**@type {!Element}*/ goog.dom.htmlToDocumentFragment(html)); var element = (/**@type {!Element}*/ goog.dom.htmlToDocumentFragment(html));
this.setAriaStates(control, element); this.setAriaStates(control, element);
...@@ -35,17 +35,19 @@ todomvc.view.ItemCountControlRenderer.prototype.createDom = function(control) { ...@@ -35,17 +35,19 @@ todomvc.view.ItemCountControlRenderer.prototype.createDom = function(control) {
* @param {Element} element Element to decorate. * @param {Element} element Element to decorate.
* @return {boolean} Whether the renderer can decorate the element. * @return {boolean} Whether the renderer can decorate the element.
*/ */
todomvc.view.ItemCountControlRenderer.prototype.canDecorate = function(element) { todomvc.view.ItemCountControlRenderer.prototype.canDecorate =
function(element) {
return false; return false;
}; };
/** /**
* @param {Element} element Element to populate. * @param {Element} element Element to populate.
* @param {goog.ui.ControlContent} content Text caption or DOM * @param {goog.ui.ControlContent} content Text caption or DOM.
*/ */
todomvc.view.ItemCountControlRenderer.prototype.setContent = function(element, content) { todomvc.view.ItemCountControlRenderer.prototype.setContent =
function(element, content) {
element.innerHTML = todomvc.view.itemCountInner({ element.innerHTML = todomvc.view.itemCountInner({
number : content number: content
}); });
}; };
...@@ -56,7 +58,8 @@ todomvc.view.ItemCountControlRenderer.prototype.setContent = function(element, c ...@@ -56,7 +58,8 @@ todomvc.view.ItemCountControlRenderer.prototype.setContent = function(element, c
* @param {goog.ui.Component.State} state State to enable or disable. * @param {goog.ui.Component.State} state State to enable or disable.
* @param {boolean} enable Whether the control is entering or exiting the state. * @param {boolean} enable Whether the control is entering or exiting the state.
*/ */
todomvc.view.ItemCountControlRenderer.prototype.setState = function(control, state, enable) { todomvc.view.ItemCountControlRenderer.prototype.setState =
function(control, state, enable) {
var element = control.getElement(); var element = control.getElement();
if (element) { if (element) {
this.updateAriaState(element, state, enable); this.updateAriaState(element, state, enable);
......
...@@ -2,21 +2,24 @@ goog.provide('todomvc.view.ToDoItemControl'); ...@@ -2,21 +2,24 @@ goog.provide('todomvc.view.ToDoItemControl');
goog.require('goog.dom'); goog.require('goog.dom');
goog.require('goog.events'); goog.require('goog.events');
goog.require('goog.events.KeyCodes');
goog.require('goog.string');
goog.require('goog.ui.Component.State'); goog.require('goog.ui.Component.State');
goog.require('goog.ui.Control'); goog.require('goog.ui.Control');
goog.require('todomvc.view.ToDoItemControlRenderer'); goog.require('todomvc.view.ToDoItemControlRenderer');
/** /**
* A control representing each item in the todo list. It makes use of the CHECKED and SELECTED states to represent being * A control representing each item in the todo list. It makes use of the
* done and being in edit mode. * CHECKED and SELECTED states to represent being done and being in edit mode.
* *
* @param {goog.dom.DomHelper=} opt_domHelper Optional DOM helper, used for document interaction. * @param {goog.dom.DomHelper=} opt_domHelper Optional DOM helper,
* used for document interaction.
* @constructor * @constructor
* @extends {goog.ui.Control} * @extends {goog.ui.Control}
*/ */
todomvc.view.ToDoItemControl = function(opt_domHelper) { todomvc.view.ToDoItemControl = function(opt_domHelper) {
goog.ui.Control.call(this, "", todomvc.view.ToDoItemControlRenderer goog.ui.Control.call(this, '', todomvc.view.ToDoItemControlRenderer
.getInstance(), opt_domHelper); .getInstance(), opt_domHelper);
// enable CHECKED and SELECTED states // enable CHECKED and SELECTED states
...@@ -27,15 +30,17 @@ todomvc.view.ToDoItemControl = function(opt_domHelper) { ...@@ -27,15 +30,17 @@ todomvc.view.ToDoItemControl = function(opt_domHelper) {
this.setAutoStates(goog.ui.Component.State.CHECKED, false); this.setAutoStates(goog.ui.Component.State.CHECKED, false);
this.setAutoStates(goog.ui.Component.State.SELECTED, false); this.setAutoStates(goog.ui.Component.State.SELECTED, false);
// allow text selection within this control // allow text selection
this.setAllowTextSelection(true); this.setAllowTextSelection(true);
}; };
goog.inherits(todomvc.view.ToDoItemControl, goog.ui.Control); goog.inherits(todomvc.view.ToDoItemControl, goog.ui.Control);
/**
* The event types this control dispatches.
*/
todomvc.view.ToDoItemControl.EventType = { todomvc.view.ToDoItemControl.EventType = {
EDIT: "edit", EDIT: 'edit',
DESTROY: "destroy" DESTROY: 'destroy'
}; };
...@@ -54,13 +59,30 @@ todomvc.view.ToDoItemControl.prototype.enterDocument = function() { ...@@ -54,13 +59,30 @@ todomvc.view.ToDoItemControl.prototype.enterDocument = function() {
function(e) { function(e) {
e.preventDefault(); e.preventDefault();
}); });
this.getHandler().listen(this.getElement(), goog.events.EventType.DBLCLICK,
function(e) {
this.setSelected(true);
});
/**
* @type {Element}
*/
var inputElement = this.getRenderer().getInputElement(
this.getElement());
this.getHandler().listen(inputElement, goog.events.EventType.KEYUP,
function(e) {
var be = e.getBrowserEvent();
if (be.keyCode === goog.events.KeyCodes.ENTER) {
this.setFocused(false);
}
});
}; };
/** /**
* Returns the renderer used by this component to render itself or to decorate * Returns the renderer used by this component to render itself or to decorate
* an existing element. * an existing element.
* *
* @return {todomvc.view.ToDoItemControlRenderer} Renderer used by the component * @return {todomvc.view.ToDoItemControlRenderer} Renderer used by the
* component.
*/ */
todomvc.view.ToDoItemControl.prototype.getRenderer = function() { todomvc.view.ToDoItemControl.prototype.getRenderer = function() {
return (/**@type {todomvc.view.ToDoItemControlRenderer}*/ this.renderer_); return (/**@type {todomvc.view.ToDoItemControlRenderer}*/ this.renderer_);
...@@ -82,15 +104,13 @@ todomvc.view.ToDoItemControl.prototype.handleMouseUp = function(e) { ...@@ -82,15 +104,13 @@ todomvc.view.ToDoItemControl.prototype.handleMouseUp = function(e) {
} else if (e.target === this.getRenderer().getDestroyElement( } else if (e.target === this.getRenderer().getDestroyElement(
this.getElement())) { this.getElement())) {
this.dispatchEvent(todomvc.view.ToDoItemControl.EventType.DESTROY); this.dispatchEvent(todomvc.view.ToDoItemControl.EventType.DESTROY);
} else if (!this.isSelected()) {
this.setSelected(true);
} }
} }
}; };
/** /**
* Override the behaviour when the control is unfocused. * Override the behaviour when the control is unfocused.
* @param {boolean} focused * @param {boolean} focused is focused?
*/ */
todomvc.view.ToDoItemControl.prototype.setFocused = function(focused) { todomvc.view.ToDoItemControl.prototype.setFocused = function(focused) {
todomvc.view.ToDoItemControl.superClass_.setFocused.call(this, focused); todomvc.view.ToDoItemControl.superClass_.setFocused.call(this, focused);
...@@ -100,18 +120,24 @@ todomvc.view.ToDoItemControl.prototype.setFocused = function(focused) { ...@@ -100,18 +120,24 @@ todomvc.view.ToDoItemControl.prototype.setFocused = function(focused) {
*/ */
var inputElement = this.getRenderer().getInputElement( var inputElement = this.getRenderer().getInputElement(
this.getElement()); this.getElement());
this.setContent(inputElement.value); var value = goog.string.trim(inputElement.value);
if (value === '') {
this.dispatchEvent(todomvc.view.ToDoItemControl.EventType.DESTROY);
} else {
this.setContent(value);
this.setSelected(false); this.setSelected(false);
this.dispatchEvent(todomvc.view.ToDoItemControl.EventType.EDIT); this.dispatchEvent(todomvc.view.ToDoItemControl.EventType.EDIT);
} }
}
}; };
/** /**
* Override the behaviour to switch to editing mode when the control is selected * Override the behaviour to switch to editing mode when the control is selected
* @param {boolean} selected * @param {boolean} selected is selected?
*/ */
todomvc.view.ToDoItemControl.prototype.setSelected = function(selected) { todomvc.view.ToDoItemControl.prototype.setSelected = function(selected) {
todomvc.view.ToDoItemControl.superClass_.setSelected.call(this, selected); todomvc.view.ToDoItemControl.superClass_.setSelected.call(this, selected);
// populate the input box when selected
if (selected) { if (selected) {
/** /**
* @type {Element} * @type {Element}
...@@ -119,6 +145,6 @@ todomvc.view.ToDoItemControl.prototype.setSelected = function(selected) { ...@@ -119,6 +145,6 @@ todomvc.view.ToDoItemControl.prototype.setSelected = function(selected) {
var inputElement = this.getRenderer().getInputElement( var inputElement = this.getRenderer().getInputElement(
this.getElement()); this.getElement());
inputElement.value = this.getContent(); inputElement.value = this.getContent();
inputElement.focus(); inputElement.select();
} }
}; };
...@@ -4,8 +4,8 @@ goog.require('goog.ui.Component.State'); ...@@ -4,8 +4,8 @@ goog.require('goog.ui.Component.State');
goog.require('goog.ui.ControlRenderer'); goog.require('goog.ui.ControlRenderer');
/** /**
* The renderer for the ToDoItemControl which has knowledge of the DOM structure of the Control and the applicable CSS * The renderer for the ToDoItemControl which has knowledge of the DOM
* classes. * structure of the Control and the applicable CSS classes.
* *
* @constructor * @constructor
* @extends {goog.ui.ControlRenderer} * @extends {goog.ui.ControlRenderer}
...@@ -24,10 +24,13 @@ goog.addSingletonGetter(todomvc.view.ToDoItemControlRenderer); ...@@ -24,10 +24,13 @@ goog.addSingletonGetter(todomvc.view.ToDoItemControlRenderer);
*/ */
todomvc.view.ToDoItemControlRenderer.prototype.createDom = function(control) { todomvc.view.ToDoItemControlRenderer.prototype.createDom = function(control) {
var html = todomvc.view.toDoItem({ var html = todomvc.view.toDoItem({
content : control.getContent() content: control.getContent(),
checked: control.isChecked()
}); });
var element = (/**@type {!Element}*/ goog.dom.htmlToDocumentFragment(html)); var element = (/**@type {!Element}*/ goog.dom.htmlToDocumentFragment(html));
this.setAriaStates(control, element); this.setAriaStates(control, element);
this.setState(control, /** @type {goog.ui.Component.State} */
(control.getState()), true);
return element; return element;
}; };
...@@ -38,16 +41,17 @@ todomvc.view.ToDoItemControlRenderer.prototype.createDom = function(control) { ...@@ -38,16 +41,17 @@ todomvc.view.ToDoItemControlRenderer.prototype.createDom = function(control) {
* @param {goog.ui.Component.State} state State to enable or disable. * @param {goog.ui.Component.State} state State to enable or disable.
* @param {boolean} enable Whether the control is entering or exiting the state. * @param {boolean} enable Whether the control is entering or exiting the state.
*/ */
todomvc.view.ToDoItemControlRenderer.prototype.setState = function(control, state, enable) { todomvc.view.ToDoItemControlRenderer.prototype.setState =
function(control, state, enable) {
var element = control.getElement(); var element = control.getElement();
if (element) { if (element) {
switch (state) { switch (state) {
case goog.ui.Component.State.CHECKED: case goog.ui.Component.State.CHECKED:
this.enableClassName(control, "done", enable); this.enableClassName(control, 'done', enable);
this.getCheckboxElement(element).checked = enable; this.getCheckboxElement(element).checked = enable;
break; break;
case goog.ui.Component.State.SELECTED: case goog.ui.Component.State.SELECTED:
this.enableClassName(control, "editing", enable); this.enableClassName(control, 'editing', enable);
break; break;
} }
...@@ -63,7 +67,8 @@ todomvc.view.ToDoItemControlRenderer.prototype.setState = function(control, stat ...@@ -63,7 +67,8 @@ todomvc.view.ToDoItemControlRenderer.prototype.setState = function(control, stat
* returned. * returned.
* @return {Element} The key event target. * @return {Element} The key event target.
*/ */
todomvc.view.ToDoItemControlRenderer.prototype.getKeyEventTarget = function(control) { todomvc.view.ToDoItemControlRenderer.prototype.getKeyEventTarget =
function(control) {
return this.getInputElement(control.getElement()); return this.getInputElement(control.getElement());
}; };
...@@ -76,7 +81,7 @@ todomvc.view.ToDoItemControlRenderer.prototype.getKeyEventTarget = function(cont ...@@ -76,7 +81,7 @@ todomvc.view.ToDoItemControlRenderer.prototype.getKeyEventTarget = function(cont
*/ */
todomvc.view.ToDoItemControlRenderer.prototype.getDisplayElement = function( todomvc.view.ToDoItemControlRenderer.prototype.getDisplayElement = function(
element) { element) {
return element ? element.childNodes[0].childNodes[0] : null; return element ? element.childNodes[0] : null;
}; };
/** /**
...@@ -125,5 +130,5 @@ todomvc.view.ToDoItemControlRenderer.prototype.getDestroyElement = function( ...@@ -125,5 +130,5 @@ todomvc.view.ToDoItemControlRenderer.prototype.getDestroyElement = function(
*/ */
todomvc.view.ToDoItemControlRenderer.prototype.getInputElement = function( todomvc.view.ToDoItemControlRenderer.prototype.getInputElement = function(
element) { element) {
return element ? element.childNodes[0].childNodes[1].childNodes[0] : null; return element ? element.childNodes[1] : null;
}; };
...@@ -5,9 +5,11 @@ goog.require('goog.ui.Container'); ...@@ -5,9 +5,11 @@ goog.require('goog.ui.Container');
goog.require('todomvc.view.ToDoListContainerRenderer'); goog.require('todomvc.view.ToDoListContainerRenderer');
/** /**
* A container for the ToDoItemControls, overridden to support keyboard focus on child controls. * A container for the ToDoItemControls, overridden to support keyboard focus
* on child controls.
* *
* @param {goog.dom.DomHelper=} opt_domHelper Optional DOM helper, used for document interaction. * @param {goog.dom.DomHelper=} opt_domHelper Optional DOM helper, used for
* document interaction.
* @constructor * @constructor
* @extends {goog.ui.Container} * @extends {goog.ui.Container}
*/ */
......
...@@ -5,7 +5,8 @@ goog.require('goog.ui.Container'); ...@@ -5,7 +5,8 @@ goog.require('goog.ui.Container');
goog.require('goog.ui.ContainerRenderer'); goog.require('goog.ui.ContainerRenderer');
/** /**
* A renderer for the container, overridden to support keyboard focus on child controls. * A renderer for the container, overridden to support keyboard focus
* on child controls.
* @constructor * @constructor
* @extends {goog.ui.ContainerRenderer} * @extends {goog.ui.ContainerRenderer}
*/ */
...@@ -20,7 +21,8 @@ goog.addSingletonGetter(todomvc.view.ToDoListContainerRenderer); ...@@ -20,7 +21,8 @@ goog.addSingletonGetter(todomvc.view.ToDoListContainerRenderer);
* @param {Element} element Element to decorate. * @param {Element} element Element to decorate.
* @return {boolean} Whether the renderer can decorate the element. * @return {boolean} Whether the renderer can decorate the element.
*/ */
todomvc.view.ToDoListContainerRenderer.prototype.canDecorate = function(element) { todomvc.view.ToDoListContainerRenderer.prototype.canDecorate =
function(element) {
return element.tagName == 'UL'; return element.tagName == 'UL';
}; };
...@@ -30,7 +32,8 @@ todomvc.view.ToDoListContainerRenderer.prototype.canDecorate = function(element) ...@@ -30,7 +32,8 @@ todomvc.view.ToDoListContainerRenderer.prototype.canDecorate = function(element)
* @param {goog.ui.Container} container Container whose DOM is to be initialized * @param {goog.ui.Container} container Container whose DOM is to be initialized
* as it enters the document. * as it enters the document.
*/ */
todomvc.view.ToDoListContainerRenderer.prototype.initializeDom = function(container) { todomvc.view.ToDoListContainerRenderer.prototype.initializeDom =
function(container) {
var elem = (/**@type {!Element}*/ container.getElement()); var elem = (/**@type {!Element}*/ container.getElement());
// Set the ARIA role. // Set the ARIA role.
......
...@@ -3,20 +3,17 @@ ...@@ -3,20 +3,17 @@
/** /**
* A todo list item template * A todo list item template
* @param content the label for this item * @param content the label for this item
* @param checked whether the item is checked
*/ */
{template .toDoItem} {template .toDoItem}
<li> <li>
<div> <div class="view">
<div class="display"> <input class="toggle" type="checkbox" {if $checked}checked{/if}>
<input class="check" type="checkbox" /> <label>{$content}</label>
<div class="todo-content" style="cursor: pointer;">{$content}</div> <button class="destroy"></button>
<span class="todo-destroy"></span>
</div> </div>
<div class="edit"> <input class="edit" value="Rule the web">
<input class="todo-input" type="text"/> </li>
</div>
</div>
</li>
{/template} {/template}
/** /**
...@@ -24,9 +21,7 @@ ...@@ -24,9 +21,7 @@
* @param number the count of items * @param number the count of items
*/ */
{template .itemCount} {template .itemCount}
<span class="todo-count"> <span id="todo-count">{call .itemCountInner data="all"/}</span>
{call .itemCountInner data="all"/}
</span>
{/template} {/template}
/** /**
...@@ -34,7 +29,7 @@ ...@@ -34,7 +29,7 @@
* @param number the count of items * @param number the count of items
*/ */
{template .itemCountInner} {template .itemCountInner}
<span class="number">{$number}</span> <span class="word">{if $number > 1}items{else}item{/if}</span> left. <strong>{$number}</strong> {if $number == 1}item{else}items{/if} left
{/template} {/template}
/** /**
...@@ -42,9 +37,7 @@ ...@@ -42,9 +37,7 @@
* @param number the count of items * @param number the count of items
*/ */
{template .clearCompleted} {template .clearCompleted}
<span class="todo-clear"> <button id="clear-completed">{call .clearCompletedInner data="all"/}</button>
{call .clearCompletedInner data="all"/}
</span>
{/template} {/template}
/** /**
...@@ -52,7 +45,5 @@ ...@@ -52,7 +45,5 @@
* @param number the count of items * @param number the count of items
*/ */
{template .clearCompletedInner} {template .clearCompletedInner}
<a href="#"> Clear completed ({$number})
Clear <span class="number-done">{$number}</span> <span class="word-done">{if $number > 1}items{else}item{/if}</span>
</a>
{/template} {/template}
\ No newline at end of file
{ {
"id" : "todomvc", "id" : "todomvc",
"inputs" : "js/main.js", "inputs" : "js/app.js",
"paths" : "js/", "paths" : "js/",
"output-wrapper" : "(function(){%output%})();", "output-wrapper" : "(function(){%output%})();",
"mode" : "ADVANCED", "mode" : "ADVANCED",
......
File mode changed from 100755 to 100644
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