function AggregateError(e,t,i){if(t){if(t.innerError&&i)return t;const r="\n------------------------------------------------\n";e+=`${r}Inner Error:\n`,"string"==typeof t?e+=`Message: ${t}`:(t.message?e+=`Message: ${t.message}`:e+=`Unknown Inner Error Type. Displaying Inner Error as JSON:\n ${JSON.stringify(t,null," ")}`,t.stack&&(e+=`\nInner Error Stack:\n${t.stack}`,e+="\nEnd Inner Error Stack")),e+=r}let r=new Error(e);return t&&(r.innerError=t),r}const FEATURE={},PLATFORM={noop(){},eachModule(){},moduleName:e=>e};PLATFORM.global="undefined"!=typeof self?self:"undefined"!=typeof global?global:new Function("return this")();const DOM={};let isInitialized=!1;function initializePAL(e){isInitialized||(isInitialized=!0,"function"!=typeof Object.getPropertyDescriptor&&(Object.getPropertyDescriptor=function(e,t){let i=Object.getOwnPropertyDescriptor(e,t),r=Object.getPrototypeOf(e);for(;void 0===i&&null!==r;)i=Object.getOwnPropertyDescriptor(r,t),r=Object.getPrototypeOf(r);return i}),e(PLATFORM,FEATURE,DOM))}function reset(){isInitialized=!1}String.prototype.endsWith&&!function(){try{return!"ab".endsWith("a",1)}catch(e){return!0}}()||(String.prototype.endsWith=function(e,t){var i=this.toString();("number"!=typeof t||!isFinite(t)||Math.floor(t)!==t||t>i.length)&&(t=i.length),t-=e.length;var r=i.indexOf(e,t);return-1!==r&&r===t}),String.prototype.startsWith&&!function(){try{return!"ab".startsWith("b",1)}catch(e){return!0}}()||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e});var emptyMetadata=Object.freeze({}),metadataContainerKey="__metadata__";"function"!=typeof Reflect.getOwnMetadata&&(Reflect.getOwnMetadata=function(e,t,i){if(t.hasOwnProperty(metadataContainerKey))return(t[metadataContainerKey][i]||emptyMetadata)[e]}),"function"!=typeof Reflect.defineMetadata&&(Reflect.defineMetadata=function(e,t,i,r){var n=i.hasOwnProperty(metadataContainerKey)?i[metadataContainerKey]:i[metadataContainerKey]={};(n[r]||(n[r]={}))[e]=t}),"function"!=typeof Reflect.metadata&&(Reflect.metadata=function(e,t){return function(i,r){Reflect.defineMetadata(e,t,i,r)}});const _PLATFORM={location:window.location,history:window.history,addEventListener(e,t,i){this.global.addEventListener(e,t,i)},removeEventListener(e,t,i){this.global.removeEventListener(e,t,i)},performance:window.performance,requestAnimationFrame(e){return this.global.requestAnimationFrame(e)}};if(Element&&!Element.prototype.matches){let e=Element.prototype;e.matches=e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector}const _FEATURE={shadowDOM:!!HTMLElement.prototype.attachShadow,scopedCSS:"scoped"in document.createElement("style"),htmlTemplateElement:function(){let e=document.createElement("div");return e.innerHTML="","content"in e.children[0]}(),mutationObserver:!(!window.MutationObserver&&!window.WebKitMutationObserver),ensureHTMLTemplateElement:e=>e};let shadowPoly=window.ShadowDOMPolyfill||null;const _DOM={Element,NodeList,SVGElement,boundary:"aurelia-dom-boundary",addEventListener(e,t,i){document.addEventListener(e,t,i)},removeEventListener(e,t,i){document.removeEventListener(e,t,i)},adoptNode:e=>document.adoptNode(e),createAttribute:e=>document.createAttribute(e),createElement:e=>document.createElement(e),createTextNode:e=>document.createTextNode(e),createComment:e=>document.createComment(e),createDocumentFragment:()=>document.createDocumentFragment(),createTemplateElement(){let e=document.createElement("template");return _FEATURE.ensureHTMLTemplateElement(e)},createMutationObserver:e=>new(window.MutationObserver||window.WebKitMutationObserver)(e),createCustomEvent:(e,t)=>new window.CustomEvent(e,t),dispatchEvent(e){document.dispatchEvent(e)},getComputedStyle:e=>window.getComputedStyle(e),getElementById:e=>document.getElementById(e),querySelector:e=>document.querySelector(e),querySelectorAll:e=>document.querySelectorAll(e),nextElementSibling(e){if(e.nextElementSibling)return e.nextElementSibling;do{e=e.nextSibling}while(e&&1!==e.nodeType);return e},createTemplateFromMarkup(e){let t=document.createElement("div");t.innerHTML=e;let i=t.firstElementChild;if(!i||"TEMPLATE"!==i.nodeName)throw new Error("Template markup must be wrapped in a element e.g. \x3c!-- markup here --\x3e ");return _FEATURE.ensureHTMLTemplateElement(i)},appendNode(e,t){(t||document.body).appendChild(e)},replaceNode(e,t,i){t.parentNode?t.parentNode.replaceChild(e,t):null!==shadowPoly?shadowPoly.unwrap(i).replaceChild(shadowPoly.unwrap(e),shadowPoly.unwrap(t)):i.replaceChild(e,t)},removeNode(e,t){e.parentNode?e.parentNode.removeChild(e):t&&(null!==shadowPoly?shadowPoly.unwrap(t).removeChild(shadowPoly.unwrap(e)):t.removeChild(e))},injectStyles(e,t,i,r){if(r){let t=document.getElementById(r);if(t){if("style"===t.tagName.toLowerCase())return void(t.innerHTML=e);throw new Error("The provided id does not indicate a style tag.")}}let n=document.createElement("style");return n.innerHTML=e,n.type="text/css",r&&(n.id=r),t=t||document.head,i&&t.childNodes.length>0?t.insertBefore(n,t.childNodes[0]):t.appendChild(n),n}};function initialize(){isInitialized||initializePAL((e,t,i)=>{Object.assign(e,_PLATFORM),Object.assign(t,_FEATURE),Object.assign(i,_DOM),Object.defineProperty(i,"title",{get:()=>document.title,set:e=>{document.title=e}}),Object.defineProperty(i,"activeElement",{get:()=>document.activeElement}),Object.defineProperty(e,"XMLHttpRequest",{get:()=>e.global.XMLHttpRequest})})}var _extends=Object.assign||function(e){for(var t=1;t{if("object"==typeof n)for(let s in n)try{if(n[s]===t)return originStorage.set(t,i=new e(r,s)),!0}catch(e){}return n===t&&(originStorage.set(t,i=new e(r,"default")),!0)}),i||unknownOrigin}static set(e,t){originStorage.set(e,t)}};function decorators(...e){let t=function(t,i,r){let n=e.length;if(i){for(r=r||{value:t[i],writable:!0,configurable:!0,enumerable:!0};n--;)r=e[n](t,i,r)||r;Object.defineProperty(t,i,r)}else for(;n--;)t=e[n](t)||t;return t};return t.on=t,t}function deprecated(e,t,i){function r(i,r,n){const s=`${i.constructor.name}#${r}`;let o=t?{}:e||{},a=`DEPRECATION - ${s}`;if("function"!=typeof n.value)throw new SyntaxError("Only methods can be marked as deprecated.");return o.message&&(a+=` - ${o.message}`),_extends({},n,{value:function(){if(o.error)throw new Error(a);return console.warn(a),n.value.apply(this,arguments)}})}return t?r(e,t,i):r}function mixin(e){const t=Object.keys(e);return function(i){let r=function(i){let r="function"==typeof i?i.prototype:i,n=t.length;for(;n--;){let i=t[n];Object.defineProperty(r,i,{value:e[i],writable:!0})}};return i?r(i):r}}function alwaysValid(){return!0}function noCompose(){}function ensureProtocolOptions(e){return void 0===e?e={}:"function"==typeof e&&(e={validate:e}),e.validate||(e.validate=alwaysValid),e.compose||(e.compose=noCompose),e}function createProtocolValidator(e){return function(t){return!0===e(t)}}function createProtocolAsserter(e,t){return function(i){let r=t(i);if(!0!==r)throw new Error(r||`${e} was not correctly implemented.`)}}function protocol(e,t){t=ensureProtocolOptions(t);let i=function(r){let n="function"==typeof r?r.prototype:r;t.compose(n),i.assert(n),Object.defineProperty(n,"protocol:"+e,{enumerable:!1,configurable:!1,writable:!1,value:!0})};return i.validate=createProtocolValidator(t.validate),i.assert=createProtocolAsserter(e,t.validate),i}protocol.create=function(e,t){t=ensureProtocolOptions(t);let i="protocol:"+e,r=function(i){let r=protocol(e,t);return i?r(i):r};return r.decorates=function(e){return!0===e[i]},r.validate=createProtocolValidator(t.validate),r.assert=createProtocolAsserter(e,t.validate),r};var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function trimDots(e){for(var t=0;t0&&(e.splice(t-1,2),t-=2)}}}function relativeToFile(e,t){var i=t&&t.split("/"),r=e.trim().split("/");if("."===r[0].charAt(0)&&i){var n=i.slice(0,i.length-1);r.unshift.apply(r,n)}return trimDots(r),r.join("/")}function join(e,t){if(!e)return t;if(!t)return e;var i=e.match(/^([^\/]*?:)\//),r=i&&i.length>0?i[1]:"",n=void 0;n=0===(e=e.substr(r.length)).indexOf("///")&&"file:"===r?"///":0===e.indexOf("//")?"//":0===e.indexOf("/")?"/":"";for(var s="/"===t.slice(-1)?"/":"",o=e.split("/"),a=t.split("/"),l=[],c=0,u=o.length;c=2){var c=s[1]?decodeURIComponent(s[1]):"";l?parseComplexParam(t,a,c):t[o]=processScalarParam(t[o],c)}else t[o]=!0}}return t}let TemplateDependency=class{constructor(e,t){this.src=e,this.name=t}},TemplateRegistryEntry=class{constructor(e){this.templateIsLoaded=!1,this.factoryIsReady=!1,this.resources=null,this.dependencies=null,this.address=e,this.onReady=null,this._template=null,this._factory=null}get template(){return this._template}set template(e){let t,i,r,n,s=this.address;this._template=e,this.templateIsLoaded=!0,t=e.content.querySelectorAll("require"),n=this.dependencies=new Array(t.length);for(let e=0,o=t.length;e element in ${s} has no "from" attribute.`);n[e]=new TemplateDependency(relativeToFile(r,s),i.getAttribute("as")),i.parentNode&&i.parentNode.removeChild(i)}}get factory(){return this._factory}set factory(e){this._factory=e,this.factoryIsReady=!0}addDependency(e,t){let i="string"==typeof e?relativeToFile(e,this.address):Origin.get(e).moduleId;this.dependencies.push(new TemplateDependency(i,t))}},Loader=class{constructor(){this.templateRegistry={}}map(e,t){throw new Error("Loaders must implement map(id, source).")}normalizeSync(e,t){throw new Error("Loaders must implement normalizeSync(moduleId, relativeTo).")}normalize(e,t){throw new Error("Loaders must implement normalize(moduleId: string, relativeTo: string): Promise.")}loadModule(e){throw new Error("Loaders must implement loadModule(id).")}loadAllModules(e){throw new Error("Loader must implement loadAllModules(ids).")}loadTemplate(e){throw new Error("Loader must implement loadTemplate(url).")}loadText(e){throw new Error("Loader must implement loadText(url).")}applyPluginToUrl(e,t){throw new Error("Loader must implement applyPluginToUrl(url, pluginName).")}addPlugin(e,t){throw new Error("Loader must implement addPlugin(pluginName, implementation).")}getOrCreateTemplateRegistryEntry(e){return this.templateRegistry[e]||(this.templateRegistry[e]=new TemplateRegistryEntry(e))}};class TextTemplateLoader{async loadTemplate(e,t){const i=await e.loadText(t.address);t.template=DOM.createTemplateFromMarkup(i)}}function ensureOriginOnExports(e,t){let i,r,n=e;if(Origin.set(n,new Origin(t,"")),"object"==typeof n)for(i in n)"function"==typeof(r=n[i])&&Origin.set(r,new Origin(t,i));return e}class EsmLoader extends Loader{constructor(){super(),this.moduleRegistry=Object.create(null),this.loaderPlugins=Object.create(null),this.modulesBeingLoaded=new Map,this.baseUrl=location.origin||`${location.protocol}//${location.hostname}${location.port?`:${location.port}`:""}`,this.useTemplateLoader(new TextTemplateLoader),this.addPlugin("template-registry-entry",{fetch:async e=>{const t=this.getOrCreateTemplateRegistryEntry(e);return t.templateIsLoaded||await this.templateLoader.loadTemplate(this,t),t}}),PLATFORM.eachModule=(e=>{const t=this.moduleRegistry;Object.getOwnPropertyNames(t).some(i=>{const r=t[i].exports;return"object"==typeof r&&e(i,r)})})}async _import(e){const t=e.split("!"),i=t.splice(t.length-1,1)[0],r=1===t.length?t[0]:null;if(r){const e=this.loaderPlugins[r];if(!e)throw new Error(`Plugin ${r} is not registered in the loader.`);return await e.fetch(i)}return import(join(this.baseUrl,i)).then(e=>(this.moduleRegistry[i]=e,e))}map(e,t){}normalizeSync(e,t){return e}normalize(e,t){return Promise.resolve(e)}useTemplateLoader(e){this.templateLoader=e}loadAllModules(e){return Promise.all(e.map(e=>this.loadModule(e)))}async loadModule(e){let t=this.moduleRegistry[e];if(t)return t;let i=this.modulesBeingLoaded.get(e);if(i)return i;i=this._import(e),this.modulesBeingLoaded.set(e,i);const r=await i;return this.moduleRegistry[e]=ensureOriginOnExports(r,e),this.modulesBeingLoaded.delete(e),r}loadTemplate(e){return this.loadModule(this.applyPluginToUrl(e,"template-registry-entry"))}async loadText(e){return fetch(e).then(e=>e.text())}applyPluginToUrl(e,t){return`${t}!${e}`}addPlugin(e,t){this.loaderPlugins[e]=t}}PLATFORM.Loader=EsmLoader;const logLevel={none:0,error:10,warn:20,info:30,debug:40};let loggers={},appenders=[],globalDefaultLevel=logLevel.none;const standardLevels=["none","error","warn","info","debug"];function isStandardLevel(e){return standardLevels.filter(t=>t===e).length>0}function appendArgs(){return[this,...arguments]}function logFactory(e){const t=logLevel[e];return function(){if(this.levelt!==e)}function getAppenders(){return[...appenders]}function clearAppenders(){appenders=[],disconnectLoggers()}function addCustomLevel(e,t){if(void 0!==logLevel[e])throw Error(`Log level "${e}" already exists.`);if(isNaN(t))throw Error("Value must be a number.");logLevel[e]=t,appenders.length>0?connectLoggers():Logger.prototype[e]=function(){}}function removeCustomLevel(e){if(void 0!==logLevel[e]){if(isStandardLevel(e))throw Error(`Built-in log level "${e}" cannot be removed.`);delete logLevel[e],delete Logger.prototype[e]}}function setLevel(e){globalDefaultLevel=e;for(let t in loggers)loggers[t].setLevel(e)}function getLevel(){return globalDefaultLevel}let Logger=class{constructor(e){let t=loggers[e];if(t)return t;loggers[e]=this,this.id=e,this.level=globalDefaultLevel}debug(e,...t){}info(e,...t){}warn(e,...t){}error(e,...t){}setLevel(e){this.level=e}isDebugEnabled(){return this.level===logLevel.debug}};var _dec,_class,_dec2,_class2,_dec3,_class3,_dec4,_class4,_dec5,_class5,_dec6,_class6,_dec7,_class7,TheLogManager=Object.freeze({logLevel,getLogger,addAppender,removeAppender,getAppenders,clearAppenders,addCustomLevel,removeCustomLevel,setLevel,getLevel,Logger});const resolver=protocol.create("aurelia:resolver",function(e){return"function"==typeof e.get||"Resolvers must implement: get(container: Container, key: any): any"});let StrategyResolver=(_dec=resolver())(_class=class{constructor(e,t){this.strategy=e,this.state=t}get(e,t){switch(this.strategy){case 0:return this.state;case 1:let i=e.invoke(this.state);return this.state=i,this.strategy=0,i;case 2:return e.invoke(this.state);case 3:return this.state(e,t,this);case 4:return this.state[0].get(e,t);case 5:return e.get(this.state);default:throw new Error("Invalid strategy: "+this.strategy)}}})||_class,Lazy=(_dec2=resolver())(_class2=class e{constructor(e){this._key=e}get(e){return()=>e.get(this._key)}static of(t){return new e(t)}})||_class2,All=(_dec3=resolver())(_class3=class e{constructor(e){this._key=e}get(e){return e.getAll(this._key)}static of(t){return new e(t)}})||_class3,Optional=(_dec4=resolver())(_class4=class e{constructor(e,t=!0){this._key=e,this._checkParent=t}get(e){return e.hasResolver(this._key,this._checkParent)?e.get(this._key):null}static of(t,i=!0){return new e(t,i)}})||_class4,Parent=(_dec5=resolver())(_class5=class e{constructor(e){this._key=e}get(e){return e.parent?e.parent.get(this._key):null}static of(t){return new e(t)}})||_class5,Factory=(_dec6=resolver())(_class6=class e{constructor(e){this._key=e}get(e){let t=this._key,i=e.getResolver(t);return i&&3===i.strategy&&(t=i.state),(...i)=>e.invoke(t,i)}static of(t){return new e(t)}})||_class6,NewInstance=(_dec7=resolver())(_class7=class e{constructor(e,...t){this.key=e,this.asKey=e,this.dynamicDependencies=t}get(e){let t=this.dynamicDependencies.length>0?this.dynamicDependencies.map(t=>t["protocol:aurelia:resolver"]?t.get(e):e.get(t)):void 0,i=this.key,r=e.getResolver(i);r&&3===r.strategy&&(i=r.state);const n=e.invoke(i,t);return e.registerInstance(this.asKey,n),n}as(e){return this.asKey=e,this}static of(t,...i){return new e(t,...i)}})||_class7;function getDecoratorDependencies(e){return autoinject(e),e.inject}function lazy(e){return function(t,i,r){getDecoratorDependencies(t)[r]=Lazy.of(e)}}function all(e){return function(t,i,r){getDecoratorDependencies(t)[r]=All.of(e)}}function optional(e=!0){let t=function(e){return function(t,i,r){let n=getDecoratorDependencies(t);n[r]=Optional.of(n[r],e)}};return t("boolean"!=typeof e||e)}function parent(e,t,i){let r=getDecoratorDependencies(e);r[i]=Parent.of(r[i])}function factory(e){return function(t,i,r){getDecoratorDependencies(t)[r]=Factory.of(e)}}function newInstance(e,...t){let i=function(e){return function(i,r,n){let s=getDecoratorDependencies(i);s[n]=NewInstance.of(s[n],...t),e&&s[n].as(e)}};return arguments.length>=1?i(e):i()}function invoker(e){return function(t){metadata.define(metadata.invoker,e,t)}}function invokeAsFactory(e){let t=function(e){metadata.define(metadata.invoker,FactoryInvoker.instance,e)};return e?t(e):t}let FactoryInvoker=class{invoke(e,t,i){let r=i.length,n=new Array(r);for(;r--;)n[r]=e.get(i[r]);return t.apply(void 0,n)}invokeWithDynamicDependencies(e,t,i,r){let n=i.length,s=new Array(n);for(;n--;)s[n]=e.get(i[n]);return void 0!==r&&(s=s.concat(r)),t.apply(void 0,s)}};function registration(e){return function(t){metadata.define(metadata.registration,e,t)}}function transient(e){return registration(new TransientRegistration(e))}function singleton(e,t=!1){return registration(new SingletonRegistration(e,t))}FactoryInvoker.instance=new FactoryInvoker;let TransientRegistration=class{constructor(e){this._key=e}registerResolver(e,t,i){let r=e.getResolver(this._key||t);return void 0===r?e.registerTransient(this._key||t,i):r}},SingletonRegistration=class{constructor(e,t=!1){"boolean"==typeof e?this._registerInChild=e:(this._key=e,this._registerInChild=t)}registerResolver(e,t,i){let r=this._registerInChild?e:e.root,n=r.getResolver(this._key||t);return void 0===n?r.registerSingleton(this._key||t,i):n}};function validateKey(e){if(null==e)throw new Error("key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?")}const _emptyParameters=Object.freeze([]);metadata.registration="aurelia:registration",metadata.invoker="aurelia:invoker";let resolverDecorates=resolver.decorates,InvocationHandler=class{constructor(e,t,i){this.fn=e,this.invoker=t,this.dependencies=i}invoke(e,t){return void 0!==t?this.invoker.invokeWithDynamicDependencies(e,this.fn,this.dependencies,t):this.invoker.invoke(e,this.fn,this.dependencies)}};function invokeWithDynamicDependencies(e,t,i,r){let n,s=i.length,o=new Array(s);for(;s--;){if(null==(n=i[s]))throw new Error("Constructor Parameter with index "+s+" cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?");o[s]=e.get(n)}return void 0!==r&&(o=o.concat(r)),Reflect.construct(t,o)}let classInvokers={0:{invoke:(e,t)=>new t,invokeWithDynamicDependencies},1:{invoke:(e,t,i)=>new t(e.get(i[0])),invokeWithDynamicDependencies},2:{invoke:(e,t,i)=>new t(e.get(i[0]),e.get(i[1])),invokeWithDynamicDependencies},3:{invoke:(e,t,i)=>new t(e.get(i[0]),e.get(i[1]),e.get(i[2])),invokeWithDynamicDependencies},4:{invoke:(e,t,i)=>new t(e.get(i[0]),e.get(i[1]),e.get(i[2]),e.get(i[3])),invokeWithDynamicDependencies},5:{invoke:(e,t,i)=>new t(e.get(i[0]),e.get(i[1]),e.get(i[2]),e.get(i[3]),e.get(i[4])),invokeWithDynamicDependencies},fallback:{invoke:invokeWithDynamicDependencies,invokeWithDynamicDependencies}};function getDependencies(e){return e.hasOwnProperty("inject")?"function"==typeof e.inject?e.inject():e.inject:[]}let Container=class e{constructor(e){void 0===e&&(e={}),this._configuration=e,this._onHandlerCreated=e.onHandlerCreated,this._handlers=e.handlers||(e.handlers=new Map),this._resolvers=new Map,this.root=this,this.parent=null}makeGlobal(){return e.instance=this,this}setHandlerCreatedCallback(e){this._onHandlerCreated=e,this._configuration.onHandlerCreated=e}registerInstance(e,t){return this.registerResolver(e,new StrategyResolver(0,void 0===t?e:t))}registerSingleton(e,t){return this.registerResolver(e,new StrategyResolver(1,void 0===t?e:t))}registerTransient(e,t){return this.registerResolver(e,new StrategyResolver(2,void 0===t?e:t))}registerHandler(e,t){return this.registerResolver(e,new StrategyResolver(3,t))}registerAlias(e,t){return this.registerResolver(t,new StrategyResolver(5,e))}registerResolver(e,t){validateKey(e);let i=this._resolvers,r=i.get(e);return void 0===r?i.set(e,t):4===r.strategy?r.state.push(t):i.set(e,new StrategyResolver(4,[r,t])),t}autoRegister(e,t){if("function"==typeof(t=void 0===t?e:t)){let i=metadata.get(metadata.registration,t);return void 0===i?this.registerResolver(e,new StrategyResolver(1,t)):i.registerResolver(this,e,t)}return this.registerResolver(e,new StrategyResolver(0,t))}autoRegisterAll(e){let t=e.length;for(;t--;)this.autoRegister(e[t])}unregister(e){this._resolvers.delete(e)}hasResolver(e,t=!1){return validateKey(e),this._resolvers.has(e)||t&&null!==this.parent&&this.parent.hasResolver(e,t)}getResolver(e){return this._resolvers.get(e)}get(t){if(validateKey(t),t===e)return this;if(resolverDecorates(t))return t.get(this,t);let i=this._resolvers.get(t);if(void 0===i){if(null===this.parent)return this.autoRegister(t).get(this,t);let e=metadata.get(metadata.registration,t);return void 0===e?this.parent._get(t):e.registerResolver(this,t,t).get(this,t)}return i.get(this,t)}_get(e){let t=this._resolvers.get(e);return void 0===t?null===this.parent?this.autoRegister(e).get(this,e):this.parent._get(e):t.get(this,e)}getAll(e){validateKey(e);let t=this._resolvers.get(e);if(void 0===t)return null===this.parent?_emptyParameters:this.parent.getAll(e);if(4===t.strategy){let i=t.state,r=i.length,n=new Array(r);for(;r--;)n[r]=i[r].get(this,e);return n}return[t.get(this,e)]}createChild(){let t=new e(this._configuration);return t.root=this.root,t.parent=this,t}invoke(e,t){try{let i=this._handlers.get(e);return void 0===i&&(i=this._createInvocationHandler(e),this._handlers.set(e,i)),i.invoke(this,t)}catch(t){throw new AggregateError(`Error invoking ${e.name}. Check the inner error for details.`,t,!0)}}_createInvocationHandler(e){let t;if(void 0===e.inject)t=metadata.getOwn(metadata.paramTypes,e)||_emptyParameters;else{t=[];let i=e;for(;"function"==typeof i;)t.push(...getDependencies(i)),i=Object.getPrototypeOf(i)}let i=metadata.getOwn(metadata.invoker,e)||classInvokers[t.length]||classInvokers.fallback,r=new InvocationHandler(e,i,t);return void 0!==this._onHandlerCreated?this._onHandlerCreated(r):r}};function autoinject(e){let t=function(e){e.hasOwnProperty("inject")||(e.inject=(metadata.getOwn(metadata.paramTypes,e)||_emptyParameters).slice(),e.inject.length>0&&e.inject[e.inject.length-1]===Object&&e.inject.pop())};return e?t(e):t}function inject(...e){return function(t,i,r){if("number"==typeof r)return autoinject(t),void(1===e.length&&(t.inject[r]=e[0]));if(r){r.value.inject=e}else t.inject=e}}const stackSeparator="\nEnqueued in TaskQueue by:\n",microStackSeparator="\nEnqueued in MicroTaskQueue by:\n";function makeRequestFlushFromMutationObserver(e){let t=DOM.createMutationObserver(e),i="a",r=DOM.createTextNode("a"),n=Object.create(null);return n.a="b",n.b="a",t.observe(r,{characterData:!0}),function(){r.data=i=n[i]}}function makeRequestFlushFromTimer(e){return function(){let t=setTimeout(r,0),i=setInterval(r,50);function r(){clearTimeout(t),clearInterval(i),e()}}}function onError(e,t,i){i&&t.stack&&"object"==typeof e&&null!==e&&(e.stack=filterFlushStack(e.stack)+t.stack),"onError"in t?t.onError(e):setTimeout(()=>{throw e},0)}let TaskQueue=class{constructor(){this.flushing=!1,this.longStacks=!1,this.microTaskQueue=[],this.microTaskQueueCapacity=1024,this.taskQueue=[],FEATURE.mutationObserver?this.requestFlushMicroTaskQueue=makeRequestFlushFromMutationObserver(()=>this.flushMicroTaskQueue()):this.requestFlushMicroTaskQueue=makeRequestFlushFromTimer(()=>this.flushMicroTaskQueue()),this.requestFlushTaskQueue=makeRequestFlushFromTimer(()=>this.flushTaskQueue())}_flushQueue(e,t){let i,r=0;try{for(this.flushing=!0;rt){for(let t=0,i=e.length-r;tt.toUpperCase());return map[e]=t,t}function createOverrideContext(e,t){return{bindingContext:e,parentOverrideContext:t||null}}function getContextFor(e,t,i){let r=t.overrideContext;if(i){for(;i&&r;)i--,r=r.parentOverrideContext;if(i||!r)return;return e in r?r:r.bindingContext}for(;r&&!(e in r)&&!(r.bindingContext&&e in r.bindingContext);)r=r.parentOverrideContext;return r?e in r?r:r.bindingContext:t.bindingContext||t.overrideContext}function createScopeForTest(e,t){return t?{bindingContext:e,overrideContext:createOverrideContext(e,createOverrideContext(t))}:{bindingContext:e,overrideContext:createOverrideContext(e)}}const slotNames=[],versionSlotNames=[];for(let e=0;e<100;e++)slotNames.push(`_observer${e}`),versionSlotNames.push(`_observerVersion${e}`);function addObserver(e){let t=void 0===this._observerSlots?0:this._observerSlots,i=t;for(;i--&&this[slotNames[i]]!==e;);if(-1===i){for(i=0;this[slotNames[i]];)i++;this[slotNames[i]]=e,e.subscribe(sourceContext,this),i===t&&(this._observerSlots=i+1)}void 0===this._version&&(this._version=0),this[versionSlotNames[i]]=this._version}function observeProperty(e,t){let i=this.observerLocator.getObserver(e,t);addObserver.call(this,i)}function observeArray(e){let t=this.observerLocator.getArrayObserver(e);addObserver.call(this,t)}function unobserve(e){let t=this._observerSlots;for(;t--;)if(e||this[versionSlotNames[t]]!==this._version){let e=this[slotNames[t]];this[slotNames[t]]=null,e&&e.unsubscribe(sourceContext,this)}}function connectable(){return function(e){e.prototype.observeProperty=observeProperty,e.prototype.observeArray=observeArray,e.prototype.unobserve=unobserve,e.prototype.addObserver=addObserver}}const queue=[],queued={};let nextId=0,minimumImmediate=100;const frameBudget=15;let isFlushRequested=!1,immediate=0;function flush(e){const t=queue.length;let i=0;for(;iframeBudget)break}queue.splice(0,i),queue.length?PLATFORM.requestAnimationFrame(flush):(isFlushRequested=!1,immediate=0)}function enqueueBindingConnect(e){if(immediaten;)n++;return!(n>=i.length)&&(r.splice(n,1),i.splice(n,1),!0)}let arrayPool1=[],arrayPool2=[],poolUtilization=[];function callSubscribers(e,t){let i,r,n,s,o=this._context0,a=this._callable0,l=this._context1,c=this._callable1,u=this._context2,h=this._callable2,d=this._contextsRest?this._contextsRest.length:0;if(d){for(n=poolUtilization.length;n--&&poolUtilization[n];);for(n<0?(n=poolUtilization.length,i=[],r=[],poolUtilization.push(!0),arrayPool1.push(i),arrayPool2.push(r)):(poolUtilization[n]=!0,i=arrayPool1[n],r=arrayPool2[n]),s=d;s--;)i[s]=this._contextsRest[s],r[s]=this._callablesRest[s]}if(o&&(a?a.call(o,e,t):o(e,t)),l&&(c?c.call(l,e,t):l(e,t)),u&&(h?h.call(u,e,t):u(e,t)),d){for(s=0;s{this.unsubscribe(e,t)}}}unsubscribe(e,t){this.removeSubscriber(e,t)&&!this.hasSubscribers()&&(this.unobserve(!0),this.oldValue=void 0)}call(){let e=this.expression.evaluate(this.scope,this.lookupFunctions),t=this.oldValue;e!==t&&(this.oldValue=e,this.callSubscribers(e,t)),this._version++,this.expression.connect(this,this.scope),this.unobserve(!1)}})||_class$1)||_class$1;function isIndex(e){return+e==e>>>0}function toNumber(e){return+e}function newSplice(e,t,i){return{index:e,removed:t,addedCount:i}}const EDIT_LEAVE=0,EDIT_UPDATE=1,EDIT_ADD=2,EDIT_DELETE=3;function ArraySplice(){}ArraySplice.prototype={calcEditDistances:function(e,t,i,r,n,s){let o,a,l=s-n+1,c=i-t+1,u=new Array(l);for(let e=0;e0||i>0;){if(0===t){n.push(2),i--;continue}if(0===i){n.push(3),t--;continue}let s,o=e[t-1][i-1],a=e[t-1][i],l=e[t][i-1];(s=a=0){e.splice(t,1),t--,o-=i.addedCount-i.removed.length,n.addedCount+=i.addedCount-r;let a=n.removed.length+i.removed.length-r;if(n.addedCount||a){let e=i.removed;if(n.indexi.index+i.addedCount){let t=n.removed.slice(i.index+i.addedCount-n.index);Array.prototype.push.apply(e,t)}n.removed=e,i.indexi?t=i-e.addedCount:t<0&&(t=i+e.removed.length+t-e.addedCount),t<0&&(t=0),e.index=t}null===this.changeRecords?this.changeRecords=[e]:this.changeRecords.push(e),this.queued||(this.queued=!0,this.taskQueue.queueMicroTask(this))}}flushChangeRecords(){(this.changeRecords&&this.changeRecords.length||this.oldCollection)&&this.call()}reset(e){this.oldCollection=e,this.hasSubscribers()&&!this.queued&&(this.queued=!0,this.taskQueue.queueMicroTask(this))}getLengthObserver(){return this.lengthObserver||(this.lengthObserver=new CollectionLengthObserver(this.collection))}call(){let e,t=this.changeRecords,i=this.oldCollection;this.queued=!1,this.changeRecords=[],this.oldCollection=null,this.hasSubscribers()&&(e=i?this.collection instanceof Map||this.collection instanceof Set?getChangeRecords(i):calcSplices(this.collection,0,this.collection.length,i,0,i.length):this.collection instanceof Map||this.collection instanceof Set?t:projectArraySplices(this.collection,t),this.callSubscribers(e)),this.lengthObserver&&this.lengthObserver.call(this.collection[this.lengthPropertyName])}})||_class2$1,CollectionLengthObserver=(_dec4$1=subscriberCollection())(_class3$1=class{constructor(e){this.collection=e,this.lengthPropertyName=e instanceof Map||e instanceof Set?"size":"length",this.currentValue=e[this.lengthPropertyName]}getValue(){return this.collection[this.lengthPropertyName]}setValue(e){this.collection[this.lengthPropertyName]=e}subscribe(e,t){this.addSubscriber(e,t)}unsubscribe(e,t){this.removeSubscriber(e,t)}call(e){let t=this.currentValue;this.callSubscribers(e,t),this.currentValue=e}})||_class3$1;const arrayProto=Array.prototype,pop=arrayProto.pop,push=arrayProto.push,reverse=arrayProto.reverse,shift=arrayProto.shift,sort=arrayProto.sort,splice=arrayProto.splice,unshift=arrayProto.unshift;function getArrayObserver(e,t){return ModifyArrayObserver.for(e,t)}arrayProto.__au_patched__?getLogger("array-observation").warn("Detected 2nd attempt of patching array from Aurelia binding. This is probably caused by dependency mismatch between core modules and a 3rd party plugin. Please see https://github.com/aurelia/cli/pull/906 if you are using webpack."):(Reflect.defineProperty(arrayProto,"__au_patched__",{value:1}),arrayProto.pop=function(){let e=this.length>0,t=pop.apply(this,arguments);return e&&void 0!==this.__array_observer__&&this.__array_observer__.addChangeRecord({type:"delete",object:this,name:this.length,oldValue:t}),t},arrayProto.push=function(){let e=push.apply(this,arguments);return void 0!==this.__array_observer__&&this.__array_observer__.addChangeRecord({type:"splice",object:this,index:this.length-arguments.length,removed:[],addedCount:arguments.length}),e},arrayProto.reverse=function(){let e;void 0!==this.__array_observer__&&(this.__array_observer__.flushChangeRecords(),e=this.slice());let t=reverse.apply(this,arguments);return void 0!==this.__array_observer__&&this.__array_observer__.reset(e),t},arrayProto.shift=function(){let e=this.length>0,t=shift.apply(this,arguments);return e&&void 0!==this.__array_observer__&&this.__array_observer__.addChangeRecord({type:"delete",object:this,name:0,oldValue:t}),t},arrayProto.sort=function(){let e;void 0!==this.__array_observer__&&(this.__array_observer__.flushChangeRecords(),e=this.slice());let t=sort.apply(this,arguments);return void 0!==this.__array_observer__&&this.__array_observer__.reset(e),t},arrayProto.splice=function(){let e=splice.apply(this,arguments);return void 0!==this.__array_observer__&&this.__array_observer__.addChangeRecord({type:"splice",object:this,index:+arguments[0],removed:e,addedCount:arguments.length>2?arguments.length-2:0}),e},arrayProto.unshift=function(){let e=unshift.apply(this,arguments);return void 0!==this.__array_observer__&&this.__array_observer__.addChangeRecord({type:"splice",object:this,index:0,removed:[],addedCount:arguments.length}),e});let ModifyArrayObserver=class e extends ModifyCollectionObserver{constructor(e,t){super(e,t)}static for(t,i){return"__array_observer__"in i||Reflect.defineProperty(i,"__array_observer__",{value:e.create(t,i),enumerable:!1,configurable:!1}),i.__array_observer__}static create(t,i){return new e(t,i)}},Expression=class{constructor(){this.isAssignable=!1}evaluate(e,t,i){throw new Error(`Binding expression "${this}" cannot be evaluated.`)}assign(e,t,i){throw new Error(`Binding expression "${this}" cannot be assigned to.`)}toString(){return super.toString()}},BindingBehavior=class extends Expression{constructor(e,t,i){super(),this.expression=e,this.name=t,this.args=i}evaluate(e,t){return this.expression.evaluate(e,t)}assign(e,t,i){return this.expression.assign(e,t,i)}accept(e){return e.visitBindingBehavior(this)}connect(e,t){this.expression.connect(e,t)}bind(e,t,i){this.expression.expression&&this.expression.bind&&this.expression.bind(e,t,i);let r=i.bindingBehaviors(this.name);if(!r)throw new Error(`No BindingBehavior named "${this.name}" was found!`);let n=`behavior-${this.name}`;if(e[n])throw new Error(`A binding behavior named "${this.name}" has already been applied to "${this.expression}"`);e[n]=r,r.bind.apply(r,[e,t].concat(evalList(t,this.args,e.lookupFunctions)))}unbind(e,t){let i=`behavior-${this.name}`;e[i].unbind(e,t),e[i]=null,this.expression.expression&&this.expression.unbind&&this.expression.unbind(e,t)}},ValueConverter=class extends Expression{constructor(e,t,i){super(),this.expression=e,this.name=t,this.args=i,this.allArgs=[e].concat(i)}evaluate(e,t){let i=t.valueConverters(this.name);if(!i)throw new Error(`No ValueConverter named "${this.name}" was found!`);return"toView"in i?i.toView.apply(i,evalList(e,this.allArgs,t)):this.allArgs[0].evaluate(e,t)}assign(e,t,i){let r=i.valueConverters(this.name);if(!r)throw new Error(`No ValueConverter named "${this.name}" was found!`);return"fromView"in r&&(t=r.fromView.apply(r,[t].concat(evalList(e,this.args,i)))),this.allArgs[0].assign(e,t,i)}accept(e){return e.visitValueConverter(this)}connect(e,t){let i=this.allArgs,r=i.length;for(;r--;)i[r].connect(e,t);let n=e.lookupFunctions.valueConverters(this.name);if(!n)throw new Error(`No ValueConverter named "${this.name}" was found!`);let s=n.signals;if(void 0!==s)for(r=s.length;r--;)connectBindingToSignal(e,s[r])}},Assign=class extends Expression{constructor(e,t){super(),this.target=e,this.value=t,this.isAssignable=!0}evaluate(e,t){return this.target.assign(e,this.value.evaluate(e,t))}accept(e){e.visitAssign(this)}connect(e,t){}assign(e,t){this.value.assign(e,t),this.target.assign(e,t)}},Conditional=class extends Expression{constructor(e,t,i){super(),this.condition=e,this.yes=t,this.no=i}evaluate(e,t){return this.condition.evaluate(e,t)?this.yes.evaluate(e,t):this.no.evaluate(e,t)}accept(e){return e.visitConditional(this)}connect(e,t){this.condition.connect(e,t),this.condition.evaluate(t)?this.yes.connect(e,t):this.no.connect(e,t)}},AccessThis=class extends Expression{constructor(e){super(),this.ancestor=e}evaluate(e,t){let i=e.overrideContext,r=this.ancestor;for(;r--&&i;)i=i.parentOverrideContext;return r<1&&i?i.bindingContext:void 0}accept(e){return e.visitAccessThis(this)}connect(e,t){}},AccessScope=class extends Expression{constructor(e,t){super(),this.name=e,this.ancestor=t,this.isAssignable=!0}evaluate(e,t){return getContextFor(this.name,e,this.ancestor)[this.name]}assign(e,t){let i=getContextFor(this.name,e,this.ancestor);return i?i[this.name]=t:void 0}accept(e){return e.visitAccessScope(this)}connect(e,t){let i=getContextFor(this.name,t,this.ancestor);e.observeProperty(i,this.name)}},AccessMember=class extends Expression{constructor(e,t){super(),this.object=e,this.name=t,this.isAssignable=!0}evaluate(e,t){let i=this.object.evaluate(e,t);return null==i?i:i[this.name]}assign(e,t){let i=this.object.evaluate(e);return null==i&&(i={},this.object.assign(e,i)),i[this.name]=t,t}accept(e){return e.visitAccessMember(this)}connect(e,t){this.object.connect(e,t);let i=this.object.evaluate(t);i&&e.observeProperty(i,this.name)}},AccessKeyed=class extends Expression{constructor(e,t){super(),this.object=e,this.key=t,this.isAssignable=!0}evaluate(e,t){return getKeyed(this.object.evaluate(e,t),this.key.evaluate(e,t))}assign(e,t){return setKeyed(this.object.evaluate(e),this.key.evaluate(e),t)}accept(e){return e.visitAccessKeyed(this)}connect(e,t){this.object.connect(e,t);let i=this.object.evaluate(t);if(i instanceof Object){this.key.connect(e,t);let r=this.key.evaluate(t);null==r||Array.isArray(i)&&"number"==typeof r||e.observeProperty(i,r)}}},CallScope=class extends Expression{constructor(e,t,i){super(),this.name=e,this.args=t,this.ancestor=i}evaluate(e,t,i){let r=evalList(e,this.args,t),n=getContextFor(this.name,e,this.ancestor),s=getFunction(n,this.name,i);if(s)return s.apply(n,r)}accept(e){return e.visitCallScope(this)}connect(e,t){let i=this.args,r=i.length;for(;r--;)i[r].connect(e,t)}},CallMember=class extends Expression{constructor(e,t,i){super(),this.object=e,this.name=t,this.args=i}evaluate(e,t,i){let r=this.object.evaluate(e,t),n=evalList(e,this.args,t),s=getFunction(r,this.name,i);if(s)return s.apply(r,n)}accept(e){return e.visitCallMember(this)}connect(e,t){if(this.object.connect(e,t),getFunction(this.object.evaluate(t),this.name,!1)){let i=this.args,r=i.length;for(;r--;)i[r].connect(e,t)}}},CallFunction=class extends Expression{constructor(e,t){super(),this.func=e,this.args=t}evaluate(e,t,i){let r=this.func.evaluate(e,t);if("function"==typeof r)return r.apply(null,evalList(e,this.args,t));if(i||null!=r)throw new Error(`${this.func} is not a function`)}accept(e){return e.visitCallFunction(this)}connect(e,t){if(this.func.connect(e,t),"function"==typeof this.func.evaluate(t)){let i=this.args,r=i.length;for(;r--;)i[r].connect(e,t)}}},Binary=class extends Expression{constructor(e,t,i){super(),this.operation=e,this.left=t,this.right=i}evaluate(e,t){let i=this.left.evaluate(e,t);switch(this.operation){case"&&":return i&&this.right.evaluate(e,t);case"||":return i||this.right.evaluate(e,t)}let r=this.right.evaluate(e,t);switch(this.operation){case"==":return i==r;case"===":return i===r;case"!=":return i!=r;case"!==":return i!==r;case"instanceof":return"function"==typeof r&&i instanceof r;case"in":return"object"==typeof r&&null!==r&&i in r}if(null===i||null===r||void 0===i||void 0===r){switch(this.operation){case"+":return null!=i?i:null!=r?r:0;case"-":return null!=i?i:null!=r?0-r:0}return null}switch(this.operation){case"+":return autoConvertAdd(i,r);case"-":return i-r;case"*":return i*r;case"/":return i/r;case"%":return i%r;case"<":return i":return i>r;case"<=":return i<=r;case">=":return i>=r;case"^":return i^r}throw new Error(`Internal error [${this.operation}] not handled`)}accept(e){return e.visitBinary(this)}connect(e,t){this.left.connect(e,t);let i=this.left.evaluate(t);"&&"===this.operation&&!i||"||"===this.operation&&i||this.right.connect(e,t)}},Unary=class extends Expression{constructor(e,t){super(),this.operation=e,this.expression=t}evaluate(e,t){switch(this.operation){case"!":return!this.expression.evaluate(e,t);case"typeof":return typeof this.expression.evaluate(e,t);case"void":return void this.expression.evaluate(e,t)}throw new Error(`Internal error [${this.operation}] not handled`)}accept(e){return e.visitPrefix(this)}connect(e,t){this.expression.connect(e,t)}},LiteralPrimitive=class extends Expression{constructor(e){super(),this.value=e}evaluate(e,t){return this.value}accept(e){return e.visitLiteralPrimitive(this)}connect(e,t){}},LiteralString=class extends Expression{constructor(e){super(),this.value=e}evaluate(e,t){return this.value}accept(e){return e.visitLiteralString(this)}connect(e,t){}},LiteralTemplate=class extends Expression{constructor(e,t,i,r){if(super(),this.cooked=e,this.expressions=t||[],this.length=this.expressions.length,this.tagged=void 0!==r,this.tagged)if(this.cooked.raw=i,this.tag=r,r instanceof AccessScope)this.contextType="Scope";else{if(!(r instanceof AccessMember||r instanceof AccessKeyed))throw new Error(`${this.tag} is not a valid template tag`);this.contextType="Object"}}getScopeContext(e,t){return getContextFor(this.tag.name,e,this.tag.ancestor)}getObjectContext(e,t){return this.tag.object.evaluate(e,t)}evaluate(e,t,i){const r=new Array(this.length);for(let i=0;i=this.len?this.err("Unexpected end of expression"):this.err()}if(e&C$ShorthandProp)return t;let i=this.val;for(;this.tkn&T$MemberOrCallExpression;)switch(this.tkn){case T$Period:if(this.nextToken(),this.tkn&T$IdentifierOrKeyword||this.err(),i=this.val,this.nextToken(),e=e&C$Primary|(e&(C$This|C$Scope))<<1|e&C$Member|(e&C$Keyed)>>1|(e&C$Call)>>2,this.tkn===T$LParen)continue;t=e&C$Scope?new AccessScope(i,t.ancestor):new AccessMember(t,i);continue;case T$LBracket:this.nextToken(),e=C$Keyed,t=new AccessKeyed(t,this.parseExpression()),this.expect(T$RBracket);break;case T$LParen:this.nextToken();const r=[];for(;this.tkn!==T$RParen&&(r.push(this.parseExpression()),this.opt(T$Comma)););this.expect(T$RParen),t=e&C$Scope?new CallScope(i,r,t.ancestor):e&(C$Member|C$Primary)?new CallMember(t,i,r):new CallFunction(t,r),e=C$Call;break;case T$TemplateTail:t=new LiteralTemplate([this.val],[],[this.raw],t),this.nextToken();break;case T$TemplateContinuation:t=this.parseTemplate(e|C$Tagged,t)}return t}parseTemplate(e,t){const i=[this.val],r=e&C$Tagged?[this.raw]:void 0;this.expect(T$TemplateContinuation);const n=[this.parseExpression()];for(;(this.tkn=this.scanTemplateTail())!==T$TemplateTail;)i.push(this.val),e&C$Tagged&&r.push(this.raw),this.expect(T$TemplateContinuation),n.push(this.parseExpression());return i.push(this.val),e&C$Tagged&&r.push(this.raw),this.nextToken(),new LiteralTemplate(i,n,r,t)}nextToken(){for(;this.idx=97&&this.ch<=122)return void(this.tkn=this.scanIdentifier());if(null!==(this.tkn=CharScanners[this.ch](this)))return}this.tkn=T$EOF}next(){return this.ch=this.src.charCodeAt(++this.idx)}scanIdentifier(){for(;AsciiIdParts.has(this.next())||this.ch>127&&IdParts[this.ch];);return KeywordLookup[this.val=this.raw]||T$Identifier}scanNumber(e){if(e)this.val=0;else for(this.val=this.ch-48;this.next()<=57&&this.ch>=48;)this.val=10*this.val+this.ch-48;if(e||46===this.ch){e||this.next();const t=this.idx;let i=this.ch-48;for(;this.next()<=57&&this.ch>=48;)i=10*i+this.ch-48;this.val=this.val+i/Math.pow(10,this.idx-t)}if(101===this.ch||69===this.ch){const e=this.idx;for(this.next(),45!==this.ch&&43!==this.ch||this.next(),this.ch>=48&&this.ch<=57||(this.idx=e,this.err("Invalid exponent"));this.next()<=57&&this.ch>=48;);this.val=parseFloat(this.src.slice(this.start,this.idx))}return T$NumericLiteral}scanString(){let e,t=this.ch;this.next();let i=this.idx;for(;this.ch!==t;)if(92===this.ch){let t;if(e||(e=[]),e.push(this.src.slice(i,this.idx)),this.next(),117===this.ch)if(this.next(),this.idx+4=this.len?this.err("Unterminated quote"):this.next();let r=this.src.slice(i,this.idx);this.next();let n=r;return null!=e&&(e.push(r),n=e.join("")),this.val=n,T$StringLiteral}scanTemplate(){let e=!0,t="";for(;96!==this.next();)if(36===this.ch){if(this.idx+1=this.len?this.err("Unterminated template literal"):t+=fromCharCode(this.ch);return this.next(),this.val=t,e?T$TemplateTail:T$TemplateContinuation}scanTemplateTail(){return this.idx>=this.len&&this.err("Unterminated template"),this.idx--,this.scanTemplate()}err(e=`Unexpected token ${this.raw}`,t=this.start){throw new Error(`Parser Error: ${e} at column ${t} in expression [${this.src}]`)}opt(e){return this.tkn===e&&(this.nextToken(),!0)}expect(e){this.tkn===e?this.nextToken():this.err(`Missing expected token ${TokenValues[e&T$TokenMask]}`,this.idx)}};function unescape(e){switch(e){case 102:return 12;case 110:return 10;case 114:return 13;case 116:return 9;case 118:return 11;default:return e}}const C$This=1024,C$Scope=2048,C$Member=4096,C$Keyed=8192,C$Call=16384,C$Primary=32768,C$ShorthandProp=65536,C$Tagged=1<<17,C$Ancestor=511,T$TokenMask=63,T$PrecShift=6,T$Precedence=448,T$ExpressionTerminal=2048,T$ClosingToken=4096,T$OpeningToken=8192,T$AccessScopeTerminal=16384,T$Keyword=32768,T$EOF=65536|T$AccessScopeTerminal|T$ExpressionTerminal,T$Identifier=1<<17,T$IdentifierOrKeyword=32768|T$Identifier,T$Literal=1<<18,T$NumericLiteral=1<<19|T$Literal,T$StringLiteral=1<<20|T$Literal,T$BinaryOp=1<<21,T$UnaryOp=1<<22,T$MemberExpression=1<<23,T$MemberOrCallExpression=1<<24,T$TemplateTail=1<<25|T$MemberOrCallExpression,T$TemplateContinuation=1<<26|T$MemberOrCallExpression,T$FalseKeyword=32768|T$Literal,T$TrueKeyword=32769|T$Literal,T$NullKeyword=32770|T$Literal,T$UndefinedKeyword=32771|T$Literal,T$ThisScope=4|T$IdentifierOrKeyword,T$ParentScope=5|T$IdentifierOrKeyword,T$LParen=8198|T$AccessScopeTerminal|T$MemberOrCallExpression,T$LBrace=8199,T$Period=8388616|T$MemberOrCallExpression,T$RBrace=4105|T$AccessScopeTerminal|T$ExpressionTerminal,T$RParen=4106|T$AccessScopeTerminal|T$ExpressionTerminal,T$Comma=11|T$AccessScopeTerminal,T$LBracket=8204|T$AccessScopeTerminal|1<<23|T$MemberOrCallExpression,T$RBracket=4109|T$ExpressionTerminal,T$Colon=14|T$AccessScopeTerminal,T$Question=15,T$Ampersand=18|T$AccessScopeTerminal,T$Bar=19|T$AccessScopeTerminal,T$BarBar=84|T$BinaryOp,T$AmpersandAmpersand=149|T$BinaryOp,T$Caret=214|T$BinaryOp,T$EqEq=279|T$BinaryOp,T$BangEq=280|T$BinaryOp,T$EqEqEq=281|T$BinaryOp,T$BangEqEq=282|T$BinaryOp,T$Lt=347|T$BinaryOp,T$Gt=348|T$BinaryOp,T$LtEq=349|T$BinaryOp,T$GtEq=350|T$BinaryOp,T$InKeyword=33119|T$BinaryOp,T$InstanceOfKeyword=33120|T$BinaryOp,T$Plus=417|T$BinaryOp|1<<22,T$Minus=418|T$BinaryOp|1<<22,T$TypeofKeyword=4227107,T$VoidKeyword=4227108,T$Star=485|T$BinaryOp,T$Percent=486|T$BinaryOp,T$Slash=487|T$BinaryOp,T$Eq=40,T$Bang=4194345,KeywordLookup=Object.create(null);KeywordLookup.true=T$TrueKeyword,KeywordLookup.null=T$NullKeyword,KeywordLookup.false=T$FalseKeyword,KeywordLookup.undefined=T$UndefinedKeyword,KeywordLookup.$this=T$ThisScope,KeywordLookup.$parent=T$ParentScope,KeywordLookup.in=T$InKeyword,KeywordLookup.instanceof=T$InstanceOfKeyword,KeywordLookup.typeof=T$TypeofKeyword,KeywordLookup.void=T$VoidKeyword;const TokenValues=[!1,!0,null,void 0,"$this","$parent","(","{",".","}",")",",","[","]",":","?","'",'"',"&","|","||","&&","^","==","!=","===","!==","<",">","<=",">=","in","instanceof","+","-","typeof","void","*","%","/","=","!"],codes={AsciiIdPart:[36,0,48,58,65,91,95,0,97,123],IdStart:[36,0,65,91,95,0,97,123,170,0,186,0,192,215,216,247,248,697,736,741,7424,7462,7468,7517,7522,7526,7531,7544,7545,7615,7680,7936,8305,0,8319,0,8336,8349,8490,8492,8498,0,8526,0,8544,8585,11360,11392,42786,42888,42891,42927,42928,42936,42999,43008,43824,43867,43868,43877,64256,64263,65313,65339,65345,65371],Digit:[48,58],Skip:[0,33,127,161]};function decompress(e,t,i,r){let n=i.length;for(let s=0;s0?o:n+1,e){let t=n;for(;t(t.next(),e)}function unexpectedCharacter(e){return e.err(`Unexpected character [${fromCharCode(e.ch)}]`),null}const AsciiIdParts=new Set;decompress(null,AsciiIdParts,codes.AsciiIdPart,!0);const IdParts=new Uint8Array(65535);decompress(IdParts,null,codes.IdStart,1),decompress(IdParts,null,codes.Digit,1);const CharScanners=new Array(65535);let ci=0;for(;ci<65535;)CharScanners[ci]=unexpectedCharacter,ci++;decompress(CharScanners,null,codes.Skip,e=>(e.next(),null)),decompress(CharScanners,null,codes.IdStart,e=>e.scanIdentifier()),decompress(CharScanners,null,codes.Digit,e=>e.scanNumber(!1)),CharScanners[34]=CharScanners[39]=(e=>e.scanString()),CharScanners[96]=(e=>e.scanTemplate()),CharScanners[33]=(e=>61!==e.next()?T$Bang:61!==e.next()?T$BangEq:(e.next(),T$BangEqEq)),CharScanners[61]=(e=>61!==e.next()?T$Eq:61!==e.next()?T$EqEq:(e.next(),T$EqEqEq)),CharScanners[38]=(e=>38!==e.next()?T$Ampersand:(e.next(),T$AmpersandAmpersand)),CharScanners[124]=(e=>124!==e.next()?T$Bar:(e.next(),T$BarBar)),CharScanners[46]=(e=>e.next()<=57&&e.ch>=48?e.scanNumber(!0):T$Period),CharScanners[60]=(e=>61!==e.next()?T$Lt:(e.next(),T$LtEq)),CharScanners[62]=(e=>61!==e.next()?T$Gt:(e.next(),T$GtEq)),CharScanners[37]=returnToken(T$Percent),CharScanners[40]=returnToken(T$LParen),CharScanners[41]=returnToken(T$RParen),CharScanners[42]=returnToken(T$Star),CharScanners[43]=returnToken(T$Plus),CharScanners[44]=returnToken(T$Comma),CharScanners[45]=returnToken(T$Minus),CharScanners[47]=returnToken(T$Slash),CharScanners[58]=returnToken(T$Colon),CharScanners[63]=returnToken(T$Question),CharScanners[91]=returnToken(T$LBracket),CharScanners[93]=returnToken(T$RBracket),CharScanners[94]=returnToken(T$Caret),CharScanners[123]=returnToken(T$LBrace),CharScanners[125]=returnToken(T$RBrace);let mapProto=Map.prototype;function getMapObserver(e,t){return ModifyMapObserver.for(e,t)}let ModifyMapObserver=class e extends ModifyCollectionObserver{constructor(e,t){super(e,t)}static for(t,i){return"__map_observer__"in i||Reflect.defineProperty(i,"__map_observer__",{value:e.create(t,i),enumerable:!1,configurable:!1}),i.__map_observer__}static create(t,i){let r=new e(t,i),n=mapProto;return n.set===i.set&&n.delete===i.delete&&n.clear===i.clear||(n={set:i.set,delete:i.delete,clear:i.clear}),i.set=function(){let e=i.has(arguments[0]),t=e?"update":"add",s=i.get(arguments[0]),o=n.set.apply(i,arguments);return e&&s===i.get(arguments[0])||r.addChangeRecord({type:t,object:i,key:arguments[0],oldValue:s}),o},i.delete=function(){let e=i.has(arguments[0]),t=i.get(arguments[0]),s=n.delete.apply(i,arguments);return e&&r.addChangeRecord({type:"delete",object:i,key:arguments[0],oldValue:t}),s},i.clear=function(){let e=n.clear.apply(i,arguments);return r.addChangeRecord({type:"clear",object:i}),e},r}};function findOriginalEventTarget(e){return e.path&&e.path[0]||e.deepPath&&e.deepPath[0]||e.target}function stopPropagation(){this.standardStopPropagation(),this.propagationStopped=!0}function handleCapturedEvent(e){e.propagationStopped=!1;let t=findOriginalEventTarget(e),i=[];for(;t;){if(t.capturedCallbacks){let r=t.capturedCallbacks[e.type];r&&(e.stopPropagation!==stopPropagation&&(e.standardStopPropagation=e.stopPropagation,e.stopPropagation=stopPropagation),i.push(r))}t=t.parentNode}for(let t=i.length-1;t>=0&&!e.propagationStopped;t--){let r=i[t];"handleEvent"in r?r.handleEvent(e):r(e)}}let CapturedHandlerEntry=class{constructor(e){this.eventName=e,this.count=0}increment(){this.count++,1===this.count&&DOM.addEventListener(this.eventName,handleCapturedEvent,!0)}decrement(){this.count--,0===this.count&&DOM.removeEventListener(this.eventName,handleCapturedEvent,!0)}};function handleDelegatedEvent(e){e.propagationStopped=!1;let t=findOriginalEventTarget(e);for(;t&&!e.propagationStopped;){if(t.delegatedCallbacks){let i=t.delegatedCallbacks[e.type];i&&(e.stopPropagation!==stopPropagation&&(e.standardStopPropagation=e.stopPropagation,e.stopPropagation=stopPropagation),"handleEvent"in i?i.handleEvent(e):i(e))}t=t.parentNode}}let DelegateHandlerEntry=class{constructor(e){this.eventName=e,this.count=0}increment(){this.count++,1===this.count&&DOM.addEventListener(this.eventName,handleDelegatedEvent,!1)}decrement(){this.count--,0===this.count&&DOM.removeEventListener(this.eventName,handleDelegatedEvent,!1)}},DelegationEntryHandler=class{constructor(e,t,i){this.entry=e,this.lookup=t,this.targetEvent=i}dispose(){this.entry.decrement(),this.lookup[this.targetEvent]=null}},EventHandler=class{constructor(e,t,i){this.target=e,this.targetEvent=t,this.callback=i}dispose(){this.target.removeEventListener(this.targetEvent,this.callback)}},DefaultEventStrategy=class{constructor(){this.delegatedHandlers={},this.capturedHandlers={}}subscribe(e,t,i,r,n){let s,o,a;if(r===delegationStrategy.bubbling){s=this.delegatedHandlers,a=s[t]||(s[t]=new DelegateHandlerEntry(t));let r=e.delegatedCallbacks||(e.delegatedCallbacks={});return a.increment(),r[t]=i,!0===n?new DelegationEntryHandler(a,r,t):function(){a.decrement(),r[t]=null}}if(r===delegationStrategy.capturing){o=this.capturedHandlers,a=o[t]||(o[t]=new CapturedHandlerEntry(t));let r=e.capturedCallbacks||(e.capturedCallbacks={});return a.increment(),r[t]=i,!0===n?new DelegationEntryHandler(a,r,t):function(){a.decrement(),r[t]=null}}return e.addEventListener(t,i),!0===n?new EventHandler(e,t,i):function(){e.removeEventListener(t,i)}}};const delegationStrategy={none:0,capturing:1,bubbling:2};let EventManager=class{constructor(){this.elementHandlerLookup={},this.eventStrategyLookup={},this.registerElementConfig({tagName:"input",properties:{value:["change","input"],checked:["change","input"],files:["change","input"]}}),this.registerElementConfig({tagName:"textarea",properties:{value:["change","input"]}}),this.registerElementConfig({tagName:"select",properties:{value:["change"]}}),this.registerElementConfig({tagName:"content editable",properties:{value:["change","input","blur","keyup","paste"]}}),this.registerElementConfig({tagName:"scrollable element",properties:{scrollTop:["scroll"],scrollLeft:["scroll"]}}),this.defaultEventStrategy=new DefaultEventStrategy}registerElementConfig(e){let t,i=e.tagName.toLowerCase(),r=e.properties,n=this.elementHandlerLookup[i]={};for(t in r)r.hasOwnProperty(t)&&(n[t]=r[t])}registerEventStrategy(e,t){this.eventStrategyLookup[e]=t}getElementHandler(e,t){let i,r=this.elementHandlerLookup;if(e.tagName){if(r[i=e.tagName.toLowerCase()]&&r[i][t])return new EventSubscriber(r[i][t]);if("textContent"===t||"innerHTML"===t)return new EventSubscriber(r["content editable"].value);if("scrollTop"===t||"scrollLeft"===t)return new EventSubscriber(r["scrollable element"][t])}return null}addEventListener(e,t,i,r,n){return(this.eventStrategyLookup[t]||this.defaultEventStrategy).subscribe(e,t,i,r,n)}},EventSubscriber=class{constructor(e){this.events=e,this.element=null,this.handler=null}subscribe(e,t){this.element=e,this.handler=t;let i=this.events;for(let r=0,n=i.length;n>r;++r)e.addEventListener(i[r],t)}dispose(){if(null===this.element)return;let e=this.element,t=this.handler,i=this.events;for(let r=0,n=i.length;n>r;++r)e.removeEventListener(i[r],t);this.element=this.handler=null}},DirtyChecker=class{constructor(){this.tracked=[],this.checkDelay=120}addProperty(e){let t=this.tracked;t.push(e),1===t.length&&this.scheduleDirtyCheck()}removeProperty(e){let t=this.tracked;t.splice(t.indexOf(e),1)}scheduleDirtyCheck(){setTimeout(()=>this.check(),this.checkDelay)}check(){let e=this.tracked,t=e.length;for(;t--;){let i=e[t];i.isDirty()&&i.call()}e.length&&this.scheduleDirtyCheck()}},DirtyCheckProperty=(_dec5$1=subscriberCollection())(_class5$1=class{constructor(e,t,i){this.dirtyChecker=e,this.obj=t,this.propertyName=i}getValue(){return this.obj[this.propertyName]}setValue(e){this.obj[this.propertyName]=e}call(){let e=this.oldValue,t=this.getValue();this.callSubscribers(t,e),this.oldValue=t}isDirty(){return this.oldValue!==this.obj[this.propertyName]}subscribe(e,t){this.hasSubscribers()||(this.oldValue=this.getValue(),this.dirtyChecker.addProperty(this)),this.addSubscriber(e,t)}unsubscribe(e,t){this.removeSubscriber(e,t)&&!this.hasSubscribers()&&this.dirtyChecker.removeProperty(this)}})||_class5$1;const logger=getLogger("property-observation"),propertyAccessor={getValue:(e,t)=>e[t],setValue:(e,t,i)=>{t[i]=e}};let PrimitiveObserver=class{constructor(e,t){this.doNotCache=!0,this.primitive=e,this.propertyName=t}getValue(){return this.primitive[this.propertyName]}setValue(){let e=typeof this.primitive;throw new Error(`The ${this.propertyName} property of a ${e} (${this.primitive}) cannot be assigned.`)}subscribe(){}unsubscribe(){}},SetterObserver=(_dec6$1=subscriberCollection())(_class7$1=class{constructor(e,t,i){this.taskQueue=e,this.obj=t,this.propertyName=i,this.queued=!1,this.observing=!1}getValue(){return this.obj[this.propertyName]}setValue(e){this.obj[this.propertyName]=e}getterValue(){return this.currentValue}setterValue(e){let t=this.currentValue;t!==e&&(this.queued||(this.oldValue=t,this.queued=!0,this.taskQueue.queueMicroTask(this)),this.currentValue=e)}call(){let e=this.oldValue,t=this.currentValue;this.queued=!1,this.callSubscribers(t,e)}subscribe(e,t){this.observing||this.convertProperty(),this.addSubscriber(e,t)}unsubscribe(e,t){this.removeSubscriber(e,t)}convertProperty(){this.observing=!0,this.currentValue=this.obj[this.propertyName],this.setValue=this.setterValue,this.getValue=this.getterValue,Reflect.defineProperty(this.obj,this.propertyName,{configurable:!0,enumerable:!(this.propertyName in this.obj)||this.obj.propertyIsEnumerable(this.propertyName),get:this.getValue.bind(this),set:this.setValue.bind(this)})||logger.warn(`Cannot observe property '${this.propertyName}' of object`,this.obj)}})||_class7$1,XLinkAttributeObserver=class{constructor(e,t,i){this.element=e,this.propertyName=t,this.attributeName=i}getValue(){return this.element.getAttributeNS("http://www.w3.org/1999/xlink",this.attributeName)}setValue(e){return this.element.setAttributeNS("http://www.w3.org/1999/xlink",this.attributeName,e)}subscribe(){throw new Error(`Observation of a "${this.element.nodeName}" element's "${this.propertyName}" property is not supported.`)}};const dataAttributeAccessor={getValue:(e,t)=>e.getAttribute(t),setValue:(e,t,i)=>{null==e?t.removeAttribute(i):t.setAttribute(i,e)}};let DataAttributeObserver=class{constructor(e,t){this.element=e,this.propertyName=t}getValue(){return this.element.getAttribute(this.propertyName)}setValue(e){return null==e?this.element.removeAttribute(this.propertyName):this.element.setAttribute(this.propertyName,e)}subscribe(){throw new Error(`Observation of a "${this.element.nodeName}" element's "${this.propertyName}" property is not supported.`)}},StyleObserver=class{constructor(e,t){this.element=e,this.propertyName=t,this.styles=null,this.version=0}getValue(){return this.element.style.cssText}_setProperty(e,t){let i="";null!=t&&"function"==typeof t.indexOf&&-1!==t.indexOf("!important")&&(i="important",t=t.replace("!important","")),this.element.style.setProperty(e,t,i)}setValue(e){let t,i=this.styles||{},r=this.version;if(null!=e)if(e instanceof Object){let n;for(t in e)e.hasOwnProperty(t)&&(n=e[t],i[t=t.replace(/([A-Z])/g,e=>"-"+e.toLowerCase())]=r,this._setProperty(t,n))}else if(e.length){let n,s=/\s*([\w\-]+)\s*:\s*((?:(?:[\w\-]+\(\s*(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|[\w\-]+\(\s*(?:^"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|[^\)]*)\),?|[^\)]*)\),?|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|[^;]*),?\s*)+);?/g;for(;null!==(n=s.exec(e));)(t=n[1])&&(i[t]=r,this._setProperty(t,n[2]))}if(this.styles=i,this.version+=1,0!==r)for(t in r-=1,i)i.hasOwnProperty(t)&&i[t]===r&&this.element.style.removeProperty(t)}subscribe(){throw new Error(`Observation of a "${this.element.nodeName}" element's "${this.propertyName}" property is not supported.`)}},ValueAttributeObserver=(_dec7$1=subscriberCollection())(_class8=class{constructor(e,t,i){this.element=e,this.propertyName=t,this.handler=i,"files"===t&&(this.setValue=(()=>{}))}getValue(){return this.element[this.propertyName]}setValue(e){e=null==e?"":e,this.element[this.propertyName]!==e&&(this.element[this.propertyName]=e,this.notify())}notify(){let e=this.oldValue,t=this.getValue();this.callSubscribers(t,e),this.oldValue=t}handleEvent(){this.notify()}subscribe(e,t){this.hasSubscribers()||(this.oldValue=this.getValue(),this.handler.subscribe(this.element,this)),this.addSubscriber(e,t)}unsubscribe(e,t){this.removeSubscriber(e,t)&&!this.hasSubscribers()&&this.handler.dispose()}})||_class8;const checkedArrayContext="CheckedObserver:array",checkedValueContext="CheckedObserver:value";let CheckedObserver=(_dec8=subscriberCollection())(_class9=class{constructor(e,t,i){this.element=e,this.handler=t,this.observerLocator=i}getValue(){return this.value}setValue(e){this.initialSync&&this.value===e||(this.arrayObserver&&(this.arrayObserver.unsubscribe(checkedArrayContext,this),this.arrayObserver=null),"checkbox"===this.element.type&&Array.isArray(e)&&(this.arrayObserver=this.observerLocator.getArrayObserver(e),this.arrayObserver.subscribe(checkedArrayContext,this)),this.oldValue=this.value,this.value=e,this.synchronizeElement(),this.notify(),this.initialSync||(this.initialSync=!0,this.observerLocator.taskQueue.queueMicroTask(this)))}call(e,t){this.synchronizeElement(),this.valueObserver||(this.valueObserver=this.element.__observers__.model||this.element.__observers__.value,this.valueObserver&&this.valueObserver.subscribe(checkedValueContext,this))}synchronizeElement(){let e=this.value,t=this.element,i=t.hasOwnProperty("model")?t.model:t.value,r="radio"===t.type,n=t.matcher||((e,t)=>e===t);t.checked=r&&!!n(e,i)||!r&&!0===e||!r&&Array.isArray(e)&&-1!==e.findIndex(e=>!!n(e,i))}synchronizeValue(){let e,t=this.value,i=this.element,r=i.hasOwnProperty("model")?i.model:i.value,n=i.matcher||((e,t)=>e===t);if("checkbox"===i.type){if(Array.isArray(t))return e=t.findIndex(e=>!!n(e,r)),void(i.checked&&-1===e?t.push(r):i.checked||-1===e||t.splice(e,1));t=i.checked}else{if(!i.checked)return;t=r}this.oldValue=this.value,this.value=t,this.notify()}notify(){let e=this.oldValue,t=this.value;t!==e&&this.callSubscribers(t,e)}handleEvent(){this.synchronizeValue()}subscribe(e,t){this.hasSubscribers()||this.handler.subscribe(this.element,this),this.addSubscriber(e,t)}unsubscribe(e,t){this.removeSubscriber(e,t)&&!this.hasSubscribers()&&this.handler.dispose()}unbind(){this.arrayObserver&&(this.arrayObserver.unsubscribe(checkedArrayContext,this),this.arrayObserver=null),this.valueObserver&&this.valueObserver.unsubscribe(checkedValueContext,this)}})||_class9;const selectArrayContext="SelectValueObserver:array";let SelectValueObserver=(_dec9=subscriberCollection())(_class10=class{constructor(e,t,i){this.element=e,this.handler=t,this.observerLocator=i}getValue(){return this.value}setValue(e){if(null!=e&&this.element.multiple&&!Array.isArray(e))throw new Error("Only null or Array instances can be bound to a multi-select.");this.value!==e&&(this.arrayObserver&&(this.arrayObserver.unsubscribe(selectArrayContext,this),this.arrayObserver=null),Array.isArray(e)&&(this.arrayObserver=this.observerLocator.getArrayObserver(e),this.arrayObserver.subscribe(selectArrayContext,this)),this.oldValue=this.value,this.value=e,this.synchronizeOptions(),this.notify(),this.initialSync||(this.initialSync=!0,this.observerLocator.taskQueue.queueMicroTask(this)))}call(e,t){this.synchronizeOptions()}synchronizeOptions(){let e,t=this.value;Array.isArray(t)&&(e=!0);let i=this.element.options,r=i.length,n=this.element.matcher||((e,t)=>e===t);for(;r--;){let s=i.item(r),o=s.hasOwnProperty("model")?s.model:s.value;e?s.selected=-1!==t.findIndex(e=>!!n(o,e)):s.selected=!!n(o,t)}}synchronizeValue(){let e=this.element.options,t=0,i=[];for(let r=0,n=e.length;re===t),t=0;for(;te(r,t))?this.value.splice(t,1):t++}for(t=0;te(r,t))&&this.value.push(r),t++}return}}else i=0===t?null:i[0];i!==this.value&&(this.oldValue=this.value,this.value=i,this.notify())}notify(){let e=this.oldValue,t=this.value;this.callSubscribers(t,e)}handleEvent(){this.synchronizeValue()}subscribe(e,t){this.hasSubscribers()||this.handler.subscribe(this.element,this),this.addSubscriber(e,t)}unsubscribe(e,t){this.removeSubscriber(e,t)&&!this.hasSubscribers()&&this.handler.dispose()}bind(){this.domObserver=DOM.createMutationObserver(()=>{this.synchronizeOptions(),this.synchronizeValue()}),this.domObserver.observe(this.element,{childList:!0,subtree:!0,characterData:!0})}unbind(){this.domObserver.disconnect(),this.domObserver=null,this.arrayObserver&&(this.arrayObserver.unsubscribe(selectArrayContext,this),this.arrayObserver=null)}})||_class10,ClassObserver=class{constructor(e){this.element=e,this.doNotCache=!0,this.value="",this.version=0}getValue(){return this.value}setValue(e){let t,i,r=this.nameIndex||{},n=this.version;if(null!=e&&e.length)for(let s=0,o=(t=e.split(/\s+/)).length;s").firstElementChild.nodeName&&elements.altGlyph&&(elements.altglyph=elements.altGlyph,delete elements.altGlyph,elements.altglyphdef=elements.altGlyphDef,delete elements.altGlyphDef,elements.altglyphitem=elements.altGlyphItem,delete elements.altGlyphItem,elements.glyphref=elements.glyphRef,delete elements.glyphRef)}isStandardSvgAttribute(e,t){return presentationElements[e]&&presentationAttributes[t]||elements[e]&&-1!==elements[e].indexOf(t)}}}const elements=svgElements,presentationElements=svgPresentationElements,presentationAttributes=svgPresentationAttributes,SVGAnalyzer=svgAnalyzer||class{isStandardSvgAttribute(){return!1}};let ObserverLocator=(_temp=_class11=class{constructor(e,t,i,r,n){this.taskQueue=e,this.eventManager=t,this.dirtyChecker=i,this.svgAnalyzer=r,this.parser=n,this.adapters=[],this.logger=getLogger("observer-locator")}getObserver(e,t){let i,r=e.__observers__;return r&&t in r?r[t]:((i=this.createPropertyObserver(e,t)).doNotCache||(void 0===r&&(r=this.getOrCreateObserversLookup(e)),r[t]=i),i)}getOrCreateObserversLookup(e){return e.__observers__||this.createObserversLookup(e)}createObserversLookup(e){let t={};return Reflect.defineProperty(e,"__observers__",{enumerable:!1,configurable:!1,writable:!1,value:t})||this.logger.warn("Cannot add observers to object",e),t}addAdapter(e){this.adapters.push(e)}getAdapterObserver(e,t,i){for(let r=0,n=this.adapters.length;rthis.callSource(e))}unbind(){this.isBound&&(this.isBound=!1,this.sourceExpression.unbind&&this.sourceExpression.unbind(this,this.source),this.source=null,this.targetProperty.setValue(null))}},ValueConverterResource=class e{constructor(e){this.name=e}static convention(t){if(t.endsWith("ValueConverter"))return new e(camelCase(t.substring(0,t.length-14)))}initialize(e,t){this.instance=e.get(t)}register(e,t){e.registerValueConverter(t||this.name,this.instance)}load(e,t){}};function valueConverter(e){if(void 0===e||"string"==typeof e)return function(t){metadata.define(metadata.resource,new ValueConverterResource(e),t)};metadata.define(metadata.resource,new ValueConverterResource,e)}let BindingBehaviorResource=class e{constructor(e){this.name=e}static convention(t){if(t.endsWith("BindingBehavior"))return new e(camelCase(t.substring(0,t.length-15)))}initialize(e,t){this.instance=e.get(t)}register(e,t){e.registerBindingBehavior(t||this.name,this.instance)}load(e,t){}};function bindingBehavior(e){if(void 0===e||"string"==typeof e)return function(t){metadata.define(metadata.resource,new BindingBehaviorResource(e),t)};metadata.define(metadata.resource,new BindingBehaviorResource,e)}let ListenerExpression=class{constructor(e,t,i,r,n,s){this.eventManager=e,this.targetEvent=t,this.sourceExpression=i,this.delegationStrategy=r,this.discrete=!0,this.preventDefault=n,this.lookupFunctions=s}createBinding(e){return new Listener(this.eventManager,this.targetEvent,this.delegationStrategy,this.sourceExpression,e,this.preventDefault,this.lookupFunctions)}},Listener=class{constructor(e,t,i,r,n,s,o){this.eventManager=e,this.targetEvent=t,this.delegationStrategy=i,this.sourceExpression=r,this.target=n,this.preventDefault=s,this.lookupFunctions=o}callSource(e){let t=this.source.overrideContext;t.$event=e;let i=this.sourceExpression.evaluate(this.source,this.lookupFunctions,!0);return delete t.$event,!0!==i&&this.preventDefault&&e.preventDefault(),i}handleEvent(e){this.callSource(e)}bind(e){if(this.isBound){if(this.source===e)return;this.unbind()}this.isBound=!0,this.source=e,this.sourceExpression.bind&&this.sourceExpression.bind(this,e,this.lookupFunctions),this._handler=this.eventManager.addEventListener(this.target,this.targetEvent,this,this.delegationStrategy,!0)}unbind(){this.isBound&&(this.isBound=!1,this.sourceExpression.unbind&&this.sourceExpression.unbind(this,this.source),this.source=null,this._handler.dispose(),this._handler=null)}};function getAU(e){let t=e.au;if(void 0===t)throw new Error(`No Aurelia APIs are defined for the element: "${e.tagName}".`);return t}let NameExpression=class e{constructor(e,t,i){this.sourceExpression=e,this.apiName=t,this.lookupFunctions=i,this.discrete=!0}createBinding(t){return new NameBinder(this.sourceExpression,e.locateAPI(t,this.apiName),this.lookupFunctions)}static locateAPI(e,t){switch(t){case"element":return e;case"controller":return getAU(e).controller;case"view-model":return getAU(e).controller.viewModel;case"view":return getAU(e).controller.view;default:let i=getAU(e)[t];if(void 0===i)throw new Error(`Attempted to reference "${t}", but it was not found amongst the target's API.`);return i.viewModel}}},NameBinder=class{constructor(e,t,i){this.sourceExpression=e,this.target=t,this.lookupFunctions=i}bind(e){if(this.isBound){if(this.source===e)return;this.unbind()}this.isBound=!0,this.source=e,this.sourceExpression.bind&&this.sourceExpression.bind(this,e,this.lookupFunctions),this.sourceExpression.assign(this.source,this.target,this.lookupFunctions)}unbind(){this.isBound&&(this.isBound=!1,this.sourceExpression.evaluate(this.source,this.lookupFunctions)===this.target&&this.sourceExpression.assign(this.source,null,this.lookupFunctions),this.sourceExpression.unbind&&this.sourceExpression.unbind(this,this.source),this.source=null)}};const LookupFunctions={bindingBehaviors:e=>null,valueConverters:e=>null};let BindingEngine=(_temp2=_class13=class{constructor(e,t){this.observerLocator=e,this.parser=t}createBindingExpression(e,t,i=bindingMode.toView,r=LookupFunctions){return new BindingExpression(this.observerLocator,e,this.parser.parse(t),i,r)}propertyObserver(e,t){return{subscribe:i=>{let r=this.observerLocator.getObserver(e,t);return r.subscribe(i),{dispose:()=>r.unsubscribe(i)}}}}collectionObserver(e){return{subscribe:t=>{let i;if(e instanceof Array)i=this.observerLocator.getArrayObserver(e);else if(e instanceof Map)i=this.observerLocator.getMapObserver(e);else{if(!(e instanceof Set))throw new Error("collection must be an instance of Array, Map or Set.");i=this.observerLocator.getSetObserver(e)}return i.subscribe(t),{dispose:()=>i.unsubscribe(t)}}}}expressionObserver(e,t){let i={bindingContext:e,overrideContext:createOverrideContext(e)};return new ExpressionObserver(i,this.parser.parse(t),this.observerLocator,LookupFunctions)}parseExpression(e){return this.parser.parse(e)}registerAdapter(e){this.observerLocator.addAdapter(e)}},_class13.inject=[ObserverLocator,Parser],_temp2),setProto=Set.prototype;function getSetObserver(e,t){return ModifySetObserver.for(e,t)}let ModifySetObserver=class e extends ModifyCollectionObserver{constructor(e,t){super(e,t)}static for(t,i){return"__set_observer__"in i||Reflect.defineProperty(i,"__set_observer__",{value:e.create(t,i),enumerable:!1,configurable:!1}),i.__set_observer__}static create(t,i){let r=new e(t,i),n=setProto;return n.add===i.add&&n.delete===i.delete&&n.clear===i.clear||(n={add:i.add,delete:i.delete,clear:i.clear}),i.add=function(){let e=i.size,t=n.add.apply(i,arguments);return i.size===e||r.addChangeRecord({type:"add",object:i,value:Array.from(i).pop()}),t},i.delete=function(){let e=i.has(arguments[0]),t=n.delete.apply(i,arguments);return e&&r.addChangeRecord({type:"delete",object:i,value:arguments[0]}),t},i.clear=function(){let e=n.clear.apply(i,arguments);return r.addChangeRecord({type:"clear",object:i}),e},r}};function observable(e,t,i){function r(e,t,i,r){const n=void 0===t;n&&(e=e.prototype,t="string"==typeof r?r:r.name);let s=`_${t}`;const o={configurable:!0,enumerable:!1,writable:!0},a=r&&r.changeHandler||`${t}Changed`;if(i?"function"==typeof i.initializer&&(o.value=i.initializer()):i={},"enumerable"in i||(i.enumerable=!0),delete i.value,delete i.writable,delete i.initializer,Reflect.defineProperty(e,s,o),i.get=function(){return this[s]},i.set=function(e){let i=this[s];e!==i&&(this[s]=e,Reflect.defineProperty(this,s,{enumerable:!1}),this[a]&&this[a](e,i,t))},i.get.dependencies=[s],!n)return i;Reflect.defineProperty(e,t,i)}return void 0===t?(t,i,n)=>r(t,i,n,e):r(e,t,i)}const signals={};function connectBindingToSignal(e,t){signals.hasOwnProperty(t)||(signals[t]=0),e.observeProperty(signals,t)}function signalBindings(e){signals.hasOwnProperty(e)&&signals[e]++}var _class$2,_temp$1,_dec$2,_class2$2,_dec2$2,_class3$2,_dec3$2,_class4$1,_dec4$2,_class5$2,_dec5$2,_class6$1,_dec6$2,_class7$2,_class8$1,_temp2$1,_class9$1,_temp3,_class11$1,_dec7$2,_class13$1,_dec8$1,_class14,_class15,_temp4,_dec9$1,_class16,_dec10$1,_class17,_dec11,_class18;const animationEvent={enterBegin:"animation:enter:begin",enterActive:"animation:enter:active",enterDone:"animation:enter:done",enterTimeout:"animation:enter:timeout",leaveBegin:"animation:leave:begin",leaveActive:"animation:leave:active",leaveDone:"animation:leave:done",leaveTimeout:"animation:leave:timeout",staggerNext:"animation:stagger:next",removeClassBegin:"animation:remove-class:begin",removeClassActive:"animation:remove-class:active",removeClassDone:"animation:remove-class:done",removeClassTimeout:"animation:remove-class:timeout",addClassBegin:"animation:add-class:begin",addClassActive:"animation:add-class:active",addClassDone:"animation:add-class:done",addClassTimeout:"animation:add-class:timeout",animateBegin:"animation:animate:begin",animateActive:"animation:animate:active",animateDone:"animation:animate:done",animateTimeout:"animation:animate:timeout",sequenceBegin:"animation:sequence:begin",sequenceDone:"animation:sequence:done"};let Animator=class{enter(e){return Promise.resolve(!1)}leave(e){return Promise.resolve(!1)}removeClass(e,t){return e.classList.remove(t),Promise.resolve(!1)}addClass(e,t){return e.classList.add(t),Promise.resolve(!1)}animate(e,t){return Promise.resolve(!1)}runSequence(e){}registerEffect(e,t){}unregisterEffect(e){}},CompositionTransactionNotifier=class{constructor(e){this.owner=e,this.owner._compositionCount++}done(){this.owner._compositionCount--,this.owner._tryCompleteTransaction()}},CompositionTransactionOwnershipToken=class{constructor(e){this.owner=e,this.owner._ownershipToken=this,this.thenable=this._createThenable()}waitForCompositionComplete(){return this.owner._tryCompleteTransaction(),this.thenable}resolve(){this._resolveCallback()}_createThenable(){return new Promise((e,t)=>{this._resolveCallback=e})}},CompositionTransaction=class{constructor(){this._ownershipToken=null,this._compositionCount=0}tryCapture(){return null===this._ownershipToken?new CompositionTransactionOwnershipToken(this):null}enlist(){return new CompositionTransactionNotifier(this)}_tryCompleteTransaction(){if(this._compositionCount<=0&&(this._compositionCount=0,null!==this._ownershipToken)){let e=this._ownershipToken;this._ownershipToken=null,e.resolve()}}};const capitalMatcher=/([A-Z])/g;function addHyphenAndLower(e){return"-"+e.toLowerCase()}function _hyphenate(e){return(e.charAt(0).toLowerCase()+e.slice(1)).replace(capitalMatcher,addHyphenAndLower)}function _isAllWhitespace(e){return!(e.auInterpolationTarget||/[^\t\n\r ]/.test(e.textContent))}let ViewEngineHooksResource=class e{constructor(){}initialize(e,t){this.instance=e.get(t)}register(e,t){e.registerViewEngineHooks(this.instance)}load(e,t){}static convention(t){if(t.endsWith("ViewEngineHooks"))return new e}};function viewEngineHooks(e){let t=function(e){metadata.define(metadata.resource,new ViewEngineHooksResource,e)};return e?t(e):t}let ElementEvents=class{constructor(e){this.element=e,this.subscriptions={}}_enqueueHandler(e){this.subscriptions[e.eventName]=this.subscriptions[e.eventName]||[],this.subscriptions[e.eventName].push(e)}_dequeueHandler(e){let t,i=this.subscriptions[e.eventName];return i&&(t=i.indexOf(e))>-1&&i.splice(t,1),e}publish(e,t={},i=!0,r=!0){let n=DOM.createCustomEvent(e,{cancelable:r,bubbles:i,detail:t});this.element.dispatchEvent(n)}subscribe(e,t,i=!0){if("function"==typeof t){return new EventHandlerImpl(this,e,t,i,!1)}}subscribeOnce(e,t,i=!0){if("function"==typeof t){return new EventHandlerImpl(this,e,t,i,!0)}}dispose(e){if(e&&"string"==typeof e){let t=this.subscriptions[e];if(t)for(;t.length;){let e=t.pop();e&&e.dispose()}}else this.disposeAll()}disposeAll(){for(let e in this.subscriptions)this.dispose(e)}},EventHandlerImpl=class{constructor(e,t,i,r,n){this.owner=e,this.eventName=t,this.handler=i,this.capture="boolean"==typeof r?r:r.capture,this.bubbles=!this.capture,this.captureOrOptions=r,this.once=n,e.element.addEventListener(t,this,r),e._enqueueHandler(this)}handleEvent(e){(0,this.handler)(e),this.once&&this.dispose()}dispose(){this.owner.element.removeEventListener(this.eventName,this,this.captureOrOptions),this.owner._dequeueHandler(this),this.owner=this.handler=null}},ResourceLoadContext=class{constructor(){this.dependencies={}}addDependency(e){this.dependencies[e]=!0}hasDependency(e){return e in this.dependencies}},ViewCompileInstruction=class{constructor(e=!1,t=!1){this.targetShadowDOM=e,this.compileSurrogate=t,this.associatedModuleId=null}};ViewCompileInstruction.normal=new ViewCompileInstruction;let BehaviorInstruction=class e{static enhance(){let t=new e;return t.enhance=!0,t}static unitTest(t,i){let r=new e;return r.type=t,r.attributes=i||{},r}static element(t,i){let r=new e;return r.type=i,r.attributes={},r.anchorIsContainer=!(t.hasAttribute("containerless")||i.containerless),r.initiatedByBehavior=!0,r}static attribute(t,i){let r=new e;return r.attrName=t,r.type=i||null,r.attributes={},r}static dynamic(t,i,r){let n=new e;return n.host=t,n.viewModel=i,n.viewFactory=r,n.inheritBindingContext=!0,n}};const biProto=BehaviorInstruction.prototype;biProto.initiatedByBehavior=!1,biProto.enhance=!1,biProto.partReplacements=null,biProto.viewFactory=null,biProto.originalAttrName=null,biProto.skipContentProcessing=!1,biProto.contentFactory=null,biProto.viewModel=null,biProto.anchorIsContainer=!1,biProto.host=null,biProto.attributes=null,biProto.type=null,biProto.attrName=null,biProto.inheritBindingContext=!1,BehaviorInstruction.normal=new BehaviorInstruction;let TargetInstruction=(_temp$1=_class$2=class e{static shadowSlot(t){let i=new e;return i.parentInjectorId=t,i.shadowSlot=!0,i}static contentExpression(t){let i=new e;return i.contentExpression=t,i}static letElement(t){let i=new e;return i.expressions=t,i.letElement=!0,i}static lifting(t,i){let r=new e;return r.parentInjectorId=t,r.expressions=e.noExpressions,r.behaviorInstructions=[i],r.viewFactory=i.viewFactory,r.providers=[i.type.target],r.lifting=!0,r}static normal(t,i,r,n,s,o){let a=new e;return a.injectorId=t,a.parentInjectorId=i,a.providers=r,a.behaviorInstructions=n,a.expressions=s,a.anchorIsContainer=!o||o.anchorIsContainer,a.elementInstruction=o,a}static surrogate(t,i,r,n){let s=new e;return s.expressions=r,s.behaviorInstructions=i,s.providers=t,s.values=n,s}},_class$2.noExpressions=Object.freeze([]),_temp$1);const tiProto=TargetInstruction.prototype;tiProto.injectorId=null,tiProto.parentInjectorId=null,tiProto.shadowSlot=!1,tiProto.slotName=null,tiProto.slotFallbackFactory=null,tiProto.contentExpression=null,tiProto.letElement=!1,tiProto.expressions=null,tiProto.expressions=null,tiProto.providers=null,tiProto.viewFactory=null,tiProto.anchorIsContainer=!1,tiProto.elementInstruction=null,tiProto.lifting=!1,tiProto.values=null;const viewStrategy=protocol.create("aurelia:view-strategy",{validate:e=>"function"==typeof e.loadViewFactory||"View strategies must implement: loadViewFactory(viewEngine: ViewEngine, compileInstruction: ViewCompileInstruction, loadContext?: ResourceLoadContext): Promise",compose(e){"function"!=typeof e.makeRelativeTo&&(e.makeRelativeTo=PLATFORM.noop)}});let RelativeViewStrategy=(_dec$2=viewStrategy())(_class2$2=class{constructor(e){this.path=e,this.absolutePath=null}loadViewFactory(e,t,i,r){return null===this.absolutePath&&this.moduleId&&(this.absolutePath=relativeToFile(this.path,this.moduleId)),t.associatedModuleId=this.moduleId,e.loadViewFactory(this.absolutePath||this.path,t,i,r)}makeRelativeTo(e){null===this.absolutePath&&(this.absolutePath=relativeToFile(this.path,e))}})||_class2$2,ConventionalViewStrategy=(_dec2$2=viewStrategy())(_class3$2=class{constructor(e,t){this.moduleId=t.moduleId,this.viewUrl=e.convertOriginToViewUrl(t)}loadViewFactory(e,t,i,r){return t.associatedModuleId=this.moduleId,e.loadViewFactory(this.viewUrl,t,i,r)}})||_class3$2,NoViewStrategy=(_dec3$2=viewStrategy())(_class4$1=class{constructor(e,t){this.dependencies=e||null,this.dependencyBaseUrl=t||""}loadViewFactory(e,t,i,r){let n=this.entry,s=this.dependencies;if(n&&n.factoryIsReady)return Promise.resolve(null);if(this.entry=n=new TemplateRegistryEntry(this.moduleId||this.dependencyBaseUrl),n.dependencies=[],n.templateIsLoaded=!0,null!==s)for(let e=0,t=s.length;e{const n=e.container,s=e.appResources,o=e.viewCompiler,a=new ViewResources(s);let l,c=[];r&&a.autoRegister(n,r);for(let e of i)if("function"==typeof e)null!==(l=a.autoRegister(n,e)).elementName&&c.push(l);else{if(!e||"object"!=typeof e)throw new Error(`dependency neither function nor object. Received: "${typeof e}"`);for(let t in e){let i=e[t];"function"==typeof i&&null!==(l=a.autoRegister(n,i)).elementName&&c.push(l)}}return Promise.all(c.map(e=>e.load(n,e.target))).then(()=>{const e=null!==this.template?o.compile(this.template,a,t):null;return this.factoryIsReady=!0,this.factory=e,e})})}})||_class7$2,ViewLocator=(_temp2$1=_class8$1=class e{getViewStrategy(t){if(!t)return null;if("object"==typeof t&&"getViewStrategy"in t){let e=Origin.get(t.constructor);return"string"==typeof(t=t.getViewStrategy())&&(t=new RelativeViewStrategy(t)),viewStrategy.assert(t),e.moduleId&&t.makeRelativeTo(e.moduleId),t}if("string"==typeof t&&(t=new RelativeViewStrategy(t)),viewStrategy.validate(t))return t;if("function"!=typeof t&&(t=t.constructor),"$view"in t){let i,r=t.$view;return i=null===(r="function"==typeof r?r.call(t):r)?new NoViewStrategy:r instanceof StaticViewStrategy?r:new StaticViewStrategy(r),metadata.define(e.viewStrategyMetadataKey,i,t),i}let i=Origin.get(t),r=metadata.get(e.viewStrategyMetadataKey,t);if(r)i.moduleId&&(r.moduleId=i.moduleId);else{if(!i.moduleId)throw new Error("Cannot determine default view strategy for object.",t);r=this.createFallbackViewStrategy(i)}return r}createFallbackViewStrategy(e){return new ConventionalViewStrategy(this,e)}convertOriginToViewUrl(e){let t=e.moduleId;return(t.endsWith(".js")||t.endsWith(".ts")?t.substring(0,t.length-3):t)+".html"}},_class8$1.viewStrategyMetadataKey="aurelia:view-strategy",_temp2$1);function mi(e){throw new Error(`BindingLanguage must implement ${e}().`)}let BindingLanguage=class{inspectAttribute(e,t,i,r){mi("inspectAttribute")}createAttributeInstruction(e,t,i,r){mi("createAttributeInstruction")}createLetExpressions(e,t){mi("createLetExpressions")}inspectTextContent(e,t){mi("inspectTextContent")}},noNodes=Object.freeze([]),SlotCustomAttribute=class{static inject(){return[DOM.Element]}constructor(e){this.element=e,this.element.auSlotAttribute=this}valueChanged(e,t){}},PassThroughSlot=class e{constructor(e,t,i,r){this.anchor=e,this.anchor.viewSlot=this,this.name=t,this.destinationName=i,this.fallbackFactory=r,this.destinationSlot=null,this.projections=0,this.contentView=null,new SlotCustomAttribute(this.anchor).value=this.destinationName}get needsFallbackRendering(){return this.fallbackFactory&&0===this.projections}renderFallbackContent(e,t,i,r){if(null===this.contentView){this.contentView=this.fallbackFactory.create(this.ownerView.container),this.contentView.bind(this.ownerView.bindingContext,this.ownerView.overrideContext);let e=Object.create(null);e[this.destinationSlot.name]=this.destinationSlot,ShadowDOM.distributeView(this.contentView,e,i,r,this.destinationSlot.name)}}passThroughTo(e){this.destinationSlot=e}addNode(t,i,r,n){null!==this.contentView&&(this.contentView.removeNodes(),this.contentView.detached(),this.contentView.unbind(),this.contentView=null),i.viewSlot instanceof e?i.viewSlot.passThroughTo(this):(this.projections++,this.destinationSlot.addNode(t,i,r,n))}removeView(e,t){this.projections--,this.destinationSlot.removeView(e,t),this.needsFallbackRendering&&this.renderFallbackContent(null,noNodes,t)}removeAll(e){this.projections=0,this.destinationSlot.removeAll(e),this.needsFallbackRendering&&this.renderFallbackContent(null,noNodes,e)}projectFrom(e,t){this.destinationSlot.projectFrom(e,t)}created(e){this.ownerView=e}bind(e){this.contentView&&this.contentView.bind(e.bindingContext,e.overrideContext)}attached(){this.contentView&&this.contentView.attached()}detached(){this.contentView&&this.contentView.detached()}unbind(){this.contentView&&this.contentView.unbind()}},ShadowSlot=class{constructor(e,t,i){this.anchor=e,this.anchor.isContentProjectionSource=!0,this.anchor.viewSlot=this,this.name=t,this.fallbackFactory=i,this.contentView=null,this.projections=0,this.children=[],this.projectFromAnchors=null,this.destinationSlots=null}get needsFallbackRendering(){return this.fallbackFactory&&0===this.projections}addNode(e,t,i,r,n){if(null!==this.contentView&&(this.contentView.removeNodes(),this.contentView.detached(),this.contentView.unbind(),this.contentView=null),t.viewSlot instanceof PassThroughSlot)t.viewSlot.passThroughTo(this);else if(null!==this.destinationSlots)ShadowDOM.distributeNodes(e,[t],this.destinationSlots,this,r);else{t.auOwnerView=e,t.auProjectionSource=i,t.auAssignedSlot=this;let n=this._findAnchor(e,t,i,r);n.parentNode.insertBefore(t,n),this.children.push(t),this.projections++}}removeView(e,t){if(null!==this.destinationSlots)ShadowDOM.undistributeView(e,this.destinationSlots,this);else if(this.contentView&&this.contentView.hasSlots)ShadowDOM.undistributeView(e,this.contentView.slots,t);else{let i=this.children.find(e=>e.auSlotProjectFrom===t);if(i){let r=i.auProjectionChildren;for(let t=0,i=r.length;tt.auSlotProjectFrom===e);if(t){let i=t.auProjectionChildren;for(let e=0,t=i.length;ee.auSlotProjectFrom===i);if(n){if(void 0!==r){let i,s=n.auProjectionChildren,o=-1;for(let n=0,a=s.length;n=r&&i!==e))return s.splice(n,0,t),a}}return n.auProjectionChildren.push(t),n}}return this.anchor}projectTo(e){this.destinationSlots=e}projectFrom(e,t){let i=DOM.createComment("anchor"),r=this.anchor.parentNode;i.auSlotProjectFrom=t,i.auOwnerView=e,i.auProjectionChildren=[],r.insertBefore(i,this.anchor),this.children.push(i),null===this.projectFromAnchors&&(this.projectFromAnchors=[]),this.projectFromAnchors.push(i)}renderFallbackContent(e,t,i,r){if(null===this.contentView&&(this.contentView=this.fallbackFactory.create(this.ownerView.container),this.contentView.bind(this.ownerView.bindingContext,this.ownerView.overrideContext),this.contentView.insertNodesBefore(this.anchor)),this.contentView.hasSlots){let n=this.contentView.slots,s=this.projectFromAnchors;if(null!==s)for(let e in n){let t=n[e];for(let e=0,i=s.length;er;++r){let s=t[r];if(!s||"string"!=typeof s&&!s.name)throw new Error(`Invalid bindable property at "${r}" for class "${e.name}". Expected either a string or an object with "name" property.`);let o=new BindableProperty(s),a=!1;for(let e=0,t=n.length;t>e;++e)if(n[e].name===o.name){a=!0;break}a||o.registerWith(e,i)}}}return i}constructor(e,t){this.bindingLanguage=null,this.parent=e||null,this.hasParent=null!==this.parent,this.viewUrl=t||"",this.lookupFunctions={valueConverters:this.getValueConverter.bind(this),bindingBehaviors:this.getBindingBehavior.bind(this)},this.attributes=Object.create(null),this.elements=Object.create(null),this.valueConverters=Object.create(null),this.bindingBehaviors=Object.create(null),this.attributeMap=Object.create(null),this.values=Object.create(null),this.beforeCompile=this.afterCompile=this.beforeCreate=this.afterCreate=this.beforeBind=this.beforeUnbind=!1}_tryAddHook(e,t){if("function"==typeof e[t]){let i,r=e[t].bind(e),n=1;for(;void 0!==this[i=t+n.toString()];)n++;this[t]=!0,this[i]=r}}_invokeHook(e,t,i,r,n){if(this.hasParent&&this.parent._invokeHook(e,t,i,r,n),this[e]){this[e+"1"](t,i,r,n);let s=e+"2";if(this[s]&&(this[s](t,i,r,n),this[s=e+"3"])){this[s](t,i,r,n);let o=4;for(;void 0!==this[s=e+o.toString()];)this[s](t,i,r,n),o++}}}registerViewEngineHooks(e){this._tryAddHook(e,"beforeCompile"),this._tryAddHook(e,"afterCompile"),this._tryAddHook(e,"beforeCreate"),this._tryAddHook(e,"afterCreate"),this._tryAddHook(e,"beforeBind"),this._tryAddHook(e,"beforeUnbind")}getBindingLanguage(e){return this.bindingLanguage||(this.bindingLanguage=e)}patchInParent(e){let t=this.parent;this.parent=e||null,this.hasParent=null!==this.parent,null===e.parent&&(e.parent=t,e.hasParent=null!==t)}relativeToView(e){return relativeToFile(e,this.viewUrl)}registerElement(e,t){register(this.elements,e,t,"an Element")}getElement(e){return this.elements[e]||(this.hasParent?this.parent.getElement(e):null)}mapAttribute(e){return this.attributeMap[e]||(this.hasParent?this.parent.mapAttribute(e):null)}registerAttribute(e,t,i){this.attributeMap[e]=i,register(this.attributes,e,t,"an Attribute")}getAttribute(e){return this.attributes[e]||(this.hasParent?this.parent.getAttribute(e):null)}registerValueConverter(e,t){register(this.valueConverters,e,t,"a ValueConverter")}getValueConverter(e){return this.valueConverters[e]||(this.hasParent?this.parent.getValueConverter(e):null)}registerBindingBehavior(e,t){register(this.bindingBehaviors,e,t,"a BindingBehavior")}getBindingBehavior(e){return this.bindingBehaviors[e]||(this.hasParent?this.parent.getBindingBehavior(e):null)}registerValue(e,t){register(this.values,e,t,"a value")}getValue(e){return this.values[e]||(this.hasParent?this.parent.getValue(e):null)}autoRegister(t,i){let r=metadata.getOwn(metadata.resource,i);return r?r instanceof HtmlBehaviorResource&&(e.convention(i,r),null===r.attributeName&&null===r.elementName&&HtmlBehaviorResource.convention(i.name,r),null===r.attributeName&&null===r.elementName&&(r.elementName=_hyphenate(i.name))):((r=e.convention(i)||HtmlBehaviorResource.convention(i.name)||ValueConverterResource.convention(i.name)||BindingBehaviorResource.convention(i.name)||ViewEngineHooksResource.convention(i.name))||((r=new HtmlBehaviorResource).elementName=_hyphenate(i.name)),metadata.define(metadata.resource,r,i)),r.initialize(t,i),r.register(this),r}},View=class{constructor(e,t,i,r,n,s,o){this.container=e,this.viewFactory=t,this.resources=t.resources,this.fragment=i,this.firstChild=i.firstChild,this.lastChild=i.lastChild,this.controllers=r,this.bindings=n,this.children=s,this.slots=o,this.hasSlots=!1,this.fromCache=!1,this.isBound=!1,this.isAttached=!1,this.bindingContext=null,this.overrideContext=null,this.controller=null,this.viewModelScope=null,this.animatableElement=void 0,this._isUserControlled=!1,this.contentView=null;for(let e in o){this.hasSlots=!0;break}}returnToCache(){this.viewFactory.returnViewToCache(this)}created(){let e,t,i=this.controllers;for(e=0,t=i.length;e=r?this.add(t):(t.insertNodesBefore(i[e].firstChild),i.splice(e,0,t),this.isAttached?(t.attached(),this.animateView(t,"enter")):void 0)}move(e,t){if(e===t)return;const i=this.children,r=i[e];r.removeNodes(),r.insertNodesBefore(i[t].firstChild),i.splice(e,1),i.splice(t,0,r)}remove(e,t,i){return this.removeAt(this.children.indexOf(e),t,i)}removeMany(e,t,i){const r=this.children;let n,s=e.length,o=[];e.forEach(e=>{if(i)return void e.removeNodes();let t=this.animateView(e,"leave");t?o.push(t.then(()=>e.removeNodes())):e.removeNodes()});let a=()=>{if(this.isAttached)for(n=0;n=0&&r.splice(t,1)}};return o.length>0?Promise.all(o).then(()=>a()):a()}removeAt(e,t,i){let r=this.children[e],n=()=>(e=this.children.indexOf(r),r.removeNodes(),this.children.splice(e,1),this.isAttached&&r.detached(),t&&r.returnToCache(),r);if(!i){let e=this.animateView(r,"leave");if(e)return e.then(()=>n())}return n()}removeAll(e,t){let i,r=this.children,n=r.length,s=[];r.forEach(e=>{if(t)return void e.removeNodes();let i=this.animateView(e,"leave");i?s.push(i.then(()=>e.removeNodes())):e.removeNodes()});let o=()=>{if(this.isAttached)for(i=0;i0?Promise.all(s).then(()=>o()):o()}attached(){let e,t,i,r;if(!this.isAttached)for(this.isAttached=!0,e=0,t=(i=this.children).length;eShadowDOM.distributeView(t,e,this))}_projectionAdd(e){ShadowDOM.distributeView(e,this.projectToSlots,this),this.children.push(e),this.isAttached&&e.attached()}_projectionInsert(e,t){0===e&&!this.children.length||e>=this.children.length?this.add(t):(ShadowDOM.distributeView(t,this.projectToSlots,this,e),this.children.splice(e,0,t),this.isAttached&&t.attached())}_projectionMove(e,t){if(e===t)return;const i=this.children,r=i[e];ShadowDOM.undistributeView(r,this.projectToSlots,this),ShadowDOM.distributeView(r,this.projectToSlots,this,t),i.splice(e,1),i.splice(t,0,r)}_projectionRemove(e,t){ShadowDOM.undistributeView(e,this.projectToSlots,this),this.children.splice(this.children.indexOf(e),1),this.isAttached&&e.detached(),t&&e.returnToCache()}_projectionRemoveAt(e,t){let i=this.children[e];ShadowDOM.undistributeView(i,this.projectToSlots,this),this.children.splice(e,1),this.isAttached&&i.detached(),t&&i.returnToCache()}_projectionRemoveMany(e,t){e.forEach(e=>this.remove(e,t))}_projectionRemoveAll(e){ShadowDOM.undistributeAll(this.projectToSlots,this);let t=this.children,i=t.length;for(let r=0;r0?this.cache=[]:this.cache=null,this.isCaching=this.cacheSize>0}getCachedView(){return null!==this.cache&&this.cache.pop()||null}returnViewToCache(e){e.isAttached&&e.detached(),e.isBound&&e.unbind(),null!==this.cache&&this.cache.lengththis.viewFactory=e)}create(e,t,i,r){return this.viewFactory.create(e,t,i,r)}get isCaching(){return this.viewFactory.isCaching}setCacheSize(e,t){this.viewFactory.setCacheSize(e,t)}getCachedView(){return this.viewFactory.getCachedView()}returnViewToCache(e){this.viewFactory.returnViewToCache(e)}},auSlotBehavior=null,ViewEngine=(_dec8$1=inject(Loader,Container,ViewCompiler,ModuleAnalyzer,ViewResources))((_temp4=_class15=class e{constructor(e,t,i,r,n){this.loader=e,this.container=t,this.viewCompiler=i,this.moduleAnalyzer=r,this.appResources=n,this._pluginMap={},null===auSlotBehavior&&((auSlotBehavior=new HtmlBehaviorResource).attributeName="au-slot",metadata.define(metadata.resource,auSlotBehavior,SlotCustomAttribute)),auSlotBehavior.initialize(t,SlotCustomAttribute),auSlotBehavior.register(n)}addResourcePlugin(e,t){let i=e.replace(".","")+"-resource-plugin";this._pluginMap[e]=i,this.loader.addPlugin(i,t)}loadViewFactory(e,t,i,r){return i=i||new ResourceLoadContext,ensureRegistryEntry(this.loader,e).then(e=>{const n=e.address;return e.onReady?i.hasDependency(n)?null===e.template?e.onReady:Promise.resolve(new ProxyViewFactory(e.onReady)):(i.addDependency(n),e.onReady):(i.addDependency(n),e.onReady=this.loadTemplateResources(e,t,i,r).then(i=>{if(e.resources=i,null===e.template)return e.factory=null;let r=this.viewCompiler.compile(e.template,i,t);return e.factory=r}),e.onReady)})}loadTemplateResources(t,i,r,n){let s,o,a=new ViewResources(this.appResources,t.address),l=t.dependencies;if(i=i||ViewCompileInstruction.normal,0===l.length&&!i.associatedModuleId)return Promise.resolve(a);if(s=l.map(e=>e.src),o=l.map(e=>e.name),logger$1.debug(`importing resources for ${t.address}`,s),n){let r=metadata.get(e.viewModelRequireMetadataKey,n);if(r){let e=s.length;for(let e=0,i=r.length;e{let r=Origin.get(i).moduleId,n=this.moduleAnalyzer.analyze(r,i,t);if(!n.mainResource)throw new Error(`No view model found in module "${e}".`);return n.initialize(this.container),n.mainResource})}importViewResources(e,t,i,r,n){return n=n||new ResourceLoadContext,r=r||ViewCompileInstruction.normal,e=e.map(e=>this._applyLoaderPlugin(e)),this.loader.loadAllModules(e).then(e=>{let s,o,a,l,c,u,h=this.container,d=this.moduleAnalyzer,p=new Array(e.length);for(s=0,o=e.length;si)})}_applyLoaderPlugin(e){let t=e.lastIndexOf(".");if(-1!==t){let i=e.substring(t),r=this._pluginMap[i];return void 0===r?e:this.loader.applyPluginToUrl(e,r)}return e}},_class15.viewModelRequireMetadataKey="aurelia:view-model-require",_class14=_temp4))||_class14,Controller=class{constructor(e,t,i,r){this.behavior=e,this.instruction=t,this.viewModel=i,this.isAttached=!1,this.view=null,this.isBound=!1,this.scope=null,this.container=r,this.elementEvents=r.elementEvents||null;let n,s,o=e.observerLocator.getOrCreateObserversLookup(i),a=e.handlesBind,l=t.attributes,c=this.boundProperties=[],u=e.properties;for(e._ensurePropertiesDefined(i,o),n=0,s=u.length;n{e[n](t,i),e.propertyChanged(s,t,i)}:(t,i)=>e[n](t,i);else if("propertyChanged"in e)i=((t,i)=>e.propertyChanged(s,t,i));else if(null!==n)throw new Error(`Change handler ${n} was specified but not declared on the class.`);return void 0!==r&&(t="function"==typeof r?r.call(e):r),new BehaviorPropertyObserver(this.owner.taskQueue,e,this.name,i,t)}}_initialize(e,t,i,r,n){let s,o,a,l=this.defaultValue;if(this.isDynamic)for(let s in i)this._createDynamicProperty(e,t,r,s,i[s],n);else this.hasOptions||(o=t[this.name],null!==i&&(s=o.selfSubscriber,a=i[this.attribute],r&&(o.selfSubscriber=null),"string"==typeof a?(e[this.name]=a,o.call()):a?n.push({observer:o,binding:a.createBinding(e)}):void 0!==l&&o.call(),o.selfSubscriber=s),o.publishing=!0)}_createDynamicProperty(e,t,i,r,n,s){let o,a,l=r+"Changed",c=null;l in e?c="propertyChanged"in e?(t,i)=>{e[l](t,i),e.propertyChanged(r,t,i)}:(t,i)=>e[l](t,i):"propertyChanged"in e&&(c=((t,i)=>e.propertyChanged(r,t,i))),o=t[r]=new BehaviorPropertyObserver(this.owner.taskQueue,e,r,c),Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get:o.getValue.bind(o),set:o.setValue.bind(o)}),i&&(o.selfSubscriber=null),"string"==typeof n?(e[r]=n,o.call()):n&&(a={observer:o,binding:n.createBinding(e)},s.push(a)),o.publishing=!0,o.selfSubscriber=c}},lastProviderId=0;function nextProviderId(){return++lastProviderId}function doProcessContent(){return!0}function doProcessAttributes(){}let HtmlBehaviorResource=class e{constructor(){this.elementName=null,this.attributeName=null,this.attributeDefaultBindingMode=void 0,this.liftsContent=!1,this.targetShadowDOM=!1,this.shadowDOMOptions=null,this.processAttributes=doProcessAttributes,this.processContent=doProcessContent,this.usesShadowDOM=!1,this.childBindings=null,this.hasDynamicOptions=!1,this.containerless=!1,this.properties=[],this.attributes={},this.isInitialized=!1,this.primaryProperty=null}static convention(t,i){let r;return t.endsWith("CustomAttribute")&&((r=i||new e).attributeName=_hyphenate(t.substring(0,t.length-15))),t.endsWith("CustomElement")&&((r=i||new e).elementName=_hyphenate(t.substring(0,t.length-13))),r}addChildBinding(e){null===this.childBindings&&(this.childBindings=[]),this.childBindings.push(e)}initialize(e,t){let i,r,n,s=t.prototype,o=this.properties,a=this.attributeName,l=this.attributeDefaultBindingMode;if(!this.isInitialized)if(this.isInitialized=!0,t.__providerId__=nextProviderId(),this.observerLocator=e.get(ObserverLocator),this.taskQueue=e.get(TaskQueue),this.target=t,this.usesShadowDOM=this.targetShadowDOM&&FEATURE.shadowDOM,this.handlesCreated="created"in s,this.handlesBind="bind"in s,this.handlesUnbind="unbind"in s,this.handlesAttached="attached"in s,this.handlesDetached="detached"in s,this.htmlName=this.elementName||this.attributeName,null!==a)if(0===o.length&&new BindableProperty({name:"value",changeHandler:"valueChanged"in s?"valueChanged":null,attribute:a,defaultBindingMode:l}).registerWith(t,this),n=o[0],1===o.length&&"value"===n.name)n.isDynamic=n.hasOptions=this.hasDynamicOptions,n.defineOn(t,this);else{for(i=0,r=o.length;i{e.registerAttribute(t,this,this.attributeName)})),null!==this.elementName&&e.registerElement(t||this.elementName,this)}load(e,t,i,r,n){let s;return null!==this.elementName?(r=e.get(ViewLocator).getViewStrategy(r||this.viewStrategy||t),s=new ViewCompileInstruction(this.targetShadowDOM,!0),r.moduleId||(r.moduleId=Origin.get(t).moduleId),r.loadViewFactory(e.get(ViewEngine),s,i,t).then(e=>(n&&this.viewFactory||(this.viewFactory=e),e))):Promise.resolve(this)}compile(e,t,i,r,n){if(this.liftsContent){if(!r.viewFactory){let s=DOM.createElement("template"),o=DOM.createDocumentFragment(),a=i.getAttribute("view-cache"),l=i.getAttribute("part");i.removeAttribute(r.originalAttrName),DOM.replaceNode(s,i,n),o.appendChild(i),r.viewFactory=e.compile(o,t),l&&(r.viewFactory.part=l,i.removeAttribute("part")),a&&(r.viewFactory.setCacheSize(a),i.removeAttribute("view-cache")),i=s}}else if(null!==this.elementName){let s={};if(this.processContent(e,t,i,r)&&i.hasChildNodes()){let o,a,l=i.firstChild,c=this.usesShadowDOM?null:DOM.createElement("au-content");for(;l;)o=l.nextSibling,"TEMPLATE"===l.tagName&&(a=l.getAttribute("replace-part"))?(s[a]=e.compile(l,t),DOM.removeNode(l,n),r.partReplacements=s):null!==c&&(3===l.nodeType&&_isAllWhitespace(l)?DOM.removeNode(l,n):c.appendChild(l)),l=o;null!==c&&c.hasChildNodes()&&i.appendChild(c),r.skipContentProcessing=!1}else r.skipContentProcessing=!0}else this.processContent(e,t,i,r)||(r.skipContentProcessing=!0);return i}create(e,t,i,r){let n,s=null;t=t||BehaviorInstruction.normal,i=i||null,r=r||null,null!==this.elementName&&i&&(this.usesShadowDOM?(n=i.attachShadow(this.shadowDOMOptions),e.registerInstance(DOM.boundary,n)):(n=i,this.targetShadowDOM&&e.registerInstance(DOM.boundary,n))),null!==i&&(i.au=s=i.au||{});let o,a=t.viewModel||e.get(this.target),l=new Controller(this,t,a,e),c=this.childBindings;if(this.liftsContent)s.controller=l;else if(null!==this.elementName){if(o=t.viewFactory||this.viewFactory,e.viewModel=a,o&&(l.view=o.create(e,t,i)),null!==i){if(s.controller=l,l.view){if(!this.usesShadowDOM&&(1===i.childNodes.length||i.contentElement)){let e=i.childNodes[0]||i.contentElement;l.view.contentView={fragment:e},e.parentNode&&DOM.removeNode(e)}if(t.anchorIsContainer){if(null!==c)for(let e=0,t=c.length;ee.name===t.name)||new BindableProperty(t).registerWith(r,this)}}};function createChildObserverDecorator(e,t){return function(i,r,n){let s="string"==typeof r?i.constructor:i,o=metadata.getOrCreateOwn(metadata.resource,HtmlBehaviorResource,s);"string"==typeof e&&(e={selector:e,name:r}),n&&(n.writable=!0,n.configurable=!0),e.all=t,o.addChildBinding(new ChildObserver(e))}}function children(e){return createChildObserverDecorator(e,!0)}function child(e){return createChildObserverDecorator(e,!1)}let ChildObserver=class{constructor(e){this.name=e.name,this.changeHandler=e.changeHandler||this.name+"Changed",this.selector=e.selector,this.all=e.all}create(e,t,i){return new ChildObserverBinder(this.selector,e,this.name,t,i,this.changeHandler,this.all)}};const noMutations=[];function trackMutation(e,t,i){let r=e.get(t);r||(r=[],e.set(t,r)),r.push(i)}function onChildChange(e,t){let i=t.binders,r=i.length,n=new Map;for(let t=0,s=e.length;t{null!==t.changeHandler&&t.viewModel[t.changeHandler](e)})}let ChildObserverBinder=class{constructor(e,t,i,r,n,s,o){this.selector=e,this.viewHost=t,this.property=i,this.viewModel=r,this.controller=n,this.changeHandler=s in r?s:null,this.usesShadowDOM=n.behavior.usesShadowDOM,this.all=o,!this.usesShadowDOM&&n.view&&n.view.contentView?this.contentView=n.view.contentView:this.contentView=null}matches(e){if(e.matches(this.selector)){if(null===this.contentView)return!0;let t=this.contentView,i=e.auAssignedSlot;if(i&&i.projectFromAnchors){let e=i.projectFromAnchors;for(let i=0,r=e.length;ivoid 0===t?i():i().then(()=>remove(e,t)),with:(e,t,i)=>void 0===t?i():Promise.all([remove(e,t),i()]),after:(e,t,i)=>Promise.resolve(e.removeAll(!0)).then(i)};function tryActivateViewModel(e){return e.skipActivation||"function"!=typeof e.viewModel.activate?Promise.resolve():e.viewModel.activate(e.model)||Promise.resolve()}let CompositionEngine=(_dec10$1=inject(ViewEngine,ViewLocator))(_class17=class{constructor(e,t){this.viewEngine=e,this.viewLocator=t}_swap(e,t){let i=SwapStrategies[e.swapOrder]||SwapStrategies.after,r=e.viewSlot.children.slice();return i(e.viewSlot,r,()=>Promise.resolve(e.viewSlot.add(t)).then(()=>{e.currentController&&e.currentController.unbind()})).then(()=>{e.compositionTransactionNotifier&&e.compositionTransactionNotifier.done()})}_createControllerAndSwap(e){return this.createController(e).then(t=>e.compositionTransactionOwnershipToken?e.compositionTransactionOwnershipToken.waitForCompositionComplete().then(()=>(t.automate(e.overrideContext,e.owningView),this._swap(e,t.view))).then(()=>t):(t.automate(e.overrideContext,e.owningView),this._swap(e,t.view).then(()=>t)))}createController(e){let t,i,r,n;return this.ensureViewModel(e).then(tryActivateViewModel).then(()=>{t=e.childContainer,i=e.viewModel,r=e.viewModelResource,n=r.metadata;let s=this.viewLocator.getViewStrategy(e.view||i);return e.viewResources&&s.makeRelativeTo(e.viewResources.viewUrl),n.load(t,r.value,null,s,!0)}).then(r=>n.create(t,BehaviorInstruction.dynamic(e.host,i,r)))}ensureViewModel(e){let t=e.childContainer=e.childContainer||e.container.createChild();if("string"==typeof e.viewModel)return e.viewModel=e.viewResources?e.viewResources.relativeToView(e.viewModel):e.viewModel,this.viewEngine.importViewModelResource(e.viewModel).then(i=>(t.autoRegister(i.value),e.host&&t.registerInstance(DOM.Element,e.host),e.viewModel=t.viewModel=t.get(i.value),e.viewModelResource=i,e));let i=e.viewModel.constructor,r="function"==typeof e.viewModel;r&&(i=e.viewModel,t.autoRegister(i));let n=metadata.getOrCreateOwn(metadata.resource,HtmlBehaviorResource,i);return n.elementName=n.elementName||"dynamic-element",n.initialize(r?t:e.container||t,i),e.viewModelResource={metadata:n,value:i},e.host&&t.registerInstance(DOM.Element,e.host),t.viewModel=e.viewModel=r?t.get(i):e.viewModel,Promise.resolve(e)}compose(e){e.childContainer=e.childContainer||e.container.createChild(),e.view=this.viewLocator.getViewStrategy(e.view);let t=e.childContainer.get(CompositionTransaction),i=t.tryCapture();return i?e.compositionTransactionOwnershipToken=i:e.compositionTransactionNotifier=t.enlist(),e.viewModel?this._createControllerAndSwap(e):e.view?(e.viewResources&&e.view.makeRelativeTo(e.viewResources.viewUrl),e.view.loadViewFactory(this.viewEngine,new ViewCompileInstruction).then(t=>{let i=t.create(e.childContainer);return i.bind(e.bindingContext,e.overrideContext),e.compositionTransactionOwnershipToken?e.compositionTransactionOwnershipToken.waitForCompositionComplete().then(()=>this._swap(e,i)).then(()=>i):this._swap(e,i).then(()=>i)})):e.viewSlot?(e.viewSlot.removeAll(),e.compositionTransactionNotifier&&e.compositionTransactionNotifier.done(),Promise.resolve(null)):Promise.resolve(null)}})||_class17,ElementConfigResource=class{initialize(e,t){}register(e,t){}load(e,t){let i=new t;e.get(EventManager).registerElementConfig(i)}};function resource(e){return function(t){"string"==typeof e||Object.getPrototypeOf(e)===Object.prototype?t.$resource=e:metadata.define(metadata.resource,e,t)}}function behavior(e){return function(t){if(e instanceof HtmlBehaviorResource)metadata.define(metadata.resource,e,t);else{let i=metadata.getOrCreateOwn(metadata.resource,HtmlBehaviorResource,t);Object.assign(i,e)}}}function customElement(e){return function(t){metadata.getOrCreateOwn(metadata.resource,HtmlBehaviorResource,t).elementName=validateBehaviorName(e,"custom element")}}function customAttribute(e,t,i){return function(r){let n=metadata.getOrCreateOwn(metadata.resource,HtmlBehaviorResource,r);n.attributeName=validateBehaviorName(e,"custom attribute"),n.attributeDefaultBindingMode=t,n.aliases=i}}function templateController(e){let t=function(e){metadata.getOrCreateOwn(metadata.resource,HtmlBehaviorResource,e).liftsContent=!0};return e?t(e):t}function bindable(e,t,i){let r=function(t,i,r){let n,s=i?t.constructor:t,o=metadata.getOrCreateOwn(metadata.resource,HtmlBehaviorResource,s);return i&&((e=e||{}).name=i),(n=new BindableProperty(e)).registerWith(s,o,r)};if(!e)return r;if(t){let n=e;return e=null,r(n,t,i)}return r}function dynamicOptions(e){let t=function(e){metadata.getOrCreateOwn(metadata.resource,HtmlBehaviorResource,e).hasDynamicOptions=!0};return e?t(e):t}const defaultShadowDOMOptions={mode:"open"};function useShadowDOM(e){let t="function"!=typeof e&&e?e:defaultShadowDOMOptions,i=function(e){let i=metadata.getOrCreateOwn(metadata.resource,HtmlBehaviorResource,e);i.targetShadowDOM=!0,i.shadowDOMOptions=t};return"function"==typeof e?i(e):i}function processAttributes(e){return function(t){metadata.getOrCreateOwn(metadata.resource,HtmlBehaviorResource,t).processAttributes=function(t,i,r,n,s){try{e(t,i,r,n,s)}catch(e){getLogger("templating").error(e)}}}}function doNotProcessContent(){return!1}function processContent(e){return function(t){metadata.getOrCreateOwn(metadata.resource,HtmlBehaviorResource,t).processContent=e?function(t,i,r,n){try{return e(t,i,r,n)}catch(e){return getLogger("templating").error(e),!1}}:doNotProcessContent}}function containerless(e){let t=function(e){metadata.getOrCreateOwn(metadata.resource,HtmlBehaviorResource,e).containerless=!0};return e?t(e):t}function useViewStrategy(e){return function(t){metadata.define(ViewLocator.viewStrategyMetadataKey,e,t)}}function useView(e){return useViewStrategy(new RelativeViewStrategy(e))}function inlineView(e,t,i){return useViewStrategy(new InlineViewStrategy(e,t,i))}function noView(e,t){let i,r;"function"==typeof e?i=e:(r=e,i=void 0);let n=function(e){metadata.define(ViewLocator.viewStrategyMetadataKey,new NoViewStrategy(r,t),e)};return i?n(i):n}function view(e){return function(t){t.$view=e}}function elementConfig(e){let t=function(e){metadata.define(metadata.resource,new ElementConfigResource,e)};return e?t(e):t}function viewResources(...e){return function(t){metadata.define(ViewEngine.viewModelRequireMetadataKey,e,t)}}let TemplatingEngine=(_dec11=inject(Container,ModuleAnalyzer,ViewCompiler,CompositionEngine))(_class18=class{constructor(e,t,i,r){this._container=e,this._moduleAnalyzer=t,this._viewCompiler=i,this._compositionEngine=r,e.registerInstance(Animator,Animator.instance=new Animator)}configureAnimator(e){this._container.unregister(Animator),this._container.registerInstance(Animator,Animator.instance=e)}compose(e){return this._compositionEngine.compose(e)}enhance(e){e instanceof DOM.Element&&(e={element:e});let t={letExpressions:[]},i=e.resources||this._container.get(ViewResources);this._viewCompiler._compileNode(e.element,i,t,e.element.parentNode,"root",!0);let r=new ViewFactory(e.element,t,i),n=e.container||this._container.createChild(),s=r.create(n,BehaviorInstruction.enhance());return s.bind(e.bindingContext||{},e.overrideContext),s.firstChild=s.lastChild=s.fragment,s.fragment=DOM.createDocumentFragment(),s.attached(),s}})||_class18;function preventActionlessFormSubmit(){DOM.addEventListener("submit",e=>{const t=e.target,i=t.action;"form"!==t.tagName.toLowerCase()||i||e.preventDefault()})}let Aurelia=class e{constructor(t,i,r){this.loader=t||new PLATFORM.Loader,this.container=i||(new Container).makeGlobal(),this.resources=r||new ViewResources,this.use=new FrameworkConfiguration(this),this.logger=getLogger("aurelia"),this.hostConfigured=!1,this.host=null,this.use.instance(e,this),this.use.instance(Loader,this.loader),this.use.instance(ViewResources,this.resources)}start(){return this._started?this._started:(this.logger.info("Aurelia Starting"),this._started=this.use.apply().then(()=>{if(preventActionlessFormSubmit(),!this.container.hasResolver(BindingLanguage)){let e="You must configure Aurelia with a BindingLanguage implementation.";throw this.logger.error(e),new Error(e)}this.logger.info("Aurelia Started");let e=DOM.createCustomEvent("aurelia-started",{bubbles:!0,cancelable:!0});return DOM.dispatchEvent(e),this}))}enhance(e={},t=null){return this._configureHost(t||DOM.querySelectorAll("body")[0]),new Promise(t=>{let i=this.container.get(TemplatingEngine);this.root=i.enhance({container:this.container,element:this.host,resources:this.resources,bindingContext:e}),this.root.attached(),this._onAureliaComposed(),t(this)})}setRoot(e=null,t=null){let i={};this.root&&this.root.viewModel&&this.root.viewModel.router&&(this.root.viewModel.router.deactivate(),this.root.viewModel.router.reset()),this._configureHost(t);let r=this.container.get(TemplatingEngine);return delete this.container.get(CompositionTransaction).initialComposition,e||(e=this.configModuleId?relativeToFile("./app",this.configModuleId):"app"),i.viewModel=e,i.container=i.childContainer=this.container,i.viewSlot=this.hostSlot,i.host=this.host,r.compose(i).then(e=>(this.root=e,i.viewSlot.attached(),this._onAureliaComposed(),this))}_configureHost(e){if(!this.hostConfigured){if(e=e||this.host,this.host=e&&"string"!=typeof e?e:DOM.getElementById(e||"applicationHost"),!this.host)throw new Error("No applicationHost was specified.");this.hostConfigured=!0,this.host.aurelia=this,this.hostSlot=new ViewSlot(this.host,!0),this.hostSlot.transformChildNodesIntoView(),this.container.registerInstance(DOM.boundary,this.host)}}_onAureliaComposed(){let e=DOM.createCustomEvent("aurelia-composed",{bubbles:!0,cancelable:!0});setTimeout(()=>DOM.dispatchEvent(e),1)}};const logger$2=getLogger("aurelia"),extPattern=/\.[^\/.]+$/;function runTasks(e,t){let i,r=()=>(i=t.shift())?Promise.resolve(i(e)).then(r):Promise.resolve();return r()}function loadPlugin(e,t,i){if(logger$2.debug(`Loading plugin ${i.moduleId}.`),"string"==typeof i.moduleId){e.resourcesRelativeTo=i.resourcesRelativeTo;let n=i.moduleId;return i.resourcesRelativeTo.length>1?t.normalize(i.moduleId,i.resourcesRelativeTo[1]).then(e=>r(e)):r(n)}if("function"==typeof i.configure)return-1!==e.configuredPlugins.indexOf(i.configure)?Promise.resolve():(e.configuredPlugins.push(i.configure),Promise.resolve(i.configure.call(null,e,i.config||{})));throw new Error(invalidConfigMsg(i.moduleId||i.configure,"plugin"));function r(r){return t.loadModule(r).then(t=>{if("configure"in t)return-1!==e.configuredPlugins.indexOf(t.configure)?Promise.resolve():Promise.resolve(t.configure(e,i.config||{})).then(()=>{e.configuredPlugins.push(t.configure),e.resourcesRelativeTo=null,logger$2.debug(`Configured plugin ${i.moduleId}.`)});e.resourcesRelativeTo=null,logger$2.debug(`Loaded plugin ${i.moduleId}.`)})}}function loadResources(e,t,i){if(0===Object.keys(t).length)return Promise.resolve();let r=e.container.get(ViewEngine);return Promise.all(Object.keys(t).map(i=>(function(t){let i=t.moduleId,r=getExt(i);n(i)&&(i=s(i));return e.loader.normalize(i,t.relativeTo).then(e=>({name:t.moduleId,importId:n(t.moduleId)?function(e,t){return s(e)+"."+t}(e,r):e}))})(t[i]))).then(e=>{let t=[],n=[];return e.forEach(e=>{t.push(void 0),n.push(e.importId)}),r.importViewResources(n,t,i)});function n(e){let t=getExt(e);return!!t&&(""!==t&&(".js"!==t&&".ts"!==t))}function s(e){return e.replace(extPattern,"")}}function getExt(e){let t=e.match(extPattern);if(t&&t.length>0)return t[0].split(".")[1]}function loadBehaviors(e){return Promise.all(e.behaviorsToLoad.map(t=>t.load(e.container,t.target))).then(()=>{e.behaviorsToLoad=null})}function assertProcessed(e){if(e.processed)throw new Error("This config instance has already been applied. To load more plugins or global resources, create a new FrameworkConfiguration instance.")}function invalidConfigMsg(e,t){return`Invalid ${t} [${e}], ${t} must be specified as functions or relative module IDs.`}let FrameworkConfiguration=class{constructor(e){this.aurelia=e,this.container=e.container,this.info=[],this.processed=!1,this.preTasks=[],this.postTasks=[],this.behaviorsToLoad=[],this.configuredPlugins=[],this.resourcesToLoad={},this.preTask(()=>e.loader.normalize("aurelia-bootstrapper").then(e=>this.bootstrapperName=e)),this.postTask(()=>loadResources(e,this.resourcesToLoad,e.resources))}instance(e,t){return this.container.registerInstance(e,t),this}singleton(e,t){return this.container.registerSingleton(e,t),this}transient(e,t){return this.container.registerTransient(e,t),this}preTask(e){return assertProcessed(this),this.preTasks.push(e),this}postTask(e){return assertProcessed(this),this.postTasks.push(e),this}feature(e,t={}){switch(typeof e){case"string":let i=/\/index$/i.test(e),r=i||getExt(e)?e:e+"/index",n=i?e.substr(0,e.length-6):e;this.info.push({moduleId:r,resourcesRelativeTo:[n,""],config:t});break;case"function":this.info.push({configure:e,config:t||{}});break;default:throw new Error(invalidConfigMsg(e,"feature"))}return this}globalResources(e){assertProcessed(this);let t,i=Array.isArray(e)?e:arguments,r=this.resourcesRelativeTo||["",""];for(let e=0,n=i.length;eloadBehaviors(this));break;default:throw new Error(invalidConfigMsg(t,"resource"))}return this}globalName(e,t){return assertProcessed(this),this.resourcesToLoad[e]={moduleId:t,relativeTo:""},this}plugin(e,t){let i;switch(assertProcessed(this),typeof e){case"string":i={moduleId:e,resourcesRelativeTo:[e,""],config:t||{}};break;case"function":i={configure:e,config:t||{}};break;default:throw new Error(invalidConfigMsg(e,"plugin"))}return this.info.push(i),this}_addNormalizedPlugin(e,t){let i={moduleId:e,resourcesRelativeTo:[e,""],config:t||{}};return this.info.push(i),this.preTask(()=>{let t=[e,this.bootstrapperName];return i.moduleId=e,i.resourcesRelativeTo=t,Promise.resolve()}),this}defaultBindingLanguage(){return this._addNormalizedPlugin("aurelia-templating-binding")}router(){return this._addNormalizedPlugin("aurelia-templating-router")}history(){return this._addNormalizedPlugin("aurelia-history-browser")}defaultResources(){return this._addNormalizedPlugin("aurelia-templating-resources")}eventAggregator(){return this._addNormalizedPlugin("aurelia-event-aggregator")}basicConfiguration(){return this.defaultBindingLanguage().defaultResources().eventAggregator()}standardConfiguration(){return this.basicConfiguration().history().router()}developmentLogging(e){let t=e?logLevel[e]:void 0;return void 0===t&&(t=logLevel.debug),this.preTask(()=>this.aurelia.loader.normalize("aurelia-logging-console",this.bootstrapperName).then(e=>this.aurelia.loader.loadModule(e).then(e=>{addAppender(new e.ConsoleAppender),setLevel(t)}))),this}apply(){return this.processed?Promise.resolve():runTasks(this,this.preTasks).then(()=>{let e,t=this.aurelia.loader,i=this.info,r=()=>(e=i.shift())?loadPlugin(this,t,e).then(r):(this.processed=!0,this.configuredPlugins=null,Promise.resolve());return r().then(()=>runTasks(this,this.postTasks))})}};const LogManager=TheLogManager;var _class$3,_temp$2,_dec$3,_class2$3,_dec2$3,_class3$3,_class4$2,_temp2$2,_class5$3,_temp3$1;let AttributeMap=(_temp$2=_class$3=class{constructor(e){this.elements=Object.create(null),this.allElements=Object.create(null),this.svg=e,this.registerUniversal("accesskey","accessKey"),this.registerUniversal("contenteditable","contentEditable"),this.registerUniversal("tabindex","tabIndex"),this.registerUniversal("textcontent","textContent"),this.registerUniversal("innerhtml","innerHTML"),this.registerUniversal("scrolltop","scrollTop"),this.registerUniversal("scrollleft","scrollLeft"),this.registerUniversal("readonly","readOnly"),this.register("label","for","htmlFor"),this.register("img","usemap","useMap"),this.register("input","maxlength","maxLength"),this.register("input","minlength","minLength"),this.register("input","formaction","formAction"),this.register("input","formenctype","formEncType"),this.register("input","formmethod","formMethod"),this.register("input","formnovalidate","formNoValidate"),this.register("input","formtarget","formTarget"),this.register("textarea","maxlength","maxLength"),this.register("td","rowspan","rowSpan"),this.register("td","colspan","colSpan"),this.register("th","rowspan","rowSpan"),this.register("th","colspan","colSpan")}register(e,t,i){e=e.toLowerCase(),t=t.toLowerCase(),(this.elements[e]=this.elements[e]||Object.create(null))[t]=i}registerUniversal(e,t){e=e.toLowerCase(),this.allElements[e]=t}map(e,t){if(this.svg.isStandardSvgAttribute(e,t))return t;e=e.toLowerCase(),t=t.toLowerCase();const i=this.elements[e];return void 0!==i&&t in i?i[t]:t in this.allElements?this.allElements[t]:/(?:^data-)|(?:^aria-)|:/.test(t)?t:camelCase(t)}},_class$3.inject=[SVGAnalyzer],_temp$2),InterpolationBindingExpression=class{constructor(e,t,i,r,n,s){this.observerLocator=e,this.targetProperty=t,this.parts=i,this.mode=r,this.lookupFunctions=n,this.attribute=this.attrToRemove=s,this.discrete=!1}createBinding(e){return 3===this.parts.length?new ChildInterpolationBinding(e,this.observerLocator,this.parts[1],this.mode,this.lookupFunctions,this.targetProperty,this.parts[0],this.parts[2]):new InterpolationBinding(this.observerLocator,this.parts,e,this.targetProperty,this.mode,this.lookupFunctions)}};function validateTarget(e,t){if("style"===t)getLogger("templating-binding").info('Internet Explorer does not support interpolation in "style" attributes. Use the style attribute\'s alias, "css" instead.');else if(e.parentElement&&"TEXTAREA"===e.parentElement.nodeName&&"textContent"===t)throw new Error('Interpolation binding cannot be used in the content of a textarea element. Use instead.')}let InterpolationBinding=class{constructor(e,t,i,r,n,s){validateTarget(i,r),this.observerLocator=e,this.parts=t,this.target=i,this.targetProperty=r,this.targetAccessor=e.getAccessor(i,r),this.mode=n,this.lookupFunctions=s}interpolate(){if(this.isBound){let e="",t=this.parts;for(let i=0,r=t.length;i=bindingMode.oneTime?i.attributes[t].defaultBindingMode:bindingMode.oneWay}bind(e,t,i,r,n){let s=r||BehaviorInstruction.attribute(i.attrName);return s.attributes[i.attrName]=new BindingExpression(this.observerLocator,this.attributeMap.map(t.tagName,i.attrName),this.parser.parse(i.attrValue),void 0===i.defaultBindingMode||null===i.defaultBindingMode?this.determineDefaultBindingMode(t,i.attrName,n):i.defaultBindingMode,e.lookupFunctions),s}trigger(e,t,i){return new ListenerExpression(this.eventManager,i.attrName,this.parser.parse(i.attrValue),delegationStrategy.none,!0,e.lookupFunctions)}capture(e,t,i){return new ListenerExpression(this.eventManager,i.attrName,this.parser.parse(i.attrValue),delegationStrategy.capturing,!0,e.lookupFunctions)}delegate(e,t,i){return new ListenerExpression(this.eventManager,i.attrName,this.parser.parse(i.attrValue),delegationStrategy.bubbling,!0,e.lookupFunctions)}call(e,t,i,r){let n=r||BehaviorInstruction.attribute(i.attrName);return n.attributes[i.attrName]=new CallExpression(this.observerLocator,i.attrName,this.parser.parse(i.attrValue),e.lookupFunctions),n}options(e,t,i,r,n){let s,o,a,l=r||BehaviorInstruction.attribute(i.attrName),c=i.attrValue,u=this.language,h=null,d="",p=!1,g=!1,m=!1;for(o=0,a=c.length;ot;++t)if(n=(i=l[t]).name,s=i.nodeValue,r=n.split("."),n!==c)if(2===r.length){if("bind"!==(o=r[1])){getLogger("templating-binding-language").warn(`Detected invalid let command. Expected "${r[0]}.bind", given "${n}"`);continue}a.push(new LetExpression(this.observerLocator,camelCase(r[0]),this.parser.parse(s),e.lookupFunctions,u))}else n=camelCase(n),null===(r=this.parseInterpolation(e,s))&&getLogger("templating-binding-language").warn(`Detected string literal in let bindings. Did you mean "${n}.bind=${s}" or "${n}=\${${s}}" ?`),r?a.push(new LetInterpolationBindingExpression(this.observerLocator,n,r,e.lookupFunctions,u)):a.push(new LetExpression(this.observerLocator,n,new LiteralString(s),e.lookupFunctions,u));return a}inspectTextContent(e,t){const i=this.parseInterpolation(e,t);return null===i?null:new InterpolationBindingExpression(this.observerLocator,"textContent",i,bindingMode.oneWay,e.lookupFunctions,"textContent")}parseInterpolation(e,t){let i,r,n,s=t.indexOf("${",0),o=t.length,a=0,l=0,c=null,u=0;for(;s>=0&&s0&&s{e.currentController=t,e.currentViewModel=t?t.viewModel:null})}else if(e.pendingTask=tryActivateViewModel$1(e.currentViewModel,t.model),!e.pendingTask)return;e.pendingTask=e.pendingTask.then(()=>{completeCompositionTask(e)},t=>{throw completeCompositionTask(e),t})}function completeCompositionTask(e){e.pendingTask=null,isEmpty(e.changes)||processChanges(e)}function requestUpdate(e){e.pendingTask||e.updateRequested||(e.updateRequested=!0,e.taskQueue.queueMicroTask(()=>{e.updateRequested=!1,processChanges(e)}))}let IfCore=class{constructor(e,t){this.viewFactory=e,this.viewSlot=t,this.view=null,this.bindingContext=null,this.overrideContext=null,this.showing=!1}bind(e,t){this.bindingContext=e,this.overrideContext=t}unbind(){null!==this.view&&(this.view.unbind(),this.viewFactory.isCaching&&(this.showing?(this.showing=!1,this.viewSlot.remove(this.view,!0,!0)):this.view.returnToCache(),this.view=null))}_show(){if(!this.showing)return null===this.view&&(this.view=this.viewFactory.create()),this.view.isBound||this.view.bind(this.bindingContext,this.overrideContext),this.showing=!0,this.viewSlot.add(this.view);this.view.isBound||this.view.bind(this.bindingContext,this.overrideContext)}_hide(){if(!this.showing)return;this.showing=!1;let e=this.viewSlot.remove(this.view);if(e instanceof Promise)return e.then(()=>this.view.unbind());this.view.unbind()}};var _dec$5,_dec2$4,_dec3$3,_class$5,_class2$5,_descriptor$1,_descriptor2$1;function _initDefineProp$1(e,t,i,r){i&&Object.defineProperty(e,t,{enumerable:i.enumerable,configurable:i.configurable,writable:i.writable,value:i.initializer?i.initializer.call(r):void 0})}function _applyDecoratedDescriptor$1(e,t,i,r,n){var s={};return Object.keys(r).forEach(function(e){s[e]=r[e]}),s.enumerable=!!s.enumerable,s.configurable=!!s.configurable,("value"in s||s.initializer)&&(s.writable=!0),s=i.slice().reverse().reduce(function(i,r){return r(e,t,i)||i},s),n&&void 0!==s.initializer&&(s.value=s.initializer?s.initializer.call(n):void 0,s.initializer=void 0),void 0===s.initializer&&(Object.defineProperty(e,t,s),s=null),s}let If=(_dec$5=customAttribute("if"),_dec2$4=inject(BoundViewFactory,ViewSlot),_dec3$3=bindable({primaryProperty:!0}),_dec$5(_class$5=templateController(_class$5=_dec2$4((_descriptor$1=_applyDecoratedDescriptor$1((_class2$5=class extends IfCore{constructor(...e){var t;return t=super(...e),_initDefineProp$1(this,"condition",_descriptor$1,this),_initDefineProp$1(this,"swapOrder",_descriptor2$1,this),t}bind(e,t){super.bind(e,t),this.condition?this._show():this._hide()}conditionChanged(e){this._update(e)}_update(e){if(this.animating)return;let t;(t=this.elseVm?e?this._swap(this.elseVm,this):this._swap(this,this.elseVm):e?this._show():this._hide())&&(this.animating=!0,t.then(()=>{this.animating=!1,this.condition!==this.showing&&this._update(this.condition)}))}_swap(e,t){switch(this.swapOrder){case"before":return Promise.resolve(t._show()).then(()=>e._hide());case"with":return Promise.all([e._hide(),t._show()]);default:let i=e._hide();return i?i.then(()=>t._show()):t._show()}}}).prototype,"condition",[_dec3$3],{enumerable:!0,initializer:null}),_descriptor2$1=_applyDecoratedDescriptor$1(_class2$5.prototype,"swapOrder",[bindable],{enumerable:!0,initializer:null}),_class$5=_class2$5))||_class$5)||_class$5)||_class$5);var _dec$6,_dec2$5,_class$6;let Else=(_dec$6=customAttribute("else"))(_class$6=templateController(_class$6=(_dec2$5=inject(BoundViewFactory,ViewSlot))(_class$6=class extends IfCore{constructor(e,t){super(e,t),this._registerInIf()}bind(e,t){super.bind(e,t),this.ifVm.condition?this._hide():this._show()}_registerInIf(){let e=this.viewSlot.anchor.previousSibling;for(;e&&!e.au;)e=e.previousSibling;if(!e||!e.au.if)throw new Error("Can't find matching If for Else custom attribute.");this.ifVm=e.au.if.viewModel,this.ifVm.elseVm=this}})||_class$6)||_class$6)||_class$6;var _dec$7,_dec2$6,_class$7;let With=(_dec$7=customAttribute("with"))(_class$7=templateController(_class$7=(_dec2$6=inject(BoundViewFactory,ViewSlot))(_class$7=class{constructor(e,t){this.viewFactory=e,this.viewSlot=t,this.parentOverrideContext=null,this.view=null}bind(e,t){this.parentOverrideContext=t,this.valueChanged(this.value)}valueChanged(e){let t=createOverrideContext(e,this.parentOverrideContext);this.view?this.view.bind(e,t):(this.view=this.viewFactory.create(),this.view.bind(e,t),this.viewSlot.add(this.view))}unbind(){this.parentOverrideContext=null,this.view&&this.view.unbind()}})||_class$7)||_class$7)||_class$7,NullRepeatStrategy=class{instanceChanged(e,t){e.removeAllViews(!0)}getCollectionObserver(e,t){}};const oneTime=bindingMode.oneTime;function updateOverrideContexts(e,t){let i=e.length;for(t>0&&(t-=1);te.originalAttrName===t)[0].attributes.items.sourceExpression}function unwrapExpression(e){let t=!1;for(;e instanceof BindingBehavior;)e=e.expression;for(;e instanceof ValueConverter;)e=e.expression,t=!0;return t?e:null}function isOneTime(e){for(;e instanceof BindingBehavior;){if("oneTime"===e.name)return!0;e=e.expression}return!1}function updateOneTimeBinding(e){e.call&&e.mode===oneTime?e.call(sourceContext):e.updateOneTimeBindings&&e.updateOneTimeBindings()}function indexOf(e,t,i,r){if(!i)return e.indexOf(t);const n=e.length;for(let s=r||0;s0?(h=e.removeViews(c,!0,!e.viewsRequireLifecycle),u=(()=>{for(let n=0;nthis._standardProcessInstanceChanged(e,t))),h instanceof Promise?h.then(u):u()}else this._inPlaceProcessItems(e,t);else this._standardProcessInstanceChanged(e,t)}_standardProcessInstanceChanged(e,t){for(let i=0,r=t.length;ii;)r--,e.removeView(r,!0,!e.viewsRequireLifecycle);let n=e.local;for(let s=0;s{if(!t.length)return e.__queuedSplices=void 0,void(e.__array=void 0);let r=this._runSplices(e,e.__array,t)||Promise.resolve();t=e.__queuedSplices=[],r.then(i)};r.then(i)}}_runSplices(e,t,i){let r=0,n=[];for(let t=0,s=i.length;t0)return Promise.all(n).then(()=>{let r=this._handleAddedSplices(e,t,i);updateOverrideContexts(e.views(),r)});let s=this._handleAddedSplices(e,t,i);updateOverrideContexts(e.views(),s)}_handleAddedSplices(e,t,i){let r,n,s=t.length;for(let o=0,a=i.length;oa.index)&&(n=r);lthis._standardProcessItems(e,t)):this._standardProcessItems(e,t)}_standardProcessItems(e,t){let i,r=0;t.forEach((n,s)=>{i=createFullOverrideContext(e,n,r,t.size,s),e.addView(i.bindingContext,i),++r})}instanceMutated(e,t,i){let r,n,s,o,a,l,c,u,h=[];for(n=0,s=i.length;n0?Promise.all(h).then(()=>{updateOverrideContexts(e.views(),0)}):updateOverrideContexts(e.views(),0)}_getViewIndexByKey(e,t){let i,r,n;for(i=0,r=e.viewCount();ithis._standardProcessItems(e,t)):this._standardProcessItems(e,t)}_standardProcessItems(e,t){let i,r=0;t.forEach(n=>{i=createFullOverrideContext(e,n,r,t.size),e.addView(i.bindingContext,i),++r})}instanceMutated(e,t,i){let r,n,s,o,a,l,c,u=[];for(n=0,s=i.length;n0?Promise.all(u).then(()=>{updateOverrideContexts(e.views(),0)}):updateOverrideContexts(e.views(),0)}_getViewIndexByValue(e,t){let i,r,n;for(i=0,r=e.viewCount();ithis._standardProcessItems(e,t)):this._standardProcessItems(e,t)}_standardProcessItems(e,t){let i,r,n,s,o=e.viewCount();if((s=o-(t=Math.floor(t)))>0)for(s>o&&(s=o),i=0,r=s;inull==e,new NullRepeatStrategy),this.addStrategy(e=>e instanceof Array,new ArrayRepeatStrategy),this.addStrategy(e=>e instanceof Map,new MapRepeatStrategy),this.addStrategy(e=>e instanceof Set,new SetRepeatStrategy),this.addStrategy(e=>"number"==typeof e,new NumberRepeatStrategy)}addStrategy(e,t){this.matchers.push(e),this.strategies.push(t)}getStrategy(e){let t=this.matchers;for(let i=0,r=t.length;i{this.ignoreMutation=!1})}_getInnerCollection(){let e=unwrapExpression(this.sourceExpression);return e?e.evaluate(this.scope,null):null}handleCollectionMutated(e,t){this.collectionObserver&&(this.ignoreMutation||this.strategy.instanceMutated(this,e,t))}handleInnerCollectionMutated(e,t){if(!this.collectionObserver)return;if(this.ignoreMutation)return;this.ignoreMutation=!0;let i=this.sourceExpression.evaluate(this.scope,this.lookupFunctions);this.observerLocator.taskQueue.queueMicroTask(()=>this.ignoreMutation=!1),i===this.items?this.itemsChanged():this.items=i}_observeInnerCollection(){let e=this._getInnerCollection(),t=this.strategyLocator.getStrategy(e);return!!t&&(this.collectionObserver=t.getCollectionObserver(this.observerLocator,e),!!this.collectionObserver&&(this.callContext="handleInnerCollectionMutated",this.collectionObserver.subscribe(this.callContext,this),!0))}_observeCollection(){let e=this.items;this.collectionObserver=this.strategy.getCollectionObserver(this.observerLocator,e),this.collectionObserver&&(this.callContext="handleCollectionMutated",this.collectionObserver.subscribe(this.callContext,this))}_captureAndRemoveMatcherBinding(){if(this.viewFactory.viewFactory){const e=this.viewFactory.viewFactory.instructions,t=Object.keys(e);for(let i=0;i)<[^<]*)*<\/script>/gi;let HTMLSanitizer=class{sanitize(e){return e.replace(SCRIPT_REGEX,"")}};var _dec$b,_dec2$8,_class$b;let SanitizeHTMLValueConverter=(_dec$b=valueConverter("sanitizeHTML"))(_class$b=(_dec2$8=inject(HTMLSanitizer))(_class$b=class{constructor(e){this.sanitizer=e}toView(e){return null==e?null:this.sanitizer.sanitize(e)}})||_class$b)||_class$b;var _dec$c,_dec2$9,_class$c;let Replaceable=(_dec$c=customAttribute("replaceable"))(_class$c=templateController(_class$c=(_dec2$9=inject(BoundViewFactory,ViewSlot))(_class$c=class{constructor(e,t){this.viewFactory=e,this.viewSlot=t,this.view=null}bind(e,t){null===this.view&&(this.view=this.viewFactory.create(),this.viewSlot.add(this.view)),this.view.bind(e,t)}unbind(){this.view.unbind()}})||_class$c)||_class$c)||_class$c;var _dec$d,_class$d;let Focus=(_dec$d=customAttribute("focus",bindingMode.twoWay))(_class$d=class{static inject(){return[DOM.Element,TaskQueue]}constructor(e,t){this.element=e,this.taskQueue=t,this.isAttached=!1,this.needsApply=!1}valueChanged(e){this.isAttached?this._apply():this.needsApply=!0}_apply(){this.value?this.taskQueue.queueMicroTask(()=>{this.value&&this.element.focus()}):this.element.blur()}attached(){this.isAttached=!0,this.needsApply&&(this.needsApply=!1,this._apply()),this.element.addEventListener("focus",this),this.element.addEventListener("blur",this)}detached(){this.isAttached=!1,this.element.removeEventListener("focus",this),this.element.removeEventListener("blur",this)}handleEvent(e){"focus"===e.type?this.value=!0:DOM.activeElement!==this.element&&(this.value=!1)}})||_class$d,cssUrlMatcher=/url\((?!['"]data)([^)]+)\)/gi;function fixupCSSUrls(e,t){if("string"!=typeof t)throw new Error(`Failed loading required CSS file: ${e}`);return t.replace(cssUrlMatcher,(t,i)=>{let r=i.charAt(0);return"'"!==r&&'"'!==r||(i=i.substr(1,i.length-2)),"url('"+relativeToFile(i,e)+"')"})}let CSSResource=class{constructor(e){this.address=e,this._scoped=null,this._global=!1,this._alreadyGloballyInjected=!1}initialize(e,t){this._scoped=new t(this)}register(e,t){"scoped"===t?e.registerViewEngineHooks(this._scoped):this._global=!0}load(e){return e.get(Loader).loadText(this.address).catch(e=>null).then(e=>{e=fixupCSSUrls(this.address,e),this._scoped.css=e,this._global&&(this._alreadyGloballyInjected=!0,DOM.injectStyles(e))})}},CSSViewEngineHooks=class{constructor(e){this.owner=e,this.css=null}beforeCompile(e,t,i){if(i.targetShadowDOM)DOM.injectStyles(this.css,e,!0);else if(FEATURE.scopedCSS){DOM.injectStyles(this.css,e,!0).setAttribute("scoped","scoped")}else this._global&&!this.owner._alreadyGloballyInjected&&(DOM.injectStyles(this.css),this.owner._alreadyGloballyInjected=!0)}};function _createCSSResource(e){var t;return resource(new CSSResource(e))(t=class extends CSSViewEngineHooks{})||t}var _dec$e,_class$e;let AttrBindingBehavior=(_dec$e=bindingBehavior("attr"))(_class$e=class{bind(e,t){e.targetObserver=new DataAttributeObserver(e.target,e.targetProperty)}unbind(e,t){}})||_class$e;var _dec$f,_dec2$a,_class$f,_dec3$4,_dec4$3,_class2$7,_dec5$3,_dec6$3,_class3$4,_dec7$3,_dec8$2,_class4$3,_dec9$2,_dec10$2,_class5$4;let modeBindingBehavior={bind(e,t,i){e.originalMode=e.mode,e.mode=this.mode},unbind(e,t){e.mode=e.originalMode,e.originalMode=null}},OneTimeBindingBehavior=(_dec$f=mixin(modeBindingBehavior))(_class$f=(_dec2$a=bindingBehavior("oneTime"))(_class$f=class{constructor(){this.mode=bindingMode.oneTime}})||_class$f)||_class$f,OneWayBindingBehavior=(_dec3$4=mixin(modeBindingBehavior))(_class2$7=(_dec4$3=bindingBehavior("oneWay"))(_class2$7=class{constructor(){this.mode=bindingMode.toView}})||_class2$7)||_class2$7,ToViewBindingBehavior=(_dec5$3=mixin(modeBindingBehavior))(_class3$4=(_dec6$3=bindingBehavior("toView"))(_class3$4=class{constructor(){this.mode=bindingMode.toView}})||_class3$4)||_class3$4,FromViewBindingBehavior=(_dec7$3=mixin(modeBindingBehavior))(_class4$3=(_dec8$2=bindingBehavior("fromView"))(_class4$3=class{constructor(){this.mode=bindingMode.fromView}})||_class4$3)||_class4$3,TwoWayBindingBehavior=(_dec9$2=mixin(modeBindingBehavior))(_class5$4=(_dec10$2=bindingBehavior("twoWay"))(_class5$4=class{constructor(){this.mode=bindingMode.twoWay}})||_class5$4)||_class5$4;var _dec$g,_class$g;function throttle(e){let t=this.throttleState,i=+new Date-t.last;if(i>=t.delay)return clearTimeout(t.timeoutId),t.timeoutId=null,t.last=+new Date,void this.throttledMethod(e);t.newValue=e,null===t.timeoutId&&(t.timeoutId=setTimeout(()=>{t.timeoutId=null,t.last=+new Date,this.throttledMethod(t.newValue)},t.delay-i))}let ThrottleBindingBehavior=(_dec$g=bindingBehavior("throttle"))(_class$g=class{bind(e,t,i=200){let r="updateTarget";e.callSource?r="callSource":e.updateSource&&e.mode===bindingMode.twoWay&&(r="updateSource"),e.throttledMethod=e[r],e.throttledMethod.originalName=r,e[r]=throttle,e.throttleState={delay:i,last:0,timeoutId:null}}unbind(e,t){e[e.throttledMethod.originalName]=e.throttledMethod,e.throttledMethod=null,clearTimeout(e.throttleState.timeoutId),e.throttleState=null}})||_class$g;var _dec$h,_class$h;const unset={};function debounceCallSource(e){const t=this.debounceState;clearTimeout(t.timeoutId),t.timeoutId=setTimeout(()=>this.debouncedMethod(e),t.delay)}function debounceCall(e,t,i){const r=this.debounceState;if(clearTimeout(r.timeoutId),e!==r.callContextToDebounce)return r.oldValue=unset,void this.debouncedMethod(e,t,i);r.oldValue===unset&&(r.oldValue=i),r.timeoutId=setTimeout(()=>{const i=r.oldValue;r.oldValue=unset,this.debouncedMethod(e,t,i)},r.delay)}let DebounceBindingBehavior=(_dec$h=bindingBehavior("debounce"))(_class$h=class{bind(e,t,i=200){const r=void 0!==e.callSource,n=r?"callSource":"call",s=r?debounceCallSource:debounceCall,o=e.mode,a=o===bindingMode.twoWay||o===bindingMode.fromView?targetContext:sourceContext;e.debouncedMethod=e[n],e.debouncedMethod.originalName=n,e[n]=s,e.debounceState={callContextToDebounce:a,delay:i,timeoutId:0,oldValue:unset}}unbind(e,t){e[e.debouncedMethod.originalName]=e.debouncedMethod,e.debouncedMethod=null,clearTimeout(e.debounceState.timeoutId),e.debounceState=null}})||_class$h;var _dec$i,_class$i;function findOriginalEventTarget$1(e){return e.path&&e.path[0]||e.deepPath&&e.deepPath[0]||e.target}function handleSelfEvent(e){let t=findOriginalEventTarget$1(e);this.target===t&&this.selfEventCallSource(e)}let SelfBindingBehavior=(_dec$i=bindingBehavior("self"))(_class$i=class{bind(e,t){if(!e.callSource||!e.targetEvent)throw new Error("Self binding behavior only supports event.");e.selfEventCallSource=e.callSource,e.callSource=handleSelfEvent}unbind(e,t){e.callSource=e.selfEventCallSource,e.selfEventCallSource=null}})||_class$i,BindingSignaler=class{constructor(){this.signals={}}signal(e){let t=this.signals[e];if(!t)return;let i=t.length;for(;i--;)t[i].call(sourceContext)}};var _dec$j,_class$j;let SignalBindingBehavior=(_dec$j=bindingBehavior("signal"))(_class$j=class{static inject(){return[BindingSignaler]}constructor(e){this.signals=e.signals}bind(e,t){if(!e.updateTarget)throw new Error("Only property bindings and string interpolation bindings can be signaled. Trigger, delegate and call bindings cannot be signaled.");if(3===arguments.length){let t=arguments[2];(this.signals[t]||(this.signals[t]=[])).push(e),e.signalName=t}else{if(!(arguments.length>3))throw new Error("Signal name is required.");{let t=Array.prototype.slice.call(arguments,2),i=t.length;for(;i--;){let r=t[i];(this.signals[r]||(this.signals[r]=[])).push(e)}e.signalName=t}}}unbind(e,t){let i=e.signalName;if(e.signalName=null,Array.isArray(i)){let t=i,r=t.length;for(;r--;){let i=t[r],n=this.signals[i];n.splice(n.indexOf(e),1)}}else{let t=this.signals[i];t.splice(t.indexOf(e),1)}}})||_class$j;var _dec$k,_class$k;const eventNamesRequired="The updateTrigger binding behavior requires at least one event name argument: eg ",notApplicableMessage="The updateTrigger binding behavior can only be applied to two-way/ from-view bindings on input/select elements.";let UpdateTriggerBindingBehavior=(_dec$k=bindingBehavior("updateTrigger"))(_class$k=class{bind(e,t,...i){if(0===i.length)throw new Error(eventNamesRequired);if(e.mode!==bindingMode.twoWay&&e.mode!==bindingMode.fromView)throw new Error(notApplicableMessage);let r=e.observerLocator.getObserver(e.target,e.targetProperty);if(!r.handler)throw new Error(notApplicableMessage);e.targetObserver=r,r.originalHandler=e.targetObserver.handler;let n=new EventSubscriber(i);r.handler=n}unbind(e,t){e.targetObserver.handler.dispose(),e.targetObserver.handler=e.targetObserver.originalHandler,e.targetObserver.originalHandler=null}})||_class$k;function _createDynamicElement(e,t,i){var r;let n=customElement(e)(r=useView(t)(r=class{bind(e){this.$parent=e}})||r)||r;for(let e=0,t=i.length;e{let i=t.template.getAttribute("bindable"),r=getElementName(e);return i?(i=i.split(",").map(e=>e.trim()),t.template.removeAttribute("bindable")):i=[],{[r]:_createDynamicElement(r,e,i)}})}})}function configure$2(e){injectAureliaHideStyleAtHead(),e.globalResources(Compose,If,Else,With,Repeat,Show,Hide,Replaceable,Focus,SanitizeHTMLValueConverter,OneTimeBindingBehavior,OneWayBindingBehavior,ToViewBindingBehavior,FromViewBindingBehavior,TwoWayBindingBehavior,ThrottleBindingBehavior,DebounceBindingBehavior,SelfBindingBehavior,SignalBindingBehavior,UpdateTriggerBindingBehavior,AttrBindingBehavior),configure$1(e);let t=e.container.get(ViewEngine),i={fetch:e=>({[e]:_createCSSResource(e)})};[".css",".less",".sass",".scss",".styl"].forEach(e=>t.addResourcePlugin(e,i))}const logger$3=getLogger("event-aggregator");let Handler=class{constructor(e,t){this.messageType=e,this.callback=t}handle(e){e instanceof this.messageType&&this.callback.call(null,e)}};function invokeCallback(e,t,i){try{e(t,i)}catch(e){logger$3.error(e)}}function invokeHandler(e,t){try{e.handle(t)}catch(e){logger$3.error(e)}}let EventAggregator=class{constructor(){this.eventLookup={},this.messageHandlers=[]}publish(e,t){let i,r;if(!e)throw new Error("Event was invalid.");if("string"==typeof e){if(i=this.eventLookup[e])for(r=(i=i.slice()).length;r--;)invokeCallback(i[r],t,e)}else for(r=(i=this.messageHandlers.slice()).length;r--;)invokeHandler(i[r],e)}subscribe(e,t){let i,r;if(!e)throw new Error("Event channel/type was invalid.");return"string"==typeof e?(i=t,r=this.eventLookup[e]||(this.eventLookup[e]=[])):(i=new Handler(e,t),r=this.messageHandlers),r.push(i),{dispose(){let e=r.indexOf(i);-1!==e&&r.splice(e,1)}}}subscribeOnce(e,t){let i=this.subscribe(e,(e,r)=>(i.dispose(),t(e,r)));return i}};function includeEventsIn(e){let t=new EventAggregator;return e.subscribeOnce=function(e,i){return t.subscribeOnce(e,i)},e.subscribe=function(e,i){return t.subscribe(e,i)},e.publish=function(e,i){t.publish(e,i)},t}function configure$3(e){e.instance(EventAggregator,includeEventsIn(e.aurelia))}function mi$1(e){throw new Error("History must implement "+e+"().")}var History=function(){function e(){}return e.prototype.activate=function(e){mi$1("activate")},e.prototype.deactivate=function(){mi$1("deactivate")},e.prototype.getAbsoluteRoot=function(){mi$1("getAbsoluteRoot")},e.prototype.navigate=function(e,t){mi$1("navigate")},e.prototype.navigateBack=function(){mi$1("navigateBack")},e.prototype.setTitle=function(e){mi$1("setTitle")},e.prototype.setState=function(e,t){mi$1("setState")},e.prototype.getState=function(e){mi$1("getState")},e.prototype.getHistoryIndex=function(){mi$1("getHistoryIndex")},e.prototype.go=function(e){mi$1("go")},e}(),extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function __extends(e,t){function i(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var LinkHandler=function(){function e(){}return e.prototype.activate=function(e){},e.prototype.deactivate=function(){},e}(),DefaultLinkHandler=function(e){function t(){var i=e.call(this)||this;return i.handler=function(e){var r=t.getEventInfo(e),n=r.shouldHandleEvent,s=r.href;n&&(e.preventDefault(),i.history.navigate(s))},i}return __extends(t,e),t.prototype.activate=function(e){e._hasPushState&&(this.history=e,DOM.addEventListener("click",this.handler,!0))},t.prototype.deactivate=function(){DOM.removeEventListener("click",this.handler,!0)},t.getEventInfo=function(e){var i=e,r={shouldHandleEvent:!1,href:null,anchor:null},n=t.findClosestAnchor(i.target);if(!n||!t.targetIsThisWindow(n))return r;if(hasAttribute$1(n,"download")||hasAttribute$1(n,"router-ignore")||hasAttribute$1(n,"data-router-ignore"))return r;if(i.altKey||i.ctrlKey||i.metaKey||i.shiftKey)return r;var s=n.getAttribute("href");r.anchor=n,r.href=s;var o=1===i.which,a=s&&!("#"===s.charAt(0)||/^[a-z]+:/i.test(s));return r.shouldHandleEvent=o&&a,r},t.findClosestAnchor=function(e){for(;e;){if("A"===e.tagName)return e;e=e.parentNode}},t.targetIsThisWindow=function(e){var t=e.getAttribute("target"),i=PLATFORM.global;return!t||t===i.name||"_self"===t},t}(LinkHandler),hasAttribute$1=function(e,t){return e.hasAttribute(t)},BrowserHistory=function(e){function t(t){var i=e.call(this)||this;return i._isActive=!1,i._checkUrlCallback=i._checkUrl.bind(i),i.location=PLATFORM.location,i.history=PLATFORM.history,i.linkHandler=t,i}return __extends(t,e),t.prototype.activate=function(e){if(this._isActive)throw new Error("History has already been activated.");var t=this.history,i=!!e.pushState;this._isActive=!0;var r,n=this.options=Object.assign({},{root:"/"},this.options,e),s=this.root=("/"+n.root+"/").replace(rootStripper,"/"),o=this._wantsHashChange=!1!==n.hashChange,a=this._hasPushState=!!(n.pushState&&t&&t.pushState);if(a?r="popstate":o&&(r="hashchange"),PLATFORM.addEventListener(r,this._checkUrlCallback),o&&i){var l=this.location,c=l.pathname.replace(/[^\/]$/,"$&/")===s;if(!a&&!c){var u=this.fragment=this._getFragment(null,!0);return l.replace(s+l.search+"#"+u),!0}if(a&&c&&l.hash){u=this.fragment=this._getHash().replace(routeStripper,"");t.replaceState({},DOM.title,s+u+l.search)}}if(this.fragment||(this.fragment=this._getFragment("")),this.linkHandler.activate(this),!n.silent)return this._loadUrl("")},t.prototype.deactivate=function(){var e=this._checkUrlCallback;PLATFORM.removeEventListener("popstate",e),PLATFORM.removeEventListener("hashchange",e),this._isActive=!1,this.linkHandler.deactivate()},t.prototype.getAbsoluteRoot=function(){var e=this.location;return""+createOrigin(e.protocol,e.hostname,e.port)+this.root},t.prototype.navigate=function(e,t){var i=void 0===t?{}:t,r=i.trigger,n=void 0===r||r,s=i.replace,o=void 0!==s&&s,a=this.location;if(e&&absoluteUrl.test(e))return a.href=e,!0;if(!this._isActive)return!1;if(e=this._getFragment(e||""),this.fragment===e&&!o)return!1;this.fragment=e;var l=this.root+e;return""===e&&"/"!==l&&(l=l.slice(0,-1)),this._hasPushState?(l=l.replace("//","/"),this.history[o?"replaceState":"pushState"]({},DOM.title,l)):this._wantsHashChange?updateHash(a,e,o):a.assign(l),!n||this._loadUrl(e)},t.prototype.navigateBack=function(){this.history.back()},t.prototype.setTitle=function(e){DOM.title=e},t.prototype.setState=function(e,t){var i=this.history,r=Object.assign({},i.state),n=this.location,s=n.pathname,o=n.search,a=n.hash;r[e]=t,i.replaceState(r,null,""+s+o+a)},t.prototype.getState=function(e){return Object.assign({},this.history.state)[e]},t.prototype.getHistoryIndex=function(){var e=this.getState("HistoryIndex");return void 0===e&&(e=this.history.length-1,this.setState("HistoryIndex",e)),e},t.prototype.go=function(e){this.history.go(e)},t.prototype._getHash=function(){return this.location.hash.substr(1)},t.prototype._getFragment=function(e,t){var i;if(!e)if(this._hasPushState||!this._wantsHashChange||t){var r=this.location;e=r.pathname+r.search,i=this.root.replace(trailingSlash,""),e.indexOf(i)||(e=e.substr(i.length))}else e=this._getHash();return"/"+e.replace(routeStripper,"")},t.prototype._checkUrl=function(){this._getFragment("")!==this.fragment&&this._loadUrl("")},t.prototype._loadUrl=function(e){var t=this.fragment=this._getFragment(e);return!!this.options.routeHandler&&this.options.routeHandler(t)},t.inject=[LinkHandler],t}(History),routeStripper=/^#?\/*|\s+$/g,rootStripper=/^\/+|\/+$/g,trailingSlash=/\/$/,absoluteUrl=/^([a-z][a-z0-9+\-.]*:)?\/\//i;function updateHash(e,t,i){if(i){var r=e.href.replace(/(javascript:|#).*$/,"");e.replace(r+"#"+t)}else e.hash="#"+t}function createOrigin(e,t,i){return e+"//"+t+(i?":"+i:"")}function configure$4(e){var t=e;t.singleton(History,BrowserHistory),t.transient(LinkHandler,DefaultLinkHandler)}let State=class e{constructor(e){this.charSpec=e,this.nextStates=[]}get(e){for(let t of this.nextStates){if(t.charSpec.validChars===e.validChars&&t.charSpec.invalidChars===e.invalidChars)return t}}put(t){let i=this.get(t);return i||(i=new e(t),this.nextStates.push(i),t.repeat&&i.nextStates.push(i),i)}match(e){let t=this.nextStates,i=[];for(let r=0,n=t.length;rthis.add(e));let t=this.rootState,i=[],r="^",n={statics:0,dynamics:0,stars:0},s=[],o=e.handler.name,a=!0,l=parse(e.path,s,n,e.caseSensitive);for(let e=0,n=l.length;e1&&"/"===n.charAt(o-1)&&(n=n.substr(0,o-1),r=!0);for(let e=0,i=n.length;e{if(e.types.stars!==t.types.stars)return e.types.stars-t.types.stars;if(e.types.stars){if(e.types.statics!==t.types.statics)return t.types.statics-e.types.statics;if(e.types.dynamics!==t.types.dynamics)return t.types.dynamics-e.types.dynamics}return e.types.dynamics!==t.types.dynamics?e.types.dynamics-t.types.dynamics:e.types.statics!==t.types.statics?t.types.statics-e.types.statics:0})}function recognizeChar(e,t){let i=[];for(let r=0,n=e.length;r{r=r.put(e)}),[i,r]}class NavigationInstruction{constructor(e){this.plan=null,this.options={},Object.assign(this,e),this.params=this.params||{},this.viewPortInstructions={};let t=[],i=this;do{let e=Object.assign({},i.params);i.config&&i.config.hasChildRouter&&delete e[i.getWildCardName()],t.unshift(e),i=i.parentInstruction}while(i);let r=Object.assign({},this.queryParams,...t);this.lifecycleArgs=[r,this.config,this]}getAllInstructions(){let e=[this],t=this.viewPortInstructions;for(let i in t){let r=t[i].childNavigationInstruction;r&&e.push(...r.getAllInstructions())}return e}getAllPreviousInstructions(){return this.getAllInstructions().map(e=>e.previousInstruction).filter(e=>e)}addViewPortInstruction(e,t,i,r){let n,s="string"==typeof e?e:e.name;const o=this.lifecycleArgs,a=Object.assign({},o[1],{currentViewPort:s});return n="string"==typeof e?{name:e,strategy:t,moduleId:i,component:r,childRouter:r.childRouter,lifecycleArgs:[o[0],a,o[2]]}:{name:s,strategy:e.strategy,component:e.component,moduleId:e.moduleId,childRouter:e.component.childRouter,lifecycleArgs:[o[0],a,o[2]]},this.viewPortInstructions[s]=n}getWildCardName(){let e=this.config.route,t=e.lastIndexOf("*");return e.substr(t+1)}getWildcardPath(){let e=this.getWildCardName(),t=this.params[e]||"",i=this.queryString;return i&&(t+="?"+i),t}getBaseUrl(){let e=encodeURI,t=decodeURI(this.fragment);if(""===t){let e=this.router.routes.find(e=>e.name===this.config.name&&""!==e.route);e&&(t=e.route)}if(!this.params)return e(t);let i=this.getWildCardName(),r=this.params[i]||"";return e(r?t.substr(0,t.lastIndexOf(r)):t)}_commitChanges(e){let t=this.router;t.currentInstruction=this;const i=this.previousInstruction;i&&(i.config.navModel.isActive=!1),this.config.navModel.isActive=!0,t.refreshNavigation();let r=[],n=[],s=this.viewPortInstructions;for(let i in s){let o=s[i],a=t.viewPorts[i];if(!a)throw new Error(`There was no router-view found in the view for ${o.moduleId}.`);let l=o.childNavigationInstruction;"replace"===o.strategy?l&&l.parentCatchHandler?r.push(l._commitChanges(e)):(e&&n.push({viewPort:a,viewPortInstruction:o}),r.push(a.process(o,e).then(()=>l?l._commitChanges(e):Promise.resolve()))):l&&r.push(l._commitChanges(e))}return Promise.all(r).then(()=>(n.forEach(e=>e.viewPort.swap(e.viewPortInstruction)),null)).then(()=>prune(this))}_updateTitle(){let e=this.router,t=this._buildTitle(e.titleSeparator);t&&e.history.setTitle(t)}_buildTitle(e=" | "){let t="",i=[],r=this.config.navModel.title,n=this.router,s=this.viewPortInstructions;r&&(t=n.transformTitle(r));for(let t in s){let r=s[t].childNavigationInstruction;if(r){let t=r._buildTitle(e);t&&i.push(t)}}return i.length&&(t=i.join(e)+(t?e:"")+t),n.title&&(t+=(t?e:"")+n.transformTitle(n.title)),t}}const prune=e=>{e.previousInstruction=null,e.plan=null};class NavModel{constructor(e,t){this.isActive=!1,this.title=null,this.href=null,this.relativeHref=null,this.settings={},this.config=null,this.router=e,this.relativeHref=t}setTitle(e){this.title=e,this.isActive&&this.router.updateTitle()}}function _normalizeAbsolutePath(e,t,i=!1){return t||"#"===e[0]||(e="#"+e),t&&i&&(e=e.substring(1,e.length)),e}function _createRootedPath(e,t,i,r){if(isAbsoluteUrl.test(e))return e;let n="";return t.length&&"/"!==t[0]&&(n+="/"),(n+=t).length&&"/"===n[n.length-1]||"/"===e[0]||(n+="/"),n.length&&"/"===n[n.length-1]&&"/"===e[0]&&(n=n.substring(0,n.length-1)),_normalizeAbsolutePath(n+e,i,r)}function _resolveUrl(e,t,i){return isRootedPath.test(e)?_normalizeAbsolutePath(e,i):_createRootedPath(e,t,i)}function _ensureArrayWithSingleRoutePerConfig(e){let t=[];if(Array.isArray(e.route))for(let i=0,r=e.route.length;ithis.map(e)),this):this.mapRoute(e)}useViewPortDefaults(e){return this.viewPortDefaults=e,this}mapRoute(e){return this.instructions.push(t=>{let i,r=_ensureArrayWithSingleRoutePerConfig(e);for(let e=0,n=r.length;ethis.parent?this.parent.transformTitle(e):e),this.container=e,this.history=t,this.reset()}reset(){this.viewPorts={},this.routes=[],this.baseUrl="",this.isConfigured=!1,this.isNavigating=!1,this.isExplicitNavigation=!1,this.isExplicitNavigationBack=!1,this.isNavigatingFirst=!1,this.isNavigatingNew=!1,this.isNavigatingRefresh=!1,this.isNavigatingForward=!1,this.isNavigatingBack=!1,this.couldDeactivate=!1,this.navigation=[],this.currentInstruction=null,this.viewPortDefaults={},this._fallbackOrder=100,this._recognizer=new RouteRecognizer,this._childRecognizer=new RouteRecognizer,this._configuredPromise=new Promise(e=>{this._resolveConfiguredPromise=e})}get isRoot(){return!this.parent}registerViewPort(e,t){t=t||"default",this.viewPorts[t]=e}ensureConfigured(){return this._configuredPromise}configure(e){this.isConfigured=!0;let t,i=e;return"function"==typeof e&&(i=e(t=new RouterConfiguration)),Promise.resolve(i).then(e=>{e&&e.exportToRouter&&(t=e),t.exportToRouter(this),this.isConfigured=!0,this._resolveConfiguredPromise()})}navigate(e,t){return!this.isConfigured&&this.parent?this.parent.navigate(e,t):(this.isExplicitNavigation=!0,this.history.navigate(_resolveUrl(e,this.baseUrl,this.history._hasPushState),t))}navigateToRoute(e,t,i){let r=this.generate(e,t);return this.navigate(r,i)}navigateBack(){this.isExplicitNavigationBack=!0,this.history.navigateBack()}createChild(e){let t=new Router(e||this.container.createChild(),this.history);return t.parent=this,t}generate(e,t={},i={}){let r="childRoute"in t?this._childRecognizer:this._recognizer;if(!r.hasRoute(e)){if(this.parent)return this.parent.generate(e,t,i);throw new Error(`A route with name '${e}' could not be found. Check that \`name: '${e}'\` was specified in the route's config.`)}let n=_createRootedPath(r.generate(e,t),this.baseUrl,this.history._hasPushState,i.absolute);return i.absolute?`${this.history.getAbsoluteRoot()}${n}`:n}createNavModel(e){let t=new NavModel(this,"href"in e?e.href:e.route);return t.title=e.title,t.order=e.nav,t.href=e.href,t.settings=e.settings,t.config=e,t}addRoute(e,t){if(Array.isArray(e.route)){return void _ensureArrayWithSingleRoutePerConfig(e).forEach(this.addRoute.bind(this))}validateRouteConfig(e),"viewPorts"in e||e.navigationStrategy||(e.viewPorts={default:{moduleId:e.moduleId,view:e.view}}),t||(t=this.createNavModel(e)),this.routes.push(e);let i=e.route;"/"===i.charAt(0)&&(i=i.substr(1));let r=!0===e.caseSensitive,n=this._recognizer.add({path:i,handler:e,caseSensitive:r});if(i){let n=e.settings;delete e.settings;let s=JSON.parse(JSON.stringify(e));e.settings=n,s.route=`${i}/*childRoute`,s.hasChildRouter=!0,this._childRecognizer.add({path:s.route,handler:s,caseSensitive:r}),s.navModel=t,s.settings=e.settings,s.navigationStrategy=e.navigationStrategy}e.navModel=t;let s=this.navigation;if((t.order||0===t.order)&&-1===s.indexOf(t)){if(!t.href&&""!==t.href&&(n.types.dynamics||n.types.stars))throw new Error('Invalid route config for "'+e.route+'" : dynamic routes must specify an "href:" to be included in the navigation model.');"number"!=typeof t.order&&(t.order=++this._fallbackOrder),s.push(t),s.sort((e,t)=>e.order-t.order)}}hasRoute(e){return!!(this._recognizer.hasRoute(e)||this.parent&&this.parent.hasRoute(e))}hasOwnRoute(e){return this._recognizer.hasRoute(e)}handleUnknownRoutes(e){if(!e)throw new Error("Invalid unknown route handler");this.catchAllHandler=(t=>this._createRouteConfig(e,t).then(e=>(t.config=e,t)))}updateTitle(){let e=this.parent;if(e)return e.updateTitle();let t=this.currentInstruction;t&&t._updateTitle()}refreshNavigation(){let e=this.navigation;for(let t=0,i=e.length;t"string"==typeof e?{moduleId:e}:"function"==typeof e?e(t):e).then(e=>"string"==typeof e?{moduleId:e}:e).then(e=>(e.route=t.params.path,validateRouteConfig(e),e.navModel||(e.navModel=this.createNavModel(e)),e))}}const generateBaseUrl=(e,t)=>`${e.baseUrl||""}${t.getBaseUrl()||""}`,validateRouteConfig=e=>{if("object"!=typeof e)throw new Error("Invalid Route Config");if("string"!=typeof e.route){let t=e.name||"(no name)";throw new Error('Invalid Route Config for "'+t+'": You must specify a "route:" pattern.')}if(!("redirect"in e||e.moduleId||e.navigationStrategy||e.viewPorts))throw new Error('Invalid Route Config for "'+e.route+'": You must specify a "moduleId:", "redirect:", "navigationStrategy:", or "viewPorts:".')},evaluateNavigationStrategy=(e,t,i)=>Promise.resolve(t.call(i,e)).then(()=>("viewPorts"in e.config||(e.config.viewPorts={default:{moduleId:e.config.moduleId}}),e)),createNextFn=(e,t)=>{let i=-1;const r=function(){if(!(++ie=>Promise.resolve({status:t,output:e,completed:"completed"===t});class Pipeline{constructor(){this.steps=[]}addStep(e){let t;if("function"==typeof e)t=e;else{if("function"==typeof e.getSteps){let t=e.getSteps();for(let e=0,i=t.length;e{const t=e.config,i=e.router;return i._createNavigationInstruction(t.redirect).then(t=>{const r={},n=e.params,s=t.params;for(let e in s){let t=s[e];"string"==typeof t&&":"===t[0]?(t=t.slice(1))in n&&(r[e]=n[t]):r[e]=s[e]}let o=i.generate(t.config,r,e.options);for(let e in n)o=o.replace(`:${e}`,n[e]);let a=e.queryString;return a&&(o+="?"+a),Promise.resolve(new Redirect(o))})},buildTransitionPlans=(e,t,i,r)=>{let n={},s=e.config,o=hasDifferentParameterValues(t,e),a=[],l=t.viewPortInstructions;for(let t in l){const c=l[t],u=c.component,h=s.viewPorts;let d=t in h?h[t]:c;null===d.moduleId&&t in i&&(d=i[t]);const p=determineActivationStrategy(e,c,d,o,r),g=n[t]={name:t,config:d,prevComponent:u,prevModuleId:c.moduleId,strategy:p};if("replace"!==p&&c.childRouter){const t=e.getWildcardPath(),i=c.childRouter._createNavigationInstruction(t,e).then(e=>(g.childNavigationInstruction=e,_buildNavigationPlan(e,"invoke-lifecycle"===g.strategy).then(t=>t instanceof Redirect?Promise.reject(t):(e.plan=t,null))));a.push(i)}}return Promise.all(a).then(()=>n)},determineActivationStrategy=(e,t,i,r,n)=>{let s,o=e.config,a=t.component.viewModel;return s=t.moduleId!==i.moduleId?"replace":"determineActivationStrategy"in a?a.determineActivationStrategy(...e.lifecycleArgs):o.activationStrategy?o.activationStrategy:r||n?"invoke-lifecycle":"no-change"},hasDifferentParameterValues=(e,t)=>{let i=e.params,r=t.params,n=t.config.hasChildRouter?t.getWildCardName():null;for(let e in r)if(e!==n&&i[e]!==r[e])return!0;for(let e in i)if(e!==n&&i[e]!==r[e])return!0;if(!t.options.compareQueryParams)return!1;let s=e.queryParams,o=t.queryParams;for(let e in o)if(s[e]!==o[e])return!0;for(let e in s)if(s[e]!==o[e])return!0;return!1};class BuildNavigationPlanStep{run(e,t){return _buildNavigationPlan(e).then(i=>i instanceof Redirect?t.cancel(i):(e.plan=i,t())).catch(t.cancel)}}const loadNewRoute=(e,t)=>{let i=determineLoadingPlans(t).map(t=>loadRoute(e,t.navigationInstruction,t.viewPortPlan));return Promise.all(i)},determineLoadingPlans=(e,t=[])=>{let i=e.plan;for(let r in i){let n=i[r],s=n.childNavigationInstruction;if("replace"===n.strategy)t.push({viewPortPlan:n,navigationInstruction:e}),s&&determineLoadingPlans(s,t);else{let i=e.addViewPortInstruction({name:r,strategy:n.strategy,moduleId:n.prevModuleId,component:n.prevComponent});s&&(i.childNavigationInstruction=s,determineLoadingPlans(s,t))}}return t},loadRoute=(e,t,i)=>{let r=i.config,n=r?r.moduleId:null;return loadComponent(e,t,r).then(r=>{let s=t.addViewPortInstruction({name:i.name,strategy:i.strategy,moduleId:n,component:r}),o=r.childRouter;if(o){let r=t.getWildcardPath();return o._createNavigationInstruction(r,t).then(t=>(i.childNavigationInstruction=t,_buildNavigationPlan(t).then(i=>i instanceof Redirect?Promise.reject(i):(t.plan=i,s.childNavigationInstruction=t,loadNewRoute(e,t)))))}})},loadComponent=(e,t,i)=>{let r=t.router,n=t.lifecycleArgs;return Promise.resolve().then(()=>e.loadRoute(r,i,t)).then(e=>{let{viewModel:t,childContainer:s}=e;if(e.router=r,e.config=i,"configureRouter"in t){let i=s.getChildRouter();return e.childRouter=i,i.configure(e=>t.configureRouter(e,i,n[0],n[1],n[2])).then(()=>e)}return e})};class RouteLoader{loadRoute(e,t,i){throw new Error('Route loaders must implement "loadRoute(router, config, navigationInstruction)".')}}class LoadRouteStep{static inject(){return[RouteLoader]}constructor(e){this.routeLoader=e}run(e,t){return loadNewRoute(this.routeLoader,e).then(t,t.cancel)}}class CommitChangesStep{run(e,t){return e._commitChanges(!0).then(()=>(e._updateTitle(),t()))}}var InternalActivationStrategy;!function(e){e.NoChange="no-change",e.InvokeLifecycle="invoke-lifecycle",e.Replace="replace"}(InternalActivationStrategy||(InternalActivationStrategy={}));const activationStrategy={noChange:"no-change",invokeLifecycle:"invoke-lifecycle",replace:"replace"},processDeactivatable=(e,t,i,r)=>{let n=e.plan,s=findDeactivatable(n,t),o=s.length;function a(e){return r||shouldContinue(e)?l():i.cancel(e)}function l(){if(o--)try{let r=s[o][t](e);return processPotential(r,a,i.cancel)}catch(e){return i.cancel(e)}return e.router.couldDeactivate=!0,i()}return l()},findDeactivatable=(e,t,i=[])=>{for(let r in e){let n=e[r],s=n.prevComponent;if((n.strategy===activationStrategy.invokeLifecycle||n.strategy===activationStrategy.replace)&&s){let e=s.viewModel;t in e&&i.push(e)}n.strategy===activationStrategy.replace&&s?addPreviousDeactivatable(s,t,i):n.childNavigationInstruction&&findDeactivatable(n.childNavigationInstruction.plan,t,i)}return i},addPreviousDeactivatable=(e,t,i)=>{let r=e.childRouter;if(r&&r.currentInstruction){let e=r.currentInstruction.viewPortInstructions;for(let r in e){let n=e[r].component,s=n.viewModel;t in s&&i.push(s),addPreviousDeactivatable(n,t,i)}}},processActivatable=(e,t,i,r)=>{let n=findActivatable(e,t),s=n.length,o=-1;function a(){if(++o(function(e,t){return r||shouldContinue(e,t)?a():i.cancel(e)})(t,e.router),i.cancel)}catch(e){return i.cancel(e)}return i()}return a()},findActivatable=(e,t,i=[],r)=>{let n=e.plan;return Object.keys(n).forEach(s=>{let o=n[s],a=e.viewPortInstructions[s],l=a.component,c=l.viewModel;(o.strategy===activationStrategy.invokeLifecycle||o.strategy===activationStrategy.replace)&&t in c&&i.push({viewModel:c,lifecycleArgs:a.lifecycleArgs,router:r});let u=o.childNavigationInstruction;u&&findActivatable(u,t,i,l.childRouter||r)}),i},shouldContinue=(e,t)=>!(e instanceof Error)&&(isNavigationCommand(e)?("function"==typeof e.setRouter&&e.setRouter(t),!!e.shouldContinueProcessing):void 0===e||e);class SafeSubscription{constructor(e){this._subscribed=!0,this._subscription=e(this),this._subscribed||this.unsubscribe()}get subscribed(){return this._subscribed}unsubscribe(){this._subscribed&&this._subscription&&this._subscription.unsubscribe(),this._subscribed=!1}}const processPotential=(e,t,i)=>{if(e&&"function"==typeof e.then)return Promise.resolve(e).then(t).catch(i);if(e&&"function"==typeof e.subscribe){let r=e;return new SafeSubscription(n=>r.subscribe({next(){n.subscribed&&(n.unsubscribe(),t(e))},error(e){n.subscribed&&(n.unsubscribe(),i(e))},complete(){n.subscribed&&(n.unsubscribe(),t(e))}}))}try{return t(e)}catch(e){return i(e)}};class CanDeactivatePreviousStep{run(e,t){return processDeactivatable(e,"canDeactivate",t)}}class CanActivateNextStep{run(e,t){return processActivatable(e,"canActivate",t)}}class DeactivatePreviousStep{run(e,t){return processDeactivatable(e,"deactivate",t,!0)}}class ActivateNextStep{run(e,t){return processActivatable(e,"activate",t,!0)}}class PipelineSlot{constructor(e,t,i){this.steps=[],this.container=e,this.slotName=t,this.slotAlias=i}getSteps(){return this.steps.map(e=>this.container.get(e))}}class PipelineProvider{static inject(){return[Container]}constructor(e){this.container=e,this.steps=[BuildNavigationPlanStep,CanDeactivatePreviousStep,LoadRouteStep,createPipelineSlot(e,"authorize"),CanActivateNextStep,createPipelineSlot(e,"preActivate","modelbind"),DeactivatePreviousStep,ActivateNextStep,createPipelineSlot(e,"preRender","precommit"),CommitChangesStep,createPipelineSlot(e,"postRender","postcomplete")]}createPipeline(e=!0){let t=new Pipeline;return this.steps.forEach(i=>{(e||i!==CanDeactivatePreviousStep)&&t.addStep(this.container.get(i))}),t}_findStep(e){return this.steps.find(t=>t.slotName===e||t.slotAlias===e)}addStep(e,t){let i=this._findStep(e);if(!i)throw new Error(`Invalid pipeline slot name: ${e}.`);{let e=i.steps;e.includes(t)||e.push(t)}}removeStep(e,t){let i=this._findStep(e);if(i){let e=i.steps;e.splice(e.indexOf(t),1)}}_clearSteps(e=""){let t=this._findStep(e);t&&(t.steps=[])}reset(){this._clearSteps("authorize"),this._clearSteps("preActivate"),this._clearSteps("preRender"),this._clearSteps("postRender")}}const createPipelineSlot=(e,t,i)=>new PipelineSlot(e,t,i),logger$4=getLogger("app-router");class AppRouter extends Router{static inject(){return[Container,History,PipelineProvider,EventAggregator]}constructor(e,t,i,r){super(e,t),this.pipelineProvider=i,this.events=r}reset(){super.reset(),this.maxInstructionCount=10,this._queue?this._queue.length=0:this._queue=[]}loadUrl(e){return this._createNavigationInstruction(e).then(e=>this._queueInstruction(e)).catch(e=>{logger$4.error(e),restorePreviousLocation(this)})}registerViewPort(e,t){const i=e;if(super.registerViewPort(i,t),this.isActive)this._dequeueInstruction();else{const e=this._findViewModel(i);if("configureRouter"in e){if(!this.isConfigured){const t=this._resolveConfiguredPromise;return this._resolveConfiguredPromise=(()=>{}),this.configure(t=>Promise.resolve(e.configureRouter(t,this)).then(()=>t)).then(()=>{this.activate(),t()})}}else this.activate()}return Promise.resolve()}activate(e){this.isActive||(this.isActive=!0,this.options=Object.assign({routeHandler:this.loadUrl.bind(this)},this.options,e),this.history.activate(this.options),this._dequeueInstruction())}deactivate(){this.isActive=!1,this.history.deactivate()}_queueInstruction(e){return new Promise(t=>{e.resolve=t,this._queue.unshift(e),this._dequeueInstruction()})}_dequeueInstruction(e=0){return Promise.resolve().then(()=>{if(this.isNavigating&&!e)return;let t=this._queue.shift();if(this._queue.length=0,!t)return;this.isNavigating=!0;let i=this.history.getState("NavigationTracker"),r=this.currentNavigationTracker;i||r?i?r?ri&&(this.isNavigatingBack=!0):this.isNavigatingRefresh=!0:this.isNavigatingNew=!0:(this.isNavigatingFirst=!0,this.isNavigatingNew=!0),i||(i=Date.now(),this.history.setState("NavigationTracker",i)),this.currentNavigationTracker=i,t.previousInstruction=this.currentInstruction;let n=this.maxInstructionCount;if(e){if(e===n-1)return logger$4.error(`${e+1} navigation instructions have been attempted without success. Restoring last known good location.`),restorePreviousLocation(this),this._dequeueInstruction(e+1);if(e>n)throw new Error("Maximum navigation attempts exceeded. Giving up.")}else this.events.publish("router:navigation:processing",{instruction:t});return this.pipelineProvider.createPipeline(!this.couldDeactivate).run(t).then(i=>processResult(t,i,e,this)).catch(e=>({output:e instanceof Error?e:new Error(e)})).then(i=>resolveInstruction(t,i,!!e,this))})}_findViewModel(e){if(this.container.viewModel)return this.container.viewModel;if(e.container){let t=e.container;for(;t;){if(t.viewModel)return this.container.viewModel=t.viewModel,t.viewModel;t=t.parent}}}}const processResult=(e,t,i,r)=>{t&&"completed"in t&&"output"in t||((t=t||{}).output=new Error(`Expected router pipeline to return a navigation result, but got [${JSON.stringify(t)}] instead.`));let n=null,s=null;return isNavigationCommand(t.output)?s=t.output.navigate(r):(n=t,t.completed||(t.output instanceof Error&&logger$4.error(t.output.toString()),restorePreviousLocation(r))),Promise.resolve(s).then(e=>r._dequeueInstruction(i+1)).then(e=>n||e||t)},resolveInstruction=(e,t,i,r)=>{e.resolve(t);let n=r.events,s={instruction:e,result:t};if(i)n.publish("router:navigation:child:complete",s);else{let i;if(r.isNavigating=!1,r.isExplicitNavigation=!1,r.isExplicitNavigationBack=!1,r.isNavigatingFirst=!1,r.isNavigatingNew=!1,r.isNavigatingRefresh=!1,r.isNavigatingForward=!1,r.isNavigatingBack=!1,r.couldDeactivate=!1,t.output instanceof Error)i="router:navigation:error";else if(t.completed){let t=e.queryString?"?"+e.queryString:"";r.history.previousLocation=e.fragment+t,i="router:navigation:success"}else i="router:navigation:canceled";n.publish(i,s),n.publish("router:navigation:complete",s)}return t},restorePreviousLocation=e=>{let t=e.history.previousLocation;t?e.navigate(t,{trigger:!1,replace:!0}):e.fallbackRoute?e.navigate(e.fallbackRoute,{trigger:!0,replace:!0}):logger$4.error("Router navigation failed, and no previous location or fallbackRoute could be restored.")};var PipelineStatus,RouterEvent,PipelineSlotName;!function(e){e.Completed="completed",e.Canceled="canceled",e.Rejected="rejected",e.Running="running"}(PipelineStatus||(PipelineStatus={})),function(e){e.Processing="router:navigation:processing",e.Error="router:navigation:error",e.Canceled="router:navigation:canceled",e.Complete="router:navigation:complete",e.Success="router:navigation:success",e.ChildComplete="router:navigation:child:complete"}(RouterEvent||(RouterEvent={})),function(e){e.Authorize="authorize",e.PreActivate="preActivate",e.PreRender="preRender",e.PostRender="postRender"}(PipelineSlotName||(PipelineSlotName={}));class EmptyLayoutViewModel{}class RouterView{constructor(e,t,i,r,n,s,o){this.element=e,this.container=t,this.viewSlot=i,this.router=r,this.viewLocator=n,this.compositionTransaction=s,this.compositionEngine=o,this.router.registerViewPort(this,this.element.getAttribute("name")),"initialComposition"in s||(s.initialComposition=!0,this.compositionTransactionNotifier=s.enlist())}static inject(){return[DOM.Element,Container,ViewSlot,Router,ViewLocator,CompositionTransaction,CompositionEngine]}created(e){this.owningView=e}bind(e,t){this.container.viewModel=e,this.overrideContext=t}process(e,t){const i=e,r=i.component,n=r.childContainer,s=r.viewModel,o=r.viewModelResource,a=o.metadata,l=r.router.currentInstruction.config,c=l.viewPorts&&l.viewPorts[i.name]||{};n.get(RouterViewLocator)._notify(this);const u={viewModel:c.layoutViewModel||l.layoutViewModel||this.layoutViewModel,view:c.layoutView||l.layoutView||this.layoutView,model:c.layoutModel||l.layoutModel||this.layoutModel,router:i.component.router,childContainer:n,viewSlot:this.viewSlot},h=this.viewLocator.getViewStrategy(r.view||s);return h&&r.view&&h.makeRelativeTo(Origin.get(r.router.container.viewModel.constructor).moduleId),a.load(n,o.value,null,h,!0).then(e=>{this.compositionTransactionNotifier||(this.compositionTransactionOwnershipToken=this.compositionTransaction.tryCapture()),(u.viewModel||u.view)&&(i.layoutInstruction=u);const r=BehaviorInstruction.dynamic(this.element,s,e);if(i.controller=a.create(n,r),t)return null;this.swap(i)})}swap(e){const t=e,i=t.controller,r=t.layoutInstruction,n=this.view,s=()=>{const e=SwapStrategies[this.swapOrder]||SwapStrategies.after,t=this.viewSlot;e(t,n,()=>Promise.resolve(t.add(this.view))).then(()=>{this._notify()})},o=e=>{i.automate(this.overrideContext,e);const t=this.compositionTransactionOwnershipToken;return t?t.waitForCompositionComplete().then(()=>(this.compositionTransactionOwnershipToken=null,s())):s()};return r?(r.viewModel||(r.viewModel=new EmptyLayoutViewModel),this.compositionEngine.createController(r).then(e=>{const t=e.view;return ShadowDOM.distributeView(i.view,e.slots||t.slots),e.automate(createOverrideContext(r.viewModel),this.owningView),t.children.push(i.view),t||e}).then(e=>(this.view=e,o(e)))):(this.view=i.view,o(this.owningView))}_notify(){const e=this.compositionTransactionNotifier;e&&(e.done(),this.compositionTransactionNotifier=null)}}RouterView.$view=null,RouterView.$resource={name:"router-view",bindables:["swapOrder","layoutView","layoutViewModel","layoutModel","inherit-binding-context"]};class RouterViewLocator{constructor(){this.promise=new Promise(e=>this.resolve=e)}findNearest(){return this.promise}_notify(e){this.resolve(e)}}class EmptyClass{}inlineView("")(EmptyClass);class TemplatingRouteLoader extends RouteLoader{constructor(e){super(),this.compositionEngine=e}resolveViewModel(e,t){return new Promise((i,r)=>{let n;if("moduleId"in t){let r=t.moduleId;return null===r?n=EmptyClass:(r=relativeToFile(r,Origin.get(e.container.viewModel.constructor).moduleId),n=/\.html/i.test(r)?createDynamicClass(r):r),i(n)}r(new Error('Invalid route config. No "moduleId" found.'))})}createChildContainer(e){const t=e.container.createChild();return t.registerSingleton(RouterViewLocator),t.getChildRouter=function(){let i;return t.registerHandler(Router,()=>i||(i=e.createChild(t))),t.get(Router)},t}loadRoute(e,t,i){return this.resolveViewModel(e,t).then(i=>this.compositionEngine.ensureViewModel({viewModel:i,childContainer:this.createChildContainer(e),view:t.view||t.viewStrategy,router:e}))}}function createDynamicClass(e){class t{bind(e){this.$parent=e}}return customElement(/([^\/^\?]+)\.html/i.exec(e)[1])(t),useView(e)(t),t}TemplatingRouteLoader.inject=[CompositionEngine];const logger$5=getLogger("route-href");class RouteHref{constructor(e,t){this.router=e,this.element=t,this.attribute="href"}static inject(){return[Router,DOM.Element]}bind(){this.isActive=!0,this.processChange()}unbind(){this.isActive=!1}attributeChanged(e,t){return t&&this.element.removeAttribute(t),this.processChange()}processChange(){return this.router.ensureConfigured().then(()=>{if(!this.isActive)return null;const e=this.element,t=this.router.generate(this.route,this.params);return e.au.controller?e.au.controller.viewModel[this.attribute]=t:e.setAttribute(this.attribute,t),null}).catch(e=>{logger$5.error(e)})}}function configure$5(e){e.singleton(RouteLoader,TemplatingRouteLoader).singleton(Router,AppRouter).globalResources(RouterView,RouteHref),e.container.registerAlias(Router,AppRouter)}RouteHref.$resource={type:"attribute",name:"route-href",bindables:[{name:"route",changeHandler:"processChange",primaryProperty:!0},{name:"params",changeHandler:"processChange"},"attribute"]};let ConsoleAppender=class{debug(e,...t){console.debug(`DEBUG [${e.id}]`,...t)}info(e,...t){console.info(`INFO [${e.id}]`,...t)}warn(e,...t){console.warn(`WARN [${e.id}]`,...t)}error(e,...t){console.error(`ERROR [${e.id}]`,...t)}};const createAndStart=(e={})=>{const t=new Aurelia,i=t.use;return i.standardConfiguration(),e.debug&&i.developmentLogging(),Array.isArray(e.plugins)&&e.plugins.forEach(e=>{Array.isArray(e)?i.plugin(e[0],e[1]):i.plugin(e)}),Array.isArray(e.resources)&&i.globalResources(e.resources),t.start()};function start(e={}){return createAndStart(e).then(t=>t.setRoot(e.root||"app.js",e.host||document.body))}function enhance(e={}){return createAndStart(e).then(t=>("function"==typeof e.root&&(e.root=t.container.get(e.root)),t.enhance(e.root||{},e.host||document.body)))}initialize(),(e=>{e.developmentLogging=function(){return LogManager.addAppender(new ConsoleAppender),LogManager.setLevel(LogManager.logLevel.debug),this},e.defaultBindingLanguage=function(){return this.plugin(configure)},e.defaultResources=function(){return this.plugin(configure$2)},e.eventAggregator=function(){return this.plugin(configure$3)},e.history=function(){return this.plugin(configure$4)},e.router=function(){return this.plugin(configure$5)}})(FrameworkConfiguration.prototype);export{AbstractRepeater,AccessKeyed,AccessMember,AccessScope,AccessThis,ActivateNextStep,AggregateError,All,Animator,AppRouter,ArrayRepeatStrategy,Assign,AttrBindingBehavior,Aurelia,BehaviorInstruction,BehaviorPropertyObserver,Binary,BindableProperty,Binding,BindingBehavior,BindingBehaviorResource,BindingEngine,BindingExpression,BindingLanguage,BindingSignaler,BoundViewFactory,BuildNavigationPlanStep,Call,CallExpression,CallFunction,CallMember,CallScope,CanActivateNextStep,CanDeactivatePreviousStep,CheckedObserver,ClassObserver,CollectionLengthObserver,CommitChangesStep,Compose,CompositionEngine,CompositionTransaction,CompositionTransactionNotifier,CompositionTransactionOwnershipToken,ComputedExpression,Conditional,Container,Controller,ConventionalViewStrategy,DOM,DataAttributeObserver,DeactivatePreviousStep,DebounceBindingBehavior,DirtyCheckProperty,DirtyChecker,ElementConfigResource,ElementEvents,Else,EventAggregator,EventManager,EventSubscriber,Expression,ExpressionCloner,ExpressionObserver,FEATURE,Factory,FactoryInvoker,Focus,FrameworkConfiguration,FromViewBindingBehavior,HTMLSanitizer,Hide,HtmlBehaviorResource,If,InlineViewStrategy,InvocationHandler,Lazy,Listener,ListenerExpression,LiteralArray,LiteralObject,LiteralPrimitive,LiteralString,LiteralTemplate,LoadRouteStep,Loader,LogManager,MapRepeatStrategy,ModifyCollectionObserver,ModuleAnalyzer,NameExpression,NavModel,NavigationInstruction,NewInstance,NoViewStrategy,NullRepeatStrategy,NumberRepeatStrategy,ObjectObservationAdapter,ObserverLocator,OneTimeBindingBehavior,OneWayBindingBehavior,Optional,Origin,PLATFORM,Parent,Parser,ParserImplementation,PassThroughSlot,Pipeline,PipelineProvider,PipelineStatus,PrimitiveObserver,Redirect,RedirectToRoute,RelativeViewStrategy,Repeat,RepeatStrategyLocator,Replaceable,ResourceDescription,ResourceLoadContext,ResourceModule,RouteLoader,Router,RouterConfiguration,SVGAnalyzer,SanitizeHTMLValueConverter,SelectValueObserver,SelfBindingBehavior,SetRepeatStrategy,SetterObserver,ShadowDOM,ShadowSlot,Show,SignalBindingBehavior,SingletonRegistration,SlotCustomAttribute,StaticViewStrategy,StrategyResolver,StyleObserver,SwapStrategies,TargetInstruction,TaskQueue,TemplateDependency,TemplateRegistryEntry,TemplateRegistryViewStrategy,TemplatingEngine,ThrottleBindingBehavior,ToViewBindingBehavior,TransientRegistration,TwoWayBindingBehavior,Unary,Unparser,UpdateTriggerBindingBehavior,ValueAttributeObserver,ValueConverter,ValueConverterResource,View,ViewCompileInstruction,ViewCompiler,ViewEngine,ViewEngineHooksResource,ViewFactory,ViewLocator,ViewResources,ViewSlot,With,XLinkAttributeObserver,_emptyParameters,_hyphenate,_isAllWhitespace,activationStrategy,all,animationEvent,autoinject,behavior,bindable,bindingBehavior,bindingMode,buildQueryString,calcSplices,camelCase,child,children,cloneExpression,computedFrom,connectBindingToSignal,connectable,containerless,createComputedObserver,createFullOverrideContext,createOverrideContext,createScopeForTest,customAttribute,customElement,dataAttributeAccessor,declarePropertyDependencies,decorators,delegationStrategy,deprecated,disableConnectQueue,dynamicOptions,elementConfig,elements,enableConnectQueue,enhance,enqueueBindingConnect,factory,getArrayObserver,getChangeRecords,getConnectQueueSize,getContextFor,getDecoratorDependencies,getItemsSourceExpression,getMapObserver,getSetObserver,hasDeclaredDependencies,includeEventsIn,initializePAL,inject,inlineView,invokeAsFactory,invoker,isInitialized,isNavigationCommand,isOneTime,join,lazy,mergeSplice,metadata,mixin,newInstance,noView,observable,optional,parent,parseQueryString,presentationAttributes,presentationElements,processAttributes,processContent,projectArraySplices,propertyAccessor,protocol,registration,relativeToFile,reset,resolver,resource,setConnectQueueThreshold,signalBindings,singleton,sourceContext,start,subscriberCollection,targetContext,templateController,transient,unwrapExpression,updateOneTimeBinding,updateOverrideContext,useShadowDOM,useView,useViewStrategy,validateBehaviorName,valueConverter,view,viewEngineHooks,viewResources,viewStrategy,viewsRequireLifecycle};