@fluixi/template-runtime 1.0.0-alpha.113 → 1.0.0-alpha.114

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.
@@ -1,4 +1,4 @@
1
- /*! @fluixi/template-runtime v1.0.0-alpha.113 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
- "use strict";var Fluixi=(()=>{var rn=Object.defineProperty;var pl=Object.getOwnPropertyDescriptor;var dl=Object.getOwnPropertyNames;var hl=Object.prototype.hasOwnProperty;var ho=(e,t)=>{for(var r in t)rn(e,r,{get:t[r],enumerable:!0})},ml=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of dl(t))!hl.call(e,i)&&i!==r&&rn(e,i,{get:()=>t[i],enumerable:!(n=pl(t,i))||n.enumerable});return e};var yl=e=>ml(rn({},"__esModule",{value:!0}),e);var sp={};ho(sp,{Dynamic:()=>xr,ErrorBoundary:()=>Tr,For:()=>Or,Index:()=>_r,Match:()=>pr,Portal:()=>ur,Show:()=>fr,Switch:()=>dr,batch:()=>I,define:()=>al,effect:()=>On,html:()=>ll,hydrate:()=>xe,insert:()=>N,memo:()=>Tn,onCleanup:()=>C,render:()=>be,resource:()=>An,signal:()=>Cn,store:()=>bi,svg:()=>ul,untrack:()=>x});var Vi={};ho(Vi,{ALWAYS_ATTRIBUTE:()=>In,ClientOnly:()=>pi,Dynamic:()=>xr,ErrorBoundary:()=>Tr,ErrorResetContext:()=>Ci,FX_DATA_ID:()=>Rt,For:()=>Or,HYDRATION_KEY:()=>K,Index:()=>_r,Island:()=>pc,JSX_PROPERTIES:()=>nt,Match:()=>pr,NoSsr:()=>ra,Portal:()=>ur,SERVER_PROPS:()=>Nn,SVG_ELEMENTS:()=>Jo,SVG_NAMESPACE:()=>tt,Show:()=>fr,Switch:()=>dr,VERSION:()=>Gt,VERSION_ATTRIBUTE:()=>it,VOID_ELEMENTS:()=>zo,addClass:()=>Mn,addDelegatedEventListener:()=>rr,addNativeEventListener:()=>ir,afterHydrationPass:()=>ks,appendChildren:()=>Bn,appendResponseHeader:()=>Ta,applyElementProp:()=>rt,applyProps:()=>mt,applyUse:()=>or,asComponent:()=>st,asContext:()=>_s,asOutlet:()=>Ts,asProvider:()=>Os,asRoute:()=>Cs,asRouter:()=>As,asRoutes:()=>Rs,asSuspense:()=>Ns,beforeFirstRender:()=>$a,beginAppHydration:()=>Ss,bindPair:()=>ui,captureHydrationCursor:()=>gs,checkRenderType:()=>Ds,classMap:()=>ta,cleanChildren:()=>Q,clearHydrationKeys:()=>Hr,cloneTemplate:()=>nr,closest:()=>Xo,createComponent:()=>we,createDynamicElement:()=>wr,createElement:()=>Wn,createNativeElement:()=>ve,createPortal:()=>li,createRequestContext:()=>bt,createTemplate:()=>ut,createUniqueId:()=>Ja,css:()=>yc,default:()=>Qu,deferElement:()=>Is,delegate:()=>rs,delegateEvents:()=>lt,endAppHydration:()=>ws,endRequestContext:()=>wt,endRequestScope:()=>ki,errorResponseStatus:()=>Cr,escapeFxJson:()=>Ir,escapeHTML:()=>Zs,fnName:()=>qs,generateID:()=>js,getAttribute:()=>jn,getGlobal:()=>us,getLocals:()=>Ca,getOffset:()=>ts,getRequestContext:()=>B,getRequestEvent:()=>Ar,getRequestLocals:()=>Ai,getServerData:()=>Mr,getStableElementId:()=>Ls,getStyle:()=>Zo,handleRef:()=>ge,hasClass:()=>Yo,holeContent:()=>dt,holeEnd:()=>pt,holeScope:()=>ft,html:()=>hc,hydrate:()=>xe,hydrateAdvancePast:()=>Ie,hydrateChildren:()=>uc,hydrateIslands:()=>dc,indexArray:()=>Ce,initializeIntegration:()=>va,insert:()=>N,insertExpression:()=>ht,installElementObjects:()=>zs,intergartionInitialized:()=>ga,isAccessor:()=>Qs,isAppHydrationPending:()=>xs,isAttributeOnlyName:()=>_e,isComponent:()=>U,isContext:()=>Zn,isCustomElement:()=>_n,isDOMNode:()=>cs,isDelegatedEvent:()=>Ws,isDomElement:()=>Ut,isDomNode:()=>he,isDomText:()=>Kt,isEventHandler:()=>Uo,isFunction:()=>Vs,isHydrating:()=>$s,isIntegrationInitialized:()=>Si,isJSXTemplate:()=>as,isNativeElement:()=>Ys,isOutlet:()=>Xn,isPromise:()=>lr,isProvider:()=>Yn,isReactElement:()=>ss,isRoute:()=>Gn,isRouter:()=>zn,isRoutes:()=>Jn,isSVGElement:()=>cr,isServer:()=>E,isSuspense:()=>Qn,isVisible:()=>Qo,iterateFn:()=>Fs,keepServerContent:()=>Ks,keyArray:()=>Re,makeArrayFlat:()=>si,mapArray:()=>Ae,mergeProps:()=>ci,observeIntersection:()=>is,observeResize:()=>os,onRequestEnd:()=>ka,prepareRender:()=>Aa,query:()=>zt,queryAll:()=>Go,registerCoreVersion:()=>fs,registerCreateComponent:()=>ya,registerGlobal:()=>ls,removeAttribute:()=>Hn,removeChildren:()=>Vn,removeClass:()=>Pn,removeDelegatedEventListener:()=>at,removeUnclaimedKeyed:()=>Wr,render:()=>be,renderStarted:()=>Ra,renderToString:()=>tc,renderToStringAsync:()=>nc,requestScope:()=>St,resetIntegration:()=>wi,resetOnNavigation:()=>Ti,runHydrationAt:()=>De,runWithRequestContext:()=>xt,runWithoutHydration:()=>bs,scrollIntoView:()=>es,serializeNode:()=>Y,serializeResourceData:()=>Hi,serverCustomElementProp:()=>Oe,setAttribute:()=>j,setClassList:()=>ae,setClassName:()=>ye,setDataRedactor:()=>rc,setDynamicAttribute:()=>Le,setDynamicBoolAttribute:()=>sr,setDynamicClassList:()=>Xs,setDynamicProperty:()=>je,setDynamicStyle:()=>Gs,setKeyScope:()=>Xa,setProperty:()=>se,setRequestStore:()=>Ei,setRequestStoreIfUnset:()=>Ea,setResponseRedirect:()=>_a,setResponseStatus:()=>Rr,setServerMode:()=>de,setStyle:()=>ee,setStyles:()=>Jt,shouldSetAsProperty:()=>Ko,splitProps:()=>ar,spread:()=>ai,stampVersions:()=>ps,styleMap:()=>ea,svg:()=>mc,takeResponseHeaders:()=>Oa,takeResponseRedirect:()=>Da,takeResponseStatus:()=>Na,takesBooleanText:()=>Dn,template:()=>oi,templateNode:()=>ii,toAttributeName:()=>Fo,toggleClass:()=>Ln,useHydrationKeys:()=>ue,versionMark:()=>qn,versions:()=>V,waitForElement:()=>ns,warnOnVersionSkew:()=>ds,whenAppHydrated:()=>Es});var Dt=Symbol.for("fluixi-proxy");var ie="1.0.0-alpha.113";var yo=ie.split(".")[0],mo=`__fluixi_signal_state_v${yo}__`,vo=`__fluixi_signal_builds_v${yo}__`,vl=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function go(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:vl,onSuspend:null,onError:null,observer:null,hot:null}}var It=globalThis;function gl(e){let t=go(),r=e;for(let n of Object.keys(t))n in e||(r[n]=t[n]);return e}function bl(){let e=It[mo];return e?gl(e):It[mo]=go()}var m=bl();(It[vo]??=[]).push(ie);function nn(){return[...new Set(It[vo]??[])]}function Sl(e){return m.observer=e,()=>{m.observer===e&&(m.observer=null)}}var wo=[],Mt;function xo(e,t){if(!m.observer)return t();let r=Mt;Mt=e;try{return t()}finally{Mt=r}}var bo;function Eo(e){let t=m.observer;t&&t.created(e.parents===void 0?{...e,parents:wo,origin:e.origin??Mt,scope:e.scope??bo}:{...e,scope:e.scope??bo})}function ko(){wo.pop()}function on(e,t,r){m.observer?.moved?.(e,t,r)}function sn(e){m.observer?.disposed?.(e)}var wl="__FLUIXI_DEVTOOLS_HOOK__",So=globalThis[wl];if(typeof So?.inject=="function")try{So.inject({observeReactiveNodes:Sl,version:ie})}catch{}function Pt(){return m.observer!=null}var $o=0,Ao=1,Je=2,Ro=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))}},Co=class extends Ro{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++,this.observers)for(let t of[...this.observers])t.markDirty(Je);an(this)}}peek(){return this._value}},Lt=class extends Ro{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this._disposed=!1,this.state=Je,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===Ao&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===Je)break}(this.state===Je||!this._initialized)&&this.recompute(),this.state=$o}}recompute(){if(this.sources){for(let s of this.sources)s.observers?.delete(this);this.sources.clear()}let e=m.consumer,t=m.untracked,r=!1;m.consumer=this,m.untracked=!1;let n,i=!1,o;try{n=this._fn()}catch(s){i=!0,o=s,n=this._value}finally{m.consumer=e,m.untracked=t,r&&ko()}let a=!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,a){if(this.version++,this.observers)for(let s of this.observers)s.markDirty(Je);an(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===$o;if(this.state=e,t){if(this.observers)for(let r of this.observers)r.markDirty(Ao);an(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function an(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}function jt(e){if(m.untracked)return e();m.untracked=!0;try{return e()}finally{m.untracked=!1}}function F(e){let t=Xe(e);return e&&(e.owned??=[]).push(t),t}function G(e,t=!0){Ge(e,t)}function Xe(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Ht(e,t){let r=Symbol(t??"context");return{id:r,defaultValue:e,Provider:i=>{let o=m.owner,a=Xe(o);(a.contexts=new Map).set(r,i.value),o&&(o.owned??=[]).push(a),m.owner=a;try{return i.children}finally{m.owner=o}}}}function Wt(e){let t=m.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.parent}return e.defaultValue}function To(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 Vt(e,t,r){let n=Xe(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 Oo(e){return m.onSuspend?(m.onSuspend(e,m.owner),!0):!1}function _o(e){m.onError=e}function k(){return m.owner}function R(e,t){let r=m.owner;m.owner=e;try{return t()}finally{m.owner=r}}function C(e){if(m.owner){if(m.owner.disposed){e();return}(m.owner.cleanups??=[]).push(e)}}function Ge(e,t=!0){if(!e.disposed){if(e.owned){for(let r=e.owned.length-1;r>=0;r--)Ge(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 W(e){let t=Xe(m.owner);m.owner&&(m.owner.owned??=[]).push(t);let r=m.owner;m.owner=t;try{return jt(()=>e(()=>Ge(t)))}finally{m.owner=r}}function No(e){m.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function xl(e){e.queued||(e.queued=!0,m.queue.push(e),!m.scheduled&&m.batchDepth===0&&(m.scheduled=!0,m.hostSchedule(Ye)))}function Ye(){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 Do(){m.batchDepth===0&&Ye()}function Io(e){m.batchDepth++;try{return e()}finally{--m.batchDepth===0&&Ye()}}var El=class extends Lt{constructor(e,t=!1,r){let n=null;super(()=>{Ge(n,!1),R(n,()=>{let a=e();typeof a=="function"&&(n.cleanups??=[]).push(a)})}),this.queued=!1,this.disposed=!1;let i=m.owner;this.owner=Xe(i),n=this.owner,this.run();let o=this.owner;if(!this.disposed&&!this.sources?.size&&!o.cleanups&&!o.owned&&!o.contexts){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&&xl(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,super.dispose(),Ge(this.owner))}};function cn(e,t=!1,r){let n=new El(e,t,r);return()=>n.dispose()}function kl(e){return!!e&&typeof e.then=="function"}No(()=>{});var Mo=Symbol.for("signal"),$l=Symbol.for("memo"),Al=Symbol.for("signal-node");function O(e,t){let r=m.hot,n=e;r&&(e=r.take("signal",e));let i=new Co(e,{equals:t?.equals}),o=(()=>i.get()),a=(s=>{let c=typeof s=="function"?s(i.peek()):s;return i.set(c),Do(),c});return o[Mo]=!0,o[Al]=i,r&&r.keep(()=>i.peek(),()=>a(()=>n)),[o,a]}function w(e,t,r){let n=t,i=k(),o=new Lt(()=>R(i,()=>{try{return n=e(n)}catch(s){if(kl(s))return Oo(s),n;throw s}}),{equals:r?.equals}),a=(()=>o.get());return Object.defineProperty(a,Mo,{value:!0,enumerable:!0}),Object.defineProperty(a,$l,{value:!0,enumerable:!0}),C(()=>{o.dispose()}),a}function D(e,t,r){let n=t;return cn(()=>{n=e(n)},!0,r?.name)}function $(e,t){let r=t;return cn(()=>{r=e(r)})}function I(e){return Io(e)}function x(e){return jt(e)}var ke=globalThis[Symbol.for("fluixi.transition")]??={depth:0,loads:new Set,pending:void 0};function Rl(){return ke.pending??=O(0)}function Po(){return ke.depth>0}function Lo(e){let[,t]=Rl();ke.loads.add(e),t(ke.loads.size);let r=()=>{ke.loads.delete(e),t(ke.loads.size)};e.then(r,r)}function Bt(){return Ye(),Promise.resolve()}var jo=Ht();_o((e,t)=>{let r=To(t,jo);return r?(r.caught=()=>e,m.consumer?queueMicrotask(()=>r.setError(e)):r.setError(e),!0):!1});function ln(){let[e,t]=O(void 0,{equals:!1}),r={error:e,caught:()=>{},reset:()=>{r.caught=()=>{},t(()=>{})},setError:n=>{r.caught=()=>n,t(()=>n)}};return r}function un(e,t){return Vt(jo,e,t)}var Cl=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,qt=typeof process>"u"?Cl:!1,Tl=Symbol.for("signal");function A(e){return typeof e=="function"&&e[Tl]===!0}function Ol(e,t){return()=>{let r=F(t);return C(()=>{G(r);let n=t.owned,i=n?n.indexOf(r):-1;i>=0&&n.splice(i,1)}),R(r,e)}}function Ho(e,t){return typeof e=="function"?A(e)||e.length?e:Ol(e,t):Array.isArray(e)?e.map(r=>Ho(r,t)):e}function fn(e,t){let r=Ht(e,t),n=r.Provider;return{...r,Provider:o=>n({get value(){return o.value},get debug(){return o.debug},get children(){let a=k(),s=o.children;return a?Ho(s,a):s}})}}var pn=null;function yn(e){pn=e}function vn(e){pn&&pn(e)}var dn=null;function gn(e){dn=e}function bn(e){return dn?dn(e):void 0}var hn=null;function Ze(e){hn=e}function Sn(){return hn?hn():void 0}var mn=null;function wn(e){mn=e}function xn(e,t){mn&&mn(e,t)}function En(){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 _l=null;function kn(e){_l=e}function Nl(e){return!!e&&typeof e.then=="function"}var $n=Symbol();function Wo(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:Sn(),a=o!==void 0?bn(o):void 0,s=a!==void 0,c=m.hot;m.hot=null;let[u,l]=O(a!==void 0?a.value:r.initialValue,{equals:!1}),[f,d]=O(void 0,{equals:!1}),y=!1,[v,p]=O(a!==void 0||r.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[b,T]=O(void 0,{equals:!1}),[S,g]=O(void 0,{equals:!1});m.hot=c;let L=$n,H=!1;D(()=>{let _=n();if(S(),_===!1||_===null||_===void 0){L=$n,I(()=>{p("unresolved"),T(void 0),d(void 0)});return}let Ot=H;if(H=!1,L!==$n&&_===L&&!Ot)return;if(L=_,s){s=!1;return}let _t=!1;C(()=>_t=!0);let po=x(v),fl=x(u),tn=po==="ready"||po==="refreshing";y=tn&&Po(),I(()=>{p(tn?"refreshing":"pending"),d(void 0)});try{let ne=i(_,{value:fl,refetching:tn});Nl(ne)?(T(ne),y&&Lo(ne),vn(ne),ne.then(Nt=>{_t||(o!==void 0&&xn(o,Nt),I(()=>{l(()=>Nt),p("ready"),T(void 0)}))},Nt=>{_t||I(()=>{d(Nt),p("errored"),T(void 0)})})):I(()=>{l(()=>ne),p("ready"),T(void 0)})}catch(ne){if(_t)return;I(()=>{d(ne),p("errored"),T(void 0)})}});let J=()=>{let _=v();return _==="pending"||_==="refreshing"},ze=(()=>{let _=f();if(_)throw _;if(J()&&!(y&&v()==="refreshing")){let Ot=b();if(Ot)throw Ot}return u()});return Object.defineProperties(ze,{state:{get:v},loading:{get:J},error:{get:f},latest:{get:u}}),Object.defineProperty(ze,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(ze,Symbol.for("signal"),{value:!0,enumerable:!0}),[ze,{mutate:l,refetch:()=>{H=!0,g(void 0)}}]}function An(...e){let[t,r]=Wo(...e);return Object.assign(t,r)}function Rn(e){let t=m.hot;if(!t)return e();m.hot=null;try{return e()}finally{m.hot=t}}function Cn(e,t){let[r,n]=O(e,t);return r.set=n,r}function Tn(e,t,r){return w(e,t,r)}function On(e,t,r){return D(e,t,r)}function Ft(e){if(typeof e=="function"&&!e.length){let t=e();return A(t)?t:Ft(t)}if(Array.isArray(e)){let t=[];for(let r=0;r<e.length;r++){let n=Ft(e[r]);Array.isArray(n)?t.push.apply(t,n):t.push(n)}return t}return e}function $e(e){let t=w(e);return qt?w(()=>Ft(t()),void 0,{name:"children"}):w(()=>Ft(t()))}function Bo(e){let t=e,r=null;return{index:()=>(r||(r=O(t,{name:"row index"})),r[0]()),set:n=>{t=n,r&&r[1](n)}}}function Ae(e,t,r){let n=[];return C(()=>{for(let i of n)i.dispose();n=[]}),w(()=>{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 a=[],s=new Set;for(let c=0;c<i.length;c++){let u=i[c],l=o.get(u);if(l&&!s.has(l))l.setIndex(c),a.push(l),s.add(l);else{let f,d,y;W(p=>{y=p;let b=Bo(c);d=b.set,f=t(u,b.index)});let v={item:u,rendered:f,dispose:y,setIndex:d};a.push(v),s.add(v)}}for(let c of n)s.has(c)||c.dispose();return n=a,a.map(c=>c.rendered)})},void 0,{name:"mapArray"})}function Re(e,t,r,n){let i=[],o=[];return C(()=>{for(let a of o)a.dispose();i=[],o=[]}),w(()=>{let a=e()||[];return x(()=>{if(a.length===0){for(let f of o)f.dispose();return i=[],o=[],n?.fallback?n.fallback():[]}let s=new Map;for(let f=0;f<i.length;f++)s.set(i[f],o[f]);let c=[],u=[],l=new Set;for(let f=0;f<a.length;f++){let d=t(a[f]),y=s.get(d);if(y&&!l.has(d))y.setIndex(f),y.setItem(a[f]),c.push(y);else{let v,p,b,T;W(S=>{T=S;let g=Bo(f);p=g.set;let[L,H]=O(a[f]);b=J=>H(()=>J),v=r(L,g.index)}),c.push({rendered:v,dispose:T,setIndex:p,setItem:b})}u.push(d),l.add(d)}for(let[f,d]of s)l.has(f)||d.dispose();return i=u,o=c,c.map(f=>f.rendered)})},void 0,{name:"keyArray"})}function Ce(e,t,r){let n=[];return C(()=>{for(let i of n)i.dispose();n=[]}),w(()=>{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,a=i.length;for(let c=o;c<a;c++){let u,l,f,d=i[c];W(y=>{f=y;let[v,p]=O(d);l=p,u=t(v,c)}),n.push({rendered:u,setItem:l,dispose:f})}for(let c=a;c<o;c++)n[c].dispose();a<o&&(n=n.slice(0,a));let s=Math.min(o,a);for(let c=0;c<s;c++)n[c].setItem(i[c]);return n.map(c=>c.rendered)})},void 0,{name:"indexArray"})}var et=Symbol.for("fluixi.server-node"),Fl=Symbol.for("fluixi.dom.server-host"),Ul=globalThis,Qe=Ul[Fl]??={server:typeof document>"u",nodes:null};function E(){return Qe.server}function de(e){Qe.server=e}function qo(e){Qe.nodes=e}function Te(){if(!Qe.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return Qe.nodes}function he(e){return e!=null&&e[et]===!0?!0:typeof Node<"u"&&e instanceof Node}function Ut(e){return e!=null&&e[et]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Kt(e){return e!=null&&e[et]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}function Fo(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function Uo(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function Ko(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 zo=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Jo=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"]),tt="http://www.w3.org/2000/svg";function _n(e){return e.localName.includes("-")}function rt(e,t,r,n=!1){if(r==null){e.removeAttribute(t);return}if(_n(e)){if(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:E()){Oe(e,t,r);return}e[t]=r;return}j(e,t,r,n)}var Nn=Symbol.for("fluixi.serverProps");function Oe(e,t,r){let n=e[Nn]??={};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 Kl=new Set(["draggable","spellcheck","contenteditable"]);function Dn(e){return e.startsWith("aria-")||Kl.has(e.toLowerCase())}var nt=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]),In=new Set(["id","class","className","style","slot","part","exportparts","is","title","role","lang","dir","tabindex","hidden"]);function _e(e){return In.has(e)||e.startsWith("aria-")||e.startsWith("data-")}function zt(e,t=document){return t.querySelector(e)}function Go(e,t=document){return Array.from(t.querySelectorAll(e))}function Xo(e,t){return e.closest(t)}function Mn(e,...t){e.classList.add(...t)}function Pn(e,...t){e.classList.remove(...t)}function Ln(e,...t){t.forEach(r=>e.classList.toggle(r))}function Yo(e,t){return e.classList.contains(t)}function j(e,t,r,n=!1){if(typeof r=="boolean"&&Dn(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 jn(e,t){return e.getAttribute(t)}function Hn(e,t){e.removeAttribute(t)}function Jt(e,t){Object.assign(e.style,t)}function Zo(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function Wn(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")Jt(n,o);else if(i.startsWith("on")&&typeof o=="function"){let a=i.slice(2).toLowerCase();n.addEventListener(a,o)}else j(n,i,o)}),r.forEach(i=>{typeof i=="string"?n.appendChild(document.createTextNode(i)):n.appendChild(i)}),n}function Vn(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function Bn(e,...t){t.forEach(r=>{typeof r=="string"?e.appendChild(document.createTextNode(r)):e.appendChild(r)})}function Qo(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function es(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function ts(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function rs(e,t,r,n){let i=o=>{let a=o.target.closest(r);a&&e.contains(a)&&n(o,a)};return e.addEventListener(t,i),()=>{e.removeEventListener(t,i)}}function ns(e,t=5e3){return new Promise((r,n)=>{let i=zt(e);if(i){r(i);return}let o=new MutationObserver(()=>{let s=zt(e);s&&(o.disconnect(),clearTimeout(a),r(s))});o.observe(document.body,{childList:!0,subtree:!0});let a=setTimeout(()=>{o.disconnect(),n(new Error(`Element ${e} not found within ${t}ms`))},t)})}function is(e,t,r={}){let n=new IntersectionObserver(i=>{i.forEach(o=>{t(o.isIntersecting)})},r);return n.observe(e),()=>{n.disconnect()}}function os(e,t){let r=new ResizeObserver(n=>{n.forEach(t)});return r.observe(e),()=>{r.disconnect()}}var zl=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function ss(e){return typeof e=="object"&&e!==null&&e.$$typeof===zl}function as(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function cs(e){return e instanceof Node}function ls(e,t,r="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[r]>"u"&&(globalThis[r]={}),typeof globalThis[r][e]>"u"&&(globalThis[r][e]=t))}function us(e,t,r="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[r]<"u"&&typeof globalThis[r][e]<"u"?globalThis[r][e]:t}var Gt="1.0.0-alpha.113";var V={dom:Gt,reactive:ie};function fs(e){V.core=e}var it="data-fluixi";function qn(){return Jl()?"":V.core??V.dom}function Jl(){try{return!0}catch{return!1}}function ps(e){if(e.setAttribute(it,qn()),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 ds(){let e=nn();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:[]},Ne="__fx_at",K="data-hk",hs=null;function ms(e){hs=e}function X(){return hs}var ys=null;function vs(e){ys=e}function ot(){return ys}function Un(e,t){return h.active&&t.parentNode===e}function Xt(e){let t=h.parents.lastIndexOf(e);t!==-1&&(h.parents.length=t),h.cursor=e.nextSibling}function gs(){return h.active?h.cursor:null}function De(e,t){if(!e||e.parentNode==null)return t();let r=h.active,n=h.cursor,i=h.parents;h.active=!0,h.cursor=e,h.parents=[];try{return t()}finally{h.active=r,h.cursor=n,h.parents=i}}function bs(e){if(!h.active)return e();let t=h.cursor,r=h.parents;h.active=!1,h.parents=[];try{return e()}finally{h.active=!0,h.cursor=t,h.parents=r}}function Ie(e){if(!h.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&Xt(t)}function Yt(){let e=globalThis;return e[Symbol.for("fluixi.appHydration")]??={pending:0,waiting:new Set}}function Ss(){Yt().pending++}function ws(){let e=Yt();if(e.pending>0&&e.pending--,e.pending>0)return;let t=[...e.waiting];e.waiting.clear();for(let r of t)r()}function xs(){return Yt().pending>0}function Es(e){let t=Yt();return t.waiting.add(e),()=>t.waiting.delete(e)}var Fn=[];function ks(e){h.active?Fn.push(e):e()}function Kn(){for(;Fn.length>0;){let e=Fn.shift();try{e()}catch(t){console.error(t)}}}function $s(){return h.active}function As(e){return Object.defineProperty(e,Symbol.for("fluixi-router"),{value:!0,enumerable:!0}),e}function Rs(e){return Object.defineProperty(e,Symbol.for("fluixi-routes"),{value:!0,enumerable:!0}),e}function Cs(e){return Object.defineProperty(e,Symbol.for("fluixi-route"),{value:!0,enumerable:!0}),e}function Ts(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-outlet"),{value:!0,enumerable:!0}),e}function Os(e){return Object.defineProperty(e,Symbol.for("fluixi-provider"),{value:!0,enumerable:!0}),e}function _s(e){return Object.defineProperty(e,Symbol.for("fluixi-context"),{value:!0,enumerable:!0}),e}function st(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function Ns(e){return Object.defineProperty(e,Symbol.for("fluixi-suspense"),{value:!0,enumerable:!0}),e}function zn(e){return typeof e=="function"&&e[Symbol.for("fluixi-router")]===!0}function Jn(e){return typeof e=="function"&&e[Symbol.for("fluixi-routes")]===!0}function Gn(e){return typeof e=="function"&&e[Symbol.for("fluixi-route")]===!0}function Xn(e){return typeof e=="function"&&e[Symbol.for("fluixi-outlet")]===!0}function Yn(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function Zn(e){return typeof e=="function"&&e[Symbol.for("fluixi-context")]===!0}function U(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function Qn(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function Ds(e){return zn(e)?{type:"router",value:e}:Gn(e)?{type:"route",value:e}:Jn(e)?{type:"routes",value:e}:Xn(e)?{type:"outlet",value:e}:U(e)?{type:"component",value:e}:Qn(e)?{type:"suspense",value:e}:Yn(e)?{type:"provider",value:e}:Zn(e)?{type:"context",value:e}:{type:"none",value:e}}function Is(e){if(E()||!h.active)return e();let t=k();return st(()=>R(t,e))}function Gl(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 Xl(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 Ls(e){return Xl(Gl(e))}var js=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Ms={},Hs="__fx_loc";function ei(e,t){return e}var Ps=new Map,Yl="__fluixi_delegated_events__",ni=globalThis[Yl]??={names:new Set},Qt=ni.names,tr=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function lt(e){if(!(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:E()))for(let t of e)Qt.has(t)||tr.has(t)||(Qt.add(t),ni.dispatch??=Zl,document.addEventListener(t,ni.dispatch))}function Zl(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 rr(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}Qt.has(t)||lt([t])}function at(e,t){delete e[`$$${t}`];let r=`__fx_${t}`,n=e[r];n&&(e.removeEventListener(t,n),delete e[r])}function Ws(e){return!tr.has(e)}function Vs(e){return typeof e=="function"}function Pe(e,t=!1){if(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:E())return Te().createText(e);if(h.active&&!t){let r=ot()?.hydrateText(e);if(r)return r}return document.createTextNode(e)}function ve(e,t=!1,r){let n=X(),i=n?n.next():null;if(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:E()){let o=Te().createElement(e,t);return i&&o.setAttribute(K,i),o}if(h.active){let o=n?n.claim(i,e):null;if(o)return ot()?.enterElement(o),e.includes("-")&&n?.handOwner(o),r?ei(o,r):o;let a=ot()?.hydrateElement(e);if(a)return e.includes("-")&&n?.handOwner(a),r?ei(a,r):a}return ei(t?document.createElementNS(tt,e):document.createElement(e),r)}function ut(e,t=!1){let r=Ps.get(e);if(r)return r;let n=document.createElement("template");return t?n.innerHTML=`<svg>${e}</svg>`:n.innerHTML=e,Ps.set(e,n),n}function ii(e,t,r=!1,n=!1,i){let o=X(),a=o?o.salt(e):"",s=o?o.next(a):null;if(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:E()){let c=Te();if(r){let u=c.parseTemplate(e,n);return s&&u.setAttribute(K,s),u}return c.createRaw(s?Ql(e,s):e)}if(h.active){let c=o?o.claim(s,t):null;if(c)return h.cursor=c.nextSibling,o?.handOwnerTree(c,e),Zt(c,i);let u=ot()?.hydrateStatic(t,a);if(u)return o?.handOwnerTree(u,e),Zt(u,i)}return Zt(nr(ut(e,n),n).firstChild,i)}function oi(e){let t;return r=>(t??=ut(e),Zt(Bs(t.content.firstChild),r))}function Bs(e){let t=typeof document>"u"?void 0:document;return t&&e.ownerDocument!==t?t.importNode(e,!0):e.cloneNode(!0)}function Ql(e,t){return e.replace(/^(\s*<[^\s/>]+)/,`$1 ${K}="${t}"`)}function Zt(e,t){return e}function ft(e,t){let r=h.active&&X();return r?r.holeScope(e,t):t()}function pt(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 dt(e,t){let r=[];for(let n=e.nextSibling;n&&n!==t;n=n.nextSibling)r.push(n);return r}function nr(e,t=!1){let r=Bs(e.content);return t?r.firstChild:r}function si(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?si(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function qs(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function Fs(e){if(A(e)||U(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!A(t)&&!U(t);)t=t();return t}var Z=0,eu=200;function tu(e,t,r,n,i){let o=n,a,s=()=>a??=new Map,c=!1;return $(()=>{let l=c&&h.active;if(c=!0,!l)return u();h.active=!1;try{return u()}finally{h.active=!0}});function u(){let l;if(U(e)&&!A(e)){if(!s().has(e)){Z++;try{let f=e();s().set(e,f)}finally{Z--}}for(l=s().get(e);typeof l=="function"&&A(l);)l=l()}else for(l=e();typeof l=="function"&&A(l);)l=l();{let f=0;for(;typeof l=="function"&&f++<50;)if(U(l)){if(!s().has(l)){let d=l;Z++;try{let y=d();s().set(d,y)}finally{Z--}}l=s().get(l)}else if(A(l))l=l();else if(l=l(),typeof l!="function"||!A(l)&&!U(l))break}Array.isArray(l)&&s(),Z++;try{o=ht(t,l,r,o,a),i(o)}finally{Z--}}}function N(e,t,r,n){if(Z>eu)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)},a=n??null,s=l=>Array.isArray(l)&&l.some(f=>typeof f=="function"),c=l=>typeof l=="function"?l:()=>l;if(typeof t!="function"&&!s(t)){Z++;try{a=ht(e,t,r,a)}finally{Z--}return o(),()=>a}let u=tu(c(t),e,r,a,l=>{a=l});return o(),()=>(u?.(),a)}var Us=Symbol.for("fluixi.keepServerContent");function Ks(e){return{[Us]:!0,adopt:e}}function ru(e){return!!e&&typeof e=="object"&&e[Us]===!0}function ht(e,t,r,n,i){if(t==null||typeof t=="boolean")return Q(e,n,r);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return Q(e,n,r);if(ru(t)){let a=n==null?[]:Array.isArray(n)?n:[n];return X()?.keep(a),t.adopt?.(a),n??null}lr(t);let o=typeof t;if(o==="string"||o==="number"){if(o==="number"&&(t=String(t)),Array.isArray(n)){if(n.length===0){let s=Pe(t);return oe(e,s,r),s}if(n.length===1&&n[0].nodeType===3){let s=n[0];return h.active&&s.data,s.data=t,n}n=Q(e,n,r)}if(n&&Kt(n))return h.active&&n.data,n.data=t,n;let a=Pe(t);return n&&n.parentNode===e?e.replaceChild(a,n):Un(e,a)||oe(e,a,r),a}if(he(t))return Un(e,t)?(Xt(t),t):(n!==t&&iu(e,n,t,r),t);if(Array.isArray(t)){let a=[],s=Array.isArray(n)?n:n?[n]:[],c=[],u=new Set,l=()=>me(t,a,e,i,c,u),f=h.active&&s.length&&X();f?f.resume(s[0],l):l();let d=nu(e,u.size?s.filter(y=>!u.has(y)):s,a,r);for(let y of c){if(y.wired)continue;let v=N(e,y.sig,y.marker);C(()=>Q(e,v()))}return d}if(ct&&typeof t=="object"){let a=ct(t);if(a!==t)return ht(e,a,r,n)}return Q(e,n,r)}var ct=null;function zs(e){ct=e}function me(e,t,r,n,i,o){for(let a=0;a<e.length;a++){let s=e[a];if(!(s==null||typeof s=="boolean")){for(;!i&&typeof s=="function"&&!A(s)&&!U(s)&&(s=s(),!(s==null||typeof s=="boolean")););if(!(s==null||typeof s=="boolean")){if(typeof s=="function"){let c;for(U(s)&&!A(s)?(n||(n=new Map),n.has(s)||n.set(s,s()),c=n.get(s)):c=i?s:s();c!==s&&typeof c=="function"&&!A(c)&&!U(c);)n||(n=new Map),n.has(c)||n.set(c,c()),c=n.get(c);if(c==null||typeof c=="boolean")continue;if(typeof c=="function"){if(A(c)||c===s){if(i){let l=Pe("",!0);if(t.push(l),h.active&&o&&h.cursor?.parentNode===r){let f=()=>h.cursor&&h.cursor.parentNode===r?h.cursor:null,d=f();r.insertBefore(l,d);let y=N(r,c,l),v=f();for(let p=d;p&&p!==v;p=p.nextSibling)o.add(p);r.insertBefore(l,v),C(()=>Q(r,y())),i.push({marker:l,sig:c,wired:!0});continue}i.push({marker:l,sig:c});continue}let u=c();for(;typeof u=="function"&&A(u);)u=u();if(u==null||typeof u=="boolean")continue;Array.isArray(u)?me(u,t,r,n):me([u],t,r,n);continue}continue}Array.isArray(c)?me(c,t,r,n,i,o):me([c],t,r,n,i,o);continue}if(!lr(s)){if(Array.isArray(s)){me(s,t,r,n,i,o);continue}if(he(s)){h.active&&(h.cursor===s||h.parents.includes(s)||s.contains?.(h.cursor))&&Xt(s),t.push(s);continue}if(ct&&typeof s=="object"){let c=ct(s);if(c!==s){me(Array.isArray(c)?c:[c],t,r,n);continue}}if(typeof s=="string"||typeof s=="number"){let c=String(s);if(c.trim()===""&&c!==" ")continue;t.push(Pe(c));continue}t.push(Pe(String(s)))}}}}}function nu(e,t,r,n){for(let f=0;f<r.length;f++){let d=r[f].parentNode;d!==null&&d!==e&&d.nodeType!==11&&(r=r.slice(),r[f]=r[f].cloneNode(!0))}let i=r.length,o=t.length,a=i,s=0,c=0,u=o>0?t[o-1].nextSibling??void 0:n,l=null;for(;s<o||c<a;){if(t[s]===r[c]){s++,c++;continue}for(;o>s&&a>c&&t[o-1]===r[a-1];)o--,a--;if(o===s){let f=a<i?c?r[c-1].nextSibling??void 0:r[a-c]:u;for(;c<a;)oe(e,r[c++],f)}else if(a===c)for(;s<o;)(!l||!l.has(t[s]))&&t[s].parentNode===e&&e.removeChild(t[s]),s++;else if(t[s]===r[a-1]&&r[c]===t[o-1]){let f=t[--o].nextSibling;oe(e,r[c++],t[s++].nextSibling),oe(e,r[--a],f),t[o]=t[s-1]}else{if(!l){l=new Map;let d=c;for(;d<a;)l.set(r[d],d++)}let f=l.get(t[s]);if(f!=null)if(c<f&&f<a){let d=s,y=1;for(;++d<o&&d<a&&!(!l.has(t[d])||l.get(t[d])!==f+y);)y++;if(y>f-c){let v=t[s];for(;c<f;)oe(e,r[c++],v)}else t[s].parentNode===e?e.replaceChild(r[c++],t[s++]):(oe(e,r[c++],u),s++)}else s++;else t[s].parentNode===e&&e.removeChild(t[s]),s++}}return r}function iu(e,t,r,n){let i=Array.isArray(t)?t[0]:t;i&&i.parentNode===e?(e.replaceChild(r,i),Array.isArray(t)&&Q(e,t.slice(1),n)):oe(e,r,n)}function Q(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 oe(e,t,r){h.active&&t.parentNode===e||(r&&r.parentNode===e?e.insertBefore(t,r):e.appendChild(t))}function se(e,t,r){r==null?delete e[t]:e[t]=r}function ir(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 Js(e,t){if(!t||typeof t!="function")return;let r=t[Ne]?.name;!r||r.indexOf(":")}function er(e,t,r){let n=typeof r=="function"?x(()=>r()):r}function or(e,t){let r=(n,i)=>{typeof n=="function"&&n(e,i??(()=>{}))};if(typeof t=="function"){r(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){r(t[0],t[1]);return}for(let n of t)Array.isArray(n)?r(n[0],n[1]):r(n)}}function Le(e,t,r,n=!1){return Js(e,r),typeof r!="function"?(j(e,t,r,n),()=>{}):$(()=>{let i=typeof r=="function"?r():r;j(e,t,i,n)})}function je(e,t,r){return typeof r!="function"?(se(e,t,r),()=>{}):(Js(e,r),$(()=>{let n=typeof r=="function"?r():r;se(e,t,n)}))}function sr(e,t,r){return typeof r!="function"?(j(e,t,!!r),()=>{}):$(()=>{let n=r();j(e,t,!!n)})}function ye(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){$(()=>{ye(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 ae(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($(()=>{let a=!!i();for(let s of o)e.classList.toggle(s,a)}));else{let a=!!(typeof i=="function"?i():i);for(let s of o)e.classList.toggle(s,a)}}}function ti(e,t,r){t.includes("-")?r==null?e.removeProperty(t):e.setProperty(t,String(r)):e[t]=r??""}function Me(e){for(;typeof e=="function";)e=e();return e}var ri=new WeakMap;function ee(e,t,r){if(typeof t=="function"&&r){r.push($(()=>ee(e,Me(t))));return}let n=Me(t),i=ri.get(e);if(n==null){ri.delete(e),e.removeAttribute("style");return}let o=new Set,a=s=>{if(typeof s=="function"&&r){r.push($(()=>a(Me(s))));return}if(s=Me(s),s!=null){if(typeof s=="string")e.style.cssText=s;else if(Array.isArray(s))for(let c of s)a(c);else if(typeof s=="object")for(let c in s){o.add(c);let u=s[c];typeof u=="function"&&r?r.push($(()=>ti(e.style,c,Me(u)))):ti(e.style,c,Me(u))}}};if(Array.isArray(n))for(let s of n)a(s);else a(n);if(i)for(let s of i)o.has(s)||ti(e.style,s,null);ri.set(e,o)}function Gs(e,t){if(typeof t!="function"){ee(e,t,[]);return}$(()=>{ee(e,t())})}function Xs(e,t){if(typeof t!="function"){ae(e,t,[]);return}$(()=>{ae(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 ai(e){let{element:t,props:r,prevProps:n=Ms,isSVG:i=!1,skipChildren:o=!1,isCustomElement:a,accessors:s}=e;if(!t||!Ut(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===tt,u=(p,b,T,S)=>{if(p==="children"){o||S.push(N(t,()=>r.children));return}let g=r[p],L=g===void 0&&T&&ou(r,p);if(g===b&&!L||L&&(p==="ref"||p==="use"||p.startsWith("on")||p.includes(":")||p==="class"||p==="className"||p==="classList"||p==="style"))return;if(p==="ref"){ge(g,t);return}if(p==="use"){or(t,g);return}if(p.startsWith("on:")){S.push(ir(t,p.slice(3),g));return}if(p.startsWith("prop:")){S.push(je(t,p.slice(5),g));return}if(p.startsWith("attr:")){S.push(Le(t,p.slice(5),g,c));return}if(p.startsWith("bool:")){S.push(sr(t,p.slice(5),g));return}if(p==="class"||p==="className"){typeof g=="function"?S.push($(()=>{ye(t,g())})):ye(t,g);return}if(p==="classList"){er(t,"class",g),typeof g=="function"?S.push($(()=>{ae(t,g())})):ae(t,g,S);return}if(p==="style"){er(t,"style",g),typeof g=="function"?S.push($(()=>{ee(t,g())})):ee(t,g,S);return}if(p.startsWith("on")){let _=p.slice(2).toLowerCase();b&&at(t,_),g&&rr(t,_,g);return}let H=a??t.localName.includes("-"),J=nt.has(p)||!c&&p in t||H&&!c&&!_e(p);if(H&&!c&&!_e(p)&&s!==void 0&&typeof g=="function"&&!s.includes(p)){(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:E())?Oe(t,p,g):se(t,p,g);return}if(H&&!c&&!_e(p)&&(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:E())){S.push($(()=>{let _=typeof g=="function"?g():r[p];for(;typeof _=="function"&&_.length===0;)_=_();Oe(t,p,_)}));return}typeof g=="function"?S.push(J?je(t,p,g):Le(t,p,g,c)):S.push($(()=>J?se(t,p,r[p]):j(t,p,r[p],c)))},l=p=>{p!=="children"&&(p.startsWith("on")?at(t,p.slice(2).toLowerCase()):nt.has(p)?se(t,p,null):t.removeAttribute(p))},f=new Map,d=(p,b,T)=>{let S=[];f.set(p,S),u(p,b,T,S)};x(()=>{for(let p in r)d(p,n[p],n===Ms);for(let p in n)p in r||l(p)});let y=k(),v=$(()=>{let p=new Set;for(let b in r)p.add(b);x(()=>R(y,()=>{for(let b of p)f.has(b)||d(b,void 0,!0);for(let[b,T]of f)p.has(b)||(T.forEach(S=>S()),f.delete(b),l(b))}))});return()=>{v();for(let p of f.values())p.forEach(b=>b())}}function mt(e,t,r=!1){for(let n in t){if(n==="children")continue;let i=t[n];if(n==="ref"){ge(i,e);continue}if(n==="use"){or(e,i);continue}if(n.startsWith("on:")){ir(e,n.slice(3),i);continue}if(n.startsWith("prop:")){je(e,n.slice(5),i);continue}if(n.startsWith("attr:")){Le(e,n.slice(5),i,r);continue}if(n.startsWith("bool:")){sr(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 a=`__fx_${o}`;if(!e[a]){let s=c=>{e[`$$${o}`]?.(c)};e.addEventListener(o,s),e[a]=s}}else e[`$$${o}`]=i,Qt.has(o)||lt([o]);continue}if(n==="class"||n==="className"){ye(e,i);continue}if(n==="classList"){er(e,"class",i),typeof i=="function"?$(()=>{ae(e,i())}):ae(e,i,[]);continue}if(n==="style"){er(e,"style",i),typeof i=="function"?$(()=>{ee(e,i())}):ee(e,i,[]);continue}if(n==="innerHTML"){if(typeof i=="function"){let o=D(()=>{let a=i();for(;typeof a=="function";)a=a();e.innerHTML=a});C(()=>o())}else e.innerHTML=i;continue}if(n==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof i=="function"){let o=D(()=>{let a=i();for(;typeof a=="function"&&a.length===0;)a=a();document.activeElement!==e&&(e.value=a??"")});C(()=>{o()})}else $(()=>{document.activeElement!==e&&(e.value=t[n]??"")});continue}if(n==="checked"&&e.tagName==="INPUT"){if(typeof i=="function"){let o=D(()=>{let a=i();for(;typeof a=="function"&&a.length===0;)a=a();document.activeElement!==e&&(e.checked=a??"")});C(()=>{o()})}else $(()=>{document.activeElement!==e&&(e.checked=t[n]??"")});continue}if(n==="value"&&e.tagName==="SELECT"){if(typeof i=="function"){let o=!0,a=D(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();o?(o=!1,queueMicrotask(()=>{e.value=s??""})):e.value=s??""});C(()=>{a()})}else{let o=!0;$(()=>{let a=t[n];o?(o=!1,queueMicrotask(()=>{e.value=a??""})):e.value=a??""})}continue}if(typeof i=="function"){let o=D(()=>{let a=i();for(;typeof a=="function"&&a.length===0;)a=a();rt(e,n,a,r)});C(()=>{o()})}else $(()=>rt(e,n,t[n],r))}}function ci(...e){let t=i=>typeof i=="function"?i():i,r=i=>{for(let o=e.length-1;o>=0;o--){let a=t(e[o]);if(!a||!(i in a))continue;let s=a[i];if(s!==void 0)return s}},n=i=>{for(let o of e){let a=t(o);if(a&&i in a)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 a=t(o);if(a)for(let s of Reflect.ownKeys(a))i.add(s)}return[...i]},getOwnPropertyDescriptor:(i,o)=>n(o)?{enumerable:!0,configurable:!0,get:()=>r(o)}:void 0})}function ar(e,...t){let r=new Set;for(let a of t)for(let s of a)r.add(s);let n=a=>({enumerable:!0,configurable:!0,get:()=>e[a]}),i=t.map(a=>{let s=new Set(a);return new Proxy({},{get:(c,u)=>s.has(u)?e[u]:void 0,has:(c,u)=>s.has(u)&&u in e,ownKeys:()=>Array.from(s).filter(c=>c in e),getOwnPropertyDescriptor:(c,u)=>s.has(u)&&u in e?n(u):void 0})}),o=new Proxy({},{get:(a,s)=>r.has(s)?void 0:e[s],has:(a,s)=>!r.has(s)&&s in e,ownKeys:()=>Reflect.ownKeys(e).filter(a=>!r.has(a)),getOwnPropertyDescriptor:(a,s)=>!r.has(s)&&s in e?n(s):void 0});return[...i,o]}function ge(e,t,r){if(!e){r?.(t);return}let n=e[Ne]?.name;if(he(e)){let i=t,o=e;if(!i)return;typeof i=="function"?i(o):typeof i=="object"&&"current"in i&&(i.current=o);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e?e.current=t:r?.(t)}function li(e,t,r){let n=t||document.body,i=$e(()=>e),o=[];return I(()=>{let a=$(()=>{let s=i();Array.isArray(s)?(s.forEach(c=>n.appendChild(c)),o.push(()=>{s.forEach(c=>{c.parentNode===n&&n.removeChild(c)})})):he(s)&&(n.appendChild(s),o.push(()=>{s.parentNode===n&&n.removeChild(s)}))});o.push(a),C(()=>{o.forEach(s=>s())})}),null}function Ys(e){return typeof e=="string"&&e.toLowerCase()===e}function cr(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 Zs(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function lr(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function Qs(e){return typeof e=="function"&&e.length===0&&A(e)}function be(e,t,r){if(!t)throw new Error("Container element is required");let n,i,o=[];return W(a=>{I(()=>{h.active||(t.textContent=""),t.setAttribute(it,"");let s=e;N(t,typeof s=="function"&&!A(s)?x(s):s)}),i=a}),()=>{i?.(),n?.(),o.forEach(a=>a()),t.textContent=""}}function ui(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 ur(e){if(E())return null;let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,r,n,i=!1,o=k(),a=()=>R(o,()=>W(s=>{r=s,n=document.createElement("div"),n.style.display="contents",t().appendChild(n),N(n,e.children)&&ge(e.ref,n)}));return h.active?queueMicrotask(()=>{i||a()}):a(),C(()=>{i=!0,r?.(),n?.remove()}),null}function ce(e){return()=>{let t=e();return typeof t=="function"?t():t}}function fr(e){let t=ce(()=>e.when),r=w(t,void 0,{name:"Show.when"}),n=w(()=>!!r(),void 0,{name:"Show.cond"}),i=k(),o=null,a=null,s=c=>{c!==a&&(o&&G(o),o=F(i),a=c)};return w(()=>{let c=n();return s(c?"when":"fallback"),R(o,()=>{if(!c)return e.fallback;let u=e.children;if(A(u))return u;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 su(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function ea(e){return w(()=>{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(`${su(n)}: ${o}`)}return r.join("; ")},void 0,{name:"StyleMap"})}var fi=Symbol("match");function pr(e){return{[fi]:!0,when:ce(()=>e.when),get children(){return e.children}}}function dr(e){let t=e.children,r=Array.isArray(t)?t:[t],n=k(),i=null,o=-1,a=s=>{s!==o&&(i&&G(i),i=F(n),o=s)};return w(()=>{for(let s=0;s<r.length;s+=1){let u=r[s],l=0;for(;typeof u=="function"&&!u[fi]&&l++<10;)u=u();if(!u||typeof u!="object"||u[fi]!==!0)continue;let f=u.when();if(f)return a(s),R(i,()=>{let d=u.children;return typeof d=="function"?d(f):d})}return a(-2),R(i,()=>e.fallback??null)},void 0,{name:"Switch"})}function ta(e){return w(()=>{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"})}function pi(e){if(E())return e.fallback??null;let t=h.active,[r,n]=O(!t);return t&&queueMicrotask(()=>n(!0)),w(()=>r()?e.children:e.fallback??null,void 0,{name:"client-only"})}var ra=pi;var yr=Symbol("store-raw"),na=Symbol("store-node"),ia=Symbol("store-has"),oa=Symbol("store-self"),sa=Symbol("store-track");var yt=new WeakMap,di=new WeakMap,We=new WeakMap,vr=new WeakMap;function au(e,t){if(!He(e)||!Pt())return;let r=new Set,n=a=>{if(!(!He(a)||r.has(a))){r.add(a);for(let s of Object.values(a))n(s)}};n(vr.get(t)??t);let i=new Set,o=a=>{if(!He(a))return;let s=a;if(r.has(s)||i.has(s))return;i.add(s);let c=yt.get(s);if(c){for(let u of c.keys.values())sn(u);c.all&&sn(c.all),yt.delete(s),We.delete(s),di.delete(s)}for(let u of Object.values(s))o(u)};o(e)}var gr=(e,t,r)=>r?`${e}[${String(t)}]`:`${e}.${String(t)}`;function fa(e,t,r){let n=t?.owner,i=n&&r!==void 0?gr(n.name,r,t?.array):void 0,o=i?{name:i}:void 0,[a,s]=xo(n?.store,()=>m.hot?Rn(()=>O(e,o)):O(e,o)),c=a;return c.$=s,c}function br(e){let t=yt.get(e);return t?t.owner||(t.owner=We.get(e)):yt.set(e,t={keys:new Map,owner:We.get(e),array:Array.isArray(e)}),t}function aa(e,t,r){let n=e.keys.get(t);return n||e.keys.set(t,n=fa(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),vr.set(e,vr.get(n)??n);let a=yt.get(e);if(a&&(a.owner=o,!!Pt())){for(let[s,c]of a.keys)on(c,t,gr(r,s,a.array));a.all&&on(a.all,t,gr(r,"*",a.array))}}function ca(e){let t=br(e);(t.all||(t.all=fa(void 0,t,"*")))()}function la(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 hr(e){if(!He(e))return e;let t=di.get(e);if(t)return t;let r=new Proxy(e,lu);return di.set(e,r),r}var lu={get(e,t,r){if(t===yr||t===na)return e;if(t===Dt)return r;if(t===ia)return c=>c in e;if(t==="__proxy")return!0;if(t===sa||t===oa)return ca(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=br(e),a=aa(o,t,n),s=a();return He(s)?(o.owner&&cu(s,a,gr(o.owner.name,t,o.array),e),hr(s)):s},set(){return!0},deleteProperty(e,t){return t in e&&z(e,t,void 0),!0},has(e,t){return t===yr||t===Dt||t===na||t===ia||t===oa||t===sa?!0:(aa(br(e),t,e[t])(),t in e)},ownKeys(e){return ca(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function pa(e,t=new Set){if(e==null||typeof e!="object")return e;let r=e[yr]??e;if(t.has(r)||!He(r))return r;t.add(r);let n=!1,i=a=>{let s=pa(a,t);return s!==a&&(n=!0),s};if(Array.isArray(r)){let a=r.map(i);return n?a:r}let o={};for(let a of Object.keys(r))o[a]=i(r[a]);return n?o:r}function z(e,t,r){let n=pa(r),i=e[t];if(i===n&&(n!==void 0||t in e))return;let o=Array.isArray(e),a=o?e.length:0;n===void 0?delete e[t]:e[t]=n;let s=br(e),c=s.keys.get(t);if(c&&la(c,n),au(i,e),o&&e.length!==a){let u=s.keys.get("length");u&&la(u,e.length)}s.all&&s.all.$(void 0)}function hi(e,t){return typeof e=="function"?e(t):e}function mi(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)?mi(i,n):z(e,r,n)}}function Sr(e){let t=[],r=e.replace(/\[([^\]]*)\]/g,".$1");for(let n of r.split("."))n.length&&t.push(n);return t}function da(e,t,r){let n=t.length-1;for(let o=0;o<n;o++){let a=t[o];if(a==="*"){let c=t.slice(o+1);if(Array.isArray(e))for(let u=0;u<e.length;u++)da(e[u],c,r);return}let s=e[a];(s==null||typeof s!="object")&&(s=/^\d+$/.test(t[o+1])?[]:{},z(e,a,s)),e=s}let i=t[n];if(i==="*"){if(Array.isArray(e))for(let o=0;o<e.length;o++)z(e,o,hi(r,e[o]));return}z(e,i,hi(r,e[i]))}function ua(e,t,r){da(e,Sr(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 mr(e,t){for(let r=e.length-1;r>=t.length;r--)z(e,String(r),void 0);e.length!==t.length&&z(e,"length",t.length);for(let r=0;r<t.length;r++)z(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&&mi(e,n);return}if(Array.isArray(r)&&t.length===1){if(uu(r)){for(let n of r)ua(e,n[0],n[1]);return}if(Array.isArray(e)){mr(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){mi(e,r);return}if(t.length>=3){yi(e,t.slice(0,-1),t[t.length-1]);return}ua(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 a=n;a<=i;a+=r)a>=0&&a<e.length&&o.push(a);return o}return t==="*"?Array.isArray(e)?e.map((r,n)=>n):Object.keys(e??{}):[t]}function yi(e,t,r){if(e==null)return;let[n,...i]=t;if(typeof n=="string"){let a=Sr(n);if(a.length>1){yi(e,[...a,...i],r);return}}let o=pu(e,n);if(i.length===0){for(let a of o)z(e,a,hi(r,e[a]));return}for(let a of o){let s=e[a];if(s==null||typeof s!="object"){let c=i[0];s=typeof c=="number"||/^\d+$/.test(String(c))?[]:{},z(e,a,s)}yi(s,i,r)}}function vi(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(vi);let t={};for(let r of Object.keys(e))t[r]=vi(e[r]);return t}function le(e,t){let r=e;for(let n of Sr(t)){if(r==null)return;r=r[n]}return r}var ha=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"}),vr.set(e,e)),Pt()&&Eo({kind:"store",node:this,handle:()=>this.root,name:t.name})}get state(){return hr(this.root)}get proxy(){return hr(this.root)}get accessor(){return(()=>hr(this.root))}unwrap(){return this.root}getNode(e){return this.root&&this.root[e]}get(e){if(e==null||e==="")return vt(this.state);let t=this.state;for(let r of Sr(e)){if(t==null)return;t=t[r]}return vt(t)}select(e){return w(()=>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 w(()=>this.state[e])}produce(e){this.set((t=>{let r=vi(t);return e(r),r}))}reconcile(e,t={}){this.set(e)}push(e,...t){let r=le(this.root,e);this.set(e,r.concat(t))}pop(e){let t=le(this.root,e).slice(),r=t.pop();return this.set(e,t),r}shift(e){let t=le(this.root,e).slice(),r=t.shift();return this.set(e,t),r}splice(e,t,r,...n){let i=le(this.root,e).slice(),o=i.splice(t,r,...n);return this.set(e,i),o}insert(e,t,r){let n=le(this.root,e).slice();n.splice(t,0,r),this.set(e,n)}removeAt(e,t){let r=le(this.root,e).slice(),n=r.splice(t,1);return this.set(e,r),n}replace(e,t){if(arguments.length>=2){let n=le(this.root,String(e)),i=t;if(Array.isArray(n)&&Array.isArray(i)){mr(n,i);return}this.set(e,i);return}let r=this.root;if(Array.isArray(r)&&Array.isArray(e)){mr(r,e);return}this.set(e)}clear(e){let t=e===void 0?this.root:le(this.root,e);if(Array.isArray(t)){mr(t,[]);return}if(t&&typeof t=="object")for(let r of Object.keys(t))z(t,r,void 0)}toObservable(){let[e]=Rn(()=>O(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 gi(e,t={immutable:!0}){let r=m.hot,n=new ha(r?r.take("store",e):e,t);return hu(n.set,n),r&&r.keep(()=>vt(n.proxy),()=>n.set(()=>e)),[n.proxy,n.set]}function mu(e,t={}){return new ha(e,{...t,immutable:!1})}function vt(e){if(e==null||typeof e!="object")return e;let t=e[yr];return t!==void 0?t:e}function yu(e){return x(()=>vt(e))}var gh=Object.freeze({createStore:gi,createMutableStore:mu,batch:I,unwrap:vt,untrackStore:yu});function bi(e,t){let[r,n]=gi(e,t);return new Proxy(r,{get:(i,o)=>o==="set"?n:i[o],has:(i,o)=>o==="set"||Reflect.has(i,o)})}var vu="__fx_dom_create_component__",Se=globalThis[vu]??={fn:null};function ya(e){Se.fn=e}function va(e={}){let t=e.signalSystem?.createComponent;t&&(Se.fn=t)}function we(e,t){let r=X()?.scope();return r?R(r,()=>ma(e,t)):ma(e,t)}function ma(e,t){if(Se.fn)return Se.fn(e,t);let r=typeof e!="function"?e:x(()=>e(t)),n=r!=null&&(typeof r=="function"||typeof r=="object");if(n)try{r.$name=e?.name}catch{}return n&&!A(r)?st(r):r}var ga=()=>Se.fn!==null,Si=()=>Se.fn!==null;function wi(){Se.fn=null}function wr(e,t={}){if(typeof e=="function")return we(e,t);if(typeof e!="string"||e.length===0)return null;let r=cr(e),n=ve(e,r);return mt(n,t,r),bu(n,t),n}function gu(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 bu(e,t){if(!gu(t))return;if((typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:E())&&!(X()?.keyed()??!1)){N(e,$e(()=>t.children));return}let r=e.firstChild,n;h.active&&r?.nodeType===8&&r.data==="fx"?n=pt(r):(r=ba("fx"),n=ba("fx/"),e.appendChild(r),e.appendChild(n));let i=r;N(e,ft(i,()=>$e(()=>t.children)),n,dt(i,n))}function ba(e){return(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:E())?Te().createComment(e):document.createComment(e)}function xr(e){let t=()=>{let s=e.component;return A(s)?s():s},[,r]=ar(e,["component"]),n=k(),i=null,o,a;return w(()=>{let s=t();return s===o||(i&&G(i),i=F(n),o=s,a=s==null?null:R(i,()=>x(()=>typeof s=="string"?wr(s,r):we(s,r)))),a},void 0,{name:"Dynamic"})}var Er,xa={getStore:()=>Er,run(e,t){let r=Er;Er=e;try{return t()}finally{Er=r}}},gt=globalThis[Symbol.for("fluixi.requestStore")]??={store:xa,async:!1};function Ei(e){gt.store=e??xa,gt.async=e!==null}function Ea(e){gt.async||Ei(e)}function bt(e={}){if(e.request===void 0){let a=$i();a&&(e.request=a)}e.locals||(e.locals=e.request?Ai(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 a=i.get(n)??0;return i.set(n,a+1),`${n}:r${a}`},nextIslandNamespace:a=>{let s=o.get(a)??0;return o.set(a,s+1),`${a}#${s}`},withResourceScope(a,s){let c=n;n=a;try{return s()}finally{n=c}},pending:new Set,data:new Map}}var kr=globalThis[Symbol.for("fluixi.requestEndHooks")]??=new WeakMap;function ka(e){let t=St();if(!t)return!1;let r=kr.get(t);return r||kr.set(t,r=[]),r.push(e),!0}function St(){return $i()??B()}var te=globalThis[Symbol.for("fluixi.beforeRender")]??={tasks:[],prepared:new WeakMap,page:void 0};function $a(e){return te.tasks.push(e),()=>{let t=te.tasks.indexOf(e);t>=0&&te.tasks.splice(t,1)}}function Aa(){let e=St();if(!e)return te.page??=Sa();let t=te.prepared.get(e);return t||te.prepared.set(e,t=Sa()),t}function Ra(){let e=St();return e?te.prepared.has(e):te.page!==void 0}async function Sa(){for(let e of[...te.tasks])await e()}function wt(e){ki(e)}function ki(e){let t=kr.get(e);if(t){kr.delete(e);for(let r of t.reverse())try{r()}catch(n){console.error("[fluixi] a request-end hook threw:",n)}}}function xt(e,t){return gt.store.run(e,t)}function B(){return gt.store.getStore()}function Ar(){return B()?.event}function Ca(){let e=Ar();return e?(e.locals||(e.locals={}),e.locals):{}}var wa=globalThis[Symbol.for("fluixi.requestLocals")]??=new WeakMap;function $i(){return globalThis[Symbol.for("fluixi.platformRequest")]?.getStore()}function Ai(e){let t=wa.get(e);return t||(t={},wa.set(e,t)),t}var Ve=globalThis[Symbol.for("fluixi.responseHeaders")]??=new WeakMap;function Ri(){let e=Ar()?.request;return e&&typeof e=="object"?e:$i()}function Ta(e,t,r=Ri()){if(!r)return!1;let n=Ve.get(r);return n||(n={headers:new Headers,sent:!1},Ve.set(r,n)),n.sent?!1:(n.headers.append(e,t),!0)}function Oa(e){let t=Ve.get(e);if(!t){t={headers:new Headers,sent:!0},Ve.set(e,t);return}return t.sent=!0,t.headers}var $r=globalThis[Symbol.for("fluixi.responseRedirects")]??=new WeakMap;function _a(e,t,r=Ri()){return!r||Ve.get(r)?.sent?!1:($r.has(r)||$r.set(r,{location:e,status:t}),!0)}var xi=globalThis[Symbol.for("fluixi.responseStatuses")]??=new WeakMap;function Rr(e,t=Ri()){return!t||Ve.get(t)?.sent?!1:(xi.set(t,e),!0)}function Cr(e){let t=e?.status;return typeof t=="number"&&Number.isInteger(t)&&t>=400&&t<=599?t:500}function Na(e){let t=xi.get(e);return xi.delete(e),t}function Da(e){let t=$r.get(e);return $r.delete(e),t}var Ci=fn(void 0);function Ti(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 Tr(e){let t=ln(),r=s=>!!s&&typeof s.then=="function",n=s=>(E()&&Rr(Cr(s)),typeof e.fallback=="function"?e.fallback(s,t.reset):e.fallback),i=s=>{if(r(s))throw s;return queueMicrotask(()=>t.setError(s)),null},o=s=>{if(Array.isArray(s))return s.map(o);if(typeof s!="function")return s;let c=s;return()=>{try{let u=o(c()),l=E()?t.caught():void 0;return l===void 0?u:x(()=>n(l))}catch(u){return E()&&!r(u)?(t.setError(u),x(()=>n(u))):i(u)}}},a=Wt(Ci);return a&&Ti(a,t),w(()=>{let s=t.error();if(s!==void 0)return n(s);try{let c=un(t,()=>{let l=e.children;return o(typeof l=="function"?l():l)}),u=E()?t.caught():void 0;return u===void 0?c:x(()=>n(u))}catch(c){return i(c),n(c)}},void 0,{name:"ErrorBoundary"})}function Or(e){let t=ce(()=>e.each),r=()=>e.fallback??null,n=(i,o)=>{let a=e.children,s=Array.isArray(a)?a.map(c=>typeof c=="function"?c(i,o):c):typeof a=="function"?a(i,o):a;return Ie(s),s};return e.by?Re(t,e.by,(i,o)=>n(i,o),{fallback:r}):Ae(t,(i,o)=>n(i,o),{fallback:r})}function _r(e){let t=ce(()=>e.each);return Ce(t,(r,n)=>{let i=e.children(r,n);return Ie(i),i},{fallback:()=>e.fallback??null})}var Su=Symbol.for("fluixi.owner"),kt=1,Oi=3,_i=8,wu=Symbol.for("fluixi.serverElementRenderer"),Ia=Symbol.for("fluixi.serverElementRendered");function Et(e){if(e.nodeType!==kt)return;let t=e;if(typeof t.localName!="string"||!t.localName.includes("-")||t[Ia])return;let r=globalThis[wu];r&&(t[Ia]=!0,r(t))}var Ma;Ma=et;var Nr=class{constructor(){this[Ma]=!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),Et(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),Et(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,Et(e)),t}addEventListener(){}removeEventListener(){}},$t=class Pa extends Nr{constructor(t){super(),this.nodeType=Oi,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 Pa(this.data)}},La=class ja extends Nr{constructor(t){super(),this.nodeType=kt,this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new ja(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}},Dr=class Ha extends Nr{constructor(t){super(),this.nodeType=_i,this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new Ha(this.data)}},xu=class{constructor(){this.cssText=""}setProperty(e,t){this[e]=t}removeProperty(e){delete this[e]}},Eu=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}},At=class Wa extends Nr{constructor(t,r=!1){if(super(),this.nodeType=kt,this.attributes=new Map,this.style=new xu,this.classList=new Eu(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=k();n&&(this[Su]=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 $t(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 Wa(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 ku=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),$u={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function Va(e){return e.replace(/&(#?\w+);/g,(t,r)=>$u[r]??t)}var re=class extends Error{};function Ba(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){s(e.slice(r));break}if(u>r&&s(e.slice(r,u)),e.startsWith("<!--",u)){let l=e.indexOf("-->",u);if(l===-1)throw new re(`unterminated comment at ${u}`);o(new Dr(e.slice(u+4,l))),r=l+3;continue}if(e[u+1]==="/"){let l=e.indexOf(">",u);if(l===-1)throw new re(`unterminated closing tag at ${u}`);let f=e.slice(u+2,l).trim().toLowerCase(),d=i.pop();if(!d||d.localName!==f)throw new re(`</${f}> does not close <${d?.localName??"nothing"}>`);r=l+1;continue}r=c(u)}if(i.length>0)throw new re(`unclosed <${i[i.length-1].localName}>`);let a=n[0];if(n.length!==1||!(a instanceof At))throw new re(`expected exactly one root element, got ${n.length}`);return a;function s(u){u!==""&&o(new $t(Va(u)))}function c(u){let l=/[\s/>]/.exec(e.slice(u+1));if(!l)throw new re(`unterminated tag at ${u}`);let f=e.slice(u+1,u+1+l.index).toLowerCase(),d=new At(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 p=e.slice(v,y);if(p==="")throw new re(`malformed attribute at ${y}`);if(e[y]==="="){if(e[y+1]!=='"')throw new re(`attribute ${p} must have a double-quoted value`);let b=e.indexOf('"',y+2);if(b===-1)throw new re(`unterminated value for ${p}`);d.setAttribute(p,Va(e.slice(y+2,b))),y=b+1}else d.setAttribute(p,"")}return o(d),ku.has(f)||i.push(d),y}}var Au=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Fa=/&/g,Ua=/</g,Ka=/>/g,Ru=/"/g;function Ni(e){return e.replace(Fa,"&amp;").replace(Ua,"&lt;").replace(Ka,"&gt;")}function qa(e){return e.replace(Fa,"&amp;").replace(Ru,"&quot;").replace(Ua,"&lt;").replace(Ka,"&gt;")}function Cu(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Tu(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(`${Cu(r)}: ${n}`)}return t.join("; ")}function Ou(e){let t="",r=Tu(e.style);for(let[n,i]of e.attributes)n==="style"&&r||(t+=` ${n}="${qa(i)}"`);if(r){let n=e.attributes.get("style"),i=n?`${n.replace(/;\s*$/,"")}; ${r}`:r;t+=` style="${qa(i)}"`}return t}function Y(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return Ni(e);if(typeof e=="number")return Ni(String(e));if(typeof e=="function")return Y(e());if(Array.isArray(e))return e.map(Y).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case Oi:return Ni(e.data??"");case _i:return`<!--${e.data??""}-->`;case kt:{Et(e);let t=e.localName,r=`<${t}${Ou(e)}>`;if(Au.has(t))return r;let n=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(Y).join("");return`${r}${n}</${t}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(Y).join(""):""}var Rt="__FX_DATA__";function Ir(e){return e.replace(/[<>&\u2028\u2029]/g,t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"))}var Di;function Mr(){let e=globalThis.__FX_DATA__;if(e&&typeof e.nodeType!="number")return e;if(Di!==void 0)return Di;let t=null;if(typeof document<"u"){let r=document.getElementById(Rt)?.textContent;if(r)try{t=JSON.parse(r)}catch{t=null}}return Di=t}var Pr=Symbol.for("fluixi.hydrationKeys");function Mi(e){let t=e;for(;t;){let r=t.contexts?.get(Pr);if(r)return r;if(!t.parent){let n={id:"",next:0};return(t.contexts??=new Map).set(Pr,n),n}t=t.parent}return{id:"",next:0}}function jr(){return E()?B()?.hydrationKeys!==!1:h.active}function Lr(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 _u(e){if(!jr())return null;let t=Mi(k()),r=t.id+(t.next++).toString(36);return e?`${Lr(r)}-${e}`:Lr(r)}var Nu=0;function Ja(){if(!jr())return`fx-c${(Nu++).toString(36)}`;let e=Mi(k());return e.ids=(e.ids??0)+1,`fx-${Lr(`${e.id}#${e.ids}`)}`}var za=new Map;function Du(e){let t=za.get(e);return t===void 0&&za.set(e,t=Lr(e).slice(0,6)),t}function Ga(e){let t=e.getAttribute(K)??"",r=t.indexOf("-");return r<0?"":t.slice(r+1)}function Pi(e){let t=e.getAttribute(K);t&&P?.get(t)===e&&P.delete(t)}function Iu(){if(!jr())return null;let e=k();if(!e)return null;let t=Mi(e),r={id:t.id+(t.next++).toString(36)+".",next:0},n=F(e);return(n.contexts=new Map).set(Pr,r),n}function Xa(e){let t=k();t&&(t.contexts??=new Map).set(Pr,{id:e,next:0})}var P=null;function Li(e){P??=new Map;for(let t of e.querySelectorAll(`[${K}]`)){let r=t.getAttribute(K);P.has(r)||P.set(r,t)}}function Hr(){P=null}function Wr(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 Mu(e){if(!(!P||e.length===0))for(let[t,r]of P)e.some(n=>n===r||n.contains(r))&&P.delete(t)}function Pu(e,t){if(!e||!P)return null;let r=P.get(e);return!r||r.localName!==t.toLowerCase()?null:(P.delete(e),r)}var Lu=Symbol.for("fluixi.owner");function Ii(e){let t=k();t&&(e[Lu]=t)}function ju(e){if(e instanceof Element){e.localName.includes("-")&&Ii(e);for(let t of e.querySelectorAll("*"))t.localName.includes("-")&&Ii(t)}}var Hu=/<[a-z][\w.]*-/i;function Wu(e,t){Hu.test(t)&&ju(e)}function Vu(e,t){let r=e[Ne];return r!==void 0&&(t[Ne]=r),t}function Bu(e,t){let r=De(e.nextSibling,t);if(typeof r=="function"){let n=r;return Vu(n,(...o)=>h.active?De(e.nextSibling,()=>{let a=n(...o);for(;typeof a=="function";)a=a();return a}):n(...o))}return r}function ue(){ms({keyed:jr,next:_u,salt:Du,claim:Pu,keep:Mu,scope:Iu,handOwner:Ii,handOwnerTree:Wu,holeScope:Bu,resume:De})}var Ya=!1;function ec(){Ya||(Ya=!0,qo({createElement:(e,t)=>new At(e,t),createText:e=>new $t(e),createRaw:e=>new La(e),parseTemplate:(e,t)=>Ba(e,t),createComment:e=>new Dr(e)}))}function tc(e,t={}){let r=E();ec(),ue(),de(!0);let n=bt(t.event);n.hydrationKeys=t.hydrationKeys!==!1;try{return xt(n,()=>W(i=>{try{let o=typeof e=="function"?e():e;return Y(o)}finally{i()}}))}finally{wt(n),de(r)}}var Za=!1,Qa=new WeakMap;function qu(){Za||(Za=!0,yn(e=>{B()?.pending.add(e)}),Ze(()=>B()?.nextResourceId()??""),wn((e,t)=>{e&&B()?.data.set(e,t)}),kn(()=>{let e=B();if(!e)return;let t=Qa.get(e);return t||Qa.set(e,t=En()),t}))}var ji=null;function rc(e){ji=e}function Hi(e){if(e.data.size===0)return"";let t={};for(let[n,i]of e.data){let o=i;if(ji)try{o=ji(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=Ir(JSON.stringify(t));return r==="{}"?"":`<script type="application/json" id="${Rt}">${r}<\/script>`}var Fu=50;async function nc(e,t={}){let r=E();ec(),ue(),de(!0),qu();let n=bt(t.event);n.hydrationKeys=t.hydrationKeys!==!1;try{return await xt(n,async()=>{t.preload&&await t.preload(t.event);let i,o=null,a=()=>{};W(l=>{a=l,o=k(),i=typeof e=="function"?e():e});let s=()=>{try{R(o,()=>Y(i))}catch{}};s();let c=0;for(;n.pending.size>0&&c++<Fu;){let l=Array.from(n.pending);n.pending.clear(),await Promise.allSettled(l),await Bt(),s()}let u=R(o,()=>Y(i))+Hi(n);return a(),u})}finally{wt(n),de(r)}}function Br(){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 Vr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);var Uu=Symbol.for("fluixi.ownsContent");function ac(e){return e.localName.includes("-")?e.hasAttribute("data-fx-ssr")||e[Uu]===!0:!1}var ic=Symbol.for("fluixi.serverContent");function cc(e){let t=e;t[ic]||(t[ic]=Array.from(e.childNodes))}function Ku(e){Br();let t=h.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(Pi(t),Vr.has(e.toLowerCase())||ac(t)?(Vr.has(e.toLowerCase())||cc(t),h.cursor=t.nextSibling):(h.parents.push(t),h.cursor=t.firstChild),t):null}function zu(e){Vr.has(e.localName)||ac(e)?(Vr.has(e.localName)||cc(e),h.cursor=e.nextSibling):(h.parents.push(e),h.cursor=e.firstChild)}function Ju(e,t){Br();let r=h.cursor;if(r&&r.nodeType===1&&r.tagName.toLowerCase()===e.toLowerCase()){let n=Ga(r);return t&&n&&n!==t?null:(Pi(r),h.cursor=r.nextSibling,r)}return null}function Gu(e){if(e===""){let r=h.cursor;return r&&r.nodeType===3&&r.data!==""?(h.cursor=r.nextSibling,r.data="",r):null}Br();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&&(t.data=e),t)}return null}function Xu(e){Br();let t=h.cursor;return t&&t.nodeType===8&&t.data===e?(h.cursor=t.nextSibling,t):null}var oc=!1;function lc(){oc||(oc=!0,vs({hydrateElement:Ku,hydrateText:Gu,hydrateMarker:Xu,hydrateStatic:Ju,enterElement:zu}))}var sc=()=>typeof location>"u"?null:`${location.pathname}${location.search}`;function xe(e,t,r){lc(),h.active=!0,h.cursor=t.firstChild,h.parents=[],ue(),Hr(),Li(t);let n=Mr(),i=r?.resourceNamespace,o=0;Ze(()=>i?`${i}:r${o++}`:`r${o++}`);let a=sc();gn(n?s=>s in n&&sc()===a?{value:n[s]}:void 0:null);try{return be(e,t)}finally{h.active=!1,h.cursor=null,h.parents=[],Kn()}}function uc(e,t){ue(),lc(),Li(e);let r={active:h.active,cursor:h.cursor,parents:h.parents};h.active=!0,h.cursor=e.firstChild,h.parents=[];try{N(e,t()),Wr(e)}finally{h.active=r.active,h.cursor=r.cursor,h.parents=r.parents,r.active||Kn()}}var Wi="fluixi-island";function pc(e){let t=e.component,r=e.props??{},n=e.name,i=ve(Wi),o=n??t.name??"Island";j(i,"name",o),j(i,"props",JSON.stringify(r??{}));let a=E()?B():void 0;if(a){let s=a.nextIslandNamespace(o);N(i,()=>a.withResourceScope(s,()=>t(r)))}else N(i,()=>t(r));return i}var fc=!1;function Yu(){if(fc||typeof document>"u")return;fc=!0;let e=document.createElement("style");e.textContent=`${Wi}{display:contents}`,document.head.appendChild(e)}function dc(e){if(typeof document>"u")return;Yu();let t=document.querySelectorAll(Wi),r=new Map;t.forEach(n=>{let i=n.getAttribute("name")??"",o=r.get(i)??0;r.set(i,o+1);let a=e[i];if(!a){typeof process>"u"&&console.warn(`[fluixi] island "${i}" has no component in the registry, left static.`);return}let s={};try{s=JSON.parse(n.getAttribute("props")||"{}")}catch{}xe(()=>a(s),n,{resourceNamespace:`${i}#${o}`})})}function hc(e,...t){throw new Error("html`` was not compiled, enable the html format: fluixi({ format: 'html' }).")}function mc(e,...t){throw new Error("svg`` was not compiled, enable the html format: fluixi({ format: 'html' }).")}function yc(e,...t){throw new Error("css`` was not compiled: component styles need @fluixi-css/vite next to the fluixi plugin.")}var Zu={createComponent:we,createElement:Wn,createNativeElement:ve,createTemplate:ut,cloneTemplate:nr,templateNode:ii,template:oi,holeContent:dt,holeEnd:pt,holeScope:ft,createPortal:li,render:be,hydrate:xe,insert:N,appendChildren:Bn,removeChildren:Vn,spread:ai,applyProps:mt,mergeProps:ci,bindPair:ui,setProperty:se,setDynamicProperty:je,setAttribute:j,setDynamicAttribute:Le,removeAttribute:Hn,getAttribute:jn,setClassName:ye,addClass:Mn,removeClass:Pn,toggleClass:Ln,setStyles:Jt,delegateEvents:lt,addDelegatedEventListener:rr,removeDelegatedEventListener:at,handleRef:ge,resetIntegration:wi,isIntegrationInitialized:Si},Qu=Zu;var qr={kind:"eager"},ef=["pointerdown","focusin","keydown"],vc=new Set(["eager","idle","visible","interaction","media","never"]),Be=class extends Error{};function gc(e,t){let r=e.slice(5);if(!vc.has(r))throw new Be(`Unknown load strategy 'load:${r}'. Expected one of ${[...vc].join(", ")}.`);switch(r){case"eager":return qr;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?tf(t):[...ef]};case"media":if(!t)throw new Be(`'load:media' needs a query, e.g. load:media="(min-width: 1024px)".`);return{kind:"media",query:t};default:throw new Be(`Unhandled load strategy '${r}'.`)}}function tf(e){let t=e.split(/[\s,]+/).map(r=>r.trim()).filter(Boolean);if(t.length===0)throw new Be("'load:interaction' was given no event names.");return t}function bc(e){return e.kind!=="eager"}var Bi=["Show","For","Index","Switch","Match","Portal","Dynamic","ErrorBoundary"],qi=["Suspense","SuspenseList","Await"],Fr=["Router","Outlet","Redirect","Link"],Ty=[...Bi,...qi,...Fr],Fi=new Set([...Bi,...qi]);function Sc(e={}){let{controlFlowModule:t="@fluixi/dom",coreModule:r="@fluixi/core",routerModule:n="@fluixi/core/router"}=e,i={};for(let o of Bi)i[o]=t;for(let o of qi)i[o]=r;for(let o of Fr)i[o]=n;return i}function wc(e,t={}){let{resolver:r,isBound:n,modules:i,strategyFor:o}=t,a=Sc(i),s=new Map,c=new Set,u=f=>{let{name:d}=f;if(!d||d.includes(".")||n?.(d))return;let y=l(d);if(!y){c.add(d);return}let v=y.origin==="builtin"&&Fi.has(d)?qr:o?.(f)??qr;f.source={...y,loading:v},s.set(d,f.source)},l=f=>{if(Fi.has(f))return{module:a[f],export:f,origin:"builtin"};let d=r?.resolve(f);if(d)return{module:d.module,export:d.export,origin:"rule"};if(Fr.includes(f))return{module:a[f],export:f,origin:"builtin"}};return Ur(e,f=>{f.kind==="component"&&u(f)}),{resolved:s,unresolved:[...c]}}function Ur(e,t){let r=Array.isArray(e)?e:[e];for(let n of r){t(n);let i=n.children;i&&Ur(i,t)}}function xc(e){let t=[];Ur(e,o=>{o.kind==="component"&&o.source&&t.push(o)});let r=new Set,n=new Set;for(let o of t){let{module:a,loading:s}=o.source;s.kind==="eager"&&r.add(a),s.kind==="never"&&n.add(a)}let i=new Map;for(let o of t){let a=o.source;!bc(a.loading)||a.loading.kind==="never"||r.has(a.module)&&(a.loading={kind:"eager"},i.set(a.module,(i.get(a.module)??0)+1))}return{collapsed:i,conflicted:[...n].filter(o=>r.has(o))}}function rf(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 Ec(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 s of i.children)n(s)||(o=!1);let a;for(let s of i.props)if(a=rf(s),a)break;return!a&&!o&&(a=nf(i)),i.static=!a,a?r.set(i,a):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 nf(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 kc={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 Kr(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(kc,i)?kc[i]:void 0;return o!==void 0&&o<=1114111?String.fromCodePoint(o):t}):e}var q="@fluixi/reactive/signal",Ui={$signal:{export:"signal",module:q,returns:"signal-handle"},$memo:{export:"memo",module:q,returns:"memo-handle"},$effect:{export:"effect",module:q,returns:"effect"},$store:{export:"store",module:"@fluixi/reactive/store",returns:"store-handle"},$resource:{export:"resource",module:q,returns:"resource-handle"},$cachedResource:{export:"cachedResource",module:"@fluixi/reactive/cached-resource",returns:"resource-handle"},$selector:{export:"createSelector",module:q,returns:"memo-accessor"},$deferred:{export:"createDeferred",module:q,returns:"memo-accessor"},$untrack:{export:"untrack",module:q,returns:"plain"},$untrackStore:{export:"untrackStore",module:"@fluixi/reactive/store",returns:"plain"},$batch:{export:"batch",module:q,returns:"plain"},$cleanup:{export:"onCleanup",module:q,returns:"plain"},$root:{export:"root",module:q,returns:"plain"},$context:{export:"context",module:q,returns:"plain"},$renderEffect:{export:"renderEffect",module:q,returns:"effect"},$computed:{export:"computed",module:q,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 Hy=new RegExp(`\\$(?:${Object.keys(Ui).map(e=>e.slice(1)).join("|")})\\s*\\(`);var $c="__fx_source";var sf="__fx_hole",Ee=(e,t,r,n)=>`(globalThis.${sf} ?? ((f) => f))(${e},${t},${r}${n===void 0?"":`,${JSON.stringify(n)}`})`,af="__fx_props",Ac=(e,t)=>`(globalThis.${af} ?? ((p) => p))(${e},${JSON.stringify(t)})`;var Ki={version:1,module:"@fluixi/dom",symbols:["createNativeElement","insert","spread","setAttribute","delegateEvents","createComponent","createMemo","untrack","Show","For","Index","Switch","Match","Dynamic","ErrorBoundary"]},Xy={version:2,module:"@fluixi/dom",symbols:[...Ki.symbols,"template","cloneTemplate","walk"]};var cf=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Rc={className:"class",htmlFor:"for"},zi=new Set(["innerHTML","outerHTML","innerText","textContent","value","checked","selected","muted","defaultValue","defaultChecked","children","ref"]),lf=new Set(["script","style","textarea","title"]);function Ji(e){return lf.has(e)}function Gi(e){return Rc[e]??e}function fe(e){return e.kind!=="attr"||e.expr!==void 0||e.name.includes(":")?!1:!zi.has(e.name)}function Xi(e){if(!e.static||Ji(e.tag))return!1;for(let t of e.props)if(!fe(t))return!1;for(let t of e.children)if(t.kind!=="text"&&!(t.kind==="element"&&Xi(t)))return!1;return!0}function qe(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 qe(e)}var ff=new Set(["draggable","spellcheck","contenteditable"]);function pf(e){return e.startsWith("aria-")||ff.has(e.toLowerCase())}function df(e){let t=Rc[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,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function mf(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function zr(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-->",vf="<!--fx/-->";function Fe(e){return e.kind==="expr"||e.kind==="component"||Yi(e)}function Yi(e){return e.kind==="element"&&e.tag.includes("-")}function Zi(e){return Yi(e)?!0:"children"in e&&Array.isArray(e.children)&&e.children.some(Zi)}function gf(e){return e.kind==="text"||e.kind==="element"&&Cc(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"?fe(e)?"serialize":"class":t==="classList"?fe(e)?"serialize":e.reactive?"classListDynamic":"classList":t==="style"?fe(e)?"serialize":e.reactive?"styleDynamic":"style":t.includes(":")||zi.has(t)?null:bf.has(t)?"property":e.expr===void 0?fe(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 Tt(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 Cc(e){return e.svg||Yi(e)||Ji(e.tag)||!Tt(e)?!1:e.children.every(t=>gf(t)||Fe(t))}function Tc(e){if(Fe(e))return!0;let t=e.children;return t?t.some(Tc):!1}function Oc(e){if(e.kind!=="element")return!1;let t=Tt(e);return t&&t.bindings.length>0?!0:e.children.some(Oc)}function Ct(e){return Tc(e)||Oc(e)}function _c(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"||_c(t))}function Nc(e,t=!1){if(!Cc(e)||!_c(e)||!Ct(e))return null;let r=[],n=[],i=[],o=0,a=l=>{let f=`_n$${o++}`;return r.push({ref:f,expr:l}),f},s=new Set;return t?c(e,"_el$"):u(e,"_el$"),{html:t?Ef(e,s):xf(e),tag:e.tag,steps:r,holes:n,bindings:i};function c(l,f){let d=Tt(l);if(d)for(let S of d.bindings)i.push({ref:f,prop:S.prop,kind:S.kind});let y=-1;l.children.forEach((S,g)=>{Ct(S)&&(y=g)});let v=null,p=!1,b=null,T=()=>v?`${v}.nextSibling`:`${f}.firstChild`;for(let S=0;S<=y;S++){let g=l.children[S];if(Fe(g)){let H=l.children[S+1];if(!H){n.push({parentRef:f,node:g});continue}if(Fe(H)||H.kind==="text"&&p){s.add(g);let J=a(T());n.push({parentRef:f,anchorRef:J,node:g}),v=J,p=!1;continue}b=a(T()),n.push({parentRef:f,anchorRef:b,node:g});continue}let L=b??a(T());b=null,g.kind==="element"&&Ct(g)&&c(g,L),v=L,p=g.kind==="text"}}function u(l,f){let d=Tt(l);if(d)for(let p of d.bindings)i.push({ref:f,prop:p.prop,kind:p.kind});let y=-1;l.children.forEach((p,b)=>{Ct(p)&&(y=b)});let v=null;for(let p=0;p<=y;p++){let b=l.children[p],T=v?`${v}.nextSibling`:`${f}.firstChild`;if(Fe(b)){let g=a(T),L=a(`holeEnd(${g})`);n.push({parentRef:f,startRef:g,endRef:L,node:b}),v=L;continue}let S=a(T);b.kind==="element"&&Ct(b)&&u(b,S),v=S}}}function xf(e){return qe(Qi(e)).split(eo).join(yf+vf)}function Ef(e,t){return qe(Qi(e,t)).split(eo).join("<!>").split(Dc).join("")}function Qi(e,t){let r=Tt(e);return{...e,props:r?r.serialize:[],children:e.children.map(n=>Fe(n)?{kind:"text",value:!t||t.has(n)?eo:Dc}:n.kind==="element"?Qi(n,t):n)}}var eo="\0fx-hole\0",Dc="\0fx-none\0";function Ic(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 Mc(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 a=Mc(e,r);if(a<0)return-1;r=a}else if(o==='"'||o==="'"){let a=Ic(e,r);if(a<0)return-1;r=a}else o==="{"?i++:o==="}"&&i--,r++}}else r++}}return-1}function kf(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 $f(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=Ic(e,n);if(o<0)return null;n=o,r=i}else if(i==="`"){let o=Mc(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==="/"&&!$f(r)){let o=kf(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 Rf(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function Jr(e){return Rf(e)?e:JSON.stringify(e)}function Lc(e){if(e.expr!==void 0){if(e.name==="ref"&&e.at)return Ee(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?Ee(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)}var Tf=/^(?:-?\d[\d_]*(?:\.\d+)?(?:e[+-]?\d+)?|"(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)*'|true|false|null)$/;function Of(e){return e.expr===void 0||Tf.test(e.expr.trim())}function jc(e){return e===void 0?String(e):/^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*)*$/.test(e.trim())?e:`() => (${e})`}function _f(e,t,r){let n=e.filter(s=>s.kind==="spread"),o=e.filter(s=>s.kind!=="spread").map(s=>`${Jr(s.name)}: ${Lc(s)}`);t!=null&&o.push(`children: ${t}`);let a=`{ ${o.join(", ")} }`;return n.length>0?(r.add("mergeProps"),`mergeProps(${n.map(s=>jc(s.expr)).join(", ")}, ${a})`):a}function Nf(e,t){return t?Ee(e,t.line,t.column):e}function Hc(e,t,r){if(e.length===1)return Ue(e[0],t,r);let n=!1;return`[${e.map(o=>{let a=Ue(o,t,r);return o.kind==="element"&&n?(t.add("deferElement"),`deferElement(() => ${M(a,"arrowBody")})`):((o.kind==="component"||o.kind==="expr"&&o.reactive)&&(n=!0),a)}).join(", ")}]`}function Df(e,t,r,n,i,o){n.add("createComponent");let a=t.filter(v=>v.kind==="spread"),s=t.filter(v=>v.kind!=="spread"),c=[],u=[];for(let v of s)(Of(v)?c:u).push([v.name,Cf(v)]);r.length>0&&u.push(["children",Hc(r,n,i)]);let l=c.map(([v,p])=>`${Jr(v)}: ${p}`),f=`{ ${[...l,...u.map(([v,p])=>`get ${Jr(v)}() { return ${p}; }`)].join(", ")} }`;if(u.some(([,v])=>/\bthis\b/.test(v))){let v=u.map(([b,T])=>`${JSON.stringify(b)}: () => (${T})`),p=u.map(([b])=>`get ${Jr(b)}() { return _$t[${JSON.stringify(b)}](); }`);f=`((_$t) => ({ ${[...l,...p].join(", ")} }))({ ${v.join(", ")} })`}a.length>0&&(n.add("mergeProps"),f=`mergeProps(${a.map(v=>jc(v.expr)).join(", ")}, ${f})`);let d={};for(let v of s)v.at&&(d[v.name]=[v.at.line,v.at.column]);Object.keys(d).length&&(f=Ac(f,d));let y=o?`globalThis.${$c}?.(${JSON.stringify(o.file)},${o.line},${o.column},${JSON.stringify(e)}), `:"";return y?`(${y}createComponent(${e}, ${f}))`:`createComponent(${e}, ${f})`}function to(e){let t=e.prop.name;return e.kind==="boolAttr"||t.startsWith("prop:")||t.startsWith("attr:")?t.slice(5):Gi(t)}function Pc(e,t){let{ref:r,prop:n,kind:i}=e,o=Lc(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(to(e))}, ${o});`;case"property":return t.add("setDynamicProperty"),`setDynamicProperty(${r}, ${JSON.stringify(to(e))}, ${o});`;case"boolAttr":return t.add("setDynamicBoolAttribute"),`setDynamicBoolAttribute(${r}, ${JSON.stringify(to(e))}, ${o});`;case"event":return Vc&&n.event.delegated?`${r}.$$${n.event.name} = ${o};`:(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"),n.assign?`handleRef(${o}, ${r}, (_v) => (${n.expr} = _v));`:`handleRef(${o}, ${r});`;case"use":return t.add("applyUse"),`applyUse(${r}, ${o});`}}function If(e,t){let r=Gi(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 Wc=!1,Gr=!1,Vc=!1;function Ue(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?Ee(n,e.at.line,e.at.column):n}case"fragment":return e.children.length===0?"null":Hc(e.children,t,r);case"component":return Nf(Df(e.name,e.props,e.children,t,r,e.at),e.bindAt??e.at);case"element":{if(r&&e.static&&!e.svg&&Xi(e)&&!Zi(e)){let s=`_tmpl$${r.length}`;r.push({id:s,html:qe(e),tag:e.tag,svg:!1});let c=zr(e);return Gr?`${s}(${c?JSON.stringify(c):""})`:(t.add("templateNode"),c?`templateNode(${s}, ${JSON.stringify(e.tag)}, false, false, ${JSON.stringify(c)})`:`templateNode(${s}, ${JSON.stringify(e.tag)})`)}if(r&&Wc){let s=Nc(e,Gr);if(s&&Gr){t.add("insert");let c=`_tmpl$${r.length}`;r.push({id:c,html:s.html,tag:s.tag,svg:!1});let u=zr(e),l=[`const _el$ = ${c}(${u?JSON.stringify(u):""});`];for(let f of s.steps)l.push(`const ${f.ref} = ${f.expr};`);for(let f of s.bindings)l.push(Pc(f,t));for(let f of s.holes){let d=f.anchorRef?`, ${f.anchorRef}`:"";l.push(`insert(${f.parentRef}, ${Ue(f.node,t,r)}${d});`)}return l.push("return _el$;"),`(() => { ${l.join(" ")} })()`}if(s){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:s.html,tag:s.tag,svg:!1});let u=zr(e),l=[`const _el$ = templateNode(${c}, ${JSON.stringify(s.tag)}, true${u?`, false, ${JSON.stringify(u)}`:""});`];for(let f of s.steps)l.push(`const ${f.ref} = ${f.expr};`);for(let f of s.bindings)l.push(Pc(f,t));for(let f of s.holes)l.push(`insert(${f.parentRef}, holeScope(${f.startRef}, () => ${M(Ue(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=[],a=e.at?`${n}, ${e.svg}, ${JSON.stringify(e.at)}`:e.svg?`${n}, true`:n;if(o.push(`const ${i} = createNativeElement(${a});`),e.props.length>0)if(!e.svg&&e.props.every(fe))for(let s of e.props)o.push(If(i,s));else{t.add("spread");let s=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: ${_f(e.props,null,t)}${s}${u}${l} });`)}for(let s of e.children){t.add("insert");let c=Ue(s,t,r),u=s.kind==="expr"&&(s.reactive||!Pf(s.code))||s.kind==="component";o.push(u?`insert(${i}, ${c}, null);`:`insert(${i}, ${c});`)}return o.push(`return ${i};`),`(() => { ${o.join(" ")} })()`}}}var Mf=/^\s*(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`$]*`|-?\d[\d_.eE+-]*|true|false|null|undefined)\s*$/,Pf=e=>Mf.test(e);function Xr(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 Yr={name:"imperative",contract:Ki,emit(e,t){let r=new Set,n=t?.templateClone!==!1?[]:void 0;return Wc=t?.partialTemplates===!0,Vc=t?.assignEvents===!0,Gr=t?.client===!0,{code:Ue(e,r,n),imports:Array.from(r),templates:n}}};var ro=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mousedown","mouseup"]);function no(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 Lf=new Set(["a","button","input","select","textarea","summary","details","option","label"]),jf=new Set(["keydown","keyup","keypress"]);function Ke(e,t){return e.attributes.find(r=>"name"in r&&r.name===t)}function Hf(e){return e.attributes.some(t=>t.kind==="Spread")}function Zr(e,t){let r=Ke(e,t);if(!r||r.kind!=="Attribute"||!r.value)return;let n=r.value;return n.kind==="static"?n.value:void 0}function Wf(e){let t=Zr(e,"role");return t==="presentation"||t==="none"?!0:Zr(e,"aria-hidden")==="true"}function Bc(e,t){return e.attributes.some(r=>r.kind==="EventBinding"&&t(r.name))}function qc(e){let t=[],r=(i,o,a)=>{t.push({code:o,message:a,severity:"warning",loc:i.loc})},n=i=>{for(let o of i){o.kind==="Element"&&Vf(o,r);let a="children"in o?o.children:void 0;a&&n(a)}};return n(e.children),t}function Vf(e,t){if(Hf(e))return;let r=e.tag.toLowerCase();r==="img"&&!Ke(e,"alt")&&!Wf(e)&&t(e,"a11y-img-alt",'An `img` needs an `alt`. Use `alt=""` when the image is decorative.'),r==="a"&&!Ke(e,"href")&&!Ke(e,"role")&&t(e,"a11y-anchor-href","An `a` without `href` is not a link. Use a `button` for an action."),r==="iframe"&&!Ke(e,"title")&&t(e,"a11y-iframe-title","An `iframe` needs a `title` describing its content.");let n=Zr(e,"tabindex")??Zr(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."),!Lf.has(r)&&Bc(e,i=>i==="click")&&!Ke(e,"role")&&!Bc(e,i=>jf.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 io(e){let t=(r,n)=>{r.parent=n;let i=Fc(r);for(let o of i)t(o,r)};return t(e,null),e}function Fc(e){switch(e.kind){case"Root":case"Element":case"Component":case"Fragment":return e.children;default:return[]}}var Uc=new Set(["capture","once","passive","prevent","stop","self"]);function pe(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 Kc=(e,t)=>({kind:"Attribute",name:t?e.name.slice(1):e.name,value:e.value,boolean:t,loc:e.loc}),Qr=[{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 a of i)Uc.has(a)||e.report("invalid-directive",`Unknown event modifier ".${a}" — expected one of ${[...Uc].join(", ")}`);return{kind:"EventBinding",name:o,syntax:t,modifiers:i,hole:pe(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:pe(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:pe(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:pe(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:pe(e,"if directive"),loc:e.loc})},{id:"each",elementOnly:!0,match:e=>e==="each",build:e=>({kind:"EachDirective",hole:pe(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:pe(e,"ref binding"),loc:e.loc})},{id:"property",match:e=>e[0]===".",build:e=>({kind:"PropertyBinding",name:e.name.slice(1),hole:pe(e,"property binding"),loc:e.loc})},{id:"boolean",match:e=>e[0]==="?",build:e=>Kc(e,!0)}];function oo(e,t=Qr,r={component:!1}){for(let n of t)if(!(n.elementOnly&&r.component)&&n.match(e.name))return n.build(e);return Kc(e,!1)}var so=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 ao=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"]),zc=new Set(["script","style","textarea","title"]),Jc=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Gc(e){return e.length>0&&(e[0]!==e[0].toLowerCase()||e.includes("."))}var Bf=/[A-Za-z0-9\-_:@.?]/,qf=class{constructor(e,t){this.diagnostics=[],this.open=[],this.r=new so(e),this.svg=t.svg??!1,this.directives=t.directives??Qr,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 io(r),this.validateTree(r),this.accessibility&&this.diagnostics.push(...qc(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(a=>a.kind==="ElseDirective")&&(n!=null&&(n.kind==="Element"||n.kind==="Component")&&n.attributes.some(s=>s.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=Gc(t),n=this.parseAttributes(r);this.foldEachKey(n,e),this.r.skipWhitespace();let i=t.toLowerCase(),o=!r&&zc.has(i),a=!r&&Jc.has(i),s=!1,c=[];if(this.r.startsWith("/>"))this.r.advance(),this.r.advance(),s=!0;else if(this.r.peek()===">"&&this.r.advance(),!a)if(this.open.push(t),c=o?this.parseRawText(t):this.parseChildren(),this.open.pop(),this.r.startsWith("</")){let f=this.r.mark(),d=this.consumeCloseTag();d&&d!==t&&(this.open.includes(d)?(this.r.reset(f),this.report("unclosed-tag","error",`Unclosed <${t}>`,this.r.span(e))):this.report("mismatched-close-tag","error",`Expected </${t}>, got </${d}>`,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:s,loc:u};let l=this.svg||ao.has(t)?"svg":"html";return{kind:"Element",tag:t,namespace:l,attributes:n,children:c,selfClosing:s,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 a=this.r.takeHole();t.push({kind:"Expression",hole:a.index,loc:a.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 s=this.r.takeHole();t.push({kind:"Spread",hole:s.index,loc:s.loc});continue}if(this.r.startsWith("...")){let s=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(s)})}else this.report("invalid-binding","error","Spread `...` must be followed by ${…}",this.r.span(s));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 a={name:n,nameLoc:i,value:o,loc:this.r.span(r),report:(s,c)=>this.report(s,"error",c,this.r.span(r))};t.push(oo(a,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,a=0;for(let l of e)l.kind==="EachDirective"?(r=l,i++):l.kind==="IfDirective"?n++:l.kind==="ElseDirective"?o++:l.kind==="RefBinding"&&a++;let s=this.r.span(t);i>1&&this.report("duplicate-directive","error","Multiple `each` directives on one element",s),n>1&&this.report("duplicate-directive","error","Multiple `if` directives on one element",s),a>1&&this.report("duplicate-directive","error","Multiple `ref` bindings on one element",s),n>0&&o>0&&this.report("invalid-directive","error","`if` and `else` cannot be on the same element",s);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",s);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=>Bf.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 en(e,t={}){return new qf(e,t).parse()}function Ff(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 Xc(e,t={}){return en(Ff(e),t)}function Uf(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}var Kf="container";function Yc(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}=Yr.emit(e,{});for(let i of r)this.used.add(i);return Xr(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(a=>a.kind==="IfDirective");if(o&&o.kind==="IfDirective"){let a=r+1;a<e.length&&this.isBlankText(e[a])&&a++;let s=e[a],c=s&&(s.kind==="Element"||s.kind==="Component")&&s.attributes.some(u=>u.kind==="ElseDirective");t.push(this.lowerIf(n,o.hole,c?s:null)),c&&(r=a);continue}}let i=this.lowerNode(n);i&&t.push(i)}return t}isBlankText(e){return e.kind==="Text"&&!e.raw&&no(e.value)===""}lowerNode(e){switch(e.kind){case"Text":{if(e.raw)return{kind:"text",value:e.value};let t=Kr(no(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(s=>s!==t),a=this.lowerComponent({...e,kind:"Component",tag:"Dynamic",tagHole:null,attributes:o});return a.props.unshift({name:"component",kind:"attr",expr:`() => ${M(this.hole(t.value.hole).code,"arrowBody")}`}),a}let r=this.lowerEach(e),n=r?[r]:this.lowerChildren(e.children);if(e.tag===Kf)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},d={name:u,kind:"attr",expr:this.emit(f),jsxElement:!0},y=r.findIndex(v=>v.name===u);y>=0?r[y]=d:r.push(d)}let o=e.attributes.find(u=>u.kind==="LoadDirective");if(o?.dynamic)throw new Be(`'load:${o.strategy}' needs a literal value, not an expression: the strategy is compile-time.`);let a=o?gc(`load:${o.strategy}`,o.modifier):void 0,s=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}:{},...s?{bindAt:s}:{},...a?{load:a}:{},...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)},a=o.kind==="Element"?this.lowerElement(o):this.lowerComponent(o),s=t.get(i.value.value)??[];s.push(a),t.set(i.value.value,s);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 s=this.stripAndLower(r,c=>c.kind==="ElseDirective");i.push({name:"fallback",kind:"attr",expr:this.emit(s),jsxElement:!0})}let o=this.stripAndLower(e,s=>s.kind==="IfDirective"),a=this.tagAt(e);return{kind:"component",name:"Show",props:i,children:[o],...a?{at:a}:{},...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 a=[{kind:"expr",code:o,reactive:!1}],s=this.tagAt(e);return{kind:"component",name:"For",props:n,children:a,...s?{at:s}:{},...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 d=`() => ${M(f.code,"arrowBody")}`;return`${JSON.stringify(l)}: ${f.at?Ee(d,f.at.line,f.at.column):d}`},i=[],o=[],a,s=[],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)),a??=f.at;break}case"StyleDirective":{let f=this.hole(l.hole);s.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,...a?{at:a}:{}}),s.length>0){let l=`{ ${s.join(", ")} }`,f=i.findIndex(d=>d.name==="style");if(f===-1)i.push({name:"style",kind:"attr",expr:l,reactive:!t&&r,...c?{at:c}:{}});else{let d=i[f],y=d.expr===void 0?JSON.stringify(d.literal):d.reactive?`() => ${M(d.expr,"arrowBody")}`:d.expr;i[f]={name:"style",kind:"attr",expr:`[${y}, ${l}]`,reactive:!1,...d.at?{at:d.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"+Yc(e.name),kind:"event",event:{name:t,delegated:ro.has(t)},expr:r};let i=this.wrapHandler(r,e.modifiers),o=this.eventOptions(e.modifiers),a=o?`[${i}, ${o}]`:i;return{name:"on:"+t,kind:"attr",expr:a}}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 a=`bindPair(${r})`;return[{name:e,kind:"attr",expr:`${a}[0]()`,reactive:!0,directive:`bind:${e}`,...t.at?{at:t.at}:{}},{name:"on"+Yc(i),kind:"event",event:{name:i,delegated:ro.has(i)},expr:`(e) => ${a}[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=Kr(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,a,s=t.parts.map(c=>{if("text"in c)return Uf(Kr(c.text));let u=this.hole(c.hole);return o=o||u.reactive,a??=u.at,"${"+u.code+"}"}).join("");return i.expr="`"+s+"`",i.reactive=o,a&&(i.at=a),i}};function Zc(e,t,r,n={}){let{root:i,diagnostics:o}=en(e,{svg:n.svg});for(let a of o){if(a.severity==="error"){let s=n.positionAt?.(a.loc.start);throw new Error(`html template${s?` (${s.line}:${s.column+1})`:""}: ${a.message}`)}n.onDiagnostic?.(a)}return new zf(t,r,n.sourceFile,n.positionAt).lowerRoot(i.children)}var Jf=e=>"components"in e;function Qc(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 el(e=[]){let t=new Map,r=[],n=[];for(let a of e){if(!Jf(a)){n.push(a);continue}for(let[s,c]of Object.entries(a.components)){let u=Gf(s,c),l=t.get(s);if(l&&l.module!==u.module){let f=r.find(d=>d.name===s);f?f.modules.push(u.module):r.push({name:s,modules:[l.module,u.module]});continue}t.set(s,u)}}let i=new Map;return{resolve:a=>{if(i.has(a))return i.get(a);let s=t.get(a);if(!s)for(let c of n){let u=a.match(new RegExp(c.match.source,c.match.flags.replace("g","")));if(u){s={module:Qc(c.module,u),export:c.export?Qc(c.export,u):a};break}}return i.set(a,s),s},names:()=>[...t.keys()],conflicts:()=>r}}var tl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Xf=new Uint8Array(64),Yf=new Uint8Array(128);for(let e=0;e<tl.length;e++){let t=tl.charCodeAt(e);Xf[e]=t,Yf[t]=e}var Vv=1024*16;var rl="data-fx-s";function nl(e,t){let r=n=>{let i=n.children;if(i)for(let o=i.length-1;o>=0;o--){let a=i[o];a.kind==="element"&&a.tag==="style"&&t.owner?i.splice(o,1):r(a)}t.scope&&n.kind==="element"&&n.tag!=="style"&&n.props&&!n.props.some(o=>o.name===rl)&&n.props.unshift({name:rl,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 co(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 il(Zf(e),e.holes,t)}function il(e,t,r={}){let n=new Set,i=[],o=Zc(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&&nl(o,r.templateStyles),Ec(o),wc(o,{resolver:el(r.resolve??[]),modules:{controlFlowModule:r.controlFlowModule??"@fluixi/dom",coreModule:r.coreModule??"@fluixi/core",routerModule:r.routerModule??"@fluixi/core/router"},strategyFor:u=>u.load}),xc(o);let{code:a,imports:s,templates:c}=Yr.emit(o,{templateClone:r.templateClone,partialTemplates:r.partialTemplates,assignEvents:r.assignEvents,client:r.client});for(let u of s)n.add(u);return r.hoistTemplates?{...i.length?{diagnostics:i}:{},code:a,imports:[...n],ir:o,templates:c}:{...i.length?{diagnostics:i}:{},code:Xr(a,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 lo(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");lo(n.children,t,r);break}case"Root":case"Fragment":lo(n.children,t,r);break;default:break}}function ol(e){let t=new Map,r=new Set;return lo(e.root.children,t,r),{holes:t,components:r}}var uo={...Vi,createMemo:w},ep=["For","Index","Show","Switch","Match","Portal","Dynamic","ErrorBoundary","Suspense"],fo=new Map;function al(e){for(let[t,r]of Object.entries(e))fo.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(fo.has(e))return fo.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=Xc(n,{svg:r}),o=i.diagnostics.filter(p=>p.severity==="error");if(o.length>0)throw new Error(`[fluixi] ${r?"svg":"html"}\`\`: ${o.map(p=>p.message).join("; ")}`);let{holes:a,components:s}=ol(i),{code:c,imports:u}=co({statics:n,holes:rp(t,a)},{svg:r}),l=u.filter(p=>!(p in uo));if(l.length>0)throw new Error(`[fluixi] no runtime binding for: ${l.join(", ")}`);let f=Array.from(new Set([...u,...ep])).filter(p=>p in uo),d=Array.from(s).filter(p=>!f.includes(p)),y=[...f,...d],v=new Function(...y,"$$v",`return (${c});`);return{run:p=>v(...f.map(b=>uo[b]),...d.map(np),p)}}var sl=new WeakMap;function op(e){let t="";for(let r of e)t+=typeof r=="function"?"f":"v";return t}function cl(e){return(t,...r)=>{let n=sl.get(t);n||(n=new Map,sl.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 ll=cl(!1),ul=cl(!0);return yl(sp);})();
1
+ /*! @fluixi/template-runtime v1.0.0-alpha.114 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
+ "use strict";var Fluixi=(()=>{var nn=Object.defineProperty;var pl=Object.getOwnPropertyDescriptor;var dl=Object.getOwnPropertyNames;var hl=Object.prototype.hasOwnProperty;var mo=(e,t)=>{for(var r in t)nn(e,r,{get:t[r],enumerable:!0})},ml=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of dl(t))!hl.call(e,i)&&i!==r&&nn(e,i,{get:()=>t[i],enumerable:!(n=pl(t,i))||n.enumerable});return e};var yl=e=>ml(nn({},"__esModule",{value:!0}),e);var ap={};mo(ap,{Dynamic:()=>Er,ErrorBoundary:()=>Or,For:()=>_r,Index:()=>Nr,Match:()=>dr,Portal:()=>fr,Show:()=>pr,Switch:()=>hr,batch:()=>I,define:()=>al,effect:()=>_n,html:()=>ll,hydrate:()=>xe,insert:()=>N,memo:()=>On,onCleanup:()=>C,render:()=>be,resource:()=>Rn,signal:()=>Tn,store:()=>Si,svg:()=>ul,untrack:()=>E});var Bi={};mo(Bi,{ALWAYS_ATTRIBUTE:()=>Mn,ClientOnly:()=>di,Dynamic:()=>Er,ErrorBoundary:()=>Or,ErrorResetContext:()=>Ti,FX_DATA_ID:()=>Rt,For:()=>_r,HYDRATION_KEY:()=>K,Index:()=>Nr,Island:()=>pc,JSX_PROPERTIES:()=>nt,Match:()=>dr,NoSsr:()=>ra,Portal:()=>fr,SERVER_PROPS:()=>Dn,SVG_ELEMENTS:()=>Go,SVG_NAMESPACE:()=>tt,Show:()=>pr,Switch:()=>hr,VERSION:()=>Gt,VERSION_ATTRIBUTE:()=>it,VOID_ELEMENTS:()=>Jo,addClass:()=>Pn,addDelegatedEventListener:()=>nr,addNativeEventListener:()=>or,afterHydrationPass:()=>ks,appendChildren:()=>qn,appendResponseHeader:()=>Ta,applyElementProp:()=>rt,applyProps:()=>mt,applyUse:()=>sr,asComponent:()=>st,asContext:()=>_s,asOutlet:()=>Ts,asProvider:()=>Os,asRoute:()=>Cs,asRouter:()=>As,asRoutes:()=>Rs,asSuspense:()=>Ns,beforeFirstRender:()=>$a,beginAppHydration:()=>Ss,bindPair:()=>fi,captureHydrationCursor:()=>gs,checkRenderType:()=>Ds,classMap:()=>ta,cleanChildren:()=>Q,clearHydrationKeys:()=>Wr,cloneTemplate:()=>ir,closest:()=>Yo,createComponent:()=>we,createDynamicElement:()=>xr,createElement:()=>Vn,createNativeElement:()=>ve,createPortal:()=>ui,createRequestContext:()=>bt,createTemplate:()=>ut,createUniqueId:()=>Ja,css:()=>yc,default:()=>ef,deferElement:()=>Is,delegate:()=>ns,delegateEvents:()=>lt,endAppHydration:()=>ws,endRequestContext:()=>wt,endRequestScope:()=>$i,errorResponseStatus:()=>Tr,escapeFxJson:()=>Mr,escapeHTML:()=>Zs,fnName:()=>qs,generateID:()=>js,getAttribute:()=>Hn,getGlobal:()=>fs,getLocals:()=>Ca,getOffset:()=>rs,getRequestContext:()=>H,getRequestEvent:()=>Rr,getRequestLocals:()=>Ri,getServerData:()=>Pr,getStableElementId:()=>Ls,getStyle:()=>Qo,handleRef:()=>ge,hasClass:()=>Zo,holeContent:()=>dt,holeEnd:()=>pt,holeScope:()=>ft,html:()=>hc,hydrate:()=>xe,hydrateAdvancePast:()=>Ie,hydrateChildren:()=>uc,hydrateIslands:()=>dc,indexArray:()=>Ce,initializeIntegration:()=>va,insert:()=>N,insertExpression:()=>ht,installElementObjects:()=>zs,intergartionInitialized:()=>ga,isAccessor:()=>Qs,isAppHydrationPending:()=>xs,isAttributeOnlyName:()=>_e,isComponent:()=>U,isContext:()=>Qn,isCustomElement:()=>Nn,isDOMNode:()=>ls,isDelegatedEvent:()=>Ws,isDomElement:()=>Ut,isDomNode:()=>he,isDomText:()=>Kt,isEventHandler:()=>Ko,isFunction:()=>Vs,isHydrating:()=>$s,isIntegrationInitialized:()=>wi,isJSXTemplate:()=>cs,isNativeElement:()=>Ys,isOutlet:()=>Yn,isPromise:()=>ur,isProvider:()=>Zn,isReactElement:()=>as,isRoute:()=>Xn,isRouter:()=>Jn,isRoutes:()=>Gn,isSVGElement:()=>lr,isServer:()=>x,isSuspense:()=>ei,isVisible:()=>es,iterateFn:()=>Fs,keepServerContent:()=>Ks,keyArray:()=>Re,makeArrayFlat:()=>ai,mapArray:()=>Ae,mergeProps:()=>li,observeIntersection:()=>os,observeResize:()=>ss,onRequestEnd:()=>ka,prepareRender:()=>Aa,query:()=>zt,queryAll:()=>Xo,registerCoreVersion:()=>ps,registerCreateComponent:()=>ya,registerGlobal:()=>us,removeAttribute:()=>Wn,removeChildren:()=>Bn,removeClass:()=>Ln,removeDelegatedEventListener:()=>at,removeUnclaimedKeyed:()=>Vr,render:()=>be,renderStarted:()=>Ra,renderToString:()=>tc,renderToStringAsync:()=>nc,requestScope:()=>St,resetIntegration:()=>xi,resetOnNavigation:()=>Oi,runHydrationAt:()=>De,runWithRequestContext:()=>xt,runWithoutHydration:()=>bs,scrollIntoView:()=>ts,serializeNode:()=>Y,serializeResourceData:()=>Wi,serverCustomElementProp:()=>Oe,setAttribute:()=>j,setClassList:()=>ae,setClassName:()=>ye,setDataRedactor:()=>rc,setDynamicAttribute:()=>Le,setDynamicBoolAttribute:()=>ar,setDynamicClassList:()=>Xs,setDynamicProperty:()=>je,setDynamicStyle:()=>Gs,setKeyScope:()=>Xa,setProperty:()=>se,setRequestStore:()=>ki,setRequestStoreIfUnset:()=>Ea,setResponseRedirect:()=>_a,setResponseStatus:()=>Cr,setServerMode:()=>de,setStyle:()=>ee,setStyles:()=>Jt,shouldSetAsProperty:()=>zo,splitProps:()=>cr,spread:()=>ci,stampVersions:()=>ds,styleMap:()=>ea,svg:()=>mc,takeResponseHeaders:()=>Oa,takeResponseRedirect:()=>Da,takeResponseStatus:()=>Na,takesBooleanText:()=>In,template:()=>si,templateNode:()=>oi,toAttributeName:()=>Uo,toggleClass:()=>jn,useHydrationKeys:()=>ue,versionMark:()=>Fn,versions:()=>B,waitForElement:()=>is,warnOnVersionSkew:()=>hs,whenAppHydrated:()=>Es});var Dt=Symbol.for("fluixi-proxy");var ie="1.0.0-alpha.114";var vo=ie.split(".")[0],yo=`__fluixi_signal_state_v${vo}__`,go=`__fluixi_signal_builds_v${vo}__`,vl=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function bo(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:vl,onSuspend:null,onError:null,observer:null,hot:null}}var It=globalThis;function gl(e){let t=bo(),r=e;for(let n of Object.keys(t))n in e||(r[n]=t[n]);return e}function bl(){let e=It[yo];return e?gl(e):It[yo]=bo()}var m=bl();(It[go]??=[]).push(ie);function on(){return[...new Set(It[go]??[])]}function Sl(e){return m.observer=e,()=>{m.observer===e&&(m.observer=null)}}var xo=[],Mt;function Eo(e,t){if(!m.observer)return t();let r=Mt;Mt=e;try{return t()}finally{Mt=r}}var So;function ko(e){let t=m.observer;t&&t.created(e.parents===void 0?{...e,parents:xo,origin:e.origin??Mt,scope:e.scope??So}:{...e,scope:e.scope??So})}function $o(){xo.pop()}function sn(e,t,r){m.observer?.moved?.(e,t,r)}function an(e){m.observer?.disposed?.(e)}var wl="__FLUIXI_DEVTOOLS_HOOK__",wo=globalThis[wl];if(typeof wo?.inject=="function")try{wo.inject({observeReactiveNodes:Sl,version:ie})}catch{}function Pt(){return m.observer!=null}var Ao=0,Ro=1,Je=2,Co=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))}},To=class extends Co{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++,this.observers)for(let t of[...this.observers])t.markDirty(Je);cn(this)}}peek(){return this._value}},Lt=class extends Co{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this._disposed=!1,this.state=Je,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===Ro&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===Je)break}(this.state===Je||!this._initialized)&&this.recompute(),this.state=Ao}}recompute(){if(this.sources){for(let s of this.sources)s.observers?.delete(this);this.sources.clear()}let e=m.consumer,t=m.untracked,r=!1;m.consumer=this,m.untracked=!1;let n,i=!1,o;try{n=this._fn()}catch(s){i=!0,o=s,n=this._value}finally{m.consumer=e,m.untracked=t,r&&$o()}let a=!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,a){if(this.version++,this.observers)for(let s of this.observers)s.markDirty(Je);cn(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===Ao;if(this.state=e,t){if(this.observers)for(let r of this.observers)r.markDirty(Ro);cn(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function cn(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}function jt(e){if(m.untracked)return e();m.untracked=!0;try{return e()}finally{m.untracked=!1}}function F(e){let t=Xe(e);return e&&(e.owned??=[]).push(t),t}function G(e,t=!0){Ge(e,t)}function Xe(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Ht(e,t){let r=Symbol(t??"context");return{id:r,defaultValue:e,Provider:i=>{let o=m.owner,a=Xe(o);(a.contexts=new Map).set(r,i.value),o&&(o.owned??=[]).push(a),m.owner=a;try{return i.children}finally{m.owner=o}}}}function Wt(e){let t=m.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.parent}return e.defaultValue}function Oo(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 Vt(e,t,r){let n=Xe(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 _o(e){return m.onSuspend?(m.onSuspend(e,m.owner),!0):!1}function No(e){m.onError=e}function k(){return m.owner}function R(e,t){let r=m.owner;m.owner=e;try{return t()}finally{m.owner=r}}function C(e){if(m.owner){if(m.owner.disposed){e();return}(m.owner.cleanups??=[]).push(e)}}function Ge(e,t=!0){if(!e.disposed){if(e.owned){for(let r=e.owned.length-1;r>=0;r--)Ge(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 V(e){let t=Xe(m.owner);m.owner&&(m.owner.owned??=[]).push(t);let r=m.owner;m.owner=t;try{return jt(()=>e(()=>Ge(t)))}finally{m.owner=r}}function Do(e){m.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function xl(e){e.queued||(e.queued=!0,m.queue.push(e),!m.scheduled&&m.batchDepth===0&&(m.scheduled=!0,m.hostSchedule(Ye)))}function Ye(){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 Io(){m.batchDepth===0&&Ye()}function Mo(e){m.batchDepth++;try{return e()}finally{--m.batchDepth===0&&Ye()}}var El=class extends Lt{constructor(e,t=!1,r){let n=null;super(()=>{Ge(n,!1),R(n,()=>{let a=e();typeof a=="function"&&(n.cleanups??=[]).push(a)})}),this.queued=!1,this.disposed=!1;let i=m.owner;this.owner=Xe(i),n=this.owner,this.run();let o=this.owner;if(!this.disposed&&!this.sources?.size&&!o.cleanups&&!o.owned&&!o.contexts){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&&xl(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,super.dispose(),Ge(this.owner))}};function ln(e,t=!1,r){let n=new El(e,t,r);return()=>n.dispose()}function kl(e){return!!e&&typeof e.then=="function"}Do(()=>{});var Po=Symbol.for("signal"),$l=Symbol.for("memo"),Al=Symbol.for("signal-node");function O(e,t){let r=m.hot,n=e;r&&(e=r.take("signal",e));let i=new To(e,{equals:t?.equals}),o=(()=>i.get()),a=(s=>{let c=typeof s=="function"?s(i.peek()):s;return i.set(c),Io(),c});return o[Po]=!0,o[Al]=i,r&&r.keep(()=>i.peek(),()=>a(()=>n)),[o,a]}function w(e,t,r){let n=t,i=k(),o=new Lt(()=>R(i,()=>{try{return n=e(n)}catch(s){if(kl(s))return _o(s),n;throw s}}),{equals:r?.equals}),a=(()=>o.get());return Object.defineProperty(a,Po,{value:!0,enumerable:!0}),Object.defineProperty(a,$l,{value:!0,enumerable:!0}),C(()=>{o.dispose()}),a}function D(e,t,r){let n=t;return ln(()=>{n=e(n)},!0,r?.name)}function $(e,t){let r=t;return ln(()=>{r=e(r)})}function I(e){return Mo(e)}function E(e){return jt(e)}var ke=globalThis[Symbol.for("fluixi.transition")]??={depth:0,loads:new Set,pending:void 0};function Rl(){return ke.pending??=O(0)}function Lo(){return ke.depth>0}function jo(e){let[,t]=Rl();ke.loads.add(e),t(ke.loads.size);let r=()=>{ke.loads.delete(e),t(ke.loads.size)};e.then(r,r)}function Bt(){return Ye(),Promise.resolve()}var Ho=Ht();No((e,t)=>{let r=Oo(t,Ho);return r?(r.caught=()=>e,m.consumer?queueMicrotask(()=>r.setError(e)):r.setError(e),!0):!1});function un(){let[e,t]=O(void 0,{equals:!1}),r={error:e,caught:()=>{},reset:()=>{r.caught=()=>{},t(()=>{})},setError:n=>{r.caught=()=>n,t(()=>n)}};return r}function fn(e,t){return Vt(Ho,e,t)}var Cl=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,qt=typeof process>"u"?Cl:!1,Tl=Symbol.for("signal");function A(e){return typeof e=="function"&&e[Tl]===!0}function Ol(e,t){return()=>{let r=F(t);return C(()=>{G(r);let n=t.owned,i=n?n.indexOf(r):-1;i>=0&&n.splice(i,1)}),R(r,e)}}function Wo(e,t){return typeof e=="function"?A(e)||e.length?e:Ol(e,t):Array.isArray(e)?e.map(r=>Wo(r,t)):e}function pn(e,t){let r=Ht(e,t),n=r.Provider;return{...r,Provider:o=>n({get value(){return o.value},get debug(){return o.debug},get children(){let a=k(),s=o.children;return a?Wo(s,a):s}})}}var dn=null;function vn(e){dn=e}function gn(e){dn&&dn(e)}var hn=null;function bn(e){hn=e}function Sn(e){return hn?hn(e):void 0}var mn=null;function Ze(e){mn=e}function wn(){return mn?mn():void 0}var yn=null;function xn(e){yn=e}function En(e,t){yn&&yn(e,t)}function kn(){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 _l=null;function $n(e){_l=e}function Nl(e){return!!e&&typeof e.then=="function"}var An=Symbol();function Vo(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:wn(),a=o!==void 0?Sn(o):void 0,s=a!==void 0,c=m.hot;m.hot=null;let[u,l]=O(a!==void 0?a.value:r.initialValue,{equals:!1}),[f,d]=O(void 0,{equals:!1}),y=!1,[v,p]=O(a!==void 0||r.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[b,T]=O(void 0,{equals:!1}),[S,g]=O(void 0,{equals:!1});m.hot=c;let L=An,W=!1;D(()=>{let _=n();if(S(),_===!1||_===null||_===void 0){L=An,I(()=>{p("unresolved"),T(void 0),d(void 0)});return}let Ot=W;if(W=!1,L!==An&&_===L&&!Ot)return;if(L=_,s){s=!1;return}let _t=!1;C(()=>_t=!0);let ho=E(v),fl=E(u),rn=ho==="ready"||ho==="refreshing";y=rn&&Lo(),I(()=>{p(rn?"refreshing":"pending"),d(void 0)});try{let ne=i(_,{value:fl,refetching:rn});Nl(ne)?(T(ne),y&&jo(ne),gn(ne),ne.then(Nt=>{_t||(o!==void 0&&En(o,Nt),I(()=>{l(()=>Nt),p("ready"),T(void 0)}))},Nt=>{_t||I(()=>{d(Nt),p("errored"),T(void 0)})})):I(()=>{l(()=>ne),p("ready"),T(void 0)})}catch(ne){if(_t)return;I(()=>{d(ne),p("errored"),T(void 0)})}});let J=()=>{let _=v();return _==="pending"||_==="refreshing"},ze=(()=>{let _=f();if(_)throw _;if(J()&&!(y&&v()==="refreshing")){let Ot=b();if(Ot)throw Ot}return u()});return Object.defineProperties(ze,{state:{get:v},loading:{get:J},error:{get:f},latest:{get:u}}),Object.defineProperty(ze,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(ze,Symbol.for("signal"),{value:!0,enumerable:!0}),[ze,{mutate:l,refetch:()=>{W=!0,g(void 0)}}]}function Rn(...e){let[t,r]=Vo(...e);return Object.assign(t,r)}function Cn(e){let t=m.hot;if(!t)return e();m.hot=null;try{return e()}finally{m.hot=t}}function Tn(e,t){let[r,n]=O(e,t);return r.set=n,r}function On(e,t,r){return w(e,t,r)}function _n(e,t,r){return D(e,t,r)}function Ft(e){if(typeof e=="function"&&!e.length){let t=e();return A(t)?t:Ft(t)}if(Array.isArray(e)){let t=[];for(let r=0;r<e.length;r++){let n=Ft(e[r]);Array.isArray(n)?t.push.apply(t,n):t.push(n)}return t}return e}function $e(e){let t=w(e);return qt?w(()=>Ft(t()),void 0,{name:"children"}):w(()=>Ft(t()))}function qo(e){let t=e,r=null;return{index:()=>(r||(r=O(t,{name:"row index"})),r[0]()),set:n=>{t=n,r&&r[1](n)}}}function Ae(e,t,r){let n=[];return C(()=>{for(let i of n)i.dispose();n=[]}),w(()=>{let i=e()||[];return E(()=>{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 a=[],s=new Set;for(let c=0;c<i.length;c++){let u=i[c],l=o.get(u);if(l&&!s.has(l))l.setIndex(c),a.push(l),s.add(l);else{let f,d,y;V(p=>{y=p;let b=qo(c);d=b.set,f=t(u,b.index)});let v={item:u,rendered:f,dispose:y,setIndex:d};a.push(v),s.add(v)}}for(let c of n)s.has(c)||c.dispose();return n=a,a.map(c=>c.rendered)})},void 0,{name:"mapArray"})}function Re(e,t,r,n){let i=[],o=[];return C(()=>{for(let a of o)a.dispose();i=[],o=[]}),w(()=>{let a=e()||[];return E(()=>{if(a.length===0){for(let f of o)f.dispose();return i=[],o=[],n?.fallback?n.fallback():[]}let s=new Map;for(let f=0;f<i.length;f++)s.set(i[f],o[f]);let c=[],u=[],l=new Set;for(let f=0;f<a.length;f++){let d=t(a[f]),y=s.get(d);if(y&&!l.has(d))y.setIndex(f),y.setItem(a[f]),c.push(y);else{let v,p,b,T;V(S=>{T=S;let g=qo(f);p=g.set;let[L,W]=O(a[f]);b=J=>W(()=>J),v=r(L,g.index)}),c.push({rendered:v,dispose:T,setIndex:p,setItem:b})}u.push(d),l.add(d)}for(let[f,d]of s)l.has(f)||d.dispose();return i=u,o=c,c.map(f=>f.rendered)})},void 0,{name:"keyArray"})}function Ce(e,t,r){let n=[];return C(()=>{for(let i of n)i.dispose();n=[]}),w(()=>{let i=e()||[];return E(()=>{if(i.length===0){for(let c of n)c.dispose();return n=[],r?.fallback?r.fallback():[]}let o=n.length,a=i.length;for(let c=o;c<a;c++){let u,l,f,d=i[c];V(y=>{f=y;let[v,p]=O(d);l=p,u=t(v,c)}),n.push({rendered:u,setItem:l,dispose:f})}for(let c=a;c<o;c++)n[c].dispose();a<o&&(n=n.slice(0,a));let s=Math.min(o,a);for(let c=0;c<s;c++)n[c].setItem(i[c]);return n.map(c=>c.rendered)})},void 0,{name:"indexArray"})}var et=Symbol.for("fluixi.server-node"),Fl=Symbol.for("fluixi.dom.server-host"),Ul=globalThis,Qe=Ul[Fl]??={server:typeof document>"u",nodes:null};function x(){return Qe.server}function de(e){Qe.server=e}function Fo(e){Qe.nodes=e}function Te(){if(!Qe.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return Qe.nodes}function he(e){return e!=null&&e[et]===!0?!0:typeof Node<"u"&&e instanceof Node}function Ut(e){return e!=null&&e[et]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Kt(e){return e!=null&&e[et]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}function Uo(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function Ko(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function zo(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 Jo=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Go=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"]),tt="http://www.w3.org/2000/svg";function Nn(e){return e.localName.includes("-")}function rt(e,t,r,n=!1){if(r==null){e.removeAttribute(t);return}if(Nn(e)){if(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:x()){Oe(e,t,r);return}e[t]=r;return}j(e,t,r,n)}var Dn=Symbol.for("fluixi.serverProps");function Oe(e,t,r){let n=e[Dn]??={};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 Kl=new Set(["draggable","spellcheck","contenteditable"]);function In(e){return e.startsWith("aria-")||Kl.has(e.toLowerCase())}var nt=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]),Mn=new Set(["id","class","className","style","slot","part","exportparts","is","title","role","lang","dir","tabindex","hidden"]);function _e(e){return Mn.has(e)||e.startsWith("aria-")||e.startsWith("data-")}function zt(e,t=document){return t.querySelector(e)}function Xo(e,t=document){return Array.from(t.querySelectorAll(e))}function Yo(e,t){return e.closest(t)}function Pn(e,...t){e.classList.add(...t)}function Ln(e,...t){e.classList.remove(...t)}function jn(e,...t){t.forEach(r=>e.classList.toggle(r))}function Zo(e,t){return e.classList.contains(t)}function j(e,t,r,n=!1){if(typeof r=="boolean"&&In(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 Hn(e,t){return e.getAttribute(t)}function Wn(e,t){e.removeAttribute(t)}function Jt(e,t){Object.assign(e.style,t)}function Qo(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function Vn(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")Jt(n,o);else if(i.startsWith("on")&&typeof o=="function"){let a=i.slice(2).toLowerCase();n.addEventListener(a,o)}else j(n,i,o)}),r.forEach(i=>{typeof i=="string"?n.appendChild(document.createTextNode(i)):n.appendChild(i)}),n}function Bn(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function qn(e,...t){t.forEach(r=>{typeof r=="string"?e.appendChild(document.createTextNode(r)):e.appendChild(r)})}function es(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function ts(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function rs(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function ns(e,t,r,n){let i=o=>{let a=o.target.closest(r);a&&e.contains(a)&&n(o,a)};return e.addEventListener(t,i),()=>{e.removeEventListener(t,i)}}function is(e,t=5e3){return new Promise((r,n)=>{let i=zt(e);if(i){r(i);return}let o=new MutationObserver(()=>{let s=zt(e);s&&(o.disconnect(),clearTimeout(a),r(s))});o.observe(document.body,{childList:!0,subtree:!0});let a=setTimeout(()=>{o.disconnect(),n(new Error(`Element ${e} not found within ${t}ms`))},t)})}function os(e,t,r={}){let n=new IntersectionObserver(i=>{i.forEach(o=>{t(o.isIntersecting)})},r);return n.observe(e),()=>{n.disconnect()}}function ss(e,t){let r=new ResizeObserver(n=>{n.forEach(t)});return r.observe(e),()=>{r.disconnect()}}var zl=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function as(e){return typeof e=="object"&&e!==null&&e.$$typeof===zl}function cs(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function ls(e){return e instanceof Node}function us(e,t,r="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[r]>"u"&&(globalThis[r]={}),typeof globalThis[r][e]>"u"&&(globalThis[r][e]=t))}function fs(e,t,r="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[r]<"u"&&typeof globalThis[r][e]<"u"?globalThis[r][e]:t}var Gt="1.0.0-alpha.114";var B={dom:Gt,reactive:ie};function ps(e){B.core=e}var it="data-fluixi";function Fn(){return Jl()?"":B.core??B.dom}function Jl(){try{return!0}catch{return!1}}function ds(e){if(e.setAttribute(it,Fn()),typeof globalThis>"u")return;let t=globalThis.Fluixi;t&&typeof t=="object"&&Object.values(t).some(r=>typeof r=="function")?t.versions=B:globalThis.Fluixi=B}function hs(){let e=on();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=[B.core,B.dom,B.reactive].filter(r=>r!==void 0);new Set(t).size<=1||console.warn(`[fluixi] package versions disagree: core ${B.core??"(absent)"}, dom ${B.dom}, reactive ${B.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:[]},Ne="__fx_at",K="data-hk",Xt=null;function ms(e){Xt=e}function X(){return Xt}var ys=null;function vs(e){ys=e}function ot(){return ys}function Kn(e,t){return h.active&&t.parentNode===e}function Yt(e){let t=h.parents.lastIndexOf(e);t!==-1&&(h.parents.length=t),h.cursor=e.nextSibling}function gs(){return h.active?h.cursor:null}function De(e,t){if(!e||e.parentNode==null)return t();let r=h.active,n=h.cursor,i=h.parents;h.active=!0,h.cursor=e,h.parents=[];try{return t()}finally{h.active=r,h.cursor=n,h.parents=i}}function bs(e){if(!h.active)return Xt?Xt.unkeyed(e):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 Ie(e){if(!h.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&Yt(t)}function Zt(){let e=globalThis;return e[Symbol.for("fluixi.appHydration")]??={pending:0,waiting:new Set}}function Ss(){Zt().pending++}function ws(){let e=Zt();if(e.pending>0&&e.pending--,e.pending>0)return;let t=[...e.waiting];e.waiting.clear();for(let r of t)r()}function xs(){return Zt().pending>0}function Es(e){let t=Zt();return t.waiting.add(e),()=>t.waiting.delete(e)}var Un=[];function ks(e){h.active?Un.push(e):e()}function zn(){for(;Un.length>0;){let e=Un.shift();try{e()}catch(t){console.error(t)}}}function $s(){return h.active}function As(e){return Object.defineProperty(e,Symbol.for("fluixi-router"),{value:!0,enumerable:!0}),e}function Rs(e){return Object.defineProperty(e,Symbol.for("fluixi-routes"),{value:!0,enumerable:!0}),e}function Cs(e){return Object.defineProperty(e,Symbol.for("fluixi-route"),{value:!0,enumerable:!0}),e}function Ts(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-outlet"),{value:!0,enumerable:!0}),e}function Os(e){return Object.defineProperty(e,Symbol.for("fluixi-provider"),{value:!0,enumerable:!0}),e}function _s(e){return Object.defineProperty(e,Symbol.for("fluixi-context"),{value:!0,enumerable:!0}),e}function st(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function Ns(e){return Object.defineProperty(e,Symbol.for("fluixi-suspense"),{value:!0,enumerable:!0}),e}function Jn(e){return typeof e=="function"&&e[Symbol.for("fluixi-router")]===!0}function Gn(e){return typeof e=="function"&&e[Symbol.for("fluixi-routes")]===!0}function Xn(e){return typeof e=="function"&&e[Symbol.for("fluixi-route")]===!0}function Yn(e){return typeof e=="function"&&e[Symbol.for("fluixi-outlet")]===!0}function Zn(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function Qn(e){return typeof e=="function"&&e[Symbol.for("fluixi-context")]===!0}function U(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function ei(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function Ds(e){return Jn(e)?{type:"router",value:e}:Xn(e)?{type:"route",value:e}:Gn(e)?{type:"routes",value:e}:Yn(e)?{type:"outlet",value:e}:U(e)?{type:"component",value:e}:ei(e)?{type:"suspense",value:e}:Zn(e)?{type:"provider",value:e}:Qn(e)?{type:"context",value:e}:{type:"none",value:e}}function Is(e){if(x()||!h.active)return e();let t=k();return st(()=>R(t,e))}function Gl(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 Xl(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 Ls(e){return Xl(Gl(e))}var js=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Ms={},Hs="__fx_loc";function ti(e,t){return e}var Ps=new Map,Yl="__fluixi_delegated_events__",ii=globalThis[Yl]??={names:new Set},er=ii.names,rr=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function lt(e){if(!(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:x()))for(let t of e)er.has(t)||rr.has(t)||(er.add(t),ii.dispatch??=Zl,document.addEventListener(t,ii.dispatch))}function Zl(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,rr.has(t)){let n=`__fx_${t}`;if(!e[n]){let i=o=>{e[`$$${t}`]?.(o)};e.addEventListener(t,i),e[n]=i}return}er.has(t)||lt([t])}function at(e,t){delete e[`$$${t}`];let r=`__fx_${t}`,n=e[r];n&&(e.removeEventListener(t,n),delete e[r])}function Ws(e){return!rr.has(e)}function Vs(e){return typeof e=="function"}function Pe(e,t=!1){if(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:x())return Te().createText(e);if(h.active&&!t){let r=ot()?.hydrateText(e);if(r)return r}return document.createTextNode(e)}function ve(e,t=!1,r){let n=X(),i=n?n.next():null;if(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:x()){let o=Te().createElement(e,t);return i&&o.setAttribute(K,i),o}if(h.active){let o=n?n.claim(i,e):null;if(o)return ot()?.enterElement(o),e.includes("-")&&n?.handOwner(o),r?ti(o,r):o;let a=ot()?.hydrateElement(e);if(a)return e.includes("-")&&n?.handOwner(a),r?ti(a,r):a}return ti(t?document.createElementNS(tt,e):document.createElement(e),r)}function ut(e,t=!1){let r=Ps.get(e);if(r)return r;let n=document.createElement("template");return t?n.innerHTML=`<svg>${e}</svg>`:n.innerHTML=e,Ps.set(e,n),n}function oi(e,t,r=!1,n=!1,i){let o=X(),a=o?o.salt(e):"",s=o?o.next(a):null;if(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:x()){let c=Te();if(r){let u=c.parseTemplate(e,n);return s&&u.setAttribute(K,s),u}return c.createRaw(s?Ql(e,s):e)}if(h.active){let c=o?o.claim(s,t):null;if(c)return h.cursor=c.nextSibling,o?.handOwnerTree(c,e),Qt(c,i);let u=ot()?.hydrateStatic(t,a);if(u)return o?.handOwnerTree(u,e),Qt(u,i)}return Qt(ir(ut(e,n),n).firstChild,i)}function si(e){let t;return r=>(t??=ut(e),Qt(Bs(t.content.firstChild),r))}function Bs(e){let t=typeof document>"u"?void 0:document;return t&&e.ownerDocument!==t?t.importNode(e,!0):e.cloneNode(!0)}function Ql(e,t){return e.replace(/^(\s*<[^\s/>]+)/,`$1 ${K}="${t}"`)}function Qt(e,t){return e}function ft(e,t){let r=h.active&&X();return r?r.holeScope(e,t):t()}function pt(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 dt(e,t){let r=[];for(let n=e.nextSibling;n&&n!==t;n=n.nextSibling)r.push(n);return r}function ir(e,t=!1){let r=Bs(e.content);return t?r.firstChild:r}function ai(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?ai(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function qs(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function Fs(e){if(A(e)||U(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!A(t)&&!U(t);)t=t();return t}var Z=0,eu=200;function tu(e,t,r,n,i){let o=n,a,s=()=>a??=new Map,c=!1;return $(()=>{let l=c&&h.active;if(c=!0,!l)return u();h.active=!1;try{return u()}finally{h.active=!0}});function u(){let l;if(U(e)&&!A(e)){if(!s().has(e)){Z++;try{let f=e();s().set(e,f)}finally{Z--}}for(l=s().get(e);typeof l=="function"&&A(l);)l=l()}else for(l=e();typeof l=="function"&&A(l);)l=l();{let f=0;for(;typeof l=="function"&&f++<50;)if(U(l)){if(!s().has(l)){let d=l;Z++;try{let y=d();s().set(d,y)}finally{Z--}}l=s().get(l)}else if(A(l))l=l();else if(l=l(),typeof l!="function"||!A(l)&&!U(l))break}Array.isArray(l)&&s(),Z++;try{o=ht(t,l,r,o,a),i(o)}finally{Z--}}}function N(e,t,r,n){if(Z>eu)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)},a=n??null,s=l=>Array.isArray(l)&&l.some(f=>typeof f=="function"),c=l=>typeof l=="function"?l:()=>l;if(typeof t!="function"&&!s(t)){Z++;try{a=ht(e,t,r,a)}finally{Z--}return o(),()=>a}let u=tu(c(t),e,r,a,l=>{a=l});return o(),()=>(u?.(),a)}var Us=Symbol.for("fluixi.keepServerContent");function Ks(e){return{[Us]:!0,adopt:e}}function ru(e){return!!e&&typeof e=="object"&&e[Us]===!0}function ht(e,t,r,n,i){if(t==null||typeof t=="boolean")return Q(e,n,r);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return Q(e,n,r);if(ru(t)){let a=n==null?[]:Array.isArray(n)?n:[n];return X()?.keep(a),t.adopt?.(a),n??null}ur(t);let o=typeof t;if(o==="string"||o==="number"){if(o==="number"&&(t=String(t)),Array.isArray(n)){if(n.length===0){let s=Pe(t);return oe(e,s,r),s}if(n.length===1&&n[0].nodeType===3){let s=n[0];return h.active&&s.data,s.data=t,n}n=Q(e,n,r)}if(n&&Kt(n))return h.active&&n.data,n.data=t,n;let a=Pe(t);return n&&n.parentNode===e?e.replaceChild(a,n):Kn(e,a)||oe(e,a,r),a}if(he(t))return Kn(e,t)?(Yt(t),t):(n!==t&&iu(e,n,t,r),t);if(Array.isArray(t)){let a=[],s=Array.isArray(n)?n:n?[n]:[],c=[],u=new Set,l=()=>me(t,a,e,i,c,u),f=h.active&&s.length&&X();f?f.resume(s[0],l):l();let d=nu(e,u.size?s.filter(y=>!u.has(y)):s,a,r);for(let y of c){if(y.wired)continue;let v=N(e,y.sig,y.marker);C(()=>Q(e,v()))}return d}if(ct&&typeof t=="object"){let a=ct(t);if(a!==t)return ht(e,a,r,n)}return Q(e,n,r)}var ct=null;function zs(e){ct=e}function me(e,t,r,n,i,o){for(let a=0;a<e.length;a++){let s=e[a];if(!(s==null||typeof s=="boolean")){for(;!i&&typeof s=="function"&&!A(s)&&!U(s)&&(s=s(),!(s==null||typeof s=="boolean")););if(!(s==null||typeof s=="boolean")){if(typeof s=="function"){let c;for(U(s)&&!A(s)?(n||(n=new Map),n.has(s)||n.set(s,s()),c=n.get(s)):c=i?s:s();c!==s&&typeof c=="function"&&!A(c)&&!U(c);)n||(n=new Map),n.has(c)||n.set(c,c()),c=n.get(c);if(c==null||typeof c=="boolean")continue;if(typeof c=="function"){if(A(c)||c===s){if(i){let l=Pe("",!0);if(t.push(l),h.active&&o&&h.cursor?.parentNode===r){let f=()=>h.cursor&&h.cursor.parentNode===r?h.cursor:null,d=f();r.insertBefore(l,d);let y=N(r,c,l),v=f();for(let p=d;p&&p!==v;p=p.nextSibling)o.add(p);r.insertBefore(l,v),C(()=>Q(r,y())),i.push({marker:l,sig:c,wired:!0});continue}i.push({marker:l,sig:c});continue}let u=c();for(;typeof u=="function"&&A(u);)u=u();if(u==null||typeof u=="boolean")continue;Array.isArray(u)?me(u,t,r,n):me([u],t,r,n);continue}continue}Array.isArray(c)?me(c,t,r,n,i,o):me([c],t,r,n,i,o);continue}if(!ur(s)){if(Array.isArray(s)){me(s,t,r,n,i,o);continue}if(he(s)){h.active&&(h.cursor===s||h.parents.includes(s)||s.contains?.(h.cursor))&&Yt(s),t.push(s);continue}if(ct&&typeof s=="object"){let c=ct(s);if(c!==s){me(Array.isArray(c)?c:[c],t,r,n);continue}}if(typeof s=="string"||typeof s=="number"){let c=String(s);if(c.trim()===""&&c!==" ")continue;t.push(Pe(c));continue}t.push(Pe(String(s)))}}}}}function nu(e,t,r,n){for(let f=0;f<r.length;f++){let d=r[f].parentNode;d!==null&&d!==e&&d.nodeType!==11&&(r=r.slice(),r[f]=r[f].cloneNode(!0))}let i=r.length,o=t.length,a=i,s=0,c=0,u=o>0?t[o-1].nextSibling??void 0:n,l=null;for(;s<o||c<a;){if(t[s]===r[c]){s++,c++;continue}for(;o>s&&a>c&&t[o-1]===r[a-1];)o--,a--;if(o===s){let f=a<i?c?r[c-1].nextSibling??void 0:r[a-c]:u;for(;c<a;)oe(e,r[c++],f)}else if(a===c)for(;s<o;)(!l||!l.has(t[s]))&&t[s].parentNode===e&&e.removeChild(t[s]),s++;else if(t[s]===r[a-1]&&r[c]===t[o-1]){let f=t[--o].nextSibling;oe(e,r[c++],t[s++].nextSibling),oe(e,r[--a],f),t[o]=t[s-1]}else{if(!l){l=new Map;let d=c;for(;d<a;)l.set(r[d],d++)}let f=l.get(t[s]);if(f!=null)if(c<f&&f<a){let d=s,y=1;for(;++d<o&&d<a&&!(!l.has(t[d])||l.get(t[d])!==f+y);)y++;if(y>f-c){let v=t[s];for(;c<f;)oe(e,r[c++],v)}else t[s].parentNode===e?e.replaceChild(r[c++],t[s++]):(oe(e,r[c++],u),s++)}else s++;else t[s].parentNode===e&&e.removeChild(t[s]),s++}}return r}function iu(e,t,r,n){let i=Array.isArray(t)?t[0]:t;i&&i.parentNode===e?(e.replaceChild(r,i),Array.isArray(t)&&Q(e,t.slice(1),n)):oe(e,r,n)}function Q(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 oe(e,t,r){h.active&&t.parentNode===e||(r&&r.parentNode===e?e.insertBefore(t,r):e.appendChild(t))}function se(e,t,r){r==null?delete e[t]:e[t]=r}function or(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 Js(e,t){if(!t||typeof t!="function")return;let r=t[Ne]?.name;!r||r.indexOf(":")}function tr(e,t,r){let n=typeof r=="function"?E(()=>r()):r}function sr(e,t){let r=(n,i)=>{typeof n=="function"&&n(e,i??(()=>{}))};if(typeof t=="function"){r(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){r(t[0],t[1]);return}for(let n of t)Array.isArray(n)?r(n[0],n[1]):r(n)}}function Le(e,t,r,n=!1){return Js(e,r),typeof r!="function"?(j(e,t,r,n),()=>{}):$(()=>{let i=typeof r=="function"?r():r;j(e,t,i,n)})}function je(e,t,r){return typeof r!="function"?(se(e,t,r),()=>{}):(Js(e,r),$(()=>{let n=typeof r=="function"?r():r;se(e,t,n)}))}function ar(e,t,r){return typeof r!="function"?(j(e,t,!!r),()=>{}):$(()=>{let n=r();j(e,t,!!n)})}function ye(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){$(()=>{ye(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 ae(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($(()=>{let a=!!i();for(let s of o)e.classList.toggle(s,a)}));else{let a=!!(typeof i=="function"?i():i);for(let s of o)e.classList.toggle(s,a)}}}function ri(e,t,r){t.includes("-")?r==null?e.removeProperty(t):e.setProperty(t,String(r)):e[t]=r??""}function Me(e){for(;typeof e=="function";)e=e();return e}var ni=new WeakMap;function ee(e,t,r){if(typeof t=="function"&&r){r.push($(()=>ee(e,Me(t))));return}let n=Me(t),i=ni.get(e);if(n==null){ni.delete(e),e.removeAttribute("style");return}let o=new Set,a=s=>{if(typeof s=="function"&&r){r.push($(()=>a(Me(s))));return}if(s=Me(s),s!=null){if(typeof s=="string")e.style.cssText=s;else if(Array.isArray(s))for(let c of s)a(c);else if(typeof s=="object")for(let c in s){o.add(c);let u=s[c];typeof u=="function"&&r?r.push($(()=>ri(e.style,c,Me(u)))):ri(e.style,c,Me(u))}}};if(Array.isArray(n))for(let s of n)a(s);else a(n);if(i)for(let s of i)o.has(s)||ri(e.style,s,null);ni.set(e,o)}function Gs(e,t){if(typeof t!="function"){ee(e,t,[]);return}$(()=>{ee(e,t())})}function Xs(e,t){if(typeof t!="function"){ae(e,t,[]);return}$(()=>{ae(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 ci(e){let{element:t,props:r,prevProps:n=Ms,isSVG:i=!1,skipChildren:o=!1,isCustomElement:a,accessors:s}=e;if(!t||!Ut(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===tt,u=(p,b,T,S)=>{if(p==="children"){o||S.push(N(t,()=>r.children));return}let g=r[p],L=g===void 0&&T&&ou(r,p);if(g===b&&!L||L&&(p==="ref"||p==="use"||p.startsWith("on")||p.includes(":")||p==="class"||p==="className"||p==="classList"||p==="style"))return;if(p==="ref"){ge(g,t);return}if(p==="use"){sr(t,g);return}if(p.startsWith("on:")){S.push(or(t,p.slice(3),g));return}if(p.startsWith("prop:")){S.push(je(t,p.slice(5),g));return}if(p.startsWith("attr:")){S.push(Le(t,p.slice(5),g,c));return}if(p.startsWith("bool:")){S.push(ar(t,p.slice(5),g));return}if(p==="class"||p==="className"){typeof g=="function"?S.push($(()=>{ye(t,g())})):ye(t,g);return}if(p==="classList"){tr(t,"class",g),typeof g=="function"?S.push($(()=>{ae(t,g())})):ae(t,g,S);return}if(p==="style"){tr(t,"style",g),typeof g=="function"?S.push($(()=>{ee(t,g())})):ee(t,g,S);return}if(p.startsWith("on")){let _=p.slice(2).toLowerCase();b&&at(t,_),g&&nr(t,_,g);return}let W=a??t.localName.includes("-"),J=nt.has(p)||!c&&p in t||W&&!c&&!_e(p);if(W&&!c&&!_e(p)&&s!==void 0&&typeof g=="function"&&!s.includes(p)){(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:x())?Oe(t,p,g):se(t,p,g);return}if(W&&!c&&!_e(p)&&(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:x())){S.push($(()=>{let _=typeof g=="function"?g():r[p];for(;typeof _=="function"&&_.length===0;)_=_();Oe(t,p,_)}));return}typeof g=="function"?S.push(J?je(t,p,g):Le(t,p,g,c)):S.push($(()=>J?se(t,p,r[p]):j(t,p,r[p],c)))},l=p=>{p!=="children"&&(p.startsWith("on")?at(t,p.slice(2).toLowerCase()):nt.has(p)?se(t,p,null):t.removeAttribute(p))},f=new Map,d=(p,b,T)=>{let S=[];f.set(p,S),u(p,b,T,S)};E(()=>{for(let p in r)d(p,n[p],n===Ms);for(let p in n)p in r||l(p)});let y=k(),v=$(()=>{let p=new Set;for(let b in r)p.add(b);E(()=>R(y,()=>{for(let b of p)f.has(b)||d(b,void 0,!0);for(let[b,T]of f)p.has(b)||(T.forEach(S=>S()),f.delete(b),l(b))}))});return()=>{v();for(let p of f.values())p.forEach(b=>b())}}function mt(e,t,r=!1){for(let n in t){if(n==="children")continue;let i=t[n];if(n==="ref"){ge(i,e);continue}if(n==="use"){sr(e,i);continue}if(n.startsWith("on:")){or(e,n.slice(3),i);continue}if(n.startsWith("prop:")){je(e,n.slice(5),i);continue}if(n.startsWith("attr:")){Le(e,n.slice(5),i,r);continue}if(n.startsWith("bool:")){ar(e,n.slice(5),i);continue}if(n.startsWith("on")&&n.length>2){let o=n.slice(2).toLowerCase();if(typeof i=="function")if(rr.has(o)){e[`$$${o}`]=i;let a=`__fx_${o}`;if(!e[a]){let s=c=>{e[`$$${o}`]?.(c)};e.addEventListener(o,s),e[a]=s}}else e[`$$${o}`]=i,er.has(o)||lt([o]);continue}if(n==="class"||n==="className"){ye(e,i);continue}if(n==="classList"){tr(e,"class",i),typeof i=="function"?$(()=>{ae(e,i())}):ae(e,i,[]);continue}if(n==="style"){tr(e,"style",i),typeof i=="function"?$(()=>{ee(e,i())}):ee(e,i,[]);continue}if(n==="innerHTML"){if(typeof i=="function"){let o=D(()=>{let a=i();for(;typeof a=="function";)a=a();e.innerHTML=a});C(()=>o())}else e.innerHTML=i;continue}if(n==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof i=="function"){let o=D(()=>{let a=i();for(;typeof a=="function"&&a.length===0;)a=a();document.activeElement!==e&&(e.value=a??"")});C(()=>{o()})}else $(()=>{document.activeElement!==e&&(e.value=t[n]??"")});continue}if(n==="checked"&&e.tagName==="INPUT"){if(typeof i=="function"){let o=D(()=>{let a=i();for(;typeof a=="function"&&a.length===0;)a=a();document.activeElement!==e&&(e.checked=a??"")});C(()=>{o()})}else $(()=>{document.activeElement!==e&&(e.checked=t[n]??"")});continue}if(n==="value"&&e.tagName==="SELECT"){if(typeof i=="function"){let o=!0,a=D(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();o?(o=!1,queueMicrotask(()=>{e.value=s??""})):e.value=s??""});C(()=>{a()})}else{let o=!0;$(()=>{let a=t[n];o?(o=!1,queueMicrotask(()=>{e.value=a??""})):e.value=a??""})}continue}if(typeof i=="function"){let o=D(()=>{let a=i();for(;typeof a=="function"&&a.length===0;)a=a();rt(e,n,a,r)});C(()=>{o()})}else $(()=>rt(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 a=t(e[o]);if(!a||!(i in a))continue;let s=a[i];if(s!==void 0)return s}},n=i=>{for(let o of e){let a=t(o);if(a&&i in a)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 a=t(o);if(a)for(let s of Reflect.ownKeys(a))i.add(s)}return[...i]},getOwnPropertyDescriptor:(i,o)=>n(o)?{enumerable:!0,configurable:!0,get:()=>r(o)}:void 0})}function cr(e,...t){let r=new Set;for(let a of t)for(let s of a)r.add(s);let n=a=>({enumerable:!0,configurable:!0,get:()=>e[a]}),i=t.map(a=>{let s=new Set(a);return new Proxy({},{get:(c,u)=>s.has(u)?e[u]:void 0,has:(c,u)=>s.has(u)&&u in e,ownKeys:()=>Array.from(s).filter(c=>c in e),getOwnPropertyDescriptor:(c,u)=>s.has(u)&&u in e?n(u):void 0})}),o=new Proxy({},{get:(a,s)=>r.has(s)?void 0:e[s],has:(a,s)=>!r.has(s)&&s in e,ownKeys:()=>Reflect.ownKeys(e).filter(a=>!r.has(a)),getOwnPropertyDescriptor:(a,s)=>!r.has(s)&&s in e?n(s):void 0});return[...i,o]}function ge(e,t,r){if(!e){r?.(t);return}let n=e[Ne]?.name;if(he(e)){let i=t,o=e;if(!i)return;typeof i=="function"?i(o):typeof i=="object"&&"current"in i&&(i.current=o);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e?e.current=t:r?.(t)}function ui(e,t,r){let n=t||document.body,i=$e(()=>e),o=[];return I(()=>{let a=$(()=>{let s=i();Array.isArray(s)?(s.forEach(c=>n.appendChild(c)),o.push(()=>{s.forEach(c=>{c.parentNode===n&&n.removeChild(c)})})):he(s)&&(n.appendChild(s),o.push(()=>{s.parentNode===n&&n.removeChild(s)}))});o.push(a),C(()=>{o.forEach(s=>s())})}),null}function Ys(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 Zs(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function ur(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function Qs(e){return typeof e=="function"&&e.length===0&&A(e)}function be(e,t,r){if(!t)throw new Error("Container element is required");let n,i,o=[];return V(a=>{I(()=>{h.active||(t.textContent=""),t.setAttribute(it,"");let s=e;N(t,typeof s=="function"&&!A(s)?E(s):s)}),i=a}),()=>{i?.(),n?.(),o.forEach(a=>a()),t.textContent=""}}function fi(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 fr(e){if(x())return null;let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,r,n,i=!1,o=k(),a=()=>R(o,()=>V(s=>{r=s,n=document.createElement("div"),n.style.display="contents",t().appendChild(n),N(n,e.children)&&ge(e.ref,n)}));return h.active?queueMicrotask(()=>{i||a()}):a(),C(()=>{i=!0,r?.(),n?.remove()}),null}function ce(e){return()=>{let t=e();return typeof t=="function"?t():t}}function pr(e){let t=ce(()=>e.when),r=w(t,void 0,{name:"Show.when"}),n=w(()=>!!r(),void 0,{name:"Show.cond"}),i=k(),o=null,a=null,s=c=>{c!==a&&(o&&G(o),o=F(i),a=c)};return w(()=>{let c=n();return s(c?"when":"fallback"),R(o,()=>{if(!c)return e.fallback;let u=e.children;if(A(u))return u;if(typeof u=="function"){let l=u;if(l.length===0)return E(()=>l(E(r)));let f=r();return E(()=>l(f))}return u})},void 0,{name:"Show.result"})}function su(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function ea(e){return w(()=>{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(`${su(n)}: ${o}`)}return r.join("; ")},void 0,{name:"StyleMap"})}var pi=Symbol("match");function dr(e){return{[pi]:!0,when:ce(()=>e.when),get children(){return e.children}}}function hr(e){let t=e.children,r=Array.isArray(t)?t:[t],n=k(),i=null,o=-1,a=s=>{s!==o&&(i&&G(i),i=F(n),o=s)};return w(()=>{for(let s=0;s<r.length;s+=1){let u=r[s],l=0;for(;typeof u=="function"&&!u[pi]&&l++<10;)u=u();if(!u||typeof u!="object"||u[pi]!==!0)continue;let f=u.when();if(f)return a(s),R(i,()=>{let d=u.children;return typeof d=="function"?d(f):d})}return a(-2),R(i,()=>e.fallback??null)},void 0,{name:"Switch"})}function ta(e){return w(()=>{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"})}function di(e){if(x())return e.fallback??null;let t=h.active,[r,n]=O(!t);return t&&queueMicrotask(()=>n(!0)),w(()=>r()?e.children:e.fallback??null,void 0,{name:"client-only"})}var ra=di;var vr=Symbol("store-raw"),na=Symbol("store-node"),ia=Symbol("store-has"),oa=Symbol("store-self"),sa=Symbol("store-track");var yt=new WeakMap,hi=new WeakMap,We=new WeakMap,gr=new WeakMap;function au(e,t){if(!He(e)||!Pt())return;let r=new Set,n=a=>{if(!(!He(a)||r.has(a))){r.add(a);for(let s of Object.values(a))n(s)}};n(gr.get(t)??t);let i=new Set,o=a=>{if(!He(a))return;let s=a;if(r.has(s)||i.has(s))return;i.add(s);let c=yt.get(s);if(c){for(let u of c.keys.values())an(u);c.all&&an(c.all),yt.delete(s),We.delete(s),hi.delete(s)}for(let u of Object.values(s))o(u)};o(e)}var br=(e,t,r)=>r?`${e}[${String(t)}]`:`${e}.${String(t)}`;function fa(e,t,r){let n=t?.owner,i=n&&r!==void 0?br(n.name,r,t?.array):void 0,o=i?{name:i}:void 0,[a,s]=Eo(n?.store,()=>m.hot?Cn(()=>O(e,o)):O(e,o)),c=a;return c.$=s,c}function Sr(e){let t=yt.get(e);return t?t.owner||(t.owner=We.get(e)):yt.set(e,t={keys:new Map,owner:We.get(e),array:Array.isArray(e)}),t}function aa(e,t,r){let n=e.keys.get(t);return n||e.keys.set(t,n=fa(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),gr.set(e,gr.get(n)??n);let a=yt.get(e);if(a&&(a.owner=o,!!Pt())){for(let[s,c]of a.keys)sn(c,t,br(r,s,a.array));a.all&&sn(a.all,t,br(r,"*",a.array))}}function ca(e){let t=Sr(e);(t.all||(t.all=fa(void 0,t,"*")))()}function la(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 mr(e){if(!He(e))return e;let t=hi.get(e);if(t)return t;let r=new Proxy(e,lu);return hi.set(e,r),r}var lu={get(e,t,r){if(t===vr||t===na)return e;if(t===Dt)return r;if(t===ia)return c=>c in e;if(t==="__proxy")return!0;if(t===sa||t===oa)return ca(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=Sr(e),a=aa(o,t,n),s=a();return He(s)?(o.owner&&cu(s,a,br(o.owner.name,t,o.array),e),mr(s)):s},set(){return!0},deleteProperty(e,t){return t in e&&z(e,t,void 0),!0},has(e,t){return t===vr||t===Dt||t===na||t===ia||t===oa||t===sa?!0:(aa(Sr(e),t,e[t])(),t in e)},ownKeys(e){return ca(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function pa(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=a=>{let s=pa(a,t);return s!==a&&(n=!0),s};if(Array.isArray(r)){let a=r.map(i);return n?a:r}let o={};for(let a of Object.keys(r))o[a]=i(r[a]);return n?o:r}function z(e,t,r){let n=pa(r),i=e[t];if(i===n&&(n!==void 0||t in e))return;let o=Array.isArray(e),a=o?e.length:0;n===void 0?delete e[t]:e[t]=n;let s=Sr(e),c=s.keys.get(t);if(c&&la(c,n),au(i,e),o&&e.length!==a){let u=s.keys.get("length");u&&la(u,e.length)}s.all&&s.all.$(void 0)}function mi(e,t){return typeof e=="function"?e(t):e}function yi(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)?yi(i,n):z(e,r,n)}}function wr(e){let t=[],r=e.replace(/\[([^\]]*)\]/g,".$1");for(let n of r.split("."))n.length&&t.push(n);return t}function da(e,t,r){let n=t.length-1;for(let o=0;o<n;o++){let a=t[o];if(a==="*"){let c=t.slice(o+1);if(Array.isArray(e))for(let u=0;u<e.length;u++)da(e[u],c,r);return}let s=e[a];(s==null||typeof s!="object")&&(s=/^\d+$/.test(t[o+1])?[]:{},z(e,a,s)),e=s}let i=t[n];if(i==="*"){if(Array.isArray(e))for(let o=0;o<e.length;o++)z(e,o,mi(r,e[o]));return}z(e,i,mi(r,e[i]))}function ua(e,t,r){da(e,wr(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 yr(e,t){for(let r=e.length-1;r>=t.length;r--)z(e,String(r),void 0);e.length!==t.length&&z(e,"length",t.length);for(let r=0;r<t.length;r++)z(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&&yi(e,n);return}if(Array.isArray(r)&&t.length===1){if(uu(r)){for(let n of r)ua(e,n[0],n[1]);return}if(Array.isArray(e)){yr(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){yi(e,r);return}if(t.length>=3){vi(e,t.slice(0,-1),t[t.length-1]);return}ua(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 a=n;a<=i;a+=r)a>=0&&a<e.length&&o.push(a);return o}return t==="*"?Array.isArray(e)?e.map((r,n)=>n):Object.keys(e??{}):[t]}function vi(e,t,r){if(e==null)return;let[n,...i]=t;if(typeof n=="string"){let a=wr(n);if(a.length>1){vi(e,[...a,...i],r);return}}let o=pu(e,n);if(i.length===0){for(let a of o)z(e,a,mi(r,e[a]));return}for(let a of o){let s=e[a];if(s==null||typeof s!="object"){let c=i[0];s=typeof c=="number"||/^\d+$/.test(String(c))?[]:{},z(e,a,s)}vi(s,i,r)}}function gi(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(gi);let t={};for(let r of Object.keys(e))t[r]=gi(e[r]);return t}function le(e,t){let r=e;for(let n of wr(t)){if(r==null)return;r=r[n]}return r}var ha=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"}),gr.set(e,e)),Pt()&&ko({kind:"store",node:this,handle:()=>this.root,name:t.name})}get state(){return mr(this.root)}get proxy(){return mr(this.root)}get accessor(){return(()=>mr(this.root))}unwrap(){return this.root}getNode(e){return this.root&&this.root[e]}get(e){if(e==null||e==="")return vt(this.state);let t=this.state;for(let r of wr(e)){if(t==null)return;t=t[r]}return vt(t)}select(e){return w(()=>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 w(()=>this.state[e])}produce(e){this.set((t=>{let r=gi(t);return e(r),r}))}reconcile(e,t={}){this.set(e)}push(e,...t){let r=le(this.root,e);this.set(e,r.concat(t))}pop(e){let t=le(this.root,e).slice(),r=t.pop();return this.set(e,t),r}shift(e){let t=le(this.root,e).slice(),r=t.shift();return this.set(e,t),r}splice(e,t,r,...n){let i=le(this.root,e).slice(),o=i.splice(t,r,...n);return this.set(e,i),o}insert(e,t,r){let n=le(this.root,e).slice();n.splice(t,0,r),this.set(e,n)}removeAt(e,t){let r=le(this.root,e).slice(),n=r.splice(t,1);return this.set(e,r),n}replace(e,t){if(arguments.length>=2){let n=le(this.root,String(e)),i=t;if(Array.isArray(n)&&Array.isArray(i)){yr(n,i);return}this.set(e,i);return}let r=this.root;if(Array.isArray(r)&&Array.isArray(e)){yr(r,e);return}this.set(e)}clear(e){let t=e===void 0?this.root:le(this.root,e);if(Array.isArray(t)){yr(t,[]);return}if(t&&typeof t=="object")for(let r of Object.keys(t))z(t,r,void 0)}toObservable(){let[e]=Cn(()=>O(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 bi(e,t={immutable:!0}){let r=m.hot,n=new ha(r?r.take("store",e):e,t);return hu(n.set,n),r&&r.keep(()=>vt(n.proxy),()=>n.set(()=>e)),[n.proxy,n.set]}function mu(e,t={}){return new ha(e,{...t,immutable:!1})}function vt(e){if(e==null||typeof e!="object")return e;let t=e[vr];return t!==void 0?t:e}function yu(e){return E(()=>vt(e))}var bh=Object.freeze({createStore:bi,createMutableStore:mu,batch:I,unwrap:vt,untrackStore:yu});function Si(e,t){let[r,n]=bi(e,t);return new Proxy(r,{get:(i,o)=>o==="set"?n:i[o],has:(i,o)=>o==="set"||Reflect.has(i,o)})}var vu="__fx_dom_create_component__",Se=globalThis[vu]??={fn:null};function ya(e){Se.fn=e}function va(e={}){let t=e.signalSystem?.createComponent;t&&(Se.fn=t)}function we(e,t){let r=X()?.scope();return r?R(r,()=>ma(e,t)):ma(e,t)}function ma(e,t){if(Se.fn)return Se.fn(e,t);let r=typeof e!="function"?e:E(()=>e(t)),n=r!=null&&(typeof r=="function"||typeof r=="object");if(n)try{r.$name=e?.name}catch{}return n&&!A(r)?st(r):r}var ga=()=>Se.fn!==null,wi=()=>Se.fn!==null;function xi(){Se.fn=null}function xr(e,t={}){if(typeof e=="function")return we(e,t);if(typeof e!="string"||e.length===0)return null;let r=lr(e),n=ve(e,r);return mt(n,t,r),bu(n,t),n}function gu(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 bu(e,t){if(!gu(t))return;if((typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:x())&&!(X()?.keyed()??!1)){N(e,$e(()=>t.children));return}let r=e.firstChild,n;h.active&&r?.nodeType===8&&r.data==="fx"?n=pt(r):(r=ba("fx"),n=ba("fx/"),e.appendChild(r),e.appendChild(n));let i=r;N(e,ft(i,()=>$e(()=>t.children)),n,dt(i,n))}function ba(e){return(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:x())?Te().createComment(e):document.createComment(e)}function Er(e){let t=()=>{let s=e.component;return A(s)?s():s},[,r]=cr(e,["component"]),n=k(),i=null,o,a;return w(()=>{let s=t();return s===o||(i&&G(i),i=F(n),o=s,a=s==null?null:R(i,()=>E(()=>typeof s=="string"?xr(s,r):we(s,r)))),a},void 0,{name:"Dynamic"})}var kr,xa={getStore:()=>kr,run(e,t){let r=kr;kr=e;try{return t()}finally{kr=r}}},gt=globalThis[Symbol.for("fluixi.requestStore")]??={store:xa,async:!1};function ki(e){gt.store=e??xa,gt.async=e!==null}function Ea(e){gt.async||ki(e)}function bt(e={}){if(e.request===void 0){let a=Ai();a&&(e.request=a)}e.locals||(e.locals=e.request?Ri(e.request):{});let t=0,r=0,n=null,i=new Map,o=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${t++}`,nextResourceId:()=>{if(n===null)return`r${r++}`;let a=i.get(n)??0;return i.set(n,a+1),`${n}:r${a}`},nextIslandNamespace:a=>{let s=o.get(a)??0;return o.set(a,s+1),`${a}#${s}`},withResourceScope(a,s){let c=n;n=a;try{return s()}finally{n=c}},pending:new Set,data:new Map}}var $r=globalThis[Symbol.for("fluixi.requestEndHooks")]??=new WeakMap;function ka(e){let t=St();if(!t)return!1;let r=$r.get(t);return r||$r.set(t,r=[]),r.push(e),!0}function St(){return Ai()??H()}var te=globalThis[Symbol.for("fluixi.beforeRender")]??={tasks:[],prepared:new WeakMap,page:void 0};function $a(e){return te.tasks.push(e),()=>{let t=te.tasks.indexOf(e);t>=0&&te.tasks.splice(t,1)}}function Aa(){let e=St();if(!e)return te.page??=Sa();let t=te.prepared.get(e);return t||te.prepared.set(e,t=Sa()),t}function Ra(){let e=St();return e?te.prepared.has(e):te.page!==void 0}async function Sa(){for(let e of[...te.tasks])await e()}function wt(e){$i(e)}function $i(e){let t=$r.get(e);if(t){$r.delete(e);for(let r of t.reverse())try{r()}catch(n){console.error("[fluixi] a request-end hook threw:",n)}}}function xt(e,t){return gt.store.run(e,t)}function H(){return gt.store.getStore()}function Rr(){return H()?.event}function Ca(){let e=Rr();return e?(e.locals||(e.locals={}),e.locals):{}}var wa=globalThis[Symbol.for("fluixi.requestLocals")]??=new WeakMap;function Ai(){return globalThis[Symbol.for("fluixi.platformRequest")]?.getStore()}function Ri(e){let t=wa.get(e);return t||(t={},wa.set(e,t)),t}var Ve=globalThis[Symbol.for("fluixi.responseHeaders")]??=new WeakMap;function Ci(){let e=Rr()?.request;return e&&typeof e=="object"?e:Ai()}function Ta(e,t,r=Ci()){if(!r)return!1;let n=Ve.get(r);return n||(n={headers:new Headers,sent:!1},Ve.set(r,n)),n.sent?!1:(n.headers.append(e,t),!0)}function Oa(e){let t=Ve.get(e);if(!t){t={headers:new Headers,sent:!0},Ve.set(e,t);return}return t.sent=!0,t.headers}var Ar=globalThis[Symbol.for("fluixi.responseRedirects")]??=new WeakMap;function _a(e,t,r=Ci()){return!r||Ve.get(r)?.sent?!1:(Ar.has(r)||Ar.set(r,{location:e,status:t}),!0)}var Ei=globalThis[Symbol.for("fluixi.responseStatuses")]??=new WeakMap;function Cr(e,t=Ci()){return!t||Ve.get(t)?.sent?!1:(Ei.set(t,e),!0)}function Tr(e){let t=e?.status;return typeof t=="number"&&Number.isInteger(t)&&t>=400&&t<=599?t:500}function Na(e){let t=Ei.get(e);return Ei.delete(e),t}function Da(e){let t=Ar.get(e);return Ar.delete(e),t}var Ti=pn(void 0);function Oi(e,t){let r;D(()=>{t.error()===void 0?r=void 0:r??=E(e.current)}),D(()=>{let n=e.committed();E(()=>{r!==void 0&&n!==r&&t.error()!==void 0&&t.reset()})})}function Or(e){let t=un(),r=s=>!!s&&typeof s.then=="function",n=s=>(x()&&Cr(Tr(s)),typeof e.fallback=="function"?e.fallback(s,t.reset):e.fallback),i=s=>{if(r(s))throw s;return queueMicrotask(()=>t.setError(s)),null},o=s=>{if(Array.isArray(s))return s.map(o);if(typeof s!="function")return s;let c=s;return()=>{try{let u=o(c()),l=x()?t.caught():void 0;return l===void 0?u:E(()=>n(l))}catch(u){return x()&&!r(u)?(t.setError(u),E(()=>n(u))):i(u)}}},a=Wt(Ti);return a&&Oi(a,t),w(()=>{let s=t.error();if(s!==void 0)return n(s);try{let c=fn(t,()=>{let l=e.children;return o(typeof l=="function"?l():l)}),u=x()?t.caught():void 0;return u===void 0?c:E(()=>n(u))}catch(c){return i(c),n(c)}},void 0,{name:"ErrorBoundary"})}function _r(e){let t=ce(()=>e.each),r=()=>e.fallback??null,n=(i,o)=>{let a=e.children,s=Array.isArray(a)?a.map(c=>typeof c=="function"?c(i,o):c):typeof a=="function"?a(i,o):a;return Ie(s),s};return e.by?Re(t,e.by,(i,o)=>n(i,o),{fallback:r}):Ae(t,(i,o)=>n(i,o),{fallback:r})}function Nr(e){let t=ce(()=>e.each);return Ce(t,(r,n)=>{let i=e.children(r,n);return Ie(i),i},{fallback:()=>e.fallback??null})}var Su=Symbol.for("fluixi.owner"),kt=1,_i=3,Ni=8,wu=Symbol.for("fluixi.serverElementRenderer"),Ia=Symbol.for("fluixi.serverElementRendered");function Et(e){if(e.nodeType!==kt)return;let t=e;if(typeof t.localName!="string"||!t.localName.includes("-")||t[Ia])return;let r=globalThis[wu];r&&(t[Ia]=!0,r(t))}var Ma;Ma=et;var Dr=class{constructor(){this[Ma]=!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),Et(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),Et(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,Et(e)),t}addEventListener(){}removeEventListener(){}},$t=class Pa extends Dr{constructor(t){super(),this.nodeType=_i,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 Pa(this.data)}},La=class ja extends Dr{constructor(t){super(),this.nodeType=kt,this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new ja(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}},Ir=class Ha extends Dr{constructor(t){super(),this.nodeType=Ni,this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new Ha(this.data)}},xu=class{constructor(){this.cssText=""}setProperty(e,t){this[e]=t}removeProperty(e){delete this[e]}},Eu=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}},At=class Wa extends Dr{constructor(t,r=!1){if(super(),this.nodeType=kt,this.attributes=new Map,this.style=new xu,this.classList=new Eu(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=k();n&&(this[Su]=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 $t(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 Wa(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 ku=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),$u={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function Va(e){return e.replace(/&(#?\w+);/g,(t,r)=>$u[r]??t)}var re=class extends Error{};function Ba(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){s(e.slice(r));break}if(u>r&&s(e.slice(r,u)),e.startsWith("<!--",u)){let l=e.indexOf("-->",u);if(l===-1)throw new re(`unterminated comment at ${u}`);o(new Ir(e.slice(u+4,l))),r=l+3;continue}if(e[u+1]==="/"){let l=e.indexOf(">",u);if(l===-1)throw new re(`unterminated closing tag at ${u}`);let f=e.slice(u+2,l).trim().toLowerCase(),d=i.pop();if(!d||d.localName!==f)throw new re(`</${f}> does not close <${d?.localName??"nothing"}>`);r=l+1;continue}r=c(u)}if(i.length>0)throw new re(`unclosed <${i[i.length-1].localName}>`);let a=n[0];if(n.length!==1||!(a instanceof At))throw new re(`expected exactly one root element, got ${n.length}`);return a;function s(u){u!==""&&o(new $t(Va(u)))}function c(u){let l=/[\s/>]/.exec(e.slice(u+1));if(!l)throw new re(`unterminated tag at ${u}`);let f=e.slice(u+1,u+1+l.index).toLowerCase(),d=new At(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 p=e.slice(v,y);if(p==="")throw new re(`malformed attribute at ${y}`);if(e[y]==="="){if(e[y+1]!=='"')throw new re(`attribute ${p} must have a double-quoted value`);let b=e.indexOf('"',y+2);if(b===-1)throw new re(`unterminated value for ${p}`);d.setAttribute(p,Va(e.slice(y+2,b))),y=b+1}else d.setAttribute(p,"")}return o(d),ku.has(f)||i.push(d),y}}var Au=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Fa=/&/g,Ua=/</g,Ka=/>/g,Ru=/"/g;function Di(e){return e.replace(Fa,"&amp;").replace(Ua,"&lt;").replace(Ka,"&gt;")}function qa(e){return e.replace(Fa,"&amp;").replace(Ru,"&quot;").replace(Ua,"&lt;").replace(Ka,"&gt;")}function Cu(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Tu(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(`${Cu(r)}: ${n}`)}return t.join("; ")}function Ou(e){let t="",r=Tu(e.style);for(let[n,i]of e.attributes)n==="style"&&r||(t+=` ${n}="${qa(i)}"`);if(r){let n=e.attributes.get("style"),i=n?`${n.replace(/;\s*$/,"")}; ${r}`:r;t+=` style="${qa(i)}"`}return t}function Y(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return Di(e);if(typeof e=="number")return Di(String(e));if(typeof e=="function")return Y(e());if(Array.isArray(e))return e.map(Y).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case _i:return Di(e.data??"");case Ni:return`<!--${e.data??""}-->`;case kt:{Et(e);let t=e.localName,r=`<${t}${Ou(e)}>`;if(Au.has(t))return r;let n=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(Y).join("");return`${r}${n}</${t}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(Y).join(""):""}var Rt="__FX_DATA__";function Mr(e){return e.replace(/[<>&\u2028\u2029]/g,t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"))}var Ii;function Pr(){let e=globalThis.__FX_DATA__;if(e&&typeof e.nodeType!="number")return e;if(Ii!==void 0)return Ii;let t=null;if(typeof document<"u"){let r=document.getElementById(Rt)?.textContent;if(r)try{t=JSON.parse(r)}catch{t=null}}return Ii=t}var Lr=Symbol.for("fluixi.hydrationKeys");function Pi(e){let t=e;for(;t;){let r=t.contexts?.get(Lr);if(r)return r;if(!t.parent){let n={id:"",next:0};return(t.contexts??=new Map).set(Lr,n),n}t=t.parent}return{id:"",next:0}}function Hr(){return x()?H()?.hydrationKeys!==!1:h.active}function jr(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 _u(e){if(!Hr())return null;let t=Pi(k()),r=t.id+(t.next++).toString(36);return e?`${jr(r)}-${e}`:jr(r)}var Nu=0;function Ja(){if(!Hr())return`fx-c${(Nu++).toString(36)}`;let e=Pi(k());return e.ids=(e.ids??0)+1,`fx-${jr(`${e.id}#${e.ids}`)}`}var za=new Map;function Du(e){let t=za.get(e);return t===void 0&&za.set(e,t=jr(e).slice(0,6)),t}function Ga(e){let t=e.getAttribute(K)??"",r=t.indexOf("-");return r<0?"":t.slice(r+1)}function Li(e){let t=e.getAttribute(K);t&&P?.get(t)===e&&P.delete(t)}function Iu(){if(!Hr())return null;let e=k();if(!e)return null;let t=Pi(e),r={id:t.id+(t.next++).toString(36)+".",next:0},n=F(e);return(n.contexts=new Map).set(Lr,r),n}function Xa(e){let t=k();t&&(t.contexts??=new Map).set(Lr,{id:e,next:0})}var P=null;function ji(e){P??=new Map;for(let t of e.querySelectorAll(`[${K}]`)){let r=t.getAttribute(K);P.has(r)||P.set(r,t)}}function Wr(){P=null}function Vr(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 Mu(e){if(!(!P||e.length===0))for(let[t,r]of P)e.some(n=>n===r||n.contains(r))&&P.delete(t)}function Pu(e,t){if(!e||!P)return null;let r=P.get(e);return!r||r.localName!==t.toLowerCase()?null:(P.delete(e),r)}var Lu=Symbol.for("fluixi.owner");function Mi(e){let t=k();t&&(e[Lu]=t)}function ju(e){if(e instanceof Element){e.localName.includes("-")&&Mi(e);for(let t of e.querySelectorAll("*"))t.localName.includes("-")&&Mi(t)}}var Hu=/<[a-z][\w.]*-/i;function Wu(e,t){Hu.test(t)&&ju(e)}function Vu(e,t){let r=e[Ne];return r!==void 0&&(t[Ne]=r),t}function Bu(e,t){let r=De(e.nextSibling,t);if(typeof r=="function"){let n=r;return Vu(n,(...o)=>h.active?De(e.nextSibling,()=>{let a=n(...o);for(;typeof a=="function";)a=a();return a}):n(...o))}return r}function ue(){ms({keyed:Hr,next:_u,salt:Du,claim:Pu,keep:Mu,scope:Iu,handOwner:Mi,handOwnerTree:Wu,holeScope:Bu,resume:De,unkeyed:qu})}function qu(e){let t=x()?H():void 0;if(!t||t.hydrationKeys===!1)return e();let r=t.hydrationKeys;t.hydrationKeys=!1;try{return e()}finally{t.hydrationKeys=r}}var Ya=!1;function ec(){Ya||(Ya=!0,Fo({createElement:(e,t)=>new At(e,t),createText:e=>new $t(e),createRaw:e=>new La(e),parseTemplate:(e,t)=>Ba(e,t),createComment:e=>new Ir(e)}))}function tc(e,t={}){let r=x();ec(),ue(),de(!0);let n=bt(t.event);n.hydrationKeys=t.hydrationKeys!==!1;try{return xt(n,()=>V(i=>{try{let o=typeof e=="function"?e():e;return Y(o)}finally{i()}}))}finally{wt(n),de(r)}}var Za=!1,Qa=new WeakMap;function Fu(){Za||(Za=!0,vn(e=>{H()?.pending.add(e)}),Ze(()=>H()?.nextResourceId()??""),xn((e,t)=>{e&&H()?.data.set(e,t)}),$n(()=>{let e=H();if(!e)return;let t=Qa.get(e);return t||Qa.set(e,t=kn()),t}))}var Hi=null;function rc(e){Hi=e}function Wi(e){if(e.data.size===0)return"";let t={};for(let[n,i]of e.data){let o=i;if(Hi)try{o=Hi(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=Mr(JSON.stringify(t));return r==="{}"?"":`<script type="application/json" id="${Rt}">${r}<\/script>`}var Uu=50;async function nc(e,t={}){let r=x();ec(),ue(),de(!0),Fu();let n=bt(t.event);n.hydrationKeys=t.hydrationKeys!==!1;try{return await xt(n,async()=>{t.preload&&await t.preload(t.event);let i,o=null,a=()=>{};V(l=>{a=l,o=k(),i=typeof e=="function"?e():e});let s=()=>{try{R(o,()=>Y(i))}catch{}};s();let c=0;for(;n.pending.size>0&&c++<Uu;){let l=Array.from(n.pending);n.pending.clear(),await Promise.allSettled(l),await Bt(),s()}let u=R(o,()=>Y(i))+Wi(n);return a(),u})}finally{wt(n),de(r)}}function qr(){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 Br=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);var Ku=Symbol.for("fluixi.ownsContent");function ac(e){return e.localName.includes("-")?e.hasAttribute("data-fx-ssr")||e[Ku]===!0:!1}var ic=Symbol.for("fluixi.serverContent");function cc(e){let t=e;t[ic]||(t[ic]=Array.from(e.childNodes))}function zu(e){qr();let t=h.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(Li(t),Br.has(e.toLowerCase())||ac(t)?(Br.has(e.toLowerCase())||cc(t),h.cursor=t.nextSibling):(h.parents.push(t),h.cursor=t.firstChild),t):null}function Ju(e){Br.has(e.localName)||ac(e)?(Br.has(e.localName)||cc(e),h.cursor=e.nextSibling):(h.parents.push(e),h.cursor=e.firstChild)}function Gu(e,t){qr();let r=h.cursor;if(r&&r.nodeType===1&&r.tagName.toLowerCase()===e.toLowerCase()){let n=Ga(r);return t&&n&&n!==t?null:(Li(r),h.cursor=r.nextSibling,r)}return null}function Xu(e){if(e===""){let r=h.cursor;return r&&r.nodeType===3&&r.data!==""?(h.cursor=r.nextSibling,r.data="",r):null}qr();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&&(t.data=e),t)}return null}function Yu(e){qr();let t=h.cursor;return t&&t.nodeType===8&&t.data===e?(h.cursor=t.nextSibling,t):null}var oc=!1;function lc(){oc||(oc=!0,vs({hydrateElement:zu,hydrateText:Xu,hydrateMarker:Yu,hydrateStatic:Gu,enterElement:Ju}))}var sc=()=>typeof location>"u"?null:`${location.pathname}${location.search}`;function xe(e,t,r){lc(),h.active=!0,h.cursor=t.firstChild,h.parents=[],ue(),Wr(),ji(t);let n=Pr(),i=r?.resourceNamespace,o=0;Ze(()=>i?`${i}:r${o++}`:`r${o++}`);let a=sc();bn(n?s=>s in n&&sc()===a?{value:n[s]}:void 0:null);try{return be(e,t)}finally{h.active=!1,h.cursor=null,h.parents=[],zn()}}function uc(e,t){ue(),lc(),ji(e);let r={active:h.active,cursor:h.cursor,parents:h.parents};h.active=!0,h.cursor=e.firstChild,h.parents=[];try{N(e,t()),Vr(e)}finally{h.active=r.active,h.cursor=r.cursor,h.parents=r.parents,r.active||zn()}}var Vi="fluixi-island";function pc(e){let t=e.component,r=e.props??{},n=e.name,i=ve(Vi),o=n??t.name??"Island";j(i,"name",o),j(i,"props",JSON.stringify(r??{}));let a=x()?H():void 0;if(a){let s=a.nextIslandNamespace(o);N(i,()=>a.withResourceScope(s,()=>t(r)))}else N(i,()=>t(r));return i}var fc=!1;function Zu(){if(fc||typeof document>"u")return;fc=!0;let e=document.createElement("style");e.textContent=`${Vi}{display:contents}`,document.head.appendChild(e)}function dc(e){if(typeof document>"u")return;Zu();let t=document.querySelectorAll(Vi),r=new Map;t.forEach(n=>{let i=n.getAttribute("name")??"",o=r.get(i)??0;r.set(i,o+1);let a=e[i];if(!a){typeof process>"u"&&console.warn(`[fluixi] island "${i}" has no component in the registry, left static.`);return}let s={};try{s=JSON.parse(n.getAttribute("props")||"{}")}catch{}xe(()=>a(s),n,{resourceNamespace:`${i}#${o}`})})}function hc(e,...t){throw new Error("html`` was not compiled, enable the html format: fluixi({ format: 'html' }).")}function mc(e,...t){throw new Error("svg`` was not compiled, enable the html format: fluixi({ format: 'html' }).")}function yc(e,...t){throw new Error("css`` was not compiled: component styles need @fluixi-css/vite next to the fluixi plugin.")}var Qu={createComponent:we,createElement:Vn,createNativeElement:ve,createTemplate:ut,cloneTemplate:ir,templateNode:oi,template:si,holeContent:dt,holeEnd:pt,holeScope:ft,createPortal:ui,render:be,hydrate:xe,insert:N,appendChildren:qn,removeChildren:Bn,spread:ci,applyProps:mt,mergeProps:li,bindPair:fi,setProperty:se,setDynamicProperty:je,setAttribute:j,setDynamicAttribute:Le,removeAttribute:Wn,getAttribute:Hn,setClassName:ye,addClass:Pn,removeClass:Ln,toggleClass:jn,setStyles:Jt,delegateEvents:lt,addDelegatedEventListener:nr,removeDelegatedEventListener:at,handleRef:ge,resetIntegration:xi,isIntegrationInitialized:wi},ef=Qu;var Fr={kind:"eager"},tf=["pointerdown","focusin","keydown"],vc=new Set(["eager","idle","visible","interaction","media","never"]),Be=class extends Error{};function gc(e,t){let r=e.slice(5);if(!vc.has(r))throw new Be(`Unknown load strategy 'load:${r}'. Expected one of ${[...vc].join(", ")}.`);switch(r){case"eager":return Fr;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?rf(t):[...tf]};case"media":if(!t)throw new Be(`'load:media' needs a query, e.g. load:media="(min-width: 1024px)".`);return{kind:"media",query:t};default:throw new Be(`Unhandled load strategy '${r}'.`)}}function rf(e){let t=e.split(/[\s,]+/).map(r=>r.trim()).filter(Boolean);if(t.length===0)throw new Be("'load:interaction' was given no event names.");return t}function bc(e){return e.kind!=="eager"}var qi=["Show","For","Index","Switch","Match","Portal","Dynamic","ErrorBoundary"],Fi=["Suspense","SuspenseList","Await"],Ur=["Router","Outlet","Redirect","Link"],Oy=[...qi,...Fi,...Ur],Ui=new Set([...qi,...Fi]);function Sc(e={}){let{controlFlowModule:t="@fluixi/dom",coreModule:r="@fluixi/core",routerModule:n="@fluixi/core/router"}=e,i={};for(let o of qi)i[o]=t;for(let o of Fi)i[o]=r;for(let o of Ur)i[o]=n;return i}function wc(e,t={}){let{resolver:r,isBound:n,modules:i,strategyFor:o}=t,a=Sc(i),s=new Map,c=new Set,u=f=>{let{name:d}=f;if(!d||d.includes(".")||n?.(d))return;let y=l(d);if(!y){c.add(d);return}let v=y.origin==="builtin"&&Ui.has(d)?Fr:o?.(f)??Fr;f.source={...y,loading:v},s.set(d,f.source)},l=f=>{if(Ui.has(f))return{module:a[f],export:f,origin:"builtin"};let d=r?.resolve(f);if(d)return{module:d.module,export:d.export,origin:"rule"};if(Ur.includes(f))return{module:a[f],export:f,origin:"builtin"}};return Kr(e,f=>{f.kind==="component"&&u(f)}),{resolved:s,unresolved:[...c]}}function Kr(e,t){let r=Array.isArray(e)?e:[e];for(let n of r){t(n);let i=n.children;i&&Kr(i,t)}}function xc(e){let t=[];Kr(e,o=>{o.kind==="component"&&o.source&&t.push(o)});let r=new Set,n=new Set;for(let o of t){let{module:a,loading:s}=o.source;s.kind==="eager"&&r.add(a),s.kind==="never"&&n.add(a)}let i=new Map;for(let o of t){let a=o.source;!bc(a.loading)||a.loading.kind==="never"||r.has(a.module)&&(a.loading={kind:"eager"},i.set(a.module,(i.get(a.module)??0)+1))}return{collapsed:i,conflicted:[...n].filter(o=>r.has(o))}}function nf(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 Ec(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 s of i.children)n(s)||(o=!1);let a;for(let s of i.props)if(a=nf(s),a)break;return!a&&!o&&(a=of(i)),i.static=!a,a?r.set(i,a):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 of(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 kc={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},sf=/&(?:#[xX]([0-9a-fA-F]{1,6})|#([0-9]{1,7})|([a-zA-Z][a-zA-Z0-9]{1,31}));/g;function zr(e){return e.includes("&")?e.replace(sf,(t,r,n,i)=>{let o=r?parseInt(r,16):n?parseInt(n,10):Object.prototype.hasOwnProperty.call(kc,i)?kc[i]:void 0;return o!==void 0&&o<=1114111?String.fromCodePoint(o):t}):e}var q="@fluixi/reactive/signal",Ki={$signal:{export:"signal",module:q,returns:"signal-handle"},$memo:{export:"memo",module:q,returns:"memo-handle"},$effect:{export:"effect",module:q,returns:"effect"},$store:{export:"store",module:"@fluixi/reactive/store",returns:"store-handle"},$resource:{export:"resource",module:q,returns:"resource-handle"},$cachedResource:{export:"cachedResource",module:"@fluixi/reactive/cached-resource",returns:"resource-handle"},$selector:{export:"createSelector",module:q,returns:"memo-accessor"},$deferred:{export:"createDeferred",module:q,returns:"memo-accessor"},$untrack:{export:"untrack",module:q,returns:"plain"},$untrackStore:{export:"untrackStore",module:"@fluixi/reactive/store",returns:"plain"},$batch:{export:"batch",module:q,returns:"plain"},$cleanup:{export:"onCleanup",module:q,returns:"plain"},$root:{export:"root",module:q,returns:"plain"},$context:{export:"context",module:q,returns:"plain"},$renderEffect:{export:"renderEffect",module:q,returns:"effect"},$computed:{export:"computed",module:q,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 Wy=new RegExp(`\\$(?:${Object.keys(Ki).map(e=>e.slice(1)).join("|")})\\s*\\(`);var $c="__fx_source";var af="__fx_hole",Ee=(e,t,r,n)=>`(globalThis.${af} ?? ((f) => f))(${e},${t},${r}${n===void 0?"":`,${JSON.stringify(n)}`})`,cf="__fx_props",Ac=(e,t)=>`(globalThis.${cf} ?? ((p) => p))(${e},${JSON.stringify(t)})`;var zi={version:1,module:"@fluixi/dom",symbols:["createNativeElement","insert","spread","setAttribute","delegateEvents","createComponent","createMemo","untrack","Show","For","Index","Switch","Match","Dynamic","ErrorBoundary"]},Yy={version:2,module:"@fluixi/dom",symbols:[...zi.symbols,"template","cloneTemplate","walk"]};var lf=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Rc={className:"class",htmlFor:"for"},Ji=new Set(["innerHTML","outerHTML","innerText","textContent","value","checked","selected","muted","defaultValue","defaultChecked","children","ref"]),uf=new Set(["script","style","textarea","title"]);function Gi(e){return uf.has(e)}function Xi(e){return Rc[e]??e}function fe(e){return e.kind!=="attr"||e.expr!==void 0||e.name.includes(":")?!1:!Ji.has(e.name)}function Yi(e){if(!e.static||Gi(e.tag))return!1;for(let t of e.props)if(!fe(t))return!1;for(let t of e.children)if(t.kind!=="text"&&!(t.kind==="element"&&Yi(t)))return!1;return!0}function qe(e){let t=e.props.map(hf).filter(Boolean).join(""),r=`<${e.tag}${t}>`;return lf.has(e.tag)?r:`${r}${e.children.map(ff).join("")}</${e.tag}>`}function ff(e){if(e.kind==="text")return yf(e.value);if(e.kind!=="element")throw new Error(`serializeStatic: unexpected ${e.kind}`);return qe(e)}var pf=new Set(["draggable","spellcheck","contenteditable"]);function df(e){return e.startsWith("aria-")||pf.has(e.toLowerCase())}function hf(e){let t=Rc[e.name]??e.name,r=e.literal;return(r===!0||r===!1||r===void 0)&&df(t)?` ${t}="${r!==!1}"`:r===!0||r===void 0?` ${t}`:r===!1||r===null?"":` ${t}="${mf(String(r))}"`}function mf(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function yf(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Jr(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 vf="<!--fx-->",gf="<!--fx/-->";function Fe(e){return e.kind==="expr"||e.kind==="component"||Zi(e)}function Zi(e){return e.kind==="element"&&e.tag.includes("-")}function Qi(e){return Zi(e)?!0:"children"in e&&Array.isArray(e.children)&&e.children.some(Qi)}function bf(e){return e.kind==="text"||e.kind==="element"&&Cc(e)}var Sf=new Set(["indeterminate"]);function wf(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"?fe(e)?"serialize":"class":t==="classList"?fe(e)?"serialize":e.reactive?"classListDynamic":"classList":t==="style"?fe(e)?"serialize":e.reactive?"styleDynamic":"style":t.includes(":")||Ji.has(t)?null:Sf.has(t)?"property":e.expr===void 0?fe(e)?"serialize":null:"attr"}function xf(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 Tt(e){let t=e.tag.includes("-"),r={serialize:[],bindings:[]};for(let n of xf(e)){let i=wf(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 Cc(e){return e.svg||Zi(e)||Gi(e.tag)||!Tt(e)?!1:e.children.every(t=>bf(t)||Fe(t))}function Tc(e){if(Fe(e))return!0;let t=e.children;return t?t.some(Tc):!1}function Oc(e){if(e.kind!=="element")return!1;let t=Tt(e);return t&&t.bindings.length>0?!0:e.children.some(Oc)}function Ct(e){return Tc(e)||Oc(e)}function _c(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"||_c(t))}function Nc(e,t=!1){if(!Cc(e)||!_c(e)||!Ct(e))return null;let r=[],n=[],i=[],o=0,a=l=>{let f=`_n$${o++}`;return r.push({ref:f,expr:l}),f},s=new Set;return t?c(e,"_el$"):u(e,"_el$"),{html:t?kf(e,s):Ef(e),tag:e.tag,steps:r,holes:n,bindings:i};function c(l,f){let d=Tt(l);if(d)for(let S of d.bindings)i.push({ref:f,prop:S.prop,kind:S.kind});let y=-1;l.children.forEach((S,g)=>{Ct(S)&&(y=g)});let v=null,p=!1,b=null,T=()=>v?`${v}.nextSibling`:`${f}.firstChild`;for(let S=0;S<=y;S++){let g=l.children[S];if(Fe(g)){let W=l.children[S+1];if(!W){n.push({parentRef:f,node:g});continue}if(Fe(W)||W.kind==="text"&&p){s.add(g);let J=a(T());n.push({parentRef:f,anchorRef:J,node:g}),v=J,p=!1;continue}b=a(T()),n.push({parentRef:f,anchorRef:b,node:g});continue}let L=b??a(T());b=null,g.kind==="element"&&Ct(g)&&c(g,L),v=L,p=g.kind==="text"}}function u(l,f){let d=Tt(l);if(d)for(let p of d.bindings)i.push({ref:f,prop:p.prop,kind:p.kind});let y=-1;l.children.forEach((p,b)=>{Ct(p)&&(y=b)});let v=null;for(let p=0;p<=y;p++){let b=l.children[p],T=v?`${v}.nextSibling`:`${f}.firstChild`;if(Fe(b)){let g=a(T),L=a(`holeEnd(${g})`);n.push({parentRef:f,startRef:g,endRef:L,node:b}),v=L;continue}let S=a(T);b.kind==="element"&&Ct(b)&&u(b,S),v=S}}}function Ef(e){return qe(eo(e)).split(to).join(vf+gf)}function kf(e,t){return qe(eo(e,t)).split(to).join("<!>").split(Dc).join("")}function eo(e,t){let r=Tt(e);return{...e,props:r?r.serialize:[],children:e.children.map(n=>Fe(n)?{kind:"text",value:!t||t.has(n)?to:Dc}:n.kind==="element"?eo(n,t):n)}}var to="\0fx-hole\0",Dc="\0fx-none\0";function Ic(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 Mc(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 a=Mc(e,r);if(a<0)return-1;r=a}else if(o==='"'||o==="'"){let a=Ic(e,r);if(a<0)return-1;r=a}else o==="{"?i++:o==="}"&&i--,r++}}else r++}}return-1}function $f(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 Af(e){return e!==""&&/[A-Za-z0-9_$)\]]/.test(e)}function Rf(e){let t=0,r="",n=0;for(;n<e.length;){let i=e[n];if(i==='"'||i==="'"){let o=Ic(e,n);if(o<0)return null;n=o,r=i}else if(i==="`"){let o=Mc(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==="/"&&!Af(r)){let o=$f(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})`:Rf(r)===!1?e:`(${e})`}function Cf(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function Gr(e){return Cf(e)?e:JSON.stringify(e)}function Lc(e){if(e.expr!==void 0){if(e.name==="ref"&&e.at)return Ee(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?Ee(t,e.at.line,e.at.column,e.directive):t}return JSON.stringify(e.literal??!0)}function Tf(e){return e.expr!==void 0?M(e.expr,"value"):JSON.stringify(e.literal??!0)}var Of=/^(?:-?\d[\d_]*(?:\.\d+)?(?:e[+-]?\d+)?|"(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)*'|true|false|null)$/;function _f(e){return e.expr===void 0||Of.test(e.expr.trim())}function jc(e){return e===void 0?String(e):/^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*)*$/.test(e.trim())?e:`() => (${e})`}function Nf(e,t,r){let n=e.filter(s=>s.kind==="spread"),o=e.filter(s=>s.kind!=="spread").map(s=>`${Gr(s.name)}: ${Lc(s)}`);t!=null&&o.push(`children: ${t}`);let a=`{ ${o.join(", ")} }`;return n.length>0?(r.add("mergeProps"),`mergeProps(${n.map(s=>jc(s.expr)).join(", ")}, ${a})`):a}function Df(e,t){return t?Ee(e,t.line,t.column):e}function Hc(e,t,r){if(e.length===1)return Ue(e[0],t,r);let n=!1;return`[${e.map(o=>{let a=Ue(o,t,r);return o.kind==="element"&&n?(t.add("deferElement"),`deferElement(() => ${M(a,"arrowBody")})`):((o.kind==="component"||o.kind==="expr"&&o.reactive)&&(n=!0),a)}).join(", ")}]`}function If(e,t,r,n,i,o){n.add("createComponent");let a=t.filter(v=>v.kind==="spread"),s=t.filter(v=>v.kind!=="spread"),c=[],u=[];for(let v of s)(_f(v)?c:u).push([v.name,Tf(v)]);r.length>0&&u.push(["children",Hc(r,n,i)]);let l=c.map(([v,p])=>`${Gr(v)}: ${p}`),f=`{ ${[...l,...u.map(([v,p])=>`get ${Gr(v)}() { return ${p}; }`)].join(", ")} }`;if(u.some(([,v])=>/\bthis\b/.test(v))){let v=u.map(([b,T])=>`${JSON.stringify(b)}: () => (${T})`),p=u.map(([b])=>`get ${Gr(b)}() { return _$t[${JSON.stringify(b)}](); }`);f=`((_$t) => ({ ${[...l,...p].join(", ")} }))({ ${v.join(", ")} })`}a.length>0&&(n.add("mergeProps"),f=`mergeProps(${a.map(v=>jc(v.expr)).join(", ")}, ${f})`);let d={};for(let v of s)v.at&&(d[v.name]=[v.at.line,v.at.column]);Object.keys(d).length&&(f=Ac(f,d));let y=o?`globalThis.${$c}?.(${JSON.stringify(o.file)},${o.line},${o.column},${JSON.stringify(e)}), `:"";return y?`(${y}createComponent(${e}, ${f}))`:`createComponent(${e}, ${f})`}function ro(e){let t=e.prop.name;return e.kind==="boolAttr"||t.startsWith("prop:")||t.startsWith("attr:")?t.slice(5):Xi(t)}function Pc(e,t){let{ref:r,prop:n,kind:i}=e,o=Lc(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(ro(e))}, ${o});`;case"property":return t.add("setDynamicProperty"),`setDynamicProperty(${r}, ${JSON.stringify(ro(e))}, ${o});`;case"boolAttr":return t.add("setDynamicBoolAttribute"),`setDynamicBoolAttribute(${r}, ${JSON.stringify(ro(e))}, ${o});`;case"event":return Vc&&n.event.delegated?`${r}.$$${n.event.name} = ${o};`:(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"),n.assign?`handleRef(${o}, ${r}, (_v) => (${n.expr} = _v));`:`handleRef(${o}, ${r});`;case"use":return t.add("applyUse"),`applyUse(${r}, ${o});`}}function Mf(e,t){let r=Xi(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 Wc=!1,Xr=!1,Vc=!1;function Ue(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?Ee(n,e.at.line,e.at.column):n}case"fragment":return e.children.length===0?"null":Hc(e.children,t,r);case"component":return Df(If(e.name,e.props,e.children,t,r,e.at),e.bindAt??e.at);case"element":{if(r&&e.static&&!e.svg&&Yi(e)&&!Qi(e)){let s=`_tmpl$${r.length}`;r.push({id:s,html:qe(e),tag:e.tag,svg:!1});let c=Jr(e);return Xr?`${s}(${c?JSON.stringify(c):""})`:(t.add("templateNode"),c?`templateNode(${s}, ${JSON.stringify(e.tag)}, false, false, ${JSON.stringify(c)})`:`templateNode(${s}, ${JSON.stringify(e.tag)})`)}if(r&&Wc){let s=Nc(e,Xr);if(s&&Xr){t.add("insert");let c=`_tmpl$${r.length}`;r.push({id:c,html:s.html,tag:s.tag,svg:!1});let u=Jr(e),l=[`const _el$ = ${c}(${u?JSON.stringify(u):""});`];for(let f of s.steps)l.push(`const ${f.ref} = ${f.expr};`);for(let f of s.bindings)l.push(Pc(f,t));for(let f of s.holes){let d=f.anchorRef?`, ${f.anchorRef}`:"";l.push(`insert(${f.parentRef}, ${Ue(f.node,t,r)}${d});`)}return l.push("return _el$;"),`(() => { ${l.join(" ")} })()`}if(s){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:s.html,tag:s.tag,svg:!1});let u=Jr(e),l=[`const _el$ = templateNode(${c}, ${JSON.stringify(s.tag)}, true${u?`, false, ${JSON.stringify(u)}`:""});`];for(let f of s.steps)l.push(`const ${f.ref} = ${f.expr};`);for(let f of s.bindings)l.push(Pc(f,t));for(let f of s.holes)l.push(`insert(${f.parentRef}, holeScope(${f.startRef}, () => ${M(Ue(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=[],a=e.at?`${n}, ${e.svg}, ${JSON.stringify(e.at)}`:e.svg?`${n}, true`:n;if(o.push(`const ${i} = createNativeElement(${a});`),e.props.length>0)if(!e.svg&&e.props.every(fe))for(let s of e.props)o.push(Mf(i,s));else{t.add("spread");let s=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: ${Nf(e.props,null,t)}${s}${u}${l} });`)}for(let s of e.children){t.add("insert");let c=Ue(s,t,r),u=s.kind==="expr"&&(s.reactive||!Lf(s.code))||s.kind==="component";o.push(u?`insert(${i}, ${c}, null);`:`insert(${i}, ${c});`)}return o.push(`return ${i};`),`(() => { ${o.join(" ")} })()`}}}var Pf=/^\s*(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`$]*`|-?\d[\d_.eE+-]*|true|false|null|undefined)\s*$/,Lf=e=>Pf.test(e);function Yr(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 Zr={name:"imperative",contract:zi,emit(e,t){let r=new Set,n=t?.templateClone!==!1?[]:void 0;return Wc=t?.partialTemplates===!0,Vc=t?.assignEvents===!0,Xr=t?.client===!0,{code:Ue(e,r,n),imports:Array.from(r),templates:n}}};var no=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mousedown","mouseup"]);function io(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 jf=new Set(["a","button","input","select","textarea","summary","details","option","label"]),Hf=new Set(["keydown","keyup","keypress"]);function Ke(e,t){return e.attributes.find(r=>"name"in r&&r.name===t)}function Wf(e){return e.attributes.some(t=>t.kind==="Spread")}function Qr(e,t){let r=Ke(e,t);if(!r||r.kind!=="Attribute"||!r.value)return;let n=r.value;return n.kind==="static"?n.value:void 0}function Vf(e){let t=Qr(e,"role");return t==="presentation"||t==="none"?!0:Qr(e,"aria-hidden")==="true"}function Bc(e,t){return e.attributes.some(r=>r.kind==="EventBinding"&&t(r.name))}function qc(e){let t=[],r=(i,o,a)=>{t.push({code:o,message:a,severity:"warning",loc:i.loc})},n=i=>{for(let o of i){o.kind==="Element"&&Bf(o,r);let a="children"in o?o.children:void 0;a&&n(a)}};return n(e.children),t}function Bf(e,t){if(Wf(e))return;let r=e.tag.toLowerCase();r==="img"&&!Ke(e,"alt")&&!Vf(e)&&t(e,"a11y-img-alt",'An `img` needs an `alt`. Use `alt=""` when the image is decorative.'),r==="a"&&!Ke(e,"href")&&!Ke(e,"role")&&t(e,"a11y-anchor-href","An `a` without `href` is not a link. Use a `button` for an action."),r==="iframe"&&!Ke(e,"title")&&t(e,"a11y-iframe-title","An `iframe` needs a `title` describing its content.");let n=Qr(e,"tabindex")??Qr(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."),!jf.has(r)&&Bc(e,i=>i==="click")&&!Ke(e,"role")&&!Bc(e,i=>Hf.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 oo(e){let t=(r,n)=>{r.parent=n;let i=Fc(r);for(let o of i)t(o,r)};return t(e,null),e}function Fc(e){switch(e.kind){case"Root":case"Element":case"Component":case"Fragment":return e.children;default:return[]}}var Uc=new Set(["capture","once","passive","prevent","stop","self"]);function pe(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 Kc=(e,t)=>({kind:"Attribute",name:t?e.name.slice(1):e.name,value:e.value,boolean:t,loc:e.loc}),en=[{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 a of i)Uc.has(a)||e.report("invalid-directive",`Unknown event modifier ".${a}" — expected one of ${[...Uc].join(", ")}`);return{kind:"EventBinding",name:o,syntax:t,modifiers:i,hole:pe(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:pe(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:pe(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:pe(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:pe(e,"if directive"),loc:e.loc})},{id:"each",elementOnly:!0,match:e=>e==="each",build:e=>({kind:"EachDirective",hole:pe(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:pe(e,"ref binding"),loc:e.loc})},{id:"property",match:e=>e[0]===".",build:e=>({kind:"PropertyBinding",name:e.name.slice(1),hole:pe(e,"property binding"),loc:e.loc})},{id:"boolean",match:e=>e[0]==="?",build:e=>Kc(e,!0)}];function so(e,t=en,r={component:!1}){for(let n of t)if(!(n.elementOnly&&r.component)&&n.match(e.name))return n.build(e);return Kc(e,!1)}var ao=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 co=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"]),zc=new Set(["script","style","textarea","title"]),Jc=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Gc(e){return e.length>0&&(e[0]!==e[0].toLowerCase()||e.includes("."))}var qf=/[A-Za-z0-9\-_:@.?]/,Ff=class{constructor(e,t){this.diagnostics=[],this.open=[],this.r=new ao(e),this.svg=t.svg??!1,this.directives=t.directives??en,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 oo(r),this.validateTree(r),this.accessibility&&this.diagnostics.push(...qc(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(a=>a.kind==="ElseDirective")&&(n!=null&&(n.kind==="Element"||n.kind==="Component")&&n.attributes.some(s=>s.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=Gc(t),n=this.parseAttributes(r);this.foldEachKey(n,e),this.r.skipWhitespace();let i=t.toLowerCase(),o=!r&&zc.has(i),a=!r&&Jc.has(i),s=!1,c=[];if(this.r.startsWith("/>"))this.r.advance(),this.r.advance(),s=!0;else if(this.r.peek()===">"&&this.r.advance(),!a)if(this.open.push(t),c=o?this.parseRawText(t):this.parseChildren(),this.open.pop(),this.r.startsWith("</")){let f=this.r.mark(),d=this.consumeCloseTag();d&&d!==t&&(this.open.includes(d)?(this.r.reset(f),this.report("unclosed-tag","error",`Unclosed <${t}>`,this.r.span(e))):this.report("mismatched-close-tag","error",`Expected </${t}>, got </${d}>`,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:s,loc:u};let l=this.svg||co.has(t)?"svg":"html";return{kind:"Element",tag:t,namespace:l,attributes:n,children:c,selfClosing:s,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 a=this.r.takeHole();t.push({kind:"Expression",hole:a.index,loc:a.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 s=this.r.takeHole();t.push({kind:"Spread",hole:s.index,loc:s.loc});continue}if(this.r.startsWith("...")){let s=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(s)})}else this.report("invalid-binding","error","Spread `...` must be followed by ${…}",this.r.span(s));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 a={name:n,nameLoc:i,value:o,loc:this.r.span(r),report:(s,c)=>this.report(s,"error",c,this.r.span(r))};t.push(so(a,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,a=0;for(let l of e)l.kind==="EachDirective"?(r=l,i++):l.kind==="IfDirective"?n++:l.kind==="ElseDirective"?o++:l.kind==="RefBinding"&&a++;let s=this.r.span(t);i>1&&this.report("duplicate-directive","error","Multiple `each` directives on one element",s),n>1&&this.report("duplicate-directive","error","Multiple `if` directives on one element",s),a>1&&this.report("duplicate-directive","error","Multiple `ref` bindings on one element",s),n>0&&o>0&&this.report("invalid-directive","error","`if` and `else` cannot be on the same element",s);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",s);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=>qf.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 tn(e,t={}){return new Ff(e,t).parse()}function Uf(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 Xc(e,t={}){return tn(Uf(e),t)}function Kf(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}var zf="container";function Yc(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Jf=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}=Zr.emit(e,{});for(let i of r)this.used.add(i);return Yr(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(a=>a.kind==="IfDirective");if(o&&o.kind==="IfDirective"){let a=r+1;a<e.length&&this.isBlankText(e[a])&&a++;let s=e[a],c=s&&(s.kind==="Element"||s.kind==="Component")&&s.attributes.some(u=>u.kind==="ElseDirective");t.push(this.lowerIf(n,o.hole,c?s:null)),c&&(r=a);continue}}let i=this.lowerNode(n);i&&t.push(i)}return t}isBlankText(e){return e.kind==="Text"&&!e.raw&&io(e.value)===""}lowerNode(e){switch(e.kind){case"Text":{if(e.raw)return{kind:"text",value:e.value};let t=zr(io(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(s=>s!==t),a=this.lowerComponent({...e,kind:"Component",tag:"Dynamic",tagHole:null,attributes:o});return a.props.unshift({name:"component",kind:"attr",expr:`() => ${M(this.hole(t.value.hole).code,"arrowBody")}`}),a}let r=this.lowerEach(e),n=r?[r]:this.lowerChildren(e.children);if(e.tag===zf)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},d={name:u,kind:"attr",expr:this.emit(f),jsxElement:!0},y=r.findIndex(v=>v.name===u);y>=0?r[y]=d:r.push(d)}let o=e.attributes.find(u=>u.kind==="LoadDirective");if(o?.dynamic)throw new Be(`'load:${o.strategy}' needs a literal value, not an expression: the strategy is compile-time.`);let a=o?gc(`load:${o.strategy}`,o.modifier):void 0,s=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}:{},...s?{bindAt:s}:{},...a?{load:a}:{},...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)},a=o.kind==="Element"?this.lowerElement(o):this.lowerComponent(o),s=t.get(i.value.value)??[];s.push(a),t.set(i.value.value,s);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 s=this.stripAndLower(r,c=>c.kind==="ElseDirective");i.push({name:"fallback",kind:"attr",expr:this.emit(s),jsxElement:!0})}let o=this.stripAndLower(e,s=>s.kind==="IfDirective"),a=this.tagAt(e);return{kind:"component",name:"Show",props:i,children:[o],...a?{at:a}:{},...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 a=[{kind:"expr",code:o,reactive:!1}],s=this.tagAt(e);return{kind:"component",name:"For",props:n,children:a,...s?{at:s}:{},...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 d=`() => ${M(f.code,"arrowBody")}`;return`${JSON.stringify(l)}: ${f.at?Ee(d,f.at.line,f.at.column):d}`},i=[],o=[],a,s=[],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)),a??=f.at;break}case"StyleDirective":{let f=this.hole(l.hole);s.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,...a?{at:a}:{}}),s.length>0){let l=`{ ${s.join(", ")} }`,f=i.findIndex(d=>d.name==="style");if(f===-1)i.push({name:"style",kind:"attr",expr:l,reactive:!t&&r,...c?{at:c}:{}});else{let d=i[f],y=d.expr===void 0?JSON.stringify(d.literal):d.reactive?`() => ${M(d.expr,"arrowBody")}`:d.expr;i[f]={name:"style",kind:"attr",expr:`[${y}, ${l}]`,reactive:!1,...d.at?{at:d.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"+Yc(e.name),kind:"event",event:{name:t,delegated:no.has(t)},expr:r};let i=this.wrapHandler(r,e.modifiers),o=this.eventOptions(e.modifiers),a=o?`[${i}, ${o}]`:i;return{name:"on:"+t,kind:"attr",expr:a}}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 a=`bindPair(${r})`;return[{name:e,kind:"attr",expr:`${a}[0]()`,reactive:!0,directive:`bind:${e}`,...t.at?{at:t.at}:{}},{name:"on"+Yc(i),kind:"event",event:{name:i,delegated:no.has(i)},expr:`(e) => ${a}[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=zr(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,a,s=t.parts.map(c=>{if("text"in c)return Kf(zr(c.text));let u=this.hole(c.hole);return o=o||u.reactive,a??=u.at,"${"+u.code+"}"}).join("");return i.expr="`"+s+"`",i.reactive=o,a&&(i.at=a),i}};function Zc(e,t,r,n={}){let{root:i,diagnostics:o}=tn(e,{svg:n.svg});for(let a of o){if(a.severity==="error"){let s=n.positionAt?.(a.loc.start);throw new Error(`html template${s?` (${s.line}:${s.column+1})`:""}: ${a.message}`)}n.onDiagnostic?.(a)}return new Jf(t,r,n.sourceFile,n.positionAt).lowerRoot(i.children)}var Gf=e=>"components"in e;function Qc(e,t){return e.replace(/\$(\d+)/g,(r,n)=>t[Number(n)]??r)}function Xf(e,t){return typeof t=="string"?{module:t,export:e}:t}function el(e=[]){let t=new Map,r=[],n=[];for(let a of e){if(!Gf(a)){n.push(a);continue}for(let[s,c]of Object.entries(a.components)){let u=Xf(s,c),l=t.get(s);if(l&&l.module!==u.module){let f=r.find(d=>d.name===s);f?f.modules.push(u.module):r.push({name:s,modules:[l.module,u.module]});continue}t.set(s,u)}}let i=new Map;return{resolve:a=>{if(i.has(a))return i.get(a);let s=t.get(a);if(!s)for(let c of n){let u=a.match(new RegExp(c.match.source,c.match.flags.replace("g","")));if(u){s={module:Qc(c.module,u),export:c.export?Qc(c.export,u):a};break}}return i.set(a,s),s},names:()=>[...t.keys()],conflicts:()=>r}}var tl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yf=new Uint8Array(64),Zf=new Uint8Array(128);for(let e=0;e<tl.length;e++){let t=tl.charCodeAt(e);Yf[e]=t,Zf[t]=e}var Bv=1024*16;var rl="data-fx-s";function nl(e,t){let r=n=>{let i=n.children;if(i)for(let o=i.length-1;o>=0;o--){let a=i[o];a.kind==="element"&&a.tag==="style"&&t.owner?i.splice(o,1):r(a)}t.scope&&n.kind==="element"&&n.tag!=="style"&&n.props&&!n.props.some(o=>o.name===rl)&&n.props.unshift({name:rl,kind:"attr",literal:t.scope})};r(e)}function Qf(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 lo(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 il(Qf(e),e.holes,t)}function il(e,t,r={}){let n=new Set,i=[],o=Zc(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&&nl(o,r.templateStyles),Ec(o),wc(o,{resolver:el(r.resolve??[]),modules:{controlFlowModule:r.controlFlowModule??"@fluixi/dom",coreModule:r.coreModule??"@fluixi/core",routerModule:r.routerModule??"@fluixi/core/router"},strategyFor:u=>u.load}),xc(o);let{code:a,imports:s,templates:c}=Zr.emit(o,{templateClone:r.templateClone,partialTemplates:r.partialTemplates,assignEvents:r.assignEvents,client:r.client});for(let u of s)n.add(u);return r.hoistTemplates?{...i.length?{diagnostics:i}:{},code:a,imports:[...n],ir:o,templates:c}:{...i.length?{diagnostics:i}:{},code:Yr(a,c),imports:[...n],ir:o}}function ep(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 uo(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)ep(o,t);if(i)for(let o of n.children)o.kind==="Expression"&&t.set(o.hole,"render");uo(n.children,t,r);break}case"Root":case"Fragment":uo(n.children,t,r);break;default:break}}function ol(e){let t=new Map,r=new Set;return uo(e.root.children,t,r),{holes:t,components:r}}var fo={...Bi,createMemo:w},tp=["For","Index","Show","Switch","Match","Portal","Dynamic","ErrorBoundary","Suspense"],po=new Map;function al(e){for(let[t,r]of Object.entries(e))po.set(t,r)}function rp(e){return e==="text"||e==="attr"||e==="control"}function np(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"&&rp(i)?{code:`$$v[${n}]()`,reactive:!0}:{code:`$$v[${n}]`,reactive:!1}})}function ip(e){if(po.has(e))return po.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 op(e,t,r){let n=e,i=Xc(n,{svg:r}),o=i.diagnostics.filter(p=>p.severity==="error");if(o.length>0)throw new Error(`[fluixi] ${r?"svg":"html"}\`\`: ${o.map(p=>p.message).join("; ")}`);let{holes:a,components:s}=ol(i),{code:c,imports:u}=lo({statics:n,holes:np(t,a)},{svg:r}),l=u.filter(p=>!(p in fo));if(l.length>0)throw new Error(`[fluixi] no runtime binding for: ${l.join(", ")}`);let f=Array.from(new Set([...u,...tp])).filter(p=>p in fo),d=Array.from(s).filter(p=>!f.includes(p)),y=[...f,...d],v=new Function(...y,"$$v",`return (${c});`);return{run:p=>v(...f.map(b=>fo[b]),...d.map(ip),p)}}var sl=new WeakMap;function sp(e){let t="";for(let r of e)t+=typeof r=="function"?"f":"v";return t}function cl(e){return(t,...r)=>{let n=sl.get(t);n||(n=new Map,sl.set(t,n));let i=sp(r),o=n.get(i);return o||(o=op(t,r,e),n.set(i,o)),o.run(r)}}var ll=cl(!1),ul=cl(!0);return yl(ap);})();