@motifx/core 1.2.0-rc.3 → 1.2.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{core-W7wNt8bq.esm.js → core-Cq96WPGz.esm.js} +564 -421
- package/dist/chunks/core-Cq96WPGz.esm.js.map +1 -0
- package/dist/chunks/{core-DD3SssnS.cjs → core-ZhqTS1zK.cjs} +564 -421
- package/dist/chunks/core-ZhqTS1zK.cjs.map +1 -0
- package/dist/devtools.cjs +1 -1
- package/dist/devtools.esm.js +1 -1
- package/dist/index.cjs +3 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -8
- package/dist/index.d.ts +5 -8
- package/dist/index.esm.js +4 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.umd.js +14341 -14202
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/jsx-runtime.cjs.map +1 -1
- package/dist/jsx-runtime.d.cts +25 -15
- package/dist/jsx-runtime.d.ts +25 -15
- package/dist/jsx-runtime.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/core-DD3SssnS.cjs.map +0 -1
- package/dist/chunks/core-W7wNt8bq.esm.js.map +0 -1
package/dist/index.esm.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function t(t){setTimeout(()=>{throw t},0)}class e{constructor(){this.unexpectedErrorHandler=t,this.listeners=[],this._isDevelopment=!1,this._enableConsoleLogging=!0}setDevelopmentMode(t){this._isDevelopment=t}setConsoleLogging(t){this._enableConsoleLogging=t}isDevelopment(){return this._isDevelopment||!0===globalThis.__MOTIF_DEV__}reportSuppressed(t,e){this.logIfDev(t,e)}report(t){this._enableConsoleLogging&&(void 0!==t.cause?console.error(t.message,t.cause):console.error(t.message));try{const e=globalThis.__MOTIF_DEVTOOLS_BUS__;e&&"function"==typeof e.publish&&e.publish("error:caught",{context:t.code??t.name,error:this.serializeError(t)})}catch{}this.emit(t)}logIfDev(t,e){this.isDevelopment()&&this._enableConsoleLogging&&console.error(`[motifjs Error - ${t}]`,e);try{const s=globalThis.__MOTIF_DEVTOOLS_BUS__;s&&"function"==typeof s.publish&&s.publish("error:caught",{context:t,error:this.serializeError(e)})}catch{}}serializeError(t){if(!t)return{message:"Unknown error"};if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack,cause:t.cause?this.serializeError(t.cause):void 0};if("object"==typeof t)try{return JSON.parse(JSON.stringify(t))}catch{return String(t)}return String(t)}addListener(t){return this.listeners.push(t),()=>{const e=this.listeners.indexOf(t);-1!==e&&this.listeners.splice(e,1)}}emit(t){for(const e of this.listeners.slice())e(t)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}safeCall(t,e,s){try{return t()}catch(t){return this.logIfDev(e,t),this.onUnexpectedError(t),s}}async safeCallAsync(t,e,s){try{return await t()}catch(t){return this.logIfDev(e,t),this.onUnexpectedError(t),s}}safeCallSilent(t,e){try{t()}catch(t){this.logIfDev(e,t)}}async safeCallSilentAsync(t,e){try{return await t()}catch(t){this.logIfDev(e,t)}}wrapSafe(t,e){return(...s)=>{try{return t(...s)}catch(t){return this.logIfDev(e,t),void this.onUnexpectedError(t)}}}wrapSafeAsync(t,e){return async(...s)=>{try{return await t(...s)}catch(t){return this.logIfDev(e,t),void this.onUnexpectedError(t)}}}}const s=new e;function i(t,e,i){return s.safeCall(t,e,i)}function n(t,e,i){return s.safeCallAsync(t,e,i)}function o(t,e){s.safeCallSilent(t,e)}function r(t){s.setUnexpectedErrorHandler(t)}const a={enabled:!1,listeners:new Set,warnings:[],routes:null};function c(){return a.enabled||!0===globalThis.__MOTIF_DEV__}function l(){try{if("undefined"==typeof window)return!1;return!0===window.__motif_DEVTOOLS||(!0===globalThis.__MOTIF_DEVTOOLS__||!0===globalThis.__MOTIF_DEVTOOLS_FLAG)}catch{return!1}}function h(t){try{t?window.__motifDevBus={on:p,emit:f,warn:m,getWarnings:_,isEnabled:d,setRoutes:g,getRoutes:y}:delete window.__motifDevBus}catch{}}function u(){a.enabled||(a.enabled=l(),a.enabled&&h(!0))}function d(){return a.enabled}function p(t){return a.listeners.add(t),()=>{a.listeners.delete(t)}}function f(t,e){const s={type:t,payload:e};for(const t of a.listeners)try{t(s)}catch{}try{const s=globalThis.__MOTIF_DEVTOOLS_BUS__;s&&"function"==typeof s.publish&&s.publish("devtools:"+t,e)}catch{}}function m(t,e,s){if(!c())return;const i={code:t,message:e,details:s};a.warnings.push(i);try{"undefined"!=typeof console&&(void 0===s?console.warn(`[motifjs] ${t}: ${e}`):console.warn(`[motifjs] ${t}: ${e}`,s))}catch{}f("warning",i)}function _(){return a.warnings.slice()}function g(t){a.routes=t}function y(){return a.routes}const v={MJX101:t=>`dom.createElement('${t}'): no document is available (no DOM environment).`,MJX102:t=>`Invalid element selector "${t}".`,MJX103:t=>`dom.createElementNS('${t}') failed.`,MJX104:()=>"Skipped inserting a component into the DOM because it contains its own parent.",MJX105:()=>"Applying router link classes failed.",MJX106:()=>"The placeholder parent changed; rebuilding the component.",MJX107:()=>"Disposing a child component failed.",MJX108:()=>"Component is disposed; the result of doWork was discarded.",MJX109:()=>"A content block child was removed because its content body is being disposed.",MJX110:t=>`Lazy timeout: the component did not load within ${t} ms.`,MJX111:()=>"Lazy aborted: loading the component was cancelled.",MJX112:t=>`resolveComponent: the factory chain exceeded ${t} levels; a factory may be returning itself.`,MJX113:()=>"The transport slot has no parent; mount the slot before transporting into it.",MJX114:()=>"Placing the navigation target into its host failed.",MJX115:()=>"Disposing the previous navigation target failed.",MJX116:t=>`Timeout: the listener guard did not settle within ${t} ms.`,MJX117:()=>"Detaching a control failed.",MJX118:()=>"The onRemove callback failed while detaching a control.",MJX119:()=>"Moving a fragment's DOM range stopped: its end marker was not found (possible infinite loop).",MJX120:()=>"Scanning a fragment's DOM range stopped: its end marker was not found (possible infinite loop).",MJX121:(t,e)=>`This code was compiled for compiler contract ${t}, but the @motifx/core runtime implements contract ${e}. Install matching versions of @motifx/compiler and @motifx/core, and rebuild packages that ship compiled JSX.`,MJX122:t=>`The component ${t} hook threw.`,MJX123:t=>`The '${t}' event handler threw.`,MJX124:t=>`A spread object on a DOM tag cannot set ${t}; the key was ignored. Write it on the tag, or use x-html, for HTML you trust.`,MJX125:t=>`A spread object on a DOM tag cannot set a javascript: URL on '${t}'; the value was ignored. Write the attribute on the tag if it is intended.`,MJX126:()=>"Lazy: loading the component failed and no Fallbackview is set; the host was cleared.",MJX127:t=>"module"===t?"The loaded module has no default export. Export the component as default, or map it: () => import('./X').then(m => m.X).":`The loaded value is not a component (got ${t}). Return a component class, a function component, an Options API factory or a component instance.`,MJX128:(t,e,s)=>"method"===s?`${t} overrides ${e} without calling super.${e}; MotifJS relies on this ComponentBase member. Rename your member, or call super.${e} in the override.`:"field"===s?`${t} defines '${e}' as an instance field, which hides the ComponentBase member MotifJS relies on. Rename your field.`:`${t} replaces '${e}', which MotifJS created for the component (a class field or an assignment with that name). Rename your member.`,MJX201:()=>"ListBinding: renderFn must return a component instance, a component class, or a factory function.",MJX202:(t,e)=>`ListBinding: duplicate key "${String(t)}" at index ${e}. Rows are matched by the item object, not by key, so rendering is not affected; keep keys unique so they identify items.`,MJX203:t=>`An effect ran ${t} times in one flush and keeps triggering itself; it is skipped for the rest of this flush. It probably writes a value it reads (for example state.n++). Wrap the write in untracked(...).`,MJX204:()=>"A component reached a text binding and was not written to the DOM. For a template prop that can change later, write a getter: {() => props.tpl}. Templates that are ready at setup also work as {props.tpl}.",MJX205:()=>"Virtualization: the watch callback threw.",MJX206:()=>"Virtualization: autoRefresh stopped; dataRequest may be changing the reactive data it reads on every refresh.",MJX207:()=>"Virtualization: loading data failed.",MJX208:()=>"An effect threw.",MJX301:(t,e)=>`RouterView outlet '${t}' was not built within ${e} ms, so the route chain cannot be mounted. Does the layout component render a <RouterView>?`,MJX302:t=>`Named route '${t}' was not found.`,MJX303:t=>`Redirect loop or too many redirects: ${t}`,MJX304:()=>"Route execution failed.",MJX305:()=>"The error fallback route failed.",MJX306:t=>`The ${t} hook threw.`,MJX307:()=>"Disposing a route component failed.",MJX308:()=>"The stack navigation transition failed.",MJX309:()=>"Router is not initialized. Call useRouter() before navigating.",MJX310:t=>`Route path cannot be empty; use '/' for the default child. Under parent "${t}".`,MJX311:(t,e)=>`Child route path should start with '/': "${t}" under parent "${e}".`,MJX312:t=>`Child route path resolves to the same full path as its parent: "${t}".`,MJX313:t=>`Multiple routes resolve to the same full path: "${t}".`,MJX314:(t,e)=>`Child route alias should start with '/': "${t}" under parent "${e}".`,MJX315:t=>`Route alias resolves to the route's own path: "${t}".`,MJX316:t=>`Multiple routes use the same alias: "${t}".`,MJX401:t=>`Service not registered for token: ${t}`,MJX402:t=>`Async factory used with get() for token ${t}; use getAsync().`,MJX403:()=>"Invalid service descriptor.",MJX404:t=>`Cyclic dependency detected: ${t}`,MJX405:()=>"Only one ApplicationBuilder instance is allowed.",MJX406:t=>`Application.run: host not found for selector: ${t}`,MJX407:t=>`getService: no ServiceProvider found for token '${t}'.`,MJX408:(t,e)=>`getService failed for token '${t}': ${e}`,MJX409:t=>`inject(${t}) was called outside a service construction; call it in a field initializer or constructor of a class the ServiceProvider creates.`,MJX410:(t,e)=>`Multiple sources provided for token '${t}': ${e}. Resolution order is useValue > useFactory > useClass.`,MJX411:t=>`'deps' must be an array for token '${t}'; the invalid deps are ignored.`,MJX413:t=>`Service '${t}' is registered with a function that cannot be constructed. Use { useValue: fn } to provide the function itself or { useFactory: fn } to create the service.`,MJX414:(t,e)=>`FromService failed for token '${t}': ${e}`,MJX501:()=>"Disposable already disposed.",MJX502:()=>"Cannot register a disposable on itself.",MJX503:()=>"Errors were thrown while disposing a store.",MJX504:()=>"A disposable was added to a DisposableStore that is already disposed; the added object will leak.",MJX505:()=>"Cannot dispose a disposable on itself.",MJX507:(t,e,s)=>`[${t}] potential listener LEAK: ${e} listeners already; most frequent stack (${s}):`,MJX601:()=>"Sequence contains no elements.",MJX602:()=>"Circuit is open.",MJX603:()=>"Bulkhead queue is full.",MJX604:()=>"Rate limit exceeded.",MJX605:()=>"Operation timed out.",MJX607:()=>"A history must be created with at least one entry.",MJX608:()=>"Method not implemented.",MJX609:()=>"OperationRunner: the operation threw.",MJX610:()=>"Matching the request path failed.",MJX611:()=>"The devtools panel failed to load."};class w extends Error{constructor(t,e,s){super(e,s),this.name="MotifError",this.code=t}}function b(t,...e){return`[motifjs] ${t}: ${v[t](...e)}`}function S(t,...e){return new w(t,b(t,...e))}function M(t,e,...i){s.report(new w(t,b(t,...i),{cause:e}))}function C(t,e,...s){try{const i=t();i&&"function"==typeof i.then&&i.then(void 0,t=>M(e,t,...s))}catch(t){M(e,t,...s)}}function k(t,e,s){m(t,v[t](...e),s)}const D=new class{constructor(){this.disposableTracker=null}notifyCreated(t){return this.disposableTracker?.trackDisposable(t),t}notifyDisposed(t){this.disposableTracker?.markAsDisposed(t)}notifyOwner(t,e){this.disposableTracker?.setParent(t,e)}toDisposable(t){let e=!0;const s={dispose:()=>{e&&(e=!1,this.notifyDisposed(s),t())}};return this.notifyCreated(s)}};class A{constructor(){this._closed=!1,D.notifyCreated(this)}get isDisposed(){return this._closed}add(t){if(!t)return t;if(t===this)throw S("MJX502");return D.notifyOwner(t,this),this._closed?k("MJX504",[],(new Error).stack):(this._items??=new Set).add(t),t}delete(t){if(t){if(t===this)throw S("MJX505");this._items?.delete(t),t.dispose()}}detach(t){t&&this._items?.delete(t)&&D.notifyOwner(t,null)}clear(){const t=this._items;if(!t||0===t.size)return;const e=[];for(const s of t)try{s?.dispose()}catch(t){e.push(t)}if(t.clear(),1===e.length)throw e[0];if(e.length>1)throw new w("MJX503",b("MJX503"),{cause:new AggregateError(e)})}dispose(){this._closed||(D.notifyDisposed(this),this._closed=!0,this.clear())}}let x;class E{get _disposables(){let t=this._store;return void 0===t&&(t=this._store=new A,D.notifyOwner(t,this)),t}constructor(){this._store=void 0,D.notifyCreated(this)}dispose(){D.notifyDisposed(this);const t=this._store;void 0===t?this._store=(void 0===x&&(x=new A,x.dispose()),x):t&&"function"==typeof t.dispose?t.dispose():k("MJX501",[],{disposable:this})}_register(t){if(t===this)throw S("MJX502");return this._disposables.add(t)}}const T={IS_REACTIVE:Symbol.for("motif.isReactive"),IS_READONLY:Symbol.for("motif.isReadonly"),IS_SUPERFICIAL:Symbol.for("motif.isSuperficial"),RAW:Symbol.for("motif.raw"),GET_SETUP:Symbol.for("motif.getSetup")},O=Symbol("");let N=!0,P={enabled:!1,key:""};function L(t){let e=t;for(;e&&e[T.RAW];)e=e[T.RAW];return e}function X(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function R(t){return"object"==typeof t&&null!==t}const I=new Set(Object.values(Object.getOwnPropertyDescriptors(Symbol)).map(t=>t.value).filter(t=>"symbol"==typeof t));function J(t){return"symbol"==typeof t&&I.has(t)}const j=new Map([["[object Object]",1],["[object Array]",1],["[object Map]",2],["[object Set]",2],["[object WeakMap]",2],["[object WeakSet]",2]]);const F=/^(?:0|[1-9]\d*)$/,H=[];let B=0;function z(t){H[B++]=N,N=t}function V(){z(!1)}function W(){N=!(B>0)||H[--B]}const $=[];class U{constructor(t,e,s,i){this.component=t,this.itemsFn=e,this.renderFn=s,this.options=i,this.propertyName="__list__",this._isActive=!1,this._rendered=[],this._identityMap=new WeakMap,this.container=zi("list-container"),this.olditems=[],this.component.controls.add(this.container)}activate(){this._isActive||(this._isActive=!0,this._setupBinding())}deactivate(){this._isActive&&(this._isActive=!1,this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=void 0),this._disposeAll())}reActivate(){this.deactivate(),this.activate()}_disposeAll(){this._rendered.forEach(t=>{try{t.dispose&&t.dispose()}catch{}}),this._rendered=[],this._identityMap=new WeakMap}_toArray(t){return t?Array.isArray(t)?t:"function"==typeof t?this._toArray(t()):t[Symbol.iterator]?Array.from(t):[]:[]}_getComponentKey(t){try{const e=t.props;if(e&&"function"==typeof e.indexkey)return e.indexkey();if(e&&void 0!==e.indexkey&&null!==e.indexkey)return e.indexkey}catch{}try{const e=t.motif.options?.__key;if(void 0!==e)return e}catch{}}isPreCreated(t){return null!==t.element||null!==t.parent}_render(t,e){return Ot(()=>{const s=this.renderFn(t,e);return this.processRendered(s,t)})}processRendered(t,e){const s=Ei(t);if(!(s instanceof zs))throw S("MJX201");try{s._base.itemRef=e}catch{}try{s.motif.options.__fromList=!0}catch{}return void 0===s.__listAdopted&&(s.__listAdopted=null!==s.parent&&void 0!==s.parent),s}get _indexSensitive(){try{return this.renderFn.length>=2}catch{return!0}}static _isPrimitive(t){return null===t||"object"!=typeof t}_setupBinding(){const t=()=>{const t=this._toArray(this.itemsFn()),e=L(t),s=t.length;let i;if(e===t)i=t;else{i=new Array(s);for(let n=0;n<s;n++)n in e?i[n]=t[n]:t[n]}const n=this.olditems,o=this._rendered;if(this.olditems.length>0){const t=new Set;for(let e=0;e<s;e++)t.add(L(i[e]));for(const e of this.olditems){const s=L(e);if(!t.has(s)){const t=this._identityMap.get(s);if(t){this._identityMap.delete(s);for(const e of t)try{e.dispose()}catch{}}}}}const r=[],a=new Set,c=new Map,l=new Set,h=new Map,u=t=>!(!t||t.isDisposed||l.has(t)||t.__listAdopted),d=Math.min(i.length,n.length);for(let t=0;t<d;t++){const e=i[t];if(!U._isPrimitive(e))continue;if(!Object.is(n[t],e))continue;const s=o[t];u(s)&&(h.set(t,s),l.add(s))}let p=null;if(!this._indexSensitive){p=new Map;for(let t=0;t<n.length;t++){const e=n[t];if(!U._isPrimitive(e))continue;const s=o[t];if(!u(s))continue;const i=p.get(e);i?i.push(s):p.set(e,[s])}}const f=new Map;return i.forEach((t,e)=>{let s;if("object"==typeof t&&null!==t){const i=L(t),n=f.get(i)??0;f.set(i,n+1);let o=this._identityMap.get(i);o||(o=[],this._identityMap.set(i,o));const r=o[n];r&&!r.isDisposed?s=r:(s=this._render(t,e),o[n]=s)}else{let i=h.get(e);if(!i&&p){const e=p.get(t);e&&e.length&&(i=e.shift(),l.add(i))}s=i||this._render(t,e)}const i=this._getComponentKey(s);null!=i&&(c.has(i)?k("MJX202",[i,e]):c.set(i,e)),r.push(s),a.add(s)}),f.forEach((t,e)=>{const s=this._identityMap.get(e);s&&s.length>t&&(s.length=t)}),this._rendered.forEach(t=>{if(!a.has(t)&&!t.__listAdopted)try{t.dispose()}catch{}}),this._syncContainer(r),this._rendered=r,this.olditems=i===t?t.slice():i,s};this._effectCleanup=At(()=>t())}_syncContainer(t){const e=this.container.controls,s=e.items;if(0===s.length){for(const s of t)try{e.add(s)}catch{}return}if(t.length>=s.length){let i=!0;for(let e=0;e<s.length;e++)if(t[e]!==s[e]){i=!1;break}if(i&&t.length>s.length){const e=new Set(s);for(let n=s.length;n<t.length;n++){if(e.has(t[n])){i=!1;break}e.add(t[n])}}if(i){for(let i=s.length;i<t.length;i++)try{e.add(t[i])}catch{}return}}const i=new Map;s.forEach((t,e)=>i.set(t,e));const n=t.map(t=>{const e=i.get(t);return void 0===e?-1:e}),o=new Set(function(t){const e=new Array(t.length).fill(-1),s=[];for(let i=0;i<t.length;i++){const n=t[i];if(-1===n)continue;if(0===s.length||t[s[s.length-1]]<n){e[i]=s.length>0?s[s.length-1]:-1,s.push(i);continue}let o=0,r=s.length-1;for(;o<r;){const e=o+r>>1;t[s[e]]<n?o=e+1:r=e}n<t[s[o]]&&(e[i]=o>0?s[o-1]:-1,s[o]=i)}const i=[];let n=s.length>0?s[s.length-1]:-1;for(;-1!==n;)i.push(n),n=e[n];return i.reverse()}(n));if(t.length===s.length&&function(t,e,s){const i=new Uint8Array(t.length);for(let n=0;n<t.length;n++){const o=t[n];if(-1===o||i[o])return!1;i[o]=1;const r=e[n];if(r.isDisposed||r.parent!==s)return!1}return!0}(n,t,this.container))return void e._reorder(t,o);let r=null;for(let i=t.length-1;i>=0;i--){const a=t[i];try{if(-1===n[i])if(r){const t=s.indexOf(r);e.add(t>=0?t:s.length,a)}else e.add(a);else o.has(i)||e.move(a,r)}catch{}r=a}}}class q{}class G{constructor(){this.__list=[],this._map=new Set}Dispose(){this.__list=[]}Add(t){this._map.add(t);var e=this.__list.push(t)-1;return null!=this.ItemAdded&&this.ItemAdded(t),e}AddBefore(t){this._map.add(t);var e=this.__list.unshift(t)-1;return null!=this.ItemAddedBefore&&this.ItemAddedBefore(t),e}Insert(t,e){this._map.add(e);var s=this.__list.splice(t,0,e);return null!=this.ItemSplice&&this.ItemSplice(t,e),s}get items(){return this.__list}clear(){return this._map.clear(),this.__list.splice(0),this.__list=[],this.__list}get count(){return this.__list.length}remove(t){const e=this.__list.indexOf(t);return-1===e?[]:(this._map.delete(t),this.__list.splice(e,1))}indexOf(t){return this.__list.indexOf(t)}FindFromKey(t,e){return this.__list.filter(s=>s[t]===e)}removeIndex(t){var e=this.__list.splice(t,1);return e.forEach(t=>{this._map.delete(t)}),e}has(t){return this._map.has(t)}item(t){return this.__list[t]}forEach(t){this.__list?.forEach(t)}ReverseClone(){return this.__list.slice().reverse()}filter(t){return this.__list.filter(t)}}function K(t){let e=!0;return{dispose(){e&&(e=!1,t())}}}function Y(t){return"/"+t.replace(/^\/+|\/+$/g,"")}function Q(t){try{if(t.isDisposed)return null;if(t.element.nodeType!==Node.COMMENT_NODE&&t.element.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&t.element.nodeType!==Node.TEXT_NODE)return t;if(t.parent)return Q(t.parent)}catch(t){throw t}return null}class Z{constructor(t,e){this.threshold=t,this.name=e,this._origins=new Map,this._quietChecks=0}check(t){if(this.threshold<=0||t<this.threshold)return;const e=(new Error).stack??"";if(this._origins.set(e,(this._origins.get(e)??0)+1),this._quietChecks--,this._quietChecks<=0){this._quietChecks=this.threshold/2;const[e,s]=this._busiestOrigin();k("MJX507",[this.name,t,s],e)}return()=>{this._origins.set(e,(this._origins.get(e)??0)-1)}}_busiestOrigin(){let t=["",0];for(const e of this._origins)e[1]>t[1]&&(t=e);return t}}class tt{constructor(){this.__values=new G}Add(t,e){var s=new q;s.Key=t,s.value=e;var i=this.__values.Add(s);return null!=this.OnItemAdded&&this.OnItemAdded(s.Key,s.value),i}has(t){return!!this.filter(e=>e.Key==t)[0]}item(t){return this.filter(e=>e.Key==t)[0]}removeIndex(t){return this.__values.removeIndex(t)}remove(t){this.__values.filter(e=>e.Key==t).forEach(t=>{this.__values.remove(t)})}clear(){this.__values.clear()}forEach(t){this.__values.forEach(t)}get values(){return this.__values}filter(t){return this.__values.items.filter(t)}find(t,e){return this.__values.items.find(t)}}function et(){const t={value:void 0,linked:!1};return t.before=t,t.after=t,t}class st{constructor(){this._ring=et(),this._count=0}get size(){return this._count}isEmpty(){return 0===this._count}push(t){return this._link(t,this._ring.before)}unshift(t){return this._link(t,this._ring)}pop(){return this._take(this._ring.before)}shift(){return this._take(this._ring.after)}clear(){for(let t=this._ring.after;t!==this._ring;t=t.after)t.linked=!1;this._ring=et(),this._count=0}*[Symbol.iterator](){const t=this._ring;for(let e=t.after;e!==t;e=e.after)yield e.value}_link(t,e){const s={value:t,before:e,after:e.after,linked:!0};return e.after.before=s,e.after=s,this._count++,()=>this._unlink(s)}_take(t){if(t===this._ring)return;const e=t.value;return this._unlink(t),e}_unlink(t){t.linked&&(t.linked=!1,t.before.after=t.after,t.after.before=t.before,this._count--)}}function it(t){return"function"==typeof t?t:()=>t}function nt(t){return"function"==typeof t?t():t}function ot(t,e){return t>e?1:t<e?-1:0}class rt{constructor(t){this.source=Array.isArray(t)?t:Array.from(t)}static from(t){return new rt(t)}where(t){return new rt(this.source.filter(t))}select(t){return new rt(this.source.map(t))}orderBy(t){return new rt([...this.source].sort((e,s)=>ot(t(e),t(s))))}orderByDescending(t){return new rt([...this.source].sort((e,s)=>ot(t(s),t(e))))}distinctBy(t){const e=new Set;return new rt(this.source.filter(s=>{const i=t(s);return!e.has(i)&&(e.add(i),!0)}))}groupBy(t){const e=new Map;for(const s of this.source){const i=t(s),n=e.get(i);n?n.push(s):e.set(i,[s])}return new rt(Array.from(e,([t,e])=>({key:t,items:e})))}first(){if(0===this.source.length)throw S("MJX601");return this.source[0]}firstOrDefault(){return this.source[0]}any(t){return t?this.source.some(t):this.source.length>0}all(t){return this.source.every(t)}aggregate(t,e){return this.source.reduce(e,t)}toArray(){return[...this.source]}[Symbol.iterator](){return this.source[Symbol.iterator]()}}const at=[1,2],ct=new Set,lt=new Set;function ht(t){at.includes(t)||ct.has(t)||(c()?(lt.delete(t),ct.add(t),k("MJX121",[t,2])):lt.add(t))}var ut;!function(t){t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",t[t.ENTITY_NODE=6]="ENTITY_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE",t[t.NOTATION_NODE=12]="NOTATION_NODE"}(ut||(ut={}));class dt{constructor(t,e){this.fn=t,this.callback=e,this.deps=[],this.active=!0,this.running=!1}run(){let t;if(this.active&&!this.running){Dt(this),ft.push(this),this.running=!0;try{t=this.fn()}finally{ft.pop(),this.running=!1,this.callback&&this.callback(t)}}}stop(){this.active=!1,Dt(this)}}const pt=new WeakMap,ft=[],mt=new Set;let _t,gt=!1,yt=!1,vt=-1;const wt=new WeakMap;function bt(t={}){yt=!!t.enabled,vt="number"==typeof t.threshold?t.threshold:yt?200:-1,_t=yt&&vt>0?new Z(vt,t.name??"reactivity-core"):void 0}function St(t,e){if(!N)return;const s=L(t),i=ft[ft.length-1];if(!i||!i.active)return;let n=pt.get(s);n||pt.set(s,n=new Map);let o=n.get(e);if(o||n.set(e,o=new Set),!o.has(i)&&(o.add(i),i.deps.push([s,e]),yt&&_t&&vt>0))try{const t=_t.check(o.size);if(t){let e=wt.get(o);e||(e=new Map,wt.set(o,e)),e.set(i,t)}}catch{}}function Mt(t,e){const s=L(t),i=pt.get(s);if(!i)return;const n=i.get(e);if(!n)return;let o=!1;n.forEach(t=>{t.active&&(t.scheduler?Ct(t.scheduler):(mt.add(t),o=!0))}),o&&function(){if(gt)return;gt=!0,Promise.resolve().then(()=>{const t=new Map;try{for(;mt.size>0;){const e=Array.from(mt);mt.clear();for(const s of e){const e=(t.get(s)??0)+1;t.set(s,e),e>kt?e===kt+1&&k("MJX203",[kt],{fn:String(s.fn).slice(0,200)}):Ct(()=>s.run())}}}finally{mt.clear(),gt=!1}})}()}function Ct(t){try{t()}catch(t){M("MJX208",t)}}const kt=50;function Dt(t){for(const[e,s]of t.deps){const i=pt.get(e);if(!i)continue;const n=i.get(s);if(n){n.delete(t);try{const e=wt.get(n),s=e?.get(t);if(s){try{s()}catch{}e.delete(t)}}catch{}0===n.size&&i.delete(s),0===i.size&&pt.delete(e)}}t.deps=[]}function At(t,e){const s=new dt(t,e);return Ct(()=>s.run()),()=>s.stop()}function xt(t){if(!t.pushed)return;t.pushed=!1;const e=ft.lastIndexOf(t.effect);e>=0&&ft.splice(e,1)}const Et={capture:()=>({effect:ft[ft.length-1],pushed:!1}),suspend:(t,e)=>(xt(t),e),resume:(t,e)=>(t.effect&&t.effect.active&&!t.pushed&&(ft.push(t.effect),t.pushed=!0),e),end(t){xt(t)}},Tt=new dt(()=>{});function Ot(t){ft.push(Tt);try{return t()}finally{ft.pop()}}function Nt(t){if(!t||"INPUT"!==t.tagName)return!1;const e=String(t.type||"").toLowerCase();return"checkbox"===e||"radio"===e}function Pt(t){if(t){if(Nt(t))return!!t.checked;if(function(t){if(!t||"INPUT"!==t.tagName)return!1;const e=String(t.type||"").toLowerCase();return"number"===e||"range"===e}(t)){const e=t.value;if(""===e||null==e)return null;const s="number"==typeof t.valueAsNumber?t.valueAsNumber:Number(e);return Number.isFinite(s)?s:null}return t.value}}Tt.active=!1;class Lt{constructor(t,e,s,i,n,o){this.updateMode="onPropertyChanged",this._isActive=!1,this._memberPath=null,this._component=t,this.propertyName=e,this.dataSource=s,this.dataMember=i,this.formatString=n,this.formatInfo=o,this._memberPath=i?i.split("."):null,this._memberPathSource=i}activate(){this._isActive||(this._isActive=!0,this._setupBinding())}deactivate(){this._isActive&&(this._isActive=!1,this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=void 0))}reActivate(){this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=void 0),this._setupBinding()}functional(t){return"function"==typeof t&&(t=this.functional(t())),t}_setupBinding(){const t=()=>{let t=this.dataSource;if(this.dataMember){this._memberPathSource!==this.dataMember&&(this._memberPath=this.dataMember.split("."),this._memberPathSource=this.dataMember);for(const e of this._memberPath)null!=t&&(t=t[e])}return t=this.functional(t),this.formatString&&null!=t&&(t=this._applyFormat(t,this.formatString)),this.converter&&(t=this.converter(t)),t},e=()=>{const e=t();return this._updateComponentProperty(e),e};this._effectCleanup=At(()=>e())}_updateComponentProperty(t){switch(this.propertyName.toLowerCase()){case"wait":{const e=this._component;if(!e||e.isDisposed)return;const s=!!t;e.isBuilt?e.isWait=!!s:e.isWait=s;break}case"display":{const e=this._component;if(!e||e.isDisposed)return;const s=t;e.isBuilt,e.isWait=!s;break}case"text":case"textcontent":this._component.setText(t);break;case"innerhtml":case"html":this._component.element.innerHTML=t,this._component.motif.trigger("htmlChanged",{value:t});break;case"visible":case"visibility":t?this._component.motif.show():this._component.motif.hide();break;case"style":"object"==typeof t&&this._component.style(t);break;case"model":{const e=this._component.element;if(!e)break;Nt(e)?e.checked=!!t:e.value=null==t?"":t;break}case"when":break;default:this._component.element&&this.propertyName in this._component.element?this._component.element[this.propertyName]=t:this.propertyName in this._component&&(this._component[this.propertyName]=t)}}_applyFormat(t,e){const s=this.formatInfo?.locale,i=this.formatInfo?.currency;if("number"==typeof t){if(e.includes("C")||e.includes("c"))return i?new Intl.NumberFormat(s,{style:"currency",currency:i}).format(t):new Intl.NumberFormat(s,{minimumFractionDigits:2,maximumFractionDigits:2}).format(t);if(e.includes("P")||e.includes("p"))return new Intl.NumberFormat(s,{style:"percent"}).format(t);if(e.includes("N")||e.includes("n")){const i=parseInt(e.match(/\d+/)?.[0]||"2");return new Intl.NumberFormat(s,{minimumFractionDigits:i,maximumFractionDigits:i}).format(t)}}if(t instanceof Date){if(e.includes("d"))return t.toLocaleDateString(s);if(e.includes("t"))return t.toLocaleTimeString(s)}return t?.toString()||""}}const Xt=T.RAW;function Rt(t,e,s){let i=Object.getPrototypeOf(t);for(;i&&i!==e;){if(Object.prototype.hasOwnProperty.call(i,s))return!0;i=Object.getPrototypeOf(i)}return!1}function It(t,e){for(const s of e){let e=t[s];"function"==typeof e&&Object.defineProperty(t,s,{configurable:!0,enumerable:!1,get(){if(this===t||(i=this,Object.prototype.hasOwnProperty.call(i,"constructor")&&"function"==typeof i.constructor&&i.constructor.prototype===i))return e;var i;const n=this[Xt]??this,o=e.bind(n);if(!Rt(n,t,s))try{Object.defineProperty(n,s,{value:o,writable:!0,configurable:!0,enumerable:!0})}catch{}return o},set(i){this!==t||"function"!=typeof i?Object.defineProperty(this,s,{value:i,writable:!0,configurable:!0,enumerable:!0}):e=i}})}}function Jt(t){return"function"==typeof t?Jt(t()):t}function jt(t,e){return"__proto__"!==e&&("constructor"!==e&&"prototype"!==e||Object.prototype.hasOwnProperty.call(t,e))}class Ft{constructor(t){this._items=[],this._branchScope=null,this._component=t}_own(t){this._branchScope?this._branchScope.push(t):this._component.motif.register(K(()=>{try{t()}catch{}}))}when(t,e){var s=new hn;this._component.controls.add(s);let i,n=!1;const o=At(t,t=>{n&&(Object.is(i,t)||!i&&!t)||(n=!0,i=t,Ot(()=>{t?s.navigate(e(t)):s.navigate(zi())}))});return this._own(o),null}get items(){return[...this._items]}text(t){this.add("textContent",t)}value(t){this.add("value",t)}add(...t){let e;if(1===t.length&&"object"==typeof t[0]&&"propertyName"in t[0])e=t[0];else{const[s,i,n,o,r]=t;e=new Lt(this._component,s,i,n,o,r)}return this._items.push(e),this._component.isBuilt&&e.activate(),e}wait(t){const e=new Lt(this._component,"isWait",t);return this._items.push(e),this._component.isBuilt&&e.activate(),e}display(t){const e=new Lt(this._component,"isWait",()=>!Jt(t()));return this._items.push(e),this._component.isBuilt&&e.activate(),e}html(t){const e=new Lt(this._component,"innerHTML",t);return this._items.push(e),this._component.isBuilt&&e.activate(),e}list(t,e,s){const i=new U(this._component,t,e,s);return this._items.push(i),this._component.isBuilt&&i.activate(),i}loop(t,e,s){const i=new U(this._component,t,e,s);return this._items.push(i),this._component.isBuilt&&i.activate(),i}method(t){const e=this._component;let s=null,i=null;const n=(t,s)=>{s?(e.controls.insert(e.controls.items.indexOf(s),t),e.controls.remove(s)):e.controls.add(t)},o=At(t,t=>{if(e.isDisposed)return;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"bigint"==typeof t||s&&null==t)return s?void s.setText(t):(s=new Oi(qi.createTextNode(t)),n(s,i),void(i=null));i||(i=new hn,n(i,s),s=null),i.navigate(null==t?zi():t)});e.motif.register(K(()=>{try{o()}catch{}}))}ternary(t,e,s){const i=new hn;return this._component.controls.add(i),this._ternaryCallTop(t,()=>{e(i)},()=>{s(i)}),null}_ternarySchedule(t,e,s,i){let n,o=!0,r=!1,a=[];const c=()=>{const t=a;a=[];for(const e of t)try{e()}catch{}},l=At(t,t=>{if(!o&&Object.is(n,t))return;n=t;const l=()=>{c();const i=this._branchScope;this._branchScope=a;try{t?e():s()}finally{this._branchScope=i}};if(o)return o=!1,void Ot(l);i(()=>{r||this._component.isDisposed||l()})});this._own(()=>{r=!0,l(),c()})}ternaryCall(t,e,s){this._ternarySchedule(t,e,s,t=>queueMicrotask(t))}_ternaryCallTop(t,e,s){this._ternarySchedule(t,e,s,t=>setTimeout(t,0))}watch(t){const e=At(()=>{t()});this._component.motif.register(K(()=>{try{e()}catch{}}))}remove(t){const e=this._items.indexOf(t);e>-1&&(this._items.splice(e,1),t.deactivate())}clear(){this._items.forEach(t=>t.deactivate()),this._items=[]}activateAll(){this._items.forEach(t=>{t.activate()})}model(...t){var e="";this._component.element&&(e=this._component.element.tagName);var s="value";switch(e.toLowerCase()){case"input":s="model";break;case"select":case"textarea":s="value";break;case"img":case"audio":case"video":s="src"}let i;if(1===t.length&&"object"==typeof t[0])i=t[0];else if("function"==typeof t[0]&&"function"==typeof t[1])i=new Lt(this._component,s,t[0]),i.setter=t[1];else{const[e,n,o,r]=t;i=new Lt(this._component,s,e,n,o,r)}const n=t=>{let e=t;const s=i;if("function"==typeof s.converterBack&&(e=s.converterBack(e)),"function"==typeof s.setter)return void s.setter(e);const n=s.dataMember,o=s.dataSource;if(n&&null!=o){const t=n.split(".");let s=o;for(let i=0;i<t.length&&null!=s;i++){const n=t[i];if(!jt(s,n))return;i===t.length-1?s[n]=e:s=s[n]}}else null!=o&&"object"==typeof o&&"value"in o&&(o.value=e)};(this._modelWriters??=new WeakMap).set(i,n);const o=e.toLowerCase();if("input"===o||"select"===o||"textarea"===o){const t=()=>{try{const t=this._component.element;if(!t)return;n(Pt(t))}catch{}};this._component.motif.on("input",t),this._component.motif.on("change",t)}return this._items.push(i),this._component.isBuilt&&i.activate(),i}writeModel(t){const e=this._modelWriters;if(!e)return!1;let s=!1;for(const i of this._items){const n=e.get(i);if(n)try{n(t),s=!0}catch{}}return s}deactivateAll(){this._items.forEach(t=>t.deactivate()),this._items=[]}reActivateAll(){for(const t of[...this._items])if("function"==typeof t.reActivate)try{t.reActivate()}catch(t){M("MJX208",t)}}switchCase(t,e,s){const i=new hn;var n;this._component.controls.add(i);var o=!1;const r=At(t,t=>{if(n==t)return;n=t;const r=String(t);if(Object.prototype.hasOwnProperty.call(e,r))e[r](i),o=!1;else if(s){if(o)return;o=!0,s(i)}else{if(o)return;o=!0,i.navigate(zi())}});return this._component.motif.register(K(()=>{try{r()}catch{}})),null}}It(Ft.prototype,["add","remove","clear","activateAll","deactivateAll","reActivateAll","when","text","value","list","loop","method","watch","display","wait","ternaryCall","_ternaryCallTop"]);class Ht{constructor(){this._subscriptions=[],this._disposed=!1}get event(){return this._subscribe||(this._subscribe=(t,e,s)=>{if(this._disposed)return{dispose(){}};const i={handler:e?t.bind(e):t,active:!0};this._writable().push(i);const n={dispose:()=>this._unsubscribe(i)};return s instanceof A?s.add(n):Array.isArray(s)&&s.push(n),n}),this._subscribe}fire(t){this._resume(),0!==this._subscriptions.length&&(this._delivery={targets:this._subscriptions,value:t,next:0},this._resume())}dispose(){if(!this._disposed){this._disposed=!0;for(const t of this._subscriptions)t.active=!1;this._subscriptions=[],this._delivery=void 0}}_writable(){return this._delivery&&this._delivery.targets===this._subscriptions&&(this._subscriptions=this._subscriptions.slice()),this._subscriptions}_unsubscribe(t){if(!t.active)return;t.active=!1;const e=this._writable(),s=e.indexOf(t);-1!==s&&e.splice(s,1)}_resume(){const t=this._delivery;if(t){for(;t.next<t.targets.length;){const e=t.targets[t.next++];if(e.active)try{e.handler(t.value)}catch(t){s.onUnexpectedError(t)}}this._delivery===t&&(this._delivery=void 0)}}}class Bt{constructor(t){this.component=t}hasListeners(t){return void 0!==this._emitters&&this._emitters.has(t)}fire(t,e){try{const s=this._emitters?.get(t.toLowerCase());s&&s.fire(e)}catch{}}on(t,e){try{this.createEvent(t,e)}catch{}}off(t,e){const s=String(t).toLowerCase(),i=this._listenerDisposables?.get(s);if(!i)return this;const n=i.get(e);return i.delete(e),n?.forEach(t=>{try{t.dispose()}catch{}}),this}getOrCreateEmitter(t){const e=this._emitters??=new Map;let s=e.get(t);return s||(s=new Ht,e.set(t,s)),s}createEvent(t,e){const s=String(t).toLowerCase(),i=s.startsWith("on")?"x:"+s.slice(2):s,n=t=>{let s;return C(()=>(s=e.length<=1?e(t):e(this.component,t),s),"MJX122",i),s},o=this.getOrCreateEmitter(s).event(t=>n(t)),r=this._listenerDisposables??=new Map;let a=r.get(s);a||(a=new Map,r.set(s,a));const c=a.get(e);return c?c.push(o):a.set(e,[o]),this}addSource(t,e){const s=String(t).toLowerCase(),i=this.getOrCreateEmitter(s),n=t=>t(t=>i.fire(t));let o;try{o=n(e instanceof Ht?e.event:e)}catch{}if(o){const t=this._sourceDisposables??=new Map;let e=t.get(s);e||(e=new Set,t.set(s,e)),e.add(o),this.component.motif.register(D.toDisposable(()=>{try{o?.dispose()}catch{}try{e?.delete(o)}catch{}}))}return this}clear(t){if(t){const e=t.toLowerCase(),s=this._sourceDisposables?.get(e);s?.forEach(t=>{try{t.dispose()}catch{}}),this._sourceDisposables?.delete(e);const i=this._emitters?.get(e);try{i?.dispose()}catch{}this._emitters?.delete(e),this._listenerDisposables?.delete(e)}else if(this._emitters)for(const t of Array.from(this._emitters.keys()))this.clear(t);return this}}It(Bt.prototype,["fire","on","off","createEvent","getOrCreateEmitter","addSource","clear"]);const zt=new Set(["focus","blur","click","pause","submit","reset","scrollTo","scrollBy","select","scrollIntoView","requestFullscreen","exitFullscreen","requestPointerLock","exitPointerLock","play","requestPictureInPicture","exitPictureInPicture","show","showModal","close","showPopover","hidePopover","togglePopover","requestSubmit","checkValidity","reportValidity","showPicker","load","setSelectionRange","setRangeText","setPointerCapture","releasePointerCapture","fastSeek"]),Vt={show:"close",showModal:"close",showPopover:"hidePopover"},Wt=new Set(["close","hidePopover","requestSubmit","checkValidity","reportValidity","showPicker","load"]),$t=new Set(["setSelectionRange","setRangeText","setPointerCapture","releasePointerCapture","fastSeek"]),Ut=new Set(["checked","selected","muted","indeterminate","srcObject"]);class qt{constructor(t){this._parent=t}get _attrMap(){return this._attrMapStore??=new Map}get _watchers(){return this._watchersStore??=new Map}get attributes(){return Array.from(this._attrMap.entries(),([t,e])=>({name:String(t),value:e}))}add(t){if(null!==t&&"object"==typeof t&&!Array.isArray(t)){const e=t;Reflect.ownKeys(e).forEach(t=>{this.parse(e[t],t)})}return this._parent}remove(t){const e=this._watchers.get(t);if(e){try{e.stop()}catch{}try{e.binding&&this._parent.bindings.remove(e.binding)}catch{}this._watchers.delete(t)}this._attrMap.delete(t);const s=this._getElement();if(s)try{s.removeAttribute(t)}catch{}return this._parent}has(t){return(this._parent.element instanceof HTMLElement||this._parent.element instanceof Element)&&this._parent.element.hasAttribute(t)}get(t){const e=this._getElement();if(e){const s=e.getAttribute(t);if(null!=s)return s}const s=this._attrMap.get(t);return null==s?null:String(s)}parse(t,e){if("function"==typeof t){const s=this._watchers.get(e);if(s){try{s.stop()}catch{}try{s.binding&&this._parent.bindings.remove(s.binding)}catch{}this._watchers.delete(e)}const i=()=>At(()=>{const s=t();this._applyValue(e,s)});let n=i();const o=()=>{try{n()}catch{}},r={propertyName:`__attr:${String(e)}`,dataSource:null,activate(){},deactivate(){o()},reActivate(){o(),n=i()}};try{this._parent.bindings.add(r)}catch{}this._watchers.set(e,{stop:o,binding:r})}else this._applyValue(e,t)}_applyValue(t,e){if(!t)return;const s=this._getElement();try{"function"==typeof e&&"function"==typeof(e=e())&&(e=e())}catch{}if(s&&"string"==typeof t&&zt.has(t)){const i=t,n=s[i];if("function"==typeof n){const o=(t,e)=>{try{Array.isArray(e)?t.apply(s,e):void 0===e?t.call(s):t.call(s,e)}catch{}},r=t=>{try{queueMicrotask(t)}catch{try{setTimeout(t,0)}catch{}}},a=()=>{this._attrMap.set(t,e)};if("focus"===i){return r(()=>{if(!1===e){const t=s.blur;"function"==typeof t&&o(t)}else!0===e?o(n):("object"==typeof e&&null!=e&&!0!==e||Array.isArray(e),o(n,e))}),void a()}if("blur"===i||"click"===i||"pause"===i||"submit"===i||"reset"===i){return r(()=>{e&&o(n)}),void a()}if("scrollTo"===i||"scrollBy"===i){return r(()=>{(Array.isArray(e)||e&&"object"==typeof e)&&o(n,e)}),void a()}if("select"===i){return r(()=>{if(e)o(n);else{const t=s;if("function"==typeof t.setSelectionRange)try{t.setSelectionRange(0,0)}catch{}}}),void a()}if("scrollIntoView"===i){return r(()=>{!0===e||null==e?o(n):o(n,e)}),void a()}if("requestFullscreen"===i){return r(()=>{if(e)o(n);else try{const t=document;t&&t.fullscreenElement===s&&"function"==typeof t.exitFullscreen&&t.exitFullscreen()}catch{}}),void a()}if("exitFullscreen"===i){return r(()=>{if(e)try{const t=document;t&&"function"==typeof t.exitFullscreen&&t.exitFullscreen()}catch{}}),void a()}if("requestPointerLock"===i){return r(()=>{if(e)o(n);else try{const t=document;t&&"function"==typeof t.exitPointerLock&&t.exitPointerLock()}catch{}}),void a()}if("exitPointerLock"===i){return r(()=>{if(e)try{const t=document;t&&"function"==typeof t.exitPointerLock&&t.exitPointerLock()}catch{}}),void a()}if("play"===i){return r(()=>{if(e)try{const t=n.call(s);t&&"function"==typeof t.then&&t.catch(()=>{})}catch{}else{const t=s.pause;"function"==typeof t&&o(t)}}),void a()}if("requestPictureInPicture"===i){return r(()=>{if(e)try{const t=n.call(s);t&&"function"==typeof t.then&&t.catch(()=>{})}catch{}}),void a()}if("exitPictureInPicture"===i){return r(()=>{if(e)try{const t=document;if(t&&"function"==typeof t.exitPictureInPicture){const e=t.exitPictureInPicture();e&&"function"==typeof e.then&&e.catch(()=>{})}}catch{}}),void a()}if(i in Vt){return r(()=>{if(!1===e){const t=s[Vt[i]];"function"==typeof t&&o(t)}else e&&o(n)}),void a()}if("togglePopover"===i){return r(()=>{if("boolean"==typeof e)try{n.call(s,e)}catch{}else e&&o(n)}),void a()}if(Wt.has(i)){return r(()=>{!0===e?o(n):e&&o(n,e)}),void a()}if($t.has(i)){return r(()=>{null!=e&&!1!==e&&o(n,e)}),void a()}return null==e||!1===e?void this._attrMap.delete(t):void a()}}if("string"==typeof t&&Ut.has(t)){const i=this._parent.element??s;if(i)try{"srcObject"===t?i.srcObject=e??null:i[t]=!!e}catch{}return void(null==e||!1===e?this._attrMap.delete(t):this._attrMap.set(t,e))}if("boolean"==typeof e&&"string"==typeof t&&(t.startsWith("aria-")||t.startsWith("data-"))){if(s)try{s.setAttribute(t,String(e))}catch{}return void this._attrMap.set(t,e)}const i="boolean"==typeof e;if(null==e||!1===e){if(s)try{s.removeAttribute(String(t))}catch{}this._attrMap.delete(t)}else{if("value"===t)try{const t=this._parent.element,s=String(e);t.value!==s&&(t.value=s)}catch{}else if("textContent"===t||"innerText"===t||"innerHTML"===t){if(si(e))return void this._parent.setText(e);try{this._parent.element[t]=e}catch{}}else if(s)try{i&&!0===e?s.setAttribute(String(t),""):s.setAttribute(String(t),e)}catch{}this._attrMap.set(t,e)}}_getElement(){const t=this._parent?.element;return t instanceof HTMLElement||t instanceof Element?t:null}hasMethodState(t){return!(!this._getElement()||!t)&&!!this.getMethodState(t)}getMethodState(t){const e=this._getElement();if(!e||!t)return!1;switch(String(t)){case"focus":case"blur":try{return(document&&document.activeElement)===e}catch{return!1}case"select":{const t=e;if("number"==typeof t.selectionStart&&"number"==typeof t.selectionEnd)try{return t.selectionEnd-t.selectionStart>0}catch{return!1}return!1}default:return!1}}}class Gt{constructor(t){this._watcherSeq=0,this._parent=t}get _counts(){return this._countsStore??=new Map}get _staticSet(){return this._staticSetStore??=new Set}get _watchers(){return this._watchersStore??=new Map}add(...t){for(const e of t)"function"==typeof e?this._addReactive(e):Array.isArray(e)?this._addStaticFromArray(e):e&&"object"==typeof e?this._addStaticFromObject(e):this._addStaticNames(this._splitClasses(String(e??"")));return this._parent}remove(t){const e=this._getElement();if(Array.isArray(t)){const s=new Set(this._staticSet);for(const e of t)for(const t of this._splitClasses(String(e)))this._staticSet.delete(t);this._applySourceDiff("static",s,new Set(this._staticSet),e)}else if("**"===t){for(const[t,s]of Array.from(this._watchers.entries())){const i=new Set(s.set);this._applySourceDiff(t,i,new Set,e);try{s.binding&&this._parent.bindings.remove(s.binding)}catch{}try{s.stop()}catch{}this._watchers.delete(t)}const t=new Set(this._staticSet);if(this._staticSet.clear(),this._applySourceDiff("static",t,new Set,e),e)try{e.removeAttribute("class")}catch{}this._counts.clear()}else{const s=new Set(this._staticSet);for(const e of this._splitClasses(String(t)))this._staticSet.delete(e);this._applySourceDiff("static",s,new Set(this._staticSet),e)}return this._parent}has(t){const e=this._getElement(),s=String(t??"").trim();return!!s&&!(!e||!e.classList.contains(s))}_getElement(){const t=this._parent?.element;return t instanceof Element?t:null}_splitClasses(t){return t?/\s/.test(t)?t.split(/\s+/).filter(t=>t.length>0):[t]:[]}_normalizeToSet(t,e){const s=new Set;if(null==t)return s;if("string"==typeof t)for(const e of this._splitClasses(t))s.add(e);else if(Array.isArray(t)){for(const i of t)if(null!=i)if("string"==typeof i)for(const t of this._splitClasses(i))s.add(t);else if(Array.isArray(i))for(const t of this._normalizeToSet(i))s.add(t);else if("object"==typeof i){const t=i;for(const e of Object.keys(t)){if(t[e])for(const t of this._splitClasses(String(e)))s.add(t)}}else if("boolean"==typeof i){if(e&&i)for(const t of this._splitClasses(String(e)))s.add(t)}else for(const t of this._splitClasses(String(i)))s.add(t)}else if("object"==typeof t){const e=t;for(const t of Object.keys(e)){if(e[t])for(const e of this._splitClasses(String(t)))s.add(e)}}else if("boolean"==typeof t){if(e&&t)for(const t of this._splitClasses(String(e)))s.add(t)}else for(const e of this._splitClasses(String(t)))s.add(e);return s}_applySourceDiff(t,e,s,i){for(const t of e)if(!s.has(t)){const e=(this._counts.get(t)||0)-1;if(e<=0){if(this._counts.delete(t),i)try{i.classList.remove(t)}catch{}}else this._counts.set(t,e)}for(const t of s)if(!e.has(t)){const e=this._counts.get(t)||0,s=e+1;if(this._counts.set(t,s),0===e&&i)try{i.classList.add(t)}catch{}}}_addStaticNames(t){if(0===t.length)return;const e=this._getElement(),s=this._staticSet,i=e&&!e.hasAttribute("class")?[]:null;for(const n of t){if(s.has(n))continue;s.add(n);const t=this._counts.get(n)||0;if(this._counts.set(n,t+1),0===t&&e)if(i)i.push(n);else try{e.classList.add(n)}catch{}}i&&i.length>0&&e.setAttribute("class",i.join(" "))}_addStaticFromArray(t){const e=this._getElement(),s=new Set(this._staticSet);for(const e of t)if(null!=e)if("string"==typeof e)for(const t of this._splitClasses(e))this._staticSet.add(t);else if(Array.isArray(e)){const t=this._normalizeToSet(e);for(const e of t)this._staticSet.add(e)}else if("object"==typeof e){const t=e;for(const e of Object.keys(t)){const s=t[e];if("function"==typeof s){const s=this._splitClasses(String(e));for(const i of s)this._addReactive(t[e],i)}else{const t=this._splitClasses(String(e));if(s)for(const e of t)this._staticSet.add(e);else for(const e of t)this._staticSet.delete(e)}}}else{if("boolean"==typeof e)continue;if("function"==typeof e)this._addReactive(e);else for(const t of this._splitClasses(String(e)))this._staticSet.add(t)}this._applySourceDiff("static",s,new Set(this._staticSet),e)}_addStaticFromObject(t){const e=this._getElement(),s=new Set(this._staticSet);for(const e of Object.keys(t)){const s=t[e],i=this._splitClasses(String(e));if(s)for(const t of i)this._staticSet.add(t);else for(const t of i)this._staticSet.delete(t)}this._applySourceDiff("static",s,new Set(this._staticSet),e)}_addReactive(t,e){const s="fx#"+ ++this._watcherSeq,i={stop:()=>{},binding:void 0,set:new Set},n=this._getElement(),o=()=>At(()=>{let o;try{const s=t();o=this._normalizeToSet(s,e)}catch{o=new Set}const r=new Set(i.set);this._applySourceDiff(s,r,o,n),i.set=o});let r=o();const a=()=>{try{r()}catch{}},c={propertyName:`__class:${s}`,dataSource:null,activate(){},deactivate:()=>{a();const t=this._getElement(),e=new Set(i.set);this._applySourceDiff(s,e,new Set,t),i.set.clear()},reActivate:()=>{a(),r=o()}};try{this._parent.bindings.add(c)}catch{}i.stop=a,i.binding=c,this._watchers.set(s,i)}}const Kt={cancel(){},addEventListener(){},removeEventListener(){},oncancel:null,playState:"finished"};function Yt(t){const e=t.substring(0,Math.max(0,t.length-1)).replace(",",".");return 1e3*Number(e)}function Qt(t,e){const s=s=>(t[`${e}-${s}`]||"").split(", "),i=s("delay"),n=s("duration");let o=-1/0;for(let t=0;t<n.length;t++){const e=Yt(n[t])+Yt(i[t%i.length]);o=Math.max(o,e)}return{kind:e,longest:o,tracks:n.length}}const Zt=/(?:^|\W)(?:transform|all)(?:,|$)/;function te(t,e){if(!t)return{type:"animation",timeout:0,propCount:0,hasTransform:!1};const s={transition:Qt(t,"transition"),animation:Qt(t,"animation")};let i,n;if("transition"===e||"animation"===e){const t=s[e];i=t.longest>0?t:null,n=i?i.longest:0}else{const{transition:t,animation:e}=s;n=Math.max(t.longest,e.longest),i=n>0?t.longest>e.longest?t:e:null}const o=i?i.kind:null;return{type:o,timeout:n,propCount:i?i.tracks:0,hasTransform:"transition"===o&&Zt.test(t.transitionProperty)}}function ee(t,e,s){if(t.isConnected&&8!==t.nodeType)return te(qi.window.getComputedStyle(t),s);const i=qi.createElement("div");i.setAttribute("style","width:0!important;height:0!important;display:none"),qi.body.appendChild(i),i.setAttribute("class",e);try{return te(qi.window.getComputedStyle(i),s)}finally{i.remove()}}function se(t,e,s,i,n=!1){if(!1===e.css)return i(),()=>{};const o=function(t,e,s=!1){const i=t.name||"motif";if("enter"===e){const e={from:t.enterFromClass??`${i}-enter-from`,active:t.enterActiveClass??`${i}-enter-active`,to:t.enterToClass??`${i}-enter-to`};return s?{from:t.appearFromClass??e.from,active:t.appearActiveClass??e.active,to:t.appearToClass??e.to}:e}return{from:t.leaveFromClass??`${i}-leave-from`,active:t.leaveActiveClass??`${i}-leave-active`,to:t.leaveToClass??`${i}-leave-to`}}(e,s,n),r=e=>{e&&e.split(/\s+/).forEach(e=>{if(e)try{t.classList.add(e)}catch{}})},a=e=>{e&&e.split(/\s+/).forEach(e=>{if(e)try{t.classList.remove(e)}catch{}})};let c,l=!1,h=null,u=null;const d=()=>{if(!l){l=!0,(()=>{if(a(o.from),a(o.to),a(o.active),void 0!==c){try{clearTimeout(c)}catch{}c=void 0}if(h&&u){try{t.removeEventListener(h,u)}catch{}u=null}})();try{i()}catch{}}};r(o.from),r(o.active);try{t.offsetHeight}catch{}return(t=>{const e=globalThis.requestAnimationFrame;"function"==typeof e?e(()=>t()):setTimeout(t,16)})(()=>{if(l)return;a(o.from),r(o.to);let i=0,n=1;const p=e.duration;if("number"==typeof p)i=p,h="animation"===e.type?"animationend":"transitionend";else if(p&&"object"==typeof p)i=("enter"===s?p.enter:p.leave)??0,h="animation"===e.type?"animationend":"transitionend";else{const s=function(t,e){return te(qi.window.getComputedStyle(t),e)}(t,e.type);i=s.timeout,n=s.propCount||1,h="animation"===s.type?"animationend":"transitionend"}if(!i||i<=0)return void d();let f=0;u=e=>{e&&e.target!==t||++f>=n&&d()};try{t.addEventListener(h,u)}catch{}c=setTimeout(d,i+60)}),d}class ie{constructor(t,e){this._component=t,this.options=e}show(){return this._component._show()}hide(){return this._component._hide()}toggle(){this._component._toggle()}on(t,e,s=!0){return this._component._on(t,e,s)}off(t,e){return this._component._off(t,e)}trigger(t,e){return this._component._trigger(t,e)}addHandler(t,e){this._component._addHandler(t,e)}clear(){return this._component._clear()}register(t){this._component._register(t)}setDisposable(t){this._component._register(D.toDisposable(t))}stopAnimations(){return this._component._stopAnimations()}}const ne=Symbol("SignalTarget"),oe=Symbol("SignalKey");class re{static create(t,e){return new re(t,e)}constructor(t,e=Object.is){this._disposed=!1,this._value=t,this._target={[ne]:!0},this._key=oe,this._equals=e}get value(){return this._disposed||St(this._target,this._key),this._value}set value(t){this._disposed||this._equals(this._value,t)||(this._value=t,Mt(this._target,this._key))}peek(){return this._value}update(t){this.value=t(this._value)}mutate(t){this._disposed||(t(this._value),Mt(this._target,this._key))}notify(){this._disposed||Mt(this._target,this._key)}asReadonly(){const t=this;return{get value(){return t.value},peek:()=>t.peek(),valueOf:()=>t.valueOf(),toString:()=>t.toString()}}dispose(){this._disposed=!0}valueOf(){return this.value}toString(){return String(this.value)}}class ae{constructor(t){this._dirty=!0,this._computing=!1,this._getter=t,this._target={[ne]:!0},this._key=oe,this._cleanup=At(()=>{if(!this._computing){this._computing=!0;try{const t=this._getter(),e=this._dirty||!Object.is(this._value,t);this._value=t,this._dirty=!1,e&&Mt(this._target,this._key)}finally{this._computing=!1}}})}get value(){if(St(this._target,this._key),this._dirty){this._computing=!0,V();try{this._value=this._getter(),this._dirty=!1}finally{W(),this._computing=!1}}return this._value}peek(){if(this._dirty){V();try{this._value=this._getter(),this._dirty=!1}finally{W()}}return this._value}dispose(){this._cleanup&&(this._cleanup(),this._cleanup=void 0)}valueOf(){return this.value}toString(){return String(this.value)}}class ce{constructor(t){this._dirty=!0,this._disposed=!1,this._getter=t,this._target={[ne]:!0},this._key=oe,this._runner=function(t,e){const s=new dt(t);return s.scheduler=e,{run:()=>{Ct(()=>s.run())},stop:()=>s.stop()}}(()=>{this._value=this._getter()},()=>{this._dirty||this._disposed||(this._dirty=!0,Mt(this._target,this._key))})}get value(){return this._disposed||St(this._target,this._key),this._refresh(),this._value}peek(){return this._refresh(),this._value}get isDirty(){return this._dirty}_refresh(){this._dirty&&(this._disposed?this._value=Ot(this._getter):this._runner.run(),this._dirty=!1)}dispose(){this._disposed||(this._disposed=!0,this._runner.stop())}valueOf(){return this.value}toString(){return String(this.value)}}let le=null,he=null,ue=null,de=null,pe=null;const fe=new WeakMap,me=new WeakMap,_e=new WeakMap,ge=new WeakMap,ye=new WeakMap;function ve(t,e){const s=le;le=t;try{return e()}finally{le=s}}function we(t,e,s){const i=he,n=ue;he=t,ue=e;try{return s()}finally{he=i,ue=n}}function be(t){let e=t;for(;e;){const t=_e.get(e);if(t)return t.scope;const s=ge.get(e);if(s&&s._pending)return s;e=e.parent}return null}function Se(t){if(!le)throw S("MJX409",function(t){return"function"==typeof t?t.name||"[AnonymousClass]":String(t)}(t));return le(t)}function Me(t){de&&de._pending&&ge.set(t,de)}function Ce(t){const e=pe;if(!e)return;if(_e.get(t)?.live)return;const s=be(t)??e._currentScope();_e.set(t,{scope:s,live:!0}),s._livePins++}function ke(t){const e=_e.get(t);e?e.live&&(e.live=!1,e.scope._releaseLivePin()):pe&&fe.has(t)&&_e.set(t,{scope:be(t)??pe._currentScope(),live:!1})}class De{constructor(t,e,s){this.services=t,this.scopedCache=new Map,this.transientSet=new Set,this._autoDisposeTransients=!1,this.pendingScoped=new Map,this._ownerlessSlot={owner:null,ownerless:!0},this._navigationDisposed=!1,this._livePins=0,this._pending=!1,this.describeToken=t=>"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t?t.name||"[AnonymousClass]":String(t),this.parent=e,this.root=s??this,this.kind=this.root===this?"root":"user",this.singletonCache=this.root===this?new Map:this.root.singletonCache,this.pendingSingleton=this.root===this?new Map:this.root.pendingSingleton}createScope(t){const e=new De(this.services,this,this.root);return e.scopeName=t??this.scopeName,e._autoDisposeTransients=this._autoDisposeTransients,e}enableAutoDisposeTransients(t=!0){return this._autoDisposeTransients=t,this}get(t){const e=this.services.getDescriptor(t);if(!e)throw S("MJX401",this.describeToken(t));return this.resolveDescriptorSync(e,[t])}async getAsync(t){const e=this.services.getDescriptor(t);if(!e)throw S("MJX401",this.describeToken(t));return await this.resolveDescriptorAsync(e,[t])}_getFor(t,e){let s=fe.get(t);return s||(s={owner:t},fe.set(t,s)),we(s,ue,()=>this.get(e))}getAllServices(){return this.services}_beginNavigation(){const t=this.root,e=t._navigation??={current:t,version:new re(0),scopes:new Set};pe=t;const s=new De(this.services,t,t);return s.kind="navigation",s.scopeName="navigation",s._pending=!0,s._autoDisposeTransients=t._autoDisposeTransients,e.scopes.add(s),s}_commitNavigation(t){const e=this.root._navigation;if(!e||e.current===t)return;t._pending=!1;const s=e.current;e.current=t,this._touch(),s!==this.root&&s._releaseIfUnused()}_abandonNavigation(t){t._pending=!1,t._releaseIfUnused()}_currentScope(){return this.root._navigation?.current??this.root}_touch(){const t=this.root._navigation;t&&(t.version.value=t.version.peek()+1)}_releaseLivePin(){this._livePins--,this._releaseIfUnused()}_releaseIfUnused(){const t=this.root._navigation;"navigation"!==this.kind||this._navigationDisposed||this._livePins>0||t&&t.current===this||(this._navigationDisposed=!0,t?.scopes.delete(this),this.dispose().catch(()=>{}))}_scopeFor(t){const e=this._navigation;if(e&&e.version.value,!t.ownerless){const e=be(t.owner);if(e)return e;if(de&&de.root===this)return de}return e?e.current:this}_handle(t,e){const s=he??this._ownerlessSlot;let i=me.get(s);i||me.set(s,i=new Map);let n=i.get(t.token);return n||(n=this._createHandle(t,s),i.set(t.token,n)),this._scopeFor(s)._scopedInstanceSync(t,e),n}async _handleAsync(t,e){const s=he??this._ownerlessSlot;return await this._scopeFor(s)._scopedInstanceAsync(t,e),we(s,null,()=>this._handle(t,e))}_createHandle(t,e){const s=this,i=()=>s._scopeFor(e)._scopedInstanceSync(t,[t.token]);return new Proxy(Object.create(null),{get(t,e){const s=i(),n=Reflect.get(s,e,s);return"function"==typeof n?function(t,e,s){let i=ye.get(t);i||ye.set(t,i=new Map);const n=i.get(e);if(n&&n.fn===s)return n.bound;const o=s.bind(t);return i.set(e,{fn:s,bound:o}),o}(s,e,n):n},set(t,e,s){const n=i();return Reflect.set(n,e,s,n)},has:(t,e)=>e in i(),getPrototypeOf:()=>Object.getPrototypeOf(i())})}_isSystemScope(){return"user"!==this.kind}_scopedInstanceSync(t,e){if(this.scopedCache.has(t.token))return this.scopedCache.get(t.token);const s=we(null,this,()=>this.instantiateSync(t,e));return this.scopedCache.set(t.token,s),s}async _scopedInstanceAsync(t,e){if(this.scopedCache.has(t.token))return this.scopedCache.get(t.token);if(this.pendingScoped.has(t.token))return await this.pendingScoped.get(t.token);const s=(async()=>{const s=await this.instantiateAsyncIn(null,this,t,e);return this.scopedCache.set(t.token,s),this.pendingScoped.delete(t.token),s})();return this.pendingScoped.set(t.token,s),await s}resolveDescriptorSync(t,e){switch(this.checkCycle(t.token,e),t.lifetime){case"singleton":{if(this.singletonCache.has(t.token))return this.singletonCache.get(t.token);const s=we(null,null,()=>this.instantiateSync(t,e));return this.singletonCache.set(t.token,s),s}case"scoped":return this._isSystemScope()&&ue!==this?this.root._handle(t,e):this._scopedInstanceSync(t,e);default:{const s=this.instantiateSync(t,e);return this._autoDisposeTransients&&this.parent&&this.transientSet.add(s),s}}}async resolveDescriptorAsync(t,e){switch(this.checkCycle(t.token,e),t.lifetime){case"singleton":{if(this.singletonCache.has(t.token))return this.singletonCache.get(t.token);if(this.pendingSingleton.has(t.token))return await this.pendingSingleton.get(t.token);const s=(async()=>{const s=await this.instantiateAsyncIn(null,null,t,e);return this.singletonCache.set(t.token,s),this.pendingSingleton.delete(t.token),s})();return this.pendingSingleton.set(t.token,s),await s}case"scoped":return this._isSystemScope()&&ue!==this?await this.root._handleAsync(t,e):await this._scopedInstanceAsync(t,e);default:{const s=await this.instantiateAsync(t,e);return this._autoDisposeTransients&&this.parent&&this.transientSet.add(s),s}}}construct(t){if(he)return t();const e={owner:null},s=we(e,ue,t);return!s||"object"!=typeof s&&"function"!=typeof s||"function"==typeof s.then||(Me(s),e.owner=s,fe.has(s)||fe.set(s,e)),s}instantiateSync(t,e){if(void 0!==t.useValue)return t.useValue;if(t.useFactory)return this.construct(()=>{const s=this.resolveDepsSync(t,e),i=ve(this.injectionResolver(e),()=>t.useFactory(...s,this));if(i&&"function"==typeof i.then){throw S("MJX402",this.describeTokenWithSource(t.token))}return i});if(t.useClass)return this.construct(()=>{const s=this.resolveDepsSync(t,e);return ve(this.injectionResolver(e),()=>new t.useClass(...s))});throw S("MJX403")}async instantiateAsyncIn(t,e,s,i){return await we(t,e,()=>this.instantiateAsync(s,i))}async instantiateAsync(t,e){if(void 0!==t.useValue)return t.useValue;const s=he,i=ue;if(t.useFactory){const n=await this.resolveDepsAsyncIn(s,i,t,e);return await we(s,i,()=>this.construct(()=>ve(this.injectionResolver(e),()=>t.useFactory(...n,this))))}if(t.useClass){const n=await this.resolveDepsAsyncIn(s,i,t,e);return we(s,i,()=>this.construct(()=>ve(this.injectionResolver(e),()=>new t.useClass(...n))))}throw S("MJX403")}async dispose(){const t=new Set,e=async e=>{if(e&&!t.has(e)){t.add(e);try{"function"==typeof e.dispose&&await e.dispose()}catch{}try{"function"==typeof e.close&&await e.close()}catch{}try{const t=e[Symbol.dispose];"function"==typeof t&&await t.call(e)}catch{}try{const t=e[Symbol.asyncDispose];"function"==typeof t&&await t.call(e)}catch{}}};if(this.root===this){const t=this._navigation;if(t){const e=[...t.scopes];t.scopes.clear(),t.current=this,pe===this&&(pe=null),this._navigation=void 0;for(const t of e)t._navigationDisposed=!0,await t.dispose()}for(const t of this.singletonCache.values())await e(t);this.singletonCache.clear(),this.pendingSingleton.clear()}for(const t of this.scopedCache.values())await e(t);"navigation"!==this.kind&&this.scopedCache.clear(),this.pendingScoped.clear();for(const t of this.transientSet.values())await e(t);this.transientSet.clear()}resolveDepsSync(t,e){const s=this.getDeps(t);return s&&0!==s.length?s.map(t=>this.resolveTokenSync(t,e)):[]}async resolveDepsAsyncIn(t,e,s,i){const n=this.getDeps(s);if(!n||0===n.length)return[];const o=[];for(const s of n)o.push(await we(t,e,()=>this.resolveTokenAsync(s,i)));return o}injectionResolver(t){return e=>this.resolveTokenSync(e,t)}getDeps(t){if(Array.isArray(t.deps))return t.deps;const e=t.useClass??t.useFactory;if(e){if(Array.isArray(e.inject))return e.inject;if(Array.isArray(e.dependencies))return e.dependencies}}resolveTokenSync(t,e){const s=this.services.getDescriptor(t);if(!s)throw S("MJX401",this.describeToken(t));const i=e.concat(t);return this.resolveDescriptorSync(s,i)}async resolveTokenAsync(t,e){const s=this.services.getDescriptor(t);if(!s)throw S("MJX401",this.describeToken(t));const i=e.concat(t);return await this.resolveDescriptorAsync(s,i)}checkCycle(t,e){const s=e.indexOf(t);if(-1!==s&&s!==e.length-1){throw S("MJX404",e.slice(s).concat([t]).map(t=>this.describeTokenWithSource(t)).join(" -> "))}}describeTokenWithSource(t){const e=this.describeToken(t),s=this.services.getDescriptor(t);if(!s)return e;return`${e}[${s.useClass?"useClass":s.useFactory?"useFactory":void 0!==s.useValue?"useValue":"unknown"}]`}}const Ae={live:0},xe=Symbol("motif.optionsOwner"),Ee=Symbol("motif.transition"),Te={mode:"concurrent"},Oe=()=>{};function Ne(){const t=new WeakMap;return{track:function(e,s,i){const n=e?.parentNode??i?.parentNode;if(!n)return{done:s,release:Oe};let o=t.get(n);o||t.set(n,o=new Set);let r=Oe;const a={node:e,via:i??null,done:new Promise(t=>{r=t})};o.add(a);let c=!1;const l=()=>{c||(c=!0,o.delete(a),r())};return{done:()=>{const t=!c;l(),t&&s&&s()},release:l,finished:a.done}},pending:function(e,s){if(!e)return null;const i=t.get(e);if(!i||0===i.size)return null;let n=null;for(const t of i)t.node!==s&&(t.node.parentNode===e||t.via?.parentNode===e?(n??=[]).push(t.done):i.delete(t));return n?Promise.all(n).then(Oe):null}}}const Pe=Ne(),Le=Ne(),Xe=Pe.track,Re=Pe.pending,Ie=Le.track,Je=Le.pending;function je(t){return"concurrent"===t||"out-in"===t||"in-out"===t}function Fe(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t?t.name||"[AnonymousClass]":String(t)}const He=1024;function Be(t){return t?._motif?.options}function ze(t){return t?._motif?.options?.[Ee]}function Ve(t){const e=ze(t);if(e?._markedDirection){e._markedDirection=!1;try{t.element?.removeAttribute?.("data-nav-direction")}catch{}}}function We(t){let e=t;for(;e;){const t=ze(e)?.mode;if(t)return t;const s=e.element;if(!s||s.nodeType!==Node.COMMENT_NODE)break;e=e.parent??e._leaveContainer}return Te.mode}function $e(t){const e=t?._motif?.options,s=e?.[Ee];return!!(e?.transitionIn||s&&(s.classes||s.name&&s.name.length>0))}function Ue(t){const e=()=>t.motif.options?.[Ee]??s,s={transitionInfo:()=>{const s=e();return{in:ee(t.element,`${s.name}-enter ${s.name}-enter-start`),out:ee(t.element,`${s.name}-leave ${s.name}-leave-start`)}},name:"",mode:void 0,classes:void 0,activeCssCancel:null,activeCssPhase:null,cssProps:()=>{const t=e();return t.classes?{name:t.classes.name||t.name||"",...t.classes}:t.name&&t.name.length>0?{name:t.name}:null},skipNextLeave:!1,_suppressEnter:!1,_markedDirection:!1,in:e=>{t.motif.options.transitionIn=e},out:e=>{t.motif.options.transitionOut=e},enterTransition:s=>{const i=e(),n=t._base,o=!n._enterPlayed;if(n._enterPlayed=!0,n._enterSeq=(n._enterSeq??0)+1,i._suppressEnter)return s&&s(),Kt;const r={};n._enterRun=r;const a=Ie(t.element,()=>{t._base?._enterRun===r&&(t._base._enterRun=null,Ve(t)),s&&s()},t.motif.options.placeholder),c=t.motif.options.transitionIn,l=c?i.run(c.keyframes,c.options,a.done):i._runCss("enter",a.done,o);return l&&l!==Kt&&"function"==typeof l.addEventListener&&l.addEventListener("cancel",a.release),l},leaveTransition:s=>{const i=e(),n=t.element,o=Xe(n,s),r=()=>{const e=t.motif.options?.transitionOut,s=e?i.run(e.keyframes,e.options,o.done):i._runCss("leave",o.done);return s&&s!==Kt&&"function"==typeof s.addEventListener&&s.addEventListener("cancel",o.release),s};return o.finished&&"in-out"===We((a=t).parent??a._leaveContainer)?function(t,e,s){const i=t.parentNode,n={finished:e.finished??Promise.resolve(),playState:"pending",addEventListener:Oe,removeEventListener:Oe,cancel:Oe};return queueMicrotask(()=>{const e=Je(i,t);e?e.then(()=>{s()}):s()}),n}(n,o,r):r();var a},_runCss:(s,i,n=!1)=>{const o=e();if("enter"===s&&"leave"===o.activeCssPhase)return i&&i(),Kt;const r=o.cssProps(),a=t.element;if(r&&a&&1===a.nodeType&&a.classList){try{o.activeCssCancel?.()}catch{}const t=se(a,r,s,()=>{o.activeCssCancel=null,o.activeCssPhase=null,i&&i()},n);return o.activeCssCancel=t,o.activeCssPhase=s,Kt}return i&&i(),Kt},activeAnimations:[],run:(s,i,n)=>{const o=e();t.motif.stopAnimations();const r=t.element;if(r.animate){var a=r.animate(s,i);o.activeAnimations.push(a);let t=!1;const e=()=>{if(!t){t=!0;try{o.activeAnimations&&(o.activeAnimations=o.activeAnimations.filter(t=>t!==a))}catch{}}};return a.addEventListener("finish",()=>{n&&n(),e()}),a.oncancel=()=>{e()},a}{n&&n();const t=globalThis;if("function"==typeof t.Animation)try{return new t.Animation}catch{}return Kt}}};return s}class qe{constructor(t){this[xe]=t}get transition(){return this[Ee]??=Ue(this[xe])}set transition(t){this[Ee]=t}set enableRouterClassing(t){try{const e=this[xe],s=e.context.onRouterChanged(()=>{ss.routerClassing.call(e,t)});e.motif.register(D.toDisposable(()=>{s()})),ss.routerClassing.call(e,t)}catch(t){M("MJX105",t)}}getInstance(){return this[xe]}get display(){return this[xe].isVisible}set display(t){t?this[xe].motif.show():this[xe].motif.hide()}hasEvent(t){return Ds(this[xe],t)}}function Ge(t,e,s){const i=t._baseCtx;i&&i._emiters?.fire(e,s)}function Ke(t,e,s,i,n){if(!t)return;let o=t[e];if(!o)return;let r=0;if("function"==typeof o){const a=o;if(C(()=>a(s,i),"MJX122",n),o=t[e],!Array.isArray(o))return;r=1}for(let t=r;t<o.length;t++){const e=o[t];C(()=>e(s,i),"MJX122",n)}}function Ye(t,e,s,i,n){if(t[e])return!0;const o=t._baseCtx;return!!o?.[s]||(!(!n||!t[n])||!!o?._emiters?.hasListeners(i))}It(qe.prototype,["getInstance","hasEvent"]);const Qe=["build","setState","reState","setText","style","dispose","disposeAsync","using","doWork","getService","$","useModel","context","siblings","serviceProvider","isWait"],Ze=new WeakSet;function ts(t,e){if("function"!=typeof t)return!1;const s=e.replace(/\$/g,"\\$");return new RegExp(`\\bsuper\\s*(\\.\\s*${s}(?![\\w$])|\\[)`).test(Function.prototype.toString.call(t))}function es(t){if(!c())return;const e=t?.constructor;if("function"!=typeof e||Ze.has(e))return;Ze.add(e);const s=e.name||"An anonymous component class";for(const[e,i]of function(t){const e=[],s=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);for(const i of Qe)if(s(t,i))e.push([i,"field"]);else for(let s=Object.getPrototypeOf(t);s&&s!==zs.prototype;s=Object.getPrototypeOf(s)){const t=Object.getOwnPropertyDescriptor(s,i);if(t){("value"in t?[t.value]:[t.get,t.set].filter(Boolean)).some(t=>ts(t,i))||e.push([i,"method"]);break}}const i=t;return i.motif instanceof ie||e.push(["motif","replaced"]),i.controls instanceof Qi||e.push(["controls","replaced"]),i.class instanceof Gt||e.push(["class","replaced"]),i.attr instanceof qt||e.push(["attr","replaced"]),i.bindings instanceof Ft||e.push(["bindings","replaced"]),null==i.element||"undefined"==typeof Node||i.element instanceof Node||e.push(["element","replaced"]),null==i.parent||i.parent instanceof zs||e.push(["parent","replaced"]),e}(t))k("MJX128",[s,e,i])}const ss={callInitializeComponent(t){const e=t,s={cancel:!1};if(!t||t.isDisposed)return;"function"==typeof t.initializeComponent&&C(()=>t.initializeComponent(e,s),"MJX122","initializeComponent");const i=t._init;i&&C(()=>i(e,s),"MJX122","initializeComponent"),Ke(t._baseCtx,"_initializeComponentHandlers",e,s,"initializeComponent"),"function"==typeof t.oninitializeComponent&&C(()=>t.oninitializeComponent(e,s),"MJX122","oninitializeComponent"),Ke(t._baseCtx,"_onInitializeComponentHandlers",e,s,"oninitializeComponent")},callDisposing(t){if(!t||t.isDisposed)return;if(!Ye(t,"onDisposing","_onDisposingHandlers","ondisposing","ondisposing"))return;const e=t,s={cancel:!1};t.onDisposing&&C(()=>t.onDisposing(e,s),"MJX122","onDisposing"),Ke(t._baseCtx,"_onDisposingHandlers",e,s,"onDisposing"),t.ondisposing&&C(()=>t.ondisposing(e,s),"MJX122","ondisposing"),Ge(t,"ondisposing",s)},callActivated(t){if(!t||t.isDisposed)return;const e=t,s={cancel:!1};t.onActivated&&C(()=>t.onActivated(e,s),"MJX122","onActivated"),Ke(t._baseCtx,"_onActivatedHandlers",e,s,"onActivated"),Ge(t,"onactivated",s)},callDeactivated(t){if(!t||t.isDisposed)return;const e=t,s={cancel:!1};t.onDeactivated&&C(()=>t.onDeactivated(e,s),"MJX122","onDeactivated"),Ke(t._baseCtx,"_onDeactivatedHandlers",e,s,"onDeactivated"),Ge(t,"ondeactivated",s)},deactivateTree(t,e=!0){if(t&&!t.isDisposed&&t.isBuilt&&t._base&&!t._base._inactive&&(t._base._inactive=!0,ss.callDeactivated(t),e&&!t.isDisposed))for(const e of Xs(t).slice())e&&!e.isDisposed&&e.isVisible&&!e.isWait&&ss.deactivateTree(e,!0)},activateTree(t,e=!0){if(t&&!t.isDisposed&&t._base&&t._base._inactive&&(t._base._inactive=!1,ss.callActivated(t),e&&!t.isDisposed))for(const e of Xs(t).slice())e&&!e.isDisposed&&e.isVisible&&!e.isWait&&ss.activateTree(e,!0)},callDisposed(t){if(t&&0===(t._flags&He)&&(!t.isDisposed||t.element||void 0!==t._baseCtx)){if(t._flags|=He,Ye(t,"onDisposed","_onDisposedHandlers","ondisposed","ondisposed")){const e=t,s={cancel:!1};t.onDisposed&&C(()=>t.onDisposed(e,s),"MJX122","onDisposed"),Ke(t._baseCtx,"_onDisposedHandlers",e,s,"onDisposed"),t.ondisposed&&C(()=>t.ondisposed(e,s),"MJX122","ondisposed"),Ge(t,"ondisposed",s)}try{globalThis.__MOTIF_DEVTOOLS_BUS__?.publish?.("component:disposed",{id:t.id,type:t.constructor?.name})}catch{}}},callBuilt(t){if(t&&!t.isDisposed){if(Ye(t,"onBuilt","_onBuiltHandlers","onbuilt","onbuilt")){const e=t,s={cancel:!1};t.onBuilt&&C(()=>t.onBuilt(e,s),"MJX122","onBuilt"),Ke(t._baseCtx,"_onBuiltHandlers",e,s,"onBuilt"),t.onbuilt&&C(()=>t.onbuilt(e,s),"MJX122","onbuilt"),Ge(t,"onbuilt",s)}try{globalThis.__MOTIF_DEVTOOLS_BUS__?.publish?.("component:mounted",{id:t.id,type:t.constructor?.name})}catch{}}},scheduleMounted(t){if(!t||t.isDisposed||t._baseCtx?._mountedScheduled)return;if(!("function"==typeof t.onMounted||!!t._baseCtx?._onMountedHandlers||"function"==typeof t.onmounted))return;t._base._mountedScheduled=!0;const e=t.element;if(!e||"number"!=typeof e.nodeType)return;const s=ki(e,()=>{t.isDisposed||ss.callMounted(t)});s&&t._register(D.toDisposable(s))},callMounted(t){if(!t||t.isDisposed||t._base._mountedFired)return;t._base._mountedFired=!0;const e=t,s={cancel:!1};t.onMounted&&C(()=>t.onMounted(e,s),"MJX122","onMounted"),Ke(t._baseCtx,"_onMountedHandlers",e,s,"onMounted"),t.onmounted&&C(()=>t.onmounted(e,s),"MJX122","onmounted"),Ge(t,"onmounted",s)},callBuilding(t){if(!t||t.isDisposed)return;if(!Ye(t,"onBuilding","_onBuildingHandlers","onbuilding"))return;const e=t,s={cancel:!1};t.onBuilding&&C(()=>t.onBuilding(e,s),"MJX122","onBuilding"),Ke(t._baseCtx,"_onBuildingHandlers",e,s,"onBuilding"),Ge(t,"onbuilding",s)},callConfig(t){if(!t||t.isDisposed||t.isConfigured)return;t.isConfigured=!0;const e=t._motif?.options?._preconfig;if(e&&o(()=>e(t),"Component._preconfig"),!Ye(t,"onConfig","_onConfigHandlers","onconfig"))return;const s=t,i={cancel:!1};t.onConfig&&C(()=>t.onConfig(s,i),"MJX122","onConfig"),Ke(t._baseCtx,"_onConfigHandlers",s,i,"onConfig"),Ge(t,"onconfig",i)},callConfigured(t){if(256&t._flags)return;if(t?._baseCtx?._configDeferred&&!t.isConfigured&&ss.callConfig(t),t._flags|=256,!t||t.isDisposed)return;if(!Ye(t,"onConfigured","_onConfiguredHandlers","onconfigured"))return;const e=t,s={cancel:!1};t.onConfigured&&C(()=>t.onConfigured(e,s),"MJX122","onConfigured"),Ke(t._baseCtx,"_onConfiguredHandlers",e,s,"onConfigured"),Ge(t,"onconfigured",s)},callOnInitialized(t){if(!t||t.isDisposed)return;if(t.isInitialized=!0,!Ye(t,"onInitialized","_onInitializedHandlers","oninitialized"))return;const e=t,s={cancel:!1};t.onInitialized&&C(()=>t.onInitialized(e,s),"MJX122","onInitialized"),Ke(t._baseCtx,"_onInitializedHandlers",e,s,"onInitialized"),Ge(t,"oninitialized",s)},callOnInitializing(t){if(!t||t.isDisposed)return;if(!Ye(t,"onInitializing","_onInitializingHandlers","oninitializing"))return;const e=t,s={cancel:!1};t.onInitializing&&C(()=>t.onInitializing(e,s),"MJX122","onInitializing"),Ke(t._baseCtx,"_onInitializingHandlers",e,s,"onInitializing"),Ge(t,"oninitializing",s)},callVisibilityChanged(t,e){if(!t||t.isDisposed)return;if(!Ye(t,"onVisibilityChanged","_onVisibilityChangedHandlers","onvisibilitychanged"))return;const s=t,i={cancel:!1,visible:e};t.onVisibilityChanged&&C(()=>t.onVisibilityChanged(s,i),"MJX122","onVisibilityChanged"),Ke(t._baseCtx,"_onVisibilityChangedHandlers",s,i,"onVisibilityChanged"),Ge(t,"onvisibilitychanged",i)},findFragmentContent(t){const e=t.element.nodeType==Node.COMMENT_NODE?t.motif.options.cache:t.element;t.element.nodeType==Node.COMMENT_NODE&&0==e?.childNodes.length&&t.controls.length>0&&(t.motif.options.cache?.appendChild(t.element),t.controls.forEach(e=>{t.motif.options.cache?.appendChild(e.element)}),t.motif.options.cache?.appendChild(t.motif.options.closeFragment))},backgroundCallback(t){t()},internalBuild(t){if(this.isDisposed||t?.isDisposed)return;if(ss.callConfigured(t),t.isDisposed)return;if(Os(t),t.isWait)return void(this.isBuilt&&function(t,e){if(!is(e))return;const s=wi(t)?.element;if(!s)return;const i=e.element;if(i&&i.parentNode===s)return;const n=e.motif.options,o=n.placeholder??(n.placeholder=qi.createComment("h"));if(o.parentNode===s)return;s.insertBefore(o,os(t,t.controls.items.indexOf(e)+1,s))}(this,t));const e=t.isBuilt;if(!this.isBuilt)return;if(t.isWait)return;const s=t._baseCtx?._enterSeq;if(t.isBuilt){if(t.parent!=this){t.parent?.controls.detach(t),t.parent=this;const e=t.__pendingLeave;if(e)return void e.promise.then(()=>{this.isDisposed||t.isDisposed||t.parent!==this||ss.internalBuild.call(this,t)})}}else t.build();if(t.isDisposed||this.isDisposed)return;t.parent=this;const i=this.controls.items,n=i.length>0&&i[i.length-1]===t?i.length-1:i.indexOf(t),o=wi(this);var r=t.element.nodeType==Node.COMMENT_NODE?t.motif.options.cache:t.element;e&&t.element.nodeType==Node.COMMENT_NODE&&0==r?.childNodes.length&&t.controls.length>0&&(r=ss.getContent.call(t));const a=o?.element,c=t.motif.options.placeholder,l=t.isVisible&&c&&a&&c.parentNode===a?c:null,h=l??(a?os(this,n+1,a):null);if(!t.isVisible){if(!is(t))return;t.motif.options.placeholder||(t.motif.options.placeholder=qi.createComment("h")),r=t.motif.options.placeholder}if(a&&"out-in"===We(this)){const e=Re(a,r);if(e)return t._base._enterSeq=(t._base._enterSeq??0)+1,void e.then(()=>{this.isDisposed||t.isDisposed||t.parent!==this||ss.internalBuild.call(this,t)})}const u=o?.element;if(r&&u&&(r===u||r.contains(u)))k("MJX104",[]);else{if(h)try{o?.element.insertBefore(r,h)}catch{o?.element.appendChild(r)}else o?.element.appendChild(r);l&&l.parentNode&&l.parentNode.removeChild(l)}if(t.isVisible){!(!e&&t._baseCtx?._enterSeq!==s)&&$e(t)&&t.motif.options.transition.enterTransition(()=>{}),e&&ss.activateTree(t)}},getContent(){return this.isDisposed||!this.element?null:this.element.nodeType==Node.COMMENT_NODE?(this.motif.options.cache?.appendChild(this.element),this.controls.forEach(t=>{const e=t.isWait||!t.isVisible?is(t)?t.motif.options.placeholder??=qi.createComment("h"):void 0:ss.getContent.call(t);e&&this.motif.options.cache?.appendChild(e)}),this.motif.options.cache?.appendChild(this.motif.options.closeFragment),this.motif.options.cache):this.element},routerClassing(t){try{const e=t.to,s=t.path;if(this.isDisposed)return;const i=this.context?.router;if(!i)return;const n=i.uri.startsWith("/")?i.uri:"/"+i.uri,o=s??"",r=function(t,e){try{const s=t=>t.trim().split(/[?#]/)[0].replace(/\\/g,"/").replace(/\/{2,}/g,"/");return s(t)===s(e)}catch(t){return M("MJX610",t),!1}}(n,o),a=r||function(t,e){const s=Y(t),i=Y(e);return s===i||s.startsWith(i+"/")}(n,o);if(t.activeClass&&("all"===e||"active"===e)){t.activeClass.split(" ").filter(t=>t.trim().length).forEach(t=>this.element.classList.toggle(t,a))}if(!a||"all"!==e&&"active"!==e?"all"!==e&&"active"!==e||t.offActive?.():t.onActive?.(),t.exactClass&&("all"===e||"exact"===e)){t.exactClass.split(" ").filter(t=>t.trim().length).forEach(t=>this.element.classList.toggle(t,r))}!r||"all"!==e&&"exact"!==e?"all"!==e&&"exact"!==e||t.offExact?.():t.onExact?.()}catch(t){}}};function is(t){return"detach"!==Be(t)?.hideStrategy}function ns(t,e){const s=Be(t)?.placeholder;if(s&&s.parentNode===e)return s;const i=t.element;return i&&i.parentNode===e?i:null}function os(t,e,s){const i=t.controls.items;for(let t=e;t<i.length;t++){const e=i[t]?ns(i[t],s):null;if(e)return e}if(t.element.nodeType===Node.COMMENT_NODE){const e=Be(t)?.closeFragment;return e&&e.parentNode===s?e:null}return null}function rs(t,e,s){const i=Be(t),n=e.parentNode;if(e.nodeType===Node.COMMENT_NODE){if(n){const t=i?.closeFragment||null;if(t){let s=e;for(;s;){const e=s.nextSibling;try{n.removeChild(s)}catch{}if(s===t)break;s=e}}else try{n.removeChild(e)}catch{}if(!s)return}}else if(n){try{n.removeChild(e)}catch{}if(!s)return}const o=i?.placeholder;if(o&&o.parentNode)try{o.parentNode.removeChild(o)}catch{}}function as(t){const e=t.element;if(!e||!0===t._keepElementOnDispose)return;const s=t.motif.options,i=s?.[Ee];try{if(!0===i?.skipNextLeave||!0===t._forceInstantDetach)return i&&(i.skipNextLeave=!1),t._forceInstantDetach=!1,void rs(t,e,!0)}catch{}if(i||s?.transitionOut)try{s.transition.leaveTransition(()=>{rs(t,e,!1)})}catch{rs(t,e,!1)}else rs(t,e,!1)}async function cs(t){const e=t.element;if(!e||!0===t._keepElementOnDispose)return;const s=t.motif.options,i=s?.[Ee];try{if(!0===i?.skipNextLeave||!0===t._forceInstantDetach)return i&&(i.skipNextLeave=!1),t._forceInstantDetach=!1,void rs(t,e,!0)}catch{}if(i||s?.transitionOut)return new Promise(i=>{try{s.transition.leaveTransition(()=>{rs(t,e,!1),i()})}catch{rs(t,e,!1),i()}});rs(t,e,!1)}function ls(t){if(!t.isDisposed){ss.callDisposing.call(t,t);try{As(t)}catch{}if(t.motif.stopAnimations(),xs(t),Xs(t).length)for(const e of t._controls.items)try{ls(e)}catch{}ss.callDisposed.call(t,t),i(()=>{t._baseCtx?._emiters?.clear()},"disposeShallow.emiters"),t.isDisposed=!0,E.prototype.dispose.call(t)}}function hs(t){try{t.parent=null}catch{}t._eventHandlers=void 0;try{t._class?._countsStore?.clear()}catch{}try{t._class?._watchersStore?.clear()}catch{}try{t._attr?._attrMapStore?.clear()}catch{}try{t._attr?._watchersStore?.clear()}catch{}try{const e=t._motif?.options;e&&(e.cache=void 0,e.closeFragment=void 0,e.placeholder=void 0)}catch{}try{t.element=null}catch{}try{t.props=void 0}catch{}try{t.childs=void 0}catch{}try{t.class=void 0}catch{}try{t.attr=void 0}catch{}try{t.parent=null}catch{}try{t._motif&&(t._motif.options=void 0)}catch{}const e=Object.keys(t);for(let s=0;s<e.length;s++){const i=e[s];if("_motif"!==i&&"_flags"!==i)try{t[i]=void 0}catch{}}t._store=null,t._flags=1860}const us=Promise.resolve();function ds(t,e){if(!e&&t._disposing&&!t.isDisposed)return!1;if(t.disposeAsync!==zs.prototype.disposeAsync)return!1;const s=Be(t);if(s){if(s.transitionOut)return!1;const t=s[Ee];if(t){if(t.activeAnimations&&t.activeAnimations.length>0)return!1;if(t.activeCssCancel)return!1;if(t.classes||t.name&&t.name.length>0)return!1}}const i=Xs(t);if(i.length)for(let t=0;t<i.length;t++){const e=i[t];if(e&&!e.isDisposed&&!ds(e,!1))return!1}return!0}const ps=new WeakMap;function fs(t,e,s){const n=s?"disposeAsync":"dispose";if(Ho._disposingCount>0){const e=function(t){for(let e=t;e;e=e.parent){if(e.application)return e.application;const t=ps.get(e);if(t)return t}return Ho.main??null}(t);e&&"disposing"===e.state&&ps.set(t,e)}!s&&e?.skipLeaveTransition&&(t.motif.options.transition.skipNextLeave=!0),i(()=>{ss.callDisposing.call(t,t)},n+".callDisposing"),As(t),xs(t),i(()=>{t.parent?.controls?.silentDetach?.(t,!0)},n+".silentDetach")}function ms(t,e,s){if(t.isDisposed=!0,E.prototype.dispose.call(t),s)return t._controls&&(t._controls.items=[]),i(()=>{ss.callDisposed.call(t,t)},"disposeAsync.callDisposed"),i(()=>{t._baseCtx?._emiters?.clear()},"disposeAsync.emiters"),void(e?.deep&&hs(t));t.element=null,i(()=>{ss.callDisposed.call(t,t)},"dispose.callDisposed"),i(()=>{t._baseCtx?._emiters?.clear()},"dispose.emiters"),As(t),hs(t)}async function _s(t,e,s,i){i?await i:((s||ze(t)?.skipNextLeave)&&await t.motif.stopAnimations(),await cs(t)),s||"TransportTo"===t.constructor.name||await async function(t){if(0===Ae.live)return;const e=Vs(t);return await Promise.all(e.map(async e=>{e.motif.options.transition.skipNextLeave=t.motif.options.transition.skipNextLeave;for(const t of e.controls.items)t.motif.options.transition.skipNextLeave=e.motif.options.transition.skipNextLeave,t.dispose({skipLeaveTransition:!0}),t.isDisposed=!0;await e.dispose()}))}(t);const o={deep:e?.deep};await n(async()=>{if(t.isDisposed)return;const e=Array.from(Xs(t));e.length&&await Promise.all(e.map(t=>s?n(async()=>{await t.disposeAsync(o)},"disposeAsync.disposeAsyncChildren.handler"):(async()=>{try{await t.disposeAsync(o)}catch(t){M("MJX107",t)}})()))},s?"disposeAsync.disposeAsyncChildren":"dispose.disposeAsync"),!s&&t.isDisposed||ms(t,e,s)}const gs={get emiters(){return this._emiters??=new Bt(this.owner)},_offAll(){As(this.owner)},_deactivateBindings(){xs(this.owner)},_activateBindings(){Es(this.owner)},_reactivateBindings(){Ts(this.owner)},_activatePreBindings(){Os(this.owner)},_detachDomWithAnimation(){as(this.owner)},_detachDomWithAnimationAsync(){return cs(this.owner)},_disposeShallow(){ls(this.owner)},_deepCleanup(){hs(this.owner)}},ys=16,vs=32,ws=64,bs=[];let Ss=0;class Ms{constructor(t,e,s,i,n){this.owner=t,this.key=e,this.original=s,this.type=i,this.flags=n,this.next=void 0}handleEvent(t){const e=this.flags,s=this.owner;if(1&e&&t.target!==s.element)return;if(2&e&&!t.isTrusted)return;const i=this.original;let n;try{i&&i.length<=1?n=i(t):i&&(n=i(s,t))}catch(t){M("MJX123",t,this.type)}if(n&&"function"==typeof n.then){const t=this.type;n.then(void 0,e=>M("MJX123",e,t))}4&e&&Cs(t),8&e&&ks(t),n&&!0===n.cancel&&(Cs(t),ks(t))}}function Cs(t){"function"==typeof t?.preventDefault&&t.preventDefault()}function ks(t){"function"==typeof t?.stopPropagation&&t.stopPropagation()}function Ds(t,e){for(let s=t._eventHandlers;void 0!==s;s=s.next)if(0===(s.flags&ws)&&s.key===e)return!0;return!1}function As(t){const e=t._eventHandlers;if(void 0!==e){for(let s=e;void 0!==s;s=s.next)if((s.flags&(vs|ws))===vs)try{t.element.removeEventListener(s.type,s,0!==(s.flags&ys))}catch{}t._eventHandlers=void 0}}function xs(t){try{t._bindings?._items?.length&&t._bindings.deactivateAll()}catch{}}function Es(t){try{t._bindings?.activateAll()}catch{}}function Ts(t){try{t._bindings?.reActivateAll()}catch{}}function Os(t){if(512&t._flags)return;const e=t._bindings?._items;e&&e.length>0&&t._bindings.items.filter(t=>"isWait"==t.propertyName||"display"==t.propertyName).forEach(t=>{t.activate()}),t._flags|=512}function Ns(t){return t.owner}const Ps=Object.freeze([]),Ls=Object.freeze([]);function Xs(t){return t._controls?.items??Ps}function Rs(t){const e=Ns(this);Ds(e,"controladded")&&e.motif.trigger("controladded",{control:t}),(e.isVisible||e.element?.nodeType!==Node.COMMENT_NODE)&&ss.internalBuild.call(e,t)}function Is(t){const e=Ns(this);Ds(e,"controladded")&&e.motif.trigger("controladded",{control:t})}function Js(t){const e=Ns(this);Ds(e,"controlremoved")&&e.motif.trigger("controlremoved",{control:t})}const js=new WeakMap,Fs=new Set(["building","built","initializing","initialized","disposing","disposed","config","configured","visibilitychanged","activated","deactivated"]),Hs=Symbol("motif.rawApplication"),Bs=new Set(["on","onRouterChanged"]);class zs extends E{get motif(){return void 0!==this._motif?this._motif:this._motif=new ie(this,this.isDisposed&&!this.element?void 0:new qe(this))}set motif(t){this._motif=t}get isBuilt(){return!!(1&this._flags)}set isBuilt(t){this._flags=t?1|this._flags:-2&this._flags}get isInitialized(){return!!(2&this._flags)}set isInitialized(t){this._flags=t?2|this._flags:-3&this._flags}get isDisposed(){return!!(4&this._flags)}set isDisposed(t){this._flags=t?4|this._flags:-5&this._flags}get isConfigured(){return!!(8&this._flags)}set isConfigured(t){this._flags=t?8|this._flags:-9&this._flags}get isPainting(){return!!(16&this._flags)}set isPainting(t){this._flags=t?16|this._flags:-17&this._flags}get isPainted(){return!!(32&this._flags)}set isPainted(t){this._flags=t?32|this._flags:-33&this._flags}get isVisible(){return!(64&this._flags)}set isVisible(t){this._flags=t?-65&this._flags:64|this._flags}get controls(){return void 0!==this._controls||this.isDisposed&&!this.element?this._controls:this._controls=function(t){const e=new Qi(t);return e.onAdd=Rs,e.onAddBeforeBuild=Is,e.onRemove=Js,e}(this)}set controls(t){this._controls=t}get class(){return void 0!==this._class||this.isDisposed&&!this.element?this._class:this._class=new Gt(this)}set class(t){this._class=t}get attr(){return void 0!==this._attr||this.isDisposed&&!this.element?this._attr:this._attr=new qt(this)}set attr(t){this._attr=t}get bindings(){return void 0!==this._bindings||this.isDisposed&&!this.element?this._bindings:this._bindings=new Ft(this)}set bindings(t){this._bindings=t}useModel(t){return Vn(t)}_computeHideStrategy(){return is(this)?"placeholder":"detach"}_isInDom(){try{if(!this.element)return!1;const t=this.element;return t.nodeType,Node.COMMENT_NODE,!!t.parentNode}catch{return!1}}set isWait(t){this._flags=t?128|this._flags:-129&this._flags,this.isBuilt?t?this.motif.hide():this.motif.show():!1===t&&this.parent&&this.parent.isBuilt&&ss.internalBuild.call(this.parent,this)}get isWait(){return!!(128&this._flags)}constructor(t,e={}){super(),this._motif=void 0,this._flags=0,this._controls=void 0,this._class=void 0,this._attr=void 0,this._bindings=void 0,this._baseCtx=void 0,this._init=void 0,this._leaveContainer=void 0,this.parent=null;const s=gi;gi=!1,Me(this),this.onElementCreating?this.element=this.onElementCreating.call(this):this.element=e?.onElementCreating?e.onElementCreating.call(this):t,3!==this.element?.nodeType&&void 0===this._controls&&(this._controls=new Qi(this));const i=e?Gs(e,this):[];if(e&&Qs(e,this)&&(e={}),oi(e?.options,this),this.props=e,e){const t=new.target;!s&&(t===zs||Object.getPrototypeOf(t)===zs)?di(e,this):yi(e,this)}if(i.length>0)for(const t of $s(this,i))C(()=>t(this),"MJX122","ref");if(ss.callOnInitializing(this),this.isDisposed)return;const n=this._controls;n&&(n.onAdd=Rs,n.onAddBeforeBuild=Is,n.onRemove=Js),ss.callOnInitialized(this);const o=new.target;o===zs||Object.getPrototypeOf(o)===zs?ss.callConfig(this):this._base._configDeferred=!0}get _base(){return void 0!==this._baseCtx||this.isDisposed&&!this.element?this._baseCtx:this._baseCtx=function(t){const e=Object.create(gs);return e.owner=t,e}(this)}get context(){const t=this.parent?.context,e=t?.[Hs]??t??ps.get(this)??Ho.main;return e?(this._scopedContext?.[Hs]!==e&&(this._scopedContext=function(t,e){const s=new Map;return new Proxy(t,{get(t,i){if(i===Hs)return t;const n=Reflect.get(t,i,t);if("function"!=typeof n)return n;const o=s.get(i);if(o&&o.fn===n)return o.bound;const r=Bs.has(i)?(...s)=>e._trackContextSubscription(n.apply(t,s)):n.bind(t);return s.set(i,{fn:n,bound:r}),r},set:(t,e,s)=>Reflect.set(t,e,s,t)})}(e,this)),this._scopedContext):e}_trackContextSubscription(t){if("function"!=typeof t)return t;if(this.isDisposed)return t(),t;const e=this._register(D.toDisposable(t));return()=>{this._disposables.detach(e),t()}}build(t=!0){if(es(this),ss.callConfigured(this),Os(this),this.isDisposed||!this.element||this.isWait)return;if(this.isBuilt||this.isWait)return;if(ss.callBuilding(this),this.isDisposed)return;var e=this.element;t&&(e=qi.createDocumentFragment());const s="string"!=typeof this.element&&this.element.nodeType===Node.COMMENT_NODE;if(s&&(this.motif.options.cache=qi.createDocumentFragment(),this.element.textContent="[",this.motif.options.cache.appendChild(this.element)),this.isBuilt)return;if(ss.callInitializeComponent(this),this.isDisposed)return;if(this.view){const t=this.view();if(this.controls.add(t),this.isDisposed)return}const i="SELECT"===this.element?.nodeName?this.bindings.items.filter(t=>"value"===t.propertyName):Ls;if(i.length)try{this.bindings.items.filter(t=>!i.includes(t)).forEach(t=>t.activate())}catch{}else Es(this);const n=Xs(this);for(const i of n.length?n.slice():n){var o=s?this.motif.options.cache:this.element;if(i.isWait||(i.parent=this,i.build(!1)),i.isWait){if(is(i)){const s=i.motif.options;(t?e:o).appendChild(s.placeholder??(s.placeholder=qi.createComment("h")))}}else{if(t){const t=Be(i)?.cache;t?e.appendChild(t):e.appendChild(i.element)}else{const t=Be(i)?.cache;t?o.appendChild(t):o.appendChild(i.element)}i._baseCtx?._inactive&&i.isVisible&&ss.activateTree(i)}}if(!this.isDisposed){if($e(this)){const t=this.element;if(t&&t.isConnected)this.motif.options.transition.enterTransition(()=>{});else{const t=this._base._enterSeq;queueMicrotask(()=>{!this.isDisposed&&this.isVisible&&this.motif.options?.transition&&this._base._enterSeq===t&&this.motif.options.transition.enterTransition(()=>{})})}}else Ve(this);if(t)try{(o=s?this.motif.options.cache:this.element).nodeType===Node.TEXT_NODE?o.appendData(e.textContent):o.appendChild?o.appendChild(e):o.append(e)}catch(t){}if(i.length)try{i.forEach(t=>t.activate())}catch{}s&&(this.motif.options.closeFragment=qi.createComment("]"),this.motif.options.cache.appendChild(this.motif.options.closeFragment),this.element.nodeType===Node.COMMENT_NODE&&this.motif.options.closeFragment&&js.set(this.element,this.motif.options.closeFragment)),this.isBuilt=!0,ss.callBuilt(this),ss.scheduleMounted(this)}}setState(){this.controls.forEach(t=>{t.setState()}),Ts(this)}reState(){Ts(this),this.controls.forEach(t=>{t.reState()})}setText(t){!this.isDisposed&&this.element&&(si(t)?function(t,e){if(ii.has(t))return;ii.add(t),k("MJX204",[],{value:Array.isArray(e)?`ComponentBase[${e.length}]`:"ComponentBase"})}(this,t):this.element&&(this.element.textContent=t))}style(t){if(this.isDisposed)return this;const e=this.element?.style;if(!e)return this;if("function"==typeof t){this._stopStyleEffect();let e=[],s=!1;const i=()=>At(()=>{const i=t();if(this.isDisposed)return;const n=this.element?.style;if(n)if("string"==typeof i)n.cssText=i,e=[],s=!0;else if(i&&"object"==typeof i){s&&(n.cssText="",s=!1);for(const t of e)if(!(t in i))try{n[t]=""}catch{}Object.assign(n,i),e=Object.keys(i)}else{s&&(n.cssText="",s=!1);for(const t of e)try{n[t]=""}catch{}e=[]}});let n=i();const o=()=>{try{n()}catch{}},r={propertyName:"__style",dataSource:null,activate(){},reActivate(){o(),n=i()},deactivate(){o()}};try{this.bindings.add(r)}catch{}return this._styleFx={stop:o,binding:r},this}return"string"==typeof t?e.cssText=t:t&&"object"==typeof t&&Object.assign(e,t),this}_stopStyleEffect(){const t=this._styleFx;if(t){this._styleFx=void 0;try{t.stop()}catch{}try{this.bindings.remove(t.binding)}catch{}}}_addHandler(t,e){this.motif.on(t,e)}async _show(){if(this.isDisposed||!this.element)return;if(this.isVisible)return;if(this.isWait)return;if(this.parent&&"out-in"===We(this.parent)){const t=this.motif.options.placeholder?.parentNode??wi(this.parent)?.element,e=Re(t,this.element);if(e){const t=this._base._showSeq=(this._base._showSeq??0)+1;return e.then(()=>{if(!this.isDisposed&&this._base._showSeq===t)return this._show()})}}ze(this)?.activeAnimations?.length&&i(async()=>{await Promise.all(this.motif.options.transition.activeAnimations.map(t=>t.finished?.catch(()=>{})))},"show.waitForLeaveAnimations");if("detach"===this._computeHideStrategy()){if(ss.callVisibilityChanged(this,!0),this.isDisposed)return;const t=!this._isInDom()&&this.parent&&this.parent.isBuilt&&!this.isWait;return this.isVisible=!0,void(t&&ss.internalBuild.call(this.parent,this))}{const e=this.motif.options.placeholder?.parentElement,s=wi(this.parent)?.element;if(this.motif.options.placeholder&&e&&e!==s){if(k("MJX106",[]),ss.callVisibilityChanged(this,!0),this.isDisposed)return;return this.isVisible=!0,void(this.parent?.isBuilt&&ss.internalBuild.call(this.parent,this))}if($e(this)&&this.motif.options.transition.enterTransition(()=>{}),ss.callVisibilityChanged(this,!0),this.isDisposed)return;if(this.element.nodeType===Node.COMMENT_NODE)return this.controls.items.filter(t=>!t.isBuilt).forEach(t=>ss.internalBuild.call(this,t)),this.controls.forEach(t=>{t.motif.show()}),this.isVisible=!0,void ss.activateTree(this,!1);if(!this.isBuilt)return void(this.isVisible=!0);var t=this.motif.options.placeholder?.parentElement;t&&(t.replaceChild(this.element,this.motif.options.placeholder),this.isVisible=!0,ss.activateTree(this))}}async _hide(){if(this.isDisposed||!this.element)return;if(this._base._showSeq=(this._base._showSeq??0)+1,!this.isVisible)return;if("detach"===this._computeHideStrategy()){if(ss.callVisibilityChanged(this,!1),this.isDisposed)return;return await this._base._detachDomWithAnimationAsync(),this.isVisible=!1,void ss.deactivateTree(this)}{const t=this.motif.options.transition,e=!0===t.skipNextLeave;e&&(t.skipNextLeave=!1);const s=()=>{if(ss.callVisibilityChanged(this,!1),!this.isDisposed){if(this.element.nodeType===Node.COMMENT_NODE)return this.controls.forEach(t=>{e&&t.isVisible&&t.element&&!t.isDisposed&&t.motif.options?.transition&&(t.motif.options.transition.skipNextLeave=!0),t.motif.hide()}),this.isVisible=!1,void ss.deactivateTree(this,!1);var t=this.element.parentElement;t&&(this.motif.options.placeholder||(this.motif.options.placeholder=qi.createComment("h")),t.replaceChild(this.motif.options.placeholder,this.element)),this.isVisible=!1,ss.deactivateTree(this)}};return e?void s():t.leaveTransition(s).finished}}_toggle(){!this.isDisposed&&this.element&&(this.isVisible?this.motif.hide():this.motif.show())}async _on(t,e,s=!0){if(this.isDisposed||!this.element)return this;const i=String(t);if(i.startsWith("x:")){const t=i.slice(2).toLowerCase();if("mounted"===t){let t;const s=ki(this.element,()=>{if(t&&(this._base._mountedSubs?.get(e)?.delete(t),this._disposables.detach(t)),this.isDisposed)return;const s={cancel:!1};C(()=>e.length<=1?e(s):e(this,s),"MJX122","x:mounted")});if(s){t=this._register(D.toDisposable(s));const i=this._base._mountedSubs??=new Map;let n=i.get(e);n||(n=new Set,i.set(e,n)),n.add(t)}return this}if(Fs.has(t))return this._base.emiters.on("on"+t,e),this}const n=i.indexOf(":"),o=n<0?i:i.slice(0,n),r=n<0?bs:i.slice(n+1).split(":"),a=o.startsWith("on")?o.slice(2).toLowerCase():o.toLowerCase();let c,l=s?vs:0;r.length&&(c={},r.includes("once")&&(c.once=!0),r.includes("passive")&&(c.passive=!0),r.includes("capture")&&(c.capture=!0,l|=ys),r.includes("self")&&(l|=1),r.includes("trusted")&&(l|=2),r.includes("prevent")&&(l|=4),r.includes("stop")&&(l|=8));const h=new Ms(this,i.toLowerCase(),e,a,l);return s&&this.element.addEventListener(a,h,c),function(t,e){let s=t._eventHandlers;if(void 0!==s){for(;void 0!==s.next;)s=s.next;s.next=e}else t._eventHandlers=e}(this,h),this}async _trigger(t,e){if(this.isDisposed||!this.element)return this;const s=String(t).toLowerCase();return i(()=>{Ss++;try{for(let t=this._eventHandlers;void 0!==t;t=t.next)if(0===(t.flags&ws)&&t.key===s)try{t.handleEvent(e)}catch{}}finally{Ss--}},"trigger"),this}async _off(t,e){if(this.isDisposed||!this.element)return this;const s=String(t).toLowerCase();if(s.startsWith("x:")){const t=s.slice(2);if("mounted"===t){const t=this._base._mountedSubs?.get(e);if(t){this._base._mountedSubs.delete(e);for(const e of t)this._disposables.delete(e)}return this}return Fs.has(t)&&this._base._emiters?.off("on"+t,e),this}for(let t=this._eventHandlers;void 0!==t;t=t.next)if(0===(t.flags&ws)&&t.key===s&&t.original===e){if(0!==(t.flags&vs)){const e=t;i(()=>{this.element.removeEventListener(e.type,e,0!==(e.flags&ys))},"off.removeEventListener")}t.flags|=ws;break}return 0===Ss&&function(t){let e,s;for(let i=t._eventHandlers;void 0!==i;i=i.next)0===(i.flags&ws)&&(void 0===s?e=i:s.next=i,s=i);void 0!==s&&(s.next=void 0),t._eventHandlers=e}(this),this}dispose(t={deep:!0}){return this.isDisposed?Promise.resolve():this._disposing?this._disposing:(ke(this),this._disposing=us,this._disposing=this._disposeCore(t,!1))}async _disposeCore(t,e){let s;if(fs(this,t,e),e||ze(this)?.skipNextLeave||(s=this._base._detachDomWithAnimationAsync()),await void 0,0===Ae.live&&ds(this,!0)){const i=function(t,e,s,i){const n={deep:e?.deep},o=[t],r=[-1];let a=null;i||as(t);for(let e=0;e<o.length;e++){const s=o[e];if(s.isDisposed)continue;const i=Xs(s);if(0===i.length)continue;const c=Array.from(i);for(let s=0;s<c.length;s++){const i=c[s];if(!i.isDisposed)if(i._disposing)(a??=[]).push(i._disposing);else try{ke(i),i._disposing=t._disposing,fs(i,n,!0),!1!==i.element?.isConnected&&as(i),o.push(i),r.push(e)}catch(t){M("MJX107",t)}}}const c=o.length;if(c>1){const t=new Array(c).fill(0);for(let e=c-1;e>=1;e--){const s=r[e];t[e]+1>t[s]&&(t[s]=t[e]+1)}const e=[];for(let t=1;t<c;t++)e.push(t);e.sort((e,s)=>t[e]-t[s]||e-s);for(let t=0;t<e.length;t++)try{ms(o[e[t]],n,!0)}catch(t){M("MJX107",t)}}return a||(!s&&t.isDisposed||ms(t,e,s),null)}(this,t,e,void 0!==s);if(i){if(await Promise.all(i),!e&&this.isDisposed)return;ms(this,t,e)}return}await _s(this,t,e,s)}disposeAsync(t={deep:!0}){return this.isDisposed?Promise.resolve():this._disposing?this._disposing:(ke(this),this._disposing=us,this._disposing=this._disposeCore(t,!0))}async _clear(){1!=this.isDisposed&&(this.motif.options&&this.motif.options.disableDisposal||await this.controls.clearAsync())}using(t,e,s){t.then(t=>{this&&!this.isDisposed&&e&&e(t)},t=>{this&&!this.isDisposed&&s&&s(t)})}doWork(t){return Promise.resolve(t).then(t=>this&&!this.isDisposed?t:S("MJX108"))}get siblings(){return this._siblingsSet||this.isDisposed&&!this.motif?.options?this._siblingsApi:this._siblingsApi??=this._createSiblingsApi()}set siblings(t){this._siblingsApi=t,this._siblingsSet=!0}_createSiblingsApi(){return{all:()=>this.parent?.controls.items,next:()=>{if(!this.parent)return;const t=this.parent.controls.items.indexOf(this);return this.parent.controls.items[t+1]},prev:()=>{if(!this.parent)return;const t=this.parent.controls.items.indexOf(this);return this.parent.controls.items[t-1]},nextAll:()=>{if(!this.parent)return;const t=this.parent.controls.items.indexOf(this);return this.parent.controls.items.slice(t+1)},prevAll:()=>{if(!this.parent)return;const t=this.parent.controls.items.indexOf(this);return this.parent.controls.items.slice(0,t)}}}get serviceProvider(){let t=this;for(;t;){const e=t.provider;if(e)return e;const s=ps.get(t);if(s)return"disposed"===s.state?null:s.provider;t=t.parent}try{return Ho.main?.provider??null}catch{return null}}getService(t){try{const e=this.serviceProvider;if(e)return e._getFor(this,t);k("MJX407",[Fe(t)],{token:t})}catch(e){k("MJX408",[Fe(t),String(e?.message??e)],{token:t,error:e})}return null}$(t){return this.isDisposed||!this.element?{fromDom:()=>null,fromComponent:()=>[]}:{fromDom:()=>{var e,s=wi(this)?.element;return(e=s||document)?e.querySelectorAll(t):null},fromComponent:()=>{const e=wi(this),s=[],i=e=>{const n=e.element;if(n&&n.nodeType===Node.ELEMENT_NODE){const i=n.matches||n.msMatchesSelector||n.webkitMatchesSelector;if("function"==typeof i)try{i.call(n,t)&&s.push(e)}catch{}}if(e.controls&&e.controls.items&&e.controls.items.length)for(const t of e.controls.items)i(t)};return i(e??this),s}}}async _stopAnimations(){const t=ze(this);try{t?.activeCssCancel?.()}catch{}try{if(t?.activeAnimations?.length)try{await Promise.all(t.activeAnimations.map(t=>t.finished?.catch(()=>{})))}catch{}}catch(t){}this.isDisposed||t&&(t.activeAnimations=[])}}function Vs(t,e=[]){return!t||t.isDisposed||("TransportTo"===t.constructor.name&&e.push(t),t.controls&&t.controls.items&&t.controls.items.forEach(t=>Vs(t,e))),e}const Ws=new WeakMap;function $s(t,e){const s=(Array.isArray(e)?e:[e]).filter(t=>"function"==typeof t);if(0===s.length)return s;let i=Ws.get(t);i||(i=new Set,Ws.set(t,i));const n=[];for(const t of s)i.has(t)||(i.add(t),n.push(t));return n}function Us(t,e){Array.isArray(e)&&e.some(t=>t instanceof zs)&&t.motif.setDisposable(()=>{for(const t of e)t instanceof zs&&!t.isDisposed&&!t.parent&&t.dispose()})}const qs=t=>"function"==typeof t||Array.isArray(t);function Gs(t,e){const s=[];if(!t||"object"!=typeof t)return s;Object.prototype.hasOwnProperty.call(t,"ref")&&(qs(t.ref)?(s.push(t.ref),delete t.ref):e&&t.ref&&"object"==typeof t.ref&&(t.ref=e));const i=t.runover;if(i&&"object"==typeof i&&Object.prototype.hasOwnProperty.call(i,"ref"))if(qs(i.ref)){s.push(i.ref);const e={...i};delete e.ref,t.runover=e}else e&&i.ref&&"object"==typeof i.ref&&(i.ref=e);return 0===s.length?s:[].concat(...s)}const Ks={initializecomponent:"_initializeComponentHandlers",oninitializecomponent:"_onInitializeComponentHandlers",onbuilding:"_onBuildingHandlers",onbuilt:"_onBuiltHandlers",onmounted:"_onMountedHandlers",oninitializing:"_onInitializingHandlers",oninitialized:"_onInitializedHandlers",onconfig:"_onConfigHandlers",onconfigured:"_onConfiguredHandlers",onvisibilitychanged:"_onVisibilityChangedHandlers",onactivated:"_onActivatedHandlers",ondeactivated:"_onDeactivatedHandlers",ondisposing:"_onDisposingHandlers",ondisposed:"_onDisposedHandlers"};function Ys(t,e,s){const i=Object.prototype.hasOwnProperty.call(Ks,e)?Ks[e]:void 0;if(!i)return!1;const n=Array.isArray(s)?s:[s];if(0===n.length||!n.every(t=>"function"==typeof t))return!1;const o=t;let r=0;if("_initializeComponentHandlers"===i&&(void 0!==o._init||o._baseCtx?._initializeComponentHandlers||(o._init=n[0],r=1)),r>=n.length)return!0;const a=o._base;for(let t=r;t<n.length;t++){const e=n[t];if("_initializeComponentHandlers"===i&&e===o._init)continue;const s=a[i];void 0===s?a[i]=e:"function"==typeof s?s!==e&&(a[i]=[s,e]):s.includes(e)||s.push(e)}return!0}function Qs(t,e){if(t){var s=Object.keys(t);return 0!==s.length&&(s.forEach(s=>{if("initializeComponent"==s||"oninitializeComponent"==s||s.startsWith("on")){if(Ys(e,s.toLowerCase(),t[s]))return void delete t[s]}else if("childs"==s){const i=[].concat(...t[s]);e.childs=i,Us(e,i),delete t[s]}else if("transition"===s)ei(t[s],e),delete t[s];else if(vi.hasOwnProperty(s.toLowerCase())||vi.hasOwnProperty("on"+s.toLowerCase())){var i;i=s.toLowerCase().startsWith("on")||"initializecomponent"===s.toLowerCase()?s:"on"+s,e[i]=t[s],delete t[s]}else if(s.startsWith("on"))e.motif.on(s,t[s]);else if(s.startsWith("x-")){var n=s.replace("x-","on");if("x-wait"==s.toLowerCase())e.bindings.wait(t[s]);else if("x-display"==s.toLowerCase())e.bindings.display(t[s]);else if(Ys(e,n.toLowerCase(),t[s]))return void delete t[s];delete t[s]}else s.startsWith("runover")?(Qs(t[s],e),delete t[s]):s.startsWith("preconfig")?(e.motif.options._preconfig=t[s],delete t[s]):"__childExpr"===s&&delete t[s]}),"object"==typeof t&&0===Reflect.ownKeys(t).length)}return!1}const Zs=new WeakMap;function ti(t,e,s){const i=t.motif.options.transition;if("string"==typeof e&&e.length>0)i.name=e,s&&(i.classes=void 0);else if(e&&"object"==typeof e)if("string"==typeof e.name&&e.name.length>0&&(i.name=e.name),"mode"in e){const{mode:t,...s}=e;je(t)&&(i.mode=t),Object.keys(s).length>0&&(i.classes=s)}else i.classes=e;else s&&(i.name="",i.classes=void 0)}function ei(t,e){e&&!e.isDisposed&&null!=t&&Zs.get(e)!==t&&(Zs.set(e,t),"function"!=typeof t?ti(e,t,!1):e.bindings.watch(()=>{const s=t();e.isDisposed||ti(e,s,!0)}))}function si(t){return t instanceof zs||Array.isArray(t)&&t.length>0&&t.every(t=>t instanceof zs)}const ii=new WeakSet;const ni=["hideStrategy","disableDisposal"];function oi(t,e){if(t&&"object"==typeof t&&e&&!e.isDisposed)for(const s of ni)void 0!==t[s]&&(e.motif.options[s]=t[s])}const ri=new Set(["ref","key","indexkey","inject","options","props","settings","isSvg","childs","initializeComponent","runover","transition","preconfig","nodes","onElementCreating"]),ai=new Set(["innerhtml","srcdoc"]),ci=new Set(["href","src","action","formaction","xlink:href"]),li=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function hi(t){if(null==t||"boolean"==typeof t)return!1;try{return li.test(String(t))}catch{return!1}}function ui(t,e){return()=>{let s=e();return"function"==typeof s&&(s=s()),"function"==typeof s&&(s=s()),hi(s)?(k("MJX125",[t]),null):s}}function di(t,e){if(!t||"object"!=typeof t||e.isDisposed)return;const s=Object.keys(t);if(0===s.length)return;let i=null,n=null;for(const o of s){if(ri.has(o))continue;if(o.startsWith("x-")||o.startsWith("x:")||o.startsWith("__"))continue;let s=t[o];if(void 0===s)continue;if(/^on/i.test(o)){"function"==typeof s&&e.motif.on(o,s);continue}if("function"==typeof s&&s.length>0)continue;const r=o.toLowerCase();if(ai.has(r))k("MJX124",[o]);else{if(ci.has(r))if("function"==typeof s)s=ui(o,s);else if(hi(s)){k("MJX125",[o]);continue}(n??=fi(e)).set(o,s),"class"===o||"className"===o?e.class.add(s&&"object"==typeof s&&!Array.isArray(s)?[s]:s):"style"===o?e.style(s):"value"===o||"checked"===o||"selected"===o?e.bindings.add(o,s):(i??={})[o]=s}}i&&e.attr.add(i)}const pi=new WeakMap;function fi(t){let e=pi.get(t);return e||(e=new Map,pi.set(t,e)),e}const mi=new Set(["class","className","style","id","tabindex","role"]);function _i(t){return mi.has(t)||t.startsWith("aria-")||t.startsWith("data-")}let gi=!1;function yi(t,e){if(!t||"object"!=typeof t||e.isDisposed)return;const s=pi.get(e);let i=null;for(const e of Object.keys(t)){if(!_i(e))continue;const n=t[e];null!=n&&("function"==typeof n&&n.length>0||s&&s.has(e)&&Object.is(s.get(e),n)||((i??={})[e]=n))}i&&di(i,e)}const vi={oninitializecomponent:(t,e)=>{},initializecomponent:(t,e)=>{},onconfigured:(t,e)=>{},onconfig:(t,e)=>{},onbuilding:(t,e)=>{},onbuilt:(t,e)=>{},onmounted:(t,e)=>{},oninitializing:(t,e)=>{},oninitialized:(t,e)=>{},ondisposing:(t,e)=>{},ondisposed:(t,e)=>{},onvisibilitychanged:(t,e)=>{},ondeactivated:(t,e)=>{},onactivated:(t,e)=>{}};function wi(t){return i(()=>!t||t.isDisposed?null:t.element.nodeType!==Node.COMMENT_NODE&&t.element.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&t.element.nodeType!==Node.TEXT_NODE?t:t.parent?wi(t.parent):null,"findAppendableComponent",null)}const bi=new Set;let Si=null;function Mi(){if(!bi.size&&Si){try{Si.disconnect()}catch{}Si=null}}function Ci(){for(const t of[...bi])if(bi.has(t)&&document.contains(t.element)){bi.delete(t);try{t.callback()}catch(t){queueMicrotask(()=>{throw t})}}Mi()}function ki(t,e){if(document.contains(t))return e(),null;const s={element:t,callback:e};return bi.add(s),Si||(Si=new MutationObserver(Ci),Si.observe(document.documentElement,{childList:!0,subtree:!0})),()=>{bi.delete(s)&&Mi()}}function Di(t){!function(t){const e=_e.get(t);e&&(_e.delete(t),e.live&&e.scope._releaseLivePin(),pe?._touch())}(t),ss.activateTree(t)}function Ai(t){Ce(t),ss.deactivateTree(t)}const xi=100;function Ei(t,e){let s=t,i=0;for(;"function"==typeof s;){if(s.prototype instanceof zs)return new s(e);if(++i>xi)return M("MJX112",void 0,xi),s;s=s(e)}return s}const Ti="http://www.w3.org/2000/svg";class Oi extends zs{constructor(){const t=new.target;var e,s,i=arguments;if(1===i.length?e=i[0]:2===i.length&&(e=i[0],s=i[1]),e instanceof Function&&Ji(e=Ei(e,s)))return Bi(e,s);if(Array.isArray(e)){super(Vi(),{});var n=Object.create(s||{});for(const t in e){const s=e[t];this.controls.add(new Oi(s,n))}}else if("string"==typeof e&&e.trim().length>0)if(s||(s={}),s?.options&&s.options.isSvg||s?.__isSvgElement){const t=qi.createElementNS("http://www.w3.org/2000/svg",e,s);s.isSvg=!0,super(t,s)}else{super(qi.createElement(e,s),s)}else if(e instanceof Node)super(e,s);else{if(e instanceof zs)return e;{const i=e&&"object"==typeof e?e:s,n=function(t){try{const e=t?.elementTag;if("string"==typeof e){const t=e.trim();if(t)return t}}catch{}}(t);if(n){super(function(t,e,s){const i="string"==typeof e?.elementNamespace&&e.elementNamespace?e.elementNamespace:void 0;return i===Ti||!0===s?.options?.isSvg||!0===s?.__isSvgElement?(s&&"object"==typeof s&&(s.isSvg=!0),qi.createElementNS(i||Ti,t,s)):qi.createElement(t,s)}(n,t,i),i??{})}else super(Vi(),i??{});const o=this.childs;if(Array.isArray(o)&&o.length&&!0!==t?._placesChilds)for(const t of o)t&&this.controls.add(t)}}}}function Ni(t){return e=>{var s=zi({...e});return s.controls.add(t(e)),s}}function Pi(t,e){if(t instanceof zs)for(const s of $s(t,e))C(()=>s(t),"MJX122","ref");return t}function Li(t,e){const s=t._base?.[e];return s?"function"==typeof s?[s]:s:[]}function Xi(t,e){return Li(t,e).length}function Ri(t,e,s,i){for(let n=s;n<Xi(t,e);n++){if(t.isDisposed)return;const s=Li(t,e)[n];C(()=>s(t,{cancel:!1}),"MJX122",i)}}function Ii(t,e){if("string"==typeof t){if("function"==typeof e){const s=new Oi(t);return s._init=e,s}if("text"===t&&e&&e.__childExpr){const t=function(t){if("function"!=typeof t)return;let e;try{e=Ot(t)}catch{return}return e instanceof zs||Array.isArray(e)&&e.length>0&&e.every(t=>t instanceof zs)?e:void 0}(e.__childExpr);if(void 0!==t)return t}return new Oi(t,e)}if(t instanceof zs||t instanceof Oi)return t;if("function"==typeof t){const s=t.prototype instanceof zs?[]:Gs(e),i=Ei(t,e);return"object"==typeof i&&null!==i&&"el"in i?Pi(Bi(i,e),s):function(t,e,s){if(!e||"object"!=typeof e)return t;if(!(t instanceof zs))return t;Pi(t,s.concat(Gs(e))),Us(t,e.childs),yi(e,t),oi(e.options,t),Object.prototype.hasOwnProperty.call(e,"transition")&&ei(e.transition,t);const i=e.runover;if(!i||"object"!=typeof i)return t;const n=Xi(t,"_onConfigHandlers"),r=Xi(t,"_onInitializingHandlers"),a=Xi(t,"_onInitializedHandlers");if(Qs(i,t),Ri(t,"_onInitializingHandlers",r,"onInitializing"),Ri(t,"_onInitializedHandlers",a,"onInitialized"),t.isConfigured){const e=t.motif.options?._preconfig;"function"==typeof e&&o(()=>e(t),"motifComponent.preconfig");for(let e=n;e<Xi(t,"_onConfigHandlers");e++){const s=Li(t,"_onConfigHandlers")[e];C(()=>s(t,{cancel:!1}),"MJX122","onConfig")}}return t}(i,e,s)}return"object"==typeof t&&null!==t&&"el"in t?Bi(t,e):new Oi(t,e)}function Ji(t){return"object"==typeof t&&null!==t&&!(t instanceof zs)&&"el"in t}function ji(t){return!t||"object"!=typeof t||t instanceof zs||null==t.default?t:t.default}function Fi(t){if(null!==t&&"object"==typeof t&&!(t instanceof zs||Array.isArray(t)||t instanceof Node)&&"function"!=typeof t.then)throw S("MJX127",function(t){return null===t?"null":Array.isArray(t)?"array":"object"!=typeof t||"[object Module]"!==Object.prototype.toString.call(t)&&!t.__esModule?typeof t:"module"}(t))}function Hi(t,e){const s=Ei(t,e);return Ji(s)?Bi(s,void 0):s}function Bi(t,e){const s="string"==typeof t.el?function(t){gi=!0;try{return t()}finally{gi=!1}}(()=>Ii(t.el,e)):Ii(t.el,e);return Object.getOwnPropertyNames(t).forEach(e=>{"el"!==e&&"ctor"!==e&&(s[e]=t[e])}),"function"==typeof t.ctor&&C(()=>t.ctor.call(s,e),"MJX122","ctor"),s}function zi(t){return new Wi(t)}function Vi(){return qi.createComment("")}class Wi extends Oi{constructor(t,e){super(Vi(),arguments.length<=1?t:e)}initializeComponent(t){const e=this.childs;if(Array.isArray(e)&&e.length)for(const t of e)t&&this.controls.add(t);o(()=>{const t=this.props?.nodes;if(Array.isArray(t)&&t.length)for(const e of t)e&&this.controls.add(e)},"Fragment.initializeComponent.props.nodes")}}const $i=globalThis;function Ui(){return $i&&$i.motifDom?$i.motifDom.window.document:$i.document}const qi={get window(){return $i&&$i.window?$i.window:$i&&$i?$i.motifDom.window:$i},_created:new Map,document:Ui(),createElement(t,e){const s=Ui();if(!s)throw S("MJX101",t);if("text"===t)return s.createTextNode("");if(!this._created.has(t)){const i=s.createElement(t,e);this._created.set(t,i)}return this._created.get(t).cloneNode(!1)},createDocumentFragment(){try{var t=Ui();if(t)return t.createDocumentFragment()}catch(t){s.reportSuppressed("dom.createDocumentFragment",t)}},createComment(t){try{return Ui()?.createComment(t)}catch(t){s.reportSuppressed("dom.createComment",t)}},createTextNode(t){try{return Ui()?.createTextNode(t)}catch(t){s.reportSuppressed("dom.createTextNode",t)}},querySelectorAll(t){try{return Ui()?.querySelectorAll(t)}catch(t){s.reportSuppressed("dom.querySelectorAll",t)}},createElementNS(t,e,s){try{return Ui()?.createElementNS(t,e,s)}catch(t){M("MJX103",t,e)}},convertToSvgElement(t){const e=t.tagName.toLowerCase(),s=document.createElementNS("http://www.w3.org/2000/svg",e);for(const e of t.attributes)s.setAttribute(e.name,e.value);for(;t.firstChild;)s.appendChild(t.firstChild);const i=t.parentNode;return i&&i.replaceChild(s,t),s},get body(){return Ui()?.body}},Gi=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;var Ki;function Yi(t,e,...s){return function(t,e,s,...i){const n=Gi.exec(e);if(!n)throw S("MJX102",e);const o=n[1]||"div";let r;return r=t!==Ki.HTML?qi.createElementNS(t,o):qi.createElement(o),n[3]&&(r.id=n[3]),n[4]&&(r.className=n[4].replace(/\./g," ").trim()),s&&Object.entries(s).forEach(([t,e])=>{void 0!==e&&(/^on\w+$/.test(t)?r[t]=e:"selected"===t?e&&r.setAttribute(t,"true"):r.setAttribute(t,e))}),r.append(...i),r}(Ki.HTML,t,e,...s)}!function(t){t.HTML="http://www.w3.org/1999/xhtml",t.SVG="http://www.w3.org/2000/svg"}(Ki||(Ki={}));class Qi{constructor(t){this.owner=t,this.items=[]}add(){const t=arguments.length;if(0===t)return[];const e=arguments[0];if(1===t&&e instanceof zs)return e.isDisposed?[]:[this._insertOne(void 0,e)];const s=Array.from(arguments);if("number"==typeof s[0]&&s.length>1){const t=s[0],e=[].concat(...s.slice(1));return this.insert(t,...e)}{const t=[].concat(...s);return this.insert(void 0,...t)}}insert(t,...e){return[].concat(...e).filter(t=>null!=t&&!t.isDisposed).map(e=>this._insertOne(t,e))}_insertOne(t,e){"string"!=typeof(e=Ei(e))&&"number"!=typeof e&&"boolean"!=typeof e&&"bigint"!=typeof e||(e=new Oi(qi.createTextNode(e),null)),es(e),e.parent&&e.parent.controls.detach(e),null!=t&&t>=0?this.items.splice(t,0,e):this.items.push(e),e.parent=this.owner;const s=e.__pendingLeave;return s?(this.onAddBeforeBuild&&!this.owner.isBuilt&&this.onAddBeforeBuild(e),s.promise.then(()=>{e.isDisposed||this.owner.isDisposed||e.parent!==this.owner||this.onAdd&&this.owner.isBuilt&&this.onAdd(e)}),e):(this.onAdd&&this.owner.isBuilt&&this.onAdd(e),this.onAddBeforeBuild&&!this.owner.isBuilt&&this.onAddBeforeBuild(e),e)}remove(t){var e=this.items.indexOf(t);if(e>-1){this.items.splice(e,1);try{t.dispose()}catch{}}}detach(t){const e=this.items.indexOf(t);return-1===e?Promise.resolve():(this.items.splice(e,1),t.isDisposed?Promise.resolve():(t._leaveContainer=this.owner,t.parent=null,function(t,e){let s=()=>{};const i=new Promise(t=>{s=t});let n=1,o=!1;const r=()=>{if(!o){if(o=!0,t.__pendingLeave?.promise===i&&delete t.__pendingLeave,!t.isDisposed){try{sn(t)}catch(t){M("MJX117",t)}Ai(t)}try{e()}catch(t){M("MJX118",t)}s()}},a=()=>{n--,0===n&&r()},c=t=>{if(!t||t.isDisposed||!t.element||!t.isVisible||t.isWait)return;const e=t.element;if(e.nodeType===Node.COMMENT_NODE)return void t.controls.items.forEach(c);if(e.nodeType!==Node.ELEMENT_NODE)return;n++;let s=!1;const i=()=>{s||(s=!0,a())};try{const e=t.motif.options;if(!e[Ee]&&!e.transitionOut)return void i();e.transition.leaveTransition(i)}catch{i()}};return t.__pendingLeave={promise:i,finish:r},c(t),a(),i}(t,()=>{this.onRemove&&this.onRemove(t)})))}silentDetach(t,e=!1){if(e)return void this.silentUnlink(t);const s=this.items.indexOf(t);if(-1!==s&&(this.items.splice(s,1),!t.isDisposed)){t.parent=null;try{sn(t)}catch(t){M("MJX117",t)}Ai(t)}}silentUnlink(t){const e=this.items.indexOf(t);-1!==e&&(this.items.splice(e,1),t._leaveContainer=this.owner,t.parent=null)}async clearAsync(){const t=this.items.splice(0,this.items.length);await Promise.all(t.map(t=>t.dispose()))}clear(){this.items.splice(0,this.items.length).forEach(t=>{try{t.dispose()}catch{}})}get length(){return this.items.length}forEach(t){this.items.forEach(t)}map(t){return this.items.map(t)}move(t,e){if(!t||t.isDisposed)return;if(e===t)return;if(t.parent!==this.owner)return;if(e&&e.parent!==this.owner)return;const s=this.items.indexOf(t);if(-1===s)return;const i=e?this.items.indexOf(e):-1;if(e&&-1===i)return;if(e?i===s+1:s===this.items.length-1)return;if(this.items.splice(s,1),e){const s=this.items.indexOf(e),i=s>=0?s:this.items.length;this.items.splice(i,0,t)}else this.items.push(t);const n=Zi(this.owner);if(!n||!ns(t,n))return;const o=e?this.items.indexOf(e):-1;en(t,n,o>=0?function(t,e,s,i){for(let t=s;t<e.length;t++){const s=ns(e[t],i);if(s)return s}return tn(t)}(this.owner,this.items,o,n):tn(this.owner))}_reorder(t,e){const s=Zi(this.owner);if(s){let i=tn(this.owner);for(let n=t.length-1;n>=0;n--){const o=t[n],r=ns(o,s);r&&(e.has(n)||en(o,s,i),i=r)}}const i=this.items;for(let e=0;e<t.length;e++)i[e]=t[e]}moveToIndex(t,e){if(!t||t.isDisposed)return;if(!Number.isFinite(e))return;if(e<0&&(e=0),e>this.items.length&&(e=this.items.length),-1===this.items.indexOf(t))return;const s=e>=this.items.length?null:this.items[e];this.move(t,s)}}function Zi(t){let e=t;for(;e;){const t=e.element;if(t&&t.nodeType!==Node.COMMENT_NODE&&t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&t.nodeType!==Node.TEXT_NODE)return t;e=e.parent}return null}function tn(t){const e=t.element;return e&&e.nodeType===Node.COMMENT_NODE&&t.motif.options?.closeFragment||null}function en(t,e,s){const i=ns(t,e);if(!i)return;if(i.nodeType!==Node.COMMENT_NODE||i!==t.element){try{e.insertBefore(i,s)}catch{}return}const n=i,o=t.motif.options?.closeFragment||null;if(!o){try{e.insertBefore(n,s)}catch{}return}s&&function(t,e,s){let i=t,n=1e4;for(;i&&n-- >0;){if(i===s)return!0;if(i===e)break;i=i.nextSibling}n<=0&&M("MJX120",void 0);return!1}(n,o,s)&&(s=o.nextSibling);const r=qi.createDocumentFragment&&qi.createDocumentFragment()||e.ownerDocument?.createDocumentFragment?.()||function(){try{return document.createDocumentFragment()}catch{return null}}();if(!r){let t=n,i=1e4;for(;t&&i-- >0;){const i=t.nextSibling;try{e.insertBefore(t,s)}catch{}if(t===o)break;t=i}return void(i<=0&&M("MJX119",void 0))}let a=n,c=1e4;for(;a&&c-- >0;){const t=a.nextSibling;try{r.appendChild(a)}catch{}if(a===o)break;a=t}c<=0&&M("MJX119",void 0);try{e.insertBefore(r,s)}catch{}}function sn(t){const e=t.element;if(!e)return;const s=t.motif.options;if(e.nodeType===Node.COMMENT_NODE&&e.parentNode){const t=s?.closeFragment||null,i=s.cache??(s.cache=qi.createDocumentFragment());let n=e,o=1e4;for(;n&&o-- >0;){const e=n.nextSibling;if(i.appendChild(n),!t||n===t)break;n=e}return}if(e.parentNode)return void e.parentNode.removeChild(e);const i=s?.placeholder;i&&i.parentNode&&i.parentNode.removeChild(i)}function nn(t){return ji(t)}function on(t){const e=t&&t.options||{},s=new hn,i=new Set,n=t=>{try{i.add(t)}catch{}return t},o=()=>{try{i.forEach(t=>{try{clearTimeout(t)}catch{}})}catch{}try{i.clear()}catch{}};try{s.motif.register(D.toDisposable(()=>o()))}catch{}const r=e.Placeholderview??e.Loaderview;null!=r&&s.navigate(Hi(r));const a=()=>{if(!e.timeoutMs&&!e.signal)return t.caller();const s=[t.caller()];return e.timeoutMs&&e.timeoutMs>0&&s.push(new Promise((t,o)=>{const r=n(setTimeout(()=>o(S("MJX110",e.timeoutMs)),e.timeoutMs));if(s[0].finally(()=>{try{clearTimeout(r),i.delete(r)}catch{}}).catch(()=>{}),e.signal){const t=()=>{try{clearTimeout(r),i.delete(r)}catch{}};try{e.signal.addEventListener("abort",t,{once:!0})}catch{}}})),e.signal&&s.push(new Promise((t,s)=>{if(e.signal.aborted)return void s(S("MJX111"));const i=()=>{e.signal.removeEventListener("abort",i),o(),s(S("MJX111"))};e.signal.addEventListener("abort",i,{once:!0})})),Promise.race(s)},c=function(t){return"number"==typeof t?{count:Math.max(0,Math.floor(t)),delayMs:500,whenOnline:!0}:t&&"object"==typeof t?{count:Math.max(0,Math.floor(t.count||0)),delayMs:Math.max(0,t.delayMs??500),whenOnline:!1!==t.whenOnline}:{count:0,delayMs:0,whenOnline:!1}}(e.retry),l=new Set;try{s.motif.register(D.toDisposable(()=>{l.forEach(t=>{try{t()}catch{}}),l.clear()}))}catch{}const h=t=>new Promise(s=>{let o=!1;const r=t=>{if(!o){o=!0,l.delete(a);try{d&&window.removeEventListener("online",d)}catch{}try{void 0!==u&&(clearTimeout(u),i.delete(u))}catch{}try{e.signal?.removeEventListener("abort",h)}catch{}s(t)}},a=()=>r(!1),h=()=>r(!1);let u,d=null;l.add(a);try{e.signal?.addEventListener("abort",h,{once:!0})}catch{}const p=()=>{u=n(setTimeout(()=>r(!0),c.delayMs*t))};c.whenOnline&&"undefined"!=typeof navigator&&!1===navigator.onLine&&"undefined"!=typeof window?(d=()=>{try{window.removeEventListener("online",d)}catch{}d=null,p()},window.addEventListener("online",d)):p()}),u=c.count>0?(async()=>{let t=0;for(;;)try{return await a()}catch(i){if(e.signal?.aborted||s.isDisposed||t>=c.count)throw i;t++;try{e.onRetry?.(t,i)}catch{}if(!await h(t)||e.signal?.aborted||s.isDisposed)throw i}})():a(),d=Date.now(),p=t=>{try{e.onError?.(t)}catch{}if(!e.signal?.aborted)if(null!=e.Fallbackview)s.navigate(Hi(e.Fallbackview));else{M("MJX126",t);try{s.motif.clear().catch(()=>{})}catch{}}},f=t=>{let e;try{e=Hi(t),Fi(e)}catch(t){return void p(t)}s.navigate(e)};return u.then(t=>{if(e.signal?.aborted)return;const s=(e.mapResult??nn)(t),o=Date.now()-d,r=Math.max(0,e.minDelayMs??0),a=Math.max(0,r-o);if(a>0){const t=n(setTimeout(()=>{e.signal?.aborted||f(s)},a));if(e.signal){const s=()=>{try{clearTimeout(t),i.delete(t)}catch{}};try{e.signal.addEventListener("abort",s,{once:!0})}catch{}}}else f(s)}).catch(p),s}function rn(t,e){const s=t?.motif?.options;if(!s)return!1;const i=s.transition;return!!(("enter"===e?s.transitionIn:s.transitionOut)||i&&(i.classes||i.name&&i.name.length>0))}function an(t){if(t&&!t.isDisposed)if(Array.isArray(t))t.forEach(an);else{try{t.motif.options?.transition?.activeCssCancel?.()}catch{}try{const e=t.motif.options?.transition?.activeAnimations;Array.isArray(e)&&(e.forEach(t=>{try{t&&"function"==typeof t.cancel&&t.cancel()}catch{}}),e.length=0)}catch{}try{if(t.controls&&t.controls.items)for(const e of t.controls.items)an(e)}catch{}}}async function cn(t,e={deep:!0}){if(!t)return;const s=Array.isArray(t)?t:[t];await Promise.all(s.map(async t=>{if(t&&!t.isDisposed)try{await t.dispose(e)}catch(t){M("MJX115",t)}}))}async function ln(t,e,s=!1){if(t.isDisposed||null==e)return;if(null!==t.current&&t.current===e)return;const i=++t._latestNavigateId;t.isBusy=!0;const n=e=>{if(t.isDisposed)return;if(i!==t._latestNavigateId)return;const s=Ei(e);t.current=s;try{Array.isArray(s)?t.controls.add(...s):t.controls.add(s)}catch(t){M("MJX114",t)}t.isBusy=!1,t.previouspage=s};if(!(t._navPending||null!==t.current||e instanceof Promise)){try{n(e)}catch(e){M("MJX114",e),t.isBusy=!1}return}t._navPending=(t._navPending??0)+1;const o=t._navLock??Promise.resolve();t._navLock=(async()=>{try{await o;try{t._navAbort?.abort()}catch{}t._navAbort=new AbortController;const r=t.current;if(r&&!s){an(r),an(t);const e=!!(i=r)&&(Array.isArray(i)?i.some(t=>!!t&&!t.isDisposed&&rn(t,"leave")):!i.isDisposed&&rn(i,"leave")),s=cn(r);e?s.catch(()=>{}):await s}try{if(e instanceof Promise){const s=on({caller:()=>e,options:{signal:t._navAbort?.signal}});n(s)}else n(e)}catch(e){M("MJX114",e),t.isBusy=!1}}finally{t._navPending=Math.max(0,(t._navPending??1)-1)}var i})(),await t._navLock}class hn extends Oi{constructor(t){super(qi.createComment(""),t),this.current=null,this._latestNavigateId=0,this._navLock=Promise.resolve(),this.isBusy=!1,t&&t.childs&&Array.isArray(t.childs)&&t.childs.length>0&&this.controls.add(t.childs)}async dispose(t={deep:!0}){await cn(this.current,t),await super.dispose(t)}async flush(){await cn(this.current)}async _clear(){await cn(this.current)}async navigate(t,e=!1){await ln(this,t,e)}async navigateLazy(t,e,s=!1){const i=on({caller:t,options:e});await this.navigate(i,s)}}const un=new Set;function dn(t){un.add(t),un.forEach(t=>{t()})}const pn=new Map,fn=Symbol("changeBodyCollectionHandler");class mn extends Oi{constructor(t){super(t);const e=t=>{this.motif.trigger("controladded",{control:t});var e=pn.get(this.props.target);e&&(t.motif.options.ownerContentBlock=this,e.controls.add(t))};this.controls.onAdd=e,this.controls.onAddBeforeBuild=e,this.childs&&this.controls.add(...this.childs)}onConfigured(t,e){var s=pn.get(this.props.target);s?(this.controls.items.forEach(t=>{t.motif.options.ownerContentBlock=this}),s.controls.add(...this.controls.items)):this.context.on(fn,()=>{var t=pn.get(this.props.target);t&&(this.controls.items.forEach(t=>{t.motif.options.ownerContentBlock=this}),t.controls.add(...this.controls.items))})}onDisposing(t,e){var s=pn.get(this.props.target);if(s)for(const t of[...s.controls.items])t.motif.options.ownerContentBlock===this&&(s.controls.remove(t),k("MJX109",[],t))}ondisposing(t){}}class _n extends Oi{constructor(t){super(t),pn.set(this.props.name,this),this.context.fire(fn)}ondisposing(t){pn.get(this.props.name)===this&&pn.delete(this.props.name)}}const gn=Symbol("slotRegistered"),yn=Symbol("slotUnregistered");class vn{static{this.slots=new Map}static registerSlot(t,e){this.slots.set(t,e),Ho.main.fire(gn,{name:t,slot:e})}static unregisterSlot(t,e){this.slots.get(t)===e&&(this.slots.delete(t),Ho.main.fire(yn,{name:t,slot:e}))}static getSlot(t){return this.slots.get(t)}}class wn extends Oi{constructor(t){super(t),this.mode=t.mode||"replace"}initializeComponent(t){vn.registerSlot(this.props.name,this),this.onDisposing=()=>{[...this.controls.items||[]].forEach(t=>{this.controls.remove(t),t.dispose?.()}),vn.unregisterSlot(this.props.name,this)}}clearSlot(){[...this.controls.items||[]].forEach(t=>{this.controls.remove(t),t.dispose?.()})}}class bn{static transport(t,e,s={}){t&&e&&(t.parent===e&&e.controls.items.includes(t)||(t.parent&&t.parent!==e&&t.parent.controls.silentDetach(t,!0),s.owner&&(t.motif.options.ownerTransporter=s.owner),"number"==typeof s.index?e.controls.items.includes(t)||e.controls.items.splice(s.index,0,t):e.controls.items.includes(t)||e.controls.add(t),t.parent=e,s.keepState||t.reState()))}static transportMany(t,e,s={}){Array.isArray(t)&&t.forEach(t=>this.transport(t,e,s))}static createSlot(t,e){return{name:t,children:[],parent:e,mount(t,e={}){if(!this.parent)throw S("MJX113");this.children.includes(t)||(bn.transport(t,this.parent,e),this.children.push(t))},unmount(t){if(!this.parent)throw S("MJX113");this.children=this.children.filter(e=>e!==t),this.parent.controls.remove(t)},detachAll(){this.parent&&(this.children.forEach(t=>{this.parent.controls.remove(t)}),this.children=[])}}}}class Sn extends Oi{constructor(t){super("div",t),this._transported=[],this._countedLive=!1,this._handleSlotChange=t=>{if(t.name===this.props.name){const e=t.slot;"merge"!==e.mode&&e.clearSlot?.();const s=[...this.childs||[],...this.controls.items];bn.transportMany(s,e),this._rememberTransported(s)}},this._clearChildrenFromSlot=t=>{(this.childs||[]).forEach(e=>{t.controls.remove(e),e.dispose()}),(this.controls.items||[]).forEach(e=>{t.controls.remove(e),e.dispose()})},Ae.live++,this._countedLive=!0}_rememberTransported(t){const e=this._transported.filter(t=>!t.isDisposed);for(const s of t)e.includes(s)||e.push(s);this._transported=e}initializeComponent(t){let e=vn.getSlot(this.props.name);if(e){"merge"!==e.mode&&e.clearSlot?.();const t=[...this.childs||[],...this.controls.items];bn.transportMany(t,e),this._rememberTransported(t)}this._slotRegisteredListener=Ho.main.on(gn,this._handleSlotChange),this._slotUnregisteredListener=Ho.main.on(yn,t=>{t.name===this.props.name&&this._clearChildrenFromSlot(t.slot)}),this._onAddRef=t=>{this.motif.trigger("controladded",{control:t});const e=vn.getSlot(this.props.name);e&&(bn.transport(t,e),this._rememberTransported([t]))},this._onRemoveRef=t=>{const e=vn.getSlot(this.props.name);e&&e.controls.remove(t),this._transported=this._transported.filter(e=>e!==t)},this.controls.onAdd=this._onAddRef,this.controls.onRemove=this._onRemoveRef}onDisposing(t,e){this._countedLive&&(this._countedLive=!1,Ae.live--);const s=vn.getSlot(this.props.name);for(const t of this._transported||[])s?.controls.remove(t),t.dispose();this._slotRegisteredListener&&(Ho.main.off(gn,this._handleSlotChange),this._slotRegisteredListener=void 0),this._slotUnregisteredListener&&(Ho.main.off(yn,this._slotUnregisteredListener),this._slotUnregisteredListener=void 0),this.controls.onAdd===this._onAddRef&&(this.controls.onAdd=void 0),this.controls.onRemove===this._onRemoveRef&&(this.controls.onRemove=void 0),this._onAddRef=void 0,this._onRemoveRef=void 0,this._transported=[]}}const Mn=new Set(["push","pop","shift","unshift","splice","reverse","sort"]),Cn=Symbol(""),kn=new Map([[T.IS_REACTIVE,()=>!0],[T.IS_READONLY,t=>t.isReadonly],[T.IS_SUPERFICIAL,t=>t.superficial],[T.GET_SETUP,(t,e)=>e],[T.RAW,(t,e,s)=>t.ReactiveMap().get(e)===s?e:Cn]]);function Dn(t,e,s,i){if("symbol"!=typeof s)return Cn;const n=kn.get(s);return void 0===n?Cn:n(t,e,i)}function An(t){return function(e,s,i){const n=Dn(t,e,s,i);if(n!==Cn)return n;if(Array.isArray(e)&&!t.isReadonly){const i=t.arrayMethods.get;if(X(i,s)){const t=i[s];return Mn.has(s)?(o=s,$.push(P),P.enabled=!0,P.key=o):St(e,s),t}}var o;const r=Reflect.get(e,s,i);return"__proto__"===s||J(s)?r:(t.isReadonly||St(e,s),t.superficial||!R(r)?r:t.reactive(r))}}function xn(t){return function(e,s,i,n){if(null!=(o=e)&&Boolean(o[T.IS_READONLY]))return!1;var o;const r=Array.isArray(e),a=e[s],c=r?e.length:0,l=r&&("string"==typeof(h=s)&&F.test(h)&&String(Number(h))===h);var h;const u=l?Number(s)<c:X(e,s),d=Reflect.set(e,s,i,n);if(t.onValueChanged)try{t.onValueChanged({raw:e,proxy:n},s)}catch{}if(L(e)!==L(n))return d;if(!r&&u&&Object.is(i,a))return d;if(Mt(e,s),r||u||Mt(e,O),l&&!u&&Mt(e,"length"),r&&"length"===s){for(let t=Number(i);t<c;t++)Mt(e,String(t))}return function(){const t=$.pop();P=$.length>0?void 0===t?{enabled:!1,key:""}:t:{enabled:!1,key:""}}(),d}}function En(t){return function(t){return St(t,Array.isArray(t)?"length":O),Reflect.ownKeys(t)}}function Tn(t){return function(t,e){const s=Reflect.has(t,e);return J(e)||St(t,e),s}}function On(t){return function(t,e){V();try{const s=X(t,e),i=Reflect.deleteProperty(t,e);return s&&(Array.isArray(t)?Mt(t,"length"):(Mt(t,e),Mt(t,O))),i}finally{W()}}}const Nn=[["includes","lookup"],["indexOf","lookup"],["lastIndexOf","lookup"],["sort","order"],["concat","join"],["push","structural"],["pop","structural"],["shift","structural"],["unshift","structural"],["splice","structural"],["reverse","structural"]];class Pn{constructor(t){this.engine=t,this.get=this.createArrayMethods()}createArrayMethods(){const t={};for(const[e,s]of Nn)t[e]=this.patch(e,s);return t}patch(t,e){const s=this;switch(e){case"lookup":return function(...e){const i=L(this);s.engine.track(i,"length");const n=i[t](...e);return!1!==(o=n)&&-1!==o?n:i[t](...e.map(t=>L(t)));var o};case"order":return function(...e){const i=L(this),n=this.length;for(let t=0;t<n;t++)s.engine.track(i,String(t));const o=i[t].apply(this,e);return s.engine.track(i,t),o};case"join":return function(...t){return Array.prototype.concat.apply(this,t)};default:return function(...e){V();const s=L(this);try{return s[t].apply(this,e)}finally{W()}}}}}const Ln=Symbol("");function Xn(t,e,s){Mt(t,e),Mt(t,O),s&&Mt(t,Ln)}function Rn(t,e){return t.has(e)?e:L(e)}function In(t,e){return{next(){const s=t.next();return s.done?s:{value:e(s.value),done:!1}},[Symbol.iterator](){return this}}}function Jn(t){const e=function(t){const e=e=>R(e)?t.reactive(e):e,s=t=>t instanceof Map?([t,s])=>[t,e(s)]:([t])=>{const s=e(t);return[s,s]};return{get(t){const s=L(this),i=Rn(s,t);return St(s,i),e(s.get(i))},has(t){const e=L(this),s=Rn(e,t);return St(e,s),e.has(s)},set(t,e){const s=L(this),i=Rn(s,t),n=L(e),o=s.has(i),r=s.get(i);return s.set(i,n),o?Object.is(r,n)||Xn(s,i,!1):Xn(s,i,!0),this},add(t){const e=L(this),s=Rn(e,t);return e.has(s)||(e.add(s),Xn(e,s,!0)),this},delete(t){const e=L(this),s=Rn(e,t),i=e.delete(s);return i&&Xn(e,s,!0),i},clear(){const t=L(this);if(0===t.size)return;const e=Array.from(t.keys());t.clear();for(const s of e)Mt(t,s);Mt(t,O),Mt(t,Ln)},forEach(t,s){const i=L(this);St(i,O);const n=this,o=i instanceof Map;i.forEach((i,r)=>{const a=e(i);t.call(s,a,o?r:a,n)})},keys(){const t=L(this);return t instanceof Map?(St(t,Ln),t.keys()):(St(t,O),In(t.keys(),e))},values(){const t=L(this);return St(t,O),In(t.values(),e)},entries(){const t=L(this);return St(t,O),In(t.entries(),s(t))},[Symbol.iterator](){const t=L(this);return St(t,O),t instanceof Map?In(t.entries(),s(t)):In(t.values(),e)}}}(t);return{get(s,i,n){const o=Dn(t,s,i,n);if(o!==Cn)return o;if("size"===i)return St(s,O),s.size;if(("string"==typeof i||i===Symbol.iterator)&&X(e,i)&&i in s)return e[i];const r=Reflect.get(s,i,s);return"function"==typeof r?r.bind(s):r}}}const jn=new WeakSet,Fn=new WeakMap;const Hn=new class{startGc(t=1e4){}stopGc(){if(this._gci){try{clearInterval(this._gci)}catch{}this._gci=void 0}}constructor(){this.DisposeMapper=new st,this.arrayTriggerCache=new Map,this.ReactiveMap=()=>Fn,this.isReadonly=!1,this.superficial=!1,this.arrayMethods=new Pn(this),this.arrayHandler={get:An(this),set:xn(this),has:Tn(),deleteProperty:On(),ownKeys:En()},this.deepHandler={get:An(this),set:xn(this),has:Tn(),deleteProperty:On(),ownKeys:En()},this.collectionHandler=Jn(this),jn.add(this),this.startGc()}reactive(t){R(t)||(t={value:t});const e=(s=t,i=Object.getPrototypeOf(s),n="",i&&i.constructor&&(n=i.constructor.name),"Control"===n||"RouteManager"==n||"ServiceManager"==n?0:Object.isExtensible(s)?j.get(Object.prototype.toString.call(s))??0:0);var s,i,n;if(0===e)return t;let o=Fn.get(t);if(o)return o;if(o=Fn.get(L(t)),o)return o;if(2===e){var r=new Proxy(t,this.collectionHandler);return Fn.set(t,r),r}if(Array.isArray(t)){r=new Proxy(t,this.arrayHandler);return Fn.set(t,r),r}r=new Proxy(t,this.deepHandler);return Fn.set(t,r),r}clearModel(t){null!=t&&null!=t&&(Object.keys(t).forEach(e=>{"object"==typeof t[e]&&(Fn.has(t[e])||Fn.has(L(t[e])))&&this.clearModel(t[e]),Fn.delete(L(t[e])),Fn.delete(t[e])}),Fn.delete(L(t)),Fn.delete(t))}track(t,e){St(t,e)}trigger(t,e,s){Mt(t,e)}ArrayTrigger(t,e,...s){this.trigger(t,e,s)}toRaw(t){return JSON.parse(JSON.stringify(this.deepClone(t)))}deepClone(t){var e,s=this;if(!t)return t;if([Number,String,Boolean].forEach(function(s){t instanceof s&&(e=s(t))}),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach(function(t,i,n){e[i]=s.deepClone(t)});else if("object"==typeof t)if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var i in e={},t)e[i]=s.deepClone(t[i]);else e=t;return e}pauseTracking(){V()}enableTracking(){z(!0)}resetTracking(){W()}dispose(){var t=!0;for(this.stopGc();1==t;)if(this.DisposeMapper.size>0){const t=this.DisposeMapper.pop();Fn.delete(t)}else t=!1;this.DisposeMapper.clear(),jn.delete(this)}},Bn=[],zn=()=>{try{const t=globalThis;return!!t.__MOTIF_DEV__&&(t.__MOTIF_STORE_REGISTRY__!==Bn&&(t.__MOTIF_STORE_REGISTRY__=Bn),!0)}catch{return!1}};function Vn(t){const e=Hn.reactive(t);try{if(zn()){const s=t?.constructor?.name||"reactive";Bn.push({name:s,value:e,type:"reactive"}),Bn.length>200&&Bn.shift()}}catch{}return e}function Wn(t){const e=Hn.reactive(t);try{if(zn()){const s=t?.constructor?.name||"useModel";Bn.push({name:s,value:e,type:"reactive"}),Bn.length>200&&Bn.shift()}}catch{}return e}function $n(t){return Hn.clearModel(t)}function Un(t){return Hn.deepClone(t)}function qn(t){const e=new re(t);try{if(zn()){const t=`signal_${Bn.length}`;Bn.push({name:t,value:e.value,type:"signal"}),Bn.length>200&&Bn.shift()}}catch{}return e}function Gn(t){const e=new ae(t);try{if(zn()){const t=`computed_${Bn.length}`;Bn.push({name:t,value:e.value,type:"computed"}),Bn.length>200&&Bn.shift()}}catch{}return e}function Kn(t){const e=new ce(t);try{if(zn()){const t=`lazyComputed_${Bn.length}`;Bn.push({name:t,value:void 0,type:"computed"}),Bn.length>200&&Bn.shift()}}catch{}return e}class Yn extends Oi{constructor(t){super("div",t),this._cache=new Map,this._view=[],this._occurrence=[],this._occurrenceKeys=new WeakMap,this._isLoadingMore=!1,this._emptyRendered=!1,this._renderPending=!1,this.contentWrapper=new Oi,this._initialLoadStarted=!1,this._offsets=null,this._observedHeight=-1,this._loadSeq=0,this._reloadScheduled=!1,this._reloadTimes=[],this._handleScroll=(t,e)=>{if(this.renderViewport(),!1===this.props.autoLoad)return;if(!this._state.hasMore||this._isLoadingMore||!this._state.isInitialized)return;const s=this.wrapper.element,i=this._fixedHeight();(null!==i?this._state.data.length*i:this._offsetOf(this._view.length))-(s.scrollTop+s.clientHeight)<(this.props.autoLoadThreshold??100)&&this._loadMore()},t.className&&this.class.add(t.className),t.style&&Object.assign(this.element.style,t.style),this._state=this.useModel({isLoading:!1,isInitialized:!1,currentPage:0,totalCount:0,hasMore:!0,error:void 0,data:[]}),this._loadMore=this._loadMore.bind(this),this._renderLoadingState=this._renderLoadingState.bind(this),this._renderErrorState=this._renderErrorState.bind(this),this._renderEmptyState=this._renderEmptyState.bind(this),this._loadInitial=this._loadInitial.bind(this),this.renderViewport=this.renderViewport.bind(this),this._makeView()}_makeView(){this._topSpacer=new Oi("div"),this._topSpacer.element.style.cssText="height: 0px;",this._topSpacer.class.add("motif-virtualization-top-spacer"),this._bottomSpacer=new Oi("div"),this._bottomSpacer.element.style.cssText="height: 0px;",this._bottomSpacer.class.add("motif-virtualization-bottom-spacer"),this._virtualContent=new Oi(document.createComment("")),this.props.mainTemplate?(this.contentWrapper.controls.add(this._topSpacer,this._virtualContent,this._bottomSpacer),this.contentWrapper.onBuilding=t=>{var e=Q(t.parent);e&&(this.wrapper=e,this._loadInitial(),e.style({overflowY:"auto",position:"relative"}),e.motif.on("scroll",this._handleScroll))},this.controls.add(this.props.mainTemplate(this.contentWrapper,this._state))):(this.wrapper=this,this.element.style.cssText="overflow-y: auto; height: 100%; position: relative;",this.controls.add(this._topSpacer,this._virtualContent,this._bottomSpacer),this.motif.on("scroll",this._handleScroll))}onBuilding(){this.props.mainTemplate||this._initialLoadStarted||(this._initialLoadStarted=!0,this._loadInitial())}onMounted(){this._observeResize(),this._renderPending&&this.renderViewport()}onDisposing(){this._stopResizeObserver(),this._stopDataWatch(),this._clearContent()}_fixedHeight(){const t=this.props.itemHeight;return"function"==typeof t?null:t}_computeOffsets(){const t=this.props.itemHeight;if("function"!=typeof t)return void(this._offsets=null);const e=this._view,s=new Array(e.length+1);s[0]=0;for(let i=0;i<e.length;i++){let n=0;try{n=Number(t(e[i],i))}catch{n=0}s[i+1]=s[i]+(n>0&&Number.isFinite(n)?n:0)}this._offsets=s}_layoutOffsets(){return this._offsets&&this._offsets.length===this._view.length+1||this._computeOffsets(),this._offsets}_offsetOf(t){const e=this._fixedHeight();if(null!==e)return t*e;const s=this._layoutOffsets();return s[Math.min(Math.max(0,t),s.length-1)]}_indexAt(t,e){const s=e.length-1;if(s<=0)return 0;let i=0,n=s-1;for(;i<n;){const s=i+n+1>>1;e[s]<=t?i=s:n=s-1}return i}_observeResize(){const t=this.wrapper?.element;if(!t||this._observed===t||this.isDisposed)return;const e=globalThis.ResizeObserver;if("function"!=typeof e)return;this._stopResizeObserver(),this._observedHeight=t.clientHeight;const s=new e(()=>{if(this.isDisposed)return;const e=t.clientHeight;e!==this._observedHeight&&(this._observedHeight=e,this.renderViewport())});s.observe(t),this._resizeObserver=s,this._observed=t}_stopResizeObserver(){try{this._resizeObserver?.disconnect()}catch{}this._resizeObserver=void 0,this._observed=void 0}_stopDataWatch(){this._dataWatchStop?.(),this._dataWatchStop=void 0}_request(t,e){const s=()=>{try{return Promise.resolve(this.props.dataRequest(t))}catch(t){return Promise.reject(t)}};if(!e||!1===this.props.autoRefresh)return Ot(s);let i;this._stopDataWatch();let n=!0;return this._dataWatchStop=At(()=>{if(n){n=!1;try{this.props.watch?.()}catch(t){M("MJX205",t)}i=s()}else this._scheduleReload()}),i}_scheduleReload(){this._reloadScheduled||this.isDisposed||(this._reloadScheduled=!0,queueMicrotask(()=>{if(this._reloadScheduled=!1,this.isDisposed)return;const t=Date.now();if(this._reloadTimes=this._reloadTimes.filter(e=>t-e<1e3),this._reloadTimes.push(t),this._reloadTimes.length>30)return this._stopDataWatch(),void k("MJX206",[]);this._state.isInitialized?this._reloadLoaded():this._loadInitial()}))}async _reloadLoaded(){const t=++this._loadSeq,e=this.props.pageSize||50,s=this._state.currentPage+1;try{const i=await this._request({page:0,pageSize:e*s,scrollTop:this.wrapper?.element?.scrollTop??0},!0);if(this.isDisposed||t!==this._loadSeq)return;const n=this.wrapper?.element,o=n?.scrollTop??0;this._state.currentPage=s-1,this._state.totalCount=i.totalCount,this._state.hasMore=i.hasMore,this._state.error=void 0,this._state.data=i.items,this._rebuildView(),this._topSpacer.style({height:"0px"}),this._bottomSpacer.style({height:this._offsetOf(this._view.length)+"px"}),this._clearContent(),n&&n.scrollTop!==o&&(n.scrollTop=o),this.renderViewport()}catch(e){if(this.isDisposed||t!==this._loadSeq)return;this._state.error=e,this._renderErrorState(e)}}async _loadInitial(){const t=++this._loadSeq;this._state.isLoading=!0,this._renderLoadingState();try{const e=this.props.pageSize||50,s=await this._request({page:0,pageSize:e,scrollTop:0},!0);if(this.isDisposed||t!==this._loadSeq)return;this._state.currentPage=0,this._state.totalCount=s.totalCount,this._state.hasMore=s.hasMore,this._state.isInitialized=!0,this._state.isLoading=!1,this._state.error=void 0,this._state.data=s.items,this._clearContent(),this._rebuildView(),this.renderViewport()}catch(e){if(this.isDisposed||t!==this._loadSeq)return;this._state.isLoading=!1,this._state.error=e,this._renderErrorState(e)}}async _loadMore(){if(this._isLoadingMore||!this._state.hasMore||!this._state.isInitialized)return;const t=this._loadSeq;try{this._isLoadingMore=!0;const e=this._state.currentPage+1,s=this.props.pageSize||50,i=await this._request({page:e,pageSize:s,scrollTop:this.wrapper?.element?.scrollTop??0},!1);if(this.isDisposed||t!==this._loadSeq)return;this._state.totalCount=i.totalCount,this._state.currentPage=e,this._state.hasMore=i.hasMore,this._state.error=void 0,this._state.data.push(...i.items),this._rebuildView(),this.renderViewport()}catch(e){if(this.isDisposed||t!==this._loadSeq)return;this._state.error=e,M("MJX207",e)}finally{this._isLoadingMore=!1}}_rebuildView(){this._view=this.props.filter?this.props.filter(this._state.data):this._state.data;const t=new Map;this._occurrence=this._view.map(e=>{if("object"!=typeof e||null===e)return 0;const s=t.get(e)??0;return t.set(e,s+1),s}),"function"==typeof this.props.itemHeight?this._computeOffsets():this._offsets=null}_clearContent(){if(!this._virtualContent)return;const t=this._virtualContent.controls;for(const e of this._cache.values())t.silentUnlink(e),e.isDisposed||e.dispose();this._cache.clear(),t.clear(),this._emptyRendered=!1}renderViewport(){if(this.isDisposed||!this.wrapper||!this._state.isInitialized)return;const t=this.wrapper.element;this._observeResize();const e=this._view,s=e.length;if(0===s)return this._emptyRendered||(this._clearContent(),this._renderEmptyState()),this._topSpacer.style({height:"0px"}),void this._bottomSpacer.style({height:"0px"});this._emptyRendered&&this._clearContent();const i=this._fixedHeight();let n,o,r,a,c;if(null!==i){const e=Math.floor(t.clientHeight/i);if(e<=0)return void(this._renderPending=!t.isConnected);this._renderPending=!1,n=Math.max(0,this.props.overscan??e);const l=Math.min(Math.max(0,Math.floor(t.scrollTop/i)),s-1);o=Math.max(0,l-n),r=Math.min(s,l+e+n),a=o*i,c=Math.max(0,s-r)*i}else{if(t.clientHeight<=0)return void(this._renderPending=!t.isConnected);this._renderPending=!1;const e=this._layoutOffsets(),i=Math.max(0,t.scrollTop),l=i+t.clientHeight,h=this._indexAt(i,e);let u=h;for(;u<s&&e[u]<l;)u++;const d=Math.max(1,u-h);n=Math.max(0,this.props.overscan??d),o=Math.max(0,h-n),r=Math.min(s,Math.max(u,h+1)+n),a=e[o],c=Math.max(0,e[s]-e[r])}const l=new Array(r-o),h=new Set;for(let t=o;t<r;t++){const s=this._rowFor(e[t],t);l[t-o]=s,h.add(s)}const u=this._virtualContent.controls.items;for(const t of u.slice())h.has(t)||this._detachRow(t);for(let t=0;t<l.length;t++){const e=l[t];u[t]!==e&&(e.parent===this._virtualContent&&this._detachRow(e),this._virtualContent.controls.insert(t,e))}this._topSpacer.style({height:a+"px"}),this._bottomSpacer.style({height:c+"px"}),this._evictCache(Math.max(200,3*(r-o))),!1!==this.props.autoLoad&&this._state.hasMore&&!this._isLoadingMore&&s<r+n&&this._loadMore()}_occurrenceKey(t,e){let s=this._occurrenceKeys.get(t);return s||(s=[],this._occurrenceKeys.set(t,s)),s[e]??={}}_rowFor(t,e){const s=this._occurrence[e]??0,i="object"==typeof t&&null!==t?0===s?t:this._occurrenceKey(t,s):e;let n=this._cache.get(i);if(n&&n.isDisposed&&(this._cache.delete(i),n=void 0),n)return this._cache.delete(i),this._cache.set(i,n),n;const o=this.props.itemTemplate(t,e);return n=o instanceof zs?o:new Oi(o),n.__listItemRef=t,this._cache.set(i,n),n}_detachRow(t){const e=this._virtualContent.controls;if(t.isDisposed)return void e.silentUnlink(t);const s=t.element;if(s.nodeType===Node.COMMENT_NODE){e.silentUnlink(t);const i=t.motif.options.closeFragment,n=t.motif.options.cache??(t.motif.options.cache=document.createDocumentFragment());let o=s;for(;o;){const t=o.nextSibling;if(n.appendChild(o),o===i)break;o=t}Ai(t)}else e.silentDetach(t)}_evictCache(t){const e=this.props.cacheSize??t;if(!(this._cache.size<=e))for(const[t,s]of this._cache){if(this._cache.size<=e)break;s.parent!==this._virtualContent&&(this._cache.delete(t),s.isDisposed||s.dispose())}}_renderLoadingState(){if(!this._virtualContent||!this.props.loadingTemplate)return;this._clearContent();const t=this.props.loadingTemplate(this._state);this._virtualContent.controls.add(t)}_renderEmptyState(){if(!this._virtualContent||!this.props.emptyTemplate)return;this._clearContent();const t=this.props.emptyTemplate();this._virtualContent.controls.add(t),this._emptyRendered=!0}_renderErrorState(t){if(this._virtualContent)if(this._clearContent(),this.props.errorTemplate){const e=this.props.errorTemplate(t);this._virtualContent.controls.add(e)}else M("MJX207",t);else M("MJX207",t)}refresh(){return this._state.data=[],this._state.currentPage=0,this._state.isInitialized=!1,this._state.hasMore=!0,this._rebuildView(),this._loadInitial()}setData(t){this._loadSeq++,this._stopDataWatch(),this._state.data=t,this._state.currentPage=0,this._state.totalCount=t.length,this._state.hasMore=!1,this._state.isInitialized=!0,this._state.isLoading=!1,this._state.error=void 0,this._clearContent(),this._rebuildView(),this.renderViewport()}scrollToIndex(t){if(!this.wrapper)return;const e=this._view.length,s=Math.min(Math.max(0,t),Math.max(0,e-1));this.wrapper.element.scrollTop=this._offsetOf(s),this.renderViewport()}getState(){return{...this._state}}}const Qn=new Map;class Zn{constructor(){this.descriptors=new Map}reset(){this.descriptors.clear()}addTransient(t,e){this._add(t,e,"transient")}addSingleton(t,e){this._add(t,e,"singleton")}addScoped(t,e){this._add(t,e,"scoped")}_add(t,e,s){const i={token:t,lifetime:s};if(e&&"object"==typeof e&&(e.useClass||e.useFactory||Object.prototype.hasOwnProperty.call(e,"useValue")||Array.isArray(e.deps))){i.useClass=e.useClass,i.useFactory=e.useFactory,i.useValue=e.useValue,i.deps=Array.isArray(e.deps)?e.deps:void 0;try{const s=[i.useClass?"useClass":null,i.useFactory?"useFactory":null,void 0!==i.useValue?"useValue":null].filter(Boolean);s.length>1&&k("MJX410",[this._tokenName(t),s.join(", ")],{token:t}),e.deps&&!Array.isArray(e.deps)&&k("MJX411",[this._tokenName(t)],{token:t})}catch{}if(i.useValue&&"function"==typeof i.useValue.then){const t=i.useValue;i.useFactory=async()=>await t,i.useValue=void 0}}else if("function"==typeof e){if(!function(t){try{return Reflect.construct(String,[],t),!0}catch{return!1}}(e))throw S("MJX413",this._tokenName(t));i.useClass=e}else if(e&&"function"==typeof e.then){const t=e;i.useFactory=async()=>await t}else i.useValue=e;this.descriptors.set(t,i)}_tokenName(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t?t.name||"[AnonymousClass]":String(t)}getDescriptor(t){const e=this.descriptors.get(t);if(e)return e;const s=Qn.get(t);return s?(this._add(t,{useClass:t,deps:s.deps,useValue:void 0,useFactory:void 0},s.lifetime||"transient"),this.descriptors.get(t)||null):null}canAutoRegister(t){return!this.descriptors.has(t)&&Qn.has(t)}getService(t){return this.getDescriptor(t)}buildServiceProvider(){return new De(this)}has(t){return this.descriptors.has(t)}remove(t){return this.descriptors.delete(t)}replace(t,e,s){const i=this.descriptors.get(t),n=s??i?.lifetime??"transient";this._add(t,e,n)}tryAddTransient(t,e){return!this.descriptors.has(t)&&(this._add(t,e,"transient"),!0)}tryAddSingleton(t,e){return!this.descriptors.has(t)&&(this._add(t,e,"singleton"),!0)}tryAddScoped(t,e){return!this.descriptors.has(t)&&(this._add(t,e,"scoped"),!0)}autoRegisterInjectables(){for(const[t,e]of Qn.entries())this.descriptors.has(t)||this._add(t,{useClass:t,deps:e.deps,useValue:void 0,useFactory:void 0},e.lifetime||"transient")}}function to(t,e){const s=(t||"").trim(),i=(e||"").trim(),n=s&&"/"!==s&&s.endsWith("/")?s.slice(0,-1):s;if("/"===i)return n||"/";const o=i?i.startsWith("/")?i:"/"+i:"";return n&&"/"!==n?n+o:o||"/"}let eo=null,so=!1;function io(){if(u(),l())try{eo||(eo=document.createElement("div"),eo.style.cssText="position:fixed; left:12px; bottom:12px; right:12px; z-index:2147483647; background:#111; color:#fff; border:1px solid #333; border-radius:8px; box-shadow:0 4px 14px rgba(0,0,0,0.4); display:none;",document.body.appendChild(eo),window.addEventListener("keydown",t=>{try{(t.ctrlKey||t.metaKey)&&"`"===t.key&&(t.preventDefault(),eo&&(so=!so,eo.style.display=so?"block":"none"))}catch{}}),p(t=>{t.type}))}catch{}}class no{static{this.outlets=new Map}static register(t,e,s){this.outlets.has(t)||this.outlets.set(t,new Map),this.outlets.get(t).set(e,s)}static unregister(t,e){this.outlets.get(t)?.delete(e),0===this.outlets.get(t)?.size&&this.outlets.delete(t)}static find(t,e){if(e&&this.outlets.get(t)?.has(e))return this.outlets.get(t).get(e);const s=this.outlets.get(t);return s&&s.size>0?Array.from(s.values())[0]:null}static findAll(t){return Array.from(this.outlets.get(t)?.values()??[])}}const oo=Symbol.for("RouterView.built");class ro extends Oi{constructor(t){super(t),this._navLock=Promise.resolve(),this.disposingChilds=!1,this.current=null,this._latestNavigateId=0,this.isBusy=!1}get __isRouterView(){return!0}get scopeId(){let t=this.parent,e=[];for(;t;)e.push(t.constructor?.name??""),t=t.parent;return e.join(">")}async navigate(t,e=!1){await ln(this,t,e)}async disposeTarget(t){await cn(t)}onBuilt(){try{no.register(this.props.name??"default",this.scopeId,this);let t=this.parent;for(;t;)t.motif.trigger(oo,this),t=t.parent}catch{}}onDisposed(){try{no.unregister(this.props.name??"default",this.scopeId)}catch{}}}const ao="motifjs:scroll",co=["wheel","touchstart","keydown","mousedown"];class lo{constructor(t={},e){this.positions=new Map,this.currentKey="",this.currentPath=null,this.visited=!1,this.restoring=!1,this.cancelFrame=null,this.disarmAbort=null,this.offs=[],this.locationAnchor=!0,this.options=t,this.viewport=e??(t.container?function(t){const e=ho(),s=()=>{try{return"string"==typeof t?document.querySelector(t):"function"==typeof t?t()??null:t}catch{return null}};return{scrollTop:()=>{const t=s();return t?t.scrollTop||0:e.scrollTop()},scrollTo:t=>{const i=s();if(i)try{i.scrollTo({top:t,behavior:"instant"})}catch{try{i.scrollTop=t}catch{}}else e.scrollTo(t)},scrollToAnchor:(t,s)=>e.scrollToAnchor(t,s)}}(t.container):ho()),this.load();try{"undefined"!=typeof history&&"scrollRestoration"in history&&(history.scrollRestoration="manual")}catch{}"undefined"!=typeof window&&(this.offs.push(fo(window,"pagehide",()=>this.persistNow())),this.offs.push(fo(document,"visibilitychange",()=>{"hidden"===document.visibilityState&&this.persistNow()})))}leaving(){this.cancelRestore(),this.visited&&(this.remember(this.currentKey,this.viewport.scrollTop()),this.persist())}arrived(t,e){this.visited=!0;const{path:s,hash:i}=uo(t),n=!!i&&s===this.currentPath&&("push"===e||"replace"===e||"traverse"===e);this.currentPath=s,this.currentKey=this.keyOf(s),this.restore(this.currentKey,!1===this.options.anchor?"":i||(this.locationAnchor?function(){try{const t=location?.hash??"";return t.length>1?po(t.slice(1)):""}catch{return""}}():""),n)}saved(t){return this.positions.get(this.keyOf(uo(t).path))??0}dispose(){this.cancelRestore(),this.persistNow();for(const t of this.offs.splice(0))t();this.positions.clear()}keyOf(t){return(this.options.key?this.options.key(t):t)||"/"}remember(t,e){const s=this.options.limit??60;for(this.positions.delete(t),this.positions.set(t,Math.max(0,Math.round(e)));this.positions.size>s;){const t=this.positions.keys().next();if(t.done)break;this.positions.delete(t.value)}}restore(t,e,s){this.cancelRestore();const i=this.positions.get(t)??0;if(!e&&i<=0)return void(!1!==this.options.top&&this.viewport.scrollTo(0));this.restoring=!0;const n=this.options.settleMs??1200,o=Date.now(),r=()=>{this.cancelFrame=null;if((e?this.viewport.scrollToAnchor(e,s):this.reached(i))||Date.now()-o>=n)return this.cancelRestore(),void this.remember(t,this.viewport.scrollTop());this.armAbort(),this.cancelFrame=function(t){if("function"!=typeof requestAnimationFrame){const e=setTimeout(t,16);return()=>clearTimeout(e)}const e=requestAnimationFrame(t);return()=>cancelAnimationFrame(e)}(r)};r()}reached(t){return this.viewport.scrollTo(t),this.viewport.scrollTop()>=t-1}armAbort(){if(this.disarmAbort||"undefined"==typeof window)return;const t=()=>this.cancelRestore(),e=co.map(e=>fo(window,e,t,{passive:!0}));this.disarmAbort=()=>{for(const t of e)t()}}cancelRestore(){this.cancelFrame?.(),this.cancelFrame=null,this.disarmAbort?.(),this.disarmAbort=null,this.restoring=!1}persistNow(){this.visited&&!this.restoring&&this.remember(this.currentKey,this.viewport.scrollTop()),this.persist()}get storage(){if(!1===this.options.persist)return null;try{return"undefined"==typeof sessionStorage?null:sessionStorage}catch{return null}}persist(){const t=this.storage;if(t)try{t.setItem(ao,JSON.stringify([...this.positions]))}catch{}}load(){const t=this.storage;if(t)try{const e=t.getItem(ao);if(!e)return;const s=JSON.parse(e);if(!Array.isArray(s))return;for(const t of s){if(!Array.isArray(t)||"string"!=typeof t[0])continue;const e=Number(t[1]);Number.isFinite(e)&&e>0&&this.positions.set(t[0],e)}}catch{}}}function ho(){return{scrollTop:()=>{try{return window.scrollY||document.documentElement?.scrollTop||0}catch{return 0}},scrollTo:t=>{try{window.scrollTo({top:t,behavior:"instant"})}catch{try{window.scrollTo(0,t)}catch{}}},scrollToAnchor:(t,e)=>{try{const s=document.getElementById(t);if(!s)return!1;if(e)s.scrollIntoView();else try{s.scrollIntoView({behavior:"instant"})}catch{s.scrollIntoView()}return!0}catch{return!1}}}}function uo(t){const e=t.indexOf("#");return e<0?{path:t,hash:""}:{path:t.slice(0,e)||"/",hash:po(t.slice(e+1))}}function po(t){try{return decodeURIComponent(t)}catch{return t}}function fo(t,e,s,i){try{return t.addEventListener(e,s,i),()=>{try{t.removeEventListener(e,s,i)}catch{}}}catch{return()=>{}}}const mo="motifjs:stack",_o=30,go=t=>!!t&&1===t.nodeType&&!!t.style;function yo(t,e){const s=t?.element;if(t&&!t.isDisposed&&go(s)){try{s.setAttribute("data-nav-direction",e)}catch{}t.motif.options.transition._markedDirection=!0}}function vo(t){const e=t?.motif?.options?.transition;if(e?._markedDirection){e._markedDirection=!1;try{t.element?.removeAttribute?.("data-nav-direction")}catch{}}}function wo(t){return t.getAttribute("style")}function bo(t,e){try{t.setAttribute("style",e??""),null===e&&t.removeAttribute("style")}catch{}}function So(t){const e=[];try{const s=t=>{const s=t.scrollTop||0,i=t.scrollLeft||0;(s||i)&&e.push([t,s,i])};s(t),t.querySelectorAll("*").forEach(s)}catch{}return e}function Mo(t){for(const[e,s,i]of t)try{e.scrollTop=s,e.scrollLeft=i}catch{}}function Co(){try{return"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function ko(t,e,s,i){if("function"!=typeof t.animate||s<=0)return Promise.resolve();try{const n=t.animate(e,{duration:s,easing:"cubic-bezier(0.2, 0.8, 0.2, 1)",fill:"forwards"});return i.push(n),n.finished.then(()=>{},()=>{})}catch{return Promise.resolve()}}function Do(t,e,s){t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.margin="0px",t.style.boxSizing="border-box";const i=e.getBoundingClientRect(),n=t.getBoundingClientRect();if(t.style.top=i.top-n.top+"px",t.style.left=i.left-n.left+"px",t.style.width=i.width+"px",t.style.height=i.height+"px",t.style.pointerEvents="none",t.style.zIndex=s?"2":"0",!s){let t="";try{t=getComputedStyle(e).position}catch{}t&&"static"!==t||(e.style.position="relative"),e.style.zIndex="1"}}class Ao{constructor(t){this.session=null,this.entries=new Map,this.uris=new Map,this.loaded=null,this.current=null,this.currentTop=null,this.offs=[],this.gesture=null,this.gestureCommitted=!1,this.awaitingGestureResult=!1,this.disposed=!1;const e=!0===t?{}:t;this.retainAttached=!0===e.retain,this.depth=Math.max(0,Math.floor(e.depth??5)),this.persist=!0===e.persist,this.animation=e.animation??"none",this.duration=Math.max(0,e.duration??300);const s=e.swipeBack;this.swipe=s?{edge:"object"==typeof s&&"number"==typeof s.edge&&s.edge>0?s.edge:24,threshold:"object"==typeof s&&"number"==typeof s.threshold&&s.threshold>0?s.threshold:.35}:null,this.persist&&this.load(),this.swipe&&this.installSwipe()}get retainedCount(){return this.entries.size}isRetaining(t){return!!t.from&&!!t.to&&t.from.session===t.to.session&&t.to.index>t.from.index}begin(t){const e=t.to;if(e){if(this.session!==e.session){if(this.disposeAllEntries(),this.uris.clear(),this.session=e.session,this.loaded&&this.loaded.session===e.session)for(const[t,e]of this.loaded.uris)this.uris.set(t,e);this.loaded=null}if("push"===t.direction)this.truncate(e.index);else if("replace"===t.direction){const t=this.entries.get(e.index);t&&(this.entries.delete(e.index),this.disposeEntry(t))}}}take(t){if(!t||t.session!==this.session)return null;const e=this.entries.get(t.index);return e?(this.entries.delete(t.index),e.pendingDetach=!1,e):null}retain(t,e,s,i,n,o,r){const a=i[n],c=a.element,l={point:t,uri:e,chain:s.slice(),instances:i.slice(),top:a,topIndex:n,outlet:o,attached:!1,hidden:!1,pendingDetach:!1,saved:null,scroll:go(c)?So(c):[]};if(this.retainAttached&&go(c))l.attached=!0,r||this.hide(l);else if(r)l.pendingDetach=!0;else try{a.parent?.controls.silentDetach(a)}catch{}const h=this.entries.get(t.index);return h&&h!==l&&this.disposeEntry(h),this.entries.set(t.index,l),this.evict(),l}settle(t){if(!t.top.isDisposed&&this.entries.get(t.point.index)===t)if(t.attached)this.hide(t);else if(t.pendingDetach){t.pendingDetach=!1;try{t.top.parent?.controls.silentDetach(t.top)}catch{}}}hide(t){if(!t.attached||t.hidden)return;const e=t.top.element;if(go(e)){t.saved={style:wo(e),inert:e.hasAttribute("inert"),ariaHidden:e.getAttribute("aria-hidden")};try{e.style.setProperty("display","none","important"),e.setAttribute("inert",""),e.setAttribute("aria-hidden","true")}catch{}t.hidden=!0;try{Ai(t.top)}catch{}}}reveal(t){const e=t.top.element;if(t.hidden&&t.saved&&go(e)){bo(e,t.saved.style);try{t.saved.inert||e.removeAttribute("inert"),null===t.saved.ariaHidden?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t.saved.ariaHidden)}catch{}}t.hidden=!1,t.saved=null}restoreScroll(t){Mo(t.scroll)}record(t,e){if(t.to&&t.to.session===this.session){if(this.uris.set(t.to.index,t.uri),"push"===t.direction)for(const e of Array.from(this.uris.keys()))e>t.to.index&&this.uris.delete(e);this.current=t.to}this.currentTop=e,this.save()}describe(){const t=this.current?.index;return Array.from(this.uris.entries()).sort((t,e)=>t[0]-e[0]).map(([e,s])=>({index:e,uri:s,current:e===t,retained:this.entries.has(e)}))}get gestureCommitPending(){return this.gestureCommitted}consumeGestureCommit(){const t=this.gestureCommitted;return this.gestureCommitted=!1,t}traversalSettled(t){if(!this.awaitingGestureResult)return;this.awaitingGestureResult=!1;const e=this.gesture;if(!t)return this.gesture=null,void(this.gestureCommitted=!1);this.gestureCommitted=!1,e&&this.settleGesture(e,!1)}async transition(t,e,s){if(this.consumeGestureCommit())return;if("none"===this.animation||!this.animation)return;if("push"!==t&&"back"!==t&&"forward"!==t)return;const i=e?.element,n=s?.element;if(!(go(i)&&go(n)&&i.isConnected&&n.isConnected))return;if(Co())return;const o="back"===t,r=wo(i),a=wo(n),c=[];try{if(Do(n,i,o),"function"==typeof this.animation){const e={direction:t,entering:i,leaving:n};await this.animation(e)}else{const t=this.duration;o?await Promise.all([ko(n,[{transform:"translateX(0)"},{transform:"translateX(100%)"}],t,c),ko(i,[{transform:"translateX(-30%)"},{transform:"translateX(0)"}],t,c)]):await Promise.all([ko(i,[{transform:"translateX(100%)"},{transform:"translateX(0)"}],t,c),ko(n,[{transform:"translateX(0)"},{transform:"translateX(-30%)"}],t,c)])}}catch(t){M("MJX308",t)}finally{for(const t of c)try{t.cancel()}catch{}bo(i,r),bo(n,a)}}async disposeEntry(t){const e=t.top;if(e&&!e.isDisposed)try{await cn(e,{deep:!0,skipLeaveTransition:!0})}catch(t){M("MJX307",t)}}async dispose(){if(!this.disposed){this.disposed=!0;for(const t of this.offs.splice(0))try{t()}catch{}this.gesture&&(this.endGestureListeners(this.gesture),this.gesture=null),await this.disposeAllEntries(),this.uris.clear(),this.current=null,this.currentTop=null}}async disposeAllEntries(){const t=Array.from(this.entries.values());this.entries.clear();for(const e of t)await this.disposeEntry(e)}truncate(t){for(const[e,s]of Array.from(this.entries))e>=t&&(this.entries.delete(e),this.disposeEntry(s))}evict(){for(;this.entries.size>this.depth;){let t=1/0;for(const e of this.entries.keys())e<t&&(t=e);const e=this.entries.get(t);this.entries.delete(t),e&&this.disposeEntry(e)}}load(){try{if("undefined"==typeof sessionStorage)return;const t=sessionStorage.getItem(mo);if(!t)return;const e=JSON.parse(t);if(!e||"string"!=typeof e.session||!Array.isArray(e.uris))return;const s=[];for(const t of e.uris)Array.isArray(t)&&"number"==typeof t[0]&&"string"==typeof t[1]&&s.push([t[0],t[1]]);this.loaded={session:e.session,uris:s}}catch{}}save(){if(this.persist&&this.session)try{if("undefined"==typeof sessionStorage)return;sessionStorage.setItem(mo,JSON.stringify({session:this.session,uris:Array.from(this.uris.entries())}))}catch{}}installSwipe(){if("undefined"==typeof document)return;const t=t=>this.onTouchStart(t);try{document.addEventListener("touchstart",t,{passive:!0}),this.offs.push(()=>{try{document.removeEventListener("touchstart",t)}catch{}})}catch{}}onTouchStart(t){if(this.disposed||this.gesture||this.awaitingGestureResult||!this.swipe)return;if(!t.touches||1!==t.touches.length)return;const e=t.touches[0];if(!e||e.clientX>this.swipe.edge)return;if(!this.current||this.current.index<=0)return;const s=this.currentTop?.element;if(!go(s)||!s.isConnected)return;const i={startX:e.clientX,startY:e.clientY,lastX:e.clientX,samples:[[e.clientX,Date.now()]],dragging:!1,width:0,top:s,topSaved:null,under:null,underSaved:null,offs:[]},n=t=>this.onTouchMove(i,t),o=()=>this.onTouchEnd(i);try{document.addEventListener("touchmove",n,{passive:!1}),document.addEventListener("touchend",o),document.addEventListener("touchcancel",o),i.offs.push(()=>{try{document.removeEventListener("touchmove",n)}catch{}try{document.removeEventListener("touchend",o)}catch{}try{document.removeEventListener("touchcancel",o)}catch{}})}catch{}this.gesture=i}endGestureListeners(t){for(const e of t.offs.splice(0))try{e()}catch{}}beginDrag(t){t.dragging=!0,t.width=t.top.getBoundingClientRect().width||("undefined"!=typeof window?window.innerWidth:0)||1,t.topSaved=wo(t.top);const e=this.current,s=e?this.entries.get(e.index-1)??null:null;if(s&&s.attached&&go(s.top.element)&&s.top.element.isConnected){const e=s.top.element;t.under=s,t.underSaved=wo(e),s.saved&&bo(e,s.saved.style),Do(e,t.top,!1),e.style.transform="translateX(-30%)",Mo(s.scroll)}t.top.style.willChange="transform"}applyDrag(t,e){const s=Math.min(1,Math.max(0,e/t.width));t.top.style.transform=`translateX(${Math.max(0,e)}px)`,t.under&&(t.under.top.element.style.transform=`translateX(-${_o*(1-s)}%)`)}onTouchMove(t,e){const s=e.touches&&e.touches[0];if(!s)return;const i=s.clientX-t.startX,n=s.clientY-t.startY;if(!t.dragging){if(Math.abs(i)<8&&Math.abs(n)<8)return;if(i<=0||Math.abs(n)>Math.abs(i))return this.endGestureListeners(t),void(this.gesture=null);this.beginDrag(t)}if(e.cancelable)try{e.preventDefault()}catch{}const o=Date.now();for(t.lastX=s.clientX,t.samples.push([s.clientX,o]);t.samples.length>2&&o-t.samples[0][1]>100;)t.samples.shift();this.applyDrag(t,i)}onTouchEnd(t){if(this.endGestureListeners(t),!t.dragging)return void(this.gesture=null);const e=t.lastX-t.startX,s=e/t.width,i=t.samples[0],n=t.samples[t.samples.length-1],o=n&&i?n[1]-i[1]:0,r=n?Date.now()-n[1]:1/0,a=o>=16&&r<=50?(n[0]-i[0])/o:0,c=s>this.swipe.threshold||a>.5&&e>0;this.settleGesture(t,c)}async settleGesture(t,e){const s=[],i=t.top,n=t.under?t.under.top.element:null,o=Co()?0:Math.max(0,Math.round(.6*this.duration)),r=i.style.transform||"translateX(0px)",a=n?.style.transform||"translateX(-30%)";if(e){await Promise.all([ko(i,[{transform:r},{transform:"translateX(100%)"}],o,s),n?ko(n,[{transform:a},{transform:"translateX(0)"}],o,s):Promise.resolve()]),i.style.transform="translateX(100%)",n&&(n.style.transform="translateX(0px)");for(const t of s)try{t.cancel()}catch{}this.gestureCommitted=!0,this.awaitingGestureResult=!0;try{window.history.back()}catch{this.traversalSettled(!0)}}else{await Promise.all([ko(i,[{transform:r},{transform:"translateX(0)"}],o,s),n?ko(n,[{transform:a},{transform:"translateX(-30%)"}],o,s):Promise.resolve()]);for(const t of s)try{t.cancel()}catch{}bo(i,t.topSaved),n&&t.under&&bo(n,t.underSaved),this.gesture===t&&(this.gesture=null)}}}class xo{constructor(t){this.source=t,this.currentColumn=0,this.tokens=[],this.parameters={},this.codePointAt=String.prototype.codePointAt?(t,e)=>t.codePointAt(e):function(t,e){const s=t.length;if(e<0||e>=s)return;const i=t.charCodeAt(e);if(i>=55296&&i<=56319&&s>e+1){const s=t.charCodeAt(e+1);if(s>=56320&&s<=57343)return 1024*(i-55296)+s-56320+65536}return i},this.tokens=[]}addToken(t){this.tokens.push(t)}parse(){for(this.source.startsWith("/")||(this.source="/"+this.source);this.source.length>1&&this.source.endsWith("/");)this.source=this.source.slice(0,-1);var t="static",e=-1,s=0,i=-1;for(this.tokens=[],this.currentColumn=0;this.currentColumn<this.source.length;){var n=this.codePointAt(this.source,this.currentColumn),o=this.tokens[e];switch(n){case 47:i++,(void 0===o||o.input.length>1)&&(this.tokens.push({default:"",input:"/",isOptinal:!1,regexs:[],type:"static",parameterName:"",parameterIndex:s,sectionIndex:i}),e=this.tokens.length-1);break;case 123:s++;let n,r,a=!1,c=!1;if(this.tokens.length>0){const t=this.tokens[this.tokens.length-1];t&&"static"===t.type&&"/"===t.input&&!t.consumed?(a=!0,n=this.tokens.length-1):t&&"static"===t.type&&"/"!==t.input&&t.sectionIndex===i&&!t.consumed&&(c=!0,r=this.tokens.length-1)}this.tokens.push({default:void 0,input:"",isOptinal:!1,regexs:[],type:"parameter",parameterName:"",parameterIndex:s,sectionIndex:i,hasLeadingSlash:a,leadingSlashTokenIndex:n,hasLeadingStatic:c,leadingStaticTokenIndex:r}),e=this.tokens.length-1,t="parameter";break;case 125:t="static",e=-1;break;case 58:t="defaultValue";break;case 63:o&&(o.isOptinal=!0);break;default:const l=this.source[this.currentColumn];o?"parameter"===t?o.parameterName=`${o.parameterName+l}`:"defaultValue"===t?o.default=`${(o.default??"")+l}`:"static"===o.type?o.input=`${o.input+l}`:(this.tokens.push({default:void 0,input:l,isOptinal:!1,regexs:[],type:"static",parameterName:"",parameterIndex:s,sectionIndex:i}),e=this.tokens.length-1):(this.tokens.push({default:void 0,input:l,isOptinal:!1,regexs:[],type:"static",parameterName:"",parameterIndex:s,sectionIndex:i}),e=this.tokens.length-1)}this.currentColumn++}const r=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");for(const t of this.tokens){if("parameter"===t.type&&t.isOptinal&&t.hasLeadingSlash&&"number"==typeof t.leadingSlashTokenIndex){const e=this.tokens[t.leadingSlashTokenIndex];e&&"static"===e.type&&"/"===e.input&&(e.consumed=!0)}if("parameter"===t.type&&t.isOptinal&&t.hasLeadingStatic&&"number"==typeof t.leadingStaticTokenIndex){const e=this.tokens[t.leadingStaticTokenIndex];e&&"static"===e.type&&e.input&&e.sectionIndex===t.sectionIndex&&(e.consumed=!0)}}const a=t=>{const e=this.tokens[t];for(let s=t+1;s<this.tokens.length;s++){const t=this.tokens[s];if("static"===t.type&&t.sectionIndex===e.sectionIndex&&t.input&&"/"!==t.input)return t.input[0];if("static"===t.type&&"/"===t.input)break}},c=(t,e)=>{const s=a(t);var i;return`(${s?`[^${i=r(s),i.replace(/[\\\]\^\-]/g,"\\$&")}]`:"[\\w\\d\\_\\-\\%\\&\\$\\+\\#\\,\\.\\{\\}\\(\\)\\[\\]\\?\\:\\=\\;\\'\\\"\\~\\\\]"}${e?"{0,255}":"{1,255}"})`};let l="^";for(let t=0;t<this.tokens.length;){const e=this.tokens[t];if("static"===e.type&&"/"===e.input){e.consumed||(l+="/"),t++;continue}const s=t;let i=t;for(;i<this.tokens.length;){const t=this.tokens[i];if("static"===t.type&&"/"===t.input&&i!==s)break;if("static"===t.type&&"/"===t.input&&i===s){i++;break}i++}const n={};let o=s;for(;o<i;){if(n[o]){o++;continue}const t=this.tokens[o];if("static"!==t.type){if(t.isOptinal&&!t.hasLeadingStatic){const e=o;let s=!1;for(let t=e+1;t<i;t++){const e=this.tokens[t],i=this.tokens[t+1];if(e&&"static"===e.type&&i&&"parameter"===i.type&&i.isOptinal&&i.hasLeadingStatic&&"number"==typeof i.leadingStaticTokenIndex&&i.leadingStaticTokenIndex===t){s=!0;break}if(e&&"static"===e.type&&"/"===e.input)break}let a="";t.hasLeadingSlash&&(a+="/"),a+=c(e,!s),n[e]=!0;let h=e+1;for(;h<i;){const t=this.tokens[h];if("static"===t.type&&this.tokens[h+1]&&"parameter"===this.tokens[h+1].type){const e=this.tokens[h+1];if(e.isOptinal&&e.hasLeadingStatic&&"number"==typeof e.leadingStaticTokenIndex&&e.leadingStaticTokenIndex===h){a+=`(?:${r(t.input)}${c(h+1,!0)})?`,n[h]=!0,n[h+1]=!0,h+=2;continue}}break}l+=`(?:${a})?`,o=h;continue}{const e=c(o,t.isOptinal);if(t.isOptinal)if(t.hasLeadingSlash)l+=`(?:/${e})?`;else if(t.hasLeadingStatic&&"number"==typeof t.leadingStaticTokenIndex){const s=this.tokens[t.leadingStaticTokenIndex];l+=`(?:${s&&"static"===s.type?r(s.input):""}${e})?`}else l+=`(?:${e})?`;else l+=e;n[o]=!0,o++}}else t.consumed||(l+=r(t.input)),n[o]=!0,o++}t=i}return l+="$",new RegExp(l,"i")}exist(t,e){const s=t.indexOf("#"),i=s>=0?t.substring(0,s):t;let n=i,o="";const r=i.indexOf("?");for(r>=0&&(n=i.substring(0,r),o=i.substring(r+1));n.length>1&&n.endsWith("/");)n=n.slice(0,-1);var a=this.parse().exec(n);if(a){a&&a.length;var c=[];if(this.parameters={},a?.forEach((t,e)=>{c.push(t)}),o&&o.length){const t=new URLSearchParams(o),e=new Map;t.forEach((t,s)=>{const i=e.get(s)||[];i.push(t),e.set(s,i)}),e.forEach((t,e)=>{1===t.length?this.parameters[e]=t[0]:this.parameters[e]=t})}else if(e){const t=new URLSearchParams(e),s=new Map;t.forEach((t,e)=>{const i=s.get(e)||[];i.push(t),s.set(e,i)}),s.forEach((t,e)=>{1===t.length?this.parameters[e]=t[0]:this.parameters[e]=t})}if(a.input===c[0])return a?.forEach((t,e)=>{if(0!==e){var s=this.tokens.find(t=>t.parameterIndex==e);if(s){let e=t;if((void 0===e||""===e)&&s.isOptinal){e=void 0===s.default||""===s.default?void 0:s.default}this.parameters[s.parameterName]=void 0===e?void 0:e}}}),!0}return!1}}function Eo(t){let e=0,s=0;for(const i of(t||"").split("/"))i&&(i.startsWith("{")&&i.endsWith("}")?s++:e++);return{statics:e,params:s}}function To(t,e){const s=t.chain.length-e.chain.length;if(0!==s)return s;const i=Eo(t.fullPath),n=Eo(e.fullPath);return i.statics!==n.statics?n.statics-i.statics:i.params!==n.params?i.params-n.params:e.fullPath.length-t.fullPath.length}class Oo{constructor(t){this.routes=t,this.records=[],this.routesMap=new Map,this.walk=(t,e,s,i=!1)=>{const n=this.joinPaths(e,s.path);if(!i){const t=s.fullPath;(null==t||"string"==typeof t&&""===t.trim())&&(s.fullPath=n),null!=s.name&&this.routesMap.set(s.name,s)}const o=[...t,s],r=[{path:n,isAlias:i},...(null==s.alias?[]:Array.isArray(s.alias)?s.alias:[s.alias]).map(t=>({path:this.joinPaths(e,t),isAlias:!0}))];for(const t of r)if(this.records.push({fullPath:t.path,chain:o,leaf:s,scanner:new xo(t.path),aliasOf:t.isAlias?s.fullPath??null:null}),s.childs&&s.childs.length)for(const e of s.childs)this.walk(o,t.path,e,t.isAlias)},this.build()}build(){this.records=[],this.routesMap.clear();for(const t of this.routes)this.walk([],"",t);this.records.sort(To)}joinPaths(t,e){e=e||"";const s=(t=t||"")&&"/"!==t&&t.endsWith("/")?t.slice(0,-1):t;if("/"===e)return s||"/";const i=e?e.startsWith("/")?e:"/"+e:"";return s&&"/"!==s?s+i:i||"/"}}class No{constructor(){this.stack=null,this._revealed=new Set,this._previousPath=null,this._previousInstances=[],this.controlCache=new Map,this._navVersion=0,this._pendingActivate=new Set,this.pendingMount=new WeakMap,this.pendingListeners=new WeakMap}register(t,e,s){this.root=t,this.application=e,this.routingModule=s}async evict(t){const e=t?[t]:Array.from(this.controlCache.keys());for(const t of e){const e=this.controlCache.get(t);if(e&&!e.isDisposed){if(!this._previousInstances.includes(e)){this.controlCache.delete(t);try{await e.dispose()}catch(t){M("MJX307",t)}}}else this.controlCache.delete(t)}}async dispose(){this._navVersion++,this._previousPath=null,this._previousInstances=[],this._revealed.clear();const t=this.stack;if(this.stack=null,t)try{await t.dispose()}catch{}await this.evict()}generatePathString(t,e){const s=t.split("/").map(t=>{if(t.startsWith("{")&&t.endsWith("}")){const s=t.slice(1,-1);let[i,n]=s.split(":");i.endsWith("?")&&(i=i.slice(0,-1));const o=e[i];return null!=o&&""!==o?String(o):n??""}return t}).filter(t=>""!==t).join("/");return t.startsWith("/")?"/"+(s||""):s}async execute(t,e,s){s??={target:t,chain:t.chain.map(e=>this.generatePathString(e.path,t.params)||""),direction:void 0,state:void 0};const i=this._rootProvider(),n={provider:i,scope:i?._beginNavigation(),route:s,committed:!1,suppressed:[]};try{await this._execute(t,e,n)}finally{!n.committed&&n.scope&&i._abandonNavigation(n.scope);for(const t of n.suppressed)t.isDisposed||(t.motif.options.transition._suppressEnter=!1)}}_commitNavigation(t){t.committed||(t.committed=!0,t.scope&&t.provider._commitNavigation(t.scope),this.application?._routerState.commit(t.route))}async _execute(t,e,s){const i=++this._navVersion,n=this.stack&&e&&e.to?this.stack:null;n&&n.begin(e);const o=n?n.take(e.to):null,r=new Array(t.chain.length),a=!(!this._previousPath||this._previousPath.route!==t.route||null==this._previousPath.route&&this._previousPath.fullPath!==t.fullPath);var c=!(!this._previousPath||this._previousPath.uri!==t.uri);let l=!1;if(a&&t.route){const e=this._previousPath.params||{},s=t.params||{};let i=!1;const o=new Set([...Object.keys(e),...Object.keys(s)]);for(const t of o)if(e[t]!==s[t]){i=!0;break}if(i){l=!0;const i=t.route;if(i&&!i.keepAlive&&this.controlCache.has(i))if(n)this.controlCache.delete(i);else{const t=this.controlCache.get(i);if(t&&"function"==typeof t.dispose&&!t.isDisposed)try{await t.dispose()}catch{}this.controlCache.delete(i)}try{const i=this.routingModule.getHooks?.()||void 0,n=t.route.onUpdate||i?.onUpdate;if(n){const i={from:{path:this._previousPath.uri||this._previousPath.fullPath||"",params:e},to:{path:t.uri||t.fullPath||"",params:s},meta:t.meta??t.extend};await n(i)}}catch(t){M("MJX306",t,"onUpdate")}}}if((!a||l)&&t.route)try{const e=t.meta??t.extend,s={path:t.uri||t.fullPath||"",params:t.params,meta:e,to:{path:t.uri||t.fullPath||"",params:t.params,meta:e}},i=this.routingModule.getHooks?.()||void 0,n=t.route.onEntering||i?.onEntering;n&&await n(s)}catch(t){M("MJX306",t,"onEntering")}const h=[];for(let e=0;e<t.chain.length;e++){const i=t.chain[e],n=o&&o.chain[e]===i?o.instances[e]:void 0;if(!n||n.isDisposed||i.keepAlive)if(this.controlCache.has(i)){let t=this.controlCache.get(i);if(!t||t.isDisposed){this.controlCache.delete(i);const t=this.createInstance(i.control,s.scope,s.route).then(t=>{this.controlCache.set(i,t),r[e]=t});h.push(t)}else r[e]=t,i.keepAlive&&!this._previousInstances.includes(t)&&this._pendingActivate.add(t)}else{const t=this.createInstance(i.control,s.scope,s.route).then(t=>{this.controlCache.set(i,t),r[e]=t});h.push(t)}else r[e]=n,this.controlCache.set(i,n)}h.length&&await Promise.all(h);let u=null,d=null;const p=this._previousInstances;if(n){const s=!!n.animation&&"none"!==n.animation&&("push"===e.direction||"back"===e.direction||"forward"===e.direction);if(d={animate:s,pages:!s&&!n.gestureCommitPending,direction:e.direction},u=await this._stackLeave(t.chain,r,e,n,d),o){const t=o.top;!t.isDisposed&&o.outlet&&t.parent===o.outlet&&(n.reveal(o),o.outlet.current=t,o.outlet.previouspage=t,this._revealed.add(t)),t.isDisposed||this._pendingActivate.add(t)}}else await this.disposeFromDivergencePoint(t.chain,r);const f=d?r.filter(t=>t&&!p.includes(t)):[];if(d){for(const t of p)vo(t);for(const t of f)d.pages?yo(t,d.direction):(t.motif.options.transition._suppressEnter=!0,s.suppressed.push(t))}if(i===this._navVersion&&this._commitNavigation(s),await this.mountChain(r,t.chain,this.root,i),d?.pages){o?.attached&&!o.top.isDisposed&&rn(o.top,"enter")&&o.top.motif.options.transition.enterTransition(()=>{});for(const t of f)t.isBuilt&&!rn(t,"enter")&&vo(t)}let m=null;if(n){o&&n.restoreScroll(o);for(let t=0;t<r.length;t++)if(r[t]&&r[t]!==p[t]){m=r[t];break}m||(m=r.length?r[r.length-1]:null),n.record(e,m)}if(!c&&t.route)try{const e=t.meta??t.extend,s={path:t.uri||t.fullPath||"",params:t.params,meta:e,to:{path:t.uri||t.fullPath||"",params:t.params,meta:e}},i=this.routingModule.getHooks?.()||void 0,n=t.route?.onEnter||i?.onEnter;n&&await n(s)}catch(t){M("MJX306",t,"onEnter")}if(this._previousPath=t,this._previousInstances=r.slice(),n&&u){u.top&&i===this._navVersion&&(u.retained||u.disposeAfter.length)&&await n.transition(e.direction,m,u.top),u.retained&&n.settle(u.retained);for(const t of u.disposeAfter)try{t.isDisposed||await t.dispose({deep:!0,skipLeaveTransition:!0})}catch(t){M("MJX307",t)}}}async _stackLeave(t,e,s,i,n){const o={top:null,retained:null,disposeAfter:[]},r=this._previousPath?.chain??[],a=this._previousInstances;if(!a.length)return o;let c=-1;for(let t=0;t<a.length;t++){const s=a[t];if(s&&!e.includes(s)){c=t;break}}if(c<0)return o;a[c].isDisposed||Ce(a[c]);const l=t=>{const e=t-1>=0?a[t-1]:this.root,s=r[t]?.extend?.targetOutlet||"default";try{return e&&!e.isDisposed?this.findRouterView(e,s):null}catch{return null}},h=a[c],u=r[c];if(i.isRetaining(s)&&h&&!h.isDisposed&&!u?.keepAlive){const t=l(c);t&&t.current===h&&(t.current=null,t.previouspage=null),an(h),n.pages&&rn(h,"leave")&&(yo(h,n.direction),await(d=h,new Promise(t=>{let e=!1;const s=()=>{e||(e=!0,t())};try{const t=d.motif.options.transition.leaveTransition(s);t&&"function"==typeof t.addEventListener&&t.addEventListener("cancel",s)}catch{s()}})),vo(h));for(let t=c;t<a.length;t++){const e=r[t];e&&!e.keepAlive&&this.controlCache.get(e)===a[t]&&this.controlCache.delete(e)}return o.top=h,o.retained=i.retain(s.from,this._previousPath?.uri??"",r,a,c,t,n.animate),o}var d;const p=n.animate&&!!h&&!h.isDisposed&&!u?.keepAlive;for(let t=a.length-1;t>=c;t--){const s=a[t],i=r[t];if(s&&!e.includes(s))if(s.isDisposed)i&&this.controlCache.get(i)===s&&this.controlCache.delete(i);else if(p&&t>c&&!i?.keepAlive)i&&this.controlCache.get(i)===s&&this.controlCache.delete(i);else try{const e=l(t);if(e&&e.current===s&&(e.current=null,e.previouspage=null),i?.keepAlive){an(s);try{s.parent?.controls.silentDetach(s)}catch{}this.controlCache.has(i)||this.controlCache.set(i,s),Ai(s)}else i&&this.controlCache.get(i)===s&&this.controlCache.delete(i),p&&t===c?(o.top=s,o.disposeAfter.push(s)):n.pages?(yo(s,n.direction),await s.dispose()):await s.dispose({deep:!0,skipLeaveTransition:!0})}catch(t){M("MJX307",t)}}return o}async disposeFromDivergencePoint(t,e){if(!this._previousPath||!this._previousInstances.length)return;const s=this._previousPath.chain,i=this._previousInstances;let n=0;const o=Math.min(s.length,t.length);for(let e=0;e<o&&s[e]===t[e];e++)n=e+1;for(let t=i.length-1;t>=n;t--){const e=i[t],n=s[t];if(e&&!e.isDisposed)try{const s=t-1,o=s>=0?i[s]:this.root,r=n?.extend?.targetOutlet||"default",a=this.findRouterView(o,r);if(a&&a.current===e&&(a.current=null,a.previouspage=null),n?.keepAlive){an(e);try{e.parent?.controls.silentDetach(e)}catch{}this.controlCache.has(n)||this.controlCache.set(n,e),Ai(e)}else this.controlCache.get(n)===e&&this.controlCache.delete(n),await e.dispose()}catch(t){M("MJX307",t)}else n&&this.controlCache.get(n)===e&&this.controlCache.delete(n)}}_construct(t,e,s){const i=this.application?._routerState;return function(t,e){const s=de;de=t??null;try{return e()}finally{de=s}}(t,()=>i?i.constructWith(e,s):s())}async parseControl(t,e,s){var i=this._construct(e,s,()=>this._resolveFrom(e,t));if(i)return i;let n=t;return n instanceof Promise&&(n=ji(await n)),(i=this._construct(e,s,()=>this._resolveFrom(e,n)))||("function"==typeof n?this.parseControl(this._construct(e,s,()=>Hi(n,this.application)),e,s):Hi(n))}_resolveFrom(t,e){const s=t??this._rootProvider();return s&&s.getAllServices().getDescriptor(e)?s.get(e):null}_rootProvider(){try{return this.application?.provider??Ho.main?.provider}catch{return}}async createInstance(t,e,s){return await this._instanceCreator(t,e,s)}async _instanceCreator(t,e,s){let i=await this.parseControl(t,e,s);return Fi(i),i}async activator(t){}static{this.OUTLET_WARN_MS=3e3}async mountChain(t,e,s,i){for(let n=0;n<t.length;){if(i!==this._navVersion)return;let o=t[n];o?.isDisposed&&(o=await this.createInstance(e[n].control,this._rootProvider()?._currentScope()),t[n]=o);const r=e[n]&&e[n].extend&&e[n].extend.targetOutlet||"default",a=this.findRouterView(s,r);if(!a||!s.isBuilt)return void this._waitForOutlet(s,t.slice(n),e.slice(n),i,r);const c=this._revealed.delete(o),l=a.current===o&&!c;await a.navigate(o),this._pendingActivate.delete(o)&&Di(o);const h=e[n]?.onShow;h&&!l&&a.current===o&&i===this._navVersion&&C(()=>h(o),"MJX306","onShow"),s=o,n++}}_waitForOutlet(t,e,i,n,o){const r=this.pendingListeners.get(t);if(r){try{r()}catch{}this.pendingListeners.delete(t)}let a,c=!1;const l=async(s,o)=>{c||(h(),n===this._navVersion&&await this.mountChain(e,i,t,n))},h=()=>{if(!c){c=!0,this.pendingListeners.delete(t);try{t.motif?.off?.(oo,l)}catch{}if(void 0!==a){try{clearTimeout(a)}catch{}a=void 0}}};t.motif.on(oo,l),this.pendingListeners.set(t,h),s.isDevelopment()&&(a=setTimeout(()=>{c||n!==this._navVersion||k("MJX301",[o,No.OUTLET_WARN_MS])},No.OUTLET_WARN_MS))}findRouterView(t,e="default"){const s=(t.controls?.items||[]).slice();for(;s.length;){const t=s.shift();if(t&&!t.isDisposed){if(t.__isRouterView){const s=t;if((s.props.name||"default")===e)return s}if(t.controls&&t.controls.items&&t.controls.items.length)for(const e of t.controls.items)s.push(e)}}if(!e||"default"===e)return null;const i="function"==typeof t.scopeId?t.scopeId():t.scopeId??"";var n=no.find(e,i);if(n)return n;let o=t,r=o?.parent;for(;r;){const t=(r.controls?.items||[]).filter(t=>t!==o).slice();for(;t.length;){const s=t.shift();if(s&&!s.isDisposed){if(s.__isRouterView){const t=s;if((t.props.name||"default")===e)return t}if(s.controls&&s.controls.items&&s.controls.items.length)for(const e of s.controls.items)t.push(e)}}o=r,r=r.parent}return null}}class Po extends Oi{constructor(t){super(t.el??"a",t),!1!==t.showHref&&this.attr.add({href:t.to}),t.target&&this.attr.add({target:t.target}),this.motif.on("click",(e,s)=>{if(t.bypass)return;if(t.target&&"_self"!==t.target)return;if(s.metaKey||s.ctrlKey||s.shiftKey||s.altKey)return;s.preventDefault();const i=Ho.main.router;i&&i.navigate(t.to)}),this.childs&&this.childs.length?this.controls.add(...this.childs):null!=t.text&&this.attr.add({textContent:t.text})}onBuilt(t,e){this.motif.options.enableRouterClassing={to:"all",path:this.props.to,activeClass:this.props.activeClass,exactClass:this.props.exactClass,onActive:this.props.onActive,offActive:this.props.offActive,onExact:this.props.onExact,offExact:this.props.offExact}}}const Lo=t=>t.split("#")[0].split("?")[0],Xo=()=>Math.random().toString(36).slice(2,10)+Date.now().toString(36);class Ro{static{this.MAX_REDIRECTS=10}constructor(t,e){this.routesMap=new Map,this._suppressBeforeEachOnce=!1,this._suppressMiddlewaresOnce=!1,this._scroll=null,this._stack=null,this._windowNavListener=null,this._historyStamp=null,this._pendingTraversal=null,this._currentUri="___startup___",this._previousRoute=null,this._fallbackRoutes={},this._navHandler=null,this._routerOptions=t,this.routeCollection=new Oo(t.RouteItems),this.routingEngine=new No,this.application=e,this._installLinkInterceptor();const s=t.scrollMemory;s&&(this._scroll=new lo(!0===s?{}:s),this._scroll.locationAnchor="history"===this._addressMode()),t.stack&&"shell"!==t.mode&&(this._stack=new Ao(t.stack),this.routingEngine.stack=this._stack)}getHooks(){return this._routerOptions.hooks}start(t,e){this.mainApp=t,this.routingEngine.register(this.mainApp,this.application,this);const s="shell"===this._routerOptions.mode?e??"/":this._getCurrentUri();this._seedHistoryIndex(),this._suppressMiddlewaresOnce=!0,this.navigate(s),"shell"!==this._routerOptions.mode&&(this._windowNavListener=()=>{this._onHistoryTraversal()},window.addEventListener("hash"===this._routerOptions.mode||"file"===this._routerOptions.mode?"hashchange":"popstate",this._windowNavListener))}get shownUri(){return this._previousRoute?this._currentUri:void 0}_getCurrentUri(){try{const t=window,e=this._routerOptions.mode||("file:"===t?.location?.protocol?"hash":"history");if("hash"===e||"file"===e){const e=t?.location?.hash||"";return e&&e.startsWith("#")&&e.slice(1)||"/"}return(t?.location?.pathname||"/")+(t?.location?.search||"")+(t?.location?.hash||"")}catch{return"/"}}static{this.HISTORY_STAMP_KEY="__motifHistory"}_addressMode(){const t=window;return this._routerOptions.mode||("file:"===t?.location?.protocol?"hash":"history")}_readHistoryStamp(){try{const t=window?.history?.state,e=t&&"object"==typeof t?t[Ro.HISTORY_STAMP_KEY]:null;if(e&&"object"==typeof e&&"number"==typeof e.index&&Number.isFinite(e.index)&&"string"==typeof e.session)return{index:e.index,session:e.session}}catch{}return null}static _isPlainObject(t){if(!t||"object"!=typeof t)return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}_withHistoryStamp(t,e){return null==t?{[Ro.HISTORY_STAMP_KEY]:e}:Ro._isPlainObject(t)?{...t,[Ro.HISTORY_STAMP_KEY]:e}:t}_routerState(t,e){return t?this._withHistoryStamp(t,{...e,hasState:!0}):this._withHistoryStamp(null,e)}_userStateOf(t){if(null==t)return;if(!Ro._isPlainObject(t))return t;const e=Ro.HISTORY_STAMP_KEY;if(!(e in t))return t;const s=t[e];if(!s||!0!==s.hasState)return;const{[e]:i,...n}=t;return n}_currentHistoryUserState(){if("shell"!==this._addressMode())try{return this._userStateOf(window?.history?.state)}catch{return}}_nextHistoryStamp(t){const e=this._historyStamp;return e?{index:t?e.index+1:e.index,session:e.session}:{index:0,session:Xo()}}_stampCurrentEntry(t,e){try{const s=window;if(!s?.history||"function"!=typeof s.history.replaceState)return;const i=s.history.state;let n;if(e)n=this._routerState(e,t);else{const e=Ro._isPlainObject(i)&&Object.keys(i).length>0;n=this._withHistoryStamp(i,e?{...t,hasState:!0}:t)}n!==i&&s.history.replaceState(n,"")}catch{}}_seedHistoryIndex(){if("shell"===this._addressMode())return;const t=this._readHistoryStamp();if(t)return void(this._historyStamp=t);const e={index:0,session:Xo()};this._stampCurrentEntry(e),this._historyStamp=e}async _onHistoryTraversal(){const t=this._historyStamp,e=this._readHistoryStamp();this._historyStamp=e;let s,i="traverse";t&&e&&t.session===e.session&&t.index!==e.index&&(i=e.index<t.index?"back":"forward"),this._pendingTraversal={direction:i,state:this._currentHistoryUserState(),from:t};try{s=await this.navigate(this._getCurrentUri())}finally{this._pendingTraversal=null}const n=!!s&&!0===s.cancelled;try{this._stack?.traversalSettled(n)}catch{}if(!n)return;const o=this._readHistoryStamp();if(this._historyStamp=o,!t||!o||o.session!==t.session)return;const r=t.index-o.index;if(0!==r)try{window.history.go(r)}catch{}}get currentUri(){return this._currentUri}async navigate(t,e){const i=this._pendingTraversal;return this._pendingTraversal=null,await(n=async()=>{try{globalThis.__MOTIF_DEVTOOLS_BUS__?.publish?.("route:navigation-start",{uri:t})}catch{}const s=this._suppressBeforeEachOnce;s&&(this._suppressBeforeEachOnce=!1);const n=this._suppressMiddlewaresOnce;n&&(this._suppressMiddlewaresOnce=!1);const o=e||{},r=o.force||!1;if(t===this._currentUri&&!r)return{ok:!0,skipped:!0,uri:t};let a;if(a=n?{proceed:!0,uri:t}:await this._runMiddlewares(t),!a.proceed)return{ok:!1,uri:a.uri,cancelled:!0,reason:"middleware"};t=a.uri;let c,l,h=this.resolve(t),u="";if(h.ok&&h.route?.redirect){const e=t,s=[e];for(;h.ok&&h.route?.redirect;){const e=this._resolveRedirect(h,t);if(!e)break;if(s.length>Ro.MAX_REDIRECTS||s.some(t=>Lo(t)===Lo(e))){u=[...s,e].join(" → "),l=S("MJX303",u);break}s.push(e),t=e,h=this.resolve(t)}if(l)k("MJX303",[u]),t=e,h=this._buildFallbackResult(t,"error",{path:t,error:l});else if(t!==e&&(c=e,t===this._currentUri&&!r))return{ok:!0,skipped:!0,uri:t}}const d=!this._previousRoute,p=d?"initial":i?i.direction:o.replace?"replace":"push",f=i?i.state:d&&void 0===o.state?this._currentHistoryUserState():o.state||void 0,m={path:h.uri||t,params:h.params,meta:h.meta??h.extend,options:e,redirectedFrom:c,direction:p,state:f},_=this._previousRoute?{path:this._previousRoute.path,params:this._previousRoute.params,meta:this._previousRoute.meta,options:this._previousRoute.options}:null;if(this._previousRoute&&this._previousRoute.routeItem){const t=this._previousRoute.routeItem.onLeave||this._routerOptions.hooks?.onLeave;if(t)try{const e={from:{path:this._previousRoute.path,params:this._previousRoute.params,meta:this._previousRoute.meta},to:m},s=await t(e);if(!1===s)return{ok:!1,cancelled:!0,reason:"onLeave"};if(s&&"object"==typeof s&&!0===s.cancel)return{ok:!1,cancelled:!0,reason:s.reason||"onLeave"}}catch(t){M("MJX306",t,"onLeave")}}let g=!0;if(s||(g=await this.application._runBeforeEachGuards(m,_)),!1===g)return{ok:!1,cancelled:!0,reason:"guard"};if("string"==typeof g){const s=this._addressShows(t,c);return await this.navigate(g,s?{...o,replace:!0}:e)}const y=t=>({target:t,chain:this.chainOf(t),direction:p,state:f});h.ok||l||(h=this._buildFallbackResult(t,"notFound",{path:t})),this._currentUri=t,this._previousRoute={path:h.uri,params:h.params,meta:h.meta??h.extend,routeItem:h.route};let v=h.uri;this._scroll?.leaving();const w=i?i.from:this._historyStamp;try{const t=!!c&&this._addressShows(c);this._applyUrl(v,t?{...o,replace:!0}:o)}catch{}const b=this._stack?{direction:p,from:w,to:this._historyStamp,uri:v}:void 0;try{await this.routingEngine.execute(h,b,y(h))}catch(e){M("MJX304",e),h=this._buildFallbackResult(t,"error",{path:t,error:e});try{await this.routingEngine.execute(h,b,y(h))}catch(t){M("MJX305",t)}}this._stack&&this.application._routerState.touch(),o.scroll?this._handleScrollBehavior(o.scroll):this._scroll?.arrived(this._uriWithHash(v,t),p),this.application.fire?.("motifjs-router-navigated",{uri:v,params:h.params,meta:h.meta??h.extend,route:h.ok?h.route:null,ok:h.ok,initial:d,redirectedFrom:c,direction:p,state:f});try{globalThis.__MOTIF_DEVTOOLS_BUS__?.publish?.("route:navigation-end",{uri:v,params:h.params})}catch{}return h},o="UrlRoutingModule.navigate",s.safeCallSilentAsync(n,o));var n,o}describeStack(){return this._stack?this._stack.describe():void 0}routeInfos(){const t=[],e=(s,i)=>{const n=[...i,s];t.push({fullPath:s.fullPath||s.path,name:s.name??null,meta:s.meta??s.extend??{},route:s,chain:n});for(const t of s.childs||[])e(t,n)};for(const t of this.routeCollection?.routes||[])e(t,[]);return t}href(t,e){const s=this.routeCollection.routesMap?.get(t);if(!s)throw S("MJX302",t);const i=s.fullPath||s.path;return this.routingEngine.generatePathString(i,e||{})||i}async evict(t){let e=null;if("string"==typeof t){if(e=this.routeCollection.routesMap?.get(t),!e)throw S("MJX302",String(t))}else e=t;await this.routingEngine.evict(e)}_getFallbackRoute(t){const e=this._fallbackRoutes[t];if(e)return e;const s=this._routerOptions.fallbacks?.[t],i={path:"",fullPath:null,control:s??("notFound"===t?Ro._builtinNotFound:Ro._builtinError),name:"notFound"===t?"not-found":"error",childs:[],extend:{},meta:{},validate:void 0,keepAlive:!1};return this._fallbackRoutes[t]=i,i}_buildFallbackResult(t,e,s){const i=this._getFallbackRoute(e),n=this._findLayoutPrefix(t),o=[...n?.chain??[],i],r={},a={};for(const t of o)t?.extend&&"object"==typeof t.extend&&Object.assign(r,t.extend),t?.meta&&"object"==typeof t.meta&&Object.assign(a,t.meta);return{ok:!1,uri:t,fullPath:null,route:i,chain:o,params:{...n?.params??{},...s},extend:r,meta:a}}_findLayoutPrefix(t){const e=t.split("?")[0].split("#")[0].split("/").filter(Boolean);let s=null;for(const t of this.routeCollection?.records||[]){if(!t.leaf.childs||!t.leaf.childs.length)continue;const i=t.fullPath.split("/").filter(Boolean).length;if(i>e.length)continue;const n="/"+e.slice(0,i).join("/");let o=!1;try{o=t.scanner.exist(n,this._pageSearch())}catch{o=!1}if(!o)continue;const r={...t.scanner.parameters};this.validateChain(n,t,r)&&((!s||t.chain.length>s.rec.chain.length||t.chain.length===s.rec.chain.length&&i>s.depth)&&(s={rec:t,params:r,depth:i}))}return s?{chain:s.rec.chain,params:s.params}:null}static{this._builtinNotFound=()=>new Oi("div",{initializeComponent(t){t.style({padding:"20px",fontFamily:"Arial, sans-serif",display:"flex","flex-direction":"column","align-items":"center"}),t.element.appendChild(Yi("h2",{},"404 - Not Found")),t.element.appendChild(Yi("p",{},"The requested page was not found."))}})}static{this._builtinError=()=>new Oi("div",{initializeComponent(t){t.style({padding:"20px",fontFamily:"Arial, sans-serif",display:"flex","flex-direction":"column","align-items":"center"}),t.element.appendChild(Yi("h2",{},"Error")),t.element.appendChild(Yi("p",{},"The requested page could not be loaded."))}})}async navigateByName(t,e,s){return await this.navigate(this.href(t,e),s)}async _runMiddlewares(t){let e=t;const s={uri:e,rewritePath:t=>{e=t,s.uri=t},context:this.application};let i=!1;const n=this._routerOptions.middlewareCollections&&this._routerOptions.middlewareCollections()||[],o=async t=>{if(t===n.length)return void(i=!0);const e=n[t];await e(s,async()=>{await o(t+1)})};return 0===n.length?i=!0:await o(0),{proceed:i,uri:e}}chainOf(t){return t.chain.map(e=>this.routingEngine.generatePathString(e.path,t.params)||"")}resolve(t){const e=[],s=this._pageSearch();for(const i of this.routeCollection?.records||[]){if(!i.scanner.exist(t,s))continue;const n={...i.scanner.parameters};this.validateChain(t,i,n)&&e.push({rec:i,params:n})}if(0===e.length){const e=(this.routeCollection?.records||[]).find(t=>t.scanner.exist("/*"));if(e){const s={};try{for(const t of e.chain)t&&t.extend&&"object"==typeof t.extend&&Object.assign(s,t.extend)}catch{}return{ok:!0,uri:t,fullPath:e.fullPath,route:e.leaf,chain:e.chain,params:{},extend:s||{},meta:e.meta||{}}}return{ok:!1,uri:t,fullPath:null,route:null,chain:[],params:{},extend:{}}}let i=e[0];const n=new Map;for(const t of e){const e=t.rec.fullPath,s=n.get(e)||[];s.push(t),n.set(e,s)}let o=!1;for(const[t,e]of n)if(e.length>1){i=(e.some(t=>!t.rec.aliasOf)?e.filter(t=>!t.rec.aliasOf):e).reduce((t,e)=>t.rec.chain.length>=e.rec.chain.length?t:e),o=!0;break}o||(i=e.reduce((t,e)=>To(t.rec,e.rec)<=0?t:e,e[0]));const r=i.rec,a=i.params,c={};try{for(const t of r.chain)t&&t.extend&&"object"==typeof t.extend&&Object.assign(c,t.extend)}catch{}return{ok:!0,uri:t,fullPath:r.fullPath,aliasOf:r.aliasOf??null,route:r.leaf,chain:r.chain,params:a,extend:c,meta:(()=>{const t={};try{for(const e of r.chain)e&&e.meta&&"object"==typeof e.meta&&Object.assign(t,e.meta)}catch{}return t})()}}validateChain(t,e,s){for(const i of e.chain)if("function"==typeof i.validate){const n={uri:t,key:i.name??e.fullPath,routes:this.routesMap,params:s};if(!i.validate(n))return!1}return!0}_installLinkInterceptor(){try{if(this._navHandler)return;this._navHandler=t=>{const e=window,s=this._routerOptions.mode||("file:"===e?.location?.protocol?"hash":"history");let i=t.target;for(;i&&i!==document.body&&!(i instanceof HTMLAnchorElement);)i=i.parentElement;if(!(i&&i instanceof HTMLAnchorElement))return;const n=i.getAttribute("rel")||"";if(!("router"==i.getAttribute("x-command")||i.hasAttribute("data-router-link")||"router"===n.toLowerCase()))return;const o=i;if(o.target&&"_self"!==o.target)return;if(t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;let r=o.getAttribute("href")||"";if(r||(r=o.getAttribute("x-to")||""),!r)return;if("history"===s){const s=new URL(r,e.location.href);if(s.origin!==e.location.origin)return;t.preventDefault();const i=s.pathname+s.search+s.hash;return void this.navigate(i)}t.preventDefault();const a=r.startsWith("#")?r.slice(1):r;this.navigate(a)},document.addEventListener("click",this._navHandler)}catch{}}_applyUrl(t,e={}){try{const s=window,i=this._routerOptions.mode||("file:"===s?.location?.protocol?"hash":"history");if("shell"===i)return;if("hash"===i||"file"===i){const i=t.startsWith("#")?t:"#"+t;if(s?.location?.hash!==i)if(e.replace&&s?.history&&"function"==typeof s.history.replaceState){const t=this._nextHistoryStamp(!1);s.history.replaceState(this._routerState(e.state,t),"",i),this._historyStamp=t}else{s.location.hash=i;const t=this._nextHistoryStamp(!0);this._stampCurrentEntry(t,e.state),this._historyStamp=t}return}if(s?.history&&"function"==typeof s.history.pushState){const i=(s.location.pathname||"/")+(s.location.search||"")+(s.location.hash||"");let n=t;try{const e=new URL(t,s.location.href);n=e.pathname+e.search+e.hash}catch{}if(i!==n)if(e.replace){const i=this._nextHistoryStamp(!1);s.history.replaceState(this._routerState(e.state,i),"",t),this._historyStamp=i}else{const i=this._nextHistoryStamp(!0);s.history.pushState(this._routerState(e.state,i),"",t),this._historyStamp=i}}}catch{}}_resolveRedirect(t,e){const s=t.route?.redirect;if(!s)return null;if("function"==typeof s){const e=s({path:t.uri,params:t.params,meta:t.meta??t.extend});return"string"==typeof e&&e.length>0?e:null}const i=this.routingEngine.generatePathString(s,t.params||{}),n=e.indexOf("#"),o=n>=0?e.slice(n):"",r=n>=0?e.slice(0,n):e,a=r.indexOf("?"),c=a>=0?r.slice(a):"",l=i.indexOf("#"),h=l>=0?i.slice(l):"";let u=l>=0?i.slice(0,l):i;return c&&!u.includes("?")&&(u+=c),u+(h||o)}_pageSearch(){try{const t=window,e=this._routerOptions.mode||("file:"===t?.location?.protocol?"hash":"history");if("history"===e||"shell"===e)return;return t?.location?.search||void 0}catch{return}}_addressShows(...t){const e=this._getCurrentUri().split("#")[0];return t.some(t=>!!t&&t.split("#")[0]===e)}_uriWithHash(t,e){const s=e.indexOf("#");return s<0||t.indexOf("#")>=0?t:t+e.slice(s)}_handleScrollBehavior(t){if(t)try{"top"===t?window.scrollTo({top:0,behavior:"auto"}):"smooth"===t?window.scrollTo({top:0,behavior:"smooth"}):"instant"===t?window.scrollTo({top:0,behavior:"instant"}):"object"==typeof t&&window.scrollTo({top:t.top||0,left:t.left||0,behavior:t.behavior||"auto"})}catch{}}dispose(){try{this._scroll?.dispose()}catch{}this._scroll=null,this._historyStamp=null;let t=Promise.resolve();try{try{t=this.routingEngine.dispose()}catch{}if(this._navHandler){try{document.removeEventListener("click",this._navHandler)}catch{}this._navHandler=null}if(this._windowNavListener){const t="hash"===this._routerOptions.mode||"file"===this._routerOptions.mode?"hashchange":"popstate";try{window.removeEventListener(t,this._windowNavListener)}catch{}this._windowNavListener=null}}catch{}return t}}class Io{constructor(){this.version=new re(0),this._current=null,this._constructing=null}read(){return this.version.value,this._constructing??this._current}commit(t){this._current=t,this.touch()}reset(){this._current=null,this.touch()}touch(){this.version.value=this.version.peek()+1}constructWith(t,e){if(!t)return e();const s=this._constructing;this._constructing=t;try{return e()}finally{this._constructing=s}}}let Jo=null,jo=!1;class Fo{constructor(){if(this.services=new Zn,Jo&&"disposing"!==Jo.state||jo)throw new w("MJX405",b("MJX405"),{cause:Jo});jo=!0}build(){this.services.autoRegisterInjectables();const t=this.services.buildServiceProvider();this.services.addSingleton(De,t);var e=new Ho(t);return this.services.addSingleton(Ho,e),Jo=e,e}rebuild(){return Jo?(Jo.provider.dispose(),Jo.provider=this.services.buildServiceProvider(),Jo):this.build()}}class Ho{static get main(){return Jo}constructor(t){this.provider=t,this._state="initializing",this._middlewares=[],this._beforeEachGuards=[],this._routerState=new Io,this.router=function(t,e){const s=()=>{const t=e();if(!t)throw S("MJX309");return t},i=()=>t.read()?.target;return{get params(){return i()?.params??{}},get route(){return i()?.route??null},get ok(){return i()?.ok??!1},get uri(){return i()?.uri??""},get fullPath(){return i()?.fullPath??null},get aliasOf(){return i()?.aliasOf??null},get extend(){return i()?.extend??{}},get meta(){const t=i();return t?t.meta??t.extend:{}},get chain(){return t.read()?.chain??[]},get direction(){return t.read()?.direction},get state(){return t.read()?.state},get stack(){return t.version.value,e()?.describeStack()},get routes(){return t.version.value,e()?.routeInfos()??[]},navigate:async(t,e)=>await s().navigate(t,e),navigateByName:async(t,e,i)=>await s().navigateByName(t,e,i),evict:async t=>{await s().evict(t)},resolve:t=>{const e=s(),i=e.resolve(t);return{chain:e.chainOf(i),result:i}},href:(t,e)=>s().href(t,e)}}(this._routerState,()=>this.urlRoutingModule),this.events=new Map,this._routerConfig=null,this._routerRoot=null,this._startedRouter=null,this._lifecycleOff=null,this._isDevelopment=!1,this._enableErrorLogging=!0}static{this._disposingCount=0}get state(){return this._state}static CreateBuilder(){return new Fo}getAppShell(){return this.appShell}run(t,e){let s;if(o(()=>{Hn.startGc()},"Application.run.engine.startGc"),"string"==typeof t){if(s=document.querySelector(t),!s)throw S("MJX406",t)}else s=t;let i=e;this._state="running";const n=new Oi(s);this.appShell=n,o(()=>{n._keepElementOnDispose=!0,n.application=this,n.provider=this.provider},"Application.run.setupAppShell"),i?(i.parent=n,n.controls.add(i)):(i=n,i.controls.add(new ro({name:"default"}))),n.build(),this._routerRoot=i,this.urlRoutingModule&&(this.urlRoutingModule.start(i),this._startedRouter=this.urlRoutingModule)}insert(t){this.appShell.controls.add(t)}remove(t){this.appShell.controls.remove(t)}attach(t){this.appShell.controls.add(t)}detach(t){this.appShell.controls.detach(t)}appendToMainHost(t){this.appShell.element?.appendChild(t)}dispose(){if(this._disposing)return this._disposing;let t;this._state="disposing",Ho._disposingCount++,jo=!1,o(()=>{this._removeLifecycleListeners()},"Application.dispose.lifecycle"),o(()=>{t=this.urlRoutingModule?.dispose?.()},"Application.dispose.router"),o(()=>{Hn.stopGc()},"Application.dispose.gcStop"),o(()=>{try{const t=window;t&&t.history&&"function"==typeof t.history.replaceState&&t.history.replaceState({},"","/")}catch{}},"Application.dispose.resetUrl"),Te.mode="concurrent";const e=this.appShell;return this._disposing=(async()=>{try{await t}catch(t){M("MJX307",t)}if(e&&!e.isDisposed)try{await e.dispose()}catch(t){M("MJX307",t)}try{await this.provider.dispose()}catch{}Jo===this&&(Jo=null),this._state="disposed",Ho._disposingCount--})()}useTransitions(t){return je(t?.mode)&&(Te.mode=t.mode),this}use(t){return this._middlewares.push(t),this}useGuard(t){return this._beforeEachGuards.push(t),this}async _runBeforeEachGuards(t,e){const s={to:t,from:e};for(const t of this._beforeEachGuards){let e,i=!1;const n=t=>{i=!0,e=t};try{await t(s,n)}catch(t){return M("MJX306",t,"guard"),!1}if(!i)return!1;if(!1===e)return!1;if("string"==typeof e)return e}return!0}useRouter(t){let e,s,i,n,r,a;return Array.isArray(t)?e=t:(e=t.routes,s=t.mode,i=t.fallbacks,n=t.hooks,r=t.scrollMemory,a=t.stack),this.urlRoutingModule&&this.urlRoutingModule.dispose(),this._routerConfig={mode:s,fallbacks:i,middlewareCollections:()=>this._middlewares,RouteItems:e,hooks:n,scrollMemory:r,stack:a},this.urlRoutingModule=new Ro(this._routerConfig,this),this._routerState.reset(),o(()=>{u(),io(),g(e),(this._isDevelopment||!0===globalThis.__MOTIF_DEV__||d())&&function(t){const e=new Map,s=new Map;function i(t,n,o){const r=t.path??"",a=String(r),c=""===n?a:to(n,a),l=o>0&&"/"===a.trim(),h=""===a.trim();h&&k("MJX310",[n||"/"],{parentPath:n,path:a}),o>0&&a.length>0&&"/"!==a&&!a.startsWith("/")&&!a.startsWith("*")&&k("MJX311",[a,n||"/"],{parentPath:n,path:a}),n&&c===n&&(l||h||k("MJX312",[c],{parentPath:n,childPath:a}));const u=(e.get(c)||0)+1;e.set(c,u),u>1&&(l||h||k("MJX313",[c],{full:c}));const d=null==t.alias?[]:Array.isArray(t.alias)?t.alias:[t.alias];for(const t of d){const e=String(t??"");o>0&&e.length>0&&"/"!==e&&!e.startsWith("/")&&!e.startsWith("*")&&k("MJX314",[e,n||"/"],{parentPath:n,alias:e});const i=""===n?e:to(n,e);i===c&&k("MJX315",[i],{full:c,alias:e});const r=(s.get(i)||0)+1;s.set(i,r),r>1&&k("MJX316",[i],{aliasFull:i})}const p=t.childs;if(Array.isArray(p))for(const t of p)i(t,c,o+1)}for(const e of t)i(e,"",0)}(e)},"Application.useRouter.devtools"),this}restartRouter(){const t=this._routerRoot;if(!t||!this._routerConfig)return this;const e=this._startedRouter,s=e?.shownUri;let i=this.urlRoutingModule;return i&&i!==e||(e?.dispose(),i=new Ro(this._routerConfig,this),this.urlRoutingModule=i),this._routerState.reset(),this._startedRouter=i,i.start(t,s),this}async navigate(t,e){if(this.urlRoutingModule)return await this.urlRoutingModule.navigate(t,e);throw S("MJX309")}async navigateByName(t,e,s){if(this.urlRoutingModule)return await this.urlRoutingModule.navigateByName(t,e,s);throw S("MJX309")}on(t,e){var s=this.events.get(t);return s||(this.events.set(t,new Set),s=this.events.get(t)),s&&s.add(e),()=>this.off(t,e)}off(t,e){var s=this.events.get(t);s&&s.delete(e)}fire(t,e){var s=this.events.get(t);s&&s.forEach(s=>{C(()=>s(e),"MJX123",String(t))})}onRouterChanged(t){return this.on("motifjs-router-navigated",t)}get isVisible(){try{return"undefined"==typeof document||"hidden"!==document.visibilityState}catch{return!0}}get isOnline(){try{return"undefined"==typeof navigator||!1!==navigator.onLine}catch{return!0}}onLifecycle(t){return this._installLifecycleListeners(),this.on("motifjs-app-lifecycle",t)}_emitLifecycle(t){this.fire("motifjs-app-lifecycle",{state:t,visible:this.isVisible,online:this.isOnline})}_installLifecycleListeners(){if(this._lifecycleOff)return;const t=[],e=(e,s,i)=>{if(e)try{e.addEventListener(s,i),t.push(()=>{try{e.removeEventListener(s,i)}catch{}})}catch{}},s="undefined"!=typeof document?document:void 0,i="undefined"!=typeof window?window:void 0;e(s,"visibilitychange",()=>this._emitLifecycle(this.isVisible?"visible":"hidden")),e(s,"freeze",()=>this._emitLifecycle("frozen")),e(s,"resume",()=>this._emitLifecycle("resumed")),e(i,"pageshow",t=>{t&&t.persisted&&this._emitLifecycle("restored")}),e(i,"online",()=>this._emitLifecycle("online")),e(i,"offline",()=>this._emitLifecycle("offline")),this._lifecycleOff=t}_removeLifecycleListeners(){const t=this._lifecycleOff;if(this._lifecycleOff=null,t)for(const e of t)e()}get isDevelopmentModeEnabled(){return this._isDevelopment}useReactiveMonitor(t={}){return o(()=>{bt(t)},"Application.useReactiveMonitor.core"),this}useDevelopment(t=!0){return this._isDevelopment=t,s.setDevelopmentMode(t),o(()=>{globalThis.__MOTIF_DEV__=t},"Application.useDevelopment.flag"),o(()=>{var e;e=t,a.enabled=e||l(),h(a.enabled)},"Application.useDevelopment.devtools"),t&&function(){for(const t of Array.from(lt))ht(t)}(),this}useLogging(t=!0){return this._enableErrorLogging=t,function(t){s.setConsoleLogging(t)}(t),this}}function Bo(){return Ho.main.router}function zo(){return{application:Ho.main,services:Ho.main.provider,router:Ho.main.router,attach(...t){Ho.main&&Ho.main.getAppShell().controls.add(...t)}}}function Vo(t){return e=>{Qn.set(e,{lifetime:t?.lifetime??"transient",deps:t?.deps})}}function Wo(t){try{return Ho.main.provider.get(t)}catch(e){return k("MJX414",[$o(t),String(e?.message??e)],{token:t,error:e}),null}}function $o(t){return"function"==typeof t?t.name||"[AnonymousClass]":String(t)}function Uo(t){return t&&"TimeoutError"===t.name}class qo extends w{constructor(){super("MJX605",b("MJX605")),this.name="TimeoutError"}}function Go(t){return new Promise(e=>setTimeout(e,t))}function Ko(t,e=.1){const s=(2*Math.random()-1)*e*t;return Math.max(0,Math.floor(t+s))}class Yo{}class Qo extends Yo{constructor(t={}){super(),this.retries=t.retries??3,this.backoff=t.backoff??"exponential",this.delayMs=t.delay??100,this.jitter=Math.min(Math.max(t.jitter??.1,0),1),this.shouldHandle=t.shouldHandle??(t=>!!t&&!Uo(t)),this.onRetry=t.onRetry}calcDelay(t){if("none"===this.backoff)return 0;if("fixed"===this.backoff)return Ko(this.delayMs,this.jitter);return Ko(this.delayMs*Math.pow(2,t-1),this.jitter)}async execute(t,e){let s;for(let i=1;i<=this.retries+1;i++)try{return await Promise.resolve(t(e))}catch(t){if(s=t,!this.shouldHandle(t)||i>this.retries)break;const n=this.calcDelay(i);this.onRetry&&await this.onRetry(i,t,n,e),n>0&&await Go(n)}throw s}}class Zo extends Yo{constructor(t){super(),this.timeoutMs=t.timeoutMs}async execute(t,e){let s;const i=Promise.resolve(t(e)),n=new Promise((t,e)=>{s=setTimeout(()=>e(new qo),this.timeoutMs)});try{return await Promise.race([i,n])}finally{clearTimeout(s)}}}class tr extends Yo{constructor(t={}){super(),this.state="CLOSED",this.failureCount=0,this.successCount=0,this.nextAttemptTime=0,this.failureThreshold=t.failureThreshold??5,this.successThreshold=t.successThreshold??2,this.durationOfBreakMs=t.durationOfBreakMs??6e4,this.shouldHandle=t.shouldHandle??(t=>!!t&&!Uo(t)),this.onStateChange=t.onStateChange}async changeState(t){const e=this.state;this.state=t,this.failureCount=0,this.successCount=0,"OPEN"===t&&(this.nextAttemptTime=Date.now()+this.durationOfBreakMs),this.onStateChange&&await this.onStateChange(e,t)}async execute(t,e){if("OPEN"===this.state){if(!(Date.now()>=this.nextAttemptTime))throw S("MJX602");await this.changeState("HALF_OPEN")}try{const s=await Promise.resolve(t(e));return"HALF_OPEN"===this.state?(this.successCount++,this.successCount>=this.successThreshold&&await this.changeState("CLOSED")):"CLOSED"===this.state&&(this.failureCount=0),s}catch(t){throw this.shouldHandle(t)&&(this.failureCount++,("HALF_OPEN"===this.state||"CLOSED"===this.state&&this.failureCount>=this.failureThreshold)&&await this.changeState("OPEN")),t}}getState(){return this.state}}class er extends Yo{constructor(t={}){super(),this.active=0,this.queue=[],this.maxConcurrent=t.maxConcurrent??10,this.maxQueue=t.maxQueue??50}dequeue(){if(0===this.queue.length)return;if(this.active>=this.maxConcurrent)return;this.queue.shift()()}async execute(t,e){if(this.active>=this.maxConcurrent){if(this.queue.length>=this.maxQueue)throw S("MJX603");await new Promise(t=>{this.queue.push(t)})}this.active++;try{return await Promise.resolve(t(e))}finally{this.active--,this.dequeue()}}}class sr extends Yo{constructor(t={}){super(),this.tokensPerInterval=t.tokensPerInterval??1,this.intervalMs=t.intervalMs??1e3,this.capacity=t.capacity??this.tokensPerInterval,this.tokens=this.capacity,this.lastRefill=Date.now()}refill(){const t=Date.now(),e=t-this.lastRefill;if(e<=0)return;const s=Math.floor(e/this.intervalMs)*this.tokensPerInterval;s>0&&(this.tokens=Math.min(this.capacity,this.tokens+s),this.lastRefill=t)}async execute(t,e){if(this.refill(),this.tokens<=0)throw S("MJX604");return this.tokens-=1,Promise.resolve(t(e))}}class ir extends Yo{constructor(t){super(),this.fallback=t.fallback,this.shouldHandle=t.shouldHandle??(()=>!0)}async execute(t,e){try{return await Promise.resolve(t(e))}catch(t){if(!this.shouldHandle(t))throw t;return await Promise.resolve(this.fallback(t,e))}}}class nr extends Yo{constructor(...t){super(),this.policies=t}async execute(t,e){return this.policies.reduceRight((t,e)=>s=>e.execute(()=>t(s),s),t)(e)}}const or=t=>new Qo(t),rr=t=>new Zo(t),ar=t=>new tr(t),cr=t=>new er(t),lr=t=>new sr(t),hr=t=>new ir(t),ur=(...t)=>new nr(...t);function dr(t,e){return s=>t.execute(e,s)}class pr{constructor(){this.resiliences=[],this.retry=t=>(this.resiliences.push(or(t)),this),this.timeout=t=>(this.resiliences.push(rr(t)),this),this.circuitBreaker=t=>(this.resiliences.push(ar(t)),this),this.bulkhead=t=>(this.resiliences.push(cr(t)),this),this.rateLimiter=t=>(this.resiliences.push(lr(t)),this),this.fallback=t=>(this.resiliences.push(hr(t)),this)}static get create(){return new pr}async execute(t,e){return ur(...this.resiliences).execute(t,e)}}export{Ho as Application,Fo as ApplicationBuilder,Oi as Component,zs as ComponentBase,ie as ComponentMotif,ae as Computed,mn as ContentBlock,_n as ContentBody,Qi as ControlCollection,tt as Dictionary,E as Disposable,A as DisposableStore,Ht as Emitter,e as ErrorHandler,Ni as FNComponent,Wi as FragmentNode,hn as Frame,Wo as FromService,Vo as Injectable,on as Lazy,ce as LazyComputed,st as LinkedList,G as List,w as MotifError,q as NameValuePair,ut as NodeTypes,rt as Query,pr as Resilience,Po as RouterLink,ro as RouterView,Zn as ServiceCollection,De as ServiceProvider,re as Signal,wn as Transport,Sn as TransportTo,bn as Transporter,Yn as Virtualization,Et as asyncTracking,$n as clearModel,bt as configureReactivityLeakMonitor,Gn as createComputed,Kn as createLazyComputed,qn as createSignal,dr as decorate,Un as deepClone,D as disposableCore,qi as dom,At as effect,s as errorHandler,Se as inject,ht as motifCompiled,Ii as motifComponent,zi as motifFragment,dn as preProcessing,Vn as reactive,nt as read,i as safeCall,n as safeCallAsync,o as safeCallSilent,r as setUnexpectedErrorHandler,K as toDisposable,it as toGetter,Ot as untracked,zo as useApplication,Wn as useModel,Bo as useNavigation};
|
|
1
|
+
const t={enabled:!1,listeners:new Set,warnings:[],routes:null,exposed:null};function e(){return t.enabled||!0===globalThis.__MOTIF_DEV__}function s(){return t.enabled}function i(){return t.enabled?o:void 0}function n(e){return t.listeners.add(e),()=>{t.listeners.delete(e)}}function o(e,s){const i={type:e,payload:s};for(const e of t.listeners)try{e(i)}catch{}}function r(){return t.warnings.slice()}function a(){return t.routes}function c(t){setTimeout(()=>{throw t},0)}class l{constructor(){this.unexpectedErrorHandler=c,this.listeners=[],this._isDevelopment=!1,this._enableConsoleLogging=!0}setDevelopmentMode(t){this._isDevelopment=t}setConsoleLogging(t){this._enableConsoleLogging=t}isDevelopment(){return this._isDevelopment||!0===globalThis.__MOTIF_DEV__}reportSuppressed(t,e){this.logIfDev(t,e)}report(t){this._enableConsoleLogging&&(void 0!==t.cause?console.error(t.message,t.cause):console.error(t.message));try{i()?.("error:caught",{context:t.code??t.name,error:this.serializeError(t)})}catch{}this.emit(t)}logIfDev(t,e){this.isDevelopment()&&this._enableConsoleLogging&&console.error(`[motifjs Error - ${t}]`,e);try{i()?.("error:caught",{context:t,error:this.serializeError(e)})}catch{}}serializeError(t){if(!t)return{message:"Unknown error"};if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack,cause:t.cause?this.serializeError(t.cause):void 0};if("object"==typeof t)try{return JSON.parse(JSON.stringify(t))}catch{return String(t)}return String(t)}addListener(t){return this.listeners.push(t),()=>{const e=this.listeners.indexOf(t);-1!==e&&this.listeners.splice(e,1)}}emit(t){for(const e of this.listeners.slice())e(t)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}safeCall(t,e,s){try{return t()}catch(t){return this.logIfDev(e,t),this.onUnexpectedError(t),s}}async safeCallAsync(t,e,s){try{return await t()}catch(t){return this.logIfDev(e,t),this.onUnexpectedError(t),s}}safeCallSilent(t,e){try{t()}catch(t){this.logIfDev(e,t)}}async safeCallSilentAsync(t,e){try{return await t()}catch(t){this.logIfDev(e,t)}}wrapSafe(t,e){return(...s)=>{try{return t(...s)}catch(t){return this.logIfDev(e,t),void this.onUnexpectedError(t)}}}wrapSafeAsync(t,e){return async(...s)=>{try{return await t(...s)}catch(t){return this.logIfDev(e,t),void this.onUnexpectedError(t)}}}}const h=new l;function u(t,e,s){return h.safeCall(t,e,s)}function d(t,e,s){return h.safeCallAsync(t,e,s)}function p(t,e){h.safeCallSilent(t,e)}function f(t){h.setUnexpectedErrorHandler(t)}const m={MJX101:t=>`dom.createElement('${t}'): no document is available (no DOM environment).`,MJX102:t=>`Invalid element selector "${t}".`,MJX103:t=>`dom.createElementNS('${t}') failed.`,MJX104:()=>"Skipped inserting a component into the DOM because it contains its own parent.",MJX105:()=>"Applying router link classes failed.",MJX106:()=>"The placeholder parent changed; rebuilding the component.",MJX107:()=>"Disposing a child component failed.",MJX108:()=>"Component is disposed; the result of doWork was discarded.",MJX109:()=>"A content block child was removed because its content body is being disposed.",MJX110:t=>`Lazy timeout: the component did not load within ${t} ms.`,MJX111:()=>"Lazy aborted: loading the component was cancelled.",MJX112:t=>`resolveComponent: the factory chain exceeded ${t} levels; a factory may be returning itself.`,MJX113:()=>"The transport slot has no parent; mount the slot before transporting into it.",MJX114:()=>"Placing the navigation target into its host failed.",MJX115:()=>"Disposing the previous navigation target failed.",MJX116:t=>`Timeout: the listener guard did not settle within ${t} ms.`,MJX117:()=>"Detaching a control failed.",MJX118:()=>"The onRemove callback failed while detaching a control.",MJX119:()=>"Moving a fragment's DOM range stopped: its end marker was not found (possible infinite loop).",MJX120:()=>"Scanning a fragment's DOM range stopped: its end marker was not found (possible infinite loop).",MJX121:(t,e)=>`This code was compiled for compiler contract ${t}, but the @motifx/core runtime implements contract ${e}. Install matching versions of @motifx/compiler and @motifx/core, and rebuild packages that ship compiled JSX.`,MJX122:t=>`The component ${t} hook threw.`,MJX123:t=>`The '${t}' event handler threw.`,MJX124:t=>`A spread object on a DOM tag cannot set ${t}; the key was ignored. Write it on the tag, or use x-html, for HTML you trust.`,MJX125:t=>`A spread object on a DOM tag cannot set a javascript: URL on '${t}'; the value was ignored. Write the attribute on the tag if it is intended.`,MJX126:()=>"Lazy: loading the component failed and no Fallbackview is set; the host was cleared.",MJX127:t=>"module"===t?"The loaded module has no default export. Export the component as default, or map it: () => import('./X').then(m => m.X).":`The loaded value is not a component (got ${t}). Return a component class, a function component, an Options API factory or a component instance.`,MJX128:(t,e,s)=>"method"===s?`${t} overrides ${e} without calling super.${e}; MotifJS relies on this ComponentBase member. Rename your member, or call super.${e} in the override.`:"field"===s?`${t} defines '${e}' as an instance field, which hides the ComponentBase member MotifJS relies on. Rename your field.`:`${t} replaces '${e}', which MotifJS created for the component (a class field or an assignment with that name). Rename your member.`,MJX201:()=>"ListBinding: renderFn must return a component instance, a component class, or a factory function.",MJX202:(t,e)=>`ListBinding: duplicate key "${String(t)}" at index ${e}. Rows are matched by the item object, not by key, so rendering is not affected; keep keys unique so they identify items.`,MJX203:t=>`An effect ran ${t} times in one flush and keeps triggering itself; it is skipped for the rest of this flush. It probably writes a value it reads (for example state.n++). Wrap the write in untracked(...).`,MJX204:()=>"A component reached a text binding and was not written to the DOM. For a template prop that can change later, write a getter: {() => props.tpl}. Templates that are ready at setup also work as {props.tpl}.",MJX205:()=>"Virtualization: the watch callback threw.",MJX206:()=>"Virtualization: autoRefresh stopped; dataRequest may be changing the reactive data it reads on every refresh.",MJX207:()=>"Virtualization: loading data failed.",MJX208:()=>"An effect threw.",MJX301:(t,e)=>`RouterView outlet '${t}' was not built within ${e} ms, so the route chain cannot be mounted. Does the layout component render a <RouterView>?`,MJX302:t=>`Named route '${t}' was not found.`,MJX303:t=>`Redirect loop or too many redirects: ${t}`,MJX304:()=>"Route execution failed.",MJX305:()=>"The error fallback route failed.",MJX306:t=>`The ${t} hook threw.`,MJX307:()=>"Disposing a route component failed.",MJX308:()=>"The stack navigation transition failed.",MJX309:()=>"Router is not initialized. Call useRouter() before navigating.",MJX310:t=>`Route path cannot be empty; use '/' for the default child. Under parent "${t}".`,MJX311:(t,e)=>`Child route path should start with '/': "${t}" under parent "${e}".`,MJX312:t=>`Child route path resolves to the same full path as its parent: "${t}".`,MJX313:t=>`Multiple routes resolve to the same full path: "${t}".`,MJX314:(t,e)=>`Child route alias should start with '/': "${t}" under parent "${e}".`,MJX315:t=>`Route alias resolves to the route's own path: "${t}".`,MJX316:t=>`Multiple routes use the same alias: "${t}".`,MJX401:t=>`Service not registered for token: ${t}`,MJX402:t=>`Async factory used with get() for token ${t}; use getAsync().`,MJX403:()=>"Invalid service descriptor.",MJX404:t=>`Cyclic dependency detected: ${t}`,MJX405:()=>"Only one ApplicationBuilder instance is allowed.",MJX406:t=>`Application.run: host not found for selector: ${t}`,MJX407:t=>`getService: no ServiceProvider found for token '${t}'.`,MJX408:(t,e)=>`getService failed for token '${t}': ${e}`,MJX409:t=>`inject(${t}) was called outside a service construction; call it in a field initializer or constructor of a class the ServiceProvider creates.`,MJX410:(t,e)=>`Multiple sources provided for token '${t}': ${e}. Resolution order is useValue > useFactory > useClass.`,MJX411:t=>`'deps' must be an array for token '${t}'; the invalid deps are ignored.`,MJX413:t=>`Service '${t}' is registered with a function that cannot be constructed. Use { useValue: fn } to provide the function itself or { useFactory: fn } to create the service.`,MJX414:(t,e)=>`FromService failed for token '${t}': ${e}`,MJX501:()=>"Disposable already disposed.",MJX502:()=>"Cannot register a disposable on itself.",MJX503:()=>"Errors were thrown while disposing a store.",MJX504:()=>"A disposable was added to a DisposableStore that is already disposed; the added object will leak.",MJX505:()=>"Cannot dispose a disposable on itself.",MJX507:(t,e,s)=>`[${t}] potential listener LEAK: ${e} listeners already; most frequent stack (${s}):`,MJX601:()=>"Sequence contains no elements.",MJX602:()=>"Circuit is open.",MJX603:()=>"Bulkhead queue is full.",MJX604:()=>"Rate limit exceeded.",MJX605:()=>"Operation timed out.",MJX607:()=>"A history must be created with at least one entry.",MJX608:()=>"Method not implemented.",MJX609:()=>"OperationRunner: the operation threw.",MJX610:()=>"Matching the request path failed."};class _ extends Error{constructor(t,e,s){super(e,s),this.name="MotifError",this.code=t}}function g(t,...e){return`[motifjs] ${t}: ${m[t](...e)}`}function y(t,...e){return new _(t,g(t,...e))}function v(t,e,...s){h.report(new _(t,g(t,...s),{cause:e}))}function w(t,e,...s){try{const i=t();i&&"function"==typeof i.then&&i.then(void 0,t=>v(e,t,...s))}catch(t){v(e,t,...s)}}function b(s,n,o){!function(s,n,o){if(!e())return;const r={code:s,message:n,details:o};t.warnings.push(r);try{"undefined"!=typeof console&&(void 0===o?console.warn(`[motifjs] ${s}: ${n}`):console.warn(`[motifjs] ${s}: ${n}`,o))}catch{}i()?.("warning",r)}(s,m[s](...n),o)}const S=new class{constructor(){this.disposableTracker=null}notifyCreated(t){return this.disposableTracker?.trackDisposable(t),t}notifyDisposed(t){this.disposableTracker?.markAsDisposed(t)}notifyOwner(t,e){this.disposableTracker?.setParent(t,e)}toDisposable(t){let e=!0;const s={dispose:()=>{e&&(e=!1,this.notifyDisposed(s),t())}};return this.notifyCreated(s)}};class C{constructor(){this._closed=!1,S.notifyCreated(this)}get isDisposed(){return this._closed}add(t){if(!t)return t;if(t===this)throw y("MJX502");return S.notifyOwner(t,this),this._closed?b("MJX504",[],(new Error).stack):void 0!==this._items?this._items.add(t):void 0===this._one?this._one=t:this._one!==t&&(this._items=new Set([this._one,t]),this._one=void 0),t}_take(t){return void 0!==this._items?this._items.delete(t):this._one===t&&(this._one=void 0,!0)}delete(t){if(t){if(t===this)throw y("MJX505");this._take(t),t.dispose()}}detach(t){t&&this._take(t)&&S.notifyOwner(t,null)}clear(){if(void 0===this._one&&(void 0===this._items||0===this._items.size))return;const t=[];let e;for(;;){const s=this._items;if(void 0!==s){for(const i of s)if(i!==e)try{i?.dispose()}catch(e){t.push(e)}s.clear();break}const i=this._one;if(void 0===i||i===e)break;e=i;try{i.dispose()}catch(e){t.push(e)}}if(this._one=void 0,1===t.length)throw t[0];if(t.length>1)throw new _("MJX503",g("MJX503"),{cause:new AggregateError(t)})}dispose(){this._closed||(S.notifyDisposed(this),this._closed=!0,this.clear())}}let M;class k{get _disposables(){let t=this._store;return void 0===t&&(t=this._store=new C,S.notifyOwner(t,this)),t}constructor(){this._store=void 0,S.notifyCreated(this)}dispose(){const t=this._store;null!==t?void 0!==t&&t.isDisposed||(S.notifyDisposed(this),void 0===t?this._store=(void 0===M&&(M=new C,M.dispose()),M):t.dispose()):b("MJX501",[],{disposable:this})}_register(t){if(t===this)throw y("MJX502");return this._disposables.add(t)}}const x={IS_REACTIVE:Symbol.for("motif.isReactive"),IS_READONLY:Symbol.for("motif.isReadonly"),IS_SUPERFICIAL:Symbol.for("motif.isSuperficial"),RAW:Symbol.for("motif.raw"),GET_SETUP:Symbol.for("motif.getSetup")},D=Symbol("");let A=!0,E={enabled:!1,key:""};function O(t){let e=t;for(;e&&e[x.RAW];)e=e[x.RAW];return e}function T(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function N(t){return"object"==typeof t&&null!==t}const P=new Set(Object.values(Object.getOwnPropertyDescriptors(Symbol)).map(t=>t.value).filter(t=>"symbol"==typeof t));function L(t){return"symbol"==typeof t&&P.has(t)}const R=new Map([["[object Object]",1],["[object Array]",1],["[object Map]",2],["[object Set]",2],["[object WeakMap]",2],["[object WeakSet]",2]]);const X=/^(?:0|[1-9]\d*)$/,I=[];let J=0;function j(t){I[J++]=A,A=t}function H(){j(!1)}function F(){A=!(J>0)||I[--J]}const B=[];class z{constructor(t,e,s,i){this.component=t,this.itemsFn=e,this.renderFn=s,this.options=i,this.propertyName="__list__",this._isActive=!1,this._rendered=[],this._identityMap=new WeakMap,this.container=nn("list-container"),this.olditems=[],this.component.controls.add(this.container)}activate(){this._isActive||(this._isActive=!0,this._setupBinding())}deactivate(){this._isActive&&(this._isActive=!1,this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=void 0),this._disposeAll())}reActivate(){this.deactivate(),this.activate()}_disposeAll(){this._rendered.forEach(t=>{try{t.dispose&&t.dispose()}catch{}}),this._rendered=[],this._identityMap=new WeakMap}_toArray(t){return t?Array.isArray(t)?t:"function"==typeof t?this._toArray(t()):t[Symbol.iterator]?Array.from(t):[]:[]}_getComponentKey(t){try{const e=t.props;if(e&&"function"==typeof e.indexkey)return e.indexkey();if(e&&void 0!==e.indexkey&&null!==e.indexkey)return e.indexkey}catch{}try{const e=t.motif.options?.__key;if(void 0!==e)return e}catch{}}isPreCreated(t){return null!==t.element||null!==t.parent}_render(t,e){return At(()=>{const s=this.renderFn(t,e);return this.processRendered(s,t)})}processRendered(t,e){const s=zi(t);if(!(s instanceof ni))throw y("MJX201");try{s._base.itemRef=e}catch{}try{s.motif.options.__fromList=!0}catch{}return function(t){const e=t._flags;if(0!==(e&Ve))return;t._flags=e|Ve|(null!==t.parent&&void 0!==t.parent?$e:0)}(s),s}get _indexSensitive(){try{return this.renderFn.length>=2}catch{return!0}}static _isPrimitive(t){return null===t||"object"!=typeof t}_setupBinding(){const t=()=>{const t=this._toArray(this.itemsFn()),e=O(t),s=t.length;let i;if(e===t)i=t;else{i=new Array(s);for(let n=0;n<s;n++)n in e?i[n]=t[n]:t[n]}const n=this.olditems,o=this._rendered;if(this.olditems.length>0){const t=new Set;for(let e=0;e<s;e++)t.add(O(i[e]));for(const e of this.olditems){const s=O(e);if(!t.has(s)){const t=this._identityMap.get(s);if(t){this._identityMap.delete(s);for(const e of t)try{e.dispose()}catch{}}}}}const r=[],a=new Set,c=new Map,l=new Set,h=new Map,u=t=>!(!t||t.isDisposed||l.has(t)||Vs(t)),d=Math.min(i.length,n.length);for(let t=0;t<d;t++){const e=i[t];if(!z._isPrimitive(e))continue;if(!Object.is(n[t],e))continue;const s=o[t];u(s)&&(h.set(t,s),l.add(s))}let p=null;if(!this._indexSensitive){p=new Map;for(let t=0;t<n.length;t++){const e=n[t];if(!z._isPrimitive(e))continue;const s=o[t];if(!u(s))continue;const i=p.get(e);i?i.push(s):p.set(e,[s])}}const f=new Map;return i.forEach((t,e)=>{let s;if("object"==typeof t&&null!==t){const i=O(t),n=f.get(i)??0;f.set(i,n+1);let o=this._identityMap.get(i);o||(o=[],this._identityMap.set(i,o));const r=o[n];r&&!r.isDisposed?s=r:(s=this._render(t,e),o[n]=s)}else{let i=h.get(e);if(!i&&p){const e=p.get(t);e&&e.length&&(i=e.shift(),l.add(i))}s=i||this._render(t,e)}const i=this._getComponentKey(s);null!=i&&(c.has(i)?b("MJX202",[i,e]):c.set(i,e)),r.push(s),a.add(s)}),f.forEach((t,e)=>{const s=this._identityMap.get(e);s&&s.length>t&&(s.length=t)}),this._rendered.forEach(t=>{if(!a.has(t)&&!Vs(t))try{t.dispose()}catch{}}),this._syncContainer(r),this._rendered=r,this.olditems=i===t?t.slice():i,s};this._effectCleanup=Mt(()=>t())}_syncContainer(t){const e=this.container.controls,s=e.items;if(0===s.length){for(const s of t)try{e.add(s)}catch{}return}if(t.length>=s.length){let i=!0;for(let e=0;e<s.length;e++)if(t[e]!==s[e]){i=!1;break}if(i&&t.length>s.length){const e=new Set(s);for(let n=s.length;n<t.length;n++){if(e.has(t[n])){i=!1;break}e.add(t[n])}}if(i){for(let i=s.length;i<t.length;i++)try{e.add(t[i])}catch{}return}}const i=new Map;s.forEach((t,e)=>i.set(t,e));const n=t.map(t=>{const e=i.get(t);return void 0===e?-1:e}),o=new Set(function(t){const e=new Array(t.length).fill(-1),s=[];for(let i=0;i<t.length;i++){const n=t[i];if(-1===n)continue;if(0===s.length||t[s[s.length-1]]<n){e[i]=s.length>0?s[s.length-1]:-1,s.push(i);continue}let o=0,r=s.length-1;for(;o<r;){const e=o+r>>1;t[s[e]]<n?o=e+1:r=e}n<t[s[o]]&&(e[i]=o>0?s[o-1]:-1,s[o]=i)}const i=[];let n=s.length>0?s[s.length-1]:-1;for(;-1!==n;)i.push(n),n=e[n];return i.reverse()}(n));if(t.length===s.length&&function(t,e,s){const i=new Uint8Array(t.length);for(let n=0;n<t.length;n++){const o=t[n];if(-1===o||i[o])return!1;i[o]=1;const r=e[n];if(r.isDisposed||r.parent!==s)return!1}return!0}(n,t,this.container))return void e._reorder(t,o);let r=null;for(let i=t.length-1;i>=0;i--){const a=t[i];try{if(-1===n[i])if(r){const t=s.indexOf(r);e.add(t>=0?t:s.length,a)}else e.add(a);else o.has(i)||e.move(a,r)}catch{}r=a}}}class W{}class V{constructor(){this.__list=[],this._map=new Set}Dispose(){this.__list=[]}Add(t){this._map.add(t);var e=this.__list.push(t)-1;return null!=this.ItemAdded&&this.ItemAdded(t),e}AddBefore(t){this._map.add(t);var e=this.__list.unshift(t)-1;return null!=this.ItemAddedBefore&&this.ItemAddedBefore(t),e}Insert(t,e){this._map.add(e);var s=this.__list.splice(t,0,e);return null!=this.ItemSplice&&this.ItemSplice(t,e),s}get items(){return this.__list}clear(){return this._map.clear(),this.__list.splice(0),this.__list=[],this.__list}get count(){return this.__list.length}remove(t){const e=this.__list.indexOf(t);return-1===e?[]:(this._map.delete(t),this.__list.splice(e,1))}indexOf(t){return this.__list.indexOf(t)}FindFromKey(t,e){return this.__list.filter(s=>s[t]===e)}removeIndex(t){var e=this.__list.splice(t,1);return e.forEach(t=>{this._map.delete(t)}),e}has(t){return this._map.has(t)}item(t){return this.__list[t]}forEach(t){this.__list?.forEach(t)}ReverseClone(){return this.__list.slice().reverse()}filter(t){return this.__list.filter(t)}}function $(t){let e=!0;return{dispose(){e&&(e=!1,t())}}}function U(t){return"/"+t.replace(/^\/+|\/+$/g,"")}function q(t){try{if(t.isDisposed)return null;if(t.element.nodeType!==Node.COMMENT_NODE&&t.element.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&t.element.nodeType!==Node.TEXT_NODE)return t;if(t.parent)return q(t.parent)}catch(t){throw t}return null}class G{constructor(t,e){this.threshold=t,this.name=e,this._origins=new Map,this._quietChecks=0}check(t){if(this.threshold<=0||t<this.threshold)return;const e=(new Error).stack??"";if(this._origins.set(e,(this._origins.get(e)??0)+1),this._quietChecks--,this._quietChecks<=0){this._quietChecks=this.threshold/2;const[e,s]=this._busiestOrigin();b("MJX507",[this.name,t,s],e)}return()=>{this._origins.set(e,(this._origins.get(e)??0)-1)}}_busiestOrigin(){let t=["",0];for(const e of this._origins)e[1]>t[1]&&(t=e);return t}}class K{constructor(){this.__values=new V}Add(t,e){var s=new W;s.Key=t,s.value=e;var i=this.__values.Add(s);return null!=this.OnItemAdded&&this.OnItemAdded(s.Key,s.value),i}has(t){return!!this.filter(e=>e.Key==t)[0]}item(t){return this.filter(e=>e.Key==t)[0]}removeIndex(t){return this.__values.removeIndex(t)}remove(t){this.__values.filter(e=>e.Key==t).forEach(t=>{this.__values.remove(t)})}clear(){this.__values.clear()}forEach(t){this.__values.forEach(t)}get values(){return this.__values}filter(t){return this.__values.items.filter(t)}find(t,e){return this.__values.items.find(t)}}function Y(){const t={value:void 0,linked:!1};return t.before=t,t.after=t,t}class Q{constructor(){this._ring=Y(),this._count=0}get size(){return this._count}isEmpty(){return 0===this._count}push(t){return this._link(t,this._ring.before)}unshift(t){return this._link(t,this._ring)}pop(){return this._take(this._ring.before)}shift(){return this._take(this._ring.after)}clear(){for(let t=this._ring.after;t!==this._ring;t=t.after)t.linked=!1;this._ring=Y(),this._count=0}*[Symbol.iterator](){const t=this._ring;for(let e=t.after;e!==t;e=e.after)yield e.value}_link(t,e){const s={value:t,before:e,after:e.after,linked:!0};return e.after.before=s,e.after=s,this._count++,()=>this._unlink(s)}_take(t){if(t===this._ring)return;const e=t.value;return this._unlink(t),e}_unlink(t){t.linked&&(t.linked=!1,t.before.after=t.after,t.after.before=t.before,this._count--)}}function Z(t){return"function"==typeof t?t:()=>t}function tt(t){return"function"==typeof t?t():t}function et(t,e){return t>e?1:t<e?-1:0}class st{constructor(t){this.source=Array.isArray(t)?t:Array.from(t)}static from(t){return new st(t)}where(t){return new st(this.source.filter(t))}select(t){return new st(this.source.map(t))}orderBy(t){return new st([...this.source].sort((e,s)=>et(t(e),t(s))))}orderByDescending(t){return new st([...this.source].sort((e,s)=>et(t(s),t(e))))}distinctBy(t){const e=new Set;return new st(this.source.filter(s=>{const i=t(s);return!e.has(i)&&(e.add(i),!0)}))}groupBy(t){const e=new Map;for(const s of this.source){const i=t(s),n=e.get(i);n?n.push(s):e.set(i,[s])}return new st(Array.from(e,([t,e])=>({key:t,items:e})))}first(){if(0===this.source.length)throw y("MJX601");return this.source[0]}firstOrDefault(){return this.source[0]}any(t){return t?this.source.some(t):this.source.length>0}all(t){return this.source.every(t)}aggregate(t,e){return this.source.reduce(e,t)}toArray(){return[...this.source]}[Symbol.iterator](){return this.source[Symbol.iterator]()}}const it=[1,2],nt=new Set,ot=new Set;function rt(t){it.includes(t)||nt.has(t)||(e()?(ot.delete(t),nt.add(t),b("MJX121",[t,1])):ot.add(t))}var at;function ct(t,e){if(0===t.length)return t.length=1,void(t[0]=e);t.push(e)}!function(t){t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",t[t.ENTITY_NODE=6]="ENTITY_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE",t[t.NOTATION_NODE=12]="NOTATION_NODE"}(at||(at={}));class lt{constructor(t,e){this.fn=t,this.callback=e,this.deps=[],this.active=!0,this.running=!1}run(){let t;if(this.active&&!this.running){Ct(this),ut.push(this),this.running=!0;try{t=this.fn()}finally{ut.pop(),this.running=!1,this.callback&&this.callback(t)}}}stop(){this.active=!1,Ct(this)}}const ht=new WeakMap,ut=[],dt=new Set;let pt,ft=!1,mt=!1,_t=-1;const gt=new WeakMap;function yt(t={}){mt=!!t.enabled,_t="number"==typeof t.threshold?t.threshold:mt?200:-1,pt=mt&&_t>0?new G(_t,t.name??"reactivity-core"):void 0}function vt(t,e){if(!A)return;const s=O(t),i=ut[ut.length-1];if(!i||!i.active)return;let n=ht.get(s);n||ht.set(s,n=new Map);let o=n.get(e);if(o||n.set(e,o=new Set),!o.has(i)&&(o.add(i),ct(i.deps,[s,e]),mt&&pt&&_t>0))try{const t=pt.check(o.size);if(t){let e=gt.get(o);e||(e=new Map,gt.set(o,e)),e.set(i,t)}}catch{}}function wt(t,e){const s=O(t),i=ht.get(s);if(!i)return;const n=i.get(e);if(!n)return;let o=!1;n.forEach(t=>{t.active&&(t.scheduler?bt(t.scheduler):(dt.add(t),o=!0))}),o&&function(){if(ft)return;ft=!0,Promise.resolve().then(()=>{const t=new Map;try{for(;dt.size>0;){const e=Array.from(dt);dt.clear();for(const s of e){const e=(t.get(s)??0)+1;t.set(s,e),e>St?e===St+1&&b("MJX203",[St],{fn:String(s.fn).slice(0,200)}):bt(()=>s.run())}}}finally{dt.clear(),ft=!1}})}()}function bt(t){try{t()}catch(t){v("MJX208",t)}}const St=50;function Ct(t){for(const[e,s]of t.deps){const i=ht.get(e);if(!i)continue;const n=i.get(s);if(n){n.delete(t);try{const e=gt.get(n),s=e?.get(t);if(s){try{s()}catch{}e.delete(t)}}catch{}0===n.size&&i.delete(s),0===i.size&&ht.delete(e)}}t.deps=[]}function Mt(t,e){const s=new lt(t,e);return bt(()=>s.run()),()=>s.stop()}function kt(t){if(!t.pushed)return;t.pushed=!1;const e=ut.lastIndexOf(t.effect);e>=0&&ut.splice(e,1)}const xt={capture:()=>({effect:ut[ut.length-1],pushed:!1}),suspend:(t,e)=>(kt(t),e),resume:(t,e)=>(t.effect&&t.effect.active&&!t.pushed&&(ut.push(t.effect),t.pushed=!0),e),end(t){kt(t)}},Dt=new lt(()=>{});function At(t){ut.push(Dt);try{return t()}finally{ut.pop()}}function Et(t){if(!t||"INPUT"!==t.tagName)return!1;const e=String(t.type||"").toLowerCase();return"checkbox"===e||"radio"===e}function Ot(t){if(t){if(Et(t))return!!t.checked;if(function(t){if(!t||"INPUT"!==t.tagName)return!1;const e=String(t.type||"").toLowerCase();return"number"===e||"range"===e}(t)){const e=t.value;if(""===e||null==e)return null;const s="number"==typeof t.valueAsNumber?t.valueAsNumber:Number(e);return Number.isFinite(s)?s:null}return t.value}}Dt.active=!1;class Tt{constructor(t,e,s,i,n,o){this.updateMode="onPropertyChanged",this._isActive=!1,this._memberPath=null,this._component=t,this.propertyName=e,this.dataSource=s,this.dataMember=i,this.formatString=n,this.formatInfo=o,this._memberPath=i?i.split("."):null,this._memberPathSource=i}activate(){this._isActive||(this._isActive=!0,this._setupBinding())}deactivate(){this._isActive&&(this._isActive=!1,this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=void 0))}reActivate(){this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=void 0),this._setupBinding()}functional(t){return"function"==typeof t&&(t=this.functional(t())),t}_setupBinding(){const t=()=>{let t=this.dataSource;if(this.dataMember){this._memberPathSource!==this.dataMember&&(this._memberPath=this.dataMember.split("."),this._memberPathSource=this.dataMember);for(const e of this._memberPath)null!=t&&(t=t[e])}return t=this.functional(t),this.formatString&&null!=t&&(t=this._applyFormat(t,this.formatString)),this.converter&&(t=this.converter(t)),t},e=()=>{const e=t();return this._updateComponentProperty(e),e};this._effectCleanup=Mt(()=>e())}_updateComponentProperty(t){switch(this.propertyName.toLowerCase()){case"wait":{const e=this._component;if(!e||e.isDisposed)return;const s=!!t;e.isBuilt?e.isWait=!!s:e.isWait=s;break}case"display":{const e=this._component;if(!e||e.isDisposed)return;const s=t;e.isBuilt,e.isWait=!s;break}case"text":case"textcontent":this._component.setText(t);break;case"innerhtml":case"html":this._component.element.innerHTML=t,this._component.motif.trigger("htmlChanged",{value:t});break;case"visible":case"visibility":t?this._component.motif.show():this._component.motif.hide();break;case"style":"object"==typeof t&&this._component.style(t);break;case"model":{const e=this._component.element;if(!e)break;Et(e)?e.checked=!!t:e.value=null==t?"":t;break}case"when":break;default:this._component.element&&this.propertyName in this._component.element?this._component.element[this.propertyName]=t:this.propertyName in this._component&&(this._component[this.propertyName]=t)}}_applyFormat(t,e){const s=this.formatInfo?.locale,i=this.formatInfo?.currency;if("number"==typeof t){if(e.includes("C")||e.includes("c"))return i?new Intl.NumberFormat(s,{style:"currency",currency:i}).format(t):new Intl.NumberFormat(s,{minimumFractionDigits:2,maximumFractionDigits:2}).format(t);if(e.includes("P")||e.includes("p"))return new Intl.NumberFormat(s,{style:"percent"}).format(t);if(e.includes("N")||e.includes("n")){const i=parseInt(e.match(/\d+/)?.[0]||"2");return new Intl.NumberFormat(s,{minimumFractionDigits:i,maximumFractionDigits:i}).format(t)}}if(t instanceof Date){if(e.includes("d"))return t.toLocaleDateString(s);if(e.includes("t"))return t.toLocaleTimeString(s)}return t?.toString()||""}}class Nt{constructor(t){this._fn=t}dispose(){const t=this._fn;if(void 0!==t){this._fn=void 0;try{t()}catch{}}}}class Pt{constructor(t){this._fn=t,S.notifyCreated(this)}dispose(){const t=this._fn;void 0!==t&&(this._fn=void 0,S.notifyDisposed(this),t())}}const Lt=S.toDisposable;function Rt(t){return new Nt(t)}function Xt(t){return S.toDisposable===Lt?new Pt(t):S.toDisposable(t)}const It=x.RAW;function Jt(t,e,s){let i=Object.getPrototypeOf(t);for(;i&&i!==e;){if(Object.prototype.hasOwnProperty.call(i,s))return!0;i=Object.getPrototypeOf(i)}return!1}function jt(t,e){for(const s of e){let e=t[s];"function"==typeof e&&Object.defineProperty(t,s,{configurable:!0,enumerable:!1,get(){if(this===t||(i=this,Object.prototype.hasOwnProperty.call(i,"constructor")&&"function"==typeof i.constructor&&i.constructor.prototype===i))return e;var i;const n=this[It]??this,o=e.bind(n);if(!Jt(n,t,s))try{Object.defineProperty(n,s,{value:o,writable:!0,configurable:!0,enumerable:!0})}catch{}return o},set(i){this!==t||"function"!=typeof i?Object.defineProperty(this,s,{value:i,writable:!0,configurable:!0,enumerable:!0}):e=i}})}}function Ht(t){return"function"==typeof t?Ht(t()):t}function Ft(t,e){return"__proto__"!==e&&("constructor"!==e&&"prototype"!==e||Object.prototype.hasOwnProperty.call(t,e))}class Bt{constructor(t){this._items=[],this._branchScope=null,this._component=t}_own(t){this._branchScope?this._branchScope.push(t):this._component.motif.register(Rt(t))}when(t,e){var s=new kn;this._component.controls.add(s);let i,n=!1;const o=Mt(t,t=>{n&&(Object.is(i,t)||!i&&!t)||(n=!0,i=t,At(()=>{t?s.navigate(e(t)):s.navigate(nn())}))});return this._own(o),null}get items(){return[...this._items]}text(t){this.add("textContent",t)}value(t){this.add("value",t)}add(...t){let e;if(1===t.length&&"object"==typeof t[0]&&"propertyName"in t[0])e=t[0];else{const[s,i,n,o,r]=t;e=new Tt(this._component,s,i,n,o,r)}return ct(this._items,e),this._component.isBuilt&&e.activate(),e}wait(t){const e=new Tt(this._component,"isWait",t);return ct(this._items,e),this._component.isBuilt&&e.activate(),e}display(t){const e=new Tt(this._component,"isWait",()=>!Ht(t()));return ct(this._items,e),this._component.isBuilt&&e.activate(),e}html(t){const e=new Tt(this._component,"innerHTML",t);return ct(this._items,e),this._component.isBuilt&&e.activate(),e}list(t,e,s){const i=new z(this._component,t,e,s);return ct(this._items,i),this._component.isBuilt&&i.activate(),i}loop(t,e,s){const i=new z(this._component,t,e,s);return ct(this._items,i),this._component.isBuilt&&i.activate(),i}method(t){const e=this._component;let s=null,i=null;const n=(t,s)=>{s?(e.controls.insert(e.controls.items.indexOf(s),t),e.controls.remove(s)):e.controls.add(t)},o=Mt(t,t=>{if(e.isDisposed)return;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"bigint"==typeof t||s&&null==t)return s?void s.setText(t):(s=new Vi(ln.createTextNode(t)),n(s,i),void(i=null));i||(i=new kn,n(i,s),s=null),i.navigate(null==t?nn():t)});e.motif.register(Rt(o))}ternary(t,e,s){const i=new kn;return this._component.controls.add(i),this._ternaryCallTop(t,()=>{e(i)},()=>{s(i)}),null}_ternarySchedule(t,e,s,i){let n,o=!0,r=!1,a=[];const c=()=>{const t=a;a=[];for(const e of t)try{e()}catch{}},l=Mt(t,t=>{if(!o&&Object.is(n,t))return;n=t;const l=()=>{c();const i=this._branchScope;this._branchScope=a;try{t?e():s()}finally{this._branchScope=i}};if(o)return o=!1,void At(l);i(()=>{r||this._component.isDisposed||l()})});this._own(()=>{r=!0,l(),c()})}ternaryCall(t,e,s){this._ternarySchedule(t,e,s,t=>queueMicrotask(t))}_ternaryCallTop(t,e,s){this._ternarySchedule(t,e,s,t=>setTimeout(t,0))}watch(t){const e=Mt(()=>{t()});this._component.motif.register(Rt(e))}remove(t){const e=this._items.indexOf(t);e>-1&&(this._items.splice(e,1),t.deactivate())}clear(){this._items.forEach(t=>t.deactivate()),this._items=[]}activateAll(){this._items.forEach(t=>{t.activate()})}model(...t){var e="";this._component.element&&(e=this._component.element.tagName);var s="value";switch(e.toLowerCase()){case"input":s="model";break;case"select":case"textarea":s="value";break;case"img":case"audio":case"video":s="src"}let i;if(1===t.length&&"object"==typeof t[0])i=t[0];else if("function"==typeof t[0]&&"function"==typeof t[1])i=new Tt(this._component,s,t[0]),i.setter=t[1];else{const[e,n,o,r]=t;i=new Tt(this._component,s,e,n,o,r)}const n=t=>{let e=t;const s=i;if("function"==typeof s.converterBack&&(e=s.converterBack(e)),"function"==typeof s.setter)return void s.setter(e);const n=s.dataMember,o=s.dataSource;if(n&&null!=o){const t=n.split(".");let s=o;for(let i=0;i<t.length&&null!=s;i++){const n=t[i];if(!Ft(s,n))return;i===t.length-1?s[n]=e:s=s[n]}}else null!=o&&"object"==typeof o&&"value"in o&&(o.value=e)};(this._modelWriters??=new WeakMap).set(i,n);const o=e.toLowerCase();if("input"===o||"select"===o||"textarea"===o){const t=()=>{try{const t=this._component.element;if(!t)return;n(Ot(t))}catch{}};this._component.motif.on("input",t),this._component.motif.on("change",t)}return ct(this._items,i),this._component.isBuilt&&i.activate(),i}writeModel(t){const e=this._modelWriters;if(!e)return!1;let s=!1;for(const i of this._items){const n=e.get(i);if(n)try{n(t),s=!0}catch{}}return s}deactivateAll(){this._items.forEach(t=>t.deactivate()),this._items=[]}reActivateAll(){for(const t of[...this._items])if("function"==typeof t.reActivate)try{t.reActivate()}catch(t){v("MJX208",t)}}switchCase(t,e,s){const i=new kn;var n;this._component.controls.add(i);var o=!1;const r=Mt(t,t=>{if(n==t)return;n=t;const r=String(t);if(Object.prototype.hasOwnProperty.call(e,r))e[r](i),o=!1;else if(s){if(o)return;o=!0,s(i)}else{if(o)return;o=!0,i.navigate(nn())}});return this._component.motif.register(Rt(r)),null}}jt(Bt.prototype,["add","remove","clear","activateAll","deactivateAll","reActivateAll","when","text","value","list","loop","method","watch","display","wait","ternaryCall","_ternaryCallTop"]);class zt{constructor(){this._subscriptions=[],this._disposed=!1}get event(){return this._subscribe||(this._subscribe=(t,e,s)=>{if(this._disposed)return{dispose(){}};const i={handler:e?t.bind(e):t,active:!0};this._writable().push(i);const n={dispose:()=>this._unsubscribe(i)};return s instanceof C?s.add(n):Array.isArray(s)&&s.push(n),n}),this._subscribe}fire(t){this._resume(),0!==this._subscriptions.length&&(this._delivery={targets:this._subscriptions,value:t,next:0},this._resume())}dispose(){if(!this._disposed){this._disposed=!0;for(const t of this._subscriptions)t.active=!1;this._subscriptions=[],this._delivery=void 0}}_writable(){return this._delivery&&this._delivery.targets===this._subscriptions&&(this._subscriptions=this._subscriptions.slice()),this._subscriptions}_unsubscribe(t){if(!t.active)return;t.active=!1;const e=this._writable(),s=e.indexOf(t);-1!==s&&e.splice(s,1)}_resume(){const t=this._delivery;if(t){for(;t.next<t.targets.length;){const e=t.targets[t.next++];if(e.active)try{e.handler(t.value)}catch(t){h.onUnexpectedError(t)}}this._delivery===t&&(this._delivery=void 0)}}}class Wt{constructor(t){this.component=t}hasListeners(t){return void 0!==this._emitters&&this._emitters.has(t)}fire(t,e){try{const s=this._emitters?.get(t.toLowerCase());s&&s.fire(e)}catch{}}on(t,e){try{this.createEvent(t,e)}catch{}}off(t,e){const s=String(t).toLowerCase(),i=this._listenerDisposables?.get(s);if(!i)return this;const n=i.get(e);return i.delete(e),n?.forEach(t=>{try{t.dispose()}catch{}}),this}getOrCreateEmitter(t){const e=this._emitters??=new Map;let s=e.get(t);return s||(s=new zt,e.set(t,s)),s}createEvent(t,e){const s=String(t).toLowerCase(),i=s.startsWith("on")?"x:"+s.slice(2):s,n=t=>{let s;return w(()=>(s=e.length<=1?e(t):e(this.component,t),s),"MJX122",i),s},o=this.getOrCreateEmitter(s).event(t=>n(t)),r=this._listenerDisposables??=new Map;let a=r.get(s);a||(a=new Map,r.set(s,a));const c=a.get(e);return c?c.push(o):a.set(e,[o]),this}addSource(t,e){const s=String(t).toLowerCase(),i=this.getOrCreateEmitter(s),n=t=>t(t=>i.fire(t));let o;try{o=n(e instanceof zt?e.event:e)}catch{}if(o){const t=this._sourceDisposables??=new Map;let e=t.get(s);e||(e=new Set,t.set(s,e)),e.add(o),this.component.motif.register(Xt(()=>{try{o?.dispose()}catch{}try{e?.delete(o)}catch{}}))}return this}clear(t){if(t){const e=t.toLowerCase(),s=this._sourceDisposables?.get(e);s?.forEach(t=>{try{t.dispose()}catch{}}),this._sourceDisposables?.delete(e);const i=this._emitters?.get(e);try{i?.dispose()}catch{}this._emitters?.delete(e),this._listenerDisposables?.delete(e)}else if(this._emitters)for(const t of Array.from(this._emitters.keys()))this.clear(t);return this}}jt(Wt.prototype,["fire","on","off","createEvent","getOrCreateEmitter","addSource","clear"]);const Vt=new Set(["focus","blur","click","pause","submit","reset","scrollTo","scrollBy","select","scrollIntoView","requestFullscreen","exitFullscreen","requestPointerLock","exitPointerLock","play","requestPictureInPicture","exitPictureInPicture","show","showModal","close","showPopover","hidePopover","togglePopover","requestSubmit","checkValidity","reportValidity","showPicker","load","setSelectionRange","setRangeText","setPointerCapture","releasePointerCapture","fastSeek"]),$t={show:"close",showModal:"close",showPopover:"hidePopover"},Ut=new Set(["close","hidePopover","requestSubmit","checkValidity","reportValidity","showPicker","load"]),qt=new Set(["setSelectionRange","setRangeText","setPointerCapture","releasePointerCapture","fastSeek"]),Gt=new Set(["checked","selected","muted","indeterminate","srcObject"]);class Kt{constructor(t){this._parent=t}get _attrMap(){return this._attrMapStore??=new Map}get _watchers(){return this._watchersStore??=new Map}get attributes(){return Array.from(this._attrMap.entries(),([t,e])=>({name:String(t),value:e}))}add(t){if(null!==t&&"object"==typeof t&&!Array.isArray(t)){const e=t;Reflect.ownKeys(e).forEach(t=>{this.parse(e[t],t)})}return this._parent}remove(t){const e=this._watchers.get(t);if(e){try{e.stop()}catch{}try{e.binding&&this._parent.bindings.remove(e.binding)}catch{}this._watchers.delete(t)}this._attrMap.delete(t);const s=this._getElement();if(s)try{s.removeAttribute(t)}catch{}return this._parent}has(t){return(this._parent.element instanceof HTMLElement||this._parent.element instanceof Element)&&this._parent.element.hasAttribute(t)}get(t){const e=this._getElement();if(e){const s=e.getAttribute(t);if(null!=s)return s}const s=this._attrMap.get(t);return null==s?null:String(s)}parse(t,e){if("function"==typeof t){const s=this._watchers.get(e);if(s){try{s.stop()}catch{}try{s.binding&&this._parent.bindings.remove(s.binding)}catch{}this._watchers.delete(e)}const i=()=>Mt(()=>{const s=t();this._applyValue(e,s)});let n=i();const o=()=>{try{n()}catch{}},r={propertyName:`__attr:${String(e)}`,dataSource:null,activate(){},deactivate(){o()},reActivate(){o(),n=i()}};try{this._parent.bindings.add(r)}catch{}this._watchers.set(e,{stop:o,binding:r})}else this._applyValue(e,t)}_applyValue(t,e){if(!t)return;const s=this._getElement();try{"function"==typeof e&&"function"==typeof(e=e())&&(e=e())}catch{}if(s&&"string"==typeof t&&Vt.has(t)){const i=t,n=s[i];if("function"==typeof n){const o=(t,e)=>{try{Array.isArray(e)?t.apply(s,e):void 0===e?t.call(s):t.call(s,e)}catch{}},r=t=>{try{queueMicrotask(t)}catch{try{setTimeout(t,0)}catch{}}},a=()=>{this._attrMap.set(t,e)};if("focus"===i){return r(()=>{if(!1===e){const t=s.blur;"function"==typeof t&&o(t)}else!0===e?o(n):("object"==typeof e&&null!=e&&!0!==e||Array.isArray(e),o(n,e))}),void a()}if("blur"===i||"click"===i||"pause"===i||"submit"===i||"reset"===i){return r(()=>{e&&o(n)}),void a()}if("scrollTo"===i||"scrollBy"===i){return r(()=>{(Array.isArray(e)||e&&"object"==typeof e)&&o(n,e)}),void a()}if("select"===i){return r(()=>{if(e)o(n);else{const t=s;if("function"==typeof t.setSelectionRange)try{t.setSelectionRange(0,0)}catch{}}}),void a()}if("scrollIntoView"===i){return r(()=>{!0===e||null==e?o(n):o(n,e)}),void a()}if("requestFullscreen"===i){return r(()=>{if(e)o(n);else try{const t=document;t&&t.fullscreenElement===s&&"function"==typeof t.exitFullscreen&&t.exitFullscreen()}catch{}}),void a()}if("exitFullscreen"===i){return r(()=>{if(e)try{const t=document;t&&"function"==typeof t.exitFullscreen&&t.exitFullscreen()}catch{}}),void a()}if("requestPointerLock"===i){return r(()=>{if(e)o(n);else try{const t=document;t&&"function"==typeof t.exitPointerLock&&t.exitPointerLock()}catch{}}),void a()}if("exitPointerLock"===i){return r(()=>{if(e)try{const t=document;t&&"function"==typeof t.exitPointerLock&&t.exitPointerLock()}catch{}}),void a()}if("play"===i){return r(()=>{if(e)try{const t=n.call(s);t&&"function"==typeof t.then&&t.catch(()=>{})}catch{}else{const t=s.pause;"function"==typeof t&&o(t)}}),void a()}if("requestPictureInPicture"===i){return r(()=>{if(e)try{const t=n.call(s);t&&"function"==typeof t.then&&t.catch(()=>{})}catch{}}),void a()}if("exitPictureInPicture"===i){return r(()=>{if(e)try{const t=document;if(t&&"function"==typeof t.exitPictureInPicture){const e=t.exitPictureInPicture();e&&"function"==typeof e.then&&e.catch(()=>{})}}catch{}}),void a()}if(i in $t){return r(()=>{if(!1===e){const t=s[$t[i]];"function"==typeof t&&o(t)}else e&&o(n)}),void a()}if("togglePopover"===i){return r(()=>{if("boolean"==typeof e)try{n.call(s,e)}catch{}else e&&o(n)}),void a()}if(Ut.has(i)){return r(()=>{!0===e?o(n):e&&o(n,e)}),void a()}if(qt.has(i)){return r(()=>{null!=e&&!1!==e&&o(n,e)}),void a()}return null==e||!1===e?void this._attrMap.delete(t):void a()}}if("string"==typeof t&&Gt.has(t)){const i=this._parent.element??s;if(i)try{"srcObject"===t?i.srcObject=e??null:i[t]=!!e}catch{}return void(null==e||!1===e?this._attrMap.delete(t):this._attrMap.set(t,e))}if("boolean"==typeof e&&"string"==typeof t&&(t.startsWith("aria-")||t.startsWith("data-"))){if(s)try{s.setAttribute(t,String(e))}catch{}return void this._attrMap.set(t,e)}const i="boolean"==typeof e;if(null==e||!1===e){if(s)try{s.removeAttribute(String(t))}catch{}this._attrMap.delete(t)}else{if("value"===t)try{const t=this._parent.element,s=String(e);t.value!==s&&(t.value=s)}catch{}else if("textContent"===t||"innerText"===t||"innerHTML"===t){if(gi(e))return void this._parent.setText(e);try{this._parent.element[t]=e}catch{}}else if(s)try{i&&!0===e?s.setAttribute(String(t),""):s.setAttribute(String(t),e)}catch{}this._attrMap.set(t,e)}}_getElement(){const t=this._parent?.element;return t instanceof HTMLElement||t instanceof Element?t:null}hasMethodState(t){return!(!this._getElement()||!t)&&!!this.getMethodState(t)}getMethodState(t){const e=this._getElement();if(!e||!t)return!1;switch(String(t)){case"focus":case"blur":try{return(document&&document.activeElement)===e}catch{return!1}case"select":{const t=e;if("number"==typeof t.selectionStart&&"number"==typeof t.selectionEnd)try{return t.selectionEnd-t.selectionStart>0}catch{return!1}return!1}default:return!1}}}class Yt{constructor(t){this._watcherSeq=0,this._parent=t}get _counts(){return void 0!==this._plain&&this._promote(),this._countsStore??this._createCounts()}_createCounts(){const t=this._countsStore=new Map;if(void 0!==this._sole){const e=this._watcherOne;if(this._sole=void 0,void 0!==e)for(const s of e.set)t.set(s,(t.get(s)||0)+1)}return t}get _staticSet(){return void 0!==this._plain&&this._promote(),this._staticSetStore??=new Set}_promote(){const t=this._plain.split(" ");this._plain=void 0;const e=this._staticSetStore??=new Set,s=this._countsStore??this._createCounts();for(const i of t)e.add(i),s.set(i,(s.get(i)||0)+1)}_watcherEntries(){if(void 0!==this._watchersStore)return Array.from(this._watchersStore.entries());const t=this._watcherOne;return void 0!==t?[[t.id,t]]:[]}_dropWatcher(t){void 0!==this._watchersStore?this._watchersStore.delete(t):void 0!==this._watcherOne&&this._watcherOne.id===t&&(this._watcherOne=void 0)}_keepWatcher(t){if(void 0!==this._watchersStore)return void this._watchersStore.set(t.id,t);const e=this._watcherOne;void 0!==e?(this._watcherOne=void 0,this._watchersStore=new Map([[e.id,e],[t.id,t]])):this._watcherOne=t}add(...t){for(const e of t)"function"==typeof e?this._addReactive(e):Array.isArray(e)?this._addStaticFromArray(e):e&&"object"==typeof e?this._addStaticFromObject(e):"string"!=typeof e||""===e||/\s/.test(e)?this._addStaticNames(this._splitClasses(String(e??""))):this._addStaticName(e);return this._parent}_addStaticName(t){if(void 0!==this._countsStore||void 0!==this._staticSetStore||void 0!==this._sole)return void this._addStaticNames([t]);const e=this._plain;if(void 0!==e&&function(t,e){let s=t.indexOf(e);for(;-1!==s;){const i=s+e.length;if(!(0!==s&&32!==t.charCodeAt(s-1)||i!==t.length&&32!==t.charCodeAt(i)))return!0;s=t.indexOf(e,s+1)}return!1}(e,t))return;this._plain=void 0===e?t:e+" "+t;const s=this._getElement();if(s)if(s.hasAttribute("class"))try{s.classList.add(t)}catch{}else s.setAttribute("class",t)}remove(t){const e=this._getElement();if(Array.isArray(t)){const s=new Set(this._staticSet);for(const e of t)for(const t of this._splitClasses(String(e)))this._staticSet.delete(t);this._applySourceDiff("static",s,new Set(this._staticSet),e)}else if("**"===t){for(const[t,s]of this._watcherEntries()){const i=new Set(s.set);this._applySourceDiff(t,i,new Set,e);try{s.binding&&this._parent.bindings.remove(s.binding)}catch{}try{s.stop()}catch{}this._dropWatcher(t)}const t=new Set(this._staticSet);if(this._staticSet.clear(),this._applySourceDiff("static",t,new Set,e),e)try{e.removeAttribute("class")}catch{}this._counts.clear()}else{const s=new Set(this._staticSet);for(const e of this._splitClasses(String(t)))this._staticSet.delete(e);this._applySourceDiff("static",s,new Set(this._staticSet),e)}return this._parent}has(t){const e=this._getElement(),s=String(t??"").trim();return!!s&&!(!e||!e.classList.contains(s))}_getElement(){const t=this._parent?.element;return t instanceof Element?t:null}_splitClasses(t){return t?/\s/.test(t)?t.split(/\s+/).filter(t=>t.length>0):[t]:[]}_normalizeToSet(t){const e=new Set;if(null==t)return e;if("string"==typeof t)for(const s of this._splitClasses(t))e.add(s);else if(Array.isArray(t)){for(const s of t)if(null!=s)if("string"==typeof s)for(const t of this._splitClasses(s))e.add(t);else if(Array.isArray(s))for(const t of this._normalizeToSet(s))e.add(t);else if("object"==typeof s){const t=s;for(const s of Object.keys(t)){if(t[s])for(const t of this._splitClasses(String(s)))e.add(t)}}else if("boolean"!=typeof s)for(const t of this._splitClasses(String(s)))e.add(t)}else if("object"==typeof t){const s=t;for(const t of Object.keys(s)){if(s[t])for(const s of this._splitClasses(String(t)))e.add(s)}}else if("boolean"!=typeof t)for(const s of this._splitClasses(String(t)))e.add(s);return e}_applySourceDiff(t,e,s,i){if(void 0!==this._countsStore||void 0!==this._plain||this._sole!==t){for(const t of e)if(!s.has(t)){const e=(this._counts.get(t)||0)-1;if(e<=0){if(this._counts.delete(t),i)try{i.classList.remove(t)}catch{}}else this._counts.set(t,e)}for(const t of s)if(!e.has(t)){const e=this._counts.get(t)||0,s=e+1;if(this._counts.set(t,s),0===e&&i)try{i.classList.add(t)}catch{}}}else{for(const t of e)if(!s.has(t)&&i)try{i.classList.remove(t)}catch{}for(const t of s)if(!e.has(t)&&i)try{i.classList.add(t)}catch{}}}_addStaticNames(t){if(0===t.length)return;const e=this._getElement(),s=this._staticSet,i=e&&!e.hasAttribute("class")?[]:null;for(const n of t){if(s.has(n))continue;s.add(n);const t=this._counts.get(n)||0;if(this._counts.set(n,t+1),0===t&&e)if(i)i.push(n);else try{e.classList.add(n)}catch{}}i&&i.length>0&&e.setAttribute("class",i.join(" "))}_addStaticFromArray(t){const e=this._getElement(),s=new Set(this._staticSet);for(const e of t)if(null!=e)if("string"==typeof e)for(const t of this._splitClasses(e))this._staticSet.add(t);else if(Array.isArray(e)){const t=this._normalizeToSet(e);for(const e of t)this._staticSet.add(e)}else if("object"==typeof e){const t=e;for(const e of Object.keys(t)){const s=t[e];if("function"==typeof s){const s=this._splitClasses(String(e));for(const i of s)this._addReactive(t[e],i)}else{const t=this._splitClasses(String(e));if(s)for(const e of t)this._staticSet.add(e);else for(const e of t)this._staticSet.delete(e)}}}else{if("boolean"==typeof e)continue;if("function"==typeof e)this._addReactive(e);else for(const t of this._splitClasses(String(e)))this._staticSet.add(t)}this._applySourceDiff("static",s,new Set(this._staticSet),e)}_addStaticFromObject(t){const e=this._getElement(),s=new Set(this._staticSet);for(const e of Object.keys(t)){const s=t[e],i=this._splitClasses(String(e));if("function"==typeof s)for(const t of i)this._addReactive(s,t);else if(s)for(const t of i)this._staticSet.add(t);else for(const t of i)this._staticSet.delete(t)}this._applySourceDiff("static",s,new Set(this._staticSet),e)}_addReactive(t,e){const s="fx#"+ ++this._watcherSeq,i={id:s,stop:()=>{},binding:void 0,set:new Set},n=this._getElement();void 0===this._countsStore&&void 0===this._staticSetStore&&void 0===this._plain&&void 0===this._sole&&void 0===this._watcherOne&&void 0===this._watchersStore&&(this._sole=s);const o=()=>Mt(()=>{let o;try{let s=t();void 0!==e&&"function"==typeof s&&(s=s()),o=void 0!==e?s?new Set([e]):new Set:this._normalizeToSet(s)}catch{o=new Set}const r=new Set(i.set);this._applySourceDiff(s,r,o,n),i.set=o});let r=o();const a=()=>{try{r()}catch{}},c={propertyName:`__class:${s}`,dataSource:null,activate(){},deactivate:()=>{a();const t=this._getElement(),e=new Set(i.set);this._applySourceDiff(s,e,new Set,t),i.set.clear()},reActivate:()=>{a(),r=o()}};try{this._parent.bindings.add(c)}catch{}i.stop=a,i.binding=c,this._keepWatcher(i)}}const Qt={cancel(){},addEventListener(){},removeEventListener(){},oncancel:null,playState:"finished"};function Zt(t){const e=t.substring(0,Math.max(0,t.length-1)).replace(",",".");return 1e3*Number(e)}function te(t,e){const s=s=>(t[`${e}-${s}`]||"").split(", "),i=s("delay"),n=s("duration");let o=-1/0;for(let t=0;t<n.length;t++){const e=Zt(n[t])+Zt(i[t%i.length]);o=Math.max(o,e)}return{kind:e,longest:o,tracks:n.length}}const ee=/(?:^|\W)(?:transform|all)(?:,|$)/;function se(t,e){if(!t)return{type:"animation",timeout:0,propCount:0,hasTransform:!1};const s={transition:te(t,"transition"),animation:te(t,"animation")};let i,n;if("transition"===e||"animation"===e){const t=s[e];i=t.longest>0?t:null,n=i?i.longest:0}else{const{transition:t,animation:e}=s;n=Math.max(t.longest,e.longest),i=n>0?t.longest>e.longest?t:e:null}const o=i?i.kind:null;return{type:o,timeout:n,propCount:i?i.tracks:0,hasTransform:"transition"===o&&ee.test(t.transitionProperty)}}function ie(t,e,s){if(t.isConnected&&8!==t.nodeType)return se(ln.window.getComputedStyle(t),s);const i=ln.createElement("div");i.setAttribute("style","width:0!important;height:0!important;display:none"),ln.body.appendChild(i),i.setAttribute("class",e);try{return se(ln.window.getComputedStyle(i),s)}finally{i.remove()}}function ne(t,e,s,i,n=!1){if(!1===e.css)return i(),()=>{};const o=function(t,e,s=!1){const i=t.name||"motif";if("enter"===e){const e={from:t.enterFromClass??`${i}-enter-from`,active:t.enterActiveClass??`${i}-enter-active`,to:t.enterToClass??`${i}-enter-to`};return s?{from:t.appearFromClass??e.from,active:t.appearActiveClass??e.active,to:t.appearToClass??e.to}:e}return{from:t.leaveFromClass??`${i}-leave-from`,active:t.leaveActiveClass??`${i}-leave-active`,to:t.leaveToClass??`${i}-leave-to`}}(e,s,n),r=e=>{e&&e.split(/\s+/).forEach(e=>{if(e)try{t.classList.add(e)}catch{}})},a=e=>{e&&e.split(/\s+/).forEach(e=>{if(e)try{t.classList.remove(e)}catch{}})};let c,l=!1,h=null,u=null;const d=()=>{if(!l){l=!0,(()=>{if(a(o.from),a(o.to),a(o.active),void 0!==c){try{clearTimeout(c)}catch{}c=void 0}if(h&&u){try{t.removeEventListener(h,u)}catch{}u=null}})();try{i()}catch{}}};r(o.from),r(o.active);try{t.offsetHeight}catch{}return(t=>{const e=globalThis.requestAnimationFrame;"function"==typeof e?e(()=>t()):setTimeout(t,16)})(()=>{if(l)return;a(o.from),r(o.to);let i=0,n=1;const p=e.duration;if("number"==typeof p)i=p,h="animation"===e.type?"animationend":"transitionend";else if(p&&"object"==typeof p)i=("enter"===s?p.enter:p.leave)??0,h="animation"===e.type?"animationend":"transitionend";else{const s=function(t,e){return se(ln.window.getComputedStyle(t),e)}(t,e.type);i=s.timeout,n=s.propCount||1,h="animation"===s.type?"animationend":"transitionend"}if(!i||i<=0)return void d();let f=0;u=e=>{e&&e.target!==t||++f>=n&&d()};try{t.addEventListener(h,u)}catch{}c=setTimeout(d,i+60)}),d}class oe{constructor(t,e){this._component=t,this.options=e}show(){return this._component._show()}hide(){return this._component._hide()}toggle(){this._component._toggle()}on(t,e,s=!0){return this._component._on(t,e,s)}off(t,e){return this._component._off(t,e)}trigger(t,e){return this._component._trigger(t,e)}addHandler(t,e){this._component._addHandler(t,e)}clear(){return this._component._clear()}register(t){this._component._register(t)}setDisposable(t){this._component._register(Xt(t))}stopAnimations(){return this._component._stopAnimations()}}const re=Symbol("SignalTarget"),ae=Symbol("SignalKey");class ce{static create(t,e){return new ce(t,e)}constructor(t,e=Object.is){this._disposed=!1,this._value=t,this._target={[re]:!0},this._key=ae,this._equals=e}get value(){return this._disposed||vt(this._target,this._key),this._value}set value(t){this._disposed||this._equals(this._value,t)||(this._value=t,wt(this._target,this._key))}peek(){return this._value}update(t){this.value=t(this._value)}mutate(t){this._disposed||(t(this._value),wt(this._target,this._key))}notify(){this._disposed||wt(this._target,this._key)}asReadonly(){const t=this;return{get value(){return t.value},peek:()=>t.peek(),valueOf:()=>t.valueOf(),toString:()=>t.toString()}}dispose(){this._disposed=!0}valueOf(){return this.value}toString(){return String(this.value)}}class le{constructor(t){this._dirty=!0,this._computing=!1,this._getter=t,this._target={[re]:!0},this._key=ae,this._cleanup=Mt(()=>{if(!this._computing){this._computing=!0;try{const t=this._getter(),e=this._dirty||!Object.is(this._value,t);this._value=t,this._dirty=!1,e&&wt(this._target,this._key)}finally{this._computing=!1}}})}get value(){if(vt(this._target,this._key),this._dirty){this._computing=!0,H();try{this._value=this._getter(),this._dirty=!1}finally{F(),this._computing=!1}}return this._value}peek(){if(this._dirty){H();try{this._value=this._getter(),this._dirty=!1}finally{F()}}return this._value}dispose(){this._cleanup&&(this._cleanup(),this._cleanup=void 0)}valueOf(){return this.value}toString(){return String(this.value)}}class he{constructor(t){this._dirty=!0,this._disposed=!1,this._getter=t,this._target={[re]:!0},this._key=ae,this._runner=function(t,e){const s=new lt(t);return s.scheduler=e,{run:()=>{bt(()=>s.run())},stop:()=>s.stop()}}(()=>{this._value=this._getter()},()=>{this._dirty||this._disposed||(this._dirty=!0,wt(this._target,this._key))})}get value(){return this._disposed||vt(this._target,this._key),this._refresh(),this._value}peek(){return this._refresh(),this._value}get isDirty(){return this._dirty}_refresh(){this._dirty&&(this._disposed?this._value=At(this._getter):this._runner.run(),this._dirty=!1)}dispose(){this._disposed||(this._disposed=!0,this._runner.stop())}valueOf(){return this.value}toString(){return String(this.value)}}let ue=null,de=null,pe=null,fe=null,me=null;const _e=new WeakMap,ge=new WeakMap,ye=new WeakMap,ve=new WeakMap,we=new WeakMap;function be(t,e){const s=ue;ue=t;try{return e()}finally{ue=s}}function Se(t,e,s){const i=de,n=pe;de=t,pe=e;try{return s()}finally{de=i,pe=n}}function Ce(t){let e=t;for(;e;){const t=ye.get(e);if(t)return t.scope;const s=ve.get(e);if(s&&s._pending)return s;e=e.parent}return null}function Me(t){if(!ue)throw y("MJX409",function(t){return"function"==typeof t?t.name||"[AnonymousClass]":String(t)}(t));return ue(t)}function ke(t){fe&&fe._pending&&ve.set(t,fe)}function xe(t){const e=me;if(!e)return;if(ye.get(t)?.live)return;const s=Ce(t)??e._currentScope();ye.set(t,{scope:s,live:!0}),s._livePins++}function De(t){const e=ye.get(t);e?e.live&&(e.live=!1,e.scope._releaseLivePin()):me&&_e.has(t)&&ye.set(t,{scope:Ce(t)??me._currentScope(),live:!1})}class Ae{constructor(t,e,s){this.services=t,this.scopedCache=new Map,this.transientSet=new Set,this._autoDisposeTransients=!1,this.pendingScoped=new Map,this._ownerlessSlot={owner:null,ownerless:!0},this._navigationDisposed=!1,this._livePins=0,this._pending=!1,this.describeToken=t=>"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t?t.name||"[AnonymousClass]":String(t),this.parent=e,this.root=s??this,this.kind=this.root===this?"root":"user",this.singletonCache=this.root===this?new Map:this.root.singletonCache,this.pendingSingleton=this.root===this?new Map:this.root.pendingSingleton}createScope(t){const e=new Ae(this.services,this,this.root);return e.scopeName=t??this.scopeName,e._autoDisposeTransients=this._autoDisposeTransients,e}enableAutoDisposeTransients(t=!0){return this._autoDisposeTransients=t,this}get(t){const e=this.services.getDescriptor(t);if(!e)throw y("MJX401",this.describeToken(t));return this.resolveDescriptorSync(e,[t])}async getAsync(t){const e=this.services.getDescriptor(t);if(!e)throw y("MJX401",this.describeToken(t));return await this.resolveDescriptorAsync(e,[t])}_getFor(t,e){let s=_e.get(t);return s||(s={owner:t},_e.set(t,s)),Se(s,pe,()=>this.get(e))}getAllServices(){return this.services}_beginNavigation(){const t=this.root,e=t._navigation??={current:t,version:new ce(0),scopes:new Set};me=t;const s=new Ae(this.services,t,t);return s.kind="navigation",s.scopeName="navigation",s._pending=!0,s._autoDisposeTransients=t._autoDisposeTransients,e.scopes.add(s),s}_commitNavigation(t){const e=this.root._navigation;if(!e||e.current===t)return;t._pending=!1;const s=e.current;e.current=t,this._touch(),s!==this.root&&s._releaseIfUnused()}_abandonNavigation(t){t._pending=!1,t._releaseIfUnused()}_currentScope(){return this.root._navigation?.current??this.root}_touch(){const t=this.root._navigation;t&&(t.version.value=t.version.peek()+1)}_releaseLivePin(){this._livePins--,this._releaseIfUnused()}_releaseIfUnused(){const t=this.root._navigation;"navigation"!==this.kind||this._navigationDisposed||this._livePins>0||t&&t.current===this||(this._navigationDisposed=!0,t?.scopes.delete(this),this.dispose().catch(()=>{}))}_scopeFor(t){const e=this._navigation;if(e&&e.version.value,!t.ownerless){const e=Ce(t.owner);if(e)return e;if(fe&&fe.root===this)return fe}return e?e.current:this}_handle(t,e){const s=de??this._ownerlessSlot;let i=ge.get(s);i||ge.set(s,i=new Map);let n=i.get(t.token);return n||(n=this._createHandle(t,s),i.set(t.token,n)),this._scopeFor(s)._scopedInstanceSync(t,e),n}async _handleAsync(t,e){const s=de??this._ownerlessSlot;return await this._scopeFor(s)._scopedInstanceAsync(t,e),Se(s,null,()=>this._handle(t,e))}_createHandle(t,e){const s=this,i=()=>s._scopeFor(e)._scopedInstanceSync(t,[t.token]);return new Proxy(Object.create(null),{get(t,e){const s=i(),n=Reflect.get(s,e,s);return"function"==typeof n?function(t,e,s){let i=we.get(t);i||we.set(t,i=new Map);const n=i.get(e);if(n&&n.fn===s)return n.bound;const o=s.bind(t);return i.set(e,{fn:s,bound:o}),o}(s,e,n):n},set(t,e,s){const n=i();return Reflect.set(n,e,s,n)},has:(t,e)=>e in i(),getPrototypeOf:()=>Object.getPrototypeOf(i())})}_isSystemScope(){return"user"!==this.kind}_scopedInstanceSync(t,e){if(this.scopedCache.has(t.token))return this.scopedCache.get(t.token);const s=Se(null,this,()=>this.instantiateSync(t,e));return this.scopedCache.set(t.token,s),s}async _scopedInstanceAsync(t,e){if(this.scopedCache.has(t.token))return this.scopedCache.get(t.token);if(this.pendingScoped.has(t.token))return await this.pendingScoped.get(t.token);const s=(async()=>{const s=await this.instantiateAsyncIn(null,this,t,e);return this.scopedCache.set(t.token,s),this.pendingScoped.delete(t.token),s})();return this.pendingScoped.set(t.token,s),await s}resolveDescriptorSync(t,e){switch(this.checkCycle(t.token,e),t.lifetime){case"singleton":{if(this.singletonCache.has(t.token))return this.singletonCache.get(t.token);const s=Se(null,null,()=>this.instantiateSync(t,e));return this.singletonCache.set(t.token,s),s}case"scoped":return this._isSystemScope()&&pe!==this?this.root._handle(t,e):this._scopedInstanceSync(t,e);default:{const s=this.instantiateSync(t,e);return this._autoDisposeTransients&&this.parent&&this.transientSet.add(s),s}}}async resolveDescriptorAsync(t,e){switch(this.checkCycle(t.token,e),t.lifetime){case"singleton":{if(this.singletonCache.has(t.token))return this.singletonCache.get(t.token);if(this.pendingSingleton.has(t.token))return await this.pendingSingleton.get(t.token);const s=(async()=>{const s=await this.instantiateAsyncIn(null,null,t,e);return this.singletonCache.set(t.token,s),this.pendingSingleton.delete(t.token),s})();return this.pendingSingleton.set(t.token,s),await s}case"scoped":return this._isSystemScope()&&pe!==this?await this.root._handleAsync(t,e):await this._scopedInstanceAsync(t,e);default:{const s=await this.instantiateAsync(t,e);return this._autoDisposeTransients&&this.parent&&this.transientSet.add(s),s}}}construct(t){if(de)return t();const e={owner:null},s=Se(e,pe,t);return!s||"object"!=typeof s&&"function"!=typeof s||"function"==typeof s.then||(ke(s),e.owner=s,_e.has(s)||_e.set(s,e)),s}instantiateSync(t,e){if(void 0!==t.useValue)return t.useValue;if(t.useFactory)return this.construct(()=>{const s=this.resolveDepsSync(t,e),i=be(this.injectionResolver(e),()=>t.useFactory(...s,this));if(i&&"function"==typeof i.then){throw y("MJX402",this.describeTokenWithSource(t.token))}return i});if(t.useClass)return this.construct(()=>{const s=this.resolveDepsSync(t,e);return be(this.injectionResolver(e),()=>new t.useClass(...s))});throw y("MJX403")}async instantiateAsyncIn(t,e,s,i){return await Se(t,e,()=>this.instantiateAsync(s,i))}async instantiateAsync(t,e){if(void 0!==t.useValue)return t.useValue;const s=de,i=pe;if(t.useFactory){const n=await this.resolveDepsAsyncIn(s,i,t,e);return await Se(s,i,()=>this.construct(()=>be(this.injectionResolver(e),()=>t.useFactory(...n,this))))}if(t.useClass){const n=await this.resolveDepsAsyncIn(s,i,t,e);return Se(s,i,()=>this.construct(()=>be(this.injectionResolver(e),()=>new t.useClass(...n))))}throw y("MJX403")}async dispose(){const t=new Set,e=async e=>{if(e&&!t.has(e)){t.add(e);try{"function"==typeof e.dispose&&await e.dispose()}catch{}try{"function"==typeof e.close&&await e.close()}catch{}try{const t=e[Symbol.dispose];"function"==typeof t&&await t.call(e)}catch{}try{const t=e[Symbol.asyncDispose];"function"==typeof t&&await t.call(e)}catch{}}};if(this.root===this){const t=this._navigation;if(t){const e=[...t.scopes];t.scopes.clear(),t.current=this,me===this&&(me=null),this._navigation=void 0;for(const t of e)t._navigationDisposed=!0,await t.dispose()}for(const t of this.singletonCache.values())await e(t);this.singletonCache.clear(),this.pendingSingleton.clear()}for(const t of this.scopedCache.values())await e(t);"navigation"!==this.kind&&this.scopedCache.clear(),this.pendingScoped.clear();for(const t of this.transientSet.values())await e(t);this.transientSet.clear()}resolveDepsSync(t,e){const s=this.getDeps(t);return s&&0!==s.length?s.map(t=>this.resolveTokenSync(t,e)):[]}async resolveDepsAsyncIn(t,e,s,i){const n=this.getDeps(s);if(!n||0===n.length)return[];const o=[];for(const s of n)o.push(await Se(t,e,()=>this.resolveTokenAsync(s,i)));return o}injectionResolver(t){return e=>this.resolveTokenSync(e,t)}getDeps(t){if(Array.isArray(t.deps))return t.deps;const e=t.useClass??t.useFactory;if(e){if(Array.isArray(e.inject))return e.inject;if(Array.isArray(e.dependencies))return e.dependencies}}resolveTokenSync(t,e){const s=this.services.getDescriptor(t);if(!s)throw y("MJX401",this.describeToken(t));const i=e.concat(t);return this.resolveDescriptorSync(s,i)}async resolveTokenAsync(t,e){const s=this.services.getDescriptor(t);if(!s)throw y("MJX401",this.describeToken(t));const i=e.concat(t);return await this.resolveDescriptorAsync(s,i)}checkCycle(t,e){const s=e.indexOf(t);if(-1!==s&&s!==e.length-1){throw y("MJX404",e.slice(s).concat([t]).map(t=>this.describeTokenWithSource(t)).join(" -> "))}}describeTokenWithSource(t){const e=this.describeToken(t),s=this.services.getDescriptor(t);if(!s)return e;return`${e}[${s.useClass?"useClass":s.useFactory?"useFactory":void 0!==s.useValue?"useValue":"unknown"}]`}}const Ee={live:0},Oe=Symbol("motif.optionsOwner"),Te=Symbol("motif.transition"),Ne={mode:"concurrent"},Pe=()=>{};function Le(){const t=new WeakMap;return{track:function(e,s,i){const n=e?.parentNode??i?.parentNode;if(!n)return{done:s,release:Pe};let o=t.get(n);o||t.set(n,o=new Set);let r=Pe;const a={node:e,via:i??null,done:new Promise(t=>{r=t})};o.add(a);let c=!1;const l=()=>{c||(c=!0,o.delete(a),r())};return{done:()=>{const t=!c;l(),t&&s&&s()},release:l,finished:a.done}},pending:function(e,s){if(!e)return null;const i=t.get(e);if(!i||0===i.size)return null;let n=null;for(const t of i)t.node!==s&&(t.node.parentNode===e||t.via?.parentNode===e?(n??=[]).push(t.done):i.delete(t));return n?Promise.all(n).then(Pe):null}}}const Re=Le(),Xe=Le(),Ie=Re.track,Je=Re.pending,je=Xe.track,He=Xe.pending;function Fe(t){return"concurrent"===t||"out-in"===t||"in-out"===t}function Be(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t?t.name||"[AnonymousClass]":String(t)}const ze=1024,We=2048,Ve=4096,$e=8192;function Ue(t){return t?._motif?.options}function qe(t){return t?._motif?.options?.[Te]}function Ge(t){const e=qe(t);if(e?._markedDirection){e._markedDirection=!1;try{t.element?.removeAttribute?.("data-nav-direction")}catch{}}}function Ke(t){let e=t;for(;e;){const t=qe(e)?.mode;if(t)return t;const s=e.element;if(!s||s.nodeType!==Node.COMMENT_NODE)break;e=e.parent??e._baseCtx?._leaveContainer}return Ne.mode}function Ye(t){const e=t?._motif?.options,s=e?.[Te];return!!(e?.transitionIn||s&&(s.classes||s.name&&s.name.length>0))}function Qe(t){const e=()=>t.motif.options?.[Te]??s,s={transitionInfo:()=>{const s=e();return{in:ie(t.element,`${s.name}-enter ${s.name}-enter-start`),out:ie(t.element,`${s.name}-leave ${s.name}-leave-start`)}},name:"",mode:void 0,classes:void 0,activeCssCancel:null,activeCssPhase:null,cssProps:()=>{const t=e();return t.classes?{name:t.classes.name||t.name||"",...t.classes}:t.name&&t.name.length>0?{name:t.name}:null},skipNextLeave:!1,_suppressEnter:!1,_markedDirection:!1,in:e=>{t.motif.options.transitionIn=e},out:e=>{t.motif.options.transitionOut=e},enterTransition:s=>{const i=e(),n=t._base,o=!n._enterPlayed;if(n._enterPlayed=!0,n._enterSeq=(n._enterSeq??0)+1,i._suppressEnter)return s&&s(),Qt;const r={};n._enterRun=r;const a=je(t.element,()=>{t._base?._enterRun===r&&(t._base._enterRun=null,Ge(t)),s&&s()},t.motif.options.placeholder),c=t.motif.options.transitionIn,l=c?i.run(c.keyframes,c.options,a.done):i._runCss("enter",a.done,o);return l&&l!==Qt&&"function"==typeof l.addEventListener&&l.addEventListener("cancel",a.release),l},leaveTransition:s=>{const i=e(),n=t.element,o=Ie(n,s),r=()=>{const e=t.motif.options?.transitionOut,s=e?i.run(e.keyframes,e.options,o.done):i._runCss("leave",o.done);return s&&s!==Qt&&"function"==typeof s.addEventListener&&s.addEventListener("cancel",o.release),s};return o.finished&&"in-out"===Ke((a=t).parent??a._baseCtx?._leaveContainer)?function(t,e,s){const i=t.parentNode,n={finished:e.finished??Promise.resolve(),playState:"pending",addEventListener:Pe,removeEventListener:Pe,cancel:Pe};return queueMicrotask(()=>{const e=He(i,t);e?e.then(()=>{s()}):s()}),n}(n,o,r):r();var a},_runCss:(s,i,n=!1)=>{const o=e();if("enter"===s&&"leave"===o.activeCssPhase)return i&&i(),Qt;const r=o.cssProps(),a=t.element;if(r&&a&&1===a.nodeType&&a.classList){try{o.activeCssCancel?.()}catch{}const t=ne(a,r,s,()=>{o.activeCssCancel=null,o.activeCssPhase=null,i&&i()},n);return o.activeCssCancel=t,o.activeCssPhase=s,Qt}return i&&i(),Qt},activeAnimations:[],run:(s,i,n)=>{const o=e();t.motif.stopAnimations();const r=t.element;if(r.animate){var a=r.animate(s,i);o.activeAnimations.push(a);let t=!1;const e=()=>{if(!t){t=!0;try{o.activeAnimations&&(o.activeAnimations=o.activeAnimations.filter(t=>t!==a))}catch{}}};return a.addEventListener("finish",()=>{n&&n(),e()}),a.oncancel=()=>{e()},a}{n&&n();const t=globalThis;if("function"==typeof t.Animation)try{return new t.Animation}catch{}return Qt}}};return s}class Ze{constructor(t){this[Oe]=t}get transition(){return this[Te]??=Qe(this[Oe])}set transition(t){this[Te]=t}set enableRouterClassing(t){try{const e=this[Oe],s=ks(e).onRouterChanged(()=>{as.routerClassing.call(e,t)});if(e.isDisposed)return void s();e.motif.register(Xt(s)),as.routerClassing.call(e,t)}catch(t){v("MJX105",t)}}getInstance(){return this[Oe]}get display(){return this[Oe].isVisible}set display(t){t?this[Oe].motif.show():this[Oe].motif.hide()}hasEvent(t){return Js(this[Oe],t)}}function ts(t,e,s){const i=t._baseCtx;i&&i._emiters?.fire(e,s)}function es(t,e,s,i,n){if(!t)return;let o=t[e];if(!o)return;let r=0;if("function"==typeof o){const a=o;if(w(()=>a(s,i),"MJX122",n),o=t[e],!Array.isArray(o))return;r=1}for(let t=r;t<o.length;t++){const e=o[t];w(()=>e(s,i),"MJX122",n)}}function ss(t,e,s,i){if(t[e])return!0;const n=t._baseCtx;return!!n?.[s]||!!n?._emiters?.hasListeners(i)}jt(Ze.prototype,["getInstance","hasEvent"]);const is=["build","setState","reState","setText","style","dispose","disposeAsync","using","doWork","getService","$","useModel","context","siblings","serviceProvider","isWait"],ns=new WeakSet;function os(t,e){if("function"!=typeof t)return!1;const s=e.replace(/\$/g,"\\$");return new RegExp(`\\bsuper\\s*(\\.\\s*${s}(?![\\w$])|\\[)`).test(Function.prototype.toString.call(t))}function rs(t){if(!e())return;const s=t?.constructor;if("function"!=typeof s||ns.has(s))return;ns.add(s);const i=s.name||"An anonymous component class";for(const[e,s]of function(t){const e=[],s=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);for(const i of is)if(s(t,i))e.push([i,"field"]);else for(let s=Object.getPrototypeOf(t);s&&s!==ni.prototype;s=Object.getPrototypeOf(s)){const t=Object.getOwnPropertyDescriptor(s,i);if(t){("value"in t?[t.value]:[t.get,t.set].filter(Boolean)).some(t=>os(t,i))||e.push([i,"method"]);break}}const i=t;return i.motif instanceof oe||e.push(["motif","replaced"]),i.controls instanceof pn||e.push(["controls","replaced"]),i.class instanceof Yt||e.push(["class","replaced"]),i.attr instanceof Kt||e.push(["attr","replaced"]),i.bindings instanceof Bt||e.push(["bindings","replaced"]),null==i.element||"undefined"==typeof Node||i.element instanceof Node||e.push(["element","replaced"]),null==i.parent||i.parent instanceof ni||e.push(["parent","replaced"]),e}(t))b("MJX128",[i,e,s])}const as={callInitializeComponent(t){const e=t,s={cancel:!1};if(!t||t.isDisposed)return;"function"==typeof t.initializeComponent&&w(()=>t.initializeComponent(e,s),"MJX122","initializeComponent");const i=t._init;i&&w(()=>i(e,s),"MJX122","initializeComponent"),es(t._baseCtx,"_initializeComponentHandlers",e,s,"initializeComponent"),"function"==typeof t.oninitializeComponent&&w(()=>t.oninitializeComponent(e,s),"MJX122","oninitializeComponent"),es(t._baseCtx,"_onInitializeComponentHandlers",e,s,"oninitializeComponent"),function(t){t._init=void 0;const e=t._baseCtx;void 0!==e&&(void 0!==e._initializeComponentHandlers&&(e._initializeComponentHandlers=void 0),void 0!==e._onInitializeComponentHandlers&&(e._onInitializeComponentHandlers=void 0))}(t)},callDisposing(t){if(!t||t.isDisposed)return;if(!ss(t,"onDisposing","_onDisposingHandlers","ondisposing"))return;const e=t,s={cancel:!1};t.onDisposing&&w(()=>t.onDisposing(e,s),"MJX122","onDisposing"),es(t._baseCtx,"_onDisposingHandlers",e,s,"onDisposing"),ts(t,"ondisposing",s)},callActivated(t){if(!t||t.isDisposed)return;const e=t,s={cancel:!1};t.onActivated&&w(()=>t.onActivated(e,s),"MJX122","onActivated"),es(t._baseCtx,"_onActivatedHandlers",e,s,"onActivated"),ts(t,"onactivated",s)},callDeactivated(t){if(!t||t.isDisposed)return;const e=t,s={cancel:!1};t.onDeactivated&&w(()=>t.onDeactivated(e,s),"MJX122","onDeactivated"),es(t._baseCtx,"_onDeactivatedHandlers",e,s,"onDeactivated"),ts(t,"ondeactivated",s)},deactivateTree(t,e=!0){if(t&&!t.isDisposed&&t.isBuilt&&t._base&&!t._base._inactive&&(t._base._inactive=!0,as.callDeactivated(t),e&&!t.isDisposed))for(const e of Ks(t).slice())e&&!e.isDisposed&&e.isVisible&&!e.isWait&&as.deactivateTree(e,!0)},activateTree(t,e=!0){if(t&&!t.isDisposed&&t._base&&t._base._inactive&&(t._base._inactive=!1,as.callActivated(t),e&&!t.isDisposed))for(const e of Ks(t).slice())e&&!e.isDisposed&&e.isVisible&&!e.isWait&&as.activateTree(e,!0)},callDisposed(t){if(t&&0===(t._flags&ze)&&(!t.isDisposed||t.element||void 0!==t._baseCtx)){if(t._flags|=ze,ss(t,"onDisposed","_onDisposedHandlers","ondisposed")){const e=t,s={cancel:!1};t.onDisposed&&w(()=>t.onDisposed(e,s),"MJX122","onDisposed"),es(t._baseCtx,"_onDisposedHandlers",e,s,"onDisposed"),ts(t,"ondisposed",s)}try{i()?.("component:disposed",{id:t.id,type:t.constructor?.name})}catch{}}},callBuilt(t){if(t&&!t.isDisposed){if(ss(t,"onBuilt","_onBuiltHandlers","onbuilt")){const e=t,s={cancel:!1};t.onBuilt&&w(()=>t.onBuilt(e,s),"MJX122","onBuilt"),es(t._baseCtx,"_onBuiltHandlers",e,s,"onBuilt"),ts(t,"onbuilt",s)}try{i()?.("component:mounted",{id:t.id,type:t.constructor?.name})}catch{}}},scheduleMounted(t){if(!t||t.isDisposed||t._baseCtx?._mountedScheduled)return;if(!("function"==typeof t.onMounted||!!t._baseCtx?._onMountedHandlers))return;t._base._mountedScheduled=!0;const e=t.element;if(!e||"number"!=typeof e.nodeType)return;const s=ji(e,()=>{t.isDisposed||as.callMounted(t)});s&&t._register(Xt(s))},callMounted(t){if(!t||t.isDisposed||t._base._mountedFired)return;t._base._mountedFired=!0;const e=t,s={cancel:!1};t.onMounted&&w(()=>t.onMounted(e,s),"MJX122","onMounted"),es(t._baseCtx,"_onMountedHandlers",e,s,"onMounted"),ts(t,"onmounted",s)},callBuilding(t){if(!t||t.isDisposed)return;if(!ss(t,"onBuilding","_onBuildingHandlers","onbuilding"))return;const e=t,s={cancel:!1};t.onBuilding&&w(()=>t.onBuilding(e,s),"MJX122","onBuilding"),es(t._baseCtx,"_onBuildingHandlers",e,s,"onBuilding"),ts(t,"onbuilding",s)},callConfig(t){if(!t||t.isDisposed||t.isConfigured)return;t.isConfigured=!0;const e=t._motif?.options?._preconfig;if(e&&p(()=>e(t),"Component._preconfig"),!ss(t,"onConfig","_onConfigHandlers","onconfig"))return;const s=t,i={cancel:!1};t.onConfig&&w(()=>t.onConfig(s,i),"MJX122","onConfig"),es(t._baseCtx,"_onConfigHandlers",s,i,"onConfig"),ts(t,"onconfig",i)},callConfigured(t){if(256&t._flags)return;if(t?._baseCtx?._configDeferred&&!t.isConfigured&&as.callConfig(t),t._flags|=256,!t||t.isDisposed)return;if(!ss(t,"onConfigured","_onConfiguredHandlers","onconfigured"))return;const e=t,s={cancel:!1};t.onConfigured&&w(()=>t.onConfigured(e,s),"MJX122","onConfigured"),es(t._baseCtx,"_onConfiguredHandlers",e,s,"onConfigured"),ts(t,"onconfigured",s)},callOnInitialized(t){if(!t||t.isDisposed)return;if(t.isInitialized=!0,!ss(t,"onInitialized","_onInitializedHandlers","oninitialized"))return;const e=t,s={cancel:!1};t.onInitialized&&w(()=>t.onInitialized(e,s),"MJX122","onInitialized"),es(t._baseCtx,"_onInitializedHandlers",e,s,"onInitialized"),ts(t,"oninitialized",s)},callOnInitializing(t){if(!t||t.isDisposed)return;if(!ss(t,"onInitializing","_onInitializingHandlers","oninitializing"))return;const e=t,s={cancel:!1};t.onInitializing&&w(()=>t.onInitializing(e,s),"MJX122","onInitializing"),es(t._baseCtx,"_onInitializingHandlers",e,s,"onInitializing"),ts(t,"oninitializing",s)},callVisibilityChanged(t,e){if(!t||t.isDisposed)return;if(!ss(t,"onVisibilityChanged","_onVisibilityChangedHandlers","onvisibilitychanged"))return;const s=t,i={cancel:!1,visible:e};t.onVisibilityChanged&&w(()=>t.onVisibilityChanged(s,i),"MJX122","onVisibilityChanged"),es(t._baseCtx,"_onVisibilityChangedHandlers",s,i,"onVisibilityChanged"),ts(t,"onvisibilitychanged",i)},findFragmentContent(t){const e=t.element.nodeType==Node.COMMENT_NODE?t.motif.options.cache:t.element;t.element.nodeType==Node.COMMENT_NODE&&0==e?.childNodes.length&&t.controls.length>0&&(t.motif.options.cache?.appendChild(t.element),t.controls.forEach(e=>{t.motif.options.cache?.appendChild(e.element)}),t.motif.options.cache?.appendChild(t.motif.options.closeFragment))},backgroundCallback(t){t()},internalBuild(t){if(this.isDisposed||t?.isDisposed)return;if(as.callConfigured(t),t.isDisposed)return;if(zs(t),t.isWait)return void(this.isBuilt&&function(t,e){if(!cs(e))return;const s=Li(t)?.element;if(!s)return;const i=e.element;if(i&&i.parentNode===s)return;const n=e.motif.options,o=n.placeholder??(n.placeholder=ln.createComment("h"));if(o.parentNode===s)return;s.insertBefore(o,hs(t,t.controls.items.indexOf(e)+1,s))}(this,t));const e=t.isBuilt;if(!this.isBuilt)return;if(t.isWait)return;const s=t._baseCtx?._enterSeq;if(t.isBuilt){if(t.parent!=this){t.parent?.controls.detach(t),t.parent=this;const e=t.__pendingLeave;if(e)return void e.promise.then(()=>{this.isDisposed||t.isDisposed||t.parent!==this||as.internalBuild.call(this,t)})}}else t.build();if(t.isDisposed||this.isDisposed)return;t.parent=this;const i=this.controls.items,n=i.length>0&&i[i.length-1]===t?i.length-1:i.indexOf(t),o=Li(this);var r=t.element.nodeType==Node.COMMENT_NODE?t.motif.options.cache:t.element;e&&t.element.nodeType==Node.COMMENT_NODE&&0==r?.childNodes.length&&t.controls.length>0&&(r=as.getContent.call(t));const a=o?.element,c=t.motif.options.placeholder,l=t.isVisible&&c&&a&&c.parentNode===a?c:null,h=l??(a?hs(this,n+1,a):null);if(!t.isVisible){if(!cs(t))return;t.motif.options.placeholder||(t.motif.options.placeholder=ln.createComment("h")),r=t.motif.options.placeholder}if(a&&"out-in"===Ke(this)){const e=Je(a,r);if(e)return t._base._enterSeq=(t._base._enterSeq??0)+1,void e.then(()=>{this.isDisposed||t.isDisposed||t.parent!==this||as.internalBuild.call(this,t)})}const u=o?.element;if(r&&u&&(r===u||r.contains(u)))b("MJX104",[]);else{if(h)try{o?.element.insertBefore(r,h)}catch{o?.element.appendChild(r)}else o?.element.appendChild(r);l&&l.parentNode&&l.parentNode.removeChild(l)}if(t.isVisible){!(!e&&t._baseCtx?._enterSeq!==s)&&Ye(t)&&t.motif.options.transition.enterTransition(()=>{}),e&&as.activateTree(t)}},getContent(){return this.isDisposed||!this.element?null:this.element.nodeType==Node.COMMENT_NODE?(this.motif.options.cache?.appendChild(this.element),this.controls.forEach(t=>{const e=t.isWait||!t.isVisible?cs(t)?t.motif.options.placeholder??=ln.createComment("h"):void 0:as.getContent.call(t);e&&this.motif.options.cache?.appendChild(e)}),this.motif.options.cache?.appendChild(this.motif.options.closeFragment),this.motif.options.cache):this.element},routerClassing(t){try{const e=t.to,s=t.path;if(this.isDisposed)return;const i=ks(this)?.router;if(!i)return;const n=i.uri.startsWith("/")?i.uri:"/"+i.uri,o=s??"",r=function(t,e){try{const s=t=>t.trim().split(/[?#]/)[0].replace(/\\/g,"/").replace(/\/{2,}/g,"/");return s(t)===s(e)}catch(t){return v("MJX610",t),!1}}(n,o),a=r||function(t,e){const s=U(t),i=U(e);return s===i||s.startsWith(i+"/")}(n,o);if(t.activeClass&&("all"===e||"active"===e)){t.activeClass.split(" ").filter(t=>t.trim().length).forEach(t=>this.element.classList.toggle(t,a))}if(!a||"all"!==e&&"active"!==e?"all"!==e&&"active"!==e||t.offActive?.():t.onActive?.(),t.exactClass&&("all"===e||"exact"===e)){t.exactClass.split(" ").filter(t=>t.trim().length).forEach(t=>this.element.classList.toggle(t,r))}!r||"all"!==e&&"exact"!==e?"all"!==e&&"exact"!==e||t.offExact?.():t.onExact?.()}catch(t){}}};function cs(t){return"detach"!==Ue(t)?.hideStrategy}function ls(t,e){const s=Ue(t)?.placeholder;if(s&&s.parentNode===e)return s;const i=t.element;return i&&i.parentNode===e?i:null}function hs(t,e,s){const i=t.controls.items;for(let t=e;t<i.length;t++){const e=i[t]?ls(i[t],s):null;if(e)return e}if(t.element.nodeType===Node.COMMENT_NODE){const e=Ue(t)?.closeFragment;return e&&e.parentNode===s?e:null}return null}function us(t,e,s){const i=Ue(t),n=e.parentNode;if(e.nodeType===Node.COMMENT_NODE){if(n){const t=i?.closeFragment||null;if(t){let s=e;for(;s;){const e=s.nextSibling;try{n.removeChild(s)}catch{}if(s===t)break;s=e}}else try{n.removeChild(e)}catch{}if(!s)return}}else if(n){try{n.removeChild(e)}catch{}if(!s)return}const o=i?.placeholder;if(o&&o.parentNode)try{o.parentNode.removeChild(o)}catch{}}function ds(t){const e=t.element;if(!e||!0===t._keepElementOnDispose)return;const s=t.motif.options,i=s?.[Te];try{if(!0===i?.skipNextLeave||!0===t._forceInstantDetach)return i&&(i.skipNextLeave=!1),t._forceInstantDetach=!1,void us(t,e,!0)}catch{}if(i||s?.transitionOut)try{s.transition.leaveTransition(()=>{us(t,e,!1)})}catch{us(t,e,!1)}else us(t,e,!1)}async function ps(t){const e=t.element;if(!e||!0===t._keepElementOnDispose)return;const s=t.motif.options,i=s?.[Te];try{if(!0===i?.skipNextLeave||!0===t._forceInstantDetach)return i&&(i.skipNextLeave=!1),t._forceInstantDetach=!1,void us(t,e,!0)}catch{}if(i||s?.transitionOut)return new Promise(i=>{try{s.transition.leaveTransition(()=>{us(t,e,!1),i()})}catch{us(t,e,!1),i()}});us(t,e,!1)}function fs(t){if(!t.isDisposed){as.callDisposing.call(t,t);try{js(t)}catch{}if(t.motif.stopAnimations(),Hs(t),Ks(t).length)for(const e of t._controls.items)try{fs(e)}catch{}as.callDisposed.call(t,t),u(()=>{t._baseCtx?._emiters?.clear()},"disposeShallow.emiters"),t.isDisposed=!0,k.prototype.dispose.call(t)}}function ms(t){try{t.parent=null}catch{}t._eventHandlers=void 0;try{t._class?._countsStore?.clear()}catch{}try{t._class?._watchersStore?.clear()}catch{}try{t._baseCtx?._attr?._attrMapStore?.clear()}catch{}try{t._baseCtx?._attr?._watchersStore?.clear()}catch{}try{const e=t._motif?.options;e&&(e.cache=void 0,e.closeFragment=void 0,e.placeholder=void 0)}catch{}try{t.element=null}catch{}try{t.props=void 0}catch{}try{t.childs=void 0}catch{}try{t.class=void 0}catch{}try{t.attr=void 0}catch{}try{t.parent=null}catch{}try{t._motif&&(t._motif.options=void 0)}catch{}const e=Object.keys(t);for(let s=0;s<e.length;s++){const i=e[s];if("_motif"!==i&&"_flags"!==i)try{t[i]=void 0}catch{}}t._store=null,t._flags=1860}const _s=Promise.resolve();function gs(t,e){if(!e&&t._disposing&&!t.isDisposed)return!1;if(t.disposeAsync!==ni.prototype.disposeAsync)return!1;const s=Ue(t);if(s){if(s.transitionOut)return!1;const t=s[Te];if(t){if(t.activeAnimations&&t.activeAnimations.length>0)return!1;if(t.activeCssCancel)return!1;if(t.classes||t.name&&t.name.length>0)return!1}}const i=Ks(t);if(i.length)for(let t=0;t<i.length;t++){const e=i[t];if(e&&!e.isDisposed&&!gs(e,!1))return!1}return!0}const ys=new WeakMap;let vs,ws=!1,bs=!1;const Ss=new WeakSet;let Cs;function Ms(t){const e=t.parent;let s;if(e)if(Cs??=Object.getOwnPropertyDescriptor(ni.prototype,"context").get,e.__lookupGetter__("context")===Cs)s=Ms(e);else{const t=e.context;s=t?.[si]??t}return s??ys.get(t)??Zo.main}function ks(t){if(Cs??=Object.getOwnPropertyDescriptor(ni.prototype,"context").get,t.__lookupGetter__("context")!==Cs){const e=t.context;return e?.[si]??e}return bs||ws?Ms(t):Zo.main}function xs(t,e,s){const i=s?"disposeAsync":"dispose";if(Zo._disposingCount>0){const e=function(t){for(let e=t;e;e=e.parent){if(e.application)return e.application;const t=ys.get(e);if(t)return t}return Zo.main??null}(t);e&&"disposing"===e.state&&(ys.set(t,e),ws=!0)}!s&&e?.skipLeaveTransition&&(t.motif.options.transition.skipNextLeave=!0),u(()=>{as.callDisposing.call(t,t)},i+".callDisposing"),js(t,s&&!0!==t._keepElementOnDispose&&!1===t.element?.isConnected),Hs(t),u(()=>{t.parent?.controls?.silentDetach?.(t,!0)},i+".silentDetach")}function Ds(t,e,s){if(t.isDisposed=!0,k.prototype.dispose.call(t),s)return t._controls&&(t._controls.items=[]),u(()=>{as.callDisposed.call(t,t)},"disposeAsync.callDisposed"),u(()=>{t._baseCtx?._emiters?.clear()},"disposeAsync.emiters"),void(e?.deep&&ms(t));t.element=null,u(()=>{as.callDisposed.call(t,t)},"dispose.callDisposed"),u(()=>{t._baseCtx?._emiters?.clear()},"dispose.emiters"),js(t),ms(t)}async function As(t,e,s,i){i?await i:((s||qe(t)?.skipNextLeave)&&await t.motif.stopAnimations(),await ps(t)),s||"TransportTo"===t.constructor.name||await async function(t){if(0===Ee.live)return;const e=oi(t);return await Promise.all(e.map(async e=>{e.motif.options.transition.skipNextLeave=t.motif.options.transition.skipNextLeave;for(const t of e.controls.items)t.motif.options.transition.skipNextLeave=e.motif.options.transition.skipNextLeave,t.dispose({skipLeaveTransition:!0}),t.isDisposed=!0;await e.dispose()}))}(t);const n={deep:e?.deep};await d(async()=>{if(t.isDisposed)return;const e=Array.from(Ks(t));e.length&&await Promise.all(e.map(t=>s?d(async()=>{await t.disposeAsync(n)},"disposeAsync.disposeAsyncChildren.handler"):(async()=>{try{await t.disposeAsync(n)}catch(t){v("MJX107",t)}})()))},s?"disposeAsync.disposeAsyncChildren":"dispose.disposeAsync"),!s&&t.isDisposed||Ds(t,e,s)}const Es={get emiters(){return this._emiters??=new Wt(this.owner)},_offAll(){js(this.owner)},_deactivateBindings(){Hs(this.owner)},_activateBindings(){Fs(this.owner)},_reactivateBindings(){Bs(this.owner)},_activatePreBindings(){zs(this.owner)},_detachDomWithAnimation(){ds(this.owner)},_detachDomWithAnimationAsync(){return ps(this.owner)},_disposeShallow(){fs(this.owner)},_deepCleanup(){ms(this.owner)}},Os=16,Ts=32,Ns=64,Ps=[];let Ls=0;class Rs{constructor(t,e,s,i,n){this.owner=t,this.key=e,this.original=s,this.type=i,this.flags=n,this.next=void 0}handleEvent(t){const e=this.flags;if(0!==(e&Ns))return;const s=this.owner;if(1&e&&t.target!==s.element)return;if(2&e&&!t.isTrusted)return;const i=this.original;let n;try{i&&i.length<=1?n=i(t):i&&(n=i(s,t))}catch(t){v("MJX123",t,this.type)}if(n&&"function"==typeof n.then){const t=this.type;n.then(void 0,e=>v("MJX123",e,t))}4&e&&Xs(t),8&e&&Is(t),n&&!0===n.cancel&&(Xs(t),Is(t))}}function Xs(t){"function"==typeof t?.preventDefault&&t.preventDefault()}function Is(t){"function"==typeof t?.stopPropagation&&t.stopPropagation()}function Js(t,e){for(let s=t._eventHandlers;void 0!==s;s=s.next)if(0===(s.flags&Ns)&&s.key===e)return!0;return!1}function js(t,e=!1){const s=t._eventHandlers;if(void 0!==s){for(let i=s;void 0!==i;i=i.next)if((i.flags&(Ts|Ns))===Ts)if(e)i.flags|=Ns,i.owner=void 0,i.original=void 0;else try{t.element.removeEventListener(i.type,i,0!==(i.flags&Os))}catch{}t._eventHandlers=void 0}}function Hs(t){try{t._bindings?._items?.length&&t._bindings.deactivateAll()}catch{}}function Fs(t){try{t._bindings?.activateAll()}catch{}}function Bs(t){try{t._bindings?.reActivateAll()}catch{}}function zs(t){if(512&t._flags)return;const e=t._bindings?._items;e&&e.length>0&&t._bindings.items.filter(t=>"isWait"==t.propertyName||"display"==t.propertyName).forEach(t=>{t.activate()}),t._flags|=512}function Ws(t,e){(t._baseCtx??(t._baseCtx=$s(t)))._leaveContainer=e}function Vs(t){return 0!==(t._flags&$e)}function $s(t){const e=Object.create(Es);return e.owner=t,e}function Us(t){return t.owner}const qs=Object.freeze([]),Gs=Object.freeze([]);function Ks(t){return t._controls?.items??qs}function Ys(t){const e=Us(this);Js(e,"controladded")&&e.motif.trigger("controladded",{control:t}),(e.isVisible||e.element?.nodeType!==Node.COMMENT_NODE)&&as.internalBuild.call(e,t)}function Qs(t){const e=Us(this);Js(e,"controladded")&&e.motif.trigger("controladded",{control:t})}function Zs(t){const e=Us(this);Js(e,"controlremoved")&&e.motif.trigger("controlremoved",{control:t})}const ti=new WeakMap,ei=new Set(["building","built","initializing","initialized","disposing","disposed","config","configured","visibilitychanged","activated","deactivated"]),si=Symbol("motif.rawApplication"),ii=new Set(["on","onRouterChanged"]);class ni extends k{get motif(){return void 0!==this._motif?this._motif:this._motif=new oe(this,this.isDisposed&&!this.element?void 0:new Ze(this))}get isBuilt(){return!!(1&this._flags)}set isBuilt(t){this._flags=t?1|this._flags:-2&this._flags}get isInitialized(){return!!(2&this._flags)}set isInitialized(t){this._flags=t?2|this._flags:-3&this._flags}get isDisposed(){return!!(4&this._flags)}set isDisposed(t){this._flags=t?4|this._flags:-5&this._flags}get isConfigured(){return!!(8&this._flags)}set isConfigured(t){this._flags=t?8|this._flags:-9&this._flags}get isPainting(){return!!(16&this._flags)}set isPainting(t){this._flags=t?16|this._flags:-17&this._flags}get isPainted(){return!!(32&this._flags)}set isPainted(t){this._flags=t?32|this._flags:-33&this._flags}get isVisible(){return!(64&this._flags)}set isVisible(t){this._flags=t?-65&this._flags:64|this._flags}get controls(){return void 0!==this._controls||this.isDisposed&&!this.element?this._controls:this._controls=function(t){const e=new pn(t);return e.onAdd=Ys,e.onAddBeforeBuild=Qs,e.onRemove=Zs,e}(this)}set controls(t){this._controls=t}get class(){return void 0!==this._class||this.isDisposed&&!this.element?this._class:this._class=new Yt(this)}set class(t){this._class=t}get attr(){const t=this._baseCtx,e=void 0!==t?t._attr:void 0;return void 0!==e||this.isDisposed&&!this.element?e:this._base._attr=new Kt(this)}set attr(t){const e=this._baseCtx;void 0!==e?e._attr=t:void 0!==t&&(this._base._attr=t)}get bindings(){return void 0!==this._bindings||this.isDisposed&&!this.element?this._bindings:this._bindings=new Bt(this)}set bindings(t){this._bindings=t}useModel(t){return oo(t)}_computeHideStrategy(){return cs(this)?"placeholder":"detach"}_isInDom(){try{if(!this.element)return!1;const t=this.element;return t.nodeType,Node.COMMENT_NODE,!!t.parentNode}catch{return!1}}set isWait(t){this._flags=t?128|this._flags:-129&this._flags,this.isBuilt?t?this.motif.hide():this.motif.show():!1===t&&this.parent&&this.parent.isBuilt&&0===(this._flags&We)&&as.internalBuild.call(this.parent,this)}get isWait(){return!!(128&this._flags)}constructor(t,e={}){super(),this._motif=void 0,this._flags=0,this._controls=void 0,this._class=void 0,this._bindings=void 0,this._baseCtx=void 0,this._init=void 0,this.parent=null,function(t){bs||t===vs||(vs=t,Ss.has(t)||(Ss.add(t),Cs??=Object.getOwnPropertyDescriptor(ni.prototype,"context").get,t.prototype.__lookupGetter__("context")!==Cs&&(bs=!0)))}(new.target);const s=Ni;Ni=!1,ke(this),this.onElementCreating?this.element=this.onElementCreating.call(this):this.element=e?.onElementCreating?e.onElementCreating.call(this):t,3!==this.element?.nodeType&&void 0===this._controls&&(this._controls=new pn(this));const i=e?hi(e,this):[];if(e&&pi(e,this)&&(e={}),wi(e?.options,this),this.props=e,e){const t=new.target;!s&&(t===ni||Object.getPrototypeOf(t)===ni)?Di(e,this):Pi(e,this)}if(i.length>0)for(const t of ai(this,i))w(()=>t(this),"MJX122","ref");if(as.callOnInitializing(this),this.isDisposed)return;const n=this._controls;n&&(n.onAdd=Ys,n.onAddBeforeBuild=Qs,n.onRemove=Zs),as.callOnInitialized(this);const o=new.target;o===ni||Object.getPrototypeOf(o)===ni?as.callConfig(this):this._base._configDeferred=!0}get _base(){return void 0!==this._baseCtx||this.isDisposed&&!this.element?this._baseCtx:this._baseCtx=$s(this)}get context(){const t=bs||ws?Ms(this):Zo.main;return t?(this._scopedContext?.[si]!==t&&(this._scopedContext=function(t,e){const s=new Map;return new Proxy(t,{get(t,i){if(i===si)return t;const n=Reflect.get(t,i,t);if("function"!=typeof n)return n;const o=s.get(i);if(o&&o.fn===n)return o.bound;const r=ii.has(i)?(...s)=>e._trackContextSubscription(n.apply(t,s)):n.bind(t);return s.set(i,{fn:n,bound:r}),r},set:(t,e,s)=>Reflect.set(t,e,s,t)})}(t,this)),this._scopedContext):t}_trackContextSubscription(t){if("function"!=typeof t)return t;if(this.isDisposed)return t(),t;const e=this._register(Xt(t));return()=>{this._disposables.detach(e),t()}}build(t=!0){if(rs(this),as.callConfigured(this),zs(this),!this.isDisposed&&this.element&&!this.isWait&&!this.isBuilt&&!this.isWait){this._flags|=We;try{if(as.callBuilding(this),this.isDisposed)return;var e=this.element;t&&(e=ln.createDocumentFragment());const i="string"!=typeof this.element&&this.element.nodeType===Node.COMMENT_NODE;if(i&&(this.motif.options.cache=ln.createDocumentFragment(),this.element.textContent="[",this.motif.options.cache.appendChild(this.element)),this.isBuilt)return;if(as.callInitializeComponent(this),this.isDisposed)return;if(this.view){const t=this.view();if(this.controls.add(t),this.isDisposed)return}const n="SELECT"===this.element?.nodeName?this.bindings.items.filter(t=>"value"===t.propertyName):Gs;if(n.length)try{this.bindings.items.filter(t=>!n.includes(t)).forEach(t=>t.activate())}catch{}else Fs(this);const o=Ks(this);for(const n of o.length?o.slice():o){var s=i?this.motif.options.cache:this.element;if(n.isWait||(n.parent=this,n.build(!1)),n.isWait){if(cs(n)){const i=n.motif.options;(t?e:s).appendChild(i.placeholder??(i.placeholder=ln.createComment("h")))}}else{if(t){const t=Ue(n)?.cache;t?e.appendChild(t):e.appendChild(n.element)}else{const t=Ue(n)?.cache;t?s.appendChild(t):s.appendChild(n.element)}n._baseCtx?._inactive&&n.isVisible&&as.activateTree(n)}}if(this.isDisposed)return;if(Ye(this)){const t=this.element;if(t&&t.isConnected)this.motif.options.transition.enterTransition(()=>{});else{const t=this._base._enterSeq;queueMicrotask(()=>{!this.isDisposed&&this.isVisible&&this.motif.options?.transition&&this._base._enterSeq===t&&this.motif.options.transition.enterTransition(()=>{})})}}else Ge(this);if(t)try{(s=i?this.motif.options.cache:this.element).nodeType===Node.TEXT_NODE?s.appendData(e.textContent):s.appendChild?s.appendChild(e):s.append(e)}catch(t){}if(n.length)try{n.forEach(t=>t.activate())}catch{}i&&(this.motif.options.closeFragment=ln.createComment("]"),this.motif.options.cache.appendChild(this.motif.options.closeFragment),this.element.nodeType===Node.COMMENT_NODE&&this.motif.options.closeFragment&&ti.set(this.element,this.motif.options.closeFragment)),this.isBuilt=!0,as.callBuilt(this),as.scheduleMounted(this)}finally{this._flags&=-2049}}}setState(){this.controls.forEach(t=>{t.setState()}),Bs(this)}reState(){Bs(this),this.controls.forEach(t=>{t.reState()})}setText(t){!this.isDisposed&&this.element&&(gi(t)?function(t,e){if(yi.has(t))return;yi.add(t),b("MJX204",[],{value:Array.isArray(e)?`ComponentBase[${e.length}]`:"ComponentBase"})}(this,t):this.element&&(this.element.textContent=t))}style(t){if(this.isDisposed)return this;const e=this.element?.style;if(!e)return this;if("function"==typeof t){this._stopStyleEffect();let e=[],s=!1;const i=()=>Mt(()=>{const i=t();if(this.isDisposed)return;const n=this.element?.style;if(n)if("string"==typeof i)n.cssText=i,e=[],s=!0;else if(i&&"object"==typeof i){s&&(n.cssText="",s=!1);for(const t of e)if(!(t in i))try{n[t]=""}catch{}Object.assign(n,i),e=Object.keys(i)}else{s&&(n.cssText="",s=!1);for(const t of e)try{n[t]=""}catch{}e=[]}});let n=i();const o=()=>{try{n()}catch{}},r={propertyName:"__style",dataSource:null,activate(){},reActivate(){o(),n=i()},deactivate(){o()}};try{this.bindings.add(r)}catch{}return this._styleFx={stop:o,binding:r},this}return"string"==typeof t?e.cssText=t:t&&"object"==typeof t&&Object.assign(e,t),this}_stopStyleEffect(){const t=this._styleFx;if(t){this._styleFx=void 0;try{t.stop()}catch{}try{this.bindings.remove(t.binding)}catch{}}}_addHandler(t,e){this.motif.on(t,e)}async _show(){if(this.isDisposed||!this.element)return;if(this.isVisible)return;if(this.isWait)return;if(this.parent&&"out-in"===Ke(this.parent)){const t=this.motif.options.placeholder?.parentNode??Li(this.parent)?.element,e=Je(t,this.element);if(e){const t=this._base._showSeq=(this._base._showSeq??0)+1;return e.then(()=>{if(!this.isDisposed&&this._base._showSeq===t)return this._show()})}}qe(this)?.activeAnimations?.length&&u(async()=>{await Promise.all(this.motif.options.transition.activeAnimations.map(t=>t.finished?.catch(()=>{})))},"show.waitForLeaveAnimations");if("detach"===this._computeHideStrategy()){if(as.callVisibilityChanged(this,!0),this.isDisposed)return;const t=!this._isInDom()&&this.parent&&this.parent.isBuilt&&!this.isWait;return this.isVisible=!0,void(t&&as.internalBuild.call(this.parent,this))}{const e=this.motif.options.placeholder?.parentElement,s=Li(this.parent)?.element;if(this.motif.options.placeholder&&e&&e!==s){if(b("MJX106",[]),as.callVisibilityChanged(this,!0),this.isDisposed)return;return this.isVisible=!0,void(this.parent?.isBuilt&&as.internalBuild.call(this.parent,this))}if(Ye(this)&&this.motif.options.transition.enterTransition(()=>{}),as.callVisibilityChanged(this,!0),this.isDisposed)return;if(this.element.nodeType===Node.COMMENT_NODE)return this.controls.items.filter(t=>!t.isBuilt).forEach(t=>as.internalBuild.call(this,t)),this.controls.forEach(t=>{t.motif.show()}),this.isVisible=!0,void as.activateTree(this,!1);if(!this.isBuilt)return void(this.isVisible=!0);var t=this.motif.options.placeholder?.parentElement;t&&(t.replaceChild(this.element,this.motif.options.placeholder),this.isVisible=!0,as.activateTree(this))}}async _hide(){if(this.isDisposed||!this.element)return;if(this._base._showSeq=(this._base._showSeq??0)+1,!this.isVisible)return;if("detach"===this._computeHideStrategy()){if(as.callVisibilityChanged(this,!1),this.isDisposed)return;return await this._base._detachDomWithAnimationAsync(),this.isVisible=!1,void as.deactivateTree(this)}{const t=this.motif.options.transition,e=!0===t.skipNextLeave;e&&(t.skipNextLeave=!1);const s=()=>{if(as.callVisibilityChanged(this,!1),!this.isDisposed){if(this.element.nodeType===Node.COMMENT_NODE)return this.controls.forEach(t=>{e&&t.isVisible&&t.element&&!t.isDisposed&&t.motif.options?.transition&&(t.motif.options.transition.skipNextLeave=!0),t.motif.hide()}),this.isVisible=!1,void as.deactivateTree(this,!1);var t=this.element.parentElement;t&&(this.motif.options.placeholder||(this.motif.options.placeholder=ln.createComment("h")),t.replaceChild(this.motif.options.placeholder,this.element)),this.isVisible=!1,as.deactivateTree(this)}};return e?void s():t.leaveTransition(s).finished}}_toggle(){!this.isDisposed&&this.element&&(this.isVisible?this.motif.hide():this.motif.show())}async _on(t,e,s=!0){if(this.isDisposed||!this.element)return this;const i=String(t);if(i.startsWith("x:")){const t=i.slice(2).toLowerCase();if("mounted"===t){let t;const s=ji(this.element,()=>{if(t&&(this._base._mountedSubs?.get(e)?.delete(t),this._disposables.detach(t)),this.isDisposed)return;const s={cancel:!1};w(()=>e.length<=1?e(s):e(this,s),"MJX122","x:mounted")});if(s){t=this._register(Xt(s));const i=this._base._mountedSubs??=new Map;let n=i.get(e);n||(n=new Set,i.set(e,n)),n.add(t)}return this}if(ei.has(t))return this._base.emiters.on("on"+t,e),this}const n=i.indexOf(":"),o=n<0?i:i.slice(0,n),r=n<0?Ps:i.slice(n+1).split(":"),a=o.startsWith("on")?o.slice(2).toLowerCase():o.toLowerCase();let c,l=s?Ts:0;r.length&&(c={},r.includes("once")&&(c.once=!0),r.includes("passive")&&(c.passive=!0),r.includes("capture")&&(c.capture=!0,l|=Os),r.includes("self")&&(l|=1),r.includes("trusted")&&(l|=2),r.includes("prevent")&&(l|=4),r.includes("stop")&&(l|=8));const h=new Rs(this,i.toLowerCase(),e,a,l);return s&&this.element.addEventListener(a,h,c),function(t,e){let s=t._eventHandlers;if(void 0!==s){for(;void 0!==s.next;)s=s.next;s.next=e}else t._eventHandlers=e}(this,h),this}async _trigger(t,e){if(this.isDisposed||!this.element)return this;const s=String(t).toLowerCase();return u(()=>{Ls++;try{for(let t=this._eventHandlers;void 0!==t;t=t.next)if(0===(t.flags&Ns)&&t.key===s)try{t.handleEvent(e)}catch{}}finally{Ls--}},"trigger"),this}async _off(t,e){if(this.isDisposed||!this.element)return this;const s=String(t).toLowerCase();if(s.startsWith("x:")){const t=s.slice(2);if("mounted"===t){const t=this._base._mountedSubs?.get(e);if(t){this._base._mountedSubs.delete(e);for(const e of t)this._disposables.delete(e)}return this}return ei.has(t)&&this._base._emiters?.off("on"+t,e),this}for(let t=this._eventHandlers;void 0!==t;t=t.next)if(0===(t.flags&Ns)&&t.key===s&&t.original===e){if(0!==(t.flags&Ts)){const e=t;u(()=>{this.element.removeEventListener(e.type,e,0!==(e.flags&Os))},"off.removeEventListener")}t.flags|=Ns;break}return 0===Ls&&function(t){let e,s;for(let i=t._eventHandlers;void 0!==i;i=i.next)0===(i.flags&Ns)&&(void 0===s?e=i:s.next=i,s=i);void 0!==s&&(s.next=void 0),t._eventHandlers=e}(this),this}dispose(t={deep:!0}){return this.isDisposed?Promise.resolve():this._disposing?this._disposing:(De(this),this._disposing=_s,this._disposing=this._disposeCore(t,!1))}async _disposeCore(t,e){let s;if(xs(this,t,e),e||qe(this)?.skipNextLeave||(s=this._base._detachDomWithAnimationAsync()),await void 0,0===Ee.live&&gs(this,!0)){const i=function(t,e,s,i){const n={deep:e?.deep},o=[t],r=[-1];let a=null;i||ds(t);for(let e=0;e<o.length;e++){const s=o[e];if(s.isDisposed)continue;const i=Ks(s);if(0===i.length)continue;const c=Array.from(i);for(let s=0;s<c.length;s++){const i=c[s];if(!i.isDisposed)if(i._disposing)(a??=[]).push(i._disposing);else try{De(i),i._disposing=t._disposing,xs(i,n,!0),!1!==i.element?.isConnected&&ds(i),o.push(i),r.push(e)}catch(t){v("MJX107",t)}}}const c=o.length;if(c>1){const t=new Array(c).fill(0);for(let e=c-1;e>=1;e--){const s=r[e];t[e]+1>t[s]&&(t[s]=t[e]+1)}const e=[];for(let t=1;t<c;t++)e.push(t);e.sort((e,s)=>t[e]-t[s]||e-s);for(let t=0;t<e.length;t++)try{Ds(o[e[t]],n,!0)}catch(t){v("MJX107",t)}}return a||(!s&&t.isDisposed||Ds(t,e,s),null)}(this,t,e,void 0!==s);if(i){if(await Promise.all(i),!e&&this.isDisposed)return;Ds(this,t,e)}return}await As(this,t,e,s)}disposeAsync(t={deep:!0}){return this.isDisposed?Promise.resolve():this._disposing?this._disposing:(De(this),this._disposing=_s,this._disposing=this._disposeCore(t,!0))}async _clear(){1!=this.isDisposed&&(this.motif.options&&this.motif.options.disableDisposal||await this.controls.clearAsync())}using(t,e,s){t.then(t=>{this&&!this.isDisposed&&e&&e(t)},t=>{this&&!this.isDisposed&&s&&s(t)})}doWork(t){return Promise.resolve(t).then(t=>this&&!this.isDisposed?t:y("MJX108"))}get siblings(){return this._siblingsSet||this.isDisposed&&!this.motif?.options?this._siblingsApi:this._siblingsApi??=this._createSiblingsApi()}set siblings(t){this._siblingsApi=t,this._siblingsSet=!0}_createSiblingsApi(){return{all:()=>this.parent?.controls.items,next:()=>{if(!this.parent)return;const t=this.parent.controls.items.indexOf(this);return this.parent.controls.items[t+1]},prev:()=>{if(!this.parent)return;const t=this.parent.controls.items.indexOf(this);return this.parent.controls.items[t-1]},nextAll:()=>{if(!this.parent)return;const t=this.parent.controls.items.indexOf(this);return this.parent.controls.items.slice(t+1)},prevAll:()=>{if(!this.parent)return;const t=this.parent.controls.items.indexOf(this);return this.parent.controls.items.slice(0,t)}}}get serviceProvider(){let t=this;for(;t;){const e=t.provider;if(e)return e;const s=ys.get(t);if(s)return"disposed"===s.state?null:s.provider;t=t.parent}try{return Zo.main?.provider??null}catch{return null}}getService(t){try{const e=this.serviceProvider;if(e)return e._getFor(this,t);b("MJX407",[Be(t)],{token:t})}catch(e){b("MJX408",[Be(t),String(e?.message??e)],{token:t,error:e})}return null}$(t){return this.isDisposed||!this.element?{fromDom:()=>null,fromComponent:()=>[]}:{fromDom:()=>{var e,s=Li(this)?.element;return(e=s||document)?e.querySelectorAll(t):null},fromComponent:()=>{const e=Li(this),s=[],i=e=>{const n=e.element;if(n&&n.nodeType===Node.ELEMENT_NODE){const i=n.matches||n.msMatchesSelector||n.webkitMatchesSelector;if("function"==typeof i)try{i.call(n,t)&&s.push(e)}catch{}}if(e.controls&&e.controls.items&&e.controls.items.length)for(const t of e.controls.items)i(t)};return i(e??this),s}}}async _stopAnimations(){const t=qe(this);try{t?.activeCssCancel?.()}catch{}try{if(t?.activeAnimations?.length)try{await Promise.all(t.activeAnimations.map(t=>t.finished?.catch(()=>{})))}catch{}}catch(t){}this.isDisposed||t&&(t.activeAnimations=[])}}function oi(t,e=[]){return!t||t.isDisposed||("TransportTo"===t.constructor.name&&e.push(t),t.controls&&t.controls.items&&t.controls.items.forEach(t=>oi(t,e))),e}Object.defineProperty(ni.prototype,"motif",{...Object.getOwnPropertyDescriptor(ni.prototype,"motif"),set(t){this._motif=t}});const ri=new WeakMap;function ai(t,e){const s=(Array.isArray(e)?e:[e]).filter(t=>"function"==typeof t);if(0===s.length)return s;let i=ri.get(t);i||(i=new Set,ri.set(t,i));const n=[];for(const t of s)i.has(t)||(i.add(t),n.push(t));return n}function ci(t,e){Array.isArray(e)&&e.some(t=>t instanceof ni)&&t.motif.setDisposable(()=>{for(const t of e)t instanceof ni&&!t.isDisposed&&!t.parent&&t.dispose()})}const li=t=>"function"==typeof t||Array.isArray(t);function hi(t,e){const s=[];if(!t||"object"!=typeof t)return s;Object.prototype.hasOwnProperty.call(t,"ref")&&(li(t.ref)?(s.push(t.ref),delete t.ref):e&&t.ref&&"object"==typeof t.ref&&(t.ref=e));const i=t.runover;if(i&&"object"==typeof i&&Object.prototype.hasOwnProperty.call(i,"ref"))if(li(i.ref)){s.push(i.ref);const e={...i};delete e.ref,t.runover=e}else e&&i.ref&&"object"==typeof i.ref&&(i.ref=e);return 0===s.length?s:[].concat(...s)}const ui={initializecomponent:"_initializeComponentHandlers",oninitializecomponent:"_onInitializeComponentHandlers",onbuilding:"_onBuildingHandlers",onbuilt:"_onBuiltHandlers",onmounted:"_onMountedHandlers",oninitializing:"_onInitializingHandlers",oninitialized:"_onInitializedHandlers",onconfig:"_onConfigHandlers",onconfigured:"_onConfiguredHandlers",onvisibilitychanged:"_onVisibilityChangedHandlers",onactivated:"_onActivatedHandlers",ondeactivated:"_onDeactivatedHandlers",ondisposing:"_onDisposingHandlers",ondisposed:"_onDisposedHandlers"};function di(t,e,s){const i=Object.prototype.hasOwnProperty.call(ui,e)?ui[e]:void 0;if(!i)return!1;const n=Array.isArray(s)?s:[s];if(0===n.length||!n.every(t=>"function"==typeof t))return!1;const o=t;let r=0;if("_initializeComponentHandlers"===i&&(void 0!==o._init||o._baseCtx?._initializeComponentHandlers||(o._init=n[0],r=1)),r>=n.length)return!0;const a=o._base;for(let t=r;t<n.length;t++){const e=n[t];if("_initializeComponentHandlers"===i&&e===o._init)continue;const s=a[i];void 0===s?a[i]=e:"function"==typeof s?s!==e&&(a[i]=[s,e]):s.includes(e)||s.push(e)}return!0}function pi(t,e){if(t){var s=Object.keys(t);return 0!==s.length&&(s.forEach(s=>{if("initializeComponent"==s||"oninitializeComponent"==s||s.startsWith("on")){if(di(e,s.toLowerCase(),t[s]))return void delete t[s]}else if("childs"==s){const i=[].concat(...t[s]);e.childs=i,ci(e,i),delete t[s]}else if("transition"===s)_i(t[s],e),delete t[s];else if(s.startsWith("on"))e.motif.on(s,t[s]);else if(s.startsWith("x-")){var i=s.replace("x-","on");if("x-wait"==s.toLowerCase())e.bindings.wait(t[s]);else if("x-display"==s.toLowerCase())e.bindings.display(t[s]);else if(di(e,i.toLowerCase(),t[s]))return void delete t[s];delete t[s]}else s.startsWith("runover")?(pi(t[s],e),delete t[s]):s.startsWith("preconfig")?(e.motif.options._preconfig=t[s],delete t[s]):"__childExpr"===s&&delete t[s]}),"object"==typeof t&&0===Reflect.ownKeys(t).length)}return!1}const fi=new WeakMap;function mi(t,e,s){const i=t.motif.options.transition;if("string"==typeof e&&e.length>0)i.name=e,s&&(i.classes=void 0);else if(e&&"object"==typeof e)if("string"==typeof e.name&&e.name.length>0&&(i.name=e.name),"mode"in e){const{mode:t,...s}=e;Fe(t)&&(i.mode=t),Object.keys(s).length>0&&(i.classes=s)}else i.classes=e;else s&&(i.name="",i.classes=void 0)}function _i(t,e){e&&!e.isDisposed&&null!=t&&fi.get(e)!==t&&(fi.set(e,t),"function"!=typeof t?mi(e,t,!1):e.bindings.watch(()=>{const s=t();e.isDisposed||mi(e,s,!0)}))}function gi(t){return t instanceof ni||Array.isArray(t)&&t.length>0&&t.every(t=>t instanceof ni)}const yi=new WeakSet;const vi=["hideStrategy","disableDisposal"];function wi(t,e){if(t&&"object"==typeof t&&e&&!e.isDisposed)for(const s of vi)void 0!==t[s]&&(e.motif.options[s]=t[s])}const bi=new Set(["ref","key","indexkey","inject","options","props","settings","isSvg","childs","initializeComponent","runover","transition","preconfig","nodes","onElementCreating"]),Si=new Set(["innerhtml","srcdoc"]),Ci=new Set(["href","src","action","formaction","xlink:href"]),Mi=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ki(t){if(null==t||"boolean"==typeof t)return!1;try{return Mi.test(String(t))}catch{return!1}}function xi(t,e){return()=>{let s=e();return"function"==typeof s&&(s=s()),"function"==typeof s&&(s=s()),ki(s)?(b("MJX125",[t]),null):s}}function Di(t,e){if(!t||"object"!=typeof t||e.isDisposed)return;const s=Object.keys(t);if(0===s.length)return;let i=null,n=null;for(const o of s){if(bi.has(o))continue;if(o.startsWith("x-")||o.startsWith("x:")||o.startsWith("__"))continue;let s=t[o];if(void 0===s)continue;if(/^on/i.test(o)){"function"==typeof s&&e.motif.on(o,s);continue}if("function"==typeof s&&s.length>0)continue;const r=o.toLowerCase();if(Si.has(r))b("MJX124",[o]);else{if(Ci.has(r))if("function"==typeof s)s=xi(o,s);else if(ki(s)){b("MJX125",[o]);continue}(n??=Ei(e)).set(o,s),"class"===o||"className"===o?e.class.add(s&&"object"==typeof s&&!Array.isArray(s)?[s]:s):"style"===o?e.style(s):"value"===o||"checked"===o||"selected"===o?e.bindings.add(o,s):(i??={})[o]=s}}i&&e.attr.add(i)}const Ai=new WeakMap;function Ei(t){let e=Ai.get(t);return e||(e=new Map,Ai.set(t,e)),e}const Oi=new Set(["class","className","style","id","tabindex","role"]);function Ti(t){return Oi.has(t)||t.startsWith("aria-")||t.startsWith("data-")}let Ni=!1;function Pi(t,e){if(!t||"object"!=typeof t||e.isDisposed)return;const s=Ai.get(e);let i=null;for(const e of Object.keys(t)){if(!Ti(e))continue;const n=t[e];null!=n&&("function"==typeof n&&n.length>0||s&&s.has(e)&&Object.is(s.get(e),n)||((i??={})[e]=n))}i&&Di(i,e)}function Li(t){return u(()=>!t||t.isDisposed?null:t.element.nodeType!==Node.COMMENT_NODE&&t.element.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&t.element.nodeType!==Node.TEXT_NODE?t:t.parent?Li(t.parent):null,"findAppendableComponent",null)}const Ri=new Set;let Xi=null;function Ii(){if(!Ri.size&&Xi){try{Xi.disconnect()}catch{}Xi=null}}function Ji(){for(const t of[...Ri])if(Ri.has(t)&&document.contains(t.element)){Ri.delete(t);try{t.callback()}catch(t){queueMicrotask(()=>{throw t})}}Ii()}function ji(t,e){if(document.contains(t))return e(),null;const s={element:t,callback:e};return Ri.add(s),Xi||(Xi=new MutationObserver(Ji),Xi.observe(document.documentElement,{childList:!0,subtree:!0})),()=>{Ri.delete(s)&&Ii()}}function Hi(t){!function(t){const e=ye.get(t);e&&(ye.delete(t),e.live&&e.scope._releaseLivePin(),me?._touch())}(t),as.activateTree(t)}function Fi(t){xe(t),as.deactivateTree(t)}const Bi=100;function zi(t,e){let s=t,i=0;for(;"function"==typeof s;){if(s.prototype instanceof ni)return new s(e);if(++i>Bi)return v("MJX112",void 0,Bi),s;s=s(e)}return s}const Wi="http://www.w3.org/2000/svg";class Vi extends ni{constructor(){const t=new.target;var e,s,i=arguments;if(1===i.length?e=i[0]:2===i.length&&(e=i[0],s=i[1]),e instanceof Function&&Qi(e=zi(e,s)))return sn(e,s);if(Array.isArray(e)){super(on(),{});var n=Object.create(s||{});for(const t in e){const s=e[t];this.controls.add(new Vi(s,n))}}else if("string"==typeof e&&e.trim().length>0)if(s||(s={}),s?.options&&s.options.isSvg||s?.__isSvgElement){const t=ln.createElementNS("http://www.w3.org/2000/svg",e,s);s.isSvg=!0,super(t,s)}else{super(ln.createElement(e,s),s)}else if(e instanceof Node)super(e,s);else{if(e instanceof ni)return e;{const i=e&&"object"==typeof e?e:s,n=function(t){try{const e=t?.elementTag;if("string"==typeof e){const t=e.trim();if(t)return t}}catch{}}(t);if(n){super(function(t,e,s){const i="string"==typeof e?.elementNamespace&&e.elementNamespace?e.elementNamespace:void 0;return i===Wi||!0===s?.options?.isSvg||!0===s?.__isSvgElement?(s&&"object"==typeof s&&(s.isSvg=!0),ln.createElementNS(i||Wi,t,s)):ln.createElement(t,s)}(n,t,i),i??{})}else super(on(),i??{});const o=this.childs;if(Array.isArray(o)&&o.length&&!0!==t?._placesChilds)for(const t of o)t&&this.controls.add(t)}}}}function $i(t){return e=>{var s=nn({...e});return s.controls.add(t(e)),s}}function Ui(t,e){if(t instanceof ni)for(const s of ai(t,e))w(()=>s(t),"MJX122","ref");return t}function qi(t,e){const s=t._base?.[e];return s?"function"==typeof s?[s]:s:[]}function Gi(t,e){return qi(t,e).length}function Ki(t,e,s,i){for(let n=s;n<Gi(t,e);n++){if(t.isDisposed)return;const s=qi(t,e)[n];w(()=>s(t,{cancel:!1}),"MJX122",i)}}function Yi(t,e,s){if("string"==typeof t){if("function"==typeof e){const s=new Vi(t);return s._init=e,s}if(1===s&&null!==e&&"object"==typeof e){const s=e.initializeComponent;if("function"==typeof s){const e=new Vi(t);return e._init=s,e}}if("text"===t&&e&&e.__childExpr){const t=function(t){if("function"!=typeof t)return;let e;try{e=At(t)}catch{return}return e instanceof ni||Array.isArray(e)&&e.length>0&&e.every(t=>t instanceof ni)?e:void 0}(e.__childExpr);if(void 0!==t)return t}return new Vi(t,e)}if(t instanceof ni||t instanceof Vi)return t;if("function"==typeof t){const s=t.prototype instanceof ni?[]:hi(e),i=zi(t,e);return"object"==typeof i&&null!==i&&"el"in i?Ui(sn(i,e),s):function(t,e,s){if(!e||"object"!=typeof e)return t;if(!(t instanceof ni))return t;Ui(t,s.concat(hi(e))),ci(t,e.childs),Pi(e,t),wi(e.options,t),Object.prototype.hasOwnProperty.call(e,"transition")&&_i(e.transition,t);const i=e.runover;if(!i||"object"!=typeof i)return t;const n=Gi(t,"_onConfigHandlers"),o=Gi(t,"_onInitializingHandlers"),r=Gi(t,"_onInitializedHandlers");if(pi(i,t),Ki(t,"_onInitializingHandlers",o,"onInitializing"),Ki(t,"_onInitializedHandlers",r,"onInitialized"),t.isConfigured){const e=t.motif.options?._preconfig;"function"==typeof e&&p(()=>e(t),"motifComponent.preconfig");for(let e=n;e<Gi(t,"_onConfigHandlers");e++){const s=qi(t,"_onConfigHandlers")[e];w(()=>s(t,{cancel:!1}),"MJX122","onConfig")}}return t}(i,e,s)}return"object"==typeof t&&null!==t&&"el"in t?sn(t,e):new Vi(t,e)}function Qi(t){return"object"==typeof t&&null!==t&&!(t instanceof ni)&&"el"in t}function Zi(t){return!t||"object"!=typeof t||t instanceof ni||null==t.default?t:t.default}function tn(t){if(null!==t&&"object"==typeof t&&!(t instanceof ni||Array.isArray(t)||t instanceof Node)&&"function"!=typeof t.then)throw y("MJX127",function(t){return null===t?"null":Array.isArray(t)?"array":"object"!=typeof t||"[object Module]"!==Object.prototype.toString.call(t)&&!t.__esModule?typeof t:"module"}(t))}function en(t,e){const s=zi(t,e);return Qi(s)?sn(s,void 0):s}function sn(t,e){const s="string"==typeof t.el?function(t){Ni=!0;try{return t()}finally{Ni=!1}}(()=>Yi(t.el,e)):Yi(t.el,e);return Object.getOwnPropertyNames(t).forEach(e=>{"el"!==e&&"ctor"!==e&&(s[e]=t[e])}),"function"==typeof t.ctor&&w(()=>t.ctor.call(s,e),"MJX122","ctor"),s}function nn(t){return new rn(t)}function on(){return ln.createComment("")}class rn extends Vi{constructor(t,e){super(on(),arguments.length<=1?t:e)}initializeComponent(t){const e=this.childs;if(Array.isArray(e)&&e.length)for(const t of e)t&&this.controls.add(t);p(()=>{const t=this.props?.nodes;if(Array.isArray(t)&&t.length)for(const e of t)e&&this.controls.add(e)},"Fragment.initializeComponent.props.nodes")}}const an=globalThis;function cn(){return an&&an.motifDom?an.motifDom.window.document:an.document}const ln={get window(){return an&&an.window?an.window:an&&an?an.motifDom.window:an},_created:new Map,document:cn(),createElement(t,e){const s=cn();if(!s)throw y("MJX101",t);if("text"===t)return s.createTextNode("");if(!this._created.has(t)){const i=s.createElement(t,e);this._created.set(t,i)}return this._created.get(t).cloneNode(!1)},createDocumentFragment(){try{var t=cn();if(t)return t.createDocumentFragment()}catch(t){h.reportSuppressed("dom.createDocumentFragment",t)}},createComment(t){try{return cn()?.createComment(t)}catch(t){h.reportSuppressed("dom.createComment",t)}},createTextNode(t){try{return cn()?.createTextNode(t)}catch(t){h.reportSuppressed("dom.createTextNode",t)}},querySelectorAll(t){try{return cn()?.querySelectorAll(t)}catch(t){h.reportSuppressed("dom.querySelectorAll",t)}},createElementNS(t,e,s){try{return cn()?.createElementNS(t,e,s)}catch(t){v("MJX103",t,e)}},convertToSvgElement(t){const e=t.tagName.toLowerCase(),s=document.createElementNS("http://www.w3.org/2000/svg",e);for(const e of t.attributes)s.setAttribute(e.name,e.value);for(;t.firstChild;)s.appendChild(t.firstChild);const i=t.parentNode;return i&&i.replaceChild(s,t),s},get body(){return cn()?.body}},hn=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;var un;function dn(t,e,...s){return function(t,e,s,...i){const n=hn.exec(e);if(!n)throw y("MJX102",e);const o=n[1]||"div";let r;return r=t!==un.HTML?ln.createElementNS(t,o):ln.createElement(o),n[3]&&(r.id=n[3]),n[4]&&(r.className=n[4].replace(/\./g," ").trim()),s&&Object.entries(s).forEach(([t,e])=>{void 0!==e&&(/^on\w+$/.test(t)?r[t]=e:"selected"===t?e&&r.setAttribute(t,"true"):r.setAttribute(t,e))}),r.append(...i),r}(un.HTML,t,e,...s)}!function(t){t.HTML="http://www.w3.org/1999/xhtml",t.SVG="http://www.w3.org/2000/svg"}(un||(un={}));class pn{constructor(t){this.owner=t,this.items=[]}add(){const t=arguments.length;if(0===t)return[];const e=arguments[0];if(1===t&&e instanceof ni)return e.isDisposed?[]:[this._insertOne(void 0,e)];const s=Array.from(arguments);if("number"==typeof s[0]&&s.length>1){const t=s[0],e=[].concat(...s.slice(1));return this.insert(t,...e)}{const t=[].concat(...s);return this.insert(void 0,...t)}}insert(t,...e){return[].concat(...e).filter(t=>null!=t&&!t.isDisposed).map(e=>this._insertOne(t,e))}_insertOne(t,e){"string"!=typeof(e=zi(e))&&"number"!=typeof e&&"boolean"!=typeof e&&"bigint"!=typeof e||(e=new Vi(ln.createTextNode(e),null)),rs(e),e.parent&&e.parent.controls.detach(e),null!=t&&t>=0?this.items.splice(t,0,e):ct(this.items,e),e.parent=this.owner;const s=e.__pendingLeave;return s?(this.onAddBeforeBuild&&!this.owner.isBuilt&&this.onAddBeforeBuild(e),s.promise.then(()=>{e.isDisposed||this.owner.isDisposed||e.parent!==this.owner||this.onAdd&&this.owner.isBuilt&&this.onAdd(e)}),e):(this.onAdd&&this.owner.isBuilt&&this.onAdd(e),this.onAddBeforeBuild&&!this.owner.isBuilt&&this.onAddBeforeBuild(e),e)}remove(t){var e=this.items.indexOf(t);if(e>-1){fn(this.items,e);try{t.dispose()}catch{}}}detach(t){const e=this.items.indexOf(t);return-1===e?Promise.resolve():(fn(this.items,e),t.isDisposed?Promise.resolve():(Ws(t,this.owner),t.parent=null,function(t,e){let s=()=>{};const i=new Promise(t=>{s=t});let n=1,o=!1;const r=()=>{if(!o){if(o=!0,t.__pendingLeave?.promise===i&&delete t.__pendingLeave,!t.isDisposed){try{yn(t)}catch(t){v("MJX117",t)}Fi(t)}try{e()}catch(t){v("MJX118",t)}s()}},a=()=>{n--,0===n&&r()},c=t=>{if(!t||t.isDisposed||!t.element||!t.isVisible||t.isWait)return;const e=t.element;if(e.nodeType===Node.COMMENT_NODE)return void t.controls.items.forEach(c);if(e.nodeType!==Node.ELEMENT_NODE)return;n++;let s=!1;const i=()=>{s||(s=!0,a())};try{const e=t.motif.options;if(!e[Te]&&!e.transitionOut)return void i();e.transition.leaveTransition(i)}catch{i()}};return t.__pendingLeave={promise:i,finish:r},c(t),a(),i}(t,()=>{this.onRemove&&this.onRemove(t)})))}silentDetach(t,e=!1){if(e)return void this.silentUnlink(t);const s=this.items.indexOf(t);if(-1!==s&&(fn(this.items,s),!t.isDisposed)){t.parent=null;try{yn(t)}catch(t){v("MJX117",t)}Fi(t)}}silentUnlink(t){const e=this.items.indexOf(t);-1!==e&&(fn(this.items,e),Ws(t,this.owner),t.parent=null)}async clearAsync(){const t=this.items.splice(0,this.items.length);await Promise.all(t.map(t=>t.dispose()))}clear(){this.items.splice(0,this.items.length).forEach(t=>{try{t.dispose()}catch{}})}get length(){return this.items.length}forEach(t){this.items.forEach(t)}map(t){return this.items.map(t)}move(t,e){if(!t||t.isDisposed)return;if(e===t)return;if(t.parent!==this.owner)return;if(e&&e.parent!==this.owner)return;const s=this.items.indexOf(t);if(-1===s)return;const i=e?this.items.indexOf(e):-1;if(e&&-1===i)return;if(e?i===s+1:s===this.items.length-1)return;if(this.items.splice(s,1),e){const s=this.items.indexOf(e),i=s>=0?s:this.items.length;this.items.splice(i,0,t)}else this.items.push(t);const n=mn(this.owner);if(!n||!ls(t,n))return;const o=e?this.items.indexOf(e):-1;gn(t,n,o>=0?function(t,e,s,i){for(let t=s;t<e.length;t++){const s=ls(e[t],i);if(s)return s}return _n(t)}(this.owner,this.items,o,n):_n(this.owner))}_reorder(t,e){const s=mn(this.owner);if(s){let i=_n(this.owner);for(let n=t.length-1;n>=0;n--){const o=t[n],r=ls(o,s);r&&(e.has(n)||gn(o,s,i),i=r)}}const i=this.items;for(let e=0;e<t.length;e++)i[e]=t[e]}moveToIndex(t,e){if(!t||t.isDisposed)return;if(!Number.isFinite(e))return;if(e<0&&(e=0),e>this.items.length&&(e=this.items.length),-1===this.items.indexOf(t))return;const s=e>=this.items.length?null:this.items[e];this.move(t,s)}}function fn(t,e){0===e?t.shift():t.splice(e,1)}function mn(t){let e=t;for(;e;){const t=e.element;if(t&&t.nodeType!==Node.COMMENT_NODE&&t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&t.nodeType!==Node.TEXT_NODE)return t;e=e.parent}return null}function _n(t){const e=t.element;return e&&e.nodeType===Node.COMMENT_NODE&&t.motif.options?.closeFragment||null}function gn(t,e,s){const i=ls(t,e);if(!i)return;if(i.nodeType!==Node.COMMENT_NODE||i!==t.element){try{e.insertBefore(i,s)}catch{}return}const n=i,o=t.motif.options?.closeFragment||null;if(!o){try{e.insertBefore(n,s)}catch{}return}s&&function(t,e,s){let i=t,n=1e4;for(;i&&n-- >0;){if(i===s)return!0;if(i===e)break;i=i.nextSibling}n<=0&&v("MJX120",void 0);return!1}(n,o,s)&&(s=o.nextSibling);const r=ln.createDocumentFragment&&ln.createDocumentFragment()||e.ownerDocument?.createDocumentFragment?.()||function(){try{return document.createDocumentFragment()}catch{return null}}();if(!r){let t=n,i=1e4;for(;t&&i-- >0;){const i=t.nextSibling;try{e.insertBefore(t,s)}catch{}if(t===o)break;t=i}return void(i<=0&&v("MJX119",void 0))}let a=n,c=1e4;for(;a&&c-- >0;){const t=a.nextSibling;try{r.appendChild(a)}catch{}if(a===o)break;a=t}c<=0&&v("MJX119",void 0);try{e.insertBefore(r,s)}catch{}}function yn(t){const e=t.element;if(!e)return;const s=t.motif.options;if(e.nodeType===Node.COMMENT_NODE&&e.parentNode){const t=s?.closeFragment||null,i=s.cache??(s.cache=ln.createDocumentFragment());let n=e,o=1e4;for(;n&&o-- >0;){const e=n.nextSibling;if(i.appendChild(n),!t||n===t)break;n=e}return}if(e.parentNode)return void e.parentNode.removeChild(e);const i=s?.placeholder;i&&i.parentNode&&i.parentNode.removeChild(i)}function vn(t){return Zi(t)}function wn(t){const e=t&&t.options||{},s=new kn,i=new Set,n=t=>{try{i.add(t)}catch{}return t},o=()=>{try{i.forEach(t=>{try{clearTimeout(t)}catch{}})}catch{}try{i.clear()}catch{}};try{s.motif.register(Xt(()=>o()))}catch{}const r=e.Placeholderview??e.Loaderview;null!=r&&s.navigate(en(r));const a=()=>{if(!e.timeoutMs&&!e.signal)return t.caller();const s=[t.caller()];return e.timeoutMs&&e.timeoutMs>0&&s.push(new Promise((t,o)=>{const r=n(setTimeout(()=>o(y("MJX110",e.timeoutMs)),e.timeoutMs));if(s[0].finally(()=>{try{clearTimeout(r),i.delete(r)}catch{}}).catch(()=>{}),e.signal){const t=()=>{try{clearTimeout(r),i.delete(r)}catch{}};try{e.signal.addEventListener("abort",t,{once:!0})}catch{}}})),e.signal&&s.push(new Promise((t,s)=>{if(e.signal.aborted)return void s(y("MJX111"));const i=()=>{e.signal.removeEventListener("abort",i),o(),s(y("MJX111"))};e.signal.addEventListener("abort",i,{once:!0})})),Promise.race(s)},c=function(t){return"number"==typeof t?{count:Math.max(0,Math.floor(t)),delayMs:500,whenOnline:!0}:t&&"object"==typeof t?{count:Math.max(0,Math.floor(t.count||0)),delayMs:Math.max(0,t.delayMs??500),whenOnline:!1!==t.whenOnline}:{count:0,delayMs:0,whenOnline:!1}}(e.retry),l=new Set;try{s.motif.register(Xt(()=>{l.forEach(t=>{try{t()}catch{}}),l.clear()}))}catch{}const h=t=>new Promise(s=>{let o=!1;const r=t=>{if(!o){o=!0,l.delete(a);try{d&&window.removeEventListener("online",d)}catch{}try{void 0!==u&&(clearTimeout(u),i.delete(u))}catch{}try{e.signal?.removeEventListener("abort",h)}catch{}s(t)}},a=()=>r(!1),h=()=>r(!1);let u,d=null;l.add(a);try{e.signal?.addEventListener("abort",h,{once:!0})}catch{}const p=()=>{u=n(setTimeout(()=>r(!0),c.delayMs*t))};c.whenOnline&&"undefined"!=typeof navigator&&!1===navigator.onLine&&"undefined"!=typeof window?(d=()=>{try{window.removeEventListener("online",d)}catch{}d=null,p()},window.addEventListener("online",d)):p()}),u=c.count>0?(async()=>{let t=0;for(;;)try{return await a()}catch(i){if(e.signal?.aborted||s.isDisposed||t>=c.count)throw i;t++;try{e.onRetry?.(t,i)}catch{}if(!await h(t)||e.signal?.aborted||s.isDisposed)throw i}})():a(),d=Date.now(),p=t=>{try{e.onError?.(t)}catch{}if(!e.signal?.aborted)if(null!=e.Fallbackview)s.navigate(en(e.Fallbackview));else{v("MJX126",t);try{s.motif.clear().catch(()=>{})}catch{}}},f=t=>{let e;try{e=en(t),tn(e)}catch(t){return void p(t)}s.navigate(e)};return u.then(t=>{if(e.signal?.aborted)return;const s=(e.mapResult??vn)(t),o=Date.now()-d,r=Math.max(0,e.minDelayMs??0),a=Math.max(0,r-o);if(a>0){const t=n(setTimeout(()=>{e.signal?.aborted||f(s)},a));if(e.signal){const s=()=>{try{clearTimeout(t),i.delete(t)}catch{}};try{e.signal.addEventListener("abort",s,{once:!0})}catch{}}}else f(s)}).catch(p),s}function bn(t,e){const s=t?.motif?.options;if(!s)return!1;const i=s.transition;return!!(("enter"===e?s.transitionIn:s.transitionOut)||i&&(i.classes||i.name&&i.name.length>0))}function Sn(t){if(t&&!t.isDisposed)if(Array.isArray(t))t.forEach(Sn);else{try{t.motif.options?.transition?.activeCssCancel?.()}catch{}try{const e=t.motif.options?.transition?.activeAnimations;Array.isArray(e)&&(e.forEach(t=>{try{t&&"function"==typeof t.cancel&&t.cancel()}catch{}}),e.length=0)}catch{}try{if(t.controls&&t.controls.items)for(const e of t.controls.items)Sn(e)}catch{}}}async function Cn(t,e={deep:!0}){if(!t)return;const s=Array.isArray(t)?t:[t];await Promise.all(s.map(async t=>{if(t&&!t.isDisposed)try{await t.dispose(e)}catch(t){v("MJX115",t)}}))}async function Mn(t,e,s=!1){if(t.isDisposed||null==e)return;if(null!==t.current&&t.current===e)return;const i=++t._latestNavigateId;t.isBusy=!0;const n=e=>{if(t.isDisposed)return;if(i!==t._latestNavigateId)return;const s=zi(e);t.current=s;try{Array.isArray(s)?t.controls.add(...s):t.controls.add(s)}catch(t){v("MJX114",t)}t.isBusy=!1,t.previouspage=s};if(!(t._navPending||null!==t.current||e instanceof Promise)){try{n(e)}catch(e){v("MJX114",e),t.isBusy=!1}return}t._navPending=(t._navPending??0)+1;const o=t._navLock??Promise.resolve();t._navLock=(async()=>{try{await o;try{t._navAbort?.abort()}catch{}t._navAbort=new AbortController;const r=t.current;if(r&&!s){Sn(r),Sn(t);const e=!!(i=r)&&(Array.isArray(i)?i.some(t=>!!t&&!t.isDisposed&&bn(t,"leave")):!i.isDisposed&&bn(i,"leave")),s=Cn(r);e?s.catch(()=>{}):await s}try{if(e instanceof Promise){const s=wn({caller:()=>e,options:{signal:t._navAbort?.signal}});n(s)}else n(e)}catch(e){v("MJX114",e),t.isBusy=!1}}finally{t._navPending=Math.max(0,(t._navPending??1)-1)}var i})(),await t._navLock}class kn extends Vi{constructor(t){super(ln.createComment(""),t),this.current=null,this._latestNavigateId=0,this._navLock=Promise.resolve(),this.isBusy=!1,t&&t.childs&&Array.isArray(t.childs)&&t.childs.length>0&&this.controls.add(t.childs)}async dispose(t={deep:!0}){await Cn(this.current,t),await super.dispose(t)}async flush(){await Cn(this.current)}async _clear(){await Cn(this.current)}async navigate(t,e=!1){await Mn(this,t,e)}async navigateLazy(t,e,s=!1){const i=wn({caller:t,options:e});await this.navigate(i,s)}}const xn=new Set;function Dn(t){xn.add(t),xn.forEach(t=>{t()})}const An=new Map,En=Symbol("changeBodyCollectionHandler");class On extends Vi{constructor(t){super(t);const e=t=>{this.motif.trigger("controladded",{control:t});var e=An.get(this.props.target);e&&(t.motif.options.ownerContentBlock=this,e.controls.add(t))};this.controls.onAdd=e,this.controls.onAddBeforeBuild=e,this.childs&&this.controls.add(...this.childs)}onConfigured(t,e){var s=An.get(this.props.target);s?(this.controls.items.forEach(t=>{t.motif.options.ownerContentBlock=this}),s.controls.add(...this.controls.items)):this.context.on(En,()=>{var t=An.get(this.props.target);t&&(this.controls.items.forEach(t=>{t.motif.options.ownerContentBlock=this}),t.controls.add(...this.controls.items))})}onDisposing(t,e){var s=An.get(this.props.target);if(s)for(const t of[...s.controls.items])t.motif.options.ownerContentBlock===this&&(s.controls.remove(t),b("MJX109",[],t))}}class Tn extends Vi{constructor(t){super(t),An.set(this.props.name,this),this.context.fire(En)}onDisposing(t){An.get(this.props.name)===this&&An.delete(this.props.name)}}const Nn=Symbol("slotRegistered"),Pn=Symbol("slotUnregistered");class Ln{static{this.slots=new Map}static registerSlot(t,e){this.slots.set(t,e),Zo.main.fire(Nn,{name:t,slot:e})}static unregisterSlot(t,e){this.slots.get(t)===e&&(this.slots.delete(t),Zo.main.fire(Pn,{name:t,slot:e}))}static getSlot(t){return this.slots.get(t)}}class Rn extends Vi{constructor(t){super(t),this.mode=t.mode||"replace"}initializeComponent(t){Ln.registerSlot(this.props.name,this),this.onDisposing=()=>{[...this.controls.items||[]].forEach(t=>{this.controls.remove(t),t.dispose?.()}),Ln.unregisterSlot(this.props.name,this)}}clearSlot(){[...this.controls.items||[]].forEach(t=>{this.controls.remove(t),t.dispose?.()})}}class Xn{static transport(t,e,s={}){t&&e&&(t.parent===e&&e.controls.items.includes(t)||(t.parent&&t.parent!==e&&t.parent.controls.silentDetach(t,!0),s.owner&&(t.motif.options.ownerTransporter=s.owner),"number"==typeof s.index?e.controls.items.includes(t)||e.controls.items.splice(s.index,0,t):e.controls.items.includes(t)||e.controls.add(t),t.parent=e,s.keepState||t.reState()))}static transportMany(t,e,s={}){Array.isArray(t)&&t.forEach(t=>this.transport(t,e,s))}static createSlot(t,e){return{name:t,children:[],parent:e,mount(t,e={}){if(!this.parent)throw y("MJX113");this.children.includes(t)||(Xn.transport(t,this.parent,e),this.children.push(t))},unmount(t){if(!this.parent)throw y("MJX113");this.children=this.children.filter(e=>e!==t),this.parent.controls.remove(t)},detachAll(){this.parent&&(this.children.forEach(t=>{this.parent.controls.remove(t)}),this.children=[])}}}}class In extends Vi{constructor(t){super("div",t),this._transported=[],this._countedLive=!1,this._handleSlotChange=t=>{if(t.name===this.props.name){const e=t.slot;"merge"!==e.mode&&e.clearSlot?.();const s=[...this.childs||[],...this.controls.items];Xn.transportMany(s,e),this._rememberTransported(s)}},this._clearChildrenFromSlot=t=>{(this.childs||[]).forEach(e=>{t.controls.remove(e),e.dispose()}),(this.controls.items||[]).forEach(e=>{t.controls.remove(e),e.dispose()})},Ee.live++,this._countedLive=!0}_rememberTransported(t){const e=this._transported.filter(t=>!t.isDisposed);for(const s of t)e.includes(s)||e.push(s);this._transported=e}initializeComponent(t){let e=Ln.getSlot(this.props.name);if(e){"merge"!==e.mode&&e.clearSlot?.();const t=[...this.childs||[],...this.controls.items];Xn.transportMany(t,e),this._rememberTransported(t)}this._slotRegisteredListener=Zo.main.on(Nn,this._handleSlotChange),this._slotUnregisteredListener=Zo.main.on(Pn,t=>{t.name===this.props.name&&this._clearChildrenFromSlot(t.slot)}),this._onAddRef=t=>{this.motif.trigger("controladded",{control:t});const e=Ln.getSlot(this.props.name);e&&(Xn.transport(t,e),this._rememberTransported([t]))},this._onRemoveRef=t=>{const e=Ln.getSlot(this.props.name);e&&e.controls.remove(t),this._transported=this._transported.filter(e=>e!==t)},this.controls.onAdd=this._onAddRef,this.controls.onRemove=this._onRemoveRef}onDisposing(t,e){this._countedLive&&(this._countedLive=!1,Ee.live--);const s=Ln.getSlot(this.props.name);for(const t of this._transported||[])s?.controls.remove(t),t.dispose();this._slotRegisteredListener&&(Zo.main.off(Nn,this._handleSlotChange),this._slotRegisteredListener=void 0),this._slotUnregisteredListener&&(Zo.main.off(Pn,this._slotUnregisteredListener),this._slotUnregisteredListener=void 0),this.controls.onAdd===this._onAddRef&&(this.controls.onAdd=void 0),this.controls.onRemove===this._onRemoveRef&&(this.controls.onRemove=void 0),this._onAddRef=void 0,this._onRemoveRef=void 0,this._transported=[]}}const Jn=new Set(["push","pop","shift","unshift","splice","reverse","sort"]),jn=Symbol(""),Hn=new Map([[x.IS_REACTIVE,()=>!0],[x.IS_READONLY,t=>t.isReadonly],[x.IS_SUPERFICIAL,t=>t.superficial],[x.GET_SETUP,(t,e)=>e],[x.RAW,(t,e,s)=>t.ReactiveMap().get(e)===s?e:jn]]);function Fn(t,e,s,i){if("symbol"!=typeof s)return jn;const n=Hn.get(s);return void 0===n?jn:n(t,e,i)}function Bn(t){return function(e,s,i){const n=Fn(t,e,s,i);if(n!==jn)return n;if(Array.isArray(e)&&!t.isReadonly){const i=t.arrayMethods.get;if(T(i,s)){const t=i[s];return Jn.has(s)?(o=s,B.push(E),E.enabled=!0,E.key=o):vt(e,s),t}}var o;const r=Reflect.get(e,s,i);return"__proto__"===s||L(s)?r:(t.isReadonly||vt(e,s),t.superficial||!N(r)?r:t.reactive(r))}}function zn(t){return function(e,s,i,n){if(null!=(o=e)&&Boolean(o[x.IS_READONLY]))return!1;var o;const r=Array.isArray(e),a=e[s],c=r?e.length:0,l=r&&("string"==typeof(h=s)&&X.test(h)&&String(Number(h))===h);var h;const u=l?Number(s)<c:T(e,s),d=Reflect.set(e,s,i,n);if(t.onValueChanged)try{t.onValueChanged({raw:e,proxy:n},s)}catch{}if(O(e)!==O(n))return d;if(!r&&u&&Object.is(i,a))return d;if(wt(e,s),r||u||wt(e,D),l&&!u&&wt(e,"length"),r&&"length"===s){for(let t=Number(i);t<c;t++)wt(e,String(t))}return function(){const t=B.pop();E=B.length>0?void 0===t?{enabled:!1,key:""}:t:{enabled:!1,key:""}}(),d}}function Wn(t){return function(t){return vt(t,Array.isArray(t)?"length":D),Reflect.ownKeys(t)}}function Vn(t){return function(t,e){const s=Reflect.has(t,e);return L(e)||vt(t,e),s}}function $n(t){return function(t,e){H();try{const s=T(t,e),i=Reflect.deleteProperty(t,e);return s&&(Array.isArray(t)?wt(t,"length"):(wt(t,e),wt(t,D))),i}finally{F()}}}const Un=[["includes","lookup"],["indexOf","lookup"],["lastIndexOf","lookup"],["sort","order"],["concat","join"],["push","structural"],["pop","structural"],["shift","structural"],["unshift","structural"],["splice","structural"],["reverse","structural"]];class qn{constructor(t){this.engine=t,this.get=this.createArrayMethods()}createArrayMethods(){const t={};for(const[e,s]of Un)t[e]=this.patch(e,s);return t}patch(t,e){const s=this;switch(e){case"lookup":return function(...e){const i=O(this);s.engine.track(i,"length");const n=i[t](...e);return!1!==(o=n)&&-1!==o?n:i[t](...e.map(t=>O(t)));var o};case"order":return function(...e){const i=O(this),n=this.length;for(let t=0;t<n;t++)s.engine.track(i,String(t));const o=i[t].apply(this,e);return s.engine.track(i,t),o};case"join":return function(...t){return Array.prototype.concat.apply(this,t)};default:return function(...e){H();const s=O(this);try{return s[t].apply(this,e)}finally{F()}}}}}const Gn=Symbol("");function Kn(t,e,s){wt(t,e),wt(t,D),s&&wt(t,Gn)}function Yn(t,e){return t.has(e)?e:O(e)}function Qn(t,e){return{next(){const s=t.next();return s.done?s:{value:e(s.value),done:!1}},[Symbol.iterator](){return this}}}function Zn(t){const e=function(t){const e=e=>N(e)?t.reactive(e):e,s=t=>t instanceof Map?([t,s])=>[t,e(s)]:([t])=>{const s=e(t);return[s,s]};return{get(t){const s=O(this),i=Yn(s,t);return vt(s,i),e(s.get(i))},has(t){const e=O(this),s=Yn(e,t);return vt(e,s),e.has(s)},set(t,e){const s=O(this),i=Yn(s,t),n=O(e),o=s.has(i),r=s.get(i);return s.set(i,n),o?Object.is(r,n)||Kn(s,i,!1):Kn(s,i,!0),this},add(t){const e=O(this),s=Yn(e,t);return e.has(s)||(e.add(s),Kn(e,s,!0)),this},delete(t){const e=O(this),s=Yn(e,t),i=e.delete(s);return i&&Kn(e,s,!0),i},clear(){const t=O(this);if(0===t.size)return;const e=Array.from(t.keys());t.clear();for(const s of e)wt(t,s);wt(t,D),wt(t,Gn)},forEach(t,s){const i=O(this);vt(i,D);const n=this,o=i instanceof Map;i.forEach((i,r)=>{const a=e(i);t.call(s,a,o?r:a,n)})},keys(){const t=O(this);return t instanceof Map?(vt(t,Gn),t.keys()):(vt(t,D),Qn(t.keys(),e))},values(){const t=O(this);return vt(t,D),Qn(t.values(),e)},entries(){const t=O(this);return vt(t,D),Qn(t.entries(),s(t))},[Symbol.iterator](){const t=O(this);return vt(t,D),t instanceof Map?Qn(t.entries(),s(t)):Qn(t.values(),e)}}}(t);return{get(s,i,n){const o=Fn(t,s,i,n);if(o!==jn)return o;if("size"===i)return vt(s,D),s.size;if(("string"==typeof i||i===Symbol.iterator)&&T(e,i)&&i in s)return e[i];const r=Reflect.get(s,i,s);return"function"==typeof r?r.bind(s):r}}}const to=new WeakSet,eo=new WeakMap;const so=new class{startGc(t=1e4){}stopGc(){if(this._gci){try{clearInterval(this._gci)}catch{}this._gci=void 0}}constructor(){this.DisposeMapper=new Q,this.arrayTriggerCache=new Map,this.ReactiveMap=()=>eo,this.isReadonly=!1,this.superficial=!1,this.arrayMethods=new qn(this),this.arrayHandler={get:Bn(this),set:zn(this),has:Vn(),deleteProperty:$n(),ownKeys:Wn()},this.deepHandler={get:Bn(this),set:zn(this),has:Vn(),deleteProperty:$n(),ownKeys:Wn()},this.collectionHandler=Zn(this),to.add(this),this.startGc()}reactive(t){N(t)||(t={value:t});const e=(s=t,i=Object.getPrototypeOf(s),n="",i&&i.constructor&&(n=i.constructor.name),"Control"===n||"RouteManager"==n||"ServiceManager"==n?0:Object.isExtensible(s)?R.get(Object.prototype.toString.call(s))??0:0);var s,i,n;if(0===e)return t;let o=eo.get(t);if(o)return o;if(o=eo.get(O(t)),o)return o;if(2===e){var r=new Proxy(t,this.collectionHandler);return eo.set(t,r),r}if(Array.isArray(t)){r=new Proxy(t,this.arrayHandler);return eo.set(t,r),r}r=new Proxy(t,this.deepHandler);return eo.set(t,r),r}clearModel(t){null!=t&&null!=t&&(Object.keys(t).forEach(e=>{"object"==typeof t[e]&&(eo.has(t[e])||eo.has(O(t[e])))&&this.clearModel(t[e]),eo.delete(O(t[e])),eo.delete(t[e])}),eo.delete(O(t)),eo.delete(t))}track(t,e){vt(t,e)}trigger(t,e,s){wt(t,e)}ArrayTrigger(t,e,...s){this.trigger(t,e,s)}toRaw(t){return JSON.parse(JSON.stringify(this.deepClone(t)))}deepClone(t){var e,s=this;if(!t)return t;if([Number,String,Boolean].forEach(function(s){t instanceof s&&(e=s(t))}),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach(function(t,i,n){e[i]=s.deepClone(t)});else if("object"==typeof t)if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var i in e={},t)e[i]=s.deepClone(t[i]);else e=t;return e}pauseTracking(){H()}enableTracking(){j(!0)}resetTracking(){F()}dispose(){var t=!0;for(this.stopGc();1==t;)if(this.DisposeMapper.size>0){const t=this.DisposeMapper.pop();eo.delete(t)}else t=!1;this.DisposeMapper.clear(),to.delete(this)}},io=[],no=()=>{try{const t=globalThis;return!!t.__MOTIF_DEV__&&(t.__MOTIF_STORE_REGISTRY__!==io&&(t.__MOTIF_STORE_REGISTRY__=io),!0)}catch{return!1}};function oo(t){const e=so.reactive(t);try{if(no()){const s=t?.constructor?.name||"reactive";io.push({name:s,value:e,type:"reactive"}),io.length>200&&io.shift()}}catch{}return e}function ro(t){const e=so.reactive(t);try{if(no()){const s=t?.constructor?.name||"useModel";io.push({name:s,value:e,type:"reactive"}),io.length>200&&io.shift()}}catch{}return e}function ao(t){return so.clearModel(t)}function co(t){return so.deepClone(t)}function lo(t){const e=new ce(t);try{if(no()){const t=`signal_${io.length}`;io.push({name:t,value:e.value,type:"signal"}),io.length>200&&io.shift()}}catch{}return e}function ho(t){const e=new le(t);try{if(no()){const t=`computed_${io.length}`;io.push({name:t,value:e.value,type:"computed"}),io.length>200&&io.shift()}}catch{}return e}function uo(t){const e=new he(t);try{if(no()){const t=`lazyComputed_${io.length}`;io.push({name:t,value:void 0,type:"computed"}),io.length>200&&io.shift()}}catch{}return e}class po extends Vi{constructor(t){super("div",t),this._cache=new Map,this._view=[],this._occurrence=[],this._occurrenceKeys=new WeakMap,this._isLoadingMore=!1,this._emptyRendered=!1,this._renderPending=!1,this.contentWrapper=new Vi,this._initialLoadStarted=!1,this._offsets=null,this._observedHeight=-1,this._loadSeq=0,this._reloadScheduled=!1,this._reloadTimes=[],this._handleScroll=(t,e)=>{if(this.renderViewport(),!1===this.props.autoLoad)return;if(!this._state.hasMore||this._isLoadingMore||!this._state.isInitialized)return;const s=this.wrapper.element,i=this._fixedHeight();(null!==i?this._state.data.length*i:this._offsetOf(this._view.length))-(s.scrollTop+s.clientHeight)<(this.props.autoLoadThreshold??100)&&this._loadMore()},t.className&&this.class.add(t.className),t.style&&Object.assign(this.element.style,t.style),this._state=this.useModel({isLoading:!1,isInitialized:!1,currentPage:0,totalCount:0,hasMore:!0,error:void 0,data:[]}),this._loadMore=this._loadMore.bind(this),this._renderLoadingState=this._renderLoadingState.bind(this),this._renderErrorState=this._renderErrorState.bind(this),this._renderEmptyState=this._renderEmptyState.bind(this),this._loadInitial=this._loadInitial.bind(this),this.renderViewport=this.renderViewport.bind(this),this._makeView()}_makeView(){this._topSpacer=new Vi("div"),this._topSpacer.element.style.cssText="height: 0px;",this._topSpacer.class.add("motif-virtualization-top-spacer"),this._bottomSpacer=new Vi("div"),this._bottomSpacer.element.style.cssText="height: 0px;",this._bottomSpacer.class.add("motif-virtualization-bottom-spacer"),this._virtualContent=new Vi(document.createComment("")),this.props.mainTemplate?(this.contentWrapper.controls.add(this._topSpacer,this._virtualContent,this._bottomSpacer),this.contentWrapper.onBuilding=t=>{var e=q(t.parent);e&&(this.wrapper=e,this._loadInitial(),e.style({overflowY:"auto",position:"relative"}),e.motif.on("scroll",this._handleScroll))},this.controls.add(this.props.mainTemplate(this.contentWrapper,this._state))):(this.wrapper=this,this.element.style.cssText="overflow-y: auto; height: 100%; position: relative;",this.controls.add(this._topSpacer,this._virtualContent,this._bottomSpacer),this.motif.on("scroll",this._handleScroll))}onBuilding(){this.props.mainTemplate||this._initialLoadStarted||(this._initialLoadStarted=!0,this._loadInitial())}onMounted(){this._observeResize(),this._renderPending&&this.renderViewport()}onDisposing(){this._stopResizeObserver(),this._stopDataWatch(),this._clearContent()}_fixedHeight(){const t=this.props.itemHeight;return"function"==typeof t?null:t}_computeOffsets(){const t=this.props.itemHeight;if("function"!=typeof t)return void(this._offsets=null);const e=this._view,s=new Array(e.length+1);s[0]=0;for(let i=0;i<e.length;i++){let n=0;try{n=Number(t(e[i],i))}catch{n=0}s[i+1]=s[i]+(n>0&&Number.isFinite(n)?n:0)}this._offsets=s}_layoutOffsets(){return this._offsets&&this._offsets.length===this._view.length+1||this._computeOffsets(),this._offsets}_offsetOf(t){const e=this._fixedHeight();if(null!==e)return t*e;const s=this._layoutOffsets();return s[Math.min(Math.max(0,t),s.length-1)]}_indexAt(t,e){const s=e.length-1;if(s<=0)return 0;let i=0,n=s-1;for(;i<n;){const s=i+n+1>>1;e[s]<=t?i=s:n=s-1}return i}_observeResize(){const t=this.wrapper?.element;if(!t||this._observed===t||this.isDisposed)return;const e=globalThis.ResizeObserver;if("function"!=typeof e)return;this._stopResizeObserver(),this._observedHeight=t.clientHeight;const s=new e(()=>{if(this.isDisposed)return;const e=t.clientHeight;e!==this._observedHeight&&(this._observedHeight=e,this.renderViewport())});s.observe(t),this._resizeObserver=s,this._observed=t}_stopResizeObserver(){try{this._resizeObserver?.disconnect()}catch{}this._resizeObserver=void 0,this._observed=void 0}_stopDataWatch(){this._dataWatchStop?.(),this._dataWatchStop=void 0}_request(t,e){const s=()=>{try{return Promise.resolve(this.props.dataRequest(t))}catch(t){return Promise.reject(t)}};if(!e||!1===this.props.autoRefresh)return At(s);let i;this._stopDataWatch();let n=!0;return this._dataWatchStop=Mt(()=>{if(n){n=!1;try{this.props.watch?.()}catch(t){v("MJX205",t)}i=s()}else this._scheduleReload()}),i}_scheduleReload(){this._reloadScheduled||this.isDisposed||(this._reloadScheduled=!0,queueMicrotask(()=>{if(this._reloadScheduled=!1,this.isDisposed)return;const t=Date.now();if(this._reloadTimes=this._reloadTimes.filter(e=>t-e<1e3),this._reloadTimes.push(t),this._reloadTimes.length>30)return this._stopDataWatch(),void b("MJX206",[]);this._state.isInitialized?this._reloadLoaded():this._loadInitial()}))}async _reloadLoaded(){const t=++this._loadSeq,e=this.props.pageSize||50,s=this._state.currentPage+1;try{const i=await this._request({page:0,pageSize:e*s,scrollTop:this.wrapper?.element?.scrollTop??0},!0);if(this.isDisposed||t!==this._loadSeq)return;const n=this.wrapper?.element,o=n?.scrollTop??0;this._state.currentPage=s-1,this._state.totalCount=i.totalCount,this._state.hasMore=i.hasMore,this._state.error=void 0,this._state.data=i.items,this._rebuildView(),this._topSpacer.style({height:"0px"}),this._bottomSpacer.style({height:this._offsetOf(this._view.length)+"px"}),this._clearContent(),n&&n.scrollTop!==o&&(n.scrollTop=o),this.renderViewport()}catch(e){if(this.isDisposed||t!==this._loadSeq)return;this._state.error=e,this._renderErrorState(e)}}async _loadInitial(){const t=++this._loadSeq;this._state.isLoading=!0,this._renderLoadingState();try{const e=this.props.pageSize||50,s=await this._request({page:0,pageSize:e,scrollTop:0},!0);if(this.isDisposed||t!==this._loadSeq)return;this._state.currentPage=0,this._state.totalCount=s.totalCount,this._state.hasMore=s.hasMore,this._state.isInitialized=!0,this._state.isLoading=!1,this._state.error=void 0,this._state.data=s.items,this._clearContent(),this._rebuildView(),this.renderViewport()}catch(e){if(this.isDisposed||t!==this._loadSeq)return;this._state.isLoading=!1,this._state.error=e,this._renderErrorState(e)}}async _loadMore(){if(this._isLoadingMore||!this._state.hasMore||!this._state.isInitialized)return;const t=this._loadSeq;try{this._isLoadingMore=!0;const e=this._state.currentPage+1,s=this.props.pageSize||50,i=await this._request({page:e,pageSize:s,scrollTop:this.wrapper?.element?.scrollTop??0},!1);if(this.isDisposed||t!==this._loadSeq)return;this._state.totalCount=i.totalCount,this._state.currentPage=e,this._state.hasMore=i.hasMore,this._state.error=void 0,this._state.data.push(...i.items),this._rebuildView(),this.renderViewport()}catch(e){if(this.isDisposed||t!==this._loadSeq)return;this._state.error=e,v("MJX207",e)}finally{this._isLoadingMore=!1}}_rebuildView(){this._view=this.props.filter?this.props.filter(this._state.data):this._state.data;const t=new Map;this._occurrence=this._view.map(e=>{if("object"!=typeof e||null===e)return 0;const s=t.get(e)??0;return t.set(e,s+1),s}),"function"==typeof this.props.itemHeight?this._computeOffsets():this._offsets=null}_clearContent(){if(!this._virtualContent)return;const t=this._virtualContent.controls;for(const e of this._cache.values())t.silentUnlink(e),e.isDisposed||e.dispose();this._cache.clear(),t.clear(),this._emptyRendered=!1}renderViewport(){if(this.isDisposed||!this.wrapper||!this._state.isInitialized)return;const t=this.wrapper.element;this._observeResize();const e=this._view,s=e.length;if(0===s)return this._emptyRendered||(this._clearContent(),this._renderEmptyState()),this._topSpacer.style({height:"0px"}),void this._bottomSpacer.style({height:"0px"});this._emptyRendered&&this._clearContent();const i=this._fixedHeight();let n,o,r,a,c;if(null!==i){const e=Math.floor(t.clientHeight/i);if(e<=0)return void(this._renderPending=!t.isConnected);this._renderPending=!1,n=Math.max(0,this.props.overscan??e);const l=Math.min(Math.max(0,Math.floor(t.scrollTop/i)),s-1);o=Math.max(0,l-n),r=Math.min(s,l+e+n),a=o*i,c=Math.max(0,s-r)*i}else{if(t.clientHeight<=0)return void(this._renderPending=!t.isConnected);this._renderPending=!1;const e=this._layoutOffsets(),i=Math.max(0,t.scrollTop),l=i+t.clientHeight,h=this._indexAt(i,e);let u=h;for(;u<s&&e[u]<l;)u++;const d=Math.max(1,u-h);n=Math.max(0,this.props.overscan??d),o=Math.max(0,h-n),r=Math.min(s,Math.max(u,h+1)+n),a=e[o],c=Math.max(0,e[s]-e[r])}const l=new Array(r-o),h=new Set;for(let t=o;t<r;t++){const s=this._rowFor(e[t],t);l[t-o]=s,h.add(s)}const u=this._virtualContent.controls.items;for(const t of u.slice())h.has(t)||this._detachRow(t);for(let t=0;t<l.length;t++){const e=l[t];u[t]!==e&&(e.parent===this._virtualContent&&this._detachRow(e),this._virtualContent.controls.insert(t,e))}this._topSpacer.style({height:a+"px"}),this._bottomSpacer.style({height:c+"px"}),this._evictCache(Math.max(200,3*(r-o))),!1!==this.props.autoLoad&&this._state.hasMore&&!this._isLoadingMore&&s<r+n&&this._loadMore()}_occurrenceKey(t,e){let s=this._occurrenceKeys.get(t);return s||(s=[],this._occurrenceKeys.set(t,s)),s[e]??={}}_rowFor(t,e){const s=this._occurrence[e]??0,i="object"==typeof t&&null!==t?0===s?t:this._occurrenceKey(t,s):e;let n=this._cache.get(i);if(n&&n.isDisposed&&(this._cache.delete(i),n=void 0),n)return this._cache.delete(i),this._cache.set(i,n),n;const o=this.props.itemTemplate(t,e);return n=o instanceof ni?o:new Vi(o),n.__listItemRef=t,this._cache.set(i,n),n}_detachRow(t){const e=this._virtualContent.controls;if(t.isDisposed)return void e.silentUnlink(t);const s=t.element;if(s.nodeType===Node.COMMENT_NODE){e.silentUnlink(t);const i=t.motif.options.closeFragment,n=t.motif.options.cache??(t.motif.options.cache=document.createDocumentFragment());let o=s;for(;o;){const t=o.nextSibling;if(n.appendChild(o),o===i)break;o=t}Fi(t)}else e.silentDetach(t)}_evictCache(t){const e=this.props.cacheSize??t;if(!(this._cache.size<=e))for(const[t,s]of this._cache){if(this._cache.size<=e)break;s.parent!==this._virtualContent&&(this._cache.delete(t),s.isDisposed||s.dispose())}}_renderLoadingState(){if(!this._virtualContent||!this.props.loadingTemplate)return;this._clearContent();const t=this.props.loadingTemplate(this._state);this._virtualContent.controls.add(t)}_renderEmptyState(){if(!this._virtualContent||!this.props.emptyTemplate)return;this._clearContent();const t=this.props.emptyTemplate();this._virtualContent.controls.add(t),this._emptyRendered=!0}_renderErrorState(t){if(this._virtualContent)if(this._clearContent(),this.props.errorTemplate){const e=this.props.errorTemplate(t);this._virtualContent.controls.add(e)}else v("MJX207",t);else v("MJX207",t)}refresh(){return this._state.data=[],this._state.currentPage=0,this._state.isInitialized=!1,this._state.hasMore=!0,this._rebuildView(),this._loadInitial()}setData(t){this._loadSeq++,this._stopDataWatch(),this._state.data=t,this._state.currentPage=0,this._state.totalCount=t.length,this._state.hasMore=!1,this._state.isInitialized=!0,this._state.isLoading=!1,this._state.error=void 0,this._clearContent(),this._rebuildView(),this.renderViewport()}scrollToIndex(t){if(!this.wrapper)return;const e=this._view.length,s=Math.min(Math.max(0,t),Math.max(0,e-1));this.wrapper.element.scrollTop=this._offsetOf(s),this.renderViewport()}getState(){return{...this._state}}}const fo=new Map;class mo{constructor(){this.descriptors=new Map}reset(){this.descriptors.clear()}addTransient(t,e){this._add(t,e,"transient")}addSingleton(t,e){this._add(t,e,"singleton")}addScoped(t,e){this._add(t,e,"scoped")}_add(t,e,s){const i={token:t,lifetime:s};if(e&&"object"==typeof e&&(e.useClass||e.useFactory||Object.prototype.hasOwnProperty.call(e,"useValue")||Array.isArray(e.deps))){i.useClass=e.useClass,i.useFactory=e.useFactory,i.useValue=e.useValue,i.deps=Array.isArray(e.deps)?e.deps:void 0;try{const s=[i.useClass?"useClass":null,i.useFactory?"useFactory":null,void 0!==i.useValue?"useValue":null].filter(Boolean);s.length>1&&b("MJX410",[this._tokenName(t),s.join(", ")],{token:t}),e.deps&&!Array.isArray(e.deps)&&b("MJX411",[this._tokenName(t)],{token:t})}catch{}if(i.useValue&&"function"==typeof i.useValue.then){const t=i.useValue;i.useFactory=async()=>await t,i.useValue=void 0}}else if("function"==typeof e){if(!function(t){try{return Reflect.construct(String,[],t),!0}catch{return!1}}(e))throw y("MJX413",this._tokenName(t));i.useClass=e}else if(e&&"function"==typeof e.then){const t=e;i.useFactory=async()=>await t}else i.useValue=e;this.descriptors.set(t,i)}_tokenName(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t?t.name||"[AnonymousClass]":String(t)}getDescriptor(t){const e=this.descriptors.get(t);if(e)return e;const s=fo.get(t);return s?(this._add(t,{useClass:t,deps:s.deps,useValue:void 0,useFactory:void 0},s.lifetime||"transient"),this.descriptors.get(t)||null):null}canAutoRegister(t){return!this.descriptors.has(t)&&fo.has(t)}getService(t){return this.getDescriptor(t)}buildServiceProvider(){return new Ae(this)}has(t){return this.descriptors.has(t)}remove(t){return this.descriptors.delete(t)}replace(t,e,s){const i=this.descriptors.get(t),n=s??i?.lifetime??"transient";this._add(t,e,n)}tryAddTransient(t,e){return!this.descriptors.has(t)&&(this._add(t,e,"transient"),!0)}tryAddSingleton(t,e){return!this.descriptors.has(t)&&(this._add(t,e,"singleton"),!0)}tryAddScoped(t,e){return!this.descriptors.has(t)&&(this._add(t,e,"scoped"),!0)}autoRegisterInjectables(){for(const[t,e]of fo.entries())this.descriptors.has(t)||this._add(t,{useClass:t,deps:e.deps,useValue:void 0,useFactory:void 0},e.lifetime||"transient")}}function _o(t,e){const s=(t||"").trim(),i=(e||"").trim(),n=s&&"/"!==s&&s.endsWith("/")?s.slice(0,-1):s;if("/"===i)return n||"/";const o=i?i.startsWith("/")?i:"/"+i:"";return n&&"/"!==n?n+o:o||"/"}class go{static{this.outlets=new Map}static register(t,e,s){this.outlets.has(t)||this.outlets.set(t,new Map),this.outlets.get(t).set(e,s)}static unregister(t,e){this.outlets.get(t)?.delete(e),0===this.outlets.get(t)?.size&&this.outlets.delete(t)}static find(t,e){if(e&&this.outlets.get(t)?.has(e))return this.outlets.get(t).get(e);const s=this.outlets.get(t);return s&&s.size>0?Array.from(s.values())[0]:null}static findAll(t){return Array.from(this.outlets.get(t)?.values()??[])}}const yo=Symbol.for("RouterView.built");class vo extends Vi{constructor(t){super(t),this._navLock=Promise.resolve(),this.disposingChilds=!1,this.current=null,this._latestNavigateId=0,this.isBusy=!1}get __isRouterView(){return!0}get scopeId(){let t=this.parent,e=[];for(;t;)e.push(t.constructor?.name??""),t=t.parent;return e.join(">")}async navigate(t,e=!1){await Mn(this,t,e)}async disposeTarget(t){await Cn(t)}onBuilt(){try{go.register(this.props.name??"default",this.scopeId,this);let t=this.parent;for(;t;)t.motif.trigger(yo,this),t=t.parent}catch{}}onDisposed(){try{go.unregister(this.props.name??"default",this.scopeId)}catch{}}}const wo="motifjs:scroll",bo=["wheel","touchstart","keydown","mousedown"];class So{constructor(t={},e){this.positions=new Map,this.currentKey="",this.currentPath=null,this.visited=!1,this.restoring=!1,this.cancelFrame=null,this.disarmAbort=null,this.offs=[],this.locationAnchor=!0,this.options=t,this.viewport=e??(t.container?function(t){const e=Co(),s=()=>{try{return"string"==typeof t?document.querySelector(t):"function"==typeof t?t()??null:t}catch{return null}};return{scrollTop:()=>{const t=s();return t?t.scrollTop||0:e.scrollTop()},scrollTo:t=>{const i=s();if(i)try{i.scrollTo({top:t,behavior:"instant"})}catch{try{i.scrollTop=t}catch{}}else e.scrollTo(t)},scrollToAnchor:(t,s)=>e.scrollToAnchor(t,s)}}(t.container):Co()),this.load();try{"undefined"!=typeof history&&"scrollRestoration"in history&&(history.scrollRestoration="manual")}catch{}"undefined"!=typeof window&&(this.offs.push(xo(window,"pagehide",()=>this.persistNow())),this.offs.push(xo(document,"visibilitychange",()=>{"hidden"===document.visibilityState&&this.persistNow()})))}leaving(){this.cancelRestore(),this.visited&&(this.remember(this.currentKey,this.viewport.scrollTop()),this.persist())}arrived(t,e){this.visited=!0;const{path:s,hash:i}=Mo(t),n=!!i&&s===this.currentPath&&("push"===e||"replace"===e||"traverse"===e);this.currentPath=s,this.currentKey=this.keyOf(s),this.restore(this.currentKey,!1===this.options.anchor?"":i||(this.locationAnchor?function(){try{const t=location?.hash??"";return t.length>1?ko(t.slice(1)):""}catch{return""}}():""),n)}saved(t){return this.positions.get(this.keyOf(Mo(t).path))??0}dispose(){this.cancelRestore(),this.persistNow();for(const t of this.offs.splice(0))t();this.positions.clear()}keyOf(t){return(this.options.key?this.options.key(t):t)||"/"}remember(t,e){const s=this.options.limit??60;for(this.positions.delete(t),this.positions.set(t,Math.max(0,Math.round(e)));this.positions.size>s;){const t=this.positions.keys().next();if(t.done)break;this.positions.delete(t.value)}}restore(t,e,s){this.cancelRestore();const i=this.positions.get(t)??0;if(!e&&i<=0)return void(!1!==this.options.top&&this.viewport.scrollTo(0));this.restoring=!0;const n=this.options.settleMs??1200,o=Date.now(),r=()=>{this.cancelFrame=null;if((e?this.viewport.scrollToAnchor(e,s):this.reached(i))||Date.now()-o>=n)return this.cancelRestore(),void this.remember(t,this.viewport.scrollTop());this.armAbort(),this.cancelFrame=function(t){if("function"!=typeof requestAnimationFrame){const e=setTimeout(t,16);return()=>clearTimeout(e)}const e=requestAnimationFrame(t);return()=>cancelAnimationFrame(e)}(r)};r()}reached(t){return this.viewport.scrollTo(t),this.viewport.scrollTop()>=t-1}armAbort(){if(this.disarmAbort||"undefined"==typeof window)return;const t=()=>this.cancelRestore(),e=bo.map(e=>xo(window,e,t,{passive:!0}));this.disarmAbort=()=>{for(const t of e)t()}}cancelRestore(){this.cancelFrame?.(),this.cancelFrame=null,this.disarmAbort?.(),this.disarmAbort=null,this.restoring=!1}persistNow(){this.visited&&!this.restoring&&this.remember(this.currentKey,this.viewport.scrollTop()),this.persist()}get storage(){if(!1===this.options.persist)return null;try{return"undefined"==typeof sessionStorage?null:sessionStorage}catch{return null}}persist(){const t=this.storage;if(t)try{t.setItem(wo,JSON.stringify([...this.positions]))}catch{}}load(){const t=this.storage;if(t)try{const e=t.getItem(wo);if(!e)return;const s=JSON.parse(e);if(!Array.isArray(s))return;for(const t of s){if(!Array.isArray(t)||"string"!=typeof t[0])continue;const e=Number(t[1]);Number.isFinite(e)&&e>0&&this.positions.set(t[0],e)}}catch{}}}function Co(){return{scrollTop:()=>{try{return window.scrollY||document.documentElement?.scrollTop||0}catch{return 0}},scrollTo:t=>{try{window.scrollTo({top:t,behavior:"instant"})}catch{try{window.scrollTo(0,t)}catch{}}},scrollToAnchor:(t,e)=>{try{const s=document.getElementById(t);if(!s)return!1;if(e)s.scrollIntoView();else try{s.scrollIntoView({behavior:"instant"})}catch{s.scrollIntoView()}return!0}catch{return!1}}}}function Mo(t){const e=t.indexOf("#");return e<0?{path:t,hash:""}:{path:t.slice(0,e)||"/",hash:ko(t.slice(e+1))}}function ko(t){try{return decodeURIComponent(t)}catch{return t}}function xo(t,e,s,i){try{return t.addEventListener(e,s,i),()=>{try{t.removeEventListener(e,s,i)}catch{}}}catch{return()=>{}}}const Do="motifjs:stack",Ao=30,Eo=t=>!!t&&1===t.nodeType&&!!t.style;function Oo(t,e){const s=t?.element;if(t&&!t.isDisposed&&Eo(s)){try{s.setAttribute("data-nav-direction",e)}catch{}t.motif.options.transition._markedDirection=!0}}function To(t){const e=t?.motif?.options?.transition;if(e?._markedDirection){e._markedDirection=!1;try{t.element?.removeAttribute?.("data-nav-direction")}catch{}}}function No(t){return t.getAttribute("style")}function Po(t,e){try{t.setAttribute("style",e??""),null===e&&t.removeAttribute("style")}catch{}}function Lo(t){const e=[];try{const s=t=>{const s=t.scrollTop||0,i=t.scrollLeft||0;(s||i)&&e.push([t,s,i])};s(t),t.querySelectorAll("*").forEach(s)}catch{}return e}function Ro(t){for(const[e,s,i]of t)try{e.scrollTop=s,e.scrollLeft=i}catch{}}function Xo(){try{return"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function Io(t,e,s,i){if("function"!=typeof t.animate||s<=0)return Promise.resolve();try{const n=t.animate(e,{duration:s,easing:"cubic-bezier(0.2, 0.8, 0.2, 1)",fill:"forwards"});return i.push(n),n.finished.then(()=>{},()=>{})}catch{return Promise.resolve()}}function Jo(t,e,s){t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.margin="0px",t.style.boxSizing="border-box";const i=e.getBoundingClientRect(),n=t.getBoundingClientRect();if(t.style.top=i.top-n.top+"px",t.style.left=i.left-n.left+"px",t.style.width=i.width+"px",t.style.height=i.height+"px",t.style.pointerEvents="none",t.style.zIndex=s?"2":"0",!s){let t="";try{t=getComputedStyle(e).position}catch{}t&&"static"!==t||(e.style.position="relative"),e.style.zIndex="1"}}class jo{constructor(t){this.session=null,this.entries=new Map,this.uris=new Map,this.loaded=null,this.current=null,this.currentTop=null,this.offs=[],this.gesture=null,this.gestureCommitted=!1,this.awaitingGestureResult=!1,this.disposed=!1;const e=!0===t?{}:t;this.retainAttached=!0===e.retain,this.depth=Math.max(0,Math.floor(e.depth??5)),this.persist=!0===e.persist,this.animation=e.animation??"none",this.duration=Math.max(0,e.duration??300);const s=e.swipeBack;this.swipe=s?{edge:"object"==typeof s&&"number"==typeof s.edge&&s.edge>0?s.edge:24,threshold:"object"==typeof s&&"number"==typeof s.threshold&&s.threshold>0?s.threshold:.35}:null,this.persist&&this.load(),this.swipe&&this.installSwipe()}get retainedCount(){return this.entries.size}isRetaining(t){return!!t.from&&!!t.to&&t.from.session===t.to.session&&t.to.index>t.from.index}begin(t){const e=t.to;if(e){if(this.session!==e.session){if(this.disposeAllEntries(),this.uris.clear(),this.session=e.session,this.loaded&&this.loaded.session===e.session)for(const[t,e]of this.loaded.uris)this.uris.set(t,e);this.loaded=null}if("push"===t.direction)this.truncate(e.index);else if("replace"===t.direction){const t=this.entries.get(e.index);t&&(this.entries.delete(e.index),this.disposeEntry(t))}}}take(t){if(!t||t.session!==this.session)return null;const e=this.entries.get(t.index);return e?(this.entries.delete(t.index),e.pendingDetach=!1,e):null}retain(t,e,s,i,n,o,r){const a=i[n],c=a.element,l={point:t,uri:e,chain:s.slice(),instances:i.slice(),top:a,topIndex:n,outlet:o,attached:!1,hidden:!1,pendingDetach:!1,saved:null,scroll:Eo(c)?Lo(c):[]};if(this.retainAttached&&Eo(c))l.attached=!0,r||this.hide(l);else if(r)l.pendingDetach=!0;else try{a.parent?.controls.silentDetach(a)}catch{}const h=this.entries.get(t.index);return h&&h!==l&&this.disposeEntry(h),this.entries.set(t.index,l),this.evict(),l}settle(t){if(!t.top.isDisposed&&this.entries.get(t.point.index)===t)if(t.attached)this.hide(t);else if(t.pendingDetach){t.pendingDetach=!1;try{t.top.parent?.controls.silentDetach(t.top)}catch{}}}hide(t){if(!t.attached||t.hidden)return;const e=t.top.element;if(Eo(e)){t.saved={style:No(e),inert:e.hasAttribute("inert"),ariaHidden:e.getAttribute("aria-hidden")};try{e.style.setProperty("display","none","important"),e.setAttribute("inert",""),e.setAttribute("aria-hidden","true")}catch{}t.hidden=!0;try{Fi(t.top)}catch{}}}reveal(t){const e=t.top.element;if(t.hidden&&t.saved&&Eo(e)){Po(e,t.saved.style);try{t.saved.inert||e.removeAttribute("inert"),null===t.saved.ariaHidden?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t.saved.ariaHidden)}catch{}}t.hidden=!1,t.saved=null}restoreScroll(t){Ro(t.scroll)}record(t,e){if(t.to&&t.to.session===this.session){if(this.uris.set(t.to.index,t.uri),"push"===t.direction)for(const e of Array.from(this.uris.keys()))e>t.to.index&&this.uris.delete(e);this.current=t.to}this.currentTop=e,this.save()}describe(){const t=this.current?.index;return Array.from(this.uris.entries()).sort((t,e)=>t[0]-e[0]).map(([e,s])=>({index:e,uri:s,current:e===t,retained:this.entries.has(e)}))}get gestureCommitPending(){return this.gestureCommitted}consumeGestureCommit(){const t=this.gestureCommitted;return this.gestureCommitted=!1,t}traversalSettled(t){if(!this.awaitingGestureResult)return;this.awaitingGestureResult=!1;const e=this.gesture;if(!t)return this.gesture=null,void(this.gestureCommitted=!1);this.gestureCommitted=!1,e&&this.settleGesture(e,!1)}async transition(t,e,s){if(this.consumeGestureCommit())return;if("none"===this.animation||!this.animation)return;if("push"!==t&&"back"!==t&&"forward"!==t)return;const i=e?.element,n=s?.element;if(!(Eo(i)&&Eo(n)&&i.isConnected&&n.isConnected))return;if(Xo())return;const o="back"===t,r=No(i),a=No(n),c=[];try{if(Jo(n,i,o),"function"==typeof this.animation){const e={direction:t,entering:i,leaving:n};await this.animation(e)}else{const t=this.duration;o?await Promise.all([Io(n,[{transform:"translateX(0)"},{transform:"translateX(100%)"}],t,c),Io(i,[{transform:"translateX(-30%)"},{transform:"translateX(0)"}],t,c)]):await Promise.all([Io(i,[{transform:"translateX(100%)"},{transform:"translateX(0)"}],t,c),Io(n,[{transform:"translateX(0)"},{transform:"translateX(-30%)"}],t,c)])}}catch(t){v("MJX308",t)}finally{for(const t of c)try{t.cancel()}catch{}Po(i,r),Po(n,a)}}async disposeEntry(t){const e=t.top;if(e&&!e.isDisposed)try{await Cn(e,{deep:!0,skipLeaveTransition:!0})}catch(t){v("MJX307",t)}}async dispose(){if(!this.disposed){this.disposed=!0;for(const t of this.offs.splice(0))try{t()}catch{}this.gesture&&(this.endGestureListeners(this.gesture),this.gesture=null),await this.disposeAllEntries(),this.uris.clear(),this.current=null,this.currentTop=null}}async disposeAllEntries(){const t=Array.from(this.entries.values());this.entries.clear();for(const e of t)await this.disposeEntry(e)}truncate(t){for(const[e,s]of Array.from(this.entries))e>=t&&(this.entries.delete(e),this.disposeEntry(s))}evict(){for(;this.entries.size>this.depth;){let t=1/0;for(const e of this.entries.keys())e<t&&(t=e);const e=this.entries.get(t);this.entries.delete(t),e&&this.disposeEntry(e)}}load(){try{if("undefined"==typeof sessionStorage)return;const t=sessionStorage.getItem(Do);if(!t)return;const e=JSON.parse(t);if(!e||"string"!=typeof e.session||!Array.isArray(e.uris))return;const s=[];for(const t of e.uris)Array.isArray(t)&&"number"==typeof t[0]&&"string"==typeof t[1]&&s.push([t[0],t[1]]);this.loaded={session:e.session,uris:s}}catch{}}save(){if(this.persist&&this.session)try{if("undefined"==typeof sessionStorage)return;sessionStorage.setItem(Do,JSON.stringify({session:this.session,uris:Array.from(this.uris.entries())}))}catch{}}installSwipe(){if("undefined"==typeof document)return;const t=t=>this.onTouchStart(t);try{document.addEventListener("touchstart",t,{passive:!0}),this.offs.push(()=>{try{document.removeEventListener("touchstart",t)}catch{}})}catch{}}onTouchStart(t){if(this.disposed||this.gesture||this.awaitingGestureResult||!this.swipe)return;if(!t.touches||1!==t.touches.length)return;const e=t.touches[0];if(!e||e.clientX>this.swipe.edge)return;if(!this.current||this.current.index<=0)return;const s=this.currentTop?.element;if(!Eo(s)||!s.isConnected)return;const i={startX:e.clientX,startY:e.clientY,lastX:e.clientX,samples:[[e.clientX,Date.now()]],dragging:!1,width:0,top:s,topSaved:null,under:null,underSaved:null,offs:[]},n=t=>this.onTouchMove(i,t),o=()=>this.onTouchEnd(i);try{document.addEventListener("touchmove",n,{passive:!1}),document.addEventListener("touchend",o),document.addEventListener("touchcancel",o),i.offs.push(()=>{try{document.removeEventListener("touchmove",n)}catch{}try{document.removeEventListener("touchend",o)}catch{}try{document.removeEventListener("touchcancel",o)}catch{}})}catch{}this.gesture=i}endGestureListeners(t){for(const e of t.offs.splice(0))try{e()}catch{}}beginDrag(t){t.dragging=!0,t.width=t.top.getBoundingClientRect().width||("undefined"!=typeof window?window.innerWidth:0)||1,t.topSaved=No(t.top);const e=this.current,s=e?this.entries.get(e.index-1)??null:null;if(s&&s.attached&&Eo(s.top.element)&&s.top.element.isConnected){const e=s.top.element;t.under=s,t.underSaved=No(e),s.saved&&Po(e,s.saved.style),Jo(e,t.top,!1),e.style.transform="translateX(-30%)",Ro(s.scroll)}t.top.style.willChange="transform"}applyDrag(t,e){const s=Math.min(1,Math.max(0,e/t.width));t.top.style.transform=`translateX(${Math.max(0,e)}px)`,t.under&&(t.under.top.element.style.transform=`translateX(-${Ao*(1-s)}%)`)}onTouchMove(t,e){const s=e.touches&&e.touches[0];if(!s)return;const i=s.clientX-t.startX,n=s.clientY-t.startY;if(!t.dragging){if(Math.abs(i)<8&&Math.abs(n)<8)return;if(i<=0||Math.abs(n)>Math.abs(i))return this.endGestureListeners(t),void(this.gesture=null);this.beginDrag(t)}if(e.cancelable)try{e.preventDefault()}catch{}const o=Date.now();for(t.lastX=s.clientX,t.samples.push([s.clientX,o]);t.samples.length>2&&o-t.samples[0][1]>100;)t.samples.shift();this.applyDrag(t,i)}onTouchEnd(t){if(this.endGestureListeners(t),!t.dragging)return void(this.gesture=null);const e=t.lastX-t.startX,s=e/t.width,i=t.samples[0],n=t.samples[t.samples.length-1],o=n&&i?n[1]-i[1]:0,r=n?Date.now()-n[1]:1/0,a=o>=16&&r<=50?(n[0]-i[0])/o:0,c=s>this.swipe.threshold||a>.5&&e>0;this.settleGesture(t,c)}async settleGesture(t,e){const s=[],i=t.top,n=t.under?t.under.top.element:null,o=Xo()?0:Math.max(0,Math.round(.6*this.duration)),r=i.style.transform||"translateX(0px)",a=n?.style.transform||"translateX(-30%)";if(e){await Promise.all([Io(i,[{transform:r},{transform:"translateX(100%)"}],o,s),n?Io(n,[{transform:a},{transform:"translateX(0)"}],o,s):Promise.resolve()]),i.style.transform="translateX(100%)",n&&(n.style.transform="translateX(0px)");for(const t of s)try{t.cancel()}catch{}this.gestureCommitted=!0,this.awaitingGestureResult=!0;try{window.history.back()}catch{this.traversalSettled(!0)}}else{await Promise.all([Io(i,[{transform:r},{transform:"translateX(0)"}],o,s),n?Io(n,[{transform:a},{transform:"translateX(-30%)"}],o,s):Promise.resolve()]);for(const t of s)try{t.cancel()}catch{}Po(i,t.topSaved),n&&t.under&&Po(n,t.underSaved),this.gesture===t&&(this.gesture=null)}}}class Ho{constructor(t){this.source=t,this.currentColumn=0,this.tokens=[],this.parameters={},this.codePointAt=String.prototype.codePointAt?(t,e)=>t.codePointAt(e):function(t,e){const s=t.length;if(e<0||e>=s)return;const i=t.charCodeAt(e);if(i>=55296&&i<=56319&&s>e+1){const s=t.charCodeAt(e+1);if(s>=56320&&s<=57343)return 1024*(i-55296)+s-56320+65536}return i},this.tokens=[]}addToken(t){this.tokens.push(t)}parse(){for(this.source.startsWith("/")||(this.source="/"+this.source);this.source.length>1&&this.source.endsWith("/");)this.source=this.source.slice(0,-1);var t="static",e=-1,s=0,i=-1;for(this.tokens=[],this.currentColumn=0;this.currentColumn<this.source.length;){var n=this.codePointAt(this.source,this.currentColumn),o=this.tokens[e];switch(n){case 47:i++,(void 0===o||o.input.length>1)&&(this.tokens.push({default:"",input:"/",isOptinal:!1,regexs:[],type:"static",parameterName:"",parameterIndex:s,sectionIndex:i}),e=this.tokens.length-1);break;case 123:s++;let n,r,a=!1,c=!1;if(this.tokens.length>0){const t=this.tokens[this.tokens.length-1];t&&"static"===t.type&&"/"===t.input&&!t.consumed?(a=!0,n=this.tokens.length-1):t&&"static"===t.type&&"/"!==t.input&&t.sectionIndex===i&&!t.consumed&&(c=!0,r=this.tokens.length-1)}this.tokens.push({default:void 0,input:"",isOptinal:!1,regexs:[],type:"parameter",parameterName:"",parameterIndex:s,sectionIndex:i,hasLeadingSlash:a,leadingSlashTokenIndex:n,hasLeadingStatic:c,leadingStaticTokenIndex:r}),e=this.tokens.length-1,t="parameter";break;case 125:t="static",e=-1;break;case 58:t="defaultValue";break;case 63:o&&(o.isOptinal=!0);break;default:const l=this.source[this.currentColumn];o?"parameter"===t?o.parameterName=`${o.parameterName+l}`:"defaultValue"===t?o.default=`${(o.default??"")+l}`:"static"===o.type?o.input=`${o.input+l}`:(this.tokens.push({default:void 0,input:l,isOptinal:!1,regexs:[],type:"static",parameterName:"",parameterIndex:s,sectionIndex:i}),e=this.tokens.length-1):(this.tokens.push({default:void 0,input:l,isOptinal:!1,regexs:[],type:"static",parameterName:"",parameterIndex:s,sectionIndex:i}),e=this.tokens.length-1)}this.currentColumn++}const r=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");for(const t of this.tokens){if("parameter"===t.type&&t.isOptinal&&t.hasLeadingSlash&&"number"==typeof t.leadingSlashTokenIndex){const e=this.tokens[t.leadingSlashTokenIndex];e&&"static"===e.type&&"/"===e.input&&(e.consumed=!0)}if("parameter"===t.type&&t.isOptinal&&t.hasLeadingStatic&&"number"==typeof t.leadingStaticTokenIndex){const e=this.tokens[t.leadingStaticTokenIndex];e&&"static"===e.type&&e.input&&e.sectionIndex===t.sectionIndex&&(e.consumed=!0)}}const a=t=>{const e=this.tokens[t];for(let s=t+1;s<this.tokens.length;s++){const t=this.tokens[s];if("static"===t.type&&t.sectionIndex===e.sectionIndex&&t.input&&"/"!==t.input)return t.input[0];if("static"===t.type&&"/"===t.input)break}},c=(t,e)=>{const s=a(t);var i;return`(${s?`[^${i=r(s),i.replace(/[\\\]\^\-]/g,"\\$&")}]`:"[\\w\\d\\_\\-\\%\\&\\$\\+\\#\\,\\.\\{\\}\\(\\)\\[\\]\\?\\:\\=\\;\\'\\\"\\~\\\\]"}${e?"{0,255}":"{1,255}"})`};let l="^";for(let t=0;t<this.tokens.length;){const e=this.tokens[t];if("static"===e.type&&"/"===e.input){e.consumed||(l+="/"),t++;continue}const s=t;let i=t;for(;i<this.tokens.length;){const t=this.tokens[i];if("static"===t.type&&"/"===t.input&&i!==s)break;if("static"===t.type&&"/"===t.input&&i===s){i++;break}i++}const n={};let o=s;for(;o<i;){if(n[o]){o++;continue}const t=this.tokens[o];if("static"!==t.type){if(t.isOptinal&&!t.hasLeadingStatic){const e=o;let s=!1;for(let t=e+1;t<i;t++){const e=this.tokens[t],i=this.tokens[t+1];if(e&&"static"===e.type&&i&&"parameter"===i.type&&i.isOptinal&&i.hasLeadingStatic&&"number"==typeof i.leadingStaticTokenIndex&&i.leadingStaticTokenIndex===t){s=!0;break}if(e&&"static"===e.type&&"/"===e.input)break}let a="";t.hasLeadingSlash&&(a+="/"),a+=c(e,!s),n[e]=!0;let h=e+1;for(;h<i;){const t=this.tokens[h];if("static"===t.type&&this.tokens[h+1]&&"parameter"===this.tokens[h+1].type){const e=this.tokens[h+1];if(e.isOptinal&&e.hasLeadingStatic&&"number"==typeof e.leadingStaticTokenIndex&&e.leadingStaticTokenIndex===h){a+=`(?:${r(t.input)}${c(h+1,!0)})?`,n[h]=!0,n[h+1]=!0,h+=2;continue}}break}l+=`(?:${a})?`,o=h;continue}{const e=c(o,t.isOptinal);if(t.isOptinal)if(t.hasLeadingSlash)l+=`(?:/${e})?`;else if(t.hasLeadingStatic&&"number"==typeof t.leadingStaticTokenIndex){const s=this.tokens[t.leadingStaticTokenIndex];l+=`(?:${s&&"static"===s.type?r(s.input):""}${e})?`}else l+=`(?:${e})?`;else l+=e;n[o]=!0,o++}}else t.consumed||(l+=r(t.input)),n[o]=!0,o++}t=i}return l+="$",new RegExp(l,"i")}exist(t,e){const s=t.indexOf("#"),i=s>=0?t.substring(0,s):t;let n=i,o="";const r=i.indexOf("?");for(r>=0&&(n=i.substring(0,r),o=i.substring(r+1));n.length>1&&n.endsWith("/");)n=n.slice(0,-1);var a=this.parse().exec(n);if(a){a&&a.length;var c=[];if(this.parameters={},a?.forEach((t,e)=>{c.push(t)}),o&&o.length){const t=new URLSearchParams(o),e=new Map;t.forEach((t,s)=>{const i=e.get(s)||[];i.push(t),e.set(s,i)}),e.forEach((t,e)=>{1===t.length?this.parameters[e]=t[0]:this.parameters[e]=t})}else if(e){const t=new URLSearchParams(e),s=new Map;t.forEach((t,e)=>{const i=s.get(e)||[];i.push(t),s.set(e,i)}),s.forEach((t,e)=>{1===t.length?this.parameters[e]=t[0]:this.parameters[e]=t})}if(a.input===c[0])return a?.forEach((t,e)=>{if(0!==e){var s=this.tokens.find(t=>t.parameterIndex==e);if(s){let e=t;if((void 0===e||""===e)&&s.isOptinal){e=void 0===s.default||""===s.default?void 0:s.default}this.parameters[s.parameterName]=void 0===e?void 0:e}}}),!0}return!1}}function Fo(t){let e=0,s=0;for(const i of(t||"").split("/"))i&&(i.startsWith("{")&&i.endsWith("}")?s++:e++);return{statics:e,params:s}}function Bo(t,e){const s=t.chain.length-e.chain.length;if(0!==s)return s;const i=Fo(t.fullPath),n=Fo(e.fullPath);return i.statics!==n.statics?n.statics-i.statics:i.params!==n.params?i.params-n.params:e.fullPath.length-t.fullPath.length}class zo{constructor(t){this.routes=t,this.records=[],this.routesMap=new Map,this.walk=(t,e,s,i=!1)=>{const n=this.joinPaths(e,s.path);if(!i){const t=s.fullPath;(null==t||"string"==typeof t&&""===t.trim())&&(s.fullPath=n),null!=s.name&&this.routesMap.set(s.name,s)}const o=[...t,s],r=[{path:n,isAlias:i},...(null==s.alias?[]:Array.isArray(s.alias)?s.alias:[s.alias]).map(t=>({path:this.joinPaths(e,t),isAlias:!0}))];for(const t of r)if(this.records.push({fullPath:t.path,chain:o,leaf:s,scanner:new Ho(t.path),aliasOf:t.isAlias?s.fullPath??null:null}),s.childs&&s.childs.length)for(const e of s.childs)this.walk(o,t.path,e,t.isAlias)},this.build()}build(){this.records=[],this.routesMap.clear();for(const t of this.routes)this.walk([],"",t);this.records.sort(Bo)}joinPaths(t,e){e=e||"";const s=(t=t||"")&&"/"!==t&&t.endsWith("/")?t.slice(0,-1):t;if("/"===e)return s||"/";const i=e?e.startsWith("/")?e:"/"+e:"";return s&&"/"!==s?s+i:i||"/"}}class Wo{constructor(){this.stack=null,this._revealed=new Set,this._previousPath=null,this._previousInstances=[],this.controlCache=new Map,this._navVersion=0,this._pendingActivate=new Set,this.pendingMount=new WeakMap,this.pendingListeners=new WeakMap}register(t,e,s){this.root=t,this.application=e,this.routingModule=s}async evict(t){const e=t?[t]:Array.from(this.controlCache.keys());for(const t of e){const e=this.controlCache.get(t);if(e&&!e.isDisposed){if(!this._previousInstances.includes(e)){this.controlCache.delete(t);try{await e.dispose()}catch(t){v("MJX307",t)}}}else this.controlCache.delete(t)}}async dispose(){this._navVersion++,this._previousPath=null,this._previousInstances=[],this._revealed.clear();const t=this.stack;if(this.stack=null,t)try{await t.dispose()}catch{}await this.evict()}generatePathString(t,e){const s=t.split("/").map(t=>{if(t.startsWith("{")&&t.endsWith("}")){const s=t.slice(1,-1);let[i,n]=s.split(":");i.endsWith("?")&&(i=i.slice(0,-1));const o=e[i];return null!=o&&""!==o?String(o):n??""}return t}).filter(t=>""!==t).join("/");return t.startsWith("/")?"/"+(s||""):s}async execute(t,e,s){s??={target:t,chain:t.chain.map(e=>this.generatePathString(e.path,t.params)||""),direction:void 0,state:void 0};const i=this._rootProvider(),n={provider:i,scope:i?._beginNavigation(),route:s,committed:!1,suppressed:[]};try{await this._execute(t,e,n)}finally{!n.committed&&n.scope&&i._abandonNavigation(n.scope);for(const t of n.suppressed)t.isDisposed||(t.motif.options.transition._suppressEnter=!1)}}_commitNavigation(t){t.committed||(t.committed=!0,t.scope&&t.provider._commitNavigation(t.scope),this.application?._routerState.commit(t.route))}async _execute(t,e,s){const i=++this._navVersion,n=this.stack&&e&&e.to?this.stack:null;n&&n.begin(e);const o=n?n.take(e.to):null,r=new Array(t.chain.length),a=!(!this._previousPath||this._previousPath.route!==t.route||null==this._previousPath.route&&this._previousPath.fullPath!==t.fullPath);var c=!(!this._previousPath||this._previousPath.uri!==t.uri);let l=!1;if(a&&t.route){const e=this._previousPath.params||{},s=t.params||{};let i=!1;const o=new Set([...Object.keys(e),...Object.keys(s)]);for(const t of o)if(e[t]!==s[t]){i=!0;break}if(i){l=!0;const i=t.route;if(i&&!i.keepAlive&&this.controlCache.has(i))if(n)this.controlCache.delete(i);else{const t=this.controlCache.get(i);if(t&&"function"==typeof t.dispose&&!t.isDisposed)try{await t.dispose()}catch{}this.controlCache.delete(i)}try{const i=this.routingModule.getHooks?.()||void 0,n=t.route.onUpdate||i?.onUpdate;if(n){const i={from:{path:this._previousPath.uri||this._previousPath.fullPath||"",params:e},to:{path:t.uri||t.fullPath||"",params:s},meta:t.meta??t.extend};await n(i)}}catch(t){v("MJX306",t,"onUpdate")}}}if((!a||l)&&t.route)try{const e=t.meta??t.extend,s={path:t.uri||t.fullPath||"",params:t.params,meta:e,to:{path:t.uri||t.fullPath||"",params:t.params,meta:e}},i=this.routingModule.getHooks?.()||void 0,n=t.route.onEntering||i?.onEntering;n&&await n(s)}catch(t){v("MJX306",t,"onEntering")}const h=[];for(let e=0;e<t.chain.length;e++){const i=t.chain[e],n=o&&o.chain[e]===i?o.instances[e]:void 0;if(!n||n.isDisposed||i.keepAlive)if(this.controlCache.has(i)){let t=this.controlCache.get(i);if(!t||t.isDisposed){this.controlCache.delete(i);const t=this.createInstance(i.control,s.scope,s.route).then(t=>{this.controlCache.set(i,t),r[e]=t});h.push(t)}else r[e]=t,i.keepAlive&&!this._previousInstances.includes(t)&&this._pendingActivate.add(t)}else{const t=this.createInstance(i.control,s.scope,s.route).then(t=>{this.controlCache.set(i,t),r[e]=t});h.push(t)}else r[e]=n,this.controlCache.set(i,n)}h.length&&await Promise.all(h);let u=null,d=null;const p=this._previousInstances;if(n){const s=!!n.animation&&"none"!==n.animation&&("push"===e.direction||"back"===e.direction||"forward"===e.direction);if(d={animate:s,pages:!s&&!n.gestureCommitPending,direction:e.direction},u=await this._stackLeave(t.chain,r,e,n,d),o){const t=o.top;!t.isDisposed&&o.outlet&&t.parent===o.outlet&&(n.reveal(o),o.outlet.current=t,o.outlet.previouspage=t,this._revealed.add(t)),t.isDisposed||this._pendingActivate.add(t)}}else await this.disposeFromDivergencePoint(t.chain,r);const f=d?r.filter(t=>t&&!p.includes(t)):[];if(d){for(const t of p)To(t);for(const t of f)d.pages?Oo(t,d.direction):(t.motif.options.transition._suppressEnter=!0,s.suppressed.push(t))}if(i===this._navVersion&&this._commitNavigation(s),await this.mountChain(r,t.chain,this.root,i),d?.pages){o?.attached&&!o.top.isDisposed&&bn(o.top,"enter")&&o.top.motif.options.transition.enterTransition(()=>{});for(const t of f)t.isBuilt&&!bn(t,"enter")&&To(t)}let m=null;if(n){o&&n.restoreScroll(o);for(let t=0;t<r.length;t++)if(r[t]&&r[t]!==p[t]){m=r[t];break}m||(m=r.length?r[r.length-1]:null),n.record(e,m)}if(!c&&t.route)try{const e=t.meta??t.extend,s={path:t.uri||t.fullPath||"",params:t.params,meta:e,to:{path:t.uri||t.fullPath||"",params:t.params,meta:e}},i=this.routingModule.getHooks?.()||void 0,n=t.route?.onEnter||i?.onEnter;n&&await n(s)}catch(t){v("MJX306",t,"onEnter")}if(this._previousPath=t,this._previousInstances=r.slice(),n&&u){u.top&&i===this._navVersion&&(u.retained||u.disposeAfter.length)&&await n.transition(e.direction,m,u.top),u.retained&&n.settle(u.retained);for(const t of u.disposeAfter)try{t.isDisposed||await t.dispose({deep:!0,skipLeaveTransition:!0})}catch(t){v("MJX307",t)}}}async _stackLeave(t,e,s,i,n){const o={top:null,retained:null,disposeAfter:[]},r=this._previousPath?.chain??[],a=this._previousInstances;if(!a.length)return o;let c=-1;for(let t=0;t<a.length;t++){const s=a[t];if(s&&!e.includes(s)){c=t;break}}if(c<0)return o;a[c].isDisposed||xe(a[c]);const l=t=>{const e=t-1>=0?a[t-1]:this.root,s=r[t]?.extend?.targetOutlet||"default";try{return e&&!e.isDisposed?this.findRouterView(e,s):null}catch{return null}},h=a[c],u=r[c];if(i.isRetaining(s)&&h&&!h.isDisposed&&!u?.keepAlive){const t=l(c);t&&t.current===h&&(t.current=null,t.previouspage=null),Sn(h),n.pages&&bn(h,"leave")&&(Oo(h,n.direction),await(d=h,new Promise(t=>{let e=!1;const s=()=>{e||(e=!0,t())};try{const t=d.motif.options.transition.leaveTransition(s);t&&"function"==typeof t.addEventListener&&t.addEventListener("cancel",s)}catch{s()}})),To(h));for(let t=c;t<a.length;t++){const e=r[t];e&&!e.keepAlive&&this.controlCache.get(e)===a[t]&&this.controlCache.delete(e)}return o.top=h,o.retained=i.retain(s.from,this._previousPath?.uri??"",r,a,c,t,n.animate),o}var d;const p=n.animate&&!!h&&!h.isDisposed&&!u?.keepAlive;for(let t=a.length-1;t>=c;t--){const s=a[t],i=r[t];if(s&&!e.includes(s))if(s.isDisposed)i&&this.controlCache.get(i)===s&&this.controlCache.delete(i);else if(p&&t>c&&!i?.keepAlive)i&&this.controlCache.get(i)===s&&this.controlCache.delete(i);else try{const e=l(t);if(e&&e.current===s&&(e.current=null,e.previouspage=null),i?.keepAlive){Sn(s);try{s.parent?.controls.silentDetach(s)}catch{}this.controlCache.has(i)||this.controlCache.set(i,s),Fi(s)}else i&&this.controlCache.get(i)===s&&this.controlCache.delete(i),p&&t===c?(o.top=s,o.disposeAfter.push(s)):n.pages?(Oo(s,n.direction),await s.dispose()):await s.dispose({deep:!0,skipLeaveTransition:!0})}catch(t){v("MJX307",t)}}return o}async disposeFromDivergencePoint(t,e){if(!this._previousPath||!this._previousInstances.length)return;const s=this._previousPath.chain,i=this._previousInstances;let n=0;const o=Math.min(s.length,t.length);for(let e=0;e<o&&s[e]===t[e];e++)n=e+1;for(let t=i.length-1;t>=n;t--){const e=i[t],n=s[t];if(e&&!e.isDisposed)try{const s=t-1,o=s>=0?i[s]:this.root,r=n?.extend?.targetOutlet||"default",a=this.findRouterView(o,r);if(a&&a.current===e&&(a.current=null,a.previouspage=null),n?.keepAlive){Sn(e);try{e.parent?.controls.silentDetach(e)}catch{}this.controlCache.has(n)||this.controlCache.set(n,e),Fi(e)}else this.controlCache.get(n)===e&&this.controlCache.delete(n),await e.dispose()}catch(t){v("MJX307",t)}else n&&this.controlCache.get(n)===e&&this.controlCache.delete(n)}}_construct(t,e,s){const i=this.application?._routerState;return function(t,e){const s=fe;fe=t??null;try{return e()}finally{fe=s}}(t,()=>i?i.constructWith(e,s):s())}async parseControl(t,e,s){var i=this._construct(e,s,()=>this._resolveFrom(e,t));if(i)return i;let n=t;return n instanceof Promise&&(n=Zi(await n)),(i=this._construct(e,s,()=>this._resolveFrom(e,n)))||("function"==typeof n?this.parseControl(this._construct(e,s,()=>en(n,this.application)),e,s):en(n))}_resolveFrom(t,e){const s=t??this._rootProvider();return s&&s.getAllServices().getDescriptor(e)?s.get(e):null}_rootProvider(){try{return this.application?.provider??Zo.main?.provider}catch{return}}async createInstance(t,e,s){return await this._instanceCreator(t,e,s)}async _instanceCreator(t,e,s){let i=await this.parseControl(t,e,s);return tn(i),i}async activator(t){}static{this.OUTLET_WARN_MS=3e3}async mountChain(t,e,s,i){for(let n=0;n<t.length;){if(i!==this._navVersion)return;let o=t[n];o?.isDisposed&&(o=await this.createInstance(e[n].control,this._rootProvider()?._currentScope()),t[n]=o);const r=e[n]&&e[n].extend&&e[n].extend.targetOutlet||"default",a=this.findRouterView(s,r);if(!a||!s.isBuilt)return void this._waitForOutlet(s,t.slice(n),e.slice(n),i,r);const c=this._revealed.delete(o),l=a.current===o&&!c;await a.navigate(o),this._pendingActivate.delete(o)&&Hi(o);const h=e[n]?.onShow;h&&!l&&a.current===o&&i===this._navVersion&&w(()=>h(o),"MJX306","onShow"),s=o,n++}}_waitForOutlet(t,e,s,i,n){const o=this.pendingListeners.get(t);if(o){try{o()}catch{}this.pendingListeners.delete(t)}let r,a=!1;const c=async(n,o)=>{a||(l(),i===this._navVersion&&await this.mountChain(e,s,t,i))},l=()=>{if(!a){a=!0,this.pendingListeners.delete(t);try{t.motif?.off?.(yo,c)}catch{}if(void 0!==r){try{clearTimeout(r)}catch{}r=void 0}}};t.motif.on(yo,c),this.pendingListeners.set(t,l),h.isDevelopment()&&(r=setTimeout(()=>{a||i!==this._navVersion||b("MJX301",[n,Wo.OUTLET_WARN_MS])},Wo.OUTLET_WARN_MS))}findRouterView(t,e="default"){const s=(t.controls?.items||[]).slice();for(;s.length;){const t=s.shift();if(t&&!t.isDisposed){if(t.__isRouterView){const s=t;if((s.props.name||"default")===e)return s}if(t.controls&&t.controls.items&&t.controls.items.length)for(const e of t.controls.items)s.push(e)}}if(!e||"default"===e)return null;const i="function"==typeof t.scopeId?t.scopeId():t.scopeId??"";var n=go.find(e,i);if(n)return n;let o=t,r=o?.parent;for(;r;){const t=(r.controls?.items||[]).filter(t=>t!==o).slice();for(;t.length;){const s=t.shift();if(s&&!s.isDisposed){if(s.__isRouterView){const t=s;if((t.props.name||"default")===e)return t}if(s.controls&&s.controls.items&&s.controls.items.length)for(const e of s.controls.items)t.push(e)}}o=r,r=r.parent}return null}}class Vo extends Vi{constructor(t){super(t.el??"a",t),!1!==t.showHref&&this.attr.add({href:Zo.main?._addressOf(t.to)??t.to}),t.target&&this.attr.add({target:t.target}),this.motif.on("click",(e,s)=>{if(t.bypass)return;if(t.target&&"_self"!==t.target)return;if(s.metaKey||s.ctrlKey||s.shiftKey||s.altKey)return;s.preventDefault();const i=Zo.main.router;i&&i.navigate(t.to)}),this.childs&&this.childs.length?this.controls.add(...this.childs):null!=t.text&&this.attr.add({textContent:t.text})}onBuilt(t,e){this.motif.options.enableRouterClassing={to:"all",path:this.props.to,activeClass:this.props.activeClass,exactClass:this.props.exactClass,onActive:this.props.onActive,offActive:this.props.offActive,onExact:this.props.onExact,offExact:this.props.offExact}}}const $o=t=>t.split("#")[0].split("?")[0],Uo=()=>Math.random().toString(36).slice(2,10)+Date.now().toString(36);class qo{static{this.MAX_REDIRECTS=10}constructor(t,e){this.routesMap=new Map,this._suppressBeforeEachOnce=!1,this._suppressMiddlewaresOnce=!1,this._scroll=null,this._stack=null,this._windowNavListener=null,this._historyStamp=null,this._pendingTraversal=null,this._currentUri="___startup___",this._previousRoute=null,this._fallbackRoutes={},this._navHandler=null,this._routerOptions=t,this.routeCollection=new zo(t.RouteItems),this.routingEngine=new Wo,this.application=e,this._installLinkInterceptor();const s=t.scrollMemory;s&&(this._scroll=new So(!0===s?{}:s),this._scroll.locationAnchor="history"===this._addressMode()),t.stack&&"shell"!==t.mode&&(this._stack=new jo(t.stack),this.routingEngine.stack=this._stack)}getHooks(){return this._routerOptions.hooks}start(t,e){this.mainApp=t,this.routingEngine.register(this.mainApp,this.application,this);const s="shell"===this._routerOptions.mode?e??"/":this._getCurrentUri();this._seedHistoryIndex(),this._suppressMiddlewaresOnce=!0,this.navigate(s),"shell"!==this._routerOptions.mode&&(this._windowNavListener=()=>{this._onHistoryTraversal()},window.addEventListener("hash"===this._routerOptions.mode||"file"===this._routerOptions.mode?"hashchange":"popstate",this._windowNavListener))}get shownUri(){return this._previousRoute?this._currentUri:void 0}_getCurrentUri(){try{const t=window,e=this._routerOptions.mode||("file:"===t?.location?.protocol?"hash":"history");if("hash"===e||"file"===e){const e=t?.location?.hash||"";return e&&e.startsWith("#")&&e.slice(1)||"/"}return(t?.location?.pathname||"/")+(t?.location?.search||"")+(t?.location?.hash||"")}catch{return"/"}}static{this.HISTORY_STAMP_KEY="__motifHistory"}_addressMode(){const t=window;return this._routerOptions.mode||("file:"===t?.location?.protocol?"hash":"history")}addressOf(t){const e=this._addressMode();return"hash"===e||"file"===e?t.startsWith("#")?t:"#"+t:t}_readHistoryStamp(){try{const t=window?.history?.state,e=t&&"object"==typeof t?t[qo.HISTORY_STAMP_KEY]:null;if(e&&"object"==typeof e&&"number"==typeof e.index&&Number.isFinite(e.index)&&"string"==typeof e.session)return{index:e.index,session:e.session}}catch{}return null}static _isPlainObject(t){if(!t||"object"!=typeof t)return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}_withHistoryStamp(t,e){return null==t?{[qo.HISTORY_STAMP_KEY]:e}:qo._isPlainObject(t)?{...t,[qo.HISTORY_STAMP_KEY]:e}:t}_routerState(t,e){return t?this._withHistoryStamp(t,{...e,hasState:!0}):this._withHistoryStamp(null,e)}_userStateOf(t){if(null==t)return;if(!qo._isPlainObject(t))return t;const e=qo.HISTORY_STAMP_KEY;if(!(e in t))return t;const s=t[e];if(!s||!0!==s.hasState)return;const{[e]:i,...n}=t;return n}_currentHistoryUserState(){if("shell"!==this._addressMode())try{return this._userStateOf(window?.history?.state)}catch{return}}_nextHistoryStamp(t){const e=this._historyStamp;return e?{index:t?e.index+1:e.index,session:e.session}:{index:0,session:Uo()}}_stampCurrentEntry(t,e){try{const s=window;if(!s?.history||"function"!=typeof s.history.replaceState)return;const i=s.history.state;let n;if(e)n=this._routerState(e,t);else{const e=qo._isPlainObject(i)&&Object.keys(i).length>0;n=this._withHistoryStamp(i,e?{...t,hasState:!0}:t)}n!==i&&s.history.replaceState(n,"")}catch{}}_seedHistoryIndex(){if("shell"===this._addressMode())return;const t=this._readHistoryStamp();if(t)return void(this._historyStamp=t);const e={index:0,session:Uo()};this._stampCurrentEntry(e),this._historyStamp=e}async _onHistoryTraversal(){const t=this._historyStamp,e=this._readHistoryStamp();this._historyStamp=e;let s,i="traverse";t&&e&&t.session===e.session&&t.index!==e.index&&(i=e.index<t.index?"back":"forward"),this._pendingTraversal={direction:i,state:this._currentHistoryUserState(),from:t};try{s=await this.navigate(this._getCurrentUri())}finally{this._pendingTraversal=null}const n=!!s&&!0===s.cancelled;try{this._stack?.traversalSettled(n)}catch{}if(!n)return;const o=this._readHistoryStamp();if(this._historyStamp=o,!t||!o||o.session!==t.session)return;const r=t.index-o.index;if(0!==r)try{window.history.go(r)}catch{}}get currentUri(){return this._currentUri}async navigate(t,e){const s=this._pendingTraversal;return this._pendingTraversal=null,await(n=async()=>{try{i()?.("route:navigation-start",{uri:t})}catch{}const n=this._suppressBeforeEachOnce;n&&(this._suppressBeforeEachOnce=!1);const o=this._suppressMiddlewaresOnce;o&&(this._suppressMiddlewaresOnce=!1);const r=e||{},a=r.force||!1;if(t===this._currentUri&&!a)return{ok:!0,skipped:!0,uri:t};let c;if(c=o?{proceed:!0,uri:t}:await this._runMiddlewares(t),!c.proceed)return{ok:!1,uri:c.uri,cancelled:!0,reason:"middleware"};t=c.uri;let l,h,u=this.resolve(t),d="";if(u.ok&&u.route?.redirect){const e=t,s=[e];for(;u.ok&&u.route?.redirect;){const e=this._resolveRedirect(u,t);if(!e)break;if(s.length>qo.MAX_REDIRECTS||s.some(t=>$o(t)===$o(e))){d=[...s,e].join(" → "),h=y("MJX303",d);break}s.push(e),t=e,u=this.resolve(t)}if(h)b("MJX303",[d]),t=e,u=this._buildFallbackResult(t,"error",{path:t,error:h});else if(t!==e&&(l=e,t===this._currentUri&&!a))return{ok:!0,skipped:!0,uri:t}}const p=!this._previousRoute,f=p?"initial":s?s.direction:r.replace?"replace":"push",m=s?s.state:p&&void 0===r.state?this._currentHistoryUserState():r.state||void 0,_={path:u.uri||t,params:u.params,meta:u.meta??u.extend,options:e,redirectedFrom:l,direction:f,state:m},g=this._previousRoute?{path:this._previousRoute.path,params:this._previousRoute.params,meta:this._previousRoute.meta,options:this._previousRoute.options}:null;if(this._previousRoute&&this._previousRoute.routeItem){const t=this._previousRoute.routeItem.onLeave||this._routerOptions.hooks?.onLeave;if(t)try{const e={from:{path:this._previousRoute.path,params:this._previousRoute.params,meta:this._previousRoute.meta},to:_},s=await t(e);if(!1===s)return{ok:!1,cancelled:!0,reason:"onLeave"};if(s&&"object"==typeof s&&!0===s.cancel)return{ok:!1,cancelled:!0,reason:s.reason||"onLeave"}}catch(t){v("MJX306",t,"onLeave")}}let w=!0;if(n||(w=await this.application._runBeforeEachGuards(_,g)),!1===w)return{ok:!1,cancelled:!0,reason:"guard"};if("string"==typeof w){const s=this._addressShows(t,l);return await this.navigate(w,s?{...r,replace:!0}:e)}const S=t=>({target:t,chain:this.chainOf(t),direction:f,state:m});u.ok||h||(u=this._buildFallbackResult(t,"notFound",{path:t})),this._currentUri=t,this._previousRoute={path:u.uri,params:u.params,meta:u.meta??u.extend,routeItem:u.route};let C=u.uri;this._scroll?.leaving();const M=s?s.from:this._historyStamp;try{const t=!!l&&this._addressShows(l);this._applyUrl(C,t?{...r,replace:!0}:r)}catch{}const k=this._stack?{direction:f,from:M,to:this._historyStamp,uri:C}:void 0;try{await this.routingEngine.execute(u,k,S(u))}catch(e){v("MJX304",e),u=this._buildFallbackResult(t,"error",{path:t,error:e});try{await this.routingEngine.execute(u,k,S(u))}catch(t){v("MJX305",t)}}this._stack&&this.application._routerState.touch(),r.scroll?this._handleScrollBehavior(r.scroll):this._scroll?.arrived(this._uriWithHash(C,t),f),this.application.fire?.("motifjs-router-navigated",{uri:C,params:u.params,meta:u.meta??u.extend,route:u.ok?u.route:null,ok:u.ok,initial:p,redirectedFrom:l,direction:f,state:m});try{i()?.("route:navigation-end",{uri:C,params:u.params})}catch{}return u},o="UrlRoutingModule.navigate",h.safeCallSilentAsync(n,o));var n,o}describeStack(){return this._stack?this._stack.describe():void 0}routeInfos(){const t=[],e=(s,i)=>{const n=[...i,s];t.push({fullPath:s.fullPath||s.path,name:s.name??null,meta:s.meta??s.extend??{},route:s,chain:n});for(const t of s.childs||[])e(t,n)};for(const t of this.routeCollection?.routes||[])e(t,[]);return t}href(t,e){const s=this.routeCollection.routesMap?.get(t);if(!s)throw y("MJX302",t);const i=s.fullPath||s.path;return this.routingEngine.generatePathString(i,e||{})||i}async evict(t){let e=null;if("string"==typeof t){if(e=this.routeCollection.routesMap?.get(t),!e)throw y("MJX302",String(t))}else e=t;await this.routingEngine.evict(e)}_getFallbackRoute(t){const e=this._fallbackRoutes[t];if(e)return e;const s=this._routerOptions.fallbacks?.[t],i={path:"",fullPath:null,control:s??("notFound"===t?qo._builtinNotFound:qo._builtinError),name:"notFound"===t?"not-found":"error",childs:[],extend:{},meta:{},validate:void 0,keepAlive:!1};return this._fallbackRoutes[t]=i,i}_buildFallbackResult(t,e,s){const i=this._getFallbackRoute(e),n=this._findLayoutPrefix(t),o=[...n?.chain??[],i],r={},a={};for(const t of o)t?.extend&&"object"==typeof t.extend&&Object.assign(r,t.extend),t?.meta&&"object"==typeof t.meta&&Object.assign(a,t.meta);return{ok:!1,uri:t,fullPath:null,route:i,chain:o,params:{...n?.params??{},...s},extend:r,meta:a}}_findLayoutPrefix(t){const e=t.split("?")[0].split("#")[0].split("/").filter(Boolean);let s=null;for(const t of this.routeCollection?.records||[]){if(!t.leaf.childs||!t.leaf.childs.length)continue;const i=t.fullPath.split("/").filter(Boolean).length;if(i>e.length)continue;const n="/"+e.slice(0,i).join("/");let o=!1;try{o=t.scanner.exist(n,this._pageSearch())}catch{o=!1}if(!o)continue;const r={...t.scanner.parameters};this.validateChain(n,t,r)&&((!s||t.chain.length>s.rec.chain.length||t.chain.length===s.rec.chain.length&&i>s.depth)&&(s={rec:t,params:r,depth:i}))}return s?{chain:s.rec.chain,params:s.params}:null}static{this._builtinNotFound=()=>new Vi("div",{initializeComponent(t){t.style({padding:"20px",fontFamily:"Arial, sans-serif",display:"flex","flex-direction":"column","align-items":"center"}),t.element.appendChild(dn("h2",{},"404 - Not Found")),t.element.appendChild(dn("p",{},"The requested page was not found."))}})}static{this._builtinError=()=>new Vi("div",{initializeComponent(t){t.style({padding:"20px",fontFamily:"Arial, sans-serif",display:"flex","flex-direction":"column","align-items":"center"}),t.element.appendChild(dn("h2",{},"Error")),t.element.appendChild(dn("p",{},"The requested page could not be loaded."))}})}async navigateByName(t,e,s){return await this.navigate(this.href(t,e),s)}async _runMiddlewares(t){let e=t;const s={uri:e,rewritePath:t=>{e=t,s.uri=t},context:this.application};let i=!1;const n=this._routerOptions.middlewareCollections&&this._routerOptions.middlewareCollections()||[],o=async t=>{if(t===n.length)return void(i=!0);const e=n[t];await e(s,async()=>{await o(t+1)})};return 0===n.length?i=!0:await o(0),{proceed:i,uri:e}}chainOf(t){return t.chain.map(e=>this.routingEngine.generatePathString(e.path,t.params)||"")}resolve(t){const e=[],s=this._pageSearch();for(const i of this.routeCollection?.records||[]){if(!i.scanner.exist(t,s))continue;const n={...i.scanner.parameters};this.validateChain(t,i,n)&&e.push({rec:i,params:n})}if(0===e.length){const e=(this.routeCollection?.records||[]).find(t=>t.scanner.exist("/*"));if(e){const s={};try{for(const t of e.chain)t&&t.extend&&"object"==typeof t.extend&&Object.assign(s,t.extend)}catch{}return{ok:!0,uri:t,fullPath:e.fullPath,route:e.leaf,chain:e.chain,params:{},extend:s||{},meta:e.meta||{}}}return{ok:!1,uri:t,fullPath:null,route:null,chain:[],params:{},extend:{}}}let i=e[0];const n=new Map;for(const t of e){const e=t.rec.fullPath,s=n.get(e)||[];s.push(t),n.set(e,s)}let o=!1;for(const[t,e]of n)if(e.length>1){i=(e.some(t=>!t.rec.aliasOf)?e.filter(t=>!t.rec.aliasOf):e).reduce((t,e)=>t.rec.chain.length>=e.rec.chain.length?t:e),o=!0;break}o||(i=e.reduce((t,e)=>Bo(t.rec,e.rec)<=0?t:e,e[0]));const r=i.rec,a=i.params,c={};try{for(const t of r.chain)t&&t.extend&&"object"==typeof t.extend&&Object.assign(c,t.extend)}catch{}return{ok:!0,uri:t,fullPath:r.fullPath,aliasOf:r.aliasOf??null,route:r.leaf,chain:r.chain,params:a,extend:c,meta:(()=>{const t={};try{for(const e of r.chain)e&&e.meta&&"object"==typeof e.meta&&Object.assign(t,e.meta)}catch{}return t})()}}validateChain(t,e,s){for(const i of e.chain)if("function"==typeof i.validate){const n={uri:t,key:i.name??e.fullPath,routes:this.routesMap,params:s};if(!i.validate(n))return!1}return!0}_installLinkInterceptor(){try{if(this._navHandler)return;this._navHandler=t=>{const e=window,s=this._routerOptions.mode||("file:"===e?.location?.protocol?"hash":"history");let i=t.target;for(;i&&i!==document.body&&!(i instanceof HTMLAnchorElement);)i=i.parentElement;if(!(i&&i instanceof HTMLAnchorElement))return;const n=i.getAttribute("rel")||"";if(!("router"==i.getAttribute("x-command")||i.hasAttribute("data-router-link")||"router"===n.toLowerCase()))return;const o=i;if(o.target&&"_self"!==o.target)return;if(t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;let r=o.getAttribute("href")||"";if(r||(r=o.getAttribute("x-to")||""),!r)return;if("history"===s){const s=new URL(r,e.location.href);if(s.origin!==e.location.origin)return;t.preventDefault();const i=s.pathname+s.search+s.hash;return void this.navigate(i)}t.preventDefault();const a=r.startsWith("#")?r.slice(1):r;this.navigate(a)},document.addEventListener("click",this._navHandler)}catch{}}_applyUrl(t,e={}){try{const s=window,i=this._routerOptions.mode||("file:"===s?.location?.protocol?"hash":"history");if("shell"===i)return;if("hash"===i||"file"===i){const i=t.startsWith("#")?t:"#"+t;if(s?.location?.hash!==i)if(e.replace&&s?.history&&"function"==typeof s.history.replaceState){const t=this._nextHistoryStamp(!1);s.history.replaceState(this._routerState(e.state,t),"",i),this._historyStamp=t}else{s.location.hash=i;const t=this._nextHistoryStamp(!0);this._stampCurrentEntry(t,e.state),this._historyStamp=t}return}if(s?.history&&"function"==typeof s.history.pushState){const i=(s.location.pathname||"/")+(s.location.search||"")+(s.location.hash||"");let n=t;try{const e=new URL(t,s.location.href);n=e.pathname+e.search+e.hash}catch{}if(i!==n)if(e.replace){const i=this._nextHistoryStamp(!1);s.history.replaceState(this._routerState(e.state,i),"",t),this._historyStamp=i}else{const i=this._nextHistoryStamp(!0);s.history.pushState(this._routerState(e.state,i),"",t),this._historyStamp=i}}}catch{}}_resolveRedirect(t,e){const s=t.route?.redirect;if(!s)return null;if("function"==typeof s){const e=s({path:t.uri,params:t.params,meta:t.meta??t.extend});return"string"==typeof e&&e.length>0?e:null}const i=this.routingEngine.generatePathString(s,t.params||{}),n=e.indexOf("#"),o=n>=0?e.slice(n):"",r=n>=0?e.slice(0,n):e,a=r.indexOf("?"),c=a>=0?r.slice(a):"",l=i.indexOf("#"),h=l>=0?i.slice(l):"";let u=l>=0?i.slice(0,l):i;return c&&!u.includes("?")&&(u+=c),u+(h||o)}_pageSearch(){try{const t=window,e=this._routerOptions.mode||("file:"===t?.location?.protocol?"hash":"history");if("history"===e||"shell"===e)return;return t?.location?.search||void 0}catch{return}}_addressShows(...t){const e=this._getCurrentUri().split("#")[0];return t.some(t=>!!t&&t.split("#")[0]===e)}_uriWithHash(t,e){const s=e.indexOf("#");return s<0||t.indexOf("#")>=0?t:t+e.slice(s)}_handleScrollBehavior(t){if(t)try{"top"===t?window.scrollTo({top:0,behavior:"auto"}):"smooth"===t?window.scrollTo({top:0,behavior:"smooth"}):"instant"===t?window.scrollTo({top:0,behavior:"instant"}):"object"==typeof t&&window.scrollTo({top:t.top||0,left:t.left||0,behavior:t.behavior||"auto"})}catch{}}dispose(){try{this._scroll?.dispose()}catch{}this._scroll=null,this._historyStamp=null;let t=Promise.resolve();try{try{t=this.routingEngine.dispose()}catch{}if(this._navHandler){try{document.removeEventListener("click",this._navHandler)}catch{}this._navHandler=null}if(this._windowNavListener){const t="hash"===this._routerOptions.mode||"file"===this._routerOptions.mode?"hashchange":"popstate";try{window.removeEventListener(t,this._windowNavListener)}catch{}this._windowNavListener=null}}catch{}return t}}class Go{constructor(){this.version=new ce(0),this._current=null,this._constructing=null}read(){return this.version.value,this._constructing??this._current}commit(t){this._current=t,this.touch()}reset(){this._current=null,this.touch()}touch(){this.version.value=this.version.peek()+1}constructWith(t,e){if(!t)return e();const s=this._constructing;this._constructing=t;try{return e()}finally{this._constructing=s}}}let Ko=null,Yo=!1;class Qo{constructor(){if(this.services=new mo,Ko&&"disposing"!==Ko.state||Yo)throw new _("MJX405",g("MJX405"),{cause:Ko});Yo=!0}build(){this.services.autoRegisterInjectables();const t=this.services.buildServiceProvider();this.services.addSingleton(Ae,t);var e=new Zo(t);return this.services.addSingleton(Zo,e),Ko=e,e}rebuild(){return Ko?(Ko.provider.dispose(),Ko.provider=this.services.buildServiceProvider(),Ko):this.build()}}class Zo{static get main(){return Ko}constructor(t){this.provider=t,this._state="initializing",this._middlewares=[],this._beforeEachGuards=[],this._routerState=new Go,this.router=function(t,e){const s=()=>{const t=e();if(!t)throw y("MJX309");return t},i=()=>t.read()?.target;return{get params(){return i()?.params??{}},get route(){return i()?.route??null},get ok(){return i()?.ok??!1},get uri(){return i()?.uri??""},get fullPath(){return i()?.fullPath??null},get aliasOf(){return i()?.aliasOf??null},get extend(){return i()?.extend??{}},get meta(){const t=i();return t?t.meta??t.extend:{}},get chain(){return t.read()?.chain??[]},get direction(){return t.read()?.direction},get state(){return t.read()?.state},get stack(){return t.version.value,e()?.describeStack()},get routes(){return t.version.value,e()?.routeInfos()??[]},navigate:async(t,e)=>await s().navigate(t,e),navigateByName:async(t,e,i)=>await s().navigateByName(t,e,i),evict:async t=>{await s().evict(t)},resolve:t=>{const e=s(),i=e.resolve(t);return{chain:e.chainOf(i),result:i}},href:(t,e)=>s().href(t,e)}}(this._routerState,()=>this.urlRoutingModule),this.events=new Map,this._routerConfig=null,this._routerRoot=null,this._startedRouter=null,this._lifecycleOff=null,this._isDevelopment=!1,this._enableErrorLogging=!0}static{this._disposingCount=0}get state(){return this._state}_addressOf(t){return this.urlRoutingModule?.addressOf(t)??t}static CreateBuilder(){return new Qo}getAppShell(){return this.appShell}run(t,e){let s;if(p(()=>{so.startGc()},"Application.run.engine.startGc"),"string"==typeof t){if(s=document.querySelector(t),!s)throw y("MJX406",t)}else s=t;let i=e;this._state="running";const n=new Vi(s);this.appShell=n,p(()=>{n._keepElementOnDispose=!0,n.application=this,n.provider=this.provider},"Application.run.setupAppShell"),i?(i.parent=n,n.controls.add(i)):(i=n,i.controls.add(new vo({name:"default"}))),n.build(),this._routerRoot=i,this.urlRoutingModule&&(this.urlRoutingModule.start(i),this._startedRouter=this.urlRoutingModule)}insert(t){this.appShell.controls.add(t)}remove(t){this.appShell.controls.remove(t)}attach(t){this.appShell.controls.add(t)}detach(t){this.appShell.controls.detach(t)}appendToMainHost(t){this.appShell.element?.appendChild(t)}dispose(){if(this._disposing)return this._disposing;let t;this._state="disposing",Zo._disposingCount++,Yo=!1,p(()=>{this._removeLifecycleListeners()},"Application.dispose.lifecycle"),p(()=>{t=this.urlRoutingModule?.dispose?.()},"Application.dispose.router"),p(()=>{so.stopGc()},"Application.dispose.gcStop"),p(()=>{try{const t=window;t&&t.history&&"function"==typeof t.history.replaceState&&t.history.replaceState({},"","/")}catch{}},"Application.dispose.resetUrl"),Ne.mode="concurrent";const e=this.appShell;return this._disposing=(async()=>{try{await t}catch(t){v("MJX307",t)}if(e&&!e.isDisposed)try{await e.dispose()}catch(t){v("MJX307",t)}try{await this.provider.dispose()}catch{}Ko===this&&(Ko=null),this._state="disposed",Zo._disposingCount--})()}useTransitions(t){return Fe(t?.mode)&&(Ne.mode=t.mode),this}use(t){return this._middlewares.push(t),this}useGuard(t){return this._beforeEachGuards.push(t),this}async _runBeforeEachGuards(t,e){const s={to:t,from:e};for(const t of this._beforeEachGuards){let e,i=!1;const n=t=>{i=!0,e=t};try{await t(s,n)}catch(t){return v("MJX306",t,"guard"),!1}if(!i)return!1;if(!1===e)return!1;if("string"==typeof e)return e}return!0}useRouter(e){let s,i,n,o,r,a;return Array.isArray(e)?s=e:(s=e.routes,i=e.mode,n=e.fallbacks,o=e.hooks,r=e.scrollMemory,a=e.stack),this.urlRoutingModule&&this.urlRoutingModule.dispose(),this._routerConfig={mode:i,fallbacks:n,middlewareCollections:()=>this._middlewares,RouteItems:s,hooks:o,scrollMemory:r,stack:a},this.urlRoutingModule=new qo(this._routerConfig,this),this._routerState.reset(),p(()=>{!function(e){t.routes=e}(s),(this._isDevelopment||!0===globalThis.__MOTIF_DEV__)&&function(t){const e=new Map,s=new Map;function i(t,n,o){const r=t.path??"",a=String(r),c=""===n?a:_o(n,a),l=o>0&&"/"===a.trim(),h=""===a.trim();h&&b("MJX310",[n||"/"],{parentPath:n,path:a}),o>0&&a.length>0&&"/"!==a&&!a.startsWith("/")&&!a.startsWith("*")&&b("MJX311",[a,n||"/"],{parentPath:n,path:a}),n&&c===n&&(l||h||b("MJX312",[c],{parentPath:n,childPath:a}));const u=(e.get(c)||0)+1;e.set(c,u),u>1&&(l||h||b("MJX313",[c],{full:c}));const d=null==t.alias?[]:Array.isArray(t.alias)?t.alias:[t.alias];for(const t of d){const e=String(t??"");o>0&&e.length>0&&"/"!==e&&!e.startsWith("/")&&!e.startsWith("*")&&b("MJX314",[e,n||"/"],{parentPath:n,alias:e});const i=""===n?e:_o(n,e);i===c&&b("MJX315",[i],{full:c,alias:e});const r=(s.get(i)||0)+1;s.set(i,r),r>1&&b("MJX316",[i],{aliasFull:i})}const p=t.childs;if(Array.isArray(p))for(const t of p)i(t,c,o+1)}for(const e of t)i(e,"",0)}(s)},"Application.useRouter.devtools"),this}restartRouter(){const t=this._routerRoot;if(!t||!this._routerConfig)return this;const e=this._startedRouter,s=e?.shownUri;let i=this.urlRoutingModule;return i&&i!==e||(e?.dispose(),i=new qo(this._routerConfig,this),this.urlRoutingModule=i),this._routerState.reset(),this._startedRouter=i,i.start(t,s),this}async navigate(t,e){if(this.urlRoutingModule)return await this.urlRoutingModule.navigate(t,e);throw y("MJX309")}async navigateByName(t,e,s){if(this.urlRoutingModule)return await this.urlRoutingModule.navigateByName(t,e,s);throw y("MJX309")}on(t,e){var s=this.events.get(t);return s||(this.events.set(t,new Set),s=this.events.get(t)),s&&s.add(e),()=>this.off(t,e)}off(t,e){var s=this.events.get(t);s&&s.delete(e)}fire(t,e){var s=this.events.get(t);s&&s.forEach(s=>{w(()=>s(e),"MJX123",String(t))})}onRouterChanged(t){return this.on("motifjs-router-navigated",t)}get isVisible(){try{return"undefined"==typeof document||"hidden"!==document.visibilityState}catch{return!0}}get isOnline(){try{return"undefined"==typeof navigator||!1!==navigator.onLine}catch{return!0}}onLifecycle(t){return this._installLifecycleListeners(),this.on("motifjs-app-lifecycle",t)}_emitLifecycle(t){this.fire("motifjs-app-lifecycle",{state:t,visible:this.isVisible,online:this.isOnline})}_installLifecycleListeners(){if(this._lifecycleOff)return;const t=[],e=(e,s,i)=>{if(e)try{e.addEventListener(s,i),t.push(()=>{try{e.removeEventListener(s,i)}catch{}})}catch{}},s="undefined"!=typeof document?document:void 0,i="undefined"!=typeof window?window:void 0;e(s,"visibilitychange",()=>this._emitLifecycle(this.isVisible?"visible":"hidden")),e(s,"freeze",()=>this._emitLifecycle("frozen")),e(s,"resume",()=>this._emitLifecycle("resumed")),e(i,"pageshow",t=>{t&&t.persisted&&this._emitLifecycle("restored")}),e(i,"online",()=>this._emitLifecycle("online")),e(i,"offline",()=>this._emitLifecycle("offline")),this._lifecycleOff=t}_removeLifecycleListeners(){const t=this._lifecycleOff;if(this._lifecycleOff=null,t)for(const e of t)e()}get isDevelopmentModeEnabled(){return this._isDevelopment}useReactiveMonitor(t={}){return p(()=>{yt(t)},"Application.useReactiveMonitor.core"),this}useDevelopment(e=!0){return this._isDevelopment=e,h.setDevelopmentMode(e),p(()=>{globalThis.__MOTIF_DEV__=e},"Application.useDevelopment.flag"),p(()=>{!function(e){t.enabled=e;try{const i=globalThis;e?(t.exposed={version:1,on:n,getWarnings:r,getRoutes:a,isEnabled:s},i.__MOTIF_DEVTOOLS__=t.exposed):(null!==t.exposed&&i.__MOTIF_DEVTOOLS__===t.exposed&&delete i.__MOTIF_DEVTOOLS__,t.exposed=null)}catch{}}(e)},"Application.useDevelopment.devtools"),e&&function(){for(const t of Array.from(ot))rt(t)}(),this}useLogging(t=!0){return this._enableErrorLogging=t,function(t){h.setConsoleLogging(t)}(t),this}}function tr(){return Zo.main.router}function er(){return{application:Zo.main,services:Zo.main.provider,router:Zo.main.router,attach(...t){Zo.main&&Zo.main.getAppShell().controls.add(...t)}}}function sr(t){return e=>{fo.set(e,{lifetime:t?.lifetime??"transient",deps:t?.deps})}}function ir(t){try{return Zo.main.provider.get(t)}catch(e){return b("MJX414",[nr(t),String(e?.message??e)],{token:t,error:e}),null}}function nr(t){return"function"==typeof t?t.name||"[AnonymousClass]":String(t)}function or(t){return t&&"TimeoutError"===t.name}class rr extends _{constructor(){super("MJX605",g("MJX605")),this.name="TimeoutError"}}function ar(t){return new Promise(e=>setTimeout(e,t))}function cr(t,e=.1){const s=(2*Math.random()-1)*e*t;return Math.max(0,Math.floor(t+s))}class lr{}class hr extends lr{constructor(t={}){super(),this.retries=t.retries??3,this.backoff=t.backoff??"exponential",this.delayMs=t.delay??100,this.jitter=Math.min(Math.max(t.jitter??.1,0),1),this.shouldHandle=t.shouldHandle??(t=>!!t&&!or(t)),this.onRetry=t.onRetry}calcDelay(t){if("none"===this.backoff)return 0;if("fixed"===this.backoff)return cr(this.delayMs,this.jitter);return cr(this.delayMs*Math.pow(2,t-1),this.jitter)}async execute(t,e){let s;for(let i=1;i<=this.retries+1;i++)try{return await Promise.resolve(t(e))}catch(t){if(s=t,!this.shouldHandle(t)||i>this.retries)break;const n=this.calcDelay(i);this.onRetry&&await this.onRetry(i,t,n,e),n>0&&await ar(n)}throw s}}class ur extends lr{constructor(t){super(),this.timeoutMs=t.timeoutMs}async execute(t,e){let s;const i=Promise.resolve(t(e)),n=new Promise((t,e)=>{s=setTimeout(()=>e(new rr),this.timeoutMs)});try{return await Promise.race([i,n])}finally{clearTimeout(s)}}}class dr extends lr{constructor(t={}){super(),this.state="CLOSED",this.failureCount=0,this.successCount=0,this.nextAttemptTime=0,this.failureThreshold=t.failureThreshold??5,this.successThreshold=t.successThreshold??2,this.durationOfBreakMs=t.durationOfBreakMs??6e4,this.shouldHandle=t.shouldHandle??(t=>!!t&&!or(t)),this.onStateChange=t.onStateChange}async changeState(t){const e=this.state;this.state=t,this.failureCount=0,this.successCount=0,"OPEN"===t&&(this.nextAttemptTime=Date.now()+this.durationOfBreakMs),this.onStateChange&&await this.onStateChange(e,t)}async execute(t,e){if("OPEN"===this.state){if(!(Date.now()>=this.nextAttemptTime))throw y("MJX602");await this.changeState("HALF_OPEN")}try{const s=await Promise.resolve(t(e));return"HALF_OPEN"===this.state?(this.successCount++,this.successCount>=this.successThreshold&&await this.changeState("CLOSED")):"CLOSED"===this.state&&(this.failureCount=0),s}catch(t){throw this.shouldHandle(t)&&(this.failureCount++,("HALF_OPEN"===this.state||"CLOSED"===this.state&&this.failureCount>=this.failureThreshold)&&await this.changeState("OPEN")),t}}getState(){return this.state}}class pr extends lr{constructor(t={}){super(),this.active=0,this.queue=[],this.maxConcurrent=t.maxConcurrent??10,this.maxQueue=t.maxQueue??50}dequeue(){if(0===this.queue.length)return;if(this.active>=this.maxConcurrent)return;this.queue.shift()()}async execute(t,e){if(this.active>=this.maxConcurrent){if(this.queue.length>=this.maxQueue)throw y("MJX603");await new Promise(t=>{this.queue.push(t)})}this.active++;try{return await Promise.resolve(t(e))}finally{this.active--,this.dequeue()}}}class fr extends lr{constructor(t={}){super(),this.tokensPerInterval=t.tokensPerInterval??1,this.intervalMs=t.intervalMs??1e3,this.capacity=t.capacity??this.tokensPerInterval,this.tokens=this.capacity,this.lastRefill=Date.now()}refill(){const t=Date.now(),e=t-this.lastRefill;if(e<=0)return;const s=Math.floor(e/this.intervalMs)*this.tokensPerInterval;s>0&&(this.tokens=Math.min(this.capacity,this.tokens+s),this.lastRefill=t)}async execute(t,e){if(this.refill(),this.tokens<=0)throw y("MJX604");return this.tokens-=1,Promise.resolve(t(e))}}class mr extends lr{constructor(t){super(),this.fallback=t.fallback,this.shouldHandle=t.shouldHandle??(()=>!0)}async execute(t,e){try{return await Promise.resolve(t(e))}catch(t){if(!this.shouldHandle(t))throw t;return await Promise.resolve(this.fallback(t,e))}}}class _r extends lr{constructor(...t){super(),this.policies=t}async execute(t,e){return this.policies.reduceRight((t,e)=>s=>e.execute(()=>t(s),s),t)(e)}}const gr=t=>new hr(t),yr=t=>new ur(t),vr=t=>new dr(t),wr=t=>new pr(t),br=t=>new fr(t),Sr=t=>new mr(t),Cr=(...t)=>new _r(...t);function Mr(t,e){return s=>t.execute(e,s)}class kr{constructor(){this.resiliences=[],this.retry=t=>(this.resiliences.push(gr(t)),this),this.timeout=t=>(this.resiliences.push(yr(t)),this),this.circuitBreaker=t=>(this.resiliences.push(vr(t)),this),this.bulkhead=t=>(this.resiliences.push(wr(t)),this),this.rateLimiter=t=>(this.resiliences.push(br(t)),this),this.fallback=t=>(this.resiliences.push(Sr(t)),this)}static get create(){return new kr}async execute(t,e){return Cr(...this.resiliences).execute(t,e)}}export{Zo as Application,Qo as ApplicationBuilder,Vi as Component,ni as ComponentBase,oe as ComponentMotif,le as Computed,On as ContentBlock,Tn as ContentBody,pn as ControlCollection,K as Dictionary,k as Disposable,C as DisposableStore,zt as Emitter,l as ErrorHandler,$i as FNComponent,rn as FragmentNode,kn as Frame,ir as FromService,sr as Injectable,wn as Lazy,he as LazyComputed,Q as LinkedList,V as List,_ as MotifError,W as NameValuePair,at as NodeTypes,st as Query,kr as Resilience,Vo as RouterLink,vo as RouterView,mo as ServiceCollection,Ae as ServiceProvider,ce as Signal,Rn as Transport,In as TransportTo,Xn as Transporter,po as Virtualization,xt as asyncTracking,ao as clearModel,yt as configureReactivityLeakMonitor,ho as createComputed,uo as createLazyComputed,lo as createSignal,Mr as decorate,co as deepClone,S as disposableCore,ln as dom,Mt as effect,h as errorHandler,Me as inject,rt as motifCompiled,Yi as motifComponent,nn as motifFragment,Dn as preProcessing,oo as reactive,tt as read,u as safeCall,d as safeCallAsync,p as safeCallSilent,f as setUnexpectedErrorHandler,$ as toDisposable,Z as toGetter,At as untracked,er as useApplication,ro as useModel,tr as useNavigation};
|
|
2
2
|
//# sourceMappingURL=index.esm.min.js.map
|