@fluixi/template-runtime 0.1.0-alpha.1 → 0.1.0-alpha.11
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/cdn/fluixi.d.ts +1 -1
- package/dist/cdn/fluixi.global.js +4 -1
- package/dist/cdn/fluixi.js +1 -1
- package/dist/classify.cjs +99 -1
- package/dist/classify.mjs +78 -1
- package/dist/index.cjs +219 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +189 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +7 -6
|
@@ -1 +1,4 @@
|
|
|
1
|
-
"use strict";var Fluixi=(()=>{var tt=Object.defineProperty;var Qi=Object.getOwnPropertyDescriptor;var Yi=Object.getOwnPropertyNames;var eo=Object.prototype.hasOwnProperty;var dr=(e,t)=>{for(var r in t)tt(e,r,{get:t[r],enumerable:!0})},to=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Yi(t))!eo.call(e,i)&&i!==r&&tt(e,i,{get:()=>t[i],enumerable:!(n=Qi(t,i))||n.enumerable});return e};var ro=e=>to(tt({},"__esModule",{value:!0}),e);var ou={};dr(ou,{Dynamic:()=>Jt,ErrorBoundary:()=>Xt,For:()=>Vt,Index:()=>Bt,Match:()=>zt,Portal:()=>Gt,Show:()=>Ft,Switch:()=>Ut,batch:()=>W,define:()=>Ji,effect:()=>Yr,html:()=>Xi,hydrate:()=>ke,insert:()=>M,memo:()=>Qr,onCleanup:()=>ft,render:()=>we,resource:()=>en,signal:()=>Zr,store:()=>ln,svg:()=>Ki,untrack:()=>ee});var Qt={};dr(Qt,{ClientOnly:()=>oi,Dynamic:()=>Jt,ErrorBoundary:()=>Xt,FX_DATA_ID:()=>Wt,For:()=>Vt,Index:()=>Bt,Island:()=>wl,JSX_PROPERTIES:()=>gt,Match:()=>zt,NoSsr:()=>Tl,Portal:()=>Gt,SVG_ELEMENTS:()=>hs,SVG_NAMESPACE:()=>He,Show:()=>Ft,Switch:()=>Ut,VERSION:()=>Cn,VOID_ELEMENTS:()=>ds,addClass:()=>gn,addDelegatedEventListener:()=>_t,addNativeEventListener:()=>Pt,appendChildren:()=>$n,applyElementProp:()=>vt,applyProps:()=>Rt,applyUse:()=>Mt,asComponent:()=>Tn,asContext:()=>Ls,asOutlet:()=>js,asProvider:()=>qs,asRoute:()=>Rs,asRouter:()=>Ms,asRoutes:()=>Ds,asSuspense:()=>Is,bindPair:()=>Zn,captureHydrationCursor:()=>Vs,checkRenderType:()=>Ws,classMap:()=>Ol,cleanChildren:()=>H,cloneTemplate:()=>Ot,closest:()=>ms,createComponent:()=>jt,createDynamicElement:()=>$l,createElement:()=>Sn,createNativeElement:()=>Nt,createPortal:()=>Xn,createRequestContext:()=>Lt,createTemplate:()=>Tt,default:()=>Zl,delegate:()=>ks,delegateEvents:()=>ze,escapeFxJson:()=>ni,escapeHTML:()=>sl,fnName:()=>Ys,generateID:()=>Gs,getAttribute:()=>kn,getGlobal:()=>Os,getLitEventName:()=>cs,getLocals:()=>hl,getOffset:()=>ws,getRequestContext:()=>te,getRequestEvent:()=>ti,getRequestLocals:()=>ri,getServerData:()=>ii,getStableElementId:()=>Js,getStyle:()=>vs,handleRef:()=>be,hasClass:()=>ys,holeContent:()=>zn,holeEnd:()=>Bn,holeScope:()=>Vn,html:()=>Sl,hydrate:()=>ke,hydrateAdvancePast:()=>Ct,hydrateIslands:()=>xl,indexArray:()=>Pe,initializeIntegration:()=>cl,insert:()=>M,insertExpression:()=>he,intergartionInitialized:()=>fl,isAccessor:()=>ll,isComponent:()=>P,isContext:()=>jn,isCustomElement:()=>vn,isDOMNode:()=>Ns,isDelegatedEvent:()=>Zs,isDomElement:()=>Ln,isDomNode:()=>ge,isDomText:()=>In,isEventHandler:()=>us,isFunction:()=>Qs,isIntegrationInitialized:()=>Qn,isJSXTemplate:()=>_s,isLitTemplateResult:()=>En,isNativeElement:()=>ol,isOutlet:()=>Dn,isPromise:()=>fe,isProvider:()=>Rn,isReactElement:()=>Es,isRoute:()=>Mn,isRouter:()=>On,isRoutes:()=>Pn,isSVGElement:()=>Kn,isServer:()=>N,isSuspense:()=>qn,isTemplateFactory:()=>Cs,isVisible:()=>gs,iterateFn:()=>el,keyArray:()=>Oe,makeArrayFlat:()=>Un,mapArray:()=>Te,mergeProps:()=>Gn,observeIntersection:()=>Ss,observeResize:()=>As,query:()=>bt,queryAll:()=>ps,registerCoreVersion:()=>Ps,registerCreateComponent:()=>ul,registerGlobal:()=>Ts,removeAttribute:()=>xn,removeChildren:()=>An,removeClass:()=>bn,removeDelegatedEventListener:()=>We,render:()=>we,renderToString:()=>zl,renderToStringAsync:()=>Xl,resetIntegration:()=>Yn,runHydrationAt:()=>kt,runWithRequestContext:()=>It,runWithoutHydration:()=>Bs,scrollIntoView:()=>bs,serializeNode:()=>V,serializeResourceData:()=>gi,setAttribute:()=>_,setClassList:()=>ye,setClassName:()=>ne,setDataRedactor:()=>Jl,setDynamicAttribute:()=>pe,setDynamicBoolAttribute:()=>Dt,setDynamicProperty:()=>me,setProperty:()=>re,setRequestStore:()=>dl,setServerMode:()=>de,setStyle:()=>ve,setStyles:()=>$t,shouldSetAsProperty:()=>fs,splitProps:()=>il,spread:()=>Jn,stampVersions:()=>_n,styleMap:()=>Ml,svg:()=>Al,templateNode:()=>Fn,toAttributeName:()=>as,toggleClass:()=>wn,versions:()=>$,waitForElement:()=>xs,warnOnVersionSkew:()=>Nn});var no="__fluixi_signal_next_state__",io=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},p=globalThis[no]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:io,onSuspend:null,onError:null},hr=0,pr=1,le=2,mr=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(p.untracked)return;let e=p.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},oo=class extends mr{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,this.observers)for(let t of[...this.observers])t.markDirty(le);rt(this)}}peek(){return this._value}},yr=class extends mr{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=le,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(p.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===pr&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===le)break}(this.state===le||!this._initialized)&&this.recompute(),this.state=hr}recompute(){if(this.sources){for(let s of this.sources)s.observers?.delete(this);this.sources.clear()}let e=p.consumer,t=p.untracked;p.consumer=this,p.untracked=!1;let r,n=!1,i;try{r=this._fn()}catch(s){n=!0,i=s,r=this._value}finally{p.consumer=e,p.untracked=t}let o=!this._initialized||this._threw!==n||(n?i!==this._error:!this._equals(this._value,r));if(this._initialized=!0,this._threw=n,this._error=i,this._value=r,o){if(this.version++,this.observers)for(let s of[...this.observers])s.markDirty(le);rt(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===hr;if(this.state=e,t){if(this.observers)for(let r of[...this.observers])r.markDirty(pr);rt(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function rt(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var so=class{constructor(e){this._watched=new Set,this._pending=new Set,this._notifyFn=e}watch(...e){for(let t of e)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...e){for(let t of e)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let t=this._pending.size===0;this._pending.add(e),t&&this._notifyFn()}};function lo(e){if(p.untracked)return e();p.untracked=!0;try{return e()}finally{p.untracked=!1}}function X(e){let t=_e(e);return e&&(e.owned??=[]).push(t),t}function K(e,t=!0){ae(e,t)}function _e(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function vr(e){let t=Symbol("context");return{id:t,defaultValue:e,Provider:r=>{let n=p.owner,i=_e(n);(i.contexts=new Map).set(t,r.value),n&&(n.owned??=[]).push(i),p.owner=i;try{return r.children}finally{p.owner=n}}}}function gr(e,t){let r=e;for(;r;){if(r.contexts&&r.contexts.has(t.id))return r.contexts.get(t.id);r=r.parent}return t.defaultValue}function ao(e){p.onSuspend=e}function uo(e){return p.onSuspend?(p.onSuspend(e,p.owner),!0):!1}function co(e){p.onError=e}function D(){return p.owner}function C(e,t){let r=p.owner;p.owner=e;try{return t()}finally{p.owner=r}}function S(e){if(p.owner){if(p.owner.disposed){e();return}(p.owner.cleanups??=[]).push(e)}}function ae(e,t=!0){if(!e.disposed){if(e.owned){for(let r=e.owned.length-1;r>=0;r--)ae(e.owned[r]);e.owned=null}if(e.cleanups){for(let r=e.cleanups.length-1;r>=0;r--)e.cleanups[r]();e.cleanups=null}t&&(e.disposed=!0)}}function T(e){let t=_e(p.owner);p.owner&&(p.owner.owned??=[]).push(t);let r=p.owner;p.owner=t;try{return e(()=>ae(t))}finally{p.owner=r}}function fo(e){p.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function ho(e){e.queued||(e.queued=!0,p.queue.push(e),!p.scheduled&&p.batchDepth===0&&(p.scheduled=!0,p.hostSchedule(Ne)))}function Ne(){if(p.scheduled=!1,p.flushing)return;p.flushing=!0;let e=0;try{for(;p.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=p.queue;p.queue=[];for(let r of t)r.queued=!1,r.disposed||r.run()}}finally{p.flushing=!1}}function po(){p.batchDepth===0&&Ne()}function mo(e){p.batchDepth++;try{return e()}finally{--p.batchDepth===0&&Ne()}}var yo=class{constructor(e){this.queued=!1,this.disposed=!1,this.owner=_e(p.owner),p.owner&&(p.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new yr(()=>{ae(this.owner,!1),C(this.owner,()=>{let t=e();typeof t=="function"&&(this.owner.cleanups??=[]).push(t)})}),this.watcher=new so(()=>ho(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&p.onSuspend){p.onSuspend(e,this.owner);return}if(p.onError&&p.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),ae(this.owner))}};function br(e){let t=new yo(e);return()=>t.dispose()}function vo(e){return!!e&&typeof e.then=="function"}fo(()=>{});var wr=Symbol.for("signal"),go=Symbol.for("memo"),bo=Symbol.for("signal-node");function O(e,t){let r=new oo(e,{equals:t?.equals}),n=(()=>r.get()),i=(o=>{let s=typeof o=="function"?o(r.peek()):o;return r.set(s),po(),s});return Object.defineProperty(n,wr,{value:!0,enumerable:!0}),Object.defineProperty(n,bo,{value:{get value(){return r.peek()},get version(){return r.version}},enumerable:!1}),[n,i]}function g(e,t,r){let n=t,i=D(),o=new yr(()=>C(i,()=>{try{return n=e(n)}catch(l){if(vo(l))return uo(l),n;throw l}}),{equals:r?.equals}),s=(()=>o.get());return Object.defineProperty(s,wr,{value:!0,enumerable:!0}),Object.defineProperty(s,go,{value:!0,enumerable:!0}),s}function R(e,t){let r=t;return br(()=>{r=e(r)})}function w(e,t){let r=t;return br(()=>{r=e(r)})}function Z(e){return mo(e)}function I(e){return lo(e)}function kr(){return Ne(),Promise.resolve()}function Te(e,t,r){let n=[];return S(()=>{for(let i of n)i.dispose();n=[]}),g(()=>{let i=e()||[];return I(()=>{if(i.length===0){for(let a of n)a.dispose();return n=[],r?.fallback?r.fallback():[]}let o=new Map;for(let a of n)o.has(a.item)||o.set(a.item,a);let s=[],l=new Set;for(let a=0;a<i.length;a++){let u=i[a],c=o.get(u);if(c&&!l.has(c))c.setIndex(a),s.push(c),l.add(c);else{let f,d,m;T(v=>{m=v;let[E,oe]=O(a);d=oe,f=t(u,E)});let b={item:u,rendered:f,dispose:m,setIndex:d};s.push(b),l.add(b)}}for(let a of n)l.has(a)||a.dispose();return n=s,s.map(a=>a.rendered)})})}function Oe(e,t,r,n){let i=[],o=[];return S(()=>{for(let s of o)s.dispose();i=[],o=[]}),g(()=>{let s=e()||[];return I(()=>{if(s.length===0){for(let f of o)f.dispose();return i=[],o=[],n?.fallback?n.fallback():[]}let l=new Map;for(let f=0;f<i.length;f++)l.set(i[f],o[f]);let a=[],u=[],c=new Set;for(let f=0;f<s.length;f++){let d=t(s[f]),m=l.get(d);if(m&&!c.has(d))m.setIndex(f),a.push(m);else{let b,v,E;T(oe=>{E=oe;let[z,se]=O(f);v=se;let Se=g(G=>(e()||[])[z()]??G,s[f]);b=r(Se,z)}),a.push({rendered:b,dispose:E,setIndex:v})}u.push(d),c.add(d)}for(let[f,d]of l)c.has(f)||d.dispose();return i=u,o=a,a.map(f=>f.rendered)})})}function Pe(e,t,r){let n=[];return S(()=>{for(let i of n)i.dispose();n=[]}),g(()=>{let i=e()||[];return I(()=>{if(i.length===0){for(let a of n)a.dispose();return n=[],r?.fallback?r.fallback():[]}let o=n.length,s=i.length;for(let a=o;a<s;a++){let u,c,f,d=i[a];T(m=>{f=m;let[b,v]=O(d);c=v,u=t(b,a)}),n.push({rendered:u,setItem:c,dispose:f})}for(let a=s;a<o;a++)n[a].dispose();s<o&&(n=n.slice(0,s));let l=Math.min(o,s);for(let a=0;a<l;a++)n[a].setItem(i[a]);return n.map(a=>a.rendered)})})}var wo=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,ko=typeof process>"u"?wo:!1,xo=Symbol.for("signal");function k(e){return typeof e=="function"&&e[xo]===!0}var So=null;function xr(e){So=e}var Ao=null;function Sr(e){Ao=e}var $o=null;function Me(e){$o=e}var Eo=null;function Ar(e){Eo=e}function Ce(e){if(typeof e=="function"&&!e.length){let t=e();return k(t)?t:Ce(t)}if(Array.isArray(e)){let t=[];for(let r=0;r<e.length;r++){let n=Ce(e[r]);Array.isArray(n)?t.push.apply(t,n):t.push(n)}return t}return e}function De(e){let t=g(e);return ko?g(()=>Ce(t()),void 0,{name:"children"}):g(()=>Ce(t()))}var Co=vr();ao((e,t)=>{let r=gr(t,Co);r&&(r.increment(),e.finally(()=>r.decrement()))});var _o=vr();co((e,t)=>{let r=gr(t,_o);return r?(r.setError(e),!0):!1});var nt=Symbol.for("fluixi-proxy");var $r="1.0.0-alpha.81";var No="__fluixi_signal_next_state__",To=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},y=globalThis[No]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:To,onSuspend:null,onError:null},Er=0,Cr=1,ue=2,Fr=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(y.untracked)return;let e=y.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},Oo=class extends Fr{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,this.observers)for(let t of[...this.observers])t.markDirty(ue);st(this)}}peek(){return this._value}},Vr=class extends Fr{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=ue,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(y.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===Cr&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===ue)break}(this.state===ue||!this._initialized)&&this.recompute(),this.state=Er}recompute(){if(this.sources){for(let s of this.sources)s.observers?.delete(this);this.sources.clear()}let e=y.consumer,t=y.untracked;y.consumer=this,y.untracked=!1;let r,n=!1,i;try{r=this._fn()}catch(s){n=!0,i=s,r=this._value}finally{y.consumer=e,y.untracked=t}let o=!this._initialized||this._threw!==n||(n?i!==this._error:!this._equals(this._value,r));if(this._initialized=!0,this._threw=n,this._error=i,this._value=r,o){if(this.version++,this.observers)for(let s of[...this.observers])s.markDirty(ue);st(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===Er;if(this.state=e,t){if(this.observers)for(let r of[...this.observers])r.markDirty(Cr);st(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function st(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var Po=class{constructor(e){this._watched=new Set,this._pending=new Set,this._notifyFn=e}watch(...e){for(let t of e)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...e){for(let t of e)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let t=this._pending.size===0;this._pending.add(e),t&&this._notifyFn()}};function Mo(e){if(y.untracked)return e();y.untracked=!0;try{return e()}finally{y.untracked=!1}}function Br(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function zr(e){let t=Symbol("context");return{id:t,defaultValue:e,Provider:r=>{let n=y.owner,i=Br(n);(i.contexts=new Map).set(t,r.value),n&&(n.owned??=[]).push(i),y.owner=i;try{return r.children}finally{y.owner=n}}}}function Ur(e,t){let r=e;for(;r;){if(r.contexts&&r.contexts.has(t.id))return r.contexts.get(t.id);r=r.parent}return t.defaultValue}function Do(e){y.onSuspend=e}function Ro(e){return y.onSuspend?(y.onSuspend(e,y.owner),!0):!1}function jo(e){y.onError=e}function qo(){return y.owner}function Jr(e,t){let r=y.owner;y.owner=e;try{return t()}finally{y.owner=r}}function ft(e){if(y.owner){if(y.owner.disposed){e();return}(y.owner.cleanups??=[]).push(e)}}function lt(e,t=!0){if(!e.disposed){if(e.owned){for(let r=e.owned.length-1;r>=0;r--)lt(e.owned[r]);e.owned=null}if(e.cleanups){for(let r=e.cleanups.length-1;r>=0;r--)e.cleanups[r]();e.cleanups=null}t&&(e.disposed=!0)}}function Lo(e){y.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Io(e){e.queued||(e.queued=!0,y.queue.push(e),!y.scheduled&&y.batchDepth===0&&(y.scheduled=!0,y.hostSchedule(dt)))}function dt(){if(y.scheduled=!1,y.flushing)return;y.flushing=!0;let e=0;try{for(;y.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=y.queue;y.queue=[];for(let r of t)r.queued=!1,r.disposed||r.run()}}finally{y.flushing=!1}}function Wo(){y.batchDepth===0&&dt()}function Ho(e){y.batchDepth++;try{return e()}finally{--y.batchDepth===0&&dt()}}var Fo=class{constructor(e){this.queued=!1,this.disposed=!1,this.owner=Br(y.owner),y.owner&&(y.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new Vr(()=>{lt(this.owner,!1),Jr(this.owner,()=>{let t=e();typeof t=="function"&&(this.owner.cleanups??=[]).push(t)})}),this.watcher=new Po(()=>Io(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&y.onSuspend){y.onSuspend(e,this.owner);return}if(y.onError&&y.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),lt(this.owner))}};function Vo(e){let t=new Fo(e);return()=>t.dispose()}function Bo(e){return!!e&&typeof e.then=="function"}Lo(()=>{});var Gr=Symbol.for("signal"),zo=Symbol.for("memo"),Uo=Symbol.for("signal-node");function Y(e,t){let r=new Oo(e,{equals:t?.equals}),n=(()=>r.get()),i=(o=>{let s=typeof o=="function"?o(r.peek()):o;return r.set(s),Wo(),s});return Object.defineProperty(n,Gr,{value:!0,enumerable:!0}),Object.defineProperty(n,Uo,{value:{get value(){return r.peek()},get version(){return r.version}},enumerable:!1}),[n,i]}function ht(e,t,r){let n=t,i=qo(),o=new Vr(()=>Jr(i,()=>{try{return n=e(n)}catch(l){if(Bo(l))return Ro(l),n;throw l}}),{equals:r?.equals}),s=(()=>o.get());return Object.defineProperty(s,Gr,{value:!0,enumerable:!0}),Object.defineProperty(s,zo,{value:!0,enumerable:!0}),s}function Xr(e,t){let r=t;return Vo(()=>{r=e(r)})}function W(e){return Ho(e)}function ee(e){return Mo(e)}var pu=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0;var Jo=Symbol.for("signal");function Kr(e){return typeof e=="function"&&e[Jo]===!0}var _r=null;function Go(e){_r&&_r(e)}var Nr=null;function Xo(e){return Nr?Nr(e):void 0}var Tr=null;function Ko(){return Tr?Tr():void 0}var Or=null;function Zo(e,t){Or&&Or(e,t)}function Qo(e){return!!e&&typeof e.then=="function"}var it=Symbol();function Yo(e,t,r={}){let n,i;typeof t=="function"?(n=typeof e=="function"?e:()=>e,i=t):(n=()=>!0,i=e,t&&typeof t=="object"&&(r=t));let o=r.transport===!1?void 0:Ko(),s=o!==void 0?Xo(o):void 0,l=s!==void 0,[a,u]=Y(s!==void 0?s.value:r.initialValue,{equals:!1}),[c,f]=Y(void 0,{equals:!1}),[d,m]=Y(s!==void 0||r.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[b,v]=Y(void 0,{equals:!1}),[E,oe]=Y(void 0,{equals:!1}),z=it,se=!1;Xr(()=>{let x=n();if(E(),x===!1||x===null||x===void 0){z=it,W(()=>{m("unresolved"),v(void 0),f(void 0)});return}let Ae=se;if(se=!1,z!==it&&x===z&&!Ae)return;if(z=x,l){l=!1;return}let $e=!1;ft(()=>$e=!0);let cr=ee(d),Zi=ee(a),fr=cr==="ready"||cr==="refreshing";W(()=>{m(fr?"refreshing":"pending"),f(void 0)});try{let U=i(x,{value:Zi,refetching:fr});Qo(U)?(v(U),Go(U),U.then(Ee=>{$e||(o!==void 0&&Zo(o,Ee),W(()=>{u(()=>Ee),m("ready"),v(void 0)}))},Ee=>{$e||W(()=>{f(Ee),m("errored"),v(void 0)})})):W(()=>{u(()=>U),m("ready"),v(void 0)})}catch(U){if($e)return;W(()=>{f(U),m("errored"),v(void 0)})}});let Se=()=>{let x=d();return x==="pending"||x==="refreshing"},G=(()=>{let x=c();if(x)throw x;if(Se()){let Ae=b();if(Ae)throw Ae}return a()});return Object.defineProperties(G,{state:{get:d},loading:{get:Se},error:{get:c},latest:{get:a}}),Object.defineProperty(G,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(G,Symbol.for("signal"),{value:!0,enumerable:!0}),[G,{mutate:u,refetch:()=>{se=!0,oe(void 0)}}]}var es=zr();Do((e,t)=>{let r=Ur(t,es);r&&(r.increment(),e.finally(()=>r.decrement()))});var ts=zr();jo((e,t)=>{let r=Ur(t,ts);return r?(r.setError(e),!0):!1});function Zr(e,t){let[r,n]=Y(e,t);return Object.assign(r,{set:n})}function Qr(e,t,r){return ht(e,t,r)}function Yr(e,t){return Xr(e,t)}function en(...e){let[t,r]=Yo(...e);return Object.assign(t,r)}var at=Symbol("store-raw"),Pr=Symbol("store-node"),Mr=Symbol("store-has"),Dr=Symbol("store-self"),Rr=Symbol("store-track");var jr=new WeakMap,qr=new WeakMap;function tn(e){let[t,r]=O(e),n=t;return n.$=r,n}function je(e){let t=jr.get(e);return t||jr.set(e,t={keys:new Map}),t}function Lr(e,t,r){let n=e.keys.get(t);return n||e.keys.set(t,n=tn(r)),n}function Ir(e){let t=je(e);(t.all||(t.all=tn()))()}function Wr(e,t){e.$(typeof t=="function"?()=>t:t)}function rn(e){if(e==null||typeof e!="object")return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Re(e){if(!rn(e))return e;let t=qr.get(e);if(t)return t;let r=new Proxy(e,rs);return qr.set(e,r),r}var rs={get(e,t,r){if(t===at||t===Pr)return e;if(t===nt)return r;if(t===Mr)return s=>s in e;if(t==="__proxy")return!0;if(t===Rr||t===Dr)return Ir(e),r;let n=e[t];if(typeof n=="function"&&!Object.prototype.hasOwnProperty.call(e,t))return n;let i=Object.getOwnPropertyDescriptor(e,t);if(i&&i.get)return i.get.call(r);let o=Lr(je(e),t,n)();return rn(o)?Re(o):o},set(){return!0},deleteProperty(e,t){return t in e&&ce(e,t,void 0),!0},has(e,t){return t===at||t===nt||t===Pr||t===Mr||t===Dr||t===Rr?!0:(Lr(je(e),t,e[t])(),t in e)},ownKeys(e){return Ir(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function ce(e,t,r){if(e[t]===r&&(r!==void 0||t in e))return;let n=Array.isArray(e),i=n?e.length:0;r===void 0?delete e[t]:e[t]=r;let o=je(e),s=o.keys.get(t);if(s&&Wr(s,r),n&&e.length!==i){let l=o.keys.get("length");l&&Wr(l,e.length)}o.all&&o.all.$(void 0)}function Hr(e,t){return typeof e=="function"?e(t):e}function ut(e,t){for(let r of Object.keys(t)){let n=t[r],i=e[r];n&&typeof n=="object"&&!Array.isArray(n)&&i&&typeof i=="object"&&!Array.isArray(i)?ut(i,n):ce(e,r,n)}}function pt(e){let t=[],r=e.replace(/\[([^\]]*)\]/g,".$1");for(let n of r.split("."))n.length&&t.push(n);return t}function nn(e,t,r){let n=t.length-1;for(let o=0;o<n;o++){let s=t[o];if(s==="*"){let a=t.slice(o+1);if(Array.isArray(e))for(let u=0;u<e.length;u++)nn(e[u],a,r);return}let l=e[s];(l==null||typeof l!="object")&&(l=/^\d+$/.test(t[o+1])?[]:{},ce(e,s,l)),e=l}let i=t[n];if(i==="*"){if(Array.isArray(e))for(let o=0;o<e.length;o++)ce(e,o,Hr(r,e[o]));return}ce(e,i,Hr(r,e[i]))}function ot(e,t,r){nn(e,pt(t),r)}function ns(e,t){let r=t[0];if(typeof r=="function"&&t.length===1){let n=r(e);n&&n!==e&&ut(e,n);return}if(Array.isArray(r)&&t.length===1){for(let n of r)Array.isArray(n)&&ot(e,n[0],n[1]);return}if(r&&typeof r=="object"&&!Array.isArray(r)&&t.length===1){ut(e,r);return}if(Array.isArray(t[1])&&t.length>=3){ot(e,`${r}.${t[1].join(".")}`,t[2]);return}ot(e,String(r),t[1])}function ct(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(ct);let t={};for(let r of Object.keys(e))t[r]=ct(e[r]);return t}function Q(e,t){let r=e;for(let n of pt(t)){if(r==null)return;r=r[n]}return r}var on=class{constructor(e,t={immutable:!0}){this.options=t,this.root=e,this.set=((...r)=>Z(()=>ns(this.root,r)))}get state(){return Re(this.root)}get proxy(){return Re(this.root)}get accessor(){return(()=>Re(this.root))}unwrap(){return this.root}getNode(e){return this.root&&this.root[e]}get(e){if(e==null||e==="")return qe(this.state);let t=this.state;for(let r of pt(e)){if(t==null)return;t=t[r]}return qe(t)}select(e){return g(()=>e(this.state))}subscribe(e){return R(()=>e(this.state))}watch(e,t){let r;return R(()=>{let n=e(this.state);Object.is(n,r)||(t(n,r),r=n)})}reactive(e){return g(()=>this.state[e])}produce(e){this.set((t=>{let r=ct(t);return e(r),r}))}reconcile(e,t={}){this.set(e)}push(e,...t){let r=Q(this.root,e);this.set(e,r.concat(t))}pop(e){let t=Q(this.root,e).slice(),r=t.pop();return this.set(e,t),r}shift(e){let t=Q(this.root,e).slice(),r=t.shift();return this.set(e,t),r}splice(e,t,r,...n){let i=Q(this.root,e).slice(),o=i.splice(t,r,...n);return this.set(e,i),o}insert(e,t,r){let n=Q(this.root,e).slice();n.splice(t,0,r),this.set(e,n)}removeAt(e,t){let r=Q(this.root,e).slice(),n=r.splice(t,1);return this.set(e,r),n}toObservable(){let[e]=O(this.state);return e.toObservable()}dispose(){}},is=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","unwrap","toObservable"];function os(e,t){for(let r of is)e[r]=t[r].bind(t);e.$=t.reactive.bind(t)}function sn(e,t={immutable:!0}){let r=new on(e,t);return os(r.set,r),[r.proxy,r.set]}function ss(e,t={}){return new on(e,{...t,immutable:!1})}function qe(e){if(e==null||typeof e!="object")return e;let t=e[at];return t!==void 0?t:e}function ls(e){return I(()=>qe(e))}var yu=Object.freeze({createStore:sn,createMutableStore:ss,batch:Z,unwrap:qe,untrackStore:ls});function ln(e,t){let[r,n]=sn(e,t);return new Proxy(r,{get:(i,o)=>o==="set"?n:i[o],has:(i,o)=>o==="set"||Reflect.has(i,o)})}function as(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function us(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function cs(e){return e.startsWith("@")?e.slice(1):e.startsWith("on")?e.slice(2).toLowerCase():e}function fs(e,t){let r=new Set(["checked","value","selected","disabled","readonly","required","multiple","open","contenteditable","draggable","spellcheck"]),n={input:new Set(["value","checked","indeterminate"]),textarea:new Set(["value"]),select:new Set(["value"]),option:new Set(["selected","value"]),audio:new Set(["volume","currentTime","paused"]),video:new Set(["volume","currentTime","paused"]),img:new Set(["src","srcset"]),iframe:new Set(["src"]),a:new Set(["href"])};return r.has(t)||n[e]&&n[e].has(t)}var ds=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),hs=new Set(["svg","g","path","circle","rect","line","polyline","polygon","ellipse","text","tspan","use","defs","symbol","mask","clipPath","pattern","linearGradient","radialGradient","stop","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","foreignObject"]),He="http://www.w3.org/2000/svg";function vn(e){return e.localName.includes("-")}function vt(e,t,r,n=!1){if(r==null){e.removeAttribute(t);return}if(vn(e)){e[t]=r;return}_(e,t,r,n)}var gt=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function bt(e,t=document){return t.querySelector(e)}function ps(e,t=document){return Array.from(t.querySelectorAll(e))}function ms(e,t){return e.closest(t)}function gn(e,...t){e.classList.add(...t)}function bn(e,...t){e.classList.remove(...t)}function wn(e,...t){t.forEach(r=>e.classList.toggle(r))}function ys(e,t){return e.classList.contains(t)}function _(e,t,r,n=!1){if(r==null||r===!1){e.removeAttribute(t);return}if(r===!0){e.setAttribute(t,"");return}if(typeof r=="object"){e.setAttribute(t,JSON.stringify(r));return}e.setAttribute(t,String(r))}function kn(e,t){return e.getAttribute(t)}function xn(e,t){e.removeAttribute(t)}function $t(e,t){Object.assign(e.style,t)}function vs(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function Sn(e,t={},...r){let n=document.createElement(e);return Object.entries(t).forEach(([i,o])=>{if(i==="class"||i==="className")n.className=o;else if(i==="style"&&typeof o=="object")$t(n,o);else if(i.startsWith("on")&&typeof o=="function"){let s=i.slice(2).toLowerCase();n.addEventListener(s,o)}else _(n,i,o)}),r.forEach(i=>{typeof i=="string"?n.appendChild(document.createTextNode(i)):n.appendChild(i)}),n}function An(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function $n(e,...t){t.forEach(r=>{typeof r=="string"?e.appendChild(document.createTextNode(r)):e.appendChild(r)})}function gs(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function bs(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function ws(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function ks(e,t,r,n){let i=o=>{let s=o.target.closest(r);s&&e.contains(s)&&n(o,s)};return e.addEventListener(t,i),()=>{e.removeEventListener(t,i)}}function xs(e,t=5e3){return new Promise((r,n)=>{let i=bt(e);if(i){r(i);return}let o=new MutationObserver(()=>{let l=bt(e);l&&(o.disconnect(),clearTimeout(s),r(l))});o.observe(document.body,{childList:!0,subtree:!0});let s=setTimeout(()=>{o.disconnect(),n(new Error(`Element ${e} not found within ${t}ms`))},t)})}function Ss(e,t,r={}){let n=new IntersectionObserver(i=>{i.forEach(o=>{t(o.isIntersecting)})},r);return n.observe(e),()=>{n.disconnect()}}function As(e,t){let r=new ResizeObserver(n=>{n.forEach(t)});return r.observe(e),()=>{r.disconnect()}}var $s=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function Es(e){return typeof e=="object"&&e!==null&&e.$$typeof===$s}function En(e){return e&&typeof e=="object"&&e.strings&&Array.isArray(e.strings)&&e.values&&Array.isArray(e.values)}function Cs(e){if(typeof e!="function")return!1;try{let t=e();return En(t)}catch{return!1}}function _s(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function Ns(e){return e instanceof Node}function Ts(e,t,r="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[r]>"u"&&(globalThis[r]={}),typeof globalThis[r][e]>"u"&&(globalThis[r][e]=t))}function Os(e,t,r="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[r]<"u"&&typeof globalThis[r][e]<"u"?globalThis[r][e]:t}var Cn="1.0.0-alpha.81",$={dom:Cn,reactive:$r};function Ps(e){$.core=e}function _n(e){$.core&&e.setAttribute("fluixi",$.core),e.setAttribute("fx-dom",$.dom),e.setAttribute("fx-reactive",$.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=$)}function Nn(){let e=[$.core,$.dom,$.reactive].filter(t=>t!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${$.core??"(absent)"}, dom ${$.dom}, reactive ${$.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}function Ms(e){return Object.defineProperty(e,Symbol.for("fluixi-router"),{value:!0,enumerable:!0}),e}function Ds(e){return Object.defineProperty(e,Symbol.for("fluixi-routes"),{value:!0,enumerable:!0}),e}function Rs(e){return Object.defineProperty(e,Symbol.for("fluixi-route"),{value:!0,enumerable:!0}),e}function js(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-outlet"),{value:!0,enumerable:!0}),e}function qs(e){return Object.defineProperty(e,Symbol.for("fluixi-provider"),{value:!0,enumerable:!0}),e}function Ls(e){return Object.defineProperty(e,Symbol.for("fluixi-context"),{value:!0,enumerable:!0}),e}function Tn(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function Is(e){return Object.defineProperty(e,Symbol.for("fluixi-suspense"),{value:!0,enumerable:!0}),e}function On(e){return typeof e=="function"&&e[Symbol.for("fluixi-router")]===!0}function Pn(e){return typeof e=="function"&&e[Symbol.for("fluixi-routes")]===!0}function Mn(e){return typeof e=="function"&&e[Symbol.for("fluixi-route")]===!0}function Dn(e){return typeof e=="function"&&e[Symbol.for("fluixi-outlet")]===!0}function Rn(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function jn(e){return typeof e=="function"&&e[Symbol.for("fluixi-context")]===!0}function P(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function qn(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function Ws(e){return On(e)?{type:"router",value:e}:Mn(e)?{type:"route",value:e}:Pn(e)?{type:"routes",value:e}:Dn(e)?{type:"outlet",value:e}:P(e)?{type:"component",value:e}:qn(e)?{type:"suspense",value:e}:Rn(e)?{type:"provider",value:e}:jn(e)?{type:"context",value:e}:{type:"none",value:e}}var N=typeof document>"u";function de(e){N=e}var Fe=Symbol.for("fluixi.server-node"),wt=null;function Hs(e){wt=e}function Ve(){if(!wt)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return wt}function ge(e){return e!=null&&e[Fe]===!0?!0:typeof Node<"u"&&e instanceof Node}function Ln(e){return e!=null&&e[Fe]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function In(e){return e!=null&&e[Fe]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var h={active:!1,cursor:null,parents:[]},Wn=null;function Fs(e){Wn=e}function Et(){return Wn}function an(e,t){return h.active&&t.parentNode===e}function Hn(e){let t=h.parents.lastIndexOf(e);t!==-1&&(h.parents.length=t),h.cursor=e.nextSibling}function Vs(){return h.active?h.cursor:null}function kt(e,t){if(!e||e.parentNode==null)return t();let r=h.active,n=h.cursor,i=h.parents;h.active=!0,h.cursor=e,h.parents=[];try{return t()}finally{h.active=r,h.cursor=n,h.parents=i}}function Bs(e){if(!h.active)return e();let t=h.cursor,r=h.parents;h.active=!1,h.parents=[];try{return e()}finally{h.active=!0,h.cursor=t,h.parents=r}}function Ct(e){if(!h.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&Hn(t)}function zs(e){let t=[];for(;e&&e.nodeType===1;){let r=e.tagName.toLowerCase();if(e.id){r+=`#${e.id}`,t.unshift(r);break}e.getAttribute("data-id")&&(r+=`[data-id="${e.getAttribute("data-id")}"]`);let n=0,i=e;for(;i=i.previousElementSibling;)i.tagName===e.tagName&&n++;r+=`:nth-of-type(${n+1})`,t.unshift(r),e=e.parentElement}return t.join(">")}function Us(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return`el_${Math.abs(t)}`}function Js(e){return Us(zs(e))}var Gs=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Xs={},un=new Map,Ie=new Set,Be=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function ze(e){if(!N)for(let t of e)Ie.has(t)||Be.has(t)||(Ie.add(t),document.addEventListener(t,Ks))}function Ks(e){let t=`$$${e.type}`,r=e.composedPath&&e.composedPath()[0]||e.target;for(;r;){let n=r[t];if(n&&!r.disabled&&(n(e),e.cancelBubble))return;r=r.host&&r.host!==r&&r.host instanceof Element?r.host:r.parentNode}}function _t(e,t,r){if(e[`$$${t}`]=r,Be.has(t)){let n=`__fx_${t}`;if(!e[n]){let i=o=>{e[`$$${t}`]?.(o)};e.addEventListener(t,i),e[n]=i}return}Ie.has(t)||ze([t])}function We(e,t){delete e[`$$${t}`];let r=`__fx_${t}`,n=e[r];n&&(e.removeEventListener(t,n),delete e[r])}function Zs(e){return!Be.has(e)}function Qs(e){return typeof e=="function"}function F(e,t=!1){if(N)return Ve().createText(e);if(h.active&&!t){let r=Et()?.hydrateText(e);if(r)return r}return document.createTextNode(e)}function Nt(e,t=!1){if(N)return Ve().createElement(e,t);if(h.active){let r=Et()?.hydrateElement(e);if(r)return r}return t?document.createElementNS(He,e):document.createElement(e)}function Tt(e,t=!1){let r=un.get(e);if(r)return r;let n=document.createElement("template");return t?n.innerHTML=`<svg>${e}</svg>`:n.innerHTML=e,un.set(e,n),n}function Fn(e,t,r=!1,n=!1){if(N){let i=Ve();return r?i.parseTemplate(e,n):i.createRaw(e)}if(h.active){let i=Et()?.hydrateStatic(t);if(i)return i}return Ot(Tt(e,n),n).firstChild}function Vn(e,t){if(!h.active)return t();let r=kt(e.nextSibling,t);if(typeof r=="function"){let n=r;return((...i)=>h.active?kt(e.nextSibling,()=>n(...i)):n(...i))}return r}function Bn(e){for(let t=e.nextSibling;t;t=t.nextSibling)if(t.nodeType===8&&t.data==="fx/")return t;throw new Error("[fluixi] template hole is missing its closing marker")}function zn(e,t){let r=[];for(let n=e.nextSibling;n&&n!==t;n=n.nextSibling)r.push(n);return r}function Ot(e,t=!1){let r=e.content.cloneNode(!0);return t?r.firstChild:r}function Un(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Un(e[0]):(e[0],e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function Ys(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function el(e){if(k(e)||P(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!k(t)&&!P(t);)t=t();return t}var L=0,tl=200;function rl(e,t,r,n,i){let o=n,s=new Map;return w(()=>{let l;if(P(e)&&!k(e)){if(!s.has(e)){L++;try{let a=e();s.set(e,a)}finally{L--}}for(l=s.get(e);typeof l=="function"&&k(l);)l=l()}else for(l=e();typeof l=="function"&&k(l);)l=l();{let a=0;for(;typeof l=="function"&&a++<50;)if(P(l)){if(!s.has(l)){let u=l;L++;try{let c=u();s.set(u,c)}finally{L--}}l=s.get(l)}else if(k(l))l=l();else if(l=l(),typeof l!="function"||!k(l)&&!P(l))break}L++;try{o=he(t,l,r,o,s),i(o)}finally{L--}})}function M(e,t,r,n){if(L>tl)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;r!==void 0&&!r&&(r=F("",!0),e.appendChild(r));let i=n??null,o=a=>Array.isArray(a)&&a.some(u=>typeof u=="function"),s=a=>typeof a=="function"?a:()=>a;if(typeof t!="function"&&!o(t)){L++;try{i=he(e,t,r,i)}finally{L--}return()=>i}let l=rl(s(t),e,r,i,a=>{i=a});return()=>(l?.(),i)}function he(e,t,r,n,i){if(t==null||typeof t=="boolean")return H(e,n,r);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return H(e,n,r);if(fe(t)){let s=F("",!0);return Array.isArray(n)?n.length>0?(e.replaceChild(s,n[0]),H(e,n.slice(1),r)):A(e,s,r):n?e.replaceChild(s,n):A(e,s,r),t.then(l=>{s.parentNode===e&&he(e,l,s.nextSibling,s)}).catch(l=>{console.error("Error resolving promise in insertExpression:",l)}),s}let o=typeof t;if(o==="string"||o==="number"){if(o==="number"&&(t=String(t)),Array.isArray(n)){if(n.length===0){let l=F(t);return A(e,l,r),l}if(n.length===1&&n[0].nodeType===3)return n[0].data=t,n;n=H(e,n,r)}if(n&&In(n))return n.data=t,n;let s=F(t);return n&&n.parentNode===e?e.replaceChild(s,n):an(e,s)||A(e,s,r),s}if(ge(t))return an(e,t)?(Hn(t),t):Array.isArray(n)?(n.length===0?A(e,t,r):n[0].parentNode===e?(e.replaceChild(t,n[0]),H(e,n.slice(1),r)):A(e,t,r),t):(n?n!==t&&(n.parentNode===e?e.replaceChild(t,n):A(e,t,r)):A(e,t,r),t);if(Array.isArray(t)){let s=[],l=Array.isArray(n)?n:n?[n]:[],a=[];q(t,s,e,r,!0,i,a);let u=nl(e,l,s,r);for(let c of a){let f=M(e,c.sig,c.marker);S(()=>{H(e,f()),c.marker.parentNode===e&&e.removeChild(c.marker)})}return u}if(o==="object"&&t!==null&&typeof t=="object"){let s=t;if("type"in s&&"props"in s){let l=s;if(typeof l.type=="function"){let a=l.type(l.props||{});return he(e,a,r,n)}}}return H(e,n,r)}function q(e,t,r,n,i=!0,o,s){for(let l=0;l<e.length;l++){let a=e[l];if(!(a==null||typeof a=="boolean")){for(;typeof a=="function"&&!fe(a)&&!k(a)&&!P(a)&&(a=a(),!(a==null||typeof a=="boolean")););if(!(a==null||typeof a=="boolean")){if(typeof a=="function"){let u;for(P(a)&&!k(a)?(o||(o=new Map),o.has(a)||o.set(a,a()),u=o.get(a)):u=a();typeof u=="function"&&!fe(u)&&!k(u)&&!P(u);)o||(o=new Map),o.has(u)||o.set(u,u()),u=o.get(u);if(u==null||typeof u=="boolean")continue;if(typeof u=="function"){if(k(u)){if(s){let f=F("",!0);t.push(f),s.push({marker:f,sig:u});continue}let c=u();for(;typeof c=="function"&&k(c);)c=c();if(c==null||typeof c=="boolean")continue;Array.isArray(c)?q(c,t,r,n,i,o):q([c],t,r,n,i,o);continue}continue}Array.isArray(u)?q(u,t,r,n,i,o,s):q([u],t,r,n,i,o,s);continue}if(fe(a)){let u=F("",!0);t.push(u),a.then(c=>{if(u.parentNode){let f=[];if(q([c],f,u.parentNode,void 0,!1,o),f.length>0){u.parentNode.replaceChild(f[0],u);for(let d=1;d<f.length;d++)u.parentNode?.insertBefore(f[d],f[d-1].nextSibling)}}}).catch(c=>console.error("Error resolving promise in array:",c));continue}if(Array.isArray(a)){q(a,t,r,n,i,o,s);continue}if(ge(a)){t.push(a);continue}if(typeof a=="object"&&a!==null&&"type"in a&&"props"in a){let u=a;if(typeof u.type=="function"){let c=u.type(u.props||{});Array.isArray(c)?q(c,t,r,n,!1,o):q([c],t,r,n,!1,o);continue}}if(typeof a=="string"||typeof a=="number"){let u=String(a);if(u.trim()===""&&u!==" ")continue;t.push(F(u));continue}t.push(F(String(a)))}}}}function nl(e,t,r,n){for(let f=0;f<r.length;f++){let d=r[f].parentNode;d!==null&&d!==e&&d.nodeType!==11&&(r=r.slice(),r[f]=r[f].cloneNode(!0))}let i=r.length,o=t.length,s=i,l=0,a=0,u=o>0?t[o-1].nextSibling??void 0:n,c=null;for(;l<o||a<s;){if(t[l]===r[a]){l++,a++;continue}for(;o>l&&s>a&&t[o-1]===r[s-1];)o--,s--;if(o===l){let f=s<i?a?r[a-1].nextSibling??void 0:r[s-a]:u;for(;a<s;)A(e,r[a++],f)}else if(s===a)for(;l<o;)(!c||!c.has(t[l]))&&t[l].parentNode===e&&e.removeChild(t[l]),l++;else if(t[l]===r[s-1]&&r[a]===t[o-1]){let f=t[--o].nextSibling;A(e,r[a++],t[l++].nextSibling),A(e,r[--s],f),t[o]=t[l-1]}else{if(!c){c=new Map;let d=a;for(;d<s;)c.set(r[d],d++)}let f=c.get(t[l]);if(f!=null)if(a<f&&f<s){let d=l,m=1;for(;++d<o&&d<s&&!(!c.has(t[d])||c.get(t[d])!==f+m);)m++;if(m>f-a){let b=t[l];for(;a<f;)A(e,r[a++],b)}else t[l].parentNode===e?e.replaceChild(r[a++],t[l++]):(A(e,r[a++],u),l++)}else l++;else t[l].parentNode===e&&e.removeChild(t[l]),l++}}return r}function H(e,t,r){if(t)if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n].parentNode===e&&e.removeChild(t[n]);else t.parentNode===e&&e.removeChild(t);return null}function A(e,t,r){h.active&&t.parentNode===e||(r&&r.parentNode===e?e.insertBefore(t,r):e.appendChild(t))}function re(e,t,r){r==null?delete e[t]:e[t]=r}function Pt(e,t,r){let n=r,i;return Array.isArray(r)&&(n=r[0],i=r[1]),typeof n!="function"?()=>{}:(e.addEventListener(t,n,i),()=>e.removeEventListener(t,n,i))}function Mt(e,t){let r=(n,i)=>{typeof n=="function"&&n(e,i??(()=>{}))};if(typeof t=="function"){r(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){r(t[0],t[1]);return}for(let n of t)Array.isArray(n)?r(n[0],n[1]):r(n)}}function pe(e,t,r,n=!1){return typeof r!="function"?(_(e,t,r,n),()=>{}):w(()=>{let i=typeof r=="function"?r():r;_(e,t,i,n)})}function me(e,t,r){return typeof r!="function"?(re(e,t,r),()=>{}):w(()=>{let n=typeof r=="function"?r():r;re(e,t,n)})}function Dt(e,t,r){return typeof r!="function"?(_(e,t,!!r),()=>{}):w(()=>{let n=r();_(e,t,!!n)})}function ne(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){w(()=>ne(e,t()));return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let r=Object.keys(t).filter(n=>{let i=t[n];return typeof i=="function"?i():!!i}).join(" ");e.setAttribute("class",r);return}e.setAttribute("class",String(t))}function ye(e,t,r){if(!(!t||typeof t!="object"))for(let n in t){let i=t[n],o=n.split(/\s+/).filter(Boolean);if(typeof i=="function"&&r)r.push(w(()=>{let s=!!i();for(let l of o)e.classList.toggle(l,s)}));else{let s=!!(typeof i=="function"?i():i);for(let l of o)e.classList.toggle(l,s)}}}function ve(e,t){let r=t;for(;typeof r=="function";)r=r();if(r==null){e.removeAttribute("style");return}if(typeof r=="string"){e.style.cssText=r;return}if(typeof r=="object")for(let n in r){let i=r[n];i==null?e.style[n]="":e.style[n]=i}}function Jn(e){let{element:t,props:r,prevProps:n=Xs,isSVG:i=!1,skipChildren:o=!1}=e;if(!t||!Ln(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!r)return console.warn("[spread] Warning: props is undefined!"),()=>{};let s=i||t.namespaceURI===He,l=[];for(let a in r){if(o&&a==="children")continue;let u=r[a],c=n[a];if(u===c)continue;if(a==="ref"){be(u,t);continue}if(a==="use"){Mt(t,u);continue}if(a.startsWith("on:")){l.push(Pt(t,a.slice(3),u));continue}if(a.startsWith("prop:")){l.push(me(t,a.slice(5),u));continue}if(a.startsWith("attr:")){l.push(pe(t,a.slice(5),u,s));continue}if(a.startsWith("bool:")){l.push(Dt(t,a.slice(5),u));continue}if(a==="class"||a==="className"){typeof u=="function"?l.push(w(()=>ne(t,u()))):ne(t,u);continue}if(a==="classList"){typeof u=="function"?l.push(w(()=>ye(t,u()))):ye(t,u,l);continue}if(a==="style"){typeof u=="function"?l.push(w(()=>ve(t,u()))):ve(t,u);continue}if(a.startsWith("on")){let d=a.slice(2).toLowerCase();c&&We(t,d),u&&_t(t,d,u);continue}let f=gt.has(a)||!s&&a in t;typeof u=="function"?l.push(f?me(t,a,u):pe(t,a,u,s)):l.push(w(()=>f?re(t,a,r[a]):_(t,a,r[a],s)))}for(let a in n)if(!(a in r))if(a.startsWith("on")){let u=a.slice(2).toLowerCase();We(t,u)}else gt.has(a)?re(t,a,null):t.removeAttribute(a);return()=>{l.forEach(a=>a())}}function Rt(e,t,r=!1){for(let n in t){let i=t[n];if(n==="ref"){be(i,e);continue}if(n!=="children"){if(n==="use"){Mt(e,i);continue}if(n.startsWith("on:")){Pt(e,n.slice(3),i);continue}if(n.startsWith("prop:")){me(e,n.slice(5),i);continue}if(n.startsWith("attr:")){pe(e,n.slice(5),i,r);continue}if(n.startsWith("bool:")){Dt(e,n.slice(5),i);continue}if(n.startsWith("on")&&n.length>2){let o=n.slice(2).toLowerCase();if(typeof i=="function")if(Be.has(o)){e[`$$${o}`]=i;let s=`__fx_${o}`;if(!e[s]){let l=a=>{e[`$$${o}`]?.(a)};e.addEventListener(o,l),e[s]=l}}else e[`$$${o}`]=i,Ie.has(o)||ze([o]);continue}if(n==="class"||n==="className"){ne(e,i);continue}if(n==="classList"){typeof i=="function"?w(()=>ye(e,i())):ye(e,i);continue}if(n==="style"){typeof i=="function"?w(()=>ve(e,i())):ve(e,i);continue}if(n==="innerHTML"){if(typeof i=="function"){let o=R(()=>{let s=i();for(;typeof s=="function";)s=s();e.innerHTML=s});S(()=>o())}else e.innerHTML=i;continue}if(n==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof i=="function"){let o=R(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();document.activeElement!==e&&(e.value=s??"")});S(()=>{o()})}else w(()=>{document.activeElement!==e&&(e.value=t[n]??"")});continue}if(n==="checked"&&e.tagName==="INPUT"){if(typeof i=="function"){let o=R(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();document.activeElement!==e&&(e.checked=s??"")});S(()=>{o()})}else w(()=>{document.activeElement!==e&&(e.checked=t[n]??"")});continue}if(n==="value"&&e.tagName==="SELECT"){if(typeof i=="function"){let o=!0,s=R(()=>{let l=i();for(;typeof l=="function"&&l.length===0;)l=l();o?(o=!1,queueMicrotask(()=>{e.value=l??""})):e.value=l??""});S(()=>{s()})}else{let o=!0;w(()=>{let s=t[n];o?(o=!1,queueMicrotask(()=>{e.value=s??""})):e.value=s??""})}continue}if(typeof i=="function"){let o=R(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();vt(e,n,s,r)});S(()=>{o()})}else w(()=>vt(e,n,t[n],r))}}}function Gn(...e){let t=n=>{for(let i=e.length-1;i>=0;i--){let o=e[i];if(o&&n in o&&o[n]!==void 0)return o[n]}},r=n=>{for(let i of e)if(i&&n in i)return!0;return!1};return new Proxy({},{get:(n,i)=>t(i),has:(n,i)=>r(i),ownKeys:()=>{let n=new Set;for(let i of e)if(i)for(let o of Reflect.ownKeys(i))n.add(o);return[...n]},getOwnPropertyDescriptor:(n,i)=>r(i)?{enumerable:!0,configurable:!0,get:()=>t(i)}:void 0})}function il(e,...t){let r=new Set;for(let s of t)for(let l of s)r.add(l);let n=s=>({enumerable:!0,configurable:!0,get:()=>e[s]}),i=t.map(s=>{let l=new Set(s);return new Proxy({},{get:(a,u)=>l.has(u)?e[u]:void 0,has:(a,u)=>l.has(u)&&u in e,ownKeys:()=>Array.from(l).filter(a=>a in e),getOwnPropertyDescriptor:(a,u)=>l.has(u)&&u in e?n(u):void 0})}),o=new Proxy({},{get:(s,l)=>r.has(l)?void 0:e[l],has:(s,l)=>!r.has(l)&&l in e,ownKeys:()=>Reflect.ownKeys(e).filter(s=>!r.has(s)),getOwnPropertyDescriptor:(s,l)=>!r.has(l)&&l in e?n(l):void 0});return[...i,o]}function be(e,t){if(e){if(ge(e)){let r=t,n=e;if(!r)return;typeof r=="function"?r(n):typeof r=="object"&&"current"in r&&(r.current=n);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}}function Xn(e,t,r){let n=t||document.body,i=De(()=>e),o=[];return Z(()=>{let s=w(()=>{let l=i();Array.isArray(l)?(l.forEach(a=>n.appendChild(a)),o.push(()=>{l.forEach(a=>{a.parentNode===n&&n.removeChild(a)})})):ge(l)&&(n.appendChild(l),o.push(()=>{l.parentNode===n&&n.removeChild(l)}))});o.push(s),S(()=>{o.forEach(l=>l())})}),null}function ol(e){return typeof e=="string"&&e.toLowerCase()===e}function Kn(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="polygon"||e==="polyline"||e==="ellipse"||e==="g"||e==="defs"||e==="clipPath"||e==="text"}function sl(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function fe(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function ll(e){return typeof e=="function"&&e.length===0&&k(e)}function we(e,t,r){if(!t)throw new Error("Container element is required");let n,i,o=[];return T(s=>{Z(()=>{h.active||(t.textContent=""),_n(t),Nn(),M(t,e)}),i=s}),()=>{i?.(),n?.(),o.forEach(s=>s()),t.textContent=""}}function Zn(e){if(Array.isArray(e))return e;if(typeof e=="function"&&typeof e.set=="function")return[e,e.set];throw new TypeError("[fluixi] bind: needs a signal — either `signal(…)` or the `[get, set]` pair from `createSignal(…)`.")}var al="__fx_dom_create_component__",J=globalThis[al]??={fn:null};function ul(e){J.fn=e}function cl(e={}){let t=e.signalSystem?.createComponent;t&&(J.fn=t)}function jt(e,t){if(J.fn)return J.fn(e,t);let r=typeof e=="function"?ee(()=>e(t)):e;if(r!=null&&(typeof r=="function"||typeof r=="object")&&!Kr(r)){try{r.$name=e?.name}catch{}return Tn(r)}return r}var fl=()=>J.fn!==null,Qn=()=>J.fn!==null;function Yn(){J.fn=null}var Le,ei={getStore:()=>Le,run(e,t){let r=Le;Le=e;try{return t()}finally{Le=r}}},qt=ei;function dl(e){qt=e??ei}function Lt(e={}){e.locals||(e.locals=e.request?ri(e.request):{});let t=0,r=0,n=null,i=new Map,o=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${t++}`,nextResourceId:()=>{if(n===null)return`r${r++}`;let s=i.get(n)??0;return i.set(n,s+1),`${n}:r${s}`},nextIslandNamespace:s=>{let l=o.get(s)??0;return o.set(s,l+1),`${s}#${l}`},withResourceScope(s,l){let a=n;n=s;try{return l()}finally{n=a}},pending:new Set,data:new Map}}function It(e,t){return qt.run(e,t)}function te(){return qt.getStore()}function ti(){return te()?.event}function hl(){let e=ti();return e?(e.locals||(e.locals={}),e.locals):{}}var cn=new WeakMap;function ri(e){let t=cn.get(e);return t||(t={},cn.set(e,t)),t}var Wt="__FX_DATA__";function ni(e){return e.replace(/[<>&\u2028\u2029]/g,t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"))}var mt;function ii(){let e=globalThis.__FX_DATA__;if(e)return e;if(mt!==void 0)return mt;let t=null;if(typeof document<"u"){let r=document.getElementById(Wt)?.textContent;if(r)try{t=JSON.parse(r)}catch{t=null}}return mt=t}function Ue(){for(;;){for(;h.cursor&&h.cursor.nodeType===3&&h.cursor.data==="";)h.cursor=h.cursor.nextSibling;if(h.cursor!=null||!h.parents.length)return;h.cursor=h.parents.pop().nextSibling}}var pl=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Je=typeof process<"u"&&process.env&&!1;function Ge(e,t){let r=t.nodeType===1?`<${t.tagName.toLowerCase()}>`:t.nodeType===3?`text ${JSON.stringify((t.nodeValue??"").slice(0,24))}`:t.nodeType===8?"comment":"node";console.warn(`[fluixi] hydration mismatch: expected ${e} but the server DOM has ${r}. Server and client rendered different markup; recreating this node on the client. Check for non-deterministic render (Date.now(), Math.random(), browser-only branches, untransported data).`)}function ml(e){Ue();let t=h.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(pl.has(e.toLowerCase())?h.cursor=t.nextSibling:(h.parents.push(t),h.cursor=t.firstChild),t):(Je&&t&&Ge(`<${e}>`,t),null)}function yl(e){Ue();let t=h.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(h.cursor=t.nextSibling,t):(Je&&t&&Ge(`<${e}> (static)`,t),null)}function vl(e){if(e===""){let r=h.cursor;return r&&r.nodeType===3&&r.data!==""?(h.cursor=r.nextSibling,r.data="",r):null}Ue();let t=h.cursor;return t&&t.nodeType===3?(h.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(Je&&t&&Ge(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function gl(e){Ue();let t=h.cursor;return t&&t.nodeType===8&&t.data===e?(h.cursor=t.nextSibling,t):(Je&&t&&Ge(`marker <!--${e.slice(0,24)}-->`,t),null)}var fn=!1;function bl(){fn||(fn=!0,Fs({hydrateElement:ml,hydrateText:vl,hydrateMarker:gl,hydrateStatic:yl}))}function ke(e,t,r){bl(),h.active=!0,h.cursor=t.firstChild,h.parents=[];let n=ii(),i=r?.resourceNamespace,o=0;Me(()=>i?`${i}:r${o++}`:`r${o++}`),Sr(n?s=>s in n?{value:n[s]}:void 0:null);try{return we(e,t)}finally{h.active=!1,h.cursor=null,h.parents=[]}}var Ht="fluixi-island";function wl(e){let{component:t,props:r={},name:n}=e,i=Nt(Ht),o=n??t.name??"Island";_(i,"name",o),_(i,"props",JSON.stringify(r??{}));let s=N?te():void 0;if(s){let l=s.nextIslandNamespace(o);M(i,()=>s.withResourceScope(l,()=>t(r)))}else M(i,()=>t(r));return i}var dn=!1;function kl(){if(dn||typeof document>"u")return;dn=!0;let e=document.createElement("style");e.textContent=`${Ht}{display:contents}`,document.head.appendChild(e)}function xl(e){if(typeof document>"u")return;kl();let t=document.querySelectorAll(Ht),r=new Map;t.forEach(n=>{let i=n.getAttribute("name")??"",o=r.get(i)??0;r.set(i,o+1);let s=e[i];if(!s){typeof process>"u"&&console.warn(`[fluixi] island "${i}" has no component in the registry — left static.`);return}let l={};try{l=JSON.parse(n.getAttribute("props")||"{}")}catch{}ke(()=>s(l),n,{resourceNamespace:`${i}#${o}`})})}function Sl(e,...t){throw new Error("html`` was not compiled — enable the lit format: fluixi({ format: 'lit' }).")}function Al(e,...t){throw new Error("svg`` was not compiled — enable the lit format: fluixi({ format: 'lit' }).")}function $l(e,t={}){if(typeof e=="function")return jt(e,t);if(typeof e!="string"||e.length===0)return null;let r=Kn(e);if(N)return Ve().createElement(e,r);let n=r?document.createElementNS(He,e):document.createElement(e);return Rt(n,t,r),El(n,t),n}function El(e,t){if(!t||t.children===void 0)return;let r=De(()=>t.children),n=i=>{M(e,i,typeof i=="function"?null:void 0)};Array.isArray(r)?r.forEach(n):n(r)}function Cl(e){return typeof e=="function"?e:(()=>e)}function Xe(e){return()=>{let t=e();return typeof t=="function"?t():t}}function _l(e){return e!=null&&e!==!1}function Nl(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function Ft(e){let t=Xe(()=>e.when),r=g(t,void 0),n=g(r,void 0),i=D(),o=null,s=null,l=a=>{a!==s&&(o&&K(o),o=X(i),s=a)};return g(()=>{let a=n();return l(a?"when":"fallback"),C(o,()=>{if(a){let u=e.children;return typeof u=="function"&&!Nl(u)?typeof r=="function"?I(()=>I(r)?u(r()):e.fallback):u(r):u}return e.fallback})},void 0,{name:"show"})}function Vt(e){let t=Xe(()=>e.each),r=()=>e.fallback??null,n=(i,o)=>{let s=e.children,l=Array.isArray(s)?s.map(a=>typeof a=="function"?a(i,o):a):typeof s=="function"?s(i,o):s;return Ct(l),l};return e.by?Oe(t,e.by,(i,o)=>n(i,o),{fallback:r}):Te(t,(i,o)=>n(i,o),{fallback:r})}function Bt(e){let t=Xe(()=>e.each);return Pe(t,(r,n)=>{let i=e.children(r,n);return Ct(i),i},{fallback:()=>e.fallback??null})}var xt=Symbol("match");function zt(e){return{[xt]:!0,when:Xe(()=>e.when),get children(){return e.children}}}function Ut(e){let t=Array.isArray(e.children)?e.children:[e.children],r=D(),n=null,i=-1,o=s=>{s!==i&&(n&&K(n),n=X(r),i=s)};return g(()=>{for(let s=0;s<t.length;s+=1){let l=t[s],a=0;for(;typeof l=="function"&&!l[xt]&&a++<10;)l=l();if(!l||typeof l!="object"||l[xt]!==!0)continue;let u=l.when();if(_l(u))return o(s),C(n,()=>typeof l.children=="function"?l.children(u):l.children)}return o(-2),C(n,()=>e.fallback??null)})}function Jt(e){let t=Cl(e.component),{component:r,...n}=e,i=D(),o=null,s;return g(()=>{let l=t();return l!==s&&(o&&K(o),o=X(i),s=l),l==null?null:typeof l=="string"?{tag:l,props:n}:C(o,()=>l(n))})}function Gt(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,r,n;return T(i=>{r=i,n=document.createElement("div"),n.style.display="contents",t().appendChild(n),M(n,e.children)&&be(e.ref,n)}),S(()=>{r(),n.remove()}),null}function oi(e){if(N)return e.fallback??null;let t=h.active,[r,n]=O(!t);return t&&queueMicrotask(()=>n(!0)),g(()=>r()?e.children:e.fallback??null,void 0,{name:"client-only"})}var Tl=oi;function Xt(e){let[t,r]=O(null),n=()=>r(null);return g(()=>{let i=t();if(i!==null)return typeof e.fallback=="function"?e.fallback(i,n):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(o){return r(o),typeof e.fallback=="function"?e.fallback(o,n):e.fallback}})}function Ol(e){return g(()=>{let t=typeof e=="function"?e():e,r=[];for(let[n,i]of Object.entries(t))n&&(typeof i=="function"?i():i)&&r.push(n);return r.join(" ")})}function Pl(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Ml(e){return g(()=>{let t=typeof e=="function"?e():e,r=[];for(let[n,i]of Object.entries(t)){if(!n)continue;let o=typeof i=="function"?i():i;o!=null&&r.push(`${Pl(n)}: ${o}`)}return r.join("; ")})}var Kt=1,si=3,li=8,ai;ai=Fe;var Ke=class{constructor(){this[ai]=!0,this.parentNode=null,this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let e=this.parentNode;if(!e)return null;let t=e.childNodes.indexOf(this);return t>=0?e.childNodes[t+1]??null:null}get previousSibling(){let e=this.parentNode;if(!e)return null;let t=e.childNodes.indexOf(this);return t>0?e.childNodes[t-1]??null:null}get parentElement(){return this.parentNode}appendChild(e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=this,this.childNodes.push(e),e}insertBefore(e,t){if(t==null)return this.appendChild(e);e.parentNode&&e.parentNode.removeChild(e);let r=this.childNodes.indexOf(t);return e.parentNode=this,r<0?this.childNodes.push(e):this.childNodes.splice(r,0,e),e}removeChild(e){let t=this.childNodes.indexOf(e);return t>=0&&this.childNodes.splice(t,1),e.parentNode=null,e}replaceChild(e,t){let r=this.childNodes.indexOf(t);return r>=0&&(e.parentNode&&e.parentNode.removeChild(e),e.parentNode=this,this.childNodes[r]=e,t.parentNode=null),t}addEventListener(){}removeEventListener(){}},Zt=class ui extends Ke{constructor(t){super(),this.nodeType=si,this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}get textContent(){return this.data}set textContent(t){this.data=t==null?"":String(t)}cloneNode(){return new ui(this.data)}},Dl=class ci extends Ke{constructor(t){super(),this.nodeType=Kt,this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new ci(this.rawOuterHTML)}},fi=class di extends Ke{constructor(t){super(),this.nodeType=li,this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new di(this.data)}},Rl=class{constructor(){this.cssText=""}setProperty(e,t){this[e]=t}removeProperty(e){delete this[e]}},jl=class{constructor(e){this.el=e}list(){let e=this.el.getAttribute("class");return e?e.split(/\s+/).filter(Boolean):[]}write(e){e.length?this.el.setAttribute("class",e.join(" ")):this.el.removeAttribute("class")}add(...e){let t=this.list();for(let r of e)t.includes(r)||t.push(r);this.write(t)}remove(...e){this.write(this.list().filter(t=>!e.includes(t)))}contains(e){return this.list().includes(e)}toggle(e,t){let r=this.contains(e),n=t===void 0?!r:t;return n?this.add(e):this.remove(e),n}},St=class hi extends Ke{constructor(t,r=!1){super(),this.nodeType=Kt,this.attributes=new Map,this.style=new Rl,this.classList=new jl(this),this.rawHTML=null,this.localName=t.toLowerCase(),this.tagName=r?t:t.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(t,r){this.attributes.set(t,String(r))}removeAttribute(t){this.attributes.delete(t)}getAttribute(t){return this.attributes.has(t)?this.attributes.get(t):null}hasAttribute(t){return this.attributes.has(t)}get id(){return this.getAttribute("id")??""}set id(t){t==null?this.removeAttribute("id"):this.setAttribute("id",t)}get className(){return this.getAttribute("class")??""}set className(t){t==null?this.removeAttribute("class"):this.setAttribute("class",t)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(t){t==null?this.removeAttribute("for"):this.setAttribute("for",t)}set value(t){t==null?this.removeAttribute("value"):this.setAttribute("value",String(t))}set checked(t){t?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(t){t?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(t){}get textContent(){return this.childNodes.map(t=>t.textContent??"").join("")}set textContent(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,t!=null&&t!==""&&this.appendChild(new Zt(String(t)))}set innerText(t){this.textContent=t}set innerHTML(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=t==null?"":String(t)}cloneNode(t=!1){let r=new hi(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,t)for(let n of this.childNodes)r.appendChild(n.cloneNode(!0));return r}},ql=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),pi=/&/g,mi=/</g,yi=/>/g,Ll=/"/g;function yt(e){return e.replace(pi,"&").replace(mi,"<").replace(yi,">")}function hn(e){return e.replace(pi,"&").replace(Ll,""").replace(mi,"<").replace(yi,">")}function Il(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Wl(e){if(!e)return"";let t=[];e.cssText&&t.push(e.cssText.trim().replace(/;\s*$/,""));for(let r of Object.keys(e)){if(r==="cssText")continue;let n=e[r];n==null||n===""||t.push(`${Il(r)}: ${n}`)}return t.join("; ")}function Hl(e){let t="",r=Wl(e.style);for(let[n,i]of e.attributes)n==="style"&&r||(t+=` ${n}="${hn(i)}"`);if(r){let n=e.attributes.get("style"),i=n?`${n.replace(/;\s*$/,"")}; ${r}`:r;t+=` style="${hn(i)}"`}return t}function V(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return yt(e);if(typeof e=="number")return yt(String(e));if(typeof e=="function")return V(e());if(Array.isArray(e))return e.map(V).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case si:return yt(e.data??"");case li:return`<!--${e.data??""}-->`;case Kt:{let t=e.localName,r=`<${t}${Hl(e)}>`;if(ql.has(t))return r;let n=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(V).join("");return`${r}${n}</${t}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(V).join(""):""}var Fl=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Vl={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function pn(e){return e.replace(/&(#?\w+);/g,(t,r)=>Vl[r]??t)}var j=class extends Error{};function Bl(e,t=!1){let r=0,n=[],i=[],o=u=>{let c=i[i.length-1];c?c.appendChild(u):n.push(u)};for(;r<e.length;){let u=e.indexOf("<",r);if(u===-1){l(e.slice(r));break}if(u>r&&l(e.slice(r,u)),e.startsWith("<!--",u)){let c=e.indexOf("-->",u);if(c===-1)throw new j(`unterminated comment at ${u}`);o(new fi(e.slice(u+4,c))),r=c+3;continue}if(e[u+1]==="/"){let c=e.indexOf(">",u);if(c===-1)throw new j(`unterminated closing tag at ${u}`);let f=e.slice(u+2,c).trim().toLowerCase(),d=i.pop();if(!d||d.localName!==f)throw new j(`</${f}> does not close <${d?.localName??"nothing"}>`);r=c+1;continue}r=a(u)}if(i.length>0)throw new j(`unclosed <${i[i.length-1].localName}>`);let s=n[0];if(n.length!==1||!(s instanceof St))throw new j(`expected exactly one root element, got ${n.length}`);return s;function l(u){u!==""&&o(new Zt(pn(u)))}function a(u){let c=/[\s/>]/.exec(e.slice(u+1));if(!c)throw new j(`unterminated tag at ${u}`);let f=e.slice(u+1,u+1+c.index).toLowerCase(),d=new St(f,t),m=u+1+c.index;for(;m<e.length;){for(;m<e.length&&/\s/.test(e[m]);)m++;if(e[m]===">"){m++;break}if(e[m]==="/"&&e[m+1]===">"){m+=2;break}let b=m;for(;m<e.length&&!/[\s=/>]/.test(e[m]);)m++;let v=e.slice(b,m);if(v==="")throw new j(`malformed attribute at ${m}`);if(e[m]==="="){if(e[m+1]!=='"')throw new j(`attribute ${v} must have a double-quoted value`);let E=e.indexOf('"',m+2);if(E===-1)throw new j(`unterminated value for ${v}`);d.setAttribute(v,pn(e.slice(m+2,E))),m=E+1}else d.setAttribute(v,"")}return o(d),Fl.has(f)||i.push(d),m}}var mn=!1;function vi(){mn||(mn=!0,Hs({createElement:(e,t)=>new St(e,t),createText:e=>new Zt(e),createRaw:e=>new Dl(e),parseTemplate:(e,t)=>Bl(e,t),createComment:e=>new fi(e)}))}function zl(e,t={}){let r=N;vi(),de(!0);let n=Lt(t.event);try{return It(n,()=>T(i=>{try{let o=typeof e=="function"?e():e;return V(o)}finally{i()}}))}finally{de(r)}}var yn=!1;function Ul(){yn||(yn=!0,xr(e=>{te()?.pending.add(e)}),Me(()=>te()?.nextResourceId()??""),Ar((e,t)=>{e&&te()?.data.set(e,t)}))}var At=null;function Jl(e){At=e}function gi(e){if(e.data.size===0)return"";let t={};for(let[n,i]of e.data){let o=i;if(At)try{o=At(i,n)}catch{continue}o!==void 0&&(typeof o=="function"||typeof o=="symbol"||(t[n]=o))}if(Object.keys(t).length===0)return"";let r=ni(JSON.stringify(t));return r==="{}"?"":`<script type="application/json" id="${Wt}">${r}<\/script>`}var Gl=50;async function Xl(e,t={}){let r=N;vi(),de(!0),Ul();let n=Lt(t.event);try{return await It(n,async()=>{t.preload&&await t.preload(t.event);let i,o=null,s=()=>{};T(c=>{s=c,o=D(),i=typeof e=="function"?e():e});let l=()=>{try{C(o,()=>V(i))}catch{}};l();let a=0;for(;n.pending.size>0&&a++<Gl;){let c=Array.from(n.pending);n.pending.clear(),await Promise.allSettled(c),await kr(),l()}let u=C(o,()=>V(i))+gi(n);return s(),u})}finally{de(r)}}var Kl={createComponent:jt,createElement:Sn,createNativeElement:Nt,createTemplate:Tt,cloneTemplate:Ot,templateNode:Fn,holeContent:zn,holeEnd:Bn,holeScope:Vn,createPortal:Xn,render:we,hydrate:ke,insert:M,appendChildren:$n,removeChildren:An,spread:Jn,applyProps:Rt,mergeProps:Gn,bindPair:Zn,setProperty:re,setDynamicProperty:me,setAttribute:_,setDynamicAttribute:pe,removeAttribute:xn,getAttribute:kn,setClassName:ne,addClass:gn,removeClass:bn,toggleClass:wn,setStyles:$t,delegateEvents:ze,addDelegatedEventListener:_t,removeDelegatedEventListener:We,handleRef:be,resetIntegration:Yn,isIntegrationInitialized:Qn},Zl=Kl;function Ql(e){let t=(r,n)=>{r.parent=n;let i=Yl(r);for(let o of i)t(o,r)};return t(e,null),e}function Yl(e){switch(e.kind){case"Root":case"Element":case"Component":case"Fragment":return e.children;default:return[]}}var ea=class{constructor(e){this.pieces=e,this.pi=0,this.oi=0,this.normalize()}normalize(){for(;this.pi<this.pieces.length;){let e=this.pieces[this.pi];if(e.kind==="static"&&this.oi>=e.text.length){this.pi++,this.oi=0;continue}break}}eof(){return this.pi>=this.pieces.length}pos(){if(this.eof()){let t=this.pieces[this.pieces.length-1];return t?t.kind==="static"?t.start+t.text.length:t.end:0}let e=this.pieces[this.pi];return e.kind==="static"?e.start+this.oi:e.start}atHole(){return!this.eof()&&this.pieces[this.pi].kind==="hole"}holeFollows(){if(this.eof())return!1;let e=this.pieces[this.pi];if(e.kind!=="static"||this.oi+1<e.text.length)return!1;let t=this.pieces[this.pi+1];return t!==void 0&&t.kind==="hole"}takeHole(){let e=this.pieces[this.pi];if(e.kind!=="hole")throw new Error("takeHole called off a hole");return this.pi++,this.oi=0,this.normalize(),{index:e.index,loc:{start:e.start,end:e.end}}}peek(e=0){if(this.eof())return"";let t=this.pieces[this.pi];return t.kind!=="static"?"":t.text[this.oi+e]??""}startsWith(e){if(this.eof())return!1;let t=this.pieces[this.pi];return t.kind!=="static"?!1:t.text.startsWith(e,this.oi)}advance(){if(this.eof())return"";let e=this.pieces[this.pi];if(e.kind!=="static")return"";let t=e.text[this.oi++]??"";return this.normalize(),t}readWhile(e){let t="";for(;!this.eof()&&!this.atHole();){let r=this.peek();if(r===""||!e(r))break;t+=r,this.oi++}return this.normalize(),t}skipWhitespace(){this.readWhile(e=>/\s/.test(e))}span(e){return{start:e,end:this.pos()}}},bi=new Set(["capture","once","passive","prevent","stop","self"]);function B(e,t){return e.value&&e.value.kind==="hole"?e.value.hole:(e.report("invalid-binding",`${t} requires an expression value: ${e.name}=\${…}`),-1)}var ki=(e,t)=>({kind:"Attribute",name:t?e.name.slice(1):e.name,value:e.value,boolean:t,loc:e.loc}),xi=[{id:"event",match:e=>e[0]==="@"||e.startsWith("on:")||/^on[A-Z]/.test(e),build:e=>{let t,r;e.name[0]==="@"?(t="at",r=e.name.slice(1)):e.name.startsWith("on:")?(t="colon",r=e.name.slice(3)):(t="on",r=e.name.slice(2));let[n,...i]=r.split("."),o=n.toLowerCase();for(let s of i)bi.has(s)||e.report("invalid-directive",`Unknown event modifier ".${s}" — expected one of ${[...bi].join(", ")}`);return{kind:"EventBinding",name:o,syntax:t,modifiers:i,hole:B(e,"event binding"),loc:e.loc}}},{id:"bind",elementOnly:!0,match:e=>e.startsWith("bind:"),build:e=>({kind:"BindDirective",name:e.name.slice(5),hole:B(e,"two-way binding"),loc:e.loc})},{id:"class-directive",elementOnly:!0,match:e=>e.startsWith("class:"),build:e=>({kind:"ClassDirective",name:e.name.slice(6),hole:B(e,"class directive"),loc:e.loc})},{id:"style-directive",elementOnly:!0,match:e=>e.startsWith("style:"),build:e=>({kind:"StyleDirective",name:e.name.slice(6),hole:B(e,"style directive"),loc:e.loc})},{id:"load",match:e=>e.startsWith("load:"),build:e=>({kind:"LoadDirective",strategy:e.name.slice(5),modifier:e.value&&e.value.kind==="static"?e.value.value:null,loc:e.loc})},{id:"use",match:e=>e==="use"||e.startsWith("use:"),build:e=>({kind:"UseDirective",name:e.name.startsWith("use:")?e.name.slice(4):null,hole:e.value&&e.value.kind==="hole"?e.value.hole:null,loc:e.loc})},{id:"if",elementOnly:!0,match:e=>e==="if",build:e=>({kind:"IfDirective",hole:B(e,"if directive"),loc:e.loc})},{id:"each",elementOnly:!0,match:e=>e==="each",build:e=>({kind:"EachDirective",hole:B(e,"each directive"),key:null,loc:e.loc})},{id:"else",elementOnly:!0,match:e=>e==="else",build:e=>(e.value!==null&&e.report("invalid-directive","`else` takes no value"),{kind:"ElseDirective",loc:e.loc})},{id:"ref",match:e=>e==="ref",build:e=>({kind:"RefBinding",hole:B(e,"ref binding"),loc:e.loc})},{id:"property",match:e=>e[0]===".",build:e=>({kind:"PropertyBinding",name:e.name.slice(1),hole:B(e,"property binding"),loc:e.loc})},{id:"boolean",match:e=>e[0]==="?",build:e=>ki(e,!0)}];function ta(e,t=xi,r={component:!1}){for(let n of t)if(!(n.elementOnly&&r.component)&&n.match(e.name))return n.build(e);return ki(e,!1)}var ra=new Set(["svg","path","circle","rect","line","polygon","polyline","ellipse","g","defs","clipPath","text"]),na=new Set(["script","style","textarea","title"]),ia=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function oa(e){return e.length>0&&(e[0]!==e[0].toLowerCase()||e.includes("."))}var sa=new Set(["a","button","input","select","textarea","summary","details","option","label"]),la=new Set(["keydown","keyup","keypress"]);function ie(e,t){return e.attributes.find(r=>"name"in r&&r.name===t)}function aa(e){return e.attributes.some(t=>t.kind==="Spread")}function Ze(e,t){let r=ie(e,t);if(!r||r.kind!=="Attribute"||!r.value)return;let n=r.value;return n.kind==="static"?n.value:void 0}function ua(e){let t=Ze(e,"role");return t==="presentation"||t==="none"?!0:Ze(e,"aria-hidden")==="true"}function wi(e,t){return e.attributes.some(r=>r.kind==="EventBinding"&&t(r.name))}function ca(e){let t=[],r=(i,o,s)=>{t.push({code:o,message:s,severity:"warning",loc:i.loc})},n=i=>{for(let o of i){o.kind==="Element"&&fa(o,r);let s="children"in o?o.children:void 0;s&&n(s)}};return n(e.children),t}function fa(e,t){if(aa(e))return;let r=e.tag.toLowerCase();r==="img"&&!ie(e,"alt")&&!ua(e)&&t(e,"a11y-img-alt",'An `img` needs an `alt`. Use `alt=""` when the image is decorative.'),r==="a"&&!ie(e,"href")&&!ie(e,"role")&&t(e,"a11y-anchor-href","An `a` without `href` is not a link. Use a `button` for an action."),r==="iframe"&&!ie(e,"title")&&t(e,"a11y-iframe-title","An `iframe` needs a `title` describing its content.");let n=Ze(e,"tabindex")??Ze(e,"tabIndex");n!==void 0&&Number(n)>0&&t(e,"a11y-positive-tabindex","A positive `tabindex` reorders tab navigation for the entire page. Use `0`, or restructure the markup."),!sa.has(r)&&wi(e,i=>i==="click")&&!ie(e,"role")&&!wi(e,i=>la.has(i))&&t(e,"a11y-click-without-keyboard",`A click handler on \`${r}\` is unreachable by keyboard. Use a \`button\`, or add a \`role\` and a key handler.`)}var da=/[A-Za-z0-9\-_:@.?]/,ha=class{constructor(e,t){this.diagnostics=[],this.r=new ea(e),this.svg=t.svg??!1,this.directives=t.directives??xi,this.accessibility=t.accessibility??!0}parse(){let e=this.r.pos(),t=[];for(;!this.r.eof()&&(t.push(...this.parseChildren()),!this.r.eof());){let n=this.r.pos();this.consumeCloseTag(),this.report("stray-close-tag","error","Close tag without a matching open tag",this.r.span(n))}let r={kind:"Root",children:t,loc:this.r.span(e)};return Ql(r),this.validateTree(r),this.accessibility&&this.diagnostics.push(...ca(r)),{root:r,diagnostics:this.diagnostics}}validateTree(e){let t=r=>{let n=null;for(let i of r)i.kind==="Text"&&/^\s*$/.test(i.value)||(i.kind==="Element"||i.kind==="Component"?(i.attributes.some(o=>o.kind==="ElseDirective")&&(n!=null&&(n.kind==="Element"||n.kind==="Component")&&n.attributes.some(o=>o.kind==="IfDirective")||this.report("else-without-if","error","`else` must immediately follow an element with `if`",i.loc)),n=i):n=null,"children"in i&&i.children&&t(i.children))};t(e.children)}parseChildren(){let e=[];for(;!this.r.eof()&&!this.r.startsWith("</");){if(this.r.startsWith("<!--")){e.push(this.parseComment());continue}if(this.isFragmentStart()){e.push(this.parseFragment());continue}if(this.isDynamicTagStart()){e.push(this.parseDynamicComponent());continue}if(this.isTagStart()){e.push(this.parseElement());continue}if(this.r.atHole()){let r=this.r.takeHole(),n={kind:"Expression",hole:r.index,loc:r.loc};e.push(n);continue}let t=this.readText();t&&e.push(t)}return e}isTagStart(){return this.r.peek()==="<"&&/[A-Za-z]/.test(this.r.peek(1))}isFragmentStart(){return this.r.peek()==="<"&&this.r.peek(1)===">"}isDynamicTagStart(){return this.r.peek()==="<"&&this.r.holeFollows()}parseDynamicComponent(){let e=this.r.pos();this.r.advance();let t=this.r.takeHole().index,r=this.parseAttributes(!0);this.r.skipWhitespace();let n=!1,i=[];return this.r.startsWith("/>")?(this.r.advance(),this.r.advance(),n=!0):(this.r.peek()===">"&&this.r.advance(),i=this.parseChildren(),this.r.startsWith("</")?(this.r.advance(),this.r.advance(),this.r.atHole()?this.r.takeHole():this.readName(),this.r.skipWhitespace(),this.r.peek()===">"&&this.r.advance()):this.report("unclosed-tag","error","Unclosed dynamic component",this.r.span(e))),{kind:"Component",tag:"",tagHole:t,attributes:r,children:i,selfClosing:n,loc:this.r.span(e)}}readText(){let e=this.r.pos(),t="";for(;!this.r.eof()&&!this.r.atHole()&&!(this.r.startsWith("</")||this.r.startsWith("<!--")||this.isTagStart()||this.isFragmentStart()||this.isDynamicTagStart());)t+=this.r.advance();return t?{kind:"Text",value:t,raw:!1,loc:this.r.span(e)}:null}parseComment(){let e=this.r.pos();this.r.advance(),this.r.advance(),this.r.advance(),this.r.advance();let t="";for(;!this.r.eof()&&!this.r.startsWith("-->");){if(this.r.atHole()){this.r.takeHole(),t+="\0";continue}t+=this.r.advance()}return this.r.startsWith("-->")?(this.r.advance(),this.r.advance(),this.r.advance()):this.report("unclosed-comment","warning","Unterminated comment",this.r.span(e)),{kind:"Comment",value:t,loc:this.r.span(e)}}parseFragment(){let e=this.r.pos();this.r.advance(),this.r.advance();let t=this.parseChildren();if(this.r.startsWith("</")){let r=this.consumeCloseTag();r&&this.report("mismatched-close-tag","error",`Expected </> to close fragment, got </${r}>`,this.r.span(e))}else this.report("unclosed-tag","error","Unterminated fragment",this.r.span(e));return{kind:"Fragment",children:t,loc:this.r.span(e)}}parseElement(){let e=this.r.pos();this.r.advance();let t=this.readName(),r=oa(t),n=this.parseAttributes(r);this.foldEachKey(n,e),this.r.skipWhitespace();let i=t.toLowerCase(),o=!r&&na.has(i),s=!r&&ia.has(i),l=!1,a=[];if(this.r.startsWith("/>"))this.r.advance(),this.r.advance(),l=!0;else if(this.r.peek()===">"&&this.r.advance(),!s)if(a=o?this.parseRawText(t):this.parseChildren(),this.r.startsWith("</")){let f=this.consumeCloseTag();f&&f!==t&&this.report("mismatched-close-tag","error",`Expected </${t}>, got </${f}>`,this.r.span(e))}else this.report("unclosed-tag","error",`Unclosed <${t}>`,this.r.span(e));let u=this.r.span(e);if(r)return{kind:"Component",tag:t,tagHole:null,attributes:n,children:a,selfClosing:l,loc:u};let c=this.svg||ra.has(t)?"svg":"html";return{kind:"Element",tag:t,namespace:c,attributes:n,children:a,selfClosing:l,rawText:o,loc:u}}parseRawText(e){let t=[],r="</"+e.toLowerCase(),n="",i=this.r.pos(),o=()=>{n&&t.push({kind:"Text",value:n,raw:!0,loc:this.r.span(i)}),n=""};for(;!this.r.eof()&&!this.startsWithCloseFor(r);){if(this.r.atHole()){o();let s=this.r.takeHole();t.push({kind:"Expression",hole:s.index,loc:s.loc}),i=this.r.pos();continue}n||(i=this.r.pos()),n+=this.r.advance()}return o(),t}startsWithCloseFor(e){let t=0;for(;t<e.length;){let r=this.r.peek(t);if(r===""||r.toLowerCase()!==e[t])return!1;t++}return!0}parseAttributes(e){let t=[];for(;!this.r.eof()&&(this.r.skipWhitespace(),!(this.r.peek()===">"||this.r.startsWith("/>")));){if(this.r.atHole()){let l=this.r.takeHole();t.push({kind:"Spread",hole:l.index,loc:l.loc});continue}if(this.r.startsWith("...")){let l=this.r.pos();if(this.r.advance(),this.r.advance(),this.r.advance(),this.r.atHole()){let a=this.r.takeHole();t.push({kind:"Spread",hole:a.index,loc:this.r.span(l)})}else this.report("invalid-binding","error","Spread `...` must be followed by ${…}",this.r.span(l));continue}let r=this.r.pos(),n=this.readName();if(!n){this.r.advance();continue}let i=this.r.span(r);this.r.skipWhitespace();let o=null;this.r.peek()==="="&&(this.r.advance(),this.r.skipWhitespace(),o=this.parseAttrValue());let s={name:n,nameLoc:i,value:o,loc:this.r.span(r),report:(l,a)=>this.report(l,"error",a,this.r.span(r))};t.push(ta(s,this.directives,{component:e}))}return t}parseAttrValue(){if(this.r.atHole())return{kind:"hole",hole:this.r.takeHole().index};let e=this.r.peek();return e==='"'||e==="'"?this.classifyParts(this.readQuotedParts(e)):{kind:"static",value:this.r.readWhile(t=>!/[\s>]/.test(t))}}readQuotedParts(e){this.r.advance();let t=[],r="";for(;!this.r.eof()&&this.r.peek()!==e;){if(this.r.atHole()){r&&(t.push({text:r}),r=""),t.push({hole:this.r.takeHole().index});continue}let n=this.r.advance();if(n==="")break;r+=n}return r&&t.push({text:r}),this.r.peek()===e&&this.r.advance(),t}classifyParts(e){let t=e.filter(r=>"hole"in r);return t.length===0?{kind:"static",value:e.map(r=>"text"in r?r.text:"").join("")}:e.length===1?{kind:"hole",hole:t[0].hole}:{kind:"mixed",parts:e}}foldEachKey(e,t){let r=null,n=0,i=0,o=0,s=0;for(let c of e)c.kind==="EachDirective"?(r=c,i++):c.kind==="IfDirective"?n++:c.kind==="ElseDirective"?o++:c.kind==="RefBinding"&&s++;let l=this.r.span(t);i>1&&this.report("duplicate-directive","error","Multiple `each` directives on one element",l),n>1&&this.report("duplicate-directive","error","Multiple `if` directives on one element",l),s>1&&this.report("duplicate-directive","error","Multiple `ref` bindings on one element",l),n>0&&i>0&&this.report("unsupported-combination","error","`if` and `each` cannot both apply to one element — wrap one in another element",l),n>0&&o>0&&this.report("invalid-directive","error","`if` and `else` cannot be on the same element",l);let a=e.findIndex(c=>c.kind==="Attribute"&&c.name==="key");if(!r){a!==-1&&this.report("invalid-directive","error","`key` requires an `each` directive on the same element",l);return}if(a===-1)return;let u=e[a];u.kind==="Attribute"&&u.value&&(u.value.kind==="static"?r.key={static:u.value.value}:u.value.kind==="hole"&&(r.key={hole:u.value.hole})),e.splice(a,1)}readName(){return this.r.readWhile(e=>da.test(e))}consumeCloseTag(){this.r.advance(),this.r.advance();let e=this.readName();return this.r.skipWhitespace(),this.r.peek()===">"&&this.r.advance(),e}report(e,t,r,n){this.diagnostics.push({code:e,severity:t,message:r,loc:n})}};function Yt(e,t={}){return new ha(e,t).parse()}function pa(e){let t=[],r=0;return e.forEach((n,i)=>{t.push({kind:"static",text:n,start:r}),r+=n.length,i<e.length-1&&t.push({kind:"hole",index:i,start:r,end:r})}),t}function Si(e,t={}){return Yt(pa(e),t)}function ma(e){switch(e.kind){case"event":return"event";case"ref":return"ref";case"spread":return"spread";case"class":case"style":return"class-or-style-directive";case"attr":case"prop":return e.reactive?"reactive-prop":e.expr!==void 0?"expression-prop":void 0;default:return"expression-prop"}}function ya(e){let t=[],r=new Map,n=i=>{switch(i.kind){case"text":return!0;case"expr":return!1;case"component":case"control":for(let o of i.children)n(o);return!1;case"fragment":for(let o of i.children)n(o);return!1;case"element":{let o=!0;for(let l of i.children)n(l)||(o=!1);let s;for(let l of i.props)if(s=ma(l),s)break;return!s&&!o&&(s=va(i)),i.static=!s,s?r.set(i,s):t.push(i),i.static}default:return!1}};for(let i of Array.isArray(e)?e:[e])n(i);return{staticElements:t,reasons:r}}function va(e){for(let t of e.children){if(t.kind==="expr")return"expression-child";if(t.kind==="component")return"component-child";if(t.kind==="control")return"control-child";if(t.kind==="element"&&!t.static||t.kind==="fragment")return"expression-child"}return"expression-child"}var er={kind:"eager"},ga=["pointerdown","focusin","keydown"],Ai=new Set(["eager","idle","visible","interaction","media","never"]),Qe=class extends Error{};function ba(e,t){let r=e.slice(5);if(!Ai.has(r))throw new Qe(`Unknown load strategy 'load:${r}'. Expected one of ${[...Ai].join(", ")}.`);switch(r){case"eager":return er;case"idle":return{kind:"idle"};case"never":return{kind:"never"};case"visible":return t?{kind:"visible",rootMargin:t}:{kind:"visible"};case"interaction":return{kind:"interaction",events:t?wa(t):[...ga]};case"media":if(!t)throw new Qe(`'load:media' needs a query, e.g. load:media="(min-width: 1024px)".`);return{kind:"media",query:t};default:throw new Qe(`Unhandled load strategy '${r}'.`)}}function wa(e){let t=e.split(/[\s,]+/).map(r=>r.trim()).filter(Boolean);if(t.length===0)throw new Qe("'load:interaction' was given no event names.");return t}function ka(e){return e.kind!=="eager"&&e.kind!=="never"}var tr=["Show","For","Index","Switch","Match","Portal","Dynamic","ErrorBoundary"],rr=["Suspense","SuspenseList","Await"],nr=["Router","Outlet","Redirect","Link"],Ku=[...tr,...rr,...nr],$i=new Set([...tr,...rr]);function xa(e={}){let{controlFlowModule:t="@fluixi/dom",coreModule:r="@fluixi/core",routerModule:n="@fluixi/core/router"}=e,i={};for(let o of tr)i[o]=t;for(let o of rr)i[o]=r;for(let o of nr)i[o]=n;return i}function Sa(e,t={}){let{resolver:r,isBound:n,modules:i,strategyFor:o}=t,s=xa(i),l=new Map,a=new Set,u=f=>{let{name:d}=f;if(!d||d.includes(".")||n?.(d))return;let m=c(d);if(!m){a.add(d);return}let b=m.origin==="builtin"&&$i.has(d)?er:o?.(f)??er;f.source={...m,loading:b},l.set(d,f.source)},c=f=>{if($i.has(f))return{module:s[f],export:f,origin:"builtin"};let d=r?.resolve(f);if(d)return{module:d.module,export:d.export,origin:"rule"};if(nr.includes(f))return{module:s[f],export:f,origin:"builtin"}};return ir(e,f=>{f.kind==="component"&&u(f)}),{resolved:l,unresolved:[...a]}}function ir(e,t){let r=Array.isArray(e)?e:[e];for(let n of r){t(n);let i=n.children;i&&ir(i,t)}}function Aa(e){let t=[];ir(e,o=>{o.kind==="component"&&o.source&&t.push(o)});let r=new Set,n=new Set;for(let o of t){let{module:s,loading:l}=o.source;l.kind==="eager"&&r.add(s),l.kind==="never"&&n.add(s)}let i=new Map;for(let o of t){let s=o.source;ka(s.loading)&&r.has(s.module)&&(s.loading={kind:"eager"},i.set(s.module,(i.get(s.module)??0)+1))}return{collapsed:i,conflicted:[...n].filter(o=>r.has(o))}}var $a=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Oi={className:"class",htmlFor:"for"},Ea=new Set(["innerHTML","outerHTML","innerText","textContent","value","checked","selected","muted","defaultValue","defaultChecked","children","ref"]),Ca=new Set(["script","style","textarea","title"]);function Pi(e){return Ca.has(e)}function _a(e){return Oi[e]??e}function or(e){return e.kind!=="attr"||e.expr!==void 0||e.name.includes(":")?!1:!Ea.has(e.name)}function Mi(e){if(!e.static||Pi(e.tag))return!1;for(let t of e.props)if(!or(t))return!1;for(let t of e.children)if(t.kind!=="text"&&!(t.kind==="element"&&Mi(t)))return!1;return!0}function sr(e){let t=e.props.map(Ta).filter(Boolean).join(""),r=`<${e.tag}${t}>`;return $a.has(e.tag)?r:`${r}${e.children.map(Na).join("")}</${e.tag}>`}function Na(e){if(e.kind==="text")return Pa(e.value);if(e.kind!=="element")throw new Error(`serializeStatic: unexpected ${e.kind}`);return sr(e)}function Ta(e){let t=Oi[e.name]??e.name,r=e.literal;return r===!0||r===void 0?` ${t}`:r===!1||r===null?"":` ${t}="${Oa(String(r))}"`}function Oa(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Pa(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var Ma="<!--fx-->",Da="<!--fx/-->";function et(e){return e.kind==="expr"||e.kind==="component"||e.kind==="control"}function Ra(e){return e.kind==="text"||e.kind==="element"&&Di(e)}function Di(e){return e.svg||Pi(e.tag)||!e.props.every(t=>or(t))?!1:e.children.every(t=>Ra(t)||et(t))}function Ye(e){if(et(e))return!0;let t=e.children;return t?t.some(Ye):!1}function Ri(e){for(let t=0;t<e.children.length;t++){let r=e.children[t];if(r.kind==="text"&&(r.value===""||e.children[t+1]?.kind==="text"))return!1}return e.children.every(t=>t.kind!=="element"||Ri(t))}function ja(e){if(!Di(e)||!Ri(e)||!e.children.some(Ye))return null;let t=[],r=[],n=0,i=s=>{let l=`_n$${n++}`;return t.push({ref:l,expr:s}),l};return o(e,"_el$"),{html:qa(e),tag:e.tag,steps:t,holes:r};function o(s,l){let a=-1;s.children.forEach((c,f)=>{Ye(c)&&(a=f)});let u=null;for(let c=0;c<=a;c++){let f=s.children[c],d=u?`${u}.nextSibling`:`${l}.firstChild`;if(et(f)){let b=i(d),v=i(`holeEnd(${b})`);r.push({parentRef:l,startRef:b,endRef:v,node:f}),u=v;continue}let m=i(d);f.kind==="element"&&Ye(f)&&o(f,m),u=m}}}function qa(e){return sr(ji(e)).split(qi).join(Ma+Da)}function ji(e){return{...e,children:e.children.map(t=>et(t)?{kind:"text",value:qi}:t.kind==="element"?ji(t):t)}}var qi="\0fx-hole\0",Li={version:1,module:"@fluixi/dom",symbols:["createNativeElement","insert","spread","setAttribute","delegateEvents","createComponent","createMemo","untrack","Show","For","Index","Switch","Match","Dynamic","ErrorBoundary"]},Zu={version:2,module:"@fluixi/dom",symbols:[...Li.symbols,"template","cloneTemplate","walk"]},La={show:"Show",for:"For",index:"Index",switch:"Switch",match:"Match",dynamic:"Dynamic",errorBoundary:"ErrorBoundary",suspense:"Suspense"};function Ia(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function Ii(e){return Ia(e)?e:JSON.stringify(e)}function Wa(e){return e.expr!==void 0?e.reactive?`() => (${e.expr})`:`(${e.expr})`:JSON.stringify(e.literal??!0)}function Ha(e){return e.expr!==void 0?`(${e.expr})`:JSON.stringify(e.literal??!0)}function Fa(e,t,r){let n=e.filter(s=>s.kind==="spread"),i=e.filter(s=>s.kind!=="spread").map(s=>`${Ii(s.name)}: ${Wa(s)}`);t!=null&&i.push(`children: ${t}`);let o=`{ ${i.join(", ")} }`;return n.length>0?(r.add("mergeProps"),`mergeProps(${n.map(s=>s.expr).join(", ")}, ${o})`):o}function Wi(e,t,r){return e.length===1?xe(e[0],t,r):`[${e.map(n=>xe(n,t,r)).join(", ")}]`}function Ei(e,t,r,n,i){n.add("createMemo"),n.add("createComponent");let o=t.filter(a=>a.kind==="spread"),s=t.filter(a=>a.kind!=="spread").map(a=>`get ${Ii(a.name)}() { return ${Ha(a)}; }`);r.length>0&&s.push(`get children() { return ${Wi(r,n,i)}; }`);let l=`{ ${s.join(", ")} }`;return o.length>0&&(n.add("mergeProps"),l=`mergeProps(${o.map(a=>a.expr).join(", ")}, ${l})`),`createMemo(() => createComponent(${e}, ${l}))`}function Va(e,t){let r=_a(t.name),n=t.literal;return n===!0||n===void 0?`${e}.setAttribute(${JSON.stringify(r)}, "");`:n===!1||n===null?"":`${e}.setAttribute(${JSON.stringify(r)}, ${JSON.stringify(String(n))});`}var Hi=!1;function xe(e,t,r){switch(e.kind){case"text":return JSON.stringify(e.value);case"expr":return e.reactive?`() => (${e.code})`:`(${e.code})`;case"fragment":return e.children.length===0?"null":Wi(e.children,t,r);case"component":return Ei(e.name,e.props,e.children,t,r);case"control":{let n=La[e.control]??e.control;return t.add(n),Ei(n,e.props,e.children,t,r)}case"element":{if(r&&e.static&&!e.svg&&Mi(e)){t.add("templateNode");let l=`_tmpl$${r.length}`;return r.push({id:l,html:sr(e),tag:e.tag,svg:!1}),`templateNode(${l}, ${JSON.stringify(e.tag)})`}if(r&&Hi){let l=ja(e);if(l){t.add("templateNode"),t.add("insert"),t.add("holeEnd"),t.add("holeContent"),t.add("holeScope");let a=`_tmpl$${r.length}`;r.push({id:a,html:l.html,tag:l.tag,svg:!1});let u=[`const _el$ = templateNode(${a}, ${JSON.stringify(l.tag)}, true);`];for(let c of l.steps)u.push(`const ${c.ref} = ${c.expr};`);for(let c of l.holes)u.push(`insert(${c.parentRef}, holeScope(${c.startRef}, () => (${xe(c.node,t,r)})), ${c.endRef}, holeContent(${c.startRef}, ${c.endRef}));`);return u.push("return _el$;"),`(() => { ${u.join(" ")} })()`}}t.add("createNativeElement");let n=JSON.stringify(e.tag),i="_el$",o=[],s=e.svg?`${n}, true`:n;if(o.push(`const ${i} = createNativeElement(${s});`),e.props.length>0)if(!e.svg&&e.props.every(or))for(let l of e.props)o.push(Va(i,l));else{t.add("spread");let l=e.svg?", isSVG: true":"";o.push(`spread({ element: ${i}, props: ${Fa(e.props,null,t)}${l} });`)}for(let l of e.children){t.add("insert");let a=xe(l,t,r),u=l.kind==="expr"&&l.reactive||l.kind==="component"||l.kind==="control";o.push(u?`insert(${i}, ${a}, null);`:`insert(${i}, ${a});`)}return o.push(`return ${i};`),`(() => { ${o.join(" ")} })()`}}}function Fi(e,t){if(!t||t.length===0)return e;let r=new Map(t.map(n=>[n.id,JSON.stringify(n.html)]));return e.replace(/_tmpl\$\d+/g,n=>r.get(n)??n)}var Vi={name:"imperative",contract:Li,emit(e,t){let r=new Set,n=t?.templateClone!==!1?[]:void 0;return Hi=t?.partialTemplates===!0,{code:xe(e,r,n),imports:Array.from(r),templates:n}}},Ba=e=>"components"in e;function Ci(e,t){return e.replace(/\$(\d+)/g,(r,n)=>t[Number(n)]??r)}function za(e,t){return typeof t=="string"?{module:t,export:e}:t}function Ua(e=[]){let t=new Map,r=[],n=[];for(let o of e){if(!Ba(o)){n.push(o);continue}for(let[s,l]of Object.entries(o.components)){let a=za(s,l),u=t.get(s);if(u&&u.module!==a.module){let c=r.find(f=>f.name===s);c?c.modules.push(a.module):r.push({name:s,modules:[u.module,a.module]});continue}t.set(s,a)}}let i=new Map;return{resolve:o=>{if(i.has(o))return i.get(o);let s=t.get(o);if(!s)for(let l of n){let a=o.match(new RegExp(l.match.source,l.match.flags.replace("g","")));if(a){s={module:Ci(l.module,a),export:l.export?Ci(l.export,a):o};break}}return i.set(o,s),s},names:()=>[...t.keys()],conflicts:()=>r}}function _i(e){let t=e.split(/\r\n|\n|\r/),r=0;for(let i=0;i<t.length;i++)/[^ \t]/.test(t[i])&&(r=i);let n="";for(let i=0;i<t.length;i++){let o=t[i].replace(/\t/g," ");i!==0&&(o=o.replace(/^ +/,"")),i!==t.length-1&&(o=o.replace(/ +$/,"")),o&&(i!==r&&(o+=" "),n+=o)}return n}var Ni=new Set(["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup"]);function Ja(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function Ti(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Ga=class{constructor(e,t){this.holes=e,this.used=t}hole(e){return this.holes[e]??{code:"undefined",reactive:!1}}emit(e){let{code:t,imports:r,templates:n}=Vi.emit(e,{});for(let i of r)this.used.add(i);return Fi(t,n)}lowerRoot(e){let t=this.lowerChildren(e);return t.length===1?t[0]:{kind:"fragment",children:t}}lowerChildren(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r];if(n.kind==="Element"||n.kind==="Component"){let o=n.attributes.find(s=>s.kind==="IfDirective");if(o&&o.kind==="IfDirective"){let s=r+1;s<e.length&&this.isBlankText(e[s])&&s++;let l=e[s],a=l&&(l.kind==="Element"||l.kind==="Component")&&l.attributes.some(u=>u.kind==="ElseDirective");t.push(this.lowerIf(n,o.hole,a?l:null)),a&&(r=s);continue}if(n.attributes.some(s=>s.kind==="EachDirective")){t.push(this.lowerEach(n));continue}}let i=this.lowerNode(n);i&&t.push(i)}return t}isBlankText(e){return e.kind==="Text"&&!e.raw&&_i(e.value)===""}lowerNode(e){switch(e.kind){case"Text":{if(e.raw)return{kind:"text",value:e.value};let t=_i(e.value);return t?{kind:"text",value:t}:null}case"Comment":return null;case"Expression":{let t=this.hole(e.hole);return{kind:"expr",code:t.code,reactive:t.reactive}}case"Fragment":return{kind:"fragment",children:this.lowerChildren(e.children)};case"Element":return this.lowerElement(e);case"Component":return this.lowerComponent(e);default:return null}}lowerElement(e){let t=e.attributes.find(r=>r.kind==="Attribute"&&r.name==="is");if(e.tag==="component"&&t&&t.value&&t.value.kind==="hole"){let r=e.attributes.filter(i=>i!==t),n=this.lowerComponent({...e,kind:"Component",tag:"Dynamic",tagHole:null,attributes:r});return n.props.unshift({name:"component",kind:"attr",expr:`() => (${this.hole(t.value.hole).code})`}),n}return{kind:"element",tag:e.tag,svg:e.namespace==="svg",props:this.lowerAttributes(e.attributes),children:this.lowerChildren(e.children),static:!1}}lowerComponent(e){let t=e.tagHole!=null?this.hole(e.tagHole).code:e.tag,r=this.lowerAttributes(e.attributes),{slots:n,rest:i}=this.partitionSlots(e.children);for(let[l,a]of n){let u=a.length===1?a[0]:{kind:"fragment",children:a},c={name:l,kind:"attr",expr:this.emit(u),jsxElement:!0},f=r.findIndex(d=>d.name===l);f>=0?r[f]=c:r.push(c)}let o=e.attributes.find(l=>l.kind==="LoadDirective"),s=o?ba(`load:${o.strategy}`,o.modifier):void 0;return{kind:"component",name:t,props:r,children:this.lowerChildren(i),...s?{load:s}:{}}}partitionSlots(e){let t=new Map,r=[];for(let n of e){if(n.kind==="Element"||n.kind==="Component"){let i=n.attributes.find(o=>o.kind==="Attribute"&&o.name==="slot");if(i&&i.value&&i.value.kind==="static"){let o={...n,attributes:n.attributes.filter(a=>a!==i)},s=o.kind==="Element"?this.lowerElement(o):this.lowerComponent(o),l=t.get(i.value.value)??[];l.push(s),t.set(i.value.value,l);continue}}r.push(n)}return{slots:t,rest:r}}lowerIf(e,t,r){let n=this.hole(t),i=[{name:"when",kind:"attr",expr:n.code,reactive:n.reactive}];if(r){let s=this.stripAndLower(r,l=>l.kind==="ElseDirective");i.push({name:"fallback",kind:"attr",expr:this.emit(s),jsxElement:!0})}let o=this.stripAndLower(e,s=>s.kind==="IfDirective");return{kind:"component",name:"Show",props:i,children:[o]}}lowerEach(e){let t=e.attributes.find(s=>s.kind==="EachDirective");if(!t||t.kind!=="EachDirective")return this.lowerNode(e);let r=this.hole(t.hole),n=[{name:"each",kind:"attr",expr:r.code,reactive:r.reactive}];if(t.key){let s="static"in t.key?`(item) => item[${JSON.stringify(t.key.static)}]`:this.hole(t.key.hole).code;n.push({name:"by",kind:"attr",expr:s})}let i=this.itemArrow(e),o;if(i){let s={kind:"expr",code:i.body,reactive:i.bodyReactive},l=this.rebuildWithChildren(e,[s]);o=`(${i.params.join(", ")}) => (${this.emit(l)})`}else{let s=this.stripAndLower(e,l=>l.kind==="EachDirective");o=`() => (${this.emit(s)})`}return{kind:"component",name:"For",props:n,children:[{kind:"expr",code:o,reactive:!1}]}}itemArrow(e){let t=e.children.filter(r=>!this.isBlankText(r));return t.length!==1||t[0].kind!=="Expression"?null:this.hole(t[0].hole).arrow??null}stripAndLower(e,t){let r={...e,attributes:e.attributes.filter(n=>!t(n))};return r.kind==="Element"?this.lowerElement(r):this.lowerComponent(r)}rebuildWithChildren(e,t){let r=this.lowerAttributes(e.attributes.filter(n=>n.kind!=="EachDirective"));return e.kind==="Element"?{kind:"element",tag:e.tag,svg:e.namespace==="svg",props:r,children:t,static:!1}:{kind:"component",name:e.tag,props:r,children:t}}lowerAttributes(e){let t=[],r=[],n=!1,i=[],o=!1,s=[];for(let l of e)switch(l.kind){case"IfDirective":case"EachDirective":case"ElseDirective":break;case"Attribute":t.push(this.plainAttr(l));break;case"PropertyBinding":t.push({name:l.name,kind:"prop",expr:this.hole(l.hole).code,reactive:this.hole(l.hole).reactive});break;case"EventBinding":t.push(this.eventProp(l));break;case"RefBinding":t.push({name:"ref",kind:"ref",expr:this.hole(l.hole).code,reactive:this.hole(l.hole).reactive});break;case"Spread":t.push({name:"",kind:"spread",expr:this.hole(l.hole).code});break;case"ClassDirective":{let a=this.hole(l.hole);r.push(`${JSON.stringify(l.name)}: ${a.code}`),n=n||a.reactive;break}case"StyleDirective":{let a=this.hole(l.hole);i.push(`${JSON.stringify(l.name)}: ${a.code}`),o=o||a.reactive;break}case"BindDirective":t.push(...this.bindProps(l.name,this.hole(l.hole).code));break;case"UseDirective":{let a=l.name??(l.hole!=null?this.hole(l.hole).code:null);if(!a)break;s.push(l.name!=null&&l.hole!=null?`[${a}, () => (${this.hole(l.hole).code})]`:`[${a}]`);break}}return r.length>0&&t.push({name:"classList",kind:"attr",expr:`{ ${r.join(", ")} }`,reactive:n}),i.length>0&&t.push({name:"style",kind:"attr",expr:`{ ${i.join(", ")} }`,reactive:o}),s.length>0&&t.push({name:"use",kind:"attr",expr:`[${s.join(", ")}]`}),t}eventProp(e){let t=e.name.toLowerCase(),r=this.hole(e.hole).code;if(!(e.syntax==="colon"||e.modifiers.length>0))return{name:"on"+Ti(e.name),kind:"event",event:{name:t,delegated:Ni.has(t)},expr:r};let n=this.wrapHandler(r,e.modifiers),i=this.eventOptions(e.modifiers),o=i?`[${n}, ${i}]`:n;return{name:"on:"+t,kind:"attr",expr:o}}wrapHandler(e,t){let r=t.includes("self")?"if (e.target !== e.currentTarget) return; ":"",n=[];return t.includes("prevent")&&n.push("e.preventDefault();"),t.includes("stop")&&n.push("e.stopPropagation();"),!r&&n.length===0?e:`(e) => { ${r}${n.join(" ")} return (${e})(e); }`}eventOptions(e){let t=[];return e.includes("capture")&&t.push("capture: true"),e.includes("once")&&t.push("once: true"),e.includes("passive")&&t.push("passive: true"),t.length?`{ ${t.join(", ")} }`:null}bindProps(e,t){let r=e==="checked",n=r?"change":"input",i=r?"checked":"value";this.used.add("bindPair");let o=`bindPair(${t})`;return[{name:e,kind:"attr",expr:`${o}[0]()`,reactive:!0},{name:"on"+Ti(n),kind:"event",event:{name:n,delegated:Ni.has(n)},expr:`(e) => ${o}[1](e.target.${i})`}]}plainAttr(e){let t=e.value,r=e.name;e.name==="class"?r=t&&t.kind==="hole"&&this.hole(t.hole).object?"classList":"className":e.name==="html"&&(r="innerHTML");let n={name:r,kind:"attr"};if(t==null)return n.literal=!0,n;if(t.kind==="static")return n.literal=t.value,n;if(t.kind==="hole"){let s=this.hole(t.hole);return n.expr=s.code,n.reactive=s.reactive,n}let i=!1,o=t.parts.map(s=>{if("text"in s)return Ja(s.text);let l=this.hole(s.hole);return i=i||l.reactive,"${"+l.code+"}"}).join("");return n.expr="`"+o+"`",n.reactive=i,n}};function Xa(e,t,r,n={}){let{root:i}=Yt(e,{svg:n.svg});return new Ga(t,r).lowerRoot(i.children)}function Ka(e){let t=[],r=0;return e.statics.forEach((n,i)=>{if(t.push({kind:"static",text:n,start:r}),r+=n.length,i<e.holes.length){let o=r+e.holes[i].code.length;t.push({kind:"hole",index:i,start:r,end:o}),r=o}}),t}function Bi(e,t={}){if(e.statics.length!==e.holes.length+1)throw new Error(`[fluixi] compileTemplate: ${e.statics.length} static runs for ${e.holes.length} holes — a template always has exactly one more.`);return Za(Ka(e),e.holes,t)}function Za(e,t,r={}){let n=new Set,i=Xa(e,[...t],n,{svg:r.svg});ya(i),Sa(i,{resolver:Ua(r.resolve??[]),modules:{controlFlowModule:r.controlFlowModule??"@fluixi/dom",coreModule:r.coreModule??"@fluixi/core",routerModule:r.routerModule??"@fluixi/core/router"},strategyFor:a=>a.load}),Aa(i);let{code:o,imports:s,templates:l}=Vi.emit(i,{templateClone:r.templateClone,partialTemplates:r.partialTemplates});for(let a of s)n.add(a);return r.hoistTemplates?{code:o,imports:[...n],ir:i,templates:l}:{code:Fi(o,l),imports:[...n],ir:i}}function Qa(e,t){switch(e.kind){case"Attribute":if(e.value&&e.value.kind==="hole")t.set(e.value.hole,"attr");else if(e.value&&e.value.kind==="mixed")for(let r of e.value.parts)"hole"in r&&t.set(r.hole,"attr");return;case"PropertyBinding":t.set(e.hole,"attr");return;case"BindDirective":t.set(e.hole,"bind");return;case"EventBinding":t.set(e.hole,"event");return;case"RefBinding":t.set(e.hole,"ref");return;case"Spread":t.set(e.hole,"spread");return;case"IfDirective":t.set(e.hole,"control");return;case"EachDirective":t.set(e.hole,"control"),e.key&&"hole"in e.key&&t.set(e.key.hole,"attr");return;default:return}}function lr(e,t,r){for(let n of e)switch(n.kind){case"Expression":t.has(n.hole)||t.set(n.hole,"text");break;case"Element":case"Component":{n.kind==="Component"&&(n.tagHole!==null?t.set(n.tagHole,"component"):n.tag&&r.add(n.tag.split(".")[0]));let i=n.attributes.some(o=>o.kind==="EachDirective");for(let o of n.attributes)Qa(o,t);if(i)for(let o of n.children)o.kind==="Expression"&&t.set(o.hole,"render");lr(n.children,t,r);break}case"Root":case"Fragment":lr(n.children,t,r);break;default:break}}function zi(e){let t=new Map,r=new Set;return lr(e.root.children,t,r),{holes:t,components:r}}var ar={...Qt,createMemo:ht},Ya=["For","Index","Show","Switch","Match","Portal","Dynamic","ErrorBoundary","Suspense"],ur=new Map;function Ji(e){for(let[t,r]of Object.entries(e))ur.set(t,r)}function eu(e){return e==="text"||e==="attr"||e==="control"}function tu(e,t){return e.map((r,n)=>{let i=t.get(n)??"text";return i==="render"?{code:`$$v[${n}]`,reactive:!1,arrow:{params:["$$item"],body:`$$v[${n}]($$item)`,bodyReactive:!1}}:typeof r=="function"&&eu(i)?{code:`$$v[${n}]()`,reactive:!0}:{code:`$$v[${n}]`,reactive:!1}})}function ru(e){if(ur.has(e))return ur.get(e);let t=globalThis[e];if(t!==void 0)return t;throw new Error(`[fluixi] <${e}> is not defined. Pass it as a hole — <\${${e}} /> — or register it with define({ ${e} }).`)}function nu(e,t,r){let n=e,i=Si(n,{svg:r}),o=i.diagnostics.filter(v=>v.severity==="error");if(o.length>0)throw new Error(`[fluixi] ${r?"svg":"html"}\`\`: ${o.map(v=>v.message).join("; ")}`);let{holes:s,components:l}=zi(i),{code:a,imports:u}=Bi({statics:n,holes:tu(t,s)},{svg:r}),c=u.filter(v=>!(v in ar));if(c.length>0)throw new Error(`[fluixi] no runtime binding for: ${c.join(", ")}`);let f=Array.from(new Set([...u,...Ya])).filter(v=>v in ar),d=Array.from(l).filter(v=>!f.includes(v)),m=[...f,...d],b=new Function(...m,"$$v",`return (${a});`);return{run:v=>b(...f.map(E=>ar[E]),...d.map(ru),v)}}var Ui=new WeakMap;function iu(e){let t="";for(let r of e)t+=typeof r=="function"?"f":"v";return t}function Gi(e){return(t,...r)=>{let n=Ui.get(t);n||(n=new Map,Ui.set(t,n));let i=iu(r),o=n.get(i);return o||(o=nu(t,r,e),n.set(i,o)),o.run(r)}}var Xi=Gi(!1),Ki=Gi(!0);return ro(ou);})();
|
|
1
|
+
/*! @fluixi/template-runtime v0.1.0-alpha.11 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
|
+
"use strict";var Fluixi=(()=>{var At=Object.defineProperty;var Ks=Object.getOwnPropertyDescriptor;var Js=Object.getOwnPropertyNames;var Gs=Object.prototype.hasOwnProperty;var qn=(e,t)=>{for(var n in t)At(e,n,{get:t[n],enumerable:!0})},Xs=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Js(t))!Gs.call(e,i)&&i!==n&&At(e,i,{get:()=>t[i],enumerable:!(r=Ks(t,i))||r.enumerable});return e};var Ys=e=>Xs(At({},"__esModule",{value:!0}),e);var jl={};qn(jl,{Dynamic:()=>kn,ErrorBoundary:()=>En,For:()=>gn,Index:()=>bn,Match:()=>wn,Portal:()=>xn,Show:()=>vn,Switch:()=>Sn,batch:()=>J,define:()=>Vs,effect:()=>Hr,html:()=>Bs,hydrate:()=>Pe,insert:()=>L,memo:()=>Lr,onCleanup:()=>ke,render:()=>Me,resource:()=>Wr,signal:()=>jr,store:()=>zr,svg:()=>Us,untrack:()=>ue});var $n={};qn($n,{ALWAYS_ATTRIBUTE:()=>si,ClientOnly:()=>Xi,Dynamic:()=>kn,ErrorBoundary:()=>En,FX_DATA_ID:()=>mn,For:()=>gn,Index:()=>bn,Island:()=>Ba,JSX_PROPERTIES:()=>zt,Match:()=>wn,NoSsr:()=>eu,Portal:()=>xn,SVG_ELEMENTS:()=>Mc,SVG_NAMESPACE:()=>lt,Show:()=>vn,Switch:()=>Sn,VERSION:()=>yi,VOID_ELEMENTS:()=>Rc,addClass:()=>ci,addDelegatedEventListener:()=>nn,addNativeEventListener:()=>cn,appendChildren:()=>pi,applyElementProp:()=>Ut,applyProps:()=>ln,applyUse:()=>an,asComponent:()=>bi,asContext:()=>ia,asOutlet:()=>na,asProvider:()=>ra,asRoute:()=>ta,asRouter:()=>Qc,asRoutes:()=>ea,asSuspense:()=>sa,bindPair:()=>Vi,captureHydrationCursor:()=>fa,checkRenderType:()=>oa,classMap:()=>tu,cleanChildren:()=>G,cloneTemplate:()=>on,closest:()=>Dc,createComponent:()=>fn,createDynamicElement:()=>Ga,createElement:()=>di,createNativeElement:()=>rn,createPortal:()=>Wi,createRequestContext:()=>hn,createTemplate:()=>sn,default:()=>Su,delegate:()=>qc,delegateEvents:()=>pt,escapeFxJson:()=>Ji,escapeHTML:()=>Na,fnName:()=>xa,generateID:()=>ya,getAttribute:()=>li,getGlobal:()=>Yc,getLitEventName:()=>Nc,getLocals:()=>ja,getOffset:()=>Wc,getRequestContext:()=>fe,getRequestEvent:()=>zi,getRequestLocals:()=>Ki,getServerData:()=>Gi,getStableElementId:()=>ma,getStyle:()=>jc,handleRef:()=>Re,hasClass:()=>Ic,holeContent:()=>Di,holeEnd:()=>Pi,holeScope:()=>Mi,html:()=>Ka,hydrate:()=>Pe,hydrateAdvancePast:()=>tn,hydrateIslands:()=>za,indexArray:()=>Ue,initializeIntegration:()=>Pa,insert:()=>L,insertExpression:()=>_e,intergartionInitialized:()=>Da,isAccessor:()=>Oa,isAttributeOnlyName:()=>oi,isComponent:()=>j,isContext:()=>Ai,isCustomElement:()=>ii,isDOMNode:()=>Gc,isDelegatedEvent:()=>wa,isDomElement:()=>$i,isDomNode:()=>Oe,isDomText:()=>Ti,isEventHandler:()=>Cc,isFunction:()=>Sa,isIntegrationInitialized:()=>Fi,isJSXTemplate:()=>Jc,isLitTemplateResult:()=>mi,isNativeElement:()=>Ca,isOutlet:()=>xi,isPromise:()=>xe,isProvider:()=>Ei,isReactElement:()=>zc,isRoute:()=>ki,isRouter:()=>wi,isRoutes:()=>Si,isSVGElement:()=>qi,isServer:()=>H,isSuspense:()=>_i,isTemplateFactory:()=>Kc,isVisible:()=>Lc,iterateFn:()=>Ea,keyArray:()=>Be,makeArrayFlat:()=>Ii,mapArray:()=>Fe,mergeProps:()=>Hi,observeIntersection:()=>Fc,observeResize:()=>Bc,query:()=>Kt,queryAll:()=>Pc,registerCoreVersion:()=>Zc,registerCreateComponent:()=>Ma,registerGlobal:()=>Xc,removeAttribute:()=>fi,removeChildren:()=>hi,removeClass:()=>ai,removeDelegatedEventListener:()=>at,render:()=>Me,renderToString:()=>mu,renderToStringAsync:()=>bu,resetIntegration:()=>Bi,runHydrationAt:()=>Jt,runWithRequestContext:()=>pn,runWithoutHydration:()=>da,scrollIntoView:()=>Hc,serializeNode:()=>Y,serializeResourceData:()=>us,setAttribute:()=>M,setClassList:()=>Ce,setClassName:()=>he,setDataRedactor:()=>vu,setDynamicAttribute:()=>$e,setDynamicBoolAttribute:()=>un,setDynamicProperty:()=>Te,setProperty:()=>de,setRequestStore:()=>Ia,setServerMode:()=>Ae,setStyle:()=>Ne,setStyles:()=>Qt,shouldSetAsProperty:()=>Oc,splitProps:()=>Ta,spread:()=>Li,stampVersions:()=>vi,styleMap:()=>ru,svg:()=>Ja,templateNode:()=>Ri,toAttributeName:()=>Tc,toggleClass:()=>ui,versions:()=>A,waitForElement:()=>Vc,warnOnVersionSkew:()=>gi});var $t="1.0.0-alpha.91",zn=$t.split(".")[0],Vn=`__fluixi_signal_state_v${zn}__`,Kn=`__fluixi_signal_builds_v${zn}__`,Zs=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function Jn(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Zs,onSuspend:null,onError:null,observer:null}}var He=globalThis;function Qs(e){let t=Jn(),n=e;for(let r of Object.keys(t))r in e||(n[r]=t[r]);return e}function eo(){let e=He[Vn];return e?Qs(e):He[Vn]=Jn()}var h=eo();(He[Kn]??=[]).push($t);function Gn(){return[...new Set(He[Kn]??[])]}function to(e){return h.observer=e,()=>{h.observer===e&&(h.observer=null)}}var $=[],no;function Tt(e){let t=h.observer;t&&t.created(e.parents===void 0?{...e,parents:$,origin:e.origin??no}:e)}function ro(e){return h.observer?($.push(e),!0):!1}function io(){$.pop()}function so(e){h.observer?.ran?.(e)}function oo(e,t){h.observer?.wrote?.(e,t)}function N(e,t,n,r){let i=h.observer;!i?.bound||!$.length||i.bound($[$.length-1],e,t,n,r)}function O(e,t,n,r){let i=h.observer;!i?.directive||!$.length||i.directive($[$.length-1],e,t,n,r)}function co(e){h.observer?.contextCreated?.(e)}function ao(e,t,n){let r=h.observer;!r?.context||!$.length||r.context($[$.length-1],e,t,n)}function Ct(e){h.observer?.disposed?.(e)}var uo="__FLUIXI_DEVTOOLS_HOOK__",Fn=globalThis[uo];if(typeof Fn?.inject=="function")try{Fn.inject({observeReactiveNodes:to,version:$t})}catch{}function Xn(){return h.observer!=null}var Bn=0,Un=1,ve=2,Yn=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(h.untracked)return;let e=h.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},lo=class extends Yn{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,oo(this,h.consumer),this.observers)for(let t of[...this.observers])t.markDirty(ve);_t(this)}}peek(){return this._value}},Zn=class extends Yn{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=ve,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(h.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===Un&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===ve)break}(this.state===ve||!this._initialized)&&this.recompute(),this.state=Bn}recompute(){if(this.sources){for(let c of this.sources)c.observers?.delete(this);this.sources.clear()}let e=h.consumer,t=h.untracked,n=ro(this);h.consumer=this,h.untracked=!1;let r,i=!1,s;try{r=this._fn()}catch(c){i=!0,s=c,r=this._value}finally{h.consumer=e,h.untracked=t,n&&io()}let o=!this._initialized||this._threw!==i||(i?s!==this._error:!this._equals(this._value,r));if(this._initialized=!0,this._threw=i,this._error=s,this._value=r,so(this),o){if(this.version++,this.observers)for(let c of[...this.observers])c.markDirty(ve);_t(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===Bn;if(this.state=e,t){if(this.observers)for(let n of[...this.observers])n.markDirty(Un);_t(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function _t(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var fo=class{constructor(e){this._watched=new Set,this._pending=new Set,this._notifyFn=e}watch(...e){for(let t of e)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...e){for(let t of e)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let t=this._pending.size===0;this._pending.add(e),t&&this._notifyFn()}};function ho(e){if(h.untracked)return e();h.untracked=!0;try{return e()}finally{h.untracked=!1}}function ie(e){let t=qe(e);return e&&(e.owned??=[]).push(t),t}function se(e,t=!0){ge(e,t)}function qe(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Qn(e,t){let n=Symbol(t??"context");return co(n),{id:n,defaultValue:e,Provider:i=>{ao(n,"provide",i.value);let s=h.owner,o=qe(s);(o.contexts=new Map).set(n,i.value),s&&(s.owned??=[]).push(o),h.owner=o;try{return i.children}finally{h.owner=s}}}}function er(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function po(e){h.onSuspend=e}function mo(e){return h.onSuspend?(h.onSuspend(e,h.owner),!0):!1}function yo(e){h.onError=e}function W(){return h.owner}function T(e,t){let n=h.owner;h.owner=e;try{return t()}finally{h.owner=n}}function S(e){if(h.owner){if(h.owner.disposed){e();return}(h.owner.cleanups??=[]).push(e)}}function ge(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)ge(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function P(e){let t=qe(h.owner);h.owner&&(h.owner.owned??=[]).push(t);let n=h.owner;h.owner=t;try{return e(()=>ge(t))}finally{h.owner=n}}function vo(e){h.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function go(e){e.queued||(e.queued=!0,h.queue.push(e),!h.scheduled&&h.batchDepth===0&&(h.scheduled=!0,h.hostSchedule(Ve)))}function Ve(){if(h.scheduled=!1,h.flushing)return;h.flushing=!0;let e=0;try{for(;h.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=h.queue;h.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{h.flushing=!1}}function bo(){h.batchDepth===0&&Ve()}function wo(e){h.batchDepth++;try{return e()}finally{--h.batchDepth===0&&Ve()}}var So=class{constructor(e,t=!1){this.queued=!1,this.disposed=!1,this.owner=qe(h.owner),h.owner&&(h.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new Zn(()=>{ge(this.owner,!1),T(this.owner,()=>{let n=e();typeof n=="function"&&(this.owner.cleanups??=[]).push(n)})}),Tt({kind:"effect",node:this.computed,handle:this,internal:!t}),this.watcher=new fo(()=>go(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&h.onSuspend){h.onSuspend(e,this.owner);return}if(h.onError&&h.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,Ct(this.computed),this.watcher.unwatch(this.computed),ge(this.owner))}};function tr(e,t=!1){let n=new So(e,t);return()=>n.dispose()}function ko(e){return!!e&&typeof e.then=="function"}vo(()=>{});var nr=Symbol.for("signal"),xo=Symbol.for("memo"),Eo=Symbol.for("signal-node");function D(e,t){let n=new lo(e,{equals:t?.equals}),r=(()=>n.get()),i=(s=>{let o=typeof s=="function"?s(n.peek()):s;return n.set(o),bo(),o});return Object.defineProperty(r,nr,{value:!0,enumerable:!0}),Object.defineProperty(r,Eo,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),Tt({kind:"signal",node:n,handle:r,name:t?.name,set:i}),Xn()&&S(()=>Ct(n)),[r,i]}function g(e,t,n){let r=t,i=W(),s=new Zn(()=>T(i,()=>{try{return r=e(r)}catch(c){if(ko(c))return mo(c),r;throw c}}),{equals:n?.equals}),o=(()=>s.get());return Object.defineProperty(o,nr,{value:!0,enumerable:!0}),Object.defineProperty(o,xo,{value:!0,enumerable:!0}),Tt({kind:"memo",node:s,handle:o,name:n?.name}),Xn()&&S(()=>Ct(s)),o}function q(e,t){let n=t;return tr(()=>{n=e(n)},!0)}function w(e,t){let n=t;return tr(()=>{n=e(n)})}function oe(e){return wo(e)}function I(e){return ho(e)}function rr(){return Ve(),Promise.resolve()}function Fe(e,t,n){let r=[];return S(()=>{for(let i of r)i.dispose();r=[]}),g(()=>{let i=e()||[];return I(()=>{if(i.length===0){for(let a of r)a.dispose();return r=[],n?.fallback?n.fallback():[]}let s=new Map;for(let a of r)s.has(a.item)||s.set(a.item,a);let o=[],c=new Set;for(let a=0;a<i.length;a++){let u=i[a],l=s.get(u);if(l&&!c.has(l))l.setIndex(a),o.push(l),c.add(l);else{let f,d,y;P(v=>{y=v;let[_,me]=D(a,{name:"row index"});d=me,f=t(u,_)});let b={item:u,rendered:f,dispose:y,setIndex:d};o.push(b),c.add(b)}}for(let a of r)c.has(a)||a.dispose();return r=o,o.map(a=>a.rendered)})},void 0,{name:"mapArray"})}function Be(e,t,n,r){let i=[],s=[];return S(()=>{for(let o of s)o.dispose();i=[],s=[]}),g(()=>{let o=e()||[];return I(()=>{if(o.length===0){for(let f of s)f.dispose();return i=[],s=[],r?.fallback?r.fallback():[]}let c=new Map;for(let f=0;f<i.length;f++)c.set(i[f],s[f]);let a=[],u=[],l=new Set;for(let f=0;f<o.length;f++){let d=t(o[f]),y=c.get(d);if(y&&!l.has(d))y.setIndex(f),a.push(y);else{let b,v,_;P(me=>{_=me;let[Q,ye]=D(f,{name:"row index"});v=ye;let Ie=g(re=>{let z=(e()||[])[Q()];return z??re},o[f]);b=n(Ie,Q)}),a.push({rendered:b,dispose:_,setIndex:v})}u.push(d),l.add(d)}for(let[f,d]of c)l.has(f)||d.dispose();return i=u,s=a,a.map(f=>f.rendered)})},void 0,{name:"keyArray"})}function Ue(e,t,n){let r=[];return S(()=>{for(let i of r)i.dispose();r=[]}),g(()=>{let i=e()||[];return I(()=>{if(i.length===0){for(let a of r)a.dispose();return r=[],n?.fallback?n.fallback():[]}let s=r.length,o=i.length;for(let a=s;a<o;a++){let u,l,f,d=i[a];P(y=>{f=y;let[b,v]=D(d);l=v,u=t(b,a)}),r.push({rendered:u,setItem:l,dispose:f})}for(let a=o;a<s;a++)r[a].dispose();o<s&&(r=r.slice(0,o));let c=Math.min(s,o);for(let a=0;a<c;a++)r[a].setItem(i[a]);return r.map(a=>a.rendered)})},void 0,{name:"indexArray"})}var Ao=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,_o=typeof process>"u"?Ao:!1,$o=Symbol.for("signal");function k(e){return typeof e=="function"&&e[$o]===!0}var To=null;function ir(e){To=e}var Co=null;function sr(e){Co=e}var No=null;function ze(e){No=e}var Oo=null;function or(e){Oo=e}function We(e){if(typeof e=="function"&&!e.length){let t=e();return k(t)?t:We(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=We(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function Ke(e){let t=g(e);return _o?g(()=>We(t()),void 0,{name:"children"}):g(()=>We(t()))}var Ro=Qn();po((e,t)=>{let n=er(t,Ro);n&&(n.increment(),e.finally(()=>n.decrement()))});var Mo=Qn();yo((e,t)=>{let n=er(t,Mo);return n?(n.setError(e),!0):!1});var Nt=Symbol.for("fluixi-proxy");var cr="1.0.0-alpha.91";var Wt="1.0.0-alpha.91";var Ar=Wt.split(".")[0],ar=`__fluixi_signal_state_v${Ar}__`,Po=`__fluixi_signal_builds_v${Ar}__`,Do=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function _r(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Do,onSuspend:null,onError:null,observer:null}}var Rt=globalThis;function Io(e){let t=_r(),n=e;for(let r of Object.keys(t))r in e||(n[r]=t[r]);return e}function jo(){let e=Rt[ar];return e?Io(e):Rt[ar]=_r()}var p=jo();(Rt[Po]??=[]).push(Wt);function Lo(e){return p.observer=e,()=>{p.observer===e&&(p.observer=null)}}var V=[],Je;function Ho(e,t){if(!p.observer)return t();let n=Je;Je=e;try{return t()}finally{Je=n}}function nt(e){let t=p.observer;t&&t.created(e.parents===void 0?{...e,parents:V,origin:e.origin??Je}:e)}function Wo(e){return p.observer?(V.push(e),!0):!1}function qo(){V.pop()}function Vo(e){p.observer?.ran?.(e)}function Fo(e,t){p.observer?.wrote?.(e,t)}function $r(e){let t=p.observer;!t?.props||!V.length||!e||t.props(V[V.length-1],e)}function Bo(e){p.observer?.contextCreated?.(e)}function Uo(e,t,n){let r=p.observer;!r?.context||!V.length||r.context(V[V.length-1],e,t,n)}function ur(e,t,n){p.observer?.moved?.(e,t,n)}function we(e){p.observer?.disposed?.(e)}var zo="__FLUIXI_DEVTOOLS_HOOK__",lr=globalThis[zo];if(typeof lr?.inject=="function")try{lr.inject({observeReactiveNodes:Lo,version:Wt})}catch{}function rt(){return p.observer!=null}var fr=0,dr=1,be=2,Tr=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(p.untracked)return;let e=p.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},Ko=class extends Tr{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,Fo(this,p.consumer),this.observers)for(let t of[...this.observers])t.markDirty(be);Mt(this)}}peek(){return this._value}},Cr=class extends Tr{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=be,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(p.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===dr&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===be)break}(this.state===be||!this._initialized)&&this.recompute(),this.state=fr}recompute(){if(this.sources){for(let c of this.sources)c.observers?.delete(this);this.sources.clear()}let e=p.consumer,t=p.untracked,n=Wo(this);p.consumer=this,p.untracked=!1;let r,i=!1,s;try{r=this._fn()}catch(c){i=!0,s=c,r=this._value}finally{p.consumer=e,p.untracked=t,n&&qo()}let o=!this._initialized||this._threw!==i||(i?s!==this._error:!this._equals(this._value,r));if(this._initialized=!0,this._threw=i,this._error=s,this._value=r,Vo(this),o){if(this.version++,this.observers)for(let c of[...this.observers])c.markDirty(be);Mt(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===fr;if(this.state=e,t){if(this.observers)for(let n of[...this.observers])n.markDirty(dr);Mt(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function Mt(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var Jo=class{constructor(e){this._watched=new Set,this._pending=new Set,this._notifyFn=e}watch(...e){for(let t of e)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...e){for(let t of e)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let t=this._pending.size===0;this._pending.add(e),t&&this._notifyFn()}};function Go(e){if(p.untracked)return e();p.untracked=!0;try{return e()}finally{p.untracked=!1}}function Nr(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Or(e,t){let n=Symbol(t??"context");return Bo(n),{id:n,defaultValue:e,Provider:i=>{Uo(n,"provide",i.value);let s=p.owner,o=Nr(s);(o.contexts=new Map).set(n,i.value),s&&(s.owned??=[]).push(o),p.owner=o;try{return i.children}finally{p.owner=s}}}}function Rr(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function Xo(e){p.onSuspend=e}function Yo(e){return p.onSuspend?(p.onSuspend(e,p.owner),!0):!1}function Zo(e){p.onError=e}function Qo(){return p.owner}function Mr(e,t){let n=p.owner;p.owner=e;try{return t()}finally{p.owner=n}}function ke(e){if(p.owner){if(p.owner.disposed){e();return}(p.owner.cleanups??=[]).push(e)}}function Pt(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)Pt(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function ec(e){p.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function tc(e){e.queued||(e.queued=!0,p.queue.push(e),!p.scheduled&&p.batchDepth===0&&(p.scheduled=!0,p.hostSchedule(qt)))}function qt(){if(p.scheduled=!1,p.flushing)return;p.flushing=!0;let e=0;try{for(;p.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=p.queue;p.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{p.flushing=!1}}function nc(){p.batchDepth===0&&qt()}function rc(e){p.batchDepth++;try{return e()}finally{--p.batchDepth===0&&qt()}}var ic=class{constructor(e,t=!1){this.queued=!1,this.disposed=!1,this.owner=Nr(p.owner),p.owner&&(p.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new Cr(()=>{Pt(this.owner,!1),Mr(this.owner,()=>{let n=e();typeof n=="function"&&(this.owner.cleanups??=[]).push(n)})}),nt({kind:"effect",node:this.computed,handle:this,internal:!t}),this.watcher=new Jo(()=>tc(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&p.onSuspend){p.onSuspend(e,this.owner);return}if(p.onError&&p.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,we(this.computed),this.watcher.unwatch(this.computed),Pt(this.owner))}};function sc(e,t=!1){let n=new ic(e,t);return()=>n.dispose()}function oc(e){return!!e&&typeof e.then=="function"}ec(()=>{});var Pr=Symbol.for("signal"),cc=Symbol.for("memo"),ac=Symbol.for("signal-node");function ce(e,t){let n=new Ko(e,{equals:t?.equals}),r=(()=>n.get()),i=(s=>{let o=typeof s=="function"?s(n.peek()):s;return n.set(o),nc(),o});return Object.defineProperty(r,Pr,{value:!0,enumerable:!0}),Object.defineProperty(r,ac,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),nt({kind:"signal",node:n,handle:r,name:t?.name,set:i}),rt()&&ke(()=>we(n)),[r,i]}function Vt(e,t,n){let r=t,i=Qo(),s=new Cr(()=>Mr(i,()=>{try{return r=e(r)}catch(c){if(oc(c))return Yo(c),r;throw c}}),{equals:n?.equals}),o=(()=>s.get());return Object.defineProperty(o,Pr,{value:!0,enumerable:!0}),Object.defineProperty(o,cc,{value:!0,enumerable:!0}),nt({kind:"memo",node:s,handle:o,name:n?.name}),rt()&&ke(()=>we(s)),o}function Dr(e,t){let n=t;return sc(()=>{n=e(n)},!0)}function J(e){return rc(e)}function ue(e){return Go(e)}var zl=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0;var uc=Symbol.for("signal");function Ir(e){return typeof e=="function"&&e[uc]===!0}var hr=null;function lc(e){hr&&hr(e)}var pr=null;function fc(e){return pr?pr(e):void 0}var mr=null;function dc(){return mr?mr():void 0}var yr=null;function hc(e,t){yr&&yr(e,t)}function pc(e){return!!e&&typeof e.then=="function"}var Ot=Symbol();function mc(e,t,n={}){let r,i;typeof t=="function"?(r=typeof e=="function"?e:()=>e,i=t):(r=()=>!0,i=e,t&&typeof t=="object"&&(n=t));let s=n.transport===!1?void 0:dc(),o=s!==void 0?fc(s):void 0,c=o!==void 0,[a,u]=ce(o!==void 0?o.value:n.initialValue,{equals:!1}),[l,f]=ce(void 0,{equals:!1}),[d,y]=ce(o!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[b,v]=ce(void 0,{equals:!1}),[_,me]=ce(void 0,{equals:!1}),Q=Ot,ye=!1;Dr(()=>{let x=r();if(_(),x===!1||x===null||x===void 0){Q=Ot,J(()=>{y("unresolved"),v(void 0),f(void 0)});return}let z=ye;if(ye=!1,Q!==Ot&&x===Q&&!z)return;if(Q=x,c){c=!1;return}let je=!1;ke(()=>je=!0);let Hn=ue(d),zs=ue(a),Wn=Hn==="ready"||Hn==="refreshing";J(()=>{y(Wn?"refreshing":"pending"),f(void 0)});try{let ee=i(x,{value:zs,refetching:Wn});pc(ee)?(v(ee),lc(ee),ee.then(Le=>{je||(s!==void 0&&hc(s,Le),J(()=>{u(()=>Le),y("ready"),v(void 0)}))},Le=>{je||J(()=>{f(Le),y("errored"),v(void 0)})})):J(()=>{u(()=>ee),y("ready"),v(void 0)})}catch(ee){if(je)return;J(()=>{f(ee),y("errored"),v(void 0)})}});let Ie=()=>{let x=d();return x==="pending"||x==="refreshing"},re=(()=>{let x=l();if(x)throw x;if(Ie()){let z=b();if(z)throw z}return a()});return Object.defineProperties(re,{state:{get:d},loading:{get:Ie},error:{get:l},latest:{get:a}}),Object.defineProperty(re,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(re,Symbol.for("signal"),{value:!0,enumerable:!0}),[re,{mutate:u,refetch:()=>{ye=!0,me(void 0)}}]}var yc=Or();Xo((e,t)=>{let n=Rr(t,yc);n&&(n.increment(),e.finally(()=>n.decrement()))});var vc=Or();Zo((e,t)=>{let n=Rr(t,vc);return n?(n.setError(e),!0):!1});function jr(e,t){let[n,r]=ce(e,t);return Object.assign(n,{set:r})}function Lr(e,t,n){return Vt(e,t,n)}function Hr(e,t){return Dr(e,t)}function Wr(...e){let[t,n]=mc(...e);return Object.assign(t,n)}var Ye=Symbol("store-raw"),vr=Symbol("store-node"),gr=Symbol("store-has"),br=Symbol("store-self"),wr=Symbol("store-track");var Se=new WeakMap,Dt=new WeakMap,le=new WeakMap,Ze=new WeakMap;function gc(e,t){if(!ae(e)||!rt())return;let n=new Set,r=o=>{if(!(!ae(o)||n.has(o))){n.add(o);for(let c of Object.values(o))r(c)}};r(Ze.get(t)??t);let i=new Set,s=o=>{if(!ae(o))return;let c=o;if(n.has(c)||i.has(c))return;i.add(c);let a=Se.get(c);if(a){for(let u of a.keys.values())we(u);a.all&&we(a.all),Se.delete(c),le.delete(c),Dt.delete(c)}for(let u of Object.values(c))s(u)};s(e)}var Qe=(e,t,n)=>n?`${e}[${String(t)}]`:`${e}.${String(t)}`;function qr(e,t,n){let r=t?.owner,i=r&&n!==void 0?Qe(r.name,n,t?.array):void 0,[s,o]=Ho(r?.store,()=>D(e,i?{name:i}:void 0)),c=s;return c.$=o,c}function et(e){let t=Se.get(e);return t?t.owner||(t.owner=le.get(e)):Se.set(e,t={keys:new Map,owner:le.get(e),array:Array.isArray(e)}),t}function Sr(e,t,n){let r=e.keys.get(t);return r||e.keys.set(t,r=qr(n,e,t)),r}function bc(e,t,n,r){let i=le.get(e);if(i&&i.store===t&&i.name===n)return;let s={store:t,name:n};le.set(e,s),Ze.set(e,Ze.get(r)??r);let o=Se.get(e);if(o&&(o.owner=s,!!rt())){for(let[c,a]of o.keys)ur(a,t,Qe(n,c,o.array));o.all&&ur(o.all,t,Qe(n,"*",o.array))}}function kr(e){let t=et(e);(t.all||(t.all=qr(void 0,t,"*")))()}function xr(e,t){e.$(typeof t=="function"?()=>t:t)}function ae(e){if(e==null||typeof e!="object")return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Ge(e){if(!ae(e))return e;let t=Dt.get(e);if(t)return t;let n=new Proxy(e,wc);return Dt.set(e,n),n}var wc={get(e,t,n){if(t===Ye||t===vr)return e;if(t===Nt)return n;if(t===gr)return a=>a in e;if(t==="__proxy")return!0;if(t===wr||t===br)return kr(e),n;let r=e[t];if(typeof r=="function"&&!Object.prototype.hasOwnProperty.call(e,t))return r;let i=Object.getOwnPropertyDescriptor(e,t);if(i&&i.get)return i.get.call(n);let s=et(e),o=Sr(s,t,r),c=o();return ae(c)?(s.owner&&bc(c,o,Qe(s.owner.name,t,s.array),e),Ge(c)):c},set(){return!0},deleteProperty(e,t){return t in e&&R(e,t,void 0),!0},has(e,t){return t===Ye||t===Nt||t===vr||t===gr||t===br||t===wr?!0:(Sr(et(e),t,e[t])(),t in e)},ownKeys(e){return kr(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function Vr(e,t=new Set){if(e==null||typeof e!="object")return e;let n=e[Ye]??e;if(t.has(n)||!ae(n))return n;t.add(n);let r=!1,i=o=>{let c=Vr(o,t);return c!==o&&(r=!0),c};if(Array.isArray(n)){let o=n.map(i);return r?o:n}let s={};for(let o of Object.keys(n))s[o]=i(n[o]);return r?s:n}function R(e,t,n){let r=Vr(n),i=e[t];if(i===r&&(r!==void 0||t in e))return;let s=Array.isArray(e),o=s?e.length:0;r===void 0?delete e[t]:e[t]=r;let c=et(e),a=c.keys.get(t);if(a&&xr(a,r),gc(i,e),s&&e.length!==o){let u=c.keys.get("length");u&&xr(u,e.length)}c.all&&c.all.$(void 0)}function It(e,t){return typeof e=="function"?e(t):e}function jt(e,t){for(let n of Object.keys(t)){let r=t[n],i=e[n];r&&typeof r=="object"&&!Array.isArray(r)&&i&&typeof i=="object"&&!Array.isArray(i)?jt(i,r):R(e,n,r)}}function it(e){let t=[],n=e.replace(/\[([^\]]*)\]/g,".$1");for(let r of n.split("."))r.length&&t.push(r);return t}function Fr(e,t,n){let r=t.length-1;for(let s=0;s<r;s++){let o=t[s];if(o==="*"){let a=t.slice(s+1);if(Array.isArray(e))for(let u=0;u<e.length;u++)Fr(e[u],a,n);return}let c=e[o];(c==null||typeof c!="object")&&(c=/^\d+$/.test(t[s+1])?[]:{},R(e,o,c)),e=c}let i=t[r];if(i==="*"){if(Array.isArray(e))for(let s=0;s<e.length;s++)R(e,s,It(n,e[s]));return}R(e,i,It(n,e[i]))}function Er(e,t,n){Fr(e,it(t),n)}function Sc(e){return Array.isArray(e)&&e.length>0&&e.every(t=>Array.isArray(t)&&t.length>=2&&typeof t[0]=="string")}function Xe(e,t){for(let n=e.length-1;n>=t.length;n--)R(e,String(n),void 0);e.length!==t.length&&R(e,"length",t.length);for(let n=0;n<t.length;n++)R(e,String(n),t[n])}function kc(e,t){let n=t[0];if(typeof n=="function"&&t.length===1){let r=n(e);r&&r!==e&&jt(e,r);return}if(Array.isArray(n)&&t.length===1){if(Sc(n)){for(let r of n)Er(e,r[0],r[1]);return}if(Array.isArray(e)){Xe(e,n);return}if(n.length===0)return;throw new TypeError("[fluixi] set() was given an array that is neither a batch of [path, value] pairs nor a replacement for an array root. Name the path you meant, as in set('items', [...]).")}if(n&&typeof n=="object"&&!Array.isArray(n)&&t.length===1){jt(e,n);return}if(t.length>=3){Lt(e,t.slice(0,-1),t[t.length-1]);return}Er(e,String(n),t[1])}function xc(e,t){if(typeof t=="function"){if(!Array.isArray(e))return[];let n=[];for(let r=0;r<e.length;r++)t(e[r],r)&&n.push(r);return n}if(Array.isArray(t))return Array.isArray(e)?t.map(Number):t.map(String);if(t&&typeof t=="object"&&("from"in t||"to"in t||"by"in t)){if(!Array.isArray(e))return[];let n=t.by??1,r=t.from??0,i=t.to??e.length-1,s=[];for(let o=r;o<=i;o+=n)o>=0&&o<e.length&&s.push(o);return s}return t==="*"?Array.isArray(e)?e.map((n,r)=>r):Object.keys(e??{}):[t]}function Lt(e,t,n){if(e==null)return;let[r,...i]=t;if(typeof r=="string"){let o=it(r);if(o.length>1){Lt(e,[...o,...i],n);return}}let s=xc(e,r);if(i.length===0){for(let o of s)R(e,o,It(n,e[o]));return}for(let o of s){let c=e[o];if(c==null||typeof c!="object"){let a=i[0];c=typeof a=="number"||/^\d+$/.test(String(a))?[]:{},R(e,o,c)}Lt(c,i,n)}}function Ht(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Ht);let t={};for(let n of Object.keys(e))t[n]=Ht(e[n]);return t}function K(e,t){let n=e;for(let r of it(t)){if(n==null)return;n=n[r]}return n}var Br=class{constructor(e,t={immutable:!0}){this.options=t,this.root=e,this.set=((...n)=>oe(()=>kc(this.root,n))),e&&typeof e=="object"&&(le.set(e,{store:this,name:t.name??"store"}),Ze.set(e,e)),nt({kind:"store",node:this,handle:()=>this.root,name:t.name})}get state(){return Ge(this.root)}get proxy(){return Ge(this.root)}get accessor(){return(()=>Ge(this.root))}unwrap(){return this.root}getNode(e){return this.root&&this.root[e]}get(e){if(e==null||e==="")return tt(this.state);let t=this.state;for(let n of it(e)){if(t==null)return;t=t[n]}return tt(t)}select(e){return g(()=>e(this.state))}subscribe(e){return q(()=>e(this.state))}watch(e,t){let n;return q(()=>{let r=e(this.state);Object.is(r,n)||(t(r,n),n=r)})}reactive(e){return g(()=>this.state[e])}produce(e){this.set((t=>{let n=Ht(t);return e(n),n}))}reconcile(e,t={}){this.set(e)}push(e,...t){let n=K(this.root,e);this.set(e,n.concat(t))}pop(e){let t=K(this.root,e).slice(),n=t.pop();return this.set(e,t),n}shift(e){let t=K(this.root,e).slice(),n=t.shift();return this.set(e,t),n}splice(e,t,n,...r){let i=K(this.root,e).slice(),s=i.splice(t,n,...r);return this.set(e,i),s}insert(e,t,n){let r=K(this.root,e).slice();r.splice(t,0,n),this.set(e,r)}removeAt(e,t){let n=K(this.root,e).slice(),r=n.splice(t,1);return this.set(e,n),r}replace(e,t){if(arguments.length>=2){let r=K(this.root,String(e)),i=t;if(Array.isArray(r)&&Array.isArray(i)){Xe(r,i);return}this.set(e,i);return}let n=this.root;if(Array.isArray(n)&&Array.isArray(e)){Xe(n,e);return}this.set(e)}clear(e){let t=e===void 0?this.root:K(this.root,e);if(Array.isArray(t)){Xe(t,[]);return}if(t&&typeof t=="object")for(let n of Object.keys(t))R(t,n,void 0)}toObservable(){let[e]=D(this.state);return e.toObservable()}dispose(){}},Ec=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","replace","clear","unwrap","toObservable"];function Ac(e,t){for(let n of Ec)e[n]=t[n].bind(t);e.$=t.reactive.bind(t)}function Ur(e,t={immutable:!0}){let n=new Br(e,t);return Ac(n.set,n),[n.proxy,n.set]}function _c(e,t={}){return new Br(e,{...t,immutable:!1})}function tt(e){if(e==null||typeof e!="object")return e;let t=e[Ye];return t!==void 0?t:e}function $c(e){return I(()=>tt(e))}var Jl=Object.freeze({createStore:Ur,createMutableStore:_c,batch:oe,unwrap:tt,untrackStore:$c});function zr(e,t){let[n,r]=Ur(e,t);return new Proxy(n,{get:(i,s)=>s==="set"?r:i[s],has:(i,s)=>s==="set"||Reflect.has(i,s)})}function Tc(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function Cc(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function Nc(e){return e.startsWith("@")?e.slice(1):e.startsWith("on")?e.slice(2).toLowerCase():e}function Oc(e,t){let n=new Set(["checked","value","selected","disabled","readonly","required","multiple","open","contenteditable","draggable","spellcheck"]),r={input:new Set(["value","checked","indeterminate"]),textarea:new Set(["value"]),select:new Set(["value"]),option:new Set(["selected","value"]),audio:new Set(["volume","currentTime","paused"]),video:new Set(["volume","currentTime","paused"]),img:new Set(["src","srcset"]),iframe:new Set(["src"]),a:new Set(["href"])};return n.has(t)||r[e]&&r[e].has(t)}var Rc=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Mc=new Set(["svg","g","path","circle","rect","line","polyline","polygon","ellipse","text","tspan","use","defs","symbol","mask","clipPath","pattern","linearGradient","radialGradient","stop","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","foreignObject"]),lt="http://www.w3.org/2000/svg";function ii(e){return e.localName.includes("-")}function Ut(e,t,n,r=!1){if(n==null){e.removeAttribute(t);return}if(ii(e)){e[t]=n;return}M(e,t,n,r)}var zt=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]),si=new Set(["id","class","className","style","slot","part","exportparts","is","title","role","lang","dir","tabindex","hidden"]);function oi(e){return si.has(e)||e.startsWith("aria-")||e.startsWith("data-")}function Kt(e,t=document){return t.querySelector(e)}function Pc(e,t=document){return Array.from(t.querySelectorAll(e))}function Dc(e,t){return e.closest(t)}function ci(e,...t){e.classList.add(...t)}function ai(e,...t){e.classList.remove(...t)}function ui(e,...t){t.forEach(n=>e.classList.toggle(n))}function Ic(e,t){return e.classList.contains(t)}function M(e,t,n,r=!1){if(n==null||n===!1){e.removeAttribute(t);return}if(n===!0){e.setAttribute(t,"");return}if(typeof n=="object"){e.setAttribute(t,JSON.stringify(n));return}e.setAttribute(t,String(n))}function li(e,t){return e.getAttribute(t)}function fi(e,t){e.removeAttribute(t)}function Qt(e,t){Object.assign(e.style,t)}function jc(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function di(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([i,s])=>{if(i==="class"||i==="className")r.className=s;else if(i==="style"&&typeof s=="object")Qt(r,s);else if(i.startsWith("on")&&typeof s=="function"){let o=i.slice(2).toLowerCase();r.addEventListener(o,s)}else M(r,i,s)}),n.forEach(i=>{typeof i=="string"?r.appendChild(document.createTextNode(i)):r.appendChild(i)}),r}function hi(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function pi(e,...t){t.forEach(n=>{typeof n=="string"?e.appendChild(document.createTextNode(n)):e.appendChild(n)})}function Lc(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function Hc(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function Wc(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function qc(e,t,n,r){let i=s=>{let o=s.target.closest(n);o&&e.contains(o)&&r(s,o)};return e.addEventListener(t,i),()=>{e.removeEventListener(t,i)}}function Vc(e,t=5e3){return new Promise((n,r)=>{let i=Kt(e);if(i){n(i);return}let s=new MutationObserver(()=>{let c=Kt(e);c&&(s.disconnect(),clearTimeout(o),n(c))});s.observe(document.body,{childList:!0,subtree:!0});let o=setTimeout(()=>{s.disconnect(),r(new Error(`Element ${e} not found within ${t}ms`))},t)})}function Fc(e,t,n={}){let r=new IntersectionObserver(i=>{i.forEach(s=>{t(s.isIntersecting)})},n);return r.observe(e),()=>{r.disconnect()}}function Bc(e,t){let n=new ResizeObserver(r=>{r.forEach(t)});return n.observe(e),()=>{n.disconnect()}}var Uc=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function zc(e){return typeof e=="object"&&e!==null&&e.$$typeof===Uc}function mi(e){return e&&typeof e=="object"&&e.strings&&Array.isArray(e.strings)&&e.values&&Array.isArray(e.values)}function Kc(e){if(typeof e!="function")return!1;try{let t=e();return mi(t)}catch{return!1}}function Jc(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function Gc(e){return e instanceof Node}function Xc(e,t,n="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[n]>"u"&&(globalThis[n]={}),typeof globalThis[n][e]>"u"&&(globalThis[n][e]=t))}function Yc(e,t,n="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[n]<"u"&&typeof globalThis[n][e]<"u"?globalThis[n][e]:t}var yi="1.0.0-alpha.91",A={dom:yi,reactive:cr};function Zc(e){A.core=e}function vi(e){A.core&&e.setAttribute("fluixi",A.core),e.setAttribute("fx-dom",A.dom),e.setAttribute("fx-reactive",A.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=A)}function gi(){let e=Gn();e.length>1&&console.warn(`[fluixi] ${e.length} builds of @fluixi/reactive are driving one reactive graph: ${e.join(", ")}. They share it on purpose, so signals still cross between them, but the oldest one decided what the graph looks like. Build the components on one release, or load them as shared-runtime bundles.`);let t=[A.core,A.dom,A.reactive].filter(n=>n!==void 0);new Set(t).size<=1||console.warn(`[fluixi] package versions disagree: core ${A.core??"(absent)"}, dom ${A.dom}, reactive ${A.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}function Qc(e){return Object.defineProperty(e,Symbol.for("fluixi-router"),{value:!0,enumerable:!0}),e}function ea(e){return Object.defineProperty(e,Symbol.for("fluixi-routes"),{value:!0,enumerable:!0}),e}function ta(e){return Object.defineProperty(e,Symbol.for("fluixi-route"),{value:!0,enumerable:!0}),e}function na(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-outlet"),{value:!0,enumerable:!0}),e}function ra(e){return Object.defineProperty(e,Symbol.for("fluixi-provider"),{value:!0,enumerable:!0}),e}function ia(e){return Object.defineProperty(e,Symbol.for("fluixi-context"),{value:!0,enumerable:!0}),e}function bi(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function sa(e){return Object.defineProperty(e,Symbol.for("fluixi-suspense"),{value:!0,enumerable:!0}),e}function wi(e){return typeof e=="function"&&e[Symbol.for("fluixi-router")]===!0}function Si(e){return typeof e=="function"&&e[Symbol.for("fluixi-routes")]===!0}function ki(e){return typeof e=="function"&&e[Symbol.for("fluixi-route")]===!0}function xi(e){return typeof e=="function"&&e[Symbol.for("fluixi-outlet")]===!0}function Ei(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function Ai(e){return typeof e=="function"&&e[Symbol.for("fluixi-context")]===!0}function j(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function _i(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function oa(e){return wi(e)?{type:"router",value:e}:ki(e)?{type:"route",value:e}:Si(e)?{type:"routes",value:e}:xi(e)?{type:"outlet",value:e}:j(e)?{type:"component",value:e}:_i(e)?{type:"suspense",value:e}:Ei(e)?{type:"provider",value:e}:Ai(e)?{type:"context",value:e}:{type:"none",value:e}}var ft=Symbol.for("fluixi.server-node"),ca=Symbol.for("fluixi.dom.server-host"),aa=globalThis,Ee=aa[ca]??={server:typeof document>"u",nodes:null};function H(){return Ee.server}function Ae(e){Ee.server=e}function ua(e){Ee.nodes=e}function dt(){if(!Ee.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return Ee.nodes}function Oe(e){return e!=null&&e[ft]===!0?!0:typeof Node<"u"&&e instanceof Node}function $i(e){return e!=null&&e[ft]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Ti(e){return e!=null&&e[ft]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var m={active:!1,cursor:null,parents:[]},Ci=null;function la(e){Ci=e}function en(){return Ci}function Kr(e,t){return m.active&&t.parentNode===e}function Ni(e){let t=m.parents.lastIndexOf(e);t!==-1&&(m.parents.length=t),m.cursor=e.nextSibling}function fa(){return m.active?m.cursor:null}function Jt(e,t){if(!e||e.parentNode==null)return t();let n=m.active,r=m.cursor,i=m.parents;m.active=!0,m.cursor=e,m.parents=[];try{return t()}finally{m.active=n,m.cursor=r,m.parents=i}}function da(e){if(!m.active)return e();let t=m.cursor,n=m.parents;m.active=!1,m.parents=[];try{return e()}finally{m.active=!0,m.cursor=t,m.parents=n}}function tn(e){if(!m.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&Ni(t)}function ha(e){let t=[];for(;e&&e.nodeType===1;){let n=e.tagName.toLowerCase();if(e.id){n+=`#${e.id}`,t.unshift(n);break}e.getAttribute("data-id")&&(n+=`[data-id="${e.getAttribute("data-id")}"]`);let r=0,i=e;for(;i=i.previousElementSibling;)i.tagName===e.tagName&&r++;n+=`:nth-of-type(${r+1})`,t.unshift(n),e=e.parentElement}return t.join(">")}function pa(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return`el_${Math.abs(t)}`}function ma(e){return pa(ha(e))}var ya=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),va={},ot="__fx_at",Oi="__fx_loc";function Jr(e,t){return t&&(e[Oi]=t),e}var Gr=new Map,ga="__fluixi_delegated_events__",Gt=globalThis[ga]??={names:new Set},ct=Gt.names,ht=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function pt(e){if(!H())for(let t of e)ct.has(t)||ht.has(t)||(ct.add(t),Gt.dispatch??=ba,document.addEventListener(t,Gt.dispatch))}function ba(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let r=n[t];if(r&&!n.disabled&&(r(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function nn(e,t,n){if(e[`$$${t}`]=n,ht.has(t)){let r=`__fx_${t}`;if(!e[r]){let i=s=>{e[`$$${t}`]?.(s)};e.addEventListener(t,i),e[r]=i}return}ct.has(t)||pt([t])}function at(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function wa(e){return!ht.has(e)}function Sa(e){return typeof e=="function"}function X(e,t=!1){if(H())return dt().createText(e);if(m.active&&!t){let n=en()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}function rn(e,t=!1,n){if(H())return dt().createElement(e,t);if(m.active){let r=en()?.hydrateElement(e);if(r)return n?Jr(r,n):r}return Jr(t?document.createElementNS(lt,e):document.createElement(e),n)}function sn(e,t=!1){let n=Gr.get(e);if(n)return n;let r=document.createElement("template");return t?r.innerHTML=`<svg>${e}</svg>`:r.innerHTML=e,Gr.set(e,r),r}function Ri(e,t,n=!1,r=!1,i){if(H()){let s=dt();return n?s.parseTemplate(e,r):s.createRaw(e)}if(m.active){let s=en()?.hydrateStatic(t);if(s)return Xr(s,i)}return Xr(on(sn(e,r),r).firstChild,i)}function Xr(e,t){let n=e;if(!t||typeof n?.querySelectorAll!="function")return e;let r=[n,...n.querySelectorAll("*")];for(let i=0;i<r.length&&i*2+1<t.pos.length;i++){let s=t.pos[i*2];s&&(r[i][Oi]={file:t.file,line:s,column:t.pos[i*2+1]})}return e}function Mi(e,t){if(!m.active)return t();let n=Jt(e.nextSibling,t);if(typeof n=="function"){let r=n;return ka(r,(...s)=>m.active?Jt(e.nextSibling,()=>r(...s)):r(...s))}return n}function ka(e,t){let n=e[ot];return n!==void 0&&(t[ot]=n),t}function Pi(e){for(let t=e.nextSibling;t;t=t.nextSibling)if(t.nodeType===8&&t.data==="fx/")return t;throw new Error("[fluixi] template hole is missing its closing marker")}function Di(e,t){let n=[];for(let r=e.nextSibling;r&&r!==t;r=r.nextSibling)n.push(r);return n}function on(e,t=!1){let n=e.content.cloneNode(!0);return t?n.firstChild:n}function Ii(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Ii(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function xa(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function Ea(e){if(k(e)||j(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!k(t)&&!j(t);)t=t();return t}var U=0,Aa=200;function _a(e,t,n,r,i){let s=r,o=new Map;return w(()=>{N(n??t,"content",void 0,e);let c;if(j(e)&&!k(e)){if(!o.has(e)){U++;try{let a=e();o.set(e,a)}finally{U--}}for(c=o.get(e);typeof c=="function"&&k(c);)c=c()}else for(c=e();typeof c=="function"&&k(c);)c=c();{let a=0;for(;typeof c=="function"&&a++<50;)if(j(c)){if(!o.has(c)){let u=c;U++;try{let l=u();o.set(u,l)}finally{U--}}c=o.get(c)}else if(k(c))c=c();else if(c=c(),typeof c!="function"||!k(c)&&!j(c))break}U++;try{s=_e(t,c,n,s,o),i(s)}finally{U--}})}function L(e,t,n,r){if(U>Aa)return console.error("[insert] Exceeded max call depth, possible infinite loop."),()=>null;n!==void 0&&!n&&(n=X("",!0),e.appendChild(n));let i=r??null,s=a=>Array.isArray(a)&&a.some(u=>typeof u=="function"),o=a=>typeof a=="function"?a:()=>a;if(typeof t!="function"&&!s(t)){U++;try{i=_e(e,t,n,i)}finally{U--}return()=>i}let c=_a(o(t),e,n,i,a=>{i=a});return()=>(c?.(),i)}function _e(e,t,n,r,i){if(t==null||typeof t=="boolean")return G(e,r,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return G(e,r,n);if(xe(t)){let o=X("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(o,r[0]),G(e,r.slice(1),n)):E(e,o,n):r?e.replaceChild(o,r):E(e,o,n),t.then(c=>{o.parentNode===e&&_e(e,c,o.nextSibling,o)}).catch(c=>{console.error("Error resolving promise in insertExpression:",c)}),o}let s=typeof t;if(s==="string"||s==="number"){if(s==="number"&&(t=String(t)),Array.isArray(r)){if(r.length===0){let c=X(t);return E(e,c,n),c}if(r.length===1&&r[0].nodeType===3)return r[0].data=t,r;r=G(e,r,n)}if(r&&Ti(r))return r.data=t,r;let o=X(t);return r&&r.parentNode===e?e.replaceChild(o,r):Kr(e,o)||E(e,o,n),o}if(Oe(t))return Kr(e,t)?(Ni(t),t):Array.isArray(r)?(r.length===0?E(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),G(e,r.slice(1),n)):E(e,t,n),t):(r?r!==t&&(r.parentNode===e?e.replaceChild(t,r):E(e,t,n)):E(e,t,n),t);if(Array.isArray(t)){let o=[],c=Array.isArray(r)?r:r?[r]:[],a=[];B(t,o,e,n,!0,i,a);let u=$a(e,c,o,n);for(let l of a){let f=L(e,l.sig,l.marker);S(()=>{G(e,f()),l.marker.parentNode===e&&e.removeChild(l.marker)})}return u}if(s==="object"&&t!==null&&typeof t=="object"){let o=t;if("type"in o&&"props"in o){let c=o;if(typeof c.type=="function"){let a=c.type(c.props||{});return _e(e,a,n,r)}}}return G(e,r,n)}function B(e,t,n,r,i=!0,s,o){for(let c=0;c<e.length;c++){let a=e[c];if(!(a==null||typeof a=="boolean")){for(;typeof a=="function"&&!xe(a)&&!k(a)&&!j(a)&&(a=a(),!(a==null||typeof a=="boolean")););if(!(a==null||typeof a=="boolean")){if(typeof a=="function"){let u;for(j(a)&&!k(a)?(s||(s=new Map),s.has(a)||s.set(a,a()),u=s.get(a)):u=a();typeof u=="function"&&!xe(u)&&!k(u)&&!j(u);)s||(s=new Map),s.has(u)||s.set(u,u()),u=s.get(u);if(u==null||typeof u=="boolean")continue;if(typeof u=="function"){if(k(u)){if(o){let f=X("",!0);t.push(f),o.push({marker:f,sig:u});continue}let l=u();for(;typeof l=="function"&&k(l);)l=l();if(l==null||typeof l=="boolean")continue;Array.isArray(l)?B(l,t,n,r,i,s):B([l],t,n,r,i,s);continue}continue}Array.isArray(u)?B(u,t,n,r,i,s,o):B([u],t,n,r,i,s,o);continue}if(xe(a)){let u=X("",!0);t.push(u),a.then(l=>{if(u.parentNode){let f=[];if(B([l],f,u.parentNode,void 0,!1,s),f.length>0){u.parentNode.replaceChild(f[0],u);for(let d=1;d<f.length;d++)u.parentNode?.insertBefore(f[d],f[d-1].nextSibling)}}}).catch(l=>console.error("Error resolving promise in array:",l));continue}if(Array.isArray(a)){B(a,t,n,r,i,s,o);continue}if(Oe(a)){t.push(a);continue}if(typeof a=="object"&&a!==null&&"type"in a&&"props"in a){let u=a;if(typeof u.type=="function"){let l=u.type(u.props||{});Array.isArray(l)?B(l,t,n,r,!1,s):B([l],t,n,r,!1,s);continue}}if(typeof a=="string"||typeof a=="number"){let u=String(a);if(u.trim()===""&&u!==" ")continue;t.push(X(u));continue}t.push(X(String(a)))}}}}function $a(e,t,n,r){for(let f=0;f<n.length;f++){let d=n[f].parentNode;d!==null&&d!==e&&d.nodeType!==11&&(n=n.slice(),n[f]=n[f].cloneNode(!0))}let i=n.length,s=t.length,o=i,c=0,a=0,u=s>0?t[s-1].nextSibling??void 0:r,l=null;for(;c<s||a<o;){if(t[c]===n[a]){c++,a++;continue}for(;s>c&&o>a&&t[s-1]===n[o-1];)s--,o--;if(s===c){let f=o<i?a?n[a-1].nextSibling??void 0:n[o-a]:u;for(;a<o;)E(e,n[a++],f)}else if(o===a)for(;c<s;)(!l||!l.has(t[c]))&&t[c].parentNode===e&&e.removeChild(t[c]),c++;else if(t[c]===n[o-1]&&n[a]===t[s-1]){let f=t[--s].nextSibling;E(e,n[a++],t[c++].nextSibling),E(e,n[--o],f),t[s]=t[c-1]}else{if(!l){l=new Map;let d=a;for(;d<o;)l.set(n[d],d++)}let f=l.get(t[c]);if(f!=null)if(a<f&&f<o){let d=c,y=1;for(;++d<s&&d<o&&!(!l.has(t[d])||l.get(t[d])!==f+y);)y++;if(y>f-a){let b=t[c];for(;a<f;)E(e,n[a++],b)}else t[c].parentNode===e?e.replaceChild(n[a++],t[c++]):(E(e,n[a++],u),c++)}else c++;else t[c].parentNode===e&&e.removeChild(t[c]),c++}}return n}function G(e,t,n){if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r].parentNode===e&&e.removeChild(t[r]);else t.parentNode===e&&e.removeChild(t);return null}function E(e,t,n){m.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function de(e,t,n){n==null?delete e[t]:e[t]=n}function cn(e,t,n){let r=n,i;return Array.isArray(n)&&(r=n[0],i=n[1]),typeof r!="function"?()=>{}:(e.addEventListener(t,r,i),()=>e.removeEventListener(t,r,i))}function ji(e,t){if(!t||typeof t!="function")return;let n=t[ot]?.name;if(!n)return;let r=n.indexOf(":");r!==-1&&O(e,n.slice(0,r),n.slice(r+1),t)}function ut(e,t,n){let r=typeof n=="function"?I(()=>n()):n;if(!(!r||typeof r!="object"))for(let i of Object.keys(r))O(e,t,i)}function an(e,t){let n=(r,i)=>{typeof r=="function"&&(O(e,"use",r.name||"use",i),r(e,i??(()=>{})))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let r of t)Array.isArray(r)?n(r[0],r[1]):n(r)}}function $e(e,t,n,r=!1){return ji(e,n),typeof n!="function"?(M(e,t,n,r),()=>{}):w(()=>{N(e,"attribute",t,n);let i=typeof n=="function"?n():n;M(e,t,i,r)})}function Te(e,t,n){return typeof n!="function"?(de(e,t,n),()=>{}):(ji(e,n),w(()=>{N(e,"property",t,n);let r=typeof n=="function"?n():n;de(e,t,r)}))}function un(e,t,n){return typeof n!="function"?(M(e,t,!!n),()=>{}):w(()=>{N(e,"attribute",t,n);let r=n();M(e,t,!!r)})}function he(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){w(()=>{N(e,"attribute","class",t),he(e,t())});return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(r=>{let i=t[r];return typeof i=="function"?i():!!i}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function Ce(e,t,n){if(!(!t||typeof t!="object"))for(let r in t){let i=t[r],s=r.split(/\s+/).filter(Boolean);if(typeof i=="function"&&n)n.push(w(()=>{let o=!!i();for(let c of s)e.classList.toggle(c,o)}));else{let o=!!(typeof i=="function"?i():i);for(let c of s)e.classList.toggle(c,o)}}}function Ne(e,t){let n=t;for(;typeof n=="function";)n=n();if(n==null){e.removeAttribute("style");return}if(typeof n=="string"){e.style.cssText=n;return}if(typeof n=="object")for(let r in n){let i=n[r];i==null?e.style[r]="":e.style[r]=i}}function Li(e){let{element:t,props:n,prevProps:r=va,isSVG:i=!1,skipChildren:s=!1,isCustomElement:o}=e;if(!t||!$i(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let c=i||t.namespaceURI===lt,a=[];for(let u in n){if(s&&u==="children")continue;let l=n[u],f=r[u];if(l===f)continue;if(u==="ref"){Re(l,t);continue}if(u==="use"){an(t,l);continue}if(u.startsWith("on:")){a.push(cn(t,u.slice(3),l));continue}if(u.startsWith("prop:")){O(t,"prop",u.slice(5),l),a.push(Te(t,u.slice(5),l));continue}if(u.startsWith("attr:")){O(t,"attr",u.slice(5),l),a.push($e(t,u.slice(5),l,c));continue}if(u.startsWith("bool:")){O(t,"bool",u.slice(5),l),a.push(un(t,u.slice(5),l));continue}if(u==="class"||u==="className"){typeof l=="function"?a.push(w(()=>{N(t,"attribute","class",l),he(t,l())})):he(t,l);continue}if(u==="classList"){ut(t,"class",l),typeof l=="function"?a.push(w(()=>{N(t,"attribute","class",l),Ce(t,l())})):Ce(t,l,a);continue}if(u==="style"){ut(t,"style",l),typeof l=="function"?a.push(w(()=>{N(t,"attribute","style",l),Ne(t,l())})):Ne(t,l);continue}if(u.startsWith("on")){let b=u.slice(2).toLowerCase();f&&at(t,b),l&&nn(t,b,l);continue}let d=o??t.localName.includes("-"),y=zt.has(u)||!c&&u in t||d&&!c&&!oi(u);typeof l=="function"?a.push(y?Te(t,u,l):$e(t,u,l,c)):a.push(w(()=>y?de(t,u,n[u]):M(t,u,n[u],c)))}for(let u in r)if(!(u in n))if(u.startsWith("on")){let l=u.slice(2).toLowerCase();at(t,l)}else zt.has(u)?de(t,u,null):t.removeAttribute(u);return()=>{a.forEach(u=>u())}}function ln(e,t,n=!1){for(let r in t){let i=t[r];if(r==="ref"){Re(i,e);continue}if(r!=="children"){if(r==="use"){an(e,i);continue}if(r.startsWith("on:")){cn(e,r.slice(3),i);continue}if(r.startsWith("prop:")){O(e,"prop",r.slice(5),i),Te(e,r.slice(5),i);continue}if(r.startsWith("attr:")){O(e,"attr",r.slice(5),i),$e(e,r.slice(5),i,n);continue}if(r.startsWith("bool:")){O(e,"bool",r.slice(5),i),un(e,r.slice(5),i);continue}if(r.startsWith("on")&&r.length>2){let s=r.slice(2).toLowerCase();if(typeof i=="function")if(ht.has(s)){e[`$$${s}`]=i;let o=`__fx_${s}`;if(!e[o]){let c=a=>{e[`$$${s}`]?.(a)};e.addEventListener(s,c),e[o]=c}}else e[`$$${s}`]=i,ct.has(s)||pt([s]);continue}if(r==="class"||r==="className"){he(e,i);continue}if(r==="classList"){ut(e,"class",i),typeof i=="function"?w(()=>{N(e,"attribute","class",i),Ce(e,i())}):Ce(e,i);continue}if(r==="style"){ut(e,"style",i),typeof i=="function"?w(()=>{N(e,"attribute","style",i),Ne(e,i())}):Ne(e,i);continue}if(r==="innerHTML"){if(typeof i=="function"){let s=q(()=>{let o=i();for(;typeof o=="function";)o=o();e.innerHTML=o});S(()=>s())}else e.innerHTML=i;continue}if(r==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof i=="function"){let s=q(()=>{let o=i();for(;typeof o=="function"&&o.length===0;)o=o();document.activeElement!==e&&(e.value=o??"")});S(()=>{s()})}else w(()=>{document.activeElement!==e&&(e.value=t[r]??"")});continue}if(r==="checked"&&e.tagName==="INPUT"){if(typeof i=="function"){let s=q(()=>{let o=i();for(;typeof o=="function"&&o.length===0;)o=o();document.activeElement!==e&&(e.checked=o??"")});S(()=>{s()})}else w(()=>{document.activeElement!==e&&(e.checked=t[r]??"")});continue}if(r==="value"&&e.tagName==="SELECT"){if(typeof i=="function"){let s=!0,o=q(()=>{let c=i();for(;typeof c=="function"&&c.length===0;)c=c();s?(s=!1,queueMicrotask(()=>{e.value=c??""})):e.value=c??""});S(()=>{o()})}else{let s=!0;w(()=>{let o=t[r];s?(s=!1,queueMicrotask(()=>{e.value=o??""})):e.value=o??""})}continue}if(typeof i=="function"){let s=q(()=>{let o=i();for(;typeof o=="function"&&o.length===0;)o=o();Ut(e,r,o,n)});S(()=>{s()})}else w(()=>Ut(e,r,t[r],n))}}}function Hi(...e){let t=r=>{for(let i=e.length-1;i>=0;i--){let s=e[i];if(s&&r in s&&s[r]!==void 0)return s[r]}},n=r=>{for(let i of e)if(i&&r in i)return!0;return!1};return new Proxy({},{get:(r,i)=>t(i),has:(r,i)=>n(i),ownKeys:()=>{let r=new Set;for(let i of e)if(i)for(let s of Reflect.ownKeys(i))r.add(s);return[...r]},getOwnPropertyDescriptor:(r,i)=>n(i)?{enumerable:!0,configurable:!0,get:()=>t(i)}:void 0})}function Ta(e,...t){let n=new Set;for(let o of t)for(let c of o)n.add(c);let r=o=>({enumerable:!0,configurable:!0,get:()=>e[o]}),i=t.map(o=>{let c=new Set(o);return new Proxy({},{get:(a,u)=>c.has(u)?e[u]:void 0,has:(a,u)=>c.has(u)&&u in e,ownKeys:()=>Array.from(c).filter(a=>a in e),getOwnPropertyDescriptor:(a,u)=>c.has(u)&&u in e?r(u):void 0})}),s=new Proxy({},{get:(o,c)=>n.has(c)?void 0:e[c],has:(o,c)=>!n.has(c)&&c in e,ownKeys:()=>Reflect.ownKeys(e).filter(o=>!n.has(o)),getOwnPropertyDescriptor:(o,c)=>!n.has(c)&&c in e?r(c):void 0});return[...i,s]}function Re(e,t){if(!e)return;let n=e[ot]?.name;if(O(t,"ref",n||typeof e=="function"&&e.name||"ref",e),Oe(e)){let r=t,i=e;if(!r)return;typeof r=="function"?r(i):typeof r=="object"&&"current"in r&&(r.current=i);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}function Wi(e,t,n){let r=t||document.body,i=Ke(()=>e),s=[];return oe(()=>{let o=w(()=>{let c=i();Array.isArray(c)?(c.forEach(a=>r.appendChild(a)),s.push(()=>{c.forEach(a=>{a.parentNode===r&&r.removeChild(a)})})):Oe(c)&&(r.appendChild(c),s.push(()=>{c.parentNode===r&&r.removeChild(c)}))});s.push(o),S(()=>{s.forEach(c=>c())})}),null}function Ca(e){return typeof e=="string"&&e.toLowerCase()===e}function qi(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="polygon"||e==="polyline"||e==="ellipse"||e==="g"||e==="defs"||e==="clipPath"||e==="text"}function Na(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function xe(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function Oa(e){return typeof e=="function"&&e.length===0&&k(e)}function Me(e,t,n){if(!t)throw new Error("Container element is required");let r,i,s=[];return P(o=>{oe(()=>{m.active||(t.textContent=""),vi(t),gi(),L(t,e)}),i=o}),()=>{i?.(),r?.(),s.forEach(o=>o()),t.textContent=""}}function Vi(e){if(Array.isArray(e))return e;if(typeof e=="function"&&typeof e.set=="function")return[e,e.set];throw new TypeError("[fluixi] bind: needs a signal, either `signal(...)` or the `[get, set]` pair from `createSignal(...)`.")}var Ra="__fx_dom_create_component__",te=globalThis[Ra]??={fn:null};function Ma(e){te.fn=e}function Pa(e={}){let t=e.signalSystem?.createComponent;t&&(te.fn=t)}function fn(e,t){if(te.fn)return te.fn(e,t);t&&$r(t);let n=typeof e=="function"?ue(()=>e(t)):e,r=n!=null&&(typeof n=="function"||typeof n=="object");if(r)try{n.$name=e?.name}catch{}return r&&!Ir(n)?bi(n):n}var Da=()=>te.fn!==null,Fi=()=>te.fn!==null;function Bi(){te.fn=null}var st,Ui={getStore:()=>st,run(e,t){let n=st;st=e;try{return t()}finally{st=n}}},dn=Ui;function Ia(e){dn=e??Ui}function hn(e={}){e.locals||(e.locals=e.request?Ki(e.request):{});let t=0,n=0,r=null,i=new Map,s=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${t++}`,nextResourceId:()=>{if(r===null)return`r${n++}`;let o=i.get(r)??0;return i.set(r,o+1),`${r}:r${o}`},nextIslandNamespace:o=>{let c=s.get(o)??0;return s.set(o,c+1),`${o}#${c}`},withResourceScope(o,c){let a=r;r=o;try{return c()}finally{r=a}},pending:new Set,data:new Map}}function pn(e,t){return dn.run(e,t)}function fe(){return dn.getStore()}function zi(){return fe()?.event}function ja(){let e=zi();return e?(e.locals||(e.locals={}),e.locals):{}}var Yr=new WeakMap;function Ki(e){let t=Yr.get(e);return t||(t={},Yr.set(e,t)),t}var mn="__FX_DATA__";function Ji(e){return e.replace(/[<>&\u2028\u2029]/g,t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"))}var Ft;function Gi(){let e=globalThis.__FX_DATA__;if(e)return e;if(Ft!==void 0)return Ft;let t=null;if(typeof document<"u"){let n=document.getElementById(mn)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return Ft=t}function mt(){for(;;){for(;m.cursor&&m.cursor.nodeType===3&&m.cursor.data==="";)m.cursor=m.cursor.nextSibling;if(m.cursor!=null||!m.parents.length)return;m.cursor=m.parents.pop().nextSibling}}var La=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),yt=typeof process<"u"&&process.env&&!1;function vt(e,t){let n=t.nodeType===1?`<${t.tagName.toLowerCase()}>`:t.nodeType===3?`text ${JSON.stringify((t.nodeValue??"").slice(0,24))}`:t.nodeType===8?"comment":"node";console.warn(`[fluixi] hydration mismatch: expected ${e} but the server DOM has ${n}. Server and client rendered different markup; recreating this node on the client. Check for non-deterministic render (Date.now(), Math.random(), browser-only branches, untransported data).`)}function Ha(e){mt();let t=m.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(La.has(e.toLowerCase())?m.cursor=t.nextSibling:(m.parents.push(t),m.cursor=t.firstChild),t):(yt&&t&&vt(`<${e}>`,t),null)}function Wa(e){mt();let t=m.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(m.cursor=t.nextSibling,t):(yt&&t&&vt(`<${e}> (static)`,t),null)}function qa(e){if(e===""){let n=m.cursor;return n&&n.nodeType===3&&n.data!==""?(m.cursor=n.nextSibling,n.data="",n):null}mt();let t=m.cursor;return t&&t.nodeType===3?(m.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(yt&&t&&vt(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function Va(e){mt();let t=m.cursor;return t&&t.nodeType===8&&t.data===e?(m.cursor=t.nextSibling,t):(yt&&t&&vt(`marker <!--${e.slice(0,24)}-->`,t),null)}var Zr=!1;function Fa(){Zr||(Zr=!0,la({hydrateElement:Ha,hydrateText:qa,hydrateMarker:Va,hydrateStatic:Wa}))}function Pe(e,t,n){Fa(),m.active=!0,m.cursor=t.firstChild,m.parents=[];let r=Gi(),i=n?.resourceNamespace,s=0;ze(()=>i?`${i}:r${s++}`:`r${s++}`),sr(r?o=>o in r?{value:r[o]}:void 0:null);try{return Me(e,t)}finally{m.active=!1,m.cursor=null,m.parents=[]}}var yn="fluixi-island";function Ba(e){let{component:t,props:n={},name:r}=e,i=rn(yn),s=r??t.name??"Island";M(i,"name",s),M(i,"props",JSON.stringify(n??{}));let o=H()?fe():void 0;if(o){let c=o.nextIslandNamespace(s);L(i,()=>o.withResourceScope(c,()=>t(n)))}else L(i,()=>t(n));return i}var Qr=!1;function Ua(){if(Qr||typeof document>"u")return;Qr=!0;let e=document.createElement("style");e.textContent=`${yn}{display:contents}`,document.head.appendChild(e)}function za(e){if(typeof document>"u")return;Ua();let t=document.querySelectorAll(yn),n=new Map;t.forEach(r=>{let i=r.getAttribute("name")??"",s=n.get(i)??0;n.set(i,s+1);let o=e[i];if(!o){typeof process>"u"&&console.warn(`[fluixi] island "${i}" has no component in the registry, left static.`);return}let c={};try{c=JSON.parse(r.getAttribute("props")||"{}")}catch{}Pe(()=>o(c),r,{resourceNamespace:`${i}#${s}`})})}function Ka(e,...t){throw new Error("html`` was not compiled, enable the lit format: fluixi({ format: 'lit' }).")}function Ja(e,...t){throw new Error("svg`` was not compiled, enable the lit format: fluixi({ format: 'lit' }).")}function Ga(e,t={}){if(typeof e=="function")return fn(e,t);if(typeof e!="string"||e.length===0)return null;let n=qi(e);if(H())return dt().createElement(e,n);let r=n?document.createElementNS(lt,e):document.createElement(e);return ln(r,t,n),Xa(r,t),r}function Xa(e,t){if(!t||t.children===void 0)return;let n=Ke(()=>t.children),r=i=>{L(e,i,typeof i=="function"?null:void 0)};Array.isArray(n)?n.forEach(r):r(n)}function Ya(e){return typeof e=="function"?e:(()=>e)}function gt(e){return()=>{let t=e();return typeof t=="function"?t():t}}function Za(e){return e!=null&&e!==!1}function Qa(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function vn(e){let t=gt(()=>e.when),n=g(t,void 0,{name:"Show.when"}),r=g(n,void 0,{name:"Show.cond"}),i=W(),s=null,o=null,c=a=>{a!==o&&(s&&se(s),s=ie(i),o=a)};return g(()=>{let a=r();return c(a?"when":"fallback"),T(s,()=>{if(a){let u=e.children;return typeof u=="function"&&!Qa(u)?typeof n=="function"?I(()=>I(n)?u(n()):e.fallback):u(n):u}return e.fallback});return e.fallback??null},void 0,{name:"Show.result"})}function gn(e){let t=gt(()=>e.each),n=()=>e.fallback??null,r=(i,s)=>{let o=e.children,c=Array.isArray(o)?o.map(a=>typeof a=="function"?a(i,s):a):typeof o=="function"?o(i,s):o;return tn(c),c};return e.by?Be(t,e.by,(i,s)=>r(i,s),{fallback:n}):Fe(t,(i,s)=>r(i,s),{fallback:n})}function bn(e){let t=gt(()=>e.each);return Ue(t,(n,r)=>{let i=e.children(n,r);return tn(i),i},{fallback:()=>e.fallback??null})}var Xt=Symbol("match");function wn(e){return{[Xt]:!0,when:gt(()=>e.when),get children(){return e.children}}}function Sn(e){let t=Array.isArray(e.children)?e.children:[e.children],n=W(),r=null,i=-1,s=o=>{o!==i&&(r&&se(r),r=ie(n),i=o)};return g(()=>{for(let o=0;o<t.length;o+=1){let a=t[o],u=0;for(;typeof a=="function"&&!a[Xt]&&u++<10;)a=a();if(!a||typeof a!="object"||a[Xt]!==!0)continue;let l=a.when();if(Za(l))return s(o),T(r,()=>typeof a.children=="function"?a.children(l):a.children)}return s(-2),T(r,()=>e.fallback??null)},void 0,{name:"Switch"})}function kn(e){let t=Ya(e.component),{component:n,...r}=e,i=W(),s=null,o;return g(()=>{let c=t();return c!==o&&(s&&se(s),s=ie(i),o=c),c==null?null:typeof c=="string"?{tag:c,props:r}:T(s,()=>c(r))},void 0,{name:"Dynamic"})}function xn(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return P(i=>{n=i,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),L(r,e.children)&&Re(e.ref,r)}),S(()=>{n(),r.remove()}),null}function Xi(e){if(H())return e.fallback??null;let t=m.active,[n,r]=D(!t);return t&&queueMicrotask(()=>r(!0)),g(()=>n()?e.children:e.fallback??null,void 0,{name:"client-only"})}var eu=Xi;function En(e){let[t,n]=D(null),r=()=>n(null);return g(()=>{let i=t();if(i!==null)return typeof e.fallback=="function"?e.fallback(i,r):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(s){return n(s),typeof e.fallback=="function"?e.fallback(s,r):e.fallback}},void 0,{name:"ErrorBoundary"})}function tu(e){return g(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,i]of Object.entries(t)){if(!r)continue;(typeof i=="function"?i():i)&&n.push(r)}return n.join(" ")},void 0,{name:"ClassMap"})}function nu(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function ru(e){return g(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,i]of Object.entries(t)){if(!r)continue;let s=typeof i=="function"?i():i;s!=null&&n.push(`${nu(r)}: ${s}`)}return n.join("; ")},void 0,{name:"StyleMap"})}var An=1,Yi=3,Zi=8,Qi;Qi=ft;var bt=class{constructor(){this[Qi]=!0,this.parentNode=null,this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let e=this.parentNode;if(!e)return null;let t=e.childNodes.indexOf(this);return t>=0?e.childNodes[t+1]??null:null}get previousSibling(){let e=this.parentNode;if(!e)return null;let t=e.childNodes.indexOf(this);return t>0?e.childNodes[t-1]??null:null}get parentElement(){return this.parentNode}appendChild(e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=this,this.childNodes.push(e),e}insertBefore(e,t){if(t==null)return this.appendChild(e);e.parentNode&&e.parentNode.removeChild(e);let n=this.childNodes.indexOf(t);return e.parentNode=this,n<0?this.childNodes.push(e):this.childNodes.splice(n,0,e),e}removeChild(e){let t=this.childNodes.indexOf(e);return t>=0&&this.childNodes.splice(t,1),e.parentNode=null,e}replaceChild(e,t){let n=this.childNodes.indexOf(t);return n>=0&&(e.parentNode&&e.parentNode.removeChild(e),e.parentNode=this,this.childNodes[n]=e,t.parentNode=null),t}addEventListener(){}removeEventListener(){}},_n=class es extends bt{constructor(t){super(),this.nodeType=Yi,this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}get textContent(){return this.data}set textContent(t){this.data=t==null?"":String(t)}cloneNode(){return new es(this.data)}},iu=class ts extends bt{constructor(t){super(),this.nodeType=An,this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new ts(this.rawOuterHTML)}},ns=class rs extends bt{constructor(t){super(),this.nodeType=Zi,this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new rs(this.data)}},su=class{constructor(){this.cssText=""}setProperty(e,t){this[e]=t}removeProperty(e){delete this[e]}},ou=class{constructor(e){this.el=e}list(){let e=this.el.getAttribute("class");return e?e.split(/\s+/).filter(Boolean):[]}write(e){e.length?this.el.setAttribute("class",e.join(" ")):this.el.removeAttribute("class")}add(...e){let t=this.list();for(let n of e)t.includes(n)||t.push(n);this.write(t)}remove(...e){this.write(this.list().filter(t=>!e.includes(t)))}contains(e){return this.list().includes(e)}toggle(e,t){let n=this.contains(e),r=t===void 0?!n:t;return r?this.add(e):this.remove(e),r}},Yt=class is extends bt{constructor(t,n=!1){super(),this.nodeType=An,this.attributes=new Map,this.style=new su,this.classList=new ou(this),this.rawHTML=null,this.localName=t.toLowerCase(),this.tagName=n?t:t.toUpperCase(),this.isSVG=n,this.namespaceURI=n?"http://www.w3.org/2000/svg":null}setAttribute(t,n){this.attributes.set(t,String(n))}removeAttribute(t){this.attributes.delete(t)}getAttribute(t){return this.attributes.has(t)?this.attributes.get(t):null}hasAttribute(t){return this.attributes.has(t)}get id(){return this.getAttribute("id")??""}set id(t){t==null?this.removeAttribute("id"):this.setAttribute("id",t)}get className(){return this.getAttribute("class")??""}set className(t){t==null?this.removeAttribute("class"):this.setAttribute("class",t)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(t){t==null?this.removeAttribute("for"):this.setAttribute("for",t)}set value(t){t==null?this.removeAttribute("value"):this.setAttribute("value",String(t))}set checked(t){t?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(t){t?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(t){}get textContent(){return this.childNodes.map(t=>t.textContent??"").join("")}set textContent(t){for(let n of this.childNodes)n.parentNode=null;this.childNodes=[],this.rawHTML=null,t!=null&&t!==""&&this.appendChild(new _n(String(t)))}set innerText(t){this.textContent=t}set innerHTML(t){for(let n of this.childNodes)n.parentNode=null;this.childNodes=[],this.rawHTML=t==null?"":String(t)}cloneNode(t=!1){let n=new is(this.localName,this.isSVG);if(n.attributes=new Map(this.attributes),n.style.cssText=this.style.cssText,n.rawHTML=this.rawHTML,t)for(let r of this.childNodes)n.appendChild(r.cloneNode(!0));return n}},cu=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ss=/&/g,os=/</g,cs=/>/g,au=/"/g;function Bt(e){return e.replace(ss,"&").replace(os,"<").replace(cs,">")}function ei(e){return e.replace(ss,"&").replace(au,""").replace(os,"<").replace(cs,">")}function uu(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function lu(e){if(!e)return"";let t=[];e.cssText&&t.push(e.cssText.trim().replace(/;\s*$/,""));for(let n of Object.keys(e)){if(n==="cssText")continue;let r=e[n];r==null||r===""||t.push(`${uu(n)}: ${r}`)}return t.join("; ")}function fu(e){let t="",n=lu(e.style);for(let[r,i]of e.attributes)r==="style"&&n||(t+=` ${r}="${ei(i)}"`);if(n){let r=e.attributes.get("style"),i=r?`${r.replace(/;\s*$/,"")}; ${n}`:n;t+=` style="${ei(i)}"`}return t}function Y(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return Bt(e);if(typeof e=="number")return Bt(String(e));if(typeof e=="function")return Y(e());if(Array.isArray(e))return e.map(Y).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case Yi:return Bt(e.data??"");case Zi:return`<!--${e.data??""}-->`;case An:{let t=e.localName,n=`<${t}${fu(e)}>`;if(cu.has(t))return n;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(Y).join("");return`${n}${r}</${t}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(Y).join(""):""}var du=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),hu={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function ti(e){return e.replace(/&(#?\w+);/g,(t,n)=>hu[n]??t)}var F=class extends Error{};function pu(e,t=!1){let n=0,r=[],i=[],s=u=>{let l=i[i.length-1];l?l.appendChild(u):r.push(u)};for(;n<e.length;){let u=e.indexOf("<",n);if(u===-1){c(e.slice(n));break}if(u>n&&c(e.slice(n,u)),e.startsWith("<!--",u)){let l=e.indexOf("-->",u);if(l===-1)throw new F(`unterminated comment at ${u}`);s(new ns(e.slice(u+4,l))),n=l+3;continue}if(e[u+1]==="/"){let l=e.indexOf(">",u);if(l===-1)throw new F(`unterminated closing tag at ${u}`);let f=e.slice(u+2,l).trim().toLowerCase(),d=i.pop();if(!d||d.localName!==f)throw new F(`</${f}> does not close <${d?.localName??"nothing"}>`);n=l+1;continue}n=a(u)}if(i.length>0)throw new F(`unclosed <${i[i.length-1].localName}>`);let o=r[0];if(r.length!==1||!(o instanceof Yt))throw new F(`expected exactly one root element, got ${r.length}`);return o;function c(u){u!==""&&s(new _n(ti(u)))}function a(u){let l=/[\s/>]/.exec(e.slice(u+1));if(!l)throw new F(`unterminated tag at ${u}`);let f=e.slice(u+1,u+1+l.index).toLowerCase(),d=new Yt(f,t),y=u+1+l.index;for(;y<e.length;){for(;y<e.length&&/\s/.test(e[y]);)y++;if(e[y]===">"){y++;break}if(e[y]==="/"&&e[y+1]===">"){y+=2;break}let b=y;for(;y<e.length&&!/[\s=/>]/.test(e[y]);)y++;let v=e.slice(b,y);if(v==="")throw new F(`malformed attribute at ${y}`);if(e[y]==="="){if(e[y+1]!=='"')throw new F(`attribute ${v} must have a double-quoted value`);let _=e.indexOf('"',y+2);if(_===-1)throw new F(`unterminated value for ${v}`);d.setAttribute(v,ti(e.slice(y+2,_))),y=_+1}else d.setAttribute(v,"")}return s(d),du.has(f)||i.push(d),y}}var ni=!1;function as(){ni||(ni=!0,ua({createElement:(e,t)=>new Yt(e,t),createText:e=>new _n(e),createRaw:e=>new iu(e),parseTemplate:(e,t)=>pu(e,t),createComment:e=>new ns(e)}))}function mu(e,t={}){let n=H();as(),Ae(!0);let r=hn(t.event);try{return pn(r,()=>P(i=>{try{let s=typeof e=="function"?e():e;return Y(s)}finally{i()}}))}finally{Ae(n)}}var ri=!1;function yu(){ri||(ri=!0,ir(e=>{fe()?.pending.add(e)}),ze(()=>fe()?.nextResourceId()??""),or((e,t)=>{e&&fe()?.data.set(e,t)}))}var Zt=null;function vu(e){Zt=e}function us(e){if(e.data.size===0)return"";let t={};for(let[r,i]of e.data){let s=i;if(Zt)try{s=Zt(i,r)}catch{continue}s!==void 0&&(typeof s=="function"||typeof s=="symbol"||(t[r]=s))}if(Object.keys(t).length===0)return"";let n=Ji(JSON.stringify(t));return n==="{}"?"":`<script type="application/json" id="${mn}">${n}<\/script>`}var gu=50;async function bu(e,t={}){let n=H();as(),Ae(!0),yu();let r=hn(t.event);try{return await pn(r,async()=>{t.preload&&await t.preload(t.event);let i,s=null,o=()=>{};P(l=>{o=l,s=W(),i=typeof e=="function"?e():e});let c=()=>{try{T(s,()=>Y(i))}catch{}};c();let a=0;for(;r.pending.size>0&&a++<gu;){let l=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(l),await rr(),c()}let u=T(s,()=>Y(i))+us(r);return o(),u})}finally{Ae(n)}}var wu={createComponent:fn,createElement:di,createNativeElement:rn,createTemplate:sn,cloneTemplate:on,templateNode:Ri,holeContent:Di,holeEnd:Pi,holeScope:Mi,createPortal:Wi,render:Me,hydrate:Pe,insert:L,appendChildren:pi,removeChildren:hi,spread:Li,applyProps:ln,mergeProps:Hi,bindPair:Vi,setProperty:de,setDynamicProperty:Te,setAttribute:M,setDynamicAttribute:$e,removeAttribute:fi,getAttribute:li,setClassName:he,addClass:ci,removeClass:ai,toggleClass:ui,setStyles:Qt,delegateEvents:pt,addDelegatedEventListener:nn,removeDelegatedEventListener:at,handleRef:Re,resetIntegration:Bi,isIntegrationInitialized:Fi},Su=wu;function ku(e){let t=(n,r)=>{n.parent=r;let i=xu(n);for(let s of i)t(s,n)};return t(e,null),e}function xu(e){switch(e.kind){case"Root":case"Element":case"Component":case"Fragment":return e.children;default:return[]}}var Eu=class{constructor(e){this.pieces=e,this.pi=0,this.oi=0,this.normalize()}normalize(){for(;this.pi<this.pieces.length;){let e=this.pieces[this.pi];if(e.kind==="static"&&this.oi>=e.text.length){this.pi++,this.oi=0;continue}break}}eof(){return this.pi>=this.pieces.length}pos(){if(this.eof()){let t=this.pieces[this.pieces.length-1];return t?t.kind==="static"?t.start+t.text.length:t.end:0}let e=this.pieces[this.pi];return e.kind==="static"?e.start+this.oi:e.start}atHole(){return!this.eof()&&this.pieces[this.pi].kind==="hole"}holeFollows(){if(this.eof())return!1;let e=this.pieces[this.pi];if(e.kind!=="static"||this.oi+1<e.text.length)return!1;let t=this.pieces[this.pi+1];return t!==void 0&&t.kind==="hole"}takeHole(){let e=this.pieces[this.pi];if(e.kind!=="hole")throw new Error("takeHole called off a hole");return this.pi++,this.oi=0,this.normalize(),{index:e.index,loc:{start:e.start,end:e.end}}}peek(e=0){if(this.eof())return"";let t=this.pieces[this.pi];return t.kind!=="static"?"":t.text[this.oi+e]??""}startsWith(e){if(this.eof())return!1;let t=this.pieces[this.pi];return t.kind!=="static"?!1:t.text.startsWith(e,this.oi)}advance(){if(this.eof())return"";let e=this.pieces[this.pi];if(e.kind!=="static")return"";let t=e.text[this.oi++]??"";return this.normalize(),t}readWhile(e){let t="";for(;!this.eof()&&!this.atHole();){let n=this.peek();if(n===""||!e(n))break;t+=n,this.oi++}return this.normalize(),t}skipWhitespace(){this.readWhile(e=>/\s/.test(e))}span(e){return{start:e,end:this.pos()}}},ls=new Set(["capture","once","passive","prevent","stop","self"]);function Z(e,t){return e.value&&e.value.kind==="hole"?e.value.hole:(e.report("invalid-binding",`${t} requires an expression value: ${e.name}=\${…}`),-1)}var ds=(e,t)=>({kind:"Attribute",name:t?e.name.slice(1):e.name,value:e.value,boolean:t,loc:e.loc}),hs=[{id:"event",match:e=>e[0]==="@"||e.startsWith("on:")||/^on[A-Z]/.test(e),build:e=>{let t,n;e.name[0]==="@"?(t="at",n=e.name.slice(1)):e.name.startsWith("on:")?(t="colon",n=e.name.slice(3)):(t="on",n=e.name.slice(2));let[r,...i]=n.split("."),s=r.toLowerCase();for(let o of i)ls.has(o)||e.report("invalid-directive",`Unknown event modifier ".${o}" — expected one of ${[...ls].join(", ")}`);return{kind:"EventBinding",name:s,syntax:t,modifiers:i,hole:Z(e,"event binding"),loc:e.loc}}},{id:"bind",elementOnly:!0,match:e=>e.startsWith("bind:"),build:e=>({kind:"BindDirective",name:e.name.slice(5),hole:Z(e,"two-way binding"),loc:e.loc})},{id:"class-directive",elementOnly:!0,match:e=>e.startsWith("class:"),build:e=>({kind:"ClassDirective",name:e.name.slice(6),hole:Z(e,"class directive"),loc:e.loc})},{id:"style-directive",elementOnly:!0,match:e=>e.startsWith("style:"),build:e=>({kind:"StyleDirective",name:e.name.slice(6),hole:Z(e,"style directive"),loc:e.loc})},{id:"load",match:e=>e.startsWith("load:"),build:e=>({kind:"LoadDirective",strategy:e.name.slice(5),modifier:e.value&&e.value.kind==="static"?e.value.value:null,loc:e.loc})},{id:"use",match:e=>e==="use"||e.startsWith("use:"),build:e=>({kind:"UseDirective",name:e.name.startsWith("use:")?e.name.slice(4):null,hole:e.value&&e.value.kind==="hole"?e.value.hole:null,loc:e.loc})},{id:"if",elementOnly:!0,match:e=>e==="if",build:e=>({kind:"IfDirective",hole:Z(e,"if directive"),loc:e.loc})},{id:"each",elementOnly:!0,match:e=>e==="each",build:e=>({kind:"EachDirective",hole:Z(e,"each directive"),key:null,loc:e.loc})},{id:"else",elementOnly:!0,match:e=>e==="else",build:e=>(e.value!==null&&e.report("invalid-directive","`else` takes no value"),{kind:"ElseDirective",loc:e.loc})},{id:"ref",match:e=>e==="ref",build:e=>({kind:"RefBinding",hole:Z(e,"ref binding"),loc:e.loc})},{id:"property",match:e=>e[0]===".",build:e=>({kind:"PropertyBinding",name:e.name.slice(1),hole:Z(e,"property binding"),loc:e.loc})},{id:"boolean",match:e=>e[0]==="?",build:e=>ds(e,!0)}];function Au(e,t=hs,n={component:!1}){for(let r of t)if(!(r.elementOnly&&n.component)&&r.match(e.name))return r.build(e);return ds(e,!1)}var _u=new Set(["svg","path","circle","rect","line","polygon","polyline","ellipse","g","defs","clipPath","text"]),$u=new Set(["script","style","textarea","title"]),Tu=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Cu(e){return e.length>0&&(e[0]!==e[0].toLowerCase()||e.includes("."))}var Nu=new Set(["a","button","input","select","textarea","summary","details","option","label"]),Ou=new Set(["keydown","keyup","keypress"]);function pe(e,t){return e.attributes.find(n=>"name"in n&&n.name===t)}function Ru(e){return e.attributes.some(t=>t.kind==="Spread")}function wt(e,t){let n=pe(e,t);if(!n||n.kind!=="Attribute"||!n.value)return;let r=n.value;return r.kind==="static"?r.value:void 0}function Mu(e){let t=wt(e,"role");return t==="presentation"||t==="none"?!0:wt(e,"aria-hidden")==="true"}function fs(e,t){return e.attributes.some(n=>n.kind==="EventBinding"&&t(n.name))}function Pu(e){let t=[],n=(i,s,o)=>{t.push({code:s,message:o,severity:"warning",loc:i.loc})},r=i=>{for(let s of i){s.kind==="Element"&&Du(s,n);let o="children"in s?s.children:void 0;o&&r(o)}};return r(e.children),t}function Du(e,t){if(Ru(e))return;let n=e.tag.toLowerCase();n==="img"&&!pe(e,"alt")&&!Mu(e)&&t(e,"a11y-img-alt",'An `img` needs an `alt`. Use `alt=""` when the image is decorative.'),n==="a"&&!pe(e,"href")&&!pe(e,"role")&&t(e,"a11y-anchor-href","An `a` without `href` is not a link. Use a `button` for an action."),n==="iframe"&&!pe(e,"title")&&t(e,"a11y-iframe-title","An `iframe` needs a `title` describing its content.");let r=wt(e,"tabindex")??wt(e,"tabIndex");r!==void 0&&Number(r)>0&&t(e,"a11y-positive-tabindex","A positive `tabindex` reorders tab navigation for the entire page. Use `0`, or restructure the markup."),!Nu.has(n)&&fs(e,i=>i==="click")&&!pe(e,"role")&&!fs(e,i=>Ou.has(i))&&t(e,"a11y-click-without-keyboard",`A click handler on \`${n}\` is unreachable by keyboard. Use a \`button\`, or add a \`role\` and a key handler.`)}var Iu=/[A-Za-z0-9\-_:@.?]/,ju=class{constructor(e,t){this.diagnostics=[],this.r=new Eu(e),this.svg=t.svg??!1,this.directives=t.directives??hs,this.accessibility=t.accessibility??!0}parse(){let e=this.r.pos(),t=[];for(;!this.r.eof()&&(t.push(...this.parseChildren()),!this.r.eof());){let r=this.r.pos();this.consumeCloseTag(),this.report("stray-close-tag","error","Close tag without a matching open tag",this.r.span(r))}let n={kind:"Root",children:t,loc:this.r.span(e)};return ku(n),this.validateTree(n),this.accessibility&&this.diagnostics.push(...Pu(n)),{root:n,diagnostics:this.diagnostics}}validateTree(e){let t=n=>{let r=null;for(let i of n)i.kind==="Text"&&/^\s*$/.test(i.value)||(i.kind==="Element"||i.kind==="Component"?(i.attributes.some(o=>o.kind==="ElseDirective")&&(r!=null&&(r.kind==="Element"||r.kind==="Component")&&r.attributes.some(c=>c.kind==="IfDirective")||this.report("else-without-if","error","`else` must immediately follow an element with `if`",i.loc)),r=i):r=null,"children"in i&&i.children&&t(i.children))};t(e.children)}parseChildren(){let e=[];for(;!this.r.eof()&&!this.r.startsWith("</");){if(this.r.startsWith("<!--")){e.push(this.parseComment());continue}if(this.isFragmentStart()){e.push(this.parseFragment());continue}if(this.isDynamicTagStart()){e.push(this.parseDynamicComponent());continue}if(this.isTagStart()){e.push(this.parseElement());continue}if(this.r.atHole()){let n=this.r.takeHole(),r={kind:"Expression",hole:n.index,loc:n.loc};e.push(r);continue}let t=this.readText();t&&e.push(t)}return e}isTagStart(){return this.r.peek()==="<"&&/[A-Za-z]/.test(this.r.peek(1))}isFragmentStart(){return this.r.peek()==="<"&&this.r.peek(1)===">"}isDynamicTagStart(){return this.r.peek()==="<"&&this.r.holeFollows()}parseDynamicComponent(){let e=this.r.pos();this.r.advance();let t=this.r.takeHole().index,n=this.parseAttributes(!0);this.r.skipWhitespace();let r=!1,i=[];return this.r.startsWith("/>")?(this.r.advance(),this.r.advance(),r=!0):(this.r.peek()===">"&&this.r.advance(),i=this.parseChildren(),this.r.startsWith("</")?(this.r.advance(),this.r.advance(),this.r.atHole()?this.r.takeHole():this.readName(),this.r.skipWhitespace(),this.r.peek()===">"&&this.r.advance()):this.report("unclosed-tag","error","Unclosed dynamic component",this.r.span(e))),{kind:"Component",tag:"",tagHole:t,attributes:n,children:i,selfClosing:r,loc:this.r.span(e)}}readText(){let e=this.r.pos(),t="";for(;!this.r.eof()&&!this.r.atHole()&&!(this.r.startsWith("</")||this.r.startsWith("<!--")||this.isTagStart()||this.isFragmentStart()||this.isDynamicTagStart());)t+=this.r.advance();return t?{kind:"Text",value:t,raw:!1,loc:this.r.span(e)}:null}parseComment(){let e=this.r.pos();this.r.advance(),this.r.advance(),this.r.advance(),this.r.advance();let t="";for(;!this.r.eof()&&!this.r.startsWith("-->");){if(this.r.atHole()){this.r.takeHole(),t+="\0";continue}t+=this.r.advance()}return this.r.startsWith("-->")?(this.r.advance(),this.r.advance(),this.r.advance()):this.report("unclosed-comment","warning","Unterminated comment",this.r.span(e)),{kind:"Comment",value:t,loc:this.r.span(e)}}parseFragment(){let e=this.r.pos();this.r.advance(),this.r.advance();let t=this.parseChildren();if(this.r.startsWith("</")){let n=this.consumeCloseTag();n&&this.report("mismatched-close-tag","error",`Expected </> to close fragment, got </${n}>`,this.r.span(e))}else this.report("unclosed-tag","error","Unterminated fragment",this.r.span(e));return{kind:"Fragment",children:t,loc:this.r.span(e)}}parseElement(){let e=this.r.pos();this.r.advance();let t=this.readName(),n=Cu(t),r=this.parseAttributes(n);this.foldEachKey(r,e),this.r.skipWhitespace();let i=t.toLowerCase(),s=!n&&$u.has(i),o=!n&&Tu.has(i),c=!1,a=[];if(this.r.startsWith("/>"))this.r.advance(),this.r.advance(),c=!0;else if(this.r.peek()===">"&&this.r.advance(),!o)if(a=s?this.parseRawText(t):this.parseChildren(),this.r.startsWith("</")){let f=this.consumeCloseTag();f&&f!==t&&this.report("mismatched-close-tag","error",`Expected </${t}>, got </${f}>`,this.r.span(e))}else this.report("unclosed-tag","error",`Unclosed <${t}>`,this.r.span(e));let u=this.r.span(e);if(n)return{kind:"Component",tag:t,tagHole:null,attributes:r,children:a,selfClosing:c,loc:u};let l=this.svg||_u.has(t)?"svg":"html";return{kind:"Element",tag:t,namespace:l,attributes:r,children:a,selfClosing:c,rawText:s,loc:u}}parseRawText(e){let t=[],n="</"+e.toLowerCase(),r="",i=this.r.pos(),s=()=>{r&&t.push({kind:"Text",value:r,raw:!0,loc:this.r.span(i)}),r=""};for(;!this.r.eof()&&!this.startsWithCloseFor(n);){if(this.r.atHole()){s();let o=this.r.takeHole();t.push({kind:"Expression",hole:o.index,loc:o.loc}),i=this.r.pos();continue}r||(i=this.r.pos()),r+=this.r.advance()}return s(),t}startsWithCloseFor(e){let t=0;for(;t<e.length;){let n=this.r.peek(t);if(n===""||n.toLowerCase()!==e[t])return!1;t++}return!0}parseAttributes(e){let t=[];for(;!this.r.eof()&&(this.r.skipWhitespace(),!(this.r.peek()===">"||this.r.startsWith("/>")));){if(this.r.atHole()){let c=this.r.takeHole();t.push({kind:"Spread",hole:c.index,loc:c.loc});continue}if(this.r.startsWith("...")){let c=this.r.pos();if(this.r.advance(),this.r.advance(),this.r.advance(),this.r.atHole()){let a=this.r.takeHole();t.push({kind:"Spread",hole:a.index,loc:this.r.span(c)})}else this.report("invalid-binding","error","Spread `...` must be followed by ${…}",this.r.span(c));continue}let n=this.r.pos(),r=this.readName();if(!r){this.r.advance();continue}let i=this.r.span(n);this.r.skipWhitespace();let s=null;this.r.peek()==="="&&(this.r.advance(),this.r.skipWhitespace(),s=this.parseAttrValue());let o={name:r,nameLoc:i,value:s,loc:this.r.span(n),report:(c,a)=>this.report(c,"error",a,this.r.span(n))};t.push(Au(o,this.directives,{component:e}))}return t}parseAttrValue(){if(this.r.atHole())return{kind:"hole",hole:this.r.takeHole().index};let e=this.r.peek();return e==='"'||e==="'"?this.classifyParts(this.readQuotedParts(e)):{kind:"static",value:this.r.readWhile(n=>!/[\s>]/.test(n))}}readQuotedParts(e){this.r.advance();let t=[],n="";for(;!this.r.eof()&&this.r.peek()!==e;){if(this.r.atHole()){n&&(t.push({text:n}),n=""),t.push({hole:this.r.takeHole().index});continue}let r=this.r.advance();if(r==="")break;n+=r}return n&&t.push({text:n}),this.r.peek()===e&&this.r.advance(),t}classifyParts(e){let t=e.filter(n=>"hole"in n);return t.length===0?{kind:"static",value:e.map(n=>"text"in n?n.text:"").join("")}:e.length===1?{kind:"hole",hole:t[0].hole}:{kind:"mixed",parts:e}}foldEachKey(e,t){let n=null,r=0,i=0,s=0,o=0;for(let l of e)l.kind==="EachDirective"?(n=l,i++):l.kind==="IfDirective"?r++:l.kind==="ElseDirective"?s++:l.kind==="RefBinding"&&o++;let c=this.r.span(t);i>1&&this.report("duplicate-directive","error","Multiple `each` directives on one element",c),r>1&&this.report("duplicate-directive","error","Multiple `if` directives on one element",c),o>1&&this.report("duplicate-directive","error","Multiple `ref` bindings on one element",c),r>0&&i>0&&this.report("unsupported-combination","error","`if` and `each` cannot both apply to one element — wrap one in another element",c),r>0&&s>0&&this.report("invalid-directive","error","`if` and `else` cannot be on the same element",c);let a=e.findIndex(l=>l.kind==="Attribute"&&l.name==="key");if(!n){a!==-1&&this.report("invalid-directive","error","`key` requires an `each` directive on the same element",c);return}if(a===-1)return;let u=e[a];u.kind==="Attribute"&&u.value&&(u.value.kind==="static"?n.key={static:u.value.value}:u.value.kind==="hole"&&(n.key={hole:u.value.hole})),e.splice(a,1)}readName(){return this.r.readWhile(e=>Iu.test(e))}consumeCloseTag(){this.r.advance(),this.r.advance();let e=this.readName();return this.r.skipWhitespace(),this.r.peek()===">"&&this.r.advance(),e}report(e,t,n,r){this.diagnostics.push({code:e,severity:t,message:n,loc:r})}};function Tn(e,t={}){return new ju(e,t).parse()}function Lu(e){let t=[],n=0;return e.forEach((r,i)=>{t.push({kind:"static",text:r,start:n}),n+=r.length,i<e.length-1&&t.push({kind:"hole",index:i,start:n,end:n})}),t}function ps(e,t={}){return Tn(Lu(e),t)}function Hu(e){switch(e.kind){case"event":return"event";case"ref":return"ref";case"spread":return"spread";case"class":case"style":return"class-or-style-directive";case"attr":case"prop":return e.reactive?"reactive-prop":e.expr!==void 0?"expression-prop":void 0;default:return"expression-prop"}}function Wu(e){let t=[],n=new Map,r=i=>{switch(i.kind){case"text":return!0;case"expr":return!1;case"component":case"control":for(let s of i.children)r(s);return!1;case"fragment":for(let s of i.children)r(s);return!1;case"element":{let s=!0;for(let c of i.children)r(c)||(s=!1);let o;for(let c of i.props)if(o=Hu(c),o)break;return!o&&!s&&(o=qu(i)),i.static=!o,o?n.set(i,o):t.push(i),i.static}default:return!1}};for(let i of Array.isArray(e)?e:[e])r(i);return{staticElements:t,reasons:n}}function qu(e){for(let t of e.children){if(t.kind==="expr")return"expression-child";if(t.kind==="component")return"component-child";if(t.kind==="control")return"control-child";if(t.kind==="element"&&!t.static||t.kind==="fragment")return"expression-child"}return"expression-child"}var Cn={kind:"eager"},Vu=["pointerdown","focusin","keydown"],ms=new Set(["eager","idle","visible","interaction","media","never"]),St=class extends Error{};function Fu(e,t){let n=e.slice(5);if(!ms.has(n))throw new St(`Unknown load strategy 'load:${n}'. Expected one of ${[...ms].join(", ")}.`);switch(n){case"eager":return Cn;case"idle":return{kind:"idle"};case"never":return{kind:"never"};case"visible":return t?{kind:"visible",rootMargin:t}:{kind:"visible"};case"interaction":return{kind:"interaction",events:t?Bu(t):[...Vu]};case"media":if(!t)throw new St(`'load:media' needs a query, e.g. load:media="(min-width: 1024px)".`);return{kind:"media",query:t};default:throw new St(`Unhandled load strategy '${n}'.`)}}function Bu(e){let t=e.split(/[\s,]+/).map(n=>n.trim()).filter(Boolean);if(t.length===0)throw new St("'load:interaction' was given no event names.");return t}function Uu(e){return e.kind!=="eager"&&e.kind!=="never"}var Nn=["Show","For","Index","Switch","Match","Portal","Dynamic","ErrorBoundary"],On=["Suspense","SuspenseList","Await"],Rn=["Router","Outlet","Redirect","Link"],Nf=[...Nn,...On,...Rn],ys=new Set([...Nn,...On]);function zu(e={}){let{controlFlowModule:t="@fluixi/dom",coreModule:n="@fluixi/core",routerModule:r="@fluixi/core/router"}=e,i={};for(let s of Nn)i[s]=t;for(let s of On)i[s]=n;for(let s of Rn)i[s]=r;return i}function Ku(e,t={}){let{resolver:n,isBound:r,modules:i,strategyFor:s}=t,o=zu(i),c=new Map,a=new Set,u=f=>{let{name:d}=f;if(!d||d.includes(".")||r?.(d))return;let y=l(d);if(!y){a.add(d);return}let b=y.origin==="builtin"&&ys.has(d)?Cn:s?.(f)??Cn;f.source={...y,loading:b},c.set(d,f.source)},l=f=>{if(ys.has(f))return{module:o[f],export:f,origin:"builtin"};let d=n?.resolve(f);if(d)return{module:d.module,export:d.export,origin:"rule"};if(Rn.includes(f))return{module:o[f],export:f,origin:"builtin"}};return Mn(e,f=>{f.kind==="component"&&u(f)}),{resolved:c,unresolved:[...a]}}function Mn(e,t){let n=Array.isArray(e)?e:[e];for(let r of n){t(r);let i=r.children;i&&Mn(i,t)}}function Ju(e){let t=[];Mn(e,s=>{s.kind==="component"&&s.source&&t.push(s)});let n=new Set,r=new Set;for(let s of t){let{module:o,loading:c}=s.source;c.kind==="eager"&&n.add(o),c.kind==="never"&&r.add(o)}let i=new Map;for(let s of t){let o=s.source;Uu(o.loading)&&n.has(o.module)&&(o.loading={kind:"eager"},i.set(o.module,(i.get(o.module)??0)+1))}return{collapsed:i,conflicted:[...r].filter(s=>n.has(s))}}var Gu=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Es={className:"class",htmlFor:"for"},Xu=new Set(["innerHTML","outerHTML","innerText","textContent","value","checked","selected","muted","defaultValue","defaultChecked","children","ref"]),Yu=new Set(["script","style","textarea","title"]);function As(e){return Yu.has(e)}function Zu(e){return Es[e]??e}function Pn(e){return e.kind!=="attr"||e.expr!==void 0||e.name.includes(":")?!1:!Xu.has(e.name)}function _s(e){if(!e.static||As(e.tag))return!1;for(let t of e.props)if(!Pn(t))return!1;for(let t of e.children)if(t.kind!=="text"&&!(t.kind==="element"&&_s(t)))return!1;return!0}function Dn(e){let t=e.props.map(el).filter(Boolean).join(""),n=`<${e.tag}${t}>`;return Gu.has(e.tag)?n:`${n}${e.children.map(Qu).join("")}</${e.tag}>`}function Qu(e){if(e.kind==="text")return nl(e.value);if(e.kind!=="element")throw new Error(`serializeStatic: unexpected ${e.kind}`);return Dn(e)}function el(e){let t=Es[e.name]??e.name,n=e.literal;return n===!0||n===void 0?` ${t}`:n===!1||n===null?"":` ${t}="${tl(String(n))}"`}function tl(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function nl(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function vs(e){let t=[],n,r=i=>{n??=i.at?.file,t.push(i.at?.line??0,i.at?.column??0);for(let s of i.children)s.kind==="element"&&r(s)};return r(e),n&&t.some(i=>i!==0)?{file:n,pos:t}:void 0}var rl="<!--fx-->",il="<!--fx/-->";function Et(e){return e.kind==="expr"||e.kind==="component"||e.kind==="control"}function sl(e){return e.kind==="text"||e.kind==="element"&&$s(e)}function $s(e){return e.svg||As(e.tag)||!e.props.every(t=>Pn(t))?!1:e.children.every(t=>sl(t)||Et(t))}function kt(e){if(Et(e))return!0;let t=e.children;return t?t.some(kt):!1}function Ts(e){for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.kind==="text"&&(n.value===""||e.children[t+1]?.kind==="text"))return!1}return e.children.every(t=>t.kind!=="element"||Ts(t))}function ol(e){if(!$s(e)||!Ts(e)||!e.children.some(kt))return null;let t=[],n=[],r=0,i=o=>{let c=`_n$${r++}`;return t.push({ref:c,expr:o}),c};return s(e,"_el$"),{html:cl(e),tag:e.tag,steps:t,holes:n};function s(o,c){let a=-1;o.children.forEach((l,f)=>{kt(l)&&(a=f)});let u=null;for(let l=0;l<=a;l++){let f=o.children[l],d=u?`${u}.nextSibling`:`${c}.firstChild`;if(Et(f)){let b=i(d),v=i(`holeEnd(${b})`);n.push({parentRef:c,startRef:b,endRef:v,node:f}),u=v;continue}let y=i(d);f.kind==="element"&&kt(f)&&s(f,y),u=y}}}function cl(e){return Dn(Cs(e)).split(Ns).join(rl+il)}function Cs(e){return{...e,children:e.children.map(t=>Et(t)?{kind:"text",value:Ns}:t.kind==="element"?Cs(t):t)}}var Ns="\0fx-hole\0",Os={version:1,module:"@fluixi/dom",symbols:["createNativeElement","insert","spread","setAttribute","delegateEvents","createComponent","createMemo","untrack","Show","For","Index","Switch","Match","Dynamic","ErrorBoundary"]},Of={version:2,module:"@fluixi/dom",symbols:[...Os.symbols,"template","cloneTemplate","walk"]},ne="@fluixi/reactive/signal",al={$signal:{export:"signal",module:ne,returns:"signal-handle"},$memo:{export:"memo",module:ne,returns:"memo-handle"},$effect:{export:"effect",module:ne,returns:"effect"},$store:{export:"store",module:"@fluixi/reactive/store",returns:"store-handle"},$resource:{export:"resource",module:ne,returns:"resource-handle"},$selector:{export:"createSelector",module:ne,returns:"memo-accessor"},$deferred:{export:"createDeferred",module:ne,returns:"memo-accessor"},$untrack:{export:"untrack",module:ne,returns:"plain"},$untrackStore:{export:"untrackStore",module:"@fluixi/reactive/store",returns:"plain"}},Rf=new RegExp(`\\$(?:${Object.keys(al).map(e=>e.slice(1)).join("|")})\\s*\\(`),ul="__fx_source",ll="__fx_hole",xt=(e,t,n,r)=>`(globalThis.${ll} ?? ((f) => f))(${e},${t},${n}${r===void 0?"":`,${JSON.stringify(r)}`})`,fl="__fx_props",dl=(e,t)=>`(globalThis.${fl} ?? ((p) => p))(${e},${JSON.stringify(t)})`;function Rs(e,t){let n=e[t];for(let r=t+1;r<e.length;r++){let i=e[r];if(i==="\\")r++;else{if(i===n)return r+1;if(i===`
|
|
3
|
+
`)return-1}}return-1}function Ms(e,t){let n=t+1;for(;n<e.length;){let r=e[n];if(r==="\\")n+=2;else{if(r==="`")return n+1;if(r==="$"&&e[n+1]==="{"){let i=1;for(n+=2;n<e.length&&i>0;){let s=e[n];if(s==="\\")n+=2;else if(s==="`"){let o=Ms(e,n);if(o<0)return-1;n=o}else if(s==='"'||s==="'"){let o=Rs(e,n);if(o<0)return-1;n=o}else s==="{"?i++:s==="}"&&i--,n++}}else n++}}return-1}function hl(e,t){let n=!1;for(let r=t+1;r<e.length;r++){let i=e[r];if(i==="\\")r++;else if(i==="[")n=!0;else if(i==="]")n=!1;else{if(i===`
|
|
4
|
+
`)return-1;if(i==="/"&&!n){let s=r+1;for(;s<e.length&&/[a-z]/i.test(e[s]);)s++;return s}}}return-1}function pl(e){return e!==""&&/[A-Za-z0-9_$)\]]/.test(e)}function ml(e){let t=0,n="",r=0;for(;r<e.length;){let i=e[r];if(i==='"'||i==="'"){let s=Rs(e,r);if(s<0)return null;r=s,n=i}else if(i==="`"){let s=Ms(e,r);if(s<0)return null;r=s,n=i}else{if(i==="/"&&e[r+1]==="/")return null;if(i==="/"&&e[r+1]==="*"){let s=e.indexOf("*/",r+2);if(s<0)return null;r=s+2}else if(i==="/"&&!pl(n)){let s=hl(e,r);if(s<0)return null;r=s,n="/"}else{if(i==="("||i==="["||i==="{")t++;else if(i===")"||i==="]"||i==="}"){if(t--,t<0)return null}else if(i===","&&t===0)return!0;/\s/.test(i)||(n=i),r++}}}return t===0?!1:null}function C(e,t){let n=e.trim();return n===""?`(${e})`:t==="arrowBody"&&n[0]==="{"?`(${e})`:ml(n)===!1?e:`(${e})`}var yl={show:"Show",for:"For",index:"Index",switch:"Switch",match:"Match",dynamic:"Dynamic",errorBoundary:"ErrorBoundary",suspense:"Suspense"};function vl(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function Ps(e){return vl(e)?e:JSON.stringify(e)}function gl(e){if(e.expr!==void 0){if(e.name==="ref"&&e.at)return xt(C(e.expr,"value"),e.at.line,e.at.column,e.expr);if(!e.reactive)return C(e.expr,"value");let t=`() => ${C(e.expr,"arrowBody")}`;return e.at?xt(t,e.at.line,e.at.column,e.directive):t}return JSON.stringify(e.literal??!0)}function bl(e){return e.expr!==void 0?C(e.expr,"value"):JSON.stringify(e.literal??!0)}function wl(e,t,n){let r=e.filter(c=>c.kind==="spread"),s=e.filter(c=>c.kind!=="spread").map(c=>`${Ps(c.name)}: ${gl(c)}`);t!=null&&s.push(`children: ${t}`);let o=`{ ${s.join(", ")} }`;return r.length>0?(n.add("mergeProps"),`mergeProps(${r.map(c=>c.expr).join(", ")}, ${o})`):o}function gs(e,t){return t?xt(e,t.line,t.column):e}function Ds(e,t,n){return e.length===1?De(e[0],t,n):`[${e.map(r=>De(r,t,n)).join(", ")}]`}function bs(e,t,n,r,i,s){r.add("createMemo"),r.add("createComponent");let o=t.filter(d=>d.kind==="spread"),c=t.filter(d=>d.kind!=="spread"),a=c.map(d=>`get ${Ps(d.name)}() { return ${bl(d)}; }`);n.length>0&&a.push(`get children() { return ${Ds(n,r,i)}; }`);let u=`{ ${a.join(", ")} }`;o.length>0&&(r.add("mergeProps"),u=`mergeProps(${o.map(d=>d.expr).join(", ")}, ${u})`);let l={};for(let d of c)d.at&&(l[d.name]=[d.at.line,d.at.column]);Object.keys(l).length&&(u=dl(u,l));let f=s?`globalThis.${ul}?.(${JSON.stringify(s.file)},${s.line},${s.column},${JSON.stringify(e)}), `:"";return`createMemo(${C(`${f}() => createComponent(${e}, ${u})`,"value")})`}function Sl(e,t){let n=Zu(t.name),r=t.literal;return r===!0||r===void 0?`${e}.setAttribute(${JSON.stringify(n)}, "");`:r===!1||r===null?"":`${e}.setAttribute(${JSON.stringify(n)}, ${JSON.stringify(String(r))});`}var Is=!1;function De(e,t,n){switch(e.kind){case"text":return JSON.stringify(e.value);case"expr":{if(!e.reactive)return C(e.code,"value");let r=`() => ${C(e.code,"arrowBody")}`;return e.at?xt(r,e.at.line,e.at.column):r}case"fragment":return e.children.length===0?"null":Ds(e.children,t,n);case"component":return gs(bs(e.name,e.props,e.children,t,n,e.at),e.bindAt??e.at);case"control":{let r=yl[e.control]??e.control;return t.add(r),gs(bs(r,e.props,e.children,t,n),e.bindAt)}case"element":{if(n&&e.static&&!e.svg&&_s(e)){t.add("templateNode");let c=`_tmpl$${n.length}`;n.push({id:c,html:Dn(e),tag:e.tag,svg:!1});let a=vs(e);return a?`templateNode(${c}, ${JSON.stringify(e.tag)}, false, false, ${JSON.stringify(a)})`:`templateNode(${c}, ${JSON.stringify(e.tag)})`}if(n&&Is){let c=ol(e);if(c){t.add("templateNode"),t.add("insert"),t.add("holeEnd"),t.add("holeContent"),t.add("holeScope");let a=`_tmpl$${n.length}`;n.push({id:a,html:c.html,tag:c.tag,svg:!1});let u=vs(e),l=[`const _el$ = templateNode(${a}, ${JSON.stringify(c.tag)}, true${u?`, false, ${JSON.stringify(u)}`:""});`];for(let f of c.steps)l.push(`const ${f.ref} = ${f.expr};`);for(let f of c.holes)l.push(`insert(${f.parentRef}, holeScope(${f.startRef}, () => ${C(De(f.node,t,n),"arrowBody")}), ${f.endRef}, holeContent(${f.startRef}, ${f.endRef}));`);return l.push("return _el$;"),`(() => { ${l.join(" ")} })()`}}t.add("createNativeElement");let r=JSON.stringify(e.tag),i="_el$",s=[],o=e.at?`${r}, ${e.svg}, ${JSON.stringify(e.at)}`:e.svg?`${r}, true`:r;if(s.push(`const ${i} = createNativeElement(${o});`),e.props.length>0)if(!e.svg&&e.props.every(Pn))for(let c of e.props)s.push(Sl(i,c));else{t.add("spread");let c=e.svg?", isSVG: true":"",a=e.tag.includes("-")?", isCustomElement: true":"";s.push(`spread({ element: ${i}, props: ${wl(e.props,null,t)}${c}${a} });`)}for(let c of e.children){t.add("insert");let a=De(c,t,n),u=c.kind==="expr"&&c.reactive||c.kind==="component"||c.kind==="control";s.push(u?`insert(${i}, ${a}, null);`:`insert(${i}, ${a});`)}return s.push(`return ${i};`),`(() => { ${s.join(" ")} })()`}}}function js(e,t){if(!t||t.length===0)return e;let n=new Map(t.map(r=>[r.id,JSON.stringify(r.html)]));return e.replace(/_tmpl\$\d+/g,r=>n.get(r)??r)}var Ls={name:"imperative",contract:Os,emit(e,t){let n=new Set,r=t?.templateClone!==!1?[]:void 0;return Is=t?.partialTemplates===!0,{code:De(e,n,r),imports:Array.from(n),templates:r}}},kl=e=>"components"in e;function ws(e,t){return e.replace(/\$(\d+)/g,(n,r)=>t[Number(r)]??n)}function xl(e,t){return typeof t=="string"?{module:t,export:e}:t}function El(e=[]){let t=new Map,n=[],r=[];for(let o of e){if(!kl(o)){r.push(o);continue}for(let[c,a]of Object.entries(o.components)){let u=xl(c,a),l=t.get(c);if(l&&l.module!==u.module){let f=n.find(d=>d.name===c);f?f.modules.push(u.module):n.push({name:c,modules:[l.module,u.module]});continue}t.set(c,u)}}let i=new Map;return{resolve:o=>{if(i.has(o))return i.get(o);let c=t.get(o);if(!c)for(let a of r){let u=o.match(new RegExp(a.match.source,a.match.flags.replace("g","")));if(u){c={module:ws(a.module,u),export:a.export?ws(a.export,u):o};break}}return i.set(o,c),c},names:()=>[...t.keys()],conflicts:()=>n}}function Ss(e){let t=e.split(/\r\n|\n|\r/),n=0;for(let i=0;i<t.length;i++)/[^ \t]/.test(t[i])&&(n=i);let r="";for(let i=0;i<t.length;i++){let s=t[i].replace(/\t/g," ");i!==0&&(s=s.replace(/^ +/,"")),i!==t.length-1&&(s=s.replace(/ +$/,"")),s&&(i!==n&&(s+=" "),r+=s)}return r}var ks=new Set(["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup"]);function Al(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function xs(e){return e.charAt(0).toUpperCase()+e.slice(1)}var _l=class{constructor(e,t,n,r){this.holes=e,this.used=t,this.sourceFile=n,this.positionAt=r}tagAt(e){let t=e.loc?.start;if(!this.sourceFile||!this.positionAt||t==null)return;let{line:n,column:r}=this.positionAt(t);return{file:this.sourceFile,line:n,column:r}}hole(e){return this.holes[e]??{code:"undefined",reactive:!1}}emit(e){let{code:t,imports:n,templates:r}=Ls.emit(e,{});for(let i of n)this.used.add(i);return js(t,r)}lowerRoot(e){let t=this.lowerChildren(e);return t.length===1?t[0]:{kind:"fragment",children:t}}lowerChildren(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(r.kind==="Element"||r.kind==="Component"){let s=r.attributes.find(o=>o.kind==="IfDirective");if(s&&s.kind==="IfDirective"){let o=n+1;o<e.length&&this.isBlankText(e[o])&&o++;let c=e[o],a=c&&(c.kind==="Element"||c.kind==="Component")&&c.attributes.some(u=>u.kind==="ElseDirective");t.push(this.lowerIf(r,s.hole,a?c:null)),a&&(n=o);continue}if(r.attributes.some(o=>o.kind==="EachDirective")){t.push(this.lowerEach(r));continue}}let i=this.lowerNode(r);i&&t.push(i)}return t}isBlankText(e){return e.kind==="Text"&&!e.raw&&Ss(e.value)===""}lowerNode(e){switch(e.kind){case"Text":{if(e.raw)return{kind:"text",value:e.value};let t=Ss(e.value);return t?{kind:"text",value:t}:null}case"Comment":return null;case"Expression":{let t=this.hole(e.hole);return{kind:"expr",code:t.code,reactive:t.reactive,...t.at?{at:t.at}:{}}}case"Fragment":return{kind:"fragment",children:this.lowerChildren(e.children)};case"Element":return this.lowerElement(e);case"Component":return this.lowerComponent(e);default:return null}}lowerElement(e){let t=e.attributes.find(r=>r.kind==="Attribute"&&r.name==="is");if(e.tag==="component"&&t&&t.value&&t.value.kind==="hole"){let r=e.attributes.filter(s=>s!==t),i=this.lowerComponent({...e,kind:"Component",tag:"Dynamic",tagHole:null,attributes:r});return i.props.unshift({name:"component",kind:"attr",expr:`() => ${C(this.hole(t.value.hole).code,"arrowBody")}`}),i}let n=this.tagAt(e);return{kind:"element",tag:e.tag,svg:e.namespace==="svg",props:this.lowerAttributes(e.attributes),children:this.lowerChildren(e.children),static:!1,...n?{at:n}:{}}}lowerComponent(e){let t=e.tagHole!=null?this.hole(e.tagHole).code:e.tag,n=this.lowerAttributes(e.attributes),{slots:r,rest:i}=this.partitionSlots(e.children);for(let[u,l]of r){let f=l.length===1?l[0]:{kind:"fragment",children:l},d={name:u,kind:"attr",expr:this.emit(f),jsxElement:!0},y=n.findIndex(b=>b.name===u);y>=0?n[y]=d:n.push(d)}let s=e.attributes.find(u=>u.kind==="LoadDirective"),o=s?Fu(`load:${s.strategy}`,s.modifier):void 0,c=n.find(u=>u.at&&u.reactive)?.at,a=this.tagAt(e);return{kind:"component",name:t,props:n,children:this.lowerChildren(i),...a?{at:a}:{},...c?{bindAt:c}:{},...o?{load:o}:{}}}partitionSlots(e){let t=new Map,n=[];for(let r of e){if(r.kind==="Element"||r.kind==="Component"){let i=r.attributes.find(s=>s.kind==="Attribute"&&s.name==="slot");if(i&&i.value&&i.value.kind==="static"){let s={...r,attributes:r.attributes.filter(a=>a!==i)},o=s.kind==="Element"?this.lowerElement(s):this.lowerComponent(s),c=t.get(i.value.value)??[];c.push(o),t.set(i.value.value,c);continue}}n.push(r)}return{slots:t,rest:n}}lowerIf(e,t,n){let r=this.hole(t),i=[{name:"when",kind:"attr",expr:r.code,reactive:r.reactive,...r.at?{at:r.at}:{}}];if(n){let c=this.stripAndLower(n,a=>a.kind==="ElseDirective");i.push({name:"fallback",kind:"attr",expr:this.emit(c),jsxElement:!0})}let s=this.stripAndLower(e,c=>c.kind==="IfDirective"),o=this.tagAt(e);return{kind:"component",name:"Show",props:i,children:[s],...o?{at:o}:{},...r.at?{bindAt:r.at}:{}}}lowerEach(e){let t=e.attributes.find(a=>a.kind==="EachDirective");if(!t||t.kind!=="EachDirective")return this.lowerNode(e);let n=this.hole(t.hole),r=[{name:"each",kind:"attr",expr:n.code,reactive:n.reactive,...n.at?{at:n.at}:{}}];if(t.key){let a="static"in t.key?`(item) => item[${JSON.stringify(t.key.static)}]`:this.hole(t.key.hole).code;r.push({name:"by",kind:"attr",expr:a})}let i=this.itemArrow(e),s;if(i){let a={kind:"expr",code:i.body,reactive:i.bodyReactive},u=this.rebuildWithChildren(e,[a]);s=`(${i.params.join(", ")}) => ${C(this.emit(u),"arrowBody")}`}else{let a=this.stripAndLower(e,u=>u.kind==="EachDirective");s=`() => ${C(this.emit(a),"arrowBody")}`}let o=[{kind:"expr",code:s,reactive:!1}],c=this.tagAt(e);return{kind:"component",name:"For",props:r,children:o,...c?{at:c}:{},...n.at?{bindAt:n.at}:{}}}itemArrow(e){let t=e.children.filter(n=>!this.isBlankText(n));return t.length!==1||t[0].kind!=="Expression"?null:this.hole(t[0].hole).arrow??null}stripAndLower(e,t){let n={...e,attributes:e.attributes.filter(r=>!t(r))};return n.kind==="Element"?this.lowerElement(n):this.lowerComponent(n)}rebuildWithChildren(e,t){let n=this.lowerAttributes(e.attributes.filter(r=>r.kind!=="EachDirective"));if(e.kind==="Element"){let r=this.tagAt(e);return{kind:"element",tag:e.tag,svg:e.namespace==="svg",props:n,children:t,static:!1,...r?{at:r}:{}}}return{kind:"component",name:e.tag,props:n,children:t}}lowerAttributes(e){let t=[],n=[],r=!1,i,s=[],o=!1,c,a=[];for(let u of e)switch(u.kind){case"IfDirective":case"EachDirective":case"ElseDirective":break;case"Attribute":t.push(this.plainAttr(u));break;case"PropertyBinding":t.push({name:u.name,kind:"prop",expr:this.hole(u.hole).code,reactive:this.hole(u.hole).reactive,...this.hole(u.hole).at?{at:this.hole(u.hole).at}:{}});break;case"EventBinding":t.push(this.eventProp(u));break;case"RefBinding":t.push({name:"ref",kind:"ref",expr:this.hole(u.hole).code,reactive:this.hole(u.hole).reactive,...this.hole(u.hole).at?{at:this.hole(u.hole).at}:{}});break;case"Spread":t.push({name:"",kind:"spread",expr:this.hole(u.hole).code});break;case"ClassDirective":{let l=this.hole(u.hole);n.push(`${JSON.stringify(u.name)}: ${l.code}`),r=r||l.reactive,i??=l.at;break}case"StyleDirective":{let l=this.hole(u.hole);s.push(`${JSON.stringify(u.name)}: ${l.code}`),o=o||l.reactive,c??=l.at;break}case"BindDirective":t.push(...this.bindProps(u.name,this.hole(u.hole)));break;case"UseDirective":{let l=u.name??(u.hole!=null?this.hole(u.hole).code:null);if(!l)break;a.push(u.name!=null&&u.hole!=null?`[${l}, () => ${C(this.hole(u.hole).code,"arrowBody")}]`:`[${l}]`);break}}return n.length>0&&t.push({name:"classList",kind:"attr",expr:`{ ${n.join(", ")} }`,reactive:r,...i?{at:i}:{}}),s.length>0&&t.push({name:"style",kind:"attr",expr:`{ ${s.join(", ")} }`,reactive:o,...c?{at:c}:{}}),a.length>0&&t.push({name:"use",kind:"attr",expr:`[${a.join(", ")}]`}),t}eventProp(e){let t=e.name.toLowerCase(),n=this.hole(e.hole).code;if(!(e.syntax==="colon"||e.modifiers.length>0))return{name:"on"+xs(e.name),kind:"event",event:{name:t,delegated:ks.has(t)},expr:n};let i=this.wrapHandler(n,e.modifiers),s=this.eventOptions(e.modifiers),o=s?`[${i}, ${s}]`:i;return{name:"on:"+t,kind:"attr",expr:o}}wrapHandler(e,t){let n=t.includes("self")?"if (e.target !== e.currentTarget) return; ":"",r=[];return t.includes("prevent")&&r.push("e.preventDefault();"),t.includes("stop")&&r.push("e.stopPropagation();"),!n&&r.length===0?e:`(e) => { ${n}${r.join(" ")} return (${e})(e); }`}eventOptions(e){let t=[];return e.includes("capture")&&t.push("capture: true"),e.includes("once")&&t.push("once: true"),e.includes("passive")&&t.push("passive: true"),t.length?`{ ${t.join(", ")} }`:null}bindProps(e,t){let n=t.code,r=e==="checked",i=r?"change":"input",s=r?"checked":"value";this.used.add("bindPair");let o=`bindPair(${n})`;return[{name:e,kind:"attr",expr:`${o}[0]()`,reactive:!0,directive:`bind:${e}`,...t.at?{at:t.at}:{}},{name:"on"+xs(i),kind:"event",event:{name:i,delegated:ks.has(i)},expr:`(e) => ${o}[1](e.target.${s})`}]}plainAttr(e){let t=e.value,n=e.name;e.name==="class"?n=t&&t.kind==="hole"&&this.hole(t.hole).object?"classList":"className":e.name==="html"&&(n="innerHTML");let i={name:n,kind:"attr"};if(t==null)return i.literal=!0,i;if(t.kind==="static")return i.literal=t.value,i;if(t.kind==="hole"){let a=this.hole(t.hole);return i.expr=a.code,i.reactive=a.reactive,a.at&&(i.at=a.at),i}let s=!1,o,c=t.parts.map(a=>{if("text"in a)return Al(a.text);let u=this.hole(a.hole);return s=s||u.reactive,o??=u.at,"${"+u.code+"}"}).join("");return i.expr="`"+c+"`",i.reactive=s,o&&(i.at=o),i}};function $l(e,t,n,r={}){let{root:i}=Tn(e,{svg:r.svg});return new _l(t,n,r.sourceFile,r.positionAt).lowerRoot(i.children)}function Tl(e){let t=[],n=0;return e.statics.forEach((r,i)=>{if(t.push({kind:"static",text:r,start:n}),n+=r.length,i<e.holes.length){let s=n+e.holes[i].code.length;t.push({kind:"hole",index:i,start:n,end:s}),n=s}}),t}function Hs(e,t={}){if(e.statics.length!==e.holes.length+1)throw new Error(`[fluixi] compileTemplate: ${e.statics.length} static runs for ${e.holes.length} holes — a template always has exactly one more.`);return Cl(Tl(e),e.holes,t)}function Cl(e,t,n={}){let r=new Set,i=$l(e,[...t],r,{svg:n.svg,...n.sourceFile?{sourceFile:n.sourceFile}:{},...n.positionAt?{positionAt:n.positionAt}:{}});Wu(i),Ku(i,{resolver:El(n.resolve??[]),modules:{controlFlowModule:n.controlFlowModule??"@fluixi/dom",coreModule:n.coreModule??"@fluixi/core",routerModule:n.routerModule??"@fluixi/core/router"},strategyFor:a=>a.load}),Ju(i);let{code:s,imports:o,templates:c}=Ls.emit(i,{templateClone:n.templateClone,partialTemplates:n.partialTemplates});for(let a of o)r.add(a);return n.hoistTemplates?{code:s,imports:[...r],ir:i,templates:c}:{code:js(s,c),imports:[...r],ir:i}}function Nl(e,t){switch(e.kind){case"Attribute":if(e.value&&e.value.kind==="hole")t.set(e.value.hole,"attr");else if(e.value&&e.value.kind==="mixed")for(let n of e.value.parts)"hole"in n&&t.set(n.hole,"attr");return;case"PropertyBinding":t.set(e.hole,"attr");return;case"BindDirective":t.set(e.hole,"bind");return;case"EventBinding":t.set(e.hole,"event");return;case"RefBinding":t.set(e.hole,"ref");return;case"Spread":t.set(e.hole,"spread");return;case"IfDirective":t.set(e.hole,"control");return;case"EachDirective":t.set(e.hole,"control"),e.key&&"hole"in e.key&&t.set(e.key.hole,"attr");return;default:return}}function In(e,t,n){for(let r of e)switch(r.kind){case"Expression":t.has(r.hole)||t.set(r.hole,"text");break;case"Element":case"Component":{r.kind==="Component"&&(r.tagHole!==null?t.set(r.tagHole,"component"):r.tag&&n.add(r.tag.split(".")[0]));let i=r.attributes.some(s=>s.kind==="EachDirective");for(let s of r.attributes)Nl(s,t);if(i)for(let s of r.children)s.kind==="Expression"&&t.set(s.hole,"render");In(r.children,t,n);break}case"Root":case"Fragment":In(r.children,t,n);break;default:break}}function Ws(e){let t=new Map,n=new Set;return In(e.root.children,t,n),{holes:t,components:n}}var jn={...$n,createMemo:Vt},Ol=["For","Index","Show","Switch","Match","Portal","Dynamic","ErrorBoundary","Suspense"],Ln=new Map;function Vs(e){for(let[t,n]of Object.entries(e))Ln.set(t,n)}function Rl(e){return e==="text"||e==="attr"||e==="control"}function Ml(e,t){return e.map((n,r)=>{let i=t.get(r)??"text";return i==="render"?{code:`$$v[${r}]`,reactive:!1,arrow:{params:["$$item"],body:`$$v[${r}]($$item)`,bodyReactive:!1}}:typeof n=="function"&&Rl(i)?{code:`$$v[${r}]()`,reactive:!0}:{code:`$$v[${r}]`,reactive:!1}})}function Pl(e){if(Ln.has(e))return Ln.get(e);let t=globalThis[e];if(t!==void 0)return t;throw new Error(`[fluixi] <${e}> is not defined. Pass it as a hole — <\${${e}} /> — or register it with define({ ${e} }).`)}function Dl(e,t,n){let r=e,i=ps(r,{svg:n}),s=i.diagnostics.filter(v=>v.severity==="error");if(s.length>0)throw new Error(`[fluixi] ${n?"svg":"html"}\`\`: ${s.map(v=>v.message).join("; ")}`);let{holes:o,components:c}=Ws(i),{code:a,imports:u}=Hs({statics:r,holes:Ml(t,o)},{svg:n}),l=u.filter(v=>!(v in jn));if(l.length>0)throw new Error(`[fluixi] no runtime binding for: ${l.join(", ")}`);let f=Array.from(new Set([...u,...Ol])).filter(v=>v in jn),d=Array.from(c).filter(v=>!f.includes(v)),y=[...f,...d],b=new Function(...y,"$$v",`return (${a});`);return{run:v=>b(...f.map(_=>jn[_]),...d.map(Pl),v)}}var qs=new WeakMap;function Il(e){let t="";for(let n of e)t+=typeof n=="function"?"f":"v";return t}function Fs(e){return(t,...n)=>{let r=qs.get(t);r||(r=new Map,qs.set(t,r));let i=Il(n),s=r.get(i);return s||(s=Dl(t,n,e),r.set(i,s)),s.run(n)}}var Bs=Fs(!1),Us=Fs(!0);return Ys(jl);})();
|