mates 0.4.0-beta.12 → 0.4.0-beta.13
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/Mutables/scope/scope.d.ts.map +1 -1
- package/dist/index.esm.js +9 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
const t=globalThis,e=t.trustedTypes,n=e?e.createPolicy("lit-html",{createHTML:t=>t}):void 0,s="$lit$",i=`lit$${Math.random().toFixed(9).slice(2)}$`,r="?"+i,o=`<${r}>`,a=document,l=()=>a.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,h=Array.isArray,u=t=>h(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,p=/-->/g,m=/>/g,_=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,y=/"/g,w=/^(?:script|style|textarea|title)$/i,v=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),b=v(1),S=v(2),E=Symbol.for("lit-noChange"),C=Symbol.for("lit-nothing"),A=new WeakMap,k=a.createTreeWalker(a,129);function M(t,e){if(!h(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==n?n.createHTML(e):e}const
|
|
6
|
+
const t=globalThis,e=t.trustedTypes,n=e?e.createPolicy("lit-html",{createHTML:t=>t}):void 0,s="$lit$",i=`lit$${Math.random().toFixed(9).slice(2)}$`,r="?"+i,o=`<${r}>`,a=document,l=()=>a.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,h=Array.isArray,u=t=>h(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,p=/-->/g,m=/>/g,_=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,y=/"/g,w=/^(?:script|style|textarea|title)$/i,v=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),b=v(1),S=v(2),E=Symbol.for("lit-noChange"),C=Symbol.for("lit-nothing"),A=new WeakMap,k=a.createTreeWalker(a,129);function M(t,e){if(!h(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==n?n.createHTML(e):e}const $=(t,e)=>{const n=t.length-1,r=[];let a,l=2===e?"<svg>":3===e?"<math>":"",c=f;for(let e=0;e<n;e++){const n=t[e];let h,u,d=-1,v=0;for(;v<n.length&&(c.lastIndex=v,u=c.exec(n),null!==u);)v=c.lastIndex,c===f?"!--"===u[1]?c=p:void 0!==u[1]?c=m:void 0!==u[2]?(w.test(u[2])&&(a=RegExp("</"+u[2],"g")),c=_):void 0!==u[3]&&(c=_):c===_?">"===u[0]?(c=a??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,h=u[1],c=void 0===u[3]?_:'"'===u[3]?y:g):c===y||c===g?c=_:c===p||c===m?c=f:(c=_,a=void 0);const b=c===_&&t[e+1].startsWith("/>")?" ":"";l+=c===f?n+o:d>=0?(r.push(h),n.slice(0,d)+s+n.slice(d)+i+b):n+i+(-2===d?e:b)}return[M(t,l+(t[n]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),r]};class x{constructor({strings:t,_$litType$:n},o){let a;this.parts=[];let c=0,h=0;const u=t.length-1,d=this.parts,[f,p]=$(t,n);if(this.el=x.createElement(f,o),k.currentNode=this.el.content,2===n||3===n){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(a=k.nextNode())&&d.length<u;){if(1===a.nodeType){if(a.hasAttributes())for(const t of a.getAttributeNames())if(t.endsWith(s)){const e=p[h++],n=a.getAttribute(t).split(i),s=/([.?@])?(.*)/.exec(e);d.push({type:1,index:c,name:s[2],strings:n,ctor:"."===s[1]?P:"?"===s[1]?z:"@"===s[1]?D:I}),a.removeAttribute(t)}else t.startsWith(i)&&(d.push({type:6,index:c}),a.removeAttribute(t));if(w.test(a.tagName)){const t=a.textContent.split(i),n=t.length-1;if(n>0){a.textContent=e?e.emptyScript:"";for(let e=0;e<n;e++)a.append(t[e],l()),k.nextNode(),d.push({type:2,index:++c});a.append(t[n],l())}}}else if(8===a.nodeType)if(a.data===r)d.push({type:2,index:c});else{let t=-1;for(;-1!==(t=a.data.indexOf(i,t+1));)d.push({type:7,index:c}),t+=i.length-1}c++}}static createElement(t,e){const n=a.createElement("template");return n.innerHTML=t,n}}function T(t,e,n=t,s){if(e===E)return e;let i=void 0!==s?n._$Co?.[s]:n._$Cl;const r=c(e)?void 0:e._$litDirective$;return i?.constructor!==r&&(i?._$AO?.(!1),void 0===r?i=void 0:(i=new r(t),i._$AT(t,n,s)),void 0!==s?(n._$Co??=[])[s]=i:n._$Cl=i),void 0!==i&&(e=T(t,i._$AS(t,e.values),i,s)),e}let R=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:n}=this._$AD,s=(t?.creationScope??a).importNode(e,!0);k.currentNode=s;let i=k.nextNode(),r=0,o=0,l=n[0];for(;void 0!==l;){if(r===l.index){let e;2===l.type?e=new O(i,i.nextSibling,this,t):1===l.type?e=new l.ctor(i,l.name,l.strings,this,t):6===l.type&&(e=new N(i,this,t)),this._$AV.push(e),l=n[++o]}r!==l?.index&&(i=k.nextNode(),r++)}return k.currentNode=a,s}p(t){let e=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}};class O{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,n,s){this.type=2,this._$AH=C,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=T(this,t,e),c(t)?t===C||null==t||""===t?(this._$AH!==C&&this._$AR(),this._$AH=C):t!==this._$AH&&t!==E&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==C&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(a.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:n}=t,s="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=x.createElement(M(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new R(s,this),n=t.u(this.options);t.p(e),this.T(n),this._$AH=t}}_$AC(t){let e=A.get(t.strings);return void 0===e&&A.set(t.strings,e=new x(t)),e}k(t){h(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,s=0;for(const i of t)s===e.length?e.push(n=new O(this.O(l()),this.O(l()),this,this.options)):n=e[s],n._$AI(i),s++;s<e.length&&(this._$AR(n&&n._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class I{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,n,s,i){this.type=1,this._$AH=C,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=i,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=C}_$AI(t,e=this,n,s){const i=this.strings;let r=!1;if(void 0===i)t=T(this,t,e,0),r=!c(t)||t!==this._$AH&&t!==E,r&&(this._$AH=t);else{const s=t;let o,a;for(t=i[0],o=0;o<i.length-1;o++)a=T(this,s[n+o],e,o),a===E&&(a=this._$AH[o]),r||=!c(a)||a!==this._$AH[o],a===C?t=C:t!==C&&(t+=(a??"")+i[o+1]),this._$AH[o]=a}r&&!s&&this.j(t)}j(t){t===C?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class P extends I{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===C?void 0:t}}class z extends I{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==C)}}class D extends I{constructor(t,e,n,s,i){super(t,e,n,s,i),this.type=5}_$AI(t,e=this){if((t=T(this,t,e,0)??C)===E)return;const n=this._$AH,s=t===C&&n!==C||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,i=t!==C&&(n===C||s);s&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class N{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){T(this,t)}}const L={M:s,P:i,A:r,C:1,L:$,R:R,D:u,V:T,I:O,H:I,N:z,U:D,B:P,F:N},j=t.litHtmlPolyfillSupport;j?.(x,O),(t.litHtmlVersions??=[]).push("3.2.1");const F=(t,e,n)=>{const s=n?.renderBefore??e;let i=s._$litPart$;if(void 0===i){const t=n?.renderBefore??null;s._$litPart$=i=new O(e.insertBefore(l(),t),t,void 0,n??{})}return i._$AI(t),i
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
@@ -60,7 +60,7 @@ function*kt(t,e,n=1){const s=void 0===e?0:t;e??=t;for(let t=s;n>0?t<e:e<t;t+=n)y
|
|
|
60
60
|
* @license
|
|
61
61
|
* Copyright 2017 Google LLC
|
|
62
62
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
63
|
-
*/const Mt=(t,e,n)=>{const s=new Map;for(let i=e;i<=n;i++)s.set(t[i],i);return s}
|
|
63
|
+
*/const Mt=(t,e,n)=>{const s=new Map;for(let i=e;i<=n;i++)s.set(t[i],i);return s},$t=Y(class extends q{constructor(t){if(super(t),t.type!==V)throw Error("repeat() can only be used in text expressions")}dt(t,e,n){let s;void 0===n?n=e:void 0!==e&&(s=e);const i=[],r=[];let o=0;for(const e of t)i[o]=s?s(e,o):o,r[o]=n(e,o),o++;return{values:r,keys:i}}render(t,e,n){return this.dt(t,e,n).values}update(t,[e,n,s]){const i=nt(t),{values:r,keys:o}=this.dt(e,n,s);if(!Array.isArray(i))return this.ut=o,r;const a=this.ut??=[],l=[];let c,h,u=0,d=i.length-1,f=0,p=r.length-1;for(;u<=d&&f<=p;)if(null===i[u])u++;else if(null===i[d])d--;else if(a[u]===o[f])l[f]=J(i[u],r[f]),u++,f++;else if(a[d]===o[p])l[p]=J(i[d],r[p]),d--,p--;else if(a[u]===o[p])l[p]=J(i[u],r[p]),Q(t,l[p+1],i[u]),u++,p--;else if(a[d]===o[f])l[f]=J(i[d],r[f]),Q(t,i[u],i[d]),d--,f++;else if(void 0===c&&(c=Mt(o,f,p),h=Mt(a,u,d)),c.has(a[u]))if(c.has(a[d])){const e=h.get(o[f]),n=void 0!==e?i[e]:null;if(null===n){const e=Q(t,i[u]);J(e,r[f]),l[f]=e}else l[f]=J(n,r[f]),Q(t,i[u],n),i[e]=null;f++}else st(i[d]),d--;else st(i[u]),u++;for(;f<=p;){const e=Q(t,l[p+1]);J(e,r[f]),l[f++]=e}for(;u<=d;){const t=i[u++];null!==t&&st(t)}return this.ut=o,et(t,l),E}}),xt="important",Tt=" !"+xt,Rt=Y(class extends q{constructor(t){if(super(t),t.type!==U||"style"!==t.name||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,n)=>{const s=t[n];return null==s?e:e+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(t,[e]){const{style:n}=t.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(e)),this.render(e);for(const t of this.ft)null==e[t]&&(this.ft.delete(t),t.includes("-")?n.removeProperty(t):n[t]=null);for(const t in e){const s=e[t];if(null!=s){this.ft.add(t);const e="string"==typeof s&&s.endsWith(Tt);t.includes("-")||e?n.setProperty(t,e?s.slice(0,-11):s,e?xt:""):n[t]=s}}return E}});
|
|
64
64
|
/**
|
|
65
65
|
* @license
|
|
66
66
|
* Copyright 2018 Google LLC
|
|
@@ -81,7 +81,7 @@ class Ot extends q{constructor(t){if(super(t),this.it=C,t.type!==V)throw Error(t
|
|
|
81
81
|
* @license
|
|
82
82
|
* Copyright 2021 Google LLC
|
|
83
83
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
84
|
-
*/function Nt(t,e,n){return t?e(t):n?.(t)}const Lt=()=>{},jt={registerComponent:Lt,unregisterComponent:Lt,notifyRender:Lt,getComponentName:()=>"Anonymous",logComponentMount:Lt,logComponentRender:Lt,logComponentUnmount:Lt,logAtomSet:Lt,logAtomUpdate:Lt,logEventTrigger:Lt,logCleanupEventTrigger:Lt,logFetchRequest:Lt,logFetchResponse:Lt,logFetchError:Lt,recordRender:Lt};function Ft(t,e){jt.registerComponent(t,e)}function Ut(t){return jt.getComponentName(t)}function Vt(t,e){jt.logEventTrigger(t,e)}function Wt(t,e,n){jt.recordRender(t,e,n)}function Bt(t){t.registerComponent&&(jt.registerComponent=t.registerComponent),t.unregisterComponent&&(jt.unregisterComponent=t.unregisterComponent),t.notifyRender&&(jt.notifyRender=t.notifyRender),t.getComponentName&&(jt.getComponentName=t.getComponentName),t.logComponentMount&&(jt.logComponentMount=t.logComponentMount),t.logComponentRender&&(jt.logComponentRender=t.logComponentRender),t.logComponentUnmount&&(jt.logComponentUnmount=t.logComponentUnmount),t.logAtomSet&&(jt.logAtomSet=t.logAtomSet),t.logAtomUpdate&&(jt.logAtomUpdate=t.logAtomUpdate),t.logEventTrigger&&(jt.logEventTrigger=t.logEventTrigger),t.logCleanupEventTrigger&&(jt.logCleanupEventTrigger=t.logCleanupEventTrigger),t.logFetchRequest&&(jt.logFetchRequest=t.logFetchRequest),t.logFetchResponse&&(jt.logFetchResponse=t.logFetchResponse),t.logFetchError&&(jt.logFetchError=t.logFetchError),t.recordRender&&(jt.recordRender=t.recordRender)}function Ht(){return jt.registerComponent!==Lt}const Yt=Symbol.for("mates.readTracking");globalThis[Yt]||(globalThis[Yt]={enableReadTracking:!1,storesBeingRead:new Set,effectRunning:!1});const qt=globalThis[Yt];function Xt(){return qt.enableReadTracking}function Zt(){return qt.storesBeingRead}function Gt(){return qt.effectRunning}function Kt(t){qt.storesBeingRead.add(t)}function Qt(){qt.effectRunning=!0}function Jt(){qt.effectRunning=!1}function te(){const t={prevEnabled:qt.enableReadTracking,prevStores:qt.storesBeingRead};return qt.enableReadTracking=!0,qt.storesBeingRead=new Set,t}function ee(t){const e=qt.storesBeingRead;return qt.enableReadTracking=t.prevEnabled,qt.storesBeingRead=t.prevStores,e}const ne=te,se=ee,ie=Symbol.for("mates.componentRunningStatus");globalThis[ie]||(globalThis[ie]={setupInProgress:!1,templateInProgress:!1,viewOuterInProgress:!1,isHookRunning:!1});const re=globalThis[ie];function oe(){return!re.isHookRunning&&(re.templateInProgress||Gt())}function ae(t){if(!re.isHookRunning){if(re.templateInProgress)throw new Error(`${t} cannot be created during template function execution. Only scopes (useScope) are allowed in templates.`);if(Gt())throw new Error(`${t} cannot be created inside a memo() or effect(). They should only read state, not create new reactive primitives.`)}}function le(t){if(!re.viewOuterInProgress){if(re.templateInProgress)throw new Error(`${t} cannot be called during template function execution. Move it to the component's outer function.`);if(Gt())throw new Error(`${t} cannot be called inside a memo() or effect(). Move it to the component's outer function.`);throw new Error(`${t} must be called inside a component's outer function. It cannot be used at module level or inside inner functions (e.g. event handlers, timers, or callbacks).`)}}const ce=new Set,he={name:"matesLogEvent",__isEvent___:!0,trigger(t){ce.forEach(e=>{try{e(t)}catch(t){}})},__subscribe:t=>(ce.add(t),()=>ce.delete(t))};function ue(t){try{return structuredClone(t)}catch(e){return t}}function de(){if("undefined"==typeof window)return!0;const t=window.location.hostname;return"localhost"===t||"127.0.0.1"===t||"[::1]"===t||t.startsWith("192.168.")||t.startsWith("10.")||t.endsWith(".local")}function fe(t){try{he.trigger(t)}catch(t){}}function pe(t,e){fe({level:"log",message:t,data:void 0!==e?ue(e):void 0,ts:performance.now()}),de()&&(void 0!==e?console.log(t,e):console.log(t))}function me(t,e){fe({level:"error",message:t,data:void 0!==e?ue(e):void 0,ts:performance.now()}),de()&&(void 0!==e?console.error(`[${e}]`,t):console.error(t))}function _e(t,e){fe({level:"warn",message:t,data:void 0!==e?ue(e):void 0,ts:performance.now()}),de()&&(void 0!==e?console.warn(t,e):console.warn(t))}function ge(t,e,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(t):s?s.value:e.get(t)}function ye(t,e,n,s,i){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?i.call(t,n):i?i.value=n:e.set(t,n),n}var we,ve,be;"function"==typeof SuppressedError&&SuppressedError;class Se{constructor(){we.set(this,new Set),ve.set(this,1)}subscribe(t){return ge(this,we,"f").add(t),()=>ge(this,we,"f").delete(t)}notify(){var t;ye(this,ve,(t=ge(this,ve,"f"),++t),"f"),[...ge(this,we,"f")].forEach(t=>{try{t?.()}catch(t){console.error(t)}})}getVersion(){return ge(this,ve,"f")}get subscriberCount(){return ge(this,we,"f").size}clear(){ge(this,we,"f").clear()}}we=new WeakMap,ve=new WeakMap;class Ee{constructor(){be.set(this,new Set)}subscribe(t){return ae("subscribe"),ge(this,be,"f").has(t)?()=>{}:(ge(this,be,"f").add(t),()=>ge(this,be,"f").delete(t))}trigger(t){ge(this,be,"f").forEach(e=>{try{e(t)}catch(t){console.error("Error in event handler:",t)}})}get handlerCount(){return ge(this,be,"f").size}clear(){ge(this,be,"f").clear()}}be=new WeakMap;const Ce=Symbol.for("mates.hostStack");globalThis[Ce]||(globalThis[Ce]=[]);const Ae=globalThis[Ce];function ke(t,e){Ae.push(t);let n=null;try{n=e()}finally{Ae.pop()}return n}function Me(t){const e=Ae[Ae.length-1];if(!e){if(!1!==t)throw new Error("getCurrentHost(): No active host context");return null}return e}const xe=(t,e)=>{const n=Me(!1);n&&n.addToCleanUps(t,e)},$e=t=>{ae("xTabEvent");const e=new Set,n=n=>{e.forEach(e=>{try{e(n)}catch(e){me(e,`xTabEvent(${t}) handler`)}})},s="undefined"!=typeof BroadcastChannel?new BroadcastChannel(t):null;s&&(s.onmessage=t=>{n(t.data)});return{trigger:e=>{if(Vt(t,e),s)try{s.postMessage(e)}catch(e){me(e,`xTabEvent(${t}) postMessage`)}n(e)},__subscribe:t=>{e.add(t);const n=()=>{e.delete(t)};return xe(t,n),n},close:()=>{s&&s.close()},name:t,__isEvent___:!0,__isXTabEvent___:!0}},Te=t=>{ae("event");const e=t||Math.random().toString(36).substring(2,15),n=new Ee;return{trigger:t=>{Vt(e,t),n.trigger(t)},__subscribe:t=>n.subscribe(t),name:e,__isEvent___:!0}},Re=t=>{ae("cleanupEvent");const e=t||Math.random().toString(36).substring(2,15),n=new Map,s=()=>{n.forEach(t=>{if(t)try{t()}catch(t){me(t,"cleanupEvent cleanup")}})},i={trigger:t=>{!function(t,e){jt.logCleanupEventTrigger(t,e)}(e,t),n.forEach((e,s)=>{if(e)try{e()}catch(t){me(t,"cleanupEvent cleanup")}try{const e=s(t);n.set(s,e)}catch(t){me(t,"cleanupEvent handler"),n.set(s,void 0)}})},__subscribe:t=>(n.set(t,void 0),()=>{const e=n.get(t);if(e)try{e()}catch(t){me(t,"cleanupEvent unsubscribe")}n.delete(t)}),cleanup:s,cleanupAndClearSubs:()=>{s(),n.clear()},get hasSubscribers(){return n.size>0},name:e,__isCleanupEvent___:!0,__isEvent___:!0};return i};let Oe=!1;function Ie(t){Oe=t,t||(ze=0,De=null,Ne=null)}function Pe(){return Oe}let ze=0,De=null,Ne=null;function Le(t){De=t,ze=0,null!==Ne&&(clearTimeout(Ne),Ne=null)}function je(){Oe&&(ze++,null!==Ne&&(clearTimeout(Ne),Ne=null))}function Fe(){Oe&&(ze=Math.max(0,ze-1),function(){if(ze>0)return;if(!De)return;if(null!==Ne)return;Ne=setTimeout(()=>{if(Ne=null,0===ze&&De){const t=De;De=null,t()}},5)}())}function Ue(){if(!Oe||!De)return;null!==Ne&&(clearTimeout(Ne),Ne=null);const t=De;De=null,t()}function Ve(){return ze}function We(){return void 0!==import.meta&&import.meta.env?"production"!==import.meta.env.NODE_ENV:"undefined"==typeof process||!process.env||"production"!==process.env.NODE_ENV}function Be(t){t.DOMReadyEvent?.cleanupAndClearSubs(),t.PaintEvent?.cleanupAndClearSubs(),t.cleanups.forEach(t=>t.forEach(t=>{try{t()}catch(t){console.error("Error during cleanup:",t)}})),t.cleanups.clear(),t.onEachUpdateCallbacks.clear(),t.scopes=new Map,t._templateFn=null,t._xviewRender=()=>{},t._hasMounted=!1,t._errorState=null,t._errorHandlers=[]}const He=new class{constructor(){this.pending=new Set,this.isScheduled=!1}scheduleDisconnect(t){this.pending.add(t),this.isScheduled||(this.isScheduled=!0,queueMicrotask(()=>this.flush()))}cancelDisconnect(t){this.pending.delete(t)}flush(){const t=Array.from(this.pending);this.pending.clear(),this.isScheduled=!1;for(const e of t)e?.isConnected||(Be(e),e._view=null,e._props={},e.oldView=void 0)}reset(){this.pending.clear(),this.isScheduled=!1}},Ye=new class{constructor(){this.pendingEffects=new Set,this.isScheduled=!1,this._isFlushing=!1}get isFlushing(){return this._isFlushing}reset(){this.pendingEffects.clear(),this.isScheduled=!1,this._isFlushing=!1}schedule(t){this.pendingEffects.add(t),this.isScheduled||(this.isScheduled=!0,queueMicrotask(()=>this.flush()))}flush(){this._isFlushing=!0;let t=0;for(;this.pendingEffects.size>0;){if(t++>=500){this.pendingEffects.clear(),console.error("EffectScheduler: Maximum iteration limit (500) reached. This likely means an effect is infinitely updating its own dependency. Remaining effects have been dropped.");break}const e=Array.from(this.pendingEffects);this.pendingEffects.clear();for(const t of e)try{t()}catch(t){me(t,"Effect")}}this._isFlushing=!1,this.isScheduled=!1,qe.flush()}},qe=new class{constructor(){this.pendingComponents=new Set,this.nextPendingComponents=new Set,this._currentWave=new Set,this.isScheduled=!1,this._isFlushing=!1,this._flushVersion=0,this._onIdleCallbacks=[]}get flushVersion(){return this._flushVersion}onceIdle(t){this._onIdleCallbacks.push(t),this._isFlushing||this.isScheduled||queueMicrotask(()=>this._drainIdleCallbacks())}_drainIdleCallbacks(){if(this._isFlushing||this.isScheduled)return;if(this.pendingComponents.size>0||this.nextPendingComponents.size>0)return;const t=this._onIdleCallbacks.splice(0);for(const e of t)try{e()}catch(t){console.error(t)}}reset(){this.pendingComponents.clear(),this.nextPendingComponents.clear(),this._currentWave.clear(),this._onIdleCallbacks.length=0,this.isScheduled=!1,this._isFlushing=!1}schedule(t){if(this._isFlushing){if(this._currentWave.has(t)&&t._renderVersion!==this._flushVersion)return;this.nextPendingComponents.add(t)}else this.pendingComponents.add(t);this.isScheduled||(this.isScheduled=!0,queueMicrotask(()=>{Ye.isScheduled||Ye.isFlushing||this.flush()}))}flush(){for(this.nextPendingComponents.size>0&&(this.nextPendingComponents.forEach(t=>this.pendingComponents.add(t)),this.nextPendingComponents.clear()),this._isFlushing=!0,this._flushVersion++;this.pendingComponents.size>0;){const t=Array.from(this.pendingComponents);this.pendingComponents.clear(),t.sort((t,e)=>t._depth-e._depth),this._currentWave=new Set(t);for(const e of t)if(e.isConnected)try{e._render()}catch(t){me(t,"Component render")}this._currentWave.clear()}this._isFlushing=!1,this.isScheduled=!1,this.nextPendingComponents.size>0?(this.isScheduled=!0,queueMicrotask(()=>{Ye.isScheduled||Ye.isFlushing||this.flush()})):this._drainIdleCallbacks()}},Xe=()=>{if(re.templateInProgress&&!re.setupInProgress)throw Error("Providers such as atoms, units, bubbles, getters, setters and actions can't be created inside the template function, you can create them in view function. Because template function gets called everytime the view updates.")},Ze=()=>{},Ge=t=>{Xe(),t.__isOnMount__=!0;const e=Me();e.addToCleanUps(t,Ze);if("AsyncFunction"===t.constructor.name&&Pe())return e._asyncMountQueue=e._asyncMountQueue??[],void e._asyncMountQueue.push(t);let n=!1;e.DOMReadyEvent.__subscribe(()=>{if(n)return;n=!0;const s=t();if(s&&"object"==typeof s&&"function"==typeof s.then)return;const i=s;i&&e.addToCleanUps(t,i)})},Ke=t=>{Xe(),t.__isOnPaint__=!0;const e=Me();e.addToCleanUps(t,Ze),e.PaintEvent.__subscribe(()=>t())},Qe=t=>{Xe(),t.__isOnAllMount__=!0;const e=Me();e.addToCleanUps(t,Ze),qe.onceIdle(()=>{if(!e.isConnected)return;const n=t();n&&e.addToCleanUps(t,n)})},Je=t=>{Xe(),t.__isOnCleanup__=!0;Me().addToCleanUps(t,t)},tn=(t,e=!0)=>{if(e&&ae("Setter"),re.setupInProgress&&e)throw new Error("Setter cannot be created inside setup function. Define setters as class properties before setup runs.");let n=t;const s=Me();e&&Xe();const i=new Set;try{const t=(...t)=>{const e=n(...t);return[...i].forEach(t=>{try{Ye.schedule(()=>t?.())}catch(t){console.error(t)}}),s?.isConnected&&qe.schedule(s),e};return t.__subscribe=t=>(ae("subscribe"),i.add(t),()=>i.delete(t)),t.__isSetter___=!0,t.set=t=>{n=t},Object.defineProperty(t,"__version__",{get:()=>0}),t}catch(t){throw new Error("You can only use setter or _ inside a scope or useState or view component's outer function")}},en=tn;function nn(t,e=!0,n){if(Gt())return;const s=Me(e);if(s&&t&&!s.cleanups.has(t)){const e=n||t.__subscribe||t.subscribe,i=e?.(()=>{qe.schedule(s)});s.addToCleanUps(t,i)}}function sn(t){return nn(t,!0),t}const rn=(t,e)=>{t.__isOn__=!0,ae("on");const n=new Set;let s;const i=()=>{if(s){try{s()}catch(t){console.error("Error in on() cleanup:",t)}s=void 0}const e=t();"function"==typeof e&&(s=e)},r=()=>Ye.schedule(i);e.forEach(t=>{n.add(t.__subscribe(r))});const o=()=>{if(n.forEach(t=>t()),s){try{s()}catch(t){console.error("Error in on() cleanup:",t)}s=void 0}};return xe(t,o),o};function on(t){let e=null;const n=new CustomEvent("request-context",{bubbles:!0,composed:!0,detail:{context:t,resolve(t=null){e=t}}});return Me().dispatchEvent(n),e}function an(){return We()&&"undefined"!=typeof window&&!!window.__mates_hmr}function ln(t){return!!t&&("AsyncFunction"===t.constructor?.name||t instanceof Promise||"object"==typeof t&&null!==t&&"then"in t||"function"==typeof t.then)}function cn(t){return"function"==typeof t?t():t}function hn(t){return t.default||t}class un extends HTMLElement{addScope(t,e){this.scopes.set(t,e)}onEachUpdate(t){this.onEachUpdateCallbacks.add(t)}constructor(){super(),this.name="Anonymous",this.scopes=new Map,this._useStates=[],this.lastVersion=-1,this._depth=0,this._parentComponent=null,this._renderVersion=0,this._errorHandlers=[],this._errorState=null,this.onEachUpdateCallbacks=new Set,this.DOMReadyEvent=null,this.PaintEvent=null,this._isViewLoading=!1,this._onRequestParentScope=t=>{const e=t,n=e.detail?.ScopeClass;if(n&&this.scopes.has(n)){const t=this.scopes.get(n);t&&(e.stopPropagation(),e.detail.resolve(t))}},this._props={},this._propsFn=()=>this._props,this._view=null,this._templateFn=null,this._hasMounted=!1,this._renderScheduled=!1,this.componentId=Math.random(),this.cleanups=new Map,this._xviewRender=()=>{};const t=re.templateInProgress;re.templateInProgress=!1,ke(this,()=>{this.DOMReadyEvent=Re("DOMReady"),this.PaintEvent=Re("Paint")}),re.templateInProgress=t}set props(t){this._props=t,qe.schedule(this)}get props(){return this._props}_applyViewChange(t,e){this.oldView!==t&&(this.oldView=t,e(t),(this._hasMounted||this._errorState)&&Be(this))}set view(t){if(null!==t){if(ln(t))return this._isViewLoading=!0,void cn(t).then(t=>{this._isViewLoading=!1,this.view=hn(t)},t=>{this._isViewLoading=!1,this._handleRenderError(t)});"function"==typeof t&&(this.name=t.name||"Anonymous"),this._applyViewChange(t,()=>{this._view=t}),qe.schedule(this)}}get view(){return this._view}callOnEachUpdate(){this.onEachUpdateCallbacks.forEach(t=>t())}connectedCallback(){this.addEventListener("request-parent-scope",this._onRequestParentScope);let t=0,e=null,n=this.parentElement;for(;n;){if(n instanceof un){e=n,t=n._depth+1;break}n=n.parentElement}this._depth=t,this._parentComponent=e,He.cancelDisconnect(this),this._hasMounted&&(Ht()&&!this._view?.skipDevToolsRender&&Ft(this,this._view),qe.schedule(this))}disconnectedCallback(){var t,e,n;this.removeEventListener("request-parent-scope",this._onRequestParentScope),Ht()&&(this._view?.__devtools__||this._view?.skipDevToolsRender||(n=Ut(this),jt.logComponentUnmount(n)),this._view?.skipDevToolsRender||(t=this,e=this._view,jt.unregisterComponent(t,e))),He.scheduleDisconnect(this)}addToCleanUps(t,e){const n=this.cleanups.get(t);n?n.push(e):this.cleanups.set(t,[e])}_render(){var t,e,n;if(!(this._errorState&&!this._view?.__isErrorView__||this._isViewLoading||this._renderScheduled)&&this._view)if(this._renderVersion=qe.flushVersion,this._hasMounted){if(this._xviewRender){this.callOnEachUpdate();let s=0;if(Ht()){const i=this._view?.__devtools__,r=this._view?.skipDevToolsRender,o=performance.now();this._xviewRender(),s=performance.now()-o,i||r||(Wt(Ut(this),this.componentId,s),e=Ut(this),n=s,jt.logComponentRender(e,n)),r||(t=this,jt.notifyRender(t))}else this._xviewRender()}}else this._mountComponent()}_mountComponent(){const t=this._view,e=function(t){if(!an())return t;const e=t?.__mates_hmr_id;if(!e)return t;const n=window.__mates_hmr?.components;return n?.[e]??t}(t);F(b``,this),re.viewOuterInProgress=!0;try{this._templateFn=ke(this,()=>e(this._propsFn))}catch(t){return re.viewOuterInProgress=!1,void this._handleRenderError(t)}if(re.viewOuterInProgress=!1,"function"==typeof this._templateFn){if(this._xviewRender=()=>{re.templateInProgress=!0;try{if(!this._templateFn)return;ke(this,()=>{const t=this._templateFn(this._propsFn);F(t,this)}),this.DOMReadyEvent?.trigger(),this.PaintEvent?.hasSubscribers&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.isConnected&&this.PaintEvent?.trigger()})})}catch(t){this._handleRenderError(t)}finally{re.templateInProgress=!1}},this.callOnEachUpdate(),Ht()){const t=e?.__devtools__,n=e?.skipDevToolsRender,s=performance.now();this._xviewRender();const i=performance.now()-s;t||n||Wt(e?.name||"Anonymous",this.componentId,i)}else this._xviewRender();this._view===t&&(this._hasMounted=!0,Ht()&&(e?.skipDevToolsRender||Ft(this,e),e?.__devtools__||e?.skipDevToolsRender||(n=e?.name||"Anonymous",jt.logComponentMount(n))))}else this._handleRenderError(new Error("inner function must be a template function that returns html result"));var n}_hotRefresh(){Be(this),qe.schedule(this)}_handleRenderError(t){this._errorState=t;for(const e of this._errorHandlers)try{e(t)}catch(t){}if(me(t,`Component "${this.name}"`),this._view?.__isErrorView__)return;const e=this.name,n=t instanceof Error?t.message:String(t),s=t instanceof Error&&t.stack?t.stack.split("\n").slice(1).map(t=>t.trim()).filter(Boolean).join("\n"):null,i=()=>()=>b`
|
|
84
|
+
*/function Nt(t,e,n){return t?e(t):n?.(t)}const Lt=()=>{},jt={registerComponent:Lt,unregisterComponent:Lt,notifyRender:Lt,getComponentName:()=>"Anonymous",logComponentMount:Lt,logComponentRender:Lt,logComponentUnmount:Lt,logAtomSet:Lt,logAtomUpdate:Lt,logEventTrigger:Lt,logCleanupEventTrigger:Lt,logFetchRequest:Lt,logFetchResponse:Lt,logFetchError:Lt,recordRender:Lt};function Ft(t,e){jt.registerComponent(t,e)}function Ut(t){return jt.getComponentName(t)}function Vt(t,e){jt.logEventTrigger(t,e)}function Wt(t,e,n){jt.recordRender(t,e,n)}function Bt(t){t.registerComponent&&(jt.registerComponent=t.registerComponent),t.unregisterComponent&&(jt.unregisterComponent=t.unregisterComponent),t.notifyRender&&(jt.notifyRender=t.notifyRender),t.getComponentName&&(jt.getComponentName=t.getComponentName),t.logComponentMount&&(jt.logComponentMount=t.logComponentMount),t.logComponentRender&&(jt.logComponentRender=t.logComponentRender),t.logComponentUnmount&&(jt.logComponentUnmount=t.logComponentUnmount),t.logAtomSet&&(jt.logAtomSet=t.logAtomSet),t.logAtomUpdate&&(jt.logAtomUpdate=t.logAtomUpdate),t.logEventTrigger&&(jt.logEventTrigger=t.logEventTrigger),t.logCleanupEventTrigger&&(jt.logCleanupEventTrigger=t.logCleanupEventTrigger),t.logFetchRequest&&(jt.logFetchRequest=t.logFetchRequest),t.logFetchResponse&&(jt.logFetchResponse=t.logFetchResponse),t.logFetchError&&(jt.logFetchError=t.logFetchError),t.recordRender&&(jt.recordRender=t.recordRender)}function Ht(){return jt.registerComponent!==Lt}const Yt=Symbol.for("mates.readTracking");globalThis[Yt]||(globalThis[Yt]={enableReadTracking:!1,storesBeingRead:new Set,effectRunning:!1});const qt=globalThis[Yt];function Xt(){return qt.enableReadTracking}function Zt(){return qt.storesBeingRead}function Gt(){return qt.effectRunning}function Kt(t){qt.storesBeingRead.add(t)}function Qt(){qt.effectRunning=!0}function Jt(){qt.effectRunning=!1}function te(){const t={prevEnabled:qt.enableReadTracking,prevStores:qt.storesBeingRead};return qt.enableReadTracking=!0,qt.storesBeingRead=new Set,t}function ee(t){const e=qt.storesBeingRead;return qt.enableReadTracking=t.prevEnabled,qt.storesBeingRead=t.prevStores,e}const ne=te,se=ee,ie=Symbol.for("mates.componentRunningStatus");globalThis[ie]||(globalThis[ie]={setupInProgress:!1,templateInProgress:!1,viewOuterInProgress:!1,isHookRunning:!1});const re=globalThis[ie];function oe(){return!re.isHookRunning&&(re.templateInProgress||Gt())}function ae(t){if(!re.isHookRunning){if(re.templateInProgress)throw new Error(`${t} cannot be created during template function execution. Only scopes (useScope) are allowed in templates.`);if(Gt())throw new Error(`${t} cannot be created inside a memo() or effect(). They should only read state, not create new reactive primitives.`)}}function le(t){if(!re.viewOuterInProgress){if(re.templateInProgress)throw new Error(`${t} cannot be called during template function execution. Move it to the component's outer function.`);if(Gt())throw new Error(`${t} cannot be called inside a memo() or effect(). Move it to the component's outer function.`);throw new Error(`${t} must be called inside a component's outer function. It cannot be used at module level or inside inner functions (e.g. event handlers, timers, or callbacks).`)}}const ce=new Set,he={name:"matesLogEvent",__isEvent___:!0,trigger(t){ce.forEach(e=>{try{e(t)}catch(t){}})},__subscribe:t=>(ce.add(t),()=>ce.delete(t))};function ue(t){try{return structuredClone(t)}catch(e){return t}}function de(){if("undefined"==typeof window)return!0;const t=window.location.hostname;return"localhost"===t||"127.0.0.1"===t||"[::1]"===t||t.startsWith("192.168.")||t.startsWith("10.")||t.endsWith(".local")}function fe(t){try{he.trigger(t)}catch(t){}}function pe(t,e){fe({level:"log",message:t,data:void 0!==e?ue(e):void 0,ts:performance.now()}),de()&&(void 0!==e?console.log(t,e):console.log(t))}function me(t,e){fe({level:"error",message:t,data:void 0!==e?ue(e):void 0,ts:performance.now()}),de()&&(void 0!==e?console.error(`[${e}]`,t):console.error(t))}function _e(t,e){fe({level:"warn",message:t,data:void 0!==e?ue(e):void 0,ts:performance.now()}),de()&&(void 0!==e?console.warn(t,e):console.warn(t))}function ge(t,e,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(t):s?s.value:e.get(t)}function ye(t,e,n,s,i){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?i.call(t,n):i?i.value=n:e.set(t,n),n}var we,ve,be;"function"==typeof SuppressedError&&SuppressedError;class Se{constructor(){we.set(this,new Set),ve.set(this,1)}subscribe(t){return ge(this,we,"f").add(t),()=>ge(this,we,"f").delete(t)}notify(){var t;ye(this,ve,(t=ge(this,ve,"f"),++t),"f"),[...ge(this,we,"f")].forEach(t=>{try{t?.()}catch(t){console.error(t)}})}getVersion(){return ge(this,ve,"f")}get subscriberCount(){return ge(this,we,"f").size}clear(){ge(this,we,"f").clear()}}we=new WeakMap,ve=new WeakMap;class Ee{constructor(){be.set(this,new Set)}subscribe(t){return ae("subscribe"),ge(this,be,"f").has(t)?()=>{}:(ge(this,be,"f").add(t),()=>ge(this,be,"f").delete(t))}trigger(t){ge(this,be,"f").forEach(e=>{try{e(t)}catch(t){console.error("Error in event handler:",t)}})}get handlerCount(){return ge(this,be,"f").size}clear(){ge(this,be,"f").clear()}}be=new WeakMap;const Ce=Symbol.for("mates.hostStack");globalThis[Ce]||(globalThis[Ce]=[]);const Ae=globalThis[Ce];function ke(t,e){Ae.push(t);let n=null;try{n=e()}finally{Ae.pop()}return n}function Me(t){const e=Ae[Ae.length-1];if(!e){if(!1!==t)throw new Error("getCurrentHost(): No active host context");return null}return e}const $e=(t,e)=>{const n=Me(!1);n&&n.addToCleanUps(t,e)},xe=t=>{ae("xTabEvent");const e=new Set,n=n=>{e.forEach(e=>{try{e(n)}catch(e){me(e,`xTabEvent(${t}) handler`)}})},s="undefined"!=typeof BroadcastChannel?new BroadcastChannel(t):null;s&&(s.onmessage=t=>{n(t.data)});return{trigger:e=>{if(Vt(t,e),s)try{s.postMessage(e)}catch(e){me(e,`xTabEvent(${t}) postMessage`)}n(e)},__subscribe:t=>{e.add(t);const n=()=>{e.delete(t)};return $e(t,n),n},close:()=>{s&&s.close()},name:t,__isEvent___:!0,__isXTabEvent___:!0}},Te=t=>{ae("event");const e=t||Math.random().toString(36).substring(2,15),n=new Ee;return{trigger:t=>{Vt(e,t),n.trigger(t)},__subscribe:t=>n.subscribe(t),name:e,__isEvent___:!0}},Re=t=>{ae("cleanupEvent");const e=t||Math.random().toString(36).substring(2,15),n=new Map,s=()=>{n.forEach(t=>{if(t)try{t()}catch(t){me(t,"cleanupEvent cleanup")}})},i={trigger:t=>{!function(t,e){jt.logCleanupEventTrigger(t,e)}(e,t),n.forEach((e,s)=>{if(e)try{e()}catch(t){me(t,"cleanupEvent cleanup")}try{const e=s(t);n.set(s,e)}catch(t){me(t,"cleanupEvent handler"),n.set(s,void 0)}})},__subscribe:t=>(n.set(t,void 0),()=>{const e=n.get(t);if(e)try{e()}catch(t){me(t,"cleanupEvent unsubscribe")}n.delete(t)}),cleanup:s,cleanupAndClearSubs:()=>{s(),n.clear()},get hasSubscribers(){return n.size>0},name:e,__isCleanupEvent___:!0,__isEvent___:!0};return i};let Oe=!1;function Ie(t){Oe=t,t||(ze=0,De=null,Ne=null)}function Pe(){return Oe}let ze=0,De=null,Ne=null;function Le(t){De=t,ze=0,null!==Ne&&(clearTimeout(Ne),Ne=null)}function je(){Oe&&(ze++,null!==Ne&&(clearTimeout(Ne),Ne=null))}function Fe(){Oe&&(ze=Math.max(0,ze-1),function(){if(ze>0)return;if(!De)return;if(null!==Ne)return;Ne=setTimeout(()=>{if(Ne=null,0===ze&&De){const t=De;De=null,t()}},5)}())}function Ue(){if(!Oe||!De)return;null!==Ne&&(clearTimeout(Ne),Ne=null);const t=De;De=null,t()}function Ve(){return ze}function We(){return void 0!==import.meta&&import.meta.env?"production"!==import.meta.env.NODE_ENV:"undefined"==typeof process||!process.env||"production"!==process.env.NODE_ENV}function Be(t){t.DOMReadyEvent?.cleanupAndClearSubs(),t.PaintEvent?.cleanupAndClearSubs(),t.cleanups.forEach(t=>t.forEach(t=>{try{t()}catch(t){console.error("Error during cleanup:",t)}})),t.cleanups.clear(),t.onEachUpdateCallbacks.clear(),t.scopes=new Map,t._templateFn=null,t._xviewRender=()=>{},t._hasMounted=!1,t._errorState=null,t._errorHandlers=[]}const He=new class{constructor(){this.pending=new Set,this.isScheduled=!1}scheduleDisconnect(t){this.pending.add(t),this.isScheduled||(this.isScheduled=!0,queueMicrotask(()=>this.flush()))}cancelDisconnect(t){this.pending.delete(t)}flush(){const t=Array.from(this.pending);this.pending.clear(),this.isScheduled=!1;for(const e of t)e?.isConnected||(Be(e),e._view=null,e._props={},e.oldView=void 0)}reset(){this.pending.clear(),this.isScheduled=!1}},Ye=new class{constructor(){this.pendingEffects=new Set,this.isScheduled=!1,this._isFlushing=!1}get isFlushing(){return this._isFlushing}reset(){this.pendingEffects.clear(),this.isScheduled=!1,this._isFlushing=!1}schedule(t){this.pendingEffects.add(t),this.isScheduled||(this.isScheduled=!0,queueMicrotask(()=>this.flush()))}flush(){this._isFlushing=!0;let t=0;for(;this.pendingEffects.size>0;){if(t++>=500){this.pendingEffects.clear(),console.error("EffectScheduler: Maximum iteration limit (500) reached. This likely means an effect is infinitely updating its own dependency. Remaining effects have been dropped.");break}const e=Array.from(this.pendingEffects);this.pendingEffects.clear();for(const t of e)try{t()}catch(t){me(t,"Effect")}}this._isFlushing=!1,this.isScheduled=!1,qe.flush()}},qe=new class{constructor(){this.pendingComponents=new Set,this.nextPendingComponents=new Set,this._currentWave=new Set,this.isScheduled=!1,this._isFlushing=!1,this._flushVersion=0,this._onIdleCallbacks=[]}get flushVersion(){return this._flushVersion}onceIdle(t){this._onIdleCallbacks.push(t),this._isFlushing||this.isScheduled||queueMicrotask(()=>this._drainIdleCallbacks())}_drainIdleCallbacks(){if(this._isFlushing||this.isScheduled)return;if(this.pendingComponents.size>0||this.nextPendingComponents.size>0)return;const t=this._onIdleCallbacks.splice(0);for(const e of t)try{e()}catch(t){console.error(t)}}reset(){this.pendingComponents.clear(),this.nextPendingComponents.clear(),this._currentWave.clear(),this._onIdleCallbacks.length=0,this.isScheduled=!1,this._isFlushing=!1}schedule(t){if(this._isFlushing){if(this._currentWave.has(t)&&t._renderVersion!==this._flushVersion)return;this.nextPendingComponents.add(t)}else this.pendingComponents.add(t);this.isScheduled||(this.isScheduled=!0,queueMicrotask(()=>{Ye.isScheduled||Ye.isFlushing||this.flush()}))}flush(){for(this.nextPendingComponents.size>0&&(this.nextPendingComponents.forEach(t=>this.pendingComponents.add(t)),this.nextPendingComponents.clear()),this._isFlushing=!0,this._flushVersion++;this.pendingComponents.size>0;){const t=Array.from(this.pendingComponents);this.pendingComponents.clear(),t.sort((t,e)=>t._depth-e._depth),this._currentWave=new Set(t);for(const e of t)if(e.isConnected)try{e._render()}catch(t){me(t,"Component render")}this._currentWave.clear()}this._isFlushing=!1,this.isScheduled=!1,this.nextPendingComponents.size>0?(this.isScheduled=!0,queueMicrotask(()=>{Ye.isScheduled||Ye.isFlushing||this.flush()})):this._drainIdleCallbacks()}},Xe=()=>{if(re.templateInProgress&&!re.setupInProgress)throw Error("Providers such as atoms, units, bubbles, getters, setters and actions can't be created inside the template function, you can create them in view function. Because template function gets called everytime the view updates.")},Ze=()=>{},Ge=t=>{Xe(),t.__isOnMount__=!0;const e=Me();e.addToCleanUps(t,Ze);if("AsyncFunction"===t.constructor.name&&Pe())return e._asyncMountQueue=e._asyncMountQueue??[],void e._asyncMountQueue.push(t);let n=!1;e.DOMReadyEvent.__subscribe(()=>{if(n)return;n=!0;const s=t();if(s&&"object"==typeof s&&"function"==typeof s.then)return;const i=s;i&&e.addToCleanUps(t,i)})},Ke=t=>{Xe(),t.__isOnPaint__=!0;const e=Me();e.addToCleanUps(t,Ze),e.PaintEvent.__subscribe(()=>t())},Qe=t=>{Xe(),t.__isOnAllMount__=!0;const e=Me();e.addToCleanUps(t,Ze),qe.onceIdle(()=>{if(!e.isConnected)return;const n=t();n&&e.addToCleanUps(t,n)})},Je=t=>{Xe(),t.__isOnCleanup__=!0;Me().addToCleanUps(t,t)},tn=(t,e=!0)=>{if(e&&ae("Setter"),re.setupInProgress&&e)throw new Error("Setter cannot be created inside setup function. Define setters as class properties before setup runs.");let n=t;const s=Me();e&&Xe();const i=new Set;try{const t=(...t)=>{const e=n(...t);return[...i].forEach(t=>{try{Ye.schedule(()=>t?.())}catch(t){console.error(t)}}),s?.isConnected&&qe.schedule(s),e};return t.__subscribe=t=>(ae("subscribe"),i.add(t),()=>i.delete(t)),t.__isSetter___=!0,t.set=t=>{n=t},Object.defineProperty(t,"__version__",{get:()=>0}),t}catch(t){throw new Error("You can only use setter or _ inside a scope or useState or view component's outer function")}},en=tn;function nn(t,e=!0,n){if(Gt())return;const s=Me(e);if(s&&t&&!s.cleanups.has(t)){const e=n||t.__subscribe||t.subscribe,i=e?.(()=>{qe.schedule(s)});s.addToCleanUps(t,i)}}function sn(t){return nn(t,!0),t}const rn=(t,e)=>{t.__isOn__=!0,ae("on");const n=new Set;let s;const i=()=>{if(s){try{s()}catch(t){console.error("Error in on() cleanup:",t)}s=void 0}const e=t();"function"==typeof e&&(s=e)},r=()=>Ye.schedule(i);e.forEach(t=>{n.add(t.__subscribe(r))});const o=()=>{if(n.forEach(t=>t()),s){try{s()}catch(t){console.error("Error in on() cleanup:",t)}s=void 0}};return $e(t,o),o};function on(t){let e=null;const n=new CustomEvent("request-context",{bubbles:!0,composed:!0,detail:{context:t,resolve(t=null){e=t}}});return Me().dispatchEvent(n),e}function an(){return We()&&"undefined"!=typeof window&&!!window.__mates_hmr}function ln(t){return!!t&&("AsyncFunction"===t.constructor?.name||t instanceof Promise||"object"==typeof t&&null!==t&&"then"in t||"function"==typeof t.then)}function cn(t){return"function"==typeof t?t():t}function hn(t){return t.default||t}class un extends HTMLElement{addScope(t,e){this.scopes.set(t,e)}onEachUpdate(t){this.onEachUpdateCallbacks.add(t)}constructor(){super(),this.name="Anonymous",this.scopes=new Map,this._useStates=[],this.lastVersion=-1,this._depth=0,this._parentComponent=null,this._renderVersion=0,this._errorHandlers=[],this._errorState=null,this.onEachUpdateCallbacks=new Set,this.DOMReadyEvent=null,this.PaintEvent=null,this._isViewLoading=!1,this._onRequestParentScope=t=>{const e=t,n=e.detail?.ScopeClass;if(n&&this.scopes.has(n)){const t=this.scopes.get(n);t&&(e.stopPropagation(),e.detail.resolve(t))}},this._props={},this._propsFn=()=>this._props,this._view=null,this._templateFn=null,this._hasMounted=!1,this._renderScheduled=!1,this.componentId=Math.random(),this.cleanups=new Map,this._xviewRender=()=>{};const t=re.templateInProgress;re.templateInProgress=!1,ke(this,()=>{this.DOMReadyEvent=Re("DOMReady"),this.PaintEvent=Re("Paint")}),re.templateInProgress=t}set props(t){this._props=t,qe.schedule(this)}get props(){return this._props}_applyViewChange(t,e){this.oldView!==t&&(this.oldView=t,e(t),(this._hasMounted||this._errorState)&&Be(this))}set view(t){if(null!==t){if(ln(t))return this._isViewLoading=!0,void cn(t).then(t=>{this._isViewLoading=!1,this.view=hn(t)},t=>{this._isViewLoading=!1,this._handleRenderError(t)});"function"==typeof t&&(this.name=t.name||"Anonymous"),this._applyViewChange(t,()=>{this._view=t}),qe.schedule(this)}}get view(){return this._view}callOnEachUpdate(){this.onEachUpdateCallbacks.forEach(t=>t())}connectedCallback(){this.addEventListener("request-parent-scope",this._onRequestParentScope);let t=0,e=null,n=this.parentElement;for(;n;){if(n instanceof un){e=n,t=n._depth+1;break}n=n.parentElement}this._depth=t,this._parentComponent=e,He.cancelDisconnect(this),this._hasMounted&&(Ht()&&!this._view?.skipDevToolsRender&&Ft(this,this._view),qe.schedule(this))}disconnectedCallback(){var t,e,n;this.removeEventListener("request-parent-scope",this._onRequestParentScope),Ht()&&(this._view?.__devtools__||this._view?.skipDevToolsRender||(n=Ut(this),jt.logComponentUnmount(n)),this._view?.skipDevToolsRender||(t=this,e=this._view,jt.unregisterComponent(t,e))),He.scheduleDisconnect(this)}addToCleanUps(t,e){const n=this.cleanups.get(t);n?n.push(e):this.cleanups.set(t,[e])}_render(){var t,e,n;if(!(this._errorState&&!this._view?.__isErrorView__||this._isViewLoading||this._renderScheduled)&&this._view)if(this._renderVersion=qe.flushVersion,this._hasMounted){if(this._xviewRender){this.callOnEachUpdate();let s=0;if(Ht()){const i=this._view?.__devtools__,r=this._view?.skipDevToolsRender,o=performance.now();this._xviewRender(),s=performance.now()-o,i||r||(Wt(Ut(this),this.componentId,s),e=Ut(this),n=s,jt.logComponentRender(e,n)),r||(t=this,jt.notifyRender(t))}else this._xviewRender()}}else this._mountComponent()}_mountComponent(){const t=this._view,e=function(t){if(!an())return t;const e=t?.__mates_hmr_id;if(!e)return t;const n=window.__mates_hmr?.components;return n?.[e]??t}(t);F(b``,this),re.viewOuterInProgress=!0;try{this._templateFn=ke(this,()=>e(this._propsFn))}catch(t){return re.viewOuterInProgress=!1,void this._handleRenderError(t)}if(re.viewOuterInProgress=!1,"function"==typeof this._templateFn){if(this._xviewRender=()=>{re.templateInProgress=!0;try{if(!this._templateFn)return;ke(this,()=>{const t=this._templateFn(this._propsFn);F(t,this)}),this.DOMReadyEvent?.trigger(),this.PaintEvent?.hasSubscribers&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.isConnected&&this.PaintEvent?.trigger()})})}catch(t){this._handleRenderError(t)}finally{re.templateInProgress=!1}},this.callOnEachUpdate(),Ht()){const t=e?.__devtools__,n=e?.skipDevToolsRender,s=performance.now();this._xviewRender();const i=performance.now()-s;t||n||Wt(e?.name||"Anonymous",this.componentId,i)}else this._xviewRender();this._view===t&&(this._hasMounted=!0,Ht()&&(e?.skipDevToolsRender||Ft(this,e),e?.__devtools__||e?.skipDevToolsRender||(n=e?.name||"Anonymous",jt.logComponentMount(n))))}else this._handleRenderError(new Error("inner function must be a template function that returns html result"));var n}_hotRefresh(){Be(this),qe.schedule(this)}_handleRenderError(t){this._errorState=t;for(const e of this._errorHandlers)try{e(t)}catch(t){}if(me(t,`Component "${this.name}"`),this._view?.__isErrorView__)return;const e=this.name,n=t instanceof Error?t.message:String(t),s=t instanceof Error&&t.stack?t.stack.split("\n").slice(1).map(t=>t.trim()).filter(Boolean).join("\n"):null,i=()=>()=>b`
|
|
85
85
|
<div
|
|
86
86
|
style="padding:14px 16px;margin:4px;border:2px solid #e74c3c;border-radius:6px;background:#fdf0ef;color:#c0392b;font-family:monospace;font-size:13px;line-height:1.5"
|
|
87
87
|
>
|
|
@@ -106,11 +106,11 @@ ${s}</pre
|
|
|
106
106
|
>
|
|
107
107
|
</details>`:null}
|
|
108
108
|
</div>
|
|
109
|
-
`;i.__isErrorView__=!0,i.skipDevToolsRender=!0,this.view=i,this.name=e,this._errorState=t}}an()&&window.addEventListener("mates:component-hot-update",t=>{const e=new Set(t.detail??[]);0!==e.size&&document.querySelectorAll("x-view").forEach(t=>{if(!(t instanceof un))return;const n=function(t){if(!an())return null;const e=t?.__mates_hmr_id;return"string"==typeof e?e:null}(t.view);n&&e.has(n)&&t._hotRefresh()})}),customElements.get("x-view")||customElements.define("x-view",un);class dn extends HTMLElement{constructor(){super(...arguments),this._onRequestContext=t=>{const e=t,n=e.detail?.context.id;n&&null!=this.id&&n===this.id&&(e.stopPropagation(),e.detail.resolve(this._value))}}connectedCallback(){this.addEventListener("request-context",this._onRequestContext)}set context(t){this.id=t.id}disconnectedCallback(){this.removeEventListener("request-context",this._onRequestContext)}set value(t){this._value=t}get value(){return this._value}}function fn(t){let e=-1===t.indexOf("\0")?t:t.replace(/\0/g,"");const n=function(t){const e=t.indexOf("{"),n=t.indexOf("}");return-1===e&&-1===n?-1:-1===e?n:-1===n?e:Math.min(e,n)}(e);return-1!==n&&(e=e.slice(0,n)),/url\s*\(/i.test(e)&&(e=e.replace(/\burl\s*\(\s*(['"]?)\s*(?:javascript:|vbscript:|data:text\/html[,;])/gi,"url($1")),e}function pn(t){return t.length>0&&/^[a-zA-Z-]+$/.test(t)}customElements.get("x-provider")||customElements.define("x-provider",dn);let mn=0;function _n(){return`_m${(mn++).toString(36)}`}const gn=Object.create(null),yn={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function wn(t){t.breakpoints&&Object.assign(yn,t.breakpoints)}function vn(t){const e=gn[t];if(void 0!==e)return e;const n=t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);return gn[t]=n,n}function bn(t,e,n){if(!n)return`.${t} {\n${e}}`;if(n.startsWith("&")){return`.${t}${n.slice(1)} {\n${e}}`}return`${n} {\n .${t} {\n${e.replace(/^ {2}/gm," ")} }\n}`}function Sn(t){return t.startsWith("&")||t.startsWith("@media")?t:Object.prototype.hasOwnProperty.call(yn,t)?`@media (min-width: ${yn[t]})`:null}function En(t,e,n){const s=Object.create(null);for(const i in t){const r=t[i];let o="",a=null;for(const t in r){const e=r[t];if(null!=e){if("object"==typeof e&&!Array.isArray(e)){const n=Sn(t);if(null===n)throw new Error(`[css-in-js] Unknown nested key "${t}" in block "${i}". Use "&:pseudo", "@media (...)", or a configured breakpoint key.`);let s="";const r=e;for(const t in r){const e=r[t];null!=e&&(pn(t)?s+=` ${vn(t)}: ${fn(String(e))};\n`:console.warn(`[css-in-js] invalid property name skipped: "${t}"`))}s.length>0&&(null===a&&(a=[]),a.push([s,n]));continue}pn(t)?o+=` ${vn(t)}: ${fn(String(e))};\n`:console.warn(`[css-in-js] invalid property name skipped: "${t}"`)}}if(0===o.length&&null===a){s[i]="";continue}const l=n?.literal?i:`${i}${_n()}`;if(o.length>0&&e.push(bn(l,o,"")),null!==a)for(let t=0;t<a.length;t++)e.push(bn(l,a[t][0],a[t][1]));s[i]=l}return s}function Cn(t){return Object.freeze(t)}var An,kn,Mn,xn,$n,Tn,Rn,On;function In(t){if(re.templateInProgress)throw new Error(`[css-in-js] ${t}() must be called at module level, not inside a template function.`);if(re.viewOuterInProgress)throw new Error(`[css-in-js] ${t}() must be called at module level, not inside a component outer function. Move it outside the component function.`);if(re.setupInProgress)throw new Error(`[css-in-js] ${t}() must be called at module level, not inside a setup function.`)}let Pn=0;function zn(t){return`${t}_kf${(Pn++).toString(36)}`}function Dn(t,e){let n="";for(const t in e){const s=e[t];let i="";for(const t in s){const e=s[t];if(null==e)continue;const n=t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);i+=` ${n}: ${String(e)};\n`}i&&(n+=` ${t} {\n${i} }\n`)}return`@keyframes ${t} {\n${n}}`}const Nn=new Set;function Ln(){return""}class jn{constructor(){An.add(this),kn.set(this,""),Mn.set(this,0),xn.set(this,null),$n.set(this,[]),Nn.add(this)}keyframes(t,e){const n=zn(t);return this.appendRules(Dn(n,e)),n}appendRules(t){""!==t&&(ge(this,$n,"f").push(t),ge(this,Mn,"f")>0&&ge(this,An,"m",Tn).call(this))}mount(){var t;ye(this,Mn,(t=ge(this,Mn,"f"),++t),"f"),1===ge(this,Mn,"f")&&(ge(this,An,"m",Tn).call(this),ge(this,xn,"f")||ge(this,An,"m",Rn).call(this))}unmount(){var t;ge(this,Mn,"f")<=0||(ye(this,Mn,(t=ge(this,Mn,"f"),--t),"f"),0===ge(this,Mn,"f")&&ge(this,An,"m",On).call(this))}get refCount(){return ge(this,Mn,"f")}get cssText(){return ge(this,kn,"f")}get isMounted(){return ge(this,Mn,"f")>0}get sheet(){return ge(this,xn,"f")}getAllCSS(){const t=[];return ge(this,kn,"f")&&t.push(ge(this,kn,"f")),ge(this,$n,"f").length>0&&t.push(ge(this,$n,"f").join("\n")),t.join("\n")}}function Fn(){if(In("stylesheet"),Pe())return{css:()=>({}),mount:()=>{},keyframes:()=>""};const t=new jn;return{css:function(e){In("css");const n=[],s=En(e,n);return n.length>0&&t.appendRules(n.join("\n")),Cn(s)},mount:function(){if(function(t){if(re.templateInProgress)throw new Error(`[css-in-js] ${t}() must not be called inside a template function. Call it in the component outer function or at module level.`)}("mount"),null===Me(!1))return t.mount(),()=>t.unmount();Ge(()=>(t.mount(),()=>t.unmount()))},keyframes:function(e,n){return In("keyframes"),t.keyframes(e,n)}}}kn=new WeakMap,Mn=new WeakMap,xn=new WeakMap,$n=new WeakMap,An=new WeakSet,Tn=function(){if(0===ge(this,$n,"f").length)return;const t=ge(this,$n,"f").join("\n");ye(this,$n,[],"f"),ye(this,kn,ge(this,kn,"f")+(ge(this,kn,"f")?"\n":"")+t,"f"),ge(this,An,"m",Rn).call(this)},Rn=function(){ge(this,xn,"f")||(ye(this,xn,new CSSStyleSheet,"f"),document.adoptedStyleSheets=[...document.adoptedStyleSheets,ge(this,xn,"f")]),ge(this,xn,"f").replaceSync(ge(this,kn,"f"))},On=function(){ge(this,xn,"f")&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(t=>t!==ge(this,xn,"f")),ye(this,xn,null,"f")),ge(this,kn,"f")&&(ge(this,$n,"f").unshift(ge(this,kn,"f")),ye(this,kn,"","f"))};let Un=null,Vn=!1;function Wn(){return Un||(Un=new jn),Un}function Bn(){Un||(Un=new jn),Vn||(Vn=!0,queueMicrotask(()=>{Vn=!1,Un.mount()}))}function Hn(t,e){if(In("keyframes"),Pe())return t;Bn();const n=zn(t);return Un.appendRules(Dn(n,e)),n}function Yn(t,e){if(In("globalCSS"),Pe())return{};Bn();const n=[],s=En(t,n,e);return n.length>0&&Un.appendRules(n.join("\n")),Cn(s)}function qn(t){In("globalRawCSS"),Bn(),Un.appendRules(t)}let Xn=!1;function Zn(){Xn||(Xn=!0,qn('\n[class*="mates-"] {\n --mates-duration : 300ms;\n --mates-easing : ease;\n --mates-distance : 24px;\n animation-duration : var(--mates-duration);\n animation-timing-function : var(--mates-easing);\n animation-fill-mode : both;\n}\n'),qn("\n@keyframes mates-kf-fade-in { from { opacity: 0 } to { opacity: 1 } }\n@keyframes mates-kf-fade-out { from { opacity: 1 } to { opacity: 0 } }\n\n@keyframes mates-kf-slide-in-up {\n from { opacity: 0; transform: translateY(var(--mates-distance)) }\n to { opacity: 1; transform: translateY(0) }\n}\n@keyframes mates-kf-slide-out-up {\n from { opacity: 1; transform: translateY(0) }\n to { opacity: 0; transform: translateY(calc(-1 * var(--mates-distance))) }\n}\n@keyframes mates-kf-slide-in-down {\n from { opacity: 0; transform: translateY(calc(-1 * var(--mates-distance))) }\n to { opacity: 1; transform: translateY(0) }\n}\n@keyframes mates-kf-slide-out-down {\n from { opacity: 1; transform: translateY(0) }\n to { opacity: 0; transform: translateY(var(--mates-distance)) }\n}\n@keyframes mates-kf-slide-in-left {\n from { opacity: 0; transform: translateX(var(--mates-distance)) }\n to { opacity: 1; transform: translateX(0) }\n}\n@keyframes mates-kf-slide-out-left {\n from { opacity: 1; transform: translateX(0) }\n to { opacity: 0; transform: translateX(calc(-1 * var(--mates-distance))) }\n}\n@keyframes mates-kf-slide-in-right {\n from { opacity: 0; transform: translateX(calc(-1 * var(--mates-distance))) }\n to { opacity: 1; transform: translateX(0) }\n}\n@keyframes mates-kf-slide-out-right {\n from { opacity: 1; transform: translateX(0) }\n to { opacity: 0; transform: translateX(var(--mates-distance)) }\n}\n\n@keyframes mates-kf-scale-in {\n from { opacity: 0; transform: scale(0.92) }\n to { opacity: 1; transform: scale(1) }\n}\n@keyframes mates-kf-scale-out {\n from { opacity: 1; transform: scale(1) }\n to { opacity: 0; transform: scale(0.92) }\n}\n\n@keyframes mates-kf-spring-in {\n from { opacity: 0; transform: scale(0.92) }\n to { opacity: 1; transform: scale(1) }\n}\n\n@keyframes mates-kf-flip-in-x {\n from { opacity: 0; transform: rotateX(90deg) }\n to { opacity: 1; transform: rotateX(0deg) }\n}\n@keyframes mates-kf-flip-in-y {\n from { opacity: 0; transform: rotateY(90deg) }\n to { opacity: 1; transform: rotateY(0deg) }\n}\n\n@keyframes mates-kf-blur-in {\n from { opacity: 0; filter: blur(10px) }\n to { opacity: 1; filter: blur(0) }\n}\n@keyframes mates-kf-blur-out {\n from { opacity: 1; filter: blur(0) }\n to { opacity: 0; filter: blur(10px) }\n}\n\n@keyframes mates-kf-shake {\n 0%, 100% { transform: translateX(0) }\n 15% { transform: translateX(calc(-1 * var(--mates-distance))) }\n 30% { transform: translateX(calc( 1 * var(--mates-distance))) }\n 45% { transform: translateX(calc(-0.6 * var(--mates-distance))) }\n 60% { transform: translateX(calc( 0.6 * var(--mates-distance))) }\n 75% { transform: translateX(calc(-0.3 * var(--mates-distance))) }\n 90% { transform: translateX(calc( 0.3 * var(--mates-distance))) }\n}\n\n@keyframes mates-kf-pulse {\n 0%, 100% { transform: scale(1) }\n 50% { transform: scale(1.08) }\n}\n\n@keyframes mates-kf-bounce {\n 0% { transform: translateY(0) }\n 20% { transform: translateY(calc(-0.40 * var(--mates-distance))) }\n 40% { transform: translateY(0) }\n 60% { transform: translateY(calc(-0.20 * var(--mates-distance))) }\n 80% { transform: translateY(0) }\n 90% { transform: translateY(calc(-0.08 * var(--mates-distance))) }\n 100% { transform: translateY(0) }\n}\n\n@keyframes mates-kf-spin {\n from { transform: rotate(0deg) }\n to { transform: rotate(360deg) }\n}\n"),Yn({"mates-fade-in":{animationName:"mates-kf-fade-in"},"mates-fade-out":{animationName:"mates-kf-fade-out"},"mates-slide-in-up":{animationName:"mates-kf-slide-in-up"},"mates-slide-out-up":{animationName:"mates-kf-slide-out-up"},"mates-slide-in-down":{animationName:"mates-kf-slide-in-down"},"mates-slide-out-down":{animationName:"mates-kf-slide-out-down"},"mates-slide-in-left":{animationName:"mates-kf-slide-in-left"},"mates-slide-out-left":{animationName:"mates-kf-slide-out-left"},"mates-slide-in-right":{animationName:"mates-kf-slide-in-right"},"mates-slide-out-right":{animationName:"mates-kf-slide-out-right"},"mates-scale-in":{animationName:"mates-kf-scale-in"},"mates-scale-out":{animationName:"mates-kf-scale-out"},"mates-spring-in":{animationName:"mates-kf-spring-in","--mates-easing":"cubic-bezier(0.34, 1.56, 0.64, 1)"},"mates-flip-in-x":{animationName:"mates-kf-flip-in-x"},"mates-flip-in-y":{animationName:"mates-kf-flip-in-y"},"mates-blur-in":{animationName:"mates-kf-blur-in"},"mates-blur-out":{animationName:"mates-kf-blur-out"},"mates-shake":{animationName:"mates-kf-shake","--mates-duration":"500ms","--mates-easing":"ease-in-out"},"mates-pulse":{animationName:"mates-kf-pulse","--mates-duration":"600ms","--mates-easing":"ease-in-out"},"mates-bounce":{animationName:"mates-kf-bounce","--mates-duration":"700ms"},"mates-spin":{animationName:"mates-kf-spin","--mates-easing":"linear"}},{literal:!0}))}const Gn={fadeIn:"mates-fade-in",fadeOut:"mates-fade-out",slideInUp:"mates-slide-in-up",slideOutUp:"mates-slide-out-up",slideInDown:"mates-slide-in-down",slideOutDown:"mates-slide-out-down",slideInLeft:"mates-slide-in-left",slideOutLeft:"mates-slide-out-left",slideInRight:"mates-slide-in-right",slideOutRight:"mates-slide-out-right",scaleIn:"mates-scale-in",scaleOut:"mates-scale-out",springIn:"mates-spring-in",flipInX:"mates-flip-in-x",flipInY:"mates-flip-in-y",blurIn:"mates-blur-in",blurOut:"mates-blur-out",shake:"mates-shake",pulse:"mates-pulse",bounce:"mates-bounce",spin:"mates-spin"};function Kn(t){ae("Action");let e=t;const n=new Set;let s=null,i=null;const r=t=>{n.forEach(e=>{try{e(t)}catch(t){console.error(t)}})},o=Object.assign(function(...t){return((t,n)=>{try{let o;return o=s?s((...n)=>e.call(t,...n),...n):e.call(t,...n),i&&(o=i(o)),r(o),o}catch(t){const e=t instanceof Error?t:new Error(String(t));throw r(void 0),e}})(this,t)},{val:()=>e,set:t=>{e=t},__isAction___:!0,__subscribe:t=>(ae("subscribe"),n.add(t),()=>n.delete(t)),interceptBefore:t=>{s=t},interceptAfter:t=>{i=t}});return o}function Qn(t=300,e="ease"){return{keyframes:[{opacity:0},{opacity:1}],options:{duration:t,easing:e,fill:"both"}}}function Jn(t=300,e="ease"){return{keyframes:[{opacity:1},{opacity:0}],options:{duration:t,easing:e,fill:"both"}}}Zn();const ts={up:"translateY(-100%)",down:"translateY(100%)",left:"translateX(-100%)",right:"translateX(100%)"};function es(t="up",e,n=400,s="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{transform:e?ss(t,e):ts[t],opacity:0},{transform:"translate(0, 0)",opacity:1}],options:{duration:n,easing:s,fill:"both"}}}function ns(t="down",e,n=400,s="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{transform:"translate(0, 0)",opacity:1},{transform:e?ss(t,e):ts[t],opacity:0}],options:{duration:n,easing:s,fill:"both"}}}function ss(t,e){switch(t){case"up":return`translateY(-${e})`;case"down":return`translateY(${e})`;case"left":return`translateX(-${e})`;case"right":return`translateX(${e})`}}function is(t=0,e=300,n="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{transform:`scale(${t})`,opacity:0},{transform:"scale(1)",opacity:1}],options:{duration:e,easing:n,fill:"both"}}}function rs(t=0,e=300,n="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{transform:"scale(1)",opacity:1},{transform:`scale(${t})`,opacity:0}],options:{duration:e,easing:n,fill:"both"}}}function os(t=1,e=600,n="linear"){return{keyframes:[{transform:"rotate(0deg)"},{transform:`rotate(${360*t}deg)`}],options:{duration:e,easing:n,fill:"both"}}}function as(t=600){return{keyframes:[{transform:"translateY(0)",offset:0},{transform:"translateY(-30%)",offset:.3},{transform:"translateY(0)",offset:.5},{transform:"translateY(-15%)",offset:.7},{transform:"translateY(0)",offset:.85},{transform:"translateY(-5%)",offset:.95},{transform:"translateY(0)",offset:1}],options:{duration:t,easing:"ease",fill:"both"}}}function ls(t=500,e="cubic-bezier(0.34, 1.56, 0.64, 1)"){return{keyframes:[{transform:"scale(0)",opacity:0},{transform:"scale(1)",opacity:1}],options:{duration:t,easing:e,fill:"both"}}}function cs(t=10,e=400){return{keyframes:[{transform:"translateX(0)"},{transform:`translateX(-${t}px)`},{transform:`translateX(${t}px)`},{transform:`translateX(-${t}px)`},{transform:`translateX(${t}px)`},{transform:"translateX(0)"}],options:{duration:e,easing:"ease-in-out",fill:"both"}}}function hs(t=1.05,e=400){return{keyframes:[{transform:"scale(1)"},{transform:`scale(${t})`},{transform:"scale(1)"}],options:{duration:e,easing:"ease-in-out",fill:"both"}}}function us(t="y",e=500,n="ease-out"){const s="x"===t?"rotateX":"rotateY";return{keyframes:[{transform:`${s}(90deg)`,opacity:0},{transform:`${s}(0deg)`,opacity:1}],options:{duration:e,easing:n,fill:"both"}}}function ds(t="y",e=500,n="ease-in"){const s="x"===t?"rotateX":"rotateY";return{keyframes:[{transform:`${s}(0deg)`,opacity:1},{transform:`${s}(90deg)`,opacity:0}],options:{duration:e,easing:n,fill:"both"}}}function fs(t=10,e=400,n="ease-out"){return{keyframes:[{filter:`blur(${t}px)`,opacity:0},{filter:"blur(0px)",opacity:1}],options:{duration:e,easing:n,fill:"both"}}}function ps(t=10,e=400,n="ease-in"){return{keyframes:[{filter:"blur(0px)",opacity:1},{filter:`blur(${t}px)`,opacity:0}],options:{duration:e,easing:n,fill:"both"}}}function ms(t=500,e="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{width:"0",overflow:"hidden"},{width:"auto",overflow:"hidden"}],options:{duration:t,easing:e,fill:"both"}}}function _s(t=500,e="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{width:"auto",overflow:"hidden"},{width:"0",overflow:"hidden"}],options:{duration:t,easing:e,fill:"both"}}}function gs(t,e,n=50){return{keyframes:t.keyframes,options:{...t.options,delay:(t.options.delay??0)+e*n}}}function ys(t){if(null==t||"object"!=typeof t)return t;try{return Object.keys(t).forEach(e=>{"object"!=typeof t[e]||null===t[e]||Object.isFrozen(t[e])||ys(t[e])}),Object.freeze(t)}catch(t){console.error(t)}}function ws(t,e,n){const s=ne();let i;Qt();try{i=t()}finally{Jt();se(s).forEach(t=>{"function"==typeof t.__subscribe&&e(t,n)})}return i}function vs(t,e){if(ae(t),"AsyncFunction"===e.constructor.name)throw new Error(`${t.toLowerCase()}() does not support async functions.`);if(Gt())throw new Error(`${t.toLowerCase()}() cannot be nested inside an effect() or memo().`)}function bs(t){const{name:e,fn:n,onRun:s,supportsCleanup:i}=t;vs(e,n);const r=new Set;let o,a=!1;const l=()=>{if(i&&o){try{o()}catch(t){console.error("Error in effect cleanup:",t)}o=void 0}},c=()=>{if(a)return;l();const t=new Set(r);r.clear();const e=()=>{a||Ye.schedule(c)};let h;try{h=ws(n,t=>{r.add(t.__subscribe(e))},e)}finally{t.forEach(t=>t())}if(a)return r.forEach(t=>t()),void r.clear();i&&"function"==typeof h&&(o=h),s(h)},h=()=>{a||(a=!0,l(),r.forEach(t=>t()),r.clear())};return c(),xe(n,h),h}let Ss=0;function Es(t,e){if("function"==typeof t){const e=t;let n;const s=Symbol("skip");return bs({name:"Memo",fn:()=>{try{return e()}catch(t){return console.error("[atom] Error in derived function:",t),s}},onRun:t=>{t!==s&&(n?(n.unlock("initial"),n.set(()=>t),n.lock("initial")):(n=As(t,{skipRestrictedContextCheck:!0}),n.lock("initial")))}}),n}e?.skipRestrictedContextCheck||ae("Atom");let n=t;const s=++Ss,i=new Se;function r(){return nn(r,!1),Xt()&&Kt(r),n}return r.get=function(){return r()},r.set=function(t,e=!1){var o,a;n="function"==typeof t?t(n):t,r.skipDevToolsLog||(o=String(s),a=n,jt.logAtomSet(o,a)),e||i.notify()},r.update=function(t,e=!1){var o;"object"==typeof n&&null!==n&&(t(n),r.skipDevToolsLog||(o=String(s),jt.logAtomUpdate(o)),e||i.notify())},r.__subscribe=function(t){return i.subscribe(t)},r.toJSON=function(){return JSON.stringify(n)},Object.defineProperty(r,"name",{value:"atom",writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(r,"val",{get:()=>r(),set:t=>r.set(t),enumerable:!1,configurable:!0}),Object.defineProperty(r,"__version__",{get:()=>i.getVersion(),enumerable:!1}),Object.defineProperty(r,"__isAtom___",{value:!0,writable:!1,enumerable:!1}),Object.defineProperty(r,"__id__",{value:s,writable:!1,enumerable:!1}),r}function Cs(t,e){e?.skipRestrictedContextCheck||ae("iAtom");const n=Es(ks(t),{skipRestrictedContextCheck:!0}),s=n.set;n.set=function(t,e=!1){const i="function"==typeof t?t(n.get()):t;s(ks(i),e)};const i=n;return delete i.update,i.name="iAtom",i}function As(t,e={}){e.skipRestrictedContextCheck||ae("superAtom"),Xe();const n=e.freeze??!1,s=n?ks(Ms(t)):t;let i=!1,r="default";const o=Es(n?ks(t):t,{skipRestrictedContextCheck:!0}),a=o.set;o.set=function(t,e=!1){if(i)return void me("Cannot mutate a locked atom.","superAtom");const s="function"==typeof t?t(o.get()):t;a(n?ks(s):s,e)};const l=o.update;o.update=function(t,e=!1){if(i)me("Cannot mutate a locked atom.","superAtom");else{if(n)throw new Error("update() is not supported when freeze is enabled — use set() with a new value.");l(t,e)}};const c=o;return c.lock=function(t="default"){i=!0,r=t},c.unlock=function(t="default"){if(r!==t)throw new Error("Incorrect passcode. Cannot unlock atom.");i=!1},c.reset=function(){i||o.set(n?ks(Ms(s)):s)},c.freeze=function(){ys(o.get())},c.name="superAtom",c}function ks(t){return"object"==typeof t&&null!==t?ys(t):t}function Ms(t){try{return structuredClone(t)}catch{return t}}function xs(t){const e=new Map,n=[],s=t=>JSON.stringify(t),i=t=>{e.delete(t);const s=n.indexOf(t);s>-1&&n.splice(s,1)};return{getCacheKey:s,removeCacheEntry:i,createCacheMethod:(r,o,a,l)=>async(...c)=>{const h=s(c),u=e.get(h);if(u){const e=Date.now();if(!(void 0!==t?.cacheDuration&&e-u.timestamp>t.cacheDuration)){const t=n.indexOf(h);return t>-1&&n.splice(t,1),n.push(h),r.set(u.result),o.set(null),a.set("success"),u.result}i(h)}const d=await l(this,c);e.set(h,{result:d,timestamp:Date.now()});const f=n.indexOf(h);if(f>-1&&n.splice(f,1),n.push(h),t?.cacheLimit&&n.length>t.cacheLimit){const t=n.shift();t&&e.delete(t)}return d},createClearCacheMethod:()=>(...t)=>{if(0===t.length)e.clear(),n.length=0;else{const e=s(t);i(e)}}}}function $s(t){let e=null,n=null;const s=()=>{e&&(clearInterval(e),e=null,n=null)};return{createStartPollingMethod:i=>(...r)=>{t?.pollInterval?(s(),n=r,i(...r),e=setInterval(()=>{n&&i(...n)},t.pollInterval)):me(new Error("pollInterval not specified in asyncAction options"))},createStopPollingMethod:()=>s,stopPolling:s}}function Ts(t,e){e?.allowInRestrictedContext||ae("Async Action");const n={...{cacheLimit:10,pollInterval:5e3},...e};let s=t;const i=new Set;let r=null,o=null,a=null,l=null;const c=xs(n),h=$s(n),u=Es(null),d=Es(null),f=Es(!1),p=Es("init"),m=t=>{i.forEach(e=>{if(void 0===e.filter||void 0===t||e.filter===t)try{e.fn()}catch(t){me(t)}})},_=()=>{o?.isActive()&&(o.cancel(),o=null),r&&(r.abort(),r=null),f.set(!1),p.set("init")},g=async(t,e)=>{_(),f.set(!0),p.set("loading"),r=new AbortController;const n=r;try{let i;if(a){i=a((...e)=>s.call(t,...e),...e)}else i=s.call(t,...e);i?.__isZeroPromise__&&(o=i);let c=await i;if(n.signal.aborted||r!==n)throw new Error("Operation was cancelled");return l&&(c=l(c)),u.set(c),d.set(null),p.set("success"),m(!0),c}catch(t){if(n.signal.aborted||r!==n)throw t;const e=t instanceof Error?t:new Error(String(t));throw u.set(null),d.set(e),p.set("error"),m(!1),e}finally{r===n&&(r=null),f.set(!1),o&&!o.isActive()&&(o=null)}},y=async(...t)=>{const e=this;if(Pe()){const n=Me(!1);je();const s=g(e,t).catch(()=>{}).finally(()=>{Fe()});return n?._ssrPromiseQueue&&n._ssrPromiseQueue.push(s),s}return g(e,t)},w=c.createCacheMethod(u,d,p,g),v=c.createClearCacheMethod(),b=h.createStartPollingMethod(y),S=h.createStopPollingMethod(),E=Object.assign(y,{data:u,error:d,isLoading:f,status:p,val:()=>s,set:t=>{s=t},params:{page:1},cancel:_,subscribe:(t,e)=>{ae("subscribe");const n={fn:t,filter:e};i.add(n);const s=()=>i.delete(n);return xe(t,s),s},cache:w,clearCache:v,startPolling:b,stopPolling:S,interceptBefore:t=>{a=t},interceptAfter:t=>{l=t},__isAsyncAction___:!0,__isAction___:!1});return Object.defineProperty(E,"abortController",{get:()=>r,enumerable:!0,configurable:!0}),xe(E,()=>{i.clear(),h.stopPolling(),_()}),E}const Rs=(t,e,n)=>{const s="timeout"===n?setTimeout(()=>t(),e):setInterval(()=>t(),e);return xe(s,"timeout"===n?()=>clearTimeout(s):()=>clearInterval(s)),s};class Os{constructor(){this.timeoutId=null,this.pendingArgs=null,this.pendingContext=null}clearPending(){this.pendingArgs=null,this.pendingContext=null}setPending(t,e){this.pendingArgs=t,this.pendingContext=e}clearTimer(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}setTimer(t,e){this.timeoutId=((t,e)=>Rs(t,e,"timeout"))(t,e)}executePending(t){return this.pendingArgs&&(this.lastResult=t.apply(this.pendingContext,this.pendingArgs),this.clearPending()),this.lastResult}}function Is(t,e){return()=>{t.clearTimer(),t.clearPending(),e?.()}}function Ps(t,e){return()=>{if(t.pendingArgs&&t.timeoutId){t.clearTimer();return t.executePending(e)}return t.lastResult}}function zs(t,e){const n=new Os,s=function(...s){return n.setPending(s,this),n.clearTimer(),n.setTimer(()=>{n.lastResult=n.executePending(t),n.timeoutId=null},e),n.lastResult};return s.cancel=Is(n),s.flush=Ps(n,t),s}function Ds(t,e){const n=!!e?.allowInRestrictedContext,s=Ts(t,e),i=Es(1,{skipRestrictedContextCheck:n}),r=Es(-1,{skipRestrictedContextCheck:n});return Object.assign(s,{page:i,totalPages:r,next:(...t)=>{if(!(-1!==r.val&&i.val>=r.val))return i.update(t=>t+1),s(...t)}})}function Ns(t){ae("taskAction");const e=[];let n=0,s=1,i=!1;const r={skipRestrictedContextCheck:!0},o=Es([],r),a=Es("idle",r),l=Es(0,r);function c(){if(o.set([...e]),0===e.length)return void l.set(0);let t=0;for(const n of e)"running"===n.status?t+=.5:"pending"!==n.status&&(t+=1);l.set(Math.round(t/e.length*100))}function h(){if(i){const t=e.some(t=>"running"===t.status);return void(t||a.set("idle"))}if("running"!==a.get())return;const n=e.filter(t=>"running"===t.status).length,r=e.filter(t=>"pending"===t.status);if(0===r.length&&0===n)return void a.set("idle");const o=-1===s?r.length:Math.max(0,s-n);0!==o&&r.slice(0,o).forEach(e=>function(e){const n=new AbortController;e.status="running",e.abortController=n;const s=t(e.input,n.signal);if(s?.__isZeroPromise__){const t=s;e.abortController={signal:t.signal,abort:()=>{t.cancel()}}}c(),Promise.resolve(s).then(t=>{"cancelled"===e.status||(e.status="success",e.result.data=t),e.abortController=null,c(),h()}).catch(t=>{if("cancelled"===e.status||!0===e.abortController?.signal?.aborted)e.status="cancelled",e.abortController=null;else{const n=t instanceof Error?t:new Error(String(t));e.status="failed",e.result.error=n,e.abortController=null,me(n,"taskAction")}c(),h()})}(e))}function u(t){return{id:++n,input:t,status:"pending",result:{data:null,error:null},abortController:null}}function d(t){const n=Array.isArray(t)?t:[t];for(const t of n)e.push(u(t));c(),"running"!==a.get()||i||h()}function f(t=1){"running"!==a.get()&&(s=t,i=!1,a.set("running"),h())}function p(){i=!0,function(){for(const t of e)"running"===t.status&&(t.status="cancelled",t.abortController?.abort(),t.abortController=null)}(),a.set("idle"),c()}function m(t){p(),e.length=0,n=0,c(),d(t)}const _={add:d,start:f,pause:function(){i||(i=!0)},stop:p,delete:function(t){const n=Array.isArray(t)?t:[t],s=new Set(n.map(t=>t.id));for(let t=e.length-1;t>=0;t--){const n=e[t];s.has(n.id)&&("running"===n.status&&(n.status="cancelled",n.abortController?.abort(),n.abortController=null),e.splice(t,1))}c(),"running"!==a.get()||i||h()},clearAndAdd:m,addAndStart:function(t,e=1){d(t),f(e)},clearAndStart:function(t,e=1){m(t),f(e)},isRunning:function(){return"running"===a.val},progress:l,tasks:o,pendingTasks:function(){return o.val.filter(t=>"pending"===t.status)},runningTasks:function(){return o.val.filter(t=>"running"===t.status)},successTasks:function(){return o.val.filter(t=>"success"===t.status)},failedTasks:function(){return o.val.filter(t=>"failed"===t.status)},cancelledTasks:function(){return o.val.filter(t=>"cancelled"===t.status)},__isTaskAction__:!0};return xe(_,p),_}function Ls(t,e){const n=new Os;let s=0;const i=function(...i){const r=Date.now(),o=r-s;return o>=e?(s=r,n.lastResult=t.apply(this,i),n.clearPending(),n.clearTimer()):(n.setPending(i,this),n.timeoutId||n.setTimer(()=>{s=Date.now(),n.lastResult=n.executePending(t),n.timeoutId=null},e-o)),n.lastResult};return i.cancel=Is(n,()=>{s=0}),i.flush=Ps(n,t),i}function js(...t){const[e,n]=t;return e.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g,(t,e)=>{if(!n||!(e in n))throw new Error(`Missing parameter: "${e}"`);return String(n[e])})}let Fs=null,Us=null;function Vs(t){Fs=t}function Ws(t){Us=t}function Bs(){return Fs}function Hs(){return Us}class Ys{constructor(){this.state="idle",this.__isZeroPromise__=!0,this.toActive()}isActive(){return"active"===this.state}isResolved(){return"resolved"===this.state}isRejected(){return"rejected"===this.state}isCancelled(){return"cancelled"===this.state}get signal(){return this.controller.signal}toActive(){return"active"===this.state||(this.state="active",this.controller=new AbortController,this.promise=new Promise((t,e)=>{this.resolveFn=t,this.rejectFn=e,this.controller.signal.addEventListener("abort",()=>{"active"===this.state&&(this.state="cancelled",e(new DOMException("Cancelled","AbortError")))})})),this}resolve(t){this.isActive()&&(this.state="resolved",this.resolveFn(t))}reject(t){this.isActive()&&(this.state="rejected",this.rejectFn(t))}cancel(t){this.isActive()&&this.controller.abort(t)}then(t,e){return this.promise.then(t,e)}catch(t){return this.promise.catch(t)}finally(t){return this.promise.finally(t)}get[Symbol.toStringTag](){return"ZeroPromise"}}const qs={100:"CONTINUE",101:"SWITCHING_PROTOCOLS",102:"PROCESSING",103:"EARLY_HINTS",200:"OK",201:"CREATED",202:"ACCEPTED",203:"NON_AUTHORITATIVE_INFORMATION",204:"NO_CONTENT",205:"RESET_CONTENT",206:"PARTIAL_CONTENT",207:"MULTI_STATUS",208:"ALREADY_REPORTED",226:"IM_USED",300:"MULTIPLE_CHOICES",301:"MOVED_PERMANENTLY",302:"FOUND",303:"SEE_OTHER",304:"NOT_MODIFIED",305:"USE_PROXY",307:"TEMPORARY_REDIRECT",308:"PERMANENT_REDIRECT",400:"BAD_REQUEST",401:"UNAUTHORIZED",402:"PAYMENT_REQUIRED",403:"FORBIDDEN",404:"NOT_FOUND",405:"METHOD_NOT_ALLOWED",406:"NOT_ACCEPTABLE",407:"PROXY_AUTHENTICATION_REQUIRED",408:"REQUEST_TIMEOUT",409:"CONFLICT",410:"GONE",411:"LENGTH_REQUIRED",412:"PRECONDITION_FAILED",413:"PAYLOAD_TOO_LARGE",414:"URI_TOO_LONG",415:"UNSUPPORTED_MEDIA_TYPE",416:"RANGE_NOT_SATISFIABLE",417:"EXPECTATION_FAILED",418:"IM_A_TEAPOT",421:"MISDIRECTED_REQUEST",422:"UNPROCESSABLE_ENTITY",423:"LOCKED",424:"FAILED_DEPENDENCY",425:"TOO_EARLY",426:"UPGRADE_REQUIRED",428:"PRECONDITION_REQUIRED",429:"TOO_MANY_REQUESTS",431:"REQUEST_HEADER_FIELDS_TOO_LARGE",451:"UNAVAILABLE_FOR_LEGAL_REASONS",500:"INTERNAL_SERVER_ERROR",501:"NOT_IMPLEMENTED",502:"BAD_GATEWAY",503:"SERVICE_UNAVAILABLE",504:"GATEWAY_TIMEOUT",505:"HTTP_VERSION_NOT_SUPPORTED",506:"VARIANT_ALSO_NEGOTIATES",507:"INSUFFICIENT_STORAGE",508:"LOOP_DETECTED",510:"NOT_EXTENDED",511:"NETWORK_AUTHENTICATION_REQUIRED"};function Xs(t){return t>=200&&t<300}function Zs(t){const{url:e="",host:n="",path:s,params:i={}}=t,r=e||s||"",o=/^https?:\/\//i.test(r)?r:`${n}${r}`,{pathParams:a,qsParams:l}=function(t,e){const n=new Set;for(const[,e]of t.matchAll(/:([a-zA-Z_][a-zA-Z0-9_]*)/g))n.add(e);const s={},i={};for(const[t,r]of Object.entries(e))n.has(t)?s[t]=r:i[t]=r;return{pathParams:s,qsParams:i}}(o,i),c=Object.keys(a).length>0?js(o,a):o;if(0===Object.keys(l).length)return c;let h,u;if(/^https?:\/\//i.test(c)){const t=new URL(c);h=t.origin+t.pathname,u=t.search}else{const t=c.indexOf("?");h=-1===t?c:c.slice(0,t),u=-1===t?"":c.slice(t)}const d=new URLSearchParams(u);for(const[t,e]of Object.entries(l))null!=e&&(Array.isArray(e)?e.forEach(e=>d.append(t,String(e))):d.set(t,String(e)));const f=d.toString();return f?`${h}?${f}`:h}const Gs=new Set,Ks=new Set,Qs=new Set;class Js{constructor(t={},e,n,s){this.instanceBeforeFns=[],this.instanceAfterFns=[],this.instanceErrorFns=[],this.baseRequest=t,this._scopeBeforeFns=e,this._scopeAfterFns=n,this._scopeErrorFns=s}interceptBefore(t){return this.instanceBeforeFns.push(t),()=>{const e=this.instanceBeforeFns.indexOf(t);-1!==e&&this.instanceBeforeFns.splice(e,1)}}interceptAfter(t){return this.instanceAfterFns.push(t),()=>{const e=this.instanceAfterFns.indexOf(t);-1!==e&&this.instanceAfterFns.splice(e,1)}}interceptError(t){return this.instanceErrorFns.push(t),()=>{const e=this.instanceErrorFns.indexOf(t);-1!==e&&this.instanceErrorFns.splice(e,1)}}clearInterceptors(){this.instanceBeforeFns.length=0,this.instanceAfterFns.length=0,this.instanceErrorFns.length=0}get _beforeFns(){return this._scopeBeforeFns??Gs}get _afterFns(){return this._scopeAfterFns??Ks}get _errorFns(){return this._scopeErrorFns??Qs}fetch(t){const e=new Ys,n={...this.baseRequest,...t,headers:{...this.baseRequest.headers,...t.headers},params:{...this.baseRequest.params,...t.params}},{body:s,url:i,host:r,params:o,path:a,...l}=n,c=Zs(n),h=function(t){return null==t?{}:"string"==typeof t||t instanceof FormData||t instanceof Blob||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||t instanceof URLSearchParams||t instanceof ReadableStream?{body:t}:{body:JSON.stringify(t),headers:{"Content-Type":"application/json"}}}(s),u=(n.method??"GET").toUpperCase(),d=Bs(),f=Hs();if(Pe()&&d){let t;try{t=c.startsWith("http")?new URL(c).pathname:c.split("?")[0]}catch{t=c.split("?")[0]}if(t.startsWith("/api")){const s=d(u,t);if(s){je();const t={"content-type":"application/json",...l.headers,...h.headers};if(f){const e=f.headers.get("cookie"),n=f.headers.get("authorization");e&&(t.cookie=e),n&&(t.authorization=n)}const i=new Request(c.startsWith("http")?c:`http://localhost${c}`,{method:u,headers:t,body:h.body??null}),r=(()=>{const t=n.params||{},e=n.url||n.path||"",s=/^https?:\/\//i.test(e)?e:`${n.host||""}${e}`,i={};for(const[,e]of s.matchAll(/:([a-zA-Z_][a-zA-Z0-9_]*)/g))e in t&&(i[e]=String(t[e]));return i})(),o={...s.ctx,params:{...r,...s.ctx?.params||{}}};return s.handler(i,o).then(async t=>{if(!t.ok){const n=qs[t.status]||"UNKNOWN_ERROR";return e.reject(new Error(`${n}: ${t.statusText}`)),void Fe()}const n=t.headers.get("content-type");n?.includes("application/json")?e.resolve(await t.json()):e.resolve(t),Fe()}).catch(t=>{e.reject(t),Fe()}),e}}}return(async()=>{let t,n=c,s={...l,method:u,...h,headers:{...l.headers,...h.headers}};0===Object.keys(s.headers).length&&delete s.headers;for(const t of this.instanceBeforeFns){const e=await t(n,s);n=e.url,s=e.options}for(const t of this._beforeFns){const e=await t(n,s);n=e.url,s=e.options}try{t=await fetch(n,{...s,signal:e.signal})}catch(t){for(const e of this.instanceErrorFns)try{e(t)}catch(t){}for(const e of this._errorFns)try{e(t)}catch(t){}return void e.reject(t)}let i=t;for(const t of this.instanceAfterFns)i=await t(i);for(const t of this._afterFns)i=await t(i);if(!i.ok){const t=qs[i.status]||"UNKNOWN_ERROR",n=new Error(`${t}: ${i.statusText}`);for(const t of this.instanceErrorFns)try{t(n)}catch(t){}for(const t of this._errorFns)try{t(n)}catch(t){}return void e.reject(n)}const r=i.headers.get("content-type");if(r?.includes("application/json")){const t=await i.json();if(t&&"object"==typeof t&&"Redirect"===t.__type&&"string"==typeof t.url){const n=t.url;return"undefined"!=typeof window&&(window.location.href=n),void e.resolve(void 0)}e.resolve(t)}else e.resolve(i)})().catch(t=>e.reject(t)),e}Fetch(t){return this.fetch(t)}Get(t){return this.fetch({...t,method:"GET"})}Post(t){return this.fetch({...t,method:"POST"})}Put(t){return this.fetch({...t,method:"PUT"})}Patch(t){return this.fetch({...t,method:"PATCH"})}Delete(t){return this.fetch({...t,method:"DELETE"})}fetchAction(t){const{baseRequest:e,options:n}=function(t){if(!t)return{baseRequest:{},options:{}};const{cacheDuration:e,cacheLimit:n,pollInterval:s,allowInRestrictedContext:i,...r}=t;return{baseRequest:r,options:{...void 0!==e&&{cacheDuration:e},...void 0!==n&&{cacheLimit:n},...void 0!==s&&{pollInterval:s},...void 0!==i&&{allowInRestrictedContext:i}}}}(t);return Ts(t=>this.fetch({...e,params:{...e.params,...t}}),n)}getAction(t){return this.fetchAction({...t,method:"GET"})}postAction(t){return this.fetchAction({...t,method:"POST"})}putAction(t){return this.fetchAction({...t,method:"PUT"})}patchAction(t){return this.fetchAction({...t,method:"PATCH"})}deleteAction(t){return this.fetchAction({...t,method:"DELETE"})}}const ti=new Js({});async function ei(t,e){let n,s=t,i=e;for(const t of Gs){const e=await t(s,i);s=e.url,i=e.options}try{n=await fetch(s,i)}catch(t){for(const e of Qs)try{e(t)}catch{}throw t}for(const t of Ks)n=await t(n);if(!n.ok){const t=new Error(`${n.status} ${n.statusText}`);for(const e of Qs)try{e(t)}catch{}}return n}function ni(t){return async(e,n)=>({url:e,options:{...n,headers:{...n.headers,Authorization:"string"==typeof t?t:await t()}}})}function si(t){return(e,n)=>({url:e.startsWith("http")?e:`${t}${e}`,options:n})}function ii(t=console.log){return e=>(t(`[fetch] ${e.status} ${e.url}`),e)}const ri=t=>ti.fetchAction(t),oi=t=>ti.getAction(t),ai=t=>ti.postAction(t),li=t=>ti.putAction(t),ci=t=>ti.patchAction(t),hi=t=>ti.deleteAction(t);function ui(t){return t.startsWith("--")?t:`--${t}`}function di(t,e){let n="";for(const t in e){n+=` ${ui(t)}: ${e[t]};\n`}return n?`${t} {\n${n}}`:""}function fi(t){const e=Object.keys(t);if(0===e.length)throw new Error("[globalTheme] themes object must have at least one entry.");const n=e[0],s=e[1],i=t[n],r=[];r.push(di(":root",i));for(const n of e)r.push(di(`[data-theme="${n}"]`,t[n]));void 0!==s&&r.push(function(t){let e="";for(const n in t)e+=` ${ui(n)}: ${t[n]};\n`;return e?`@media (prefers-color-scheme: dark) {\n :root:not([data-theme]) {\n${e} }\n}`:""}(t[s])),Bn();const o=Wn(),a=r.filter(Boolean).join("\n");a&&o.appendRules(a);const l=Object.create(null);for(const t in i)l[t]=ui(t);return{cssVars:Object.freeze(l)}}function pi(t){Bn();const e=Wn(),n=di(":root",t);return n&&e.appendRules(n),t}function mi(t){if(null==t)return{action:"remove"};if("boolean"==typeof t)return t?{action:"set",value:""}:{action:"remove"};if("string"==typeof t)return{action:"set",value:t};if("number"==typeof t)return{action:"set",value:String(t)};if(Array.isArray(t)){if(2===t.length){const[e,n]=t;return e?"boolean"==typeof n?n?{action:"set",value:""}:{action:"remove"}:{action:"set",value:String(n)}:{action:"remove"}}if(3===t.length){const[e,n,s]=t,i=e?n:s;return"boolean"==typeof i?i?{action:"set",value:""}:{action:"remove"}:{action:"set",value:String(i)}}}return{action:"remove"}}function _i(t){return t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function gi(t){if(null==t||!1===t)return null;if("string"==typeof t)return t;if("number"==typeof t)return String(t);if(Array.isArray(t)){if(2===t.length){const[e,n]=t;return e?String(n):null}if(3===t.length){const[e,n,s]=t;return String(e?n:s)}}return null}const yi=new WeakMap,wi=new WeakMap,vi=new WeakMap,bi=new WeakMap;class Si{constructor(t){this.el=t}attr(t){const e=this.el;yi.has(e)||yi.set(e,new Map);const n=yi.get(e),s=new Map;for(const[i,r]of Object.entries(t)){const t=mi(r);"set"===t.action?(n.get(i)!==t.value&&e.setAttribute(i,t.value),s.set(i,t.value)):n.has(i)&&e.removeAttribute(i)}for(const t of n.keys())s.has(t)||e.removeAttribute(t);return yi.set(e,s),this}updateAttr(t){const e=this.el;yi.has(e)||yi.set(e,new Map);const n=yi.get(e),s=Object.fromEntries(n);t(s);const i=new Map;for(const[t,r]of Object.entries(s))n.get(t)!==r&&e.setAttribute(t,r),i.set(t,r);for(const t of n.keys())i.has(t)||e.removeAttribute(t);return yi.set(e,i),this}style(t){const e=this.el;wi.has(e)||wi.set(e,new Map);const n=wi.get(e),s=new Map;for(const[i,r]of Object.entries(t)){const t=gi(r),o=_i(i);null!==t?(n.get(o)!==t&&e.style.setProperty(o,t),s.set(o,t)):n.has(o)&&e.style.removeProperty(o)}for(const t of n.keys())s.has(t)||e.style.removeProperty(t);return wi.set(e,s),this}classes(t){const e=this.el;vi.has(e)||vi.set(e,new Set);const n=vi.get(e),s=function(t){const e=new Set,n=t=>{for(const n of t.split(/\s+/))n&&e.add(n)};if("string"==typeof t)return n(t),e;if(Array.isArray(t)){for(const e of t)if(e||0===e)if("string"!=typeof e){if(Array.isArray(e))if(2===e.length){const[t,s]=e;t&&s&&n(s)}else if(3===e.length){const[t,s,i]=e;n(t?s:i)}}else n(e);return e}if("object"==typeof t&&null!==t)for(const[e,s]of Object.entries(t))s&&n(e);return e}(t);for(const t of s)n.has(t)||e.classList.add(t);for(const t of n)s.has(t)||e.classList.remove(t);return vi.set(e,s),this}addClass(t){const e=this.el;for(const n of t.split(/\s+/))n&&e.classList.add(n);return this}removeClass(t){const e=this.el;for(const n of t.split(/\s+/))n&&e.classList.remove(n);return this}toggleClass(t,e){const n=this.el;for(const s of t.split(/\s+/))s&&n.classList.toggle(s,e);return this}html(t){if(null==t)throw new Error("$(el).html() — the factory function must return a lit-html TemplateResult (e.g. () => html`<span>${value}</span>`).");return F(t,this.el),this}text(t){return this.el.textContent=String(t),this}focus(t){return this.el.focus(t),this}blur(){return this.el.blur(),this}scroll(t){const e=this.el;return"string"==typeof t?e.scrollTo({top:0,behavior:t}):t?e.scrollTo(t):e.scrollTo({top:0}),this}scrollIntoView(t){return this.el.scrollIntoView(t),this}measure(t){const e=this.el.getBoundingClientRect();return t({width:e.width,height:e.height,top:e.top,left:e.left,right:e.right,bottom:e.bottom,x:e.x,y:e.y}),this}on(t,e,n){const s=this.el;bi.has(s)||bi.set(s,new Map);const i=bi.get(s),r=i.get(t);r&&s.removeEventListener(t,r.handler,r.options);const o=e;return s.addEventListener(t,o,n),i.set(t,{handler:o,options:n}),this}off(t,e){const n=this.el,s=bi.get(n);if(!s)return this;if(e){const i=s.get(t);i&&i.handler===e&&(n.removeEventListener(t,i.handler,i.options),s.delete(t))}else{const e=s.get(t);e&&(n.removeEventListener(t,e.handler,e.options),s.delete(t))}return this}once(t,e,n){const s="object"==typeof n?{...n,once:!0}:{once:!0};return this.el.addEventListener(t,e,s),this}delegate(t,e,n,s){const i=t=>{const s=t.target?.closest(e);s&&this.el.contains(s)&&n(t,s)};return this.el.addEventListener(t,i,s),bi.has(this.el)||bi.set(this.el,new Map),bi.get(this.el).set(`${t}:delegate:${e}`,{handler:i,options:s}),this}aria(t){const e=this.el;for(const[n,s]of Object.entries(t)){const t=n.startsWith("aria-")?n:`aria-${n}`;null==s||!1===s?e.removeAttribute(t):e.setAttribute(t,String(s))}return this}getAttr(t){return this.el.getAttribute(t)}data(t){const e=this.el;for(const[n,s]of Object.entries(t)){const t=n.startsWith("data-")?n.slice(5):n,i=n.startsWith("data-")?n:`data-${n}`;null==s?e.removeAttribute(i):e.setAttribute(i,String(s));const r=t.replace(/-([a-z])/g,(t,e)=>e.toUpperCase());null==s?delete e.dataset[r]:e.dataset[r]=String(s)}return this}}function Ei(t){if(null!==t&&"object"==typeof t&&!0===t.__isMatesRef__){const e=t;if(void 0===e.value)throw new Error("$(ref): the ref has no element attached yet (ref.value is undefined).\nDOM manipulation via $() must happen after the element has mounted.\nUse one of the lifecycle hooks where the element is guaranteed to exist:\n • onMount() — runs once after the component's first render\n • onPaint() — runs after the browser has painted\n • onUpdate() — runs after every subsequent re-render\n\nExample:\n const inputRef = ref<HTMLInputElement>();\n onMount(() => { $(inputRef).focus(); });");return new Si(e.value)}return new Si(t)}function Ci(t,e){return"function"!=typeof t.animate?Promise.resolve():("function"==typeof t.getAnimations&&t.getAnimations().forEach(t=>t.cancel()),new Promise(n=>{const s=t.animate(e.keyframes,{duration:300,easing:"ease",fill:"both",...e.options});s.onfinish=()=>n(),s.oncancel=()=>n()}))}async function Ai(t){const{el:e,exit:n,enter:s,swap:i,getEl:r,isStale:o}=t;if(!e)return void i();if(await Ci(e,n),o?.())return;if(i(),await("function"!=typeof requestAnimationFrame?Promise.resolve():new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(()=>t())))),o?.())return;const a=r?.()??e;a&&await Ci(a,s)}function ki(t){return t.__isEffect__=!0,bs({name:"Effect",fn:t,onRun:()=>{},supportsCleanup:!0})}const Mi=new WeakMap,xi=Y(class extends ut{render(t){return C}update(t,[e]){const n=e!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=e,this.ht=t.options?.host,this.rt(this.ct=t.element)),C}rt(t){if(this.isConnected||(t=void 0),"function"==typeof this.Y){const e=this.ht??globalThis;let n=Mi.get(e);void 0===n&&(n=new WeakMap,Mi.set(e,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,t),void 0!==t&&this.Y.call(this.ht,t)}else this.Y.value=t}get lt(){return"function"==typeof this.Y?Mi.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});function $i(){const t=new Ee;let e;const n={get value(){return e},__subscribe:e=>t.subscribe(e),__isMatesRef__:!0,__set:n=>{e!==n&&(e=n,t.trigger(n))}};return n}function Ti(t){if(t&&t.__isMatesRef__){const e=t;return xi(t=>{e.__set(t)})}return xi(t)}function Ri(t,e){return t.add(e),()=>t.delete(e)}class Oi{constructor(){this._beforeFns=new Set,this._afterFns=new Set,this._errorFns=new Set,this.fetchClient=new Js({},this._beforeFns,this._afterFns,this._errorFns)}interceptBefore(t){return Ri(this._beforeFns,t)}interceptAfter(t){return Ri(this._afterFns,t)}interceptError(t){return Ri(this._errorFns,t)}clearInterceptors(){this._beforeFns.clear(),this._afterFns.clear(),this._errorFns.clear()}}const Ii=()=>{if("undefined"==typeof window)return{};const t=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash,e=new URLSearchParams(t),n={};for(const[t,s]of e)try{n[t]=JSON.parse(s)}catch{n[t]=s}return n};function Pi(t){const e=Es(Ii());let n=!1;ki(()=>{const s=e();n||t()||(t=>{if("undefined"==typeof window)return;const e=new URLSearchParams;for(const n in t){const s=t[n];null!=s&&e.set(n,"object"==typeof s?JSON.stringify(s):String(s))}const n=e.toString(),s=window.location.pathname+window.location.search+(n?`#${n}`:"");window.history.replaceState(null,"",s)})(s)});const s=()=>{t()||(n=!0,e.set(Ii()),n=!1)};return"undefined"!=typeof window&&window.addEventListener("hashchange",s),e}const zi=()=>{if("undefined"==typeof window)return{};const t=new URLSearchParams(window.location.search),e={};for(const[n,s]of t)try{e[n]=JSON.parse(s)}catch{e[n]=s}return e};function Di(t){const e=Es(zi());let n=!1;ki(()=>{const s=e();n||t()||(t=>{if("undefined"==typeof window)return;const e=new URLSearchParams;for(const n in t){const s=t[n];null!=s&&e.set(n,"object"==typeof s?JSON.stringify(s):String(s))}const n=e.toString(),s=window.location.pathname+(n?`?${n}`:"")+window.location.hash;window.history.replaceState(null,"",s)})(s)});const s=()=>{t()||(n=!0,e.set(zi()),n=!1)};return"undefined"!=typeof window&&window.addEventListener("popstate",s),e}function Ni(t){return new Promise(e=>{const n=()=>{t?.(),e()};Pe()?queueMicrotask(n):"undefined"!=typeof requestIdleCallback?requestIdleCallback(()=>n(),{timeout:300}):requestAnimationFrame(n)})}class Li{constructor(){this.navigationLocked=Es(!1),this.navigationRequestEvent=Te("router:navigation-request"),this.historyStateAtom=Es("undefined"!=typeof window?window.history.state:null),this.pathAtom=function(t,e,n){const s=As("undefined"!=typeof window?window.location.pathname:"/");function i(t){t.preventDefault(),t.returnValue=""}return ki(()=>(t()?"undefined"!=typeof window&&window.addEventListener("beforeunload",i):"undefined"!=typeof window&&window.removeEventListener("beforeunload",i),()=>{"undefined"!=typeof window&&window.removeEventListener("beforeunload",i)})),"undefined"!=typeof window&&(window.addEventListener("popstate",i=>{if(t())return window.history.pushState(window.history.state,"",s.get()),void e.set(window.history.state??null);const r=window.location.pathname;if(r!==s.get()&&n.trigger({to:r,from:s.get()}),t())return window.history.pushState(window.history.state,"",s.get()),void e.set(window.history.state??null);e.set(i.state??null),r!==s.get()&&s.set(r)}),window.addEventListener("hashchange",()=>{if(t())return;const e=window.location.pathname;e!==s.get()&&s.set(e)}),window.addEventListener("navigate",()=>{if(t())return;const e=window.location.pathname;e!==s.get()&&s.set(e)})),s}(this.navigationLocked,this.historyStateAtom,this.navigationRequestEvent),this.qsAtom=Di(this.navigationLocked),this.hashAtom=Pi(this.navigationLocked)}navigateTo(t,e,n){var s,i,r,o;(s=this.pathAtom,i=this.navigationLocked,r=this.historyStateAtom,o=this.navigationRequestEvent,function(t,e,n){if(i())return;if(t===s.get())return;const a=t.includes("?"),l=t.includes("#");let c=t;if(a||l)if(l){if(!a){const e=t.indexOf("#");c=t.slice(0,e)+window.location.search+t.slice(e)}}else c=t+window.location.hash;else c=t+window.location.search+window.location.hash;o.trigger({to:t,from:s.get()}),i()||(r.set(n??null),e?window.history.replaceState(n,"",c):window.history.pushState(n,"",c),s.set(t))})(t,e,n)}lockNavigation(){this.navigationLocked.set(!0)}unlockNavigation(){this.navigationLocked.set(!1)}get location(){return t=this.pathAtom,e=this.hashAtom,n=this.qsAtom,{get path(){return t.get()},get hash(){return e()},get qsObj(){return n()}};var t,e,n}onNavigationRequest(t){if(Pe())return;Xe();let e=!1;const n=this.navigationRequestEvent.__subscribe(n=>{if(e)return;const{to:s,from:i}=n;this.lockNavigation();let r=!1;const o=t({to:s,from:i,next:()=>{r||(r=!0,e=!0,this.unlockNavigation(),Ni(()=>{this.navigateTo(s),e=!1}))}});o instanceof Promise?o.then(()=>{r||this.unlockNavigation()}).catch(()=>{r||this.unlockNavigation()}):r||this.unlockNavigation()});xe(t,n)}}const ji="mates";function Fi(t,e){try{null===e?t.removeItem(ji):t.setItem(ji,JSON.stringify(e))}catch{}}function Ui(t,e){const n=Es((()=>{try{return function(t){try{const e=t.getItem(ji);if(e)return JSON.parse(e)}catch{}return null}(t())}catch{return null}})()),s=n.set;n.set=function(e,i=!1){s(e,i);try{Fi(t(),n.get())}catch{}};const i=n.update;return n.update=function(e,s=!1){if(null!==n.get()){i(e,s);try{Fi(t(),n.get())}catch{}}},e(t=>{if(t.key===ji)if(t.newValue)try{s(JSON.parse(t.newValue))}catch{}else s(null)}),Object.defineProperty(n,"name",{value:"storageAtom",writable:!0,configurable:!0,enumerable:!1}),n}function Vi(t){"undefined"!=typeof window&&window.addEventListener("storage",t)}class Wi{constructor(){this.lsAtom=Ui(()=>localStorage,t=>Vi(e=>{e.storageArea===localStorage&&t(e)})),this.ssAtom=Ui(()=>sessionStorage,t=>Vi(e=>{e.storageArea===sessionStorage&&t(e)}))}}const Bi="mates-theme";function Hi(t){return"auto"===t?function(){try{return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}():t}const Yi=function(){const t=Es(function(){try{const t=localStorage.getItem(Bi);return"light"===t||"dark"===t||"auto"===t?t:null}catch{return null}}()??"auto",{skipRestrictedContextCheck:!0}),e=t;if(e.setToLight=()=>{t.set("light")},e.setToDark=()=>{t.set("dark")},e.setToAuto=()=>{t.set("auto")},e.toggle=()=>{const e=Hi(t.get());t.set("dark"===e?"light":"dark")},Object.defineProperty(e,"resolved",{get:()=>Hi(t.get()),enumerable:!1,configurable:!0}),Object.defineProperty(e,"name",{value:"themeAtom",writable:!0,configurable:!0,enumerable:!1}),ki(()=>{const e=t.get();!function(t){try{document.documentElement.setAttribute("data-theme",Hi(t))}catch{}}(e),function(t){try{"auto"===t?localStorage.removeItem(Bi):localStorage.setItem(Bi,t)}catch{}}(e)}),"undefined"!=typeof window&&window.matchMedia)try{window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{"auto"===t.get()&&t.set("auto")})}catch{}return e};class qi{constructor(){this.themeAtom=Yi(),this.titleAtom=function(){const t=Es("undefined"!=typeof document?document.title:"");return ki(()=>{"undefined"!=typeof document&&(document.title=t.get())}),t}()}}class Xi{constructor(){this._router=new Li,this._fetch=new Oi,this._storage=new Wi,this._theme=new qi}get pathAtom(){return this._router.pathAtom}get qsAtom(){return this._router.qsAtom}get hashAtom(){return this._router.hashAtom}get historyStateAtom(){return this._router.historyStateAtom}get navigationLocked(){return this._router.navigationLocked}get navigationRequestEvent(){return this._router.navigationRequestEvent}get location(){return this._router.location}navigateTo(t,e,n){return this._router.navigateTo(t,e,n)}lockNavigation(){return this._router.lockNavigation()}unlockNavigation(){return this._router.unlockNavigation()}onNavigationRequest(t){return this._router.onNavigationRequest(t)}get fetchClient(){return this._fetch.fetchClient}interceptBefore(t){return this._fetch.interceptBefore(t)}interceptAfter(t){return this._fetch.interceptAfter(t)}interceptError(t){return this._fetch.interceptError(t)}clearInterceptors(){return this._fetch.clearInterceptors()}get lsAtom(){return this._storage.lsAtom}get ssAtom(){return this._storage.ssAtom}get themeAtom(){return this._theme.themeAtom}get titleAtom(){return this._theme.titleAtom}}const Zi=t=>"function"==typeof t&&!0===t.__isAtom___&&"function"==typeof t.set&&"function"==typeof t.__subscribe,Gi=t=>"object"==typeof t&&null!==t&&!0===t.__isUnit___&&"function"==typeof t.__subscribe&&"function"==typeof t.__reset,Ki=t=>"function"==typeof t&&!0===t.__isAction___&&"function"==typeof t.__subscribe,Qi=t=>"function"==typeof t&&!0===t.__isAsyncAction___&&"function"==typeof t.subscribe,Ji=t=>"function"==typeof t&&!0===t.__isSetter___&&"function"==typeof t.__subscribe,tr=t=>"object"==typeof t&&null!==t&&!0===t.__isEvent___&&"function"==typeof t.__subscribe&&"function"==typeof t.trigger,er=t=>"object"==typeof t&&null!==t&&!0===t.__isConfirmationEvent___&&"function"==typeof t.requestConfirmation&&"function"==typeof t.onConfirmRequest,nr=t=>"object"==typeof t&&null!==t&&!0===t.__isChannel___&&"function"==typeof t.join,sr=t=>"function"==typeof t&&!0===t.__isSelector___&&"function"==typeof t.areVersionsChanged,ir=t=>"function"==typeof t,rr=t=>"AsyncFunction"===t.constructor.name,or=(t,e,n,s)=>{if(Zi(t)){const i=t,r=Es(i(),s),o=n(r.set,e),a=n(r.update,e);return r.set=o,r.update=a,i.__subscribe(()=>{Ye.schedule(()=>r.set(i()))}),xe(r,()=>{o.cancel(),a.cancel()}),r}const i=Es(t,s),r=n(i.set,e),o=n(i.update,e);return i.set=r,i.update=o,xe(i,()=>{r.cancel(),o.cancel()}),i},ar=(t,e,n)=>or(t,e,zs,n);function lr(t,e,n){const s=new Set;function i(t){const n=setTimeout(()=>{s.delete(n),t()},e);s.add(n)}function r(){for(const t of s)clearTimeout(t);s.clear()}if(Zi(t)){const e=t,s=Es(e(),n),o=s.set.bind(s),a=s.update.bind(s);return s.set=(t,e)=>{i(()=>o(t,e))},s.update=(t,e)=>{i(()=>a(t,e))},e.__subscribe(()=>{const t=e();i(()=>o(t))}),xe(s,r),s}const o=Es(t,n),a=o.set.bind(o),l=o.update.bind(o);return o.set=(t,e)=>{i(()=>a(t,e))},o.update=(t,e)=>{i(()=>l(t,e))},xe(o,r),o}const cr=(t=[],e)=>{const n=new Map(t),s=Es(n,e),i=n.set.bind(n);n.set=(t,e)=>(i(t,e),s.update(()=>{}),n);const r=n.delete.bind(n);n.delete=t=>{const e=r(t);return s.update(()=>{}),e};const o=n.clear.bind(n);n.clear=()=>{o(),s.update(()=>{})};const a=n.get.bind(n);n.get=t=>(s.get(),a(t));const l=n.has.bind(n);n.has=t=>(s.get(),l(t));const c=Object.getOwnPropertyDescriptor(Map.prototype,"size");Object.defineProperty(n,"size",{get:()=>(s.get(),c.get.call(n))});const h=n.entries.bind(n);n.entries=()=>(s.get(),h());const u=n.values.bind(n);n.values=()=>(s.get(),u());const d=n.keys.bind(n);n.keys=()=>(s.get(),d());const f=n.forEach.bind(n);n.forEach=(t,e)=>(s.get(),f(t,e));const p=n[Symbol.iterator].bind(n);return n[Symbol.iterator]=()=>(s.get(),p()),n.update=t=>{const e={set:(t,n)=>(i(t,n),e),delete:t=>r(t),clear:()=>{o()},get:t=>a(t),has:t=>l(t),entries:()=>h(),values:()=>u(),keys:()=>d(),forEach:(t,e)=>f(t,e),[Symbol.iterator]:()=>p(),get size(){return c.get.call(n)}};return t(e),s.update(()=>{}),n},n.updateItem=(t,e)=>{const i=a(t);return null==i||"object"!=typeof i||(e(i),s.update(()=>{})),n},Object.defineProperty(n,"__isAtom___",{value:s,writable:!1,enumerable:!1}),Object.defineProperty(n,"__version__",{get:()=>s.__version__,enumerable:!1}),n},hr=(t=[],e)=>{const n=new Set(t),s=Es(n,e),i=n.add.bind(n);n.add=t=>(i(t),s.update(()=>{}),n);const r=n.delete.bind(n);n.delete=t=>{const e=r(t);return s.update(()=>{}),e};const o=n.clear.bind(n);n.clear=()=>{o(),s.update(()=>{})};const a=n.has.bind(n);n.has=t=>(s.get(),a(t));const l=Object.getOwnPropertyDescriptor(Set.prototype,"size");Object.defineProperty(n,"size",{get:()=>(s.get(),l.get.call(n))});const c=n.entries.bind(n);n.entries=()=>(s.get(),c());const h=n.values.bind(n);n.values=()=>(s.get(),h());const u=n.keys.bind(n);n.keys=()=>(s.get(),u());const d=n.forEach.bind(n);n.forEach=(t,e)=>(s.get(),d(t,e));const f=n[Symbol.iterator].bind(n);return n[Symbol.iterator]=()=>(s.get(),f()),n.update=t=>{const e={add:t=>(i(t),e),delete:t=>r(t),clear:()=>{o()},has:t=>a(t),entries:()=>c(),values:()=>h(),keys:()=>u(),forEach:(t,e)=>d(t,e),[Symbol.iterator]:()=>f(),get size(){return l.get.call(n)}};return t(e),s.update(()=>{}),n},n.updateItem=(t,e)=>(null==t||"object"!=typeof t||(e(t),s.update(()=>{})),n),Object.defineProperty(n,"__isAtom___",{value:s,writable:!1,enumerable:!1}),Object.defineProperty(n,"__version__",{get:()=>s.__version__,enumerable:!1}),n},ur=(t,e,n)=>or(t,e,Ls,n);function dr(t){const e=new Map,n=new Map,s=Es(e,t),i=s.get.bind(s),r=s;return r.add=(t,i,r)=>{if(n.has(t)&&(clearTimeout(n.get(t)),n.delete(t)),s.update(e=>{e.set(t,i)}),void 0!==r&&-1!==r&&r>0){const i=setTimeout(()=>{e.delete(t),n.delete(t),s.update(()=>{})},r);n.set(t,i)}},r.get=t=>(i(),e.get(t)),r.remove=t=>!!e.has(t)&&(n.has(t)&&(clearTimeout(n.get(t)),n.delete(t)),e.delete(t),s.update(()=>{}),!0),r.has=t=>(i(),e.has(t)),r.getAll=()=>(i(),Array.from(e.values())),r.clearAll=()=>{n.forEach(t=>clearTimeout(t)),n.clear(),e.clear(),s.update(()=>{})},Object.defineProperty(r,"size",{get:()=>(i(),e.size),enumerable:!0,configurable:!0}),Object.defineProperty(r,"name",{get:()=>"cacheAtom",enumerable:!0,configurable:!0}),xe(s,r.clearAll),r}function fr(t=0,e){const n=Es(t,e),s=n;return s.change=t=>{n.set(void 0!==t?t:Math.random())},s.name="changeFlagAtom",s}const pr=(t=1,e)=>{const n=Es(t,e),s=n;return s.next=()=>{n.set(t=>t+1)},s.prev=()=>{n.set(t=>t>1?t-1:t)},s.reset=()=>{n.set(1)},Object.defineProperty(s,"currentPage",{get:()=>n.get(),enumerable:!1,configurable:!0}),Object.defineProperty(s,"name",{value:"paginationAtom",writable:!0,configurable:!0,enumerable:!1}),s};function mr(t,e=2){let n=parseFloat(String(t).trim());Number.isFinite(n)||(n=0);const s=10**e;return Math.round(n*s)/s}function _r(t,e,n){const s=As(t,{skipRestrictedContextCheck:!0,...n}),i=As([],{skipRestrictedContextCheck:!0,...n});function r(){const t=s.get(),n=e.map(e=>e(t)).filter(t=>null!=t&&""!==t);return i.set(n),n}const o=s.set;s.set=function(t,e=!1){o(t,e),r()};const a=s.update;s.update=function(t,e=!1){a(t,e),r()};const l=s;return Object.defineProperty(l,"__isFormAtom__",{value:!0,writable:!1,enumerable:!1,configurable:!1}),Object.defineProperty(l,"errors",{get:()=>i.get(),enumerable:!1,configurable:!0}),Object.defineProperty(l,"isValid",{get:()=>0===i.get().length,enumerable:!1,configurable:!0}),l.validate=r,l.toFloat=()=>mr(s.get()),l.toFloatString=()=>mr(s.get()).toString(),l.toValidNumber=()=>function(t){const e=Number(t);return Number.isFinite(e)?e:0}(s.get()),Object.defineProperty(l,"name",{value:"formAtom",writable:!0,configurable:!0,enumerable:!1}),l}const gr=(t,e=[],n)=>_r(t,e,n);function yr(t){const e=[],n={},s=new WeakSet;return function t(i,r){if(null==i)return;const o=typeof i;if("object"!==o&&"function"!==o)return;if(s.has(i))return;if(s.add(i),function(t){if(null==t)return!1;const e=typeof t;return("object"===e||"function"===e)&&!0===t.__isFormAtom__}(i)){const t=i.validate();return void(t.length>0&&(e.push(...t),n[r]=t))}if(Array.isArray(i)){for(let e=0;e<i.length;e++){const n=r?`${r}[${e}]`:`[${e}]`;t(i[e],n)}return}const a=Object.keys(i);for(const e of a){const n=r?`${r}.${e}`:e;t(i[e],n)}}(t,""),{isValid:0===e.length,errors:e,errorsByField:n}}function wr(t,e,n){const s=e.replace(/\[(\d+)]/g,".$1").split(".");let i=t;for(const t of s){if(null==i)return n;i=i[t]}return void 0===i?n:i}function vr(t,e){const n={};for(const s of e)s in t&&(n[s]=t[s]);return n}function br(t,e){const n={...t};for(const t of e)delete n[t];return n}function Sr(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function Er(t,...e){const n={...t};for(const t of e)for(const e of Object.keys(t))Sr(n[e])&&Sr(t[e])?n[e]=Er(n[e],t[e]):n[e]=t[e];return n}function Cr(t,e,n){return Math.min(Math.max(t,e),n)}function Ar(t,e,n){if(void 0===e&&(e=t,t=0),void 0===n&&(n=t<=e?1:-1),0===n)return[];const s=[];if(n>0)for(let i=t;i<e;i+=n)s.push(i);else for(let i=t;i>e;i+=n)s.push(i);return s}function kr(t,e){if(e<1)return[];const n=[];for(let s=0;s<t.length;s+=e)n.push(t.slice(s,s+e));return n}function Mr(t,e){const n=new Set,s=[];for(const i of t){const t=e(i);n.has(t)||(n.add(t),s.push(i))}return s}function xr(t,e){const n={};for(const s of t){const t=String(e(s));n[t]||(n[t]=[]),n[t].push(s)}return n}function $r(t){return null==t||("string"==typeof t||Array.isArray(t)?0===t.length:t instanceof Map||t instanceof Set?0===t.size:"object"==typeof t&&0===Object.keys(t).length)}function Tr(t,e){if(null==t||"object"!=typeof t)return;const n=Array.isArray(t)?t.map((t,e)=>e):Object.keys(t);for(const s of n){const n=e(s,t[s],t);void 0!==n&&(t[s]=n);const i=t[s];null!==i&&"object"==typeof i&&Tr(i,e)}}const Rr=t=>(t=>"number"==typeof t||"boolean"==typeof t||!$r(t))(t)?null:"Required",Or=t=>(t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))(t)?null:"Invalid email",Ir=t=>e=>((t,e)=>t.length>=e)(e,t)?null:`Min ${t} characters`,Pr=t=>e=>((t,e)=>t.length<=e)(e,t)?null:`Max ${t} characters`,zr=(t,e="Invalid format")=>n=>((t,e)=>e.test(t))(n,t)?null:e,Dr=t=>e=>((t,e)=>t>=e)(e,t)?null:`Min is ${t}`,Nr=t=>e=>((t,e)=>t<=e)(e,t)?null:`Max is ${t}`;function Lr(t){let e;return bs({name:"Memo",fn:t,onRun:t=>{e?e.set(()=>t):(e=Es(void 0,{skipRestrictedContextCheck:!0}),e.set(()=>t,!0))}}),e}function jr(t){const e=new Set,n=[Object.prototype,Array.prototype,Function.prototype,String.prototype,Number.prototype,Boolean.prototype,Symbol.prototype,Date.prototype,RegExp.prototype,Map.prototype,Set.prototype,WeakMap.prototype,WeakSet.prototype,Promise.prototype,Error.prototype];let s=t;for(;s&&!n.includes(s);){for(const t of Reflect.ownKeys(s))"constructor"!==t&&e.add(t);s=Object.getPrototypeOf(s)}return Array.from(e)}const Fr=t=>{const e=Me();if(e&&e.scopes.has(t))throw new Error("Scope already exists for the same class for this component");let n;re.viewOuterInProgress=!0;try{n=new t}finally{re.viewOuterInProgress=!1}const s=re.setupInProgress;try{if((()=>{jr(n).forEach(t=>{const e=Object.getOwnPropertyDescriptor(n,t)||Object.getOwnPropertyDescriptor(Object.getPrototypeOf(n),t);if(e&&(e.get||e.set))return;const s=n[t];"function"!=typeof s||s.__version__||(n[t]=s.bind(n))})})(),"function"==typeof n.setup){rr(n.setup)&&console.warn("Async setup functions are not supported. Please ensure the setup function is synchronous."),re.setupInProgress=!0;try{n.setup(e?._propsFn||(()=>({})))}catch(t){console.error(t)}finally{re.setupInProgress=s}}e&&e.addScope(t,n),n.__isScope___=!0}catch(t){console.error(t)}finally{re.setupInProgress=s}return n},Ur=t=>{let e=null;const n=new CustomEvent("request-parent-scope",{bubbles:!0,composed:!0,detail:{ScopeClass:t,resolve:t=>{e=t}}}),s=Me(!1);if(s)s.dispatchEvent(n);else if("undefined"!=typeof document){const t=document.querySelector("x-view");t&&t.dispatchEvent(n)}if(e)return e;if("undefined"!=typeof document&&!document.querySelector("x-view"))return new Proxy({},{get:(t,e)=>"__isScope___"===e||(()=>{})});throw new Error(`No parent scope found for ${t.name}`)},Vr=new Set;function Wr(t){for(const e of t)Vr.add(e)}function Br(){return[...Vr]}const Hr=()=>Ur(Xi),Yr=()=>Ur(Li),qr=()=>Ur(Oi),Xr=()=>Ur(Wi),Zr=()=>Ur(qi);function Gr(t,e){let n=t;for(;n&&n!==Object.prototype;){const t=Object.getOwnPropertyDescriptor(n,e);if(t)return t;n=Object.getPrototypeOf(n)}}const Kr=(t,e,n)=>{const s=jr(t);s.forEach(s=>{const i=Gr(t,s);if(i?.get){let n,r=-1;const o=i.get;Object.defineProperty(t,s,{get(){const s=e.__version__;return s!==r&&(r=s,n=o.call(t)),n},configurable:!0,enumerable:i.enumerable})}else if(ir(t[s])){if(rr(t[s]))throw new Error(`Async functions are not supported inside ${n}`);const i=t[s];t[s]=(...n)=>{e.update(()=>i.apply(t,n))}}});const i=Object.create(t);return s.forEach(n=>{const s=Gr(t,n);if(!s)return;const r=!!s.get,o=!r&&ir(s.value);r||o||Object.defineProperty(i,n,{get:()=>e()[n],set(t){e.update(e=>{e[n]=t})},enumerable:!0,configurable:!0})}),i},Qr=t=>{if("object"!=typeof t||null===t)throw new Error("initial state must be an object");const e=Es(t),n=Kr(t,e,"store");return()=>[n,e.update]},Jr=t=>{const e=Me();if("object"!=typeof t||null===t)throw new Error("stateObj must be an object");const n=Es(t),s=Kr(t,n,"useState");return e?._useStates&&e._useStates.push({state:t,atom:n}),[s,n.update]},to=t=>{Xe();const e=Me();e._errorHandlers||(e._errorHandlers=[]),e._errorHandlers.push(t)},eo=(t,e)=>{const n=Me();if(Xe(),!n)throw new Error("onReferenceChange must be called inside a component");let s=[];t(),s=e(),n.onEachUpdate(()=>{const n=e();s.some((t,e)=>t!==n[e])&&(t(),s=n)})},no=(t,e={})=>b`<x-view .view=${t} .props=${e}></x-view>`,so=no,io=no,ro=(t,e)=>F(no(oo,{viewFn:t}),e),oo=t=>{Fr(Li),Fr(Oi),Fr(Wi),Fr(qi),Fr(Xi);for(const t of Br())Fr(t);const e=t().viewFn;return()=>no(e)},ao=ro,lo=t=>{const e=$i(),n=t().condition,s=Es(n),i=Es(n);return ki(()=>{const n=i();if(n===s.get())return;const r=e.value;if(!r)return void s.set(n);const o=t().config;Ai({el:r,exit:o?.exit??Jn(200),enter:o?.enter??Qn(250),swap:()=>s.set(n),getEl:()=>e.value,isStale:()=>i.get()!==n})}),Ge(()=>{const n=e.value;if(!n)return;const s=t().config;Ci(n,s?.enter??Qn(250))}),()=>{const n=s(),{condition:r,trueTpl:o,falseTpl:a}=t();return i.get()!==r&&i.set(r),b`
|
|
109
|
+
`;i.__isErrorView__=!0,i.skipDevToolsRender=!0,this.view=i,this.name=e,this._errorState=t}}an()&&window.addEventListener("mates:component-hot-update",t=>{const e=new Set(t.detail??[]);0!==e.size&&document.querySelectorAll("x-view").forEach(t=>{if(!(t instanceof un))return;const n=function(t){if(!an())return null;const e=t?.__mates_hmr_id;return"string"==typeof e?e:null}(t.view);n&&e.has(n)&&t._hotRefresh()})}),customElements.get("x-view")||customElements.define("x-view",un);class dn extends HTMLElement{constructor(){super(...arguments),this._onRequestContext=t=>{const e=t,n=e.detail?.context.id;n&&null!=this.id&&n===this.id&&(e.stopPropagation(),e.detail.resolve(this._value))}}connectedCallback(){this.addEventListener("request-context",this._onRequestContext)}set context(t){this.id=t.id}disconnectedCallback(){this.removeEventListener("request-context",this._onRequestContext)}set value(t){this._value=t}get value(){return this._value}}function fn(t){let e=-1===t.indexOf("\0")?t:t.replace(/\0/g,"");const n=function(t){const e=t.indexOf("{"),n=t.indexOf("}");return-1===e&&-1===n?-1:-1===e?n:-1===n?e:Math.min(e,n)}(e);return-1!==n&&(e=e.slice(0,n)),/url\s*\(/i.test(e)&&(e=e.replace(/\burl\s*\(\s*(['"]?)\s*(?:javascript:|vbscript:|data:text\/html[,;])/gi,"url($1")),e}function pn(t){return t.length>0&&/^[a-zA-Z-]+$/.test(t)}customElements.get("x-provider")||customElements.define("x-provider",dn);let mn=0;function _n(){return`_m${(mn++).toString(36)}`}const gn=Object.create(null),yn={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function wn(t){t.breakpoints&&Object.assign(yn,t.breakpoints)}function vn(t){const e=gn[t];if(void 0!==e)return e;const n=t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);return gn[t]=n,n}function bn(t,e,n){if(!n)return`.${t} {\n${e}}`;if(n.startsWith("&")){return`.${t}${n.slice(1)} {\n${e}}`}return`${n} {\n .${t} {\n${e.replace(/^ {2}/gm," ")} }\n}`}function Sn(t){return t.startsWith("&")||t.startsWith("@media")?t:Object.prototype.hasOwnProperty.call(yn,t)?`@media (min-width: ${yn[t]})`:null}function En(t,e,n){const s=Object.create(null);for(const i in t){const r=t[i];let o="",a=null;for(const t in r){const e=r[t];if(null!=e){if("object"==typeof e&&!Array.isArray(e)){const n=Sn(t);if(null===n)throw new Error(`[css-in-js] Unknown nested key "${t}" in block "${i}". Use "&:pseudo", "@media (...)", or a configured breakpoint key.`);let s="";const r=e;for(const t in r){const e=r[t];null!=e&&(pn(t)?s+=` ${vn(t)}: ${fn(String(e))};\n`:console.warn(`[css-in-js] invalid property name skipped: "${t}"`))}s.length>0&&(null===a&&(a=[]),a.push([s,n]));continue}pn(t)?o+=` ${vn(t)}: ${fn(String(e))};\n`:console.warn(`[css-in-js] invalid property name skipped: "${t}"`)}}if(0===o.length&&null===a){s[i]="";continue}const l=n?.literal?i:`${i}${_n()}`;if(o.length>0&&e.push(bn(l,o,"")),null!==a)for(let t=0;t<a.length;t++)e.push(bn(l,a[t][0],a[t][1]));s[i]=l}return s}function Cn(t){return Object.freeze(t)}var An,kn,Mn,$n,xn,Tn,Rn,On;function In(t){if(re.templateInProgress)throw new Error(`[css-in-js] ${t}() must be called at module level, not inside a template function.`);if(re.viewOuterInProgress)throw new Error(`[css-in-js] ${t}() must be called at module level, not inside a component outer function. Move it outside the component function.`);if(re.setupInProgress)throw new Error(`[css-in-js] ${t}() must be called at module level, not inside a setup function.`)}let Pn=0;function zn(t){return`${t}_kf${(Pn++).toString(36)}`}function Dn(t,e){let n="";for(const t in e){const s=e[t];let i="";for(const t in s){const e=s[t];if(null==e)continue;const n=t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);i+=` ${n}: ${String(e)};\n`}i&&(n+=` ${t} {\n${i} }\n`)}return`@keyframes ${t} {\n${n}}`}const Nn=new Set;function Ln(){return""}class jn{constructor(){An.add(this),kn.set(this,""),Mn.set(this,0),$n.set(this,null),xn.set(this,[]),Nn.add(this)}keyframes(t,e){const n=zn(t);return this.appendRules(Dn(n,e)),n}appendRules(t){""!==t&&(ge(this,xn,"f").push(t),ge(this,Mn,"f")>0&&ge(this,An,"m",Tn).call(this))}mount(){var t;ye(this,Mn,(t=ge(this,Mn,"f"),++t),"f"),1===ge(this,Mn,"f")&&(ge(this,An,"m",Tn).call(this),ge(this,$n,"f")||ge(this,An,"m",Rn).call(this))}unmount(){var t;ge(this,Mn,"f")<=0||(ye(this,Mn,(t=ge(this,Mn,"f"),--t),"f"),0===ge(this,Mn,"f")&&ge(this,An,"m",On).call(this))}get refCount(){return ge(this,Mn,"f")}get cssText(){return ge(this,kn,"f")}get isMounted(){return ge(this,Mn,"f")>0}get sheet(){return ge(this,$n,"f")}getAllCSS(){const t=[];return ge(this,kn,"f")&&t.push(ge(this,kn,"f")),ge(this,xn,"f").length>0&&t.push(ge(this,xn,"f").join("\n")),t.join("\n")}}function Fn(){if(In("stylesheet"),Pe())return{css:()=>({}),mount:()=>{},keyframes:()=>""};const t=new jn;return{css:function(e){In("css");const n=[],s=En(e,n);return n.length>0&&t.appendRules(n.join("\n")),Cn(s)},mount:function(){if(function(t){if(re.templateInProgress)throw new Error(`[css-in-js] ${t}() must not be called inside a template function. Call it in the component outer function or at module level.`)}("mount"),null===Me(!1))return t.mount(),()=>t.unmount();Ge(()=>(t.mount(),()=>t.unmount()))},keyframes:function(e,n){return In("keyframes"),t.keyframes(e,n)}}}kn=new WeakMap,Mn=new WeakMap,$n=new WeakMap,xn=new WeakMap,An=new WeakSet,Tn=function(){if(0===ge(this,xn,"f").length)return;const t=ge(this,xn,"f").join("\n");ye(this,xn,[],"f"),ye(this,kn,ge(this,kn,"f")+(ge(this,kn,"f")?"\n":"")+t,"f"),ge(this,An,"m",Rn).call(this)},Rn=function(){ge(this,$n,"f")||(ye(this,$n,new CSSStyleSheet,"f"),document.adoptedStyleSheets=[...document.adoptedStyleSheets,ge(this,$n,"f")]),ge(this,$n,"f").replaceSync(ge(this,kn,"f"))},On=function(){ge(this,$n,"f")&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(t=>t!==ge(this,$n,"f")),ye(this,$n,null,"f")),ge(this,kn,"f")&&(ge(this,xn,"f").unshift(ge(this,kn,"f")),ye(this,kn,"","f"))};let Un=null,Vn=!1;function Wn(){return Un||(Un=new jn),Un}function Bn(){Un||(Un=new jn),Vn||(Vn=!0,queueMicrotask(()=>{Vn=!1,Un.mount()}))}function Hn(t,e){if(In("keyframes"),Pe())return t;Bn();const n=zn(t);return Un.appendRules(Dn(n,e)),n}function Yn(t,e){if(In("globalCSS"),Pe())return{};Bn();const n=[],s=En(t,n,e);return n.length>0&&Un.appendRules(n.join("\n")),Cn(s)}function qn(t){In("globalRawCSS"),Bn(),Un.appendRules(t)}let Xn=!1;function Zn(){Xn||(Xn=!0,qn('\n[class*="mates-"] {\n --mates-duration : 300ms;\n --mates-easing : ease;\n --mates-distance : 24px;\n animation-duration : var(--mates-duration);\n animation-timing-function : var(--mates-easing);\n animation-fill-mode : both;\n}\n'),qn("\n@keyframes mates-kf-fade-in { from { opacity: 0 } to { opacity: 1 } }\n@keyframes mates-kf-fade-out { from { opacity: 1 } to { opacity: 0 } }\n\n@keyframes mates-kf-slide-in-up {\n from { opacity: 0; transform: translateY(var(--mates-distance)) }\n to { opacity: 1; transform: translateY(0) }\n}\n@keyframes mates-kf-slide-out-up {\n from { opacity: 1; transform: translateY(0) }\n to { opacity: 0; transform: translateY(calc(-1 * var(--mates-distance))) }\n}\n@keyframes mates-kf-slide-in-down {\n from { opacity: 0; transform: translateY(calc(-1 * var(--mates-distance))) }\n to { opacity: 1; transform: translateY(0) }\n}\n@keyframes mates-kf-slide-out-down {\n from { opacity: 1; transform: translateY(0) }\n to { opacity: 0; transform: translateY(var(--mates-distance)) }\n}\n@keyframes mates-kf-slide-in-left {\n from { opacity: 0; transform: translateX(var(--mates-distance)) }\n to { opacity: 1; transform: translateX(0) }\n}\n@keyframes mates-kf-slide-out-left {\n from { opacity: 1; transform: translateX(0) }\n to { opacity: 0; transform: translateX(calc(-1 * var(--mates-distance))) }\n}\n@keyframes mates-kf-slide-in-right {\n from { opacity: 0; transform: translateX(calc(-1 * var(--mates-distance))) }\n to { opacity: 1; transform: translateX(0) }\n}\n@keyframes mates-kf-slide-out-right {\n from { opacity: 1; transform: translateX(0) }\n to { opacity: 0; transform: translateX(var(--mates-distance)) }\n}\n\n@keyframes mates-kf-scale-in {\n from { opacity: 0; transform: scale(0.92) }\n to { opacity: 1; transform: scale(1) }\n}\n@keyframes mates-kf-scale-out {\n from { opacity: 1; transform: scale(1) }\n to { opacity: 0; transform: scale(0.92) }\n}\n\n@keyframes mates-kf-spring-in {\n from { opacity: 0; transform: scale(0.92) }\n to { opacity: 1; transform: scale(1) }\n}\n\n@keyframes mates-kf-flip-in-x {\n from { opacity: 0; transform: rotateX(90deg) }\n to { opacity: 1; transform: rotateX(0deg) }\n}\n@keyframes mates-kf-flip-in-y {\n from { opacity: 0; transform: rotateY(90deg) }\n to { opacity: 1; transform: rotateY(0deg) }\n}\n\n@keyframes mates-kf-blur-in {\n from { opacity: 0; filter: blur(10px) }\n to { opacity: 1; filter: blur(0) }\n}\n@keyframes mates-kf-blur-out {\n from { opacity: 1; filter: blur(0) }\n to { opacity: 0; filter: blur(10px) }\n}\n\n@keyframes mates-kf-shake {\n 0%, 100% { transform: translateX(0) }\n 15% { transform: translateX(calc(-1 * var(--mates-distance))) }\n 30% { transform: translateX(calc( 1 * var(--mates-distance))) }\n 45% { transform: translateX(calc(-0.6 * var(--mates-distance))) }\n 60% { transform: translateX(calc( 0.6 * var(--mates-distance))) }\n 75% { transform: translateX(calc(-0.3 * var(--mates-distance))) }\n 90% { transform: translateX(calc( 0.3 * var(--mates-distance))) }\n}\n\n@keyframes mates-kf-pulse {\n 0%, 100% { transform: scale(1) }\n 50% { transform: scale(1.08) }\n}\n\n@keyframes mates-kf-bounce {\n 0% { transform: translateY(0) }\n 20% { transform: translateY(calc(-0.40 * var(--mates-distance))) }\n 40% { transform: translateY(0) }\n 60% { transform: translateY(calc(-0.20 * var(--mates-distance))) }\n 80% { transform: translateY(0) }\n 90% { transform: translateY(calc(-0.08 * var(--mates-distance))) }\n 100% { transform: translateY(0) }\n}\n\n@keyframes mates-kf-spin {\n from { transform: rotate(0deg) }\n to { transform: rotate(360deg) }\n}\n"),Yn({"mates-fade-in":{animationName:"mates-kf-fade-in"},"mates-fade-out":{animationName:"mates-kf-fade-out"},"mates-slide-in-up":{animationName:"mates-kf-slide-in-up"},"mates-slide-out-up":{animationName:"mates-kf-slide-out-up"},"mates-slide-in-down":{animationName:"mates-kf-slide-in-down"},"mates-slide-out-down":{animationName:"mates-kf-slide-out-down"},"mates-slide-in-left":{animationName:"mates-kf-slide-in-left"},"mates-slide-out-left":{animationName:"mates-kf-slide-out-left"},"mates-slide-in-right":{animationName:"mates-kf-slide-in-right"},"mates-slide-out-right":{animationName:"mates-kf-slide-out-right"},"mates-scale-in":{animationName:"mates-kf-scale-in"},"mates-scale-out":{animationName:"mates-kf-scale-out"},"mates-spring-in":{animationName:"mates-kf-spring-in","--mates-easing":"cubic-bezier(0.34, 1.56, 0.64, 1)"},"mates-flip-in-x":{animationName:"mates-kf-flip-in-x"},"mates-flip-in-y":{animationName:"mates-kf-flip-in-y"},"mates-blur-in":{animationName:"mates-kf-blur-in"},"mates-blur-out":{animationName:"mates-kf-blur-out"},"mates-shake":{animationName:"mates-kf-shake","--mates-duration":"500ms","--mates-easing":"ease-in-out"},"mates-pulse":{animationName:"mates-kf-pulse","--mates-duration":"600ms","--mates-easing":"ease-in-out"},"mates-bounce":{animationName:"mates-kf-bounce","--mates-duration":"700ms"},"mates-spin":{animationName:"mates-kf-spin","--mates-easing":"linear"}},{literal:!0}))}const Gn={fadeIn:"mates-fade-in",fadeOut:"mates-fade-out",slideInUp:"mates-slide-in-up",slideOutUp:"mates-slide-out-up",slideInDown:"mates-slide-in-down",slideOutDown:"mates-slide-out-down",slideInLeft:"mates-slide-in-left",slideOutLeft:"mates-slide-out-left",slideInRight:"mates-slide-in-right",slideOutRight:"mates-slide-out-right",scaleIn:"mates-scale-in",scaleOut:"mates-scale-out",springIn:"mates-spring-in",flipInX:"mates-flip-in-x",flipInY:"mates-flip-in-y",blurIn:"mates-blur-in",blurOut:"mates-blur-out",shake:"mates-shake",pulse:"mates-pulse",bounce:"mates-bounce",spin:"mates-spin"};function Kn(t){ae("Action");let e=t;const n=new Set;let s=null,i=null;const r=t=>{n.forEach(e=>{try{e(t)}catch(t){console.error(t)}})},o=Object.assign(function(...t){return((t,n)=>{try{let o;return o=s?s((...n)=>e.call(t,...n),...n):e.call(t,...n),i&&(o=i(o)),r(o),o}catch(t){const e=t instanceof Error?t:new Error(String(t));throw r(void 0),e}})(this,t)},{val:()=>e,set:t=>{e=t},__isAction___:!0,__subscribe:t=>(ae("subscribe"),n.add(t),()=>n.delete(t)),interceptBefore:t=>{s=t},interceptAfter:t=>{i=t}});return o}function Qn(t=300,e="ease"){return{keyframes:[{opacity:0},{opacity:1}],options:{duration:t,easing:e,fill:"both"}}}function Jn(t=300,e="ease"){return{keyframes:[{opacity:1},{opacity:0}],options:{duration:t,easing:e,fill:"both"}}}Zn();const ts={up:"translateY(-100%)",down:"translateY(100%)",left:"translateX(-100%)",right:"translateX(100%)"};function es(t="up",e,n=400,s="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{transform:e?ss(t,e):ts[t],opacity:0},{transform:"translate(0, 0)",opacity:1}],options:{duration:n,easing:s,fill:"both"}}}function ns(t="down",e,n=400,s="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{transform:"translate(0, 0)",opacity:1},{transform:e?ss(t,e):ts[t],opacity:0}],options:{duration:n,easing:s,fill:"both"}}}function ss(t,e){switch(t){case"up":return`translateY(-${e})`;case"down":return`translateY(${e})`;case"left":return`translateX(-${e})`;case"right":return`translateX(${e})`}}function is(t=0,e=300,n="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{transform:`scale(${t})`,opacity:0},{transform:"scale(1)",opacity:1}],options:{duration:e,easing:n,fill:"both"}}}function rs(t=0,e=300,n="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{transform:"scale(1)",opacity:1},{transform:`scale(${t})`,opacity:0}],options:{duration:e,easing:n,fill:"both"}}}function os(t=1,e=600,n="linear"){return{keyframes:[{transform:"rotate(0deg)"},{transform:`rotate(${360*t}deg)`}],options:{duration:e,easing:n,fill:"both"}}}function as(t=600){return{keyframes:[{transform:"translateY(0)",offset:0},{transform:"translateY(-30%)",offset:.3},{transform:"translateY(0)",offset:.5},{transform:"translateY(-15%)",offset:.7},{transform:"translateY(0)",offset:.85},{transform:"translateY(-5%)",offset:.95},{transform:"translateY(0)",offset:1}],options:{duration:t,easing:"ease",fill:"both"}}}function ls(t=500,e="cubic-bezier(0.34, 1.56, 0.64, 1)"){return{keyframes:[{transform:"scale(0)",opacity:0},{transform:"scale(1)",opacity:1}],options:{duration:t,easing:e,fill:"both"}}}function cs(t=10,e=400){return{keyframes:[{transform:"translateX(0)"},{transform:`translateX(-${t}px)`},{transform:`translateX(${t}px)`},{transform:`translateX(-${t}px)`},{transform:`translateX(${t}px)`},{transform:"translateX(0)"}],options:{duration:e,easing:"ease-in-out",fill:"both"}}}function hs(t=1.05,e=400){return{keyframes:[{transform:"scale(1)"},{transform:`scale(${t})`},{transform:"scale(1)"}],options:{duration:e,easing:"ease-in-out",fill:"both"}}}function us(t="y",e=500,n="ease-out"){const s="x"===t?"rotateX":"rotateY";return{keyframes:[{transform:`${s}(90deg)`,opacity:0},{transform:`${s}(0deg)`,opacity:1}],options:{duration:e,easing:n,fill:"both"}}}function ds(t="y",e=500,n="ease-in"){const s="x"===t?"rotateX":"rotateY";return{keyframes:[{transform:`${s}(0deg)`,opacity:1},{transform:`${s}(90deg)`,opacity:0}],options:{duration:e,easing:n,fill:"both"}}}function fs(t=10,e=400,n="ease-out"){return{keyframes:[{filter:`blur(${t}px)`,opacity:0},{filter:"blur(0px)",opacity:1}],options:{duration:e,easing:n,fill:"both"}}}function ps(t=10,e=400,n="ease-in"){return{keyframes:[{filter:"blur(0px)",opacity:1},{filter:`blur(${t}px)`,opacity:0}],options:{duration:e,easing:n,fill:"both"}}}function ms(t=500,e="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{width:"0",overflow:"hidden"},{width:"auto",overflow:"hidden"}],options:{duration:t,easing:e,fill:"both"}}}function _s(t=500,e="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{width:"auto",overflow:"hidden"},{width:"0",overflow:"hidden"}],options:{duration:t,easing:e,fill:"both"}}}function gs(t,e,n=50){return{keyframes:t.keyframes,options:{...t.options,delay:(t.options.delay??0)+e*n}}}function ys(t){if(null==t||"object"!=typeof t)return t;try{return Object.keys(t).forEach(e=>{"object"!=typeof t[e]||null===t[e]||Object.isFrozen(t[e])||ys(t[e])}),Object.freeze(t)}catch(t){console.error(t)}}function ws(t,e,n){const s=ne();let i;Qt();try{i=t()}finally{Jt();se(s).forEach(t=>{"function"==typeof t.__subscribe&&e(t,n)})}return i}function vs(t,e){if(ae(t),"AsyncFunction"===e.constructor.name)throw new Error(`${t.toLowerCase()}() does not support async functions.`);if(Gt())throw new Error(`${t.toLowerCase()}() cannot be nested inside an effect() or memo().`)}function bs(t){const{name:e,fn:n,onRun:s,supportsCleanup:i}=t;vs(e,n);const r=new Set;let o,a=!1;const l=()=>{if(i&&o){try{o()}catch(t){console.error("Error in effect cleanup:",t)}o=void 0}},c=()=>{if(a)return;l();const t=new Set(r);r.clear();const e=()=>{a||Ye.schedule(c)};let h;try{h=ws(n,t=>{r.add(t.__subscribe(e))},e)}finally{t.forEach(t=>t())}if(a)return r.forEach(t=>t()),void r.clear();i&&"function"==typeof h&&(o=h),s(h)},h=()=>{a||(a=!0,l(),r.forEach(t=>t()),r.clear())};return c(),$e(n,h),h}let Ss=0;function Es(t,e){if("function"==typeof t){const e=t;let n;const s=Symbol("skip");return bs({name:"Memo",fn:()=>{try{return e()}catch(t){return console.error("[atom] Error in derived function:",t),s}},onRun:t=>{t!==s&&(n?(n.unlock("initial"),n.set(()=>t),n.lock("initial")):(n=As(t,{skipRestrictedContextCheck:!0}),n.lock("initial")))}}),n}e?.skipRestrictedContextCheck||ae("Atom");let n=t;const s=++Ss,i=new Se;function r(){return nn(r,!1),Xt()&&Kt(r),n}return r.get=function(){return r()},r.set=function(t,e=!1){var o,a;n="function"==typeof t?t(n):t,r.skipDevToolsLog||(o=String(s),a=n,jt.logAtomSet(o,a)),e||i.notify()},r.update=function(t,e=!1){var o;"object"==typeof n&&null!==n&&(t(n),r.skipDevToolsLog||(o=String(s),jt.logAtomUpdate(o)),e||i.notify())},r.__subscribe=function(t){return i.subscribe(t)},r.toJSON=function(){return JSON.stringify(n)},Object.defineProperty(r,"name",{value:"atom",writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(r,"val",{get:()=>r(),set:t=>r.set(t),enumerable:!1,configurable:!0}),Object.defineProperty(r,"__version__",{get:()=>i.getVersion(),enumerable:!1}),Object.defineProperty(r,"__isAtom___",{value:!0,writable:!1,enumerable:!1}),Object.defineProperty(r,"__id__",{value:s,writable:!1,enumerable:!1}),r}function Cs(t,e){e?.skipRestrictedContextCheck||ae("iAtom");const n=Es(ks(t),{skipRestrictedContextCheck:!0}),s=n.set;n.set=function(t,e=!1){const i="function"==typeof t?t(n.get()):t;s(ks(i),e)};const i=n;return delete i.update,i.name="iAtom",i}function As(t,e={}){e.skipRestrictedContextCheck||ae("superAtom"),Xe();const n=e.freeze??!1,s=n?ks(Ms(t)):t;let i=!1,r="default";const o=Es(n?ks(t):t,{skipRestrictedContextCheck:!0}),a=o.set;o.set=function(t,e=!1){if(i)return void me("Cannot mutate a locked atom.","superAtom");const s="function"==typeof t?t(o.get()):t;a(n?ks(s):s,e)};const l=o.update;o.update=function(t,e=!1){if(i)me("Cannot mutate a locked atom.","superAtom");else{if(n)throw new Error("update() is not supported when freeze is enabled — use set() with a new value.");l(t,e)}};const c=o;return c.lock=function(t="default"){i=!0,r=t},c.unlock=function(t="default"){if(r!==t)throw new Error("Incorrect passcode. Cannot unlock atom.");i=!1},c.reset=function(){i||o.set(n?ks(Ms(s)):s)},c.freeze=function(){ys(o.get())},c.name="superAtom",c}function ks(t){return"object"==typeof t&&null!==t?ys(t):t}function Ms(t){try{return structuredClone(t)}catch{return t}}function $s(t){const e=new Map,n=[],s=t=>JSON.stringify(t),i=t=>{e.delete(t);const s=n.indexOf(t);s>-1&&n.splice(s,1)};return{getCacheKey:s,removeCacheEntry:i,createCacheMethod:(r,o,a,l)=>async(...c)=>{const h=s(c),u=e.get(h);if(u){const e=Date.now();if(!(void 0!==t?.cacheDuration&&e-u.timestamp>t.cacheDuration)){const t=n.indexOf(h);return t>-1&&n.splice(t,1),n.push(h),r.set(u.result),o.set(null),a.set("success"),u.result}i(h)}const d=await l(this,c);e.set(h,{result:d,timestamp:Date.now()});const f=n.indexOf(h);if(f>-1&&n.splice(f,1),n.push(h),t?.cacheLimit&&n.length>t.cacheLimit){const t=n.shift();t&&e.delete(t)}return d},createClearCacheMethod:()=>(...t)=>{if(0===t.length)e.clear(),n.length=0;else{const e=s(t);i(e)}}}}function xs(t){let e=null,n=null;const s=()=>{e&&(clearInterval(e),e=null,n=null)};return{createStartPollingMethod:i=>(...r)=>{t?.pollInterval?(s(),n=r,i(...r),e=setInterval(()=>{n&&i(...n)},t.pollInterval)):me(new Error("pollInterval not specified in asyncAction options"))},createStopPollingMethod:()=>s,stopPolling:s}}function Ts(t,e){e?.allowInRestrictedContext||ae("Async Action");const n={...{cacheLimit:10,pollInterval:5e3},...e};let s=t;const i=new Set;let r=null,o=null,a=null,l=null;const c=$s(n),h=xs(n),u=Es(null),d=Es(null),f=Es(!1),p=Es("init"),m=t=>{i.forEach(e=>{if(void 0===e.filter||void 0===t||e.filter===t)try{e.fn()}catch(t){me(t)}})},_=()=>{o?.isActive()&&(o.cancel(),o=null),r&&(r.abort(),r=null),f.set(!1),p.set("init")},g=async(t,e)=>{_(),f.set(!0),p.set("loading"),r=new AbortController;const n=r;try{let i;if(a){i=a((...e)=>s.call(t,...e),...e)}else i=s.call(t,...e);i?.__isZeroPromise__&&(o=i);let c=await i;if(n.signal.aborted||r!==n)throw new Error("Operation was cancelled");return l&&(c=l(c)),u.set(c),d.set(null),p.set("success"),m(!0),c}catch(t){if(n.signal.aborted||r!==n)throw t;const e=t instanceof Error?t:new Error(String(t));throw u.set(null),d.set(e),p.set("error"),m(!1),e}finally{r===n&&(r=null),f.set(!1),o&&!o.isActive()&&(o=null)}},y=async(...t)=>{const e=this;if(Pe()){const n=Me(!1);je();const s=g(e,t).catch(()=>{}).finally(()=>{Fe()});return n?._ssrPromiseQueue&&n._ssrPromiseQueue.push(s),s}return g(e,t)},w=c.createCacheMethod(u,d,p,g),v=c.createClearCacheMethod(),b=h.createStartPollingMethod(y),S=h.createStopPollingMethod(),E=Object.assign(y,{data:u,error:d,isLoading:f,status:p,val:()=>s,set:t=>{s=t},params:{page:1},cancel:_,subscribe:(t,e)=>{ae("subscribe");const n={fn:t,filter:e};i.add(n);const s=()=>i.delete(n);return $e(t,s),s},cache:w,clearCache:v,startPolling:b,stopPolling:S,interceptBefore:t=>{a=t},interceptAfter:t=>{l=t},__isAsyncAction___:!0,__isAction___:!1});return Object.defineProperty(E,"abortController",{get:()=>r,enumerable:!0,configurable:!0}),$e(E,()=>{i.clear(),h.stopPolling(),_()}),E}const Rs=(t,e,n)=>{const s="timeout"===n?setTimeout(()=>t(),e):setInterval(()=>t(),e);return $e(s,"timeout"===n?()=>clearTimeout(s):()=>clearInterval(s)),s};class Os{constructor(){this.timeoutId=null,this.pendingArgs=null,this.pendingContext=null}clearPending(){this.pendingArgs=null,this.pendingContext=null}setPending(t,e){this.pendingArgs=t,this.pendingContext=e}clearTimer(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}setTimer(t,e){this.timeoutId=((t,e)=>Rs(t,e,"timeout"))(t,e)}executePending(t){return this.pendingArgs&&(this.lastResult=t.apply(this.pendingContext,this.pendingArgs),this.clearPending()),this.lastResult}}function Is(t,e){return()=>{t.clearTimer(),t.clearPending(),e?.()}}function Ps(t,e){return()=>{if(t.pendingArgs&&t.timeoutId){t.clearTimer();return t.executePending(e)}return t.lastResult}}function zs(t,e){const n=new Os,s=function(...s){return n.setPending(s,this),n.clearTimer(),n.setTimer(()=>{n.lastResult=n.executePending(t),n.timeoutId=null},e),n.lastResult};return s.cancel=Is(n),s.flush=Ps(n,t),s}function Ds(t,e){const n=!!e?.allowInRestrictedContext,s=Ts(t,e),i=Es(1,{skipRestrictedContextCheck:n}),r=Es(-1,{skipRestrictedContextCheck:n});return Object.assign(s,{page:i,totalPages:r,next:(...t)=>{if(!(-1!==r.val&&i.val>=r.val))return i.update(t=>t+1),s(...t)}})}function Ns(t){ae("taskAction");const e=[];let n=0,s=1,i=!1;const r={skipRestrictedContextCheck:!0},o=Es([],r),a=Es("idle",r),l=Es(0,r);function c(){if(o.set([...e]),0===e.length)return void l.set(0);let t=0;for(const n of e)"running"===n.status?t+=.5:"pending"!==n.status&&(t+=1);l.set(Math.round(t/e.length*100))}function h(){if(i){const t=e.some(t=>"running"===t.status);return void(t||a.set("idle"))}if("running"!==a.get())return;const n=e.filter(t=>"running"===t.status).length,r=e.filter(t=>"pending"===t.status);if(0===r.length&&0===n)return void a.set("idle");const o=-1===s?r.length:Math.max(0,s-n);0!==o&&r.slice(0,o).forEach(e=>function(e){const n=new AbortController;e.status="running",e.abortController=n;const s=t(e.input,n.signal);if(s?.__isZeroPromise__){const t=s;e.abortController={signal:t.signal,abort:()=>{t.cancel()}}}c(),Promise.resolve(s).then(t=>{"cancelled"===e.status||(e.status="success",e.result.data=t),e.abortController=null,c(),h()}).catch(t=>{if("cancelled"===e.status||!0===e.abortController?.signal?.aborted)e.status="cancelled",e.abortController=null;else{const n=t instanceof Error?t:new Error(String(t));e.status="failed",e.result.error=n,e.abortController=null,me(n,"taskAction")}c(),h()})}(e))}function u(t){return{id:++n,input:t,status:"pending",result:{data:null,error:null},abortController:null}}function d(t){const n=Array.isArray(t)?t:[t];for(const t of n)e.push(u(t));c(),"running"!==a.get()||i||h()}function f(t=1){"running"!==a.get()&&(s=t,i=!1,a.set("running"),h())}function p(){i=!0,function(){for(const t of e)"running"===t.status&&(t.status="cancelled",t.abortController?.abort(),t.abortController=null)}(),a.set("idle"),c()}function m(t){p(),e.length=0,n=0,c(),d(t)}const _={add:d,start:f,pause:function(){i||(i=!0)},stop:p,delete:function(t){const n=Array.isArray(t)?t:[t],s=new Set(n.map(t=>t.id));for(let t=e.length-1;t>=0;t--){const n=e[t];s.has(n.id)&&("running"===n.status&&(n.status="cancelled",n.abortController?.abort(),n.abortController=null),e.splice(t,1))}c(),"running"!==a.get()||i||h()},clearAndAdd:m,addAndStart:function(t,e=1){d(t),f(e)},clearAndStart:function(t,e=1){m(t),f(e)},isRunning:function(){return"running"===a.val},progress:l,tasks:o,pendingTasks:function(){return o.val.filter(t=>"pending"===t.status)},runningTasks:function(){return o.val.filter(t=>"running"===t.status)},successTasks:function(){return o.val.filter(t=>"success"===t.status)},failedTasks:function(){return o.val.filter(t=>"failed"===t.status)},cancelledTasks:function(){return o.val.filter(t=>"cancelled"===t.status)},__isTaskAction__:!0};return $e(_,p),_}function Ls(t,e){const n=new Os;let s=0;const i=function(...i){const r=Date.now(),o=r-s;return o>=e?(s=r,n.lastResult=t.apply(this,i),n.clearPending(),n.clearTimer()):(n.setPending(i,this),n.timeoutId||n.setTimer(()=>{s=Date.now(),n.lastResult=n.executePending(t),n.timeoutId=null},e-o)),n.lastResult};return i.cancel=Is(n,()=>{s=0}),i.flush=Ps(n,t),i}function js(...t){const[e,n]=t;return e.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g,(t,e)=>{if(!n||!(e in n))throw new Error(`Missing parameter: "${e}"`);return String(n[e])})}let Fs=null,Us=null;function Vs(t){Fs=t}function Ws(t){Us=t}function Bs(){return Fs}function Hs(){return Us}class Ys{constructor(){this.state="idle",this.__isZeroPromise__=!0,this.toActive()}isActive(){return"active"===this.state}isResolved(){return"resolved"===this.state}isRejected(){return"rejected"===this.state}isCancelled(){return"cancelled"===this.state}get signal(){return this.controller.signal}toActive(){return"active"===this.state||(this.state="active",this.controller=new AbortController,this.promise=new Promise((t,e)=>{this.resolveFn=t,this.rejectFn=e,this.controller.signal.addEventListener("abort",()=>{"active"===this.state&&(this.state="cancelled",e(new DOMException("Cancelled","AbortError")))})})),this}resolve(t){this.isActive()&&(this.state="resolved",this.resolveFn(t))}reject(t){this.isActive()&&(this.state="rejected",this.rejectFn(t))}cancel(t){this.isActive()&&this.controller.abort(t)}then(t,e){return this.promise.then(t,e)}catch(t){return this.promise.catch(t)}finally(t){return this.promise.finally(t)}get[Symbol.toStringTag](){return"ZeroPromise"}}const qs={100:"CONTINUE",101:"SWITCHING_PROTOCOLS",102:"PROCESSING",103:"EARLY_HINTS",200:"OK",201:"CREATED",202:"ACCEPTED",203:"NON_AUTHORITATIVE_INFORMATION",204:"NO_CONTENT",205:"RESET_CONTENT",206:"PARTIAL_CONTENT",207:"MULTI_STATUS",208:"ALREADY_REPORTED",226:"IM_USED",300:"MULTIPLE_CHOICES",301:"MOVED_PERMANENTLY",302:"FOUND",303:"SEE_OTHER",304:"NOT_MODIFIED",305:"USE_PROXY",307:"TEMPORARY_REDIRECT",308:"PERMANENT_REDIRECT",400:"BAD_REQUEST",401:"UNAUTHORIZED",402:"PAYMENT_REQUIRED",403:"FORBIDDEN",404:"NOT_FOUND",405:"METHOD_NOT_ALLOWED",406:"NOT_ACCEPTABLE",407:"PROXY_AUTHENTICATION_REQUIRED",408:"REQUEST_TIMEOUT",409:"CONFLICT",410:"GONE",411:"LENGTH_REQUIRED",412:"PRECONDITION_FAILED",413:"PAYLOAD_TOO_LARGE",414:"URI_TOO_LONG",415:"UNSUPPORTED_MEDIA_TYPE",416:"RANGE_NOT_SATISFIABLE",417:"EXPECTATION_FAILED",418:"IM_A_TEAPOT",421:"MISDIRECTED_REQUEST",422:"UNPROCESSABLE_ENTITY",423:"LOCKED",424:"FAILED_DEPENDENCY",425:"TOO_EARLY",426:"UPGRADE_REQUIRED",428:"PRECONDITION_REQUIRED",429:"TOO_MANY_REQUESTS",431:"REQUEST_HEADER_FIELDS_TOO_LARGE",451:"UNAVAILABLE_FOR_LEGAL_REASONS",500:"INTERNAL_SERVER_ERROR",501:"NOT_IMPLEMENTED",502:"BAD_GATEWAY",503:"SERVICE_UNAVAILABLE",504:"GATEWAY_TIMEOUT",505:"HTTP_VERSION_NOT_SUPPORTED",506:"VARIANT_ALSO_NEGOTIATES",507:"INSUFFICIENT_STORAGE",508:"LOOP_DETECTED",510:"NOT_EXTENDED",511:"NETWORK_AUTHENTICATION_REQUIRED"};function Xs(t){return t>=200&&t<300}function Zs(t){const{url:e="",host:n="",path:s,params:i={}}=t,r=e||s||"",o=/^https?:\/\//i.test(r)?r:`${n}${r}`,{pathParams:a,qsParams:l}=function(t,e){const n=new Set;for(const[,e]of t.matchAll(/:([a-zA-Z_][a-zA-Z0-9_]*)/g))n.add(e);const s={},i={};for(const[t,r]of Object.entries(e))n.has(t)?s[t]=r:i[t]=r;return{pathParams:s,qsParams:i}}(o,i),c=Object.keys(a).length>0?js(o,a):o;if(0===Object.keys(l).length)return c;let h,u;if(/^https?:\/\//i.test(c)){const t=new URL(c);h=t.origin+t.pathname,u=t.search}else{const t=c.indexOf("?");h=-1===t?c:c.slice(0,t),u=-1===t?"":c.slice(t)}const d=new URLSearchParams(u);for(const[t,e]of Object.entries(l))null!=e&&(Array.isArray(e)?e.forEach(e=>d.append(t,String(e))):d.set(t,String(e)));const f=d.toString();return f?`${h}?${f}`:h}const Gs=new Set,Ks=new Set,Qs=new Set;class Js{constructor(t={},e,n,s){this.instanceBeforeFns=[],this.instanceAfterFns=[],this.instanceErrorFns=[],this.baseRequest=t,this._scopeBeforeFns=e,this._scopeAfterFns=n,this._scopeErrorFns=s}interceptBefore(t){return this.instanceBeforeFns.push(t),()=>{const e=this.instanceBeforeFns.indexOf(t);-1!==e&&this.instanceBeforeFns.splice(e,1)}}interceptAfter(t){return this.instanceAfterFns.push(t),()=>{const e=this.instanceAfterFns.indexOf(t);-1!==e&&this.instanceAfterFns.splice(e,1)}}interceptError(t){return this.instanceErrorFns.push(t),()=>{const e=this.instanceErrorFns.indexOf(t);-1!==e&&this.instanceErrorFns.splice(e,1)}}clearInterceptors(){this.instanceBeforeFns.length=0,this.instanceAfterFns.length=0,this.instanceErrorFns.length=0}get _beforeFns(){return this._scopeBeforeFns??Gs}get _afterFns(){return this._scopeAfterFns??Ks}get _errorFns(){return this._scopeErrorFns??Qs}fetch(t){const e=new Ys,n={...this.baseRequest,...t,headers:{...this.baseRequest.headers,...t.headers},params:{...this.baseRequest.params,...t.params}},{body:s,url:i,host:r,params:o,path:a,...l}=n,c=Zs(n),h=function(t){return null==t?{}:"string"==typeof t||t instanceof FormData||t instanceof Blob||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||t instanceof URLSearchParams||t instanceof ReadableStream?{body:t}:{body:JSON.stringify(t),headers:{"Content-Type":"application/json"}}}(s),u=(n.method??"GET").toUpperCase(),d=Bs(),f=Hs();if(Pe()&&d){let t;try{t=c.startsWith("http")?new URL(c).pathname:c.split("?")[0]}catch{t=c.split("?")[0]}if(t.startsWith("/api")){const s=d(u,t);if(s){je();const t={"content-type":"application/json",...l.headers,...h.headers};if(f){const e=f.headers.get("cookie"),n=f.headers.get("authorization");e&&(t.cookie=e),n&&(t.authorization=n)}const i=new Request(c.startsWith("http")?c:`http://localhost${c}`,{method:u,headers:t,body:h.body??null}),r=(()=>{const t=n.params||{},e=n.url||n.path||"",s=/^https?:\/\//i.test(e)?e:`${n.host||""}${e}`,i={};for(const[,e]of s.matchAll(/:([a-zA-Z_][a-zA-Z0-9_]*)/g))e in t&&(i[e]=String(t[e]));return i})(),o={...s.ctx,params:{...r,...s.ctx?.params||{}}};return s.handler(i,o).then(async t=>{if(!t.ok){const n=qs[t.status]||"UNKNOWN_ERROR";return e.reject(new Error(`${n}: ${t.statusText}`)),void Fe()}const n=t.headers.get("content-type");n?.includes("application/json")?e.resolve(await t.json()):e.resolve(t),Fe()}).catch(t=>{e.reject(t),Fe()}),e}}}return(async()=>{let t,n=c,s={...l,method:u,...h,headers:{...l.headers,...h.headers}};0===Object.keys(s.headers).length&&delete s.headers;for(const t of this.instanceBeforeFns){const e=await t(n,s);n=e.url,s=e.options}for(const t of this._beforeFns){const e=await t(n,s);n=e.url,s=e.options}try{t=await fetch(n,{...s,signal:e.signal})}catch(t){for(const e of this.instanceErrorFns)try{e(t)}catch(t){}for(const e of this._errorFns)try{e(t)}catch(t){}return void e.reject(t)}let i=t;for(const t of this.instanceAfterFns)i=await t(i);for(const t of this._afterFns)i=await t(i);if(!i.ok){const t=qs[i.status]||"UNKNOWN_ERROR",n=new Error(`${t}: ${i.statusText}`);for(const t of this.instanceErrorFns)try{t(n)}catch(t){}for(const t of this._errorFns)try{t(n)}catch(t){}return void e.reject(n)}const r=i.headers.get("content-type");if(r?.includes("application/json")){const t=await i.json();if(t&&"object"==typeof t&&"Redirect"===t.__type&&"string"==typeof t.url){const n=t.url;return"undefined"!=typeof window&&(window.location.href=n),void e.resolve(void 0)}e.resolve(t)}else e.resolve(i)})().catch(t=>e.reject(t)),e}Fetch(t){return this.fetch(t)}Get(t){return this.fetch({...t,method:"GET"})}Post(t){return this.fetch({...t,method:"POST"})}Put(t){return this.fetch({...t,method:"PUT"})}Patch(t){return this.fetch({...t,method:"PATCH"})}Delete(t){return this.fetch({...t,method:"DELETE"})}fetchAction(t){const{baseRequest:e,options:n}=function(t){if(!t)return{baseRequest:{},options:{}};const{cacheDuration:e,cacheLimit:n,pollInterval:s,allowInRestrictedContext:i,...r}=t;return{baseRequest:r,options:{...void 0!==e&&{cacheDuration:e},...void 0!==n&&{cacheLimit:n},...void 0!==s&&{pollInterval:s},...void 0!==i&&{allowInRestrictedContext:i}}}}(t);return Ts(t=>this.fetch({...e,params:{...e.params,...t}}),n)}getAction(t){return this.fetchAction({...t,method:"GET"})}postAction(t){return this.fetchAction({...t,method:"POST"})}putAction(t){return this.fetchAction({...t,method:"PUT"})}patchAction(t){return this.fetchAction({...t,method:"PATCH"})}deleteAction(t){return this.fetchAction({...t,method:"DELETE"})}}const ti=new Js({});async function ei(t,e){let n,s=t,i=e;for(const t of Gs){const e=await t(s,i);s=e.url,i=e.options}try{n=await fetch(s,i)}catch(t){for(const e of Qs)try{e(t)}catch{}throw t}for(const t of Ks)n=await t(n);if(!n.ok){const t=new Error(`${n.status} ${n.statusText}`);for(const e of Qs)try{e(t)}catch{}}return n}function ni(t){return async(e,n)=>({url:e,options:{...n,headers:{...n.headers,Authorization:"string"==typeof t?t:await t()}}})}function si(t){return(e,n)=>({url:e.startsWith("http")?e:`${t}${e}`,options:n})}function ii(t=console.log){return e=>(t(`[fetch] ${e.status} ${e.url}`),e)}const ri=t=>ti.fetchAction(t),oi=t=>ti.getAction(t),ai=t=>ti.postAction(t),li=t=>ti.putAction(t),ci=t=>ti.patchAction(t),hi=t=>ti.deleteAction(t);function ui(t){return t.startsWith("--")?t:`--${t}`}function di(t,e){let n="";for(const t in e){n+=` ${ui(t)}: ${e[t]};\n`}return n?`${t} {\n${n}}`:""}function fi(t){const e=Object.keys(t);if(0===e.length)throw new Error("[globalTheme] themes object must have at least one entry.");const n=e[0],s=e[1],i=t[n],r=[];r.push(di(":root",i));for(const n of e)r.push(di(`[data-theme="${n}"]`,t[n]));void 0!==s&&r.push(function(t){let e="";for(const n in t)e+=` ${ui(n)}: ${t[n]};\n`;return e?`@media (prefers-color-scheme: dark) {\n :root:not([data-theme]) {\n${e} }\n}`:""}(t[s])),Bn();const o=Wn(),a=r.filter(Boolean).join("\n");a&&o.appendRules(a);const l=Object.create(null);for(const t in i)l[t]=ui(t);return{cssVars:Object.freeze(l)}}function pi(t){Bn();const e=Wn(),n=di(":root",t);return n&&e.appendRules(n),t}function mi(t){if(null==t)return{action:"remove"};if("boolean"==typeof t)return t?{action:"set",value:""}:{action:"remove"};if("string"==typeof t)return{action:"set",value:t};if("number"==typeof t)return{action:"set",value:String(t)};if(Array.isArray(t)){if(2===t.length){const[e,n]=t;return e?"boolean"==typeof n?n?{action:"set",value:""}:{action:"remove"}:{action:"set",value:String(n)}:{action:"remove"}}if(3===t.length){const[e,n,s]=t,i=e?n:s;return"boolean"==typeof i?i?{action:"set",value:""}:{action:"remove"}:{action:"set",value:String(i)}}}return{action:"remove"}}function _i(t){return t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function gi(t){if(null==t||!1===t)return null;if("string"==typeof t)return t;if("number"==typeof t)return String(t);if(Array.isArray(t)){if(2===t.length){const[e,n]=t;return e?String(n):null}if(3===t.length){const[e,n,s]=t;return String(e?n:s)}}return null}const yi=new WeakMap,wi=new WeakMap,vi=new WeakMap,bi=new WeakMap;class Si{constructor(t){this.el=t}attr(t){const e=this.el;yi.has(e)||yi.set(e,new Map);const n=yi.get(e),s=new Map;for(const[i,r]of Object.entries(t)){const t=mi(r);"set"===t.action?(n.get(i)!==t.value&&e.setAttribute(i,t.value),s.set(i,t.value)):n.has(i)&&e.removeAttribute(i)}for(const t of n.keys())s.has(t)||e.removeAttribute(t);return yi.set(e,s),this}updateAttr(t){const e=this.el;yi.has(e)||yi.set(e,new Map);const n=yi.get(e),s=Object.fromEntries(n);t(s);const i=new Map;for(const[t,r]of Object.entries(s))n.get(t)!==r&&e.setAttribute(t,r),i.set(t,r);for(const t of n.keys())i.has(t)||e.removeAttribute(t);return yi.set(e,i),this}style(t){const e=this.el;wi.has(e)||wi.set(e,new Map);const n=wi.get(e),s=new Map;for(const[i,r]of Object.entries(t)){const t=gi(r),o=_i(i);null!==t?(n.get(o)!==t&&e.style.setProperty(o,t),s.set(o,t)):n.has(o)&&e.style.removeProperty(o)}for(const t of n.keys())s.has(t)||e.style.removeProperty(t);return wi.set(e,s),this}classes(t){const e=this.el;vi.has(e)||vi.set(e,new Set);const n=vi.get(e),s=function(t){const e=new Set,n=t=>{for(const n of t.split(/\s+/))n&&e.add(n)};if("string"==typeof t)return n(t),e;if(Array.isArray(t)){for(const e of t)if(e||0===e)if("string"!=typeof e){if(Array.isArray(e))if(2===e.length){const[t,s]=e;t&&s&&n(s)}else if(3===e.length){const[t,s,i]=e;n(t?s:i)}}else n(e);return e}if("object"==typeof t&&null!==t)for(const[e,s]of Object.entries(t))s&&n(e);return e}(t);for(const t of s)n.has(t)||e.classList.add(t);for(const t of n)s.has(t)||e.classList.remove(t);return vi.set(e,s),this}addClass(t){const e=this.el;for(const n of t.split(/\s+/))n&&e.classList.add(n);return this}removeClass(t){const e=this.el;for(const n of t.split(/\s+/))n&&e.classList.remove(n);return this}toggleClass(t,e){const n=this.el;for(const s of t.split(/\s+/))s&&n.classList.toggle(s,e);return this}html(t){if(null==t)throw new Error("$(el).html() — the factory function must return a lit-html TemplateResult (e.g. () => html`<span>${value}</span>`).");return F(t,this.el),this}text(t){return this.el.textContent=String(t),this}focus(t){return this.el.focus(t),this}blur(){return this.el.blur(),this}scroll(t){const e=this.el;return"string"==typeof t?e.scrollTo({top:0,behavior:t}):t?e.scrollTo(t):e.scrollTo({top:0}),this}scrollIntoView(t){return this.el.scrollIntoView(t),this}measure(t){const e=this.el.getBoundingClientRect();return t({width:e.width,height:e.height,top:e.top,left:e.left,right:e.right,bottom:e.bottom,x:e.x,y:e.y}),this}on(t,e,n){const s=this.el;bi.has(s)||bi.set(s,new Map);const i=bi.get(s),r=i.get(t);r&&s.removeEventListener(t,r.handler,r.options);const o=e;return s.addEventListener(t,o,n),i.set(t,{handler:o,options:n}),this}off(t,e){const n=this.el,s=bi.get(n);if(!s)return this;if(e){const i=s.get(t);i&&i.handler===e&&(n.removeEventListener(t,i.handler,i.options),s.delete(t))}else{const e=s.get(t);e&&(n.removeEventListener(t,e.handler,e.options),s.delete(t))}return this}once(t,e,n){const s="object"==typeof n?{...n,once:!0}:{once:!0};return this.el.addEventListener(t,e,s),this}delegate(t,e,n,s){const i=t=>{const s=t.target?.closest(e);s&&this.el.contains(s)&&n(t,s)};return this.el.addEventListener(t,i,s),bi.has(this.el)||bi.set(this.el,new Map),bi.get(this.el).set(`${t}:delegate:${e}`,{handler:i,options:s}),this}aria(t){const e=this.el;for(const[n,s]of Object.entries(t)){const t=n.startsWith("aria-")?n:`aria-${n}`;null==s||!1===s?e.removeAttribute(t):e.setAttribute(t,String(s))}return this}getAttr(t){return this.el.getAttribute(t)}data(t){const e=this.el;for(const[n,s]of Object.entries(t)){const t=n.startsWith("data-")?n.slice(5):n,i=n.startsWith("data-")?n:`data-${n}`;null==s?e.removeAttribute(i):e.setAttribute(i,String(s));const r=t.replace(/-([a-z])/g,(t,e)=>e.toUpperCase());null==s?delete e.dataset[r]:e.dataset[r]=String(s)}return this}}function Ei(t){if(null!==t&&"object"==typeof t&&!0===t.__isMatesRef__){const e=t;if(void 0===e.value)throw new Error("$(ref): the ref has no element attached yet (ref.value is undefined).\nDOM manipulation via $() must happen after the element has mounted.\nUse one of the lifecycle hooks where the element is guaranteed to exist:\n • onMount() — runs once after the component's first render\n • onPaint() — runs after the browser has painted\n • onUpdate() — runs after every subsequent re-render\n\nExample:\n const inputRef = ref<HTMLInputElement>();\n onMount(() => { $(inputRef).focus(); });");return new Si(e.value)}return new Si(t)}function Ci(t,e){return"function"!=typeof t.animate?Promise.resolve():("function"==typeof t.getAnimations&&t.getAnimations().forEach(t=>t.cancel()),new Promise(n=>{const s=t.animate(e.keyframes,{duration:300,easing:"ease",fill:"both",...e.options});s.onfinish=()=>n(),s.oncancel=()=>n()}))}async function Ai(t){const{el:e,exit:n,enter:s,swap:i,getEl:r,isStale:o}=t;if(!e)return void i();if(await Ci(e,n),o?.())return;if(i(),await("function"!=typeof requestAnimationFrame?Promise.resolve():new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(()=>t())))),o?.())return;const a=r?.()??e;a&&await Ci(a,s)}function ki(t){return t.__isEffect__=!0,bs({name:"Effect",fn:t,onRun:()=>{},supportsCleanup:!0})}const Mi=new WeakMap,$i=Y(class extends ut{render(t){return C}update(t,[e]){const n=e!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=e,this.ht=t.options?.host,this.rt(this.ct=t.element)),C}rt(t){if(this.isConnected||(t=void 0),"function"==typeof this.Y){const e=this.ht??globalThis;let n=Mi.get(e);void 0===n&&(n=new WeakMap,Mi.set(e,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,t),void 0!==t&&this.Y.call(this.ht,t)}else this.Y.value=t}get lt(){return"function"==typeof this.Y?Mi.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});function xi(){const t=new Ee;let e;const n={get value(){return e},__subscribe:e=>t.subscribe(e),__isMatesRef__:!0,__set:n=>{e!==n&&(e=n,t.trigger(n))}};return n}function Ti(t){if(t&&t.__isMatesRef__){const e=t;return $i(t=>{e.__set(t)})}return $i(t)}function Ri(t,e){return t.add(e),()=>t.delete(e)}class Oi{constructor(){this._beforeFns=new Set,this._afterFns=new Set,this._errorFns=new Set,this.fetchClient=new Js({},this._beforeFns,this._afterFns,this._errorFns)}interceptBefore(t){return Ri(this._beforeFns,t)}interceptAfter(t){return Ri(this._afterFns,t)}interceptError(t){return Ri(this._errorFns,t)}clearInterceptors(){this._beforeFns.clear(),this._afterFns.clear(),this._errorFns.clear()}}const Ii=()=>{if("undefined"==typeof window)return{};const t=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash,e=new URLSearchParams(t),n={};for(const[t,s]of e)try{n[t]=JSON.parse(s)}catch{n[t]=s}return n};function Pi(t){const e=Es(Ii());let n=!1;ki(()=>{const s=e();n||t()||(t=>{if("undefined"==typeof window)return;const e=new URLSearchParams;for(const n in t){const s=t[n];null!=s&&e.set(n,"object"==typeof s?JSON.stringify(s):String(s))}const n=e.toString(),s=window.location.pathname+window.location.search+(n?`#${n}`:"");window.history.replaceState(null,"",s)})(s)});const s=()=>{t()||(n=!0,e.set(Ii()),n=!1)};return"undefined"!=typeof window&&window.addEventListener("hashchange",s),e}const zi=()=>{if("undefined"==typeof window)return{};const t=new URLSearchParams(window.location.search),e={};for(const[n,s]of t)try{e[n]=JSON.parse(s)}catch{e[n]=s}return e};function Di(t){const e=Es(zi());let n=!1;ki(()=>{const s=e();n||t()||(t=>{if("undefined"==typeof window)return;const e=new URLSearchParams;for(const n in t){const s=t[n];null!=s&&e.set(n,"object"==typeof s?JSON.stringify(s):String(s))}const n=e.toString(),s=window.location.pathname+(n?`?${n}`:"")+window.location.hash;window.history.replaceState(null,"",s)})(s)});const s=()=>{t()||(n=!0,e.set(zi()),n=!1)};return"undefined"!=typeof window&&window.addEventListener("popstate",s),e}function Ni(t){return new Promise(e=>{const n=()=>{t?.(),e()};Pe()?queueMicrotask(n):"undefined"!=typeof requestIdleCallback?requestIdleCallback(()=>n(),{timeout:300}):requestAnimationFrame(n)})}class Li{constructor(){this.navigationLocked=Es(!1),this.navigationRequestEvent=Te("router:navigation-request"),this.historyStateAtom=Es("undefined"!=typeof window?window.history.state:null),this.pathAtom=function(t,e,n){const s=As("undefined"!=typeof window?window.location.pathname:"/");function i(t){t.preventDefault(),t.returnValue=""}return ki(()=>(t()?"undefined"!=typeof window&&window.addEventListener("beforeunload",i):"undefined"!=typeof window&&window.removeEventListener("beforeunload",i),()=>{"undefined"!=typeof window&&window.removeEventListener("beforeunload",i)})),"undefined"!=typeof window&&(window.addEventListener("popstate",i=>{if(t())return window.history.pushState(window.history.state,"",s.get()),void e.set(window.history.state??null);const r=window.location.pathname;if(r!==s.get()&&n.trigger({to:r,from:s.get()}),t())return window.history.pushState(window.history.state,"",s.get()),void e.set(window.history.state??null);e.set(i.state??null),r!==s.get()&&s.set(r)}),window.addEventListener("hashchange",()=>{if(t())return;const e=window.location.pathname;e!==s.get()&&s.set(e)}),window.addEventListener("navigate",()=>{if(t())return;const e=window.location.pathname;e!==s.get()&&s.set(e)})),s}(this.navigationLocked,this.historyStateAtom,this.navigationRequestEvent),this.qsAtom=Di(this.navigationLocked),this.hashAtom=Pi(this.navigationLocked)}navigateTo(t,e,n){var s,i,r,o;(s=this.pathAtom,i=this.navigationLocked,r=this.historyStateAtom,o=this.navigationRequestEvent,function(t,e,n){if(i())return;if(t===s.get())return;const a=t.includes("?"),l=t.includes("#");let c=t;if(a||l)if(l){if(!a){const e=t.indexOf("#");c=t.slice(0,e)+window.location.search+t.slice(e)}}else c=t+window.location.hash;else c=t+window.location.search+window.location.hash;o.trigger({to:t,from:s.get()}),i()||(r.set(n??null),e?window.history.replaceState(n,"",c):window.history.pushState(n,"",c),s.set(t))})(t,e,n)}lockNavigation(){this.navigationLocked.set(!0)}unlockNavigation(){this.navigationLocked.set(!1)}get location(){return t=this.pathAtom,e=this.hashAtom,n=this.qsAtom,{get path(){return t.get()},get hash(){return e()},get qsObj(){return n()}};var t,e,n}onNavigationRequest(t){if(Pe())return;Xe();let e=!1;const n=this.navigationRequestEvent.__subscribe(n=>{if(e)return;const{to:s,from:i}=n;this.lockNavigation();let r=!1;const o=t({to:s,from:i,next:()=>{r||(r=!0,e=!0,this.unlockNavigation(),Ni(()=>{this.navigateTo(s),e=!1}))}});o instanceof Promise?o.then(()=>{r||this.unlockNavigation()}).catch(()=>{r||this.unlockNavigation()}):r||this.unlockNavigation()});$e(t,n)}}const ji="mates";function Fi(t,e){try{null===e?t.removeItem(ji):t.setItem(ji,JSON.stringify(e))}catch{}}function Ui(t,e){const n=Es((()=>{try{return function(t){try{const e=t.getItem(ji);if(e)return JSON.parse(e)}catch{}return null}(t())}catch{return null}})()),s=n.set;n.set=function(e,i=!1){s(e,i);try{Fi(t(),n.get())}catch{}};const i=n.update;return n.update=function(e,s=!1){if(null!==n.get()){i(e,s);try{Fi(t(),n.get())}catch{}}},e(t=>{if(t.key===ji)if(t.newValue)try{s(JSON.parse(t.newValue))}catch{}else s(null)}),Object.defineProperty(n,"name",{value:"storageAtom",writable:!0,configurable:!0,enumerable:!1}),n}function Vi(t){"undefined"!=typeof window&&window.addEventListener("storage",t)}class Wi{constructor(){this.lsAtom=Ui(()=>localStorage,t=>Vi(e=>{e.storageArea===localStorage&&t(e)})),this.ssAtom=Ui(()=>sessionStorage,t=>Vi(e=>{e.storageArea===sessionStorage&&t(e)}))}}const Bi="mates-theme";function Hi(t){return"auto"===t?function(){try{return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}():t}const Yi=function(){const t=Es(function(){try{const t=localStorage.getItem(Bi);return"light"===t||"dark"===t||"auto"===t?t:null}catch{return null}}()??"auto",{skipRestrictedContextCheck:!0}),e=t;if(e.setToLight=()=>{t.set("light")},e.setToDark=()=>{t.set("dark")},e.setToAuto=()=>{t.set("auto")},e.toggle=()=>{const e=Hi(t.get());t.set("dark"===e?"light":"dark")},Object.defineProperty(e,"resolved",{get:()=>Hi(t.get()),enumerable:!1,configurable:!0}),Object.defineProperty(e,"name",{value:"themeAtom",writable:!0,configurable:!0,enumerable:!1}),ki(()=>{const e=t.get();!function(t){try{document.documentElement.setAttribute("data-theme",Hi(t))}catch{}}(e),function(t){try{"auto"===t?localStorage.removeItem(Bi):localStorage.setItem(Bi,t)}catch{}}(e)}),"undefined"!=typeof window&&window.matchMedia)try{window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{"auto"===t.get()&&t.set("auto")})}catch{}return e};class qi{constructor(){this.themeAtom=Yi(),this.titleAtom=function(){const t=Es("undefined"!=typeof document?document.title:"");return ki(()=>{"undefined"!=typeof document&&(document.title=t.get())}),t}()}}class Xi{constructor(){this._router=new Li,this._fetch=new Oi,this._storage=new Wi,this._theme=new qi}get pathAtom(){return this._router.pathAtom}get qsAtom(){return this._router.qsAtom}get hashAtom(){return this._router.hashAtom}get historyStateAtom(){return this._router.historyStateAtom}get navigationLocked(){return this._router.navigationLocked}get navigationRequestEvent(){return this._router.navigationRequestEvent}get location(){return this._router.location}navigateTo(t,e,n){return this._router.navigateTo(t,e,n)}lockNavigation(){return this._router.lockNavigation()}unlockNavigation(){return this._router.unlockNavigation()}onNavigationRequest(t){return this._router.onNavigationRequest(t)}get fetchClient(){return this._fetch.fetchClient}interceptBefore(t){return this._fetch.interceptBefore(t)}interceptAfter(t){return this._fetch.interceptAfter(t)}interceptError(t){return this._fetch.interceptError(t)}clearInterceptors(){return this._fetch.clearInterceptors()}get lsAtom(){return this._storage.lsAtom}get ssAtom(){return this._storage.ssAtom}get themeAtom(){return this._theme.themeAtom}get titleAtom(){return this._theme.titleAtom}}const Zi=t=>"function"==typeof t&&!0===t.__isAtom___&&"function"==typeof t.set&&"function"==typeof t.__subscribe,Gi=t=>"object"==typeof t&&null!==t&&!0===t.__isUnit___&&"function"==typeof t.__subscribe&&"function"==typeof t.__reset,Ki=t=>"function"==typeof t&&!0===t.__isAction___&&"function"==typeof t.__subscribe,Qi=t=>"function"==typeof t&&!0===t.__isAsyncAction___&&"function"==typeof t.subscribe,Ji=t=>"function"==typeof t&&!0===t.__isSetter___&&"function"==typeof t.__subscribe,tr=t=>"object"==typeof t&&null!==t&&!0===t.__isEvent___&&"function"==typeof t.__subscribe&&"function"==typeof t.trigger,er=t=>"object"==typeof t&&null!==t&&!0===t.__isConfirmationEvent___&&"function"==typeof t.requestConfirmation&&"function"==typeof t.onConfirmRequest,nr=t=>"object"==typeof t&&null!==t&&!0===t.__isChannel___&&"function"==typeof t.join,sr=t=>"function"==typeof t&&!0===t.__isSelector___&&"function"==typeof t.areVersionsChanged,ir=t=>"function"==typeof t,rr=t=>"AsyncFunction"===t.constructor.name,or=(t,e,n,s)=>{if(Zi(t)){const i=t,r=Es(i(),s),o=n(r.set,e),a=n(r.update,e);return r.set=o,r.update=a,i.__subscribe(()=>{Ye.schedule(()=>r.set(i()))}),$e(r,()=>{o.cancel(),a.cancel()}),r}const i=Es(t,s),r=n(i.set,e),o=n(i.update,e);return i.set=r,i.update=o,$e(i,()=>{r.cancel(),o.cancel()}),i},ar=(t,e,n)=>or(t,e,zs,n);function lr(t,e,n){const s=new Set;function i(t){const n=setTimeout(()=>{s.delete(n),t()},e);s.add(n)}function r(){for(const t of s)clearTimeout(t);s.clear()}if(Zi(t)){const e=t,s=Es(e(),n),o=s.set.bind(s),a=s.update.bind(s);return s.set=(t,e)=>{i(()=>o(t,e))},s.update=(t,e)=>{i(()=>a(t,e))},e.__subscribe(()=>{const t=e();i(()=>o(t))}),$e(s,r),s}const o=Es(t,n),a=o.set.bind(o),l=o.update.bind(o);return o.set=(t,e)=>{i(()=>a(t,e))},o.update=(t,e)=>{i(()=>l(t,e))},$e(o,r),o}const cr=(t=[],e)=>{const n=new Map(t),s=Es(n,e),i=n.set.bind(n);n.set=(t,e)=>(i(t,e),s.update(()=>{}),n);const r=n.delete.bind(n);n.delete=t=>{const e=r(t);return s.update(()=>{}),e};const o=n.clear.bind(n);n.clear=()=>{o(),s.update(()=>{})};const a=n.get.bind(n);n.get=t=>(s.get(),a(t));const l=n.has.bind(n);n.has=t=>(s.get(),l(t));const c=Object.getOwnPropertyDescriptor(Map.prototype,"size");Object.defineProperty(n,"size",{get:()=>(s.get(),c.get.call(n))});const h=n.entries.bind(n);n.entries=()=>(s.get(),h());const u=n.values.bind(n);n.values=()=>(s.get(),u());const d=n.keys.bind(n);n.keys=()=>(s.get(),d());const f=n.forEach.bind(n);n.forEach=(t,e)=>(s.get(),f(t,e));const p=n[Symbol.iterator].bind(n);return n[Symbol.iterator]=()=>(s.get(),p()),n.update=t=>{const e={set:(t,n)=>(i(t,n),e),delete:t=>r(t),clear:()=>{o()},get:t=>a(t),has:t=>l(t),entries:()=>h(),values:()=>u(),keys:()=>d(),forEach:(t,e)=>f(t,e),[Symbol.iterator]:()=>p(),get size(){return c.get.call(n)}};return t(e),s.update(()=>{}),n},n.updateItem=(t,e)=>{const i=a(t);return null==i||"object"!=typeof i||(e(i),s.update(()=>{})),n},Object.defineProperty(n,"__isAtom___",{value:s,writable:!1,enumerable:!1}),Object.defineProperty(n,"__version__",{get:()=>s.__version__,enumerable:!1}),n},hr=(t=[],e)=>{const n=new Set(t),s=Es(n,e),i=n.add.bind(n);n.add=t=>(i(t),s.update(()=>{}),n);const r=n.delete.bind(n);n.delete=t=>{const e=r(t);return s.update(()=>{}),e};const o=n.clear.bind(n);n.clear=()=>{o(),s.update(()=>{})};const a=n.has.bind(n);n.has=t=>(s.get(),a(t));const l=Object.getOwnPropertyDescriptor(Set.prototype,"size");Object.defineProperty(n,"size",{get:()=>(s.get(),l.get.call(n))});const c=n.entries.bind(n);n.entries=()=>(s.get(),c());const h=n.values.bind(n);n.values=()=>(s.get(),h());const u=n.keys.bind(n);n.keys=()=>(s.get(),u());const d=n.forEach.bind(n);n.forEach=(t,e)=>(s.get(),d(t,e));const f=n[Symbol.iterator].bind(n);return n[Symbol.iterator]=()=>(s.get(),f()),n.update=t=>{const e={add:t=>(i(t),e),delete:t=>r(t),clear:()=>{o()},has:t=>a(t),entries:()=>c(),values:()=>h(),keys:()=>u(),forEach:(t,e)=>d(t,e),[Symbol.iterator]:()=>f(),get size(){return l.get.call(n)}};return t(e),s.update(()=>{}),n},n.updateItem=(t,e)=>(null==t||"object"!=typeof t||(e(t),s.update(()=>{})),n),Object.defineProperty(n,"__isAtom___",{value:s,writable:!1,enumerable:!1}),Object.defineProperty(n,"__version__",{get:()=>s.__version__,enumerable:!1}),n},ur=(t,e,n)=>or(t,e,Ls,n);function dr(t){const e=new Map,n=new Map,s=Es(e,t),i=s.get.bind(s),r=s;return r.add=(t,i,r)=>{if(n.has(t)&&(clearTimeout(n.get(t)),n.delete(t)),s.update(e=>{e.set(t,i)}),void 0!==r&&-1!==r&&r>0){const i=setTimeout(()=>{e.delete(t),n.delete(t),s.update(()=>{})},r);n.set(t,i)}},r.get=t=>(i(),e.get(t)),r.remove=t=>!!e.has(t)&&(n.has(t)&&(clearTimeout(n.get(t)),n.delete(t)),e.delete(t),s.update(()=>{}),!0),r.has=t=>(i(),e.has(t)),r.getAll=()=>(i(),Array.from(e.values())),r.clearAll=()=>{n.forEach(t=>clearTimeout(t)),n.clear(),e.clear(),s.update(()=>{})},Object.defineProperty(r,"size",{get:()=>(i(),e.size),enumerable:!0,configurable:!0}),Object.defineProperty(r,"name",{get:()=>"cacheAtom",enumerable:!0,configurable:!0}),$e(s,r.clearAll),r}function fr(t=0,e){const n=Es(t,e),s=n;return s.change=t=>{n.set(void 0!==t?t:Math.random())},s.name="changeFlagAtom",s}const pr=(t=1,e)=>{const n=Es(t,e),s=n;return s.next=()=>{n.set(t=>t+1)},s.prev=()=>{n.set(t=>t>1?t-1:t)},s.reset=()=>{n.set(1)},Object.defineProperty(s,"currentPage",{get:()=>n.get(),enumerable:!1,configurable:!0}),Object.defineProperty(s,"name",{value:"paginationAtom",writable:!0,configurable:!0,enumerable:!1}),s};function mr(t,e=2){let n=parseFloat(String(t).trim());Number.isFinite(n)||(n=0);const s=10**e;return Math.round(n*s)/s}function _r(t,e,n){const s=As(t,{skipRestrictedContextCheck:!0,...n}),i=As([],{skipRestrictedContextCheck:!0,...n});function r(){const t=s.get(),n=e.map(e=>e(t)).filter(t=>null!=t&&""!==t);return i.set(n),n}const o=s.set;s.set=function(t,e=!1){o(t,e),r()};const a=s.update;s.update=function(t,e=!1){a(t,e),r()};const l=s;return Object.defineProperty(l,"__isFormAtom__",{value:!0,writable:!1,enumerable:!1,configurable:!1}),Object.defineProperty(l,"errors",{get:()=>i.get(),enumerable:!1,configurable:!0}),Object.defineProperty(l,"isValid",{get:()=>0===i.get().length,enumerable:!1,configurable:!0}),l.validate=r,l.toFloat=()=>mr(s.get()),l.toFloatString=()=>mr(s.get()).toString(),l.toValidNumber=()=>function(t){const e=Number(t);return Number.isFinite(e)?e:0}(s.get()),Object.defineProperty(l,"name",{value:"formAtom",writable:!0,configurable:!0,enumerable:!1}),l}const gr=(t,e=[],n)=>_r(t,e,n);function yr(t){const e=[],n={},s=new WeakSet;return function t(i,r){if(null==i)return;const o=typeof i;if("object"!==o&&"function"!==o)return;if(s.has(i))return;if(s.add(i),function(t){if(null==t)return!1;const e=typeof t;return("object"===e||"function"===e)&&!0===t.__isFormAtom__}(i)){const t=i.validate();return void(t.length>0&&(e.push(...t),n[r]=t))}if(Array.isArray(i)){for(let e=0;e<i.length;e++){const n=r?`${r}[${e}]`:`[${e}]`;t(i[e],n)}return}const a=Object.keys(i);for(const e of a){const n=r?`${r}.${e}`:e;t(i[e],n)}}(t,""),{isValid:0===e.length,errors:e,errorsByField:n}}function wr(t,e,n){const s=e.replace(/\[(\d+)]/g,".$1").split(".");let i=t;for(const t of s){if(null==i)return n;i=i[t]}return void 0===i?n:i}function vr(t,e){const n={};for(const s of e)s in t&&(n[s]=t[s]);return n}function br(t,e){const n={...t};for(const t of e)delete n[t];return n}function Sr(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function Er(t,...e){const n={...t};for(const t of e)for(const e of Object.keys(t))Sr(n[e])&&Sr(t[e])?n[e]=Er(n[e],t[e]):n[e]=t[e];return n}function Cr(t,e,n){return Math.min(Math.max(t,e),n)}function Ar(t,e,n){if(void 0===e&&(e=t,t=0),void 0===n&&(n=t<=e?1:-1),0===n)return[];const s=[];if(n>0)for(let i=t;i<e;i+=n)s.push(i);else for(let i=t;i>e;i+=n)s.push(i);return s}function kr(t,e){if(e<1)return[];const n=[];for(let s=0;s<t.length;s+=e)n.push(t.slice(s,s+e));return n}function Mr(t,e){const n=new Set,s=[];for(const i of t){const t=e(i);n.has(t)||(n.add(t),s.push(i))}return s}function $r(t,e){const n={};for(const s of t){const t=String(e(s));n[t]||(n[t]=[]),n[t].push(s)}return n}function xr(t){return null==t||("string"==typeof t||Array.isArray(t)?0===t.length:t instanceof Map||t instanceof Set?0===t.size:"object"==typeof t&&0===Object.keys(t).length)}function Tr(t,e){if(null==t||"object"!=typeof t)return;const n=Array.isArray(t)?t.map((t,e)=>e):Object.keys(t);for(const s of n){const n=e(s,t[s],t);void 0!==n&&(t[s]=n);const i=t[s];null!==i&&"object"==typeof i&&Tr(i,e)}}const Rr=t=>(t=>"number"==typeof t||"boolean"==typeof t||!xr(t))(t)?null:"Required",Or=t=>(t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))(t)?null:"Invalid email",Ir=t=>e=>((t,e)=>t.length>=e)(e,t)?null:`Min ${t} characters`,Pr=t=>e=>((t,e)=>t.length<=e)(e,t)?null:`Max ${t} characters`,zr=(t,e="Invalid format")=>n=>((t,e)=>e.test(t))(n,t)?null:e,Dr=t=>e=>((t,e)=>t>=e)(e,t)?null:`Min is ${t}`,Nr=t=>e=>((t,e)=>t<=e)(e,t)?null:`Max is ${t}`;function Lr(t){let e;return bs({name:"Memo",fn:t,onRun:t=>{e?e.set(()=>t):(e=Es(void 0,{skipRestrictedContextCheck:!0}),e.set(()=>t,!0))}}),e}function jr(t){const e=new Set,n=[Object.prototype,Array.prototype,Function.prototype,String.prototype,Number.prototype,Boolean.prototype,Symbol.prototype,Date.prototype,RegExp.prototype,Map.prototype,Set.prototype,WeakMap.prototype,WeakSet.prototype,Promise.prototype,Error.prototype];let s=t;for(;s&&!n.includes(s);){for(const t of Reflect.ownKeys(s))"constructor"!==t&&e.add(t);s=Object.getPrototypeOf(s)}return Array.from(e)}const Fr=t=>{const e=Me();if(e&&e.scopes.has(t))throw new Error("Scope already exists for the same class for this component");let n;re.viewOuterInProgress=!0;try{n=new t}finally{re.viewOuterInProgress=!1}const s=re.setupInProgress;try{if((()=>{jr(n).forEach(t=>{const e=Object.getOwnPropertyDescriptor(n,t)||Object.getOwnPropertyDescriptor(Object.getPrototypeOf(n),t);if(e&&(e.get||e.set))return;const s=n[t];"function"!=typeof s||s.__version__||(n[t]=s.bind(n))})})(),"function"==typeof n.setup){rr(n.setup)&&console.warn("Async setup functions are not supported. Please ensure the setup function is synchronous."),re.setupInProgress=!0;try{n.setup(e?._propsFn||(()=>({})))}catch(t){console.error(t)}finally{re.setupInProgress=s}}e&&e.addScope(t,n),n.__isScope___=!0}catch(t){console.error(t)}finally{re.setupInProgress=s}return n},Ur=t=>{let e=null;const n=new CustomEvent("request-parent-scope",{bubbles:!0,composed:!0,detail:{ScopeClass:t,resolve:t=>{e=t}}}),s=Me(!1);if(s)s.dispatchEvent(n);else if("undefined"!=typeof document){const t=document.querySelector("x-view");t&&t.dispatchEvent(n)}if(e)return e;throw new Error(`No parent scope found for ${t.name}`)},Vr=new Set;function Wr(t){for(const e of t)Vr.add(e)}function Br(){return[...Vr]}const Hr=()=>Ur(Xi),Yr=()=>Ur(Li),qr=()=>Ur(Oi),Xr=()=>Ur(Wi),Zr=()=>Ur(qi);function Gr(t,e){let n=t;for(;n&&n!==Object.prototype;){const t=Object.getOwnPropertyDescriptor(n,e);if(t)return t;n=Object.getPrototypeOf(n)}}const Kr=(t,e,n)=>{const s=jr(t);s.forEach(s=>{const i=Gr(t,s);if(i?.get){let n,r=-1;const o=i.get;Object.defineProperty(t,s,{get(){const s=e.__version__;return s!==r&&(r=s,n=o.call(t)),n},configurable:!0,enumerable:i.enumerable})}else if(ir(t[s])){if(rr(t[s]))throw new Error(`Async functions are not supported inside ${n}`);const i=t[s];t[s]=(...n)=>{e.update(()=>i.apply(t,n))}}});const i=Object.create(t);return s.forEach(n=>{const s=Gr(t,n);if(!s)return;const r=!!s.get,o=!r&&ir(s.value);r||o||Object.defineProperty(i,n,{get:()=>e()[n],set(t){e.update(e=>{e[n]=t})},enumerable:!0,configurable:!0})}),i},Qr=t=>{if("object"!=typeof t||null===t)throw new Error("initial state must be an object");const e=Es(t),n=Kr(t,e,"store");return()=>[n,e.update]},Jr=t=>{const e=Me();if("object"!=typeof t||null===t)throw new Error("stateObj must be an object");const n=Es(t),s=Kr(t,n,"useState");return e?._useStates&&e._useStates.push({state:t,atom:n}),[s,n.update]},to=t=>{Xe();const e=Me();e._errorHandlers||(e._errorHandlers=[]),e._errorHandlers.push(t)},eo=(t,e)=>{const n=Me();if(Xe(),!n)throw new Error("onReferenceChange must be called inside a component");let s=[];t(),s=e(),n.onEachUpdate(()=>{const n=e();s.some((t,e)=>t!==n[e])&&(t(),s=n)})},no=(t,e={})=>b`<x-view .view=${t} .props=${e}></x-view>`,so=no,io=no,ro=(t,e)=>F(no(oo,{viewFn:t}),e),oo=t=>{Fr(Li),Fr(Oi),Fr(Wi),Fr(qi),Fr(Xi);for(const t of Br())Fr(t);const e=t().viewFn;return()=>no(e)},ao=ro,lo=t=>{const e=xi(),n=t().condition,s=Es(n),i=Es(n);return ki(()=>{const n=i();if(n===s.get())return;const r=e.value;if(!r)return void s.set(n);const o=t().config;Ai({el:r,exit:o?.exit??Jn(200),enter:o?.enter??Qn(250),swap:()=>s.set(n),getEl:()=>e.value,isStale:()=>i.get()!==n})}),Ge(()=>{const n=e.value;if(!n)return;const s=t().config;Ci(n,s?.enter??Qn(250))}),()=>{const n=s(),{condition:r,trueTpl:o,falseTpl:a}=t();return i.get()!==r&&i.set(r),b`
|
|
110
110
|
<div ${Ti(e)} style="position:relative">
|
|
111
111
|
${n?o:a}
|
|
112
112
|
</div>
|
|
113
|
-
`}};function co(t,e,n=C,s){return no(lo,{condition:t,trueTpl:e,falseTpl:n,config:s})}function ho(t,e,n){const{show:s,...i}=n;return co(s,b`<x-view .view=${t} .props=${e}></x-view>`,C,i)}function uo(t){const e=re.isHookRunning;re.isHookRunning=!0;try{return t()}finally{re.isHookRunning=e}}function fo(t){var e,n,s,i,r;e=new WeakMap,n=new WeakMap,s=new WeakMap,i=new WeakMap,r=new WeakMap;const o=Y(class extends ut{constructor(t){if(super(t),e.set(this,null),n.set(this,!1),s.set(this,null),i.set(this,!1),r.set(this,null),t.type!==H)throw new Error("eleHook() must be used as an element expression, e.g. html`<div ${myHook()}>`")}update(o,a){const l=o.element;if(!ge(this,i,"f")||l.isConnected){if(!ge(this,n,"f")){ye(this,s,l,"f"),ye(this,i,!1,"f");const o=Ei(ge(this,s,"f")),c=uo(()=>t(o,...a));return ye(this,e,c??null,"f"),ye(this,n,!0,"f"),void ye(this,r,a,"f")}ge(this,e,"f")?.onUpdate&&uo(()=>ge(this,e,"f").onUpdate(...a)),ye(this,r,a,"f")}else console.log("[eleHook] UPDATE SKIPPED — disconnected & host detached, el:",l)}render(...t){}disconnected(){ye(this,i,!0,"f"),console.log("[eleHook] DISCONNECTED — el:",ge(this,s,"f"),"mounted:",ge(this,n,"f"),"hasCleanup:",!!ge(this,e,"f")?.onCleanup),ge(this,e,"f")?.onCleanup&&ge(this,e,"f").onCleanup(),ye(this,e,null,"f"),ye(this,n,!1,"f")}reconnected(){if(console.log("[eleHook] RECONNECTED — el:",ge(this,s,"f"),"was disconnected:",ge(this,i,"f"),"will re-mount:",!(!ge(this,i,"f")||ge(this,n,"f")||!ge(this,s,"f")||!ge(this,r,"f"))),ye(this,i,!1,"f"),!ge(this,n,"f")&&ge(this,s,"f")&&ge(this,r,"f")){const i=Ei(ge(this,s,"f")),o=uo(()=>t(i,...ge(this,r,"f")));ye(this,e,o??null,"f"),ye(this,n,!0,"f"),console.log("[eleHook] RE-MOUNTED after reconnect — el:",ge(this,s,"f"))}}});return(...t)=>o(...t)}const po=fo((t,e)=>(t.attr(e),{onUpdate(e){t.attr(e)},onCleanup(){t.attr({})}}));function mo(t){return po(t)}function _o(t){}const go=fo((t,e)=>{const n=t.el;let s=new Set;const i=t=>{const e=(t=>{const e=new Set;if(Array.isArray(t))for(const n of t)if(Array.isArray(n)){if(2===n.length){const[t,s]=n;t&&s&&e.add(s)}else if(3===n.length){const[t,s,i]=n,r=t?s:i;r&&e.add(r)}}else"string"==typeof n&&n&&e.add(n);else for(const[n,s]of Object.entries(t))s&&e.add(n);return e})(t);for(const t of s)e.has(t)||n.classList.remove(t);for(const t of e)s.has(t)||n.classList.add(t);s=e};return i(e),{onUpdate(t){i(t)},onCleanup(){for(const t of s)n.classList.remove(t);s=new Set}}});function yo(t){return go(t)}function wo(t){}const vo=fo((t,e,n)=>{const s=t.el;let i=n;const r=t=>{const e=t;i(e.detail,e)};return s.addEventListener(e,r),{onUpdate(t,e){i=e},onCleanup(){s.removeEventListener(e,r)}}});function bo(t,e){return vo(t,e)}function So(){const t=Me(!1);return{dispatch(e,n){t&&t.dispatchEvent(new CustomEvent(e,{detail:n,bubbles:!0,composed:!0,cancelable:!0}))}}}function Eo(t,e){if(e<=0)return{start(){t()},pause(){},resume(){},stop(){},get state(){return"stopped"},get remaining(){return 0}};let n="idle",s=e,i=0,r=null;function o(){null!==r&&(clearTimeout(r),r=null)}function a(){const t=performance.now()-i;return Math.max(0,s-t)}function l(){o(),r=setTimeout(()=>{r=null,n="stopped",s=0,t()},s)}return{start(){"running"!==n&&(s=e,i=performance.now(),n="running",l())},pause(){"running"===n&&(s=a(),o(),n="paused")},resume(){if("paused"===n){if(s<=0)return n="stopped",s=0,void t();i=performance.now(),n="running",l()}},stop(){o(),n="stopped",s=e},get state(){return n},get remaining(){return"running"===n?a():s}}}const Co=fo((t,e)=>{const n=t.el;let s=Eo(()=>{n.remove()},e);return s.start(),{onUpdate(t){t!==e&&(e=t,s.stop(),s=Eo(()=>{n.remove()},e),s.start())},onCleanup(){s.stop()}}});function Ao(t){const e=re.isHookRunning;re.isHookRunning=!0;try{return t()}finally{re.isHookRunning=e}}function ko(t){var e,n,s,i,r,o;e=new WeakMap,n=new WeakMap,s=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap;const a=Y(class extends ut{constructor(t){if(super(t),e.set(this,null),n.set(this,!1),s.set(this,!1),i.set(this,!1),r.set(this,null),o.set(this,t=>{ge(this,i,"f")?ye(this,r,t,"f"):this.setValue(t)}),t.type!==V)throw new Error("htmlHook() must be used as a child expression, e.g. html`<div>${myHook()}</div>`")}update(a,l){if(!ge(this,s,"f")||this.isConnected){if(ye(this,i,!0,"f"),ye(this,r,null,"f"),ge(this,n,"f"))ge(this,e,"f")?.onUpdate&&Ao(()=>ge(this,e,"f").onUpdate(...l));else{const s=Ao(()=>t(ge(this,o,"f"),...l));ye(this,e,s??null,"f"),ye(this,n,!0,"f")}if(ye(this,i,!1,"f"),null!==ge(this,r,"f")){const t=ge(this,r,"f");return ye(this,r,null,"f"),t}}else console.log("[htmlHook] UPDATE SKIPPED — disconnected & part detached")}render(...t){}disconnected(){ye(this,s,!0,"f"),ge(this,e,"f")?.onCleanup&&ge(this,e,"f").onCleanup(),ye(this,n,!1,"f"),ye(this,e,null,"f")}reconnected(){ge(this,s,"f")&&(ye(this,s,!1,"f"),ye(this,n,!1,"f"),ye(this,e,null,"f"))}});return(...t)=>a(...t)}const Mo=fo((t,e)=>{let n=e;const s=new IntersectionObserver(t=>{for(const e of t)e.isIntersecting?n.onVisible?.():n.onHidden?.()},{rootMargin:e.rootMargin??"0px",threshold:e.threshold??0});return s.observe(t.el),{onUpdate(t){n=t},onCleanup(){s.disconnect()}}});function
|
|
113
|
+
`}};function co(t,e,n=C,s){return no(lo,{condition:t,trueTpl:e,falseTpl:n,config:s})}function ho(t,e,n){const{show:s,...i}=n;return co(s,b`<x-view .view=${t} .props=${e}></x-view>`,C,i)}function uo(t){const e=re.isHookRunning;re.isHookRunning=!0;try{return t()}finally{re.isHookRunning=e}}function fo(t){var e,n,s,i,r;e=new WeakMap,n=new WeakMap,s=new WeakMap,i=new WeakMap,r=new WeakMap;const o=Y(class extends ut{constructor(t){if(super(t),e.set(this,null),n.set(this,!1),s.set(this,null),i.set(this,!1),r.set(this,null),t.type!==H)throw new Error("eleHook() must be used as an element expression, e.g. html`<div ${myHook()}>`")}update(o,a){const l=o.element;if(!ge(this,i,"f")||l.isConnected){if(!ge(this,n,"f")){ye(this,s,l,"f"),ye(this,i,!1,"f");const o=Ei(ge(this,s,"f")),c=uo(()=>t(o,...a));return ye(this,e,c??null,"f"),ye(this,n,!0,"f"),void ye(this,r,a,"f")}ge(this,e,"f")?.onUpdate&&uo(()=>ge(this,e,"f").onUpdate(...a)),ye(this,r,a,"f")}else console.log("[eleHook] UPDATE SKIPPED — disconnected & host detached, el:",l)}render(...t){}disconnected(){ye(this,i,!0,"f"),console.log("[eleHook] DISCONNECTED — el:",ge(this,s,"f"),"mounted:",ge(this,n,"f"),"hasCleanup:",!!ge(this,e,"f")?.onCleanup),ge(this,e,"f")?.onCleanup&&ge(this,e,"f").onCleanup(),ye(this,e,null,"f"),ye(this,n,!1,"f")}reconnected(){if(console.log("[eleHook] RECONNECTED — el:",ge(this,s,"f"),"was disconnected:",ge(this,i,"f"),"will re-mount:",!(!ge(this,i,"f")||ge(this,n,"f")||!ge(this,s,"f")||!ge(this,r,"f"))),ye(this,i,!1,"f"),!ge(this,n,"f")&&ge(this,s,"f")&&ge(this,r,"f")){const i=Ei(ge(this,s,"f")),o=uo(()=>t(i,...ge(this,r,"f")));ye(this,e,o??null,"f"),ye(this,n,!0,"f"),console.log("[eleHook] RE-MOUNTED after reconnect — el:",ge(this,s,"f"))}}});return(...t)=>o(...t)}const po=fo((t,e)=>(t.attr(e),{onUpdate(e){t.attr(e)},onCleanup(){t.attr({})}}));function mo(t){return po(t)}function _o(t){}const go=fo((t,e)=>{const n=t.el;let s=new Set;const i=t=>{const e=(t=>{const e=new Set;if(Array.isArray(t))for(const n of t)if(Array.isArray(n)){if(2===n.length){const[t,s]=n;t&&s&&e.add(s)}else if(3===n.length){const[t,s,i]=n,r=t?s:i;r&&e.add(r)}}else"string"==typeof n&&n&&e.add(n);else for(const[n,s]of Object.entries(t))s&&e.add(n);return e})(t);for(const t of s)e.has(t)||n.classList.remove(t);for(const t of e)s.has(t)||n.classList.add(t);s=e};return i(e),{onUpdate(t){i(t)},onCleanup(){for(const t of s)n.classList.remove(t);s=new Set}}});function yo(t){return go(t)}function wo(t){}const vo=fo((t,e,n)=>{const s=t.el;let i=n;const r=t=>{const e=t;i(e.detail,e)};return s.addEventListener(e,r),{onUpdate(t,e){i=e},onCleanup(){s.removeEventListener(e,r)}}});function bo(t,e){return vo(t,e)}function So(){const t=Me(!1);return{dispatch(e,n){t&&t.dispatchEvent(new CustomEvent(e,{detail:n,bubbles:!0,composed:!0,cancelable:!0}))}}}function Eo(t,e){if(e<=0)return{start(){t()},pause(){},resume(){},stop(){},get state(){return"stopped"},get remaining(){return 0}};let n="idle",s=e,i=0,r=null;function o(){null!==r&&(clearTimeout(r),r=null)}function a(){const t=performance.now()-i;return Math.max(0,s-t)}function l(){o(),r=setTimeout(()=>{r=null,n="stopped",s=0,t()},s)}return{start(){"running"!==n&&(s=e,i=performance.now(),n="running",l())},pause(){"running"===n&&(s=a(),o(),n="paused")},resume(){if("paused"===n){if(s<=0)return n="stopped",s=0,void t();i=performance.now(),n="running",l()}},stop(){o(),n="stopped",s=e},get state(){return n},get remaining(){return"running"===n?a():s}}}const Co=fo((t,e)=>{const n=t.el;let s=Eo(()=>{n.remove()},e);return s.start(),{onUpdate(t){t!==e&&(e=t,s.stop(),s=Eo(()=>{n.remove()},e),s.start())},onCleanup(){s.stop()}}});function Ao(t){const e=re.isHookRunning;re.isHookRunning=!0;try{return t()}finally{re.isHookRunning=e}}function ko(t){var e,n,s,i,r,o;e=new WeakMap,n=new WeakMap,s=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap;const a=Y(class extends ut{constructor(t){if(super(t),e.set(this,null),n.set(this,!1),s.set(this,!1),i.set(this,!1),r.set(this,null),o.set(this,t=>{ge(this,i,"f")?ye(this,r,t,"f"):this.setValue(t)}),t.type!==V)throw new Error("htmlHook() must be used as a child expression, e.g. html`<div>${myHook()}</div>`")}update(a,l){if(!ge(this,s,"f")||this.isConnected){if(ye(this,i,!0,"f"),ye(this,r,null,"f"),ge(this,n,"f"))ge(this,e,"f")?.onUpdate&&Ao(()=>ge(this,e,"f").onUpdate(...l));else{const s=Ao(()=>t(ge(this,o,"f"),...l));ye(this,e,s??null,"f"),ye(this,n,!0,"f")}if(ye(this,i,!1,"f"),null!==ge(this,r,"f")){const t=ge(this,r,"f");return ye(this,r,null,"f"),t}}else console.log("[htmlHook] UPDATE SKIPPED — disconnected & part detached")}render(...t){}disconnected(){ye(this,s,!0,"f"),ge(this,e,"f")?.onCleanup&&ge(this,e,"f").onCleanup(),ye(this,n,!1,"f"),ye(this,e,null,"f")}reconnected(){ge(this,s,"f")&&(ye(this,s,!1,"f"),ye(this,n,!1,"f"),ye(this,e,null,"f"))}});return(...t)=>a(...t)}const Mo=fo((t,e)=>{let n=e;const s=new IntersectionObserver(t=>{for(const e of t)e.isIntersecting?n.onVisible?.():n.onHidden?.()},{rootMargin:e.rootMargin??"0px",threshold:e.threshold??0});return s.observe(t.el),{onUpdate(t){n=t},onCleanup(){s.disconnect()}}});function $o(t){return Mo(t)}function xo(t,e){return Mo({onVisible:t,...e})}function To(t,e){return Mo({onHidden:t,...e})}const Ro=fo((t,e,n)=>{let s=e,i=!1,r=!0;const o=new IntersectionObserver(t=>{for(const e of t){const t=e.isIntersecting;if(r)return r=!1,void(i=t);t&&!i&&s(),i=t}},{rootMargin:n?.rootMargin??"0px",threshold:n?.threshold??0});return o.observe(t.el),{onUpdate(t,e){s=t},onCleanup(){o.disconnect(),i=!1,r=!0}}});function Oo(t,e){return Ro(t,e)}function Io(t,e){return Ro(t,e)}const Po=fo((t,e)=>{e(t.el)}),zo=fo((t,e)=>{let n=e;return{onUpdate(t){n=t},onCleanup(){n(t.el)}}});function Do(t){return Po(t)}function No(t){return zo(t)}fo((t,e)=>({onUpdate(e){e(t.el)}}));const Lo=ko((t,e,n,s,i)=>{function r(t,e,n){return"function"==typeof e?{keyFn:t,template:e,opts:n??{}}:{keyFn:null,template:t,opts:e??{}}}function o(t,e,n,s){const i=s.columns??3,r=s.gap??12,o=s.containerClass??"",a=[`column-count:${i}`,`column-gap:${r}px`,s.containerStyle??""].filter(Boolean).join(";"),l=["break-inside:avoid",`margin-bottom:${r}px`,"display:inline-block","width:100%","box-sizing:border-box"].join(";"),c=t,h=$t(c,e||((t,e)=>e),(t,e)=>b`
|
|
114
114
|
<div style="${l}">${n(t,e)}</div>
|
|
115
115
|
`);return b`
|
|
116
116
|
<div class="${o}" style="${a}">
|
|
@@ -157,21 +157,21 @@ ${s}</pre
|
|
|
157
157
|
* Copyright 2021 Google LLC
|
|
158
158
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
159
159
|
*/
|
|
160
|
-
class Ma{constructor(t){this._element=null;const e=t??window;this._node=e,t&&(this._element=t)}get element(){return this._element||document.scrollingElement||document.documentElement}get scrollTop(){return this.element.scrollTop||window.scrollY}get scrollLeft(){return this.element.scrollLeft||window.scrollX}get scrollHeight(){return this.element.scrollHeight}get scrollWidth(){return this.element.scrollWidth}get viewportHeight(){return this._element?this._element.getBoundingClientRect().height:window.innerHeight}get viewportWidth(){return this._element?this._element.getBoundingClientRect().width:window.innerWidth}get maxScrollTop(){return this.scrollHeight-this.viewportHeight}get maxScrollLeft(){return this.scrollWidth-this.viewportWidth}}class
|
|
160
|
+
class Ma{constructor(t){this._element=null;const e=t??window;this._node=e,t&&(this._element=t)}get element(){return this._element||document.scrollingElement||document.documentElement}get scrollTop(){return this.element.scrollTop||window.scrollY}get scrollLeft(){return this.element.scrollLeft||window.scrollX}get scrollHeight(){return this.element.scrollHeight}get scrollWidth(){return this.element.scrollWidth}get viewportHeight(){return this._element?this._element.getBoundingClientRect().height:window.innerHeight}get viewportWidth(){return this._element?this._element.getBoundingClientRect().width:window.innerWidth}get maxScrollTop(){return this.scrollHeight-this.viewportHeight}get maxScrollLeft(){return this.scrollWidth-this.viewportWidth}}class $a extends Ma{constructor(t,e){super(e),this._clients=new Set,this._retarget=null,this._end=null,this.__destination=null,this.correctingScrollError=!1,this._checkForArrival=this._checkForArrival.bind(this),this._updateManagedScrollTo=this._updateManagedScrollTo.bind(this),this.scrollTo=this.scrollTo.bind(this),this.scrollBy=this.scrollBy.bind(this);const n=this._node;this._originalScrollTo=n.scrollTo,this._originalScrollBy=n.scrollBy,this._originalScroll=n.scroll,this._attach(t)}get _destination(){return this.__destination}get scrolling(){return null!==this._destination}scrollTo(t,e){const n="number"==typeof t&&"number"==typeof e?{left:t,top:e}:t;this._scrollTo(n)}scrollBy(t,e){const n="number"==typeof t&&"number"==typeof e?{left:t,top:e}:t;void 0!==n.top&&(n.top+=this.scrollTop),void 0!==n.left&&(n.left+=this.scrollLeft),this._scrollTo(n)}_nativeScrollTo(t){this._originalScrollTo.bind(this._element||window)(t)}_scrollTo(t,e=null,n=null){null!==this._end&&this._end(),"smooth"===t.behavior?(this._setDestination(t),this._retarget=e,this._end=n):this._resetScrollState(),this._nativeScrollTo(t)}_setDestination(t){let{top:e,left:n}=t;return e=void 0===e?void 0:Math.max(0,Math.min(e,this.maxScrollTop)),n=void 0===n?void 0:Math.max(0,Math.min(n,this.maxScrollLeft)),(null===this._destination||n!==this._destination.left||e!==this._destination.top)&&(this.__destination={top:e,left:n,behavior:"smooth"},!0)}_resetScrollState(){this.__destination=null,this._retarget=null,this._end=null}_updateManagedScrollTo(t){this._destination&&this._setDestination(t)&&this._nativeScrollTo(this._destination)}managedScrollTo(t,e,n){return this._scrollTo(t,e,n),this._updateManagedScrollTo}correctScrollError(t){this.correctingScrollError=!0,requestAnimationFrame(()=>requestAnimationFrame(()=>this.correctingScrollError=!1)),this._nativeScrollTo(t),this._retarget&&this._setDestination(this._retarget()),this._destination&&this._nativeScrollTo(this._destination)}_checkForArrival(){if(null!==this._destination){const{scrollTop:t,scrollLeft:e}=this;let{top:n,left:s}=this._destination;n=Math.min(n||0,this.maxScrollTop),s=Math.min(s||0,this.maxScrollLeft);const i=Math.abs(n-t),r=Math.abs(s-e);i<1&&r<1&&(this._end&&this._end(),this._resetScrollState())}}detach(t){return this._clients.delete(t),0===this._clients.size&&(this._node.scrollTo=this._originalScrollTo,this._node.scrollBy=this._originalScrollBy,this._node.scroll=this._originalScroll,this._node.removeEventListener("scroll",this._checkForArrival)),null}_attach(t){this._clients.add(t),1===this._clients.size&&(this._node.scrollTo=this.scrollTo,this._node.scrollBy=this.scrollBy,this._node.scroll=this.scrollTo,this._node.addEventListener("scroll",this._checkForArrival))}}
|
|
161
161
|
/**
|
|
162
162
|
* @license
|
|
163
163
|
* Copyright 2021 Google LLC
|
|
164
164
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
165
|
-
*/let
|
|
165
|
+
*/let xa="undefined"!=typeof window?window.ResizeObserver:void 0;const Ta=Symbol("virtualizerRef"),Ra="virtualizer-sizer";let Oa;class Ia{constructor(t){if(this._benchmarkStart=null,this._layout=null,this._clippingAncestors=[],this._scrollSize=null,this._scrollError=null,this._childrenPos=null,this._childMeasurements=null,this._toBeMeasured=new Map,this._rangeChanged=!0,this._itemsChanged=!0,this._visibilityChanged=!0,this._scrollerController=null,this._isScroller=!1,this._sizer=null,this._hostElementRO=null,this._childrenRO=null,this._mutationObserver=null,this._scrollEndRafId=null,this._scrollEventListeners=[],this._scrollEventListenerOptions={passive:!0},this._loadListener=this._childLoaded.bind(this),this._scrollIntoViewTarget=null,this._updateScrollIntoViewCoordinates=null,this._items=[],this._first=-1,this._last=-1,this._firstVisible=-1,this._lastVisible=-1,this._scheduled=new Map,this._measureCallback=null,this._measureChildOverride=null,this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null,this._layoutInitialized=null,this._connected=!1,!t)throw new Error("Virtualizer constructor requires a configuration object");if(!t.hostElement)throw new Error('Virtualizer configuration requires the "hostElement" property');this._init(t)}set items(t){Array.isArray(t)&&t!==this._items&&(this._itemsChanged=!0,this._items=t,this._schedule(this._updateLayout))}_init(t){this._isScroller=!!t.scroller,this._initHostElement(t);const e=t.layout||{};this._layoutInitialized=this._initLayout(e)}_initObservers(){this._mutationObserver=new MutationObserver(this._finishDOMUpdate.bind(this)),this._hostElementRO=new xa(()=>this._hostElementSizeChanged()),this._childrenRO=new xa(this._childrenSizeChanged.bind(this))}_initHostElement(t){this._hostElement=t.hostElement;const e=this._hostElement;this._applyVirtualizerStyles(),e[Ta]=this}connected(){this._initObservers();const t=this._isScroller;this._clippingAncestors=function(t,e=!1){let n=!1;return function(t,e=!1){const n=[];let s=e?t:za(t);for(;null!==s;)n.push(s),s=za(s);return n}(t,e).filter(t=>{if(n)return!1;const e=getComputedStyle(t);return n="fixed"===e.position,"visible"!==e.overflow})}
|
|
166
166
|
/**
|
|
167
167
|
* @license
|
|
168
168
|
* Copyright 2021 Google LLC
|
|
169
169
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
170
|
-
*/(this._hostElement,t),this._scrollerController=new xa(this,this._clippingAncestors[0]),this._schedule(this._updateLayout),this._observeAndListen(),this._connected=!0}_observeAndListen(){this._mutationObserver.observe(this._hostElement,{childList:!0}),this._hostElementRO.observe(this._hostElement),this._scrollEventListeners.push(window),window.addEventListener("scroll",this,this._scrollEventListenerOptions),this._clippingAncestors.forEach(t=>{t.addEventListener("scroll",this,this._scrollEventListenerOptions),this._scrollEventListeners.push(t),this._hostElementRO.observe(t)}),this._hostElementRO.observe(this._scrollerController.element),this._children.forEach(t=>this._childrenRO.observe(t)),this._scrollEventListeners.forEach(t=>t.addEventListener("scroll",this,this._scrollEventListenerOptions))}disconnected(){this._scrollEventListeners.forEach(t=>t.removeEventListener("scroll",this,this._scrollEventListenerOptions)),null!==this._scrollEndRafId&&(cancelAnimationFrame(this._scrollEndRafId),this._scrollEndRafId=null),this._scrollEventListeners=[],this._clippingAncestors=[],this._scrollerController?.detach(this),this._scrollerController=null,this._mutationObserver?.disconnect(),this._mutationObserver=null,this._hostElementRO?.disconnect(),this._hostElementRO=null,this._childrenRO?.disconnect(),this._childrenRO=null,this._rejectLayoutCompletePromise("disconnected"),this._connected=!1}_applyVirtualizerStyles(){const t=this._hostElement.style;t.display=t.display||"block",t.position=t.position||"relative",t.contain=t.contain||"size layout",this._isScroller&&(t.overflow=t.overflow||"auto",t.minHeight=t.minHeight||"150px")}_getSizer(){const t=this._hostElement;if(!this._sizer){let e=t.querySelector(`[${Ra}]`);e||(e=document.createElement("div"),e.setAttribute(Ra,""),t.appendChild(e)),Object.assign(e.style,{position:"absolute",margin:"-2px 0 0 0",padding:0,visibility:"hidden",fontSize:"2px"}),e.textContent=" ",e.setAttribute(Ra,""),this._sizer=e}return this._sizer}async updateLayoutConfig(t){await this._layoutInitialized;const e=t.type||Oa;if("function"==typeof e&&this._layout instanceof e){const e={...t};return delete e.type,this._layout.config=e,!0}return!1}async _initLayout(t){let e,n;if("function"==typeof t.type){n=t.type;const s={...t};delete s.type,e=s}else e=t;void 0===n&&(Oa=n=(await Promise.resolve().then(function(){return ya})).FlowLayout),this._layout=new n(t=>this._handleLayoutMessage(t),e),this._layout.measureChildren&&"function"==typeof this._layout.updateItemSizes&&("function"==typeof this._layout.measureChildren&&(this._measureChildOverride=this._layout.measureChildren),this._measureCallback=this._layout.updateItemSizes.bind(this._layout)),this._layout.listenForChildLoadEvents&&this._hostElement.addEventListener("load",this._loadListener,!0),this._schedule(this._updateLayout)}startBenchmarking(){null===this._benchmarkStart&&(this._benchmarkStart=window.performance.now())}stopBenchmarking(){if(null!==this._benchmarkStart){const t=window.performance.now(),e=t-this._benchmarkStart,n=performance.getEntriesByName("uv-virtualizing","measure").filter(e=>e.startTime>=this._benchmarkStart&&e.startTime<t).reduce((t,e)=>t+e.duration,0);return this._benchmarkStart=null,{timeElapsed:e,virtualizationTime:n}}return null}_measureChildren(){const t={},e=this._children,n=this._measureChildOverride||this._measureChild;for(let s=0;s<e.length;s++){const i=e[s],r=this._first+s;(this._itemsChanged||this._toBeMeasured.has(i))&&(t[r]=n.call(this,i,this._items[r]))}this._childMeasurements=t,this._schedule(this._updateLayout),this._toBeMeasured.clear()}_measureChild(t){const{width:e,height:n}=t.getBoundingClientRect();return Object.assign({width:e,height:n},function(t){const e=window.getComputedStyle(t);return{marginTop:Pa(e.marginTop),marginRight:Pa(e.marginRight),marginBottom:Pa(e.marginBottom),marginLeft:Pa(e.marginLeft)}}(t))}_schedule(t){const e=this._scheduled.get(t);void 0!==e&&cancelAnimationFrame(e);const n=requestAnimationFrame(()=>{this._scheduled.delete(t),t.call(this)});this._scheduled.set(t,n)}async _updateDOM(t){this._scrollSize=t.scrollSize,this._adjustRange(t.range),this._childrenPos=t.childPositions,this._scrollError=t.scrollError||null;const{_rangeChanged:e,_itemsChanged:n}=this;this._visibilityChanged&&(this._notifyVisibility(),this._visibilityChanged=!1),(e||n)&&(this._notifyRange(),this._rangeChanged=!1),this._finishDOMUpdate()}_finishDOMUpdate(){this._connected&&(this._children.forEach(t=>this._childrenRO.observe(t)),this._checkScrollIntoViewTarget(this._childrenPos),this._positionChildren(this._childrenPos),this._sizeHostElement(this._scrollSize),this._correctScrollError(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_updateLayout(){this._layout&&this._connected&&(this._layout.items=this._items,this._updateView(),null!==this._childMeasurements&&(this._measureCallback&&this._measureCallback(this._childMeasurements),this._childMeasurements=null),this._layout.reflowIfNeeded(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_handleScrollEvent(){if(this._benchmarkStart&&"mark"in window.performance){try{window.performance.measure("uv-virtualizing","uv-start","uv-end")}catch(t){console.warn("Error measuring performance data: ",t)}window.performance.mark("uv-start")}!1===this._scrollerController.correctingScrollError&&this._layout?.unpin(),this._schedule(this._updateLayout),null!==this._scrollEndRafId&&cancelAnimationFrame(this._scrollEndRafId),this._scrollEndRafId=requestAnimationFrame(()=>{this._scrollEndRafId=null,this._connected&&this._updateLayout()})}handleEvent(t){if("scroll"===t.type)(t.currentTarget===window||this._clippingAncestors.includes(t.currentTarget))&&this._handleScrollEvent();else console.warn("event not handled",t)}_handleLayoutMessage(t){"stateChanged"===t.type?this._updateDOM(t):"visibilityChanged"===t.type?(this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._notifyVisibility()):"unpinned"===t.type&&this._hostElement.dispatchEvent(new ka)}get _children(){const t=[];let e=this._hostElement.firstElementChild;for(;e;)e.hasAttribute(Ra)||t.push(e),e=e.nextElementSibling;return t}_updateView(){const t=this._hostElement,e=this._scrollerController?.element,n=this._layout;if(t&&e&&n){let s,i,r,o;const a=t.getBoundingClientRect();s=0,i=0,r=window.innerHeight,o=window.innerWidth;const l=this._clippingAncestors.map(t=>t.getBoundingClientRect());l.unshift(a);for(const t of l)s=Math.max(s,t.top),i=Math.max(i,t.left),r=Math.min(r,t.bottom),o=Math.min(o,t.right);const c=e.getBoundingClientRect(),h={left:a.left-c.left,top:a.top-c.top},u={width:e.scrollWidth,height:e.scrollHeight},d=s-a.top+t.scrollTop,f=i-a.left+t.scrollLeft,p=Math.max(0,r-s),m=Math.max(0,o-i);n.viewportSize={width:m,height:p},n.viewportScroll={top:d,left:f},n.totalScrollSize=u,n.offsetWithinScroller=h}}_sizeHostElement(t){const e=82e5,n=t&&null!==t.width?Math.min(e,t.width):0,s=t&&null!==t.height?Math.min(e,t.height):0;if(this._isScroller)this._getSizer().style.transform=`translate(${n}px, ${s}px)`;else{const t=this._hostElement.style;t.minWidth=n?`${n}px`:"100%",t.minHeight=s?`${s}px`:"100%"}}_positionChildren(t){t&&t.forEach(({top:t,left:e,width:n,height:s,xOffset:i,yOffset:r},o)=>{const a=this._children[o-this._first];a&&(a.style.position="absolute",a.style.boxSizing="border-box",a.style.transform=`translate(${e}px, ${t}px)`,void 0!==n&&(a.style.width=`${n}px`),void 0!==s&&(a.style.height=`${s}px`),a.style.left=void 0===i?null:`${i}px`,a.style.top=void 0===r?null:`${r}px`)})}async _adjustRange(t){const{_first:e,_last:n,_firstVisible:s,_lastVisible:i}=this;this._first=t.first,this._last=t.last,this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._rangeChanged=this._rangeChanged||this._first!==e||this._last!==n,this._visibilityChanged=this._visibilityChanged||this._firstVisible!==s||this._lastVisible!==i}_correctScrollError(){if(this._scrollError){const{scrollTop:t,scrollLeft:e}=this._scrollerController,{top:n,left:s}=this._scrollError;this._scrollError=null,this._scrollerController.correctScrollError({top:t-n,left:e-s})}}element(t){return t===1/0&&(t=this._items.length-1),void 0===this._items?.[t]?void 0:{scrollIntoView:(e={})=>this._scrollElementIntoView({...e,index:t})}}_scrollElementIntoView(t){if(t.index>=this._first&&t.index<=this._last)this._children[t.index-this._first].scrollIntoView(t);else if(t.index=Math.min(t.index,this._items.length-1),"smooth"===t.behavior){const e=this._layout.getScrollIntoViewCoordinates(t),{behavior:n}=t;this._updateScrollIntoViewCoordinates=this._scrollerController.managedScrollTo(Object.assign(e,{behavior:n}),()=>this._layout.getScrollIntoViewCoordinates(t),()=>this._scrollIntoViewTarget=null),this._scrollIntoViewTarget=t}else this._layout.pin=t}_checkScrollIntoViewTarget(t){const{index:e}=this._scrollIntoViewTarget||{};e&&t?.has(e)&&this._updateScrollIntoViewCoordinates(this._layout.getScrollIntoViewCoordinates(this._scrollIntoViewTarget))}_notifyRange(){this._hostElement.dispatchEvent(new Ca({first:this._first,last:this._last}))}_notifyVisibility(){this._hostElement.dispatchEvent(new Aa({first:this._firstVisible,last:this._lastVisible}))}get layoutComplete(){return this._layoutCompletePromise||(this._layoutCompletePromise=new Promise((t,e)=>{this._layoutCompleteResolver=t,this._layoutCompleteRejecter=e})),this._layoutCompletePromise}_rejectLayoutCompletePromise(t){null!==this._layoutCompleteRejecter&&this._layoutCompleteRejecter(t),this._resetLayoutCompleteState()}_scheduleLayoutComplete(){this._layoutCompletePromise&&null===this._pendingLayoutComplete&&(this._pendingLayoutComplete=requestAnimationFrame(()=>requestAnimationFrame(()=>this._resolveLayoutCompletePromise())))}_resolveLayoutCompletePromise(){null!==this._layoutCompleteResolver&&this._layoutCompleteResolver(),this._resetLayoutCompleteState()}_resetLayoutCompleteState(){this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null}_hostElementSizeChanged(){this._schedule(this._updateLayout)}_childLoaded(){}_childrenSizeChanged(t){if(this._layout?.measureChildren){for(const e of t)this._toBeMeasured.set(e.target,e.contentRect);this._measureChildren()}this._scheduleLayoutComplete(),this._itemsChanged=!1,this._rangeChanged=!1}}function Pa(t){const e=t?parseFloat(t):NaN;return Number.isNaN(e)?0:e}function za(t){if(null!==t.assignedSlot)return t.assignedSlot;if(null!==t.parentElement)return t.parentElement;const e=t.parentNode;return e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host||null}const Da=Y(class extends ut{constructor(t){if(super(t),this._virtualizer=null,this._first=0,this._last=-1,this._renderItem=(t,e)=>((t,e)=>b`${e}: ${JSON.stringify(t,null,2)}`)(t,e+this._first),this._keyFunction=(t,e)=>(t=>t)(t,this._first),this._items=[],t.type!==V)throw new Error("The virtualize directive can only be used in child expressions")}render(t){t&&this._setFunctions(t);const e=[];if(this._first>=0&&this._last>=this._first)for(let t=this._first;t<=this._last;t++)e.push(this._items[t]);return xt(e,this._keyFunction,this._renderItem)}update(t,[e]){this._setFunctions(e);const n=this._items!==e.items;return this._items=e.items||[],this._virtualizer?this._updateVirtualizerConfig(t,e):this._initialize(t,e),n?E:this.render()}async _updateVirtualizerConfig(t,e){if(!await this._virtualizer.updateLayoutConfig(e.layout||{})){const n=t.parentNode;this._makeVirtualizer(n,e)}this._virtualizer.items=this._items}_setFunctions(t){const{renderItem:e,keyFunction:n}=t;e&&(this._renderItem=(t,n)=>e(t,n+this._first)),n&&(this._keyFunction=(t,e)=>n(t,e+this._first))}_makeVirtualizer(t,e){this._virtualizer&&this._virtualizer.disconnected();const{layout:n,scroller:s,items:i}=e;this._virtualizer=new Ia({hostElement:t,layout:n,scroller:s}),this._virtualizer.items=i,this._virtualizer.connected()}_initialize(t,e){const n=t.parentNode;n&&1===n.nodeType&&(n.addEventListener("rangeChanged",t=>{this._first=t.first,this._last=t.last,this.setValue(this.render())}),this._makeVirtualizer(n,e))}disconnected(){this._virtualizer?.disconnected()}reconnected(){this._virtualizer?.connected()}});function Na(t,e,n,s){const{keyFn:i,template:r,opts:o}=ja(e,n,s),a={direction:o?.direction??"vertical",...o?.pin?{pin:o.pin}:{}};return Da({items:t,renderItem:r,keyFunction:i,scroller:o?.scroller,layout:ua(a)})}function La(t,e,n,s){const{keyFn:i,template:r,opts:o}=ja(e,n,s),a={direction:o.direction??"vertical",getAspectRatio:o.getAspectRatio,gap:o.gap??"8px",flex:!0,...o.itemSize?{itemSize:o.itemSize}:{},...o.pin?{pin:o.pin}:{}};return Da({items:t,renderItem:r,keyFunction:i,scroller:o.scroller,layout:(l=a,Object.assign({type:Ea},l))});var l}function ja(t,e,n){return"function"==typeof e?{keyFn:t,template:e,opts:n}:{keyFn:void 0,template:t,opts:e}}function Fa(t){return new Promise((e,n)=>{t.onsuccess=()=>e(t.result),t.onerror=()=>n(t.error)})}function Ua(t,e,n){return new Promise((s,i)=>{const r=[];let o=!1;t.onsuccess=()=>{const i=t.result;if(i){if(e>0&&!o)return o=!0,void i.advance(e);r.push(i.value),null!==n&&r.length>=n?s(r):i.continue()}else s(r)},t.onerror=()=>i(t.error)})}const Va={equals:t=>IDBKeyRange.only(t),greaterThan:t=>IDBKeyRange.lowerBound(t,!0),greaterThanOrEqual:t=>IDBKeyRange.lowerBound(t,!1),lessThan:t=>IDBKeyRange.upperBound(t,!0),lessThanOrEqual:t=>IDBKeyRange.upperBound(t,!1),between:(t,e,n)=>IDBKeyRange.bound(t,e,n?.lowerOpen??!1,n?.upperOpen??!1),startsWith:t=>IDBKeyRange.bound(t,t+"",!1,!1)};class Wa{constructor(t,e,n,s,i,r){this._db=t,this._storeName=e,this._pk=n,this._indexQuery=s,this._indexSort=i,this._page=r}filterByIndex(t,e){return new Wa(this._db,this._storeName,this._pk,{indexName:t,range:e(Va)},this._indexSort,this._page)}sortByIndex(t,e="asc"){return new Wa(this._db,this._storeName,this._pk,this._indexQuery,{indexName:t,direction:"desc"===e?"prev":"next"},this._page)}async toArray(){const t=new Wa(this._db,this._storeName,this._pk,this._indexQuery,this._indexSort,null);return Ba(await t._run(),t)}async page(t,e){const n=new Wa(this._db,this._storeName,this._pk,this._indexQuery,this._indexSort,{num:t,size:e});return Ba(await n._run(),n)}async _run(){const t=this._db.transaction(this._storeName,"readonly").objectStore(this._storeName),e=null!==this._indexQuery,n=null!==this._indexSort,s=this._page?(this._page.num-1)*this._page.size:0,i=this._page?this._page.size:null;if(!e&&!n)return this._page?Ua(t.openCursor(),s,i):Fa(t.getAll());const r=this._indexQuery.indexName,o=this._indexQuery?.range??null,a=this._indexSort.indexName,l=this._indexSort.direction;if(n&&(!e||r===a)){const n=e?o:null;return Ua(t.index(a).openCursor(n,l),s,i)}let c=await Fa(t.index(r).getAll(o));if(n){const t=a,e="prev"===l?-1:1;c.sort((n,s)=>{const i=n[t],r=s[t];return(i<r?-1:i>r?1:0)*e})}return this._page&&(c=c.slice(s,s+i)),c}}function Ba(t,e){const{_db:n,_storeName:s,_pk:i}=e,r=Es(t,{skipRestrictedContextCheck:!0}),o=r;return o.updateItem=async(t,e)=>{const o=r.get().find(e=>e[i]===t);null!=o&&"object"==typeof o&&(e(o),await Fa(n.transaction(s,"readwrite").objectStore(s).put(o)),r.update(()=>{}))},o.setItem=async(t,e)=>{await Fa(n.transaction(s,"readwrite").objectStore(s).put(e)),r.update(n=>{const s=n.findIndex(e=>e[i]===t);-1!==s&&(n[s]=e)})},o.removeItem=async t=>{await Fa(n.transaction(s,"readwrite").objectStore(s).delete(t)),r.update(e=>{const n=e.findIndex(e=>e[i]===t);-1!==n&&e.splice(n,1)})},o.refresh=async()=>{r.set(await e._run())},Object.defineProperty(o,"name",{value:"dbTableAtom",writable:!0,configurable:!0,enumerable:!1}),o}function Ha(t,e,n,s){const i=new Wa(t,e,n,null,null,null),r=()=>s?s.objectStore(e):t.transaction(e,"readonly").objectStore(e),o=()=>s?s.objectStore(e):t.transaction(e,"readwrite").objectStore(e);return{filterByIndex:(t,e)=>i.filterByIndex(t,e),sortByIndex:(t,e)=>i.sortByIndex(t,e),toArray:()=>i.toArray(),page:(t,e)=>i.page(t,e),add:t=>Fa(o().add(t)),set:async(t,e)=>{await Fa(o().put(e))},update:async(n,i)=>{const r=s?s.objectStore(e):t.transaction(e,"readwrite").objectStore(e),o=await Fa(r.get(n));null!=o&&(i(o),await Fa(r.put(o)))},delete:async t=>{await Fa(o().delete(t))},clear:async()=>{await Fa(o().clear())},count:()=>Fa(r().count()),get:t=>Fa(r().get(t)),has:async t=>void 0!==await Fa(r().getKey(t))}}function Ya(t,e){return Pe()?Promise.reject(new Error("[indexDB] IndexedDB is not available in SSR environments.")):new Promise((n,s)=>{const i=indexedDB.open(t,e.version);i.onupgradeneeded=t=>{const n=i.result,s=i.transaction;e.upgrade&&e.upgrade(function(t,e){return{createTable(e,n,s=[]){if(t.objectStoreNames.contains(e))return;const i=t.createObjectStore(e,{keyPath:n});for(const t of s)i.createIndex(t,t,{unique:!1})},addIndex(n,s,i){if(!t.objectStoreNames.contains(n))return;const r=e.objectStore(n);r.indexNames.contains(s)||r.createIndex(s,s,i??{unique:!1})},removeIndex(n,s){if(!t.objectStoreNames.contains(n))return;const i=e.objectStore(n);i.indexNames.contains(s)&&i.deleteIndex(s)},dropTable(e){t.objectStoreNames.contains(e)&&t.deleteObjectStore(e)}}}(n,s),t.oldVersion)},i.onsuccess=()=>{const e=i.result;e.onversionchange=()=>{e.close(),console.warn(`[indexDB] "${t}" connection closed — version change detected. Reload the page to upgrade.`)};const s={table:(t,n)=>Ha(e,t,n),transaction:(t,n)=>new Promise((s,i)=>{const r=e.transaction(t,"readwrite"),o={table:(t,n)=>Ha(e,t,n,r)};r.oncomplete=()=>s(),r.onerror=()=>i(r.error),r.onabort=()=>i(new Error(`[indexDB] Transaction on [${t.join(", ")}] aborted`)),n(o).catch(t=>{try{r.abort()}catch{}i(t)})}),close(){e.close()}};n(s)},i.onerror=()=>s(i.error),i.onblocked=()=>{console.warn(`[indexDB] Opening "${t}" is blocked — close other connections first.`)}})}function qa(){const t=new Uint8Array(16);if("undefined"!=typeof crypto&&crypto.getRandomValues)crypto.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=256*Math.random()|0;t[6]=15&t[6]|64,t[8]=63&t[8]|128;const e=Array.from(t).map(t=>t.toString(16).padStart(2,"0")).join("");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20,32)}`}function Xa(){return{list:t=>Promise.resolve(function(){function t(){return[]}return t.get=t=>{},t.has=t=>!1,t.add=async t=>"",t.set=async(t,e)=>{},t.update=async(t,e)=>{},t.deleteRow=async t=>{},t.clear=async()=>{},Object.defineProperty(t,"size",{get:()=>0,enumerable:!0,configurable:!0}),t}())}}const Za="mini-db",Ga="mini-db:v";function Ka(t){return new Promise((e,n)=>{t.onsuccess=()=>e(t.result),t.onerror=()=>n(t.error)})}function Qa(t,e,n){return new Promise((s,i)=>{const r=e?indexedDB.open(t,e):indexedDB.open(t);r.onupgradeneeded=()=>n?.(r.result),r.onsuccess=()=>s(r.result),r.onerror=()=>i(r.error),r.onblocked=()=>console.warn("[miniDB] Open blocked — close other connections first.")})}function Ja(t){t.current.onversionchange=async()=>{t.current.close(),t.current=await Qa(Za),Ja(t)}}async function tl(t,e,n){const s=await Ka(t.current.transaction(e,"readonly").objectStore(e).getAll()),i=cr(s.map(t=>[String(t.id),t])),r=n=>Ka(t.current.transaction(e,"readwrite").objectStore(e).put(n));n&&n.addEventListener("message",t=>{const n=t.data;n&&n.store===e&&("set"===n.op?i.set(n.key,n.item):"delete"===n.op?i.delete(n.key):"clear"===n.op&&i.clear())});const o=t=>{try{n?.postMessage(t)}catch{}};function a(){return Array.from(i.values())}return a.get=t=>i.get(t),a.has=t=>i.has(t),a.add=async t=>{const n=String(t.id??qa()),s={...t,id:n};return await r(s),i.set(n,s),o({store:e,op:"set",key:n,item:s}),n},a.set=async(t,n)=>{const s={...n,id:t};await r(s),i.set(t,s),o({store:e,op:"set",key:t,item:s})},a.update=async(t,n)=>{const s=i.get(t);s&&(i.updateItem(t,n),await r(s),o({store:e,op:"set",key:t,item:s}))},a.deleteRow=async n=>{await(n=>Ka(t.current.transaction(e,"readwrite").objectStore(e).delete(n)))(n),i.delete(n),o({store:e,op:"delete",key:n})},a.clear=async()=>{await Ka(t.current.transaction(e,"readwrite").objectStore(e).clear()),i.clear(),o({store:e,op:"clear"})},Object.defineProperty(a,"size",{get:()=>i.size,enumerable:!0,configurable:!0}),a}async function el(t=1,e){if(Pe())return Xa();const n={current:await Qa(Za)};Ja(n);const s="undefined"!=typeof BroadcastChannel?new BroadcastChannel(Za):null,i=function(){try{return parseInt(localStorage.getItem(Ga)??"0",10)||0}catch{return 0}}();if(i!==t){if(e){const s=[];e(i,t,{clear:t=>s.push(t)});for(const t of s)n.current.objectStoreNames.contains(t)&&await Ka(n.current.transaction(t,"readwrite").objectStore(t).clear())}!function(t){try{localStorage.setItem(Ga,String(t))}catch{}}(t)}const r=new Map;return{async list(t){if(r.has(t))return r.get(t);n.current.objectStoreNames.contains(t)||(n.current=await async function(t,e){const n=t.name,s=t.version+1;return t.close(),Qa(n,s,t=>{t.objectStoreNames.contains(e)||t.createObjectStore(e,{keyPath:"id"})})}(n.current,t),Ja(n));const e=await tl(n,t,s);return r.set(t,e),e}}}function nl(t,e,n,s=!1){document.addEventListener(t,e,{capture:s}),n.addToCleanUps(e,()=>{document.removeEventListener(t,e,{capture:s})})}function sl(t,e,n,s){let i;if("wheelUp"===t||"wheelDown"===t){const r="wheelUp"===t,o=e,a=t=>{(r?t.deltaY>=0:t.deltaY<=0)||(i&&i(),i=o(t))};return window.addEventListener("wheel",a,{capture:n,passive:!0}),void s.addToCleanUps(e,()=>{window.removeEventListener("wheel",a,{capture:n}),i&&i()})}const r="scroll"===t||"touchstart"===t||"touchmove"===t,o=e,a=t=>{i&&i(),i=o(t)};window.addEventListener(t,a,{capture:n,passive:r}),s.addToCleanUps(e,()=>{window.removeEventListener(t,a,{capture:n}),i&&i()})}function il(t,e){Pe()||(Xe(),sl(t,e,!1,Me()))}function rl(t,e){Pe()||(Xe(),sl(t,e,!0,Me()))}const ol=t=>{rl("scroll",t)},al=t=>{il("blur",t)},ll=t=>{il("focus",t)},cl=t=>{il("online",t)},hl=t=>{il("offline",t)},ul=t=>{il("resize",t)},dl=t=>{il("paste",t)},fl=t=>{il("copy",t)},pl=t=>{il("cut",t)},ml=t=>{il("keydown",t)},_l=t=>{il("keyup",t)},gl=t=>{if(Pe())return;Xe();let e;nl("visibilitychange",()=>{e&&e(),e=t(document.hidden)},Me())},yl=t=>{if(Pe())return;Xe();let e;nl("selectionchange",()=>{e&&e(),e=t(window.getSelection())},Me())},wl=t=>{il("storage",t)},vl=t=>{if(Pe())return;Xe();const e=Me();let n;const s=t=>t.preventDefault(),i=e=>{e.preventDefault(),n&&n(),n=t(e)};window.addEventListener("dragover",s),window.addEventListener("drop",i),e.addToCleanUps(t,()=>{window.removeEventListener("dragover",s),window.removeEventListener("drop",i),n&&n()})},bl=t=>{if(Pe())return;Xe();const e=Me(!0),n=n=>{const s=n.target;s&&!e.contains(s)&&t(n)};document.addEventListener("mousedown",n,!0),e.addToCleanUps(t,()=>{document.removeEventListener("mousedown",n,!0)})},Sl=(t,e=window)=>{if(Pe())return;Xe();const n=Me();let s;const i=e=>{s&&s(),s=t(e)};e.addEventListener("scroll",i,{passive:!0}),n.addToCleanUps(t,()=>{e.removeEventListener("scroll",i),s&&s()})},El=(t,e)=>{if(Pe())return;Xe();const n=Me();let s;const i=new ResizeObserver(e=>{for(const n of e)s&&s(),s=t(n)}),r=e||n;i.observe(r),n.addToCleanUps(t,()=>{i.disconnect(),s&&s()})},Cl=t=>{if(Pe())return;Xe();const e=Me(),{pathAtom:n}=Ur(Xi);let s;const i=n.__subscribe(()=>{s&&s(),s=t(n.get())||null});e.addToCleanUps(t,()=>{i(),s&&s()})},Al=(t,e)=>{if(Pe())return;Xe();const n=Me();let s;const i=setInterval(()=>{s&&s(),s=t()},e);n.addToCleanUps(t,()=>{clearInterval(i),s&&s()})},kl=(t,e)=>{if(Pe())return;Xe();const n=Me();let s;const i=setTimeout(()=>{s=t()},e);n.addToCleanUps(t,()=>{clearTimeout(i),s&&s()})};function Ml(t,e){Xe();const n=Me(),s=e.map(e=>e.__subscribe(t));n.addToCleanUps(t,()=>{s.forEach(t=>t())})}const xl=t=>{Xe();const e=Me();let n;e.onEachUpdate(()=>{n&&n(),n=t()}),e.addToCleanUps(t,()=>{n&&n()})},$l=t=>{const e=Me();if(!e)throw new Error("onDOMReady must be called within a component context");return e.DOMReadyEvent.__subscribe(t)},Tl=ko((t,e,n)=>{const s=document.createElement("div");Object.assign(s.style,{position:"fixed",inset:"0",zIndex:"9999",display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.5)"}),n?.style&&Object.assign(s.style,n.style),n?.onBackdropClick&&s.addEventListener("click",t=>{t.target===s&&n.onBackdropClick()});const i=document.createElement("div");n?.dialogStyle&&Object.assign(i.style,n.dialogStyle),i.addEventListener("click",t=>t.stopPropagation()),F(e,i),s.appendChild(i),document.body.appendChild(s);const r=document.body.style.overflow;return document.body.style.overflow="hidden",{onUpdate(t){F(t,i)},onCleanup(){s.remove(),document.body.style.overflow=r}}});function Rl(t,e){return Tl(t,e)}const Ol={position:"fixed",display:"none",margin:"0"},Il="9999";function Pl(t={}){const{style:e,target:n,zIndex:s=Il}=t,i=document.createElement("div");for(const[t,e]of Object.entries(Ol))i.style[t]=e;i.style.zIndex=String(s),e&&Object.assign(i.style,e);return{el:i,attach:()=>{i.isConnected||function(t){return t?"string"==typeof t?document.querySelector(t)??document.body:t:document.body}(n).appendChild(i)},detach:()=>{i.isConnected&&i.remove()},isAttached:()=>i.isConnected}}function zl(t,e,n,s,i,r,o){return t.startsWith("top")?s>=n:t.startsWith("bottom")?i>=n:t.startsWith("left")?r>=e:!!t.startsWith("right")&&o>=e}function Dl(t,e,n,s,i,r){const o=window.innerWidth,a=function(t){let e=t.parentElement;for(;e&&e!==document.documentElement;){const{overflowY:t}=window.getComputedStyle(e),n="auto"===t||"scroll"===t,s=e.scrollHeight>e.clientHeight;if(n&&s)return e;e=e.parentElement}return null}(t);let l,c;if(a){const t=a.getBoundingClientRect(),n=a.scrollHeight-a.scrollTop-a.clientHeight;c=t.bottom-e.bottom+n-i;const s=a.scrollTop;l=e.top-t.top+s-i}else{const t=window.scrollY||document.documentElement.scrollTop,n=document.documentElement.scrollHeight;l=e.top+t-i,c=n-(e.bottom+t)-i}const h=e.left-i,u=o-e.right-i;if("auto"===r){const t=["bottom-start","top-start","right","left"];for(const e of t)if(zl(e,n,s,l,c,h,u))return e;return"bottom-start"}if(zl(r,n,s,l,c,h,u))return r;const d=function(t){return t.startsWith("top")?t.replace("top","bottom"):t.startsWith("bottom")?t.replace("bottom","top"):t.startsWith("left")?t.replace("left","right"):t.startsWith("right")?t.replace("right","left"):t}(r);return zl(d,n,s,l,c,h,u)?d:r}const Nl=fo((t,e,n)=>{const s=t.el;let i=!1,r=e,o=n;console.log("[popup] MOUNT — anchor:",s,"destroyOnClose:",!!n.destroyOnClose);const a=Pl({...void 0!==o.zIndex?{zIndex:o.zIndex}:{},style:{background:"var(--md-color-surface-raised,#fff)",boxShadow:"var(--md-shadow-dropdown,0 5px 5px -3px rgba(0,0,0,.20),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12))",minWidth:"160px",...o.style??{}}}),l=a.el;o.destroyOnClose;const c=()=>{const t=s.getBoundingClientRect();l.style.visibility="hidden",l.style.display="block",o.matchAnchorWidth&&(l.style.width=`${t.width}px`);const e=l.offsetWidth,n=l.offsetHeight,i=Dl(s,t,e,n,o.gap??4,o.position??"bottom-start");!function(t,e,n,s,i,r){const o=window.innerWidth,a=window.innerHeight;let l=0,c=0;n.startsWith("bottom")?l=e.bottom+r:n.startsWith("top")?l=e.top-r-i:"right"===n||"left"===n?l=e.top+e.height/2-i/2:n.endsWith("-start")?l=e.top:n.endsWith("-end")&&(l=e.bottom-i),"bottom"===n||"top"===n?c=e.left+e.width/2-s/2:n.endsWith("-start")?c=n.startsWith("right")?e.right+r:n.startsWith("left")?e.left-r-s:e.left:n.endsWith("-end")?c=n.startsWith("right")?e.right+r:n.startsWith("left")?e.left-r-s:e.right-s:n.startsWith("right")?c=e.right+r:n.startsWith("left")&&(c=e.left-r-s);const h=Math.max(4,Math.min(c,o-s-4)),u=Math.max(4,Math.min(l,a-i-4)),d=parseInt(String(h),10),f=parseInt(String(u),10);t.style.left=`${d}px`,t.style.top=`${f}px`}(l,t,i,e,n,o.gap??4),l.style.visibility=""},h=()=>{i&&c()};let u=null;const d=()=>{u?.disconnect(),u=null},f=t=>{const e=t.target;l.contains(e)||s.contains(e)||y()},p=t=>{"Escape"===t.key&&y()},m=t=>"boolean"==typeof t?t:t(),_=()=>void 0!==o.open,g=()=>{i||(i=!0,a.isAttached()||(a.attach(),F(r,l),console.log("[popup] LAZY-ATTACHED to body on open — floating:",l)),c(),o.onOpen?.(l),_()||(document.addEventListener("click",f,{capture:!0}),document.addEventListener("keydown",p)),window.addEventListener("scroll",h,{passive:!0,capture:!0}),window.addEventListener("resize",h,{passive:!0}),o.matchAnchorWidth&&(u=new ResizeObserver(t=>{if(!i)return;const e=t[0]?.borderBoxSize?.[0]?.inlineSize??t[0]?.contentRect.width;null!=e&&(l.style.width=`${e}px`,l.style.minWidth=`${e}px`,h())}),u.observe(s)))},y=()=>{i&&(console.log("[popup] CLOSE — destroyOnClose:",o.destroyOnClose,"floating.isConnected:",l.isConnected,"floating:",l),i=!1,o.destroyOnClose||(l.style.display="none"),o.onClose?.(s,l),o.destroyOnClose&&a.isAttached()&&(console.log("[popup] REMOVED from body in close() — floating:",l),a.detach()),_()||(document.removeEventListener("click",f,{capture:!0}),document.removeEventListener("keydown",p)),window.removeEventListener("scroll",h,{capture:!0}),window.removeEventListener("resize",h),d())},w=t=>{t.stopPropagation(),i?y():g()};return _()?m(o.open)&&g():s.addEventListener("click",w),{onUpdate(t,e){console.log("[popup] UPDATE — isOpen:",i,"anchor:",s);const n=_();if(r=t,o=e,l.isConnected&&F(t,l),e.style&&Object.assign(l.style,e.style),_()){n||s.removeEventListener("click",w);const t=m(e.open);t&&!i?g():!t&&i?y():i&&c()}else n&&s.addEventListener("click",w),i&&c()},onCleanup(){console.log("[popup] CLEANUP — isOpen:",i,"floating.parentNode:",l.parentNode??"NO PARENT","floating.isConnected:",l.isConnected,"floating:",l,"anchor.isConnected:",s.isConnected),i&&y(),d(),_()||s.removeEventListener("click",w),a.detach(),console.log("[popup] CLEANUP DONE — floating still in body?",a.isAttached())}}});function Ll(t,e){return Nl(t,"string"==typeof e?{position:e}:e??{})}function jl(t,e,n){const s=t=>parseInt(String(t),10);switch(e){case"top":case"top-start":return{top:s(t.top-n),left:s(t.left)};case"top-end":return{top:s(t.top-n),left:s(t.right)};case"bottom":case"bottom-start":default:return{top:s(t.bottom+n),left:s(t.left)};case"bottom-end":return{top:s(t.bottom+n),left:s(t.right)};case"right":case"right-start":return{top:s(t.top),left:s(t.right+n)};case"right-end":return{top:s(t.bottom),left:s(t.right+n)};case"left":case"left-start":return{top:s(t.top),left:s(t.left-n)};case"left-end":return{top:s(t.bottom),left:s(t.left-n)}}}function Fl(t){return"top"===t||"top-start"===t||"top-end"===t?"translateY(-100%)":"left"===t||"left-start"===t||"left-end"===t?"translateX(-100%)":""}function Ul(t,e,n,s){const i=window.innerHeight-t.bottom-s,r=t.top-s,o=window.innerWidth-t.right-s,a=t.left-s;if(i>=n)return"bottom";if(r>=n)return"top";if(o>=e)return"right";if(a>=e)return"left";return[["bottom",i],["top",r],["right",o],["left",a]].reduce((t,e)=>e[1]>t[1]?e:t)[0]}const Vl=ko((t,e,n)=>{const s=document.createElement("div");if(n?.style&&Object.assign(s.style,n.style),n?.on)for(const[t,e]of Object.entries(n.on))s.addEventListener(t,e);return function(t){return t?"string"==typeof t?document.querySelector(t)??document.body:t:document.body}(n?.target).appendChild(s),F(e,s),{onUpdate(t){F(t,s)},onCleanup(){s.remove()}}});function Wl(t,e){return Vl(t,e)}const Bl=(t,e)=>{const n=(e??Ur(Xi).pathAtom).get();if(n===t)return!0;const s=t.split("/").filter(Boolean),i=n.split("/").filter(Boolean);if(s.length!==i.length)return!1;for(let t=0;t<s.length;t++){const e=s[t],n=i[t];if(e.startsWith(":")){if(!n)return!1}else if(e!==n)return!1}return!0},Hl=t=>{const e=$i(),{pathAtom:n}=Ur(Xi),s=()=>t().options,i=t().options.notFound?{path:"*",component:t().options.notFound}:null,r=()=>{const{routes:e}=t(),s=e.find(t=>Bl(t.path,n));return s??i},o=r(),a=Es(o),l=Es(o);return ki(()=>{const t=l();if(t===a.get())return;const n=e.value;if(!n)return void a.set(t);const i=s(),r=a.get();Ai({el:n,exit:r?.exit??i.exit??Jn(200),enter:t?.enter??i.enter??Qn(250),swap:()=>a.set(t),getEl:()=>e.value,isStale:()=>l.get()!==t})}),ki(()=>{n(),function(t){l.get()!==t&&l.set(t)}(r())}),Ge(()=>{const t=e.value;if(!t)return;const n=a.get(),i=s();Ci(t,n?.enter??i.enter??Qn(250))}),()=>{const t=a();return b`
|
|
170
|
+
*/(this._hostElement,t),this._scrollerController=new $a(this,this._clippingAncestors[0]),this._schedule(this._updateLayout),this._observeAndListen(),this._connected=!0}_observeAndListen(){this._mutationObserver.observe(this._hostElement,{childList:!0}),this._hostElementRO.observe(this._hostElement),this._scrollEventListeners.push(window),window.addEventListener("scroll",this,this._scrollEventListenerOptions),this._clippingAncestors.forEach(t=>{t.addEventListener("scroll",this,this._scrollEventListenerOptions),this._scrollEventListeners.push(t),this._hostElementRO.observe(t)}),this._hostElementRO.observe(this._scrollerController.element),this._children.forEach(t=>this._childrenRO.observe(t)),this._scrollEventListeners.forEach(t=>t.addEventListener("scroll",this,this._scrollEventListenerOptions))}disconnected(){this._scrollEventListeners.forEach(t=>t.removeEventListener("scroll",this,this._scrollEventListenerOptions)),null!==this._scrollEndRafId&&(cancelAnimationFrame(this._scrollEndRafId),this._scrollEndRafId=null),this._scrollEventListeners=[],this._clippingAncestors=[],this._scrollerController?.detach(this),this._scrollerController=null,this._mutationObserver?.disconnect(),this._mutationObserver=null,this._hostElementRO?.disconnect(),this._hostElementRO=null,this._childrenRO?.disconnect(),this._childrenRO=null,this._rejectLayoutCompletePromise("disconnected"),this._connected=!1}_applyVirtualizerStyles(){const t=this._hostElement.style;t.display=t.display||"block",t.position=t.position||"relative",t.contain=t.contain||"size layout",this._isScroller&&(t.overflow=t.overflow||"auto",t.minHeight=t.minHeight||"150px")}_getSizer(){const t=this._hostElement;if(!this._sizer){let e=t.querySelector(`[${Ra}]`);e||(e=document.createElement("div"),e.setAttribute(Ra,""),t.appendChild(e)),Object.assign(e.style,{position:"absolute",margin:"-2px 0 0 0",padding:0,visibility:"hidden",fontSize:"2px"}),e.textContent=" ",e.setAttribute(Ra,""),this._sizer=e}return this._sizer}async updateLayoutConfig(t){await this._layoutInitialized;const e=t.type||Oa;if("function"==typeof e&&this._layout instanceof e){const e={...t};return delete e.type,this._layout.config=e,!0}return!1}async _initLayout(t){let e,n;if("function"==typeof t.type){n=t.type;const s={...t};delete s.type,e=s}else e=t;void 0===n&&(Oa=n=(await Promise.resolve().then(function(){return ya})).FlowLayout),this._layout=new n(t=>this._handleLayoutMessage(t),e),this._layout.measureChildren&&"function"==typeof this._layout.updateItemSizes&&("function"==typeof this._layout.measureChildren&&(this._measureChildOverride=this._layout.measureChildren),this._measureCallback=this._layout.updateItemSizes.bind(this._layout)),this._layout.listenForChildLoadEvents&&this._hostElement.addEventListener("load",this._loadListener,!0),this._schedule(this._updateLayout)}startBenchmarking(){null===this._benchmarkStart&&(this._benchmarkStart=window.performance.now())}stopBenchmarking(){if(null!==this._benchmarkStart){const t=window.performance.now(),e=t-this._benchmarkStart,n=performance.getEntriesByName("uv-virtualizing","measure").filter(e=>e.startTime>=this._benchmarkStart&&e.startTime<t).reduce((t,e)=>t+e.duration,0);return this._benchmarkStart=null,{timeElapsed:e,virtualizationTime:n}}return null}_measureChildren(){const t={},e=this._children,n=this._measureChildOverride||this._measureChild;for(let s=0;s<e.length;s++){const i=e[s],r=this._first+s;(this._itemsChanged||this._toBeMeasured.has(i))&&(t[r]=n.call(this,i,this._items[r]))}this._childMeasurements=t,this._schedule(this._updateLayout),this._toBeMeasured.clear()}_measureChild(t){const{width:e,height:n}=t.getBoundingClientRect();return Object.assign({width:e,height:n},function(t){const e=window.getComputedStyle(t);return{marginTop:Pa(e.marginTop),marginRight:Pa(e.marginRight),marginBottom:Pa(e.marginBottom),marginLeft:Pa(e.marginLeft)}}(t))}_schedule(t){const e=this._scheduled.get(t);void 0!==e&&cancelAnimationFrame(e);const n=requestAnimationFrame(()=>{this._scheduled.delete(t),t.call(this)});this._scheduled.set(t,n)}async _updateDOM(t){this._scrollSize=t.scrollSize,this._adjustRange(t.range),this._childrenPos=t.childPositions,this._scrollError=t.scrollError||null;const{_rangeChanged:e,_itemsChanged:n}=this;this._visibilityChanged&&(this._notifyVisibility(),this._visibilityChanged=!1),(e||n)&&(this._notifyRange(),this._rangeChanged=!1),this._finishDOMUpdate()}_finishDOMUpdate(){this._connected&&(this._children.forEach(t=>this._childrenRO.observe(t)),this._checkScrollIntoViewTarget(this._childrenPos),this._positionChildren(this._childrenPos),this._sizeHostElement(this._scrollSize),this._correctScrollError(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_updateLayout(){this._layout&&this._connected&&(this._layout.items=this._items,this._updateView(),null!==this._childMeasurements&&(this._measureCallback&&this._measureCallback(this._childMeasurements),this._childMeasurements=null),this._layout.reflowIfNeeded(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_handleScrollEvent(){if(this._benchmarkStart&&"mark"in window.performance){try{window.performance.measure("uv-virtualizing","uv-start","uv-end")}catch(t){console.warn("Error measuring performance data: ",t)}window.performance.mark("uv-start")}!1===this._scrollerController.correctingScrollError&&this._layout?.unpin(),this._schedule(this._updateLayout),null!==this._scrollEndRafId&&cancelAnimationFrame(this._scrollEndRafId),this._scrollEndRafId=requestAnimationFrame(()=>{this._scrollEndRafId=null,this._connected&&this._updateLayout()})}handleEvent(t){if("scroll"===t.type)(t.currentTarget===window||this._clippingAncestors.includes(t.currentTarget))&&this._handleScrollEvent();else console.warn("event not handled",t)}_handleLayoutMessage(t){"stateChanged"===t.type?this._updateDOM(t):"visibilityChanged"===t.type?(this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._notifyVisibility()):"unpinned"===t.type&&this._hostElement.dispatchEvent(new ka)}get _children(){const t=[];let e=this._hostElement.firstElementChild;for(;e;)e.hasAttribute(Ra)||t.push(e),e=e.nextElementSibling;return t}_updateView(){const t=this._hostElement,e=this._scrollerController?.element,n=this._layout;if(t&&e&&n){let s,i,r,o;const a=t.getBoundingClientRect();s=0,i=0,r=window.innerHeight,o=window.innerWidth;const l=this._clippingAncestors.map(t=>t.getBoundingClientRect());l.unshift(a);for(const t of l)s=Math.max(s,t.top),i=Math.max(i,t.left),r=Math.min(r,t.bottom),o=Math.min(o,t.right);const c=e.getBoundingClientRect(),h={left:a.left-c.left,top:a.top-c.top},u={width:e.scrollWidth,height:e.scrollHeight},d=s-a.top+t.scrollTop,f=i-a.left+t.scrollLeft,p=Math.max(0,r-s),m=Math.max(0,o-i);n.viewportSize={width:m,height:p},n.viewportScroll={top:d,left:f},n.totalScrollSize=u,n.offsetWithinScroller=h}}_sizeHostElement(t){const e=82e5,n=t&&null!==t.width?Math.min(e,t.width):0,s=t&&null!==t.height?Math.min(e,t.height):0;if(this._isScroller)this._getSizer().style.transform=`translate(${n}px, ${s}px)`;else{const t=this._hostElement.style;t.minWidth=n?`${n}px`:"100%",t.minHeight=s?`${s}px`:"100%"}}_positionChildren(t){t&&t.forEach(({top:t,left:e,width:n,height:s,xOffset:i,yOffset:r},o)=>{const a=this._children[o-this._first];a&&(a.style.position="absolute",a.style.boxSizing="border-box",a.style.transform=`translate(${e}px, ${t}px)`,void 0!==n&&(a.style.width=`${n}px`),void 0!==s&&(a.style.height=`${s}px`),a.style.left=void 0===i?null:`${i}px`,a.style.top=void 0===r?null:`${r}px`)})}async _adjustRange(t){const{_first:e,_last:n,_firstVisible:s,_lastVisible:i}=this;this._first=t.first,this._last=t.last,this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._rangeChanged=this._rangeChanged||this._first!==e||this._last!==n,this._visibilityChanged=this._visibilityChanged||this._firstVisible!==s||this._lastVisible!==i}_correctScrollError(){if(this._scrollError){const{scrollTop:t,scrollLeft:e}=this._scrollerController,{top:n,left:s}=this._scrollError;this._scrollError=null,this._scrollerController.correctScrollError({top:t-n,left:e-s})}}element(t){return t===1/0&&(t=this._items.length-1),void 0===this._items?.[t]?void 0:{scrollIntoView:(e={})=>this._scrollElementIntoView({...e,index:t})}}_scrollElementIntoView(t){if(t.index>=this._first&&t.index<=this._last)this._children[t.index-this._first].scrollIntoView(t);else if(t.index=Math.min(t.index,this._items.length-1),"smooth"===t.behavior){const e=this._layout.getScrollIntoViewCoordinates(t),{behavior:n}=t;this._updateScrollIntoViewCoordinates=this._scrollerController.managedScrollTo(Object.assign(e,{behavior:n}),()=>this._layout.getScrollIntoViewCoordinates(t),()=>this._scrollIntoViewTarget=null),this._scrollIntoViewTarget=t}else this._layout.pin=t}_checkScrollIntoViewTarget(t){const{index:e}=this._scrollIntoViewTarget||{};e&&t?.has(e)&&this._updateScrollIntoViewCoordinates(this._layout.getScrollIntoViewCoordinates(this._scrollIntoViewTarget))}_notifyRange(){this._hostElement.dispatchEvent(new Ca({first:this._first,last:this._last}))}_notifyVisibility(){this._hostElement.dispatchEvent(new Aa({first:this._firstVisible,last:this._lastVisible}))}get layoutComplete(){return this._layoutCompletePromise||(this._layoutCompletePromise=new Promise((t,e)=>{this._layoutCompleteResolver=t,this._layoutCompleteRejecter=e})),this._layoutCompletePromise}_rejectLayoutCompletePromise(t){null!==this._layoutCompleteRejecter&&this._layoutCompleteRejecter(t),this._resetLayoutCompleteState()}_scheduleLayoutComplete(){this._layoutCompletePromise&&null===this._pendingLayoutComplete&&(this._pendingLayoutComplete=requestAnimationFrame(()=>requestAnimationFrame(()=>this._resolveLayoutCompletePromise())))}_resolveLayoutCompletePromise(){null!==this._layoutCompleteResolver&&this._layoutCompleteResolver(),this._resetLayoutCompleteState()}_resetLayoutCompleteState(){this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null}_hostElementSizeChanged(){this._schedule(this._updateLayout)}_childLoaded(){}_childrenSizeChanged(t){if(this._layout?.measureChildren){for(const e of t)this._toBeMeasured.set(e.target,e.contentRect);this._measureChildren()}this._scheduleLayoutComplete(),this._itemsChanged=!1,this._rangeChanged=!1}}function Pa(t){const e=t?parseFloat(t):NaN;return Number.isNaN(e)?0:e}function za(t){if(null!==t.assignedSlot)return t.assignedSlot;if(null!==t.parentElement)return t.parentElement;const e=t.parentNode;return e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host||null}const Da=Y(class extends ut{constructor(t){if(super(t),this._virtualizer=null,this._first=0,this._last=-1,this._renderItem=(t,e)=>((t,e)=>b`${e}: ${JSON.stringify(t,null,2)}`)(t,e+this._first),this._keyFunction=(t,e)=>(t=>t)(t,this._first),this._items=[],t.type!==V)throw new Error("The virtualize directive can only be used in child expressions")}render(t){t&&this._setFunctions(t);const e=[];if(this._first>=0&&this._last>=this._first)for(let t=this._first;t<=this._last;t++)e.push(this._items[t]);return $t(e,this._keyFunction,this._renderItem)}update(t,[e]){this._setFunctions(e);const n=this._items!==e.items;return this._items=e.items||[],this._virtualizer?this._updateVirtualizerConfig(t,e):this._initialize(t,e),n?E:this.render()}async _updateVirtualizerConfig(t,e){if(!await this._virtualizer.updateLayoutConfig(e.layout||{})){const n=t.parentNode;this._makeVirtualizer(n,e)}this._virtualizer.items=this._items}_setFunctions(t){const{renderItem:e,keyFunction:n}=t;e&&(this._renderItem=(t,n)=>e(t,n+this._first)),n&&(this._keyFunction=(t,e)=>n(t,e+this._first))}_makeVirtualizer(t,e){this._virtualizer&&this._virtualizer.disconnected();const{layout:n,scroller:s,items:i}=e;this._virtualizer=new Ia({hostElement:t,layout:n,scroller:s}),this._virtualizer.items=i,this._virtualizer.connected()}_initialize(t,e){const n=t.parentNode;n&&1===n.nodeType&&(n.addEventListener("rangeChanged",t=>{this._first=t.first,this._last=t.last,this.setValue(this.render())}),this._makeVirtualizer(n,e))}disconnected(){this._virtualizer?.disconnected()}reconnected(){this._virtualizer?.connected()}});function Na(t,e,n,s){const{keyFn:i,template:r,opts:o}=ja(e,n,s),a={direction:o?.direction??"vertical",...o?.pin?{pin:o.pin}:{}};return Da({items:t,renderItem:r,keyFunction:i,scroller:o?.scroller,layout:ua(a)})}function La(t,e,n,s){const{keyFn:i,template:r,opts:o}=ja(e,n,s),a={direction:o.direction??"vertical",getAspectRatio:o.getAspectRatio,gap:o.gap??"8px",flex:!0,...o.itemSize?{itemSize:o.itemSize}:{},...o.pin?{pin:o.pin}:{}};return Da({items:t,renderItem:r,keyFunction:i,scroller:o.scroller,layout:(l=a,Object.assign({type:Ea},l))});var l}function ja(t,e,n){return"function"==typeof e?{keyFn:t,template:e,opts:n}:{keyFn:void 0,template:t,opts:e}}function Fa(t){return new Promise((e,n)=>{t.onsuccess=()=>e(t.result),t.onerror=()=>n(t.error)})}function Ua(t,e,n){return new Promise((s,i)=>{const r=[];let o=!1;t.onsuccess=()=>{const i=t.result;if(i){if(e>0&&!o)return o=!0,void i.advance(e);r.push(i.value),null!==n&&r.length>=n?s(r):i.continue()}else s(r)},t.onerror=()=>i(t.error)})}const Va={equals:t=>IDBKeyRange.only(t),greaterThan:t=>IDBKeyRange.lowerBound(t,!0),greaterThanOrEqual:t=>IDBKeyRange.lowerBound(t,!1),lessThan:t=>IDBKeyRange.upperBound(t,!0),lessThanOrEqual:t=>IDBKeyRange.upperBound(t,!1),between:(t,e,n)=>IDBKeyRange.bound(t,e,n?.lowerOpen??!1,n?.upperOpen??!1),startsWith:t=>IDBKeyRange.bound(t,t+"",!1,!1)};class Wa{constructor(t,e,n,s,i,r){this._db=t,this._storeName=e,this._pk=n,this._indexQuery=s,this._indexSort=i,this._page=r}filterByIndex(t,e){return new Wa(this._db,this._storeName,this._pk,{indexName:t,range:e(Va)},this._indexSort,this._page)}sortByIndex(t,e="asc"){return new Wa(this._db,this._storeName,this._pk,this._indexQuery,{indexName:t,direction:"desc"===e?"prev":"next"},this._page)}async toArray(){const t=new Wa(this._db,this._storeName,this._pk,this._indexQuery,this._indexSort,null);return Ba(await t._run(),t)}async page(t,e){const n=new Wa(this._db,this._storeName,this._pk,this._indexQuery,this._indexSort,{num:t,size:e});return Ba(await n._run(),n)}async _run(){const t=this._db.transaction(this._storeName,"readonly").objectStore(this._storeName),e=null!==this._indexQuery,n=null!==this._indexSort,s=this._page?(this._page.num-1)*this._page.size:0,i=this._page?this._page.size:null;if(!e&&!n)return this._page?Ua(t.openCursor(),s,i):Fa(t.getAll());const r=this._indexQuery.indexName,o=this._indexQuery?.range??null,a=this._indexSort.indexName,l=this._indexSort.direction;if(n&&(!e||r===a)){const n=e?o:null;return Ua(t.index(a).openCursor(n,l),s,i)}let c=await Fa(t.index(r).getAll(o));if(n){const t=a,e="prev"===l?-1:1;c.sort((n,s)=>{const i=n[t],r=s[t];return(i<r?-1:i>r?1:0)*e})}return this._page&&(c=c.slice(s,s+i)),c}}function Ba(t,e){const{_db:n,_storeName:s,_pk:i}=e,r=Es(t,{skipRestrictedContextCheck:!0}),o=r;return o.updateItem=async(t,e)=>{const o=r.get().find(e=>e[i]===t);null!=o&&"object"==typeof o&&(e(o),await Fa(n.transaction(s,"readwrite").objectStore(s).put(o)),r.update(()=>{}))},o.setItem=async(t,e)=>{await Fa(n.transaction(s,"readwrite").objectStore(s).put(e)),r.update(n=>{const s=n.findIndex(e=>e[i]===t);-1!==s&&(n[s]=e)})},o.removeItem=async t=>{await Fa(n.transaction(s,"readwrite").objectStore(s).delete(t)),r.update(e=>{const n=e.findIndex(e=>e[i]===t);-1!==n&&e.splice(n,1)})},o.refresh=async()=>{r.set(await e._run())},Object.defineProperty(o,"name",{value:"dbTableAtom",writable:!0,configurable:!0,enumerable:!1}),o}function Ha(t,e,n,s){const i=new Wa(t,e,n,null,null,null),r=()=>s?s.objectStore(e):t.transaction(e,"readonly").objectStore(e),o=()=>s?s.objectStore(e):t.transaction(e,"readwrite").objectStore(e);return{filterByIndex:(t,e)=>i.filterByIndex(t,e),sortByIndex:(t,e)=>i.sortByIndex(t,e),toArray:()=>i.toArray(),page:(t,e)=>i.page(t,e),add:t=>Fa(o().add(t)),set:async(t,e)=>{await Fa(o().put(e))},update:async(n,i)=>{const r=s?s.objectStore(e):t.transaction(e,"readwrite").objectStore(e),o=await Fa(r.get(n));null!=o&&(i(o),await Fa(r.put(o)))},delete:async t=>{await Fa(o().delete(t))},clear:async()=>{await Fa(o().clear())},count:()=>Fa(r().count()),get:t=>Fa(r().get(t)),has:async t=>void 0!==await Fa(r().getKey(t))}}function Ya(t,e){return Pe()?Promise.reject(new Error("[indexDB] IndexedDB is not available in SSR environments.")):new Promise((n,s)=>{const i=indexedDB.open(t,e.version);i.onupgradeneeded=t=>{const n=i.result,s=i.transaction;e.upgrade&&e.upgrade(function(t,e){return{createTable(e,n,s=[]){if(t.objectStoreNames.contains(e))return;const i=t.createObjectStore(e,{keyPath:n});for(const t of s)i.createIndex(t,t,{unique:!1})},addIndex(n,s,i){if(!t.objectStoreNames.contains(n))return;const r=e.objectStore(n);r.indexNames.contains(s)||r.createIndex(s,s,i??{unique:!1})},removeIndex(n,s){if(!t.objectStoreNames.contains(n))return;const i=e.objectStore(n);i.indexNames.contains(s)&&i.deleteIndex(s)},dropTable(e){t.objectStoreNames.contains(e)&&t.deleteObjectStore(e)}}}(n,s),t.oldVersion)},i.onsuccess=()=>{const e=i.result;e.onversionchange=()=>{e.close(),console.warn(`[indexDB] "${t}" connection closed — version change detected. Reload the page to upgrade.`)};const s={table:(t,n)=>Ha(e,t,n),transaction:(t,n)=>new Promise((s,i)=>{const r=e.transaction(t,"readwrite"),o={table:(t,n)=>Ha(e,t,n,r)};r.oncomplete=()=>s(),r.onerror=()=>i(r.error),r.onabort=()=>i(new Error(`[indexDB] Transaction on [${t.join(", ")}] aborted`)),n(o).catch(t=>{try{r.abort()}catch{}i(t)})}),close(){e.close()}};n(s)},i.onerror=()=>s(i.error),i.onblocked=()=>{console.warn(`[indexDB] Opening "${t}" is blocked — close other connections first.`)}})}function qa(){const t=new Uint8Array(16);if("undefined"!=typeof crypto&&crypto.getRandomValues)crypto.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=256*Math.random()|0;t[6]=15&t[6]|64,t[8]=63&t[8]|128;const e=Array.from(t).map(t=>t.toString(16).padStart(2,"0")).join("");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20,32)}`}function Xa(){return{list:t=>Promise.resolve(function(){function t(){return[]}return t.get=t=>{},t.has=t=>!1,t.add=async t=>"",t.set=async(t,e)=>{},t.update=async(t,e)=>{},t.deleteRow=async t=>{},t.clear=async()=>{},Object.defineProperty(t,"size",{get:()=>0,enumerable:!0,configurable:!0}),t}())}}const Za="mini-db",Ga="mini-db:v";function Ka(t){return new Promise((e,n)=>{t.onsuccess=()=>e(t.result),t.onerror=()=>n(t.error)})}function Qa(t,e,n){return new Promise((s,i)=>{const r=e?indexedDB.open(t,e):indexedDB.open(t);r.onupgradeneeded=()=>n?.(r.result),r.onsuccess=()=>s(r.result),r.onerror=()=>i(r.error),r.onblocked=()=>console.warn("[miniDB] Open blocked — close other connections first.")})}function Ja(t){t.current.onversionchange=async()=>{t.current.close(),t.current=await Qa(Za),Ja(t)}}async function tl(t,e,n){const s=await Ka(t.current.transaction(e,"readonly").objectStore(e).getAll()),i=cr(s.map(t=>[String(t.id),t])),r=n=>Ka(t.current.transaction(e,"readwrite").objectStore(e).put(n));n&&n.addEventListener("message",t=>{const n=t.data;n&&n.store===e&&("set"===n.op?i.set(n.key,n.item):"delete"===n.op?i.delete(n.key):"clear"===n.op&&i.clear())});const o=t=>{try{n?.postMessage(t)}catch{}};function a(){return Array.from(i.values())}return a.get=t=>i.get(t),a.has=t=>i.has(t),a.add=async t=>{const n=String(t.id??qa()),s={...t,id:n};return await r(s),i.set(n,s),o({store:e,op:"set",key:n,item:s}),n},a.set=async(t,n)=>{const s={...n,id:t};await r(s),i.set(t,s),o({store:e,op:"set",key:t,item:s})},a.update=async(t,n)=>{const s=i.get(t);s&&(i.updateItem(t,n),await r(s),o({store:e,op:"set",key:t,item:s}))},a.deleteRow=async n=>{await(n=>Ka(t.current.transaction(e,"readwrite").objectStore(e).delete(n)))(n),i.delete(n),o({store:e,op:"delete",key:n})},a.clear=async()=>{await Ka(t.current.transaction(e,"readwrite").objectStore(e).clear()),i.clear(),o({store:e,op:"clear"})},Object.defineProperty(a,"size",{get:()=>i.size,enumerable:!0,configurable:!0}),a}async function el(t=1,e){if(Pe())return Xa();const n={current:await Qa(Za)};Ja(n);const s="undefined"!=typeof BroadcastChannel?new BroadcastChannel(Za):null,i=function(){try{return parseInt(localStorage.getItem(Ga)??"0",10)||0}catch{return 0}}();if(i!==t){if(e){const s=[];e(i,t,{clear:t=>s.push(t)});for(const t of s)n.current.objectStoreNames.contains(t)&&await Ka(n.current.transaction(t,"readwrite").objectStore(t).clear())}!function(t){try{localStorage.setItem(Ga,String(t))}catch{}}(t)}const r=new Map;return{async list(t){if(r.has(t))return r.get(t);n.current.objectStoreNames.contains(t)||(n.current=await async function(t,e){const n=t.name,s=t.version+1;return t.close(),Qa(n,s,t=>{t.objectStoreNames.contains(e)||t.createObjectStore(e,{keyPath:"id"})})}(n.current,t),Ja(n));const e=await tl(n,t,s);return r.set(t,e),e}}}function nl(t,e,n,s=!1){document.addEventListener(t,e,{capture:s}),n.addToCleanUps(e,()=>{document.removeEventListener(t,e,{capture:s})})}function sl(t,e,n,s){let i;if("wheelUp"===t||"wheelDown"===t){const r="wheelUp"===t,o=e,a=t=>{(r?t.deltaY>=0:t.deltaY<=0)||(i&&i(),i=o(t))};return window.addEventListener("wheel",a,{capture:n,passive:!0}),void s.addToCleanUps(e,()=>{window.removeEventListener("wheel",a,{capture:n}),i&&i()})}const r="scroll"===t||"touchstart"===t||"touchmove"===t,o=e,a=t=>{i&&i(),i=o(t)};window.addEventListener(t,a,{capture:n,passive:r}),s.addToCleanUps(e,()=>{window.removeEventListener(t,a,{capture:n}),i&&i()})}function il(t,e){Pe()||(Xe(),sl(t,e,!1,Me()))}function rl(t,e){Pe()||(Xe(),sl(t,e,!0,Me()))}const ol=t=>{rl("scroll",t)},al=t=>{il("blur",t)},ll=t=>{il("focus",t)},cl=t=>{il("online",t)},hl=t=>{il("offline",t)},ul=t=>{il("resize",t)},dl=t=>{il("paste",t)},fl=t=>{il("copy",t)},pl=t=>{il("cut",t)},ml=t=>{il("keydown",t)},_l=t=>{il("keyup",t)},gl=t=>{if(Pe())return;Xe();let e;nl("visibilitychange",()=>{e&&e(),e=t(document.hidden)},Me())},yl=t=>{if(Pe())return;Xe();let e;nl("selectionchange",()=>{e&&e(),e=t(window.getSelection())},Me())},wl=t=>{il("storage",t)},vl=t=>{if(Pe())return;Xe();const e=Me();let n;const s=t=>t.preventDefault(),i=e=>{e.preventDefault(),n&&n(),n=t(e)};window.addEventListener("dragover",s),window.addEventListener("drop",i),e.addToCleanUps(t,()=>{window.removeEventListener("dragover",s),window.removeEventListener("drop",i),n&&n()})},bl=t=>{if(Pe())return;Xe();const e=Me(!0),n=n=>{const s=n.target;s&&!e.contains(s)&&t(n)};document.addEventListener("mousedown",n,!0),e.addToCleanUps(t,()=>{document.removeEventListener("mousedown",n,!0)})},Sl=(t,e=window)=>{if(Pe())return;Xe();const n=Me();let s;const i=e=>{s&&s(),s=t(e)};e.addEventListener("scroll",i,{passive:!0}),n.addToCleanUps(t,()=>{e.removeEventListener("scroll",i),s&&s()})},El=(t,e)=>{if(Pe())return;Xe();const n=Me();let s;const i=new ResizeObserver(e=>{for(const n of e)s&&s(),s=t(n)}),r=e||n;i.observe(r),n.addToCleanUps(t,()=>{i.disconnect(),s&&s()})},Cl=t=>{if(Pe())return;Xe();const e=Me(),{pathAtom:n}=Ur(Xi);let s;const i=n.__subscribe(()=>{s&&s(),s=t(n.get())||null});e.addToCleanUps(t,()=>{i(),s&&s()})},Al=(t,e)=>{if(Pe())return;Xe();const n=Me();let s;const i=setInterval(()=>{s&&s(),s=t()},e);n.addToCleanUps(t,()=>{clearInterval(i),s&&s()})},kl=(t,e)=>{if(Pe())return;Xe();const n=Me();let s;const i=setTimeout(()=>{s=t()},e);n.addToCleanUps(t,()=>{clearTimeout(i),s&&s()})};function Ml(t,e){Xe();const n=Me(),s=e.map(e=>e.__subscribe(t));n.addToCleanUps(t,()=>{s.forEach(t=>t())})}const $l=t=>{Xe();const e=Me();let n;e.onEachUpdate(()=>{n&&n(),n=t()}),e.addToCleanUps(t,()=>{n&&n()})},xl=t=>{const e=Me();if(!e)throw new Error("onDOMReady must be called within a component context");return e.DOMReadyEvent.__subscribe(t)},Tl=ko((t,e,n)=>{const s=document.createElement("div");Object.assign(s.style,{position:"fixed",inset:"0",zIndex:"9999",display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.5)"}),n?.style&&Object.assign(s.style,n.style),n?.onBackdropClick&&s.addEventListener("click",t=>{t.target===s&&n.onBackdropClick()});const i=document.createElement("div");n?.dialogStyle&&Object.assign(i.style,n.dialogStyle),i.addEventListener("click",t=>t.stopPropagation()),F(e,i),s.appendChild(i),document.body.appendChild(s);const r=document.body.style.overflow;return document.body.style.overflow="hidden",{onUpdate(t){F(t,i)},onCleanup(){s.remove(),document.body.style.overflow=r}}});function Rl(t,e){return Tl(t,e)}const Ol={position:"fixed",display:"none",margin:"0"},Il="9999";function Pl(t={}){const{style:e,target:n,zIndex:s=Il}=t,i=document.createElement("div");for(const[t,e]of Object.entries(Ol))i.style[t]=e;i.style.zIndex=String(s),e&&Object.assign(i.style,e);return{el:i,attach:()=>{i.isConnected||function(t){return t?"string"==typeof t?document.querySelector(t)??document.body:t:document.body}(n).appendChild(i)},detach:()=>{i.isConnected&&i.remove()},isAttached:()=>i.isConnected}}function zl(t,e,n,s,i,r,o){return t.startsWith("top")?s>=n:t.startsWith("bottom")?i>=n:t.startsWith("left")?r>=e:!!t.startsWith("right")&&o>=e}function Dl(t,e,n,s,i,r){const o=window.innerWidth,a=function(t){let e=t.parentElement;for(;e&&e!==document.documentElement;){const{overflowY:t}=window.getComputedStyle(e),n="auto"===t||"scroll"===t,s=e.scrollHeight>e.clientHeight;if(n&&s)return e;e=e.parentElement}return null}(t);let l,c;if(a){const t=a.getBoundingClientRect(),n=a.scrollHeight-a.scrollTop-a.clientHeight;c=t.bottom-e.bottom+n-i;const s=a.scrollTop;l=e.top-t.top+s-i}else{const t=window.scrollY||document.documentElement.scrollTop,n=document.documentElement.scrollHeight;l=e.top+t-i,c=n-(e.bottom+t)-i}const h=e.left-i,u=o-e.right-i;if("auto"===r){const t=["bottom-start","top-start","right","left"];for(const e of t)if(zl(e,n,s,l,c,h,u))return e;return"bottom-start"}if(zl(r,n,s,l,c,h,u))return r;const d=function(t){return t.startsWith("top")?t.replace("top","bottom"):t.startsWith("bottom")?t.replace("bottom","top"):t.startsWith("left")?t.replace("left","right"):t.startsWith("right")?t.replace("right","left"):t}(r);return zl(d,n,s,l,c,h,u)?d:r}const Nl=fo((t,e,n)=>{const s=t.el;let i=!1,r=e,o=n;console.log("[popup] MOUNT — anchor:",s,"destroyOnClose:",!!n.destroyOnClose);const a=Pl({...void 0!==o.zIndex?{zIndex:o.zIndex}:{},style:{background:"var(--md-color-surface-raised,#fff)",boxShadow:"var(--md-shadow-dropdown,0 5px 5px -3px rgba(0,0,0,.20),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12))",minWidth:"160px",...o.style??{}}}),l=a.el;o.destroyOnClose;const c=()=>{const t=s.getBoundingClientRect();l.style.visibility="hidden",l.style.display="block",o.matchAnchorWidth&&(l.style.width=`${t.width}px`);const e=l.offsetWidth,n=l.offsetHeight,i=Dl(s,t,e,n,o.gap??4,o.position??"bottom-start");!function(t,e,n,s,i,r){const o=window.innerWidth,a=window.innerHeight;let l=0,c=0;n.startsWith("bottom")?l=e.bottom+r:n.startsWith("top")?l=e.top-r-i:"right"===n||"left"===n?l=e.top+e.height/2-i/2:n.endsWith("-start")?l=e.top:n.endsWith("-end")&&(l=e.bottom-i),"bottom"===n||"top"===n?c=e.left+e.width/2-s/2:n.endsWith("-start")?c=n.startsWith("right")?e.right+r:n.startsWith("left")?e.left-r-s:e.left:n.endsWith("-end")?c=n.startsWith("right")?e.right+r:n.startsWith("left")?e.left-r-s:e.right-s:n.startsWith("right")?c=e.right+r:n.startsWith("left")&&(c=e.left-r-s);const h=Math.max(4,Math.min(c,o-s-4)),u=Math.max(4,Math.min(l,a-i-4)),d=parseInt(String(h),10),f=parseInt(String(u),10);t.style.left=`${d}px`,t.style.top=`${f}px`}(l,t,i,e,n,o.gap??4),l.style.visibility=""},h=()=>{i&&c()};let u=null;const d=()=>{u?.disconnect(),u=null},f=t=>{const e=t.target;l.contains(e)||s.contains(e)||y()},p=t=>{"Escape"===t.key&&y()},m=t=>"boolean"==typeof t?t:t(),_=()=>void 0!==o.open,g=()=>{i||(i=!0,a.isAttached()||(a.attach(),F(r,l),console.log("[popup] LAZY-ATTACHED to body on open — floating:",l)),c(),o.onOpen?.(l),_()||(document.addEventListener("click",f,{capture:!0}),document.addEventListener("keydown",p)),window.addEventListener("scroll",h,{passive:!0,capture:!0}),window.addEventListener("resize",h,{passive:!0}),o.matchAnchorWidth&&(u=new ResizeObserver(t=>{if(!i)return;const e=t[0]?.borderBoxSize?.[0]?.inlineSize??t[0]?.contentRect.width;null!=e&&(l.style.width=`${e}px`,l.style.minWidth=`${e}px`,h())}),u.observe(s)))},y=()=>{i&&(console.log("[popup] CLOSE — destroyOnClose:",o.destroyOnClose,"floating.isConnected:",l.isConnected,"floating:",l),i=!1,o.destroyOnClose||(l.style.display="none"),o.onClose?.(s,l),o.destroyOnClose&&a.isAttached()&&(console.log("[popup] REMOVED from body in close() — floating:",l),a.detach()),_()||(document.removeEventListener("click",f,{capture:!0}),document.removeEventListener("keydown",p)),window.removeEventListener("scroll",h,{capture:!0}),window.removeEventListener("resize",h),d())},w=t=>{t.stopPropagation(),i?y():g()};return _()?m(o.open)&&g():s.addEventListener("click",w),{onUpdate(t,e){console.log("[popup] UPDATE — isOpen:",i,"anchor:",s);const n=_();if(r=t,o=e,l.isConnected&&F(t,l),e.style&&Object.assign(l.style,e.style),_()){n||s.removeEventListener("click",w);const t=m(e.open);t&&!i?g():!t&&i?y():i&&c()}else n&&s.addEventListener("click",w),i&&c()},onCleanup(){console.log("[popup] CLEANUP — isOpen:",i,"floating.parentNode:",l.parentNode??"NO PARENT","floating.isConnected:",l.isConnected,"floating:",l,"anchor.isConnected:",s.isConnected),i&&y(),d(),_()||s.removeEventListener("click",w),a.detach(),console.log("[popup] CLEANUP DONE — floating still in body?",a.isAttached())}}});function Ll(t,e){return Nl(t,"string"==typeof e?{position:e}:e??{})}function jl(t,e,n){const s=t=>parseInt(String(t),10);switch(e){case"top":case"top-start":return{top:s(t.top-n),left:s(t.left)};case"top-end":return{top:s(t.top-n),left:s(t.right)};case"bottom":case"bottom-start":default:return{top:s(t.bottom+n),left:s(t.left)};case"bottom-end":return{top:s(t.bottom+n),left:s(t.right)};case"right":case"right-start":return{top:s(t.top),left:s(t.right+n)};case"right-end":return{top:s(t.bottom),left:s(t.right+n)};case"left":case"left-start":return{top:s(t.top),left:s(t.left-n)};case"left-end":return{top:s(t.bottom),left:s(t.left-n)}}}function Fl(t){return"top"===t||"top-start"===t||"top-end"===t?"translateY(-100%)":"left"===t||"left-start"===t||"left-end"===t?"translateX(-100%)":""}function Ul(t,e,n,s){const i=window.innerHeight-t.bottom-s,r=t.top-s,o=window.innerWidth-t.right-s,a=t.left-s;if(i>=n)return"bottom";if(r>=n)return"top";if(o>=e)return"right";if(a>=e)return"left";return[["bottom",i],["top",r],["right",o],["left",a]].reduce((t,e)=>e[1]>t[1]?e:t)[0]}const Vl=ko((t,e,n)=>{const s=document.createElement("div");if(n?.style&&Object.assign(s.style,n.style),n?.on)for(const[t,e]of Object.entries(n.on))s.addEventListener(t,e);return function(t){return t?"string"==typeof t?document.querySelector(t)??document.body:t:document.body}(n?.target).appendChild(s),F(e,s),{onUpdate(t){F(t,s)},onCleanup(){s.remove()}}});function Wl(t,e){return Vl(t,e)}const Bl=(t,e)=>{const n=(e??Ur(Xi).pathAtom).get();if(n===t)return!0;const s=t.split("/").filter(Boolean),i=n.split("/").filter(Boolean);if(s.length!==i.length)return!1;for(let t=0;t<s.length;t++){const e=s[t],n=i[t];if(e.startsWith(":")){if(!n)return!1}else if(e!==n)return!1}return!0},Hl=t=>{const e=xi(),{pathAtom:n}=Ur(Xi),s=()=>t().options,i=t().options.notFound?{path:"*",component:t().options.notFound}:null,r=()=>{const{routes:e}=t(),s=e.find(t=>Bl(t.path,n));return s??i},o=r(),a=Es(o),l=Es(o);return ki(()=>{const t=l();if(t===a.get())return;const n=e.value;if(!n)return void a.set(t);const i=s(),r=a.get();Ai({el:n,exit:r?.exit??i.exit??Jn(200),enter:t?.enter??i.enter??Qn(250),swap:()=>a.set(t),getEl:()=>e.value,isStale:()=>l.get()!==t})}),ki(()=>{n(),function(t){l.get()!==t&&l.set(t)}(r())}),Ge(()=>{const t=e.value;if(!t)return;const n=a.get(),i=s();Ci(t,n?.enter??i.enter??Qn(250))}),()=>{const t=a();return b`
|
|
171
171
|
<div style="position:relative;overflow:hidden">
|
|
172
172
|
<div ${Ti(e)}>
|
|
173
173
|
${t?no(t.component,t.props??{}):C}
|
|
174
174
|
</div>
|
|
175
175
|
</div>
|
|
176
|
-
`}};function Yl(t,e={}){return no(Hl,{routes:t,options:e})}function ql(t,e){if("undefined"==typeof window)return;const{pathAtom:n,navigateTo:s}=Ur(Xi),i=n.get(),r=t.split("/"),o=i.split("/");if(r.length!==o.length)return void console.warn(`replaceParams: pattern "${t}" has ${r.length} segments but current path "${i}" has ${o.length}. No-op.`);const a=new Set(r.filter(t=>t.startsWith(":")).map(t=>t.slice(1)));for(const n of Object.keys(e))a.has(n)||console.warn(`replaceParams: param "${n}" not found in pattern "${t}".`);const l=o.map((t,n)=>{const s=r[n];if(!s.startsWith(":"))return t;const i=s.slice(1);return i in e?String(e[i]):t}),c=l.join("/");c!==i&&s(c,!0)}const Xl=(t,{view:e})=>Bl(t)?e?so(e,{}):C:null,Zl=(t,e)=>{const n=t.find(t=>Bl(t.path));if(void 0===n)return e?()=>no(e):()=>C;const{component:s}=n;return()=>no(s)},Gl=1e3,Kl=3e4,Ql=1/0;function Jl(t,e={}){le("ws");const{reconnect:n=!0,reconnectDelay:s=Gl,reconnectMaxDelay:i=Kl,reconnectMaxAttempts:r=Ql,protocols:o,auth:a,autoConnect:l=!0}=e,c=Es("connecting",{skipRestrictedContextCheck:!0}),h=new Set;let u=null,d=0,f=s,p=null,m=!1;const _=[];function g(){null!==p&&(clearTimeout(p),p=null)}function y(){let e;m=!1,g(),c.set("connecting");try{e=function(){if(!a)return t;const e=a(),n=Object.entries(e);if(0===n.length)return t;const s=n.map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&");return t.includes("?")?`${t}&${s}`:`${t}?${s}`}()}catch(t){return me(t),void c.set("error")}try{u=o?new WebSocket(e,o):new WebSocket(e)}catch(t){return me(t),c.set("error"),void w()}u.onopen=()=>{m?u?.close():(d=0,f=s,c.set("connected"),function(){for(;_.length>0;){const t=_.shift();u?.readyState===WebSocket.OPEN&&u.send(t)}}())},u.onmessage=t=>{if(m)return;const e="string"==typeof t.data?t.data:String(t.data);let n;try{n=JSON.parse(e)}catch{n=e}var s;s=n,h.forEach(t=>{try{t(s)}catch(t){me(t)}})},u.onerror=()=>{c.set("error")},u.onclose=()=>{m||(c.set("disconnected"),w())}}function w(){if(!n||m)return;if(d>=r)return;d++;const t=f;f=Math.min(2*f,i),p=setTimeout(()=>{m||y()},t)}function v(){m=!0,g(),u&&(u.onopen=null,u.onmessage=null,u.onerror=null,u.onclose=null,u.readyState!==WebSocket.OPEN&&u.readyState!==WebSocket.CONNECTING||u.close(1e3,"client disconnect"),u=null),c.set("disconnected"),h.clear(),_.length=0}const b={send:function(t){const e="string"==typeof t?t:JSON.stringify(t);u?.readyState===WebSocket.OPEN?u.send(e):_.push(e)},__subscribe:function(t){return h.add(t),()=>h.delete(t)},status:c,connect:y,disconnect:v,__isWs___:!0};return l?y():c.set("disconnected"),xe(b,v),b}const tc=Symbol.for("mates.ssrContextStorage");function ec(){const t=globalThis[tc];if(t&&"function"==typeof t.getStore){const e=t.getStore();return e?.ctx}}function nc(){const t=globalThis[tc];if(t&&"function"==typeof t.getStore){const e=t.getStore();return!0===e?.ssrMode}return!1}class sc{constructor(){this.id=Math.random().toString(36).substring(2,15),this.context=null}}function ic(){if("undefined"==typeof document)return{};const t=document.cookie;if(!t)return{};const e={};for(const n of t.split(";")){const t=n.indexOf("=");if(-1===t)continue;const s=n.slice(0,t).trim();if(!s)continue;const i=n.slice(t+1).trim();try{e[s]=decodeURIComponent(i)}catch{e[s]=i}}return e}function rc(t,e=new WeakMap){if("function"==typeof structuredClone)return structuredClone(t);if(null===t||"object"!=typeof t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(t instanceof Map){const n=new Map;return e.set(t,n),t.forEach((t,s)=>n.set(rc(s,e),rc(t,e))),n}if(t instanceof Set){const n=new Set;return e.set(t,n),t.forEach(t=>n.add(rc(t,e))),n}if(Array.isArray(t)){const n=[];e.set(t,n);for(let s=0;s<t.length;s++)n[s]=rc(t[s],e);return n}const n=e.get(t);if(n)return n;const s={};e.set(t,s);for(const n of Object.keys(t))s[n]=rc(t[n],e);return s}function oc(t,e){let n=Object.getOwnPropertyDescriptor(t,e),s=Object.getPrototypeOf(t);for(;!n&&s&&s!==Object.prototype;)n=Object.getOwnPropertyDescriptor(s,e),s=Object.getPrototypeOf(s);return n?.get&&"function"==typeof n.get?n.get:null}var ac,lc,cc,hc,uc,dc;function fc(t){return"number"==typeof t?`${t}px`:t}lc=new WeakMap,cc=new WeakMap,hc=new WeakMap,uc=new WeakMap,ac=new WeakSet,dc=function(t){ge(this,lc,"f")?.remove(),ye(this,lc,null,"f"),ye(this,cc,"","f"),ye(this,hc,"","f"),ye(this,uc,new Set,"f");const e=t.endNode;if(e?.parentNode){const n=t.startNode,s=document.createRange();s.setStartAfter(n),s.setEndBefore(e),s.deleteContents()}};const pc=Y(class extends q{constructor(t){if(super(t),ac.add(this),lc.set(this,null),cc.set(this,""),hc.set(this,""),uc.set(this,new Set),t.type!==V)throw new Error("safeSVG() must be used as a child expression, e.g. html`<div>${safeSVG(markup)}</div>`")}update(t,[e,n]){if(console.log("update"),!e.trimStart().startsWith("<svg"))return console.warn("safeSVG: input does not start with <svg — nothing rendered"),ge(this,ac,"m",dc).call(this,t),E;const s=JSON.stringify(n);if(null===ge(this,lc,"f")||e!==ge(this,cc,"f")){const n=function(t){const e=document.createElement("template");e.innerHTML=t;const n=e.content.firstElementChild;return n instanceof SVGElement?n:null}(e);if(null===n)return console.warn("safeSVG: failed to parse SVG markup — nothing rendered"),ge(this,ac,"m",dc).call(this,t),E;ge(this,lc,"f")?.remove(),ye(this,lc,n,"f"),ye(this,cc,e,"f"),ye(this,hc,"","f"),ye(this,uc,new Set,"f");const s=t.endNode;s.parentNode.insertBefore(ge(this,lc,"f"),s)}if(s!==ge(this,hc,"f")){const t=function(t,e){const n=new Set,s=(e,s)=>{t.setAttribute(e,s),n.add(e)},i=e.width??e.size,r=e.height??e.size;void 0!==i&&s("width",fc(i)),void 0!==r&&s("height",fc(r)),void 0!==e.fill&&s("fill",e.fill),void 0!==e.stroke&&s("stroke",e.stroke),void 0!==e.strokeWidth&&s("stroke-width",String(e.strokeWidth)),void 0!==e.strokeLinecap&&s("stroke-linecap",e.strokeLinecap),void 0!==e.strokeLinejoin&&s("stroke-linejoin",e.strokeLinejoin),void 0!==e.opacity&&s("opacity",String(e.opacity)),void 0!==e.viewBox&&s("viewBox",e.viewBox),void 0!==e.transform&&s("transform",e.transform);const o=[],a=e.width??e.size,l=e.height??e.size;void 0!==a&&o.push(`width:${fc(a)}`),void 0!==l&&o.push(`height:${fc(l)}`),void 0!==e.color&&o.push(`color:${e.color}`),o.push("display:inline-block"),o.push("vertical-align:middle"),e.style&&o.push(e.style),s("style",o.join(";")),e.class&&s("class",e.class);const c=e.ariaHidden??!0;return e.ariaLabel?(s("aria-label",e.ariaLabel),s("role","img")):c&&s("aria-hidden","true"),n}(ge(this,lc,"f"),n);for(const e of ge(this,uc,"f"))t.has(e)||ge(this,lc,"f").removeAttribute(e);ye(this,uc,t,"f"),ye(this,hc,s,"f")}return E}render(t,e){return E}});function mc(t,e={}){return pc(t,e)}let _c=null,gc=null,yc=null;function wc(t){_c=t}function vc(t){gc=t}function bc(){return gc}function Sc(){return _c??-(new Date).getTimezoneOffset()}function Ec(){return yc??("undefined"!=typeof navigator?navigator.language:null)??"en"}function Cc(t,e){const n={};for(const s of new Intl.DateTimeFormat("en",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(new Date(e)))"literal"!==s.type&&(n[s.type]=parseInt(s.value,10));const s=24===n.hour?0:n.hour,i=Date.UTC(n.year,n.month-1,n.day,s,n.minute,n.second);return Math.round((i-e)/6e4)||0}function Ac(t,e){try{const n=new Intl.DateTimeFormat("en",{timeZone:t,timeZoneName:"short"}).formatToParts(new Date(e)).find(t=>"timeZoneName"===t.type);return n?n.value:t}catch{return t}}function kc(t,e){try{const n=new Intl.DateTimeFormat("en",{timeZone:t,timeZoneName:"long"}).formatToParts(new Date(e)).find(t=>"timeZoneName"===t.type);return n?n.value:t}catch{return t}}function Mc(t,e){const n=new Date(t+6e4*e);return{Y:n.getUTCFullYear(),M:n.getUTCMonth()+1,D:n.getUTCDate(),h:n.getUTCHours(),m:n.getUTCMinutes(),s:n.getUTCSeconds(),ms:n.getUTCMilliseconds(),wd:n.getUTCDay()}}const xc=t=>String(t).padStart(2,"0");function $c(t,e,n){const s={[n]:e};return gc?s.timeZone=gc:(s.timeZone="UTC",t+=6e4*Sc()),new Intl.DateTimeFormat(Ec(),s).format(new Date(t))}function Tc(t,e){const n=t>=0?"+":"-",s=Math.abs(t);return e?`${n}${xc(Math.floor(s/60))}:${xc(s%60)}`:`${n}${xc(Math.floor(s/60))}${xc(s%60)}`}function Rc(t){const e=t.replace(/s$/,"");if("millisecond"===e||"m"===e)return"ms";if("minute"===e)return"min";if(!new Set(["year","month","week","day","hour","min","second","ms"]).has(e))throw new RangeError(`Invalid date unit: "${t}"`);return e}function Oc(){try{const t=new Intl.Locale(Ec()),e=t.weekInfo?.firstDay??t.getWeekInfo?.()?.firstDay;if(void 0!==e)return e%7}catch{}return 0}const Ic=/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|H|hh|h|mm|ss|SSS|ZZ|Z|A|a/g,Pc=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function zc(t){try{const e=new Date(Date.UTC(2024,0,7+t,12,0,0));return new Intl.DateTimeFormat(Ec(),{weekday:"long",timeZone:"UTC"}).format(e)}catch{return Pc[t]||""}}function Dc(t){try{const e=new Date(Date.UTC(2024,t-1,15,12,0,0));return new Intl.DateTimeFormat(Ec(),{month:"long",timeZone:"UTC"}).format(e)}catch{return""}}function Nc(t){if(t instanceof Number)return t.valueOf();if("number"==typeof t)return t;if("string"==typeof t)return new Date(t).getTime();if(t instanceof Date)return t.getTime();if("object"==typeof t&&null!==t){const{year:e=1970,month:n=1,day:s=1,hour:i=0,minute:r=0,second:o=0,ms:a=0}=t;return Date.UTC(e,n-1,s,i,r,o,a)-6e4*Sc()}return NaN}function Lc(t,e,n){const s=Rc(n);if("hour"===s)return t+36e5*e;if("min"===s)return t+6e4*e;if("second"===s)return t+1e3*e;if("ms"===s)return t+e;const i=Sc(),r=Mc(t,i);let o=r.Y,a=r.M,l=r.D;if("year"===s)o+=e;else if("month"===s){const t=a-1+e;o+=Math.floor(t/12),a=(t%12+12)%12+1,l=Math.min(l,new Date(o,a,0).getDate())}else l+="week"===s?7*e:e;return Date.UTC(o,a-1,l,r.h,r.m,r.s,r.ms)-6e4*i}function jc(t,e){const n=Sc(),s=Mc(t,n),i=Mc(e,n);return s.Y===i.Y&&s.M===i.M&&s.D===i.D}function Fc(t){const e=Sc(),n=Mc(t,e);return Date.UTC(n.Y,n.M-1,n.D,0,0,0,0)-6e4*e}function Uc(t,e){const n=Sc(),s=Mc(t,n),i=s.h%12||12,r=[],o=e.replace(/\[([^\]]*)\]/g,(t,e)=>(r.push(e),`\0${r.length-1}\0`));Ic.lastIndex=0;const a=o.replace(Ic,e=>{switch(e){case"YYYY":return String(s.Y);case"YY":return String(s.Y).slice(-2);case"MMMM":return $c(t,"long","month");case"MMM":return $c(t,"short","month");case"MM":return xc(s.M);case"M":return String(s.M);case"DD":return xc(s.D);case"D":return String(s.D);case"dddd":return $c(t,"long","weekday");case"ddd":return $c(t,"short","weekday");case"HH":return xc(s.h);case"H":return String(s.h);case"hh":return xc(i);case"h":return String(i);case"mm":return xc(s.m);case"ss":return xc(s.s);case"SSS":return(t=>String(t).padStart(3,"0"))(s.ms);case"A":return s.h>=12?"PM":"AM";case"a":return s.h>=12?"pm":"am";case"Z":return Tc(n,!0);case"ZZ":return Tc(n,!1);default:return e}});return a.replace(/\0(\d+)\0/g,(t,e)=>r[+e])}const Vc=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60],["second",1]];const Wc=Symbol("ts"),Bc=Object.create(Number.prototype);function Hc(t){return function(t){const e=Object.create(Bc);return e[Wc]=t,e}(void 0===t?Date.now():Nc(t))}function Yc(t){null==t?(wc(null),vc(null)):(wc(t.offset),vc(t.name))}function qc(t){wc(t),vc(null)}function Xc(){return Sc()}function Zc(t){!function(t){yc=t}(t??null)}function Gc(){return Ec()}function Kc(){let t;try{t=Intl.supportedValuesOf("timeZone")}catch{return[]}const e=Date.now();return t.map(t=>({name:t,longName:kc(t,e),shortName:Ac(t,e),offset:Cc(t,e)}))}function Qc(t){const e=t??Ec(),n=new Intl.DateTimeFormat(e,{month:"long",timeZone:"UTC"}),s=new Intl.DateTimeFormat(e,{month:"short",timeZone:"UTC"}),i=[];for(let t=1;t<=12;t++){const e=new Date(Date.UTC(2024,t-1,15,12,0,0));i.push({number:t,name:n.format(e),shortName:s.format(e)})}return i}function Jc(t,e){if(!Number.isInteger(t)||!Number.isInteger(e)||e<1||e>12)throw new RangeError("getCalendar(year, month): month must be integer 1–12");const n=Hc({year:t,month:e,day:1}),{year:s,month:i,numberOfDaysOfTheMonth:r}=n.values,o=[];for(let t=Mc(n.valueOf(),Sc()).wd;t>0;t--)o.push(Hc({year:s,month:i,day:1-t}));for(let t=1;t<=r;t++)o.push(Hc({year:s,month:i,day:t}));const a=o.length%7,l=0===a?0:7-a,c=Hc({year:s,month:i,day:r});for(let t=0;t<l;t++)c.add(1,"day"),o.push(Hc(c.valueOf()));const h=[];for(let t=0;t<o.length;t+=7)h.push(o.slice(t,t+7));return h}Object.defineProperties(Bc,{valueOf:{value(){return this[Wc]},writable:!1,configurable:!1},values:{get(){const t=this[Wc],e=Mc(t,Sc());return{year:e.Y,month:e.M,monthName:Dc(e.M),dayName:zc(e.wd),date:e.D,weekStartDayName:zc(Oc()),numberOfDaysOfTheMonth:new Date(e.Y,e.M,0).getDate(),hours:e.h,minutes:e.m,seconds:e.s,milliSeconds:e.ms,timestamp:t,iso:new Date(t).toISOString()}},configurable:!1},toJSON:{value(){const t=this[Wc];return Number.isFinite(t)?new Date(t).toISOString():"Invalid Date"},writable:!1,configurable:!1},toString:{value(){const t=this[Wc];return Number.isFinite(t)?new Intl.DateTimeFormat(Ec(),{dateStyle:"medium",...bc()?{timeZone:bc()}:{timeZone:"UTC"}}).format(new Date(bc()?t:t+6e4*Sc())):"Invalid Date"},writable:!1,configurable:!1},format:{value(t){return Uc(this[Wc],t)},writable:!1,configurable:!1},formatLongAgo:{value(t){return function(t,e={}){const{numeric:n="auto",style:s="long"}=e,i=((void 0!==e.now?Nc(e.now):Date.now())-t)/1e3,r=Math.abs(i),o=i>=0?-1:1,a=new Intl.RelativeTimeFormat(Ec(),{numeric:n,style:s});for(const[t,e]of Vc)if(r>=e)return a.format(o*Math.round(r/e),t);return a.format(0,"second")}(this[Wc],t)},writable:!1,configurable:!1},add:{value(t,e){return this[Wc]=Lc(this[Wc],t,e),this},writable:!1,configurable:!1},subtract:{value(t,e){return this[Wc]=Lc(this[Wc],-t,e),this},writable:!1,configurable:!1},isBefore:{value(t){return this[Wc]<Nc(t)},writable:!1,configurable:!1},isAfter:{value(t){return this[Wc]>Nc(t)},writable:!1,configurable:!1},isFuture:{value(){return this[Wc]>Date.now()},writable:!1,configurable:!1},isPresent:{value(){return jc(this[Wc],Date.now())},writable:!1,configurable:!1},isToday:{value(){return jc(this[Wc],Date.now())},writable:!1,configurable:!1},isYesterday:{value(){const t=Lc(Fc(Date.now()),-1,"day");return jc(this[Wc],t)},writable:!1,configurable:!1},isTomorrow:{value(){const t=Lc(Fc(Date.now()),1,"day");return jc(this[Wc],t)},writable:!1,configurable:!1},getDifference:{value(t,e){return function(t,e,n){const s=Rc(n),i=t-e;if("ms"===s)return i;if("second"===s)return Math.trunc(i/1e3);if("min"===s)return Math.trunc(i/6e4);if("hour"===s)return Math.trunc(i/36e5);const r=Sc(),o=Mc(t,r),a=Mc(e,r);if("day"===s||"week"===s){const n=Math.floor((t+6e4*r)/864e5)-Math.floor((e+6e4*r)/864e5);return"week"===s?Math.trunc(n/7):n}return"month"===s?12*(o.Y-a.Y)+(o.M-a.M):o.Y-a.Y}(this[Wc],Nc(t),e)},writable:!1,configurable:!1},getAge:{value(t){return function(t,e){const n=Sc(),s=Mc(t,n),i=Mc(e,n);let r=i.Y-s.Y,o=s.M,a=s.D;if(2===o&&29===a){const t=t=>t%4==0&&t%100!=0||t%400==0;t(i.Y)||(o=3,a=1)}return(i.M<o||i.M===o&&i.D<a)&&r--,Math.max(0,r)}(this[Wc],void 0!==t?Nc(t):Date.now())},writable:!1,configurable:!1}});export{Ei as $,sc as Context,qs as ErrorTypes,Js as FetchClient,Oi as FetchUtils,Gn as MA,Xi as MatesUtils,Se as NotificationManager,Zl as Router,Li as RouterUtils,Wi as StorageUtils,Ee as SyncNotificationManager,qi as ThemeUtils,oo as WithScope,Ys as ZeroPromise,en as _,nn as _subToView,Kn as action,Kt as addStoreBeingRead,co as animatedIf,Yl as animatedRouter,ho as animatedX,Ar as arrayRange,le as assertComponentOuterContext,ae as assertNotInRestrictedContext,Ts as asyncAction,_t as asyncAppend,mt as asyncReplace,Es as atom,mo as attr,fs as blurInPreset,ps as blurOutPreset,as as bouncePreset,js as buildPath,Zs as buildRequestUrl,dr as cacheAtom,xs as cacheFn,fr as changeFlagAtom,kr as chunk,Cr as clamp,wt as classMap,yo as classes,He as cleanupScheduler,_s as collapseWidthPreset,Ln as collectSSRStyles,re as componentRunningStatus,Ul as computeAutoPlacement,wn as configureCSS,Eo as countdown,xs as createCacheManager,Pl as createFloatingContainer,Rs as createManagedTimer,$s as createPollingManager,bs as createReactiveRunner,or as createTimedAtom,Hc as date,zs as debounce,ar as debouncedAtom,Fe as decrementSsrAsyncCounter,rc as deepClone,ys as deepFreeze,lr as delayAtom,hi as deleteAction,ys as df,Rl as dialog,Co as disappear,Ue as done,ki as effect,Ye as effectScheduler,fo as eleHook,Te as event,ms as expandWidthPreset,Qn as fadeInPreset,Jn as fadeOutPreset,ri as fetchAction,us as flipInPreset,ds as flipOutPreset,gr as formAtom,wr as get,oi as getAction,jr as getAllProps,Kc as getAllTimezones,Jc as getCalendar,ic as getCookieObj,jl as getCoords,Me as getCurrentHost,Br as getGlobalScopeClasses,Gc as getLocale,Qc as getMonths,Ur as getParentScope,Ur as getScope,Ve as getSsrAsyncCounter,Zt as getStoresBeingRead,Xc as getTimezoneOffset,Yn as globalCSS,qe as globalScheduler,fi as globalTheme,xr as groupBy,bt as guard,b as html,ko as htmlHook,Cs as iAtom,St as ifDefined,je as incrementSsrAsyncCounter,Ya as indexDB,Zn as injectMatesAnimations,Bt as installDevToolsHooks,Ki as isAction,Xs as isApiResponseSuccess,Qi as isAsyncAction,rr as isAsyncFunction,ln as isAsyncValue,Zi as isAtom,nr as isChannel,er as isConfirmationEvent,oc as isDefinedAsGetter,We as isDev,Ht as isDevToolsInstalled,Gt as isEffectRunning,Or as isEmail,$r as isEmpty,tr as isEvent,ir as isFunction,sr as isGetter,oe as isInRestrictedContext,Nr as isMax,Dr as isMin,Bl as isPathMatching,zr as isPattern,Xt as isReadTrackingEnabled,Rr as isRequired,Pe as isSSR,Ji as isSetter,Gi as isUnit,Tr as iterateDeeply,Et as join,Ct as keyed,Hn as keyframes,Io as lazyLoad,yt as litCache,At as live,pe as log,me as logError,_e as logWarning,cr as mapAtom,jo as masonryGrid,he as matesLogEvent,Pr as maxLength,Lr as memo,Wo as memoTemplate,Er as merge,Ir as minLength,el as miniDB,E as noChange,C as nothing,br as omit,rn as on,Qe as onAllMount,al as onBlur,Je as onCleanup,bl as onClickAway,Do as onConnect,fl as onCopy,pl as onCut,$l as onDOMReady,No as onDisconnect,bo as onEleEvent,to as onError,Qo as onEvent,vl as onFileDrop,ll as onFocus,To as onHidden,xo as onIntersect,Al as onInterval,ml as onKeyDown,_l as onKeyUp,Ge as onMount,Cl as onNavigate,hl as onOffline,cl as onOnline,Ke as onPaint,ea as onParent,dl as onPaste,eo as onReferenceChange,El as onResize,Sl as onScroll,Oo as onScrolledIntoView,yl as onSelectionChange,Ml as onSocket,wl as onStorageChange,kl as onTimeout,xl as onUpdate,gl as onVisibilityChange,$o as onVisible,il as onWindow,rl as onWindowCapture,ul as onWindowResize,ol as onWindowScroll,Ni as onceIdle,Ds as paginatedAsyncAction,pr as paginationAtom,ci as patchAction,vr as pick,Fl as placementTransform,Jt as popEffect,Ll as popup,Wl as portal,ai as postAction,hs as pulsePreset,Qt as pushEffect,li as putAction,qa as randomId,kt as range,$i as ref,xe as registerCleanup,Wr as registerGlobalScopes,_o as removeAttr,wo as removeClasses,Jo as removeOn,ra as removeStyle,F as render,na as renderSwitch,ao as renderTemplate,ro as renderX,xt as repeat,ql as replaceParams,Be as resetComponentState,cn as resolveAsyncValue,ee as restoreTracking,pi as rootCSS,Xl as route,ei as runWithGlobalInterceptors,ue as safeClone,mc as safeSVG,Xe as safetyCheck,te as saveAndEnableTracking,is as scaleInPreset,rs as scaleOutPreset,Fr as scope,hr as setAtom,Zc as setLocale,Ti as setRef,Vs as setSSRApiLookup,Ie as setSSRMode,Ws as setSSRRequest,Le as setSsrDoneCallback,Yc as setTimezone,qc as setTimezoneOffset,tn as setter,cs as shakePreset,Cs as signal,es as slideInPreset,ns as slideOutPreset,os as spinPreset,ls as springInPreset,ne as startTracking,se as stopTracking,Qr as store,ia as style,Rt as styleMap,Fn as stylesheet,As as superAtom,S as svg,Ns as taskAction,io as template,Ls as throttle,ur as throttledAtom,aa as timerTemplate,ws as trackAndSubscribe,Mr as uniqBy,It as unsafeHTML,mc as unsafeSVG,Dt as until,hn as unwrapModule,on as useContext,ec as useCtx,So as useEleEvent,qr as useFetch,nc as useIsSSR,Yr as useRouter,Fr as useScope,Jr as useState,Xr as useStorage,sn as useStore,Zr as useTheme,Hr as useUtils,qa as uuid,yr as validateAll,vs as validateReactiveFunction,so as view,Na as virtualList,La as virtualMasonry,rn as watch,Nt as when,ni as withAuth,si as withBaseUrl,ke as withHost,ii as withLogging,gs as withStaggerPreset,Jl as ws,no as x,$e as xTabEvent};
|
|
176
|
+
`}};function Yl(t,e={}){return no(Hl,{routes:t,options:e})}function ql(t,e){if("undefined"==typeof window)return;const{pathAtom:n,navigateTo:s}=Ur(Xi),i=n.get(),r=t.split("/"),o=i.split("/");if(r.length!==o.length)return void console.warn(`replaceParams: pattern "${t}" has ${r.length} segments but current path "${i}" has ${o.length}. No-op.`);const a=new Set(r.filter(t=>t.startsWith(":")).map(t=>t.slice(1)));for(const n of Object.keys(e))a.has(n)||console.warn(`replaceParams: param "${n}" not found in pattern "${t}".`);const l=o.map((t,n)=>{const s=r[n];if(!s.startsWith(":"))return t;const i=s.slice(1);return i in e?String(e[i]):t}),c=l.join("/");c!==i&&s(c,!0)}const Xl=(t,{view:e})=>Bl(t)?e?so(e,{}):C:null,Zl=(t,e)=>{const n=t.find(t=>Bl(t.path));if(void 0===n)return e?()=>no(e):()=>C;const{component:s}=n;return()=>no(s)},Gl=1e3,Kl=3e4,Ql=1/0;function Jl(t,e={}){le("ws");const{reconnect:n=!0,reconnectDelay:s=Gl,reconnectMaxDelay:i=Kl,reconnectMaxAttempts:r=Ql,protocols:o,auth:a,autoConnect:l=!0}=e,c=Es("connecting",{skipRestrictedContextCheck:!0}),h=new Set;let u=null,d=0,f=s,p=null,m=!1;const _=[];function g(){null!==p&&(clearTimeout(p),p=null)}function y(){let e;m=!1,g(),c.set("connecting");try{e=function(){if(!a)return t;const e=a(),n=Object.entries(e);if(0===n.length)return t;const s=n.map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&");return t.includes("?")?`${t}&${s}`:`${t}?${s}`}()}catch(t){return me(t),void c.set("error")}try{u=o?new WebSocket(e,o):new WebSocket(e)}catch(t){return me(t),c.set("error"),void w()}u.onopen=()=>{m?u?.close():(d=0,f=s,c.set("connected"),function(){for(;_.length>0;){const t=_.shift();u?.readyState===WebSocket.OPEN&&u.send(t)}}())},u.onmessage=t=>{if(m)return;const e="string"==typeof t.data?t.data:String(t.data);let n;try{n=JSON.parse(e)}catch{n=e}var s;s=n,h.forEach(t=>{try{t(s)}catch(t){me(t)}})},u.onerror=()=>{c.set("error")},u.onclose=()=>{m||(c.set("disconnected"),w())}}function w(){if(!n||m)return;if(d>=r)return;d++;const t=f;f=Math.min(2*f,i),p=setTimeout(()=>{m||y()},t)}function v(){m=!0,g(),u&&(u.onopen=null,u.onmessage=null,u.onerror=null,u.onclose=null,u.readyState!==WebSocket.OPEN&&u.readyState!==WebSocket.CONNECTING||u.close(1e3,"client disconnect"),u=null),c.set("disconnected"),h.clear(),_.length=0}const b={send:function(t){const e="string"==typeof t?t:JSON.stringify(t);u?.readyState===WebSocket.OPEN?u.send(e):_.push(e)},__subscribe:function(t){return h.add(t),()=>h.delete(t)},status:c,connect:y,disconnect:v,__isWs___:!0};return l?y():c.set("disconnected"),$e(b,v),b}const tc=Symbol.for("mates.ssrContextStorage");function ec(){const t=globalThis[tc];if(t&&"function"==typeof t.getStore){const e=t.getStore();return e?.ctx}}function nc(){const t=globalThis[tc];if(t&&"function"==typeof t.getStore){const e=t.getStore();return!0===e?.ssrMode}return!1}class sc{constructor(){this.id=Math.random().toString(36).substring(2,15),this.context=null}}function ic(){if("undefined"==typeof document)return{};const t=document.cookie;if(!t)return{};const e={};for(const n of t.split(";")){const t=n.indexOf("=");if(-1===t)continue;const s=n.slice(0,t).trim();if(!s)continue;const i=n.slice(t+1).trim();try{e[s]=decodeURIComponent(i)}catch{e[s]=i}}return e}function rc(t,e=new WeakMap){if("function"==typeof structuredClone)return structuredClone(t);if(null===t||"object"!=typeof t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(t instanceof Map){const n=new Map;return e.set(t,n),t.forEach((t,s)=>n.set(rc(s,e),rc(t,e))),n}if(t instanceof Set){const n=new Set;return e.set(t,n),t.forEach(t=>n.add(rc(t,e))),n}if(Array.isArray(t)){const n=[];e.set(t,n);for(let s=0;s<t.length;s++)n[s]=rc(t[s],e);return n}const n=e.get(t);if(n)return n;const s={};e.set(t,s);for(const n of Object.keys(t))s[n]=rc(t[n],e);return s}function oc(t,e){let n=Object.getOwnPropertyDescriptor(t,e),s=Object.getPrototypeOf(t);for(;!n&&s&&s!==Object.prototype;)n=Object.getOwnPropertyDescriptor(s,e),s=Object.getPrototypeOf(s);return n?.get&&"function"==typeof n.get?n.get:null}var ac,lc,cc,hc,uc,dc;function fc(t){return"number"==typeof t?`${t}px`:t}lc=new WeakMap,cc=new WeakMap,hc=new WeakMap,uc=new WeakMap,ac=new WeakSet,dc=function(t){ge(this,lc,"f")?.remove(),ye(this,lc,null,"f"),ye(this,cc,"","f"),ye(this,hc,"","f"),ye(this,uc,new Set,"f");const e=t.endNode;if(e?.parentNode){const n=t.startNode,s=document.createRange();s.setStartAfter(n),s.setEndBefore(e),s.deleteContents()}};const pc=Y(class extends q{constructor(t){if(super(t),ac.add(this),lc.set(this,null),cc.set(this,""),hc.set(this,""),uc.set(this,new Set),t.type!==V)throw new Error("safeSVG() must be used as a child expression, e.g. html`<div>${safeSVG(markup)}</div>`")}update(t,[e,n]){if(console.log("update"),!e.trimStart().startsWith("<svg"))return console.warn("safeSVG: input does not start with <svg — nothing rendered"),ge(this,ac,"m",dc).call(this,t),E;const s=JSON.stringify(n);if(null===ge(this,lc,"f")||e!==ge(this,cc,"f")){const n=function(t){const e=document.createElement("template");e.innerHTML=t;const n=e.content.firstElementChild;return n instanceof SVGElement?n:null}(e);if(null===n)return console.warn("safeSVG: failed to parse SVG markup — nothing rendered"),ge(this,ac,"m",dc).call(this,t),E;ge(this,lc,"f")?.remove(),ye(this,lc,n,"f"),ye(this,cc,e,"f"),ye(this,hc,"","f"),ye(this,uc,new Set,"f");const s=t.endNode;s.parentNode.insertBefore(ge(this,lc,"f"),s)}if(s!==ge(this,hc,"f")){const t=function(t,e){const n=new Set,s=(e,s)=>{t.setAttribute(e,s),n.add(e)},i=e.width??e.size,r=e.height??e.size;void 0!==i&&s("width",fc(i)),void 0!==r&&s("height",fc(r)),void 0!==e.fill&&s("fill",e.fill),void 0!==e.stroke&&s("stroke",e.stroke),void 0!==e.strokeWidth&&s("stroke-width",String(e.strokeWidth)),void 0!==e.strokeLinecap&&s("stroke-linecap",e.strokeLinecap),void 0!==e.strokeLinejoin&&s("stroke-linejoin",e.strokeLinejoin),void 0!==e.opacity&&s("opacity",String(e.opacity)),void 0!==e.viewBox&&s("viewBox",e.viewBox),void 0!==e.transform&&s("transform",e.transform);const o=[],a=e.width??e.size,l=e.height??e.size;void 0!==a&&o.push(`width:${fc(a)}`),void 0!==l&&o.push(`height:${fc(l)}`),void 0!==e.color&&o.push(`color:${e.color}`),o.push("display:inline-block"),o.push("vertical-align:middle"),e.style&&o.push(e.style),s("style",o.join(";")),e.class&&s("class",e.class);const c=e.ariaHidden??!0;return e.ariaLabel?(s("aria-label",e.ariaLabel),s("role","img")):c&&s("aria-hidden","true"),n}(ge(this,lc,"f"),n);for(const e of ge(this,uc,"f"))t.has(e)||ge(this,lc,"f").removeAttribute(e);ye(this,uc,t,"f"),ye(this,hc,s,"f")}return E}render(t,e){return E}});function mc(t,e={}){return pc(t,e)}let _c=null,gc=null,yc=null;function wc(t){_c=t}function vc(t){gc=t}function bc(){return gc}function Sc(){return _c??-(new Date).getTimezoneOffset()}function Ec(){return yc??("undefined"!=typeof navigator?navigator.language:null)??"en"}function Cc(t,e){const n={};for(const s of new Intl.DateTimeFormat("en",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(new Date(e)))"literal"!==s.type&&(n[s.type]=parseInt(s.value,10));const s=24===n.hour?0:n.hour,i=Date.UTC(n.year,n.month-1,n.day,s,n.minute,n.second);return Math.round((i-e)/6e4)||0}function Ac(t,e){try{const n=new Intl.DateTimeFormat("en",{timeZone:t,timeZoneName:"short"}).formatToParts(new Date(e)).find(t=>"timeZoneName"===t.type);return n?n.value:t}catch{return t}}function kc(t,e){try{const n=new Intl.DateTimeFormat("en",{timeZone:t,timeZoneName:"long"}).formatToParts(new Date(e)).find(t=>"timeZoneName"===t.type);return n?n.value:t}catch{return t}}function Mc(t,e){const n=new Date(t+6e4*e);return{Y:n.getUTCFullYear(),M:n.getUTCMonth()+1,D:n.getUTCDate(),h:n.getUTCHours(),m:n.getUTCMinutes(),s:n.getUTCSeconds(),ms:n.getUTCMilliseconds(),wd:n.getUTCDay()}}const $c=t=>String(t).padStart(2,"0");function xc(t,e,n){const s={[n]:e};return gc?s.timeZone=gc:(s.timeZone="UTC",t+=6e4*Sc()),new Intl.DateTimeFormat(Ec(),s).format(new Date(t))}function Tc(t,e){const n=t>=0?"+":"-",s=Math.abs(t);return e?`${n}${$c(Math.floor(s/60))}:${$c(s%60)}`:`${n}${$c(Math.floor(s/60))}${$c(s%60)}`}function Rc(t){const e=t.replace(/s$/,"");if("millisecond"===e||"m"===e)return"ms";if("minute"===e)return"min";if(!new Set(["year","month","week","day","hour","min","second","ms"]).has(e))throw new RangeError(`Invalid date unit: "${t}"`);return e}function Oc(){try{const t=new Intl.Locale(Ec()),e=t.weekInfo?.firstDay??t.getWeekInfo?.()?.firstDay;if(void 0!==e)return e%7}catch{}return 0}const Ic=/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|H|hh|h|mm|ss|SSS|ZZ|Z|A|a/g,Pc=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function zc(t){try{const e=new Date(Date.UTC(2024,0,7+t,12,0,0));return new Intl.DateTimeFormat(Ec(),{weekday:"long",timeZone:"UTC"}).format(e)}catch{return Pc[t]||""}}function Dc(t){try{const e=new Date(Date.UTC(2024,t-1,15,12,0,0));return new Intl.DateTimeFormat(Ec(),{month:"long",timeZone:"UTC"}).format(e)}catch{return""}}function Nc(t){if(t instanceof Number)return t.valueOf();if("number"==typeof t)return t;if("string"==typeof t)return new Date(t).getTime();if(t instanceof Date)return t.getTime();if("object"==typeof t&&null!==t){const{year:e=1970,month:n=1,day:s=1,hour:i=0,minute:r=0,second:o=0,ms:a=0}=t;return Date.UTC(e,n-1,s,i,r,o,a)-6e4*Sc()}return NaN}function Lc(t,e,n){const s=Rc(n);if("hour"===s)return t+36e5*e;if("min"===s)return t+6e4*e;if("second"===s)return t+1e3*e;if("ms"===s)return t+e;const i=Sc(),r=Mc(t,i);let o=r.Y,a=r.M,l=r.D;if("year"===s)o+=e;else if("month"===s){const t=a-1+e;o+=Math.floor(t/12),a=(t%12+12)%12+1,l=Math.min(l,new Date(o,a,0).getDate())}else l+="week"===s?7*e:e;return Date.UTC(o,a-1,l,r.h,r.m,r.s,r.ms)-6e4*i}function jc(t,e){const n=Sc(),s=Mc(t,n),i=Mc(e,n);return s.Y===i.Y&&s.M===i.M&&s.D===i.D}function Fc(t){const e=Sc(),n=Mc(t,e);return Date.UTC(n.Y,n.M-1,n.D,0,0,0,0)-6e4*e}function Uc(t,e){const n=Sc(),s=Mc(t,n),i=s.h%12||12,r=[],o=e.replace(/\[([^\]]*)\]/g,(t,e)=>(r.push(e),`\0${r.length-1}\0`));Ic.lastIndex=0;const a=o.replace(Ic,e=>{switch(e){case"YYYY":return String(s.Y);case"YY":return String(s.Y).slice(-2);case"MMMM":return xc(t,"long","month");case"MMM":return xc(t,"short","month");case"MM":return $c(s.M);case"M":return String(s.M);case"DD":return $c(s.D);case"D":return String(s.D);case"dddd":return xc(t,"long","weekday");case"ddd":return xc(t,"short","weekday");case"HH":return $c(s.h);case"H":return String(s.h);case"hh":return $c(i);case"h":return String(i);case"mm":return $c(s.m);case"ss":return $c(s.s);case"SSS":return(t=>String(t).padStart(3,"0"))(s.ms);case"A":return s.h>=12?"PM":"AM";case"a":return s.h>=12?"pm":"am";case"Z":return Tc(n,!0);case"ZZ":return Tc(n,!1);default:return e}});return a.replace(/\0(\d+)\0/g,(t,e)=>r[+e])}const Vc=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60],["second",1]];const Wc=Symbol("ts"),Bc=Object.create(Number.prototype);function Hc(t){return function(t){const e=Object.create(Bc);return e[Wc]=t,e}(void 0===t?Date.now():Nc(t))}function Yc(t){null==t?(wc(null),vc(null)):(wc(t.offset),vc(t.name))}function qc(t){wc(t),vc(null)}function Xc(){return Sc()}function Zc(t){!function(t){yc=t}(t??null)}function Gc(){return Ec()}function Kc(){let t;try{t=Intl.supportedValuesOf("timeZone")}catch{return[]}const e=Date.now();return t.map(t=>({name:t,longName:kc(t,e),shortName:Ac(t,e),offset:Cc(t,e)}))}function Qc(t){const e=t??Ec(),n=new Intl.DateTimeFormat(e,{month:"long",timeZone:"UTC"}),s=new Intl.DateTimeFormat(e,{month:"short",timeZone:"UTC"}),i=[];for(let t=1;t<=12;t++){const e=new Date(Date.UTC(2024,t-1,15,12,0,0));i.push({number:t,name:n.format(e),shortName:s.format(e)})}return i}function Jc(t,e){if(!Number.isInteger(t)||!Number.isInteger(e)||e<1||e>12)throw new RangeError("getCalendar(year, month): month must be integer 1–12");const n=Hc({year:t,month:e,day:1}),{year:s,month:i,numberOfDaysOfTheMonth:r}=n.values,o=[];for(let t=Mc(n.valueOf(),Sc()).wd;t>0;t--)o.push(Hc({year:s,month:i,day:1-t}));for(let t=1;t<=r;t++)o.push(Hc({year:s,month:i,day:t}));const a=o.length%7,l=0===a?0:7-a,c=Hc({year:s,month:i,day:r});for(let t=0;t<l;t++)c.add(1,"day"),o.push(Hc(c.valueOf()));const h=[];for(let t=0;t<o.length;t+=7)h.push(o.slice(t,t+7));return h}Object.defineProperties(Bc,{valueOf:{value(){return this[Wc]},writable:!1,configurable:!1},values:{get(){const t=this[Wc],e=Mc(t,Sc());return{year:e.Y,month:e.M,monthName:Dc(e.M),dayName:zc(e.wd),date:e.D,weekStartDayName:zc(Oc()),numberOfDaysOfTheMonth:new Date(e.Y,e.M,0).getDate(),hours:e.h,minutes:e.m,seconds:e.s,milliSeconds:e.ms,timestamp:t,iso:new Date(t).toISOString()}},configurable:!1},toJSON:{value(){const t=this[Wc];return Number.isFinite(t)?new Date(t).toISOString():"Invalid Date"},writable:!1,configurable:!1},toString:{value(){const t=this[Wc];return Number.isFinite(t)?new Intl.DateTimeFormat(Ec(),{dateStyle:"medium",...bc()?{timeZone:bc()}:{timeZone:"UTC"}}).format(new Date(bc()?t:t+6e4*Sc())):"Invalid Date"},writable:!1,configurable:!1},format:{value(t){return Uc(this[Wc],t)},writable:!1,configurable:!1},formatLongAgo:{value(t){return function(t,e={}){const{numeric:n="auto",style:s="long"}=e,i=((void 0!==e.now?Nc(e.now):Date.now())-t)/1e3,r=Math.abs(i),o=i>=0?-1:1,a=new Intl.RelativeTimeFormat(Ec(),{numeric:n,style:s});for(const[t,e]of Vc)if(r>=e)return a.format(o*Math.round(r/e),t);return a.format(0,"second")}(this[Wc],t)},writable:!1,configurable:!1},add:{value(t,e){return this[Wc]=Lc(this[Wc],t,e),this},writable:!1,configurable:!1},subtract:{value(t,e){return this[Wc]=Lc(this[Wc],-t,e),this},writable:!1,configurable:!1},isBefore:{value(t){return this[Wc]<Nc(t)},writable:!1,configurable:!1},isAfter:{value(t){return this[Wc]>Nc(t)},writable:!1,configurable:!1},isFuture:{value(){return this[Wc]>Date.now()},writable:!1,configurable:!1},isPresent:{value(){return jc(this[Wc],Date.now())},writable:!1,configurable:!1},isToday:{value(){return jc(this[Wc],Date.now())},writable:!1,configurable:!1},isYesterday:{value(){const t=Lc(Fc(Date.now()),-1,"day");return jc(this[Wc],t)},writable:!1,configurable:!1},isTomorrow:{value(){const t=Lc(Fc(Date.now()),1,"day");return jc(this[Wc],t)},writable:!1,configurable:!1},getDifference:{value(t,e){return function(t,e,n){const s=Rc(n),i=t-e;if("ms"===s)return i;if("second"===s)return Math.trunc(i/1e3);if("min"===s)return Math.trunc(i/6e4);if("hour"===s)return Math.trunc(i/36e5);const r=Sc(),o=Mc(t,r),a=Mc(e,r);if("day"===s||"week"===s){const n=Math.floor((t+6e4*r)/864e5)-Math.floor((e+6e4*r)/864e5);return"week"===s?Math.trunc(n/7):n}return"month"===s?12*(o.Y-a.Y)+(o.M-a.M):o.Y-a.Y}(this[Wc],Nc(t),e)},writable:!1,configurable:!1},getAge:{value(t){return function(t,e){const n=Sc(),s=Mc(t,n),i=Mc(e,n);let r=i.Y-s.Y,o=s.M,a=s.D;if(2===o&&29===a){const t=t=>t%4==0&&t%100!=0||t%400==0;t(i.Y)||(o=3,a=1)}return(i.M<o||i.M===o&&i.D<a)&&r--,Math.max(0,r)}(this[Wc],void 0!==t?Nc(t):Date.now())},writable:!1,configurable:!1}});export{Ei as $,sc as Context,qs as ErrorTypes,Js as FetchClient,Oi as FetchUtils,Gn as MA,Xi as MatesUtils,Se as NotificationManager,Zl as Router,Li as RouterUtils,Wi as StorageUtils,Ee as SyncNotificationManager,qi as ThemeUtils,oo as WithScope,Ys as ZeroPromise,en as _,nn as _subToView,Kn as action,Kt as addStoreBeingRead,co as animatedIf,Yl as animatedRouter,ho as animatedX,Ar as arrayRange,le as assertComponentOuterContext,ae as assertNotInRestrictedContext,Ts as asyncAction,_t as asyncAppend,mt as asyncReplace,Es as atom,mo as attr,fs as blurInPreset,ps as blurOutPreset,as as bouncePreset,js as buildPath,Zs as buildRequestUrl,dr as cacheAtom,$s as cacheFn,fr as changeFlagAtom,kr as chunk,Cr as clamp,wt as classMap,yo as classes,He as cleanupScheduler,_s as collapseWidthPreset,Ln as collectSSRStyles,re as componentRunningStatus,Ul as computeAutoPlacement,wn as configureCSS,Eo as countdown,$s as createCacheManager,Pl as createFloatingContainer,Rs as createManagedTimer,xs as createPollingManager,bs as createReactiveRunner,or as createTimedAtom,Hc as date,zs as debounce,ar as debouncedAtom,Fe as decrementSsrAsyncCounter,rc as deepClone,ys as deepFreeze,lr as delayAtom,hi as deleteAction,ys as df,Rl as dialog,Co as disappear,Ue as done,ki as effect,Ye as effectScheduler,fo as eleHook,Te as event,ms as expandWidthPreset,Qn as fadeInPreset,Jn as fadeOutPreset,ri as fetchAction,us as flipInPreset,ds as flipOutPreset,gr as formAtom,wr as get,oi as getAction,jr as getAllProps,Kc as getAllTimezones,Jc as getCalendar,ic as getCookieObj,jl as getCoords,Me as getCurrentHost,Br as getGlobalScopeClasses,Gc as getLocale,Qc as getMonths,Ur as getParentScope,Ur as getScope,Ve as getSsrAsyncCounter,Zt as getStoresBeingRead,Xc as getTimezoneOffset,Yn as globalCSS,qe as globalScheduler,fi as globalTheme,$r as groupBy,bt as guard,b as html,ko as htmlHook,Cs as iAtom,St as ifDefined,je as incrementSsrAsyncCounter,Ya as indexDB,Zn as injectMatesAnimations,Bt as installDevToolsHooks,Ki as isAction,Xs as isApiResponseSuccess,Qi as isAsyncAction,rr as isAsyncFunction,ln as isAsyncValue,Zi as isAtom,nr as isChannel,er as isConfirmationEvent,oc as isDefinedAsGetter,We as isDev,Ht as isDevToolsInstalled,Gt as isEffectRunning,Or as isEmail,xr as isEmpty,tr as isEvent,ir as isFunction,sr as isGetter,oe as isInRestrictedContext,Nr as isMax,Dr as isMin,Bl as isPathMatching,zr as isPattern,Xt as isReadTrackingEnabled,Rr as isRequired,Pe as isSSR,Ji as isSetter,Gi as isUnit,Tr as iterateDeeply,Et as join,Ct as keyed,Hn as keyframes,Io as lazyLoad,yt as litCache,At as live,pe as log,me as logError,_e as logWarning,cr as mapAtom,jo as masonryGrid,he as matesLogEvent,Pr as maxLength,Lr as memo,Wo as memoTemplate,Er as merge,Ir as minLength,el as miniDB,E as noChange,C as nothing,br as omit,rn as on,Qe as onAllMount,al as onBlur,Je as onCleanup,bl as onClickAway,Do as onConnect,fl as onCopy,pl as onCut,xl as onDOMReady,No as onDisconnect,bo as onEleEvent,to as onError,Qo as onEvent,vl as onFileDrop,ll as onFocus,To as onHidden,$o as onIntersect,Al as onInterval,ml as onKeyDown,_l as onKeyUp,Ge as onMount,Cl as onNavigate,hl as onOffline,cl as onOnline,Ke as onPaint,ea as onParent,dl as onPaste,eo as onReferenceChange,El as onResize,Sl as onScroll,Oo as onScrolledIntoView,yl as onSelectionChange,Ml as onSocket,wl as onStorageChange,kl as onTimeout,$l as onUpdate,gl as onVisibilityChange,xo as onVisible,il as onWindow,rl as onWindowCapture,ul as onWindowResize,ol as onWindowScroll,Ni as onceIdle,Ds as paginatedAsyncAction,pr as paginationAtom,ci as patchAction,vr as pick,Fl as placementTransform,Jt as popEffect,Ll as popup,Wl as portal,ai as postAction,hs as pulsePreset,Qt as pushEffect,li as putAction,qa as randomId,kt as range,xi as ref,$e as registerCleanup,Wr as registerGlobalScopes,_o as removeAttr,wo as removeClasses,Jo as removeOn,ra as removeStyle,F as render,na as renderSwitch,ao as renderTemplate,ro as renderX,$t as repeat,ql as replaceParams,Be as resetComponentState,cn as resolveAsyncValue,ee as restoreTracking,pi as rootCSS,Xl as route,ei as runWithGlobalInterceptors,ue as safeClone,mc as safeSVG,Xe as safetyCheck,te as saveAndEnableTracking,is as scaleInPreset,rs as scaleOutPreset,Fr as scope,hr as setAtom,Zc as setLocale,Ti as setRef,Vs as setSSRApiLookup,Ie as setSSRMode,Ws as setSSRRequest,Le as setSsrDoneCallback,Yc as setTimezone,qc as setTimezoneOffset,tn as setter,cs as shakePreset,Cs as signal,es as slideInPreset,ns as slideOutPreset,os as spinPreset,ls as springInPreset,ne as startTracking,se as stopTracking,Qr as store,ia as style,Rt as styleMap,Fn as stylesheet,As as superAtom,S as svg,Ns as taskAction,io as template,Ls as throttle,ur as throttledAtom,aa as timerTemplate,ws as trackAndSubscribe,Mr as uniqBy,It as unsafeHTML,mc as unsafeSVG,Dt as until,hn as unwrapModule,on as useContext,ec as useCtx,So as useEleEvent,qr as useFetch,nc as useIsSSR,Yr as useRouter,Fr as useScope,Jr as useState,Xr as useStorage,sn as useStore,Zr as useTheme,Hr as useUtils,qa as uuid,yr as validateAll,vs as validateReactiveFunction,so as view,Na as virtualList,La as virtualMasonry,rn as watch,Nt as when,ni as withAuth,si as withBaseUrl,ke as withHost,ii as withLogging,gs as withStaggerPreset,Jl as ws,no as x,xe as xTabEvent};
|
|
177
177
|
//# sourceMappingURL=index.esm.js.map
|