text: var route=function(e){"use strict";e=e&&"default"in e?e["default"]:e;var t=function(e){e=e||{};var t={},r=Array.prototype.slice;Object.defineProperties(e,{on:{value:function(r,n){if(typeof n=="function"){(t[r]=t[r]||[]).push(n)}return e},enumerable:false,writable:false,configurable:false},off:{value:function(r,n){if(r=="*"&&!n){t={}}else{if(n){var i=t[r];for(var a=0,f;f=i&&i[a];++a){if(f==n){i.splice(a--,1)}}}else{delete t[r]}}return e},enumerable:false,writable:false,configurable:false},one:{value:function(t,r){function n(){e.off(t,n);r.apply(e,arguments)}return e.on(t,n)},enumerable:false,writable:false,configurable:false},trigger:{value:function(n){var i=arguments;var a=arguments.length-1,f=new Array(a),u,o,c;for(c=0;c<a;c++){f[c]=i[c+1]}u=r.call(t[n]||[],0);for(c=0;o=u[c];++c){o.apply(e,f)}if(t["*"]&&n!="*"){e.trigger.apply(e,["*",n].concat(f))}return e},enumerable:false,writable:false,configurable:false}});return e};var r=/^.+?\/\/+[^/]+/;var n="EventListener";var i="remove"+n;var a="add"+n;var f="hasAttribute";var u="popstate";var o="hashchange";var c="trigger";var s=3;var l=typeof window!="undefined"&&window;var h=typeof document!="undefined"&&document;var v=l&&history;var p=l&&(v.location||l.location);var d=k.prototype;var m=h&&h.ontouchstart?"touchstart":"click";var g=t();var y=false;var b=false;var w;var $;var A;var S;var x;var E=[];var O=0;function T(e){return e.split(/[/?#]/)}function K(e,t){var r=t.replace(/\?/g,"\\?").replace(/\*/g,"([^/?#]+?)").replace(/\.\./,".*");var n=new RegExp("^"+r+"$");var i=e.match(n);if(i){return i.slice(1)}}function N(e,t){var r;return function(){clearTimeout(r);r=setTimeout(e,t)}}function j(e){w=N(R,1);l[a](u,w);l[a](o,w);h[a](m,_);if(e){R(true)}}function k(){this.$=[];t(this);g.on("stop",this.s.bind(this));g.on("emit",this.e.bind(this))}function P(e){return e.replace(/^\/|\/$/,"")}function q(e){return typeof e=="string"}function D(e){return(e||p.href).replace(r,"")}function L(e){return $[0]==="#"?(e||p.href||"").split($)[1]||"":(p?D(e):e||"").replace($,"")}function R(e){var t=O===0;if(s<=O){return}O++;E.push(function(){var t=L();if(e||t!==A){g[c]("emit",t);A=t}});if(t){var r;while(r=E.shift()){r()}O=0}}function _(e){if(e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.defaultPrevented){return}var t=e.target;while(t&&t.nodeName!=="A"){t=t.parentNode}if(!t||t.nodeName!=="A"||t[f]("download")||!t[f]("href")||t.target&&t.target!=="_self"||t.href.indexOf(p.href.match(r)[0])===-1){return}if(t.href!==p.href&&(t.href.split("#")[0]===p.href.split("#")[0]||$[0]!=="#"&&D(t.href).indexOf($)!==0||$[0]==="#"&&t.href.split($)[0]!==p.href.split($)[0]||!z(L(t.href),t.title||h.title))){return}e.preventDefault()}function z(e,t,r){if(!v){return g[c]("emit",L(e))}e=$+P(e);t=t||h.title;r?v.replaceState(null,t,e):v.pushState(null,t,e);h.title=t;b=false;R();return b}d.m=function(e,t,r){if(q(e)&&(!t||q(t))){z(e,t,r||false)}else if(t){this.r(e,t)}else{this.r("@",e)}};d.s=function(){this.off("*");this.$=[]};d.e=function(e){this.$.concat("@").some(function(t){var r=(t==="@"?S:x)(P(e),P(t));if(typeof r!="undefined"){this[c].apply(null,[t].concat(r));return b=true}},this)};d.r=function(e,t){if(e!=="@"){e="/"+P(e);this.$.push(e)}this.on(e,t)};var B=new k;var C=B.m.bind(B);C.create=function(){var e=new k;var t=e.m.bind(e);t.stop=e.s.bind(e);return t};C.base=function(e){$=e||"#";A=L()};C.exec=function(){R(true)};C.parser=function(e,t){if(!e&&!t){S=T;x=K}if(e){S=e}if(t){x=t}};C.query=function(){var e={};var t=p.href||A;t.replace(/[?&](.+?)=([^&]*)/g,function(t,r,n){e[r]=n});return e};C.stop=function(){if(y){if(l){l[i](u,w);l[i](o,w);h[i](m,_)}g[c]("stop");y=false}};C.start=function(e){if(!y){if(l){if(document.readyState==="interactive"||document.readyState==="complete"){j(e)}else{document.onreadystatechange=function(){if(document.readyState==="interactive"){setTimeout(function(){j(e)},1)}}}}y=true}};C.base();C.parser();e.tag2("router","<yield></yield>","","",function(e){var t=this;this.route=C.create();this.select=function(e){[].concat(t.tags.route).forEach(function(t){return t.show=t===e})};this.on("mount",function(){window.setTimeout(function(){return C.start(true)},0)});this.on("unmount",function(){t.route.stop()})});e.tag2("route",'<virtual if="{show}"><yield></yield></virtual>',"","",function(e){var t=this;this.show=false;this.parent.route(e.path,function(){var e=[],n=arguments.length;while(n--)e[n]=arguments[n];t.one("updated",function(){r(t.tags).forEach(function(t){t.trigger.apply(t,["route"].concat(e));t.update()})});t.parent.select(t);t.parent.update()});function r(e){return Object.keys(e).map(function(t){return e[t]}).reduce(function(e,t){return e.concat(t)},[])}});return C}(riot);