@fluixi/reactive 1.0.0-alpha.78 → 1.0.0-alpha.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/reactive.cjs +1 -1
- package/dist/cdn/reactive.global.js +1 -1
- package/dist/cdn/reactive.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lib/index.cjs +1 -1
- package/dist/lib/index.mjs +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/version.generated.cjs +1 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/dist/version.generated.mjs +1 -1
- package/package.json +2 -2
package/dist/cdn/reactive.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var tt=Object.defineProperty;var Qn=Object.getOwnPropertyDescriptor;var Jn=Object.getOwnPropertyNames;var Zn=Object.prototype.hasOwnProperty;var er=(e,t)=>{for(var n in t)tt(e,n,{get:t[n],enumerable:!0})},tr=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Jn(t))!Zn.call(e,o)&&o!==n&&tt(e,o,{get:()=>t[o],enumerable:!(r=Qn(t,o))||r.enumerable});return e};var nr=e=>tr(tt({},"__esModule",{value:!0}),e);var To={};er(To,{$NAME:()=>Rn,$NODE:()=>Q,$PROXY:()=>vr,$RAW:()=>Fe,$SELF:()=>We,$SIGNAL:()=>br,$STORE:()=>An,$TRACK:()=>Ge,Observable:()=>N,SafeSubscriber:()=>qe,Signal:()=>mn,Store:()=>H,StoreAPI:()=>jn,Subject:()=>ot,Subscriber:()=>ie,Subscription:()=>se,SuspenseContext:()=>Ke,VERSION:()=>Ut,__DEV__:()=>Ce,batch:()=>$,clearAllCachedResources:()=>po,clearCachedResourceNamespace:()=>fo,combineSignal:()=>Ur,combineSignals:()=>Ir,createCachedResource:()=>lo,createChildOwner:()=>Bt,createComputed:()=>Xt,createComputedStore:()=>_n,createContext:()=>ce,createDebounce:()=>cn,createDebouncedResource:()=>ln,createDebouncedSignal:()=>St,createDeferred:()=>an,createEffect:()=>M,createErrorBoundary:()=>Tn,createMemo:()=>T,createMutableStore:()=>Rt,createRenderEffect:()=>Qt,createResource:()=>de,createRoot:()=>Y,createSelector:()=>un,createSignal:()=>h,createStore:()=>De,createStoreEffect:()=>Fn,createStoreMemo:()=>Dn,createSuspenseBoundary:()=>fn,debounceSignal:()=>Vr,disposeScope:()=>Lt,distinctSignal:()=>Dr,effect:()=>gr,everySignal:()=>_r,filterSignal:()=>Cr,findSignal:()=>Pr,flush:()=>Zt,getNode:()=>Mn,getOwner:()=>Re,getServerData:()=>Ee,getStoreNode:()=>qn,guardSignal:()=>$r,indexArray:()=>dr,isComponent:()=>rn,isMemo:()=>tn,isOwnerDisposed:()=>$t,isProvider:()=>sn,isResource:()=>nn,isSignal:()=>Le,isStore:()=>In,isStoreProxy:()=>Ye,isSuspense:()=>on,keyArray:()=>fr,makeArrayFlat:()=>lt,mapArray:()=>lr,mapSignal:()=>Ar,memo:()=>xr,mergeSignal:()=>Mr,modifiable:()=>Nn,nextResourceId:()=>Pe,omitSignal:()=>Br,on:()=>en,onCleanup:()=>F,operate:()=>rr,pickSignal:()=>jr,produceUtil:()=>Bn,provide:()=>le,provideErrorBoundary:()=>yn,provideSuspense:()=>dn,readChildren:()=>Ve,readSignal:()=>Hr,reconcileUtil:()=>Ln,reduceSignal:()=>Er,reportResourceData:()=>ke,resource:()=>hn,runWithOwner:()=>fe,selectSignal:()=>Nr,setOwner:()=>ut,setResourceDataSink:()=>bt,setResourceIdSource:()=>ht,setResourceTracker:()=>yt,setServerDataGetter:()=>mt,signal:()=>Sr,someSignal:()=>kr,sortSignal:()=>Fr,startTransition:()=>ct,store:()=>$n,throttleSignal:()=>Kr,trackResourcePromise:()=>X,untrack:()=>D,untrackStore:()=>At,unwrap:()=>Te,useContext:()=>Vt,useTransition:()=>Jt,whenSignal:()=>Lr,wrap:()=>Un,zipSignal:()=>qr});module.exports=nr(To);var Ut="1.0.0-alpha.78";function nt(e){return typeof e=="function"&&!/^class\s/.test(Function.prototype.toString.call(e))}function It(e){return e==null||Array.isArray(e)||typeof e=="function"||e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error?!1:typeof e=="object"}function rt(e){return e instanceof Promise||!!e&&(typeof e=="object"||typeof e=="function")&&"then"in e}var se=class e{constructor(t){this._closed=!1;this._parentOrParents=null;this._subscriptions=null;t&&(this._subscriptions=[t])}get closed(){return this._closed}unsubscribe(){if(this._closed)return;this._closed=!0;let{_parentOrParents:t,_subscriptions:n}=this;if(t instanceof e)t.remove(this);else if(t!==null)for(let r of t)r.remove(this);if(n){for(let r of n)if(nt(r)&&!(r instanceof e))try{r()}catch(o){console.error("Error in unsubscribe function:",o)}else if(It(r)&&typeof r.unsubscribe=="function")try{r.unsubscribe()}catch(o){console.error("Error unsubscribing child:",o)}this._subscriptions=null}}add(t){if(!t||t===this)return this;if(t.closed)return this;let{_closed:n,_subscriptions:r}=this;if(n){if(nt(t))try{t()}catch(o){console.error("Error in unsubscribe function:",o)}else if(t.unsubscribe)try{t.unsubscribe()}catch(o){console.error("Error unsubscribing:",o)}return this}return r||(this._subscriptions=[]),this._subscriptions.push(t),t instanceof e&&t._addParent(this),this}remove(t){let{_subscriptions:n}=this;if(!n)return;let r=n.indexOf(t);r!==-1&&(n.splice(r,1),t._removeParent(this))}_addParent(t){let{_parentOrParents:n}=this;n?Array.isArray(n)?n.push(t):this._parentOrParents=[n,t]:this._parentOrParents=t}_removeParent(t){let{_parentOrParents:n}=this;if(n===t)this._parentOrParents=null;else if(Array.isArray(n)){let r=n.indexOf(t);r!==-1&&(n.splice(r,1),n.length===1&&(this._parentOrParents=n[0]))}}};var ie=class extends se{constructor(n,r,o){super();this.isStopped=!1;let s;n?typeof n=="object"?s=n:s={next:n,error:r,complete:o}:s={},this.destination=s}next(n){if(!this.isStopped&&this.destination.next)try{this.destination.next(n)}catch(r){this.error(r)}}error(n){if(!this.isStopped){if(this.isStopped=!0,this.destination.error)try{this.destination.error(n)}catch(r){throw r}else throw n;this.unsubscribe()}}complete(){if(!this.isStopped){if(this.isStopped=!0,this.destination.complete)try{this.destination.complete()}catch(n){this.error(n);return}this.unsubscribe()}}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}},qe=class extends ie{constructor(n,r,o,s){super(n,r,o);this._isUnsubscribing=!1;this._parentSubscriber=null;this._parentSubscriber=s||null}next(n){if(!this.isStopped&&!this._isUnsubscribing)try{super.next(n)}catch(r){this.error(r)}}error(n){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.error(n)}finally{this._isUnsubscribing=!1}}}complete(){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.complete()}finally{this._isUnsubscribing=!1}}}unsubscribe(){this.closed||(this._isUnsubscribing=!0,super.unsubscribe(),this._isUnsubscribing=!1)}};function rr(e){return new ie(e.next,e.error,e.complete)}var N=class extends se{constructor(t){if(super(),t)this._subscribe=t;else throw new TypeError("Observable constructor requires a subscribe function")}subscribe(t,n,r){let o;t instanceof ie?o=t:o=new qe(t,n,r);let{_subscribe:s}=this;try{let i=s.call(this,o);i&&(typeof i=="function"||typeof i.unsubscribe=="function")&&o.add(i)}catch(i){o.error(i)}return o}pipe(...t){return t.length===0?this:t.reduce((n,r)=>r(n),this)}toPromise(){return new Promise((t,n)=>{let r;this.subscribe({next:o=>r=o,error:n,complete:()=>t(r)})})}};var ot=class extends N{constructor(){super(n=>{if(this.closed)throw new Error("Subject has been closed");if(this.hasError)n.error(this.thrownError);else if(this.isStopped)n.complete();else return this.observers.push(n),()=>{let r=this.observers.indexOf(n);r!==-1&&this.observers.splice(r,1)}});this.observers=[];this.isStopped=!1;this.hasError=!1;this.thrownError=null}next(n){if(this.isStopped)return;let{observers:r}=this,o=r.length,s=r.slice();for(let i=0;i<o;i++)s[i].next?.(n)}error(n){if(this.isStopped)return;this.hasError=!0,this.thrownError=n,this.isStopped=!0;let{observers:r}=this;this.observers=[];let o=r.length,s=r.slice();for(let i=0;i<o;i++)s[i].error?.(n)}complete(){if(this.isStopped)return;this.isStopped=!0;let{observers:n}=this;this.observers=[];let r=n.length,o=n.slice();for(let s=0;s<r;s++)o[s].complete?.()}unsubscribe(){this.isStopped=!0,this.observers=[]}asObservable(){return new N(r=>this.subscribe(r))}};var or="__fluixi_signal_next_state__",sr=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},a=globalThis[or]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:sr,onSuspend:null,onError:null};var Mt=0,qt=1,xe=2,Ne=class{constructor(){this.observers=null;this.watchers=null;this.version=0}updateIfNecessary(){}track(){if(a.untracked)return;let t=a.consumer;t&&((this.observers??=new Set).add(t),(t.sources??=new Set).add(this))}},ue=class extends Ne{constructor(t,n){super(),this._value=t,this._equals=n?.equals===!1?()=>!1:n?.equals??Object.is}get(){return this.track(),this._value}set(t){if(!this._equals(this._value,t)){if(this._value=t,this.version++,this.observers)for(let n of[...this.observers])n.markDirty(xe);st(this)}}peek(){return this._value}},K=class extends Ne{constructor(n,r){super();this._threw=!1;this._initialized=!1;this.state=xe;this.sources=null;this._fn=n,this._equals=r?.equals===!1?()=>!1:r?.equals??Object.is}get(){if(a.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===qt&&this.sources){for(let n of this.sources)if(n.updateIfNecessary(),this.state===xe)break}(this.state===xe||!this._initialized)&&this.recompute(),this.state=Mt}recompute(){if(this.sources){for(let u of this.sources)u.observers?.delete(this);this.sources.clear()}let n=a.consumer,r=a.untracked;a.consumer=this,a.untracked=!1;let o,s=!1,i;try{o=this._fn()}catch(u){s=!0,i=u,o=this._value}finally{a.consumer=n,a.untracked=r}let c=!this._initialized||this._threw!==s||(s?i!==this._error:!this._equals(this._value,o));if(this._initialized=!0,this._threw=s,this._error=i,this._value=o,c){if(this.version++,this.observers)for(let u of[...this.observers])u.markDirty(xe);st(this)}}markDirty(n){if(this.state>=n)return;let r=this.state===Mt;if(this.state=n,r){if(this.observers)for(let o of[...this.observers])o.markDirty(qt);st(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function st(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var ae=class{constructor(t){this._watched=new Set;this._pending=new Set;this._notifyFn=t}watch(...t){for(let n of t)this._watched.add(n),(n.watchers??=new Set).add(this)}unwatch(...t){for(let n of t)this._watched.delete(n),n.watchers?.delete(this),this._pending.delete(n)}getPending(){let t=[...this._pending];return this._pending.clear(),t}_notify(t){if(!this._watched.has(t)||this._pending.has(t))return;let n=this._pending.size===0;this._pending.add(t),n&&this._notifyFn()}};function ge(e){if(a.untracked)return e();a.untracked=!0;try{return e()}finally{a.untracked=!1}}function Nt(){return a.consumer}function jt(e){return!!(e.observers&&e.observers.size)||!!(e.watchers&&e.watchers.size)}function Bt(e){let t=Oe(e);return e&&(e.owned??=[]).push(t),t}function Lt(e,t=!0){we(e,t)}function $t(e){return!!e&&e.disposed===!0}function Oe(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function ce(e){let t=Symbol("context");return{id:t,defaultValue:e,Provider:r=>{let o=a.owner,s=Oe(o);(s.contexts=new Map).set(t,r.value),o&&(o.owned??=[]).push(s),a.owner=s;try{return r.children}finally{a.owner=o}}}}function Vt(e){let t=a.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.parent}return e.defaultValue}function je(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function le(e,t,n){let r=Oe(a.owner);(r.contexts=new Map).set(e.id,t),a.owner&&(a.owner.owned??=[]).push(r);let o=a.owner;a.owner=r;try{return n()}finally{a.owner=o}}function Kt(e){a.onSuspend=e}function Ht(e){return a.onSuspend?(a.onSuspend(e,a.owner),!0):!1}function Wt(e){a.onError=e}function Re(){return a.owner}function ut(e){let t=a.owner;return a.owner=e,t}function fe(e,t){let n=a.owner;a.owner=e;try{return t()}finally{a.owner=n}}function F(e){if(a.owner){if(a.owner.disposed){e();return}(a.owner.cleanups??=[]).push(e)}}function we(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)we(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function Y(e){let t=Oe(a.owner);a.owner&&(a.owner.owned??=[]).push(t);let n=a.owner;a.owner=t;try{return e(()=>we(t))}finally{a.owner=n}}function Gt(e){a.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function ir(e){e.queued||(e.queued=!0,a.queue.push(e),!a.scheduled&&a.batchDepth===0&&(a.scheduled=!0,a.hostSchedule(Ae)))}function Ae(){if(a.scheduled=!1,a.flushing)return;a.flushing=!0;let e=0;try{for(;a.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=a.queue;a.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{a.flushing=!1}}function zt(){a.batchDepth===0&&Ae()}function at(e){a.batchDepth++;try{return e()}finally{--a.batchDepth===0&&Ae()}}var it=class{constructor(t){this.queued=!1;this.disposed=!1;this.owner=Oe(a.owner),a.owner&&(a.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new K(()=>{we(this.owner,!1),fe(this.owner,()=>{let n=t();typeof n=="function"&&(this.owner.cleanups??=[]).push(n)})}),this.watcher=new ae(()=>ir(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(t){if(t&&typeof t.then=="function"&&a.onSuspend){a.onSuspend(t,this.owner);return}if(a.onError&&a.onError(t,this.owner))return;throw t}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),we(this.owner))}};function Be(e){let t=new it(e);return()=>t.dispose()}function ur(e){return!!e&&typeof e.then=="function"}Gt(()=>{});var Yt=Symbol.for("signal"),ar=Symbol.for("memo"),cr=Symbol.for("signal-node");function h(e,t){let n=new ue(e,{equals:t?.equals}),r=(()=>n.get()),o=(s=>{let i=typeof s=="function"?s(n.peek()):s;return n.set(i),zt(),i});return Object.defineProperty(r,Yt,{value:!0,enumerable:!0}),Object.defineProperty(r,cr,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[r,o]}function T(e,t,n){let r=t,o=Re(),s=new K(()=>fe(o,()=>{try{return r=e(r)}catch(c){if(ur(c))return Ht(c),r;throw c}}),{equals:n?.equals}),i=(()=>s.get());return Object.defineProperty(i,Yt,{value:!0,enumerable:!0}),Object.defineProperty(i,ar,{value:!0,enumerable:!0}),i}function M(e,t){let n=t;return Be(()=>{n=e(n)})}function Xt(e,t){let n=t;Be(()=>{n=e(n)})}function Qt(e,t){let n=t;return Be(()=>{n=e(n)})}function $(e){return at(e)}function D(e){return ge(e)}function ct(e){return at(e),Promise.resolve()}function Jt(){return[()=>!1,ct]}function Zt(){return Ae(),Promise.resolve()}function en(e,t,n){let r=Array.isArray(e),o,s=n?.defer??!1;return i=>{let c=r?e.map(l=>l()):e();if(s){s=!1,o=c;return}let u=ge(()=>t(c,o,i));return o=c,u}}function lr(e,t,n){let r=[];return F(()=>{for(let o of r)o.dispose();r=[]}),T(()=>{let o=e()||[];return D(()=>{if(o.length===0){for(let u of r)u.dispose();return r=[],n?.fallback?n.fallback():[]}let s=new Map;for(let u of r)s.has(u.item)||s.set(u.item,u);let i=[],c=new Set;for(let u=0;u<o.length;u++){let l=o[u],b=s.get(l);if(b&&!c.has(b))b.setIndex(u),i.push(b),c.add(b);else{let d,m,v;Y(x=>{v=x;let[E,p]=h(u);m=p,d=t(l,E)});let O={item:l,rendered:d,dispose:v,setIndex:m};i.push(O),c.add(O)}}for(let u of r)c.has(u)||u.dispose();return r=i,i.map(u=>u.rendered)})})}function fr(e,t,n,r){let o=[],s=[];return F(()=>{for(let i of s)i.dispose();o=[],s=[]}),T(()=>{let i=e()||[];return D(()=>{if(i.length===0){for(let d of s)d.dispose();return o=[],s=[],r?.fallback?r.fallback():[]}let c=new Map;for(let d=0;d<o.length;d++)c.set(o[d],s[d]);let u=[],l=[],b=new Set;for(let d=0;d<i.length;d++){let m=t(i[d]),v=c.get(m);if(v&&!b.has(m))v.setIndex(d),u.push(v);else{let O,x,E;Y(p=>{E=p;let[U,A]=h(d);x=A;let B=T(P=>{let I=(e()||[])[U()];return I??P},i[d]);O=n(B,U)}),u.push({rendered:O,dispose:E,setIndex:x})}l.push(m),b.add(m)}for(let[d,m]of c)b.has(d)||m.dispose();return o=l,s=u,u.map(d=>d.rendered)})})}function dr(e,t,n){let r=[];return F(()=>{for(let o of r)o.dispose();r=[]}),T(()=>{let o=e()||[];return D(()=>{if(o.length===0){for(let u of r)u.dispose();return r=[],n?.fallback?n.fallback():[]}let s=r.length,i=o.length;for(let u=s;u<i;u++){let l,b,d,m=o[u];Y(v=>{d=v;let[O,x]=h(m);b=x,l=t(O,u)}),r.push({rendered:l,setItem:b,dispose:d})}for(let u=i;u<s;u++)r[u].dispose();i<s&&(r=r.slice(0,i));let c=Math.min(s,i);for(let u=0;u<c;u++)r[u].setItem(o[u]);return r.map(u=>u.rendered)})})}var Ce=!1,pr=Symbol.for("signal"),Tr=Symbol.for("memo"),yr=Symbol.for("resource");function Le(e){return typeof e=="function"&&e[pr]===!0}function tn(e){return typeof e=="function"&&e[Tr]===!0}function nn(e){return typeof e=="function"&&e[yr]===!0}function rn(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function on(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function sn(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function lt(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?lt(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var ft=null;function yt(e){ft=e}function X(e){ft&&ft(e)}var dt=null;function mt(e){dt=e}function Ee(e){return dt?dt(e):void 0}var pt=null;function ht(e){pt=e}function Pe(){return pt?pt():void 0}var Tt=null;function bt(e){Tt=e}function ke(e,t){Tt&&Tt(e,t)}function un(e,t=(n,r)=>n===r){let n=new Map;return M(()=>{let r=e();for(let[o,s]of n){let[i,c]=s,u=t(o,r);i()!==u&&c(u)}}),r=>{let o=n.get(r);if(!o){let[s,i]=h(!1);o=[s,i],n.set(r,o);let c=e();i(t(r,c))}return o[0]()}}function an(e,t){let[n,r]=h(e(),t);return M(()=>{let o=e();t?.timeoutMs?setTimeout(()=>r(()=>o),t.timeoutMs):typeof requestIdleCallback=="function"?requestIdleCallback(()=>r(()=>o)):Promise.resolve().then(()=>r(()=>o))}),n}function cn(e,t){let n,r=(...o)=>{n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0,e(...o)},t)};return F(()=>{n!==void 0&&clearTimeout(n)}),r}function mr(e){return!!e&&typeof e.then=="function"}var vt=Symbol();function de(e,t,n={}){let r,o;typeof t=="function"?(r=typeof e=="function"?e:()=>e,o=t):(r=()=>!0,o=e,t&&typeof t=="object"&&(n=t));let s=n.transport===!1?void 0:Pe(),i=s!==void 0?Ee(s):void 0,c=i!==void 0,[u,l]=h(i!==void 0?i.value:n.initialValue,{equals:!1}),[b,d]=h(void 0,{equals:!1}),[m,v]=h(i!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[O,x]=h(void 0,{equals:!1}),[E,p]=h(void 0,{equals:!1}),U=vt,A=!1;M(()=>{let C=r();if(E(),C===!1||C===null||C===void 0){U=vt,$(()=>{v("unresolved"),x(void 0),d(void 0)});return}let I=A;if(A=!1,U!==vt&&C===U&&!I)return;if(U=C,c){c=!1;return}let V=!1;F(()=>V=!0);let G=D(m),Se=D(u),ne=G==="ready"||G==="refreshing";$(()=>{v(ne?"refreshing":"pending"),d(void 0)});try{let q=o(C,{value:Se,refetching:ne});mr(q)?(x(q),X(q),q.then(z=>{V||(s!==void 0&&ke(s,z),$(()=>{l(()=>z),v("ready"),x(void 0)}))},z=>{V||$(()=>{d(z),v("errored"),x(void 0)})})):$(()=>{l(()=>q),v("ready"),x(void 0)})}catch(q){if(V)return;$(()=>{d(q),v("errored"),x(void 0)})}});let B=()=>{let C=m();return C==="pending"||C==="refreshing"},P=(()=>{let C=b();if(C)throw C;if(B()){let I=O();if(I)throw I}return u()});return Object.defineProperties(P,{state:{get:m},loading:{get:B},error:{get:b},latest:{get:u}}),Object.defineProperty(P,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(P,Symbol.for("signal"),{value:!0,enumerable:!0}),[P,{mutate:l,refetch:()=>{A=!0,p(void 0)}}]}function St(e,t=300){let[n,r]=h(e),[o,s]=h(e),[i,c]=h(!1),u,l=()=>{u!==void 0&&(clearTimeout(u),u=void 0)},b=()=>{l();let m=D(n);return s(()=>m),c(!1),m},d=(m=>{let v=typeof m=="function"?m(D(n)):m;return r(()=>v),c(!0),l(),u=setTimeout(b,t),v});return F(l),[o,d,{immediate:n,pending:i,flush:b,cancel:()=>{l(),c(!1)}}]}function hr(e){return e!=null&&e!==""}function ln(e,t,n={}){let{delay:r=300,initialValue:o,shouldFetch:s=hr}=n,[i,c,u]=St(e,r),l=()=>s(i())?i():!1,[b,{refetch:d}]=de(l,t,o===void 0?{}:{initialValue:o});return[b,{...u,query:i,setQuery:c,refetch:d}]}function $e(e){if(typeof e=="function"&&!e.length){let t=e();return Le(t)?t:$e(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=$e(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function Ve(e){let t=T(e);return T(()=>$e(t()))}var Ke=ce();Kt((e,t)=>{let n=je(t,Ke);n&&(n.increment(),e.finally(()=>n.decrement()))});function fn(){let[e,t]=h(0),n=0;return{increment:()=>t(n+=1),decrement:()=>t(n-=1),inFallback:()=>e()>0}}function dn(e,t){return le(Ke,e,t)}var pn=ce();Wt((e,t)=>{let n=je(t,pn);return n?(n.setError(e),!0):!1});function Tn(){let[e,t]=h(void 0,{equals:!1});return{error:e,reset:()=>t(()=>{}),setError:r=>t(()=>r)}}function yn(e,t){return le(pn,e,t)}var mn={State:ue,Computed:K,subtle:{Watcher:ae,untrack:ge,currentComputed:Nt,hasSinks:jt}};var br=Symbol.for("signal"),vr=Symbol.for("fluixi-proxy");function Sr(e,t){let[n,r]=h(e,t);return Object.assign(n,{set:r})}function xr(e,t,n){return T(e,t,n)}function gr(e,t){return M(e,t)}function hn(...e){let[t,n]=de(...e);return Object.assign(t,n)}var g=require("@fluixi/reactive/signal"),Fe=Symbol("store-raw"),Q=Symbol("store-node"),bn=Symbol("store-has"),We=Symbol("store-self"),Ge=Symbol("store-track"),Rn=Symbol("store-name"),An=Symbol("store-store"),vn=new WeakMap,Sn=new WeakMap;function Cn(e){let[t,n]=(0,g.createSignal)(e),r=t;return r.$=n,r}function ze(e){let t=vn.get(e);return t||vn.set(e,t={keys:new Map}),t}function xn(e,t,n){let r=e.keys.get(t);return r||e.keys.set(t,r=Cn(n)),r}function gn(e){let t=ze(e);(t.all||(t.all=Cn()))()}function wn(e,t){e.$(typeof t=="function"?()=>t:t)}function En(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 He(e){if(!En(e))return e;let t=Sn.get(e);if(t)return t;let n=new Proxy(e,wr);return Sn.set(e,n),n}var wr={get(e,t,n){if(t===Fe||t===Q)return e;if(t===g.$PROXY)return n;if(t===bn)return i=>i in e;if(t==="__proxy")return!0;if(t===Ge||t===We)return gn(e),n;let r=e[t];if(typeof r=="function"&&!Object.prototype.hasOwnProperty.call(e,t))return r;let o=Object.getOwnPropertyDescriptor(e,t);if(o&&o.get)return o.get.call(n);let s=xn(ze(e),t,r)();return En(s)?He(s):s},set(){return!0},deleteProperty(e,t){return t in e&&_e(e,t,void 0),!0},has(e,t){return t===Fe||t===g.$PROXY||t===Q||t===bn||t===We||t===Ge?!0:(xn(ze(e),t,e[t])(),t in e)},ownKeys(e){return gn(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function _e(e,t,n){if(e[t]===n&&(n!==void 0||t in e))return;let o=Array.isArray(e),s=o?e.length:0;n===void 0?delete e[t]:e[t]=n;let i=ze(e),c=i.keys.get(t);if(c&&wn(c,n),o&&e.length!==s){let u=i.keys.get("length");u&&wn(u,e.length)}i.all&&i.all.$(void 0)}function On(e,t){return typeof e=="function"?e(t):e}function gt(e,t){for(let n of Object.keys(t)){let r=t[n],o=e[n];r&&typeof r=="object"&&!Array.isArray(r)&&o&&typeof o=="object"&&!Array.isArray(o)?gt(o,r):_e(e,n,r)}}function Ot(e){let t=[],n=e.replace(/\[([^\]]*)\]/g,".$1");for(let r of n.split("."))r.length&&t.push(r);return t}function Pn(e,t,n){let r=t.length-1;for(let s=0;s<r;s++){let i=t[s];if(i==="*"){let u=t.slice(s+1);if(Array.isArray(e))for(let l=0;l<e.length;l++)Pn(e[l],u,n);return}let c=e[i];(c==null||typeof c!="object")&&(c=/^\d+$/.test(t[s+1])?[]:{},_e(e,i,c)),e=c}let o=t[r];if(o==="*"){if(Array.isArray(e))for(let s=0;s<e.length;s++)_e(e,s,On(n,e[s]));return}_e(e,o,On(n,e[o]))}function xt(e,t,n){Pn(e,Ot(t),n)}function Or(e,t){let n=t[0];if(typeof n=="function"&&t.length===1){let r=n(e);r&&r!==e&>(e,r);return}if(Array.isArray(n)&&t.length===1){for(let r of n)Array.isArray(r)&&xt(e,r[0],r[1]);return}if(n&&typeof n=="object"&&!Array.isArray(n)&&t.length===1){gt(e,n);return}if(Array.isArray(t[1])&&t.length>=3){xt(e,`${n}.${t[1].join(".")}`,t[2]);return}xt(e,String(n),t[1])}function wt(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(wt);let t={};for(let n of Object.keys(e))t[n]=wt(e[n]);return t}function pe(e,t){let n=e;for(let r of Ot(t)){if(n==null)return;n=n[r]}return n}var H=class{constructor(t,n={immutable:!0}){this.options=n;this.root=t,this.set=((...r)=>(0,g.batch)(()=>Or(this.root,r)))}get state(){return He(this.root)}get proxy(){return He(this.root)}get accessor(){return(()=>He(this.root))}unwrap(){return this.root}getNode(t){return this.root&&this.root[t]}get(t){if(t==null||t==="")return Te(this.state);let n=this.state;for(let r of Ot(t)){if(n==null)return;n=n[r]}return Te(n)}select(t){return(0,g.createMemo)(()=>t(this.state))}subscribe(t){return(0,g.createEffect)(()=>t(this.state))}watch(t,n){let r;return(0,g.createEffect)(()=>{let o=t(this.state);Object.is(o,r)||(n(o,r),r=o)})}reactive(t){return(0,g.createMemo)(()=>this.state[t])}produce(t){this.set((n=>{let r=wt(n);return t(r),r}))}reconcile(t,n={}){this.set(t)}push(t,...n){let r=pe(this.root,t);this.set(t,r.concat(n))}pop(t){let n=pe(this.root,t).slice(),r=n.pop();return this.set(t,n),r}shift(t){let n=pe(this.root,t).slice(),r=n.shift();return this.set(t,n),r}splice(t,n,r,...o){let s=pe(this.root,t).slice(),i=s.splice(n,r,...o);return this.set(t,s),i}insert(t,n,r){let o=pe(this.root,t).slice();o.splice(n,0,r),this.set(t,o)}removeAt(t,n){let r=pe(this.root,t).slice(),o=r.splice(n,1);return this.set(t,r),o}toObservable(){let[t]=(0,g.createSignal)(this.state);return t.toObservable()}dispose(){}},Rr=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","unwrap","toObservable"];function kn(e,t){for(let n of Rr)e[n]=t[n].bind(t);e.$=t.reactive.bind(t)}function De(e,t={immutable:!0}){let n=new H(e,t);return kn(n.set,n),[n.proxy,n.set]}function Rt(e,t={}){return new H(e,{...t,immutable:!1})}function _n(e,t={}){let n=new H(e(),t);return(0,g.createEffect)(()=>n.set(e())),n}function Fn(e,t,n){return(0,g.createEffect)(()=>n(t(e)))}function Dn(e,t,n){return(0,g.createMemo)(()=>t(e),void 0,n)}function Un(e,t={}){let n=new H(e,t),r=(()=>n.proxy);return kn(r,n),r}function Te(e){if(e==null||typeof e!="object")return e;let t=e[Fe];return t!==void 0?t:e}function At(e){return(0,g.untrack)(()=>Te(e))}function In(e){return Ye(e)}function Mn(e){return Ye(e)?e[Q]:null}function qn(e){return e&&typeof e=="object"&&Q in e?e[Q]:null}function Ye(e){return!!e&&typeof e=="object"&&(g.$PROXY in e||e.__proxy===!0)}function Nn(e){return e}var jn=Object.freeze({createStore:De,createMutableStore:Rt,batch:g.batch,unwrap:Te,untrackStore:At});function Ct(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Ct);let t={};for(let n of Object.keys(e))t[n]=Ct(e[n]);return t}function Bn(e){return t=>{let n=Ct(t);return e(n),n}}function Ln(e,t={}){return()=>e}function $n(e,t){let[n,r]=De(e,t);return new Proxy(n,{get:(o,s)=>s==="set"?r:o[s],has:(o,s)=>s==="set"||Reflect.has(o,s)})}function Ar(e,t,n){return T(()=>t(e()),void 0,n)}function Cr(e,t,n){return T(()=>e().filter(t),void 0,n)}function Er(e,t,n,r){return T(()=>e().reduce(t,n),void 0,r)}function Pr(e,t,n){return T(()=>e().find(t),void 0,n)}function kr(e,t,n){return T(()=>e().some(t),void 0,n)}function _r(e,t,n){return T(()=>e().every(t),void 0,n)}function Fr(e,t,n){return T(()=>[...e()].sort(t),void 0,n)}function Dr(e,t){return T(()=>[...new Set(e())],void 0,t)}function Ur(e,t,n){return T(()=>{let r=e.map(o=>o());return t(r)},void 0,n)}function Ir(...e){return new N(t=>{let n=()=>e.map(o=>typeof o=="function"?o():o.get()),r=e.map(o=>typeof o=="function"&&o.subscribe?o.subscribe(()=>{t.next(n())}):typeof o!="function"?o.subscribe(()=>{t.next(n())}):M(()=>{t.next(n())}));return()=>{r.forEach(o=>{typeof o=="function"?o():o&&typeof o.unsubscribe=="function"&&o.unsubscribe()})}})}function Mr(e,t,n){return T(()=>e()||t(),void 0,n)}function qr(e,t,n,r){return T(()=>n(e(),t()),void 0,r)}function Nr(e,t,n){return T(()=>t(e()),void 0,{equals:n,internal:!0})}function jr(e,t,n){return T(()=>{let r=e(),o={};for(let s of t)o[s]=r[s];return o},void 0,n)}function Br(e,t,n){return T(()=>{let o={...e()};for(let s of t)delete o[s];return o},void 0,n)}function Lr(e,t,n,r){return T(()=>e()?t():n(),void 0,r)}function $r(e,t,n){return T(()=>e()?t():void 0,void 0,n)}function Vr(e,t,n){let[r,o]=h(e()),s;return T(()=>{let i=e();clearTimeout(s),s=setTimeout(()=>o(()=>i),t)}),r}function Kr(e,t,n){let[r,o]=h(e()),s=0,i;return T(()=>{let c=e(),u=Date.now();u-s>=t?(s=u,o(()=>c)):(clearTimeout(i),i=setTimeout(()=>{s=Date.now(),o(()=>c)},t-(u-s)))}),r}function Hr(e){let t=e;for(;typeof t=="function";)t=t();return t}var Wr=Symbol.for("signal");var Vn=Symbol("fluixi-proxy"),Gr=Symbol.for("signal-node"),Ue=0,Pt=1,Ze=2,me=3,S=null,R=null,f=null,Qe=null,Je=0,zr=!1,Et=!1,ye=0,Yr=1e6,W=new WeakMap,Xe=null;var Xr=new Map,Qr=0;function Jr(){return`node_${++Qr}_${Date.now()}`}function Zr(e){!1}function eo(e,t,n){let r={id:Jr(),type:e,value:t,version:0,equals:n?.equals,name:n?.name,created:Date.now(),updated:Date.now()};return Zr(r),r}function to(e,t){return e===t}function Hn(e){throw typeof console<"u"&&console.error("Reactive error:",e),e}function no(e){if(f)f.indexOf(e)===-1&&f.push(e);else if(Xe&&Xe.running&&!e.pure)Xe.effects.indexOf(e)===-1&&Xe.effects.push(e);else if(!e.pure||e.computed)_t(e);else if(e.pure&&!e.computed&&e.accessor){let t=R,n=f;R=null,f=[],e.accessor(),R=t;let r=f;if(f=n,r.length>0){let o=f;et(r),f=o}}}function Kn(e,t){for(let n=0;n<e.length;n++)t(e[n])}function J(e,t){let n=e;typeof n=="object"&&n&&Vn in n&&delete n[Vn];let r=eo("signal",n,{equals:t?.equals===!1?void 0:t?.equals,name:t?.name}),o=[i,c];W.set(o,new Set);let s;function i(){let u=R;if(u){u.sources?u.sources.indexOf(o)===-1&&u.sources.push(o):u.sources=[o];let l=W.get(o);l&&!l.has(u)&&l.add(u)}return n}function c(u){let l=typeof u=="function"?u(n):u,b=r.equals||to;if(t?.equals===!1||!b(n,l)){n=l,r.value=l,r.version++,r.updated=Date.now();let m=W.get(o);if(m&&m.size>0){let E=function(p,U=!1){let A=p.state;if(!(A===me&&p===R)){if(U&&!p.pure){A===Ue&&(p.state=Pt,zr&&(f!==null&&f.indexOf(p)===-1?f.push(p):O.push(p)));return}if(!x.has(p)&&(x.add(p),p.state=Ze,A===Ue||A===Pt?O.push(p):!p.pure&&f!==null&&f.indexOf(p)===-1&&f.push(p),p.pure&&p.accessor)){let B=W.get(p.accessor);B&&Kn(Array.from(B),P=>E(P,!0))}}};var d=E;let v=Array.from(m),O=[],x=new Set;Kn(v,E);for(let p of O)no(p)}}}return i.toObservable=()=>new N(u=>{let l=!0;return kt(()=>{let d=i();l?l=!1:u.next(d)})}),Object.defineProperty(i,Wr,{value:!0,enumerable:!0}),Object.defineProperty(i,Gr,{value:r,enumerable:!1}),o}function kt(e,t,n){let r={fn:e,state:Ze,sources:null,sourceSlots:null,owned:null,cleanups:null,owner:S,contexts:null,pure:!1,updatedAt:null};S&&(S.owned?S.owned.push(r):S.owned=[r]);let o=j&&ve(j);return o&&(r.suspense=o),Wn(r,t),()=>he(r)}function Wn(e,t){if(e.sources){for(let o of e.sources){let s=W.get(o);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.owned){for(let o=0;o<e.owned.length;o++)he(e.owned[o]);e.owned=null}let n=R,r=S;if(R=e,S=e,Je++,Je>Yr)throw Je=0,R=n,S=r,new Error("Potential infinite loop detected. Exceeded maximum iterations.");try{e.state=me;let o=e.fn(t);typeof o=="function"&&(e.cleanups?e.cleanups.push(o):e.cleanups=[o]),e.state===me&&(e.state=Ue)}catch(o){if(rt(o)){let s=j&&ve(j);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Hn(o)}finally{R=n,S=r}}function _t(e){if(!(e.disposed||!e.fn||e.state===Ue)&&(e.state===Ze||e.state===Pt||e.state===me)){if(e.cleanups){for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();e.cleanups=null}if(e.owned){for(let t=0;t<e.owned.length;t++)he(e.owned[t]);e.owned=null}e.renderEffect?zn(e):Wn(e,e.value)}}function he(e){if(e.disposed=!0,e.sources)for(let t of e.sources){let n=W.get(t);n&&n.delete(e)}if(e.cleanups)for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();if(e.owned)for(let t=0;t<e.owned.length;t++)he(e.owned[t]);if(e.owner&&e.owner.owned){let t=e.owner.owned.indexOf(e);t!==-1&&e.owner.owned.splice(t,1)}}function et(e){let t=[],n=[];for(let o of e)o.pure&&!o.computed&&o.accessor?t.indexOf(o)===-1&&t.push(o):(o.computed||!o.pure)&&n.indexOf(o)===-1&&n.push(o);f=[];let r=0;for(;r<t.length;){let o=t[r++],s=W.get(o.accessor);if(s&&s.size>0){let c=R;R=null,o.accessor(),R=c}let i=f.splice(0);for(let c of i)c.pure&&!c.computed&&c.accessor?t.indexOf(c)===-1&&t.push(c):(c.computed||!c.pure)&&n.indexOf(c)===-1&&n.push(c)}f=null;for(let o of n)(o.computed||!o.pure)&&_t(o)}function Z(e){if(f&&ye>0)return e();if(f&&ye===0){let t=f,n=[];f=n,ye++;let r;try{r=e()}finally{ye--,f=t}let o=f;return et(n),f=o,r}ye++,f=[],Qe=[];try{return e()}finally{ye--,ro()}}function ro(){if(!Et){Et=!0,Je=0;try{for(;f&&f.length>0;){let e=f;f=null,et(e)}if(f=null,Qe){let e=Qe;Qe=null;for(let t=0;t<e.length;t++)_t(e[t])}}finally{Et=!1}}}function be(e){let t=R;R=null;try{return e()}finally{R=t}}function Gn(e){S&&(S.cleanups?S.cleanups.push(e):S.cleanups=[e])}function oo(e){let t=Symbol("context"),n=so(t);return{id:t,Provider:n,defaultValue:e}}function so(e){return t=>{let n=S;for(;n;)n.contexts||(n.contexts=new Map),n.contexts.has(e)||n.contexts.set(e,t.value),n=n.owner;let r;return io(()=>{r=be(()=>{let o=S;return o&&(o.contexts||(o.contexts=new Map),o.contexts.set(e,t.value)),Ve(()=>t.children)})}),r}}function ve(e){let t=S;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.owner}if(e)return e.defaultValue}function io(e,t,n){let r={fn:e,state:Ze,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:S,contexts:null,pure:!1,updatedAt:null,renderEffect:!0};S&&(S.owned?S.owned.push(r):S.owned=[r]);let o=j&&ve(j);return o&&(r.suspense=o),zn(r),()=>he(r)}function zn(e){if(e.sources){for(let o of e.sources){let s=W.get(o);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.cleanups){for(let o=0;o<e.cleanups.length;o++)e.cleanups[o]();e.cleanups=null}if(e.owned){for(let o=0;o<e.owned.length;o++)he(e.owned[o]);e.owned=null}let t=R,n=S,r=f;R=e,S=e,f===null&&(f=[]),e.state=me;try{let o=e.fn(e.value);typeof o=="function"&&(e.cleanups||(e.cleanups=[]),e.cleanups.push(o)),e.value=o,e.state===me&&(e.state=Ue)}catch(o){if(rt(o)){let s=j&&ve(j);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Hn(o)}finally{R=t,S=n;let o=f;if(f=r,o!==r&&o&&o.length>0){let s=f;et(o),f=s}}}var j;function Yn(){return j||(j=oo())}var te=new Map,ee=new Map,uo=0,ao=Symbol.for("signal"),co=Symbol.for("resource");function lo(e,t,n={}){let r,o,s;typeof t=="function"?(r=e,o=t,s=n):(r=()=>!0,o=e,s=t??n);let{ttl:i=1/0,name:c=`_auto_${uo++}`,staleWhileRevalidate:u=!0}=s,l=c,b=y=>`${l}:${JSON.stringify(y)}`,d=y=>i===1/0||Date.now()-y.timestamp<=i,[m,v]=J(void 0,{equals:!1}),[O,x]=J("unresolved",{equals:!1}),[E,p]=J(void 0,{equals:!1}),[U,A]=J(void 0,{equals:!1}),[B,P]=J(!1),[C,I]=J(0,{equals:!1}),V=Symbol("unset"),G=V,Se=!1,ne=!1;function q(y,k,_,L){if(ee.has(k)){ee.get(k).then(w=>{L()||z(w,_)},w=>{!L()&&!_&&Ft(w)}),_||A(ee.get(k));return}let re=Promise.resolve(o(y)).then(w=>(te.set(k,{value:w,timestamp:Date.now()}),ee.delete(k),w),w=>{throw ee.delete(k),w});if(ee.set(k,re),!_){X(re),A(re);let w=Ie&&ve(Ie);w&&(w.increment(),re.finally(()=>w.decrement()))}re.then(w=>{L()||z(w,_)},w=>{!L()&&!_&&Ft(w)})}function z(y,k){Z(()=>{v(()=>y),x("ready"),P(!1),A(void 0),p(void 0)})}function Ft(y){Z(()=>{p(y),x("errored"),A(void 0)})}let Ie;kt(()=>{Ie===void 0&&(Ie=Yn());let y=r();if(C(),y===!1||y===null||y===void 0){G=V,Z(()=>{x("unresolved"),A(void 0),p(void 0)});return}let k=Se,_=ne;Se=!1,ne=!1;let L=b(y);_&&te.delete(L);let re=G===V||y!==G;G=y;let w=!1;Gn(()=>{w=!0});let oe=te.get(L);if(oe&&d(oe)&&!k&&!_){(be(O)!=="ready"||be(m)!==oe.value)&&Z(()=>{v(()=>oe.value),x("ready"),P(!1),p(void 0)});return}if(oe&&u&&!_){Z(()=>{v(()=>oe.value),x("ready"),P(!0),p(void 0),A(void 0)}),q(y,L,!0,()=>w);return}let Dt=be(O),Xn=Dt==="ready"||Dt==="refreshing";Z(()=>{x(Xn?"refreshing":"pending"),p(void 0),P(!1)}),q(y,L,!1,()=>w)});let Me=(()=>{let y=E();if(y)throw y;if(O()==="pending"){let _=U();if(_)throw _}return m()});return Object.defineProperty(Me,co,{value:!0,enumerable:!0}),Object.defineProperty(Me,ao,{value:!0,enumerable:!0}),Object.defineProperties(Me,{state:{get:O},loading:{get:()=>{let y=O();return y==="pending"||y==="refreshing"}},error:{get:E},latest:{get:m},stale:{get:B}}),[Me,{mutate:v,refetch:()=>{Se=!0,I(y=>y+1)},invalidate:()=>{let y=be(r);y!=null&&y!==!1&&te.delete(b(y)),ne=!0,I(k=>k+1)}}]}function fo(e){let t=`${e}:`;for(let n of te.keys())n.startsWith(t)&&te.delete(n)}function po(){te.clear(),ee.clear()}
|
|
1
|
+
"use strict";var tt=Object.defineProperty;var Qn=Object.getOwnPropertyDescriptor;var Jn=Object.getOwnPropertyNames;var Zn=Object.prototype.hasOwnProperty;var er=(e,t)=>{for(var n in t)tt(e,n,{get:t[n],enumerable:!0})},tr=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Jn(t))!Zn.call(e,o)&&o!==n&&tt(e,o,{get:()=>t[o],enumerable:!(r=Qn(t,o))||r.enumerable});return e};var nr=e=>tr(tt({},"__esModule",{value:!0}),e);var To={};er(To,{$NAME:()=>Rn,$NODE:()=>Q,$PROXY:()=>vr,$RAW:()=>Fe,$SELF:()=>We,$SIGNAL:()=>br,$STORE:()=>An,$TRACK:()=>Ge,Observable:()=>N,SafeSubscriber:()=>qe,Signal:()=>mn,Store:()=>H,StoreAPI:()=>jn,Subject:()=>ot,Subscriber:()=>ie,Subscription:()=>se,SuspenseContext:()=>Ke,VERSION:()=>Ut,__DEV__:()=>Ce,batch:()=>$,clearAllCachedResources:()=>po,clearCachedResourceNamespace:()=>fo,combineSignal:()=>Ur,combineSignals:()=>Ir,createCachedResource:()=>lo,createChildOwner:()=>Bt,createComputed:()=>Xt,createComputedStore:()=>_n,createContext:()=>ce,createDebounce:()=>cn,createDebouncedResource:()=>ln,createDebouncedSignal:()=>St,createDeferred:()=>an,createEffect:()=>M,createErrorBoundary:()=>Tn,createMemo:()=>T,createMutableStore:()=>Rt,createRenderEffect:()=>Qt,createResource:()=>de,createRoot:()=>Y,createSelector:()=>un,createSignal:()=>h,createStore:()=>De,createStoreEffect:()=>Fn,createStoreMemo:()=>Dn,createSuspenseBoundary:()=>fn,debounceSignal:()=>Vr,disposeScope:()=>Lt,distinctSignal:()=>Dr,effect:()=>gr,everySignal:()=>_r,filterSignal:()=>Cr,findSignal:()=>Pr,flush:()=>Zt,getNode:()=>Mn,getOwner:()=>Re,getServerData:()=>Ee,getStoreNode:()=>qn,guardSignal:()=>$r,indexArray:()=>dr,isComponent:()=>rn,isMemo:()=>tn,isOwnerDisposed:()=>$t,isProvider:()=>sn,isResource:()=>nn,isSignal:()=>Le,isStore:()=>In,isStoreProxy:()=>Ye,isSuspense:()=>on,keyArray:()=>fr,makeArrayFlat:()=>lt,mapArray:()=>lr,mapSignal:()=>Ar,memo:()=>xr,mergeSignal:()=>Mr,modifiable:()=>Nn,nextResourceId:()=>Pe,omitSignal:()=>Br,on:()=>en,onCleanup:()=>F,operate:()=>rr,pickSignal:()=>jr,produceUtil:()=>Bn,provide:()=>le,provideErrorBoundary:()=>yn,provideSuspense:()=>dn,readChildren:()=>Ve,readSignal:()=>Hr,reconcileUtil:()=>Ln,reduceSignal:()=>Er,reportResourceData:()=>ke,resource:()=>hn,runWithOwner:()=>fe,selectSignal:()=>Nr,setOwner:()=>ut,setResourceDataSink:()=>bt,setResourceIdSource:()=>ht,setResourceTracker:()=>yt,setServerDataGetter:()=>mt,signal:()=>Sr,someSignal:()=>kr,sortSignal:()=>Fr,startTransition:()=>ct,store:()=>$n,throttleSignal:()=>Kr,trackResourcePromise:()=>X,untrack:()=>D,untrackStore:()=>At,unwrap:()=>Te,useContext:()=>Vt,useTransition:()=>Jt,whenSignal:()=>Lr,wrap:()=>Un,zipSignal:()=>qr});module.exports=nr(To);var Ut="1.0.0-alpha.79";function nt(e){return typeof e=="function"&&!/^class\s/.test(Function.prototype.toString.call(e))}function It(e){return e==null||Array.isArray(e)||typeof e=="function"||e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error?!1:typeof e=="object"}function rt(e){return e instanceof Promise||!!e&&(typeof e=="object"||typeof e=="function")&&"then"in e}var se=class e{constructor(t){this._closed=!1;this._parentOrParents=null;this._subscriptions=null;t&&(this._subscriptions=[t])}get closed(){return this._closed}unsubscribe(){if(this._closed)return;this._closed=!0;let{_parentOrParents:t,_subscriptions:n}=this;if(t instanceof e)t.remove(this);else if(t!==null)for(let r of t)r.remove(this);if(n){for(let r of n)if(nt(r)&&!(r instanceof e))try{r()}catch(o){console.error("Error in unsubscribe function:",o)}else if(It(r)&&typeof r.unsubscribe=="function")try{r.unsubscribe()}catch(o){console.error("Error unsubscribing child:",o)}this._subscriptions=null}}add(t){if(!t||t===this)return this;if(t.closed)return this;let{_closed:n,_subscriptions:r}=this;if(n){if(nt(t))try{t()}catch(o){console.error("Error in unsubscribe function:",o)}else if(t.unsubscribe)try{t.unsubscribe()}catch(o){console.error("Error unsubscribing:",o)}return this}return r||(this._subscriptions=[]),this._subscriptions.push(t),t instanceof e&&t._addParent(this),this}remove(t){let{_subscriptions:n}=this;if(!n)return;let r=n.indexOf(t);r!==-1&&(n.splice(r,1),t._removeParent(this))}_addParent(t){let{_parentOrParents:n}=this;n?Array.isArray(n)?n.push(t):this._parentOrParents=[n,t]:this._parentOrParents=t}_removeParent(t){let{_parentOrParents:n}=this;if(n===t)this._parentOrParents=null;else if(Array.isArray(n)){let r=n.indexOf(t);r!==-1&&(n.splice(r,1),n.length===1&&(this._parentOrParents=n[0]))}}};var ie=class extends se{constructor(n,r,o){super();this.isStopped=!1;let s;n?typeof n=="object"?s=n:s={next:n,error:r,complete:o}:s={},this.destination=s}next(n){if(!this.isStopped&&this.destination.next)try{this.destination.next(n)}catch(r){this.error(r)}}error(n){if(!this.isStopped){if(this.isStopped=!0,this.destination.error)try{this.destination.error(n)}catch(r){throw r}else throw n;this.unsubscribe()}}complete(){if(!this.isStopped){if(this.isStopped=!0,this.destination.complete)try{this.destination.complete()}catch(n){this.error(n);return}this.unsubscribe()}}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}},qe=class extends ie{constructor(n,r,o,s){super(n,r,o);this._isUnsubscribing=!1;this._parentSubscriber=null;this._parentSubscriber=s||null}next(n){if(!this.isStopped&&!this._isUnsubscribing)try{super.next(n)}catch(r){this.error(r)}}error(n){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.error(n)}finally{this._isUnsubscribing=!1}}}complete(){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.complete()}finally{this._isUnsubscribing=!1}}}unsubscribe(){this.closed||(this._isUnsubscribing=!0,super.unsubscribe(),this._isUnsubscribing=!1)}};function rr(e){return new ie(e.next,e.error,e.complete)}var N=class extends se{constructor(t){if(super(),t)this._subscribe=t;else throw new TypeError("Observable constructor requires a subscribe function")}subscribe(t,n,r){let o;t instanceof ie?o=t:o=new qe(t,n,r);let{_subscribe:s}=this;try{let i=s.call(this,o);i&&(typeof i=="function"||typeof i.unsubscribe=="function")&&o.add(i)}catch(i){o.error(i)}return o}pipe(...t){return t.length===0?this:t.reduce((n,r)=>r(n),this)}toPromise(){return new Promise((t,n)=>{let r;this.subscribe({next:o=>r=o,error:n,complete:()=>t(r)})})}};var ot=class extends N{constructor(){super(n=>{if(this.closed)throw new Error("Subject has been closed");if(this.hasError)n.error(this.thrownError);else if(this.isStopped)n.complete();else return this.observers.push(n),()=>{let r=this.observers.indexOf(n);r!==-1&&this.observers.splice(r,1)}});this.observers=[];this.isStopped=!1;this.hasError=!1;this.thrownError=null}next(n){if(this.isStopped)return;let{observers:r}=this,o=r.length,s=r.slice();for(let i=0;i<o;i++)s[i].next?.(n)}error(n){if(this.isStopped)return;this.hasError=!0,this.thrownError=n,this.isStopped=!0;let{observers:r}=this;this.observers=[];let o=r.length,s=r.slice();for(let i=0;i<o;i++)s[i].error?.(n)}complete(){if(this.isStopped)return;this.isStopped=!0;let{observers:n}=this;this.observers=[];let r=n.length,o=n.slice();for(let s=0;s<r;s++)o[s].complete?.()}unsubscribe(){this.isStopped=!0,this.observers=[]}asObservable(){return new N(r=>this.subscribe(r))}};var or="__fluixi_signal_next_state__",sr=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},a=globalThis[or]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:sr,onSuspend:null,onError:null};var Mt=0,qt=1,xe=2,Ne=class{constructor(){this.observers=null;this.watchers=null;this.version=0}updateIfNecessary(){}track(){if(a.untracked)return;let t=a.consumer;t&&((this.observers??=new Set).add(t),(t.sources??=new Set).add(this))}},ue=class extends Ne{constructor(t,n){super(),this._value=t,this._equals=n?.equals===!1?()=>!1:n?.equals??Object.is}get(){return this.track(),this._value}set(t){if(!this._equals(this._value,t)){if(this._value=t,this.version++,this.observers)for(let n of[...this.observers])n.markDirty(xe);st(this)}}peek(){return this._value}},K=class extends Ne{constructor(n,r){super();this._threw=!1;this._initialized=!1;this.state=xe;this.sources=null;this._fn=n,this._equals=r?.equals===!1?()=>!1:r?.equals??Object.is}get(){if(a.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===qt&&this.sources){for(let n of this.sources)if(n.updateIfNecessary(),this.state===xe)break}(this.state===xe||!this._initialized)&&this.recompute(),this.state=Mt}recompute(){if(this.sources){for(let u of this.sources)u.observers?.delete(this);this.sources.clear()}let n=a.consumer,r=a.untracked;a.consumer=this,a.untracked=!1;let o,s=!1,i;try{o=this._fn()}catch(u){s=!0,i=u,o=this._value}finally{a.consumer=n,a.untracked=r}let c=!this._initialized||this._threw!==s||(s?i!==this._error:!this._equals(this._value,o));if(this._initialized=!0,this._threw=s,this._error=i,this._value=o,c){if(this.version++,this.observers)for(let u of[...this.observers])u.markDirty(xe);st(this)}}markDirty(n){if(this.state>=n)return;let r=this.state===Mt;if(this.state=n,r){if(this.observers)for(let o of[...this.observers])o.markDirty(qt);st(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function st(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var ae=class{constructor(t){this._watched=new Set;this._pending=new Set;this._notifyFn=t}watch(...t){for(let n of t)this._watched.add(n),(n.watchers??=new Set).add(this)}unwatch(...t){for(let n of t)this._watched.delete(n),n.watchers?.delete(this),this._pending.delete(n)}getPending(){let t=[...this._pending];return this._pending.clear(),t}_notify(t){if(!this._watched.has(t)||this._pending.has(t))return;let n=this._pending.size===0;this._pending.add(t),n&&this._notifyFn()}};function ge(e){if(a.untracked)return e();a.untracked=!0;try{return e()}finally{a.untracked=!1}}function Nt(){return a.consumer}function jt(e){return!!(e.observers&&e.observers.size)||!!(e.watchers&&e.watchers.size)}function Bt(e){let t=Oe(e);return e&&(e.owned??=[]).push(t),t}function Lt(e,t=!0){we(e,t)}function $t(e){return!!e&&e.disposed===!0}function Oe(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function ce(e){let t=Symbol("context");return{id:t,defaultValue:e,Provider:r=>{let o=a.owner,s=Oe(o);(s.contexts=new Map).set(t,r.value),o&&(o.owned??=[]).push(s),a.owner=s;try{return r.children}finally{a.owner=o}}}}function Vt(e){let t=a.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.parent}return e.defaultValue}function je(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function le(e,t,n){let r=Oe(a.owner);(r.contexts=new Map).set(e.id,t),a.owner&&(a.owner.owned??=[]).push(r);let o=a.owner;a.owner=r;try{return n()}finally{a.owner=o}}function Kt(e){a.onSuspend=e}function Ht(e){return a.onSuspend?(a.onSuspend(e,a.owner),!0):!1}function Wt(e){a.onError=e}function Re(){return a.owner}function ut(e){let t=a.owner;return a.owner=e,t}function fe(e,t){let n=a.owner;a.owner=e;try{return t()}finally{a.owner=n}}function F(e){if(a.owner){if(a.owner.disposed){e();return}(a.owner.cleanups??=[]).push(e)}}function we(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)we(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function Y(e){let t=Oe(a.owner);a.owner&&(a.owner.owned??=[]).push(t);let n=a.owner;a.owner=t;try{return e(()=>we(t))}finally{a.owner=n}}function Gt(e){a.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function ir(e){e.queued||(e.queued=!0,a.queue.push(e),!a.scheduled&&a.batchDepth===0&&(a.scheduled=!0,a.hostSchedule(Ae)))}function Ae(){if(a.scheduled=!1,a.flushing)return;a.flushing=!0;let e=0;try{for(;a.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=a.queue;a.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{a.flushing=!1}}function zt(){a.batchDepth===0&&Ae()}function at(e){a.batchDepth++;try{return e()}finally{--a.batchDepth===0&&Ae()}}var it=class{constructor(t){this.queued=!1;this.disposed=!1;this.owner=Oe(a.owner),a.owner&&(a.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new K(()=>{we(this.owner,!1),fe(this.owner,()=>{let n=t();typeof n=="function"&&(this.owner.cleanups??=[]).push(n)})}),this.watcher=new ae(()=>ir(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(t){if(t&&typeof t.then=="function"&&a.onSuspend){a.onSuspend(t,this.owner);return}if(a.onError&&a.onError(t,this.owner))return;throw t}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),we(this.owner))}};function Be(e){let t=new it(e);return()=>t.dispose()}function ur(e){return!!e&&typeof e.then=="function"}Gt(()=>{});var Yt=Symbol.for("signal"),ar=Symbol.for("memo"),cr=Symbol.for("signal-node");function h(e,t){let n=new ue(e,{equals:t?.equals}),r=(()=>n.get()),o=(s=>{let i=typeof s=="function"?s(n.peek()):s;return n.set(i),zt(),i});return Object.defineProperty(r,Yt,{value:!0,enumerable:!0}),Object.defineProperty(r,cr,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[r,o]}function T(e,t,n){let r=t,o=Re(),s=new K(()=>fe(o,()=>{try{return r=e(r)}catch(c){if(ur(c))return Ht(c),r;throw c}}),{equals:n?.equals}),i=(()=>s.get());return Object.defineProperty(i,Yt,{value:!0,enumerable:!0}),Object.defineProperty(i,ar,{value:!0,enumerable:!0}),i}function M(e,t){let n=t;return Be(()=>{n=e(n)})}function Xt(e,t){let n=t;Be(()=>{n=e(n)})}function Qt(e,t){let n=t;return Be(()=>{n=e(n)})}function $(e){return at(e)}function D(e){return ge(e)}function ct(e){return at(e),Promise.resolve()}function Jt(){return[()=>!1,ct]}function Zt(){return Ae(),Promise.resolve()}function en(e,t,n){let r=Array.isArray(e),o,s=n?.defer??!1;return i=>{let c=r?e.map(l=>l()):e();if(s){s=!1,o=c;return}let u=ge(()=>t(c,o,i));return o=c,u}}function lr(e,t,n){let r=[];return F(()=>{for(let o of r)o.dispose();r=[]}),T(()=>{let o=e()||[];return D(()=>{if(o.length===0){for(let u of r)u.dispose();return r=[],n?.fallback?n.fallback():[]}let s=new Map;for(let u of r)s.has(u.item)||s.set(u.item,u);let i=[],c=new Set;for(let u=0;u<o.length;u++){let l=o[u],b=s.get(l);if(b&&!c.has(b))b.setIndex(u),i.push(b),c.add(b);else{let d,m,v;Y(x=>{v=x;let[E,p]=h(u);m=p,d=t(l,E)});let O={item:l,rendered:d,dispose:v,setIndex:m};i.push(O),c.add(O)}}for(let u of r)c.has(u)||u.dispose();return r=i,i.map(u=>u.rendered)})})}function fr(e,t,n,r){let o=[],s=[];return F(()=>{for(let i of s)i.dispose();o=[],s=[]}),T(()=>{let i=e()||[];return D(()=>{if(i.length===0){for(let d of s)d.dispose();return o=[],s=[],r?.fallback?r.fallback():[]}let c=new Map;for(let d=0;d<o.length;d++)c.set(o[d],s[d]);let u=[],l=[],b=new Set;for(let d=0;d<i.length;d++){let m=t(i[d]),v=c.get(m);if(v&&!b.has(m))v.setIndex(d),u.push(v);else{let O,x,E;Y(p=>{E=p;let[U,A]=h(d);x=A;let B=T(P=>{let I=(e()||[])[U()];return I??P},i[d]);O=n(B,U)}),u.push({rendered:O,dispose:E,setIndex:x})}l.push(m),b.add(m)}for(let[d,m]of c)b.has(d)||m.dispose();return o=l,s=u,u.map(d=>d.rendered)})})}function dr(e,t,n){let r=[];return F(()=>{for(let o of r)o.dispose();r=[]}),T(()=>{let o=e()||[];return D(()=>{if(o.length===0){for(let u of r)u.dispose();return r=[],n?.fallback?n.fallback():[]}let s=r.length,i=o.length;for(let u=s;u<i;u++){let l,b,d,m=o[u];Y(v=>{d=v;let[O,x]=h(m);b=x,l=t(O,u)}),r.push({rendered:l,setItem:b,dispose:d})}for(let u=i;u<s;u++)r[u].dispose();i<s&&(r=r.slice(0,i));let c=Math.min(s,i);for(let u=0;u<c;u++)r[u].setItem(o[u]);return r.map(u=>u.rendered)})})}var Ce=!1,pr=Symbol.for("signal"),Tr=Symbol.for("memo"),yr=Symbol.for("resource");function Le(e){return typeof e=="function"&&e[pr]===!0}function tn(e){return typeof e=="function"&&e[Tr]===!0}function nn(e){return typeof e=="function"&&e[yr]===!0}function rn(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function on(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function sn(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function lt(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?lt(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var ft=null;function yt(e){ft=e}function X(e){ft&&ft(e)}var dt=null;function mt(e){dt=e}function Ee(e){return dt?dt(e):void 0}var pt=null;function ht(e){pt=e}function Pe(){return pt?pt():void 0}var Tt=null;function bt(e){Tt=e}function ke(e,t){Tt&&Tt(e,t)}function un(e,t=(n,r)=>n===r){let n=new Map;return M(()=>{let r=e();for(let[o,s]of n){let[i,c]=s,u=t(o,r);i()!==u&&c(u)}}),r=>{let o=n.get(r);if(!o){let[s,i]=h(!1);o=[s,i],n.set(r,o);let c=e();i(t(r,c))}return o[0]()}}function an(e,t){let[n,r]=h(e(),t);return M(()=>{let o=e();t?.timeoutMs?setTimeout(()=>r(()=>o),t.timeoutMs):typeof requestIdleCallback=="function"?requestIdleCallback(()=>r(()=>o)):Promise.resolve().then(()=>r(()=>o))}),n}function cn(e,t){let n,r=(...o)=>{n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0,e(...o)},t)};return F(()=>{n!==void 0&&clearTimeout(n)}),r}function mr(e){return!!e&&typeof e.then=="function"}var vt=Symbol();function de(e,t,n={}){let r,o;typeof t=="function"?(r=typeof e=="function"?e:()=>e,o=t):(r=()=>!0,o=e,t&&typeof t=="object"&&(n=t));let s=n.transport===!1?void 0:Pe(),i=s!==void 0?Ee(s):void 0,c=i!==void 0,[u,l]=h(i!==void 0?i.value:n.initialValue,{equals:!1}),[b,d]=h(void 0,{equals:!1}),[m,v]=h(i!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[O,x]=h(void 0,{equals:!1}),[E,p]=h(void 0,{equals:!1}),U=vt,A=!1;M(()=>{let C=r();if(E(),C===!1||C===null||C===void 0){U=vt,$(()=>{v("unresolved"),x(void 0),d(void 0)});return}let I=A;if(A=!1,U!==vt&&C===U&&!I)return;if(U=C,c){c=!1;return}let V=!1;F(()=>V=!0);let G=D(m),Se=D(u),ne=G==="ready"||G==="refreshing";$(()=>{v(ne?"refreshing":"pending"),d(void 0)});try{let q=o(C,{value:Se,refetching:ne});mr(q)?(x(q),X(q),q.then(z=>{V||(s!==void 0&&ke(s,z),$(()=>{l(()=>z),v("ready"),x(void 0)}))},z=>{V||$(()=>{d(z),v("errored"),x(void 0)})})):$(()=>{l(()=>q),v("ready"),x(void 0)})}catch(q){if(V)return;$(()=>{d(q),v("errored"),x(void 0)})}});let B=()=>{let C=m();return C==="pending"||C==="refreshing"},P=(()=>{let C=b();if(C)throw C;if(B()){let I=O();if(I)throw I}return u()});return Object.defineProperties(P,{state:{get:m},loading:{get:B},error:{get:b},latest:{get:u}}),Object.defineProperty(P,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(P,Symbol.for("signal"),{value:!0,enumerable:!0}),[P,{mutate:l,refetch:()=>{A=!0,p(void 0)}}]}function St(e,t=300){let[n,r]=h(e),[o,s]=h(e),[i,c]=h(!1),u,l=()=>{u!==void 0&&(clearTimeout(u),u=void 0)},b=()=>{l();let m=D(n);return s(()=>m),c(!1),m},d=(m=>{let v=typeof m=="function"?m(D(n)):m;return r(()=>v),c(!0),l(),u=setTimeout(b,t),v});return F(l),[o,d,{immediate:n,pending:i,flush:b,cancel:()=>{l(),c(!1)}}]}function hr(e){return e!=null&&e!==""}function ln(e,t,n={}){let{delay:r=300,initialValue:o,shouldFetch:s=hr}=n,[i,c,u]=St(e,r),l=()=>s(i())?i():!1,[b,{refetch:d}]=de(l,t,o===void 0?{}:{initialValue:o});return[b,{...u,query:i,setQuery:c,refetch:d}]}function $e(e){if(typeof e=="function"&&!e.length){let t=e();return Le(t)?t:$e(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=$e(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function Ve(e){let t=T(e);return T(()=>$e(t()))}var Ke=ce();Kt((e,t)=>{let n=je(t,Ke);n&&(n.increment(),e.finally(()=>n.decrement()))});function fn(){let[e,t]=h(0),n=0;return{increment:()=>t(n+=1),decrement:()=>t(n-=1),inFallback:()=>e()>0}}function dn(e,t){return le(Ke,e,t)}var pn=ce();Wt((e,t)=>{let n=je(t,pn);return n?(n.setError(e),!0):!1});function Tn(){let[e,t]=h(void 0,{equals:!1});return{error:e,reset:()=>t(()=>{}),setError:r=>t(()=>r)}}function yn(e,t){return le(pn,e,t)}var mn={State:ue,Computed:K,subtle:{Watcher:ae,untrack:ge,currentComputed:Nt,hasSinks:jt}};var br=Symbol.for("signal"),vr=Symbol.for("fluixi-proxy");function Sr(e,t){let[n,r]=h(e,t);return Object.assign(n,{set:r})}function xr(e,t,n){return T(e,t,n)}function gr(e,t){return M(e,t)}function hn(...e){let[t,n]=de(...e);return Object.assign(t,n)}var g=require("@fluixi/reactive/signal"),Fe=Symbol("store-raw"),Q=Symbol("store-node"),bn=Symbol("store-has"),We=Symbol("store-self"),Ge=Symbol("store-track"),Rn=Symbol("store-name"),An=Symbol("store-store"),vn=new WeakMap,Sn=new WeakMap;function Cn(e){let[t,n]=(0,g.createSignal)(e),r=t;return r.$=n,r}function ze(e){let t=vn.get(e);return t||vn.set(e,t={keys:new Map}),t}function xn(e,t,n){let r=e.keys.get(t);return r||e.keys.set(t,r=Cn(n)),r}function gn(e){let t=ze(e);(t.all||(t.all=Cn()))()}function wn(e,t){e.$(typeof t=="function"?()=>t:t)}function En(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 He(e){if(!En(e))return e;let t=Sn.get(e);if(t)return t;let n=new Proxy(e,wr);return Sn.set(e,n),n}var wr={get(e,t,n){if(t===Fe||t===Q)return e;if(t===g.$PROXY)return n;if(t===bn)return i=>i in e;if(t==="__proxy")return!0;if(t===Ge||t===We)return gn(e),n;let r=e[t];if(typeof r=="function"&&!Object.prototype.hasOwnProperty.call(e,t))return r;let o=Object.getOwnPropertyDescriptor(e,t);if(o&&o.get)return o.get.call(n);let s=xn(ze(e),t,r)();return En(s)?He(s):s},set(){return!0},deleteProperty(e,t){return t in e&&_e(e,t,void 0),!0},has(e,t){return t===Fe||t===g.$PROXY||t===Q||t===bn||t===We||t===Ge?!0:(xn(ze(e),t,e[t])(),t in e)},ownKeys(e){return gn(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function _e(e,t,n){if(e[t]===n&&(n!==void 0||t in e))return;let o=Array.isArray(e),s=o?e.length:0;n===void 0?delete e[t]:e[t]=n;let i=ze(e),c=i.keys.get(t);if(c&&wn(c,n),o&&e.length!==s){let u=i.keys.get("length");u&&wn(u,e.length)}i.all&&i.all.$(void 0)}function On(e,t){return typeof e=="function"?e(t):e}function gt(e,t){for(let n of Object.keys(t)){let r=t[n],o=e[n];r&&typeof r=="object"&&!Array.isArray(r)&&o&&typeof o=="object"&&!Array.isArray(o)?gt(o,r):_e(e,n,r)}}function Ot(e){let t=[],n=e.replace(/\[([^\]]*)\]/g,".$1");for(let r of n.split("."))r.length&&t.push(r);return t}function Pn(e,t,n){let r=t.length-1;for(let s=0;s<r;s++){let i=t[s];if(i==="*"){let u=t.slice(s+1);if(Array.isArray(e))for(let l=0;l<e.length;l++)Pn(e[l],u,n);return}let c=e[i];(c==null||typeof c!="object")&&(c=/^\d+$/.test(t[s+1])?[]:{},_e(e,i,c)),e=c}let o=t[r];if(o==="*"){if(Array.isArray(e))for(let s=0;s<e.length;s++)_e(e,s,On(n,e[s]));return}_e(e,o,On(n,e[o]))}function xt(e,t,n){Pn(e,Ot(t),n)}function Or(e,t){let n=t[0];if(typeof n=="function"&&t.length===1){let r=n(e);r&&r!==e&>(e,r);return}if(Array.isArray(n)&&t.length===1){for(let r of n)Array.isArray(r)&&xt(e,r[0],r[1]);return}if(n&&typeof n=="object"&&!Array.isArray(n)&&t.length===1){gt(e,n);return}if(Array.isArray(t[1])&&t.length>=3){xt(e,`${n}.${t[1].join(".")}`,t[2]);return}xt(e,String(n),t[1])}function wt(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(wt);let t={};for(let n of Object.keys(e))t[n]=wt(e[n]);return t}function pe(e,t){let n=e;for(let r of Ot(t)){if(n==null)return;n=n[r]}return n}var H=class{constructor(t,n={immutable:!0}){this.options=n;this.root=t,this.set=((...r)=>(0,g.batch)(()=>Or(this.root,r)))}get state(){return He(this.root)}get proxy(){return He(this.root)}get accessor(){return(()=>He(this.root))}unwrap(){return this.root}getNode(t){return this.root&&this.root[t]}get(t){if(t==null||t==="")return Te(this.state);let n=this.state;for(let r of Ot(t)){if(n==null)return;n=n[r]}return Te(n)}select(t){return(0,g.createMemo)(()=>t(this.state))}subscribe(t){return(0,g.createEffect)(()=>t(this.state))}watch(t,n){let r;return(0,g.createEffect)(()=>{let o=t(this.state);Object.is(o,r)||(n(o,r),r=o)})}reactive(t){return(0,g.createMemo)(()=>this.state[t])}produce(t){this.set((n=>{let r=wt(n);return t(r),r}))}reconcile(t,n={}){this.set(t)}push(t,...n){let r=pe(this.root,t);this.set(t,r.concat(n))}pop(t){let n=pe(this.root,t).slice(),r=n.pop();return this.set(t,n),r}shift(t){let n=pe(this.root,t).slice(),r=n.shift();return this.set(t,n),r}splice(t,n,r,...o){let s=pe(this.root,t).slice(),i=s.splice(n,r,...o);return this.set(t,s),i}insert(t,n,r){let o=pe(this.root,t).slice();o.splice(n,0,r),this.set(t,o)}removeAt(t,n){let r=pe(this.root,t).slice(),o=r.splice(n,1);return this.set(t,r),o}toObservable(){let[t]=(0,g.createSignal)(this.state);return t.toObservable()}dispose(){}},Rr=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","unwrap","toObservable"];function kn(e,t){for(let n of Rr)e[n]=t[n].bind(t);e.$=t.reactive.bind(t)}function De(e,t={immutable:!0}){let n=new H(e,t);return kn(n.set,n),[n.proxy,n.set]}function Rt(e,t={}){return new H(e,{...t,immutable:!1})}function _n(e,t={}){let n=new H(e(),t);return(0,g.createEffect)(()=>n.set(e())),n}function Fn(e,t,n){return(0,g.createEffect)(()=>n(t(e)))}function Dn(e,t,n){return(0,g.createMemo)(()=>t(e),void 0,n)}function Un(e,t={}){let n=new H(e,t),r=(()=>n.proxy);return kn(r,n),r}function Te(e){if(e==null||typeof e!="object")return e;let t=e[Fe];return t!==void 0?t:e}function At(e){return(0,g.untrack)(()=>Te(e))}function In(e){return Ye(e)}function Mn(e){return Ye(e)?e[Q]:null}function qn(e){return e&&typeof e=="object"&&Q in e?e[Q]:null}function Ye(e){return!!e&&typeof e=="object"&&(g.$PROXY in e||e.__proxy===!0)}function Nn(e){return e}var jn=Object.freeze({createStore:De,createMutableStore:Rt,batch:g.batch,unwrap:Te,untrackStore:At});function Ct(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Ct);let t={};for(let n of Object.keys(e))t[n]=Ct(e[n]);return t}function Bn(e){return t=>{let n=Ct(t);return e(n),n}}function Ln(e,t={}){return()=>e}function $n(e,t){let[n,r]=De(e,t);return new Proxy(n,{get:(o,s)=>s==="set"?r:o[s],has:(o,s)=>s==="set"||Reflect.has(o,s)})}function Ar(e,t,n){return T(()=>t(e()),void 0,n)}function Cr(e,t,n){return T(()=>e().filter(t),void 0,n)}function Er(e,t,n,r){return T(()=>e().reduce(t,n),void 0,r)}function Pr(e,t,n){return T(()=>e().find(t),void 0,n)}function kr(e,t,n){return T(()=>e().some(t),void 0,n)}function _r(e,t,n){return T(()=>e().every(t),void 0,n)}function Fr(e,t,n){return T(()=>[...e()].sort(t),void 0,n)}function Dr(e,t){return T(()=>[...new Set(e())],void 0,t)}function Ur(e,t,n){return T(()=>{let r=e.map(o=>o());return t(r)},void 0,n)}function Ir(...e){return new N(t=>{let n=()=>e.map(o=>typeof o=="function"?o():o.get()),r=e.map(o=>typeof o=="function"&&o.subscribe?o.subscribe(()=>{t.next(n())}):typeof o!="function"?o.subscribe(()=>{t.next(n())}):M(()=>{t.next(n())}));return()=>{r.forEach(o=>{typeof o=="function"?o():o&&typeof o.unsubscribe=="function"&&o.unsubscribe()})}})}function Mr(e,t,n){return T(()=>e()||t(),void 0,n)}function qr(e,t,n,r){return T(()=>n(e(),t()),void 0,r)}function Nr(e,t,n){return T(()=>t(e()),void 0,{equals:n,internal:!0})}function jr(e,t,n){return T(()=>{let r=e(),o={};for(let s of t)o[s]=r[s];return o},void 0,n)}function Br(e,t,n){return T(()=>{let o={...e()};for(let s of t)delete o[s];return o},void 0,n)}function Lr(e,t,n,r){return T(()=>e()?t():n(),void 0,r)}function $r(e,t,n){return T(()=>e()?t():void 0,void 0,n)}function Vr(e,t,n){let[r,o]=h(e()),s;return T(()=>{let i=e();clearTimeout(s),s=setTimeout(()=>o(()=>i),t)}),r}function Kr(e,t,n){let[r,o]=h(e()),s=0,i;return T(()=>{let c=e(),u=Date.now();u-s>=t?(s=u,o(()=>c)):(clearTimeout(i),i=setTimeout(()=>{s=Date.now(),o(()=>c)},t-(u-s)))}),r}function Hr(e){let t=e;for(;typeof t=="function";)t=t();return t}var Wr=Symbol.for("signal");var Vn=Symbol("fluixi-proxy"),Gr=Symbol.for("signal-node"),Ue=0,Pt=1,Ze=2,me=3,S=null,R=null,f=null,Qe=null,Je=0,zr=!1,Et=!1,ye=0,Yr=1e6,W=new WeakMap,Xe=null;var Xr=new Map,Qr=0;function Jr(){return`node_${++Qr}_${Date.now()}`}function Zr(e){!1}function eo(e,t,n){let r={id:Jr(),type:e,value:t,version:0,equals:n?.equals,name:n?.name,created:Date.now(),updated:Date.now()};return Zr(r),r}function to(e,t){return e===t}function Hn(e){throw typeof console<"u"&&console.error("Reactive error:",e),e}function no(e){if(f)f.indexOf(e)===-1&&f.push(e);else if(Xe&&Xe.running&&!e.pure)Xe.effects.indexOf(e)===-1&&Xe.effects.push(e);else if(!e.pure||e.computed)_t(e);else if(e.pure&&!e.computed&&e.accessor){let t=R,n=f;R=null,f=[],e.accessor(),R=t;let r=f;if(f=n,r.length>0){let o=f;et(r),f=o}}}function Kn(e,t){for(let n=0;n<e.length;n++)t(e[n])}function J(e,t){let n=e;typeof n=="object"&&n&&Vn in n&&delete n[Vn];let r=eo("signal",n,{equals:t?.equals===!1?void 0:t?.equals,name:t?.name}),o=[i,c];W.set(o,new Set);let s;function i(){let u=R;if(u){u.sources?u.sources.indexOf(o)===-1&&u.sources.push(o):u.sources=[o];let l=W.get(o);l&&!l.has(u)&&l.add(u)}return n}function c(u){let l=typeof u=="function"?u(n):u,b=r.equals||to;if(t?.equals===!1||!b(n,l)){n=l,r.value=l,r.version++,r.updated=Date.now();let m=W.get(o);if(m&&m.size>0){let E=function(p,U=!1){let A=p.state;if(!(A===me&&p===R)){if(U&&!p.pure){A===Ue&&(p.state=Pt,zr&&(f!==null&&f.indexOf(p)===-1?f.push(p):O.push(p)));return}if(!x.has(p)&&(x.add(p),p.state=Ze,A===Ue||A===Pt?O.push(p):!p.pure&&f!==null&&f.indexOf(p)===-1&&f.push(p),p.pure&&p.accessor)){let B=W.get(p.accessor);B&&Kn(Array.from(B),P=>E(P,!0))}}};var d=E;let v=Array.from(m),O=[],x=new Set;Kn(v,E);for(let p of O)no(p)}}}return i.toObservable=()=>new N(u=>{let l=!0;return kt(()=>{let d=i();l?l=!1:u.next(d)})}),Object.defineProperty(i,Wr,{value:!0,enumerable:!0}),Object.defineProperty(i,Gr,{value:r,enumerable:!1}),o}function kt(e,t,n){let r={fn:e,state:Ze,sources:null,sourceSlots:null,owned:null,cleanups:null,owner:S,contexts:null,pure:!1,updatedAt:null};S&&(S.owned?S.owned.push(r):S.owned=[r]);let o=j&&ve(j);return o&&(r.suspense=o),Wn(r,t),()=>he(r)}function Wn(e,t){if(e.sources){for(let o of e.sources){let s=W.get(o);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.owned){for(let o=0;o<e.owned.length;o++)he(e.owned[o]);e.owned=null}let n=R,r=S;if(R=e,S=e,Je++,Je>Yr)throw Je=0,R=n,S=r,new Error("Potential infinite loop detected. Exceeded maximum iterations.");try{e.state=me;let o=e.fn(t);typeof o=="function"&&(e.cleanups?e.cleanups.push(o):e.cleanups=[o]),e.state===me&&(e.state=Ue)}catch(o){if(rt(o)){let s=j&&ve(j);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Hn(o)}finally{R=n,S=r}}function _t(e){if(!(e.disposed||!e.fn||e.state===Ue)&&(e.state===Ze||e.state===Pt||e.state===me)){if(e.cleanups){for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();e.cleanups=null}if(e.owned){for(let t=0;t<e.owned.length;t++)he(e.owned[t]);e.owned=null}e.renderEffect?zn(e):Wn(e,e.value)}}function he(e){if(e.disposed=!0,e.sources)for(let t of e.sources){let n=W.get(t);n&&n.delete(e)}if(e.cleanups)for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();if(e.owned)for(let t=0;t<e.owned.length;t++)he(e.owned[t]);if(e.owner&&e.owner.owned){let t=e.owner.owned.indexOf(e);t!==-1&&e.owner.owned.splice(t,1)}}function et(e){let t=[],n=[];for(let o of e)o.pure&&!o.computed&&o.accessor?t.indexOf(o)===-1&&t.push(o):(o.computed||!o.pure)&&n.indexOf(o)===-1&&n.push(o);f=[];let r=0;for(;r<t.length;){let o=t[r++],s=W.get(o.accessor);if(s&&s.size>0){let c=R;R=null,o.accessor(),R=c}let i=f.splice(0);for(let c of i)c.pure&&!c.computed&&c.accessor?t.indexOf(c)===-1&&t.push(c):(c.computed||!c.pure)&&n.indexOf(c)===-1&&n.push(c)}f=null;for(let o of n)(o.computed||!o.pure)&&_t(o)}function Z(e){if(f&&ye>0)return e();if(f&&ye===0){let t=f,n=[];f=n,ye++;let r;try{r=e()}finally{ye--,f=t}let o=f;return et(n),f=o,r}ye++,f=[],Qe=[];try{return e()}finally{ye--,ro()}}function ro(){if(!Et){Et=!0,Je=0;try{for(;f&&f.length>0;){let e=f;f=null,et(e)}if(f=null,Qe){let e=Qe;Qe=null;for(let t=0;t<e.length;t++)_t(e[t])}}finally{Et=!1}}}function be(e){let t=R;R=null;try{return e()}finally{R=t}}function Gn(e){S&&(S.cleanups?S.cleanups.push(e):S.cleanups=[e])}function oo(e){let t=Symbol("context"),n=so(t);return{id:t,Provider:n,defaultValue:e}}function so(e){return t=>{let n=S;for(;n;)n.contexts||(n.contexts=new Map),n.contexts.has(e)||n.contexts.set(e,t.value),n=n.owner;let r;return io(()=>{r=be(()=>{let o=S;return o&&(o.contexts||(o.contexts=new Map),o.contexts.set(e,t.value)),Ve(()=>t.children)})}),r}}function ve(e){let t=S;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.owner}if(e)return e.defaultValue}function io(e,t,n){let r={fn:e,state:Ze,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:S,contexts:null,pure:!1,updatedAt:null,renderEffect:!0};S&&(S.owned?S.owned.push(r):S.owned=[r]);let o=j&&ve(j);return o&&(r.suspense=o),zn(r),()=>he(r)}function zn(e){if(e.sources){for(let o of e.sources){let s=W.get(o);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.cleanups){for(let o=0;o<e.cleanups.length;o++)e.cleanups[o]();e.cleanups=null}if(e.owned){for(let o=0;o<e.owned.length;o++)he(e.owned[o]);e.owned=null}let t=R,n=S,r=f;R=e,S=e,f===null&&(f=[]),e.state=me;try{let o=e.fn(e.value);typeof o=="function"&&(e.cleanups||(e.cleanups=[]),e.cleanups.push(o)),e.value=o,e.state===me&&(e.state=Ue)}catch(o){if(rt(o)){let s=j&&ve(j);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Hn(o)}finally{R=t,S=n;let o=f;if(f=r,o!==r&&o&&o.length>0){let s=f;et(o),f=s}}}var j;function Yn(){return j||(j=oo())}var te=new Map,ee=new Map,uo=0,ao=Symbol.for("signal"),co=Symbol.for("resource");function lo(e,t,n={}){let r,o,s;typeof t=="function"?(r=e,o=t,s=n):(r=()=>!0,o=e,s=t??n);let{ttl:i=1/0,name:c=`_auto_${uo++}`,staleWhileRevalidate:u=!0}=s,l=c,b=y=>`${l}:${JSON.stringify(y)}`,d=y=>i===1/0||Date.now()-y.timestamp<=i,[m,v]=J(void 0,{equals:!1}),[O,x]=J("unresolved",{equals:!1}),[E,p]=J(void 0,{equals:!1}),[U,A]=J(void 0,{equals:!1}),[B,P]=J(!1),[C,I]=J(0,{equals:!1}),V=Symbol("unset"),G=V,Se=!1,ne=!1;function q(y,k,_,L){if(ee.has(k)){ee.get(k).then(w=>{L()||z(w,_)},w=>{!L()&&!_&&Ft(w)}),_||A(ee.get(k));return}let re=Promise.resolve(o(y)).then(w=>(te.set(k,{value:w,timestamp:Date.now()}),ee.delete(k),w),w=>{throw ee.delete(k),w});if(ee.set(k,re),!_){X(re),A(re);let w=Ie&&ve(Ie);w&&(w.increment(),re.finally(()=>w.decrement()))}re.then(w=>{L()||z(w,_)},w=>{!L()&&!_&&Ft(w)})}function z(y,k){Z(()=>{v(()=>y),x("ready"),P(!1),A(void 0),p(void 0)})}function Ft(y){Z(()=>{p(y),x("errored"),A(void 0)})}let Ie;kt(()=>{Ie===void 0&&(Ie=Yn());let y=r();if(C(),y===!1||y===null||y===void 0){G=V,Z(()=>{x("unresolved"),A(void 0),p(void 0)});return}let k=Se,_=ne;Se=!1,ne=!1;let L=b(y);_&&te.delete(L);let re=G===V||y!==G;G=y;let w=!1;Gn(()=>{w=!0});let oe=te.get(L);if(oe&&d(oe)&&!k&&!_){(be(O)!=="ready"||be(m)!==oe.value)&&Z(()=>{v(()=>oe.value),x("ready"),P(!1),p(void 0)});return}if(oe&&u&&!_){Z(()=>{v(()=>oe.value),x("ready"),P(!0),p(void 0),A(void 0)}),q(y,L,!0,()=>w);return}let Dt=be(O),Xn=Dt==="ready"||Dt==="refreshing";Z(()=>{x(Xn?"refreshing":"pending"),p(void 0),P(!1)}),q(y,L,!1,()=>w)});let Me=(()=>{let y=E();if(y)throw y;if(O()==="pending"){let _=U();if(_)throw _}return m()});return Object.defineProperty(Me,co,{value:!0,enumerable:!0}),Object.defineProperty(Me,ao,{value:!0,enumerable:!0}),Object.defineProperties(Me,{state:{get:O},loading:{get:()=>{let y=O();return y==="pending"||y==="refreshing"}},error:{get:E},latest:{get:m},stale:{get:B}}),[Me,{mutate:v,refetch:()=>{Se=!0,I(y=>y+1)},invalidate:()=>{let y=be(r);y!=null&&y!==!1&&te.delete(b(y)),ne=!0,I(k=>k+1)}}]}function fo(e){let t=`${e}:`;for(let n of te.keys())n.startsWith(t)&&te.delete(n)}function po(){te.clear(),ee.clear()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Fluixi=(()=>{var st=Object.defineProperty;var Tr=Object.getOwnPropertyDescriptor;var mr=Object.getOwnPropertyNames;var br=Object.prototype.hasOwnProperty;var vr=(e,t)=>{for(var n in t)st(e,n,{get:t[n],enumerable:!0})},Sr=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of mr(t))!br.call(e,o)&&o!==n&&st(e,o,{get:()=>t[o],enumerable:!(r=Tr(t,o))||r.enumerable});return e};var xr=e=>Sr(st({},"__esModule",{value:!0}),e);var Zo={};vr(Zo,{$NAME:()=>Kn,$NODE:()=>Q,$PROXY:()=>jr,$RAW:()=>Ie,$SELF:()=>Xe,$SIGNAL:()=>Mr,$STORE:()=>Hn,$TRACK:()=>Qe,Observable:()=>j,SafeSubscriber:()=>Ne,Signal:()=>Rn,Store:()=>H,StoreAPI:()=>or,Subject:()=>at,Subscriber:()=>ie,Subscription:()=>se,SuspenseContext:()=>Ge,VERSION:()=>$t,__DEV__:()=>Ce,batch:()=>V,clearAllCachedResources:()=>Jo,clearCachedResourceNamespace:()=>Qo,combineSignal:()=>So,combineSignals:()=>xo,createCachedResource:()=>Xo,createChildOwner:()=>Yt,createComputed:()=>sn,createComputedStore:()=>Xn,createContext:()=>ce,createDebounce:()=>bn,createDebouncedResource:()=>vn,createDebouncedSignal:()=>Ot,createDeferred:()=>mn,createEffect:()=>U,createErrorBoundary:()=>wn,createMemo:()=>y,createMutableStore:()=>It,createRenderEffect:()=>un,createResource:()=>de,createRoot:()=>Y,createSelector:()=>Tn,createSignal:()=>b,createStore:()=>qe,createStoreEffect:()=>Qn,createStoreMemo:()=>Jn,createSuspenseBoundary:()=>Sn,debounceSignal:()=>_o,disposeScope:()=>Xt,distinctSignal:()=>vo,effect:()=>Lr,everySignal:()=>mo,filterSignal:()=>po,findSignal:()=>yo,flush:()=>cn,getNode:()=>tr,getOwner:()=>Re,getServerData:()=>ke,getStoreNode:()=>nr,guardSignal:()=>ko,indexArray:()=>Pr,isComponent:()=>pn,isMemo:()=>fn,isOwnerDisposed:()=>Qt,isProvider:()=>yn,isResource:()=>dn,isSignal:()=>$e,isStore:()=>er,isStoreProxy:()=>Ze,isSuspense:()=>hn,keyArray:()=>Er,makeArrayFlat:()=>ht,mapArray:()=>_r,mapSignal:()=>fo,memo:()=>Br,mergeSignal:()=>go,modifiable:()=>rr,nextResourceId:()=>_e,omitSignal:()=>Ao,on:()=>ln,onCleanup:()=>D,operate:()=>gr,pickSignal:()=>Ro,produceUtil:()=>sr,provide:()=>le,provideErrorBoundary:()=>On,provideSuspense:()=>xn,readChildren:()=>He,readSignal:()=>Po,reconcileUtil:()=>ir,reduceSignal:()=>ho,reportResourceData:()=>Ee,resource:()=>An,runWithOwner:()=>fe,selectSignal:()=>Oo,setOwner:()=>ft,setResourceDataSink:()=>gt,setResourceIdSource:()=>xt,setResourceTracker:()=>vt,setServerDataGetter:()=>St,signal:()=>Nr,someSignal:()=>To,sortSignal:()=>bo,startTransition:()=>pt,store:()=>ur,throttleSignal:()=>Eo,trackResourcePromise:()=>X,untrack:()=>F,untrackStore:()=>qt,unwrap:()=>he,useContext:()=>Jt,useTransition:()=>an,whenSignal:()=>Co,wrap:()=>Zn,zipSignal:()=>wo});var $t="1.0.0-alpha.78";function it(e){return typeof e=="function"&&!/^class\s/.test(Function.prototype.toString.call(e))}function Kt(e){return e==null||Array.isArray(e)||typeof e=="function"||e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error?!1:typeof e=="object"}function ut(e){return e instanceof Promise||!!e&&(typeof e=="object"||typeof e=="function")&&"then"in e}var se=class e{constructor(t){this._closed=!1;this._parentOrParents=null;this._subscriptions=null;t&&(this._subscriptions=[t])}get closed(){return this._closed}unsubscribe(){if(this._closed)return;this._closed=!0;let{_parentOrParents:t,_subscriptions:n}=this;if(t instanceof e)t.remove(this);else if(t!==null)for(let r of t)r.remove(this);if(n){for(let r of n)if(it(r)&&!(r instanceof e))try{r()}catch(o){console.error("Error in unsubscribe function:",o)}else if(Kt(r)&&typeof r.unsubscribe=="function")try{r.unsubscribe()}catch(o){console.error("Error unsubscribing child:",o)}this._subscriptions=null}}add(t){if(!t||t===this)return this;if(t.closed)return this;let{_closed:n,_subscriptions:r}=this;if(n){if(it(t))try{t()}catch(o){console.error("Error in unsubscribe function:",o)}else if(t.unsubscribe)try{t.unsubscribe()}catch(o){console.error("Error unsubscribing:",o)}return this}return r||(this._subscriptions=[]),this._subscriptions.push(t),t instanceof e&&t._addParent(this),this}remove(t){let{_subscriptions:n}=this;if(!n)return;let r=n.indexOf(t);r!==-1&&(n.splice(r,1),t._removeParent(this))}_addParent(t){let{_parentOrParents:n}=this;n?Array.isArray(n)?n.push(t):this._parentOrParents=[n,t]:this._parentOrParents=t}_removeParent(t){let{_parentOrParents:n}=this;if(n===t)this._parentOrParents=null;else if(Array.isArray(n)){let r=n.indexOf(t);r!==-1&&(n.splice(r,1),n.length===1&&(this._parentOrParents=n[0]))}}};var ie=class extends se{constructor(n,r,o){super();this.isStopped=!1;let s;n?typeof n=="object"?s=n:s={next:n,error:r,complete:o}:s={},this.destination=s}next(n){if(!this.isStopped&&this.destination.next)try{this.destination.next(n)}catch(r){this.error(r)}}error(n){if(!this.isStopped){if(this.isStopped=!0,this.destination.error)try{this.destination.error(n)}catch(r){throw r}else throw n;this.unsubscribe()}}complete(){if(!this.isStopped){if(this.isStopped=!0,this.destination.complete)try{this.destination.complete()}catch(n){this.error(n);return}this.unsubscribe()}}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}},Ne=class extends ie{constructor(n,r,o,s){super(n,r,o);this._isUnsubscribing=!1;this._parentSubscriber=null;this._parentSubscriber=s||null}next(n){if(!this.isStopped&&!this._isUnsubscribing)try{super.next(n)}catch(r){this.error(r)}}error(n){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.error(n)}finally{this._isUnsubscribing=!1}}}complete(){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.complete()}finally{this._isUnsubscribing=!1}}}unsubscribe(){this.closed||(this._isUnsubscribing=!0,super.unsubscribe(),this._isUnsubscribing=!1)}};function gr(e){return new ie(e.next,e.error,e.complete)}var j=class extends se{constructor(t){if(super(),t)this._subscribe=t;else throw new TypeError("Observable constructor requires a subscribe function")}subscribe(t,n,r){let o;t instanceof ie?o=t:o=new Ne(t,n,r);let{_subscribe:s}=this;try{let i=s.call(this,o);i&&(typeof i=="function"||typeof i.unsubscribe=="function")&&o.add(i)}catch(i){o.error(i)}return o}pipe(...t){return t.length===0?this:t.reduce((n,r)=>r(n),this)}toPromise(){return new Promise((t,n)=>{let r;this.subscribe({next:o=>r=o,error:n,complete:()=>t(r)})})}};var at=class extends j{constructor(){super(n=>{if(this.closed)throw new Error("Subject has been closed");if(this.hasError)n.error(this.thrownError);else if(this.isStopped)n.complete();else return this.observers.push(n),()=>{let r=this.observers.indexOf(n);r!==-1&&this.observers.splice(r,1)}});this.observers=[];this.isStopped=!1;this.hasError=!1;this.thrownError=null}next(n){if(this.isStopped)return;let{observers:r}=this,o=r.length,s=r.slice();for(let i=0;i<o;i++)s[i].next?.(n)}error(n){if(this.isStopped)return;this.hasError=!0,this.thrownError=n,this.isStopped=!0;let{observers:r}=this;this.observers=[];let o=r.length,s=r.slice();for(let i=0;i<o;i++)s[i].error?.(n)}complete(){if(this.isStopped)return;this.isStopped=!0;let{observers:n}=this;this.observers=[];let r=n.length,o=n.slice();for(let s=0;s<r;s++)o[s].complete?.()}unsubscribe(){this.isStopped=!0,this.observers=[]}asObservable(){return new j(r=>this.subscribe(r))}};var wr="__fluixi_signal_next_state__",Or=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},a=globalThis[wr]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Or,onSuspend:null,onError:null};var Ht=0,Gt=1,xe=2,Be=class{constructor(){this.observers=null;this.watchers=null;this.version=0}updateIfNecessary(){}track(){if(a.untracked)return;let t=a.consumer;t&&((this.observers??=new Set).add(t),(t.sources??=new Set).add(this))}},ue=class extends Be{constructor(t,n){super(),this._value=t,this._equals=n?.equals===!1?()=>!1:n?.equals??Object.is}get(){return this.track(),this._value}set(t){if(!this._equals(this._value,t)){if(this._value=t,this.version++,this.observers)for(let n of[...this.observers])n.markDirty(xe);ct(this)}}peek(){return this._value}},K=class extends Be{constructor(n,r){super();this._threw=!1;this._initialized=!1;this.state=xe;this.sources=null;this._fn=n,this._equals=r?.equals===!1?()=>!1:r?.equals??Object.is}get(){if(a.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===Gt&&this.sources){for(let n of this.sources)if(n.updateIfNecessary(),this.state===xe)break}(this.state===xe||!this._initialized)&&this.recompute(),this.state=Ht}recompute(){if(this.sources){for(let u of this.sources)u.observers?.delete(this);this.sources.clear()}let n=a.consumer,r=a.untracked;a.consumer=this,a.untracked=!1;let o,s=!1,i;try{o=this._fn()}catch(u){s=!0,i=u,o=this._value}finally{a.consumer=n,a.untracked=r}let c=!this._initialized||this._threw!==s||(s?i!==this._error:!this._equals(this._value,o));if(this._initialized=!0,this._threw=s,this._error=i,this._value=o,c){if(this.version++,this.observers)for(let u of[...this.observers])u.markDirty(xe);ct(this)}}markDirty(n){if(this.state>=n)return;let r=this.state===Ht;if(this.state=n,r){if(this.observers)for(let o of[...this.observers])o.markDirty(Gt);ct(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function ct(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var ae=class{constructor(t){this._watched=new Set;this._pending=new Set;this._notifyFn=t}watch(...t){for(let n of t)this._watched.add(n),(n.watchers??=new Set).add(this)}unwatch(...t){for(let n of t)this._watched.delete(n),n.watchers?.delete(this),this._pending.delete(n)}getPending(){let t=[...this._pending];return this._pending.clear(),t}_notify(t){if(!this._watched.has(t)||this._pending.has(t))return;let n=this._pending.size===0;this._pending.add(t),n&&this._notifyFn()}};function ge(e){if(a.untracked)return e();a.untracked=!0;try{return e()}finally{a.untracked=!1}}function Wt(){return a.consumer}function zt(e){return!!(e.observers&&e.observers.size)||!!(e.watchers&&e.watchers.size)}function Yt(e){let t=Oe(e);return e&&(e.owned??=[]).push(t),t}function Xt(e,t=!0){we(e,t)}function Qt(e){return!!e&&e.disposed===!0}function Oe(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function ce(e){let t=Symbol("context");return{id:t,defaultValue:e,Provider:r=>{let o=a.owner,s=Oe(o);(s.contexts=new Map).set(t,r.value),o&&(o.owned??=[]).push(s),a.owner=s;try{return r.children}finally{a.owner=o}}}}function Jt(e){let t=a.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.parent}return e.defaultValue}function Le(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function le(e,t,n){let r=Oe(a.owner);(r.contexts=new Map).set(e.id,t),a.owner&&(a.owner.owned??=[]).push(r);let o=a.owner;a.owner=r;try{return n()}finally{a.owner=o}}function Zt(e){a.onSuspend=e}function en(e){return a.onSuspend?(a.onSuspend(e,a.owner),!0):!1}function tn(e){a.onError=e}function Re(){return a.owner}function ft(e){let t=a.owner;return a.owner=e,t}function fe(e,t){let n=a.owner;a.owner=e;try{return t()}finally{a.owner=n}}function D(e){if(a.owner){if(a.owner.disposed){e();return}(a.owner.cleanups??=[]).push(e)}}function we(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)we(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function Y(e){let t=Oe(a.owner);a.owner&&(a.owner.owned??=[]).push(t);let n=a.owner;a.owner=t;try{return e(()=>we(t))}finally{a.owner=n}}function nn(e){a.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Rr(e){e.queued||(e.queued=!0,a.queue.push(e),!a.scheduled&&a.batchDepth===0&&(a.scheduled=!0,a.hostSchedule(Ae)))}function Ae(){if(a.scheduled=!1,a.flushing)return;a.flushing=!0;let e=0;try{for(;a.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=a.queue;a.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{a.flushing=!1}}function rn(){a.batchDepth===0&&Ae()}function dt(e){a.batchDepth++;try{return e()}finally{--a.batchDepth===0&&Ae()}}var lt=class{constructor(t){this.queued=!1;this.disposed=!1;this.owner=Oe(a.owner),a.owner&&(a.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new K(()=>{we(this.owner,!1),fe(this.owner,()=>{let n=t();typeof n=="function"&&(this.owner.cleanups??=[]).push(n)})}),this.watcher=new ae(()=>Rr(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(t){if(t&&typeof t.then=="function"&&a.onSuspend){a.onSuspend(t,this.owner);return}if(a.onError&&a.onError(t,this.owner))return;throw t}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),we(this.owner))}};function Ve(e){let t=new lt(e);return()=>t.dispose()}function Ar(e){return!!e&&typeof e.then=="function"}nn(()=>{});var on=Symbol.for("signal"),Cr=Symbol.for("memo"),kr=Symbol.for("signal-node");function b(e,t){let n=new ue(e,{equals:t?.equals}),r=(()=>n.get()),o=(s=>{let i=typeof s=="function"?s(n.peek()):s;return n.set(i),rn(),i});return Object.defineProperty(r,on,{value:!0,enumerable:!0}),Object.defineProperty(r,kr,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[r,o]}function y(e,t,n){let r=t,o=Re(),s=new K(()=>fe(o,()=>{try{return r=e(r)}catch(c){if(Ar(c))return en(c),r;throw c}}),{equals:n?.equals}),i=(()=>s.get());return Object.defineProperty(i,on,{value:!0,enumerable:!0}),Object.defineProperty(i,Cr,{value:!0,enumerable:!0}),i}function U(e,t){let n=t;return Ve(()=>{n=e(n)})}function sn(e,t){let n=t;Ve(()=>{n=e(n)})}function un(e,t){let n=t;return Ve(()=>{n=e(n)})}function V(e){return dt(e)}function F(e){return ge(e)}function pt(e){return dt(e),Promise.resolve()}function an(){return[()=>!1,pt]}function cn(){return Ae(),Promise.resolve()}function ln(e,t,n){let r=Array.isArray(e),o,s=n?.defer??!1;return i=>{let c=r?e.map(f=>f()):e();if(s){s=!1,o=c;return}let u=ge(()=>t(c,o,i));return o=c,u}}function _r(e,t,n){let r=[];return D(()=>{for(let o of r)o.dispose();r=[]}),y(()=>{let o=e()||[];return F(()=>{if(o.length===0){for(let u of r)u.dispose();return r=[],n?.fallback?n.fallback():[]}let s=new Map;for(let u of r)s.has(u.item)||s.set(u.item,u);let i=[],c=new Set;for(let u=0;u<o.length;u++){let f=o[u],v=s.get(f);if(v&&!c.has(v))v.setIndex(u),i.push(v),c.add(v);else{let p,m,S;Y(g=>{S=g;let[k,h]=b(u);m=h,p=t(f,k)});let O={item:f,rendered:p,dispose:S,setIndex:m};i.push(O),c.add(O)}}for(let u of r)c.has(u)||u.dispose();return r=i,i.map(u=>u.rendered)})})}function Er(e,t,n,r){let o=[],s=[];return D(()=>{for(let i of s)i.dispose();o=[],s=[]}),y(()=>{let i=e()||[];return F(()=>{if(i.length===0){for(let p of s)p.dispose();return o=[],s=[],r?.fallback?r.fallback():[]}let c=new Map;for(let p=0;p<o.length;p++)c.set(o[p],s[p]);let u=[],f=[],v=new Set;for(let p=0;p<i.length;p++){let m=t(i[p]),S=c.get(m);if(S&&!v.has(m))S.setIndex(p),u.push(S);else{let O,g,k;Y(h=>{k=h;let[I,A]=b(p);g=A;let B=y(_=>{let q=(e()||[])[I()];return q??_},i[p]);O=n(B,I)}),u.push({rendered:O,dispose:k,setIndex:g})}f.push(m),v.add(m)}for(let[p,m]of c)v.has(p)||m.dispose();return o=f,s=u,u.map(p=>p.rendered)})})}function Pr(e,t,n){let r=[];return D(()=>{for(let o of r)o.dispose();r=[]}),y(()=>{let o=e()||[];return F(()=>{if(o.length===0){for(let u of r)u.dispose();return r=[],n?.fallback?n.fallback():[]}let s=r.length,i=o.length;for(let u=s;u<i;u++){let f,v,p,m=o[u];Y(S=>{p=S;let[O,g]=b(m);v=g,f=t(O,u)}),r.push({rendered:f,setItem:v,dispose:p})}for(let u=i;u<s;u++)r[u].dispose();i<s&&(r=r.slice(0,i));let c=Math.min(s,i);for(let u=0;u<c;u++)r[u].setItem(o[u]);return r.map(u=>u.rendered)})})}var Ce=!1,Dr=Symbol.for("signal"),Fr=Symbol.for("memo"),Ir=Symbol.for("resource");function $e(e){return typeof e=="function"&&e[Dr]===!0}function fn(e){return typeof e=="function"&&e[Fr]===!0}function dn(e){return typeof e=="function"&&e[Ir]===!0}function pn(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function hn(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function yn(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function ht(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?ht(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var yt=null;function vt(e){yt=e}function X(e){yt&&yt(e)}var Tt=null;function St(e){Tt=e}function ke(e){return Tt?Tt(e):void 0}var mt=null;function xt(e){mt=e}function _e(){return mt?mt():void 0}var bt=null;function gt(e){bt=e}function Ee(e,t){bt&&bt(e,t)}function Tn(e,t=(n,r)=>n===r){let n=new Map;return U(()=>{let r=e();for(let[o,s]of n){let[i,c]=s,u=t(o,r);i()!==u&&c(u)}}),r=>{let o=n.get(r);if(!o){let[s,i]=b(!1);o=[s,i],n.set(r,o);let c=e();i(t(r,c))}return o[0]()}}function mn(e,t){let[n,r]=b(e(),t);return U(()=>{let o=e();t?.timeoutMs?setTimeout(()=>r(()=>o),t.timeoutMs):typeof requestIdleCallback=="function"?requestIdleCallback(()=>r(()=>o)):Promise.resolve().then(()=>r(()=>o))}),n}function bn(e,t){let n,r=(...o)=>{n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0,e(...o)},t)};return D(()=>{n!==void 0&&clearTimeout(n)}),r}function qr(e){return!!e&&typeof e.then=="function"}var wt=Symbol();function de(e,t,n={}){let r,o;typeof t=="function"?(r=typeof e=="function"?e:()=>e,o=t):(r=()=>!0,o=e,t&&typeof t=="object"&&(n=t));let s=n.transport===!1?void 0:_e(),i=s!==void 0?ke(s):void 0,c=i!==void 0,[u,f]=b(i!==void 0?i.value:n.initialValue,{equals:!1}),[v,p]=b(void 0,{equals:!1}),[m,S]=b(i!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[O,g]=b(void 0,{equals:!1}),[k,h]=b(void 0,{equals:!1}),I=wt,A=!1;U(()=>{let C=r();if(k(),C===!1||C===null||C===void 0){I=wt,V(()=>{S("unresolved"),g(void 0),p(void 0)});return}let q=A;if(A=!1,I!==wt&&C===I&&!q)return;if(I=C,c){c=!1;return}let $=!1;D(()=>$=!0);let W=F(m),Se=F(u),ne=W==="ready"||W==="refreshing";V(()=>{S(ne?"refreshing":"pending"),p(void 0)});try{let M=o(C,{value:Se,refetching:ne});qr(M)?(g(M),X(M),M.then(z=>{$||(s!==void 0&&Ee(s,z),V(()=>{f(()=>z),S("ready"),g(void 0)}))},z=>{$||V(()=>{p(z),S("errored"),g(void 0)})})):V(()=>{f(()=>M),S("ready"),g(void 0)})}catch(M){if($)return;V(()=>{p(M),S("errored"),g(void 0)})}});let B=()=>{let C=m();return C==="pending"||C==="refreshing"},_=(()=>{let C=v();if(C)throw C;if(B()){let q=O();if(q)throw q}return u()});return Object.defineProperties(_,{state:{get:m},loading:{get:B},error:{get:v},latest:{get:u}}),Object.defineProperty(_,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(_,Symbol.for("signal"),{value:!0,enumerable:!0}),[_,{mutate:f,refetch:()=>{A=!0,h(void 0)}}]}function Ot(e,t=300){let[n,r]=b(e),[o,s]=b(e),[i,c]=b(!1),u,f=()=>{u!==void 0&&(clearTimeout(u),u=void 0)},v=()=>{f();let m=F(n);return s(()=>m),c(!1),m},p=(m=>{let S=typeof m=="function"?m(F(n)):m;return r(()=>S),c(!0),f(),u=setTimeout(v,t),S});return D(f),[o,p,{immediate:n,pending:i,flush:v,cancel:()=>{f(),c(!1)}}]}function Ur(e){return e!=null&&e!==""}function vn(e,t,n={}){let{delay:r=300,initialValue:o,shouldFetch:s=Ur}=n,[i,c,u]=Ot(e,r),f=()=>s(i())?i():!1,[v,{refetch:p}]=de(f,t,o===void 0?{}:{initialValue:o});return[v,{...u,query:i,setQuery:c,refetch:p}]}function Ke(e){if(typeof e=="function"&&!e.length){let t=e();return $e(t)?t:Ke(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=Ke(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function He(e){let t=y(e);return y(()=>Ke(t()))}var Ge=ce();Zt((e,t)=>{let n=Le(t,Ge);n&&(n.increment(),e.finally(()=>n.decrement()))});function Sn(){let[e,t]=b(0),n=0;return{increment:()=>t(n+=1),decrement:()=>t(n-=1),inFallback:()=>e()>0}}function xn(e,t){return le(Ge,e,t)}var gn=ce();tn((e,t)=>{let n=Le(t,gn);return n?(n.setError(e),!0):!1});function wn(){let[e,t]=b(void 0,{equals:!1});return{error:e,reset:()=>t(()=>{}),setError:r=>t(()=>r)}}function On(e,t){return le(gn,e,t)}var Rn={State:ue,Computed:K,subtle:{Watcher:ae,untrack:ge,currentComputed:Wt,hasSinks:zt}};var Mr=Symbol.for("signal"),jr=Symbol.for("fluixi-proxy");function Nr(e,t){let[n,r]=b(e,t);return Object.assign(n,{set:r})}function Br(e,t,n){return y(e,t,n)}function Lr(e,t){return U(e,t)}function An(...e){let[t,n]=de(...e);return Object.assign(t,n)}var Vr="__fluixi_signal_next_state__",$r=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},l=globalThis[Vr]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:$r,onSuspend:null,onError:null},Cn=0,kn=1,Pe=2,_n=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(l.untracked)return;let e=l.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},Kr=class extends _n{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,this.observers)for(let t of[...this.observers])t.markDirty(Pe);Rt(this)}}peek(){return this._value}},En=class extends _n{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=Pe,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(l.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===kn&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===Pe)break}(this.state===Pe||!this._initialized)&&this.recompute(),this.state=Cn}recompute(){if(this.sources){for(let i of this.sources)i.observers?.delete(this);this.sources.clear()}let e=l.consumer,t=l.untracked;l.consumer=this,l.untracked=!1;let n,r=!1,o;try{n=this._fn()}catch(i){r=!0,o=i,n=this._value}finally{l.consumer=e,l.untracked=t}let s=!this._initialized||this._threw!==r||(r?o!==this._error:!this._equals(this._value,n));if(this._initialized=!0,this._threw=r,this._error=o,this._value=n,s){if(this.version++,this.observers)for(let i of[...this.observers])i.markDirty(Pe);Rt(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===Cn;if(this.state=e,t){if(this.observers)for(let n of[...this.observers])n.markDirty(kn);Rt(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function Rt(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var Hr=class{constructor(e){this._watched=new Set,this._pending=new Set,this._notifyFn=e}watch(...e){for(let t of e)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...e){for(let t of e)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let t=this._pending.size===0;this._pending.add(e),t&&this._notifyFn()}};function Gr(e){if(l.untracked)return e();l.untracked=!0;try{return e()}finally{l.untracked=!1}}function Pn(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Dn(e){let t=Symbol("context");return{id:t,defaultValue:e,Provider:n=>{let r=l.owner,o=Pn(r);(o.contexts=new Map).set(t,n.value),r&&(r.owned??=[]).push(o),l.owner=o;try{return n.children}finally{l.owner=r}}}}function Fn(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function Wr(e){l.onSuspend=e}function zr(e){return l.onSuspend?(l.onSuspend(e,l.owner),!0):!1}function Yr(e){l.onError=e}function Xr(){return l.owner}function In(e,t){let n=l.owner;l.owner=e;try{return t()}finally{l.owner=n}}function At(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)At(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function Qr(e){l.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Jr(e){e.queued||(e.queued=!0,l.queue.push(e),!l.scheduled&&l.batchDepth===0&&(l.scheduled=!0,l.hostSchedule(Ct)))}function Ct(){if(l.scheduled=!1,l.flushing)return;l.flushing=!0;let e=0;try{for(;l.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=l.queue;l.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{l.flushing=!1}}function Zr(){l.batchDepth===0&&Ct()}function eo(e){l.batchDepth++;try{return e()}finally{--l.batchDepth===0&&Ct()}}var to=class{constructor(e){this.queued=!1,this.disposed=!1,this.owner=Pn(l.owner),l.owner&&(l.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new En(()=>{At(this.owner,!1),In(this.owner,()=>{let t=e();typeof t=="function"&&(this.owner.cleanups??=[]).push(t)})}),this.watcher=new Hr(()=>Jr(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&l.onSuspend){l.onSuspend(e,this.owner);return}if(l.onError&&l.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),At(this.owner))}};function no(e){let t=new to(e);return()=>t.dispose()}function ro(e){return!!e&&typeof e.then=="function"}Qr(()=>{});var qn=Symbol.for("signal"),oo=Symbol.for("memo"),so=Symbol.for("signal-node");function kt(e,t){let n=new Kr(e,{equals:t?.equals}),r=(()=>n.get()),o=(s=>{let i=typeof s=="function"?s(n.peek()):s;return n.set(i),Zr(),i});return Object.defineProperty(r,qn,{value:!0,enumerable:!0}),Object.defineProperty(r,so,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[r,o]}function We(e,t,n){let r=t,o=Xr(),s=new En(()=>In(o,()=>{try{return r=e(r)}catch(c){if(ro(c))return zr(c),r;throw c}}),{equals:n?.equals}),i=(()=>s.get());return Object.defineProperty(i,qn,{value:!0,enumerable:!0}),Object.defineProperty(i,oo,{value:!0,enumerable:!0}),i}function De(e,t){let n=t;return no(()=>{n=e(n)})}function _t(e){return eo(e)}function Un(e){return Gr(e)}var io=Dn();Wr((e,t)=>{let n=Fn(t,io);n&&(n.increment(),e.finally(()=>n.decrement()))});var uo=Dn();Yr((e,t)=>{let n=Fn(t,uo);return n?(n.setError(e),!0):!1});var ze=Symbol.for("fluixi-proxy");var Ie=Symbol("store-raw"),Q=Symbol("store-node"),Mn=Symbol("store-has"),Xe=Symbol("store-self"),Qe=Symbol("store-track"),Kn=Symbol("store-name"),Hn=Symbol("store-store"),jn=new WeakMap,Nn=new WeakMap;function Gn(e){let[t,n]=kt(e),r=t;return r.$=n,r}function Je(e){let t=jn.get(e);return t||jn.set(e,t={keys:new Map}),t}function Bn(e,t,n){let r=e.keys.get(t);return r||e.keys.set(t,r=Gn(n)),r}function Ln(e){let t=Je(e);(t.all||(t.all=Gn()))()}function Vn(e,t){e.$(typeof t=="function"?()=>t:t)}function Wn(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 Ye(e){if(!Wn(e))return e;let t=Nn.get(e);if(t)return t;let n=new Proxy(e,ao);return Nn.set(e,n),n}var ao={get(e,t,n){if(t===Ie||t===Q)return e;if(t===ze)return n;if(t===Mn)return i=>i in e;if(t==="__proxy")return!0;if(t===Qe||t===Xe)return Ln(e),n;let r=e[t];if(typeof r=="function"&&!Object.prototype.hasOwnProperty.call(e,t))return r;let o=Object.getOwnPropertyDescriptor(e,t);if(o&&o.get)return o.get.call(n);let s=Bn(Je(e),t,r)();return Wn(s)?Ye(s):s},set(){return!0},deleteProperty(e,t){return t in e&&Fe(e,t,void 0),!0},has(e,t){return t===Ie||t===ze||t===Q||t===Mn||t===Xe||t===Qe?!0:(Bn(Je(e),t,e[t])(),t in e)},ownKeys(e){return Ln(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function Fe(e,t,n){if(e[t]===n&&(n!==void 0||t in e))return;let o=Array.isArray(e),s=o?e.length:0;n===void 0?delete e[t]:e[t]=n;let i=Je(e),c=i.keys.get(t);if(c&&Vn(c,n),o&&e.length!==s){let u=i.keys.get("length");u&&Vn(u,e.length)}i.all&&i.all.$(void 0)}function $n(e,t){return typeof e=="function"?e(t):e}function Pt(e,t){for(let n of Object.keys(t)){let r=t[n],o=e[n];r&&typeof r=="object"&&!Array.isArray(r)&&o&&typeof o=="object"&&!Array.isArray(o)?Pt(o,r):Fe(e,n,r)}}function Ft(e){let t=[],n=e.replace(/\[([^\]]*)\]/g,".$1");for(let r of n.split("."))r.length&&t.push(r);return t}function zn(e,t,n){let r=t.length-1;for(let s=0;s<r;s++){let i=t[s];if(i==="*"){let u=t.slice(s+1);if(Array.isArray(e))for(let f=0;f<e.length;f++)zn(e[f],u,n);return}let c=e[i];(c==null||typeof c!="object")&&(c=/^\d+$/.test(t[s+1])?[]:{},Fe(e,i,c)),e=c}let o=t[r];if(o==="*"){if(Array.isArray(e))for(let s=0;s<e.length;s++)Fe(e,s,$n(n,e[s]));return}Fe(e,o,$n(n,e[o]))}function Et(e,t,n){zn(e,Ft(t),n)}function co(e,t){let n=t[0];if(typeof n=="function"&&t.length===1){let r=n(e);r&&r!==e&&Pt(e,r);return}if(Array.isArray(n)&&t.length===1){for(let r of n)Array.isArray(r)&&Et(e,r[0],r[1]);return}if(n&&typeof n=="object"&&!Array.isArray(n)&&t.length===1){Pt(e,n);return}if(Array.isArray(t[1])&&t.length>=3){Et(e,`${n}.${t[1].join(".")}`,t[2]);return}Et(e,String(n),t[1])}function Dt(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Dt);let t={};for(let n of Object.keys(e))t[n]=Dt(e[n]);return t}function pe(e,t){let n=e;for(let r of Ft(t)){if(n==null)return;n=n[r]}return n}var H=class{constructor(t,n={immutable:!0}){this.options=n;this.root=t,this.set=((...r)=>_t(()=>co(this.root,r)))}get state(){return Ye(this.root)}get proxy(){return Ye(this.root)}get accessor(){return(()=>Ye(this.root))}unwrap(){return this.root}getNode(t){return this.root&&this.root[t]}get(t){if(t==null||t==="")return he(this.state);let n=this.state;for(let r of Ft(t)){if(n==null)return;n=n[r]}return he(n)}select(t){return We(()=>t(this.state))}subscribe(t){return De(()=>t(this.state))}watch(t,n){let r;return De(()=>{let o=t(this.state);Object.is(o,r)||(n(o,r),r=o)})}reactive(t){return We(()=>this.state[t])}produce(t){this.set((n=>{let r=Dt(n);return t(r),r}))}reconcile(t,n={}){this.set(t)}push(t,...n){let r=pe(this.root,t);this.set(t,r.concat(n))}pop(t){let n=pe(this.root,t).slice(),r=n.pop();return this.set(t,n),r}shift(t){let n=pe(this.root,t).slice(),r=n.shift();return this.set(t,n),r}splice(t,n,r,...o){let s=pe(this.root,t).slice(),i=s.splice(n,r,...o);return this.set(t,s),i}insert(t,n,r){let o=pe(this.root,t).slice();o.splice(n,0,r),this.set(t,o)}removeAt(t,n){let r=pe(this.root,t).slice(),o=r.splice(n,1);return this.set(t,r),o}toObservable(){let[t]=kt(this.state);return t.toObservable()}dispose(){}},lo=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","unwrap","toObservable"];function Yn(e,t){for(let n of lo)e[n]=t[n].bind(t);e.$=t.reactive.bind(t)}function qe(e,t={immutable:!0}){let n=new H(e,t);return Yn(n.set,n),[n.proxy,n.set]}function It(e,t={}){return new H(e,{...t,immutable:!1})}function Xn(e,t={}){let n=new H(e(),t);return De(()=>n.set(e())),n}function Qn(e,t,n){return De(()=>n(t(e)))}function Jn(e,t,n){return We(()=>t(e),void 0,n)}function Zn(e,t={}){let n=new H(e,t),r=(()=>n.proxy);return Yn(r,n),r}function he(e){if(e==null||typeof e!="object")return e;let t=e[Ie];return t!==void 0?t:e}function qt(e){return Un(()=>he(e))}function er(e){return Ze(e)}function tr(e){return Ze(e)?e[Q]:null}function nr(e){return e&&typeof e=="object"&&Q in e?e[Q]:null}function Ze(e){return!!e&&typeof e=="object"&&(ze in e||e.__proxy===!0)}function rr(e){return e}var or=Object.freeze({createStore:qe,createMutableStore:It,batch:_t,unwrap:he,untrackStore:qt});function Ut(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Ut);let t={};for(let n of Object.keys(e))t[n]=Ut(e[n]);return t}function sr(e){return t=>{let n=Ut(t);return e(n),n}}function ir(e,t={}){return()=>e}function ur(e,t){let[n,r]=qe(e,t);return new Proxy(n,{get:(o,s)=>s==="set"?r:o[s],has:(o,s)=>s==="set"||Reflect.has(o,s)})}function fo(e,t,n){return y(()=>t(e()),void 0,n)}function po(e,t,n){return y(()=>e().filter(t),void 0,n)}function ho(e,t,n,r){return y(()=>e().reduce(t,n),void 0,r)}function yo(e,t,n){return y(()=>e().find(t),void 0,n)}function To(e,t,n){return y(()=>e().some(t),void 0,n)}function mo(e,t,n){return y(()=>e().every(t),void 0,n)}function bo(e,t,n){return y(()=>[...e()].sort(t),void 0,n)}function vo(e,t){return y(()=>[...new Set(e())],void 0,t)}function So(e,t,n){return y(()=>{let r=e.map(o=>o());return t(r)},void 0,n)}function xo(...e){return new j(t=>{let n=()=>e.map(o=>typeof o=="function"?o():o.get()),r=e.map(o=>typeof o=="function"&&o.subscribe?o.subscribe(()=>{t.next(n())}):typeof o!="function"?o.subscribe(()=>{t.next(n())}):U(()=>{t.next(n())}));return()=>{r.forEach(o=>{typeof o=="function"?o():o&&typeof o.unsubscribe=="function"&&o.unsubscribe()})}})}function go(e,t,n){return y(()=>e()||t(),void 0,n)}function wo(e,t,n,r){return y(()=>n(e(),t()),void 0,r)}function Oo(e,t,n){return y(()=>t(e()),void 0,{equals:n,internal:!0})}function Ro(e,t,n){return y(()=>{let r=e(),o={};for(let s of t)o[s]=r[s];return o},void 0,n)}function Ao(e,t,n){return y(()=>{let o={...e()};for(let s of t)delete o[s];return o},void 0,n)}function Co(e,t,n,r){return y(()=>e()?t():n(),void 0,r)}function ko(e,t,n){return y(()=>e()?t():void 0,void 0,n)}function _o(e,t,n){let[r,o]=b(e()),s;return y(()=>{let i=e();clearTimeout(s),s=setTimeout(()=>o(()=>i),t)}),r}function Eo(e,t,n){let[r,o]=b(e()),s=0,i;return y(()=>{let c=e(),u=Date.now();u-s>=t?(s=u,o(()=>c)):(clearTimeout(i),i=setTimeout(()=>{s=Date.now(),o(()=>c)},t-(u-s)))}),r}function Po(e){let t=e;for(;typeof t=="function";)t=t();return t}var Do=Symbol.for("signal");var ar=Symbol("fluixi-proxy"),Fo=Symbol.for("signal-node"),Ue=0,jt=1,rt=2,Te=3,x=null,R=null,d=null,tt=null,nt=0,Io=!1,Mt=!1,ye=0,qo=1e6,G=new WeakMap,et=null;var Uo=new Map,Mo=0;function jo(){return`node_${++Mo}_${Date.now()}`}function No(e){!1}function Bo(e,t,n){let r={id:jo(),type:e,value:t,version:0,equals:n?.equals,name:n?.name,created:Date.now(),updated:Date.now()};return No(r),r}function Lo(e,t){return e===t}function lr(e){throw typeof console<"u"&&console.error("Reactive error:",e),e}function Vo(e){if(d)d.indexOf(e)===-1&&d.push(e);else if(et&&et.running&&!e.pure)et.effects.indexOf(e)===-1&&et.effects.push(e);else if(!e.pure||e.computed)Bt(e);else if(e.pure&&!e.computed&&e.accessor){let t=R,n=d;R=null,d=[],e.accessor(),R=t;let r=d;if(d=n,r.length>0){let o=d;ot(r),d=o}}}function cr(e,t){for(let n=0;n<e.length;n++)t(e[n])}function J(e,t){let n=e;typeof n=="object"&&n&&ar in n&&delete n[ar];let r=Bo("signal",n,{equals:t?.equals===!1?void 0:t?.equals,name:t?.name}),o=[i,c];G.set(o,new Set);let s;function i(){let u=R;if(u){u.sources?u.sources.indexOf(o)===-1&&u.sources.push(o):u.sources=[o];let f=G.get(o);f&&!f.has(u)&&f.add(u)}return n}function c(u){let f=typeof u=="function"?u(n):u,v=r.equals||Lo;if(t?.equals===!1||!v(n,f)){n=f,r.value=f,r.version++,r.updated=Date.now();let m=G.get(o);if(m&&m.size>0){let k=function(h,I=!1){let A=h.state;if(!(A===Te&&h===R)){if(I&&!h.pure){A===Ue&&(h.state=jt,Io&&(d!==null&&d.indexOf(h)===-1?d.push(h):O.push(h)));return}if(!g.has(h)&&(g.add(h),h.state=rt,A===Ue||A===jt?O.push(h):!h.pure&&d!==null&&d.indexOf(h)===-1&&d.push(h),h.pure&&h.accessor)){let B=G.get(h.accessor);B&&cr(Array.from(B),_=>k(_,!0))}}};var p=k;let S=Array.from(m),O=[],g=new Set;cr(S,k);for(let h of O)Vo(h)}}}return i.toObservable=()=>new j(u=>{let f=!0;return Nt(()=>{let p=i();f?f=!1:u.next(p)})}),Object.defineProperty(i,Do,{value:!0,enumerable:!0}),Object.defineProperty(i,Fo,{value:r,enumerable:!1}),o}function Nt(e,t,n){let r={fn:e,state:rt,sources:null,sourceSlots:null,owned:null,cleanups:null,owner:x,contexts:null,pure:!1,updatedAt:null};x&&(x.owned?x.owned.push(r):x.owned=[r]);let o=N&&ve(N);return o&&(r.suspense=o),fr(r,t),()=>me(r)}function fr(e,t){if(e.sources){for(let o of e.sources){let s=G.get(o);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.owned){for(let o=0;o<e.owned.length;o++)me(e.owned[o]);e.owned=null}let n=R,r=x;if(R=e,x=e,nt++,nt>qo)throw nt=0,R=n,x=r,new Error("Potential infinite loop detected. Exceeded maximum iterations.");try{e.state=Te;let o=e.fn(t);typeof o=="function"&&(e.cleanups?e.cleanups.push(o):e.cleanups=[o]),e.state===Te&&(e.state=Ue)}catch(o){if(ut(o)){let s=N&&ve(N);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}lr(o)}finally{R=n,x=r}}function Bt(e){if(!(e.disposed||!e.fn||e.state===Ue)&&(e.state===rt||e.state===jt||e.state===Te)){if(e.cleanups){for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();e.cleanups=null}if(e.owned){for(let t=0;t<e.owned.length;t++)me(e.owned[t]);e.owned=null}e.renderEffect?pr(e):fr(e,e.value)}}function me(e){if(e.disposed=!0,e.sources)for(let t of e.sources){let n=G.get(t);n&&n.delete(e)}if(e.cleanups)for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();if(e.owned)for(let t=0;t<e.owned.length;t++)me(e.owned[t]);if(e.owner&&e.owner.owned){let t=e.owner.owned.indexOf(e);t!==-1&&e.owner.owned.splice(t,1)}}function ot(e){let t=[],n=[];for(let o of e)o.pure&&!o.computed&&o.accessor?t.indexOf(o)===-1&&t.push(o):(o.computed||!o.pure)&&n.indexOf(o)===-1&&n.push(o);d=[];let r=0;for(;r<t.length;){let o=t[r++],s=G.get(o.accessor);if(s&&s.size>0){let c=R;R=null,o.accessor(),R=c}let i=d.splice(0);for(let c of i)c.pure&&!c.computed&&c.accessor?t.indexOf(c)===-1&&t.push(c):(c.computed||!c.pure)&&n.indexOf(c)===-1&&n.push(c)}d=null;for(let o of n)(o.computed||!o.pure)&&Bt(o)}function Z(e){if(d&&ye>0)return e();if(d&&ye===0){let t=d,n=[];d=n,ye++;let r;try{r=e()}finally{ye--,d=t}let o=d;return ot(n),d=o,r}ye++,d=[],tt=[];try{return e()}finally{ye--,$o()}}function $o(){if(!Mt){Mt=!0,nt=0;try{for(;d&&d.length>0;){let e=d;d=null,ot(e)}if(d=null,tt){let e=tt;tt=null;for(let t=0;t<e.length;t++)Bt(e[t])}}finally{Mt=!1}}}function be(e){let t=R;R=null;try{return e()}finally{R=t}}function dr(e){x&&(x.cleanups?x.cleanups.push(e):x.cleanups=[e])}function Ko(e){let t=Symbol("context"),n=Ho(t);return{id:t,Provider:n,defaultValue:e}}function Ho(e){return t=>{let n=x;for(;n;)n.contexts||(n.contexts=new Map),n.contexts.has(e)||n.contexts.set(e,t.value),n=n.owner;let r;return Go(()=>{r=be(()=>{let o=x;return o&&(o.contexts||(o.contexts=new Map),o.contexts.set(e,t.value)),He(()=>t.children)})}),r}}function ve(e){let t=x;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.owner}if(e)return e.defaultValue}function Go(e,t,n){let r={fn:e,state:rt,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:x,contexts:null,pure:!1,updatedAt:null,renderEffect:!0};x&&(x.owned?x.owned.push(r):x.owned=[r]);let o=N&&ve(N);return o&&(r.suspense=o),pr(r),()=>me(r)}function pr(e){if(e.sources){for(let o of e.sources){let s=G.get(o);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.cleanups){for(let o=0;o<e.cleanups.length;o++)e.cleanups[o]();e.cleanups=null}if(e.owned){for(let o=0;o<e.owned.length;o++)me(e.owned[o]);e.owned=null}let t=R,n=x,r=d;R=e,x=e,d===null&&(d=[]),e.state=Te;try{let o=e.fn(e.value);typeof o=="function"&&(e.cleanups||(e.cleanups=[]),e.cleanups.push(o)),e.value=o,e.state===Te&&(e.state=Ue)}catch(o){if(ut(o)){let s=N&&ve(N);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}lr(o)}finally{R=t,x=n;let o=d;if(d=r,o!==r&&o&&o.length>0){let s=d;ot(o),d=s}}}var N;function hr(){return N||(N=Ko())}var te=new Map,ee=new Map,Wo=0,zo=Symbol.for("signal"),Yo=Symbol.for("resource");function Xo(e,t,n={}){let r,o,s;typeof t=="function"?(r=e,o=t,s=n):(r=()=>!0,o=e,s=t??n);let{ttl:i=1/0,name:c=`_auto_${Wo++}`,staleWhileRevalidate:u=!0}=s,f=c,v=T=>`${f}:${JSON.stringify(T)}`,p=T=>i===1/0||Date.now()-T.timestamp<=i,[m,S]=J(void 0,{equals:!1}),[O,g]=J("unresolved",{equals:!1}),[k,h]=J(void 0,{equals:!1}),[I,A]=J(void 0,{equals:!1}),[B,_]=J(!1),[C,q]=J(0,{equals:!1}),$=Symbol("unset"),W=$,Se=!1,ne=!1;function M(T,E,P,L){if(ee.has(E)){ee.get(E).then(w=>{L()||z(w,P)},w=>{!L()&&!P&&Lt(w)}),P||A(ee.get(E));return}let re=Promise.resolve(o(T)).then(w=>(te.set(E,{value:w,timestamp:Date.now()}),ee.delete(E),w),w=>{throw ee.delete(E),w});if(ee.set(E,re),!P){X(re),A(re);let w=Me&&ve(Me);w&&(w.increment(),re.finally(()=>w.decrement()))}re.then(w=>{L()||z(w,P)},w=>{!L()&&!P&&Lt(w)})}function z(T,E){Z(()=>{S(()=>T),g("ready"),_(!1),A(void 0),h(void 0)})}function Lt(T){Z(()=>{h(T),g("errored"),A(void 0)})}let Me;Nt(()=>{Me===void 0&&(Me=hr());let T=r();if(C(),T===!1||T===null||T===void 0){W=$,Z(()=>{g("unresolved"),A(void 0),h(void 0)});return}let E=Se,P=ne;Se=!1,ne=!1;let L=v(T);P&&te.delete(L);let re=W===$||T!==W;W=T;let w=!1;dr(()=>{w=!0});let oe=te.get(L);if(oe&&p(oe)&&!E&&!P){(be(O)!=="ready"||be(m)!==oe.value)&&Z(()=>{S(()=>oe.value),g("ready"),_(!1),h(void 0)});return}if(oe&&u&&!P){Z(()=>{S(()=>oe.value),g("ready"),_(!0),h(void 0),A(void 0)}),M(T,L,!0,()=>w);return}let Vt=be(O),yr=Vt==="ready"||Vt==="refreshing";Z(()=>{g(yr?"refreshing":"pending"),h(void 0),_(!1)}),M(T,L,!1,()=>w)});let je=(()=>{let T=k();if(T)throw T;if(O()==="pending"){let P=I();if(P)throw P}return m()});return Object.defineProperty(je,Yo,{value:!0,enumerable:!0}),Object.defineProperty(je,zo,{value:!0,enumerable:!0}),Object.defineProperties(je,{state:{get:O},loading:{get:()=>{let T=O();return T==="pending"||T==="refreshing"}},error:{get:k},latest:{get:m},stale:{get:B}}),[je,{mutate:S,refetch:()=>{Se=!0,q(T=>T+1)},invalidate:()=>{let T=be(r);T!=null&&T!==!1&&te.delete(v(T)),ne=!0,q(E=>E+1)}}]}function Qo(e){let t=`${e}:`;for(let n of te.keys())n.startsWith(t)&&te.delete(n)}function Jo(){te.clear(),ee.clear()}return xr(Zo);})();
|
|
1
|
+
"use strict";var Fluixi=(()=>{var st=Object.defineProperty;var Tr=Object.getOwnPropertyDescriptor;var mr=Object.getOwnPropertyNames;var br=Object.prototype.hasOwnProperty;var vr=(e,t)=>{for(var n in t)st(e,n,{get:t[n],enumerable:!0})},Sr=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of mr(t))!br.call(e,o)&&o!==n&&st(e,o,{get:()=>t[o],enumerable:!(r=Tr(t,o))||r.enumerable});return e};var xr=e=>Sr(st({},"__esModule",{value:!0}),e);var Zo={};vr(Zo,{$NAME:()=>Kn,$NODE:()=>Q,$PROXY:()=>jr,$RAW:()=>Ie,$SELF:()=>Xe,$SIGNAL:()=>Mr,$STORE:()=>Hn,$TRACK:()=>Qe,Observable:()=>j,SafeSubscriber:()=>Ne,Signal:()=>Rn,Store:()=>H,StoreAPI:()=>or,Subject:()=>at,Subscriber:()=>ie,Subscription:()=>se,SuspenseContext:()=>Ge,VERSION:()=>$t,__DEV__:()=>Ce,batch:()=>V,clearAllCachedResources:()=>Jo,clearCachedResourceNamespace:()=>Qo,combineSignal:()=>So,combineSignals:()=>xo,createCachedResource:()=>Xo,createChildOwner:()=>Yt,createComputed:()=>sn,createComputedStore:()=>Xn,createContext:()=>ce,createDebounce:()=>bn,createDebouncedResource:()=>vn,createDebouncedSignal:()=>Ot,createDeferred:()=>mn,createEffect:()=>U,createErrorBoundary:()=>wn,createMemo:()=>y,createMutableStore:()=>It,createRenderEffect:()=>un,createResource:()=>de,createRoot:()=>Y,createSelector:()=>Tn,createSignal:()=>b,createStore:()=>qe,createStoreEffect:()=>Qn,createStoreMemo:()=>Jn,createSuspenseBoundary:()=>Sn,debounceSignal:()=>_o,disposeScope:()=>Xt,distinctSignal:()=>vo,effect:()=>Lr,everySignal:()=>mo,filterSignal:()=>po,findSignal:()=>yo,flush:()=>cn,getNode:()=>tr,getOwner:()=>Re,getServerData:()=>ke,getStoreNode:()=>nr,guardSignal:()=>ko,indexArray:()=>Pr,isComponent:()=>pn,isMemo:()=>fn,isOwnerDisposed:()=>Qt,isProvider:()=>yn,isResource:()=>dn,isSignal:()=>$e,isStore:()=>er,isStoreProxy:()=>Ze,isSuspense:()=>hn,keyArray:()=>Er,makeArrayFlat:()=>ht,mapArray:()=>_r,mapSignal:()=>fo,memo:()=>Br,mergeSignal:()=>go,modifiable:()=>rr,nextResourceId:()=>_e,omitSignal:()=>Ao,on:()=>ln,onCleanup:()=>D,operate:()=>gr,pickSignal:()=>Ro,produceUtil:()=>sr,provide:()=>le,provideErrorBoundary:()=>On,provideSuspense:()=>xn,readChildren:()=>He,readSignal:()=>Po,reconcileUtil:()=>ir,reduceSignal:()=>ho,reportResourceData:()=>Ee,resource:()=>An,runWithOwner:()=>fe,selectSignal:()=>Oo,setOwner:()=>ft,setResourceDataSink:()=>gt,setResourceIdSource:()=>xt,setResourceTracker:()=>vt,setServerDataGetter:()=>St,signal:()=>Nr,someSignal:()=>To,sortSignal:()=>bo,startTransition:()=>pt,store:()=>ur,throttleSignal:()=>Eo,trackResourcePromise:()=>X,untrack:()=>F,untrackStore:()=>qt,unwrap:()=>he,useContext:()=>Jt,useTransition:()=>an,whenSignal:()=>Co,wrap:()=>Zn,zipSignal:()=>wo});var $t="1.0.0-alpha.79";function it(e){return typeof e=="function"&&!/^class\s/.test(Function.prototype.toString.call(e))}function Kt(e){return e==null||Array.isArray(e)||typeof e=="function"||e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error?!1:typeof e=="object"}function ut(e){return e instanceof Promise||!!e&&(typeof e=="object"||typeof e=="function")&&"then"in e}var se=class e{constructor(t){this._closed=!1;this._parentOrParents=null;this._subscriptions=null;t&&(this._subscriptions=[t])}get closed(){return this._closed}unsubscribe(){if(this._closed)return;this._closed=!0;let{_parentOrParents:t,_subscriptions:n}=this;if(t instanceof e)t.remove(this);else if(t!==null)for(let r of t)r.remove(this);if(n){for(let r of n)if(it(r)&&!(r instanceof e))try{r()}catch(o){console.error("Error in unsubscribe function:",o)}else if(Kt(r)&&typeof r.unsubscribe=="function")try{r.unsubscribe()}catch(o){console.error("Error unsubscribing child:",o)}this._subscriptions=null}}add(t){if(!t||t===this)return this;if(t.closed)return this;let{_closed:n,_subscriptions:r}=this;if(n){if(it(t))try{t()}catch(o){console.error("Error in unsubscribe function:",o)}else if(t.unsubscribe)try{t.unsubscribe()}catch(o){console.error("Error unsubscribing:",o)}return this}return r||(this._subscriptions=[]),this._subscriptions.push(t),t instanceof e&&t._addParent(this),this}remove(t){let{_subscriptions:n}=this;if(!n)return;let r=n.indexOf(t);r!==-1&&(n.splice(r,1),t._removeParent(this))}_addParent(t){let{_parentOrParents:n}=this;n?Array.isArray(n)?n.push(t):this._parentOrParents=[n,t]:this._parentOrParents=t}_removeParent(t){let{_parentOrParents:n}=this;if(n===t)this._parentOrParents=null;else if(Array.isArray(n)){let r=n.indexOf(t);r!==-1&&(n.splice(r,1),n.length===1&&(this._parentOrParents=n[0]))}}};var ie=class extends se{constructor(n,r,o){super();this.isStopped=!1;let s;n?typeof n=="object"?s=n:s={next:n,error:r,complete:o}:s={},this.destination=s}next(n){if(!this.isStopped&&this.destination.next)try{this.destination.next(n)}catch(r){this.error(r)}}error(n){if(!this.isStopped){if(this.isStopped=!0,this.destination.error)try{this.destination.error(n)}catch(r){throw r}else throw n;this.unsubscribe()}}complete(){if(!this.isStopped){if(this.isStopped=!0,this.destination.complete)try{this.destination.complete()}catch(n){this.error(n);return}this.unsubscribe()}}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}},Ne=class extends ie{constructor(n,r,o,s){super(n,r,o);this._isUnsubscribing=!1;this._parentSubscriber=null;this._parentSubscriber=s||null}next(n){if(!this.isStopped&&!this._isUnsubscribing)try{super.next(n)}catch(r){this.error(r)}}error(n){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.error(n)}finally{this._isUnsubscribing=!1}}}complete(){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.complete()}finally{this._isUnsubscribing=!1}}}unsubscribe(){this.closed||(this._isUnsubscribing=!0,super.unsubscribe(),this._isUnsubscribing=!1)}};function gr(e){return new ie(e.next,e.error,e.complete)}var j=class extends se{constructor(t){if(super(),t)this._subscribe=t;else throw new TypeError("Observable constructor requires a subscribe function")}subscribe(t,n,r){let o;t instanceof ie?o=t:o=new Ne(t,n,r);let{_subscribe:s}=this;try{let i=s.call(this,o);i&&(typeof i=="function"||typeof i.unsubscribe=="function")&&o.add(i)}catch(i){o.error(i)}return o}pipe(...t){return t.length===0?this:t.reduce((n,r)=>r(n),this)}toPromise(){return new Promise((t,n)=>{let r;this.subscribe({next:o=>r=o,error:n,complete:()=>t(r)})})}};var at=class extends j{constructor(){super(n=>{if(this.closed)throw new Error("Subject has been closed");if(this.hasError)n.error(this.thrownError);else if(this.isStopped)n.complete();else return this.observers.push(n),()=>{let r=this.observers.indexOf(n);r!==-1&&this.observers.splice(r,1)}});this.observers=[];this.isStopped=!1;this.hasError=!1;this.thrownError=null}next(n){if(this.isStopped)return;let{observers:r}=this,o=r.length,s=r.slice();for(let i=0;i<o;i++)s[i].next?.(n)}error(n){if(this.isStopped)return;this.hasError=!0,this.thrownError=n,this.isStopped=!0;let{observers:r}=this;this.observers=[];let o=r.length,s=r.slice();for(let i=0;i<o;i++)s[i].error?.(n)}complete(){if(this.isStopped)return;this.isStopped=!0;let{observers:n}=this;this.observers=[];let r=n.length,o=n.slice();for(let s=0;s<r;s++)o[s].complete?.()}unsubscribe(){this.isStopped=!0,this.observers=[]}asObservable(){return new j(r=>this.subscribe(r))}};var wr="__fluixi_signal_next_state__",Or=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},a=globalThis[wr]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Or,onSuspend:null,onError:null};var Ht=0,Gt=1,xe=2,Be=class{constructor(){this.observers=null;this.watchers=null;this.version=0}updateIfNecessary(){}track(){if(a.untracked)return;let t=a.consumer;t&&((this.observers??=new Set).add(t),(t.sources??=new Set).add(this))}},ue=class extends Be{constructor(t,n){super(),this._value=t,this._equals=n?.equals===!1?()=>!1:n?.equals??Object.is}get(){return this.track(),this._value}set(t){if(!this._equals(this._value,t)){if(this._value=t,this.version++,this.observers)for(let n of[...this.observers])n.markDirty(xe);ct(this)}}peek(){return this._value}},K=class extends Be{constructor(n,r){super();this._threw=!1;this._initialized=!1;this.state=xe;this.sources=null;this._fn=n,this._equals=r?.equals===!1?()=>!1:r?.equals??Object.is}get(){if(a.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===Gt&&this.sources){for(let n of this.sources)if(n.updateIfNecessary(),this.state===xe)break}(this.state===xe||!this._initialized)&&this.recompute(),this.state=Ht}recompute(){if(this.sources){for(let u of this.sources)u.observers?.delete(this);this.sources.clear()}let n=a.consumer,r=a.untracked;a.consumer=this,a.untracked=!1;let o,s=!1,i;try{o=this._fn()}catch(u){s=!0,i=u,o=this._value}finally{a.consumer=n,a.untracked=r}let c=!this._initialized||this._threw!==s||(s?i!==this._error:!this._equals(this._value,o));if(this._initialized=!0,this._threw=s,this._error=i,this._value=o,c){if(this.version++,this.observers)for(let u of[...this.observers])u.markDirty(xe);ct(this)}}markDirty(n){if(this.state>=n)return;let r=this.state===Ht;if(this.state=n,r){if(this.observers)for(let o of[...this.observers])o.markDirty(Gt);ct(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function ct(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var ae=class{constructor(t){this._watched=new Set;this._pending=new Set;this._notifyFn=t}watch(...t){for(let n of t)this._watched.add(n),(n.watchers??=new Set).add(this)}unwatch(...t){for(let n of t)this._watched.delete(n),n.watchers?.delete(this),this._pending.delete(n)}getPending(){let t=[...this._pending];return this._pending.clear(),t}_notify(t){if(!this._watched.has(t)||this._pending.has(t))return;let n=this._pending.size===0;this._pending.add(t),n&&this._notifyFn()}};function ge(e){if(a.untracked)return e();a.untracked=!0;try{return e()}finally{a.untracked=!1}}function Wt(){return a.consumer}function zt(e){return!!(e.observers&&e.observers.size)||!!(e.watchers&&e.watchers.size)}function Yt(e){let t=Oe(e);return e&&(e.owned??=[]).push(t),t}function Xt(e,t=!0){we(e,t)}function Qt(e){return!!e&&e.disposed===!0}function Oe(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function ce(e){let t=Symbol("context");return{id:t,defaultValue:e,Provider:r=>{let o=a.owner,s=Oe(o);(s.contexts=new Map).set(t,r.value),o&&(o.owned??=[]).push(s),a.owner=s;try{return r.children}finally{a.owner=o}}}}function Jt(e){let t=a.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.parent}return e.defaultValue}function Le(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function le(e,t,n){let r=Oe(a.owner);(r.contexts=new Map).set(e.id,t),a.owner&&(a.owner.owned??=[]).push(r);let o=a.owner;a.owner=r;try{return n()}finally{a.owner=o}}function Zt(e){a.onSuspend=e}function en(e){return a.onSuspend?(a.onSuspend(e,a.owner),!0):!1}function tn(e){a.onError=e}function Re(){return a.owner}function ft(e){let t=a.owner;return a.owner=e,t}function fe(e,t){let n=a.owner;a.owner=e;try{return t()}finally{a.owner=n}}function D(e){if(a.owner){if(a.owner.disposed){e();return}(a.owner.cleanups??=[]).push(e)}}function we(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)we(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function Y(e){let t=Oe(a.owner);a.owner&&(a.owner.owned??=[]).push(t);let n=a.owner;a.owner=t;try{return e(()=>we(t))}finally{a.owner=n}}function nn(e){a.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Rr(e){e.queued||(e.queued=!0,a.queue.push(e),!a.scheduled&&a.batchDepth===0&&(a.scheduled=!0,a.hostSchedule(Ae)))}function Ae(){if(a.scheduled=!1,a.flushing)return;a.flushing=!0;let e=0;try{for(;a.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=a.queue;a.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{a.flushing=!1}}function rn(){a.batchDepth===0&&Ae()}function dt(e){a.batchDepth++;try{return e()}finally{--a.batchDepth===0&&Ae()}}var lt=class{constructor(t){this.queued=!1;this.disposed=!1;this.owner=Oe(a.owner),a.owner&&(a.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new K(()=>{we(this.owner,!1),fe(this.owner,()=>{let n=t();typeof n=="function"&&(this.owner.cleanups??=[]).push(n)})}),this.watcher=new ae(()=>Rr(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(t){if(t&&typeof t.then=="function"&&a.onSuspend){a.onSuspend(t,this.owner);return}if(a.onError&&a.onError(t,this.owner))return;throw t}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),we(this.owner))}};function Ve(e){let t=new lt(e);return()=>t.dispose()}function Ar(e){return!!e&&typeof e.then=="function"}nn(()=>{});var on=Symbol.for("signal"),Cr=Symbol.for("memo"),kr=Symbol.for("signal-node");function b(e,t){let n=new ue(e,{equals:t?.equals}),r=(()=>n.get()),o=(s=>{let i=typeof s=="function"?s(n.peek()):s;return n.set(i),rn(),i});return Object.defineProperty(r,on,{value:!0,enumerable:!0}),Object.defineProperty(r,kr,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[r,o]}function y(e,t,n){let r=t,o=Re(),s=new K(()=>fe(o,()=>{try{return r=e(r)}catch(c){if(Ar(c))return en(c),r;throw c}}),{equals:n?.equals}),i=(()=>s.get());return Object.defineProperty(i,on,{value:!0,enumerable:!0}),Object.defineProperty(i,Cr,{value:!0,enumerable:!0}),i}function U(e,t){let n=t;return Ve(()=>{n=e(n)})}function sn(e,t){let n=t;Ve(()=>{n=e(n)})}function un(e,t){let n=t;return Ve(()=>{n=e(n)})}function V(e){return dt(e)}function F(e){return ge(e)}function pt(e){return dt(e),Promise.resolve()}function an(){return[()=>!1,pt]}function cn(){return Ae(),Promise.resolve()}function ln(e,t,n){let r=Array.isArray(e),o,s=n?.defer??!1;return i=>{let c=r?e.map(f=>f()):e();if(s){s=!1,o=c;return}let u=ge(()=>t(c,o,i));return o=c,u}}function _r(e,t,n){let r=[];return D(()=>{for(let o of r)o.dispose();r=[]}),y(()=>{let o=e()||[];return F(()=>{if(o.length===0){for(let u of r)u.dispose();return r=[],n?.fallback?n.fallback():[]}let s=new Map;for(let u of r)s.has(u.item)||s.set(u.item,u);let i=[],c=new Set;for(let u=0;u<o.length;u++){let f=o[u],v=s.get(f);if(v&&!c.has(v))v.setIndex(u),i.push(v),c.add(v);else{let p,m,S;Y(g=>{S=g;let[k,h]=b(u);m=h,p=t(f,k)});let O={item:f,rendered:p,dispose:S,setIndex:m};i.push(O),c.add(O)}}for(let u of r)c.has(u)||u.dispose();return r=i,i.map(u=>u.rendered)})})}function Er(e,t,n,r){let o=[],s=[];return D(()=>{for(let i of s)i.dispose();o=[],s=[]}),y(()=>{let i=e()||[];return F(()=>{if(i.length===0){for(let p of s)p.dispose();return o=[],s=[],r?.fallback?r.fallback():[]}let c=new Map;for(let p=0;p<o.length;p++)c.set(o[p],s[p]);let u=[],f=[],v=new Set;for(let p=0;p<i.length;p++){let m=t(i[p]),S=c.get(m);if(S&&!v.has(m))S.setIndex(p),u.push(S);else{let O,g,k;Y(h=>{k=h;let[I,A]=b(p);g=A;let B=y(_=>{let q=(e()||[])[I()];return q??_},i[p]);O=n(B,I)}),u.push({rendered:O,dispose:k,setIndex:g})}f.push(m),v.add(m)}for(let[p,m]of c)v.has(p)||m.dispose();return o=f,s=u,u.map(p=>p.rendered)})})}function Pr(e,t,n){let r=[];return D(()=>{for(let o of r)o.dispose();r=[]}),y(()=>{let o=e()||[];return F(()=>{if(o.length===0){for(let u of r)u.dispose();return r=[],n?.fallback?n.fallback():[]}let s=r.length,i=o.length;for(let u=s;u<i;u++){let f,v,p,m=o[u];Y(S=>{p=S;let[O,g]=b(m);v=g,f=t(O,u)}),r.push({rendered:f,setItem:v,dispose:p})}for(let u=i;u<s;u++)r[u].dispose();i<s&&(r=r.slice(0,i));let c=Math.min(s,i);for(let u=0;u<c;u++)r[u].setItem(o[u]);return r.map(u=>u.rendered)})})}var Ce=!1,Dr=Symbol.for("signal"),Fr=Symbol.for("memo"),Ir=Symbol.for("resource");function $e(e){return typeof e=="function"&&e[Dr]===!0}function fn(e){return typeof e=="function"&&e[Fr]===!0}function dn(e){return typeof e=="function"&&e[Ir]===!0}function pn(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function hn(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function yn(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function ht(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?ht(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var yt=null;function vt(e){yt=e}function X(e){yt&&yt(e)}var Tt=null;function St(e){Tt=e}function ke(e){return Tt?Tt(e):void 0}var mt=null;function xt(e){mt=e}function _e(){return mt?mt():void 0}var bt=null;function gt(e){bt=e}function Ee(e,t){bt&&bt(e,t)}function Tn(e,t=(n,r)=>n===r){let n=new Map;return U(()=>{let r=e();for(let[o,s]of n){let[i,c]=s,u=t(o,r);i()!==u&&c(u)}}),r=>{let o=n.get(r);if(!o){let[s,i]=b(!1);o=[s,i],n.set(r,o);let c=e();i(t(r,c))}return o[0]()}}function mn(e,t){let[n,r]=b(e(),t);return U(()=>{let o=e();t?.timeoutMs?setTimeout(()=>r(()=>o),t.timeoutMs):typeof requestIdleCallback=="function"?requestIdleCallback(()=>r(()=>o)):Promise.resolve().then(()=>r(()=>o))}),n}function bn(e,t){let n,r=(...o)=>{n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0,e(...o)},t)};return D(()=>{n!==void 0&&clearTimeout(n)}),r}function qr(e){return!!e&&typeof e.then=="function"}var wt=Symbol();function de(e,t,n={}){let r,o;typeof t=="function"?(r=typeof e=="function"?e:()=>e,o=t):(r=()=>!0,o=e,t&&typeof t=="object"&&(n=t));let s=n.transport===!1?void 0:_e(),i=s!==void 0?ke(s):void 0,c=i!==void 0,[u,f]=b(i!==void 0?i.value:n.initialValue,{equals:!1}),[v,p]=b(void 0,{equals:!1}),[m,S]=b(i!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[O,g]=b(void 0,{equals:!1}),[k,h]=b(void 0,{equals:!1}),I=wt,A=!1;U(()=>{let C=r();if(k(),C===!1||C===null||C===void 0){I=wt,V(()=>{S("unresolved"),g(void 0),p(void 0)});return}let q=A;if(A=!1,I!==wt&&C===I&&!q)return;if(I=C,c){c=!1;return}let $=!1;D(()=>$=!0);let W=F(m),Se=F(u),ne=W==="ready"||W==="refreshing";V(()=>{S(ne?"refreshing":"pending"),p(void 0)});try{let M=o(C,{value:Se,refetching:ne});qr(M)?(g(M),X(M),M.then(z=>{$||(s!==void 0&&Ee(s,z),V(()=>{f(()=>z),S("ready"),g(void 0)}))},z=>{$||V(()=>{p(z),S("errored"),g(void 0)})})):V(()=>{f(()=>M),S("ready"),g(void 0)})}catch(M){if($)return;V(()=>{p(M),S("errored"),g(void 0)})}});let B=()=>{let C=m();return C==="pending"||C==="refreshing"},_=(()=>{let C=v();if(C)throw C;if(B()){let q=O();if(q)throw q}return u()});return Object.defineProperties(_,{state:{get:m},loading:{get:B},error:{get:v},latest:{get:u}}),Object.defineProperty(_,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(_,Symbol.for("signal"),{value:!0,enumerable:!0}),[_,{mutate:f,refetch:()=>{A=!0,h(void 0)}}]}function Ot(e,t=300){let[n,r]=b(e),[o,s]=b(e),[i,c]=b(!1),u,f=()=>{u!==void 0&&(clearTimeout(u),u=void 0)},v=()=>{f();let m=F(n);return s(()=>m),c(!1),m},p=(m=>{let S=typeof m=="function"?m(F(n)):m;return r(()=>S),c(!0),f(),u=setTimeout(v,t),S});return D(f),[o,p,{immediate:n,pending:i,flush:v,cancel:()=>{f(),c(!1)}}]}function Ur(e){return e!=null&&e!==""}function vn(e,t,n={}){let{delay:r=300,initialValue:o,shouldFetch:s=Ur}=n,[i,c,u]=Ot(e,r),f=()=>s(i())?i():!1,[v,{refetch:p}]=de(f,t,o===void 0?{}:{initialValue:o});return[v,{...u,query:i,setQuery:c,refetch:p}]}function Ke(e){if(typeof e=="function"&&!e.length){let t=e();return $e(t)?t:Ke(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=Ke(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function He(e){let t=y(e);return y(()=>Ke(t()))}var Ge=ce();Zt((e,t)=>{let n=Le(t,Ge);n&&(n.increment(),e.finally(()=>n.decrement()))});function Sn(){let[e,t]=b(0),n=0;return{increment:()=>t(n+=1),decrement:()=>t(n-=1),inFallback:()=>e()>0}}function xn(e,t){return le(Ge,e,t)}var gn=ce();tn((e,t)=>{let n=Le(t,gn);return n?(n.setError(e),!0):!1});function wn(){let[e,t]=b(void 0,{equals:!1});return{error:e,reset:()=>t(()=>{}),setError:r=>t(()=>r)}}function On(e,t){return le(gn,e,t)}var Rn={State:ue,Computed:K,subtle:{Watcher:ae,untrack:ge,currentComputed:Wt,hasSinks:zt}};var Mr=Symbol.for("signal"),jr=Symbol.for("fluixi-proxy");function Nr(e,t){let[n,r]=b(e,t);return Object.assign(n,{set:r})}function Br(e,t,n){return y(e,t,n)}function Lr(e,t){return U(e,t)}function An(...e){let[t,n]=de(...e);return Object.assign(t,n)}var Vr="__fluixi_signal_next_state__",$r=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},l=globalThis[Vr]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:$r,onSuspend:null,onError:null},Cn=0,kn=1,Pe=2,_n=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(l.untracked)return;let e=l.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},Kr=class extends _n{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,this.observers)for(let t of[...this.observers])t.markDirty(Pe);Rt(this)}}peek(){return this._value}},En=class extends _n{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=Pe,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(l.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===kn&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===Pe)break}(this.state===Pe||!this._initialized)&&this.recompute(),this.state=Cn}recompute(){if(this.sources){for(let i of this.sources)i.observers?.delete(this);this.sources.clear()}let e=l.consumer,t=l.untracked;l.consumer=this,l.untracked=!1;let n,r=!1,o;try{n=this._fn()}catch(i){r=!0,o=i,n=this._value}finally{l.consumer=e,l.untracked=t}let s=!this._initialized||this._threw!==r||(r?o!==this._error:!this._equals(this._value,n));if(this._initialized=!0,this._threw=r,this._error=o,this._value=n,s){if(this.version++,this.observers)for(let i of[...this.observers])i.markDirty(Pe);Rt(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===Cn;if(this.state=e,t){if(this.observers)for(let n of[...this.observers])n.markDirty(kn);Rt(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function Rt(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var Hr=class{constructor(e){this._watched=new Set,this._pending=new Set,this._notifyFn=e}watch(...e){for(let t of e)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...e){for(let t of e)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let t=this._pending.size===0;this._pending.add(e),t&&this._notifyFn()}};function Gr(e){if(l.untracked)return e();l.untracked=!0;try{return e()}finally{l.untracked=!1}}function Pn(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Dn(e){let t=Symbol("context");return{id:t,defaultValue:e,Provider:n=>{let r=l.owner,o=Pn(r);(o.contexts=new Map).set(t,n.value),r&&(r.owned??=[]).push(o),l.owner=o;try{return n.children}finally{l.owner=r}}}}function Fn(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function Wr(e){l.onSuspend=e}function zr(e){return l.onSuspend?(l.onSuspend(e,l.owner),!0):!1}function Yr(e){l.onError=e}function Xr(){return l.owner}function In(e,t){let n=l.owner;l.owner=e;try{return t()}finally{l.owner=n}}function At(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)At(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function Qr(e){l.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Jr(e){e.queued||(e.queued=!0,l.queue.push(e),!l.scheduled&&l.batchDepth===0&&(l.scheduled=!0,l.hostSchedule(Ct)))}function Ct(){if(l.scheduled=!1,l.flushing)return;l.flushing=!0;let e=0;try{for(;l.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=l.queue;l.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{l.flushing=!1}}function Zr(){l.batchDepth===0&&Ct()}function eo(e){l.batchDepth++;try{return e()}finally{--l.batchDepth===0&&Ct()}}var to=class{constructor(e){this.queued=!1,this.disposed=!1,this.owner=Pn(l.owner),l.owner&&(l.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new En(()=>{At(this.owner,!1),In(this.owner,()=>{let t=e();typeof t=="function"&&(this.owner.cleanups??=[]).push(t)})}),this.watcher=new Hr(()=>Jr(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&l.onSuspend){l.onSuspend(e,this.owner);return}if(l.onError&&l.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),At(this.owner))}};function no(e){let t=new to(e);return()=>t.dispose()}function ro(e){return!!e&&typeof e.then=="function"}Qr(()=>{});var qn=Symbol.for("signal"),oo=Symbol.for("memo"),so=Symbol.for("signal-node");function kt(e,t){let n=new Kr(e,{equals:t?.equals}),r=(()=>n.get()),o=(s=>{let i=typeof s=="function"?s(n.peek()):s;return n.set(i),Zr(),i});return Object.defineProperty(r,qn,{value:!0,enumerable:!0}),Object.defineProperty(r,so,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[r,o]}function We(e,t,n){let r=t,o=Xr(),s=new En(()=>In(o,()=>{try{return r=e(r)}catch(c){if(ro(c))return zr(c),r;throw c}}),{equals:n?.equals}),i=(()=>s.get());return Object.defineProperty(i,qn,{value:!0,enumerable:!0}),Object.defineProperty(i,oo,{value:!0,enumerable:!0}),i}function De(e,t){let n=t;return no(()=>{n=e(n)})}function _t(e){return eo(e)}function Un(e){return Gr(e)}var io=Dn();Wr((e,t)=>{let n=Fn(t,io);n&&(n.increment(),e.finally(()=>n.decrement()))});var uo=Dn();Yr((e,t)=>{let n=Fn(t,uo);return n?(n.setError(e),!0):!1});var ze=Symbol.for("fluixi-proxy");var Ie=Symbol("store-raw"),Q=Symbol("store-node"),Mn=Symbol("store-has"),Xe=Symbol("store-self"),Qe=Symbol("store-track"),Kn=Symbol("store-name"),Hn=Symbol("store-store"),jn=new WeakMap,Nn=new WeakMap;function Gn(e){let[t,n]=kt(e),r=t;return r.$=n,r}function Je(e){let t=jn.get(e);return t||jn.set(e,t={keys:new Map}),t}function Bn(e,t,n){let r=e.keys.get(t);return r||e.keys.set(t,r=Gn(n)),r}function Ln(e){let t=Je(e);(t.all||(t.all=Gn()))()}function Vn(e,t){e.$(typeof t=="function"?()=>t:t)}function Wn(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 Ye(e){if(!Wn(e))return e;let t=Nn.get(e);if(t)return t;let n=new Proxy(e,ao);return Nn.set(e,n),n}var ao={get(e,t,n){if(t===Ie||t===Q)return e;if(t===ze)return n;if(t===Mn)return i=>i in e;if(t==="__proxy")return!0;if(t===Qe||t===Xe)return Ln(e),n;let r=e[t];if(typeof r=="function"&&!Object.prototype.hasOwnProperty.call(e,t))return r;let o=Object.getOwnPropertyDescriptor(e,t);if(o&&o.get)return o.get.call(n);let s=Bn(Je(e),t,r)();return Wn(s)?Ye(s):s},set(){return!0},deleteProperty(e,t){return t in e&&Fe(e,t,void 0),!0},has(e,t){return t===Ie||t===ze||t===Q||t===Mn||t===Xe||t===Qe?!0:(Bn(Je(e),t,e[t])(),t in e)},ownKeys(e){return Ln(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function Fe(e,t,n){if(e[t]===n&&(n!==void 0||t in e))return;let o=Array.isArray(e),s=o?e.length:0;n===void 0?delete e[t]:e[t]=n;let i=Je(e),c=i.keys.get(t);if(c&&Vn(c,n),o&&e.length!==s){let u=i.keys.get("length");u&&Vn(u,e.length)}i.all&&i.all.$(void 0)}function $n(e,t){return typeof e=="function"?e(t):e}function Pt(e,t){for(let n of Object.keys(t)){let r=t[n],o=e[n];r&&typeof r=="object"&&!Array.isArray(r)&&o&&typeof o=="object"&&!Array.isArray(o)?Pt(o,r):Fe(e,n,r)}}function Ft(e){let t=[],n=e.replace(/\[([^\]]*)\]/g,".$1");for(let r of n.split("."))r.length&&t.push(r);return t}function zn(e,t,n){let r=t.length-1;for(let s=0;s<r;s++){let i=t[s];if(i==="*"){let u=t.slice(s+1);if(Array.isArray(e))for(let f=0;f<e.length;f++)zn(e[f],u,n);return}let c=e[i];(c==null||typeof c!="object")&&(c=/^\d+$/.test(t[s+1])?[]:{},Fe(e,i,c)),e=c}let o=t[r];if(o==="*"){if(Array.isArray(e))for(let s=0;s<e.length;s++)Fe(e,s,$n(n,e[s]));return}Fe(e,o,$n(n,e[o]))}function Et(e,t,n){zn(e,Ft(t),n)}function co(e,t){let n=t[0];if(typeof n=="function"&&t.length===1){let r=n(e);r&&r!==e&&Pt(e,r);return}if(Array.isArray(n)&&t.length===1){for(let r of n)Array.isArray(r)&&Et(e,r[0],r[1]);return}if(n&&typeof n=="object"&&!Array.isArray(n)&&t.length===1){Pt(e,n);return}if(Array.isArray(t[1])&&t.length>=3){Et(e,`${n}.${t[1].join(".")}`,t[2]);return}Et(e,String(n),t[1])}function Dt(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Dt);let t={};for(let n of Object.keys(e))t[n]=Dt(e[n]);return t}function pe(e,t){let n=e;for(let r of Ft(t)){if(n==null)return;n=n[r]}return n}var H=class{constructor(t,n={immutable:!0}){this.options=n;this.root=t,this.set=((...r)=>_t(()=>co(this.root,r)))}get state(){return Ye(this.root)}get proxy(){return Ye(this.root)}get accessor(){return(()=>Ye(this.root))}unwrap(){return this.root}getNode(t){return this.root&&this.root[t]}get(t){if(t==null||t==="")return he(this.state);let n=this.state;for(let r of Ft(t)){if(n==null)return;n=n[r]}return he(n)}select(t){return We(()=>t(this.state))}subscribe(t){return De(()=>t(this.state))}watch(t,n){let r;return De(()=>{let o=t(this.state);Object.is(o,r)||(n(o,r),r=o)})}reactive(t){return We(()=>this.state[t])}produce(t){this.set((n=>{let r=Dt(n);return t(r),r}))}reconcile(t,n={}){this.set(t)}push(t,...n){let r=pe(this.root,t);this.set(t,r.concat(n))}pop(t){let n=pe(this.root,t).slice(),r=n.pop();return this.set(t,n),r}shift(t){let n=pe(this.root,t).slice(),r=n.shift();return this.set(t,n),r}splice(t,n,r,...o){let s=pe(this.root,t).slice(),i=s.splice(n,r,...o);return this.set(t,s),i}insert(t,n,r){let o=pe(this.root,t).slice();o.splice(n,0,r),this.set(t,o)}removeAt(t,n){let r=pe(this.root,t).slice(),o=r.splice(n,1);return this.set(t,r),o}toObservable(){let[t]=kt(this.state);return t.toObservable()}dispose(){}},lo=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","unwrap","toObservable"];function Yn(e,t){for(let n of lo)e[n]=t[n].bind(t);e.$=t.reactive.bind(t)}function qe(e,t={immutable:!0}){let n=new H(e,t);return Yn(n.set,n),[n.proxy,n.set]}function It(e,t={}){return new H(e,{...t,immutable:!1})}function Xn(e,t={}){let n=new H(e(),t);return De(()=>n.set(e())),n}function Qn(e,t,n){return De(()=>n(t(e)))}function Jn(e,t,n){return We(()=>t(e),void 0,n)}function Zn(e,t={}){let n=new H(e,t),r=(()=>n.proxy);return Yn(r,n),r}function he(e){if(e==null||typeof e!="object")return e;let t=e[Ie];return t!==void 0?t:e}function qt(e){return Un(()=>he(e))}function er(e){return Ze(e)}function tr(e){return Ze(e)?e[Q]:null}function nr(e){return e&&typeof e=="object"&&Q in e?e[Q]:null}function Ze(e){return!!e&&typeof e=="object"&&(ze in e||e.__proxy===!0)}function rr(e){return e}var or=Object.freeze({createStore:qe,createMutableStore:It,batch:_t,unwrap:he,untrackStore:qt});function Ut(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Ut);let t={};for(let n of Object.keys(e))t[n]=Ut(e[n]);return t}function sr(e){return t=>{let n=Ut(t);return e(n),n}}function ir(e,t={}){return()=>e}function ur(e,t){let[n,r]=qe(e,t);return new Proxy(n,{get:(o,s)=>s==="set"?r:o[s],has:(o,s)=>s==="set"||Reflect.has(o,s)})}function fo(e,t,n){return y(()=>t(e()),void 0,n)}function po(e,t,n){return y(()=>e().filter(t),void 0,n)}function ho(e,t,n,r){return y(()=>e().reduce(t,n),void 0,r)}function yo(e,t,n){return y(()=>e().find(t),void 0,n)}function To(e,t,n){return y(()=>e().some(t),void 0,n)}function mo(e,t,n){return y(()=>e().every(t),void 0,n)}function bo(e,t,n){return y(()=>[...e()].sort(t),void 0,n)}function vo(e,t){return y(()=>[...new Set(e())],void 0,t)}function So(e,t,n){return y(()=>{let r=e.map(o=>o());return t(r)},void 0,n)}function xo(...e){return new j(t=>{let n=()=>e.map(o=>typeof o=="function"?o():o.get()),r=e.map(o=>typeof o=="function"&&o.subscribe?o.subscribe(()=>{t.next(n())}):typeof o!="function"?o.subscribe(()=>{t.next(n())}):U(()=>{t.next(n())}));return()=>{r.forEach(o=>{typeof o=="function"?o():o&&typeof o.unsubscribe=="function"&&o.unsubscribe()})}})}function go(e,t,n){return y(()=>e()||t(),void 0,n)}function wo(e,t,n,r){return y(()=>n(e(),t()),void 0,r)}function Oo(e,t,n){return y(()=>t(e()),void 0,{equals:n,internal:!0})}function Ro(e,t,n){return y(()=>{let r=e(),o={};for(let s of t)o[s]=r[s];return o},void 0,n)}function Ao(e,t,n){return y(()=>{let o={...e()};for(let s of t)delete o[s];return o},void 0,n)}function Co(e,t,n,r){return y(()=>e()?t():n(),void 0,r)}function ko(e,t,n){return y(()=>e()?t():void 0,void 0,n)}function _o(e,t,n){let[r,o]=b(e()),s;return y(()=>{let i=e();clearTimeout(s),s=setTimeout(()=>o(()=>i),t)}),r}function Eo(e,t,n){let[r,o]=b(e()),s=0,i;return y(()=>{let c=e(),u=Date.now();u-s>=t?(s=u,o(()=>c)):(clearTimeout(i),i=setTimeout(()=>{s=Date.now(),o(()=>c)},t-(u-s)))}),r}function Po(e){let t=e;for(;typeof t=="function";)t=t();return t}var Do=Symbol.for("signal");var ar=Symbol("fluixi-proxy"),Fo=Symbol.for("signal-node"),Ue=0,jt=1,rt=2,Te=3,x=null,R=null,d=null,tt=null,nt=0,Io=!1,Mt=!1,ye=0,qo=1e6,G=new WeakMap,et=null;var Uo=new Map,Mo=0;function jo(){return`node_${++Mo}_${Date.now()}`}function No(e){!1}function Bo(e,t,n){let r={id:jo(),type:e,value:t,version:0,equals:n?.equals,name:n?.name,created:Date.now(),updated:Date.now()};return No(r),r}function Lo(e,t){return e===t}function lr(e){throw typeof console<"u"&&console.error("Reactive error:",e),e}function Vo(e){if(d)d.indexOf(e)===-1&&d.push(e);else if(et&&et.running&&!e.pure)et.effects.indexOf(e)===-1&&et.effects.push(e);else if(!e.pure||e.computed)Bt(e);else if(e.pure&&!e.computed&&e.accessor){let t=R,n=d;R=null,d=[],e.accessor(),R=t;let r=d;if(d=n,r.length>0){let o=d;ot(r),d=o}}}function cr(e,t){for(let n=0;n<e.length;n++)t(e[n])}function J(e,t){let n=e;typeof n=="object"&&n&&ar in n&&delete n[ar];let r=Bo("signal",n,{equals:t?.equals===!1?void 0:t?.equals,name:t?.name}),o=[i,c];G.set(o,new Set);let s;function i(){let u=R;if(u){u.sources?u.sources.indexOf(o)===-1&&u.sources.push(o):u.sources=[o];let f=G.get(o);f&&!f.has(u)&&f.add(u)}return n}function c(u){let f=typeof u=="function"?u(n):u,v=r.equals||Lo;if(t?.equals===!1||!v(n,f)){n=f,r.value=f,r.version++,r.updated=Date.now();let m=G.get(o);if(m&&m.size>0){let k=function(h,I=!1){let A=h.state;if(!(A===Te&&h===R)){if(I&&!h.pure){A===Ue&&(h.state=jt,Io&&(d!==null&&d.indexOf(h)===-1?d.push(h):O.push(h)));return}if(!g.has(h)&&(g.add(h),h.state=rt,A===Ue||A===jt?O.push(h):!h.pure&&d!==null&&d.indexOf(h)===-1&&d.push(h),h.pure&&h.accessor)){let B=G.get(h.accessor);B&&cr(Array.from(B),_=>k(_,!0))}}};var p=k;let S=Array.from(m),O=[],g=new Set;cr(S,k);for(let h of O)Vo(h)}}}return i.toObservable=()=>new j(u=>{let f=!0;return Nt(()=>{let p=i();f?f=!1:u.next(p)})}),Object.defineProperty(i,Do,{value:!0,enumerable:!0}),Object.defineProperty(i,Fo,{value:r,enumerable:!1}),o}function Nt(e,t,n){let r={fn:e,state:rt,sources:null,sourceSlots:null,owned:null,cleanups:null,owner:x,contexts:null,pure:!1,updatedAt:null};x&&(x.owned?x.owned.push(r):x.owned=[r]);let o=N&&ve(N);return o&&(r.suspense=o),fr(r,t),()=>me(r)}function fr(e,t){if(e.sources){for(let o of e.sources){let s=G.get(o);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.owned){for(let o=0;o<e.owned.length;o++)me(e.owned[o]);e.owned=null}let n=R,r=x;if(R=e,x=e,nt++,nt>qo)throw nt=0,R=n,x=r,new Error("Potential infinite loop detected. Exceeded maximum iterations.");try{e.state=Te;let o=e.fn(t);typeof o=="function"&&(e.cleanups?e.cleanups.push(o):e.cleanups=[o]),e.state===Te&&(e.state=Ue)}catch(o){if(ut(o)){let s=N&&ve(N);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}lr(o)}finally{R=n,x=r}}function Bt(e){if(!(e.disposed||!e.fn||e.state===Ue)&&(e.state===rt||e.state===jt||e.state===Te)){if(e.cleanups){for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();e.cleanups=null}if(e.owned){for(let t=0;t<e.owned.length;t++)me(e.owned[t]);e.owned=null}e.renderEffect?pr(e):fr(e,e.value)}}function me(e){if(e.disposed=!0,e.sources)for(let t of e.sources){let n=G.get(t);n&&n.delete(e)}if(e.cleanups)for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();if(e.owned)for(let t=0;t<e.owned.length;t++)me(e.owned[t]);if(e.owner&&e.owner.owned){let t=e.owner.owned.indexOf(e);t!==-1&&e.owner.owned.splice(t,1)}}function ot(e){let t=[],n=[];for(let o of e)o.pure&&!o.computed&&o.accessor?t.indexOf(o)===-1&&t.push(o):(o.computed||!o.pure)&&n.indexOf(o)===-1&&n.push(o);d=[];let r=0;for(;r<t.length;){let o=t[r++],s=G.get(o.accessor);if(s&&s.size>0){let c=R;R=null,o.accessor(),R=c}let i=d.splice(0);for(let c of i)c.pure&&!c.computed&&c.accessor?t.indexOf(c)===-1&&t.push(c):(c.computed||!c.pure)&&n.indexOf(c)===-1&&n.push(c)}d=null;for(let o of n)(o.computed||!o.pure)&&Bt(o)}function Z(e){if(d&&ye>0)return e();if(d&&ye===0){let t=d,n=[];d=n,ye++;let r;try{r=e()}finally{ye--,d=t}let o=d;return ot(n),d=o,r}ye++,d=[],tt=[];try{return e()}finally{ye--,$o()}}function $o(){if(!Mt){Mt=!0,nt=0;try{for(;d&&d.length>0;){let e=d;d=null,ot(e)}if(d=null,tt){let e=tt;tt=null;for(let t=0;t<e.length;t++)Bt(e[t])}}finally{Mt=!1}}}function be(e){let t=R;R=null;try{return e()}finally{R=t}}function dr(e){x&&(x.cleanups?x.cleanups.push(e):x.cleanups=[e])}function Ko(e){let t=Symbol("context"),n=Ho(t);return{id:t,Provider:n,defaultValue:e}}function Ho(e){return t=>{let n=x;for(;n;)n.contexts||(n.contexts=new Map),n.contexts.has(e)||n.contexts.set(e,t.value),n=n.owner;let r;return Go(()=>{r=be(()=>{let o=x;return o&&(o.contexts||(o.contexts=new Map),o.contexts.set(e,t.value)),He(()=>t.children)})}),r}}function ve(e){let t=x;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.owner}if(e)return e.defaultValue}function Go(e,t,n){let r={fn:e,state:rt,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:x,contexts:null,pure:!1,updatedAt:null,renderEffect:!0};x&&(x.owned?x.owned.push(r):x.owned=[r]);let o=N&&ve(N);return o&&(r.suspense=o),pr(r),()=>me(r)}function pr(e){if(e.sources){for(let o of e.sources){let s=G.get(o);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.cleanups){for(let o=0;o<e.cleanups.length;o++)e.cleanups[o]();e.cleanups=null}if(e.owned){for(let o=0;o<e.owned.length;o++)me(e.owned[o]);e.owned=null}let t=R,n=x,r=d;R=e,x=e,d===null&&(d=[]),e.state=Te;try{let o=e.fn(e.value);typeof o=="function"&&(e.cleanups||(e.cleanups=[]),e.cleanups.push(o)),e.value=o,e.state===Te&&(e.state=Ue)}catch(o){if(ut(o)){let s=N&&ve(N);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}lr(o)}finally{R=t,x=n;let o=d;if(d=r,o!==r&&o&&o.length>0){let s=d;ot(o),d=s}}}var N;function hr(){return N||(N=Ko())}var te=new Map,ee=new Map,Wo=0,zo=Symbol.for("signal"),Yo=Symbol.for("resource");function Xo(e,t,n={}){let r,o,s;typeof t=="function"?(r=e,o=t,s=n):(r=()=>!0,o=e,s=t??n);let{ttl:i=1/0,name:c=`_auto_${Wo++}`,staleWhileRevalidate:u=!0}=s,f=c,v=T=>`${f}:${JSON.stringify(T)}`,p=T=>i===1/0||Date.now()-T.timestamp<=i,[m,S]=J(void 0,{equals:!1}),[O,g]=J("unresolved",{equals:!1}),[k,h]=J(void 0,{equals:!1}),[I,A]=J(void 0,{equals:!1}),[B,_]=J(!1),[C,q]=J(0,{equals:!1}),$=Symbol("unset"),W=$,Se=!1,ne=!1;function M(T,E,P,L){if(ee.has(E)){ee.get(E).then(w=>{L()||z(w,P)},w=>{!L()&&!P&&Lt(w)}),P||A(ee.get(E));return}let re=Promise.resolve(o(T)).then(w=>(te.set(E,{value:w,timestamp:Date.now()}),ee.delete(E),w),w=>{throw ee.delete(E),w});if(ee.set(E,re),!P){X(re),A(re);let w=Me&&ve(Me);w&&(w.increment(),re.finally(()=>w.decrement()))}re.then(w=>{L()||z(w,P)},w=>{!L()&&!P&&Lt(w)})}function z(T,E){Z(()=>{S(()=>T),g("ready"),_(!1),A(void 0),h(void 0)})}function Lt(T){Z(()=>{h(T),g("errored"),A(void 0)})}let Me;Nt(()=>{Me===void 0&&(Me=hr());let T=r();if(C(),T===!1||T===null||T===void 0){W=$,Z(()=>{g("unresolved"),A(void 0),h(void 0)});return}let E=Se,P=ne;Se=!1,ne=!1;let L=v(T);P&&te.delete(L);let re=W===$||T!==W;W=T;let w=!1;dr(()=>{w=!0});let oe=te.get(L);if(oe&&p(oe)&&!E&&!P){(be(O)!=="ready"||be(m)!==oe.value)&&Z(()=>{S(()=>oe.value),g("ready"),_(!1),h(void 0)});return}if(oe&&u&&!P){Z(()=>{S(()=>oe.value),g("ready"),_(!0),h(void 0),A(void 0)}),M(T,L,!0,()=>w);return}let Vt=be(O),yr=Vt==="ready"||Vt==="refreshing";Z(()=>{g(yr?"refreshing":"pending"),h(void 0),_(!1)}),M(T,L,!1,()=>w)});let je=(()=>{let T=k();if(T)throw T;if(O()==="pending"){let P=I();if(P)throw P}return m()});return Object.defineProperty(je,Yo,{value:!0,enumerable:!0}),Object.defineProperty(je,zo,{value:!0,enumerable:!0}),Object.defineProperties(je,{state:{get:O},loading:{get:()=>{let T=O();return T==="pending"||T==="refreshing"}},error:{get:k},latest:{get:m},stale:{get:B}}),[je,{mutate:S,refetch:()=>{Se=!0,q(T=>T+1)},invalidate:()=>{let T=be(r);T!=null&&T!==!1&&te.delete(v(T)),ne=!0,q(E=>E+1)}}]}function Qo(e){let t=`${e}:`;for(let n of te.keys())n.startsWith(t)&&te.delete(n)}function Jo(){te.clear(),ee.clear()}return xr(Zo);})();
|
package/dist/cdn/reactive.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var yn="1.0.0-alpha.78";function ze(e){return typeof e=="function"&&!/^class\s/.test(Function.prototype.toString.call(e))}function Ot(e){return e==null||Array.isArray(e)||typeof e=="function"||e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error?!1:typeof e=="object"}function Ye(e){return e instanceof Promise||!!e&&(typeof e=="object"||typeof e=="function")&&"then"in e}var pe=class e{constructor(t){this._closed=!1;this._parentOrParents=null;this._subscriptions=null;t&&(this._subscriptions=[t])}get closed(){return this._closed}unsubscribe(){if(this._closed)return;this._closed=!0;let{_parentOrParents:t,_subscriptions:n}=this;if(t instanceof e)t.remove(this);else if(t!==null)for(let r of t)r.remove(this);if(n){for(let r of n)if(ze(r)&&!(r instanceof e))try{r()}catch(o){console.error("Error in unsubscribe function:",o)}else if(Ot(r)&&typeof r.unsubscribe=="function")try{r.unsubscribe()}catch(o){console.error("Error unsubscribing child:",o)}this._subscriptions=null}}add(t){if(!t||t===this)return this;if(t.closed)return this;let{_closed:n,_subscriptions:r}=this;if(n){if(ze(t))try{t()}catch(o){console.error("Error in unsubscribe function:",o)}else if(t.unsubscribe)try{t.unsubscribe()}catch(o){console.error("Error unsubscribing:",o)}return this}return r||(this._subscriptions=[]),this._subscriptions.push(t),t instanceof e&&t._addParent(this),this}remove(t){let{_subscriptions:n}=this;if(!n)return;let r=n.indexOf(t);r!==-1&&(n.splice(r,1),t._removeParent(this))}_addParent(t){let{_parentOrParents:n}=this;n?Array.isArray(n)?n.push(t):this._parentOrParents=[n,t]:this._parentOrParents=t}_removeParent(t){let{_parentOrParents:n}=this;if(n===t)this._parentOrParents=null;else if(Array.isArray(n)){let r=n.indexOf(t);r!==-1&&(n.splice(r,1),n.length===1&&(this._parentOrParents=n[0]))}}};var Te=class extends pe{constructor(n,r,o){super();this.isStopped=!1;let s;n?typeof n=="object"?s=n:s={next:n,error:r,complete:o}:s={},this.destination=s}next(n){if(!this.isStopped&&this.destination.next)try{this.destination.next(n)}catch(r){this.error(r)}}error(n){if(!this.isStopped){if(this.isStopped=!0,this.destination.error)try{this.destination.error(n)}catch(r){throw r}else throw n;this.unsubscribe()}}complete(){if(!this.isStopped){if(this.isStopped=!0,this.destination.complete)try{this.destination.complete()}catch(n){this.error(n);return}this.unsubscribe()}}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}},Xe=class extends Te{constructor(n,r,o,s){super(n,r,o);this._isUnsubscribing=!1;this._parentSubscriber=null;this._parentSubscriber=s||null}next(n){if(!this.isStopped&&!this._isUnsubscribing)try{super.next(n)}catch(r){this.error(r)}}error(n){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.error(n)}finally{this._isUnsubscribing=!1}}}complete(){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.complete()}finally{this._isUnsubscribing=!1}}}unsubscribe(){this.closed||(this._isUnsubscribing=!0,super.unsubscribe(),this._isUnsubscribing=!1)}};function Lr(e){return new Te(e.next,e.error,e.complete)}var B=class extends pe{constructor(t){if(super(),t)this._subscribe=t;else throw new TypeError("Observable constructor requires a subscribe function")}subscribe(t,n,r){let o;t instanceof Te?o=t:o=new Xe(t,n,r);let{_subscribe:s}=this;try{let i=s.call(this,o);i&&(typeof i=="function"||typeof i.unsubscribe=="function")&&o.add(i)}catch(i){o.error(i)}return o}pipe(...t){return t.length===0?this:t.reduce((n,r)=>r(n),this)}toPromise(){return new Promise((t,n)=>{let r;this.subscribe({next:o=>r=o,error:n,complete:()=>t(r)})})}};var Rt=class extends B{constructor(){super(n=>{if(this.closed)throw new Error("Subject has been closed");if(this.hasError)n.error(this.thrownError);else if(this.isStopped)n.complete();else return this.observers.push(n),()=>{let r=this.observers.indexOf(n);r!==-1&&this.observers.splice(r,1)}});this.observers=[];this.isStopped=!1;this.hasError=!1;this.thrownError=null}next(n){if(this.isStopped)return;let{observers:r}=this,o=r.length,s=r.slice();for(let i=0;i<o;i++)s[i].next?.(n)}error(n){if(this.isStopped)return;this.hasError=!0,this.thrownError=n,this.isStopped=!0;let{observers:r}=this;this.observers=[];let o=r.length,s=r.slice();for(let i=0;i<o;i++)s[i].error?.(n)}complete(){if(this.isStopped)return;this.isStopped=!0;let{observers:n}=this;this.observers=[];let r=n.length,o=n.slice();for(let s=0;s<r;s++)o[s].complete?.()}unsubscribe(){this.isStopped=!0,this.observers=[]}asObservable(){return new B(r=>this.subscribe(r))}};var mn="__fluixi_signal_next_state__",hn=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},a=globalThis[mn]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:hn,onSuspend:null,onError:null};var At=0,Ct=1,ye=2,Pe=class{constructor(){this.observers=null;this.watchers=null;this.version=0}updateIfNecessary(){}track(){if(a.untracked)return;let t=a.consumer;t&&((this.observers??=new Set).add(t),(t.sources??=new Set).add(this))}},te=class extends Pe{constructor(t,n){super(),this._value=t,this._equals=n?.equals===!1?()=>!1:n?.equals??Object.is}get(){return this.track(),this._value}set(t){if(!this._equals(this._value,t)){if(this._value=t,this.version++,this.observers)for(let n of[...this.observers])n.markDirty(ye);Qe(this)}}peek(){return this._value}},$=class extends Pe{constructor(n,r){super();this._threw=!1;this._initialized=!1;this.state=ye;this.sources=null;this._fn=n,this._equals=r?.equals===!1?()=>!1:r?.equals??Object.is}get(){if(a.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===Ct&&this.sources){for(let n of this.sources)if(n.updateIfNecessary(),this.state===ye)break}(this.state===ye||!this._initialized)&&this.recompute(),this.state=At}recompute(){if(this.sources){for(let u of this.sources)u.observers?.delete(this);this.sources.clear()}let n=a.consumer,r=a.untracked;a.consumer=this,a.untracked=!1;let o,s=!1,i;try{o=this._fn()}catch(u){s=!0,i=u,o=this._value}finally{a.consumer=n,a.untracked=r}let c=!this._initialized||this._threw!==s||(s?i!==this._error:!this._equals(this._value,o));if(this._initialized=!0,this._threw=s,this._error=i,this._value=o,c){if(this.version++,this.observers)for(let u of[...this.observers])u.markDirty(ye);Qe(this)}}markDirty(n){if(this.state>=n)return;let r=this.state===At;if(this.state=n,r){if(this.observers)for(let o of[...this.observers])o.markDirty(Ct);Qe(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function Qe(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var ne=class{constructor(t){this._watched=new Set;this._pending=new Set;this._notifyFn=t}watch(...t){for(let n of t)this._watched.add(n),(n.watchers??=new Set).add(this)}unwatch(...t){for(let n of t)this._watched.delete(n),n.watchers?.delete(this),this._pending.delete(n)}getPending(){let t=[...this._pending];return this._pending.clear(),t}_notify(t){if(!this._watched.has(t)||this._pending.has(t))return;let n=this._pending.size===0;this._pending.add(t),n&&this._notifyFn()}};function me(e){if(a.untracked)return e();a.untracked=!0;try{return e()}finally{a.untracked=!1}}function Et(){return a.consumer}function Pt(e){return!!(e.observers&&e.observers.size)||!!(e.watchers&&e.watchers.size)}function bn(e){let t=be(e);return e&&(e.owned??=[]).push(t),t}function vn(e,t=!0){he(e,t)}function Sn(e){return!!e&&e.disposed===!0}function be(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function ve(e){let t=Symbol("context");return{id:t,defaultValue:e,Provider:r=>{let o=a.owner,s=be(o);(s.contexts=new Map).set(t,r.value),o&&(o.owned??=[]).push(s),a.owner=s;try{return r.children}finally{a.owner=o}}}}function xn(e){let t=a.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.parent}return e.defaultValue}function ke(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function Se(e,t,n){let r=be(a.owner);(r.contexts=new Map).set(e.id,t),a.owner&&(a.owner.owned??=[]).push(r);let o=a.owner;a.owner=r;try{return n()}finally{a.owner=o}}function kt(e){a.onSuspend=e}function _t(e){return a.onSuspend?(a.onSuspend(e,a.owner),!0):!1}function Ft(e){a.onError=e}function _e(){return a.owner}function Dt(e){let t=a.owner;return a.owner=e,t}function xe(e,t){let n=a.owner;a.owner=e;try{return t()}finally{a.owner=n}}function _(e){if(a.owner){if(a.owner.disposed){e();return}(a.owner.cleanups??=[]).push(e)}}function he(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)he(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function re(e){let t=be(a.owner);a.owner&&(a.owner.owned??=[]).push(t);let n=a.owner;a.owner=t;try{return e(()=>he(t))}finally{a.owner=n}}function Ut(e){a.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function gn(e){e.queued||(e.queued=!0,a.queue.push(e),!a.scheduled&&a.batchDepth===0&&(a.scheduled=!0,a.hostSchedule(ge)))}function ge(){if(a.scheduled=!1,a.flushing)return;a.flushing=!0;let e=0;try{for(;a.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=a.queue;a.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{a.flushing=!1}}function It(){a.batchDepth===0&&ge()}function Ze(e){a.batchDepth++;try{return e()}finally{--a.batchDepth===0&&ge()}}var Je=class{constructor(t){this.queued=!1;this.disposed=!1;this.owner=be(a.owner),a.owner&&(a.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new $(()=>{he(this.owner,!1),xe(this.owner,()=>{let n=t();typeof n=="function"&&(this.owner.cleanups??=[]).push(n)})}),this.watcher=new ne(()=>gn(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(t){if(t&&typeof t.then=="function"&&a.onSuspend){a.onSuspend(t,this.owner);return}if(a.onError&&a.onError(t,this.owner))return;throw t}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),he(this.owner))}};function Fe(e){let t=new Je(e);return()=>t.dispose()}function wn(e){return!!e&&typeof e.then=="function"}Ut(()=>{});var Mt=Symbol.for("signal"),On=Symbol.for("memo"),Rn=Symbol.for("signal-node");function h(e,t){let n=new te(e,{equals:t?.equals}),r=(()=>n.get()),o=(s=>{let i=typeof s=="function"?s(n.peek()):s;return n.set(i),It(),i});return Object.defineProperty(r,Mt,{value:!0,enumerable:!0}),Object.defineProperty(r,Rn,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[r,o]}function y(e,t,n){let r=t,o=_e(),s=new $(()=>xe(o,()=>{try{return r=e(r)}catch(c){if(wn(c))return _t(c),r;throw c}}),{equals:n?.equals}),i=(()=>s.get());return Object.defineProperty(i,Mt,{value:!0,enumerable:!0}),Object.defineProperty(i,On,{value:!0,enumerable:!0}),i}function M(e,t){let n=t;return Fe(()=>{n=e(n)})}function An(e,t){let n=t;Fe(()=>{n=e(n)})}function Cn(e,t){let n=t;return Fe(()=>{n=e(n)})}function V(e){return Ze(e)}function U(e){return me(e)}function qt(e){return Ze(e),Promise.resolve()}function En(){return[()=>!1,qt]}function Pn(){return ge(),Promise.resolve()}function kn(e,t,n){let r=Array.isArray(e),o,s=n?.defer??!1;return i=>{let c=r?e.map(l=>l()):e();if(s){s=!1,o=c;return}let u=me(()=>t(c,o,i));return o=c,u}}function no(e,t,n){let r=[];return _(()=>{for(let o of r)o.dispose();r=[]}),y(()=>{let o=e()||[];return U(()=>{if(o.length===0){for(let u of r)u.dispose();return r=[],n?.fallback?n.fallback():[]}let s=new Map;for(let u of r)s.has(u.item)||s.set(u.item,u);let i=[],c=new Set;for(let u=0;u<o.length;u++){let l=o[u],b=s.get(l);if(b&&!c.has(b))b.setIndex(u),i.push(b),c.add(b);else{let d,m,v;re(x=>{v=x;let[C,p]=h(u);m=p,d=t(l,C)});let w={item:l,rendered:d,dispose:v,setIndex:m};i.push(w),c.add(w)}}for(let u of r)c.has(u)||u.dispose();return r=i,i.map(u=>u.rendered)})})}function ro(e,t,n,r){let o=[],s=[];return _(()=>{for(let i of s)i.dispose();o=[],s=[]}),y(()=>{let i=e()||[];return U(()=>{if(i.length===0){for(let d of s)d.dispose();return o=[],s=[],r?.fallback?r.fallback():[]}let c=new Map;for(let d=0;d<o.length;d++)c.set(o[d],s[d]);let u=[],l=[],b=new Set;for(let d=0;d<i.length;d++){let m=t(i[d]),v=c.get(m);if(v&&!b.has(m))v.setIndex(d),u.push(v);else{let w,x,C;re(p=>{C=p;let[F,R]=h(d);x=R;let N=y(E=>{let D=(e()||[])[F()];return D??E},i[d]);w=n(N,F)}),u.push({rendered:w,dispose:C,setIndex:x})}l.push(m),b.add(m)}for(let[d,m]of c)b.has(d)||m.dispose();return o=l,s=u,u.map(d=>d.rendered)})})}function oo(e,t,n){let r=[];return _(()=>{for(let o of r)o.dispose();r=[]}),y(()=>{let o=e()||[];return U(()=>{if(o.length===0){for(let u of r)u.dispose();return r=[],n?.fallback?n.fallback():[]}let s=r.length,i=o.length;for(let u=s;u<i;u++){let l,b,d,m=o[u];re(v=>{d=v;let[w,x]=h(m);b=x,l=t(w,u)}),r.push({rendered:l,setItem:b,dispose:d})}for(let u=i;u<s;u++)r[u].dispose();i<s&&(r=r.slice(0,i));let c=Math.min(s,i);for(let u=0;u<c;u++)r[u].setItem(o[u]);return r.map(u=>u.rendered)})})}var De=!1,_n=Symbol.for("signal"),Fn=Symbol.for("memo"),Dn=Symbol.for("resource");function et(e){return typeof e=="function"&&e[_n]===!0}function Un(e){return typeof e=="function"&&e[Fn]===!0}function In(e){return typeof e=="function"&&e[Dn]===!0}function Mn(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 Nn(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function Nt(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Nt(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var tt=null;function jt(e){tt=e}function oe(e){tt&&tt(e)}var nt=null;function Bt(e){nt=e}function Ue(e){return nt?nt(e):void 0}var rt=null;function Lt(e){rt=e}function Ie(){return rt?rt():void 0}var ot=null;function $t(e){ot=e}function Me(e,t){ot&&ot(e,t)}function jn(e,t=(n,r)=>n===r){let n=new Map;return M(()=>{let r=e();for(let[o,s]of n){let[i,c]=s,u=t(o,r);i()!==u&&c(u)}}),r=>{let o=n.get(r);if(!o){let[s,i]=h(!1);o=[s,i],n.set(r,o);let c=e();i(t(r,c))}return o[0]()}}function Bn(e,t){let[n,r]=h(e(),t);return M(()=>{let o=e();t?.timeoutMs?setTimeout(()=>r(()=>o),t.timeoutMs):typeof requestIdleCallback=="function"?requestIdleCallback(()=>r(()=>o)):Promise.resolve().then(()=>r(()=>o))}),n}function Ln(e,t){let n,r=(...o)=>{n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0,e(...o)},t)};return _(()=>{n!==void 0&&clearTimeout(n)}),r}function $n(e){return!!e&&typeof e.then=="function"}var st=Symbol();function we(e,t,n={}){let r,o;typeof t=="function"?(r=typeof e=="function"?e:()=>e,o=t):(r=()=>!0,o=e,t&&typeof t=="object"&&(n=t));let s=n.transport===!1?void 0:Ie(),i=s!==void 0?Ue(s):void 0,c=i!==void 0,[u,l]=h(i!==void 0?i.value:n.initialValue,{equals:!1}),[b,d]=h(void 0,{equals:!1}),[m,v]=h(i!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[w,x]=h(void 0,{equals:!1}),[C,p]=h(void 0,{equals:!1}),F=st,R=!1;M(()=>{let A=r();if(C(),A===!1||A===null||A===void 0){F=st,V(()=>{v("unresolved"),x(void 0),d(void 0)});return}let D=R;if(R=!1,F!==st&&A===F&&!D)return;if(F=A,c){c=!1;return}let L=!1;_(()=>L=!0);let H=U(m),de=U(u),J=H==="ready"||H==="refreshing";V(()=>{v(J?"refreshing":"pending"),d(void 0)});try{let I=o(A,{value:de,refetching:J});$n(I)?(x(I),oe(I),I.then(W=>{L||(s!==void 0&&Me(s,W),V(()=>{l(()=>W),v("ready"),x(void 0)}))},W=>{L||V(()=>{d(W),v("errored"),x(void 0)})})):V(()=>{l(()=>I),v("ready"),x(void 0)})}catch(I){if(L)return;V(()=>{d(I),v("errored"),x(void 0)})}});let N=()=>{let A=m();return A==="pending"||A==="refreshing"},E=(()=>{let A=b();if(A)throw A;if(N()){let D=w();if(D)throw D}return u()});return Object.defineProperties(E,{state:{get:m},loading:{get:N},error:{get:b},latest:{get:u}}),Object.defineProperty(E,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(E,Symbol.for("signal"),{value:!0,enumerable:!0}),[E,{mutate:l,refetch:()=>{R=!0,p(void 0)}}]}function Vt(e,t=300){let[n,r]=h(e),[o,s]=h(e),[i,c]=h(!1),u,l=()=>{u!==void 0&&(clearTimeout(u),u=void 0)},b=()=>{l();let m=U(n);return s(()=>m),c(!1),m},d=(m=>{let v=typeof m=="function"?m(U(n)):m;return r(()=>v),c(!0),l(),u=setTimeout(b,t),v});return _(l),[o,d,{immediate:n,pending:i,flush:b,cancel:()=>{l(),c(!1)}}]}function Vn(e){return e!=null&&e!==""}function Kn(e,t,n={}){let{delay:r=300,initialValue:o,shouldFetch:s=Vn}=n,[i,c,u]=Vt(e,r),l=()=>s(i())?i():!1,[b,{refetch:d}]=we(l,t,o===void 0?{}:{initialValue:o});return[b,{...u,query:i,setQuery:c,refetch:d}]}function qe(e){if(typeof e=="function"&&!e.length){let t=e();return et(t)?t:qe(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=qe(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function it(e){let t=y(e);return y(()=>qe(t()))}var ut=ve();kt((e,t)=>{let n=ke(t,ut);n&&(n.increment(),e.finally(()=>n.decrement()))});function Hn(){let[e,t]=h(0),n=0;return{increment:()=>t(n+=1),decrement:()=>t(n-=1),inFallback:()=>e()>0}}function Wn(e,t){return Se(ut,e,t)}var Kt=ve();Ft((e,t)=>{let n=ke(t,Kt);return n?(n.setError(e),!0):!1});function Gn(){let[e,t]=h(void 0,{equals:!1});return{error:e,reset:()=>t(()=>{}),setError:r=>t(()=>r)}}function zn(e,t){return Se(Kt,e,t)}var Yn={State:te,Computed:$,subtle:{Watcher:ne,untrack:me,currentComputed:Et,hasSinks:Pt}};var Eo=Symbol.for("signal"),Po=Symbol.for("fluixi-proxy");function Ko(e,t){let[n,r]=h(e,t);return Object.assign(n,{set:r})}function Ho(e,t,n){return y(e,t,n)}function Wo(e,t){return M(e,t)}function Xn(...e){let[t,n]=we(...e);return Object.assign(t,n)}import{$PROXY as ct,batch as Jt,createEffect as je,createMemo as lt,createSignal as Zt,untrack as Qn}from"@fluixi/reactive/signal";var Be=Symbol("store-raw"),ie=Symbol("store-node"),Ht=Symbol("store-has"),ft=Symbol("store-self"),dt=Symbol("store-track"),Jn=Symbol("store-name"),Zn=Symbol("store-store"),Wt=new WeakMap,Gt=new WeakMap;function en(e){let[t,n]=Zt(e),r=t;return r.$=n,r}function Le(e){let t=Wt.get(e);return t||Wt.set(e,t={keys:new Map}),t}function zt(e,t,n){let r=e.keys.get(t);return r||e.keys.set(t,r=en(n)),r}function Yt(e){let t=Le(e);(t.all||(t.all=en()))()}function Xt(e,t){e.$(typeof t=="function"?()=>t:t)}function tn(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 Ne(e){if(!tn(e))return e;let t=Gt.get(e);if(t)return t;let n=new Proxy(e,er);return Gt.set(e,n),n}var er={get(e,t,n){if(t===Be||t===ie)return e;if(t===ct)return n;if(t===Ht)return i=>i in e;if(t==="__proxy")return!0;if(t===dt||t===ft)return Yt(e),n;let r=e[t];if(typeof r=="function"&&!Object.prototype.hasOwnProperty.call(e,t))return r;let o=Object.getOwnPropertyDescriptor(e,t);if(o&&o.get)return o.get.call(n);let s=zt(Le(e),t,r)();return tn(s)?Ne(s):s},set(){return!0},deleteProperty(e,t){return t in e&&Oe(e,t,void 0),!0},has(e,t){return t===Be||t===ct||t===ie||t===Ht||t===ft||t===dt?!0:(zt(Le(e),t,e[t])(),t in e)},ownKeys(e){return Yt(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function Oe(e,t,n){if(e[t]===n&&(n!==void 0||t in e))return;let o=Array.isArray(e),s=o?e.length:0;n===void 0?delete e[t]:e[t]=n;let i=Le(e),c=i.keys.get(t);if(c&&Xt(c,n),o&&e.length!==s){let u=i.keys.get("length");u&&Xt(u,e.length)}i.all&&i.all.$(void 0)}function Qt(e,t){return typeof e=="function"?e(t):e}function pt(e,t){for(let n of Object.keys(t)){let r=t[n],o=e[n];r&&typeof r=="object"&&!Array.isArray(r)&&o&&typeof o=="object"&&!Array.isArray(o)?pt(o,r):Oe(e,n,r)}}function yt(e){let t=[],n=e.replace(/\[([^\]]*)\]/g,".$1");for(let r of n.split("."))r.length&&t.push(r);return t}function nn(e,t,n){let r=t.length-1;for(let s=0;s<r;s++){let i=t[s];if(i==="*"){let u=t.slice(s+1);if(Array.isArray(e))for(let l=0;l<e.length;l++)nn(e[l],u,n);return}let c=e[i];(c==null||typeof c!="object")&&(c=/^\d+$/.test(t[s+1])?[]:{},Oe(e,i,c)),e=c}let o=t[r];if(o==="*"){if(Array.isArray(e))for(let s=0;s<e.length;s++)Oe(e,s,Qt(n,e[s]));return}Oe(e,o,Qt(n,e[o]))}function at(e,t,n){nn(e,yt(t),n)}function tr(e,t){let n=t[0];if(typeof n=="function"&&t.length===1){let r=n(e);r&&r!==e&&pt(e,r);return}if(Array.isArray(n)&&t.length===1){for(let r of n)Array.isArray(r)&&at(e,r[0],r[1]);return}if(n&&typeof n=="object"&&!Array.isArray(n)&&t.length===1){pt(e,n);return}if(Array.isArray(t[1])&&t.length>=3){at(e,`${n}.${t[1].join(".")}`,t[2]);return}at(e,String(n),t[1])}function Tt(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Tt);let t={};for(let n of Object.keys(e))t[n]=Tt(e[n]);return t}function se(e,t){let n=e;for(let r of yt(t)){if(n==null)return;n=n[r]}return n}var G=class{constructor(t,n={immutable:!0}){this.options=n;this.root=t,this.set=((...r)=>Jt(()=>tr(this.root,r)))}get state(){return Ne(this.root)}get proxy(){return Ne(this.root)}get accessor(){return(()=>Ne(this.root))}unwrap(){return this.root}getNode(t){return this.root&&this.root[t]}get(t){if(t==null||t==="")return Re(this.state);let n=this.state;for(let r of yt(t)){if(n==null)return;n=n[r]}return Re(n)}select(t){return lt(()=>t(this.state))}subscribe(t){return je(()=>t(this.state))}watch(t,n){let r;return je(()=>{let o=t(this.state);Object.is(o,r)||(n(o,r),r=o)})}reactive(t){return lt(()=>this.state[t])}produce(t){this.set((n=>{let r=Tt(n);return t(r),r}))}reconcile(t,n={}){this.set(t)}push(t,...n){let r=se(this.root,t);this.set(t,r.concat(n))}pop(t){let n=se(this.root,t).slice(),r=n.pop();return this.set(t,n),r}shift(t){let n=se(this.root,t).slice(),r=n.shift();return this.set(t,n),r}splice(t,n,r,...o){let s=se(this.root,t).slice(),i=s.splice(n,r,...o);return this.set(t,s),i}insert(t,n,r){let o=se(this.root,t).slice();o.splice(n,0,r),this.set(t,o)}removeAt(t,n){let r=se(this.root,t).slice(),o=r.splice(n,1);return this.set(t,r),o}toObservable(){let[t]=Zt(this.state);return t.toObservable()}dispose(){}},nr=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","unwrap","toObservable"];function rn(e,t){for(let n of nr)e[n]=t[n].bind(t);e.$=t.reactive.bind(t)}function $e(e,t={immutable:!0}){let n=new G(e,t);return rn(n.set,n),[n.proxy,n.set]}function on(e,t={}){return new G(e,{...t,immutable:!1})}function rr(e,t={}){let n=new G(e(),t);return je(()=>n.set(e())),n}function or(e,t,n){return je(()=>n(t(e)))}function sr(e,t,n){return lt(()=>t(e),void 0,n)}function ir(e,t={}){let n=new G(e,t),r=(()=>n.proxy);return rn(r,n),r}function Re(e){if(e==null||typeof e!="object")return e;let t=e[Be];return t!==void 0?t:e}function sn(e){return Qn(()=>Re(e))}function ur(e){return mt(e)}function ar(e){return mt(e)?e[ie]:null}function cr(e){return e&&typeof e=="object"&&ie in e?e[ie]:null}function mt(e){return!!e&&typeof e=="object"&&(ct in e||e.__proxy===!0)}function lr(e){return e}var fr=Object.freeze({createStore:$e,createMutableStore:on,batch:Jt,unwrap:Re,untrackStore:sn});function ht(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(ht);let t={};for(let n of Object.keys(e))t[n]=ht(e[n]);return t}function dr(e){return t=>{let n=ht(t);return e(n),n}}function pr(e,t={}){return()=>e}function Tr(e,t){let[n,r]=$e(e,t);return new Proxy(n,{get:(o,s)=>s==="set"?r:o[s],has:(o,s)=>s==="set"||Reflect.has(o,s)})}function fs(e,t,n){return y(()=>t(e()),void 0,n)}function ds(e,t,n){return y(()=>e().filter(t),void 0,n)}function ps(e,t,n,r){return y(()=>e().reduce(t,n),void 0,r)}function Ts(e,t,n){return y(()=>e().find(t),void 0,n)}function ys(e,t,n){return y(()=>e().some(t),void 0,n)}function ms(e,t,n){return y(()=>e().every(t),void 0,n)}function hs(e,t,n){return y(()=>[...e()].sort(t),void 0,n)}function bs(e,t){return y(()=>[...new Set(e())],void 0,t)}function vs(e,t,n){return y(()=>{let r=e.map(o=>o());return t(r)},void 0,n)}function Ss(...e){return new B(t=>{let n=()=>e.map(o=>typeof o=="function"?o():o.get()),r=e.map(o=>typeof o=="function"&&o.subscribe?o.subscribe(()=>{t.next(n())}):typeof o!="function"?o.subscribe(()=>{t.next(n())}):M(()=>{t.next(n())}));return()=>{r.forEach(o=>{typeof o=="function"?o():o&&typeof o.unsubscribe=="function"&&o.unsubscribe()})}})}function xs(e,t,n){return y(()=>e()||t(),void 0,n)}function gs(e,t,n,r){return y(()=>n(e(),t()),void 0,r)}function ws(e,t,n){return y(()=>t(e()),void 0,{equals:n,internal:!0})}function Os(e,t,n){return y(()=>{let r=e(),o={};for(let s of t)o[s]=r[s];return o},void 0,n)}function Rs(e,t,n){return y(()=>{let o={...e()};for(let s of t)delete o[s];return o},void 0,n)}function As(e,t,n,r){return y(()=>e()?t():n(),void 0,r)}function Cs(e,t,n){return y(()=>e()?t():void 0,void 0,n)}function Es(e,t,n){let[r,o]=h(e()),s;return y(()=>{let i=e();clearTimeout(s),s=setTimeout(()=>o(()=>i),t)}),r}function Ps(e,t,n){let[r,o]=h(e()),s=0,i;return y(()=>{let c=e(),u=Date.now();u-s>=t?(s=u,o(()=>c)):(clearTimeout(i),i=setTimeout(()=>{s=Date.now(),o(()=>c)},t-(u-s)))}),r}function ks(e){let t=e;for(;typeof t=="function";)t=t();return t}var yr=Symbol.for("signal");var un=Symbol("fluixi-proxy"),mr=Symbol.for("signal-node"),Ae=0,vt=1,We=2,ae=3,S=null,O=null,f=null,Ke=null,He=0,hr=!1,bt=!1,ue=0,br=1e6,K=new WeakMap,Ve=null;var vr=new Map,Sr=0;function xr(){return`node_${++Sr}_${Date.now()}`}function gr(e){!1}function wr(e,t,n){let r={id:xr(),type:e,value:t,version:0,equals:n?.equals,name:n?.name,created:Date.now(),updated:Date.now()};return gr(r),r}function Or(e,t){return e===t}function cn(e){throw typeof console<"u"&&console.error("Reactive error:",e),e}function Rr(e){if(f)f.indexOf(e)===-1&&f.push(e);else if(Ve&&Ve.running&&!e.pure)Ve.effects.indexOf(e)===-1&&Ve.effects.push(e);else if(!e.pure||e.computed)xt(e);else if(e.pure&&!e.computed&&e.accessor){let t=O,n=f;O=null,f=[],e.accessor(),O=t;let r=f;if(f=n,r.length>0){let o=f;Ge(r),f=o}}}function an(e,t){for(let n=0;n<e.length;n++)t(e[n])}function z(e,t){let n=e;typeof n=="object"&&n&&un in n&&delete n[un];let r=wr("signal",n,{equals:t?.equals===!1?void 0:t?.equals,name:t?.name}),o=[i,c];K.set(o,new Set);let s;function i(){let u=O;if(u){u.sources?u.sources.indexOf(o)===-1&&u.sources.push(o):u.sources=[o];let l=K.get(o);l&&!l.has(u)&&l.add(u)}return n}function c(u){let l=typeof u=="function"?u(n):u,b=r.equals||Or;if(t?.equals===!1||!b(n,l)){n=l,r.value=l,r.version++,r.updated=Date.now();let m=K.get(o);if(m&&m.size>0){let C=function(p,F=!1){let R=p.state;if(!(R===ae&&p===O)){if(F&&!p.pure){R===Ae&&(p.state=vt,hr&&(f!==null&&f.indexOf(p)===-1?f.push(p):w.push(p)));return}if(!x.has(p)&&(x.add(p),p.state=We,R===Ae||R===vt?w.push(p):!p.pure&&f!==null&&f.indexOf(p)===-1&&f.push(p),p.pure&&p.accessor)){let N=K.get(p.accessor);N&&an(Array.from(N),E=>C(E,!0))}}};var d=C;let v=Array.from(m),w=[],x=new Set;an(v,C);for(let p of w)Rr(p)}}}return i.toObservable=()=>new B(u=>{let l=!0;return St(()=>{let d=i();l?l=!1:u.next(d)})}),Object.defineProperty(i,yr,{value:!0,enumerable:!0}),Object.defineProperty(i,mr,{value:r,enumerable:!1}),o}function St(e,t,n){let r={fn:e,state:We,sources:null,sourceSlots:null,owned:null,cleanups:null,owner:S,contexts:null,pure:!1,updatedAt:null};S&&(S.owned?S.owned.push(r):S.owned=[r]);let o=q&&fe(q);return o&&(r.suspense=o),ln(r,t),()=>ce(r)}function ln(e,t){if(e.sources){for(let o of e.sources){let s=K.get(o);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.owned){for(let o=0;o<e.owned.length;o++)ce(e.owned[o]);e.owned=null}let n=O,r=S;if(O=e,S=e,He++,He>br)throw He=0,O=n,S=r,new Error("Potential infinite loop detected. Exceeded maximum iterations.");try{e.state=ae;let o=e.fn(t);typeof o=="function"&&(e.cleanups?e.cleanups.push(o):e.cleanups=[o]),e.state===ae&&(e.state=Ae)}catch(o){if(Ye(o)){let s=q&&fe(q);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}cn(o)}finally{O=n,S=r}}function xt(e){if(!(e.disposed||!e.fn||e.state===Ae)&&(e.state===We||e.state===vt||e.state===ae)){if(e.cleanups){for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();e.cleanups=null}if(e.owned){for(let t=0;t<e.owned.length;t++)ce(e.owned[t]);e.owned=null}e.renderEffect?dn(e):ln(e,e.value)}}function ce(e){if(e.disposed=!0,e.sources)for(let t of e.sources){let n=K.get(t);n&&n.delete(e)}if(e.cleanups)for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();if(e.owned)for(let t=0;t<e.owned.length;t++)ce(e.owned[t]);if(e.owner&&e.owner.owned){let t=e.owner.owned.indexOf(e);t!==-1&&e.owner.owned.splice(t,1)}}function Ge(e){let t=[],n=[];for(let o of e)o.pure&&!o.computed&&o.accessor?t.indexOf(o)===-1&&t.push(o):(o.computed||!o.pure)&&n.indexOf(o)===-1&&n.push(o);f=[];let r=0;for(;r<t.length;){let o=t[r++],s=K.get(o.accessor);if(s&&s.size>0){let c=O;O=null,o.accessor(),O=c}let i=f.splice(0);for(let c of i)c.pure&&!c.computed&&c.accessor?t.indexOf(c)===-1&&t.push(c):(c.computed||!c.pure)&&n.indexOf(c)===-1&&n.push(c)}f=null;for(let o of n)(o.computed||!o.pure)&&xt(o)}function Y(e){if(f&&ue>0)return e();if(f&&ue===0){let t=f,n=[];f=n,ue++;let r;try{r=e()}finally{ue--,f=t}let o=f;return Ge(n),f=o,r}ue++,f=[],Ke=[];try{return e()}finally{ue--,Ar()}}function Ar(){if(!bt){bt=!0,He=0;try{for(;f&&f.length>0;){let e=f;f=null,Ge(e)}if(f=null,Ke){let e=Ke;Ke=null;for(let t=0;t<e.length;t++)xt(e[t])}}finally{bt=!1}}}function le(e){let t=O;O=null;try{return e()}finally{O=t}}function fn(e){S&&(S.cleanups?S.cleanups.push(e):S.cleanups=[e])}function Cr(e){let t=Symbol("context"),n=Er(t);return{id:t,Provider:n,defaultValue:e}}function Er(e){return t=>{let n=S;for(;n;)n.contexts||(n.contexts=new Map),n.contexts.has(e)||n.contexts.set(e,t.value),n=n.owner;let r;return Pr(()=>{r=le(()=>{let o=S;return o&&(o.contexts||(o.contexts=new Map),o.contexts.set(e,t.value)),it(()=>t.children)})}),r}}function fe(e){let t=S;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.owner}if(e)return e.defaultValue}function Pr(e,t,n){let r={fn:e,state:We,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:S,contexts:null,pure:!1,updatedAt:null,renderEffect:!0};S&&(S.owned?S.owned.push(r):S.owned=[r]);let o=q&&fe(q);return o&&(r.suspense=o),dn(r),()=>ce(r)}function dn(e){if(e.sources){for(let o of e.sources){let s=K.get(o);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.cleanups){for(let o=0;o<e.cleanups.length;o++)e.cleanups[o]();e.cleanups=null}if(e.owned){for(let o=0;o<e.owned.length;o++)ce(e.owned[o]);e.owned=null}let t=O,n=S,r=f;O=e,S=e,f===null&&(f=[]),e.state=ae;try{let o=e.fn(e.value);typeof o=="function"&&(e.cleanups||(e.cleanups=[]),e.cleanups.push(o)),e.value=o,e.state===ae&&(e.state=Ae)}catch(o){if(Ye(o)){let s=q&&fe(q);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}cn(o)}finally{O=t,S=n;let o=f;if(f=r,o!==r&&o&&o.length>0){let s=f;Ge(o),f=s}}}var q;function pn(){return q||(q=Cr())}var Q=new Map,X=new Map,kr=0,_r=Symbol.for("signal"),Fr=Symbol.for("resource");function js(e,t,n={}){let r,o,s;typeof t=="function"?(r=e,o=t,s=n):(r=()=>!0,o=e,s=t??n);let{ttl:i=1/0,name:c=`_auto_${kr++}`,staleWhileRevalidate:u=!0}=s,l=c,b=T=>`${l}:${JSON.stringify(T)}`,d=T=>i===1/0||Date.now()-T.timestamp<=i,[m,v]=z(void 0,{equals:!1}),[w,x]=z("unresolved",{equals:!1}),[C,p]=z(void 0,{equals:!1}),[F,R]=z(void 0,{equals:!1}),[N,E]=z(!1),[A,D]=z(0,{equals:!1}),L=Symbol("unset"),H=L,de=!1,J=!1;function I(T,P,k,j){if(X.has(P)){X.get(P).then(g=>{j()||W(g,k)},g=>{!j()&&!k&>(g)}),k||R(X.get(P));return}let Z=Promise.resolve(o(T)).then(g=>(Q.set(P,{value:g,timestamp:Date.now()}),X.delete(P),g),g=>{throw X.delete(P),g});if(X.set(P,Z),!k){oe(Z),R(Z);let g=Ce&&fe(Ce);g&&(g.increment(),Z.finally(()=>g.decrement()))}Z.then(g=>{j()||W(g,k)},g=>{!j()&&!k&>(g)})}function W(T,P){Y(()=>{v(()=>T),x("ready"),E(!1),R(void 0),p(void 0)})}function gt(T){Y(()=>{p(T),x("errored"),R(void 0)})}let Ce;St(()=>{Ce===void 0&&(Ce=pn());let T=r();if(A(),T===!1||T===null||T===void 0){H=L,Y(()=>{x("unresolved"),R(void 0),p(void 0)});return}let P=de,k=J;de=!1,J=!1;let j=b(T);k&&Q.delete(j);let Z=H===L||T!==H;H=T;let g=!1;fn(()=>{g=!0});let ee=Q.get(j);if(ee&&d(ee)&&!P&&!k){(le(w)!=="ready"||le(m)!==ee.value)&&Y(()=>{v(()=>ee.value),x("ready"),E(!1),p(void 0)});return}if(ee&&u&&!k){Y(()=>{v(()=>ee.value),x("ready"),E(!0),p(void 0),R(void 0)}),I(T,j,!0,()=>g);return}let wt=le(w),Tn=wt==="ready"||wt==="refreshing";Y(()=>{x(Tn?"refreshing":"pending"),p(void 0),E(!1)}),I(T,j,!1,()=>g)});let Ee=(()=>{let T=C();if(T)throw T;if(w()==="pending"){let k=F();if(k)throw k}return m()});return Object.defineProperty(Ee,Fr,{value:!0,enumerable:!0}),Object.defineProperty(Ee,_r,{value:!0,enumerable:!0}),Object.defineProperties(Ee,{state:{get:w},loading:{get:()=>{let T=w();return T==="pending"||T==="refreshing"}},error:{get:C},latest:{get:m},stale:{get:N}}),[Ee,{mutate:v,refetch:()=>{de=!0,D(T=>T+1)},invalidate:()=>{let T=le(r);T!=null&&T!==!1&&Q.delete(b(T)),J=!0,D(P=>P+1)}}]}function Bs(e){let t=`${e}:`;for(let n of Q.keys())n.startsWith(t)&&Q.delete(n)}function Ls(){Q.clear(),X.clear()}export{Jn as $NAME,ie as $NODE,Po as $PROXY,Be as $RAW,ft as $SELF,Eo as $SIGNAL,Zn as $STORE,dt as $TRACK,B as Observable,Xe as SafeSubscriber,Yn as Signal,G as Store,fr as StoreAPI,Rt as Subject,Te as Subscriber,pe as Subscription,ut as SuspenseContext,yn as VERSION,De as __DEV__,V as batch,Ls as clearAllCachedResources,Bs as clearCachedResourceNamespace,vs as combineSignal,Ss as combineSignals,js as createCachedResource,bn as createChildOwner,An as createComputed,rr as createComputedStore,ve as createContext,Ln as createDebounce,Kn as createDebouncedResource,Vt as createDebouncedSignal,Bn as createDeferred,M as createEffect,Gn as createErrorBoundary,y as createMemo,on as createMutableStore,Cn as createRenderEffect,we as createResource,re as createRoot,jn as createSelector,h as createSignal,$e as createStore,or as createStoreEffect,sr as createStoreMemo,Hn as createSuspenseBoundary,Es as debounceSignal,vn as disposeScope,bs as distinctSignal,Wo as effect,ms as everySignal,ds as filterSignal,Ts as findSignal,Pn as flush,ar as getNode,_e as getOwner,Ue as getServerData,cr as getStoreNode,Cs as guardSignal,oo as indexArray,Mn as isComponent,Un as isMemo,Sn as isOwnerDisposed,Nn as isProvider,In as isResource,et as isSignal,ur as isStore,mt as isStoreProxy,qn as isSuspense,ro as keyArray,Nt as makeArrayFlat,no as mapArray,fs as mapSignal,Ho as memo,xs as mergeSignal,lr as modifiable,Ie as nextResourceId,Rs as omitSignal,kn as on,_ as onCleanup,Lr as operate,Os as pickSignal,dr as produceUtil,Se as provide,zn as provideErrorBoundary,Wn as provideSuspense,it as readChildren,ks as readSignal,pr as reconcileUtil,ps as reduceSignal,Me as reportResourceData,Xn as resource,xe as runWithOwner,ws as selectSignal,Dt as setOwner,$t as setResourceDataSink,Lt as setResourceIdSource,jt as setResourceTracker,Bt as setServerDataGetter,Ko as signal,ys as someSignal,hs as sortSignal,qt as startTransition,Tr as store,Ps as throttleSignal,oe as trackResourcePromise,U as untrack,sn as untrackStore,Re as unwrap,xn as useContext,En as useTransition,As as whenSignal,ir as wrap,gs as zipSignal};
|
|
1
|
+
var yn="1.0.0-alpha.79";function ze(e){return typeof e=="function"&&!/^class\s/.test(Function.prototype.toString.call(e))}function Ot(e){return e==null||Array.isArray(e)||typeof e=="function"||e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error?!1:typeof e=="object"}function Ye(e){return e instanceof Promise||!!e&&(typeof e=="object"||typeof e=="function")&&"then"in e}var pe=class e{constructor(t){this._closed=!1;this._parentOrParents=null;this._subscriptions=null;t&&(this._subscriptions=[t])}get closed(){return this._closed}unsubscribe(){if(this._closed)return;this._closed=!0;let{_parentOrParents:t,_subscriptions:n}=this;if(t instanceof e)t.remove(this);else if(t!==null)for(let r of t)r.remove(this);if(n){for(let r of n)if(ze(r)&&!(r instanceof e))try{r()}catch(o){console.error("Error in unsubscribe function:",o)}else if(Ot(r)&&typeof r.unsubscribe=="function")try{r.unsubscribe()}catch(o){console.error("Error unsubscribing child:",o)}this._subscriptions=null}}add(t){if(!t||t===this)return this;if(t.closed)return this;let{_closed:n,_subscriptions:r}=this;if(n){if(ze(t))try{t()}catch(o){console.error("Error in unsubscribe function:",o)}else if(t.unsubscribe)try{t.unsubscribe()}catch(o){console.error("Error unsubscribing:",o)}return this}return r||(this._subscriptions=[]),this._subscriptions.push(t),t instanceof e&&t._addParent(this),this}remove(t){let{_subscriptions:n}=this;if(!n)return;let r=n.indexOf(t);r!==-1&&(n.splice(r,1),t._removeParent(this))}_addParent(t){let{_parentOrParents:n}=this;n?Array.isArray(n)?n.push(t):this._parentOrParents=[n,t]:this._parentOrParents=t}_removeParent(t){let{_parentOrParents:n}=this;if(n===t)this._parentOrParents=null;else if(Array.isArray(n)){let r=n.indexOf(t);r!==-1&&(n.splice(r,1),n.length===1&&(this._parentOrParents=n[0]))}}};var Te=class extends pe{constructor(n,r,o){super();this.isStopped=!1;let s;n?typeof n=="object"?s=n:s={next:n,error:r,complete:o}:s={},this.destination=s}next(n){if(!this.isStopped&&this.destination.next)try{this.destination.next(n)}catch(r){this.error(r)}}error(n){if(!this.isStopped){if(this.isStopped=!0,this.destination.error)try{this.destination.error(n)}catch(r){throw r}else throw n;this.unsubscribe()}}complete(){if(!this.isStopped){if(this.isStopped=!0,this.destination.complete)try{this.destination.complete()}catch(n){this.error(n);return}this.unsubscribe()}}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}},Xe=class extends Te{constructor(n,r,o,s){super(n,r,o);this._isUnsubscribing=!1;this._parentSubscriber=null;this._parentSubscriber=s||null}next(n){if(!this.isStopped&&!this._isUnsubscribing)try{super.next(n)}catch(r){this.error(r)}}error(n){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.error(n)}finally{this._isUnsubscribing=!1}}}complete(){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.complete()}finally{this._isUnsubscribing=!1}}}unsubscribe(){this.closed||(this._isUnsubscribing=!0,super.unsubscribe(),this._isUnsubscribing=!1)}};function Lr(e){return new Te(e.next,e.error,e.complete)}var B=class extends pe{constructor(t){if(super(),t)this._subscribe=t;else throw new TypeError("Observable constructor requires a subscribe function")}subscribe(t,n,r){let o;t instanceof Te?o=t:o=new Xe(t,n,r);let{_subscribe:s}=this;try{let i=s.call(this,o);i&&(typeof i=="function"||typeof i.unsubscribe=="function")&&o.add(i)}catch(i){o.error(i)}return o}pipe(...t){return t.length===0?this:t.reduce((n,r)=>r(n),this)}toPromise(){return new Promise((t,n)=>{let r;this.subscribe({next:o=>r=o,error:n,complete:()=>t(r)})})}};var Rt=class extends B{constructor(){super(n=>{if(this.closed)throw new Error("Subject has been closed");if(this.hasError)n.error(this.thrownError);else if(this.isStopped)n.complete();else return this.observers.push(n),()=>{let r=this.observers.indexOf(n);r!==-1&&this.observers.splice(r,1)}});this.observers=[];this.isStopped=!1;this.hasError=!1;this.thrownError=null}next(n){if(this.isStopped)return;let{observers:r}=this,o=r.length,s=r.slice();for(let i=0;i<o;i++)s[i].next?.(n)}error(n){if(this.isStopped)return;this.hasError=!0,this.thrownError=n,this.isStopped=!0;let{observers:r}=this;this.observers=[];let o=r.length,s=r.slice();for(let i=0;i<o;i++)s[i].error?.(n)}complete(){if(this.isStopped)return;this.isStopped=!0;let{observers:n}=this;this.observers=[];let r=n.length,o=n.slice();for(let s=0;s<r;s++)o[s].complete?.()}unsubscribe(){this.isStopped=!0,this.observers=[]}asObservable(){return new B(r=>this.subscribe(r))}};var mn="__fluixi_signal_next_state__",hn=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},a=globalThis[mn]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:hn,onSuspend:null,onError:null};var At=0,Ct=1,ye=2,Pe=class{constructor(){this.observers=null;this.watchers=null;this.version=0}updateIfNecessary(){}track(){if(a.untracked)return;let t=a.consumer;t&&((this.observers??=new Set).add(t),(t.sources??=new Set).add(this))}},te=class extends Pe{constructor(t,n){super(),this._value=t,this._equals=n?.equals===!1?()=>!1:n?.equals??Object.is}get(){return this.track(),this._value}set(t){if(!this._equals(this._value,t)){if(this._value=t,this.version++,this.observers)for(let n of[...this.observers])n.markDirty(ye);Qe(this)}}peek(){return this._value}},$=class extends Pe{constructor(n,r){super();this._threw=!1;this._initialized=!1;this.state=ye;this.sources=null;this._fn=n,this._equals=r?.equals===!1?()=>!1:r?.equals??Object.is}get(){if(a.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===Ct&&this.sources){for(let n of this.sources)if(n.updateIfNecessary(),this.state===ye)break}(this.state===ye||!this._initialized)&&this.recompute(),this.state=At}recompute(){if(this.sources){for(let u of this.sources)u.observers?.delete(this);this.sources.clear()}let n=a.consumer,r=a.untracked;a.consumer=this,a.untracked=!1;let o,s=!1,i;try{o=this._fn()}catch(u){s=!0,i=u,o=this._value}finally{a.consumer=n,a.untracked=r}let c=!this._initialized||this._threw!==s||(s?i!==this._error:!this._equals(this._value,o));if(this._initialized=!0,this._threw=s,this._error=i,this._value=o,c){if(this.version++,this.observers)for(let u of[...this.observers])u.markDirty(ye);Qe(this)}}markDirty(n){if(this.state>=n)return;let r=this.state===At;if(this.state=n,r){if(this.observers)for(let o of[...this.observers])o.markDirty(Ct);Qe(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function Qe(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var ne=class{constructor(t){this._watched=new Set;this._pending=new Set;this._notifyFn=t}watch(...t){for(let n of t)this._watched.add(n),(n.watchers??=new Set).add(this)}unwatch(...t){for(let n of t)this._watched.delete(n),n.watchers?.delete(this),this._pending.delete(n)}getPending(){let t=[...this._pending];return this._pending.clear(),t}_notify(t){if(!this._watched.has(t)||this._pending.has(t))return;let n=this._pending.size===0;this._pending.add(t),n&&this._notifyFn()}};function me(e){if(a.untracked)return e();a.untracked=!0;try{return e()}finally{a.untracked=!1}}function Et(){return a.consumer}function Pt(e){return!!(e.observers&&e.observers.size)||!!(e.watchers&&e.watchers.size)}function bn(e){let t=be(e);return e&&(e.owned??=[]).push(t),t}function vn(e,t=!0){he(e,t)}function Sn(e){return!!e&&e.disposed===!0}function be(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function ve(e){let t=Symbol("context");return{id:t,defaultValue:e,Provider:r=>{let o=a.owner,s=be(o);(s.contexts=new Map).set(t,r.value),o&&(o.owned??=[]).push(s),a.owner=s;try{return r.children}finally{a.owner=o}}}}function xn(e){let t=a.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.parent}return e.defaultValue}function ke(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function Se(e,t,n){let r=be(a.owner);(r.contexts=new Map).set(e.id,t),a.owner&&(a.owner.owned??=[]).push(r);let o=a.owner;a.owner=r;try{return n()}finally{a.owner=o}}function kt(e){a.onSuspend=e}function _t(e){return a.onSuspend?(a.onSuspend(e,a.owner),!0):!1}function Ft(e){a.onError=e}function _e(){return a.owner}function Dt(e){let t=a.owner;return a.owner=e,t}function xe(e,t){let n=a.owner;a.owner=e;try{return t()}finally{a.owner=n}}function _(e){if(a.owner){if(a.owner.disposed){e();return}(a.owner.cleanups??=[]).push(e)}}function he(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)he(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function re(e){let t=be(a.owner);a.owner&&(a.owner.owned??=[]).push(t);let n=a.owner;a.owner=t;try{return e(()=>he(t))}finally{a.owner=n}}function Ut(e){a.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function gn(e){e.queued||(e.queued=!0,a.queue.push(e),!a.scheduled&&a.batchDepth===0&&(a.scheduled=!0,a.hostSchedule(ge)))}function ge(){if(a.scheduled=!1,a.flushing)return;a.flushing=!0;let e=0;try{for(;a.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=a.queue;a.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{a.flushing=!1}}function It(){a.batchDepth===0&&ge()}function Ze(e){a.batchDepth++;try{return e()}finally{--a.batchDepth===0&&ge()}}var Je=class{constructor(t){this.queued=!1;this.disposed=!1;this.owner=be(a.owner),a.owner&&(a.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new $(()=>{he(this.owner,!1),xe(this.owner,()=>{let n=t();typeof n=="function"&&(this.owner.cleanups??=[]).push(n)})}),this.watcher=new ne(()=>gn(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(t){if(t&&typeof t.then=="function"&&a.onSuspend){a.onSuspend(t,this.owner);return}if(a.onError&&a.onError(t,this.owner))return;throw t}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),he(this.owner))}};function Fe(e){let t=new Je(e);return()=>t.dispose()}function wn(e){return!!e&&typeof e.then=="function"}Ut(()=>{});var Mt=Symbol.for("signal"),On=Symbol.for("memo"),Rn=Symbol.for("signal-node");function h(e,t){let n=new te(e,{equals:t?.equals}),r=(()=>n.get()),o=(s=>{let i=typeof s=="function"?s(n.peek()):s;return n.set(i),It(),i});return Object.defineProperty(r,Mt,{value:!0,enumerable:!0}),Object.defineProperty(r,Rn,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[r,o]}function y(e,t,n){let r=t,o=_e(),s=new $(()=>xe(o,()=>{try{return r=e(r)}catch(c){if(wn(c))return _t(c),r;throw c}}),{equals:n?.equals}),i=(()=>s.get());return Object.defineProperty(i,Mt,{value:!0,enumerable:!0}),Object.defineProperty(i,On,{value:!0,enumerable:!0}),i}function M(e,t){let n=t;return Fe(()=>{n=e(n)})}function An(e,t){let n=t;Fe(()=>{n=e(n)})}function Cn(e,t){let n=t;return Fe(()=>{n=e(n)})}function V(e){return Ze(e)}function U(e){return me(e)}function qt(e){return Ze(e),Promise.resolve()}function En(){return[()=>!1,qt]}function Pn(){return ge(),Promise.resolve()}function kn(e,t,n){let r=Array.isArray(e),o,s=n?.defer??!1;return i=>{let c=r?e.map(l=>l()):e();if(s){s=!1,o=c;return}let u=me(()=>t(c,o,i));return o=c,u}}function no(e,t,n){let r=[];return _(()=>{for(let o of r)o.dispose();r=[]}),y(()=>{let o=e()||[];return U(()=>{if(o.length===0){for(let u of r)u.dispose();return r=[],n?.fallback?n.fallback():[]}let s=new Map;for(let u of r)s.has(u.item)||s.set(u.item,u);let i=[],c=new Set;for(let u=0;u<o.length;u++){let l=o[u],b=s.get(l);if(b&&!c.has(b))b.setIndex(u),i.push(b),c.add(b);else{let d,m,v;re(x=>{v=x;let[C,p]=h(u);m=p,d=t(l,C)});let w={item:l,rendered:d,dispose:v,setIndex:m};i.push(w),c.add(w)}}for(let u of r)c.has(u)||u.dispose();return r=i,i.map(u=>u.rendered)})})}function ro(e,t,n,r){let o=[],s=[];return _(()=>{for(let i of s)i.dispose();o=[],s=[]}),y(()=>{let i=e()||[];return U(()=>{if(i.length===0){for(let d of s)d.dispose();return o=[],s=[],r?.fallback?r.fallback():[]}let c=new Map;for(let d=0;d<o.length;d++)c.set(o[d],s[d]);let u=[],l=[],b=new Set;for(let d=0;d<i.length;d++){let m=t(i[d]),v=c.get(m);if(v&&!b.has(m))v.setIndex(d),u.push(v);else{let w,x,C;re(p=>{C=p;let[F,R]=h(d);x=R;let N=y(E=>{let D=(e()||[])[F()];return D??E},i[d]);w=n(N,F)}),u.push({rendered:w,dispose:C,setIndex:x})}l.push(m),b.add(m)}for(let[d,m]of c)b.has(d)||m.dispose();return o=l,s=u,u.map(d=>d.rendered)})})}function oo(e,t,n){let r=[];return _(()=>{for(let o of r)o.dispose();r=[]}),y(()=>{let o=e()||[];return U(()=>{if(o.length===0){for(let u of r)u.dispose();return r=[],n?.fallback?n.fallback():[]}let s=r.length,i=o.length;for(let u=s;u<i;u++){let l,b,d,m=o[u];re(v=>{d=v;let[w,x]=h(m);b=x,l=t(w,u)}),r.push({rendered:l,setItem:b,dispose:d})}for(let u=i;u<s;u++)r[u].dispose();i<s&&(r=r.slice(0,i));let c=Math.min(s,i);for(let u=0;u<c;u++)r[u].setItem(o[u]);return r.map(u=>u.rendered)})})}var De=!1,_n=Symbol.for("signal"),Fn=Symbol.for("memo"),Dn=Symbol.for("resource");function et(e){return typeof e=="function"&&e[_n]===!0}function Un(e){return typeof e=="function"&&e[Fn]===!0}function In(e){return typeof e=="function"&&e[Dn]===!0}function Mn(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 Nn(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function Nt(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Nt(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var tt=null;function jt(e){tt=e}function oe(e){tt&&tt(e)}var nt=null;function Bt(e){nt=e}function Ue(e){return nt?nt(e):void 0}var rt=null;function Lt(e){rt=e}function Ie(){return rt?rt():void 0}var ot=null;function $t(e){ot=e}function Me(e,t){ot&&ot(e,t)}function jn(e,t=(n,r)=>n===r){let n=new Map;return M(()=>{let r=e();for(let[o,s]of n){let[i,c]=s,u=t(o,r);i()!==u&&c(u)}}),r=>{let o=n.get(r);if(!o){let[s,i]=h(!1);o=[s,i],n.set(r,o);let c=e();i(t(r,c))}return o[0]()}}function Bn(e,t){let[n,r]=h(e(),t);return M(()=>{let o=e();t?.timeoutMs?setTimeout(()=>r(()=>o),t.timeoutMs):typeof requestIdleCallback=="function"?requestIdleCallback(()=>r(()=>o)):Promise.resolve().then(()=>r(()=>o))}),n}function Ln(e,t){let n,r=(...o)=>{n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0,e(...o)},t)};return _(()=>{n!==void 0&&clearTimeout(n)}),r}function $n(e){return!!e&&typeof e.then=="function"}var st=Symbol();function we(e,t,n={}){let r,o;typeof t=="function"?(r=typeof e=="function"?e:()=>e,o=t):(r=()=>!0,o=e,t&&typeof t=="object"&&(n=t));let s=n.transport===!1?void 0:Ie(),i=s!==void 0?Ue(s):void 0,c=i!==void 0,[u,l]=h(i!==void 0?i.value:n.initialValue,{equals:!1}),[b,d]=h(void 0,{equals:!1}),[m,v]=h(i!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[w,x]=h(void 0,{equals:!1}),[C,p]=h(void 0,{equals:!1}),F=st,R=!1;M(()=>{let A=r();if(C(),A===!1||A===null||A===void 0){F=st,V(()=>{v("unresolved"),x(void 0),d(void 0)});return}let D=R;if(R=!1,F!==st&&A===F&&!D)return;if(F=A,c){c=!1;return}let L=!1;_(()=>L=!0);let H=U(m),de=U(u),J=H==="ready"||H==="refreshing";V(()=>{v(J?"refreshing":"pending"),d(void 0)});try{let I=o(A,{value:de,refetching:J});$n(I)?(x(I),oe(I),I.then(W=>{L||(s!==void 0&&Me(s,W),V(()=>{l(()=>W),v("ready"),x(void 0)}))},W=>{L||V(()=>{d(W),v("errored"),x(void 0)})})):V(()=>{l(()=>I),v("ready"),x(void 0)})}catch(I){if(L)return;V(()=>{d(I),v("errored"),x(void 0)})}});let N=()=>{let A=m();return A==="pending"||A==="refreshing"},E=(()=>{let A=b();if(A)throw A;if(N()){let D=w();if(D)throw D}return u()});return Object.defineProperties(E,{state:{get:m},loading:{get:N},error:{get:b},latest:{get:u}}),Object.defineProperty(E,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(E,Symbol.for("signal"),{value:!0,enumerable:!0}),[E,{mutate:l,refetch:()=>{R=!0,p(void 0)}}]}function Vt(e,t=300){let[n,r]=h(e),[o,s]=h(e),[i,c]=h(!1),u,l=()=>{u!==void 0&&(clearTimeout(u),u=void 0)},b=()=>{l();let m=U(n);return s(()=>m),c(!1),m},d=(m=>{let v=typeof m=="function"?m(U(n)):m;return r(()=>v),c(!0),l(),u=setTimeout(b,t),v});return _(l),[o,d,{immediate:n,pending:i,flush:b,cancel:()=>{l(),c(!1)}}]}function Vn(e){return e!=null&&e!==""}function Kn(e,t,n={}){let{delay:r=300,initialValue:o,shouldFetch:s=Vn}=n,[i,c,u]=Vt(e,r),l=()=>s(i())?i():!1,[b,{refetch:d}]=we(l,t,o===void 0?{}:{initialValue:o});return[b,{...u,query:i,setQuery:c,refetch:d}]}function qe(e){if(typeof e=="function"&&!e.length){let t=e();return et(t)?t:qe(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=qe(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function it(e){let t=y(e);return y(()=>qe(t()))}var ut=ve();kt((e,t)=>{let n=ke(t,ut);n&&(n.increment(),e.finally(()=>n.decrement()))});function Hn(){let[e,t]=h(0),n=0;return{increment:()=>t(n+=1),decrement:()=>t(n-=1),inFallback:()=>e()>0}}function Wn(e,t){return Se(ut,e,t)}var Kt=ve();Ft((e,t)=>{let n=ke(t,Kt);return n?(n.setError(e),!0):!1});function Gn(){let[e,t]=h(void 0,{equals:!1});return{error:e,reset:()=>t(()=>{}),setError:r=>t(()=>r)}}function zn(e,t){return Se(Kt,e,t)}var Yn={State:te,Computed:$,subtle:{Watcher:ne,untrack:me,currentComputed:Et,hasSinks:Pt}};var Eo=Symbol.for("signal"),Po=Symbol.for("fluixi-proxy");function Ko(e,t){let[n,r]=h(e,t);return Object.assign(n,{set:r})}function Ho(e,t,n){return y(e,t,n)}function Wo(e,t){return M(e,t)}function Xn(...e){let[t,n]=we(...e);return Object.assign(t,n)}import{$PROXY as ct,batch as Jt,createEffect as je,createMemo as lt,createSignal as Zt,untrack as Qn}from"@fluixi/reactive/signal";var Be=Symbol("store-raw"),ie=Symbol("store-node"),Ht=Symbol("store-has"),ft=Symbol("store-self"),dt=Symbol("store-track"),Jn=Symbol("store-name"),Zn=Symbol("store-store"),Wt=new WeakMap,Gt=new WeakMap;function en(e){let[t,n]=Zt(e),r=t;return r.$=n,r}function Le(e){let t=Wt.get(e);return t||Wt.set(e,t={keys:new Map}),t}function zt(e,t,n){let r=e.keys.get(t);return r||e.keys.set(t,r=en(n)),r}function Yt(e){let t=Le(e);(t.all||(t.all=en()))()}function Xt(e,t){e.$(typeof t=="function"?()=>t:t)}function tn(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 Ne(e){if(!tn(e))return e;let t=Gt.get(e);if(t)return t;let n=new Proxy(e,er);return Gt.set(e,n),n}var er={get(e,t,n){if(t===Be||t===ie)return e;if(t===ct)return n;if(t===Ht)return i=>i in e;if(t==="__proxy")return!0;if(t===dt||t===ft)return Yt(e),n;let r=e[t];if(typeof r=="function"&&!Object.prototype.hasOwnProperty.call(e,t))return r;let o=Object.getOwnPropertyDescriptor(e,t);if(o&&o.get)return o.get.call(n);let s=zt(Le(e),t,r)();return tn(s)?Ne(s):s},set(){return!0},deleteProperty(e,t){return t in e&&Oe(e,t,void 0),!0},has(e,t){return t===Be||t===ct||t===ie||t===Ht||t===ft||t===dt?!0:(zt(Le(e),t,e[t])(),t in e)},ownKeys(e){return Yt(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function Oe(e,t,n){if(e[t]===n&&(n!==void 0||t in e))return;let o=Array.isArray(e),s=o?e.length:0;n===void 0?delete e[t]:e[t]=n;let i=Le(e),c=i.keys.get(t);if(c&&Xt(c,n),o&&e.length!==s){let u=i.keys.get("length");u&&Xt(u,e.length)}i.all&&i.all.$(void 0)}function Qt(e,t){return typeof e=="function"?e(t):e}function pt(e,t){for(let n of Object.keys(t)){let r=t[n],o=e[n];r&&typeof r=="object"&&!Array.isArray(r)&&o&&typeof o=="object"&&!Array.isArray(o)?pt(o,r):Oe(e,n,r)}}function yt(e){let t=[],n=e.replace(/\[([^\]]*)\]/g,".$1");for(let r of n.split("."))r.length&&t.push(r);return t}function nn(e,t,n){let r=t.length-1;for(let s=0;s<r;s++){let i=t[s];if(i==="*"){let u=t.slice(s+1);if(Array.isArray(e))for(let l=0;l<e.length;l++)nn(e[l],u,n);return}let c=e[i];(c==null||typeof c!="object")&&(c=/^\d+$/.test(t[s+1])?[]:{},Oe(e,i,c)),e=c}let o=t[r];if(o==="*"){if(Array.isArray(e))for(let s=0;s<e.length;s++)Oe(e,s,Qt(n,e[s]));return}Oe(e,o,Qt(n,e[o]))}function at(e,t,n){nn(e,yt(t),n)}function tr(e,t){let n=t[0];if(typeof n=="function"&&t.length===1){let r=n(e);r&&r!==e&&pt(e,r);return}if(Array.isArray(n)&&t.length===1){for(let r of n)Array.isArray(r)&&at(e,r[0],r[1]);return}if(n&&typeof n=="object"&&!Array.isArray(n)&&t.length===1){pt(e,n);return}if(Array.isArray(t[1])&&t.length>=3){at(e,`${n}.${t[1].join(".")}`,t[2]);return}at(e,String(n),t[1])}function Tt(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Tt);let t={};for(let n of Object.keys(e))t[n]=Tt(e[n]);return t}function se(e,t){let n=e;for(let r of yt(t)){if(n==null)return;n=n[r]}return n}var G=class{constructor(t,n={immutable:!0}){this.options=n;this.root=t,this.set=((...r)=>Jt(()=>tr(this.root,r)))}get state(){return Ne(this.root)}get proxy(){return Ne(this.root)}get accessor(){return(()=>Ne(this.root))}unwrap(){return this.root}getNode(t){return this.root&&this.root[t]}get(t){if(t==null||t==="")return Re(this.state);let n=this.state;for(let r of yt(t)){if(n==null)return;n=n[r]}return Re(n)}select(t){return lt(()=>t(this.state))}subscribe(t){return je(()=>t(this.state))}watch(t,n){let r;return je(()=>{let o=t(this.state);Object.is(o,r)||(n(o,r),r=o)})}reactive(t){return lt(()=>this.state[t])}produce(t){this.set((n=>{let r=Tt(n);return t(r),r}))}reconcile(t,n={}){this.set(t)}push(t,...n){let r=se(this.root,t);this.set(t,r.concat(n))}pop(t){let n=se(this.root,t).slice(),r=n.pop();return this.set(t,n),r}shift(t){let n=se(this.root,t).slice(),r=n.shift();return this.set(t,n),r}splice(t,n,r,...o){let s=se(this.root,t).slice(),i=s.splice(n,r,...o);return this.set(t,s),i}insert(t,n,r){let o=se(this.root,t).slice();o.splice(n,0,r),this.set(t,o)}removeAt(t,n){let r=se(this.root,t).slice(),o=r.splice(n,1);return this.set(t,r),o}toObservable(){let[t]=Zt(this.state);return t.toObservable()}dispose(){}},nr=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","unwrap","toObservable"];function rn(e,t){for(let n of nr)e[n]=t[n].bind(t);e.$=t.reactive.bind(t)}function $e(e,t={immutable:!0}){let n=new G(e,t);return rn(n.set,n),[n.proxy,n.set]}function on(e,t={}){return new G(e,{...t,immutable:!1})}function rr(e,t={}){let n=new G(e(),t);return je(()=>n.set(e())),n}function or(e,t,n){return je(()=>n(t(e)))}function sr(e,t,n){return lt(()=>t(e),void 0,n)}function ir(e,t={}){let n=new G(e,t),r=(()=>n.proxy);return rn(r,n),r}function Re(e){if(e==null||typeof e!="object")return e;let t=e[Be];return t!==void 0?t:e}function sn(e){return Qn(()=>Re(e))}function ur(e){return mt(e)}function ar(e){return mt(e)?e[ie]:null}function cr(e){return e&&typeof e=="object"&&ie in e?e[ie]:null}function mt(e){return!!e&&typeof e=="object"&&(ct in e||e.__proxy===!0)}function lr(e){return e}var fr=Object.freeze({createStore:$e,createMutableStore:on,batch:Jt,unwrap:Re,untrackStore:sn});function ht(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(ht);let t={};for(let n of Object.keys(e))t[n]=ht(e[n]);return t}function dr(e){return t=>{let n=ht(t);return e(n),n}}function pr(e,t={}){return()=>e}function Tr(e,t){let[n,r]=$e(e,t);return new Proxy(n,{get:(o,s)=>s==="set"?r:o[s],has:(o,s)=>s==="set"||Reflect.has(o,s)})}function fs(e,t,n){return y(()=>t(e()),void 0,n)}function ds(e,t,n){return y(()=>e().filter(t),void 0,n)}function ps(e,t,n,r){return y(()=>e().reduce(t,n),void 0,r)}function Ts(e,t,n){return y(()=>e().find(t),void 0,n)}function ys(e,t,n){return y(()=>e().some(t),void 0,n)}function ms(e,t,n){return y(()=>e().every(t),void 0,n)}function hs(e,t,n){return y(()=>[...e()].sort(t),void 0,n)}function bs(e,t){return y(()=>[...new Set(e())],void 0,t)}function vs(e,t,n){return y(()=>{let r=e.map(o=>o());return t(r)},void 0,n)}function Ss(...e){return new B(t=>{let n=()=>e.map(o=>typeof o=="function"?o():o.get()),r=e.map(o=>typeof o=="function"&&o.subscribe?o.subscribe(()=>{t.next(n())}):typeof o!="function"?o.subscribe(()=>{t.next(n())}):M(()=>{t.next(n())}));return()=>{r.forEach(o=>{typeof o=="function"?o():o&&typeof o.unsubscribe=="function"&&o.unsubscribe()})}})}function xs(e,t,n){return y(()=>e()||t(),void 0,n)}function gs(e,t,n,r){return y(()=>n(e(),t()),void 0,r)}function ws(e,t,n){return y(()=>t(e()),void 0,{equals:n,internal:!0})}function Os(e,t,n){return y(()=>{let r=e(),o={};for(let s of t)o[s]=r[s];return o},void 0,n)}function Rs(e,t,n){return y(()=>{let o={...e()};for(let s of t)delete o[s];return o},void 0,n)}function As(e,t,n,r){return y(()=>e()?t():n(),void 0,r)}function Cs(e,t,n){return y(()=>e()?t():void 0,void 0,n)}function Es(e,t,n){let[r,o]=h(e()),s;return y(()=>{let i=e();clearTimeout(s),s=setTimeout(()=>o(()=>i),t)}),r}function Ps(e,t,n){let[r,o]=h(e()),s=0,i;return y(()=>{let c=e(),u=Date.now();u-s>=t?(s=u,o(()=>c)):(clearTimeout(i),i=setTimeout(()=>{s=Date.now(),o(()=>c)},t-(u-s)))}),r}function ks(e){let t=e;for(;typeof t=="function";)t=t();return t}var yr=Symbol.for("signal");var un=Symbol("fluixi-proxy"),mr=Symbol.for("signal-node"),Ae=0,vt=1,We=2,ae=3,S=null,O=null,f=null,Ke=null,He=0,hr=!1,bt=!1,ue=0,br=1e6,K=new WeakMap,Ve=null;var vr=new Map,Sr=0;function xr(){return`node_${++Sr}_${Date.now()}`}function gr(e){!1}function wr(e,t,n){let r={id:xr(),type:e,value:t,version:0,equals:n?.equals,name:n?.name,created:Date.now(),updated:Date.now()};return gr(r),r}function Or(e,t){return e===t}function cn(e){throw typeof console<"u"&&console.error("Reactive error:",e),e}function Rr(e){if(f)f.indexOf(e)===-1&&f.push(e);else if(Ve&&Ve.running&&!e.pure)Ve.effects.indexOf(e)===-1&&Ve.effects.push(e);else if(!e.pure||e.computed)xt(e);else if(e.pure&&!e.computed&&e.accessor){let t=O,n=f;O=null,f=[],e.accessor(),O=t;let r=f;if(f=n,r.length>0){let o=f;Ge(r),f=o}}}function an(e,t){for(let n=0;n<e.length;n++)t(e[n])}function z(e,t){let n=e;typeof n=="object"&&n&&un in n&&delete n[un];let r=wr("signal",n,{equals:t?.equals===!1?void 0:t?.equals,name:t?.name}),o=[i,c];K.set(o,new Set);let s;function i(){let u=O;if(u){u.sources?u.sources.indexOf(o)===-1&&u.sources.push(o):u.sources=[o];let l=K.get(o);l&&!l.has(u)&&l.add(u)}return n}function c(u){let l=typeof u=="function"?u(n):u,b=r.equals||Or;if(t?.equals===!1||!b(n,l)){n=l,r.value=l,r.version++,r.updated=Date.now();let m=K.get(o);if(m&&m.size>0){let C=function(p,F=!1){let R=p.state;if(!(R===ae&&p===O)){if(F&&!p.pure){R===Ae&&(p.state=vt,hr&&(f!==null&&f.indexOf(p)===-1?f.push(p):w.push(p)));return}if(!x.has(p)&&(x.add(p),p.state=We,R===Ae||R===vt?w.push(p):!p.pure&&f!==null&&f.indexOf(p)===-1&&f.push(p),p.pure&&p.accessor)){let N=K.get(p.accessor);N&&an(Array.from(N),E=>C(E,!0))}}};var d=C;let v=Array.from(m),w=[],x=new Set;an(v,C);for(let p of w)Rr(p)}}}return i.toObservable=()=>new B(u=>{let l=!0;return St(()=>{let d=i();l?l=!1:u.next(d)})}),Object.defineProperty(i,yr,{value:!0,enumerable:!0}),Object.defineProperty(i,mr,{value:r,enumerable:!1}),o}function St(e,t,n){let r={fn:e,state:We,sources:null,sourceSlots:null,owned:null,cleanups:null,owner:S,contexts:null,pure:!1,updatedAt:null};S&&(S.owned?S.owned.push(r):S.owned=[r]);let o=q&&fe(q);return o&&(r.suspense=o),ln(r,t),()=>ce(r)}function ln(e,t){if(e.sources){for(let o of e.sources){let s=K.get(o);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.owned){for(let o=0;o<e.owned.length;o++)ce(e.owned[o]);e.owned=null}let n=O,r=S;if(O=e,S=e,He++,He>br)throw He=0,O=n,S=r,new Error("Potential infinite loop detected. Exceeded maximum iterations.");try{e.state=ae;let o=e.fn(t);typeof o=="function"&&(e.cleanups?e.cleanups.push(o):e.cleanups=[o]),e.state===ae&&(e.state=Ae)}catch(o){if(Ye(o)){let s=q&&fe(q);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}cn(o)}finally{O=n,S=r}}function xt(e){if(!(e.disposed||!e.fn||e.state===Ae)&&(e.state===We||e.state===vt||e.state===ae)){if(e.cleanups){for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();e.cleanups=null}if(e.owned){for(let t=0;t<e.owned.length;t++)ce(e.owned[t]);e.owned=null}e.renderEffect?dn(e):ln(e,e.value)}}function ce(e){if(e.disposed=!0,e.sources)for(let t of e.sources){let n=K.get(t);n&&n.delete(e)}if(e.cleanups)for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();if(e.owned)for(let t=0;t<e.owned.length;t++)ce(e.owned[t]);if(e.owner&&e.owner.owned){let t=e.owner.owned.indexOf(e);t!==-1&&e.owner.owned.splice(t,1)}}function Ge(e){let t=[],n=[];for(let o of e)o.pure&&!o.computed&&o.accessor?t.indexOf(o)===-1&&t.push(o):(o.computed||!o.pure)&&n.indexOf(o)===-1&&n.push(o);f=[];let r=0;for(;r<t.length;){let o=t[r++],s=K.get(o.accessor);if(s&&s.size>0){let c=O;O=null,o.accessor(),O=c}let i=f.splice(0);for(let c of i)c.pure&&!c.computed&&c.accessor?t.indexOf(c)===-1&&t.push(c):(c.computed||!c.pure)&&n.indexOf(c)===-1&&n.push(c)}f=null;for(let o of n)(o.computed||!o.pure)&&xt(o)}function Y(e){if(f&&ue>0)return e();if(f&&ue===0){let t=f,n=[];f=n,ue++;let r;try{r=e()}finally{ue--,f=t}let o=f;return Ge(n),f=o,r}ue++,f=[],Ke=[];try{return e()}finally{ue--,Ar()}}function Ar(){if(!bt){bt=!0,He=0;try{for(;f&&f.length>0;){let e=f;f=null,Ge(e)}if(f=null,Ke){let e=Ke;Ke=null;for(let t=0;t<e.length;t++)xt(e[t])}}finally{bt=!1}}}function le(e){let t=O;O=null;try{return e()}finally{O=t}}function fn(e){S&&(S.cleanups?S.cleanups.push(e):S.cleanups=[e])}function Cr(e){let t=Symbol("context"),n=Er(t);return{id:t,Provider:n,defaultValue:e}}function Er(e){return t=>{let n=S;for(;n;)n.contexts||(n.contexts=new Map),n.contexts.has(e)||n.contexts.set(e,t.value),n=n.owner;let r;return Pr(()=>{r=le(()=>{let o=S;return o&&(o.contexts||(o.contexts=new Map),o.contexts.set(e,t.value)),it(()=>t.children)})}),r}}function fe(e){let t=S;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.owner}if(e)return e.defaultValue}function Pr(e,t,n){let r={fn:e,state:We,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:S,contexts:null,pure:!1,updatedAt:null,renderEffect:!0};S&&(S.owned?S.owned.push(r):S.owned=[r]);let o=q&&fe(q);return o&&(r.suspense=o),dn(r),()=>ce(r)}function dn(e){if(e.sources){for(let o of e.sources){let s=K.get(o);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.cleanups){for(let o=0;o<e.cleanups.length;o++)e.cleanups[o]();e.cleanups=null}if(e.owned){for(let o=0;o<e.owned.length;o++)ce(e.owned[o]);e.owned=null}let t=O,n=S,r=f;O=e,S=e,f===null&&(f=[]),e.state=ae;try{let o=e.fn(e.value);typeof o=="function"&&(e.cleanups||(e.cleanups=[]),e.cleanups.push(o)),e.value=o,e.state===ae&&(e.state=Ae)}catch(o){if(Ye(o)){let s=q&&fe(q);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}cn(o)}finally{O=t,S=n;let o=f;if(f=r,o!==r&&o&&o.length>0){let s=f;Ge(o),f=s}}}var q;function pn(){return q||(q=Cr())}var Q=new Map,X=new Map,kr=0,_r=Symbol.for("signal"),Fr=Symbol.for("resource");function js(e,t,n={}){let r,o,s;typeof t=="function"?(r=e,o=t,s=n):(r=()=>!0,o=e,s=t??n);let{ttl:i=1/0,name:c=`_auto_${kr++}`,staleWhileRevalidate:u=!0}=s,l=c,b=T=>`${l}:${JSON.stringify(T)}`,d=T=>i===1/0||Date.now()-T.timestamp<=i,[m,v]=z(void 0,{equals:!1}),[w,x]=z("unresolved",{equals:!1}),[C,p]=z(void 0,{equals:!1}),[F,R]=z(void 0,{equals:!1}),[N,E]=z(!1),[A,D]=z(0,{equals:!1}),L=Symbol("unset"),H=L,de=!1,J=!1;function I(T,P,k,j){if(X.has(P)){X.get(P).then(g=>{j()||W(g,k)},g=>{!j()&&!k&>(g)}),k||R(X.get(P));return}let Z=Promise.resolve(o(T)).then(g=>(Q.set(P,{value:g,timestamp:Date.now()}),X.delete(P),g),g=>{throw X.delete(P),g});if(X.set(P,Z),!k){oe(Z),R(Z);let g=Ce&&fe(Ce);g&&(g.increment(),Z.finally(()=>g.decrement()))}Z.then(g=>{j()||W(g,k)},g=>{!j()&&!k&>(g)})}function W(T,P){Y(()=>{v(()=>T),x("ready"),E(!1),R(void 0),p(void 0)})}function gt(T){Y(()=>{p(T),x("errored"),R(void 0)})}let Ce;St(()=>{Ce===void 0&&(Ce=pn());let T=r();if(A(),T===!1||T===null||T===void 0){H=L,Y(()=>{x("unresolved"),R(void 0),p(void 0)});return}let P=de,k=J;de=!1,J=!1;let j=b(T);k&&Q.delete(j);let Z=H===L||T!==H;H=T;let g=!1;fn(()=>{g=!0});let ee=Q.get(j);if(ee&&d(ee)&&!P&&!k){(le(w)!=="ready"||le(m)!==ee.value)&&Y(()=>{v(()=>ee.value),x("ready"),E(!1),p(void 0)});return}if(ee&&u&&!k){Y(()=>{v(()=>ee.value),x("ready"),E(!0),p(void 0),R(void 0)}),I(T,j,!0,()=>g);return}let wt=le(w),Tn=wt==="ready"||wt==="refreshing";Y(()=>{x(Tn?"refreshing":"pending"),p(void 0),E(!1)}),I(T,j,!1,()=>g)});let Ee=(()=>{let T=C();if(T)throw T;if(w()==="pending"){let k=F();if(k)throw k}return m()});return Object.defineProperty(Ee,Fr,{value:!0,enumerable:!0}),Object.defineProperty(Ee,_r,{value:!0,enumerable:!0}),Object.defineProperties(Ee,{state:{get:w},loading:{get:()=>{let T=w();return T==="pending"||T==="refreshing"}},error:{get:C},latest:{get:m},stale:{get:N}}),[Ee,{mutate:v,refetch:()=>{de=!0,D(T=>T+1)},invalidate:()=>{let T=le(r);T!=null&&T!==!1&&Q.delete(b(T)),J=!0,D(P=>P+1)}}]}function Bs(e){let t=`${e}:`;for(let n of Q.keys())n.startsWith(t)&&Q.delete(n)}function Ls(){Q.clear(),X.clear()}export{Jn as $NAME,ie as $NODE,Po as $PROXY,Be as $RAW,ft as $SELF,Eo as $SIGNAL,Zn as $STORE,dt as $TRACK,B as Observable,Xe as SafeSubscriber,Yn as Signal,G as Store,fr as StoreAPI,Rt as Subject,Te as Subscriber,pe as Subscription,ut as SuspenseContext,yn as VERSION,De as __DEV__,V as batch,Ls as clearAllCachedResources,Bs as clearCachedResourceNamespace,vs as combineSignal,Ss as combineSignals,js as createCachedResource,bn as createChildOwner,An as createComputed,rr as createComputedStore,ve as createContext,Ln as createDebounce,Kn as createDebouncedResource,Vt as createDebouncedSignal,Bn as createDeferred,M as createEffect,Gn as createErrorBoundary,y as createMemo,on as createMutableStore,Cn as createRenderEffect,we as createResource,re as createRoot,jn as createSelector,h as createSignal,$e as createStore,or as createStoreEffect,sr as createStoreMemo,Hn as createSuspenseBoundary,Es as debounceSignal,vn as disposeScope,bs as distinctSignal,Wo as effect,ms as everySignal,ds as filterSignal,Ts as findSignal,Pn as flush,ar as getNode,_e as getOwner,Ue as getServerData,cr as getStoreNode,Cs as guardSignal,oo as indexArray,Mn as isComponent,Un as isMemo,Sn as isOwnerDisposed,Nn as isProvider,In as isResource,et as isSignal,ur as isStore,mt as isStoreProxy,qn as isSuspense,ro as keyArray,Nt as makeArrayFlat,no as mapArray,fs as mapSignal,Ho as memo,xs as mergeSignal,lr as modifiable,Ie as nextResourceId,Rs as omitSignal,kn as on,_ as onCleanup,Lr as operate,Os as pickSignal,dr as produceUtil,Se as provide,zn as provideErrorBoundary,Wn as provideSuspense,it as readChildren,ks as readSignal,pr as reconcileUtil,ps as reduceSignal,Me as reportResourceData,Xn as resource,xe as runWithOwner,ws as selectSignal,Dt as setOwner,$t as setResourceDataSink,Lt as setResourceIdSource,jt as setResourceTracker,Bt as setServerDataGetter,Ko as signal,ys as someSignal,hs as sortSignal,qt as startTransition,Tr as store,Ps as throttleSignal,oe as trackResourcePromise,U as untrack,sn as untrackStore,Re as unwrap,xn as useContext,En as useTransition,As as whenSignal,ir as wrap,gs as zipSignal};
|