-!function(t,e){function i(t,i,r){var n=e.createEvent("CustomEvent");return n.initCustomEvent(t,!1,!0,i),r.dispatchEvent(n)}e.registerElement("app-route",{prototype:Object.create(HTMLElement.prototype)}),e.registerElement("active-route",{prototype:Object.create(HTMLElement.prototype)});var r=Object.create(HTMLElement.prototype),n={},a="ActiveXObject"in t;r.attachedCallback=function(){"manual"!==this.getAttribute("init")&&this.init()},r.init=function(){this.isInitialized||(this.isInitialized=!0,this.activeRoute=e.createElement("app-route"),this.stateChangeHandler=this.go.bind(this),t.addEventListener("popstate",this.stateChangeHandler,!1),a&&t.addEventListener("hashchange",this.stateChangeHandler,!1),this.activeRouteContent=e.createElement("active-route"),this.appendChild(this.activeRouteContent),this.hasAttribute("shadow")&&(this.activeRouteContent=this.activeRouteContent.createShadowRoot()),this.go())},r.detachedCallback=function(){t.removeEventListener("popstate",this.stateChangeHandler,!1),a&&t.removeEventListener("hashchange",this.stateChangeHandler,!1)},r.go=function(){var e=this.parseUrlPath(t.location.href),r={path:e};if(i("state-change",r,this)){for(var n=this.querySelectorAll("app-route"),a=0;a<n.length;a++)if(this.testRoute(n[a].getAttribute("path"),e,this.getAttribute("trailingSlash"),n[a].hasAttribute("regex")))return void this.activateRoute(n[a],e);i("not-found",r,this)}},r.activateRoute=function(t,e){var r={path:e,route:t,oldRoute:this.activeRoute};if(i("activate-route-start",r,this)&&i("activate-route-start",r,t)){this.activeRoute.removeAttribute("active"),t.setAttribute("active","active"),this.activeRoute=t;var n=t.getAttribute("import"),a=t.getAttribute("path"),s=t.hasAttribute("regex"),o=t.getAttribute("element"),c=t.hasAttribute("template"),l=!c;l&&n?this.importAndActivateCustomElement(n,o,a,e,s,r):l&&!n&&o?this.activateCustomElement(o,a,e,s,r):c&&n?this.importAndActivateTemplate(n,t,r):c&&!n&&this.activateTemplate(t,r)}},r.importAndActivateCustomElement=function(t,i,r,a,s,o){if(!n.hasOwnProperty(t)){n[t]=!0;var c=e.createElement("link");c.setAttribute("rel","import"),c.setAttribute("href",t),e.head.appendChild(c)}this.activateCustomElement(i||t.split("/").slice(-1)[0].replace(".html",""),r,a,s,o)},r.activateCustomElement=function(i,r,n,a,s){var o=e.createElement(i),c=this.routeArguments(r,n,t.location.href,a);for(var l in c)c.hasOwnProperty(l)&&(o[l]=c[l]);this.activeElement(o,s)},r.importAndActivateTemplate=function(t,i,r){if(n.hasOwnProperty(t)){var a=e.querySelector('link[href="'+t+'"]');a.import?this.activeElement(e.importNode(a.import.querySelector("template").content,!0),r):a.onload=function(){i.hasAttribute("active")&&this.activeElement(e.importNode(a.import.querySelector("template").content,!0),r)}.bind(this)}else{n[t]=!0;var s=e.createElement("link");s.setAttribute("rel","import"),s.setAttribute("href",t),s.onload=function(){i.hasAttribute("active")&&this.activeElement(e.importNode(s.import.querySelector("template").content,!0),r)}.bind(this),e.head.appendChild(s)}},r.activateTemplate=function(t,i){var r=e.importNode(t.querySelector("template").content,!0);this.activeElement(r,i)},r.activeElement=function(t,e){for(;this.activeRouteContent.firstChild;)this.activeRouteContent.removeChild(this.activeRouteContent.firstChild);this.activeRouteContent.appendChild(t),i("activate-route-end",e,this),i("activate-route-end",e,e.route)},r.parseUrlPath=function(t){var e=t.split("/"),i="/"+e.splice(3,e.length-3).join("/"),r=i.split(/[\?#]/)[0],n=i.indexOf("#");if(-1!==n){var a=i.substring(n).split("?")[0];"#/"===a.substring(0,2)?r=a.substring(1):"#!/"===a.substring(0,3)&&(r=a.substring(2))}return r},r.testRoute=function(t,e,i,r){if("ignore"===i&&("/"===e.slice(-1)&&(e=e.slice(0,-1)),"/"!==t.slice(-1)||r||(t=t.slice(0,-1))),r){if("/"!==t.charAt(0))return!1;t=t.slice(1);var n="";if("/"===t.slice(-1))t=t.slice(0,-1);else{if("/i"!==t.slice(-2))return!1;t=t.slice(0,-2),n="i"}return new RegExp(t,n).test(e)}if(t===e||"*"===t)return!0;if(-1===t.indexOf("*")&&-1===t.indexOf(":"))return!1;var a=e.split("/"),s=t.split("/");if(a.length!==s.length)return!1;for(var o=0;o<s.length;o++){var c=s[o];if(c!==a[o]&&"*"!==c&&":"!==c.charAt(0))return!1}return!0},r.routeArguments=function(t,e,i,r){var n={},a=e.split("/");if(!r)for(var s=t.split("/"),o=0;o<s.length;o++){var c=s[o];":"===c.charAt(0)&&(n[c.substring(1)]=a[o])}var l=i.indexOf("?"),h="";if(-1!==l){h=i.substring(l);var u=h.indexOf("#");-1!==u&&(h=h.substring(0,u))}var v=i.indexOf("#/"),p=i.indexOf("#!/");if(-1!==v||-1!==p){var m="";m=i.substring(-1!==v?v:p),l=m.indexOf("?"),-1!==l&&(h=m.substring(l))}var d=h.substring(1).split("&");1===d.length&&""===d[0]&&(d=[]);for(var f=0;f<d.length;f++){var g=d[f],b=g.split("=");n[b[0]]=b.splice(1,b.length-1).join("=")}for(var A in n){var E=n[A];n[A]="true"===E?!0:"false"===E?!1:isNaN(E)||""===E?decodeURIComponent(E):+E}return n},e.registerElement("app-router",{prototype:r})}(window,document);
|
+!function(t,e){function a(t,a,i){var r=e.createEvent("CustomEvent");return r.initCustomEvent(t,!1,!0,a),i.dispatchEvent(r)}function i(e){var i=g.parseUrl(t.location.href,e.getAttribute("mode"));if(i.hash!==b.hash&&i.path===b.path&&i.search===b.search&&i.isHashPath===b.isHashPath)return d(i.hash),void 0;b=i;var n={path:i.path};if(a("state-change",n,e)){for(var s=e.firstElementChild;s;){if("APP-ROUTE"===s.tagName&&g.testRoute(s.getAttribute("path"),i.path,e.getAttribute("trailingSlash"),s.hasAttribute("regex")))return r(e,s,i),void 0;s=s.nextSibling}a("not-found",n,e)}}function r(t,e,i){if(e.hasAttribute("redirect"))return t.go(e.getAttribute("redirect"),{replace:!0}),void 0;var r={path:i.path,route:e,oldRoute:t.activeRoute};a("activate-route-start",r,t)&&a("activate-route-start",r,e)&&(t.previousRoute&&t.previousRoute.transitionAnimationInProgress&&l(t.previousRoute),t.activeRoute&&t.activeRoute.removeAttribute("active"),t.previousRoute=t.activeRoute,t.activeRoute=e,t.activeRoute.setAttribute("active","active"),e.hasAttribute("import")?n(t,e.getAttribute("import"),e,i,r):e.hasAttribute("element")?o(t,e.getAttribute("element"),e,i,r):e.firstElementChild&&"TEMPLATE"===e.firstElementChild.tagName&&h(t,e.firstElementChild,e,i,r))}function n(t,a,i,r,n){function o(){s(t,h,a,i,r,n)}var h;f.hasOwnProperty(a)?(h=e.querySelector('link[href="'+a+'"]'),h.import?o():h.addEventListener("load",o)):(f[a]=!0,h=e.createElement("link"),h.setAttribute("rel","import"),h.setAttribute("href",a),h.addEventListener("load",o),e.head.appendChild(h))}function s(t,e,a,i,r,n){i.hasAttribute("active")&&(i.hasAttribute("template")?h(t,e.import.querySelector("template"),i,r,n):o(t,i.getAttribute("element")||a.split("/").slice(-1)[0].replace(".html",""),i,r,n))}function o(t,a,i,r,n){var s=e.createElement(a),o=u(t,i,r,n);for(var h in o)o.hasOwnProperty(h)&&(s[h]=o[h]);c(t,s,r,n)}function h(t,a,i,r,n){var s;if("createInstance"in a){var o=u(t,i,r,n);s=a.createInstance(o)}else s=e.importNode(a.content,!0);c(t,s,r,n)}function u(t,e,i,r){var n=g.routeArguments(e.getAttribute("path"),i.path,i.search,e.hasAttribute("regex"),"auto"===t.getAttribute("typecast"));return(e.hasAttribute("bindRouter")||t.hasAttribute("bindRouter"))&&(n.router=t),r.model=n,a("before-data-binding",r,t),a("before-data-binding",r,r.route),r.model}function c(t,e,i,r){t.hasAttribute("core-animated-pages")&&r.route!==r.oldRoute||p(t.previousRoute),t.activeRoute.appendChild(e),t.hasAttribute("core-animated-pages")&&(t.coreAnimatedPages.selected=t.activeRoute.getAttribute("path"),t.previousRoute&&(t.previousRoute.transitionAnimationInProgress=!0)),i.hash&&!t.hasAttribute("core-animated-pages")&&d(i.hash),a("activate-route-end",r,t),a("activate-route-end",r,r.route)}function l(t){t&&(t.transitionAnimationInProgress=!1,p(t))}function p(t){if(t)for(var e=t.firstChild;e;){var a=e;e=e.nextSibling,"TEMPLATE"!==a.tagName&&t.removeChild(a)}}function d(t){t&&setTimeout(function(){var a=e.querySelector("html /deep/ "+t)||e.querySelector('html /deep/ [name="'+t.substring(1)+'"]');a&&a.scrollIntoView&&a.scrollIntoView(!0)},0)}function v(t,e,a,i,r){var n=t[e],s=a[i];if("**"===n&&e===t.length-1)return!0;if("undefined"==typeof n||"undefined"==typeof s)return n===s;if(n===s||"*"===n||":"===n.charAt(0))return":"===n.charAt(0)&&"undefined"!=typeof r&&(r[n.substring(1)]=a[i]),v(t,e+1,a,i+1,r);if("**"===n)for(var o=i;o<a.length;o++)if(v(t,e+1,a,o,r))return!0;return!1}var g={},f={},m="ActiveXObject"in t,b={},A=Object.create(HTMLElement.prototype);A.util=g,e.registerElement("app-route",{prototype:Object.create(HTMLElement.prototype)}),A.attachedCallback=function(){"manual"!==this.getAttribute("init")&&this.init()},A.init=function(){var a=this;a.isInitialized||(a.isInitialized=!0,a.hasAttribute("trailingSlash")||a.setAttribute("trailingSlash","strict"),a.hasAttribute("mode")||a.setAttribute("mode","auto"),a.hasAttribute("typecast")||a.setAttribute("typecast","auto"),a.hasAttribute("core-animated-pages")&&(a.createShadowRoot(),a.coreAnimatedPages=e.createElement("core-animated-pages"),a.coreAnimatedPages.appendChild(e.createElement("content")),a.coreAnimatedPages.style.position="static",a.coreAnimatedPages.setAttribute("valueattr","path"),a.coreAnimatedPages.setAttribute("transitions",a.getAttribute("transitions")),a.shadowRoot.appendChild(a.coreAnimatedPages),a.coreAnimatedPages.addEventListener("core-animated-pages-transition-end",function(){l(a.previousRoute)})),a.stateChangeHandler=i.bind(null,a),t.addEventListener("popstate",a.stateChangeHandler,!1),m&&t.addEventListener("hashchange",a.stateChangeHandler,!1),i(a))},A.detachedCallback=function(){t.removeEventListener("popstate",this.stateChangeHandler,!1),m&&t.removeEventListener("hashchange",this.stateChangeHandler,!1)},A.go=function(a,i){"pushstate"!==this.getAttribute("mode")&&(a="#"+a),i&&i.replace===!0?t.history.replaceState(null,null,a):t.history.pushState(null,null,a);try{var r=new PopStateEvent("popstate",{bubbles:!1,cancelable:!1,state:{}});"dispatchEvent_"in t?t.dispatchEvent_(r):t.dispatchEvent(r)}catch(n){var s=e.createEvent("CustomEvent");s.initCustomEvent("popstate",!1,!1,{state:{}}),t.dispatchEvent(s)}},g.parseUrl=function(t,a){var i={isHashPath:"hash"===a};if("function"==typeof URL){var r=new URL(t);i.path=r.pathname,i.hash=r.hash,i.search=r.search}else{var n=e.createElement("a");n.href=t,i.path=n.pathname,"/"!==i.path.charAt(0)&&(i.path="/"+i.path),i.hash=n.hash,i.search=n.search}if("pushstate"!==a&&("#/"===i.hash.substring(0,2)?(i.isHashPath=!0,i.path=i.hash.substring(1)):"#!/"===i.hash.substring(0,3)?(i.isHashPath=!0,i.path=i.hash.substring(2)):i.isHashPath&&(i.path=0===i.hash.length?"/":i.hash.substring(1)),i.isHashPath)){i.hash="";var s=i.path.indexOf("#");-1!==s&&(i.hash=i.path.substring(s),i.path=i.path.substring(0,s));var o=i.path.indexOf("?");-1!==o&&(i.search=i.path.substring(o),i.path=i.path.substring(0,o))}return i},g.testRoute=function(t,e,a,i){return"ignore"===a&&("/"===e.slice(-1)&&(e=e.slice(0,-1)),"/"!==t.slice(-1)||i||(t=t.slice(0,-1))),i?g.testRegExString(t,e):t===e||"*"===t?!0:("/"!==t.charAt(0)&&(t="/**/"+t),v(t.split("/"),1,e.split("/"),1))},g.routeArguments=function(t,e,a,i,r){var n={};i||("/"!==t.charAt(0)&&(t="/**/"+t),v(t.split("/"),1,e.split("/"),1,n));var s=a.substring(1).split("&");1===s.length&&""===s[0]&&(s=[]);for(var o=0;o<s.length;o++){var h=s[o],u=h.split("=");n[u[0]]=u.splice(1,u.length-1).join("=")}if(r)for(var c in n)n[c]=g.typecast(n[c]);return n},g.typecast=function(t){return"true"===t?!0:"false"===t?!1:isNaN(t)||""===t||"0"===t.charAt(0)?decodeURIComponent(t):+t},g.testRegExString=function(t,e){if("/"!==t.charAt(0))return!1;t=t.slice(1);var a="";if("/"===t.slice(-1))t=t.slice(0,-1);else{if("/i"!==t.slice(-2))return!1;t=t.slice(0,-2),a="i"}return new RegExp(t,a).test(e)},e.registerElement("app-router",{prototype:A})}(window,document);
|