@fluixi/template-runtime 1.0.0-alpha.108 → 1.0.0-alpha.110
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.global.js +4 -4
- package/dist/chunk-XGVU6L2C.mjs +79 -0
- package/dist/classify.mjs +3 -75
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +4 -79
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +8 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/template-runtime v1.0.0-alpha.
|
|
2
|
-
"use strict";var Fluixi=(()=>{var Ft=Object.defineProperty;var nc=Object.getOwnPropertyDescriptor;var rc=Object.getOwnPropertyNames;var ic=Object.prototype.hasOwnProperty;var yr=(e,t)=>{for(var n in t)Ft(e,n,{get:t[n],enumerable:!0})},sc=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rc(t))!ic.call(e,i)&&i!==n&&Ft(e,i,{get:()=>t[i],enumerable:!(r=nc(t,i))||r.enumerable});return e};var oc=e=>sc(Ft({},"__esModule",{value:!0}),e);var vd={};yr(vd,{Dynamic:()=>Gn,ErrorBoundary:()=>Xn,For:()=>zn,Index:()=>Un,Match:()=>Kn,Portal:()=>Yn,Show:()=>Fn,Switch:()=>Jn,batch:()=>ee,define:()=>Xo,effect:()=>xi,html:()=>Qo,hydrate:()=>Fe,insert:()=>I,memo:()=>Si,onCleanup:()=>Te,render:()=>Ve,resource:()=>ki,signal:()=>wi,store:()=>Ci,svg:()=>ec,untrack:()=>ge});var Qn={};yr(Qn,{ALWAYS_ATTRIBUTE:()=>Zi,ClientOnly:()=>Xs,Dynamic:()=>Gn,ErrorBoundary:()=>Xn,FX_DATA_ID:()=>Bn,For:()=>zn,HYDRATION_KEY:()=>re,Index:()=>Un,Island:()=>pl,JSX_PROPERTIES:()=>yn,Match:()=>Kn,NoSsr:()=>Sl,Portal:()=>Yn,SERVER_PROPS:()=>Yi,SVG_ELEMENTS:()=>Wa,SVG_NAMESPACE:()=>kn,Show:()=>Fn,Switch:()=>Jn,VERSION:()=>cs,VERSION_ATTRIBUTE:()=>as,VOID_ELEMENTS:()=>qa,addClass:()=>Qi,addDelegatedEventListener:()=>Rn,addNativeEventListener:()=>jn,appendChildren:()=>os,appendResponseHeader:()=>fu,applyElementProp:()=>mn,applyProps:()=>Wn,applyUse:()=>Hn,asComponent:()=>Nn,asContext:()=>Nu,asOutlet:()=>Cu,asProvider:()=>Tu,asRoute:()=>Ou,asRouter:()=>_u,asRoutes:()=>$u,asSuspense:()=>Ru,beginAppHydration:()=>gu,bindPair:()=>Bs,captureHydrationCursor:()=>yu,checkRenderType:()=>Mu,classMap:()=>xl,cleanChildren:()=>G,clearHydrationKeys:()=>ks,cloneTemplate:()=>Ln,closest:()=>Fa,createComponent:()=>Dt,createDynamicElement:()=>Ys,createElement:()=>is,createNativeElement:()=>Pt,createPortal:()=>qs,createRequestContext:()=>An,createTemplate:()=>Mn,css:()=>bl,default:()=>Fl,deferElement:()=>Pu,delegate:()=>Ya,delegateEvents:()=>Mt,endAppHydration:()=>bu,endRequestContext:()=>_n,escapeFxJson:()=>zs,escapeHTML:()=>tl,fnName:()=>Ku,generateID:()=>ju,getAttribute:()=>ns,getGlobal:()=>su,getLocals:()=>lu,getOffset:()=>Ga,getRequestContext:()=>X,getRequestEvent:()=>On,getRequestLocals:()=>ms,getServerData:()=>Us,getStableElementId:()=>Lu,getStyle:()=>Ua,handleRef:()=>Be,hasClass:()=>za,holeContent:()=>In,holeEnd:()=>Dn,holeScope:()=>Pn,html:()=>vl,hydrate:()=>Fe,hydrateAdvancePast:()=>Tn,hydrateChildren:()=>hl,hydrateIslands:()=>yl,indexArray:()=>nt,initializeIntegration:()=>sl,insert:()=>I,insertExpression:()=>Ie,intergartionInitialized:()=>ol,isAccessor:()=>nl,isAppHydrationPending:()=>wu,isAttributeOnlyName:()=>yt,isComponent:()=>B,isContext:()=>Ns,isCustomElement:()=>Gi,isDOMNode:()=>ru,isDelegatedEvent:()=>Vu,isDomElement:()=>Ki,isDomNode:()=>We,isDomText:()=>Ji,isEventHandler:()=>ja,isFunction:()=>Fu,isIntegrationInitialized:()=>Vs,isJSXTemplate:()=>nu,isNativeElement:()=>el,isOutlet:()=>Cs,isPromise:()=>Ne,isProvider:()=>Ts,isReactElement:()=>tu,isRoute:()=>Os,isRouter:()=>_s,isRoutes:()=>$s,isSVGElement:()=>Ws,isServer:()=>$,isSuspense:()=>Rs,isVisible:()=>Ka,iterateFn:()=>Ju,keyArray:()=>tt,makeArrayFlat:()=>Ds,mapArray:()=>et,mergeProps:()=>js,observeIntersection:()=>Za,observeResize:()=>Qa,onRequestEnd:()=>uu,query:()=>vn,queryAll:()=>Va,registerCoreVersion:()=>ou,registerCreateComponent:()=>il,registerGlobal:()=>iu,removeAttribute:()=>rs,removeChildren:()=>ss,removeClass:()=>es,removeDelegatedEventListener:()=>$t,removeUnclaimedKeyed:()=>Es,render:()=>Ve,renderToString:()=>jl,renderToStringAsync:()=>Bl,resetIntegration:()=>Fs,runHydrationAt:()=>xt,runWithRequestContext:()=>$n,runWithoutHydration:()=>vu,scrollIntoView:()=>Ja,serializeNode:()=>ne,serializeResourceData:()=>lo,serverCustomElementProp:()=>gt,setAttribute:()=>q,setClassList:()=>ae,setClassName:()=>Se,setDataRedactor:()=>ql,setDynamicAttribute:()=>Le,setDynamicBoolAttribute:()=>qn,setDynamicClassList:()=>Qu,setDynamicProperty:()=>je,setDynamicStyle:()=>Zu,setKeyScope:()=>Au,setProperty:()=>ce,setRequestStore:()=>hs,setRequestStoreIfUnset:()=>au,setResponseRedirect:()=>hu,setServerMode:()=>Me,setStyle:()=>ie,setStyles:()=>En,shouldSetAsProperty:()=>Ha,splitProps:()=>Hs,spread:()=>Ls,stampVersions:()=>ls,styleMap:()=>El,svg:()=>gl,takeResponseHeaders:()=>du,takeResponseRedirect:()=>pu,takesBooleanText:()=>Xi,templateNode:()=>Ps,toAttributeName:()=>La,toggleClass:()=>ts,versionMark:()=>us,versions:()=>H,waitForElement:()=>Xa,warnOnVersionSkew:()=>fs,whenAppHydrated:()=>Su});var Ut="1.0.0-alpha.108",xr=Ut.split(".")[0],vr=`__fluixi_signal_state_v${xr}__`,kr=`__fluixi_signal_builds_v${xr}__`,cc=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function Er(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:cc,onSuspend:null,onError:null,observer:null}}var Xe=globalThis;function ac(e){let t=Er(),n=e;for(let r of Object.keys(t))r in e||(n[r]=t[r]);return e}function uc(){let e=Xe[vr];return e?ac(e):Xe[vr]=Er()}var m=uc();(Xe[kr]??=[]).push(Ut);function Ar(){return[...new Set(Xe[kr]??[])]}function lc(e){return m.observer=e,()=>{m.observer===e&&(m.observer=null)}}var D=[],fc,gr;function Kt(e){let t=m.observer;t&&t.created(e.parents===void 0?{...e,parents:D,origin:e.origin??fc,scope:e.scope??gr}:{...e,scope:e.scope??gr})}function dc(e){return m.observer?(D.push(e),!0):!1}function hc(){D.pop()}function pc(e){m.observer?.ran?.(e)}function mc(e,t){m.observer?.wrote?.(e,t)}function T(e,t,n,r){let i=m.observer;!i?.bound||!D.length||i.bound(D[D.length-1],e,t,n,r)}function L(e,t,n,r){let i=m.observer;!i?.directive||!D.length||i.directive(D[D.length-1],e,t,n,r)}function yc(e){m.observer?.contextCreated?.(e)}function vc(e,t,n){let r=m.observer;!r?.context||!D.length||r.context(D[D.length-1],e,t,n)}function Jt(e){m.observer?.disposed?.(e)}var gc="__FLUIXI_DEVTOOLS_HOOK__",br=globalThis[gc];if(typeof br?.inject=="function")try{br.inject({observeReactiveNodes:lc,version:Ut})}catch{}function he(){return m.observer!=null}var wr=0,Sr=1,Ee=2,_r=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(m.untracked)return;let e=m.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},bc=class extends _r{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}get value(){return this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,mc(this,m.consumer),this.observers)for(let t of[...this.observers])t.markDirty(Ee);zt(this)}}peek(){return this._value}},$r=class extends _r{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this._disposed=!1,this.state=Ee,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(m.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}dispose(){if(!this._disposed&&(this._disposed=!0,this.sources)){for(let e of this.sources)e.observers?.delete(this);this.sources=null}}updateIfNecessary(){if(!this._disposed){if(this.state===Sr&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===Ee)break}(this.state===Ee||!this._initialized)&&this.recompute(),this.state=wr}}recompute(){if(this.sources){for(let c of this.sources)c.observers?.delete(this);this.sources.clear()}let e=m.consumer,t=m.untracked,n=dc(this);m.consumer=this,m.untracked=!1;let r,i=!1,s;try{r=this._fn()}catch(c){i=!0,s=c,r=this._value}finally{m.consumer=e,m.untracked=t,n&&hc()}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,pc(this),o){if(this.version++,this.observers)for(let c of this.observers)c.markDirty(Ee);zt(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===wr;if(this.state=e,t){if(this.observers)for(let n of this.observers)n.markDirty(Sr);zt(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function zt(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}function Or(e){if(m.untracked)return e();m.untracked=!0;try{return e()}finally{m.untracked=!1}}function Z(e){let t=_e(e);return e&&(e.owned??=[]).push(t),t}function pe(e,t=!0){Ae(e,t)}function _e(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Cr(e,t){let n=Symbol(t??"context");return yc(n),{id:n,defaultValue:e,Provider:i=>{vc(n,"provide",i.value);let s=m.owner,o=_e(s);(o.contexts=new Map).set(n,i.value),s&&(s.owned??=[]).push(o),m.owner=o;try{return i.children}finally{m.owner=s}}}}function Tr(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 wc(e,t,n){let r=_e(m.owner);(r.contexts=new Map).set(e.id,t),m.owner&&(m.owner.owned??=[]).push(r);let i=m.owner;m.owner=r;try{return n()}finally{m.owner=i}}function Sc(e){m.onSuspend=e}function xc(e){return m.onSuspend?(m.onSuspend(e,m.owner),!0):!1}function kc(e){m.onError=e}function x(){return m.owner}function E(e,t){let n=m.owner;m.owner=e;try{return t()}finally{m.owner=n}}function A(e){if(m.owner){if(m.owner.disposed){e();return}(m.owner.cleanups??=[]).push(e)}}function Ae(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)Ae(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 W(e){let t=_e(m.owner);m.owner&&(m.owner.owned??=[]).push(t);let n=m.owner;m.owner=t;try{return Or(()=>e(()=>Ae(t)))}finally{m.owner=n}}function Ec(e){m.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Ac(e){e.queued||(e.queued=!0,m.queue.push(e),!m.scheduled&&m.batchDepth===0&&(m.scheduled=!0,m.hostSchedule(Qe)))}function Qe(){if(m.scheduled=!1,m.flushing)return;m.flushing=!0;let e=0,t=!1,n;try{for(;m.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let r=m.queue;m.queue=[];for(let i of r)if(i.queued=!1,!i.disposed)try{i.run()}catch(s){t||(t=!0,n=s)}}}finally{m.flushing=!1}if(t)throw n}function _c(){m.batchDepth===0&&Qe()}function $c(e){m.batchDepth++;try{return e()}finally{--m.batchDepth===0&&Qe()}}var Oc=class extends $r{constructor(e,t=!1,n){let r=null;super(()=>{Ae(r,!1),E(r,()=>{let o=e();typeof o=="function"&&(r.cleanups??=[]).push(o)})}),this.queued=!1,this.disposed=!1;let i=m.owner;this.owner=_e(i),r=this.owner,he()&&Kt({kind:"effect",node:this,handle:this,internal:!t,...n?{name:n}:{}}),this.run();let s=this.owner;if(!this.disposed&&!this.sources?.size&&!s.cleanups&&!s.owned&&!s.contexts&&!he()){this.disposed=!0;return}i&&(i.cleanups??=[]).push(()=>this.dispose())}markDirty(e){let t=this.state===0;super.markDirty(e),t&&this.state!==0&&!this.disposed&&Ac(this)}run(){if(!this.disposed)try{this.get()}catch(e){if(e&&typeof e.then=="function"&&m.onSuspend){m.onSuspend(e,this.owner);return}if(m.onError&&m.onError(e,this.owner))return;throw e}}dispose(){this.disposed||(this.disposed=!0,Jt(this),super.dispose(),Ae(this.owner))}};function Nr(e,t=!1,n){let r=new Oc(e,t,n);return()=>r.dispose()}function Cc(e){return!!e&&typeof e.then=="function"}Ec(()=>{});var Rr=Symbol.for("signal"),Tc=Symbol.for("memo"),Nc=Symbol.for("signal-node");function V(e,t){let n=new bc(e,{equals:t?.equals}),r=(()=>n.get()),i=(s=>{let o=typeof s=="function"?s(n.peek()):s;return n.set(o),_c(),o});return r[Rr]=!0,r[Nc]=n,he()&&Kt({kind:"signal",node:n,handle:r,name:t?.name,set:i}),he()&&A(()=>Jt(n)),[r,i]}function w(e,t,n){let r=t,i=x(),s=new $r(()=>E(i,()=>{try{return r=e(r)}catch(c){if(Cc(c))return xc(c),r;throw c}}),{equals:n?.equals}),o=(()=>s.get());return Object.defineProperty(o,Rr,{value:!0,enumerable:!0}),Object.defineProperty(o,Tc,{value:!0,enumerable:!0}),he()&&Kt({kind:"memo",node:s,handle:o,name:n?.name}),A(()=>{s.dispose(),he()&&Jt(s)}),o}function F(e,t,n){let r=t;return Nr(()=>{r=e(r)},!0,n?.name)}function S(e,t){let n=t;return Nr(()=>{n=e(n)})}function me(e){return $c(e)}function N(e){return Or(e)}function Mr(){return Qe(),Promise.resolve()}function Pr(e){let t=e,n=null;return{index:()=>(n||(n=V(t,{name:"row index"})),n[0]()),set:r=>{t=r,n&&n[1](r)}}}function et(e,t,n){let r=[];return A(()=>{for(let i of r)i.dispose();r=[]}),w(()=>{let i=e()||[];return N(()=>{if(i.length===0){for(let u of r)u.dispose();return r=[],n?.fallback?n.fallback():[]}let s=new Map;for(let u of r)s.has(u.item)||s.set(u.item,u);let o=[],c=new Set;for(let u=0;u<i.length;u++){let l=i[u],a=s.get(l);if(a&&!c.has(a))a.setIndex(u),o.push(a),c.add(a);else{let f,d,p;W(v=>{p=v;let b=Pr(u);d=b.set,f=t(l,b.index)});let g={item:l,rendered:f,dispose:p,setIndex:d};o.push(g),c.add(g)}}for(let u of r)c.has(u)||u.dispose();return r=o,o.map(u=>u.rendered)})},void 0,{name:"mapArray"})}function tt(e,t,n,r){let i=[],s=[];return A(()=>{for(let o of s)o.dispose();i=[],s=[]}),w(()=>{let o=e()||[];return N(()=>{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 u=[],l=[],a=new Set;for(let f=0;f<o.length;f++){let d=t(o[f]),p=c.get(d);if(p&&!a.has(d))p.setIndex(f),p.setItem(o[f]),u.push(p);else{let g,v,b,C;W(le=>{C=le;let fe=Pr(f);v=fe.set;let[Ke,de]=V(o[f]);b=O=>de(()=>O),g=n(Ke,fe.index)}),u.push({rendered:g,dispose:C,setIndex:v,setItem:b})}l.push(d),a.add(d)}for(let[f,d]of c)a.has(f)||d.dispose();return i=l,s=u,u.map(f=>f.rendered)})},void 0,{name:"keyArray"})}function nt(e,t,n){let r=[];return A(()=>{for(let i of r)i.dispose();r=[]}),w(()=>{let i=e()||[];return N(()=>{if(i.length===0){for(let u of r)u.dispose();return r=[],n?.fallback?n.fallback():[]}let s=r.length,o=i.length;for(let u=s;u<o;u++){let l,a,f,d=i[u];W(p=>{f=p;let[g,v]=V(d);a=v,l=t(g,u)}),r.push({rendered:l,setItem:a,dispose:f})}for(let u=o;u<s;u++)r[u].dispose();o<s&&(r=r.slice(0,o));let c=Math.min(s,o);for(let u=0;u<c;u++)r[u].setItem(i[u]);return r.map(u=>u.rendered)})},void 0,{name:"indexArray"})}var Rc=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,Mc=typeof process>"u"?Rc:!1,Pc=Symbol.for("signal");function k(e){return typeof e=="function"&&e[Pc]===!0}var Dc=null;function Dr(e){Dc=e}var Ic=null;function Ir(e){Ic=e}var Lc=null;function rt(e){Lc=e}var jc=null;function Lr(e){jc=e}function jr(){let e=new Map,t=new Map;return{get:n=>e.get(n),set:(n,r)=>{e.set(n,r)},delete:n=>{e.delete(n)},keys:()=>e.keys(),clear:()=>{e.clear(),t.clear()},inflight:t}}var Hc=null;function Hr(e){Hc=e}function Ze(e){if(typeof e=="function"&&!e.length){let t=e();return k(t)?t:Ze(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=Ze(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function it(e){let t=w(e);return Mc?w(()=>Ze(t()),void 0,{name:"children"}):w(()=>Ze(t()))}var qc=Cr();Sc((e,t)=>{let n=Tr(t,qc);n&&(n.increment(),e.finally(()=>n.decrement()))});var qr=Cr();kc((e,t)=>{let n=Tr(t,qr);return n?(n.setError(e),!0):!1});function Wr(){let[e,t]=V(void 0,{equals:!1});return{error:e,reset:()=>t(()=>{}),setError:r=>t(()=>r)}}function Br(e,t){return wc(qr,e,t)}var Gt=Symbol.for("fluixi-proxy");var Vr="1.0.0-alpha.108";var on="1.0.0-alpha.108";var ai=on.split(".")[0],Fr=`__fluixi_signal_state_v${ai}__`,Wc=`__fluixi_signal_builds_v${ai}__`,Bc=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function ui(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Bc,onSuspend:null,onError:null,observer:null}}var Xt=globalThis;function Vc(e){let t=ui(),n=e;for(let r of Object.keys(t))r in e||(n[r]=t[r]);return e}function Fc(){let e=Xt[Fr];return e?Vc(e):Xt[Fr]=ui()}var y=Fc();(Xt[Wc]??=[]).push(on);function zc(e){return y.observer=e,()=>{y.observer===e&&(y.observer=null)}}var z=[],st;function Uc(e,t){if(!y.observer)return t();let n=st;st=e;try{return t()}finally{st=n}}var zr;function ht(e){let t=y.observer;t&&t.created(e.parents===void 0?{...e,parents:z,origin:e.origin??st,scope:e.scope??zr}:{...e,scope:e.scope??zr})}function Kc(e){return y.observer?(z.push(e),!0):!1}function Jc(){z.pop()}function Gc(e){y.observer?.ran?.(e)}function Yc(e,t){y.observer?.wrote?.(e,t)}function li(e){let t=y.observer;!t?.props||!z.length||!e||t.props(z[z.length-1],e)}function Xc(e){y.observer?.contextCreated?.(e)}function Zc(e,t,n){let r=y.observer;!r?.context||!z.length||r.context(z[z.length-1],e,t,n)}function Ur(e,t,n){y.observer?.moved?.(e,t,n)}function Oe(e){y.observer?.disposed?.(e)}var Qc="__FLUIXI_DEVTOOLS_HOOK__",Kr=globalThis[Qc];if(typeof Kr?.inject=="function")try{Kr.inject({observeReactiveNodes:zc,version:on})}catch{}function U(){return y.observer!=null}var Jr=0,Gr=1,$e=2,fi=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))}},ea=class extends fi{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}get value(){return this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,Yc(this,y.consumer),this.observers)for(let t of[...this.observers])t.markDirty($e);Zt(this)}}peek(){return this._value}},di=class extends fi{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this._disposed=!1,this.state=$e,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}dispose(){if(!this._disposed&&(this._disposed=!0,this.sources)){for(let e of this.sources)e.observers?.delete(this);this.sources=null}}updateIfNecessary(){if(!this._disposed){if(this.state===Gr&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===$e)break}(this.state===$e||!this._initialized)&&this.recompute(),this.state=Jr}}recompute(){if(this.sources){for(let c of this.sources)c.observers?.delete(this);this.sources.clear()}let e=y.consumer,t=y.untracked,n=Kc(this);y.consumer=this,y.untracked=!1;let r,i=!1,s;try{r=this._fn()}catch(c){i=!0,s=c,r=this._value}finally{y.consumer=e,y.untracked=t,n&&Jc()}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,Gc(this),o){if(this.version++,this.observers)for(let c of this.observers)c.markDirty($e);Zt(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===Jr;if(this.state=e,t){if(this.observers)for(let n of this.observers)n.markDirty(Gr);Zt(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function Zt(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}function ta(e){if(y.untracked)return e();y.untracked=!0;try{return e()}finally{y.untracked=!1}}function hi(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function pi(e,t){let n=Symbol(t??"context");return Xc(n),{id:n,defaultValue:e,Provider:i=>{Zc(n,"provide",i.value);let s=y.owner,o=hi(s);(o.contexts=new Map).set(n,i.value),s&&(s.owned??=[]).push(o),y.owner=o;try{return i.children}finally{y.owner=s}}}}function mi(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 na(e){y.onSuspend=e}function ra(e){return y.onSuspend?(y.onSuspend(e,y.owner),!0):!1}function ia(e){y.onError=e}function sa(){return y.owner}function yi(e,t){let n=y.owner;y.owner=e;try{return t()}finally{y.owner=n}}function Te(e){if(y.owner){if(y.owner.disposed){e();return}(y.owner.cleanups??=[]).push(e)}}function Qt(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)Qt(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 oa(e){y.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function ca(e){e.queued||(e.queued=!0,y.queue.push(e),!y.scheduled&&y.batchDepth===0&&(y.scheduled=!0,y.hostSchedule(cn)))}function cn(){if(y.scheduled=!1,y.flushing)return;y.flushing=!0;let e=0,t=!1,n;try{for(;y.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let r=y.queue;y.queue=[];for(let i of r)if(i.queued=!1,!i.disposed)try{i.run()}catch(s){t||(t=!0,n=s)}}}finally{y.flushing=!1}if(t)throw n}function aa(){y.batchDepth===0&&cn()}function ua(e){y.batchDepth++;try{return e()}finally{--y.batchDepth===0&&cn()}}var la=class extends di{constructor(e,t=!1,n){let r=null;super(()=>{Qt(r,!1),yi(r,()=>{let o=e();typeof o=="function"&&(r.cleanups??=[]).push(o)})}),this.queued=!1,this.disposed=!1;let i=y.owner;this.owner=hi(i),r=this.owner,U()&&ht({kind:"effect",node:this,handle:this,internal:!t,...n?{name:n}:{}}),this.run();let s=this.owner;if(!this.disposed&&!this.sources?.size&&!s.cleanups&&!s.owned&&!s.contexts&&!U()){this.disposed=!0;return}i&&(i.cleanups??=[]).push(()=>this.dispose())}markDirty(e){let t=this.state===0;super.markDirty(e),t&&this.state!==0&&!this.disposed&&ca(this)}run(){if(!this.disposed)try{this.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,Oe(this),super.dispose(),Qt(this.owner))}};function fa(e,t=!1,n){let r=new la(e,t,n);return()=>r.dispose()}function da(e){return!!e&&typeof e.then=="function"}oa(()=>{});var vi=Symbol.for("signal"),ha=Symbol.for("memo"),pa=Symbol.for("signal-node");function ye(e,t){let n=new ea(e,{equals:t?.equals}),r=(()=>n.get()),i=(s=>{let o=typeof s=="function"?s(n.peek()):s;return n.set(o),aa(),o});return r[vi]=!0,r[pa]=n,U()&&ht({kind:"signal",node:n,handle:r,name:t?.name,set:i}),U()&&Te(()=>Oe(n)),[r,i]}function an(e,t,n){let r=t,i=sa(),s=new di(()=>yi(i,()=>{try{return r=e(r)}catch(c){if(da(c))return ra(c),r;throw c}}),{equals:n?.equals}),o=(()=>s.get());return Object.defineProperty(o,vi,{value:!0,enumerable:!0}),Object.defineProperty(o,ha,{value:!0,enumerable:!0}),U()&&ht({kind:"memo",node:s,handle:o,name:n?.name}),Te(()=>{s.dispose(),U()&&Oe(s)}),o}function gi(e,t,n){let r=t;return fa(()=>{r=e(r)},!0,n?.name)}function ee(e){return ua(e)}function ge(e){return ta(e)}var Ad=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0;var ma=Symbol.for("signal");function bi(e){return typeof e=="function"&&e[ma]===!0}var Yr=null;function ya(e){Yr&&Yr(e)}var Xr=null;function va(e){return Xr?Xr(e):void 0}var Zr=null;function ga(){return Zr?Zr():void 0}var Qr=null;function ba(e,t){Qr&&Qr(e,t)}function wa(e){return!!e&&typeof e.then=="function"}var Yt=Symbol();function Sa(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:ga(),o=s!==void 0?va(s):void 0,c=o!==void 0,[u,l]=ye(o!==void 0?o.value:n.initialValue,{equals:!1}),[a,f]=ye(void 0,{equals:!1}),[d,p]=ye(o!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[g,v]=ye(void 0,{equals:!1}),[b,C]=ye(void 0,{equals:!1}),le=Yt,fe=!1;gi(()=>{let O=r();if(b(),O===!1||O===null||O===void 0){le=Yt,ee(()=>{p("unresolved"),v(void 0),f(void 0)});return}let Je=fe;if(fe=!1,le!==Yt&&O===le&&!Je)return;if(le=O,c){c=!1;return}let Ge=!1;Te(()=>Ge=!0);let pr=ge(d),tc=ge(u),mr=pr==="ready"||pr==="refreshing";ee(()=>{p(mr?"refreshing":"pending"),f(void 0)});try{let oe=i(O,{value:tc,refetching:mr});wa(oe)?(v(oe),ya(oe),oe.then(Ye=>{Ge||(s!==void 0&&ba(s,Ye),ee(()=>{l(()=>Ye),p("ready"),v(void 0)}))},Ye=>{Ge||ee(()=>{f(Ye),p("errored"),v(void 0)})})):ee(()=>{l(()=>oe),p("ready"),v(void 0)})}catch(oe){if(Ge)return;ee(()=>{f(oe),p("errored"),v(void 0)})}});let Ke=()=>{let O=d();return O==="pending"||O==="refreshing"},de=(()=>{let O=a();if(O)throw O;if(Ke()){let Je=g();if(Je)throw Je}return u()});return Object.defineProperties(de,{state:{get:d},loading:{get:Ke},error:{get:a},latest:{get:u}}),Object.defineProperty(de,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(de,Symbol.for("signal"),{value:!0,enumerable:!0}),[de,{mutate:l,refetch:()=>{fe=!0,C(void 0)}}]}var xa=pi();na((e,t)=>{let n=mi(t,xa);n&&(n.increment(),e.finally(()=>n.decrement()))});var ka=pi();ia((e,t)=>{let n=mi(t,ka);return n?(n.setError(e),!0):!1});function wi(e,t){let[n,r]=ye(e,t);return n.set=r,n}function Si(e,t,n){return an(e,t,n)}function xi(e,t,n){return gi(e,t,n)}function ki(...e){let[t,n]=Sa(...e);return Object.assign(t,n)}var at=Symbol("store-raw"),ei=Symbol("store-node"),ti=Symbol("store-has"),ni=Symbol("store-self"),ri=Symbol("store-track");var Ce=new WeakMap,en=new WeakMap,be=new WeakMap,ut=new WeakMap;function Ea(e,t){if(!ve(e)||!U())return;let n=new Set,r=o=>{if(!(!ve(o)||n.has(o))){n.add(o);for(let c of Object.values(o))r(c)}};r(ut.get(t)??t);let i=new Set,s=o=>{if(!ve(o))return;let c=o;if(n.has(c)||i.has(c))return;i.add(c);let u=Ce.get(c);if(u){for(let l of u.keys.values())Oe(l);u.all&&Oe(u.all),Ce.delete(c),be.delete(c),en.delete(c)}for(let l of Object.values(c))s(l)};s(e)}var lt=(e,t,n)=>n?`${e}[${String(t)}]`:`${e}.${String(t)}`;function Ei(e,t,n){let r=t?.owner,i=r&&n!==void 0?lt(r.name,n,t?.array):void 0,[s,o]=Uc(r?.store,()=>V(e,i?{name:i}:void 0)),c=s;return c.$=o,c}function ft(e){let t=Ce.get(e);return t?t.owner||(t.owner=be.get(e)):Ce.set(e,t={keys:new Map,owner:be.get(e),array:Array.isArray(e)}),t}function ii(e,t,n){let r=e.keys.get(t);return r||e.keys.set(t,r=Ei(n,e,t)),r}function Aa(e,t,n,r){let i=be.get(e);if(i&&i.store===t&&i.name===n)return;let s={store:t,name:n};be.set(e,s),ut.set(e,ut.get(r)??r);let o=Ce.get(e);if(o&&(o.owner=s,!!U())){for(let[c,u]of o.keys)Ur(u,t,lt(n,c,o.array));o.all&&Ur(o.all,t,lt(n,"*",o.array))}}function si(e){let t=ft(e);(t.all||(t.all=Ei(void 0,t,"*")))()}function oi(e,t){e.$(typeof t=="function"?()=>t:t)}function ve(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 ot(e){if(!ve(e))return e;let t=en.get(e);if(t)return t;let n=new Proxy(e,_a);return en.set(e,n),n}var _a={get(e,t,n){if(t===at||t===ei)return e;if(t===Gt)return n;if(t===ti)return u=>u in e;if(t==="__proxy")return!0;if(t===ri||t===ni)return si(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=ft(e),o=ii(s,t,r),c=o();return ve(c)?(s.owner&&Aa(c,o,lt(s.owner.name,t,s.array),e),ot(c)):c},set(){return!0},deleteProperty(e,t){return t in e&&j(e,t,void 0),!0},has(e,t){return t===at||t===Gt||t===ei||t===ti||t===ni||t===ri?!0:(ii(ft(e),t,e[t])(),t in e)},ownKeys(e){return si(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function Ai(e,t=new Set){if(e==null||typeof e!="object")return e;let n=e[at]??e;if(t.has(n)||!ve(n))return n;t.add(n);let r=!1,i=o=>{let c=Ai(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 j(e,t,n){let r=Ai(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=ft(e),u=c.keys.get(t);if(u&&oi(u,r),Ea(i,e),s&&e.length!==o){let l=c.keys.get("length");l&&oi(l,e.length)}c.all&&c.all.$(void 0)}function tn(e,t){return typeof e=="function"?e(t):e}function nn(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)?nn(i,r):j(e,n,r)}}function pt(e){let t=[],n=e.replace(/\[([^\]]*)\]/g,".$1");for(let r of n.split("."))r.length&&t.push(r);return t}function _i(e,t,n){let r=t.length-1;for(let s=0;s<r;s++){let o=t[s];if(o==="*"){let u=t.slice(s+1);if(Array.isArray(e))for(let l=0;l<e.length;l++)_i(e[l],u,n);return}let c=e[o];(c==null||typeof c!="object")&&(c=/^\d+$/.test(t[s+1])?[]:{},j(e,o,c)),e=c}let i=t[r];if(i==="*"){if(Array.isArray(e))for(let s=0;s<e.length;s++)j(e,s,tn(n,e[s]));return}j(e,i,tn(n,e[i]))}function ci(e,t,n){_i(e,pt(t),n)}function $a(e){return Array.isArray(e)&&e.length>0&&e.every(t=>Array.isArray(t)&&t.length>=2&&typeof t[0]=="string")}function ct(e,t){for(let n=e.length-1;n>=t.length;n--)j(e,String(n),void 0);e.length!==t.length&&j(e,"length",t.length);for(let n=0;n<t.length;n++)j(e,String(n),t[n])}function Oa(e,t){let n=t[0];if(typeof n=="function"&&t.length===1){let r=n(e);r&&r!==e&&nn(e,r);return}if(Array.isArray(n)&&t.length===1){if($a(n)){for(let r of n)ci(e,r[0],r[1]);return}if(Array.isArray(e)){ct(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){nn(e,n);return}if(t.length>=3){rn(e,t.slice(0,-1),t[t.length-1]);return}ci(e,String(n),t[1])}function Ca(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 rn(e,t,n){if(e==null)return;let[r,...i]=t;if(typeof r=="string"){let o=pt(r);if(o.length>1){rn(e,[...o,...i],n);return}}let s=Ca(e,r);if(i.length===0){for(let o of s)j(e,o,tn(n,e[o]));return}for(let o of s){let c=e[o];if(c==null||typeof c!="object"){let u=i[0];c=typeof u=="number"||/^\d+$/.test(String(u))?[]:{},j(e,o,c)}rn(c,i,n)}}function sn(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(sn);let t={};for(let n of Object.keys(e))t[n]=sn(e[n]);return t}function Q(e,t){let n=e;for(let r of pt(t)){if(n==null)return;n=n[r]}return n}var $i=class{constructor(e,t={immutable:!0}){this.options=t,this.root=e,this.set=((...n)=>me(()=>Oa(this.root,n))),e&&typeof e=="object"&&(be.set(e,{store:this,name:t.name??"store"}),ut.set(e,e)),U()&&ht({kind:"store",node:this,handle:()=>this.root,name:t.name})}get state(){return ot(this.root)}get proxy(){return ot(this.root)}get accessor(){return(()=>ot(this.root))}unwrap(){return this.root}getNode(e){return this.root&&this.root[e]}get(e){if(e==null||e==="")return dt(this.state);let t=this.state;for(let n of pt(e)){if(t==null)return;t=t[n]}return dt(t)}select(e){return w(()=>e(this.state))}subscribe(e){return F(()=>e(this.state))}watch(e,t){let n;return F(()=>{let r=e(this.state);Object.is(r,n)||(t(r,n),n=r)})}reactive(e){return w(()=>this.state[e])}produce(e){this.set((t=>{let n=sn(t);return e(n),n}))}reconcile(e,t={}){this.set(e)}push(e,...t){let n=Q(this.root,e);this.set(e,n.concat(t))}pop(e){let t=Q(this.root,e).slice(),n=t.pop();return this.set(e,t),n}shift(e){let t=Q(this.root,e).slice(),n=t.shift();return this.set(e,t),n}splice(e,t,n,...r){let i=Q(this.root,e).slice(),s=i.splice(t,n,...r);return this.set(e,i),s}insert(e,t,n){let r=Q(this.root,e).slice();r.splice(t,0,n),this.set(e,r)}removeAt(e,t){let n=Q(this.root,e).slice(),r=n.splice(t,1);return this.set(e,n),r}replace(e,t){if(arguments.length>=2){let r=Q(this.root,String(e)),i=t;if(Array.isArray(r)&&Array.isArray(i)){ct(r,i);return}this.set(e,i);return}let n=this.root;if(Array.isArray(n)&&Array.isArray(e)){ct(n,e);return}this.set(e)}clear(e){let t=e===void 0?this.root:Q(this.root,e);if(Array.isArray(t)){ct(t,[]);return}if(t&&typeof t=="object")for(let n of Object.keys(t))j(t,n,void 0)}toObservable(){let[e]=V(this.state);return e.toObservable()}dispose(){}},Ta=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","replace","clear","unwrap","toObservable"];function Na(e,t){for(let n of Ta)e[n]=t[n].bind(t);e.$=t.reactive.bind(t)}function Oi(e,t={immutable:!0}){let n=new $i(e,t);return Na(n.set,n),[n.proxy,n.set]}function Ra(e,t={}){return new $i(e,{...t,immutable:!1})}function dt(e){if(e==null||typeof e!="object")return e;let t=e[at];return t!==void 0?t:e}function Ma(e){return N(()=>dt(e))}var $d=Object.freeze({createStore:Oi,createMutableStore:Ra,batch:me,unwrap:dt,untrackStore:Ma});function Ci(e,t){let[n,r]=Oi(e,t);return new Proxy(n,{get:(i,s)=>s==="set"?r:i[s],has:(i,s)=>s==="set"||Reflect.has(i,s)})}var Ct=Symbol.for("fluixi.server-node"),Pa=Symbol.for("fluixi.dom.server-host"),Da=globalThis,Re=Da[Pa]??={server:typeof document>"u",nodes:null};function $(){return Re.server}function Me(e){Re.server=e}function Ia(e){Re.nodes=e}function Tt(){if(!Re.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return Re.nodes}function We(e){return e!=null&&e[Ct]===!0?!0:typeof Node<"u"&&e instanceof Node}function Ki(e){return e!=null&&e[Ct]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Ji(e){return e!=null&&e[Ct]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}function La(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function ja(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function Ha(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 qa=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Wa=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"]),kn="http://www.w3.org/2000/svg";function Gi(e){return e.localName.includes("-")}function mn(e,t,n,r=!1){if(n==null){e.removeAttribute(t);return}if(Gi(e)){if($()){gt(e,t,n);return}e[t]=n;return}q(e,t,n,r)}var Yi=Symbol.for("fluixi.serverProps");function gt(e,t,n){let r=e[Yi]??={};r[t]=n,n==null||n===!1?e.removeAttribute(t):n===!0?e.setAttribute(t,""):(typeof n=="string"||typeof n=="number")&&e.setAttribute(t,String(n))}var Ba=new Set(["draggable","spellcheck","contenteditable"]);function Xi(e){return e.startsWith("aria-")||Ba.has(e.toLowerCase())}var yn=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]),Zi=new Set(["id","class","className","style","slot","part","exportparts","is","title","role","lang","dir","tabindex","hidden"]);function yt(e){return Zi.has(e)||e.startsWith("aria-")||e.startsWith("data-")}function vn(e,t=document){return t.querySelector(e)}function Va(e,t=document){return Array.from(t.querySelectorAll(e))}function Fa(e,t){return e.closest(t)}function Qi(e,...t){e.classList.add(...t)}function es(e,...t){e.classList.remove(...t)}function ts(e,...t){t.forEach(n=>e.classList.toggle(n))}function za(e,t){return e.classList.contains(t)}function q(e,t,n,r=!1){if(typeof n=="boolean"&&Xi(t)){e.setAttribute(t,String(n));return}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 ns(e,t){return e.getAttribute(t)}function rs(e,t){e.removeAttribute(t)}function En(e,t){Object.assign(e.style,t)}function Ua(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function is(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")En(r,s);else if(i.startsWith("on")&&typeof s=="function"){let o=i.slice(2).toLowerCase();r.addEventListener(o,s)}else q(r,i,s)}),n.forEach(i=>{typeof i=="string"?r.appendChild(document.createTextNode(i)):r.appendChild(i)}),r}function ss(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function os(e,...t){t.forEach(n=>{typeof n=="string"?e.appendChild(document.createTextNode(n)):e.appendChild(n)})}function Ka(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function Ja(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function Ga(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function Ya(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 Xa(e,t=5e3){return new Promise((n,r)=>{let i=vn(e);if(i){n(i);return}let s=new MutationObserver(()=>{let c=vn(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 Za(e,t,n={}){let r=new IntersectionObserver(i=>{i.forEach(s=>{t(s.isIntersecting)})},n);return r.observe(e),()=>{r.disconnect()}}function Qa(e,t){let n=new ResizeObserver(r=>{r.forEach(t)});return n.observe(e),()=>{n.disconnect()}}var eu=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function tu(e){return typeof e=="object"&&e!==null&&e.$$typeof===eu}function nu(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function ru(e){return e instanceof Node}function iu(e,t,n="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[n]>"u"&&(globalThis[n]={}),typeof globalThis[n][e]>"u"&&(globalThis[n][e]=t))}function su(e,t,n="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[n]<"u"&&typeof globalThis[n][e]<"u"?globalThis[n][e]:t}var cs="1.0.0-alpha.108",H={dom:cs,reactive:Vr};function ou(e){H.core=e}var as="data-fluixi";function us(){return cu()?"":H.core??H.dom}function cu(){try{return!0}catch{return!1}}function ls(e){e.setAttribute(as,us()),typeof globalThis<"u"&&(globalThis.Fluixi=H)}function fs(){let e=Ar();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=[H.core,H.dom,H.reactive].filter(n=>n!==void 0);new Set(t).size<=1||console.warn(`[fluixi] package versions disagree: core ${H.core??"(absent)"}, dom ${H.dom}, reactive ${H.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\`.`)}var mt,ds={getStore:()=>mt,run(e,t){let n=mt;mt=e;try{return t()}finally{mt=n}}},Pe=globalThis[Symbol.for("fluixi.requestStore")]??={store:ds,async:!1};function hs(e){Pe.store=e??ds,Pe.async=e!==null}function au(e){Pe.async||hs(e)}function An(e={}){if(e.request===void 0){let o=ps();o&&(e.request=o)}e.locals||(e.locals=e.request?ms(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 u=r;r=o;try{return c()}finally{r=u}},pending:new Set,data:new Map}}var bt=globalThis[Symbol.for("fluixi.requestEndHooks")]??=new WeakMap;function uu(e){let t=X();if(!t)return!1;let n=bt.get(t);return n||bt.set(t,n=[]),n.push(e),!0}function _n(e){let t=bt.get(e);if(t){bt.delete(e);for(let n of t.reverse())try{n()}catch(r){console.error("[fluixi] a request-end hook threw:",r)}}}function $n(e,t){return Pe.store.run(e,t)}function X(){return Pe.store.getStore()}function On(){return X()?.event}function lu(){let e=On();return e?(e.locals||(e.locals={}),e.locals):{}}var Ti=globalThis[Symbol.for("fluixi.requestLocals")]??=new WeakMap;function ps(){return globalThis[Symbol.for("fluixi.platformRequest")]?.getStore()}function ms(e){let t=Ti.get(e);return t||(t={},Ti.set(e,t)),t}var De=globalThis[Symbol.for("fluixi.responseHeaders")]??=new WeakMap;function ys(){let e=On()?.request;return e&&typeof e=="object"?e:ps()}function fu(e,t,n=ys()){if(!n)return!1;let r=De.get(n);return r||(r={headers:new Headers,sent:!1},De.set(n,r)),r.sent?!1:(r.headers.append(e,t),!0)}function du(e){let t=De.get(e);if(!t){t={headers:new Headers,sent:!0},De.set(e,t);return}return t.sent=!0,t.headers}var wt=globalThis[Symbol.for("fluixi.responseRedirects")]??=new WeakMap;function hu(e,t,n=ys()){return!n||De.get(n)?.sent?!1:(wt.has(n)||wt.set(n,{location:e,status:t}),!0)}function pu(e){let t=wt.get(e);return wt.delete(e),t}var h={active:!1,cursor:null,parents:[]},vs=null;function mu(e){vs=e}function St(){return vs}function Ni(e,t){return h.active&&t.parentNode===e}function Cn(e){let t=h.parents.lastIndexOf(e);t!==-1&&(h.parents.length=t),h.cursor=e.nextSibling}function yu(){return h.active?h.cursor:null}function xt(e,t){if(!e||e.parentNode==null)return t();let n=h.active,r=h.cursor,i=h.parents;h.active=!0,h.cursor=e,h.parents=[];try{return t()}finally{h.active=n,h.cursor=r,h.parents=i}}function vu(e){if(!h.active)return e();let t=h.cursor,n=h.parents;h.active=!1,h.parents=[];try{return e()}finally{h.active=!0,h.cursor=t,h.parents=n}}function Tn(e){if(!h.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&Cn(t)}function Nt(){let e=globalThis;return e[Symbol.for("fluixi.appHydration")]??={pending:0,waiting:new Set}}function gu(){Nt().pending++}function bu(){let e=Nt();if(e.pending>0&&e.pending--,e.pending>0)return;let t=[...e.waiting];e.waiting.clear();for(let n of t)n()}function wu(){return Nt().pending>0}function Su(e){let t=Nt();return t.waiting.add(e),()=>t.waiting.delete(e)}var kt=Symbol.for("fluixi.hydrationKeys"),re="data-hk";function gs(e){let t=e;for(;t;){let n=t.contexts?.get(kt);if(n)return n;if(!t.parent){let r={id:"",next:0};return(t.contexts??=new Map).set(kt,r),r}t=t.parent}return{id:"",next:0}}function bs(){return $()?X()?.hydrationKeys!==!1:h.active}function gn(e){let t=3735928559,n=1103547991;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);t=Math.imul(t^i,2654435761),n=Math.imul(n^i,1597334677)}return t=Math.imul(t^t>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),(4294967296*(2097151&n)+(t>>>0)).toString(36)}function ws(e){if(!bs())return null;let t=gs(x()),n=t.id+(t.next++).toString(36);return e?`${gn(n)}-${e}`:gn(n)}var Ri=new Map;function xu(e){let t=Ri.get(e);return t===void 0&&Ri.set(e,t=gn(e).slice(0,6)),t}function ku(e){let t=e.getAttribute(re)??"",n=t.indexOf("-");return n<0?"":t.slice(n+1)}function Ss(e){let t=e.getAttribute(re);t&&M?.get(t)===e&&M.delete(t)}function Eu(){if(!bs())return null;let e=x();if(!e)return null;let t=gs(e),n={id:t.id+(t.next++).toString(36)+".",next:0},r=Z(e);return(r.contexts=new Map).set(kt,n),r}function Au(e){let t=x();t&&(t.contexts??=new Map).set(kt,{id:e,next:0})}var M=null;function xs(e){M??=new Map;for(let t of e.querySelectorAll(`[${re}]`)){let n=t.getAttribute(re);M.has(n)||M.set(n,t)}}function ks(){M=null}function Es(e){if(!M)return 0;let t=0;for(let[n,r]of M){if(!r.isConnected){M.delete(n);continue}e&&!e.contains(r)||r.parentElement?.closest("[data-fx-ssr]")||(M.delete(n),r.remove(),t++)}return t}function As(e,t){if(!e||!M)return null;let n=M.get(e);return!n||n.localName!==t.toLowerCase()?null:(M.delete(e),n)}function _u(e){return Object.defineProperty(e,Symbol.for("fluixi-router"),{value:!0,enumerable:!0}),e}function $u(e){return Object.defineProperty(e,Symbol.for("fluixi-routes"),{value:!0,enumerable:!0}),e}function Ou(e){return Object.defineProperty(e,Symbol.for("fluixi-route"),{value:!0,enumerable:!0}),e}function Cu(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-outlet"),{value:!0,enumerable:!0}),e}function Tu(e){return Object.defineProperty(e,Symbol.for("fluixi-provider"),{value:!0,enumerable:!0}),e}function Nu(e){return Object.defineProperty(e,Symbol.for("fluixi-context"),{value:!0,enumerable:!0}),e}function Nn(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function Ru(e){return Object.defineProperty(e,Symbol.for("fluixi-suspense"),{value:!0,enumerable:!0}),e}function _s(e){return typeof e=="function"&&e[Symbol.for("fluixi-router")]===!0}function $s(e){return typeof e=="function"&&e[Symbol.for("fluixi-routes")]===!0}function Os(e){return typeof e=="function"&&e[Symbol.for("fluixi-route")]===!0}function Cs(e){return typeof e=="function"&&e[Symbol.for("fluixi-outlet")]===!0}function Ts(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function Ns(e){return typeof e=="function"&&e[Symbol.for("fluixi-context")]===!0}function B(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function Rs(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function Mu(e){return _s(e)?{type:"router",value:e}:Os(e)?{type:"route",value:e}:$s(e)?{type:"routes",value:e}:Cs(e)?{type:"outlet",value:e}:B(e)?{type:"component",value:e}:Rs(e)?{type:"suspense",value:e}:Ts(e)?{type:"provider",value:e}:Ns(e)?{type:"context",value:e}:{type:"none",value:e}}function Pu(e){if($()||!h.active)return e();let t=x();return Nn(()=>E(t,e))}function Du(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 Iu(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 Lu(e){return Iu(Du(e))}var ju=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Hu={},Et="__fx_at",Ms="__fx_loc";function un(e,t){return t&&(e[Ms]=t),e}var qu=Symbol.for("fluixi.owner");function At(e){let t=x();t&&(e[qu]=t)}function Mi(e){if(e instanceof Element){e.localName.includes("-")&&At(e);for(let t of e.querySelectorAll("*"))t.localName.includes("-")&&At(t)}}var Pi=/<[a-z][\w.]*-/i,Di=new Map,Wu="__fluixi_delegated_events__",bn=globalThis[Wu]??={names:new Set},_t=bn.names,Rt=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function Mt(e){if(!$())for(let t of e)_t.has(t)||Rt.has(t)||(_t.add(t),bn.dispatch??=Bu,document.addEventListener(t,bn.dispatch))}function Bu(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;Object.defineProperty(e,"currentTarget",{configurable:!0,get:()=>n??document});try{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}}finally{delete e.currentTarget}}function Rn(e,t,n){if(e[`$$${t}`]=n,Rt.has(t)){let r=`__fx_${t}`;if(!e[r]){let i=s=>{e[`$$${t}`]?.(s)};e.addEventListener(t,i),e[r]=i}return}_t.has(t)||Mt([t])}function $t(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function Vu(e){return!Rt.has(e)}function Fu(e){return typeof e=="function"}function te(e,t=!1){if($())return Tt().createText(e);if(h.active&&!t){let n=St()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}function Pt(e,t=!1,n){let r=ws();if($()){let i=Tt().createElement(e,t);return r&&i.setAttribute(re,r),i}if(h.active){let i=As(r,e);if(i)return St()?.enterElement(i),e.includes("-")&&At(i),n?un(i,n):i;let s=St()?.hydrateElement(e);if(s)return e.includes("-")&&At(s),n?un(s,n):s}return un(t?document.createElementNS(kn,e):document.createElement(e),n)}function Mn(e,t=!1){let n=Di.get(e);if(n)return n;let r=document.createElement("template");return t?r.innerHTML=`<svg>${e}</svg>`:r.innerHTML=e,Di.set(e,r),r}function Ps(e,t,n=!1,r=!1,i){let s=xu(e),o=ws(s);if($()){let c=Tt();if(n){let u=c.parseTemplate(e,r);return o&&u.setAttribute(re,o),u}return c.createRaw(o?zu(e,o):e)}if(h.active){let c=As(o,t);if(c)return h.cursor=c.nextSibling,Pi.test(e)&&Mi(c),ln(c,i);let u=St()?.hydrateStatic(t,s);if(u)return Pi.test(e)&&Mi(u),ln(u,i)}return ln(Ln(Mn(e,r),r).firstChild,i)}function zu(e,t){return e.replace(/^(\s*<[^\s/>]+)/,`$1 ${re}="${t}"`)}function ln(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][Ms]={file:t.file,line:s,column:t.pos[i*2+1]})}return e}function Pn(e,t){if(!h.active)return t();let n=xt(e.nextSibling,t);if(typeof n=="function"){let r=n;return Uu(r,(...s)=>h.active?xt(e.nextSibling,()=>{let o=r(...s);for(;typeof o=="function";)o=o();return o}):r(...s))}return n}function Uu(e,t){let n=e[Et];return n!==void 0&&(t[Et]=n),t}function Dn(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 In(e,t){let n=[];for(let r=e.nextSibling;r&&r!==t;r=r.nextSibling)n.push(r);return n}function Ln(e,t=!1){let n=e.content.cloneNode(!0);return t?n.firstChild:n}function Ds(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Ds(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function Ku(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function Ju(e){if(k(e)||B(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!k(t)&&!B(t);)t=t();return t}var Y=0,Gu=200;function Yu(e,t,n,r,i){let s=r,o,c=()=>o??=new Map,u=!1;return S(()=>{let a=u&&h.active;if(u=!0,!a)return l();h.active=!1;try{return l()}finally{h.active=!0}});function l(){T(n??t,"content",void 0,e);let a;if(B(e)&&!k(e)){if(!c().has(e)){Y++;try{let f=e();c().set(e,f)}finally{Y--}}for(a=c().get(e);typeof a=="function"&&k(a);)a=a()}else for(a=e();typeof a=="function"&&k(a);)a=a();{let f=0;for(;typeof a=="function"&&f++<50;)if(B(a)){if(!c().has(a)){let d=a;Y++;try{let p=d();c().set(d,p)}finally{Y--}}a=c().get(a)}else if(k(a))a=a();else if(a=a(),typeof a!="function"||!k(a)&&!B(a))break}Array.isArray(a)&&c(),Y++;try{s=Ie(t,a,n,s,o),i(s)}finally{Y--}}}function I(e,t,n,r){if(Y>Gu)return console.error("[insert] Exceeded max call depth, possible infinite loop."),()=>null;let i=n!==void 0&&!n&&h.active;n!==void 0&&!n&&(n=te("",!0),i||e.appendChild(n));let s=()=>{if(!i||n.parentNode)return;let a=h.cursor;e.insertBefore(n,a&&a.parentNode===e?a:null)},o=r??null,c=a=>Array.isArray(a)&&a.some(f=>typeof f=="function"),u=a=>typeof a=="function"?a:()=>a;if(typeof t!="function"&&!c(t)){Y++;try{o=Ie(e,t,n,o)}finally{Y--}return s(),()=>o}let l=Yu(u(t),e,n,o,a=>{o=a});return s(),()=>(l?.(),o)}function Ie(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(Ne(t)){let o=te("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(o,r[0]),G(e,r.slice(1),n)):R(e,o,n):r?e.replaceChild(o,r):R(e,o,n),t.then(c=>{o.parentNode===e&&Ie(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=te(t);return R(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&&Ji(r))return r.data=t,r;let o=te(t);return r&&r.parentNode===e?e.replaceChild(o,r):Ni(e,o)||R(e,o,n),o}if(We(t))return Ni(e,t)?(Cn(t),t):Array.isArray(r)?(r.length===0?R(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),G(e,r.slice(1),n)):R(e,t,n),t):(r?r!==t&&(r.parentNode===e?e.replaceChild(t,r):R(e,t,n)):R(e,t,n),t);if(Array.isArray(t)){let o=[],c=Array.isArray(r)?r:r?[r]:[],u=[],l=new Set,a=()=>J(t,o,e,n,!0,i,u,l);h.active&&c.length?xt(c[0],a):a();let f=Xu(e,l.size?c.filter(d=>!l.has(d)):c,o,n);for(let d of u){if(d.wired)continue;let p=I(e,d.sig,d.marker);A(()=>G(e,p()))}return f}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 u=c.type(c.props||{});return Ie(e,u,n,r)}}}return G(e,r,n)}function J(e,t,n,r,i=!0,s,o,c){for(let u=0;u<e.length;u++){let l=e[u];if(!(l==null||typeof l=="boolean")){for(;typeof l=="function"&&!Ne(l)&&!k(l)&&!B(l)&&(l=l(),!(l==null||typeof l=="boolean")););if(!(l==null||typeof l=="boolean")){if(typeof l=="function"){let a;for(B(l)&&!k(l)?(s||(s=new Map),s.has(l)||s.set(l,l()),a=s.get(l)):a=l();typeof a=="function"&&!Ne(a)&&!k(a)&&!B(a);)s||(s=new Map),s.has(a)||s.set(a,a()),a=s.get(a);if(a==null||typeof a=="boolean")continue;if(typeof a=="function"){if(k(a)){if(o){let d=te("",!0);if(t.push(d),h.active&&c&&h.cursor?.parentNode===n){let p=()=>h.cursor&&h.cursor.parentNode===n?h.cursor:null,g=p();n.insertBefore(d,g);let v=I(n,a,d),b=p();for(let C=g;C&&C!==b;C=C.nextSibling)c.add(C);n.insertBefore(d,b),A(()=>G(n,v())),o.push({marker:d,sig:a,wired:!0});continue}o.push({marker:d,sig:a});continue}let f=a();for(;typeof f=="function"&&k(f);)f=f();if(f==null||typeof f=="boolean")continue;Array.isArray(f)?J(f,t,n,r,i,s):J([f],t,n,r,i,s);continue}continue}Array.isArray(a)?J(a,t,n,r,i,s,o,c):J([a],t,n,r,i,s,o,c);continue}if(Ne(l)){let a=te("",!0);t.push(a),l.then(f=>{if(a.parentNode){let d=[];if(J([f],d,a.parentNode,void 0,!1,s),d.length>0){a.parentNode.replaceChild(d[0],a);for(let p=1;p<d.length;p++)a.parentNode?.insertBefore(d[p],d[p-1].nextSibling)}}}).catch(f=>console.error("Error resolving promise in array:",f));continue}if(Array.isArray(l)){J(l,t,n,r,i,s,o,c);continue}if(We(l)){h.active&&(h.cursor===l||h.parents.includes(l))&&Cn(l),t.push(l);continue}if(typeof l=="object"&&l!==null&&"type"in l&&"props"in l){let a=l;if(typeof a.type=="function"){let f=a.type(a.props||{});Array.isArray(f)?J(f,t,n,r,!1,s):J([f],t,n,r,!1,s);continue}}if(typeof l=="string"||typeof l=="number"){let a=String(l);if(a.trim()===""&&a!==" ")continue;t.push(te(a));continue}t.push(te(String(l)))}}}}function Xu(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,u=0,l=s>0?t[s-1].nextSibling??void 0:r,a=null;for(;c<s||u<o;){if(t[c]===n[u]){c++,u++;continue}for(;s>c&&o>u&&t[s-1]===n[o-1];)s--,o--;if(s===c){let f=o<i?u?n[u-1].nextSibling??void 0:n[o-u]:l;for(;u<o;)R(e,n[u++],f)}else if(o===u)for(;c<s;)(!a||!a.has(t[c]))&&t[c].parentNode===e&&e.removeChild(t[c]),c++;else if(t[c]===n[o-1]&&n[u]===t[s-1]){let f=t[--s].nextSibling;R(e,n[u++],t[c++].nextSibling),R(e,n[--o],f),t[s]=t[c-1]}else{if(!a){a=new Map;let d=u;for(;d<o;)a.set(n[d],d++)}let f=a.get(t[c]);if(f!=null)if(u<f&&f<o){let d=c,p=1;for(;++d<s&&d<o&&!(!a.has(t[d])||a.get(t[d])!==f+p);)p++;if(p>f-u){let g=t[c];for(;u<f;)R(e,n[u++],g)}else t[c].parentNode===e?e.replaceChild(n[u++],t[c++]):(R(e,n[u++],l),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 R(e,t,n){h.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function ce(e,t,n){n==null?delete e[t]:e[t]=n}function jn(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 Is(e,t){if(!t||typeof t!="function")return;let n=t[Et]?.name;if(!n)return;let r=n.indexOf(":");r!==-1&&L(e,n.slice(0,r),n.slice(r+1),t)}function Ot(e,t,n){let r=typeof n=="function"?N(()=>n()):n;if(!(!r||typeof r!="object"))for(let i of Object.keys(r))L(e,t,i)}function Hn(e,t){let n=(r,i)=>{typeof r=="function"&&(L(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 Le(e,t,n,r=!1){return Is(e,n),typeof n!="function"?(q(e,t,n,r),()=>{}):S(()=>{T(e,"attribute",t,n);let i=typeof n=="function"?n():n;q(e,t,i,r)})}function je(e,t,n){return typeof n!="function"?(ce(e,t,n),()=>{}):(Is(e,n),S(()=>{T(e,"property",t,n);let r=typeof n=="function"?n():n;ce(e,t,r)}))}function qn(e,t,n){return typeof n!="function"?(q(e,t,!!n),()=>{}):S(()=>{T(e,"attribute",t,n);let r=n();q(e,t,!!r)})}function Se(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){S(()=>{T(e,"attribute","class",t),Se(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 ae(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(S(()=>{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 fn(e,t,n){t.includes("-")?n==null?e.removeProperty(t):e.setProperty(t,String(n)):e[t]=n??""}function we(e){for(;typeof e=="function";)e=e();return e}var dn=new WeakMap;function ie(e,t,n){if(typeof t=="function"&&n){n.push(S(()=>ie(e,we(t))));return}let r=we(t),i=dn.get(e);if(r==null){dn.delete(e),e.removeAttribute("style");return}let s=new Set,o=c=>{if(typeof c=="function"&&n){n.push(S(()=>o(we(c))));return}if(c=we(c),c!=null){if(typeof c=="string")e.style.cssText=c;else if(Array.isArray(c))for(let u of c)o(u);else if(typeof c=="object")for(let u in c){s.add(u);let l=c[u];typeof l=="function"&&n?n.push(S(()=>fn(e.style,u,we(l)))):fn(e.style,u,we(l))}}};if(Array.isArray(r))for(let c of r)o(c);else o(r);if(i)for(let c of i)s.has(c)||fn(e.style,c,null);dn.set(e,s)}function Zu(e,t){if(typeof t!="function"){ie(e,t,[]);return}S(()=>{T(e,"attribute","style",t),ie(e,t())})}function Qu(e,t){if(typeof t!="function"){ae(e,t,[]);return}S(()=>{T(e,"attribute","class",t),ae(e,t())})}function Ls(e){let{element:t,props:n,prevProps:r=Hu,isSVG:i=!1,skipChildren:s=!1,isCustomElement:o,accessors:c}=e;if(!t||!Ki(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let u=i||t.namespaceURI===kn,l=[];for(let a in n){if(s&&a==="children")continue;let f=n[a],d=r[a];if(f===d)continue;if(a==="ref"){Be(f,t);continue}if(a==="use"){Hn(t,f);continue}if(a.startsWith("on:")){l.push(jn(t,a.slice(3),f));continue}if(a.startsWith("prop:")){L(t,"prop",a.slice(5),f),l.push(je(t,a.slice(5),f));continue}if(a.startsWith("attr:")){L(t,"attr",a.slice(5),f),l.push(Le(t,a.slice(5),f,u));continue}if(a.startsWith("bool:")){L(t,"bool",a.slice(5),f),l.push(qn(t,a.slice(5),f));continue}if(a==="class"||a==="className"){typeof f=="function"?l.push(S(()=>{T(t,"attribute","class",f),Se(t,f())})):Se(t,f);continue}if(a==="classList"){Ot(t,"class",f),typeof f=="function"?l.push(S(()=>{T(t,"attribute","class",f),ae(t,f())})):ae(t,f,l);continue}if(a==="style"){Ot(t,"style",f),typeof f=="function"?l.push(S(()=>{T(t,"attribute","style",f),ie(t,f())})):ie(t,f,l);continue}if(a.startsWith("on")){let b=a.slice(2).toLowerCase();d&&$t(t,b),f&&Rn(t,b,f);continue}let p=o??t.localName.includes("-"),g=yn.has(a)||!u&&a in t||p&&!u&&!yt(a);if(p&&!u&&!yt(a)&&c!==void 0&&typeof f=="function"&&!c.includes(a)){$()?gt(t,a,f):ce(t,a,f);continue}if(p&&!u&&!yt(a)&&$()){l.push(S(()=>{let b=typeof f=="function"?f():n[a];for(;typeof b=="function"&&b.length===0;)b=b();gt(t,a,b)}));continue}typeof f=="function"?l.push(g?je(t,a,f):Le(t,a,f,u)):l.push(S(()=>g?ce(t,a,n[a]):q(t,a,n[a],u)))}for(let a in r)if(!(a in n))if(a.startsWith("on")){let f=a.slice(2).toLowerCase();$t(t,f)}else yn.has(a)?ce(t,a,null):t.removeAttribute(a);return()=>{l.forEach(a=>a())}}function Wn(e,t,n=!1){for(let r in t){let i=t[r];if(r==="ref"){Be(i,e);continue}if(r!=="children"){if(r==="use"){Hn(e,i);continue}if(r.startsWith("on:")){jn(e,r.slice(3),i);continue}if(r.startsWith("prop:")){L(e,"prop",r.slice(5),i),je(e,r.slice(5),i);continue}if(r.startsWith("attr:")){L(e,"attr",r.slice(5),i),Le(e,r.slice(5),i,n);continue}if(r.startsWith("bool:")){L(e,"bool",r.slice(5),i),qn(e,r.slice(5),i);continue}if(r.startsWith("on")&&r.length>2){let s=r.slice(2).toLowerCase();if(typeof i=="function")if(Rt.has(s)){e[`$$${s}`]=i;let o=`__fx_${s}`;if(!e[o]){let c=u=>{e[`$$${s}`]?.(u)};e.addEventListener(s,c),e[o]=c}}else e[`$$${s}`]=i,_t.has(s)||Mt([s]);continue}if(r==="class"||r==="className"){Se(e,i);continue}if(r==="classList"){Ot(e,"class",i),typeof i=="function"?S(()=>{T(e,"attribute","class",i),ae(e,i())}):ae(e,i,[]);continue}if(r==="style"){Ot(e,"style",i),typeof i=="function"?S(()=>{T(e,"attribute","style",i),ie(e,i())}):ie(e,i,[]);continue}if(r==="innerHTML"){if(typeof i=="function"){let s=F(()=>{let o=i();for(;typeof o=="function";)o=o();e.innerHTML=o});A(()=>s())}else e.innerHTML=i;continue}if(r==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof i=="function"){let s=F(()=>{let o=i();for(;typeof o=="function"&&o.length===0;)o=o();document.activeElement!==e&&(e.value=o??"")});A(()=>{s()})}else S(()=>{document.activeElement!==e&&(e.value=t[r]??"")});continue}if(r==="checked"&&e.tagName==="INPUT"){if(typeof i=="function"){let s=F(()=>{let o=i();for(;typeof o=="function"&&o.length===0;)o=o();document.activeElement!==e&&(e.checked=o??"")});A(()=>{s()})}else S(()=>{document.activeElement!==e&&(e.checked=t[r]??"")});continue}if(r==="value"&&e.tagName==="SELECT"){if(typeof i=="function"){let s=!0,o=F(()=>{let c=i();for(;typeof c=="function"&&c.length===0;)c=c();s?(s=!1,queueMicrotask(()=>{e.value=c??""})):e.value=c??""});A(()=>{o()})}else{let s=!0;S(()=>{let o=t[r];s?(s=!1,queueMicrotask(()=>{e.value=o??""})):e.value=o??""})}continue}if(typeof i=="function"){let s=F(()=>{let o=i();for(;typeof o=="function"&&o.length===0;)o=o();mn(e,r,o,n)});A(()=>{s()})}else S(()=>mn(e,r,t[r],n))}}}function js(...e){let t=r=>{for(let i=e.length-1;i>=0;i--){let s=e[i];if(!s||!(r in s))continue;let o=s[r];if(o!==void 0)return o}},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 Hs(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:(u,l)=>c.has(l)?e[l]:void 0,has:(u,l)=>c.has(l)&&l in e,ownKeys:()=>Array.from(c).filter(u=>u in e),getOwnPropertyDescriptor:(u,l)=>c.has(l)&&l in e?r(l):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 Be(e,t){if(!e)return;let n=e[Et]?.name;if(L(t,"ref",n||typeof e=="function"&&e.name||"ref",e),We(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 qs(e,t,n){let r=t||document.body,i=it(()=>e),s=[];return me(()=>{let o=S(()=>{let c=i();Array.isArray(c)?(c.forEach(u=>r.appendChild(u)),s.push(()=>{c.forEach(u=>{u.parentNode===r&&r.removeChild(u)})})):We(c)&&(r.appendChild(c),s.push(()=>{c.parentNode===r&&r.removeChild(c)}))});s.push(o),A(()=>{s.forEach(c=>c())})}),null}function el(e){return typeof e=="string"&&e.toLowerCase()===e}function Ws(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 tl(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ne(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function nl(e){return typeof e=="function"&&e.length===0&&k(e)}function Ve(e,t,n){if(!t)throw new Error("Container element is required");let r,i,s=[];return W(o=>{me(()=>{h.active||(t.textContent=""),ls(t),fs(),I(t,e)}),i=o}),()=>{i?.(),r?.(),s.forEach(o=>o()),t.textContent=""}}function Bs(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 rl="__fx_dom_create_component__",ue=globalThis[rl]??={fn:null};function il(e){ue.fn=e}function sl(e={}){let t=e.signalSystem?.createComponent;t&&(ue.fn=t)}function Dt(e,t){let n=Eu();return n?E(n,()=>Ii(e,t)):Ii(e,t)}function Ii(e,t){if(ue.fn)return ue.fn(e,t);t&&li(t);let n=typeof e=="function"?ge(()=>e(t)):e,r=n!=null&&(typeof n=="function"||typeof n=="object");if(r)try{n.$name=e?.name}catch{}return r&&!bi(n)?Nn(n):n}var ol=()=>ue.fn!==null,Vs=()=>ue.fn!==null;function Fs(){ue.fn=null}var Bn="__FX_DATA__";function zs(e){return e.replace(/[<>&\u2028\u2029]/g,t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"))}var hn;function Us(){let e=globalThis.__FX_DATA__;if(e&&typeof e.nodeType!="number")return e;if(hn!==void 0)return hn;let t=null;if(typeof document<"u"){let n=document.getElementById(Bn)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return hn=t}function It(){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 Ks=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),He=typeof process<"u"&&process.env&&!1;function qe(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).`)}var cl=Symbol.for("fluixi.ownsContent");function Js(e){return e.localName.includes("-")?e.hasAttribute("data-fx-ssr")||e[cl]===!0:!1}function al(e){It();let t=h.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(Ss(t),Ks.has(e.toLowerCase())||Js(t)?h.cursor=t.nextSibling:(h.parents.push(t),h.cursor=t.firstChild),t):(He&&t&&qe(`<${e}>`,t),null)}function ul(e){Ks.has(e.localName)||Js(e)?h.cursor=e.nextSibling:(h.parents.push(e),h.cursor=e.firstChild)}function ll(e,t){It();let n=h.cursor;if(n&&n.nodeType===1&&n.tagName.toLowerCase()===e.toLowerCase()){let r=ku(n);return t&&r&&r!==t?(He&&qe(`<${e}> (another template)`,n),null):(Ss(n),h.cursor=n.nextSibling,n)}return He&&n&&qe(`<${e}> (static)`,n),null}function fl(e){if(e===""){let n=h.cursor;return n&&n.nodeType===3&&n.data!==""?(h.cursor=n.nextSibling,n.data="",n):null}It();let t=h.cursor;if(t&&t.nodeType===3){let n=t.data;return n.length>e.length&&n.startsWith(e)?(h.cursor=t.splitText(e.length),t):(h.cursor=t.nextSibling,n!==e&&(t.data=e),t)}return He&&t&&qe(`text ${JSON.stringify(e.slice(0,24))}`,t),null}function dl(e){It();let t=h.cursor;return t&&t.nodeType===8&&t.data===e?(h.cursor=t.nextSibling,t):(He&&t&&qe(`marker <!--${e.slice(0,24)}-->`,t),null)}var Li=!1;function Gs(){Li||(Li=!0,mu({hydrateElement:al,hydrateText:fl,hydrateMarker:dl,hydrateStatic:ll,enterElement:ul}))}var ji=()=>typeof location>"u"?null:`${location.pathname}${location.search}`;function Fe(e,t,n){Gs(),h.active=!0,h.cursor=t.firstChild,h.parents=[],ks(),xs(t);let r=Us(),i=n?.resourceNamespace,s=0;rt(()=>i?`${i}:r${s++}`:`r${s++}`);let o=ji();Ir(r?c=>c in r&&ji()===o?{value:r[c]}:void 0:null);try{return Ve(e,t)}finally{h.active=!1,h.cursor=null,h.parents=[]}}function hl(e,t){Gs(),xs(e);let n={active:h.active,cursor:h.cursor,parents:h.parents};h.active=!0,h.cursor=e.firstChild,h.parents=[];try{I(e,t()),Es(e)}finally{h.active=n.active,h.cursor=n.cursor,h.parents=n.parents}}var Vn="fluixi-island";function pl(e){let{component:t,props:n={},name:r}=e,i=Pt(Vn),s=r??t.name??"Island";q(i,"name",s),q(i,"props",JSON.stringify(n??{}));let o=$()?X():void 0;if(o){let c=o.nextIslandNamespace(s);I(i,()=>o.withResourceScope(c,()=>t(n)))}else I(i,()=>t(n));return i}var Hi=!1;function ml(){if(Hi||typeof document>"u")return;Hi=!0;let e=document.createElement("style");e.textContent=`${Vn}{display:contents}`,document.head.appendChild(e)}function yl(e){if(typeof document>"u")return;ml();let t=document.querySelectorAll(Vn),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{}Fe(()=>o(c),r,{resourceNamespace:`${i}#${s}`})})}function vl(e,...t){throw new Error("html`` was not compiled, enable the html format: fluixi({ format: 'html' }).")}function gl(e,...t){throw new Error("svg`` was not compiled, enable the html format: fluixi({ format: 'html' }).")}function bl(e,...t){throw new Error("css`` was not compiled: component styles need @fluixi-css/vite next to the fluixi plugin.")}function Ys(e,t={}){if(typeof e=="function")return Dt(e,t);if(typeof e!="string"||e.length===0)return null;let n=Ws(e),r=Pt(e,n);return Wn(r,t,n),wl(r,t),r}function wl(e,t){if(!t||t.children===void 0)return;let n=e.firstChild,r;h.active&&n?.nodeType===8&&n.data==="fx"?r=Dn(n):(n=qi("fx"),r=qi("fx/"),e.appendChild(n),e.appendChild(r));let i=n;I(e,Pn(i,()=>it(()=>t.children)),r,In(i,r))}function qi(e){return $()?Tt().createComment(e):document.createComment(e)}function Lt(e){return()=>{let t=e();return typeof t=="function"?t():t}}function Fn(e){let t=Lt(()=>e.when),n=w(t,void 0,{name:"Show.when"}),r=w(()=>!!n(),void 0,{name:"Show.cond"}),i=x(),s=null,o=null,c=u=>{u!==o&&(s&&pe(s),s=Z(i),o=u)};return w(()=>{let u=r();return c(u?"when":"fallback"),E(s,()=>{if(!u)return e.fallback;let l=e.children;if(typeof l=="function"){let a=l;if(a.length===0)return N(()=>a(N(n)));let f=n();return N(()=>a(f))}return l})},void 0,{name:"Show.result"})}function zn(e){let t=Lt(()=>e.each),n=()=>e.fallback??null,r=(i,s)=>{let o=e.children,c=Array.isArray(o)?o.map(u=>typeof u=="function"?u(i,s):u):typeof o=="function"?o(i,s):o;return Tn(c),c};return e.by?tt(t,e.by,(i,s)=>r(i,s),{fallback:n}):et(t,(i,s)=>r(i,s),{fallback:n})}function Un(e){let t=Lt(()=>e.each);return nt(t,(n,r)=>{let i=e.children(n,r);return Tn(i),i},{fallback:()=>e.fallback??null})}var wn=Symbol("match");function Kn(e){return{[wn]:!0,when:Lt(()=>e.when),get children(){return e.children}}}function Jn(e){let t=Array.isArray(e.children)?e.children:[e.children],n=x(),r=null,i=-1,s=o=>{o!==i&&(r&&pe(r),r=Z(n),i=o)};return w(()=>{for(let o=0;o<t.length;o+=1){let u=t[o],l=0;for(;typeof u=="function"&&!u[wn]&&l++<10;)u=u();if(!u||typeof u!="object"||u[wn]!==!0)continue;let a=u.when();if(a)return s(o),E(r,()=>{let f=u.children;return typeof f=="function"?f(a):f})}return s(-2),E(r,()=>e.fallback??null)},void 0,{name:"Switch"})}function Gn(e){let t=()=>{let c=e.component;return k(c)?c():c},[,n]=Hs(e,["component"]),r=x(),i=null,s,o;return w(()=>{let c=t();return c===s||(i&&pe(i),i=Z(r),s=c,o=c==null?null:E(i,()=>N(()=>typeof c=="string"?Ys(c,n):Dt(c,n)))),o},void 0,{name:"Dynamic"})}function Yn(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return W(i=>{n=i,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),I(r,e.children)&&Be(e.ref,r)}),A(()=>{n(),r.remove()}),null}function Xs(e){if($())return e.fallback??null;let t=h.active,[n,r]=V(!t);return t&&queueMicrotask(()=>r(!0)),w(()=>n()?e.children:e.fallback??null,void 0,{name:"client-only"})}var Sl=Xs;function Xn(e){let t=Wr(),n=o=>!!o&&typeof o.then=="function",r=o=>typeof e.fallback=="function"?e.fallback(o,t.reset):e.fallback,i=o=>{if(n(o))throw o;return queueMicrotask(()=>t.setError(o)),null},s=o=>{if(Array.isArray(o))return o.map(s);if(typeof o!="function")return o;let c=o;return()=>{try{return s(c())}catch(u){return i(u)}}};return w(()=>{let o=t.error();if(o!==void 0)return r(o);try{return Br(t,()=>{let c=e.children;return s(typeof c=="function"?c():c)})}catch(c){return i(c),r(c)}},void 0,{name:"ErrorBoundary"})}function xl(e){return w(()=>{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 kl(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function El(e){return w(()=>{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(`${kl(r)}: ${s}`)}return n.join("; ")},void 0,{name:"StyleMap"})}var Al=Symbol.for("fluixi.owner"),jt=1,Zs=3,Qs=8,_l=Symbol.for("fluixi.serverElementRenderer"),Wi=Symbol.for("fluixi.serverElementRendered");function vt(e){if(e.nodeType!==jt)return;let t=e;if(typeof t.localName!="string"||!t.localName.includes("-")||t[Wi])return;let n=globalThis[_l];n&&(t[Wi]=!0,n(t))}var eo;eo=Ct;var Ht=class{constructor(){this[eo]=!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),vt(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),vt(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,vt(e)),t}addEventListener(){}removeEventListener(){}},Zn=class to extends Ht{constructor(t){super(),this.nodeType=Zs,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 to(this.data)}},$l=class no extends Ht{constructor(t){super(),this.nodeType=jt,this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new no(this.rawOuterHTML)}},ro=class io extends Ht{constructor(t){super(),this.nodeType=Qs,this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new io(this.data)}},Ol=class{constructor(){this.cssText=""}setProperty(e,t){this[e]=t}removeProperty(e){delete this[e]}},Cl=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}},Sn=class so extends Ht{constructor(t,n=!1){if(super(),this.nodeType=jt,this.attributes=new Map,this.style=new Ol,this.classList=new Cl(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,this.localName.includes("-")){let r=x();r&&(this[Al]=r)}}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 Zn(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 so(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}},Tl=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),oo=/&/g,co=/</g,ao=/>/g,Nl=/"/g;function pn(e){return e.replace(oo,"&").replace(co,"<").replace(ao,">")}function Bi(e){return e.replace(oo,"&").replace(Nl,""").replace(co,"<").replace(ao,">")}function Rl(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Ml(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(`${Rl(n)}: ${r}`)}return t.join("; ")}function Pl(e){let t="",n=Ml(e.style);for(let[r,i]of e.attributes)r==="style"&&n||(t+=` ${r}="${Bi(i)}"`);if(n){let r=e.attributes.get("style"),i=r?`${r.replace(/;\s*$/,"")}; ${n}`:n;t+=` style="${Bi(i)}"`}return t}function ne(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return pn(e);if(typeof e=="number")return pn(String(e));if(typeof e=="function")return ne(e());if(Array.isArray(e))return e.map(ne).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case Zs:return pn(e.data??"");case Qs:return`<!--${e.data??""}-->`;case jt:{vt(e);let t=e.localName,n=`<${t}${Pl(e)}>`;if(Tl.has(t))return n;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(ne).join("");return`${n}${r}</${t}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(ne).join(""):""}var Dl=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Il={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function Vi(e){return e.replace(/&(#?\w+);/g,(t,n)=>Il[n]??t)}var K=class extends Error{};function Ll(e,t=!1){let n=0,r=[],i=[],s=l=>{let a=i[i.length-1];a?a.appendChild(l):r.push(l)};for(;n<e.length;){let l=e.indexOf("<",n);if(l===-1){c(e.slice(n));break}if(l>n&&c(e.slice(n,l)),e.startsWith("<!--",l)){let a=e.indexOf("-->",l);if(a===-1)throw new K(`unterminated comment at ${l}`);s(new ro(e.slice(l+4,a))),n=a+3;continue}if(e[l+1]==="/"){let a=e.indexOf(">",l);if(a===-1)throw new K(`unterminated closing tag at ${l}`);let f=e.slice(l+2,a).trim().toLowerCase(),d=i.pop();if(!d||d.localName!==f)throw new K(`</${f}> does not close <${d?.localName??"nothing"}>`);n=a+1;continue}n=u(l)}if(i.length>0)throw new K(`unclosed <${i[i.length-1].localName}>`);let o=r[0];if(r.length!==1||!(o instanceof Sn))throw new K(`expected exactly one root element, got ${r.length}`);return o;function c(l){l!==""&&s(new Zn(Vi(l)))}function u(l){let a=/[\s/>]/.exec(e.slice(l+1));if(!a)throw new K(`unterminated tag at ${l}`);let f=e.slice(l+1,l+1+a.index).toLowerCase(),d=new Sn(f,t),p=l+1+a.index;for(;p<e.length;){for(;p<e.length&&/\s/.test(e[p]);)p++;if(e[p]===">"){p++;break}if(e[p]==="/"&&e[p+1]===">"){p+=2;break}let g=p;for(;p<e.length&&!/[\s=/>]/.test(e[p]);)p++;let v=e.slice(g,p);if(v==="")throw new K(`malformed attribute at ${p}`);if(e[p]==="="){if(e[p+1]!=='"')throw new K(`attribute ${v} must have a double-quoted value`);let b=e.indexOf('"',p+2);if(b===-1)throw new K(`unterminated value for ${v}`);d.setAttribute(v,Vi(e.slice(p+2,b))),p=b+1}else d.setAttribute(v,"")}return s(d),Dl.has(f)||i.push(d),p}}var Fi=!1;function uo(){Fi||(Fi=!0,Ia({createElement:(e,t)=>new Sn(e,t),createText:e=>new Zn(e),createRaw:e=>new $l(e),parseTemplate:(e,t)=>Ll(e,t),createComment:e=>new ro(e)}))}function jl(e,t={}){let n=$();uo(),Me(!0);let r=An(t.event);r.hydrationKeys=t.hydrationKeys!==!1;try{return $n(r,()=>W(i=>{try{let s=typeof e=="function"?e():e;return ne(s)}finally{i()}}))}finally{_n(r),Me(n)}}var zi=!1,Ui=new WeakMap;function Hl(){zi||(zi=!0,Dr(e=>{X()?.pending.add(e)}),rt(()=>X()?.nextResourceId()??""),Lr((e,t)=>{e&&X()?.data.set(e,t)}),Hr(()=>{let e=X();if(!e)return;let t=Ui.get(e);return t||Ui.set(e,t=jr()),t}))}var xn=null;function ql(e){xn=e}function lo(e){if(e.data.size===0)return"";let t={};for(let[r,i]of e.data){let s=i;if(xn)try{s=xn(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=zs(JSON.stringify(t));return n==="{}"?"":`<script type="application/json" id="${Bn}">${n}<\/script>`}var Wl=50;async function Bl(e,t={}){let n=$();uo(),Me(!0),Hl();let r=An(t.event);r.hydrationKeys=t.hydrationKeys!==!1;try{return await $n(r,async()=>{t.preload&&await t.preload(t.event);let i,s=null,o=()=>{};W(a=>{o=a,s=x(),i=typeof e=="function"?e():e});let c=()=>{try{E(s,()=>ne(i))}catch{}};c();let u=0;for(;r.pending.size>0&&u++<Wl;){let a=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(a),await Mr(),c()}let l=E(s,()=>ne(i))+lo(r);return o(),l})}finally{_n(r),Me(n)}}var Vl={createComponent:Dt,createElement:is,createNativeElement:Pt,createTemplate:Mn,cloneTemplate:Ln,templateNode:Ps,holeContent:In,holeEnd:Dn,holeScope:Pn,createPortal:qs,render:Ve,hydrate:Fe,insert:I,appendChildren:os,removeChildren:ss,spread:Ls,applyProps:Wn,mergeProps:js,bindPair:Bs,setProperty:ce,setDynamicProperty:je,setAttribute:q,setDynamicAttribute:Le,removeAttribute:rs,getAttribute:ns,setClassName:Se,addClass:Qi,removeClass:es,toggleClass:ts,setStyles:En,delegateEvents:Mt,addDelegatedEventListener:Rn,removeDelegatedEventListener:$t,handleRef:Be,resetIntegration:Fs,isIntegrationInitialized:Vs},Fl=Vl;function zl(e){let t=(n,r)=>{n.parent=r;let i=Ul(n);for(let s of i)t(s,n)};return t(e,null),e}function Ul(e){switch(e.kind){case"Root":case"Element":case"Component":case"Fragment":return e.children;default:return[]}}var Kl=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()}}},fo=new Set(["capture","once","passive","prevent","stop","self"]);function se(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 po=(e,t)=>({kind:"Attribute",name:t?e.name.slice(1):e.name,value:e.value,boolean:t,loc:e.loc}),mo=[{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)fo.has(o)||e.report("invalid-directive",`Unknown event modifier ".${o}" — expected one of ${[...fo].join(", ")}`);return{kind:"EventBinding",name:s,syntax:t,modifiers:i,hole:se(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:se(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:se(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:se(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:se(e,"if directive"),loc:e.loc})},{id:"each",elementOnly:!0,match:e=>e==="each",build:e=>({kind:"EachDirective",hole:se(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:se(e,"ref binding"),loc:e.loc})},{id:"property",match:e=>e[0]===".",build:e=>({kind:"PropertyBinding",name:e.name.slice(1),hole:se(e,"property binding"),loc:e.loc})},{id:"boolean",match:e=>e[0]==="?",build:e=>po(e,!0)}];function Jl(e,t=mo,n={component:!1}){for(let r of t)if(!(r.elementOnly&&n.component)&&r.match(e.name))return r.build(e);return po(e,!1)}var Gl=new Set(["svg","g","defs","symbol","use","switch","view","desc","metadata","path","circle","ellipse","line","polygon","polyline","rect","image","text","tspan","textPath","linearGradient","radialGradient","stop","pattern","mask","clipPath","marker","foreignObject","animate","animateMotion","animateTransform","mpath","set","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Yl=new Set(["script","style","textarea","title"]),Xl=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Zl(e){return e.length>0&&(e[0]!==e[0].toLowerCase()||e.includes("."))}var Ql=new Set(["a","button","input","select","textarea","summary","details","option","label"]),ef=new Set(["keydown","keyup","keypress"]);function xe(e,t){return e.attributes.find(n=>"name"in n&&n.name===t)}function tf(e){return e.attributes.some(t=>t.kind==="Spread")}function qt(e,t){let n=xe(e,t);if(!n||n.kind!=="Attribute"||!n.value)return;let r=n.value;return r.kind==="static"?r.value:void 0}function nf(e){let t=qt(e,"role");return t==="presentation"||t==="none"?!0:qt(e,"aria-hidden")==="true"}function ho(e,t){return e.attributes.some(n=>n.kind==="EventBinding"&&t(n.name))}function rf(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"&&sf(s,n);let o="children"in s?s.children:void 0;o&&r(o)}};return r(e.children),t}function sf(e,t){if(tf(e))return;let n=e.tag.toLowerCase();n==="img"&&!xe(e,"alt")&&!nf(e)&&t(e,"a11y-img-alt",'An `img` needs an `alt`. Use `alt=""` when the image is decorative.'),n==="a"&&!xe(e,"href")&&!xe(e,"role")&&t(e,"a11y-anchor-href","An `a` without `href` is not a link. Use a `button` for an action."),n==="iframe"&&!xe(e,"title")&&t(e,"a11y-iframe-title","An `iframe` needs a `title` describing its content.");let r=qt(e,"tabindex")??qt(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."),!Ql.has(n)&&ho(e,i=>i==="click")&&!xe(e,"role")&&!ho(e,i=>ef.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 of=/[A-Za-z0-9\-_:@.?]/,cf=class{constructor(e,t){this.diagnostics=[],this.r=new Kl(e),this.svg=t.svg??!1,this.directives=t.directives??mo,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 zl(n),this.validateTree(n),this.accessibility&&this.diagnostics.push(...rf(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=Zl(t),r=this.parseAttributes(n);this.foldEachKey(r,e),this.r.skipWhitespace();let i=t.toLowerCase(),s=!n&&Yl.has(i),o=!n&&Xl.has(i),c=!1,u=[];if(this.r.startsWith("/>"))this.r.advance(),this.r.advance(),c=!0;else if(this.r.peek()===">"&&this.r.advance(),!o)if(u=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 l=this.r.span(e);if(n)return{kind:"Component",tag:t,tagHole:null,attributes:r,children:u,selfClosing:c,loc:l};let a=this.svg||Gl.has(t)?"svg":"html";return{kind:"Element",tag:t,namespace:a,attributes:r,children:u,selfClosing:c,rawText:s,loc:l}}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 u=this.r.takeHole();t.push({kind:"Spread",hole:u.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,u)=>this.report(c,"error",u,this.r.span(n))};t.push(Jl(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 a of e)a.kind==="EachDirective"?(n=a,i++):a.kind==="IfDirective"?r++:a.kind==="ElseDirective"?s++:a.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 u=e.findIndex(a=>a.kind==="Attribute"&&a.name==="key");if(!n){u!==-1&&this.report("invalid-directive","error","`key` requires an `each` directive on the same element",c);return}if(u===-1)return;let l=e[u];l.kind==="Attribute"&&l.value&&(l.value.kind==="static"?n.key={static:l.value.value}:l.value.kind==="hole"&&(n.key={hole:l.value.hole})),e.splice(u,1)}readName(){return this.r.readWhile(e=>of.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 er(e,t={}){return new cf(e,t).parse()}function af(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 yo(e,t={}){return er(af(e),t)}var vo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",uf=new Uint8Array(64),lf=new Uint8Array(128);for(let e=0;e<vo.length;e++){let t=vo.charCodeAt(e);uf[e]=t,lf[t]=e}var fh=1024*16,go="data-fx-s";function ff(e,t){let n=r=>{let i=r.children;if(i)for(let s=i.length-1;s>=0;s--){let o=i[s];o.kind==="element"&&o.tag==="style"&&t.owner?i.splice(s,1):n(o)}t.scope&&r.kind==="element"&&r.tag!=="style"&&r.props&&!r.props.some(s=>s.name===go)&&r.props.unshift({name:go,kind:"attr",literal:t.scope})};n(e)}function df(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 hf(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=df(c),o)break;return!o&&!s&&(o=pf(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 pf(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 ir={kind:"eager"},mf=["pointerdown","focusin","keydown"],bo=new Set(["eager","idle","visible","interaction","media","never"]),Wt=class extends Error{};function yf(e,t){let n=e.slice(5);if(!bo.has(n))throw new Wt(`Unknown load strategy 'load:${n}'. Expected one of ${[...bo].join(", ")}.`);switch(n){case"eager":return ir;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?vf(t):[...mf]};case"media":if(!t)throw new Wt(`'load:media' needs a query, e.g. load:media="(min-width: 1024px)".`);return{kind:"media",query:t};default:throw new Wt(`Unhandled load strategy '${n}'.`)}}function vf(e){let t=e.split(/[\s,]+/).map(n=>n.trim()).filter(Boolean);if(t.length===0)throw new Wt("'load:interaction' was given no event names.");return t}function gf(e){return e.kind!=="eager"&&e.kind!=="never"}var or=["Show","For","Index","Switch","Match","Portal","Dynamic","ErrorBoundary"],cr=["Suspense","SuspenseList","Await"],ar=["Router","Outlet","Redirect","Link"],dh=[...or,...cr,...ar],wo=new Set([...or,...cr]);function bf(e={}){let{controlFlowModule:t="@fluixi/dom",coreModule:n="@fluixi/core",routerModule:r="@fluixi/core/router"}=e,i={};for(let s of or)i[s]=t;for(let s of cr)i[s]=n;for(let s of ar)i[s]=r;return i}function wf(e,t={}){let{resolver:n,isBound:r,modules:i,strategyFor:s}=t,o=bf(i),c=new Map,u=new Set,l=f=>{let{name:d}=f;if(!d||d.includes(".")||r?.(d))return;let p=a(d);if(!p){u.add(d);return}let g=p.origin==="builtin"&&wo.has(d)?ir:s?.(f)??ir;f.source={...p,loading:g},c.set(d,f.source)},a=f=>{if(wo.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(ar.includes(f))return{module:o[f],export:f,origin:"builtin"}};return ur(e,f=>{f.kind==="component"&&l(f)}),{resolved:c,unresolved:[...u]}}function ur(e,t){let n=Array.isArray(e)?e:[e];for(let r of n){t(r);let i=r.children;i&&ur(i,t)}}function Sf(e){let t=[];ur(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;gf(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 xf=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Co={className:"class",htmlFor:"for"},To=new Set(["innerHTML","outerHTML","innerText","textContent","value","checked","selected","muted","defaultValue","defaultChecked","children","ref"]),kf=new Set(["script","style","textarea","title"]);function No(e){return kf.has(e)}function Ro(e){return Co[e]??e}function ke(e){return e.kind!=="attr"||e.expr!==void 0||e.name.includes(":")?!1:!To.has(e.name)}function Mo(e){if(!e.static||No(e.tag))return!1;for(let t of e.props)if(!ke(t))return!1;for(let t of e.children)if(t.kind!=="text"&&!(t.kind==="element"&&Mo(t)))return!1;return!0}function lr(e){let t=e.props.map($f).filter(Boolean).join(""),n=`<${e.tag}${t}>`;return xf.has(e.tag)?n:`${n}${e.children.map(Ef).join("")}</${e.tag}>`}function Ef(e){if(e.kind==="text")return Cf(e.value);if(e.kind!=="element")throw new Error(`serializeStatic: unexpected ${e.kind}`);return lr(e)}var Af=new Set(["draggable","spellcheck","contenteditable"]);function _f(e){return e.startsWith("aria-")||Af.has(e.toLowerCase())}function $f(e){let t=Co[e.name]??e.name,n=e.literal;return(n===!0||n===!1||n===void 0)&&_f(t)?` ${t}="${n!==!1}"`:n===!0||n===void 0?` ${t}`:n===!1||n===null?"":` ${t}="${Of(String(n))}"`}function Of(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Cf(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function So(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 Tf="<!--fx-->",Nf="<!--fx/-->";function Bt(e){return e.kind==="expr"||e.kind==="component"||e.kind==="control"}function Rf(e){return e.kind==="text"||e.kind==="element"&&Po(e)}var Mf=new Set(["indeterminate"]);function Pf(e){if(e.kind==="spread")return null;if(e.name==="ref")return"ref";if(e.name==="use")return"use";if(e.kind==="event")return e.event?"event":null;if(e.kind==="prop")return"property";if(e.kind!=="attr")return null;let t=e.name;return t.startsWith("on:")?"nativeEvent":t.startsWith("prop:")?"property":t.startsWith("attr:")?"attr":t.startsWith("bool:")?"boolAttr":t==="className"||t==="class"?ke(e)?"serialize":"class":t==="classList"?ke(e)?"serialize":e.reactive?"classListDynamic":"classList":t==="style"?ke(e)?"serialize":e.reactive?"styleDynamic":"style":t.includes(":")||To.has(t)?null:Mf.has(t)?"property":e.expr===void 0?ke(e)?"serialize":null:"attr"}function Df(e){let t=[],n=new Map;for(let r of e.props)n.has(r.name)||t.push(r.name),n.set(r.name,r);return t.map(r=>n.get(r))}function Vt(e){let t=e.tag.includes("-"),n={serialize:[],bindings:[]};for(let r of Df(e)){let i=Pf(r);if(i===null)return null;if(i==="serialize"){n.serialize.push(r);continue}if(t)return null;n.bindings.push({prop:r,kind:i})}return n}function Po(e){return e.svg||No(e.tag)||!Vt(e)?!1:e.children.every(t=>Rf(t)||Bt(t))}function Do(e){if(Bt(e))return!0;let t=e.children;return t?t.some(Do):!1}function Io(e){if(e.kind!=="element")return!1;let t=Vt(e);return t&&t.bindings.length>0?!0:e.children.some(Io)}function tr(e){return Do(e)||Io(e)}function Lo(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"||Lo(t))}function If(e){if(!Po(e)||!Lo(e)||!tr(e))return null;let t=[],n=[],r=[],i=0,s=c=>{let u=`_n$${i++}`;return t.push({ref:u,expr:c}),u};return o(e,"_el$"),{html:Lf(e),tag:e.tag,steps:t,holes:n,bindings:r};function o(c,u){let l=Vt(c);if(l)for(let d of l.bindings)r.push({ref:u,prop:d.prop,kind:d.kind});let a=-1;c.children.forEach((d,p)=>{tr(d)&&(a=p)});let f=null;for(let d=0;d<=a;d++){let p=c.children[d],g=f?`${f}.nextSibling`:`${u}.firstChild`;if(Bt(p)){let b=s(g),C=s(`holeEnd(${b})`);n.push({parentRef:u,startRef:b,endRef:C,node:p}),f=C;continue}let v=s(g);p.kind==="element"&&tr(p)&&o(p,v),f=v}}}function Lf(e){return lr(jo(e)).split(Ho).join(Tf+Nf)}function jo(e){let t=Vt(e);return{...e,props:t?t.serialize:[],children:e.children.map(n=>Bt(n)?{kind:"text",value:Ho}:n.kind==="element"?jo(n):n)}}var Ho="\0fx-hole\0",qo={version:1,module:"@fluixi/dom",symbols:["createNativeElement","insert","spread","setAttribute","delegateEvents","createComponent","createMemo","untrack","Show","For","Index","Switch","Match","Dynamic","ErrorBoundary"]},hh={version:2,module:"@fluixi/dom",symbols:[...qo.symbols,"template","cloneTemplate","walk"]},P="@fluixi/reactive/signal",jf={$signal:{export:"signal",module:P,returns:"signal-handle"},$memo:{export:"memo",module:P,returns:"memo-handle"},$effect:{export:"effect",module:P,returns:"effect"},$store:{export:"store",module:"@fluixi/reactive/store",returns:"store-handle"},$resource:{export:"resource",module:P,returns:"resource-handle"},$cachedResource:{export:"cachedResource",module:"@fluixi/reactive/cached-resource",returns:"resource-handle"},$selector:{export:"createSelector",module:P,returns:"memo-accessor"},$deferred:{export:"createDeferred",module:P,returns:"memo-accessor"},$untrack:{export:"untrack",module:P,returns:"plain"},$untrackStore:{export:"untrackStore",module:"@fluixi/reactive/store",returns:"plain"},$batch:{export:"batch",module:P,returns:"plain"},$cleanup:{export:"onCleanup",module:P,returns:"plain"},$root:{export:"root",module:P,returns:"plain"},$context:{export:"context",module:P,returns:"plain"},$renderEffect:{export:"renderEffect",module:P,returns:"effect"},$computed:{export:"computed",module:P,returns:"effect"},$storage:{export:"useStorage",module:"@fluixi/core/storage",returns:"plain"},$asyncStorage:{export:"useAsyncStorage",module:"@fluixi/core/storage",returns:"plain"},$persisted:{export:"persisted",module:"@fluixi/core/storage",returns:"signal-handle"},$env:{export:"env",module:"@fluixi/start/env",returns:"plain"}},ph=new RegExp(`\\$(?:${Object.keys(jf).map(e=>e.slice(1)).join("|")})\\s*\\(`),Hf="__fx_source",qf="__fx_hole",ze=(e,t,n,r)=>`(globalThis.${qf} ?? ((f) => f))(${e},${t},${n}${r===void 0?"":`,${JSON.stringify(r)}`})`,Wf="__fx_props",Bf=(e,t)=>`(globalThis.${Wf} ?? ((p) => p))(${e},${JSON.stringify(t)})`;function Wo(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
|
|
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 Ff(e){return e!==""&&/[A-Za-z0-9_$)\]]/.test(e)}function zf(e){let t=0,n="",r=0;for(;r<e.length;){let i=e[r];if(i==='"'||i==="'"){let s=Wo(e,r);if(s<0)return null;r=s,n=i}else if(i==="`"){let s=Bo(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==="/"&&!Ff(n)){let s=Vf(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 _(e,t){let n=e.trim();return n===""?`(${e})`:t==="arrowBody"&&n[0]==="{"?`(${e})`:zf(n)===!1?e:`(${e})`}var Uf={show:"Show",for:"For",index:"Index",switch:"Switch",match:"Match",dynamic:"Dynamic",errorBoundary:"ErrorBoundary",suspense:"Suspense"};function Kf(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function sr(e){return Kf(e)?e:JSON.stringify(e)}function Vo(e){if(e.expr!==void 0){if(e.name==="ref"&&e.at)return ze(_(e.expr,"value"),e.at.line,e.at.column,e.expr);if(!e.reactive)return _(e.expr,"value");let t=`() => ${_(e.expr,"arrowBody")}`;return e.at?ze(t,e.at.line,e.at.column,e.directive):t}return JSON.stringify(e.literal??!0)}function Jf(e){return e.expr!==void 0?_(e.expr,"value"):JSON.stringify(e.literal??!0)}function Gf(e,t,n){let r=e.filter(c=>c.kind==="spread"),s=e.filter(c=>c.kind!=="spread").map(c=>`${sr(c.name)}: ${Vo(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 xo(e,t){return t?ze(e,t.line,t.column):e}function Fo(e,t,n){if(e.length===1)return Ue(e[0],t,n);let r=!1;return`[${e.map(s=>{let o=Ue(s,t,n);return s.kind==="element"&&r?(t.add("deferElement"),`deferElement(() => ${_(o,"arrowBody")})`):((s.kind==="component"||s.kind==="control"||s.kind==="expr"&&s.reactive)&&(r=!0),o)}).join(", ")}]`}function ko(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"),u=c.map(d=>[d.name,Jf(d)]);n.length>0&&u.push(["children",Fo(n,r,i)]);let l=`{ ${u.map(([d,p])=>`get ${sr(d)}() { return ${p}; }`).join(", ")} }`;if(u.some(([,d])=>/\bthis\b/.test(d))){let d=u.map(([g,v])=>`${JSON.stringify(g)}: () => (${v})`);l=`((_$t) => ({ ${u.map(([g])=>`get ${sr(g)}() { return _$t[${JSON.stringify(g)}](); }`).join(", ")} }))({ ${d.join(", ")} })`}o.length>0&&(r.add("mergeProps"),l=`mergeProps(${o.map(d=>d.expr).join(", ")}, ${l})`);let a={};for(let d of c)d.at&&(a[d.name]=[d.at.line,d.at.column]);Object.keys(a).length&&(l=Bf(l,a));let f=s?`globalThis.${Hf}?.(${JSON.stringify(s.file)},${s.line},${s.column},${JSON.stringify(e)}), `:"";return`createMemo(${_(`${f}() => createComponent(${e}, ${l})`,"value")})`}function nr(e){let t=e.prop.name;return e.kind==="boolAttr"||t.startsWith("prop:")||t.startsWith("attr:")?t.slice(5):Ro(t)}function Yf(e,t){let{ref:n,prop:r,kind:i}=e,s=Vo(r);switch(i){case"class":return t.add("setClassName"),`setClassName(${n}, ${s});`;case"classList":return t.add("setClassList"),`setClassList(${n}, ${s}, []);`;case"classListDynamic":return t.add("setDynamicClassList"),`setDynamicClassList(${n}, ${s});`;case"style":return t.add("setStyle"),`setStyle(${n}, ${s}, []);`;case"styleDynamic":return t.add("setDynamicStyle"),`setDynamicStyle(${n}, ${s});`;case"attr":return t.add("setDynamicAttribute"),`setDynamicAttribute(${n}, ${JSON.stringify(nr(e))}, ${s});`;case"property":return t.add("setDynamicProperty"),`setDynamicProperty(${n}, ${JSON.stringify(nr(e))}, ${s});`;case"boolAttr":return t.add("setDynamicBoolAttribute"),`setDynamicBoolAttribute(${n}, ${JSON.stringify(nr(e))}, ${s});`;case"event":return t.add("addDelegatedEventListener"),`addDelegatedEventListener(${n}, ${JSON.stringify(r.event.name)}, ${s});`;case"nativeEvent":return t.add("addNativeEventListener"),`addNativeEventListener(${n}, ${JSON.stringify(r.name.slice(3))}, ${s});`;case"ref":return t.add("handleRef"),`handleRef(${s}, ${n});`;case"use":return t.add("applyUse"),`applyUse(${n}, ${s});`}}function Xf(e,t){let n=Ro(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 zo=!1;function Ue(e,t,n){switch(e.kind){case"text":return JSON.stringify(e.value);case"expr":{if(!e.reactive)return _(e.code,"value");let r=`() => ${_(e.code,"arrowBody")}`;return e.at?ze(r,e.at.line,e.at.column):r}case"fragment":return e.children.length===0?"null":Fo(e.children,t,n);case"component":return xo(ko(e.name,e.props,e.children,t,n,e.at),e.bindAt??e.at);case"control":{let r=Uf[e.control]??e.control;return t.add(r),xo(ko(r,e.props,e.children,t,n),e.bindAt)}case"element":{if(n&&e.static&&!e.svg&&Mo(e)){t.add("templateNode");let c=`_tmpl$${n.length}`;n.push({id:c,html:lr(e),tag:e.tag,svg:!1});let u=So(e);return u?`templateNode(${c}, ${JSON.stringify(e.tag)}, false, false, ${JSON.stringify(u)})`:`templateNode(${c}, ${JSON.stringify(e.tag)})`}if(n&&zo){let c=If(e);if(c){t.add("templateNode"),t.add("insert"),t.add("holeEnd"),t.add("holeContent"),t.add("holeScope");let u=`_tmpl$${n.length}`;n.push({id:u,html:c.html,tag:c.tag,svg:!1});let l=So(e),a=[`const _el$ = templateNode(${u}, ${JSON.stringify(c.tag)}, true${l?`, false, ${JSON.stringify(l)}`:""});`];for(let f of c.steps)a.push(`const ${f.ref} = ${f.expr};`);for(let f of c.bindings)a.push(Yf(f,t));for(let f of c.holes)a.push(`insert(${f.parentRef}, holeScope(${f.startRef}, () => ${_(Ue(f.node,t,n),"arrowBody")}), ${f.endRef}, holeContent(${f.startRef}, ${f.endRef}));`);return a.push("return _el$;"),`(() => { ${a.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(ke))for(let c of e.props)s.push(Xf(i,c));else{t.add("spread");let c=e.svg?", isSVG: true":"",u=e.props.filter(a=>a.kind!=="spread"&&a.expr!==void 0&&a.reactive&&a.name!=="ref").map(a=>a.name),l=e.tag.includes("-")?`, isCustomElement: true, accessors: ${JSON.stringify(u)}`:"";s.push(`spread({ element: ${i}, props: ${Gf(e.props,null,t)}${c}${l} });`)}for(let c of e.children){t.add("insert");let u=Ue(c,t,n),l=c.kind==="expr"&&(c.reactive||!Qf(c.code))||c.kind==="component"||c.kind==="control";s.push(l?`insert(${i}, ${u}, null);`:`insert(${i}, ${u});`)}return s.push(`return ${i};`),`(() => { ${s.join(" ")} })()`}}}var Zf=/^\s*(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`$]*`|-?\d[\d_.eE+-]*|true|false|null|undefined)\s*$/,Qf=e=>Zf.test(e);function Uo(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 Ko={name:"imperative",contract:qo,emit(e,t){let n=new Set,r=t?.templateClone!==!1?[]:void 0;return zo=t?.partialTemplates===!0,{code:Ue(e,n,r),imports:Array.from(n),templates:r}}},ed=e=>"components"in e;function Eo(e,t){return e.replace(/\$(\d+)/g,(n,r)=>t[Number(r)]??n)}function td(e,t){return typeof t=="string"?{module:t,export:e}:t}function nd(e=[]){let t=new Map,n=[],r=[];for(let o of e){if(!ed(o)){r.push(o);continue}for(let[c,u]of Object.entries(o.components)){let l=td(c,u),a=t.get(c);if(a&&a.module!==l.module){let f=n.find(d=>d.name===c);f?f.modules.push(l.module):n.push({name:c,modules:[a.module,l.module]});continue}t.set(c,l)}}let i=new Map;return{resolve:o=>{if(i.has(o))return i.get(o);let c=t.get(o);if(!c)for(let u of r){let l=o.match(new RegExp(u.match.source,u.match.flags.replace("g","")));if(l){c={module:Eo(u.module,l),export:u.export?Eo(u.export,l):o};break}}return i.set(o,c),c},names:()=>[...t.keys()],conflicts:()=>n}}function Ao(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 _o={quot:34,amp:38,apos:39,lt:60,gt:62,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,copy:169,ordf:170,laquo:171,not:172,shy:173,reg:174,macr:175,deg:176,plusmn:177,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,sup1:185,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,Agrave:192,Aacute:193,Acirc:194,Atilde:195,Auml:196,Aring:197,AElig:198,Ccedil:199,Egrave:200,Eacute:201,Ecirc:202,Euml:203,Igrave:204,Iacute:205,Icirc:206,Iuml:207,ETH:208,Ntilde:209,Ograve:210,Oacute:211,Ocirc:212,Otilde:213,Ouml:214,times:215,Oslash:216,Ugrave:217,Uacute:218,Ucirc:219,Uuml:220,Yacute:221,THORN:222,szlig:223,agrave:224,aacute:225,acirc:226,atilde:227,auml:228,aring:229,aelig:230,ccedil:231,egrave:232,eacute:233,ecirc:234,euml:235,igrave:236,iacute:237,icirc:238,iuml:239,eth:240,ntilde:241,ograve:242,oacute:243,ocirc:244,otilde:245,ouml:246,divide:247,oslash:248,ugrave:249,uacute:250,ucirc:251,uuml:252,yacute:253,thorn:254,yuml:255,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},rd=/&(?:#[xX]([0-9a-fA-F]{1,6})|#([0-9]{1,7})|([a-zA-Z][a-zA-Z0-9]{1,31}));/g;function rr(e){return e.includes("&")?e.replace(rd,(t,n,r,i)=>{let s=n?parseInt(n,16):r?parseInt(r,10):Object.prototype.hasOwnProperty.call(_o,i)?_o[i]:void 0;return s!==void 0&&s<=1114111?String.fromCodePoint(s):t}):e}var $o=new Set(["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup"]);function id(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}var sd="container";function Oo(e){return e.charAt(0).toUpperCase()+e.slice(1)}var od=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}=Ko.emit(e,{});for(let i of n)this.used.add(i);return Uo(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],u=c&&(c.kind==="Element"||c.kind==="Component")&&c.attributes.some(l=>l.kind==="ElseDirective");t.push(this.lowerIf(r,s.hole,u?c:null)),u&&(n=o);continue}}let i=this.lowerNode(r);i&&t.push(i)}return t}isBlankText(e){return e.kind==="Text"&&!e.raw&&Ao(e.value)===""}lowerNode(e){switch(e.kind){case"Text":{if(e.raw)return{kind:"text",value:e.value};let t=rr(Ao(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(s=>s.kind==="Attribute"&&s.name==="is");if(e.tag==="component"&&t&&t.value&&t.value.kind==="hole"){let s=e.attributes.filter(c=>c!==t),o=this.lowerComponent({...e,kind:"Component",tag:"Dynamic",tagHole:null,attributes:s});return o.props.unshift({name:"component",kind:"attr",expr:`() => ${_(this.hole(t.value.hole).code,"arrowBody")}`}),o}let n=this.lowerEach(e),r=n?[n]:this.lowerChildren(e.children);if(e.tag===sd)return r.length===1?r[0]:{kind:"fragment",children:r};let i=this.tagAt(e);return{kind:"element",tag:e.tag,svg:e.namespace==="svg",props:this.lowerAttributes(e.attributes,!0),children:r,static:!1,...i?{at:i}:{}}}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[l,a]of r){let f=a.length===1?a[0]:{kind:"fragment",children:a},d={name:l,kind:"attr",expr:this.emit(f),jsxElement:!0},p=n.findIndex(g=>g.name===l);p>=0?n[p]=d:n.push(d)}let s=e.attributes.find(l=>l.kind==="LoadDirective"),o=s?yf(`load:${s.strategy}`,s.modifier):void 0,c=n.find(l=>l.at&&l.reactive)?.at,u=this.tagAt(e);return{kind:"component",name:t,props:n,children:this.lowerChildren(i),...u?{at:u}:{},...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(u=>u!==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,u=>u.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(u=>u.kind==="EachDirective");if(!t||t.kind!=="EachDirective")return null;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 u="static"in t.key?`(item) => item[${JSON.stringify(t.key.static)}]`:this.hole(t.key.hole).code;r.push({name:"by",kind:"attr",expr:u})}let i=this.itemArrow(e),s;if(i){let u=i.bodyReactive?`() => ${_(i.body,"arrowBody")}`:_(i.body,"arrowBody");s=`(${i.params.join(", ")}) => ${u}`}else{let u=this.lowerChildren(e.children),l=u.length===1?u[0]:{kind:"fragment",children:u};s=`() => ${_(this.emit(l),"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)}lowerAttributes(e,t=!1){let n=!1,r=(a,f)=>{if(n||=f.reactive,!t||!f.reactive)return`${JSON.stringify(a)}: ${f.code}`;let d=`() => ${_(f.code,"arrowBody")}`;return`${JSON.stringify(a)}: ${f.at?ze(d,f.at.line,f.at.column):d}`},i=[],s=[],o,c=[],u,l=[];for(let a of e)switch(a.kind){case"IfDirective":case"EachDirective":case"ElseDirective":break;case"Attribute":i.push(this.plainAttr(a));break;case"PropertyBinding":i.push({name:a.name,kind:"prop",expr:this.hole(a.hole).code,reactive:this.hole(a.hole).reactive,...this.hole(a.hole).at?{at:this.hole(a.hole).at}:{}});break;case"EventBinding":i.push(this.eventProp(a));break;case"RefBinding":i.push({name:"ref",kind:"ref",expr:this.hole(a.hole).code,reactive:this.hole(a.hole).reactive,...this.hole(a.hole).at?{at:this.hole(a.hole).at}:{}});break;case"Spread":i.push({name:"",kind:"spread",expr:this.hole(a.hole).code});break;case"ClassDirective":{let f=this.hole(a.hole);s.push(r(a.name,f)),o??=f.at;break}case"StyleDirective":{let f=this.hole(a.hole);c.push(r(a.name,f)),u??=f.at;break}case"BindDirective":i.push(...this.bindProps(a.name,this.hole(a.hole)));break;case"UseDirective":{let f=a.name??(a.hole!=null?this.hole(a.hole).code:null);if(!f)break;l.push(a.name!=null&&a.hole!=null?`[${f}, () => ${_(this.hole(a.hole).code,"arrowBody")}]`:`[${f}]`);break}}if(s.length>0&&i.push({name:"classList",kind:"attr",expr:`{ ${s.join(", ")} }`,reactive:!t&&n,...o?{at:o}:{}}),c.length>0){let a=`{ ${c.join(", ")} }`,f=i.findIndex(d=>d.name==="style");if(f===-1)i.push({name:"style",kind:"attr",expr:a,reactive:!t&&n,...u?{at:u}:{}});else{let d=i[f],p=d.expr===void 0?JSON.stringify(d.literal):d.reactive?`() => ${_(d.expr,"arrowBody")}`:d.expr;i[f]={name:"style",kind:"attr",expr:`[${p}, ${a}]`,reactive:!1,...d.at?{at:d.at}:{}}}}return l.length>0&&i.push({name:"use",kind:"attr",expr:`[${l.join(", ")}]`}),i}eventProp(e){let t=e.name.toLowerCase(),n=this.hole(e.hole).code;if(!(e.syntax==="colon"||e.modifiers.length>0))return{name:"on"+Oo(e.name),kind:"event",event:{name:t,delegated:$o.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"+Oo(i),kind:"event",event:{name:i,delegated:$o.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=rr(t.value),i;if(t.kind==="hole"){let u=this.hole(t.hole);return i.expr=u.code,i.reactive=u.reactive,u.at&&(i.at=u.at),i}let s=!1,o,c=t.parts.map(u=>{if("text"in u)return id(rr(u.text));let l=this.hole(u.hole);return s=s||l.reactive,o??=l.at,"${"+l.code+"}"}).join("");return i.expr="`"+c+"`",i.reactive=s,o&&(i.at=o),i}};function cd(e,t,n,r={}){let{root:i}=er(e,{svg:r.svg});return new od(t,n,r.sourceFile,r.positionAt).lowerRoot(i.children)}function ad(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 Jo(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 ud(ad(e),e.holes,t)}function ud(e,t,n={}){let r=new Set,i=cd(e,[...t],r,{svg:n.svg,...n.sourceFile?{sourceFile:n.sourceFile}:{},...n.positionAt?{positionAt:n.positionAt}:{}});n.templateStyles&&ff(i,n.templateStyles),hf(i),wf(i,{resolver:nd(n.resolve??[]),modules:{controlFlowModule:n.controlFlowModule??"@fluixi/dom",coreModule:n.coreModule??"@fluixi/core",routerModule:n.routerModule??"@fluixi/core/router"},strategyFor:u=>u.load}),Sf(i);let{code:s,imports:o,templates:c}=Ko.emit(i,{templateClone:n.templateClone,partialTemplates:n.partialTemplates});for(let u of o)r.add(u);return n.hoistTemplates?{code:s,imports:[...r],ir:i,templates:c}:{code:Uo(s,c),imports:[...r],ir:i}}function ld(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 fr(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)ld(s,t);if(i)for(let s of r.children)s.kind==="Expression"&&t.set(s.hole,"render");fr(r.children,t,n);break}case"Root":case"Fragment":fr(r.children,t,n);break;default:break}}function Go(e){let t=new Map,n=new Set;return fr(e.root.children,t,n),{holes:t,components:n}}var dr={...Qn,createMemo:an},fd=["For","Index","Show","Switch","Match","Portal","Dynamic","ErrorBoundary","Suspense"],hr=new Map;function Xo(e){for(let[t,n]of Object.entries(e))hr.set(t,n)}function dd(e){return e==="text"||e==="attr"||e==="control"}function hd(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"&&dd(i)?{code:`$$v[${r}]()`,reactive:!0}:{code:`$$v[${r}]`,reactive:!1}})}function pd(e){if(hr.has(e))return hr.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 md(e,t,n){let r=e,i=yo(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}=Go(i),{code:u,imports:l}=Jo({statics:r,holes:hd(t,o)},{svg:n}),a=l.filter(v=>!(v in dr));if(a.length>0)throw new Error(`[fluixi] no runtime binding for: ${a.join(", ")}`);let f=Array.from(new Set([...l,...fd])).filter(v=>v in dr),d=Array.from(c).filter(v=>!f.includes(v)),p=[...f,...d],g=new Function(...p,"$$v",`return (${u});`);return{run:v=>g(...f.map(b=>dr[b]),...d.map(pd),v)}}var Yo=new WeakMap;function yd(e){let t="";for(let n of e)t+=typeof n=="function"?"f":"v";return t}function Zo(e){return(t,...n)=>{let r=Yo.get(t);r||(r=new Map,Yo.set(t,r));let i=yd(n),s=r.get(i);return s||(s=md(t,n,e),r.set(i,s)),s.run(n)}}var Qo=Zo(!1),ec=Zo(!0);return oc(vd);})();
|
|
1
|
+
/*! @fluixi/template-runtime v1.0.0-alpha.110 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
|
+
"use strict";var Fluixi=(()=>{var ln=Object.defineProperty;var Sl=Object.getOwnPropertyDescriptor;var wl=Object.getOwnPropertyNames;var xl=Object.prototype.hasOwnProperty;var xo=(e,t)=>{for(var r in t)ln(e,r,{get:t[r],enumerable:!0})},El=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of wl(t))!xl.call(e,i)&&i!==r&&ln(e,i,{get:()=>t[i],enumerable:!(n=Sl(t,i))||n.enumerable});return e};var kl=e=>El(ln({},"__esModule",{value:!0}),e);var sp={};xo(sp,{Dynamic:()=>Hr,ErrorBoundary:()=>Wr,For:()=>qr,Index:()=>Br,Match:()=>Yt,Portal:()=>Vr,Show:()=>Xt,Switch:()=>Zt,batch:()=>I,define:()=>ml,effect:()=>Pn,html:()=>gl,hydrate:()=>Ce,insert:()=>_,memo:()=>In,onCleanup:()=>A,render:()=>$e,resource:()=>_n,signal:()=>Mn,store:()=>hi,svg:()=>vl,untrack:()=>x});var Gi={};xo(Gi,{ALWAYS_ATTRIBUTE:()=>Si,ClientOnly:()=>ei,Dynamic:()=>Hr,ErrorBoundary:()=>Wr,ErrorResetContext:()=>Wi,FX_DATA_ID:()=>Tt,For:()=>qr,HYDRATION_KEY:()=>Y,Index:()=>Br,Island:()=>Sc,JSX_PROPERTIES:()=>vt,Match:()=>Yt,NoSsr:()=>Ds,Portal:()=>Vr,SERVER_PROPS:()=>vi,SVG_ELEMENTS:()=>la,SVG_NAMESPACE:()=>yt,Show:()=>Xt,Switch:()=>Zt,VERSION:()=>ar,VERSION_ATTRIBUTE:()=>Fn,VOID_ELEMENTS:()=>ca,addClass:()=>wi,addDelegatedEventListener:()=>Nr,addNativeEventListener:()=>Dr,afterHydrationPass:()=>Os,appendChildren:()=>Ri,appendResponseHeader:()=>ls,applyElementProp:()=>gt,applyProps:()=>kt,applyUse:()=>Mr,asComponent:()=>dt,asContext:()=>Hs,asOutlet:()=>Ls,asProvider:()=>js,asRoute:()=>Ps,asRouter:()=>Ms,asRoutes:()=>Is,asSuspense:()=>Ws,beforeFirstRender:()=>os,beginAppHydration:()=>ws,bindPair:()=>Hi,captureHydrationCursor:()=>bs,checkRenderType:()=>qs,classMap:()=>Qo,cleanChildren:()=>Z,clearHydrationKeys:()=>hr,cloneTemplate:()=>_r,closest:()=>fa,createComponent:()=>xe,createDynamicElement:()=>jr,createElement:()=>$i,createNativeElement:()=>ke,createPortal:()=>ji,createRequestContext:()=>nt,createTemplate:()=>Or,createUniqueId:()=>As,css:()=>kc,default:()=>tf,deferElement:()=>Bs,delegate:()=>ga,delegateEvents:()=>St,endAppHydration:()=>xs,endRequestContext:()=>ot,endRequestScope:()=>Wn,errorResponseStatus:()=>ir,escapeFxJson:()=>Kr,escapeHTML:()=>Va,fnName:()=>Ia,generateID:()=>Oa,getAttribute:()=>ki,getGlobal:()=>Aa,getLocals:()=>cs,getOffset:()=>ya,getRequestContext:()=>B,getRequestEvent:()=>rr,getRequestLocals:()=>Bn,getServerData:()=>Ur,getStableElementId:()=>Na,getStyle:()=>da,handleRef:()=>Ae,hasClass:()=>pa,holeContent:()=>Et,holeEnd:()=>xt,holeScope:()=>wt,html:()=>xc,hydrate:()=>Ce,hydrateAdvancePast:()=>je,hydrateChildren:()=>vc,hydrateIslands:()=>wc,indexArray:()=>Me,initializeIntegration:()=>na,insert:()=>_,insertExpression:()=>ze,intergartionInitialized:()=>ia,isAccessor:()=>Fa,isAppHydrationPending:()=>Es,isAttributeOnlyName:()=>Be,isComponent:()=>J,isContext:()=>si,isCustomElement:()=>gi,isDOMNode:()=>Ea,isDelegatedEvent:()=>Da,isDomElement:()=>or,isDomNode:()=>Se,isDomText:()=>sr,isEventHandler:()=>sa,isFunction:()=>Ma,isHydrating:()=>_s,isIntegrationInitialized:()=>mi,isJSXTemplate:()=>xa,isNativeElement:()=>Ba,isOutlet:()=>ii,isPromise:()=>Fe,isProvider:()=>oi,isReactElement:()=>wa,isRoute:()=>ni,isRouter:()=>ti,isRoutes:()=>ri,isSVGElement:()=>Lr,isServer:()=>w,isSuspense:()=>ai,isVisible:()=>ha,iterateFn:()=>Pa,keepServerContent:()=>ja,keyArray:()=>De,makeArrayFlat:()=>Ii,mapArray:()=>_e,mergeProps:()=>Li,observeIntersection:()=>ba,observeResize:()=>Sa,onRequestEnd:()=>is,prepareRender:()=>ss,query:()=>Er,queryAll:()=>ua,registerCoreVersion:()=>ms,registerCreateComponent:()=>ra,registerGlobal:()=>ka,removeAttribute:()=>Ai,removeChildren:()=>Ci,removeClass:()=>xi,removeDelegatedEventListener:()=>bt,removeUnclaimedKeyed:()=>mr,render:()=>$e,renderStarted:()=>as,renderToString:()=>lc,renderToStringAsync:()=>fc,requestScope:()=>it,resetIntegration:()=>yi,resetOnNavigation:()=>qi,runHydrationAt:()=>Le,runWithRequestContext:()=>st,runWithoutHydration:()=>Ss,scrollIntoView:()=>ma,serializeNode:()=>Q,serializeResourceData:()=>Ui,serverCustomElementProp:()=>qe,setAttribute:()=>H,setClassList:()=>he,setClassName:()=>Ee,setDataRedactor:()=>uc,setDynamicAttribute:()=>Ke,setDynamicBoolAttribute:()=>Ir,setDynamicClassList:()=>qa,setDynamicProperty:()=>Ue,setDynamicStyle:()=>Wa,setKeyScope:()=>Ts,setProperty:()=>de,setRequestStore:()=>Hn,setRequestStoreIfUnset:()=>ns,setResponseRedirect:()=>fs,setResponseStatus:()=>nr,setServerMode:()=>be,setStyle:()=>oe,setStyles:()=>kr,shouldSetAsProperty:()=>aa,splitProps:()=>Pr,spread:()=>Pi,stampVersions:()=>cr,styleMap:()=>Zo,svg:()=>Ec,takeResponseHeaders:()=>us,takeResponseRedirect:()=>ds,takeResponseStatus:()=>ps,takesBooleanText:()=>bi,templateNode:()=>Mi,toAttributeName:()=>oa,toggleClass:()=>Ei,versionMark:()=>zn,versions:()=>V,waitForElement:()=>va,warnOnVersionSkew:()=>lr,whenAppHydrated:()=>ks});var Lt=Symbol.for("fluixi-proxy");var ce="1.0.0-alpha.110";var ko=ce.split(".")[0],Eo=`__fluixi_signal_state_v${ko}__`,Ao=`__fluixi_signal_builds_v${ko}__`,Al=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function $o(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Al,onSuspend:null,onError:null,observer:null,hot:null}}var jt=globalThis;function $l(e){let t=$o(),r=e;for(let n of Object.keys(t))n in e||(r[n]=t[n]);return e}function Cl(){let e=jt[Eo];return e?$l(e):jt[Eo]=$o()}var m=Cl();(jt[Ao]??=[]).push(ce);function un(){return[...new Set(jt[Ao]??[])]}function fn(e){return m.observer=e,()=>{m.observer===e&&(m.observer=null)}}var L=[],Ht;function To(e,t){if(!m.observer)return t();let r=Ht;Ht=e;try{return t()}finally{Ht=r}}var Co;function ve(e){let t=m.observer;t&&t.created(e.parents===void 0?{...e,parents:L,origin:e.origin??Ht,scope:e.scope??Co}:{...e,scope:e.scope??Co})}function No(e){return m.observer?(L.push(e),!0):!1}function Oo(){L.pop()}function _o(e){m.observer?.ran?.(e)}function Do(e,t){m.observer?.wrote?.(e,t)}function j(e,t,r,n){let i=m.observer;!i?.bound||!L.length||i.bound(L[L.length-1],e,t,r,n)}function Wt(e){let t=m.observer;!t?.props||!L.length||!e||t.props(L[L.length-1],e)}function W(e,t,r,n){let i=m.observer;!i?.directive||!L.length||i.directive(L[L.length-1],e,t,r,n)}function qt(e){m.observer?.contextCreated?.(e)}function Te(e,t,r){let n=m.observer;!n?.context||!L.length||n.context(L[L.length-1],e,t,r)}function pn(e,t,r){m.observer?.moved?.(e,t,r)}function le(e){m.observer?.disposed?.(e)}var Rl="__FLUIXI_DEVTOOLS_HOOK__",Ro=globalThis[Rl];if(typeof Ro?.inject=="function")try{Ro.inject({observeReactiveNodes:fn,version:ce})}catch{}function K(){return m.observer!=null}var Mo=0,Io=1,Ye=2,Po=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(m.untracked)return;let e=m.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},Lo=class extends Po{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}get value(){return this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,Do(this,m.consumer),this.observers)for(let t of[...this.observers])t.markDirty(Ye);dn(this)}}peek(){return this._value}},Bt=class extends Po{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this._disposed=!1,this.state=Ye,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(m.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}dispose(){if(!this._disposed&&(this._disposed=!0,this.sources)){for(let e of this.sources)e.observers?.delete(this);this.sources=null}}updateIfNecessary(){if(!this._disposed){if(this.state===Io&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===Ye)break}(this.state===Ye||!this._initialized)&&this.recompute(),this.state=Mo}}recompute(){if(this.sources){for(let a of this.sources)a.observers?.delete(this);this.sources.clear()}let e=m.consumer,t=m.untracked,r=No(this);m.consumer=this,m.untracked=!1;let n,i=!1,o;try{n=this._fn()}catch(a){i=!0,o=a,n=this._value}finally{m.consumer=e,m.untracked=t,r&&Oo()}let s=!this._initialized||this._threw!==i||(i?o!==this._error:!this._equals(this._value,n));if(this._initialized=!0,this._threw=i,this._error=o,this._value=n,_o(this),s){if(this.version++,this.observers)for(let a of this.observers)a.markDirty(Ye);dn(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===Mo;if(this.state=e,t){if(this.observers)for(let r of this.observers)r.markDirty(Io);dn(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function dn(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}function Vt(e){if(m.untracked)return e();m.untracked=!0;try{return e()}finally{m.untracked=!1}}function U(e){let t=Qe(e);return e&&(e.owned??=[]).push(t),t}function X(e,t=!0){Ze(e,t)}function Qe(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Ft(e,t){let r=Symbol(t??"context");return qt(r),{id:r,defaultValue:e,Provider:i=>{Te(r,"provide",i.value);let o=m.owner,s=Qe(o);(s.contexts=new Map).set(r,i.value),o&&(o.owned??=[]).push(s),m.owner=s;try{return i.children}finally{m.owner=o}}}}function zt(e){let t=m.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id)){let r=t.contexts.get(e.id);return Te(e.id,"read",r),r}t=t.parent}return Te(e.id,"read",e.defaultValue),e.defaultValue}function jo(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 Kt(e,t,r){let n=Qe(m.owner);(n.contexts=new Map).set(e.id,t),m.owner&&(m.owner.owned??=[]).push(n);let i=m.owner;m.owner=n;try{return r()}finally{m.owner=i}}function Ho(e){return m.onSuspend?(m.onSuspend(e,m.owner),!0):!1}function Wo(e){m.onError=e}function E(){return m.owner}function $(e,t){let r=m.owner;m.owner=e;try{return t()}finally{m.owner=r}}function A(e){if(m.owner){if(m.owner.disposed){e();return}(m.owner.cleanups??=[]).push(e)}}function Ze(e,t=!0){if(!e.disposed){if(e.owned){for(let r=e.owned.length-1;r>=0;r--)Ze(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 q(e){let t=Qe(m.owner);m.owner&&(m.owner.owned??=[]).push(t);let r=m.owner;m.owner=t;try{return Vt(()=>e(()=>Ze(t)))}finally{m.owner=r}}function qo(e){m.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Tl(e){e.queued||(e.queued=!0,m.queue.push(e),!m.scheduled&&m.batchDepth===0&&(m.scheduled=!0,m.hostSchedule(et)))}function et(){if(m.scheduled=!1,m.flushing)return;m.flushing=!0;let e=0,t=!1,r;try{for(;m.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let n=m.queue;m.queue=[];for(let i of n)if(i.queued=!1,!i.disposed)try{i.run()}catch(o){t||(t=!0,r=o)}}}finally{m.flushing=!1}if(t)throw r}function Bo(){m.batchDepth===0&&et()}function Vo(e){m.batchDepth++;try{return e()}finally{--m.batchDepth===0&&et()}}var Nl=class extends Bt{constructor(e,t=!1,r){let n=null;super(()=>{Ze(n,!1),$(n,()=>{let s=e();typeof s=="function"&&(n.cleanups??=[]).push(s)})}),this.queued=!1,this.disposed=!1;let i=m.owner;this.owner=Qe(i),n=this.owner,K()&&ve({kind:"effect",node:this,handle:this,internal:!t,...r?{name:r}:{}}),this.run();let o=this.owner;if(!this.disposed&&!this.sources?.size&&!o.cleanups&&!o.owned&&!o.contexts&&!K()){this.disposed=!0;return}i&&(i.cleanups??=[]).push(()=>this.dispose())}markDirty(e){let t=this.state===0;super.markDirty(e),t&&this.state!==0&&!this.disposed&&Tl(this)}run(){if(!this.disposed)try{this.get()}catch(e){if(e&&typeof e.then=="function"&&m.onSuspend){m.onSuspend(e,this.owner);return}if(m.onError&&m.onError(e,this.owner))return;throw e}}dispose(){this.disposed||(this.disposed=!0,le(this),super.dispose(),Ze(this.owner))}};function hn(e,t=!1,r){let n=new Nl(e,t,r);return()=>n.dispose()}function Ol(e){return!!e&&typeof e.then=="function"}qo(()=>{});var Fo=Symbol.for("signal"),_l=Symbol.for("memo"),Dl=Symbol.for("signal-node");function T(e,t){let r=m.hot,n=e;r&&(e=r.take("signal",e));let i=new Lo(e,{equals:t?.equals}),o=(()=>i.get()),s=(a=>{let c=typeof a=="function"?a(i.peek()):a;return i.set(c),Bo(),c});return o[Fo]=!0,o[Dl]=i,K()&&ve({kind:"signal",node:i,handle:o,name:t?.name,set:s}),K()&&A(()=>le(i)),r&&r.keep(()=>i.peek(),()=>s(()=>n)),[o,s]}function S(e,t,r){let n=t,i=E(),o=new Bt(()=>$(i,()=>{try{return n=e(n)}catch(a){if(Ol(a))return Ho(a),n;throw a}}),{equals:r?.equals}),s=(()=>o.get());return Object.defineProperty(s,Fo,{value:!0,enumerable:!0}),Object.defineProperty(s,_l,{value:!0,enumerable:!0}),K()&&ve({kind:"memo",node:o,handle:s,name:r?.name}),A(()=>{o.dispose(),K()&&le(o)}),s}function D(e,t,r){let n=t;return hn(()=>{n=e(n)},!0,r?.name)}function k(e,t){let r=t;return hn(()=>{r=e(r)})}function I(e){return Vo(e)}function x(e){return Vt(e)}var Ne=globalThis[Symbol.for("fluixi.transition")]??={depth:0,loads:new Set,pending:void 0};function Ml(){return Ne.pending??=T(0)}function zo(){return Ne.depth>0}function Ko(e){let[,t]=Ml();Ne.loads.add(e),t(Ne.loads.size);let r=()=>{Ne.loads.delete(e),t(Ne.loads.size)};e.then(r,r)}function Ut(){return et(),Promise.resolve()}var Uo=Ft();Wo((e,t)=>{let r=jo(t,Uo);return r?(r.caught=()=>e,m.consumer?queueMicrotask(()=>r.setError(e)):r.setError(e),!0):!1});function mn(){let[e,t]=T(void 0,{equals:!1}),r={error:e,caught:()=>{},reset:()=>{r.caught=()=>{},t(()=>{})},setError:n=>{r.caught=()=>n,t(()=>n)}};return r}function yn(e,t){return Kt(Uo,e,t)}var Il=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,Jt=typeof process>"u"?Il:!1,Pl=Symbol.for("signal");function R(e){return typeof e=="function"&&e[Pl]===!0}function Ll(e,t){return()=>{let r=U(t);return A(()=>{X(r);let n=t.owned,i=n?n.indexOf(r):-1;i>=0&&n.splice(i,1)}),$(r,e)}}function Jo(e,t){return typeof e=="function"?R(e)||e.length?e:Ll(e,t):Array.isArray(e)?e.map(r=>Jo(r,t)):e}function gn(e,t){let r=Ft(e,t),n=r.Provider;return{...r,Provider:o=>n({get value(){return o.value},get debug(){return o.debug},get children(){let s=E(),a=o.children;return s?Jo(a,s):a}})}}var vn=null;function xn(e){vn=e}function En(e){vn&&vn(e)}var bn=null;function kn(e){bn=e}function An(e){return bn?bn(e):void 0}var Sn=null;function tt(e){Sn=e}function $n(){return Sn?Sn():void 0}var wn=null;function Cn(e){wn=e}function Rn(e,t){wn&&wn(e,t)}function Tn(){let e=new Map,t=new Map;return{get:r=>e.get(r),set:(r,n)=>{e.set(r,n)},delete:r=>{e.delete(r)},keys:()=>e.keys(),clear:()=>{e.clear(),t.clear()},inflight:t}}var jl=null;function Nn(e){jl=e}function Hl(e){return!!e&&typeof e.then=="function"}var On=Symbol();function Go(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:$n(),s=o!==void 0?An(o):void 0,a=s!==void 0,c=m.hot;m.hot=null;let[u,l]=T(s!==void 0?s.value:r.initialValue,{equals:!1}),[f,p]=T(void 0,{equals:!1}),y=!1,[v,d]=T(s!==void 0||r.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[b,C]=T(void 0,{equals:!1}),[N,g]=T(void 0,{equals:!1});m.hot=c;let ee=On,te=!1;D(()=>{let O=n();if(N(),O===!1||O===null||O===void 0){ee=On,I(()=>{d("unresolved"),C(void 0),p(void 0)});return}let Mt=te;if(te=!1,ee!==On&&O===ee&&!Mt)return;if(ee=O,a){a=!1;return}let It=!1;A(()=>It=!0);let wo=x(v),bl=x(u),cn=wo==="ready"||wo==="refreshing";y=cn&&zo(),I(()=>{d(cn?"refreshing":"pending"),p(void 0)});try{let ae=i(O,{value:bl,refetching:cn});Hl(ae)?(C(ae),y&&Ko(ae),En(ae),ae.then(Pt=>{It||(o!==void 0&&Rn(o,Pt),I(()=>{l(()=>Pt),d("ready"),C(void 0)}))},Pt=>{It||I(()=>{p(Pt),d("errored"),C(void 0)})})):I(()=>{l(()=>ae),d("ready"),C(void 0)})}catch(ae){if(It)return;I(()=>{p(ae),d("errored"),C(void 0)})}});let ge=()=>{let O=v();return O==="pending"||O==="refreshing"},Xe=(()=>{let O=f();if(O)throw O;if(ge()&&!(y&&v()==="refreshing")){let Mt=b();if(Mt)throw Mt}return u()});return Object.defineProperties(Xe,{state:{get:v},loading:{get:ge},error:{get:f},latest:{get:u}}),Object.defineProperty(Xe,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(Xe,Symbol.for("signal"),{value:!0,enumerable:!0}),[Xe,{mutate:l,refetch:()=>{te=!0,g(void 0)}}]}function _n(...e){let[t,r]=Go(...e);return Object.assign(t,r)}function Dn(e){let t=m.hot;if(!t)return e();m.hot=null;try{return e()}finally{m.hot=t}}function Mn(e,t){let[r,n]=T(e,t);return r.set=n,r}function In(e,t,r){return S(e,t,r)}function Pn(e,t,r){return D(e,t,r)}function Gt(e){if(typeof e=="function"&&!e.length){let t=e();return R(t)?t:Gt(t)}if(Array.isArray(e)){let t=[];for(let r=0;r<e.length;r++){let n=Gt(e[r]);Array.isArray(n)?t.push.apply(t,n):t.push(n)}return t}return e}function Oe(e){let t=S(e);return Jt?S(()=>Gt(t()),void 0,{name:"children"}):S(()=>Gt(t()))}function Yo(e){let t=e,r=null;return{index:()=>(r||(r=T(t,{name:"row index"})),r[0]()),set:n=>{t=n,r&&r[1](n)}}}function _e(e,t,r){let n=[];return A(()=>{for(let i of n)i.dispose();n=[]}),S(()=>{let i=e()||[];return x(()=>{if(i.length===0){for(let c of n)c.dispose();return n=[],r?.fallback?r.fallback():[]}let o=new Map;for(let c of n)o.has(c.item)||o.set(c.item,c);let s=[],a=new Set;for(let c=0;c<i.length;c++){let u=i[c],l=o.get(u);if(l&&!a.has(l))l.setIndex(c),s.push(l),a.add(l);else{let f,p,y;q(d=>{y=d;let b=Yo(c);p=b.set,f=t(u,b.index)});let v={item:u,rendered:f,dispose:y,setIndex:p};s.push(v),a.add(v)}}for(let c of n)a.has(c)||c.dispose();return n=s,s.map(c=>c.rendered)})},void 0,{name:"mapArray"})}function De(e,t,r,n){let i=[],o=[];return A(()=>{for(let s of o)s.dispose();i=[],o=[]}),S(()=>{let s=e()||[];return x(()=>{if(s.length===0){for(let f of o)f.dispose();return i=[],o=[],n?.fallback?n.fallback():[]}let a=new Map;for(let f=0;f<i.length;f++)a.set(i[f],o[f]);let c=[],u=[],l=new Set;for(let f=0;f<s.length;f++){let p=t(s[f]),y=a.get(p);if(y&&!l.has(p))y.setIndex(f),y.setItem(s[f]),c.push(y);else{let v,d,b,C;q(N=>{C=N;let g=Yo(f);d=g.set;let[ee,te]=T(s[f]);b=ge=>te(()=>ge),v=r(ee,g.index)}),c.push({rendered:v,dispose:C,setIndex:d,setItem:b})}u.push(p),l.add(p)}for(let[f,p]of a)l.has(f)||p.dispose();return i=u,o=c,c.map(f=>f.rendered)})},void 0,{name:"keyArray"})}function Me(e,t,r){let n=[];return A(()=>{for(let i of n)i.dispose();n=[]}),S(()=>{let i=e()||[];return x(()=>{if(i.length===0){for(let c of n)c.dispose();return n=[],r?.fallback?r.fallback():[]}let o=n.length,s=i.length;for(let c=o;c<s;c++){let u,l,f,p=i[c];q(y=>{f=y;let[v,d]=T(p);l=d,u=t(v,c)}),n.push({rendered:u,setItem:l,dispose:f})}for(let c=s;c<o;c++)n[c].dispose();s<o&&(n=n.slice(0,s));let a=Math.min(o,s);for(let c=0;c<a;c++)n[c].setItem(i[c]);return n.map(c=>c.rendered)})},void 0,{name:"indexArray"})}function ue(e){return()=>{let t=e();return typeof t=="function"?t():t}}function Xt(e){let t=ue(()=>e.when),r=S(t,void 0,{name:"Show.when"}),n=S(()=>!!r(),void 0,{name:"Show.cond"}),i=E(),o=null,s=null,a=c=>{c!==s&&(o&&X(o),o=U(i),s=c)};return S(()=>{let c=n();return a(c?"when":"fallback"),$(o,()=>{if(!c)return e.fallback;let u=e.children;if(typeof u=="function"){let l=u;if(l.length===0)return x(()=>l(x(r)));let f=r();return x(()=>l(f))}return u})},void 0,{name:"Show.result"})}function nu(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Zo(e){return S(()=>{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(`${nu(n)}: ${o}`)}return r.join("; ")},void 0,{name:"StyleMap"})}var Ln=Symbol("match");function Yt(e){return{[Ln]:!0,when:ue(()=>e.when),get children(){return e.children}}}function Zt(e){let t=Array.isArray(e.children)?e.children:[e.children],r=E(),n=null,i=-1,o=s=>{s!==i&&(n&&X(n),n=U(r),i=s)};return S(()=>{for(let s=0;s<t.length;s+=1){let c=t[s],u=0;for(;typeof c=="function"&&!c[Ln]&&u++<10;)c=c();if(!c||typeof c!="object"||c[Ln]!==!0)continue;let l=c.when();if(l)return o(s),$(n,()=>{let f=c.children;return typeof f=="function"?f(l):f})}return o(-2),$(n,()=>e.fallback??null)},void 0,{name:"Switch"})}function Qo(e){return S(()=>{let t=typeof e=="function"?e():e,r=[];for(let[n,i]of Object.entries(t)){if(!n)continue;(typeof i=="function"?i():i)&&r.push(n)}return r.join(" ")},void 0,{name:"ClassMap"})}var Qt,rs={getStore:()=>Qt,run(e,t){let r=Qt;Qt=e;try{return t()}finally{Qt=r}}},rt=globalThis[Symbol.for("fluixi.requestStore")]??={store:rs,async:!1};function Hn(e){rt.store=e??rs,rt.async=e!==null}function ns(e){rt.async||Hn(e)}function nt(e={}){if(e.request===void 0){let s=qn();s&&(e.request=s)}e.locals||(e.locals=e.request?Bn(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 a=o.get(s)??0;return o.set(s,a+1),`${s}#${a}`},withResourceScope(s,a){let c=n;n=s;try{return a()}finally{n=c}},pending:new Set,data:new Map}}var er=globalThis[Symbol.for("fluixi.requestEndHooks")]??=new WeakMap;function is(e){let t=it();if(!t)return!1;let r=er.get(t);return r||er.set(t,r=[]),r.push(e),!0}function it(){return qn()??B()}var re=globalThis[Symbol.for("fluixi.beforeRender")]??={tasks:[],prepared:new WeakMap,page:void 0};function os(e){return re.tasks.push(e),()=>{let t=re.tasks.indexOf(e);t>=0&&re.tasks.splice(t,1)}}function ss(){let e=it();if(!e)return re.page??=es();let t=re.prepared.get(e);return t||re.prepared.set(e,t=es()),t}function as(){let e=it();return e?re.prepared.has(e):re.page!==void 0}async function es(){for(let e of[...re.tasks])await e()}function ot(e){Wn(e)}function Wn(e){let t=er.get(e);if(t){er.delete(e);for(let r of t.reverse())try{r()}catch(n){console.error("[fluixi] a request-end hook threw:",n)}}}function st(e,t){return rt.store.run(e,t)}function B(){return rt.store.getStore()}function rr(){return B()?.event}function cs(){let e=rr();return e?(e.locals||(e.locals={}),e.locals):{}}var ts=globalThis[Symbol.for("fluixi.requestLocals")]??=new WeakMap;function qn(){return globalThis[Symbol.for("fluixi.platformRequest")]?.getStore()}function Bn(e){let t=ts.get(e);return t||(t={},ts.set(e,t)),t}var Ie=globalThis[Symbol.for("fluixi.responseHeaders")]??=new WeakMap;function Vn(){let e=rr()?.request;return e&&typeof e=="object"?e:qn()}function ls(e,t,r=Vn()){if(!r)return!1;let n=Ie.get(r);return n||(n={headers:new Headers,sent:!1},Ie.set(r,n)),n.sent?!1:(n.headers.append(e,t),!0)}function us(e){let t=Ie.get(e);if(!t){t={headers:new Headers,sent:!0},Ie.set(e,t);return}return t.sent=!0,t.headers}var tr=globalThis[Symbol.for("fluixi.responseRedirects")]??=new WeakMap;function fs(e,t,r=Vn()){return!r||Ie.get(r)?.sent?!1:(tr.has(r)||tr.set(r,{location:e,status:t}),!0)}var jn=globalThis[Symbol.for("fluixi.responseStatuses")]??=new WeakMap;function nr(e,t=Vn()){return!t||Ie.get(t)?.sent?!1:(jn.set(t,e),!0)}function ir(e){let t=e?.status;return typeof t=="number"&&Number.isInteger(t)&&t>=400&&t<=599?t:500}function ps(e){let t=jn.get(e);return jn.delete(e),t}function ds(e){let t=tr.get(e);return tr.delete(e),t}var ct=Symbol.for("fluixi.server-node"),iu=Symbol.for("fluixi.dom.server-host"),ou=globalThis,at=ou[iu]??={server:typeof document>"u",nodes:null};function w(){return at.server}function be(e){at.server=e}function hs(e){at.nodes=e}function Pe(){if(!at.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return at.nodes}function Se(e){return e!=null&&e[ct]===!0?!0:typeof Node<"u"&&e instanceof Node}function or(e){return e!=null&&e[ct]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function sr(e){return e!=null&&e[ct]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var ar="1.0.0-alpha.110";var V={dom:ar,reactive:ce};function ms(e){V.core=e}var Fn="data-fluixi";function zn(){return lt()?"":V.core??V.dom}function lt(){try{return!0}catch{return!1}}function cr(e){if(e.setAttribute(Fn,zn()),typeof globalThis>"u")return;let t=globalThis.Fluixi;t&&typeof t=="object"&&Object.values(t).some(r=>typeof r=="function")?t.versions=V:globalThis.Fluixi=V}function lr(){let e=un();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=[V.core,V.dom,V.reactive].filter(r=>r!==void 0);new Set(t).size<=1||console.warn(`[fluixi] package versions disagree: core ${V.core??"(absent)"}, dom ${V.dom}, reactive ${V.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\`.`)}var h={active:!1,cursor:null,parents:[]},gs=null;function vs(e){gs=e}function ut(){return gs}function Un(e,t){return h.active&&t.parentNode===e}function pr(e){let t=h.parents.lastIndexOf(e);t!==-1&&(h.parents.length=t),h.cursor=e.nextSibling}function bs(){return h.active?h.cursor:null}function Le(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 Ss(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 je(e){if(!h.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&pr(t)}function dr(){let e=globalThis;return e[Symbol.for("fluixi.appHydration")]??={pending:0,waiting:new Set}}function ws(){dr().pending++}function xs(){let e=dr();if(e.pending>0&&e.pending--,e.pending>0)return;let t=[...e.waiting];e.waiting.clear();for(let r of t)r()}function Es(){return dr().pending>0}function ks(e){let t=dr();return t.waiting.add(e),()=>t.waiting.delete(e)}var ur=Symbol.for("fluixi.hydrationKeys"),Y="data-hk";function Jn(e){let t=e;for(;t;){let r=t.contexts?.get(ur);if(r)return r;if(!t.parent){let n={id:"",next:0};return(t.contexts??=new Map).set(ur,n),n}t=t.parent}return{id:"",next:0}}function ft(){return w()?B()?.hydrationKeys!==!1:h.active}function fr(e){let t=3735928559,r=1103547991;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);t=Math.imul(t^i,2654435761),r=Math.imul(r^i,1597334677)}return t=Math.imul(t^t>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),(4294967296*(2097151&r)+(t>>>0)).toString(36)}function Gn(e){if(!ft())return null;let t=Jn(E()),r=t.id+(t.next++).toString(36);return e?`${fr(r)}-${e}`:fr(r)}var su=0;function As(){if(!ft())return`fx-c${(su++).toString(36)}`;let e=Jn(E());return e.ids=(e.ids??0)+1,`fx-${fr(`${e.id}#${e.ids}`)}`}var ys=new Map;function $s(e){let t=ys.get(e);return t===void 0&&ys.set(e,t=fr(e).slice(0,6)),t}function Cs(e){let t=e.getAttribute(Y)??"",r=t.indexOf("-");return r<0?"":t.slice(r+1)}function Xn(e){let t=e.getAttribute(Y);t&&P?.get(t)===e&&P.delete(t)}function Rs(){if(!ft())return null;let e=E();if(!e)return null;let t=Jn(e),r={id:t.id+(t.next++).toString(36)+".",next:0},n=U(e);return(n.contexts=new Map).set(ur,r),n}function Ts(e){let t=E();t&&(t.contexts??=new Map).set(ur,{id:e,next:0})}var P=null;function Yn(e){P??=new Map;for(let t of e.querySelectorAll(`[${Y}]`)){let r=t.getAttribute(Y);P.has(r)||P.set(r,t)}}function hr(){P=null}function mr(e){if(!P)return 0;let t=0;for(let[r,n]of P){if(!n.isConnected){P.delete(r);continue}e&&!e.contains(n)||n.parentElement?.closest("[data-fx-ssr]")||(P.delete(r),n.remove(),t++)}return t}function Ns(e){if(!(!P||e.length===0))for(let[t,r]of P)e.some(n=>n===r||n.contains(r))&&P.delete(t)}var Kn=[];function Os(e){h.active?Kn.push(e):e()}function Zn(){for(;Kn.length>0;){let e=Kn.shift();try{e()}catch(t){console.error(t)}}}function pt(e,t){lt()||console.warn(`[fluixi] hydration mismatch: expected text ${JSON.stringify(t.slice(0,24))} but the server DOM has text ${JSON.stringify(e.slice(0,24))}. Server and client rendered different markup; keeping the node and writing the client's text. Check for non-deterministic render (Date.now(), Math.random(), browser-only branches, untransported data).`)}function _s(){return h.active}function Qn(e,t){if(!e||!P)return null;let r=P.get(e);return!r||r.localName!==t.toLowerCase()?null:(P.delete(e),r)}function ei(e){if(w())return e.fallback??null;let t=h.active,[r,n]=T(!t);return t&&queueMicrotask(()=>n(!0)),S(()=>r()?e.children:e.fallback??null,void 0,{name:"client-only"})}var Ds=ei;function Ms(e){return Object.defineProperty(e,Symbol.for("fluixi-router"),{value:!0,enumerable:!0}),e}function Is(e){return Object.defineProperty(e,Symbol.for("fluixi-routes"),{value:!0,enumerable:!0}),e}function Ps(e){return Object.defineProperty(e,Symbol.for("fluixi-route"),{value:!0,enumerable:!0}),e}function Ls(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-outlet"),{value:!0,enumerable:!0}),e}function js(e){return Object.defineProperty(e,Symbol.for("fluixi-provider"),{value:!0,enumerable:!0}),e}function Hs(e){return Object.defineProperty(e,Symbol.for("fluixi-context"),{value:!0,enumerable:!0}),e}function dt(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function Ws(e){return Object.defineProperty(e,Symbol.for("fluixi-suspense"),{value:!0,enumerable:!0}),e}function ti(e){return typeof e=="function"&&e[Symbol.for("fluixi-router")]===!0}function ri(e){return typeof e=="function"&&e[Symbol.for("fluixi-routes")]===!0}function ni(e){return typeof e=="function"&&e[Symbol.for("fluixi-route")]===!0}function ii(e){return typeof e=="function"&&e[Symbol.for("fluixi-outlet")]===!0}function oi(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function si(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 ai(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function qs(e){return ti(e)?{type:"router",value:e}:ni(e)?{type:"route",value:e}:ri(e)?{type:"routes",value:e}:ii(e)?{type:"outlet",value:e}:J(e)?{type:"component",value:e}:ai(e)?{type:"suspense",value:e}:oi(e)?{type:"provider",value:e}:si(e)?{type:"context",value:e}:{type:"none",value:e}}function Bs(e){if(w()||!h.active)return e();let t=E();return dt(()=>$(t,e))}var vr=Symbol("store-raw"),Vs=Symbol("store-node"),Fs=Symbol("store-has"),zs=Symbol("store-self"),Ks=Symbol("store-track");var ht=new WeakMap,ci=new WeakMap,We=new WeakMap,br=new WeakMap;function au(e,t){if(!He(e)||!K())return;let r=new Set,n=s=>{if(!(!He(s)||r.has(s))){r.add(s);for(let a of Object.values(s))n(a)}};n(br.get(t)??t);let i=new Set,o=s=>{if(!He(s))return;let a=s;if(r.has(a)||i.has(a))return;i.add(a);let c=ht.get(a);if(c){for(let u of c.keys.values())le(u);c.all&&le(c.all),ht.delete(a),We.delete(a),ci.delete(a)}for(let u of Object.values(a))o(u)};o(e)}var Sr=(e,t,r)=>r?`${e}[${String(t)}]`:`${e}.${String(t)}`;function Ys(e,t,r){let n=t?.owner,i=n&&r!==void 0?Sr(n.name,r,t?.array):void 0,o=i?{name:i}:void 0,[s,a]=To(n?.store,()=>m.hot?Dn(()=>T(e,o)):T(e,o)),c=s;return c.$=a,c}function wr(e){let t=ht.get(e);return t?t.owner||(t.owner=We.get(e)):ht.set(e,t={keys:new Map,owner:We.get(e),array:Array.isArray(e)}),t}function Us(e,t,r){let n=e.keys.get(t);return n||e.keys.set(t,n=Ys(r,e,t)),n}function cu(e,t,r,n){let i=We.get(e);if(i&&i.store===t&&i.name===r)return;let o={store:t,name:r};We.set(e,o),br.set(e,br.get(n)??n);let s=ht.get(e);if(s&&(s.owner=o,!!K())){for(let[a,c]of s.keys)pn(c,t,Sr(r,a,s.array));s.all&&pn(s.all,t,Sr(r,"*",s.array))}}function Js(e){let t=wr(e);(t.all||(t.all=Ys(void 0,t,"*")))()}function Gs(e,t){e.$(typeof t=="function"?()=>t:t)}function He(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 yr(e){if(!He(e))return e;let t=ci.get(e);if(t)return t;let r=new Proxy(e,lu);return ci.set(e,r),r}var lu={get(e,t,r){if(t===vr||t===Vs)return e;if(t===Lt)return r;if(t===Fs)return c=>c in e;if(t==="__proxy")return!0;if(t===Ks||t===zs)return Js(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=wr(e),s=Us(o,t,n),a=s();return He(a)?(o.owner&&cu(a,s,Sr(o.owner.name,t,o.array),e),yr(a)):a},set(){return!0},deleteProperty(e,t){return t in e&&G(e,t,void 0),!0},has(e,t){return t===vr||t===Lt||t===Vs||t===Fs||t===zs||t===Ks?!0:(Us(wr(e),t,e[t])(),t in e)},ownKeys(e){return Js(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function Zs(e,t=new Set){if(e==null||typeof e!="object")return e;let r=e[vr]??e;if(t.has(r)||!He(r))return r;t.add(r);let n=!1,i=s=>{let a=Zs(s,t);return a!==s&&(n=!0),a};if(Array.isArray(r)){let s=r.map(i);return n?s:r}let o={};for(let s of Object.keys(r))o[s]=i(r[s]);return n?o:r}function G(e,t,r){let n=Zs(r),i=e[t];if(i===n&&(n!==void 0||t in e))return;let o=Array.isArray(e),s=o?e.length:0;n===void 0?delete e[t]:e[t]=n;let a=wr(e),c=a.keys.get(t);if(c&&Gs(c,n),au(i,e),o&&e.length!==s){let u=a.keys.get("length");u&&Gs(u,e.length)}a.all&&a.all.$(void 0)}function li(e,t){return typeof e=="function"?e(t):e}function ui(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)?ui(i,n):G(e,r,n)}}function xr(e){let t=[],r=e.replace(/\[([^\]]*)\]/g,".$1");for(let n of r.split("."))n.length&&t.push(n);return t}function Qs(e,t,r){let n=t.length-1;for(let o=0;o<n;o++){let s=t[o];if(s==="*"){let c=t.slice(o+1);if(Array.isArray(e))for(let u=0;u<e.length;u++)Qs(e[u],c,r);return}let a=e[s];(a==null||typeof a!="object")&&(a=/^\d+$/.test(t[o+1])?[]:{},G(e,s,a)),e=a}let i=t[n];if(i==="*"){if(Array.isArray(e))for(let o=0;o<e.length;o++)G(e,o,li(r,e[o]));return}G(e,i,li(r,e[i]))}function Xs(e,t,r){Qs(e,xr(t),r)}function uu(e){return Array.isArray(e)&&e.length>0&&e.every(t=>Array.isArray(t)&&t.length>=2&&typeof t[0]=="string")}function gr(e,t){for(let r=e.length-1;r>=t.length;r--)G(e,String(r),void 0);e.length!==t.length&&G(e,"length",t.length);for(let r=0;r<t.length;r++)G(e,String(r),t[r])}function fu(e,t){let r=t[0];if(typeof r=="function"&&t.length===1){let n=r(e);n&&n!==e&&ui(e,n);return}if(Array.isArray(r)&&t.length===1){if(uu(r)){for(let n of r)Xs(e,n[0],n[1]);return}if(Array.isArray(e)){gr(e,r);return}if(r.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(r&&typeof r=="object"&&!Array.isArray(r)&&t.length===1){ui(e,r);return}if(t.length>=3){fi(e,t.slice(0,-1),t[t.length-1]);return}Xs(e,String(r),t[1])}function pu(e,t){if(typeof t=="function"){if(!Array.isArray(e))return[];let r=[];for(let n=0;n<e.length;n++)t(e[n],n)&&r.push(n);return r}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 r=t.by??1,n=t.from??0,i=t.to??e.length-1,o=[];for(let s=n;s<=i;s+=r)s>=0&&s<e.length&&o.push(s);return o}return t==="*"?Array.isArray(e)?e.map((r,n)=>n):Object.keys(e??{}):[t]}function fi(e,t,r){if(e==null)return;let[n,...i]=t;if(typeof n=="string"){let s=xr(n);if(s.length>1){fi(e,[...s,...i],r);return}}let o=pu(e,n);if(i.length===0){for(let s of o)G(e,s,li(r,e[s]));return}for(let s of o){let a=e[s];if(a==null||typeof a!="object"){let c=i[0];a=typeof c=="number"||/^\d+$/.test(String(c))?[]:{},G(e,s,a)}fi(a,i,r)}}function pi(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(pi);let t={};for(let r of Object.keys(e))t[r]=pi(e[r]);return t}function fe(e,t){let r=e;for(let n of xr(t)){if(r==null)return;r=r[n]}return r}var ea=class{constructor(e,t={immutable:!0}){this.options=t,this.root=e,this.set=((...r)=>I(()=>fu(this.root,r))),e&&typeof e=="object"&&(We.set(e,{store:this,name:t.name??"store"}),br.set(e,e)),K()&&ve({kind:"store",node:this,handle:()=>this.root,name:t.name})}get state(){return yr(this.root)}get proxy(){return yr(this.root)}get accessor(){return(()=>yr(this.root))}unwrap(){return this.root}getNode(e){return this.root&&this.root[e]}get(e){if(e==null||e==="")return mt(this.state);let t=this.state;for(let r of xr(e)){if(t==null)return;t=t[r]}return mt(t)}select(e){return S(()=>e(this.state))}subscribe(e){return D(()=>e(this.state))}watch(e,t){let r;return D(()=>{let n=e(this.state);Object.is(n,r)||(t(n,r),r=n)})}reactive(e){return S(()=>this.state[e])}produce(e){this.set((t=>{let r=pi(t);return e(r),r}))}reconcile(e,t={}){this.set(e)}push(e,...t){let r=fe(this.root,e);this.set(e,r.concat(t))}pop(e){let t=fe(this.root,e).slice(),r=t.pop();return this.set(e,t),r}shift(e){let t=fe(this.root,e).slice(),r=t.shift();return this.set(e,t),r}splice(e,t,r,...n){let i=fe(this.root,e).slice(),o=i.splice(t,r,...n);return this.set(e,i),o}insert(e,t,r){let n=fe(this.root,e).slice();n.splice(t,0,r),this.set(e,n)}removeAt(e,t){let r=fe(this.root,e).slice(),n=r.splice(t,1);return this.set(e,r),n}replace(e,t){if(arguments.length>=2){let n=fe(this.root,String(e)),i=t;if(Array.isArray(n)&&Array.isArray(i)){gr(n,i);return}this.set(e,i);return}let r=this.root;if(Array.isArray(r)&&Array.isArray(e)){gr(r,e);return}this.set(e)}clear(e){let t=e===void 0?this.root:fe(this.root,e);if(Array.isArray(t)){gr(t,[]);return}if(t&&typeof t=="object")for(let r of Object.keys(t))G(t,r,void 0)}toObservable(){let[e]=Dn(()=>T(this.state));return e.toObservable()}dispose(){}},du=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","replace","clear","unwrap","toObservable"];function hu(e,t){for(let r of du)e[r]=t[r].bind(t);e.$=t.reactive.bind(t)}function di(e,t={immutable:!0}){let r=m.hot,n=new ea(r?r.take("store",e):e,t);return hu(n.set,n),r&&r.keep(()=>mt(n.proxy),()=>n.set(()=>e)),[n.proxy,n.set]}function mu(e,t={}){return new ea(e,{...t,immutable:!1})}function mt(e){if(e==null||typeof e!="object")return e;let t=e[vr];return t!==void 0?t:e}function yu(e){return x(()=>mt(e))}var nh=Object.freeze({createStore:di,createMutableStore:mu,batch:I,unwrap:mt,untrackStore:yu});function hi(e,t){let[r,n]=di(e,t);return new Proxy(r,{get:(i,o)=>o==="set"?n:i[o],has:(i,o)=>o==="set"||Reflect.has(i,o)})}var gu="__fx_dom_create_component__",we=globalThis[gu]??={fn:null};function ra(e){we.fn=e}function na(e={}){let t=e.signalSystem?.createComponent;t&&(we.fn=t)}function xe(e,t){let r=Rs();return r?$(r,()=>ta(e,t)):ta(e,t)}function ta(e,t){if(we.fn)return we.fn(e,t);t&&Wt(t);let r=typeof e=="function"?x(()=>e(t)):e,n=r!=null&&(typeof r=="function"||typeof r=="object");if(n)try{r.$name=e?.name}catch{}return n&&!R(r)?dt(r):r}var ia=()=>we.fn!==null,mi=()=>we.fn!==null;function yi(){we.fn=null}function oa(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function sa(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function aa(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 ca=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),la=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"]),yt="http://www.w3.org/2000/svg";function gi(e){return e.localName.includes("-")}function gt(e,t,r,n=!1){if(r==null){e.removeAttribute(t);return}if(gi(e)){if(w()){qe(e,t,r);return}e[t]=r;return}H(e,t,r,n)}var vi=Symbol.for("fluixi.serverProps");function qe(e,t,r){let n=e[vi]??={};n[t]=r,r==null||r===!1?e.removeAttribute(t):r===!0?e.setAttribute(t,""):(typeof r=="string"||typeof r=="number")&&e.setAttribute(t,String(r))}var vu=new Set(["draggable","spellcheck","contenteditable"]);function bi(e){return e.startsWith("aria-")||vu.has(e.toLowerCase())}var vt=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 Be(e){return Si.has(e)||e.startsWith("aria-")||e.startsWith("data-")}function Er(e,t=document){return t.querySelector(e)}function ua(e,t=document){return Array.from(t.querySelectorAll(e))}function fa(e,t){return e.closest(t)}function wi(e,...t){e.classList.add(...t)}function xi(e,...t){e.classList.remove(...t)}function Ei(e,...t){t.forEach(r=>e.classList.toggle(r))}function pa(e,t){return e.classList.contains(t)}function H(e,t,r,n=!1){if(typeof r=="boolean"&&bi(t)){e.setAttribute(t,String(r));return}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 ki(e,t){return e.getAttribute(t)}function Ai(e,t){e.removeAttribute(t)}function kr(e,t){Object.assign(e.style,t)}function da(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function $i(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")kr(n,o);else if(i.startsWith("on")&&typeof o=="function"){let s=i.slice(2).toLowerCase();n.addEventListener(s,o)}else H(n,i,o)}),r.forEach(i=>{typeof i=="string"?n.appendChild(document.createTextNode(i)):n.appendChild(i)}),n}function Ci(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function Ri(e,...t){t.forEach(r=>{typeof r=="string"?e.appendChild(document.createTextNode(r)):e.appendChild(r)})}function ha(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function ma(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function ya(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function ga(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 va(e,t=5e3){return new Promise((r,n)=>{let i=Er(e);if(i){r(i);return}let o=new MutationObserver(()=>{let a=Er(e);a&&(o.disconnect(),clearTimeout(s),r(a))});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 ba(e,t,r={}){let n=new IntersectionObserver(i=>{i.forEach(o=>{t(o.isIntersecting)})},r);return n.observe(e),()=>{n.disconnect()}}function Sa(e,t){let r=new ResizeObserver(n=>{n.forEach(t)});return r.observe(e),()=>{r.disconnect()}}var bu=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function wa(e){return typeof e=="object"&&e!==null&&e.$$typeof===bu}function xa(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function Ea(e){return e instanceof Node}function ka(e,t,r="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[r]>"u"&&(globalThis[r]={}),typeof globalThis[r][e]>"u"&&(globalThis[r][e]=t))}function Aa(e,t,r="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[r]<"u"&&typeof globalThis[r][e]<"u"?globalThis[r][e]:t}function Su(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 wu(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 Na(e){return wu(Su(e))}var Oa=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),$a={},Ar="__fx_at",_a="__fx_loc";function Ti(e,t){return t&&(e[_a]=t),e}var xu=Symbol.for("fluixi.owner");function $r(e){let t=E();t&&(e[xu]=t)}function Ca(e){if(e instanceof Element){e.localName.includes("-")&&$r(e);for(let t of e.querySelectorAll("*"))t.localName.includes("-")&&$r(t)}}var Ra=/<[a-z][\w.]*-/i,Ta=new Map,Eu="__fluixi_delegated_events__",Di=globalThis[Eu]??={names:new Set},Cr=Di.names,Tr=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function St(e){if(!w())for(let t of e)Cr.has(t)||Tr.has(t)||(Cr.add(t),Di.dispatch??=ku,document.addEventListener(t,Di.dispatch))}function ku(e){let t=`$$${e.type}`,r=e.composedPath&&e.composedPath()[0]||e.target;Object.defineProperty(e,"currentTarget",{configurable:!0,get:()=>r??document});try{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}}finally{delete e.currentTarget}}function Nr(e,t,r){if(e[`$$${t}`]=r,Tr.has(t)){let n=`__fx_${t}`;if(!e[n]){let i=o=>{e[`$$${t}`]?.(o)};e.addEventListener(t,i),e[n]=i}return}Cr.has(t)||St([t])}function bt(e,t){delete e[`$$${t}`];let r=`__fx_${t}`,n=e[r];n&&(e.removeEventListener(t,n),delete e[r])}function Da(e){return!Tr.has(e)}function Ma(e){return typeof e=="function"}function pe(e,t=!1){if(w())return Pe().createText(e);if(h.active&&!t){let r=ut()?.hydrateText(e);if(r)return r}return document.createTextNode(e)}function ke(e,t=!1,r){let n=Gn();if(w()){let i=Pe().createElement(e,t);return n&&i.setAttribute(Y,n),i}if(h.active){let i=Qn(n,e);if(i)return ut()?.enterElement(i),e.includes("-")&&$r(i),r?Ti(i,r):i;let o=ut()?.hydrateElement(e);if(o)return e.includes("-")&&$r(o),r?Ti(o,r):o}return Ti(t?document.createElementNS(yt,e):document.createElement(e),r)}function Or(e,t=!1){let r=Ta.get(e);if(r)return r;let n=document.createElement("template");return t?n.innerHTML=`<svg>${e}</svg>`:n.innerHTML=e,Ta.set(e,n),n}function Mi(e,t,r=!1,n=!1,i){let o=$s(e),s=Gn(o);if(w()){let a=Pe();if(r){let c=a.parseTemplate(e,n);return s&&c.setAttribute(Y,s),c}return a.createRaw(s?Au(e,s):e)}if(h.active){let a=Qn(s,t);if(a)return h.cursor=a.nextSibling,Ra.test(e)&&Ca(a),Ni(a,i);let c=ut()?.hydrateStatic(t,o);if(c)return Ra.test(e)&&Ca(c),Ni(c,i)}return Ni(_r(Or(e,n),n).firstChild,i)}function Au(e,t){return e.replace(/^(\s*<[^\s/>]+)/,`$1 ${Y}="${t}"`)}function Ni(e,t){let r=e;if(!t||typeof r?.querySelectorAll!="function")return e;let n=[r,...r.querySelectorAll("*")];for(let i=0;i<n.length&&i*2+1<t.pos.length;i++){let o=t.pos[i*2];o&&(n[i][_a]={file:t.file,line:o,column:t.pos[i*2+1]})}return e}function wt(e,t){if(!h.active)return t();let r=Le(e.nextSibling,t);if(typeof r=="function"){let n=r;return $u(n,(...o)=>h.active?Le(e.nextSibling,()=>{let s=n(...o);for(;typeof s=="function";)s=s();return s}):n(...o))}return r}function $u(e,t){let r=e[Ar];return r!==void 0&&(t[Ar]=r),t}function xt(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 Et(e,t){let r=[];for(let n=e.nextSibling;n&&n!==t;n=n.nextSibling)r.push(n);return r}function _r(e,t=!1){let r=e.content.cloneNode(!0);return t?r.firstChild:r}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 Ia(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function Pa(e){if(R(e)||J(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!R(t)&&!J(t);)t=t();return t}var ie=0,Cu=200;function Ru(e,t,r,n,i){let o=n,s,a=()=>s??=new Map,c=!1;return k(()=>{let l=c&&h.active;if(c=!0,!l)return u();h.active=!1;try{return u()}finally{h.active=!0}});function u(){j(r??t,"content",void 0,e);let l;if(J(e)&&!R(e)){if(!a().has(e)){ie++;try{let f=e();a().set(e,f)}finally{ie--}}for(l=a().get(e);typeof l=="function"&&R(l);)l=l()}else for(l=e();typeof l=="function"&&R(l);)l=l();{let f=0;for(;typeof l=="function"&&f++<50;)if(J(l)){if(!a().has(l)){let p=l;ie++;try{let y=p();a().set(p,y)}finally{ie--}}l=a().get(l)}else if(R(l))l=l();else if(l=l(),typeof l!="function"||!R(l)&&!J(l))break}Array.isArray(l)&&a(),ie++;try{o=ze(t,l,r,o,s),i(o)}finally{ie--}}}function _(e,t,r,n){if(ie>Cu)return console.error("[insert] Exceeded max call depth, possible infinite loop."),()=>null;let i=r!==void 0&&!r&&h.active;r!==void 0&&!r&&(r=pe("",!0),i||e.appendChild(r));let o=()=>{if(!i||r.parentNode)return;let l=h.cursor;e.insertBefore(r,l&&l.parentNode===e?l:null)},s=n??null,a=l=>Array.isArray(l)&&l.some(f=>typeof f=="function"),c=l=>typeof l=="function"?l:()=>l;if(typeof t!="function"&&!a(t)){ie++;try{s=ze(e,t,r,s)}finally{ie--}return o(),()=>s}let u=Ru(c(t),e,r,s,l=>{s=l});return o(),()=>(u?.(),s)}var La=Symbol.for("fluixi.keepServerContent");function ja(e){return{[La]:!0,adopt:e}}function Tu(e){return!!e&&typeof e=="object"&&e[La]===!0}function ze(e,t,r,n,i){if(t==null||typeof t=="boolean")return Z(e,n,r);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return Z(e,n,r);if(Tu(t)){let s=n==null?[]:Array.isArray(n)?n:[n];return Ns(s),t.adopt?.(s),n??null}if(Fe(t)){let s=pe("",!0);return Array.isArray(n)?n.length>0?(e.replaceChild(s,n[0]),Z(e,n.slice(1),r)):F(e,s,r):n?e.replaceChild(s,n):F(e,s,r),t.then(a=>{s.parentNode===e&&ze(e,a,s.nextSibling,s)}).catch(a=>{console.error("Error resolving promise in insertExpression:",a)}),s}let o=typeof t;if(o==="string"||o==="number"){if(o==="number"&&(t=String(t)),Array.isArray(n)){if(n.length===0){let a=pe(t);return F(e,a,r),a}if(n.length===1&&n[0].nodeType===3){let a=n[0];return h.active&&a.data!==t&&pt(a.data,t),a.data=t,n}n=Z(e,n,r)}if(n&&sr(n))return h.active&&n.data!==t&&pt(n.data,t),n.data=t,n;let s=pe(t);return n&&n.parentNode===e?e.replaceChild(s,n):Un(e,s)||F(e,s,r),s}if(Se(t))return Un(e,t)?(pr(t),t):Array.isArray(n)?(n.length===0?F(e,t,r):n[0].parentNode===e?(e.replaceChild(t,n[0]),Z(e,n.slice(1),r)):F(e,t,r),t):(n?n!==t&&(n.parentNode===e?e.replaceChild(t,n):F(e,t,r)):F(e,t,r),t);if(Array.isArray(t)){let s=[],a=Array.isArray(n)?n:n?[n]:[],c=[],u=new Set,l=()=>ne(t,s,e,r,!0,i,c,u);h.active&&a.length?Le(a[0],l):l();let f=Nu(e,u.size?a.filter(p=>!u.has(p)):a,s,r);for(let p of c){if(p.wired)continue;let y=_(e,p.sig,p.marker);A(()=>Z(e,y()))}return f}if(o==="object"&&t!==null&&typeof t=="object"){let s=t;if("type"in s&&"props"in s){let a=s;if(typeof a.type=="function"){let c=a.type(a.props||{});return ze(e,c,r,n)}}}return Z(e,n,r)}function ne(e,t,r,n,i=!0,o,s,a){for(let c=0;c<e.length;c++){let u=e[c];if(!(u==null||typeof u=="boolean")){for(;typeof u=="function"&&!Fe(u)&&!R(u)&&!J(u)&&(u=u(),!(u==null||typeof u=="boolean")););if(!(u==null||typeof u=="boolean")){if(typeof u=="function"){let l;for(J(u)&&!R(u)?(o||(o=new Map),o.has(u)||o.set(u,u()),l=o.get(u)):l=u();typeof l=="function"&&!Fe(l)&&!R(l)&&!J(l);)o||(o=new Map),o.has(l)||o.set(l,l()),l=o.get(l);if(l==null||typeof l=="boolean")continue;if(typeof l=="function"){if(R(l)){if(s){let p=pe("",!0);if(t.push(p),h.active&&a&&h.cursor?.parentNode===r){let y=()=>h.cursor&&h.cursor.parentNode===r?h.cursor:null,v=y();r.insertBefore(p,v);let d=_(r,l,p),b=y();for(let C=v;C&&C!==b;C=C.nextSibling)a.add(C);r.insertBefore(p,b),A(()=>Z(r,d())),s.push({marker:p,sig:l,wired:!0});continue}s.push({marker:p,sig:l});continue}let f=l();for(;typeof f=="function"&&R(f);)f=f();if(f==null||typeof f=="boolean")continue;Array.isArray(f)?ne(f,t,r,n,i,o):ne([f],t,r,n,i,o);continue}continue}Array.isArray(l)?ne(l,t,r,n,i,o,s,a):ne([l],t,r,n,i,o,s,a);continue}if(Fe(u)){let l=pe("",!0);t.push(l),u.then(f=>{if(l.parentNode){let p=[];if(ne([f],p,l.parentNode,void 0,!1,o),p.length>0){l.parentNode.replaceChild(p[0],l);for(let y=1;y<p.length;y++)l.parentNode?.insertBefore(p[y],p[y-1].nextSibling)}}}).catch(f=>console.error("Error resolving promise in array:",f));continue}if(Array.isArray(u)){ne(u,t,r,n,i,o,s,a);continue}if(Se(u)){h.active&&(h.cursor===u||h.parents.includes(u))&&pr(u),t.push(u);continue}if(typeof u=="object"&&u!==null&&"type"in u&&"props"in u){let l=u;if(typeof l.type=="function"){let f=l.type(l.props||{});Array.isArray(f)?ne(f,t,r,n,!1,o):ne([f],t,r,n,!1,o);continue}}if(typeof u=="string"||typeof u=="number"){let l=String(u);if(l.trim()===""&&l!==" ")continue;t.push(pe(l));continue}t.push(pe(String(u)))}}}}function Nu(e,t,r,n){for(let f=0;f<r.length;f++){let p=r[f].parentNode;p!==null&&p!==e&&p.nodeType!==11&&(r=r.slice(),r[f]=r[f].cloneNode(!0))}let i=r.length,o=t.length,s=i,a=0,c=0,u=o>0?t[o-1].nextSibling??void 0:n,l=null;for(;a<o||c<s;){if(t[a]===r[c]){a++,c++;continue}for(;o>a&&s>c&&t[o-1]===r[s-1];)o--,s--;if(o===a){let f=s<i?c?r[c-1].nextSibling??void 0:r[s-c]:u;for(;c<s;)F(e,r[c++],f)}else if(s===c)for(;a<o;)(!l||!l.has(t[a]))&&t[a].parentNode===e&&e.removeChild(t[a]),a++;else if(t[a]===r[s-1]&&r[c]===t[o-1]){let f=t[--o].nextSibling;F(e,r[c++],t[a++].nextSibling),F(e,r[--s],f),t[o]=t[a-1]}else{if(!l){l=new Map;let p=c;for(;p<s;)l.set(r[p],p++)}let f=l.get(t[a]);if(f!=null)if(c<f&&f<s){let p=a,y=1;for(;++p<o&&p<s&&!(!l.has(t[p])||l.get(t[p])!==f+y);)y++;if(y>f-c){let v=t[a];for(;c<f;)F(e,r[c++],v)}else t[a].parentNode===e?e.replaceChild(r[c++],t[a++]):(F(e,r[c++],u),a++)}else a++;else t[a].parentNode===e&&e.removeChild(t[a]),a++}}return r}function Z(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 F(e,t,r){h.active&&t.parentNode===e||(r&&r.parentNode===e?e.insertBefore(t,r):e.appendChild(t))}function de(e,t,r){r==null?delete e[t]:e[t]=r}function Dr(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 Ha(e,t){if(!t||typeof t!="function")return;let r=t[Ar]?.name;if(!r)return;let n=r.indexOf(":");n!==-1&&W(e,r.slice(0,n),r.slice(n+1),t)}function Rr(e,t,r){let n=typeof r=="function"?x(()=>r()):r;if(!(!n||typeof n!="object"))for(let i of Object.keys(n))W(e,t,i)}function Mr(e,t){let r=(n,i)=>{typeof n=="function"&&(W(e,"use",n.name||"use",i),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 Ke(e,t,r,n=!1){return Ha(e,r),typeof r!="function"?(H(e,t,r,n),()=>{}):k(()=>{j(e,"attribute",t,r);let i=typeof r=="function"?r():r;H(e,t,i,n)})}function Ue(e,t,r){return typeof r!="function"?(de(e,t,r),()=>{}):(Ha(e,r),k(()=>{j(e,"property",t,r);let n=typeof r=="function"?r():r;de(e,t,n)}))}function Ir(e,t,r){return typeof r!="function"?(H(e,t,!!r),()=>{}):k(()=>{j(e,"attribute",t,r);let n=r();H(e,t,!!n)})}function Ee(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){k(()=>{j(e,"attribute","class",t),Ee(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 he(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(k(()=>{let s=!!i();for(let a of o)e.classList.toggle(a,s)}));else{let s=!!(typeof i=="function"?i():i);for(let a of o)e.classList.toggle(a,s)}}}function Oi(e,t,r){t.includes("-")?r==null?e.removeProperty(t):e.setProperty(t,String(r)):e[t]=r??""}function Ve(e){for(;typeof e=="function";)e=e();return e}var _i=new WeakMap;function oe(e,t,r){if(typeof t=="function"&&r){r.push(k(()=>oe(e,Ve(t))));return}let n=Ve(t),i=_i.get(e);if(n==null){_i.delete(e),e.removeAttribute("style");return}let o=new Set,s=a=>{if(typeof a=="function"&&r){r.push(k(()=>s(Ve(a))));return}if(a=Ve(a),a!=null){if(typeof a=="string")e.style.cssText=a;else if(Array.isArray(a))for(let c of a)s(c);else if(typeof a=="object")for(let c in a){o.add(c);let u=a[c];typeof u=="function"&&r?r.push(k(()=>Oi(e.style,c,Ve(u)))):Oi(e.style,c,Ve(u))}}};if(Array.isArray(n))for(let a of n)s(a);else s(n);if(i)for(let a of i)o.has(a)||Oi(e.style,a,null);_i.set(e,o)}function Wa(e,t){if(typeof t!="function"){oe(e,t,[]);return}k(()=>{j(e,"attribute","style",t),oe(e,t())})}function qa(e,t){if(typeof t!="function"){he(e,t,[]);return}k(()=>{j(e,"attribute","class",t),he(e,t())})}function Ou(e,t){for(let r=e;r;r=Object.getPrototypeOf(r)){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return typeof n.get=="function"}return!1}function Pi(e){let{element:t,props:r,prevProps:n=$a,isSVG:i=!1,skipChildren:o=!1,isCustomElement:s,accessors:a}=e;if(!t||!or(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!r)return console.warn("[spread] Warning: props is undefined!"),()=>{};let c=i||t.namespaceURI===yt,u=(d,b,C,N)=>{if(d==="children"){o||N.push(_(t,()=>r.children));return}let g=r[d],ee=g===void 0&&C&&Ou(r,d);if(g===b&&!ee||ee&&(d==="ref"||d==="use"||d.startsWith("on")||d.includes(":")||d==="class"||d==="className"||d==="classList"||d==="style"))return;if(d==="ref"){Ae(g,t);return}if(d==="use"){Mr(t,g);return}if(d.startsWith("on:")){N.push(Dr(t,d.slice(3),g));return}if(d.startsWith("prop:")){W(t,"prop",d.slice(5),g),N.push(Ue(t,d.slice(5),g));return}if(d.startsWith("attr:")){W(t,"attr",d.slice(5),g),N.push(Ke(t,d.slice(5),g,c));return}if(d.startsWith("bool:")){W(t,"bool",d.slice(5),g),N.push(Ir(t,d.slice(5),g));return}if(d==="class"||d==="className"){typeof g=="function"?N.push(k(()=>{j(t,"attribute","class",g),Ee(t,g())})):Ee(t,g);return}if(d==="classList"){Rr(t,"class",g),typeof g=="function"?N.push(k(()=>{j(t,"attribute","class",g),he(t,g())})):he(t,g,N);return}if(d==="style"){Rr(t,"style",g),typeof g=="function"?N.push(k(()=>{j(t,"attribute","style",g),oe(t,g())})):oe(t,g,N);return}if(d.startsWith("on")){let O=d.slice(2).toLowerCase();b&&bt(t,O),g&&Nr(t,O,g);return}let te=s??t.localName.includes("-"),ge=vt.has(d)||!c&&d in t||te&&!c&&!Be(d);if(te&&!c&&!Be(d)&&a!==void 0&&typeof g=="function"&&!a.includes(d)){w()?qe(t,d,g):de(t,d,g);return}if(te&&!c&&!Be(d)&&w()){N.push(k(()=>{let O=typeof g=="function"?g():r[d];for(;typeof O=="function"&&O.length===0;)O=O();qe(t,d,O)}));return}typeof g=="function"?N.push(ge?Ue(t,d,g):Ke(t,d,g,c)):N.push(k(()=>ge?de(t,d,r[d]):H(t,d,r[d],c)))},l=d=>{d!=="children"&&(d.startsWith("on")?bt(t,d.slice(2).toLowerCase()):vt.has(d)?de(t,d,null):t.removeAttribute(d))},f=new Map,p=(d,b,C)=>{let N=[];f.set(d,N),u(d,b,C,N)};x(()=>{for(let d in r)p(d,n[d],n===$a);for(let d in n)d in r||l(d)});let y=E(),v=k(()=>{let d=new Set;for(let b in r)d.add(b);x(()=>$(y,()=>{for(let b of d)f.has(b)||p(b,void 0,!0);for(let[b,C]of f)d.has(b)||(C.forEach(N=>N()),f.delete(b),l(b))}))});return()=>{v();for(let d of f.values())d.forEach(b=>b())}}function kt(e,t,r=!1){for(let n in t){if(n==="children")continue;let i=t[n];if(n==="ref"){Ae(i,e);continue}if(n==="use"){Mr(e,i);continue}if(n.startsWith("on:")){Dr(e,n.slice(3),i);continue}if(n.startsWith("prop:")){W(e,"prop",n.slice(5),i),Ue(e,n.slice(5),i);continue}if(n.startsWith("attr:")){W(e,"attr",n.slice(5),i),Ke(e,n.slice(5),i,r);continue}if(n.startsWith("bool:")){W(e,"bool",n.slice(5),i),Ir(e,n.slice(5),i);continue}if(n.startsWith("on")&&n.length>2){let o=n.slice(2).toLowerCase();if(typeof i=="function")if(Tr.has(o)){e[`$$${o}`]=i;let s=`__fx_${o}`;if(!e[s]){let a=c=>{e[`$$${o}`]?.(c)};e.addEventListener(o,a),e[s]=a}}else e[`$$${o}`]=i,Cr.has(o)||St([o]);continue}if(n==="class"||n==="className"){Ee(e,i);continue}if(n==="classList"){Rr(e,"class",i),typeof i=="function"?k(()=>{j(e,"attribute","class",i),he(e,i())}):he(e,i,[]);continue}if(n==="style"){Rr(e,"style",i),typeof i=="function"?k(()=>{j(e,"attribute","style",i),oe(e,i())}):oe(e,i,[]);continue}if(n==="innerHTML"){if(typeof i=="function"){let o=D(()=>{let s=i();for(;typeof s=="function";)s=s();e.innerHTML=s});A(()=>o())}else e.innerHTML=i;continue}if(n==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof i=="function"){let o=D(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();document.activeElement!==e&&(e.value=s??"")});A(()=>{o()})}else k(()=>{document.activeElement!==e&&(e.value=t[n]??"")});continue}if(n==="checked"&&e.tagName==="INPUT"){if(typeof i=="function"){let o=D(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();document.activeElement!==e&&(e.checked=s??"")});A(()=>{o()})}else k(()=>{document.activeElement!==e&&(e.checked=t[n]??"")});continue}if(n==="value"&&e.tagName==="SELECT"){if(typeof i=="function"){let o=!0,s=D(()=>{let a=i();for(;typeof a=="function"&&a.length===0;)a=a();o?(o=!1,queueMicrotask(()=>{e.value=a??""})):e.value=a??""});A(()=>{s()})}else{let o=!0;k(()=>{let s=t[n];o?(o=!1,queueMicrotask(()=>{e.value=s??""})):e.value=s??""})}continue}if(typeof i=="function"){let o=D(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();gt(e,n,s,r)});A(()=>{o()})}else k(()=>gt(e,n,t[n],r))}}function Li(...e){let t=i=>typeof i=="function"?i():i,r=i=>{for(let o=e.length-1;o>=0;o--){let s=t(e[o]);if(!s||!(i in s))continue;let a=s[i];if(a!==void 0)return a}},n=i=>{for(let o of e){let s=t(o);if(s&&i in s)return!0}return!1};return new Proxy({},{get:(i,o)=>r(o),has:(i,o)=>n(o),ownKeys:()=>{let i=new Set;for(let o of e){let s=t(o);if(s)for(let a of Reflect.ownKeys(s))i.add(a)}return[...i]},getOwnPropertyDescriptor:(i,o)=>n(o)?{enumerable:!0,configurable:!0,get:()=>r(o)}:void 0})}function Pr(e,...t){let r=new Set;for(let s of t)for(let a of s)r.add(a);let n=s=>({enumerable:!0,configurable:!0,get:()=>e[s]}),i=t.map(s=>{let a=new Set(s);return new Proxy({},{get:(c,u)=>a.has(u)?e[u]:void 0,has:(c,u)=>a.has(u)&&u in e,ownKeys:()=>Array.from(a).filter(c=>c in e),getOwnPropertyDescriptor:(c,u)=>a.has(u)&&u in e?n(u):void 0})}),o=new Proxy({},{get:(s,a)=>r.has(a)?void 0:e[a],has:(s,a)=>!r.has(a)&&a in e,ownKeys:()=>Reflect.ownKeys(e).filter(s=>!r.has(s)),getOwnPropertyDescriptor:(s,a)=>!r.has(a)&&a in e?n(a):void 0});return[...i,o]}function Ae(e,t){if(!e)return;let r=e[Ar]?.name;if(W(t,"ref",r||typeof e=="function"&&e.name||"ref",e),Se(e)){let n=t,i=e;if(!n)return;typeof n=="function"?n(i):typeof n=="object"&&"current"in n&&(n.current=i);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}function ji(e,t,r){let n=t||document.body,i=Oe(()=>e),o=[];return I(()=>{let s=k(()=>{let a=i();Array.isArray(a)?(a.forEach(c=>n.appendChild(c)),o.push(()=>{a.forEach(c=>{c.parentNode===n&&n.removeChild(c)})})):Se(a)&&(n.appendChild(a),o.push(()=>{a.parentNode===n&&n.removeChild(a)}))});o.push(s),A(()=>{o.forEach(a=>a())})}),null}function Ba(e){return typeof e=="string"&&e.toLowerCase()===e}function Lr(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 Va(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 Fa(e){return typeof e=="function"&&e.length===0&&R(e)}function $e(e,t,r){if(!t)throw new Error("Container element is required");let n,i,o=[];return q(s=>{I(()=>{h.active||(t.textContent=""),cr(t),lr(),_(t,e)}),i=s}),()=>{i?.(),n?.(),o.forEach(s=>s()),t.textContent=""}}function Hi(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(...)`.")}function jr(e,t={}){if(typeof e=="function")return xe(e,t);if(typeof e!="string"||e.length===0)return null;let r=Lr(e),n=ke(e,r);return kt(n,t,r),Du(n,t),n}function _u(e){if(!e||!("children"in e))return!1;let t=Object.getOwnPropertyDescriptor(e,"children");return!t||"get"in t?!0:t.value!==void 0}function Du(e,t){if(!_u(t))return;if(w()&&!ft()){_(e,Oe(()=>t.children));return}let r=e.firstChild,n;h.active&&r?.nodeType===8&&r.data==="fx"?n=xt(r):(r=za("fx"),n=za("fx/"),e.appendChild(r),e.appendChild(n));let i=r;_(e,wt(i,()=>Oe(()=>t.children)),n,Et(i,n))}function za(e){return w()?Pe().createComment(e):document.createComment(e)}function Hr(e){let t=()=>{let a=e.component;return R(a)?a():a},[,r]=Pr(e,["component"]),n=E(),i=null,o,s;return S(()=>{let a=t();return a===o||(i&&X(i),i=U(n),o=a,s=a==null?null:$(i,()=>x(()=>typeof a=="string"?jr(a,r):xe(a,r)))),s},void 0,{name:"Dynamic"})}var Wi=gn(void 0);function qi(e,t){let r;D(()=>{t.error()===void 0?r=void 0:r??=x(e.current)}),D(()=>{let n=e.committed();x(()=>{r!==void 0&&n!==r&&t.error()!==void 0&&t.reset()})})}function Wr(e){let t=mn(),r=a=>!!a&&typeof a.then=="function",n=a=>(w()&&nr(ir(a)),typeof e.fallback=="function"?e.fallback(a,t.reset):e.fallback),i=a=>{if(r(a))throw a;return queueMicrotask(()=>t.setError(a)),null},o=a=>{if(Array.isArray(a))return a.map(o);if(typeof a!="function")return a;let c=a;return()=>{try{let u=o(c()),l=w()?t.caught():void 0;return l===void 0?u:x(()=>n(l))}catch(u){return w()&&!r(u)?(t.setError(u),x(()=>n(u))):i(u)}}},s=zt(Wi);return s&&qi(s,t),S(()=>{let a=t.error();if(a!==void 0)return n(a);try{let c=yn(t,()=>{let l=e.children;return o(typeof l=="function"?l():l)}),u=w()?t.caught():void 0;return u===void 0?c:x(()=>n(u))}catch(c){return i(c),n(c)}},void 0,{name:"ErrorBoundary"})}function qr(e){let t=ue(()=>e.each),r=()=>e.fallback??null,n=(i,o)=>{let s=e.children,a=Array.isArray(s)?s.map(c=>typeof c=="function"?c(i,o):c):typeof s=="function"?s(i,o):s;return je(a),a};return e.by?De(t,e.by,(i,o)=>n(i,o),{fallback:r}):_e(t,(i,o)=>n(i,o),{fallback:r})}function Br(e){let t=ue(()=>e.each);return Me(t,(r,n)=>{let i=e.children(r,n);return je(i),i},{fallback:()=>e.fallback??null})}function Vr(e){if(w())return null;let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,r,n,i=!1,o=E(),s=()=>$(o,()=>q(a=>{r=a,n=document.createElement("div"),n.style.display="contents",t().appendChild(n),_(n,e.children)&&Ae(e.ref,n)}));return h.active?queueMicrotask(()=>{i||s()}):s(),A(()=>{i=!0,r?.(),n?.remove()}),null}var Mu=Symbol.for("fluixi.owner"),$t=1,Bi=3,Vi=8,Iu=Symbol.for("fluixi.serverElementRenderer"),Ka=Symbol.for("fluixi.serverElementRendered");function At(e){if(e.nodeType!==$t)return;let t=e;if(typeof t.localName!="string"||!t.localName.includes("-")||t[Ka])return;let r=globalThis[Iu];r&&(t[Ka]=!0,r(t))}var Ua;Ua=ct;var Fr=class{constructor(){this[Ua]=!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),At(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),At(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,At(e)),t}addEventListener(){}removeEventListener(){}},Ct=class Ja extends Fr{constructor(t){super(),this.nodeType=Bi,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 Ja(this.data)}},Ga=class Xa extends Fr{constructor(t){super(),this.nodeType=$t,this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new Xa(this.rawOuterHTML)}getAttribute(t){let r=/^\s*<[a-zA-Z][^\s/>]*([^>]*)>/.exec(this.rawOuterHTML)?.[1];if(!r)return null;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`(?:^|\\s)${n}(?:\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+)))?(?=\\s|/|$)`,"i").exec(r);return i?i[1]??i[2]??i[3]??"":null}hasAttribute(t){return this.getAttribute(t)!==null}},zr=class Ya extends Fr{constructor(t){super(),this.nodeType=Vi,this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new Ya(this.data)}},Pu=class{constructor(){this.cssText=""}setProperty(e,t){this[e]=t}removeProperty(e){delete this[e]}},Lu=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}},Rt=class Za extends Fr{constructor(t,r=!1){if(super(),this.nodeType=$t,this.attributes=new Map,this.style=new Pu,this.classList=new Lu(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,this.localName.includes("-")){let n=E();n&&(this[Mu]=n)}}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}get dataset(){let t=r=>`data-${r.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}`;return new Proxy({},{get:(r,n)=>typeof n=="string"?this.getAttribute(t(n))??void 0:void 0,set:(r,n,i)=>(typeof n=="string"&&this.setAttribute(t(n),String(i)),!0),deleteProperty:(r,n)=>(typeof n=="string"&&this.removeAttribute(t(n)),!0)})}toggleAttribute(t,r){let n=r??!this.hasAttribute(t);return n?this.setAttribute(t,""):this.removeAttribute(t),n}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 Ct(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 Za(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}};var ju=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Hu={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function Qa(e){return e.replace(/&(#?\w+);/g,(t,r)=>Hu[r]??t)}var se=class extends Error{};function ec(e,t=!1){let r=0,n=[],i=[],o=u=>{let l=i[i.length-1];l?l.appendChild(u):n.push(u)};for(;r<e.length;){let u=e.indexOf("<",r);if(u===-1){a(e.slice(r));break}if(u>r&&a(e.slice(r,u)),e.startsWith("<!--",u)){let l=e.indexOf("-->",u);if(l===-1)throw new se(`unterminated comment at ${u}`);o(new zr(e.slice(u+4,l))),r=l+3;continue}if(e[u+1]==="/"){let l=e.indexOf(">",u);if(l===-1)throw new se(`unterminated closing tag at ${u}`);let f=e.slice(u+2,l).trim().toLowerCase(),p=i.pop();if(!p||p.localName!==f)throw new se(`</${f}> does not close <${p?.localName??"nothing"}>`);r=l+1;continue}r=c(u)}if(i.length>0)throw new se(`unclosed <${i[i.length-1].localName}>`);let s=n[0];if(n.length!==1||!(s instanceof Rt))throw new se(`expected exactly one root element, got ${n.length}`);return s;function a(u){u!==""&&o(new Ct(Qa(u)))}function c(u){let l=/[\s/>]/.exec(e.slice(u+1));if(!l)throw new se(`unterminated tag at ${u}`);let f=e.slice(u+1,u+1+l.index).toLowerCase(),p=new Rt(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 v=y;for(;y<e.length&&!/[\s=/>]/.test(e[y]);)y++;let d=e.slice(v,y);if(d==="")throw new se(`malformed attribute at ${y}`);if(e[y]==="="){if(e[y+1]!=='"')throw new se(`attribute ${d} must have a double-quoted value`);let b=e.indexOf('"',y+2);if(b===-1)throw new se(`unterminated value for ${d}`);p.setAttribute(d,Qa(e.slice(y+2,b))),y=b+1}else p.setAttribute(d,"")}return o(p),ju.has(f)||i.push(p),y}}var Wu=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),rc=/&/g,nc=/</g,ic=/>/g,qu=/"/g;function Fi(e){return e.replace(rc,"&").replace(nc,"<").replace(ic,">")}function tc(e){return e.replace(rc,"&").replace(qu,""").replace(nc,"<").replace(ic,">")}function Bu(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Vu(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(`${Bu(r)}: ${n}`)}return t.join("; ")}function Fu(e){let t="",r=Vu(e.style);for(let[n,i]of e.attributes)n==="style"&&r||(t+=` ${n}="${tc(i)}"`);if(r){let n=e.attributes.get("style"),i=n?`${n.replace(/;\s*$/,"")}; ${r}`:r;t+=` style="${tc(i)}"`}return t}function Q(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return Fi(e);if(typeof e=="number")return Fi(String(e));if(typeof e=="function")return Q(e());if(Array.isArray(e))return e.map(Q).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case Bi:return Fi(e.data??"");case Vi:return`<!--${e.data??""}-->`;case $t:{At(e);let t=e.localName,r=`<${t}${Fu(e)}>`;if(Wu.has(t))return r;let n=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(Q).join("");return`${r}${n}</${t}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(Q).join(""):""}var Tt="__FX_DATA__";function Kr(e){return e.replace(/[<>&\u2028\u2029]/g,t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"))}var zi;function Ur(){let e=globalThis.__FX_DATA__;if(e&&typeof e.nodeType!="number")return e;if(zi!==void 0)return zi;let t=null;if(typeof document<"u"){let r=document.getElementById(Tt)?.textContent;if(r)try{t=JSON.parse(r)}catch{t=null}}return zi=t}var oc=!1;function cc(){oc||(oc=!0,hs({createElement:(e,t)=>new Rt(e,t),createText:e=>new Ct(e),createRaw:e=>new Ga(e),parseTemplate:(e,t)=>ec(e,t),createComment:e=>new zr(e)}))}function lc(e,t={}){let r=w();cc(),be(!0);let n=nt(t.event);n.hydrationKeys=t.hydrationKeys!==!1;try{return st(n,()=>q(i=>{try{let o=typeof e=="function"?e():e;return Q(o)}finally{i()}}))}finally{ot(n),be(r)}}var sc=!1,ac=new WeakMap;function zu(){sc||(sc=!0,xn(e=>{B()?.pending.add(e)}),tt(()=>B()?.nextResourceId()??""),Cn((e,t)=>{e&&B()?.data.set(e,t)}),Nn(()=>{let e=B();if(!e)return;let t=ac.get(e);return t||ac.set(e,t=Tn()),t}))}var Ki=null;function uc(e){Ki=e}function Ui(e){if(e.data.size===0)return"";let t={};for(let[n,i]of e.data){let o=i;if(Ki)try{o=Ki(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=Kr(JSON.stringify(t));return r==="{}"?"":`<script type="application/json" id="${Tt}">${r}<\/script>`}var Ku=50;async function fc(e,t={}){let r=w();cc(),be(!0),zu();let n=nt(t.event);n.hydrationKeys=t.hydrationKeys!==!1;try{return await st(n,async()=>{t.preload&&await t.preload(t.event);let i,o=null,s=()=>{};q(l=>{s=l,o=E(),i=typeof e=="function"?e():e});let a=()=>{try{$(o,()=>Q(i))}catch{}};a();let c=0;for(;n.pending.size>0&&c++<Ku;){let l=Array.from(n.pending);n.pending.clear(),await Promise.allSettled(l),await Ut(),a()}let u=$(o,()=>Q(i))+Ui(n);return s(),u})}finally{ot(n),be(r)}}function Gr(){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 Jr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Nt=!lt();function Ot(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).`)}var Uu=Symbol.for("fluixi.ownsContent");function mc(e){return e.localName.includes("-")?e.hasAttribute("data-fx-ssr")||e[Uu]===!0:!1}var pc=Symbol.for("fluixi.serverContent");function yc(e){let t=e;t[pc]||(t[pc]=Array.from(e.childNodes))}function Ju(e){Gr();let t=h.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(Xn(t),Jr.has(e.toLowerCase())||mc(t)?(Jr.has(e.toLowerCase())||yc(t),h.cursor=t.nextSibling):(h.parents.push(t),h.cursor=t.firstChild),t):(Nt&&t&&Ot(`<${e}>`,t),null)}function Gu(e){Jr.has(e.localName)||mc(e)?(Jr.has(e.localName)||yc(e),h.cursor=e.nextSibling):(h.parents.push(e),h.cursor=e.firstChild)}function Xu(e,t){Gr();let r=h.cursor;if(r&&r.nodeType===1&&r.tagName.toLowerCase()===e.toLowerCase()){let n=Cs(r);return t&&n&&n!==t?(Nt&&Ot(`<${e}> (another template)`,r),null):(Xn(r),h.cursor=r.nextSibling,r)}return Nt&&r&&Ot(`<${e}> (static)`,r),null}function Yu(e){if(e===""){let r=h.cursor;return r&&r.nodeType===3&&r.data!==""?(h.cursor=r.nextSibling,r.data="",r):null}Gr();let t=h.cursor;if(t&&t.nodeType===3){let r=t.data;return r.length>e.length&&r.startsWith(e)?(h.cursor=t.splitText(e.length),t):(h.cursor=t.nextSibling,r!==e&&(pt(r,e),t.data=e),t)}return Nt&&t&&Ot(`text ${JSON.stringify(e.slice(0,24))}`,t),null}function Zu(e){Gr();let t=h.cursor;return t&&t.nodeType===8&&t.data===e?(h.cursor=t.nextSibling,t):(Nt&&t&&Ot(`marker <!--${e.slice(0,24)}-->`,t),null)}var dc=!1;function gc(){dc||(dc=!0,vs({hydrateElement:Ju,hydrateText:Yu,hydrateMarker:Zu,hydrateStatic:Xu,enterElement:Gu}))}var hc=()=>typeof location>"u"?null:`${location.pathname}${location.search}`;function Ce(e,t,r){gc(),h.active=!0,h.cursor=t.firstChild,h.parents=[],hr(),Yn(t);let n=Ur(),i=r?.resourceNamespace,o=0;tt(()=>i?`${i}:r${o++}`:`r${o++}`);let s=hc();kn(n?a=>a in n&&hc()===s?{value:n[a]}:void 0:null);try{return $e(e,t)}finally{h.active=!1,h.cursor=null,h.parents=[],Zn()}}function vc(e,t){gc(),Yn(e);let r={active:h.active,cursor:h.cursor,parents:h.parents};h.active=!0,h.cursor=e.firstChild,h.parents=[];try{_(e,t()),mr(e)}finally{h.active=r.active,h.cursor=r.cursor,h.parents=r.parents,r.active||Zn()}}var Ji="fluixi-island";function Sc(e){let t=e.component,r=e.props??{},n=e.name,i=ke(Ji),o=n??t.name??"Island";H(i,"name",o),H(i,"props",JSON.stringify(r??{}));let s=w()?B():void 0;if(s){let a=s.nextIslandNamespace(o);_(i,()=>s.withResourceScope(a,()=>t(r)))}else _(i,()=>t(r));return i}var bc=!1;function Qu(){if(bc||typeof document>"u")return;bc=!0;let e=document.createElement("style");e.textContent=`${Ji}{display:contents}`,document.head.appendChild(e)}function wc(e){if(typeof document>"u")return;Qu();let t=document.querySelectorAll(Ji),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 a={};try{a=JSON.parse(n.getAttribute("props")||"{}")}catch{}Ce(()=>s(a),n,{resourceNamespace:`${i}#${o}`})})}function xc(e,...t){throw new Error("html`` was not compiled, enable the html format: fluixi({ format: 'html' }).")}function Ec(e,...t){throw new Error("svg`` was not compiled, enable the html format: fluixi({ format: 'html' }).")}function kc(e,...t){throw new Error("css`` was not compiled: component styles need @fluixi-css/vite next to the fluixi plugin.")}var ef={createComponent:xe,createElement:$i,createNativeElement:ke,createTemplate:Or,cloneTemplate:_r,templateNode:Mi,holeContent:Et,holeEnd:xt,holeScope:wt,createPortal:ji,render:$e,hydrate:Ce,insert:_,appendChildren:Ri,removeChildren:Ci,spread:Pi,applyProps:kt,mergeProps:Li,bindPair:Hi,setProperty:de,setDynamicProperty:Ue,setAttribute:H,setDynamicAttribute:Ke,removeAttribute:Ai,getAttribute:ki,setClassName:Ee,addClass:wi,removeClass:xi,toggleClass:Ei,setStyles:kr,delegateEvents:St,addDelegatedEventListener:Nr,removeDelegatedEventListener:bt,handleRef:Ae,resetIntegration:yi,isIntegrationInitialized:mi},tf=ef;var Xr={kind:"eager"},rf=["pointerdown","focusin","keydown"],Ac=new Set(["eager","idle","visible","interaction","media","never"]),Je=class extends Error{};function $c(e,t){let r=e.slice(5);if(!Ac.has(r))throw new Je(`Unknown load strategy 'load:${r}'. Expected one of ${[...Ac].join(", ")}.`);switch(r){case"eager":return Xr;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?nf(t):[...rf]};case"media":if(!t)throw new Je(`'load:media' needs a query, e.g. load:media="(min-width: 1024px)".`);return{kind:"media",query:t};default:throw new Je(`Unhandled load strategy '${r}'.`)}}function nf(e){let t=e.split(/[\s,]+/).map(r=>r.trim()).filter(Boolean);if(t.length===0)throw new Je("'load:interaction' was given no event names.");return t}function Cc(e){return e.kind!=="eager"}var Xi=["Show","For","Index","Switch","Match","Portal","Dynamic","ErrorBoundary"],Yi=["Suspense","SuspenseList","Await"],Yr=["Router","Outlet","Redirect","Link"],by=[...Xi,...Yi,...Yr],Zi=new Set([...Xi,...Yi]);function Rc(e={}){let{controlFlowModule:t="@fluixi/dom",coreModule:r="@fluixi/core",routerModule:n="@fluixi/core/router"}=e,i={};for(let o of Xi)i[o]=t;for(let o of Yi)i[o]=r;for(let o of Yr)i[o]=n;return i}function Tc(e,t={}){let{resolver:r,isBound:n,modules:i,strategyFor:o}=t,s=Rc(i),a=new Map,c=new Set,u=f=>{let{name:p}=f;if(!p||p.includes(".")||n?.(p))return;let y=l(p);if(!y){c.add(p);return}let v=y.origin==="builtin"&&Zi.has(p)?Xr:o?.(f)??Xr;f.source={...y,loading:v},a.set(p,f.source)},l=f=>{if(Zi.has(f))return{module:s[f],export:f,origin:"builtin"};let p=r?.resolve(f);if(p)return{module:p.module,export:p.export,origin:"rule"};if(Yr.includes(f))return{module:s[f],export:f,origin:"builtin"}};return Zr(e,f=>{f.kind==="component"&&u(f)}),{resolved:a,unresolved:[...c]}}function Zr(e,t){let r=Array.isArray(e)?e:[e];for(let n of r){t(n);let i=n.children;i&&Zr(i,t)}}function Nc(e){let t=[];Zr(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:a}=o.source;a.kind==="eager"&&r.add(s),a.kind==="never"&&n.add(s)}let i=new Map;for(let o of t){let s=o.source;!Cc(s.loading)||s.loading.kind==="never"||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 Oc={quot:34,amp:38,apos:39,lt:60,gt:62,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,copy:169,ordf:170,laquo:171,not:172,shy:173,reg:174,macr:175,deg:176,plusmn:177,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,sup1:185,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,Agrave:192,Aacute:193,Acirc:194,Atilde:195,Auml:196,Aring:197,AElig:198,Ccedil:199,Egrave:200,Eacute:201,Ecirc:202,Euml:203,Igrave:204,Iacute:205,Icirc:206,Iuml:207,ETH:208,Ntilde:209,Ograve:210,Oacute:211,Ocirc:212,Otilde:213,Ouml:214,times:215,Oslash:216,Ugrave:217,Uacute:218,Ucirc:219,Uuml:220,Yacute:221,THORN:222,szlig:223,agrave:224,aacute:225,acirc:226,atilde:227,auml:228,aring:229,aelig:230,ccedil:231,egrave:232,eacute:233,ecirc:234,euml:235,igrave:236,iacute:237,icirc:238,iuml:239,eth:240,ntilde:241,ograve:242,oacute:243,ocirc:244,otilde:245,ouml:246,divide:247,oslash:248,ugrave:249,uacute:250,ucirc:251,uuml:252,yacute:253,thorn:254,yuml:255,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},of=/&(?:#[xX]([0-9a-fA-F]{1,6})|#([0-9]{1,7})|([a-zA-Z][a-zA-Z0-9]{1,31}));/g;function Qr(e){return e.includes("&")?e.replace(of,(t,r,n,i)=>{let o=r?parseInt(r,16):n?parseInt(n,10):Object.prototype.hasOwnProperty.call(Oc,i)?Oc[i]:void 0;return o!==void 0&&o<=1114111?String.fromCodePoint(o):t}):e}var z="@fluixi/reactive/signal",Qi={$signal:{export:"signal",module:z,returns:"signal-handle"},$memo:{export:"memo",module:z,returns:"memo-handle"},$effect:{export:"effect",module:z,returns:"effect"},$store:{export:"store",module:"@fluixi/reactive/store",returns:"store-handle"},$resource:{export:"resource",module:z,returns:"resource-handle"},$cachedResource:{export:"cachedResource",module:"@fluixi/reactive/cached-resource",returns:"resource-handle"},$selector:{export:"createSelector",module:z,returns:"memo-accessor"},$deferred:{export:"createDeferred",module:z,returns:"memo-accessor"},$untrack:{export:"untrack",module:z,returns:"plain"},$untrackStore:{export:"untrackStore",module:"@fluixi/reactive/store",returns:"plain"},$batch:{export:"batch",module:z,returns:"plain"},$cleanup:{export:"onCleanup",module:z,returns:"plain"},$root:{export:"root",module:z,returns:"plain"},$context:{export:"context",module:z,returns:"plain"},$renderEffect:{export:"renderEffect",module:z,returns:"effect"},$computed:{export:"computed",module:z,returns:"effect"},$storage:{export:"useStorage",module:"@fluixi/core/storage",returns:"plain"},$asyncStorage:{export:"useAsyncStorage",module:"@fluixi/core/storage",returns:"plain"},$persisted:{export:"persisted",module:"@fluixi/core/storage",returns:"signal-handle"},$env:{export:"env",module:"@fluixi/start/env",returns:"plain"}};var Ry=new RegExp(`\\$(?:${Object.keys(Qi).map(e=>e.slice(1)).join("|")})\\s*\\(`);var _c="__fx_source";var sf="__fx_hole",Re=(e,t,r,n)=>`(globalThis.${sf} ?? ((f) => f))(${e},${t},${r}${n===void 0?"":`,${JSON.stringify(n)}`})`,af="__fx_props",Dc=(e,t)=>`(globalThis.${af} ?? ((p) => p))(${e},${JSON.stringify(t)})`;var eo={version:1,module:"@fluixi/dom",symbols:["createNativeElement","insert","spread","setAttribute","delegateEvents","createComponent","createMemo","untrack","Show","For","Index","Switch","Match","Dynamic","ErrorBoundary"]},Hy={version:2,module:"@fluixi/dom",symbols:[...eo.symbols,"template","cloneTemplate","walk"]};var cf=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Mc={className:"class",htmlFor:"for"},to=new Set(["innerHTML","outerHTML","innerText","textContent","value","checked","selected","muted","defaultValue","defaultChecked","children","ref"]),lf=new Set(["script","style","textarea","title"]);function ro(e){return lf.has(e)}function no(e){return Mc[e]??e}function me(e){return e.kind!=="attr"||e.expr!==void 0||e.name.includes(":")?!1:!to.has(e.name)}function io(e){if(!e.static||ro(e.tag))return!1;for(let t of e.props)if(!me(t))return!1;for(let t of e.children)if(t.kind!=="text"&&!(t.kind==="element"&&io(t)))return!1;return!0}function _t(e){let t=e.props.map(df).filter(Boolean).join(""),r=`<${e.tag}${t}>`;return cf.has(e.tag)?r:`${r}${e.children.map(uf).join("")}</${e.tag}>`}function uf(e){if(e.kind==="text")return mf(e.value);if(e.kind!=="element")throw new Error(`serializeStatic: unexpected ${e.kind}`);return _t(e)}var ff=new Set(["draggable","spellcheck","contenteditable"]);function pf(e){return e.startsWith("aria-")||ff.has(e.toLowerCase())}function df(e){let t=Mc[e.name]??e.name,r=e.literal;return(r===!0||r===!1||r===void 0)&&pf(t)?` ${t}="${r!==!1}"`:r===!0||r===void 0?` ${t}`:r===!1||r===null?"":` ${t}="${hf(String(r))}"`}function hf(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function mf(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function oo(e){let t=[],r,n=i=>{r??=i.at?.file,t.push(i.at?.line??0,i.at?.column??0);for(let o of i.children)o.kind==="element"&&n(o)};return n(e),r&&t.some(i=>i!==0)?{file:r,pos:t}:void 0}var yf="<!--fx-->",gf="<!--fx/-->";function en(e){return e.kind==="expr"||e.kind==="component"||ao(e)}function ao(e){return e.kind==="element"&&e.tag.includes("-")}function co(e){return ao(e)?!0:"children"in e&&Array.isArray(e.children)&&e.children.some(co)}function vf(e){return e.kind==="text"||e.kind==="element"&&Ic(e)}var bf=new Set(["indeterminate"]);function Sf(e){if(e.kind==="spread")return null;if(e.name==="ref")return"ref";if(e.name==="use")return"use";if(e.kind==="event")return e.event?"event":null;if(e.kind==="prop")return"property";if(e.kind!=="attr")return null;let t=e.name;return t.startsWith("on:")?"nativeEvent":t.startsWith("prop:")?"property":t.startsWith("attr:")?"attr":t.startsWith("bool:")?"boolAttr":t==="className"||t==="class"?me(e)?"serialize":"class":t==="classList"?me(e)?"serialize":e.reactive?"classListDynamic":"classList":t==="style"?me(e)?"serialize":e.reactive?"styleDynamic":"style":t.includes(":")||to.has(t)?null:bf.has(t)?"property":e.expr===void 0?me(e)?"serialize":null:"attr"}function wf(e){let t=[],r=new Map;for(let n of e.props)r.has(n.name)||t.push(n.name),r.set(n.name,n);return t.map(n=>r.get(n))}function tn(e){let t=e.tag.includes("-"),r={serialize:[],bindings:[]};for(let n of wf(e)){let i=Sf(n);if(i===null)return null;if(i==="serialize"){r.serialize.push(n);continue}if(t)return null;r.bindings.push({prop:n,kind:i})}return r}function Ic(e){return e.svg||ao(e)||ro(e.tag)||!tn(e)?!1:e.children.every(t=>vf(t)||en(t))}function Pc(e){if(en(e))return!0;let t=e.children;return t?t.some(Pc):!1}function Lc(e){if(e.kind!=="element")return!1;let t=tn(e);return t&&t.bindings.length>0?!0:e.children.some(Lc)}function so(e){return Pc(e)||Lc(e)}function jc(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"||jc(t))}function Hc(e){if(!Ic(e)||!jc(e)||!so(e))return null;let t=[],r=[],n=[],i=0,o=a=>{let c=`_n$${i++}`;return t.push({ref:c,expr:a}),c};return s(e,"_el$"),{html:xf(e),tag:e.tag,steps:t,holes:r,bindings:n};function s(a,c){let u=tn(a);if(u)for(let p of u.bindings)n.push({ref:c,prop:p.prop,kind:p.kind});let l=-1;a.children.forEach((p,y)=>{so(p)&&(l=y)});let f=null;for(let p=0;p<=l;p++){let y=a.children[p],v=f?`${f}.nextSibling`:`${c}.firstChild`;if(en(y)){let b=o(v),C=o(`holeEnd(${b})`);r.push({parentRef:c,startRef:b,endRef:C,node:y}),f=C;continue}let d=o(v);y.kind==="element"&&so(y)&&s(y,d),f=d}}}function xf(e){return _t(Wc(e)).split(qc).join(yf+gf)}function Wc(e){let t=tn(e);return{...e,props:t?t.serialize:[],children:e.children.map(r=>en(r)?{kind:"text",value:qc}:r.kind==="element"?Wc(r):r)}}var qc="\0fx-hole\0";function Bc(e,t){let r=e[t];for(let n=t+1;n<e.length;n++){let i=e[n];if(i==="\\")n++;else{if(i===r)return n+1;if(i===`
|
|
3
|
+
`)return-1}}return-1}function Vc(e,t){let r=t+1;for(;r<e.length;){let n=e[r];if(n==="\\")r+=2;else{if(n==="`")return r+1;if(n==="$"&&e[r+1]==="{"){let i=1;for(r+=2;r<e.length&&i>0;){let o=e[r];if(o==="\\")r+=2;else if(o==="`"){let s=Vc(e,r);if(s<0)return-1;r=s}else if(o==='"'||o==="'"){let s=Bc(e,r);if(s<0)return-1;r=s}else o==="{"?i++:o==="}"&&i--,r++}}else r++}}return-1}function Ef(e,t){let r=!1;for(let n=t+1;n<e.length;n++){let i=e[n];if(i==="\\")n++;else if(i==="[")r=!0;else if(i==="]")r=!1;else{if(i===`
|
|
4
|
+
`)return-1;if(i==="/"&&!r){let o=n+1;for(;o<e.length&&/[a-z]/i.test(e[o]);)o++;return o}}}return-1}function kf(e){return e!==""&&/[A-Za-z0-9_$)\]]/.test(e)}function Af(e){let t=0,r="",n=0;for(;n<e.length;){let i=e[n];if(i==='"'||i==="'"){let o=Bc(e,n);if(o<0)return null;n=o,r=i}else if(i==="`"){let o=Vc(e,n);if(o<0)return null;n=o,r=i}else{if(i==="/"&&e[n+1]==="/")return null;if(i==="/"&&e[n+1]==="*"){let o=e.indexOf("*/",n+2);if(o<0)return null;n=o+2}else if(i==="/"&&!kf(r)){let o=Ef(e,n);if(o<0)return null;n=o,r="/"}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)||(r=i),n++}}}return t===0?!1:null}function M(e,t){let r=e.trim();return r===""?`(${e})`:t==="arrowBody"&&r[0]==="{"?`(${e})`:Af(r)===!1?e:`(${e})`}function $f(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function uo(e){return $f(e)?e:JSON.stringify(e)}function Fc(e){if(e.expr!==void 0){if(e.name==="ref"&&e.at)return Re(M(e.expr,"value"),e.at.line,e.at.column,e.expr);if(!e.reactive)return M(e.expr,"value");let t=`() => ${M(e.expr,"arrowBody")}`;return e.at?Re(t,e.at.line,e.at.column,e.directive):t}return JSON.stringify(e.literal??!0)}function Cf(e){return e.expr!==void 0?M(e.expr,"value"):JSON.stringify(e.literal??!0)}function zc(e){return e===void 0?String(e):/^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*)*$/.test(e.trim())?e:`() => (${e})`}function Rf(e,t,r){let n=e.filter(a=>a.kind==="spread"),o=e.filter(a=>a.kind!=="spread").map(a=>`${uo(a.name)}: ${Fc(a)}`);t!=null&&o.push(`children: ${t}`);let s=`{ ${o.join(", ")} }`;return n.length>0?(r.add("mergeProps"),`mergeProps(${n.map(a=>zc(a.expr)).join(", ")}, ${s})`):s}function Tf(e,t){return t?Re(e,t.line,t.column):e}function Kc(e,t,r){if(e.length===1)return Dt(e[0],t,r);let n=!1;return`[${e.map(o=>{let s=Dt(o,t,r);return o.kind==="element"&&n?(t.add("deferElement"),`deferElement(() => ${M(s,"arrowBody")})`):((o.kind==="component"||o.kind==="expr"&&o.reactive)&&(n=!0),s)}).join(", ")}]`}function Nf(e,t,r,n,i,o){n.add("createMemo"),n.add("createComponent");let s=t.filter(p=>p.kind==="spread"),a=t.filter(p=>p.kind!=="spread"),c=a.map(p=>[p.name,Cf(p)]);r.length>0&&c.push(["children",Kc(r,n,i)]);let u=`{ ${c.map(([p,y])=>`get ${uo(p)}() { return ${y}; }`).join(", ")} }`;if(c.some(([,p])=>/\bthis\b/.test(p))){let p=c.map(([v,d])=>`${JSON.stringify(v)}: () => (${d})`);u=`((_$t) => ({ ${c.map(([v])=>`get ${uo(v)}() { return _$t[${JSON.stringify(v)}](); }`).join(", ")} }))({ ${p.join(", ")} })`}s.length>0&&(n.add("mergeProps"),u=`mergeProps(${s.map(p=>zc(p.expr)).join(", ")}, ${u})`);let l={};for(let p of a)p.at&&(l[p.name]=[p.at.line,p.at.column]);Object.keys(l).length&&(u=Dc(u,l));let f=o?`globalThis.${_c}?.(${JSON.stringify(o.file)},${o.line},${o.column},${JSON.stringify(e)}), `:"";return`createMemo(${M(`${f}() => createComponent(${e}, ${u})`,"value")})`}function lo(e){let t=e.prop.name;return e.kind==="boolAttr"||t.startsWith("prop:")||t.startsWith("attr:")?t.slice(5):no(t)}function Of(e,t){let{ref:r,prop:n,kind:i}=e,o=Fc(n);switch(i){case"class":return t.add("setClassName"),`setClassName(${r}, ${o});`;case"classList":return t.add("setClassList"),`setClassList(${r}, ${o}, []);`;case"classListDynamic":return t.add("setDynamicClassList"),`setDynamicClassList(${r}, ${o});`;case"style":return t.add("setStyle"),`setStyle(${r}, ${o}, []);`;case"styleDynamic":return t.add("setDynamicStyle"),`setDynamicStyle(${r}, ${o});`;case"attr":return t.add("setDynamicAttribute"),`setDynamicAttribute(${r}, ${JSON.stringify(lo(e))}, ${o});`;case"property":return t.add("setDynamicProperty"),`setDynamicProperty(${r}, ${JSON.stringify(lo(e))}, ${o});`;case"boolAttr":return t.add("setDynamicBoolAttribute"),`setDynamicBoolAttribute(${r}, ${JSON.stringify(lo(e))}, ${o});`;case"event":return t.add("addDelegatedEventListener"),`addDelegatedEventListener(${r}, ${JSON.stringify(n.event.name)}, ${o});`;case"nativeEvent":return t.add("addNativeEventListener"),`addNativeEventListener(${r}, ${JSON.stringify(n.name.slice(3))}, ${o});`;case"ref":return t.add("handleRef"),`handleRef(${o}, ${r});`;case"use":return t.add("applyUse"),`applyUse(${r}, ${o});`}}function _f(e,t){let r=no(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 Uc=!1;function Dt(e,t,r){switch(e.kind){case"text":return JSON.stringify(e.value);case"expr":{if(!e.reactive)return M(e.code,"value");let n=`() => ${M(e.code,"arrowBody")}`;return e.at?Re(n,e.at.line,e.at.column):n}case"fragment":return e.children.length===0?"null":Kc(e.children,t,r);case"component":return Tf(Nf(e.name,e.props,e.children,t,r,e.at),e.bindAt??e.at);case"element":{if(r&&e.static&&!e.svg&&io(e)&&!co(e)){t.add("templateNode");let a=`_tmpl$${r.length}`;r.push({id:a,html:_t(e),tag:e.tag,svg:!1});let c=oo(e);return c?`templateNode(${a}, ${JSON.stringify(e.tag)}, false, false, ${JSON.stringify(c)})`:`templateNode(${a}, ${JSON.stringify(e.tag)})`}if(r&&Uc){let a=Hc(e);if(a){t.add("templateNode"),t.add("insert"),t.add("holeEnd"),t.add("holeContent"),t.add("holeScope");let c=`_tmpl$${r.length}`;r.push({id:c,html:a.html,tag:a.tag,svg:!1});let u=oo(e),l=[`const _el$ = templateNode(${c}, ${JSON.stringify(a.tag)}, true${u?`, false, ${JSON.stringify(u)}`:""});`];for(let f of a.steps)l.push(`const ${f.ref} = ${f.expr};`);for(let f of a.bindings)l.push(Of(f,t));for(let f of a.holes)l.push(`insert(${f.parentRef}, holeScope(${f.startRef}, () => ${M(Dt(f.node,t,r),"arrowBody")}), ${f.endRef}, holeContent(${f.startRef}, ${f.endRef}));`);return l.push("return _el$;"),`(() => { ${l.join(" ")} })()`}}t.add("createNativeElement");let n=JSON.stringify(e.tag),i="_el$",o=[],s=e.at?`${n}, ${e.svg}, ${JSON.stringify(e.at)}`:e.svg?`${n}, true`:n;if(o.push(`const ${i} = createNativeElement(${s});`),e.props.length>0)if(!e.svg&&e.props.every(me))for(let a of e.props)o.push(_f(i,a));else{t.add("spread");let a=e.svg?", isSVG: true":"",c=e.props.filter(f=>f.kind!=="spread"&&f.expr!==void 0&&f.reactive&&f.name!=="ref").map(f=>f.name),u=e.tag.includes("-")?`, isCustomElement: true, accessors: ${JSON.stringify(c)}`:"",l=e.children.length>0?", skipChildren: true":"";o.push(`spread({ element: ${i}, props: ${Rf(e.props,null,t)}${a}${u}${l} });`)}for(let a of e.children){t.add("insert");let c=Dt(a,t,r),u=a.kind==="expr"&&(a.reactive||!Mf(a.code))||a.kind==="component";o.push(u?`insert(${i}, ${c}, null);`:`insert(${i}, ${c});`)}return o.push(`return ${i};`),`(() => { ${o.join(" ")} })()`}}}var Df=/^\s*(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`$]*`|-?\d[\d_.eE+-]*|true|false|null|undefined)\s*$/,Mf=e=>Df.test(e);function rn(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 nn={name:"imperative",contract:eo,emit(e,t){let r=new Set,n=t?.templateClone!==!1?[]:void 0;return Uc=t?.partialTemplates===!0,{code:Dt(e,r,n),imports:Array.from(r),templates:n}}};function fo(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 If=new Set(["a","button","input","select","textarea","summary","details","option","label"]),Pf=new Set(["keydown","keyup","keypress"]);function Ge(e,t){return e.attributes.find(r=>"name"in r&&r.name===t)}function Lf(e){return e.attributes.some(t=>t.kind==="Spread")}function on(e,t){let r=Ge(e,t);if(!r||r.kind!=="Attribute"||!r.value)return;let n=r.value;return n.kind==="static"?n.value:void 0}function jf(e){let t=on(e,"role");return t==="presentation"||t==="none"?!0:on(e,"aria-hidden")==="true"}function Jc(e,t){return e.attributes.some(r=>r.kind==="EventBinding"&&t(r.name))}function Gc(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"&&Hf(o,r);let s="children"in o?o.children:void 0;s&&n(s)}};return n(e.children),t}function Hf(e,t){if(Lf(e))return;let r=e.tag.toLowerCase();r==="img"&&!Ge(e,"alt")&&!jf(e)&&t(e,"a11y-img-alt",'An `img` needs an `alt`. Use `alt=""` when the image is decorative.'),r==="a"&&!Ge(e,"href")&&!Ge(e,"role")&&t(e,"a11y-anchor-href","An `a` without `href` is not a link. Use a `button` for an action."),r==="iframe"&&!Ge(e,"title")&&t(e,"a11y-iframe-title","An `iframe` needs a `title` describing its content.");let n=on(e,"tabindex")??on(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."),!If.has(r)&&Jc(e,i=>i==="click")&&!Ge(e,"role")&&!Jc(e,i=>Pf.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.`)}function po(e){let t=(r,n)=>{r.parent=n;let i=Xc(r);for(let o of i)t(o,r)};return t(e,null),e}function Xc(e){switch(e.kind){case"Root":case"Element":case"Component":case"Fragment":return e.children;default:return[]}}var Yc=new Set(["capture","once","passive","prevent","stop","self"]);function ye(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 Zc=(e,t)=>({kind:"Attribute",name:t?e.name.slice(1):e.name,value:e.value,boolean:t,loc:e.loc}),sn=[{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)Yc.has(s)||e.report("invalid-directive",`Unknown event modifier ".${s}" — expected one of ${[...Yc].join(", ")}`);return{kind:"EventBinding",name:o,syntax:t,modifiers:i,hole:ye(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:ye(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:ye(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:ye(e,"style directive"),loc:e.loc})},{id:"load",match:e=>e.startsWith("load:"),build:e=>(e.value&&e.value.kind!=="static"&&e.report("invalid-binding",`'${e.name}' needs a literal value, not an expression: the strategy is compile-time.`),{kind:"LoadDirective",strategy:e.name.slice(5),modifier:e.value&&e.value.kind==="static"?e.value.value:null,...e.value&&e.value.kind!=="static"?{dynamic:!0}:{},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:ye(e,"if directive"),loc:e.loc})},{id:"each",elementOnly:!0,match:e=>e==="each",build:e=>({kind:"EachDirective",hole:ye(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:ye(e,"ref binding"),loc:e.loc})},{id:"property",match:e=>e[0]===".",build:e=>({kind:"PropertyBinding",name:e.name.slice(1),hole:ye(e,"property binding"),loc:e.loc})},{id:"boolean",match:e=>e[0]==="?",build:e=>Zc(e,!0)}];function ho(e,t=sn,r={component:!1}){for(let n of t)if(!(n.elementOnly&&r.component)&&n.match(e.name))return n.build(e);return Zc(e,!1)}var mo=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}mark(){return[this.pi,this.oi]}reset([e,t]){this.pi=e,this.oi=t}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()}}};var yo=new Set(["svg","g","defs","symbol","use","switch","view","desc","metadata","path","circle","ellipse","line","polygon","polyline","rect","image","text","tspan","textPath","linearGradient","radialGradient","stop","pattern","mask","clipPath","marker","foreignObject","animate","animateMotion","animateTransform","mpath","set","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Qc=new Set(["script","style","textarea","title"]),el=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function tl(e){return e.length>0&&(e[0]!==e[0].toLowerCase()||e.includes("."))}var Wf=/[A-Za-z0-9\-_:@.?]/,qf=class{constructor(e,t){this.diagnostics=[],this.open=[],this.r=new mo(e),this.svg=t.svg??!1,this.directives=t.directives??sn,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 po(r),this.validateTree(r),this.accessibility&&this.diagnostics.push(...Gc(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(s=>s.kind==="ElseDirective")&&(n!=null&&(n.kind==="Element"||n.kind==="Component")&&n.attributes.some(a=>a.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=tl(t),n=this.parseAttributes(r);this.foldEachKey(n,e),this.r.skipWhitespace();let i=t.toLowerCase(),o=!r&&Qc.has(i),s=!r&&el.has(i),a=!1,c=[];if(this.r.startsWith("/>"))this.r.advance(),this.r.advance(),a=!0;else if(this.r.peek()===">"&&this.r.advance(),!s)if(this.open.push(t),c=o?this.parseRawText(t):this.parseChildren(),this.open.pop(),this.r.startsWith("</")){let f=this.r.mark(),p=this.consumeCloseTag();p&&p!==t&&(this.open.includes(p)?(this.r.reset(f),this.report("unclosed-tag","error",`Unclosed <${t}>`,this.r.span(e))):this.report("mismatched-close-tag","error",`Expected </${t}>, got </${p}>`,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:c,selfClosing:a,loc:u};let l=this.svg||yo.has(t)?"svg":"html";return{kind:"Element",tag:t,namespace:l,attributes:n,children:c,selfClosing:a,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 a=this.r.takeHole();t.push({kind:"Spread",hole:a.index,loc:a.loc});continue}if(this.r.startsWith("...")){let a=this.r.pos();if(this.r.advance(),this.r.advance(),this.r.advance(),this.r.atHole()){let c=this.r.takeHole();t.push({kind:"Spread",hole:c.index,loc:this.r.span(a)})}else this.report("invalid-binding","error","Spread `...` must be followed by ${…}",this.r.span(a));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:(a,c)=>this.report(a,"error",c,this.r.span(r))};t.push(ho(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(r=>!/[\s>]/.test(r))}}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 l of e)l.kind==="EachDirective"?(r=l,i++):l.kind==="IfDirective"?n++:l.kind==="ElseDirective"?o++:l.kind==="RefBinding"&&s++;let a=this.r.span(t);i>1&&this.report("duplicate-directive","error","Multiple `each` directives on one element",a),n>1&&this.report("duplicate-directive","error","Multiple `if` directives on one element",a),s>1&&this.report("duplicate-directive","error","Multiple `ref` bindings on one element",a),n>0&&o>0&&this.report("invalid-directive","error","`if` and `else` cannot be on the same element",a);let c=e.findIndex(l=>l.kind==="Attribute"&&l.name==="key");if(!r){c!==-1&&this.report("invalid-directive","error","`key` requires an `each` directive on the same element",a);return}if(c===-1)return;let u=e[c];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(c,1)}readName(){return this.r.readWhile(e=>Wf.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 an(e,t={}){return new qf(e,t).parse()}function Bf(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 rl(e,t={}){return an(Bf(e),t)}var nl=new Set(["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup"]);function Vf(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}var Ff="container";function il(e){return e.charAt(0).toUpperCase()+e.slice(1)}var zf=class{constructor(e,t,r,n){this.holes=e,this.used=t,this.sourceFile=r,this.positionAt=n}tagAt(e){let t=e.loc?.start;if(!this.sourceFile||!this.positionAt||t==null)return;let{line:r,column:n}=this.positionAt(t);return{file:this.sourceFile,line:r,column:n}}hole(e){return this.holes[e]??{code:"undefined",reactive:!1}}emit(e){let{code:t,imports:r,templates:n}=nn.emit(e,{});for(let i of r)this.used.add(i);return rn(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 a=e[s],c=a&&(a.kind==="Element"||a.kind==="Component")&&a.attributes.some(u=>u.kind==="ElseDirective");t.push(this.lowerIf(n,o.hole,c?a:null)),c&&(r=s);continue}}let i=this.lowerNode(n);i&&t.push(i)}return t}isBlankText(e){return e.kind==="Text"&&!e.raw&&fo(e.value)===""}lowerNode(e){switch(e.kind){case"Text":{if(e.raw)return{kind:"text",value:e.value};let t=Qr(fo(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(o=>o.kind==="Attribute"&&o.name==="is");if(e.tag==="component"&&t&&t.value&&t.value.kind==="hole"){let o=e.attributes.filter(a=>a!==t),s=this.lowerComponent({...e,kind:"Component",tag:"Dynamic",tagHole:null,attributes:o});return s.props.unshift({name:"component",kind:"attr",expr:`() => ${M(this.hole(t.value.hole).code,"arrowBody")}`}),s}let r=this.lowerEach(e),n=r?[r]:this.lowerChildren(e.children);if(e.tag===Ff)return n.length===1?n[0]:{kind:"fragment",children:n};let i=this.tagAt(e);return{kind:"element",tag:e.tag,svg:e.namespace==="svg",props:this.lowerAttributes(e.attributes,!0),children:n,static:!1,...i?{at:i}:{}}}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[u,l]of n){let f=l.length===1?l[0]:{kind:"fragment",children:l},p={name:u,kind:"attr",expr:this.emit(f),jsxElement:!0},y=r.findIndex(v=>v.name===u);y>=0?r[y]=p:r.push(p)}let o=e.attributes.find(u=>u.kind==="LoadDirective");if(o?.dynamic)throw new Je(`'load:${o.strategy}' needs a literal value, not an expression: the strategy is compile-time.`);let s=o?$c(`load:${o.strategy}`,o.modifier):void 0,a=r.find(u=>u.at&&u.reactive)?.at,c=this.tagAt(e);return{kind:"component",name:t,props:r,children:this.lowerChildren(i),...c?{at:c}:{},...a?{bindAt:a}:{},...s?{load:s}:{},...e.tagHole!=null?{tagExpression:!0}:{}}}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(c=>c!==i)},s=o.kind==="Element"?this.lowerElement(o):this.lowerComponent(o),a=t.get(i.value.value)??[];a.push(s),t.set(i.value.value,a);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,...n.at?{at:n.at}:{}}];if(r){let a=this.stripAndLower(r,c=>c.kind==="ElseDirective");i.push({name:"fallback",kind:"attr",expr:this.emit(a),jsxElement:!0})}let o=this.stripAndLower(e,a=>a.kind==="IfDirective"),s=this.tagAt(e);return{kind:"component",name:"Show",props:i,children:[o],...s?{at:s}:{},...n.at?{bindAt:n.at}:{}}}lowerEach(e){let t=e.attributes.find(c=>c.kind==="EachDirective");if(!t||t.kind!=="EachDirective")return null;let r=this.hole(t.hole),n=[{name:"each",kind:"attr",expr:r.code,reactive:r.reactive,...r.at?{at:r.at}:{}}];if(t.key){let c="static"in t.key?`(item) => item[${JSON.stringify(t.key.static)}]`:this.hole(t.key.hole).code;n.push({name:"by",kind:"attr",expr:c})}let i=this.itemArrow(e),o;if(i){let c=i.bodyReactive?`() => ${M(i.body,"arrowBody")}`:M(i.body,"arrowBody");o=`(${i.params.join(", ")}) => ${c}`}else{let c=this.lowerChildren(e.children),u=c.length===1?c[0]:{kind:"fragment",children:c};o=`() => ${M(this.emit(u),"arrowBody")}`}let s=[{kind:"expr",code:o,reactive:!1}],a=this.tagAt(e);return{kind:"component",name:"For",props:n,children:s,...a?{at:a}:{},...r.at?{bindAt:r.at}:{}}}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)}lowerAttributes(e,t=!1){let r=!1,n=(l,f)=>{if(r||=f.reactive,!t||!f.reactive)return`${JSON.stringify(l)}: ${f.code}`;let p=`() => ${M(f.code,"arrowBody")}`;return`${JSON.stringify(l)}: ${f.at?Re(p,f.at.line,f.at.column):p}`},i=[],o=[],s,a=[],c,u=[];for(let l of e)switch(l.kind){case"IfDirective":case"EachDirective":case"ElseDirective":break;case"Attribute":i.push(this.plainAttr(l));break;case"PropertyBinding":i.push({name:l.name,kind:"prop",expr:this.hole(l.hole).code,reactive:this.hole(l.hole).reactive,...this.hole(l.hole).at?{at:this.hole(l.hole).at}:{}});break;case"EventBinding":i.push(this.eventProp(l));break;case"RefBinding":i.push({name:"ref",kind:"ref",expr:this.hole(l.hole).code,reactive:this.hole(l.hole).reactive,...this.hole(l.hole).at?{at:this.hole(l.hole).at}:{}});break;case"Spread":i.push({name:"",kind:"spread",expr:this.hole(l.hole).code});break;case"ClassDirective":{let f=this.hole(l.hole);o.push(n(l.name,f)),s??=f.at;break}case"StyleDirective":{let f=this.hole(l.hole);a.push(n(l.name,f)),c??=f.at;break}case"BindDirective":i.push(...this.bindProps(l.name,this.hole(l.hole)));break;case"UseDirective":{let f=l.name??(l.hole!=null?this.hole(l.hole).code:null);if(!f)break;u.push(l.name!=null&&l.hole!=null?`[${f}, () => ${M(this.hole(l.hole).code,"arrowBody")}]`:`[${f}]`);break}}if(o.length>0&&i.push({name:"classList",kind:"attr",expr:`{ ${o.join(", ")} }`,reactive:!t&&r,...s?{at:s}:{}}),a.length>0){let l=`{ ${a.join(", ")} }`,f=i.findIndex(p=>p.name==="style");if(f===-1)i.push({name:"style",kind:"attr",expr:l,reactive:!t&&r,...c?{at:c}:{}});else{let p=i[f],y=p.expr===void 0?JSON.stringify(p.literal):p.reactive?`() => ${M(p.expr,"arrowBody")}`:p.expr;i[f]={name:"style",kind:"attr",expr:`[${y}, ${l}]`,reactive:!1,...p.at?{at:p.at}:{}}}}return u.length>0&&i.push({name:"use",kind:"attr",expr:`[${u.join(", ")}]`}),i}eventProp(e){let t=e.name.toLowerCase(),r=this.hole(e.hole).code;if(!(e.syntax==="colon"||e.modifiers.length>0))return{name:"on"+il(e.name),kind:"event",event:{name:t,delegated:nl.has(t)},expr:r};let i=this.wrapHandler(r,e.modifiers),o=this.eventOptions(e.modifiers),s=o?`[${i}, ${o}]`:i;return{name:"on:"+t,kind:"attr",expr:s}}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=t.code,n=e==="checked",i=n?"change":"input",o=n?"checked":"value";this.used.add("bindPair");let s=`bindPair(${r})`;return[{name:e,kind:"attr",expr:`${s}[0]()`,reactive:!0,directive:`bind:${e}`,...t.at?{at:t.at}:{}},{name:"on"+il(i),kind:"event",event:{name:i,delegated:nl.has(i)},expr:`(e) => ${s}[1](e.target.${o})`}]}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 i={name:r,kind:"attr"};if(t==null)return i.literal=!0,i;if(t.kind==="static")return i.literal=Qr(t.value),i;if(t.kind==="hole"){let c=this.hole(t.hole);return i.expr=c.code,i.reactive=c.reactive,c.at&&(i.at=c.at),i}let o=!1,s,a=t.parts.map(c=>{if("text"in c)return Vf(Qr(c.text));let u=this.hole(c.hole);return o=o||u.reactive,s??=u.at,"${"+u.code+"}"}).join("");return i.expr="`"+a+"`",i.reactive=o,s&&(i.at=s),i}};function ol(e,t,r,n={}){let{root:i,diagnostics:o}=an(e,{svg:n.svg});for(let s of o){if(s.severity==="error"){let a=n.positionAt?.(s.loc.start);throw new Error(`html template${a?` (${a.line}:${a.column+1})`:""}: ${s.message}`)}n.onDiagnostic?.(s)}return new zf(t,r,n.sourceFile,n.positionAt).lowerRoot(i.children)}function Kf(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 sl(e){let t=[],r=new Map,n=i=>{switch(i.kind){case"text":return!0;case"expr":return!1;case"component":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 a of i.children)n(a)||(o=!1);let s;for(let a of i.props)if(s=Kf(a),s)break;return!s&&!o&&(s=Uf(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 Uf(e){for(let t of e.children){if(t.kind==="expr")return"expression-child";if(t.kind==="component")return"component-child";if(t.kind==="element"&&!t.static||t.kind==="fragment")return"expression-child"}return"expression-child"}var Jf=e=>"components"in e;function al(e,t){return e.replace(/\$(\d+)/g,(r,n)=>t[Number(n)]??r)}function Gf(e,t){return typeof t=="string"?{module:t,export:e}:t}function cl(e=[]){let t=new Map,r=[],n=[];for(let s of e){if(!Jf(s)){n.push(s);continue}for(let[a,c]of Object.entries(s.components)){let u=Gf(a,c),l=t.get(a);if(l&&l.module!==u.module){let f=r.find(p=>p.name===a);f?f.modules.push(u.module):r.push({name:a,modules:[l.module,u.module]});continue}t.set(a,u)}}let i=new Map;return{resolve:s=>{if(i.has(s))return i.get(s);let a=t.get(s);if(!a)for(let c of n){let u=s.match(new RegExp(c.match.source,c.match.flags.replace("g","")));if(u){a={module:al(c.module,u),export:c.export?al(c.export,u):s};break}}return i.set(s,a),a},names:()=>[...t.keys()],conflicts:()=>r}}var ll="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Xf=new Uint8Array(64),Yf=new Uint8Array(128);for(let e=0;e<ll.length;e++){let t=ll.charCodeAt(e);Xf[e]=t,Yf[t]=e}var Tg=1024*16;var ul="data-fx-s";function fl(e,t){let r=n=>{let i=n.children;if(i)for(let o=i.length-1;o>=0;o--){let s=i[o];s.kind==="element"&&s.tag==="style"&&t.owner?i.splice(o,1):r(s)}t.scope&&n.kind==="element"&&n.tag!=="style"&&n.props&&!n.props.some(o=>o.name===ul)&&n.props.unshift({name:ul,kind:"attr",literal:t.scope})};r(e)}function Zf(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 go(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 pl(Zf(e),e.holes,t)}function pl(e,t,r={}){let n=new Set,i=[],o=ol(e,[...t],n,{onDiagnostic:u=>i.push({code:u.code,message:u.message,offset:u.loc.start}),svg:r.svg,...r.sourceFile?{sourceFile:r.sourceFile}:{},...r.positionAt?{positionAt:r.positionAt}:{}});r.templateStyles&&fl(o,r.templateStyles),sl(o),Tc(o,{resolver:cl(r.resolve??[]),modules:{controlFlowModule:r.controlFlowModule??"@fluixi/dom",coreModule:r.coreModule??"@fluixi/core",routerModule:r.routerModule??"@fluixi/core/router"},strategyFor:u=>u.load}),Nc(o);let{code:s,imports:a,templates:c}=nn.emit(o,{templateClone:r.templateClone,partialTemplates:r.partialTemplates});for(let u of a)n.add(u);return r.hoistTemplates?{...i.length?{diagnostics:i}:{},code:s,imports:[...n],ir:o,templates:c}:{...i.length?{diagnostics:i}:{},code:rn(s,c),imports:[...n],ir:o}}function Qf(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 vo(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)Qf(o,t);if(i)for(let o of n.children)o.kind==="Expression"&&t.set(o.hole,"render");vo(n.children,t,r);break}case"Root":case"Fragment":vo(n.children,t,r);break;default:break}}function dl(e){let t=new Map,r=new Set;return vo(e.root.children,t,r),{holes:t,components:r}}var bo={...Gi,createMemo:S},ep=["For","Index","Show","Switch","Match","Portal","Dynamic","ErrorBoundary","Suspense"],So=new Map;function ml(e){for(let[t,r]of Object.entries(e))So.set(t,r)}function tp(e){return e==="text"||e==="attr"||e==="control"}function rp(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"&&tp(i)?{code:`$$v[${n}]()`,reactive:!0}:{code:`$$v[${n}]`,reactive:!1}})}function np(e){if(So.has(e))return So.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 ip(e,t,r){let n=e,i=rl(n,{svg:r}),o=i.diagnostics.filter(d=>d.severity==="error");if(o.length>0)throw new Error(`[fluixi] ${r?"svg":"html"}\`\`: ${o.map(d=>d.message).join("; ")}`);let{holes:s,components:a}=dl(i),{code:c,imports:u}=go({statics:n,holes:rp(t,s)},{svg:r}),l=u.filter(d=>!(d in bo));if(l.length>0)throw new Error(`[fluixi] no runtime binding for: ${l.join(", ")}`);let f=Array.from(new Set([...u,...ep])).filter(d=>d in bo),p=Array.from(a).filter(d=>!f.includes(d)),y=[...f,...p],v=new Function(...y,"$$v",`return (${c});`);return{run:d=>v(...f.map(b=>bo[b]),...p.map(np),d)}}var hl=new WeakMap;function op(e){let t="";for(let r of e)t+=typeof r=="function"?"f":"v";return t}function yl(e){return(t,...r)=>{let n=hl.get(t);n||(n=new Map,hl.set(t,n));let i=op(r),o=n.get(i);return o||(o=ip(t,r,e),n.set(i,o)),o.run(r)}}var gl=yl(!1),vl=yl(!0);return kl(sp);})();
|