mates 0.4.0-beta.11 → 0.4.0-beta.12

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/index.esm.js CHANGED
@@ -106,7 +106,7 @@ ${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();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,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`
110
110
  <div ${Ti(e)} style="position:relative">
111
111
  ${n?o:a}
112
112
  </div>