main.js 27 KB

1
  1. !function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=11)}([function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){var r=n(7);n(6),n(3),n(4),n(5),console.log("Hello");var o={view:function(){return r("div","hello Ethica!")}};r.mount(document.getElementById("app"),o)},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,n){(function(t,n){!function(){"use strict";function r(e,t,n,r,o,i){return{tag:e,key:t,attrs:n,children:r,text:o,dom:i,domSize:void 0,state:void 0,_state:void 0,events:void 0,instance:void 0,skip:!1}}function o(e){for(var t,n="div",r=[],o={};t=u.exec(e);){var i=t[1],a=t[2];if(""===i&&""!==a)n=a;else if("#"===i)o.id=a;else if("."===i)r.push(a);else if("["===t[3][0]){var l=t[6];l&&(l=l.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")),"class"===t[4]?r.push(l):o[t[4]]=l||!0}}return r.length>0&&(o.className=r.join(" ")),c[e]={tag:n,attrs:o}}function i(e,t,n){var o,i,a=!1,l=t.className||t.class;for(var u in e.attrs)s.call(e.attrs,u)&&(t[u]=e.attrs[u]);void 0!==l&&(void 0!==t.class&&(t.class=void 0,t.className=l),null!=e.attrs.className&&(t.className=e.attrs.className+" "+l));for(var u in t)if(s.call(t,u)&&"key"!==u){a=!0;break}return Array.isArray(n)&&1===n.length&&null!=n[0]&&"#"===n[0].tag?i=n[0].children:o=n,r(e.tag,t.key,a?t:void 0,o,i)}function a(e){var t,n=arguments[1],a=2;if(null==e||"string"!=typeof e&&"function"!=typeof e&&"function"!=typeof e.view)throw Error("The selector must be either a string or a component.");if("string"==typeof e)var l=c[e]||o(e);if(null==n?n={}:("object"!=typeof n||null!=n.tag||Array.isArray(n))&&(n={},a=1),arguments.length===a+1)t=arguments[a],Array.isArray(t)||(t=[t]);else for(t=[];a<arguments.length;)t.push(arguments[a++]);var u=r.normalizeChildren(t);return"string"==typeof e?i(l,n,u):r(e,n.key,n,u)}function l(e){var t=0,n=null,r="function"==typeof requestAnimationFrame?requestAnimationFrame:setTimeout;return function(){var o=Date.now();0===t||o-t>=16?(t=o,e()):null===n&&(n=r(function(){n=null,e(),t=Date.now()},16-(o-t)))}}r.normalize=function(e){return Array.isArray(e)?r("[",void 0,void 0,r.normalizeChildren(e),void 0,void 0):null!=e&&"object"!=typeof e?r("#",void 0,void 0,!1===e?"":e,void 0,void 0):e},r.normalizeChildren=function(e){for(var t=0;t<e.length;t++)e[t]=r.normalize(e[t]);return e};var u=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,c={},s={}.hasOwnProperty;a.trust=function(e){return null==e&&(e=""),r("<",void 0,void 0,e,void 0,void 0)},a.fragment=function(e,t){return r("[",e.key,e,r.normalizeChildren(t),void 0,void 0)};var f=a,d=function(e){function n(e,t){return function n(l){var f;try{if(!t||null==l||"object"!=typeof l&&"function"!=typeof l||"function"!=typeof(f=l.then))s(function(){t||0!==e.length||console.error("Possible unhandled promise rejection:",l);for(var r=0;r<e.length;r++)e[r](l);i.length=0,a.length=0,c.state=t,c.retry=function(){n(l)}});else{if(l===o)throw new TypeError("Promise can't be resolved w/ itself");r(f.bind(l))}}catch(e){u(e)}}}function r(e){function t(e){return function(t){n++>0||e(t)}}var n=0,r=t(u);try{e(t(l),r)}catch(e){r(e)}}if(!(this instanceof d))throw new Error("Promise must be called with `new`");if("function"!=typeof e)throw new TypeError("executor must be a function");var o=this,i=[],a=[],l=n(i,!0),u=n(a,!1),c=o._instance={resolvers:i,rejectors:a},s="function"==typeof t?t:setTimeout;r(e)};if(d.prototype.then=function(e,t){function n(e,t,n,i){t.push(function(t){if("function"!=typeof e)n(t);else try{r(e(t))}catch(e){o&&o(e)}}),"function"==typeof a.retry&&i===a.state&&a.retry()}var r,o,i=this,a=i._instance,l=new d(function(e,t){r=e,o=t});return n(e,a.resolvers,r,!0),n(t,a.rejectors,o,!1),l},d.prototype.catch=function(e){return this.then(null,e)},d.resolve=function(e){return e instanceof d?e:new d(function(t){t(e)})},d.reject=function(e){return new d(function(t,n){n(e)})},d.all=function(e){return new d(function(t,n){var r=e.length,o=0,i=[];if(0===e.length)t([]);else for(var a=0;a<e.length;a++)!function(a){function l(e){o++,i[a]=e,o===r&&t(i)}null==e[a]||"object"!=typeof e[a]&&"function"!=typeof e[a]||"function"!=typeof e[a].then?l(e[a]):e[a].then(l,n)}(a)})},d.race=function(e){return new d(function(t,n){for(var r=0;r<e.length;r++)e[r].then(t,n)})},"undefined"!=typeof window){void 0===window.Promise&&(window.Promise=d);var d=window.Promise}else if(void 0!==n){void 0===n.Promise&&(n.Promise=d);var d=n.Promise}var v=function(e){function t(e,r){if(Array.isArray(r))for(var o=0;o<r.length;o++)t(e+"["+o+"]",r[o]);else if("[object Object]"===Object.prototype.toString.call(r))for(var o in r)t(e+"["+o+"]",r[o]);else n.push(encodeURIComponent(e)+(null!=r&&""!==r?"="+encodeURIComponent(r):""))}if("[object Object]"!==Object.prototype.toString.call(e))return"";var n=[];for(var r in e)t(r,e[r]);return n.join("&")},h=new RegExp("^file://","i"),m=function(e,t){function n(e){d=e}function r(){function e(){0==--t&&"function"==typeof d&&d()}var t=0;return function n(r){var o=r.then;return r.then=function(){t++;var i=o.apply(r,arguments);return i.then(e,function(n){if(e(),0===t)throw n}),n(i)},r}}function o(e,t){if("string"==typeof e){var n=e;e=t||{},null==e.url&&(e.url=n)}return e}function i(n,i){var a=r();n=o(n,i);var d=new t(function(t,r){null==n.method&&(n.method="GET"),n.method=n.method.toUpperCase();var o="GET"!==n.method&&"TRACE"!==n.method&&("boolean"!=typeof n.useBody||n.useBody);"function"!=typeof n.serialize&&(n.serialize="undefined"!=typeof FormData&&n.data instanceof FormData?function(e){return e}:JSON.stringify),"function"!=typeof n.deserialize&&(n.deserialize=c),"function"!=typeof n.extract&&(n.extract=s),n.url=l(n.url,n.data),o?n.data=n.serialize(n.data):n.url=u(n.url,n.data);var i=new e.XMLHttpRequest,a=!1,d=i.abort;i.abort=function(){a=!0,d.call(i)},i.open(n.method,n.url,"boolean"!=typeof n.async||n.async,"string"==typeof n.user?n.user:void 0,"string"==typeof n.password?n.password:void 0),n.serialize===JSON.stringify&&o&&i.setRequestHeader("Content-Type","application/json; charset=utf-8"),n.deserialize===c&&i.setRequestHeader("Accept","application/json, text/*"),n.withCredentials&&(i.withCredentials=n.withCredentials);for(var v in n.headers)({}).hasOwnProperty.call(n.headers,v)&&i.setRequestHeader(v,n.headers[v]);"function"==typeof n.config&&(i=n.config(i,n)||i),i.onreadystatechange=function(){if(!a&&4===i.readyState)try{var e=n.extract!==s?n.extract(i,n):n.deserialize(n.extract(i,n));if(i.status>=200&&i.status<300||304===i.status||h.test(n.url))t(f(n.type,e));else{var o=new Error(i.responseText);for(var l in e)o[l]=e[l];r(o)}}catch(e){r(e)}},o&&null!=n.data?i.send(n.data):i.send()});return!0===n.background?d:a(d)}function a(n,i){var a=r();n=o(n,i);var c=new t(function(t,r){var o=n.callbackName||"_mithril_"+Math.round(1e16*Math.random())+"_"+m++,i=e.document.createElement("script");e[o]=function(r){i.parentNode.removeChild(i),t(f(n.type,r)),delete e[o]},i.onerror=function(){i.parentNode.removeChild(i),r(new Error("JSONP request failed")),delete e[o]},null==n.data&&(n.data={}),n.url=l(n.url,n.data),n.data[n.callbackKey||"callback"]=o,i.src=u(n.url,n.data),e.document.documentElement.appendChild(i)});return!0===n.background?c:a(c)}function l(e,t){if(null==t)return e;for(var n=e.match(/:[^\/]+/gi)||[],r=0;r<n.length;r++){var o=n[r].slice(1);null!=t[o]&&(e=e.replace(n[r],t[o]))}return e}function u(e,t){var n=v(t);if(""!==n){e+=(e.indexOf("?")<0?"?":"&")+n}return e}function c(e){try{return""!==e?JSON.parse(e):null}catch(t){throw new Error(e)}}function s(e){return e.responseText}function f(e,t){if("function"==typeof e){if(!Array.isArray(t))return new e(t);for(var n=0;n<t.length;n++)t[n]=new e(t[n])}return t}var d,m=0;return{request:i,jsonp:a,setCompletionCallback:n}}(window,d),p=function(e){function t(e){return U=e}function n(e,t,n,r,i,a,l){for(var u=n;u<r;u++){var c=t[u];null!=c&&o(e,c,i,l,a)}}function o(e,t,n,r,o){var c=t.tag;if("string"!=typeof c)return s(e,t,n,r,o);switch(t.state={},null!=t.attrs&&F(t.attrs,t,n),c){case"#":return i(e,t,o);case"<":return a(e,t,o);case"[":return l(e,t,n,r,o);default:return u(e,t,n,r,o)}}function i(e,t,n){return t.dom=B.createTextNode(t.children),T(e,t.dom,n),t.dom}function a(e,t,n){var r=t.children.match(/^\s*?<(\w+)/im)||[],o={caption:"table",thead:"table",tbody:"table",tfoot:"table",tr:"tbody",th:"tr",td:"tr",colgroup:"table",col:"colgroup"}[r[1]]||"div",i=B.createElement(o);i.innerHTML=t.children,t.dom=i.firstChild,t.domSize=i.childNodes.length;for(var a,l=B.createDocumentFragment();a=i.firstChild;)l.appendChild(a);return T(e,l,n),l}function l(e,t,r,o,i){var a=B.createDocumentFragment();if(null!=t.children){var l=t.children;n(a,l,0,l.length,r,null,o)}return t.dom=a.firstChild,t.domSize=a.childNodes.length,T(e,a,i),a}function u(e,t,o,i,a){var l=t.tag;switch(t.tag){case"svg":i="http://www.w3.org/2000/svg";break;case"math":i="http://www.w3.org/1998/Math/MathML"}var u=t.attrs,c=u&&u.is,s=i?c?B.createElementNS(i,l,{is:c}):B.createElementNS(i,l):c?B.createElement(l,{is:c}):B.createElement(l);if(t.dom=s,null!=u&&z(t,u,i),T(e,s,a),null!=t.attrs&&null!=t.attrs.contenteditable)k(t);else if(null!=t.text&&(""!==t.text?s.textContent=t.text:t.children=[r("#",void 0,void 0,t.text,void 0,void 0)]),null!=t.children){var f=t.children;n(s,f,0,f.length,o,null,i),j(t)}return s}function c(e,t){var n;if("function"==typeof e.tag.view){if(e.state=Object.create(e.tag),n=e.state.view,null!=n.$$reentrantLock$$)return J;n.$$reentrantLock$$=!0}else{if(e.state=void 0,n=e.tag,null!=n.$$reentrantLock$$)return J;n.$$reentrantLock$$=!0,e.state=null!=e.tag.prototype&&"function"==typeof e.tag.prototype.view?new e.tag(e):e.tag(e)}if(e._state=e.state,null!=e.attrs&&F(e.attrs,e,t),F(e._state,e,t),e.instance=r.normalize(e._state.view.call(e.state,e)),e.instance===e)throw Error("A view cannot return the vnode it received as argument");n.$$reentrantLock$$=null}function s(e,t,n,r,i){if(c(t,n),null!=t.instance){var a=o(e,t.instance,n,r,i);return t.dom=t.instance.dom,t.domSize=null!=t.dom?t.instance.domSize:0,T(e,a,i),a}return t.domSize=0,J}function f(e,t,r,i,a,l,u){if(t!==r&&(null!=t||null!=r))if(null==t)n(e,r,0,r.length,a,l,void 0);else if(null==r)E(t,0,t.length,r);else{if(t.length===r.length){for(var c=!1,s=0;s<r.length;s++)if(null!=r[s]&&null!=t[s]){c=null==r[s].key&&null==t[s].key;break}if(c){for(var s=0;s<t.length;s++)t[s]!==r[s]&&(null==t[s]&&null!=r[s]?o(e,r[s],a,u,x(t,s+1,l)):null==r[s]?E(t,s,s+1,r):d(e,t[s],r[s],a,x(t,s+1,l),i,u));return}}if(i=i||y(t,r)){var f=t.pool;t=t.concat(t.pool)}for(var v,h=0,m=0,p=t.length-1,g=r.length-1;p>=h&&g>=m;){var k=t[h],C=r[m];if(k!==C||i)if(null==k)h++;else if(null==C)m++;else if(k.key===C.key){var S=null!=f&&h>=t.length-f.length||null==f&&i;h++,m++,d(e,k,C,a,x(t,h,l),S,u),i&&k.tag===C.tag&&T(e,b(k),l)}else{var k=t[p];if(k!==C||i)if(null==k)p--;else if(null==C)m++;else{if(k.key!==C.key)break;var S=null!=f&&p>=t.length-f.length||null==f&&i;d(e,k,C,a,x(t,p+1,l),S,u),(i||m<g)&&T(e,b(k),x(t,h,l)),p--,m++}else p--,m++}else h++,m++}for(;p>=h&&g>=m;){var k=t[p],C=r[g];if(k!==C||i)if(null==k)p--;else if(null==C)g--;else if(k.key===C.key){var S=null!=f&&p>=t.length-f.length||null==f&&i;d(e,k,C,a,x(t,p+1,l),S,u),i&&k.tag===C.tag&&T(e,b(k),l),null!=k.dom&&(l=k.dom),p--,g--}else{if(v||(v=w(t,p)),null!=C){var A=v[C.key];if(null!=A){var z=t[A],S=null!=f&&A>=t.length-f.length||null==f&&i;d(e,z,C,a,x(t,p+1,l),i,u),T(e,b(z),l),t[A].skip=!0,null!=z.dom&&(l=z.dom)}else{var _=o(e,C,a,void 0,l);l=_}}g--}else p--,g--;if(g<m)break}n(e,r,m,g+1,a,l,u),E(t,h,p+1,r)}}function d(e,t,n,r,i,a,l){var u=t.tag;if(u===n.tag){if(n.state=t.state,n._state=t._state,n.events=t.events,!a&&q(n,t))return;if("string"==typeof u)switch(null!=n.attrs&&(a?(n.state={},F(n.attrs,n,r)):D(n.attrs,n,r)),u){case"#":v(t,n);break;case"<":h(e,t,n,i);break;case"[":m(e,t,n,a,r,i,l);break;default:p(t,n,a,r,l)}else g(e,t,n,r,i,a,l)}else C(t,null),o(e,n,r,l,i)}function v(e,t){e.children.toString()!==t.children.toString()&&(e.dom.nodeValue=t.children),t.dom=e.dom}function h(e,t,n,r){t.children!==n.children?(b(t),a(e,n,r)):(n.dom=t.dom,n.domSize=t.domSize)}function m(e,t,n,r,o,i,a){f(e,t.children,n.children,r,o,i,a);var l=0,u=n.children;if(n.dom=null,null!=u){for(var c=0;c<u.length;c++){var s=u[c];null!=s&&null!=s.dom&&(null==n.dom&&(n.dom=s.dom),l+=s.domSize||1)}1!==l&&(n.domSize=l)}}function p(e,t,n,o,i){var a=t.dom=e.dom;switch(t.tag){case"svg":i="http://www.w3.org/2000/svg";break;case"math":i="http://www.w3.org/1998/Math/MathML"}"textarea"===t.tag&&(null==t.attrs&&(t.attrs={}),null!=t.text&&(t.attrs.value=t.text,t.text=void 0)),I(t,e.attrs,t.attrs,i),null!=t.attrs&&null!=t.attrs.contenteditable?k(t):null!=e.text&&null!=t.text&&""!==t.text?e.text.toString()!==t.text.toString()&&(e.dom.firstChild.nodeValue=t.text):(null!=e.text&&(e.children=[r("#",void 0,void 0,e.text,void 0,e.dom.firstChild)]),null!=t.text&&(t.children=[r("#",void 0,void 0,t.text,void 0,void 0)]),f(a,e.children,t.children,n,o,null,i))}function g(e,t,n,i,a,l,u){if(l)c(n,i);else{if(n.instance=r.normalize(n._state.view.call(n.state,n)),n.instance===n)throw Error("A view cannot return the vnode it received as argument");null!=n.attrs&&D(n.attrs,n,i),D(n._state,n,i)}null!=n.instance?(null==t.instance?o(e,n.instance,i,u,a):d(e,t.instance,n.instance,i,a,l,u),n.dom=n.instance.dom,n.domSize=n.instance.domSize):null!=t.instance?(C(t.instance,null),n.dom=void 0,n.domSize=0):(n.dom=t.dom,n.domSize=t.domSize)}function y(e,t){if(null!=e.pool&&Math.abs(e.pool.length-t.length)<=Math.abs(e.length-t.length)){var n=e[0]&&e[0].children&&e[0].children.length||0,r=e.pool[0]&&e.pool[0].children&&e.pool[0].children.length||0,o=t[0]&&t[0].children&&t[0].children.length||0;if(Math.abs(r-o)<=Math.abs(n-o))return!0}return!1}function w(e,t){for(var n={},r=0,r=0;r<t;r++){var o=e[r];if(null!=o){var i=o.key;null!=i&&(n[i]=r)}}return n}function b(e){var t=e.domSize;if(null!=t||null==e.dom){var n=B.createDocumentFragment();if(t>0){for(var r=e.dom;--t;)n.appendChild(r.nextSibling);n.insertBefore(r,n.firstChild)}return n}return e.dom}function x(e,t,n){for(;t<e.length;t++)if(null!=e[t]&&null!=e[t].dom)return e[t].dom;return n}function T(e,t,n){n&&n.parentNode?e.insertBefore(t,n):e.appendChild(t)}function k(e){var t=e.children;if(null!=t&&1===t.length&&"<"===t[0].tag){var n=t[0].children;e.dom.innerHTML!==n&&(e.dom.innerHTML=n)}else if(null!=e.text||null!=t&&0!==t.length)throw new Error("Child node of a contenteditable must be trusted")}function E(e,t,n,r){for(var o=t;o<n;o++){var i=e[o];null!=i&&(i.skip?i.skip=!1:C(i,r))}}function C(e,t){function n(){if(++o===r&&(A(e),e.dom)){var n=e.domSize||1;if(n>1)for(var i=e.dom;--n;)S(i.nextSibling);S(e.dom),null==t||null!=e.domSize||P(e.attrs)||"string"!=typeof e.tag||(t.pool?t.pool.push(e):t.pool=[e])}}var r=1,o=0;if(e.attrs&&"function"==typeof e.attrs.onbeforeremove){var i=e.attrs.onbeforeremove.call(e.state,e);null!=i&&"function"==typeof i.then&&(r++,i.then(n,n))}if("string"!=typeof e.tag&&"function"==typeof e._state.onbeforeremove){var i=e._state.onbeforeremove.call(e.state,e);null!=i&&"function"==typeof i.then&&(r++,i.then(n,n))}n()}function S(e){var t=e.parentNode;null!=t&&t.removeChild(e)}function A(e){if(e.attrs&&"function"==typeof e.attrs.onremove&&e.attrs.onremove.call(e.state,e),"string"!=typeof e.tag&&"function"==typeof e._state.onremove&&e._state.onremove.call(e.state,e),null!=e.instance)A(e.instance);else{var t=e.children;if(Array.isArray(t))for(var n=0;n<t.length;n++){var r=t[n];null!=r&&A(r)}}}function z(e,t,n){for(var r in t)_(e,r,null,t[r],n)}function _(e,t,n,r,o){var i=e.dom;if("key"!==t&&"is"!==t&&(n!==r||O(e,t)||"object"==typeof r)&&void 0!==r&&!M(t)){var a=t.indexOf(":");if(a>-1&&"xlink"===t.substr(0,a))i.setAttributeNS("http://www.w3.org/1999/xlink",t.slice(a+1),r);else if("o"===t[0]&&"n"===t[1]&&"function"==typeof r)R(e,t,r);else if("style"===t)L(i,n,r);else if(t in i&&!N(t)&&void 0===o&&!$(e)){if("input"===e.tag&&"value"===t&&e.dom.value==r&&e.dom===B.activeElement)return;if("select"===e.tag&&"value"===t&&e.dom.value==r&&e.dom===B.activeElement)return;if("option"===e.tag&&"value"===t&&e.dom.value==r)return;if("input"===e.tag&&"type"===t)return void i.setAttribute(t,r);i[t]=r}else"boolean"==typeof r?r?i.setAttribute(t,""):i.removeAttribute(t):i.setAttribute("className"===t?"class":t,r)}}function j(e){var t=e.attrs;"select"===e.tag&&null!=t&&("value"in t&&_(e,"value",null,t.value,void 0),"selectedIndex"in t&&_(e,"selectedIndex",null,t.selectedIndex,void 0))}function I(e,t,n,r){if(null!=n)for(var o in n)_(e,o,t&&t[o],n[o],r);if(null!=t)for(var o in t)null!=n&&o in n||("className"===o&&(o="class"),"o"!==o[0]||"n"!==o[1]||M(o)?"key"!==o&&e.dom.removeAttribute(o):R(e,o,void 0))}function O(e,t){return"value"===t||"checked"===t||"selectedIndex"===t||"selected"===t&&e.dom===B.activeElement}function M(e){return"oninit"===e||"oncreate"===e||"onupdate"===e||"onremove"===e||"onbeforeremove"===e||"onbeforeupdate"===e}function N(e){return"href"===e||"list"===e||"form"===e||"width"===e||"height"===e}function $(e){return e.attrs.is||e.tag.indexOf("-")>-1}function P(e){return null!=e&&(e.oncreate||e.onupdate||e.onbeforeremove||e.onremove)}function L(e,t,n){if(t===n&&(e.style.cssText="",t=null),null==n)e.style.cssText="";else if("string"==typeof n)e.style.cssText=n;else{"string"==typeof t&&(e.style.cssText="");for(var r in n)e.style[r]=n[r];if(null!=t&&"string"!=typeof t)for(var r in t)r in n||(e.style[r]="")}}function R(e,t,n){var r=e.dom,o="function"!=typeof U?n:function(e){var t=n.call(r,e);return U.call(r,e),t};if(t in r)r[t]="function"==typeof n?o:null;else{var i=t.slice(2);if(void 0===e.events&&(e.events={}),e.events[t]===o)return;null!=e.events[t]&&r.removeEventListener(i,e.events[t],!1),"function"==typeof n&&(e.events[t]=o,r.addEventListener(i,e.events[t],!1))}}function F(e,t,n){"function"==typeof e.oninit&&e.oninit.call(t.state,t),"function"==typeof e.oncreate&&n.push(e.oncreate.bind(t.state,t))}function D(e,t,n){"function"==typeof e.onupdate&&n.push(e.onupdate.bind(t.state,t))}function q(e,t){var n,r;return null!=e.attrs&&"function"==typeof e.attrs.onbeforeupdate&&(n=e.attrs.onbeforeupdate.call(e.state,e,t)),"string"!=typeof e.tag&&"function"==typeof e._state.onbeforeupdate&&(r=e._state.onbeforeupdate.call(e.state,e,t)),!(void 0===n&&void 0===r||n||r)&&(e.dom=t.dom,e.domSize=t.domSize,e.instance=t.instance,!0)}function H(e,t){if(!e)throw new Error("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var n=[],o=B.activeElement;null==e.vnodes&&(e.textContent=""),Array.isArray(t)||(t=[t]),f(e,e.vnodes,r.normalizeChildren(t),!1,n,null,void 0),e.vnodes=t;for(var i=0;i<n.length;i++)n[i]();B.activeElement!==o&&o.focus()}var U,B=e.document,J=B.createDocumentFragment();return{render:H,setEventCallback:t}},g=function(e){function t(e,t){n(e),i.push(e,l(t))}function n(e){var t=i.indexOf(e);t>-1&&i.splice(t,2)}function r(){for(var e=1;e<i.length;e+=2)i[e]()}var o=p(e);o.setEventCallback(function(e){!1!==e.redraw&&r()});var i=[];return{subscribe:t,unsubscribe:n,redraw:r,render:o.render}}(window);m.setCompletionCallback(g.redraw);f.mount=function(e){return function(t,n){if(null===n)return e.render(t,[]),void e.unsubscribe(t);if(null==n.view&&"function"!=typeof n)throw new Error("m.mount(element, component) expects a component, not a vnode");var o=function(){e.render(t,r(n))};e.subscribe(t,o),e.redraw()}}(g);var y=d,w=function(e){if(""===e||null==e)return{};"?"===e.charAt(0)&&(e=e.slice(1));for(var t=e.split("&"),n={},r={},o=0;o<t.length;o++){var i=t[o].split("="),a=decodeURIComponent(i[0]),l=2===i.length?decodeURIComponent(i[1]):"";"true"===l?l=!0:"false"===l&&(l=!1);var u=a.split(/\]\[?|\[/),c=n;a.indexOf("[")>-1&&u.pop();for(var s=0;s<u.length;s++){var f=u[s],d=u[s+1],v=""==d||!isNaN(parseInt(d,10)),h=s===u.length-1;if(""===f){var a=u.slice(0,s).join();null==r[a]&&(r[a]=0),f=r[a]++}null==c[f]&&(c[f]=h?l:v?[]:{}),c=c[f]}}return n},b=function(e){function n(t){var n=e.location[t].replace(/(?:%[a-f89][a-f0-9])+/gim,decodeURIComponent);return"pathname"===t&&"/"!==n[0]&&(n="/"+n),n}function r(e){return function(){null==i&&(i=l(function(){i=null,e()}))}}function o(e,t,n){var r=e.indexOf("?"),o=e.indexOf("#"),i=r>-1?r:o>-1?o:e.length;if(r>-1){var a=o>-1?o:e.length,l=w(e.slice(r+1,a));for(var u in l)t[u]=l[u]}if(o>-1){var c=w(e.slice(o+1));for(var u in c)n[u]=c[u]}return e.slice(0,i)}var i,a="function"==typeof e.history.pushState,l="function"==typeof t?t:setTimeout,u={prefix:"#!"};return u.getPath=function(){switch(u.prefix.charAt(0)){case"#":return n("hash").slice(u.prefix.length);case"?":return n("search").slice(u.prefix.length)+n("hash");default:return n("pathname").slice(u.prefix.length)+n("search")+n("hash")}},u.setPath=function(t,n,r){var i={},l={};if(t=o(t,i,l),null!=n){for(var c in n)i[c]=n[c];t=t.replace(/:([^\/]+)/g,function(e,t){return delete i[t],n[t]})}var s=v(i);s&&(t+="?"+s);var f=v(l);if(f&&(t+="#"+f),a){var d=r?r.state:null,h=r?r.title:null;e.onpopstate(),r&&r.replace?e.history.replaceState(d,h,u.prefix+t):e.history.pushState(d,h,u.prefix+t)}else e.location.href=u.prefix+t},u.defineRoutes=function(t,n,i){function l(){var r=u.getPath(),a={},l=o(r,a,a),c=e.history.state;if(null!=c)for(var s in c)a[s]=c[s];for(var f in t){var d=new RegExp("^"+f.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(d.test(l))return void l.replace(d,function(){for(var e=f.match(/:[^\/]+/g)||[],o=[].slice.call(arguments,1,-2),i=0;i<e.length;i++)a[e[i].replace(/:|\./g,"")]=decodeURIComponent(o[i]);n(t[f],a,r,f)})}i(r,a)}a?e.onpopstate=r(l):"#"===u.prefix.charAt(0)&&(e.onhashchange=l),l()},u};f.route=function(e,t){var n,o,i,a,l,u=b(e),c=function(e){return e},s=function(e,s,f){if(null==e)throw new Error("Ensure the DOM element that was passed to `m.route` is not undefined");var d=function(){null!=n&&t.render(e,n(r(o,i.key,i)))},v=function(e){if(e===s)throw new Error("Could not resolve default route "+s);u.setPath(s,null,{replace:!0})};u.defineRoutes(f,function(e,t,r){var u=l=function(e,s){u===l&&(o=null==s||"function"!=typeof s.view&&"function"!=typeof s?"div":s,i=t,a=r,l=null,n=(e.render||c).bind(e),d())};e.view||"function"==typeof e?u({},e):e.onmatch?y.resolve(e.onmatch(t,r)).then(function(t){u(e,t)},v):u(e,"div")},v),t.subscribe(e,d)};return s.set=function(e,t,n){null!=l&&(n={replace:!0}),l=null,u.setPath(e,t,n)},s.get=function(){return a},s.prefix=function(e){u.prefix=e},s.link=function(e){e.dom.setAttribute("href",u.prefix+e.attrs.href),e.dom.onclick=function(e){if(!(e.ctrlKey||e.metaKey||e.shiftKey||2===e.which)){e.preventDefault(),e.redraw=!1;var t=this.getAttribute("href");0===t.indexOf(u.prefix)&&(t=t.slice(u.prefix.length)),s.set(t,void 0,void 0)}}},s.param=function(e){return void 0!==i&&void 0!==e?i[e]:i},s}(window,g),f.withAttr=function(e,t,n){return function(r){t.call(n||this,e in r.currentTarget?r.currentTarget[e]:r.currentTarget.getAttribute(e))}};var x=p(window);f.render=x.render,f.redraw=g.redraw,f.request=m.request,f.jsonp=m.jsonp,f.parseQueryString=w,f.buildQueryString=v,f.version="1.1.1",f.vnode=r,e.exports=f}()}).call(t,n(10).setImmediate,n(0))},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(s===setTimeout)return setTimeout(e,0);if((s===n||!s)&&setTimeout)return s=setTimeout,setTimeout(e,0);try{return s(e,0)}catch(t){try{return s.call(null,e,0)}catch(t){return s.call(this,e,0)}}}function i(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function a(){m&&v&&(m=!1,v.length?h=v.concat(h):p=-1,h.length&&l())}function l(){if(!m){var e=o(a);m=!0;for(var t=h.length;t;){for(v=h,h=[];++p<t;)v&&v[p].run();p=-1,t=h.length}v=null,m=!1,i(e)}}function u(e,t){this.fun=e,this.array=t}function c(){}var s,f,d=e.exports={};!function(){try{s="function"==typeof setTimeout?setTimeout:n}catch(e){s=n}try{f="function"==typeof clearTimeout?clearTimeout:r}catch(e){f=r}}();var v,h=[],m=!1,p=-1;d.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];h.push(new u(e,t)),1!==h.length||m||o(l)},u.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(e){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(e){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(e,t,n){(function(e,t){!function(e,n){"use strict";function r(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var r={callback:e,args:t};return c[u]=r,l(u),u++}function o(e){delete c[e]}function i(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(n,r)}}function a(e){if(s)setTimeout(a,0,e);else{var t=c[e];if(t){s=!0;try{i(t)}finally{o(e),s=!1}}}}if(!e.setImmediate){var l,u=1,c={},s=!1,f=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,"[object process]"==={}.toString.call(e.process)?function(){l=function(e){t.nextTick(function(){a(e)})}}():function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?function(){var t="setImmediate$"+Math.random()+"$",n=function(n){n.source===e&&"string"==typeof n.data&&0===n.data.indexOf(t)&&a(+n.data.slice(t.length))};e.addEventListener?e.addEventListener("message",n,!1):e.attachEvent("onmessage",n),l=function(n){e.postMessage(t+n,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){a(e.data)},l=function(t){e.port2.postMessage(t)}}():f&&"onreadystatechange"in f.createElement("script")?function(){var e=f.documentElement;l=function(t){var n=f.createElement("script");n.onreadystatechange=function(){a(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}():function(){l=function(e){setTimeout(a,0,e)}}(),d.setImmediate=r,d.clearImmediate=o}}("undefined"==typeof self?void 0===e?this:e:self)}).call(t,n(0),n(8))},function(e,t,n){function r(e,t){this._id=e,this._clearFn=t}var o=Function.prototype.apply;t.setTimeout=function(){return new r(o.call(setTimeout,window,arguments),clearTimeout)},t.setInterval=function(){return new r(o.call(setInterval,window,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(window,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(9),t.setImmediate=setImmediate,t.clearImmediate=clearImmediate},function(e,t,n){n(1),e.exports=n(2)}]);