text: /*
  Mithril v0.1.17
  http://github.com/lhorie/mithril.js
  (c) Leo Horie
  License: MIT
  */
  Mithril=m=new function a(b){function c(){var a=arguments,b=!("[object Object]"!=z.call(a[1])||"tag"in a[1]||"subtree"in a[1]),c=b?a[1]:{},d="class"in c?"class":"className",e=y[a[0]];if(void 0===e){y[a[0]]=e={tag:"div",attrs:{}};for(var f,g=[];f=A.exec(a[0]);)if(""==f[1])e.tag=f[2];else if("#"==f[1])e.attrs.id=f[2];else if("."==f[1])g.push(f[2]);else if("["==f[3][0]){var h=B.exec(f[3]);e.attrs[h[1]]=h[3]||(h[2]?"":!0)}g.length>0&&(e.attrs[d]=g.join(" "))}e=i(e),e.attrs=i(e.attrs),e.children=b?a[2]:a[1];for(var j in c)e.attrs[j]=j==d?(e.attrs[j]||"")+" "+c[j]:c[j];return e}function d(a,c,i,j,k,l,m,n,o,p,q){if((null===k||void 0===k)&&(k=""),"retain"===k.subtree)return l;var r=z.call(l),s=z.call(k);if(r!=s){if(null!==l&&void 0!==l)if(i&&i.nodes){var t=n-j,u=t+("[object Array]"==s?k:l.nodes).length;f(i.nodes.slice(t,u),i.slice(t,u))}else f(l.nodes,l);l=new k.constructor,l.nodes=[]}if("[object Array]"==s){for(var v=[],w=l.length===k.length,x=0,y=1,A=2,B=3,C={},D=!1,E=0;E<l.length;E++)l[E]&&l[E].attrs&&void 0!==l[E].attrs.key&&(D=!0,C[l[E].attrs.key]={action:y,index:E});if(D){for(var E=0;E<k.length;E++)if(k[E]&&k[E].attrs&&void 0!==k[E].attrs.key){var F=k[E].attrs.key;C[F]=C[F]?{action:B,index:E,from:C[F].index,element:a.childNodes[C[F].index]}:{action:A,index:E}}for(var G,H=Object.keys(C).map(function(a){return C[a]}),I=H.sort(function(a,b){return a.action-b.action||b.index-a.index}),J=new Array(l.length),E=0;G=I[E];E++){if(G.action==y&&(f(l[G.index].nodes,l[G.index]),J.splice(G.index,1)),G.action==A){var K=b.document.createElement("div");K.key=k[G.index].attrs.key.toString(),a.insertBefore(K,a.childNodes[G.index]),J.splice(G.index,0,{attrs:{key:k[G.index].attrs.key},nodes:[K]})}G.action==B&&(a.childNodes[G.index]!==G.element&&a.insertBefore(G.element,a.childNodes[G.index]),J[G.index]=l[G.from])}l=J,l.nodes=[];for(var L,E=0;L=a.childNodes[E];E++)l.nodes.push(L)}for(var E=0,M=0;E<k.length;E++){var N=d(a,c,l,n,k[E],l[M],m,n+x||x,o,p,q);void 0!==N&&(N.nodes.intact||(w=!1),x+=N instanceof Array?N.length:1,l[M++]=N)}if(!w){for(var E=0;E<k.length;E++)void 0!==l[E]&&(v=v.concat(l[E].nodes));for(var O,E=v.length;O=l.nodes[E];E++)null!==O.parentNode&&O.parentNode.childNodes.length!=v.length&&(O.parentNode.removeChild(O),l[E]&&g(l[E]));for(var O,E=l.nodes.length;O=v[E];E++)null===O.parentNode&&a.appendChild(O);k.length<l.length&&(l.length=k.length),l.nodes=v}}else if("[object Object]"==s){if((k.tag!=l.tag||Object.keys(k.attrs).join()!=Object.keys(l.attrs).join()||k.attrs.id!=l.attrs.id)&&f(l.nodes,l),"string"!=typeof k.tag)return;var O,P=0===l.nodes.length;k.attrs.xmlns?p=k.attrs.xmlns:"svg"===k.tag&&(p="http://www.w3.org/2000/svg"),P?(O=void 0===p?b.document.createElement(k.tag):b.document.createElementNS(p,k.tag),l={tag:k.tag,children:void 0!==k.children?d(O,k.tag,void 0,void 0,k.children,l.children,!0,0,k.attrs.contenteditable?O:o,p,q):void 0,attrs:e(O,k.tag,k.attrs,{},p),nodes:[O]},a.insertBefore(O,a.childNodes[n]||null)):(O=l.nodes[0],e(O,k.tag,k.attrs,l.attrs,p),l.children=d(O,k.tag,void 0,void 0,k.children,l.children,!1,0,k.attrs.contenteditable?O:o,p,q),l.nodes.intact=!0,m===!0&&a.insertBefore(O,a.childNodes[n]||null)),"[object Function]"==z.call(k.attrs.config)&&q.push(k.attrs.config.bind(b,O,!P,l.configContext=l.configContext||{},l))}else{var v;0===l.nodes.length?(k.$trusted?v=h(a,n,k):(v=[b.document.createTextNode(k)],a.insertBefore(v[0],a.childNodes[n]||null)),l="string number boolean".indexOf(typeof k)>-1?new k.constructor(k):k,l.nodes=v):l.valueOf()!==k.valueOf()||m===!0?(v=l.nodes,o&&o===b.document.activeElement||(k.$trusted?(f(v,l),v=h(a,n,k)):"textarea"===c?a.value=k:o?o.innerHTML=k:((1==v[0].nodeType||v.length>1)&&(f(l.nodes,l),v=[b.document.createTextNode(k)]),a.insertBefore(v[0],a.childNodes[n]||null),v[0].nodeValue=k)),l=new k.constructor(k),l.nodes=v):l.nodes.intact=!0}return l}function e(a,c,d,e,f){for(var g in d){var h=d[g],i=e[g];if(!(g in e)||i!==h||a===b.document.activeElement){if(e[g]=h,"config"===g)continue;if("function"==typeof h&&0==g.indexOf("on"))a[g]=j(h,a);else if("style"===g&&"object"==typeof h){for(var k in h)(void 0===i||i[k]!==h[k])&&(a.style[k]=h[k]);for(var k in i)k in h||(a.style[k]="")}else void 0!==f?"href"===g?a.setAttributeNS("http://www.w3.org/1999/xlink","href",h):"className"===g?a.setAttribute("class",h):a.setAttribute(g,h):"value"===g&&"input"===c?a.value!==h&&(a.value=h):g in a&&"list"!=g&&"style"!=g?a[g]=h:a.setAttribute(g,h)}}return e}function f(a,b){for(var c=a.length-1;c>-1;c--)a[c]&&a[c].parentNode&&(a[c].parentNode.removeChild(a[c]),b=[].concat(b),b[c]&&g(b[c]));a.length=0}function g(a){if(a.configContext&&"function"==typeof a.configContext.onunload&&a.configContext.onunload(),a.children instanceof Array)for(var b=0;b<a.children.length;b++)g(a.children[b])}function h(a,c,d){var e=a.childNodes[c];if(e){var f=1!=e.nodeType,g=b.document.createElement("span");f?(a.insertBefore(g,e),g.insertAdjacentHTML("beforebegin",d),a.removeChild(g)):e.insertAdjacentHTML("beforebegin",d)}else a.insertAdjacentHTML("beforeend",d);for(var h=[];a.childNodes[c]!==e;)h.push(a.childNodes[c]),c++;return h}function i(a){var b={};for(var c in a)b[c]=a[c];return b}function j(a,b){return function(d){d=d||event,c.startComputation();try{return a.call(b,d)}finally{c.endComputation()}}}function k(a){var b=D.indexOf(a);return 0>b?D.push(a)-1:b}function l(){for(var a=0;a<F.length;a++)H[a]&&c.render(F[a],G[a].view(H[a]));L&&(L(),L=null),J=I}function m(a){return a.slice(O[c.route.mode].length)}function n(a,b,d){Q={};var e=d.indexOf("?");-1!==e&&(Q=r(d.substr(e+1,d.length)),d=d.substr(0,e));for(var g in b){if(g==d)return f(a.childNodes,E[k(a)]),c.module(a,b[g]),!0;var h=new RegExp("^"+g.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(h.test(d))return f(a.childNodes,E[k(a)]),d.replace(h,function(){for(var d=g.match(/:[^\/]+/g)||[],e=[].slice.call(arguments,1,-2),f=0;f<d.length;f++)Q[d[f].replace(/:|\./g,"")]=s(e[f]);c.module(a,b[g])}),!0}}function o(a){a=a||event,a.ctrlKey||a.metaKey||2==a.which||(a.preventDefault(),c.route(a.currentTarget[c.route.mode].slice(O[c.route.mode].length)))}function p(){"hash"!=c.route.mode&&b.location.hash?b.location.hash=b.location.hash:b.scrollTo(0,0)}function q(a,b){var c=[];for(var d in a){var e=b?b+"["+d+"]":d,f=a[d];c.push("object"==typeof f?q(f,e):encodeURIComponent(e)+"="+encodeURIComponent(f))}return c.join("&")}function r(a){for(var b=a.split("&"),c={},d=0;d<b.length;d++){var e=b[d].split("=");c[s(e[0])]=e[1]?s(e[1]):1===e.length?!0:""}return c}function s(a){return decodeURIComponent(a.replace(/\+/g," "))}function t(a){return a}function u(a){var c=new b.XMLHttpRequest;if(c.open(a.method,a.url,!0,a.user,a.password),c.onreadystatechange=function(){4===c.readyState&&(c.status>=200&&c.status<300?a.onload({type:"load",target:c}):a.onerror({type:"error",target:c}))},a.serialize==JSON.stringify&&"GET"!=a.method&&c.setRequestHeader("Content-Type","application/json; charset=utf-8"),"function"==typeof a.config){var d=a.config(c,a);void 0!==d&&(c=d)}return c.send(a.data),c}function v(a,b,c){return b&&Object.keys(b).length>0&&("GET"==a.method?a.url=a.url+(a.url.indexOf("?")<0?"?":"&")+q(b):a.data=c(b)),a}function w(a,b){var c=a.match(/:[a-z]\w+/gi);if(c&&b)for(var d=0;d<c.length;d++){var e=c[d].slice(1);a=a.replace(c[d],b[e]),delete b[e]}return a}var x,y={},z={}.toString,A=/(?:(^|#|\.)([^#\.\[\]]+))|(\[.+?\])/g,B=/\[(.+?)(?:=("|'|)(.*?)\2)?\]/,C={insertAdjacentHTML:function(a,c){b.document.write(c),b.document.close()},appendChild:function(a){void 0===x&&(x=b.document.createElement("html")),"HTML"==a.nodeName?x=a:x.appendChild(a),b.document.documentElement!==x&&b.document.replaceChild(x,b.document.documentElement)},insertBefore:function(a){this.appendChild(a)},childNodes:[]},D=[],E={};c.render=function(a,c){var e=[];if(!a)throw new Error("Please ensure the DOM element exists before rendering a template into it.");var g=k(a),h=a==b.document||a==b.document.documentElement?C:a;void 0===E[g]&&f(h.childNodes),E[g]=d(h,null,void 0,void 0,c,E[g],!1,0,null,void 0,e);for(var i=0;i<e.length;i++)e[i]()},c.trust=function(a){return a=new String(a),a.$trusted=!0,a};var F=[],G=[],H=[],I=0,J=0,K=0,L=null;c.module=function(a,b){var d=F.indexOf(a);0>d&&(d=F.length);var e=!1;if(H[d]&&"function"==typeof H[d].onunload){var f={preventDefault:function(){e=!0}};H[d].onunload(f)}e||(c.startComputation(),F[d]=a,G[d]=b,H[d]=new b.controller,c.endComputation())},c.redraw=function(){if(I=b.performance&&b.performance.now?b.performance.now():(new b.Date).getTime(),I-J>16)l();else{var a=b.cancelAnimationFrame||b.clearTimeout,c=b.requestAnimationFrame||b.setTimeout;a(K),K=c(l,0)}};var M=0;c.startComputation=function(){M++},c.endComputation=function(){M=Math.max(M-1,0),0==M&&c.redraw()},c.withAttr=function(a,b){return function(c){c=c||event,b(a in c.currentTarget?c.currentTarget[a]:c.currentTarget.getAttribute(a))}};var N,O={pathname:"",hash:"#",search:"?"},P=function(){},Q={};c.route=function(){if(0===arguments.length)return N;if(3===arguments.length&&"string"==typeof arguments[1]){var a=arguments[0],d=arguments[1],e=arguments[2];P=function(b){var f=N=m(b);n(a,e,f)||c.route(d,!0)};var f="hash"==c.route.mode?"onhashchange":"onpopstate";b[f]=function(){N!=m(b.location[c.route.mode])&&P(b.location[c.route.mode])},L=p,b[f](),N=m(b.location[c.route.mode])}else if(arguments[0].addEventListener){var g=arguments[0],h=arguments[1];g.href.indexOf(O[c.route.mode])<0&&(g.href=b.location.pathname+O[c.route.mode]+g.pathname),h||(g.removeEventListener("click",o),g.addEventListener("click",o))}else if("string"==typeof arguments[0]){N=arguments[0];var i="object"==typeof arguments[1]?q(arguments[1]):null;i&&(N+=(-1===N.indexOf("?")?"?":"&")+i);var j=(3==arguments.length?arguments[2]:arguments[1])===!0;b.history.pushState?(L=function(){b.history[j?"replaceState":"pushState"](null,b.document.title,O[c.route.mode]+N),p()},P(O[c.route.mode]+N)):b.location[c.route.mode]=N}},c.route.param=function(a){return Q[a]},c.route.mode="search",c.prop=function(a){var b=function(){return arguments.length&&(a=arguments[0]),a};return b.toJSON=function(){return a},b};var R={};return c.deferred=function(){var a=[],b=[],d=R,e=R,f=c.prop(),g={resolve:function(c){d===R&&f(d=c);for(var e=0;e<a.length;e++)a[e](c);a.length=b.length=0},reject:function(c){e===R&&(e=c);for(var d=0;d<b.length;d++)b[d](c);a.length=b.length=0},promise:f};return g.promise.resolvers=a,g.promise.then=function(f,g){function h(a,b){return function(c){try{var d=b(c);d&&"function"==typeof d.then?d.then(i[a],g):i[a](void 0!==d?d:c)}catch(e){if(e instanceof Error&&e.constructor!==Error)throw e;i.reject(e)}}}var i=c.deferred();return f||(f=t),g||(g=t),d!==R?h("resolve",f)(d):e!==R?h("reject",g)(e):(a.push(h("resolve",f)),b.push(h("reject",g))),i.promise},g},c.sync=function(a){function b(a,b){return function(c){return g[a]=c,b||(d="reject"),0==--f&&(e.promise(g),e[d](g)),c}}for(var d="resolve",e=c.deferred(),f=a.length,g=new Array(f),h=0;h<a.length;h++)a[h].then(b(h,!0),b(h,!1));return e.promise},c.request=function(a){a.background!==!0&&c.startComputation();var b=c.deferred(),d=a.serialize=a.serialize||JSON.stringify,e=a.deserialize=a.deserialize||JSON.parse,f=a.extract||function(a){return 0===a.responseText.length&&e===JSON.parse?null:a.responseText};return a.url=w(a.url,a.data),a=v(a,a.data,d),a.onload=a.onerror=function(d){try{d=d||event;var g=("load"==d.type?a.unwrapSuccess:a.unwrapError)||t,h=g(e(f(d.target,a)));if("load"==d.type)if(h instanceof Array&&a.type)for(var i=0;i<h.length;i++)h[i]=new a.type(h[i]);else a.type&&(h=new a.type(h));b["load"==d.type?"resolve":"reject"](h)}catch(d){if(d instanceof SyntaxError)throw new SyntaxError("Could not parse HTTP response. See http://lhorie.github.io/mithril/mithril.request.html#using-variable-data-formats");if(d instanceof Error&&d.constructor!==Error)throw d;b.reject(d)}a.background!==!0&&c.endComputation()},u(a),b.promise},c.deps=function(a){return b=a},c.deps.factory=a,c}("undefined"!=typeof window?window:{}),"undefined"!=typeof module&&null!==module&&(module.exports=m),"function"==typeof define&&define.amd&&define(function(){return m});
  //# sourceMappingURL=mithril.min.map