@fluixi/reactive 1.0.0-alpha.81 → 1.0.0-alpha.83
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/README.md +4 -0
- package/dist/cdn/reactive.cjs +1 -1
- package/dist/cdn/reactive.global.js +1 -1
- package/dist/cdn/reactive.mjs +1 -1
- package/dist/cdn/signal.cjs +1 -1
- package/dist/cdn/signal.global.js +1 -1
- package/dist/cdn/signal.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/lib/signal/api.cjs +1 -1
- package/dist/lib/signal/api.mjs +1 -1
- package/dist/lib/signal/cached-resource.cjs +1 -1
- package/dist/lib/signal/cached-resource.mjs +1 -1
- package/dist/lib/signal/graph/children.cjs +1 -1
- package/dist/lib/signal/graph/children.mjs +1 -1
- package/dist/lib/signal/graph/compat.cjs +1 -1
- package/dist/lib/signal/graph/compat.d.ts.map +1 -1
- package/dist/lib/signal/graph/compat.js +19 -2
- package/dist/lib/signal/graph/compat.mjs +1 -1
- package/dist/lib/signal/graph/core.cjs +1 -1
- package/dist/lib/signal/graph/core.d.ts.map +1 -1
- package/dist/lib/signal/graph/core.js +7 -0
- package/dist/lib/signal/graph/core.mjs +1 -1
- package/dist/lib/signal/graph/debounced.cjs +1 -1
- package/dist/lib/signal/graph/debounced.mjs +1 -1
- package/dist/lib/signal/graph/derived.cjs +1 -1
- package/dist/lib/signal/graph/derived.mjs +1 -1
- package/dist/lib/signal/graph/error-boundary.cjs +1 -1
- package/dist/lib/signal/graph/error-boundary.mjs +1 -1
- package/dist/lib/signal/graph/index.cjs +1 -1
- package/dist/lib/signal/graph/index.mjs +1 -1
- package/dist/lib/signal/graph/observe.cjs +1 -0
- package/dist/lib/signal/graph/observe.d.ts +141 -0
- package/dist/lib/signal/graph/observe.d.ts.map +1 -0
- package/dist/lib/signal/graph/observe.js +149 -0
- package/dist/lib/signal/graph/observe.mjs +1 -0
- package/dist/lib/signal/graph/resource.cjs +1 -1
- package/dist/lib/signal/graph/resource.mjs +1 -1
- package/dist/lib/signal/graph/runtime.cjs +1 -1
- package/dist/lib/signal/graph/runtime.d.ts +2 -2
- package/dist/lib/signal/graph/runtime.d.ts.map +1 -1
- package/dist/lib/signal/graph/runtime.js +22 -7
- package/dist/lib/signal/graph/runtime.mjs +1 -1
- package/dist/lib/signal/graph/signal-next.cjs +1 -1
- package/dist/lib/signal/graph/signal-next.mjs +1 -1
- package/dist/lib/signal/graph/state.cjs +1 -1
- package/dist/lib/signal/graph/state.d.ts +2 -0
- package/dist/lib/signal/graph/state.d.ts.map +1 -1
- package/dist/lib/signal/graph/state.js +1 -0
- package/dist/lib/signal/graph/state.mjs +1 -1
- package/dist/lib/signal/graph/suspense.cjs +1 -1
- package/dist/lib/signal/graph/suspense.mjs +1 -1
- package/dist/lib/signal/index-legacy.cjs +1 -1
- package/dist/lib/signal/index-legacy.mjs +1 -1
- package/dist/lib/signal/index.cjs +1 -1
- package/dist/lib/signal/index.d.ts +2 -0
- package/dist/lib/signal/index.d.ts.map +1 -1
- package/dist/lib/signal/index.js +2 -0
- package/dist/lib/signal/index.mjs +1 -1
- package/dist/lib/signal/list.cjs +1 -1
- package/dist/lib/signal/list.js +5 -5
- package/dist/lib/signal/list.mjs +1 -1
- package/dist/lib/signal/resource-api.cjs +1 -1
- package/dist/lib/signal/resource-api.mjs +1 -1
- package/dist/lib/signal/signal.cjs +1 -1
- package/dist/lib/signal/signal.mjs +1 -1
- package/dist/lib/signal/utilities.cjs +1 -1
- package/dist/lib/signal/utilities.mjs +1 -1
- package/dist/lib/store/api.cjs +1 -1
- package/dist/lib/store/api.mjs +1 -1
- package/dist/lib/store/index.cjs +1 -1
- package/dist/lib/store/index.mjs +1 -1
- package/dist/lib/store/store.cjs +1 -1
- package/dist/lib/store/store.d.ts.map +1 -1
- package/dist/lib/store/store.js +148 -8
- package/dist/lib/store/store.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/README.md
CHANGED
|
@@ -202,6 +202,10 @@ current view. Pure computations still settle immediately.
|
|
|
202
202
|
- `createComputed(fn)` - Runs eagerly, unlike a memo
|
|
203
203
|
- `on(deps, fn, options?)` - Explicit dependencies
|
|
204
204
|
|
|
205
|
+
### Observation
|
|
206
|
+
|
|
207
|
+
- `observeReactiveNodes(observer)` - Watch nodes being created, recomputed and disposed. What @fluixi/devtools attaches to; unwatched, it costs one null check per node.
|
|
208
|
+
|
|
205
209
|
### Owner Management
|
|
206
210
|
|
|
207
211
|
- `getOwner()` - Get current reactive owner
|
package/dist/cdn/reactive.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var nt=Object.defineProperty;var Qn=Object.getOwnPropertyDescriptor;var Jn=Object.getOwnPropertyNames;var Zn=Object.prototype.hasOwnProperty;var er=(e,t)=>{for(var n in t)nt(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&&nt(e,o,{get:()=>t[o],enumerable:!(r=Qn(t,o))||r.enumerable});return e};var nr=e=>tr(nt({},"__esModule",{value:!0}),e);var yo={};er(yo,{$NAME:()=>Rn,$NODE:()=>Q,$PROXY:()=>Sr,$RAW:()=>De,$SELF:()=>Ge,$SIGNAL:()=>vr,$STORE:()=>An,$TRACK:()=>ze,Observable:()=>N,SafeSubscriber:()=>Ne,Signal:()=>mn,Store:()=>H,StoreAPI:()=>jn,Subject:()=>st,Subscriber:()=>ie,Subscription:()=>se,SuspenseContext:()=>He,VERSION:()=>jt,__DEV__:()=>de,batch:()=>$,clearAllCachedResources:()=>To,clearCachedResourceNamespace:()=>po,combineSignal:()=>Ir,combineSignals:()=>Mr,createCachedResource:()=>fo,createChildOwner:()=>Ht,createComputed:()=>tn,createComputedStore:()=>_n,createContext:()=>ce,createDebounce:()=>cn,createDebouncedResource:()=>ln,createDebouncedSignal:()=>Rt,createDeferred:()=>an,createEffect:()=>M,createErrorBoundary:()=>Tn,createMemo:()=>T,createMutableStore:()=>kt,createRenderEffect:()=>nn,createResource:()=>pe,createRoot:()=>Y,createSelector:()=>un,createSignal:()=>h,createStore:()=>Ue,createStoreEffect:()=>Fn,createStoreMemo:()=>Dn,createSuspenseBoundary:()=>fn,debounceSignal:()=>Kr,disposeScope:()=>Wt,distinctSignal:()=>Ur,effect:()=>wr,everySignal:()=>Fr,filterSignal:()=>Er,findSignal:()=>kr,flush:()=>on,getNode:()=>Mn,getOwner:()=>Ae,getServerData:()=>Pe,getStoreNode:()=>qn,guardSignal:()=>Vr,indexArray:()=>dr,isComponent:()=>pt,isMemo:()=>ft,isOwnerDisposed:()=>Gt,isProvider:()=>yt,isResource:()=>dt,isSignal:()=>Ee,isStore:()=>In,isStoreProxy:()=>Xe,isSuspense:()=>Tt,keyArray:()=>fr,makeArrayFlat:()=>$e,mapArray:()=>lr,mapSignal:()=>Cr,memo:()=>gr,mergeSignal:()=>qr,modifiable:()=>Nn,nextResourceId:()=>ke,omitSignal:()=>Lr,on:()=>sn,onCleanup:()=>F,operate:()=>rr,pickSignal:()=>Br,produceUtil:()=>Bn,provide:()=>le,provideErrorBoundary:()=>yn,provideSuspense:()=>dn,readChildren:()=>Ke,readSignal:()=>Wr,reconcileUtil:()=>Ln,reduceSignal:()=>Pr,reportResourceData:()=>_e,resource:()=>hn,runWithOwner:()=>fe,selectSignal:()=>jr,setOwner:()=>at,setResourceDataSink:()=>wt,setResourceIdSource:()=>gt,setResourceTracker:()=>St,setServerDataGetter:()=>xt,signal:()=>xr,someSignal:()=>_r,sortSignal:()=>Dr,startTransition:()=>lt,store:()=>$n,throttleSignal:()=>Hr,trackResourcePromise:()=>X,untrack:()=>D,untrackStore:()=>_t,unwrap:()=>ye,useContext:()=>zt,useTransition:()=>rn,whenSignal:()=>$r,wrap:()=>Un,zipSignal:()=>Nr});module.exports=nr(yo);var jt="1.0.0-alpha.81";function rt(e){return typeof e=="function"&&!/^class\s/.test(Function.prototype.toString.call(e))}function Bt(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 ot(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(rt(r)&&!(r instanceof e))try{r()}catch(o){console.error("Error in unsubscribe function:",o)}else if(Bt(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(rt(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 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 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 st=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 Lt=0,$t=1,ge=2,je=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 je{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(ge);it(this)}}peek(){return this._value}},K=class extends je{constructor(n,r){super();this._threw=!1;this._initialized=!1;this.state=ge;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===$t&&this.sources){for(let n of this.sources)if(n.updateIfNecessary(),this.state===ge)break}(this.state===ge||!this._initialized)&&this.recompute(),this.state=Lt}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(ge);it(this)}}markDirty(n){if(this.state>=n)return;let r=this.state===Lt;if(this.state=n,r){if(this.observers)for(let o of[...this.observers])o.markDirty($t);it(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function it(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 we(e){if(a.untracked)return e();a.untracked=!0;try{return e()}finally{a.untracked=!1}}function Vt(){return a.consumer}function Kt(e){return!!(e.observers&&e.observers.size)||!!(e.watchers&&e.watchers.size)}function Ht(e){let t=Re(e);return e&&(e.owned??=[]).push(t),t}function Wt(e,t=!0){Oe(e,t)}function Gt(e){return!!e&&e.disposed===!0}function Re(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=Re(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 zt(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 Be(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=Re(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 Yt(e){a.onSuspend=e}function Xt(e){return a.onSuspend?(a.onSuspend(e,a.owner),!0):!1}function Qt(e){a.onError=e}function Ae(){return a.owner}function at(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 Oe(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)Oe(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=Re(a.owner);a.owner&&(a.owner.owned??=[]).push(t);let n=a.owner;a.owner=t;try{return e(()=>Oe(t))}finally{a.owner=n}}function Jt(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(Ce)))}function Ce(){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&&Ce()}function ct(e){a.batchDepth++;try{return e()}finally{--a.batchDepth===0&&Ce()}}var ut=class{constructor(t){this.queued=!1;this.disposed=!1;this.owner=Re(a.owner),a.owner&&(a.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new K(()=>{Oe(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),Oe(this.owner))}};function Le(e){let t=new ut(e);return()=>t.dispose()}function ur(e){return!!e&&typeof e.then=="function"}Jt(()=>{});var en=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,en,{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=Ae(),s=new K(()=>fe(o,()=>{try{return r=e(r)}catch(c){if(ur(c))return Xt(c),r;throw c}}),{equals:n?.equals}),i=(()=>s.get());return Object.defineProperty(i,en,{value:!0,enumerable:!0}),Object.defineProperty(i,ar,{value:!0,enumerable:!0}),i}function M(e,t){let n=t;return Le(()=>{n=e(n)})}function tn(e,t){let n=t;Le(()=>{n=e(n)})}function nn(e,t){let n=t;return Le(()=>{n=e(n)})}function $(e){return ct(e)}function D(e){return we(e)}function lt(e){return ct(e),Promise.resolve()}function rn(){return[()=>!1,lt]}function on(){return Ce(),Promise.resolve()}function sn(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=we(()=>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 pr=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,de=typeof process>"u"?pr:!1,Tr=Symbol.for("signal"),yr=Symbol.for("memo"),mr=Symbol.for("resource");function Ee(e){return typeof e=="function"&&e[Tr]===!0}function ft(e){return typeof e=="function"&&e[yr]===!0}function dt(e){return typeof e=="function"&&e[mr]===!0}function pt(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function Tt(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function yt(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function $e(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?$e(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var mt=null;function St(e){mt=e}function X(e){mt&&mt(e)}var ht=null;function xt(e){ht=e}function Pe(e){return ht?ht(e):void 0}var bt=null;function gt(e){bt=e}function ke(){return bt?bt():void 0}var vt=null;function wt(e){vt=e}function _e(e,t){vt&&vt(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 hr(e){return!!e&&typeof e.then=="function"}var Ot=Symbol();function pe(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:ke(),i=s!==void 0?Pe(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=Ot,A=!1;M(()=>{let C=r();if(E(),C===!1||C===null||C===void 0){U=Ot,$(()=>{v("unresolved"),x(void 0),d(void 0)});return}let I=A;if(A=!1,U!==Ot&&C===U&&!I)return;if(U=C,c){c=!1;return}let V=!1;F(()=>V=!0);let G=D(m),xe=D(u),ne=G==="ready"||G==="refreshing";$(()=>{v(ne?"refreshing":"pending"),d(void 0)});try{let q=o(C,{value:xe,refetching:ne});hr(q)?(x(q),X(q),q.then(z=>{V||(s!==void 0&&_e(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 Rt(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 br(e){return e!=null&&e!==""}function ln(e,t,n={}){let{delay:r=300,initialValue:o,shouldFetch:s=br}=n,[i,c,u]=Rt(e,r),l=()=>s(i())?i():!1,[b,{refetch:d}]=pe(l,t,o===void 0?{}:{initialValue:o});return[b,{...u,query:i,setQuery:c,refetch:d}]}function Ve(e){if(typeof e=="function"&&!e.length){let t=e();return Ee(t)?t:Ve(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=Ve(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function Ke(e){let t=T(e);return de?T(()=>Ve(t()),void 0,{name:"children"}):T(()=>Ve(t()))}var He=ce();Yt((e,t)=>{let n=Be(t,He);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(He,e,t)}var pn=ce();Qt((e,t)=>{let n=Be(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:we,currentComputed:Vt,hasSinks:Kt}};var vr=Symbol.for("signal"),Sr=Symbol.for("fluixi-proxy");function xr(e,t){let[n,r]=h(e,t);return Object.assign(n,{set:r})}function gr(e,t,n){return T(e,t,n)}function wr(e,t){return M(e,t)}function hn(...e){let[t,n]=pe(...e);return Object.assign(t,n)}var g=require("@fluixi/reactive/signal"),De=Symbol("store-raw"),Q=Symbol("store-node"),bn=Symbol("store-has"),Ge=Symbol("store-self"),ze=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 Ye(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=Ye(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 We(e){if(!En(e))return e;let t=Sn.get(e);if(t)return t;let n=new Proxy(e,Or);return Sn.set(e,n),n}var Or={get(e,t,n){if(t===De||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===ze||t===Ge)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(Ye(e),t,r)();return En(s)?We(s):s},set(){return!0},deleteProperty(e,t){return t in e&&Fe(e,t,void 0),!0},has(e,t){return t===De||t===g.$PROXY||t===Q||t===bn||t===Ge||t===ze?!0:(xn(Ye(e),t,e[t])(),t in e)},ownKeys(e){return gn(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=Ye(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 Ct(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)?Ct(o,r):Fe(e,n,r)}}function Pt(e){let t=[],n=e.replace(/\[([^\]]*)\]/g,".$1");for(let r of n.split("."))r.length&&t.push(r);return t}function 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])?[]:{},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,On(n,e[s]));return}Fe(e,o,On(n,e[o]))}function At(e,t,n){Pn(e,Pt(t),n)}function Rr(e,t){let n=t[0];if(typeof n=="function"&&t.length===1){let r=n(e);r&&r!==e&&Ct(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){Ct(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 Et(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Et);let t={};for(let n of Object.keys(e))t[n]=Et(e[n]);return t}function Te(e,t){let n=e;for(let r of Pt(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)(()=>Rr(this.root,r)))}get state(){return We(this.root)}get proxy(){return We(this.root)}get accessor(){return(()=>We(this.root))}unwrap(){return this.root}getNode(t){return this.root&&this.root[t]}get(t){if(t==null||t==="")return ye(this.state);let n=this.state;for(let r of Pt(t)){if(n==null)return;n=n[r]}return ye(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=Et(n);return t(r),r}))}reconcile(t,n={}){this.set(t)}push(t,...n){let r=Te(this.root,t);this.set(t,r.concat(n))}pop(t){let n=Te(this.root,t).slice(),r=n.pop();return this.set(t,n),r}shift(t){let n=Te(this.root,t).slice(),r=n.shift();return this.set(t,n),r}splice(t,n,r,...o){let s=Te(this.root,t).slice(),i=s.splice(n,r,...o);return this.set(t,s),i}insert(t,n,r){let o=Te(this.root,t).slice();o.splice(n,0,r),this.set(t,o)}removeAt(t,n){let r=Te(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(){}},Ar=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","unwrap","toObservable"];function kn(e,t){for(let n of Ar)e[n]=t[n].bind(t);e.$=t.reactive.bind(t)}function Ue(e,t={immutable:!0}){let n=new H(e,t);return kn(n.set,n),[n.proxy,n.set]}function kt(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 ye(e){if(e==null||typeof e!="object")return e;let t=e[De];return t!==void 0?t:e}function _t(e){return(0,g.untrack)(()=>ye(e))}function In(e){return Xe(e)}function Mn(e){return Xe(e)?e[Q]:null}function qn(e){return e&&typeof e=="object"&&Q in e?e[Q]:null}function Xe(e){return!!e&&typeof e=="object"&&(g.$PROXY in e||e.__proxy===!0)}function Nn(e){return e}var jn=Object.freeze({createStore:Ue,createMutableStore:kt,batch:g.batch,unwrap:ye,untrackStore:_t});function Ft(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Ft);let t={};for(let n of Object.keys(e))t[n]=Ft(e[n]);return t}function Bn(e){return t=>{let n=Ft(t);return e(n),n}}function Ln(e,t={}){return()=>e}function $n(e,t){let[n,r]=Ue(e,t);return new Proxy(n,{get:(o,s)=>s==="set"?r:o[s],has:(o,s)=>s==="set"||Reflect.has(o,s)})}function Cr(e,t,n){return T(()=>t(e()),void 0,n)}function Er(e,t,n){return T(()=>e().filter(t),void 0,n)}function Pr(e,t,n,r){return T(()=>e().reduce(t,n),void 0,r)}function kr(e,t,n){return T(()=>e().find(t),void 0,n)}function _r(e,t,n){return T(()=>e().some(t),void 0,n)}function Fr(e,t,n){return T(()=>e().every(t),void 0,n)}function Dr(e,t,n){return T(()=>[...e()].sort(t),void 0,n)}function Ur(e,t){return T(()=>[...new Set(e())],void 0,t)}function Ir(e,t,n){return T(()=>{let r=e.map(o=>o());return t(r)},void 0,n)}function Mr(...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 qr(e,t,n){return T(()=>e()||t(),void 0,n)}function Nr(e,t,n,r){return T(()=>n(e(),t()),void 0,r)}function jr(e,t,n){return T(()=>t(e()),void 0,{equals:n,internal:!0})}function Br(e,t,n){return T(()=>{let r=e(),o={};for(let s of t)o[s]=r[s];return o},void 0,n)}function Lr(e,t,n){return T(()=>{let o={...e()};for(let s of t)delete o[s];return o},void 0,n)}function $r(e,t,n,r){return T(()=>e()?t():n(),void 0,r)}function Vr(e,t,n){return T(()=>e()?t():void 0,void 0,n)}function Kr(e,t,n){let[r,o]=h(e()),s;return T(()=>{let i=e();clearTimeout(s),s=setTimeout(()=>o(()=>i),t)}),r}function Hr(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 Wr(e){let t=e;for(;typeof t=="function";)t=t();return t}var Gr=Symbol.for("signal");var Vn=Symbol("fluixi-proxy"),zr=Symbol.for("signal-node"),Ie=0,Ut=1,et=2,he=3,S=null,R=null,f=null,Je=null,Ze=0,Yr=!1,Dt=!1,me=0,Xr=1e6,W=new WeakMap,Qe=null;var Qr=new Map,Jr=0;function Zr(){return`node_${++Jr}_${Date.now()}`}function eo(e){de&&Qr.set(e.id,new WeakRef(e))}function to(e,t,n){let r={id:Zr(),type:e,value:t,version:0,equals:n?.equals,name:n?.name,created:Date.now(),updated:Date.now()};return eo(r),r}function no(e,t){return e===t}function Hn(e){throw typeof console<"u"&&console.error("Reactive error:",e),e}function ro(e){if(f)f.indexOf(e)===-1&&f.push(e);else if(Qe&&Qe.running&&!e.pure)Qe.effects.indexOf(e)===-1&&Qe.effects.push(e);else if(!e.pure||e.computed)Mt(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;tt(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=to("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||no;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===he&&p===R)){if(U&&!p.pure){A===Ie&&(p.state=Ut,Yr&&(f!==null&&f.indexOf(p)===-1?f.push(p):O.push(p)));return}if(!x.has(p)&&(x.add(p),p.state=et,A===Ie||A===Ut?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)ro(p)}}}return i.toObservable=()=>new N(u=>{let l=!0;return It(()=>{let d=i();l?l=!1:u.next(d)})}),Object.defineProperty(i,Gr,{value:!0,enumerable:!0}),Object.defineProperty(i,zr,{value:r,enumerable:!1}),o}function It(e,t,n){let r={fn:e,state:et,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&&Se(j);return o&&(r.suspense=o),Wn(r,t),()=>be(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++)be(e.owned[o]);e.owned=null}let n=R,r=S;if(R=e,S=e,Ze++,Ze>Xr)throw Ze=0,R=n,S=r,new Error("Potential infinite loop detected. Exceeded maximum iterations.");try{e.state=he;let o=e.fn(t);typeof o=="function"&&(e.cleanups?e.cleanups.push(o):e.cleanups=[o]),e.state===he&&(e.state=Ie)}catch(o){if(ot(o)){let s=j&&Se(j);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Hn(o)}finally{R=n,S=r}}function Mt(e){if(!(e.disposed||!e.fn||e.state===Ie)&&(e.state===et||e.state===Ut||e.state===he)){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++)be(e.owned[t]);e.owned=null}e.renderEffect?zn(e):Wn(e,e.value)}}function be(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++)be(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 tt(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)&&Mt(o)}function Z(e){if(f&&me>0)return e();if(f&&me===0){let t=f,n=[];f=n,me++;let r;try{r=e()}finally{me--,f=t}let o=f;return tt(n),f=o,r}me++,f=[],Je=[];try{return e()}finally{me--,oo()}}function oo(){if(!Dt){Dt=!0,Ze=0;try{for(;f&&f.length>0;){let e=f;f=null,tt(e)}if(f=null,Je){let e=Je;Je=null;for(let t=0;t<e.length;t++)Mt(e[t])}}finally{Dt=!1}}}function ve(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 so(e){let t=Symbol("context"),n=io(t);return{id:t,Provider:n,defaultValue:e}}function io(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 uo(()=>{r=ve(()=>{let o=S;return o&&(o.contexts||(o.contexts=new Map),o.contexts.set(e,t.value)),Ke(()=>t.children)})}),r}}function Se(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 uo(e,t,n){let r={fn:e,state:et,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&&Se(j);return o&&(r.suspense=o),zn(r),()=>be(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++)be(e.owned[o]);e.owned=null}let t=R,n=S,r=f;R=e,S=e,f===null&&(f=[]),e.state=he;try{let o=e.fn(e.value);typeof o=="function"&&(e.cleanups||(e.cleanups=[]),e.cleanups.push(o)),e.value=o,e.state===he&&(e.state=Ie)}catch(o){if(ot(o)){let s=j&&Se(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;tt(o),f=s}}}var j;function Yn(){return j||(j=so())}var te=new Map,ee=new Map,ao=0,co=Symbol.for("signal"),lo=Symbol.for("resource");function fo(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_${ao++}`,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,xe=!1,ne=!1;function q(y,k,_,L){if(ee.has(k)){ee.get(k).then(w=>{L()||z(w,_)},w=>{!L()&&!_&&qt(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=Me&&Se(Me);w&&(w.increment(),re.finally(()=>w.decrement()))}re.then(w=>{L()||z(w,_)},w=>{!L()&&!_&&qt(w)})}function z(y,k){Z(()=>{v(()=>y),x("ready"),P(!1),A(void 0),p(void 0)})}function qt(y){Z(()=>{p(y),x("errored"),A(void 0)})}let Me;It(()=>{Me===void 0&&(Me=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=xe,_=ne;xe=!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&&!_){(ve(O)!=="ready"||ve(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 Nt=ve(O),Xn=Nt==="ready"||Nt==="refreshing";Z(()=>{x(Xn?"refreshing":"pending"),p(void 0),P(!1)}),q(y,L,!1,()=>w)});let qe=(()=>{let y=E();if(y)throw y;if(O()==="pending"){let _=U();if(_)throw _}return m()});return Object.defineProperty(qe,lo,{value:!0,enumerable:!0}),Object.defineProperty(qe,co,{value:!0,enumerable:!0}),Object.defineProperties(qe,{state:{get:O},loading:{get:()=>{let y=O();return y==="pending"||y==="refreshing"}},error:{get:E},latest:{get:m},stale:{get:B}}),[qe,{mutate:v,refetch:()=>{xe=!0,I(y=>y+1)},invalidate:()=>{let y=ve(r);y!=null&&y!==!1&&te.delete(b(y)),ne=!0,I(k=>k+1)}}]}function po(e){let t=`${e}:`;for(let n of te.keys())n.startsWith(t)&&te.delete(n)}function To(){te.clear(),ee.clear()}
|
|
1
|
+
"use strict";var Tt=Object.defineProperty;var hr=Object.getOwnPropertyDescriptor;var Sr=Object.getOwnPropertyNames;var xr=Object.prototype.hasOwnProperty;var gr=(e,t)=>{for(var n in t)Tt(e,n,{get:t[n],enumerable:!0})},wr=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Sr(t))!xr.call(e,o)&&o!==n&&Tt(e,o,{get:()=>t[o],enumerable:!(r=hr(t,o))||r.enumerable});return e};var Or=e=>wr(Tt({},"__esModule",{value:!0}),e);var Bo={};gr(Bo,{$NAME:()=>Gn,$NODE:()=>ee,$PROXY:()=>Vr,$RAW:()=>xe,$SELF:()=>ot,$SIGNAL:()=>$r,$STORE:()=>zn,$TRACK:()=>st,Observable:()=>q,SafeSubscriber:()=>Ge,Signal:()=>Bn,Store:()=>G,StoreAPI:()=>ar,Subject:()=>mt,Subscriber:()=>ce,Subscription:()=>ue,SuspenseContext:()=>nt,VERSION:()=>We,__DEV__:()=>be,batch:()=>V,clearAllCachedResources:()=>qo,clearCachedResourceNamespace:()=>Mo,combineSignal:()=>io,combineSignals:()=>ao,createCachedResource:()=>No,createChildOwner:()=>vn,createComputed:()=>An,createComputedStore:()=>Zn,createContext:()=>ye,createDebounce:()=>Fn,createDebouncedResource:()=>Un,createDebouncedSignal:()=>Bt,createDeferred:()=>Dn,createEffect:()=>N,createErrorBoundary:()=>Mn,createMemo:()=>y,createMutableStore:()=>Wt,createRenderEffect:()=>kn,createResource:()=>me,createRoot:()=>J,createSelector:()=>_n,createSignal:()=>b,createStore:()=>$e,createStoreEffect:()=>er,createStoreMemo:()=>tr,createSuspenseBoundary:()=>In,debounceSignal:()=>vo,disposeScope:()=>bn,distinctSignal:()=>so,effect:()=>Wr,everySignal:()=>ro,filterSignal:()=>Zr,findSignal:()=>to,flush:()=>En,getNode:()=>or,getOwner:()=>Ue,getServerData:()=>Ne,getStoreNode:()=>sr,guardSignal:()=>To,indexArray:()=>Ir,isComponent:()=>Ct,isMemo:()=>At,isOwnerDisposed:()=>mn,isProvider:()=>Pt,isResource:()=>kt,isSignal:()=>je,isStore:()=>rr,isStoreProxy:()=>ct,isSuspense:()=>Et,keyArray:()=>Ur,makeArrayFlat:()=>Ze,mapArray:()=>Fr,mapSignal:()=>Jr,memo:()=>Hr,mergeSignal:()=>uo,modifiable:()=>ir,nextResourceId:()=>Me,observeReactiveNodes:()=>ht,omitSignal:()=>po,on:()=>Pn,onCleanup:()=>k,operate:()=>Rr,pickSignal:()=>fo,produceUtil:()=>ur,provide:()=>Te,provideErrorBoundary:()=>qn,provideSuspense:()=>jn,readChildren:()=>tt,readSignal:()=>mo,reconcileUtil:()=>cr,reduceSignal:()=>eo,reportReactiveBinding:()=>cn,reportReactiveContext:()=>le,reportReactiveContextCreated:()=>Xe,reportReactiveDirective:()=>fn,reportReactiveProps:()=>ln,reportResourceData:()=>qe,resource:()=>Ln,runWithOwner:()=>ve,selectSignal:()=>lo,setOwner:()=>wt,setResourceDataSink:()=>Mt,setResourceIdSource:()=>Nt,setResourceTracker:()=>It,setServerDataGetter:()=>jt,signal:()=>Kr,someSignal:()=>no,sortSignal:()=>oo,startTransition:()=>Rt,store:()=>lr,throttleSignal:()=>bo,trackResourcePromise:()=>Z,untrack:()=>U,untrackStore:()=>Gt,unwrap:()=>we,useContext:()=>hn,useTransition:()=>Cn,whenSignal:()=>yo,wrap:()=>nr,zipSignal:()=>co});module.exports=Or(Bo);var We="1.0.0-alpha.83";function vt(e){return typeof e=="function"&&!/^class\s/.test(Function.prototype.toString.call(e))}function tn(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 bt(e){return e instanceof Promise||!!e&&(typeof e=="object"||typeof e=="function")&&"then"in e}var ue=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(vt(r)&&!(r instanceof e))try{r()}catch(o){console.error("Error in unsubscribe function:",o)}else if(tn(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(vt(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 ce=class extends ue{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())}},Ge=class extends ce{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 ce(e.next,e.error,e.complete)}var q=class extends ue{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 ce?o=t:o=new Ge(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 mt=class extends q{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 q(r=>this.subscribe(r))}};var Ar="__fluixi_signal_next_state__",kr=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},c=globalThis[Ar]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:kr,onSuspend:null,onError:null,observer:null};function ht(e){return c.observer=e,()=>{c.observer===e&&(c.observer=null)}}var E=[],ze;function rn(e,t){if(!c.observer)return t();let n=ze;ze=e;try{return t()}finally{ze=n}}function Q(e){let t=c.observer;t&&t.created(e.parents===void 0?{...e,parents:E,origin:e.origin??ze}:e)}function on(e){return c.observer?(E.push(e),!0):!1}function sn(){E.pop()}function an(e){c.observer?.ran?.(e)}function un(e,t){c.observer?.wrote?.(e,t)}function cn(e,t,n,r){let o=c.observer;!o?.bound||!E.length||o.bound(E[E.length-1],e,t,n,r)}function ln(e){let t=c.observer;!t?.props||!E.length||!e||t.props(E[E.length-1],e)}function fn(e,t,n,r){let o=c.observer;!o?.directive||!E.length||o.directive(E[E.length-1],e,t,n,r)}function Xe(e){c.observer?.contextCreated?.(e)}function le(e,t,n){let r=c.observer;!r?.context||!E.length||r.context(E[E.length-1],e,t,n)}function St(e,t,n){c.observer?.moved?.(e,t,n)}function H(e){c.observer?.disposed?.(e)}var Cr="__FLUIXI_DEVTOOLS_HOOK__",nn=globalThis[Cr];if(typeof nn?.inject=="function")try{nn.inject({observeReactiveNodes:ht,version:We})}catch{}function fe(){return c.observer!=null}var dn=0,pn=1,Pe=2,Ye=class{constructor(){this.observers=null;this.watchers=null;this.version=0}updateIfNecessary(){}track(){if(c.untracked)return;let t=c.consumer;t&&((this.observers??=new Set).add(t),(t.sources??=new Set).add(this))}},de=class extends Ye{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++,un(this,c.consumer),this.observers)for(let n of[...this.observers])n.markDirty(Pe);xt(this)}}peek(){return this._value}},W=class extends Ye{constructor(n,r){super();this._threw=!1;this._initialized=!1;this.state=Pe;this.sources=null;this._fn=n,this._equals=r?.equals===!1?()=>!1:r?.equals??Object.is}get(){if(c.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===pn&&this.sources){for(let n of this.sources)if(n.updateIfNecessary(),this.state===Pe)break}(this.state===Pe||!this._initialized)&&this.recompute(),this.state=dn}recompute(){if(this.sources){for(let l of this.sources)l.observers?.delete(this);this.sources.clear()}let n=c.consumer,r=c.untracked,o=on(this);c.consumer=this,c.untracked=!1;let s,i=!1,u;try{s=this._fn()}catch(l){i=!0,u=l,s=this._value}finally{c.consumer=n,c.untracked=r,o&&sn()}let a=!this._initialized||this._threw!==i||(i?u!==this._error:!this._equals(this._value,s));if(this._initialized=!0,this._threw=i,this._error=u,this._value=s,an(this),a){if(this.version++,this.observers)for(let l of[...this.observers])l.markDirty(Pe);xt(this)}}markDirty(n){if(this.state>=n)return;let r=this.state===dn;if(this.state=n,r){if(this.observers)for(let o of[...this.observers])o.markDirty(pn);xt(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function xt(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var pe=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 _e(e){if(c.untracked)return e();c.untracked=!0;try{return e()}finally{c.untracked=!1}}function yn(){return c.consumer}function Tn(e){return!!(e.observers&&e.observers.size)||!!(e.watchers&&e.watchers.size)}function vn(e){let t=Fe(e);return e&&(e.owned??=[]).push(t),t}function bn(e,t=!0){De(e,t)}function mn(e){return!!e&&e.disposed===!0}function Fe(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function ye(e,t){let n=Symbol(t??"context");return Xe(n),{id:n,defaultValue:e,Provider:o=>{le(n,"provide",o.value);let s=c.owner,i=Fe(s);(i.contexts=new Map).set(n,o.value),s&&(s.owned??=[]).push(i),c.owner=i;try{return o.children}finally{c.owner=s}}}}function hn(e){let t=c.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id)){let n=t.contexts.get(e.id);return le(e.id,"read",n),n}t=t.parent}return le(e.id,"read",e.defaultValue),e.defaultValue}function Qe(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 Te(e,t,n){let r=Fe(c.owner);(r.contexts=new Map).set(e.id,t),c.owner&&(c.owner.owned??=[]).push(r);let o=c.owner;c.owner=r;try{return n()}finally{c.owner=o}}function Sn(e){c.onSuspend=e}function xn(e){return c.onSuspend?(c.onSuspend(e,c.owner),!0):!1}function gn(e){c.onError=e}function Ue(){return c.owner}function wt(e){let t=c.owner;return c.owner=e,t}function ve(e,t){let n=c.owner;c.owner=e;try{return t()}finally{c.owner=n}}function k(e){if(c.owner){if(c.owner.disposed){e();return}(c.owner.cleanups??=[]).push(e)}}function De(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)De(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 J(e){let t=Fe(c.owner);c.owner&&(c.owner.owned??=[]).push(t);let n=c.owner;c.owner=t;try{return e(()=>De(t))}finally{c.owner=n}}function wn(e){c.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Er(e){e.queued||(e.queued=!0,c.queue.push(e),!c.scheduled&&c.batchDepth===0&&(c.scheduled=!0,c.hostSchedule(Ie)))}function Ie(){if(c.scheduled=!1,c.flushing)return;c.flushing=!0;let e=0;try{for(;c.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=c.queue;c.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{c.flushing=!1}}function On(){c.batchDepth===0&&Ie()}function Ot(e){c.batchDepth++;try{return e()}finally{--c.batchDepth===0&&Ie()}}var gt=class{constructor(t,n=!1){this.queued=!1;this.disposed=!1;this.owner=Fe(c.owner),c.owner&&(c.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new W(()=>{De(this.owner,!1),ve(this.owner,()=>{let r=t();typeof r=="function"&&(this.owner.cleanups??=[]).push(r)})}),Q({kind:"effect",node:this.computed,handle:this,internal:!n}),this.watcher=new pe(()=>Er(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"&&c.onSuspend){c.onSuspend(t,this.owner);return}if(c.onError&&c.onError(t,this.owner))return;throw t}}}dispose(){this.disposed||(this.disposed=!0,H(this.computed),this.watcher.unwatch(this.computed),De(this.owner))}};function Je(e,t=!1){let n=new gt(e,t);return()=>n.dispose()}function Pr(e){return!!e&&typeof e.then=="function"}wn(()=>{});var Rn=Symbol.for("signal"),_r=Symbol.for("memo"),Dr=Symbol.for("signal-node");function b(e,t){let n=new de(e,{equals:t?.equals}),r=(()=>n.get()),o=(s=>{let i=typeof s=="function"?s(n.peek()):s;return n.set(i),On(),i});return Object.defineProperty(r,Rn,{value:!0,enumerable:!0}),Object.defineProperty(r,Dr,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),Q({kind:"signal",node:n,handle:r,name:t?.name,set:o}),fe()&&k(()=>H(n)),[r,o]}function y(e,t,n){let r=t,o=Ue(),s=new W(()=>ve(o,()=>{try{return r=e(r)}catch(u){if(Pr(u))return xn(u),r;throw u}}),{equals:n?.equals}),i=(()=>s.get());return Object.defineProperty(i,Rn,{value:!0,enumerable:!0}),Object.defineProperty(i,_r,{value:!0,enumerable:!0}),Q({kind:"memo",node:s,handle:i,name:n?.name}),fe()&&k(()=>H(s)),i}function N(e,t){let n=t;return Je(()=>{n=e(n)},!0)}function An(e,t){let n=t;Je(()=>{n=e(n)})}function kn(e,t){let n=t;return Je(()=>{n=e(n)})}function V(e){return Ot(e)}function U(e){return _e(e)}function Rt(e){return Ot(e),Promise.resolve()}function Cn(){return[()=>!1,Rt]}function En(){return Ie(),Promise.resolve()}function Pn(e,t,n){let r=Array.isArray(e),o,s=n?.defer??!1;return i=>{let u=r?e.map(l=>l()):e();if(s){s=!1,o=u;return}let a=_e(()=>t(u,o,i));return o=u,a}}function Fr(e,t,n){let r=[];return k(()=>{for(let o of r)o.dispose();r=[]}),y(()=>{let o=e()||[];return U(()=>{if(o.length===0){for(let a of r)a.dispose();return r=[],n?.fallback?n.fallback():[]}let s=new Map;for(let a of r)s.has(a.item)||s.set(a.item,a);let i=[],u=new Set;for(let a=0;a<o.length;a++){let l=o[a],m=s.get(l);if(m&&!u.has(m))m.setIndex(a),i.push(m),u.add(m);else{let d,v,h;J(x=>{h=x;let[P,p]=b(a,{name:"row index"});v=p,d=t(l,P)});let O={item:l,rendered:d,dispose:h,setIndex:v};i.push(O),u.add(O)}}for(let a of r)u.has(a)||a.dispose();return r=i,i.map(a=>a.rendered)})},void 0,{name:"mapArray"})}function Ur(e,t,n,r){let o=[],s=[];return k(()=>{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 u=new Map;for(let d=0;d<o.length;d++)u.set(o[d],s[d]);let a=[],l=[],m=new Set;for(let d=0;d<i.length;d++){let v=t(i[d]),h=u.get(v);if(h&&!m.has(v))h.setIndex(d),a.push(h);else{let O,x,P;J(p=>{P=p;let[I,A]=b(d,{name:"row index"});x=A;let L=y(_=>{let j=(e()||[])[I()];return j??_},i[d]);O=n(L,I)}),a.push({rendered:O,dispose:P,setIndex:x})}l.push(v),m.add(v)}for(let[d,v]of u)m.has(d)||v.dispose();return o=l,s=a,a.map(d=>d.rendered)})},void 0,{name:"keyArray"})}function Ir(e,t,n){let r=[];return k(()=>{for(let o of r)o.dispose();r=[]}),y(()=>{let o=e()||[];return U(()=>{if(o.length===0){for(let a of r)a.dispose();return r=[],n?.fallback?n.fallback():[]}let s=r.length,i=o.length;for(let a=s;a<i;a++){let l,m,d,v=o[a];J(h=>{d=h;let[O,x]=b(v);m=x,l=t(O,a)}),r.push({rendered:l,setItem:m,dispose:d})}for(let a=i;a<s;a++)r[a].dispose();i<s&&(r=r.slice(0,i));let u=Math.min(s,i);for(let a=0;a<u;a++)r[a].setItem(o[a]);return r.map(a=>a.rendered)})},void 0,{name:"indexArray"})}var jr=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,be=typeof process>"u"?jr:!1,Nr=Symbol.for("signal"),Mr=Symbol.for("memo"),qr=Symbol.for("resource");function je(e){return typeof e=="function"&&e[Nr]===!0}function At(e){return typeof e=="function"&&e[Mr]===!0}function kt(e){return typeof e=="function"&&e[qr]===!0}function Ct(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function Et(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function Pt(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function Ze(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Ze(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var _t=null;function It(e){_t=e}function Z(e){_t&&_t(e)}var Dt=null;function jt(e){Dt=e}function Ne(e){return Dt?Dt(e):void 0}var Ft=null;function Nt(e){Ft=e}function Me(){return Ft?Ft():void 0}var Ut=null;function Mt(e){Ut=e}function qe(e,t){Ut&&Ut(e,t)}function _n(e,t=(n,r)=>n===r){let n=new Map;return N(()=>{let r=e();for(let[o,s]of n){let[i,u]=s,a=t(o,r);i()!==a&&u(a)}}),r=>{let o=n.get(r);if(!o){let[s,i]=b(!1);o=[s,i],n.set(r,o);let u=e();i(t(r,u))}return o[0]()}}function Dn(e,t){let[n,r]=b(e(),t);return N(()=>{let o=e();t?.timeoutMs?setTimeout(()=>r(()=>o),t.timeoutMs):typeof requestIdleCallback=="function"?requestIdleCallback(()=>r(()=>o)):Promise.resolve().then(()=>r(()=>o))}),n}function Fn(e,t){let n,r=(...o)=>{n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0,e(...o)},t)};return k(()=>{n!==void 0&&clearTimeout(n)}),r}function Br(e){return!!e&&typeof e.then=="function"}var qt=Symbol();function me(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:Me(),i=s!==void 0?Ne(s):void 0,u=i!==void 0,[a,l]=b(i!==void 0?i.value:n.initialValue,{equals:!1}),[m,d]=b(void 0,{equals:!1}),[v,h]=b(i!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[O,x]=b(void 0,{equals:!1}),[P,p]=b(void 0,{equals:!1}),I=qt,A=!1;N(()=>{let C=r();if(P(),C===!1||C===null||C===void 0){I=qt,V(()=>{h("unresolved"),x(void 0),d(void 0)});return}let j=A;if(A=!1,I!==qt&&C===I&&!j)return;if(I=C,u){u=!1;return}let K=!1;k(()=>K=!0);let X=U(v),Ee=U(a),se=X==="ready"||X==="refreshing";V(()=>{h(se?"refreshing":"pending"),d(void 0)});try{let M=o(C,{value:Ee,refetching:se});Br(M)?(x(M),Z(M),M.then(Y=>{K||(s!==void 0&&qe(s,Y),V(()=>{l(()=>Y),h("ready"),x(void 0)}))},Y=>{K||V(()=>{d(Y),h("errored"),x(void 0)})})):V(()=>{l(()=>M),h("ready"),x(void 0)})}catch(M){if(K)return;V(()=>{d(M),h("errored"),x(void 0)})}});let L=()=>{let C=v();return C==="pending"||C==="refreshing"},_=(()=>{let C=m();if(C)throw C;if(L()){let j=O();if(j)throw j}return a()});return Object.defineProperties(_,{state:{get:v},loading:{get:L},error:{get:m},latest:{get:a}}),Object.defineProperty(_,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(_,Symbol.for("signal"),{value:!0,enumerable:!0}),[_,{mutate:l,refetch:()=>{A=!0,p(void 0)}}]}function Bt(e,t=300){let[n,r]=b(e),[o,s]=b(e),[i,u]=b(!1),a,l=()=>{a!==void 0&&(clearTimeout(a),a=void 0)},m=()=>{l();let v=U(n);return s(()=>v),u(!1),v},d=(v=>{let h=typeof v=="function"?v(U(n)):v;return r(()=>h),u(!0),l(),a=setTimeout(m,t),h});return k(l),[o,d,{immediate:n,pending:i,flush:m,cancel:()=>{l(),u(!1)}}]}function Lr(e){return e!=null&&e!==""}function Un(e,t,n={}){let{delay:r=300,initialValue:o,shouldFetch:s=Lr}=n,[i,u,a]=Bt(e,r),l=()=>s(i())?i():!1,[m,{refetch:d}]=me(l,t,o===void 0?{}:{initialValue:o});return[m,{...a,query:i,setQuery:u,refetch:d}]}function et(e){if(typeof e=="function"&&!e.length){let t=e();return je(t)?t:et(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=et(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function tt(e){let t=y(e);return be?y(()=>et(t()),void 0,{name:"children"}):y(()=>et(t()))}var nt=ye();Sn((e,t)=>{let n=Qe(t,nt);n&&(n.increment(),e.finally(()=>n.decrement()))});function In(){let[e,t]=b(0),n=0;return{increment:()=>t(n+=1),decrement:()=>t(n-=1),inFallback:()=>e()>0}}function jn(e,t){return Te(nt,e,t)}var Nn=ye();gn((e,t)=>{let n=Qe(t,Nn);return n?(n.setError(e),!0):!1});function Mn(){let[e,t]=b(void 0,{equals:!1});return{error:e,reset:()=>t(()=>{}),setError:r=>t(()=>r)}}function qn(e,t){return Te(Nn,e,t)}var Bn={State:de,Computed:W,subtle:{Watcher:pe,untrack:_e,currentComputed:yn,hasSinks:Tn}};var $r=Symbol.for("signal"),Vr=Symbol.for("fluixi-proxy");function Kr(e,t){let[n,r]=b(e,t);return Object.assign(n,{set:r})}function Hr(e,t,n){return y(e,t,n)}function Wr(e,t){return N(e,t)}function Ln(...e){let[t,n]=me(...e);return Object.assign(t,n)}var g=require("@fluixi/reactive/signal");var xe=Symbol("store-raw"),ee=Symbol("store-node"),$n=Symbol("store-has"),ot=Symbol("store-self"),st=Symbol("store-track"),Gn=Symbol("store-name"),zn=Symbol("store-store"),Le=new WeakMap,$t=new WeakMap,ge=new WeakMap,it=new WeakMap;function Gr(e,t){if(!Se(e)||!fe())return;let n=new Set,r=i=>{if(!(!Se(i)||n.has(i))){n.add(i);for(let u of Object.values(i))r(u)}};r(it.get(t)??t);let o=new Set,s=i=>{if(!Se(i))return;let u=i;if(n.has(u)||o.has(u))return;o.add(u);let a=Le.get(u);if(a){for(let l of a.keys.values())H(l);a.all&&H(a.all),Le.delete(u),ge.delete(u),$t.delete(u)}for(let l of Object.values(u))s(l)};s(e)}var at=(e,t,n)=>n?`${e}[${String(t)}]`:`${e}.${String(t)}`;function Xn(e,t,n){let r=t?.owner,o=r&&n!==void 0?at(r.name,n,t?.array):void 0,[s,i]=rn(r?.store,()=>(0,g.createSignal)(e,o?{name:o}:void 0)),u=s;return u.$=i,u}function ut(e){let t=Le.get(e);return t?t.owner||(t.owner=ge.get(e)):Le.set(e,t={keys:new Map,owner:ge.get(e),array:Array.isArray(e)}),t}function Vn(e,t,n){let r=e.keys.get(t);return r||e.keys.set(t,r=Xn(n,e,t)),r}function zr(e,t,n,r){let o=ge.get(e);if(o&&o.store===t&&o.name===n)return;let s={store:t,name:n};ge.set(e,s),it.set(e,it.get(r)??r);let i=Le.get(e);if(i&&(i.owner=s,!!fe())){for(let[u,a]of i.keys)St(a,t,at(n,u,i.array));i.all&&St(i.all,t,at(n,"*",i.array))}}function Kn(e){let t=ut(e);(t.all||(t.all=Xn(void 0,t,"*")))()}function Hn(e,t){e.$(typeof t=="function"?()=>t:t)}function Se(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 rt(e){if(!Se(e))return e;let t=$t.get(e);if(t)return t;let n=new Proxy(e,Xr);return $t.set(e,n),n}var Xr={get(e,t,n){if(t===xe||t===ee)return e;if(t===g.$PROXY)return n;if(t===$n)return a=>a in e;if(t==="__proxy")return!0;if(t===st||t===ot)return Kn(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=ut(e),i=Vn(s,t,r),u=i();return Se(u)?(s.owner&&zr(u,i,at(s.owner.name,t,s.array),e),rt(u)):u},set(){return!0},deleteProperty(e,t){return t in e&&Be(e,t,void 0),!0},has(e,t){return t===xe||t===g.$PROXY||t===ee||t===$n||t===ot||t===st?!0:(Vn(ut(e),t,e[t])(),t in e)},ownKeys(e){return Kn(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function Yn(e,t=new Set){if(e==null||typeof e!="object")return e;let n=e[xe]??e;if(t.has(n)||!Se(n))return n;t.add(n);let r=!1,o=i=>{let u=Yn(i,t);return u!==i&&(r=!0),u};if(Array.isArray(n)){let i=n.map(o);return r?i:n}let s={};for(let i of Object.keys(n))s[i]=o(n[i]);return r?s:n}function Be(e,t,n){let r=Yn(n),o=e[t];if(o===r&&(r!==void 0||t in e))return;let s=Array.isArray(e),i=s?e.length:0;r===void 0?delete e[t]:e[t]=r;let u=ut(e),a=u.keys.get(t);if(a&&Hn(a,r),Gr(o,e),s&&e.length!==i){let l=u.keys.get("length");l&&Hn(l,e.length)}u.all&&u.all.$(void 0)}function Wn(e,t){return typeof e=="function"?e(t):e}function Vt(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)?Vt(o,r):Be(e,n,r)}}function Ht(e){let t=[],n=e.replace(/\[([^\]]*)\]/g,".$1");for(let r of n.split("."))r.length&&t.push(r);return t}function Qn(e,t,n){let r=t.length-1;for(let s=0;s<r;s++){let i=t[s];if(i==="*"){let a=t.slice(s+1);if(Array.isArray(e))for(let l=0;l<e.length;l++)Qn(e[l],a,n);return}let u=e[i];(u==null||typeof u!="object")&&(u=/^\d+$/.test(t[s+1])?[]:{},Be(e,i,u)),e=u}let o=t[r];if(o==="*"){if(Array.isArray(e))for(let s=0;s<e.length;s++)Be(e,s,Wn(n,e[s]));return}Be(e,o,Wn(n,e[o]))}function Lt(e,t,n){Qn(e,Ht(t),n)}function Yr(e,t){let n=t[0];if(typeof n=="function"&&t.length===1){let r=n(e);r&&r!==e&&Vt(e,r);return}if(Array.isArray(n)&&t.length===1){for(let r of n)Array.isArray(r)&&Lt(e,r[0],r[1]);return}if(n&&typeof n=="object"&&!Array.isArray(n)&&t.length===1){Vt(e,n);return}if(Array.isArray(t[1])&&t.length>=3){Lt(e,`${n}.${t[1].join(".")}`,t[2]);return}Lt(e,String(n),t[1])}function Kt(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Kt);let t={};for(let n of Object.keys(e))t[n]=Kt(e[n]);return t}function he(e,t){let n=e;for(let r of Ht(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)=>(0,g.batch)(()=>Yr(this.root,r))),t&&typeof t=="object"&&(ge.set(t,{store:this,name:n.name??"store"}),it.set(t,t)),Q({kind:"store",node:this,handle:()=>this.root,name:n.name})}get state(){return rt(this.root)}get proxy(){return rt(this.root)}get accessor(){return(()=>rt(this.root))}unwrap(){return this.root}getNode(t){return this.root&&this.root[t]}get(t){if(t==null||t==="")return we(this.state);let n=this.state;for(let r of Ht(t)){if(n==null)return;n=n[r]}return we(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=Kt(n);return t(r),r}))}reconcile(t,n={}){this.set(t)}push(t,...n){let r=he(this.root,t);this.set(t,r.concat(n))}pop(t){let n=he(this.root,t).slice(),r=n.pop();return this.set(t,n),r}shift(t){let n=he(this.root,t).slice(),r=n.shift();return this.set(t,n),r}splice(t,n,r,...o){let s=he(this.root,t).slice(),i=s.splice(n,r,...o);return this.set(t,s),i}insert(t,n,r){let o=he(this.root,t).slice();o.splice(n,0,r),this.set(t,o)}removeAt(t,n){let r=he(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(){}},Qr=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","unwrap","toObservable"];function Jn(e,t){for(let n of Qr)e[n]=t[n].bind(t);e.$=t.reactive.bind(t)}function $e(e,t={immutable:!0}){let n=new G(e,t);return Jn(n.set,n),[n.proxy,n.set]}function Wt(e,t={}){return new G(e,{...t,immutable:!1})}function Zn(e,t={}){let n=new G(e(),t);return(0,g.createEffect)(()=>n.set(e())),n}function er(e,t,n){return(0,g.createEffect)(()=>n(t(e)))}function tr(e,t,n){return(0,g.createMemo)(()=>t(e),void 0,n)}function nr(e,t={}){let n=new G(e,t),r=(()=>n.proxy);return Jn(r,n),r}function we(e){if(e==null||typeof e!="object")return e;let t=e[xe];return t!==void 0?t:e}function Gt(e){return(0,g.untrack)(()=>we(e))}function rr(e){return ct(e)}function or(e){return ct(e)?e[ee]:null}function sr(e){return e&&typeof e=="object"&&ee in e?e[ee]:null}function ct(e){return!!e&&typeof e=="object"&&(g.$PROXY in e||e.__proxy===!0)}function ir(e){return e}var ar=Object.freeze({createStore:$e,createMutableStore:Wt,batch:g.batch,unwrap:we,untrackStore:Gt});function zt(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(zt);let t={};for(let n of Object.keys(e))t[n]=zt(e[n]);return t}function ur(e){return t=>{let n=zt(t);return e(n),n}}function cr(e,t={}){return()=>e}function lr(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 Jr(e,t,n){return y(()=>t(e()),void 0,n)}function Zr(e,t,n){return y(()=>e().filter(t),void 0,n)}function eo(e,t,n,r){return y(()=>e().reduce(t,n),void 0,r)}function to(e,t,n){return y(()=>e().find(t),void 0,n)}function no(e,t,n){return y(()=>e().some(t),void 0,n)}function ro(e,t,n){return y(()=>e().every(t),void 0,n)}function oo(e,t,n){return y(()=>[...e()].sort(t),void 0,n)}function so(e,t){return y(()=>[...new Set(e())],void 0,t)}function io(e,t,n){return y(()=>{let r=e.map(o=>o());return t(r)},void 0,n)}function ao(...e){return new q(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())}):N(()=>{t.next(n())}));return()=>{r.forEach(o=>{typeof o=="function"?o():o&&typeof o.unsubscribe=="function"&&o.unsubscribe()})}})}function uo(e,t,n){return y(()=>e()||t(),void 0,n)}function co(e,t,n,r){return y(()=>n(e(),t()),void 0,r)}function lo(e,t,n){return y(()=>t(e()),void 0,{equals:n,internal:!0})}function fo(e,t,n){return y(()=>{let r=e(),o={};for(let s of t)o[s]=r[s];return o},void 0,n)}function po(e,t,n){return y(()=>{let o={...e()};for(let s of t)delete o[s];return o},void 0,n)}function yo(e,t,n,r){return y(()=>e()?t():n(),void 0,r)}function To(e,t,n){return y(()=>e()?t():void 0,void 0,n)}function vo(e,t,n){let[r,o]=b(e()),s;return y(()=>{let i=e();clearTimeout(s),s=setTimeout(()=>o(()=>i),t)}),r}function bo(e,t,n){let[r,o]=b(e()),s=0,i;return y(()=>{let u=e(),a=Date.now();a-s>=t?(s=a,o(()=>u)):(clearTimeout(i),i=setTimeout(()=>{s=Date.now(),o(()=>u)},t-(a-s)))}),r}function mo(e){let t=e;for(;typeof t=="function";)t=t();return t}var ho=Symbol.for("signal");var fr=Symbol("fluixi-proxy"),So=Symbol.for("signal-node"),Ve=0,Yt=1,pt=2,Re=3,S=null,R=null,f=null,ft=null,dt=0,xo=!1,Xt=!1,Oe=0,go=1e6,z=new WeakMap,lt=null;var wo=new Map,Oo=0;function Ro(){return`node_${++Oo}_${Date.now()}`}function Ao(e){be&&wo.set(e.id,new WeakRef(e))}function ko(e,t,n){let r={id:Ro(),type:e,value:t,version:0,equals:n?.equals,name:n?.name,created:Date.now(),updated:Date.now()};return Ao(r),r}function Co(e,t){return e===t}function pr(e){throw typeof console<"u"&&console.error("Reactive error:",e),e}function Eo(e){if(f)f.indexOf(e)===-1&&f.push(e);else if(lt&<.running&&!e.pure)lt.effects.indexOf(e)===-1&<.effects.push(e);else if(!e.pure||e.computed)Jt(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;yt(r),f=o}}}function dr(e,t){for(let n=0;n<e.length;n++)t(e[n])}function te(e,t){let n=e;typeof n=="object"&&n&&fr in n&&delete n[fr];let r=ko("signal",n,{equals:t?.equals===!1?void 0:t?.equals,name:t?.name}),o=[i,u];z.set(o,new Set);let s;function i(){let a=R;if(a){a.sources?a.sources.indexOf(o)===-1&&a.sources.push(o):a.sources=[o];let l=z.get(o);l&&!l.has(a)&&l.add(a)}return n}function u(a){let l=typeof a=="function"?a(n):a,m=r.equals||Co;if(t?.equals===!1||!m(n,l)){n=l,r.value=l,r.version++,r.updated=Date.now();let v=z.get(o);if(v&&v.size>0){let P=function(p,I=!1){let A=p.state;if(!(A===Re&&p===R)){if(I&&!p.pure){A===Ve&&(p.state=Yt,xo&&(f!==null&&f.indexOf(p)===-1?f.push(p):O.push(p)));return}if(!x.has(p)&&(x.add(p),p.state=pt,A===Ve||A===Yt?O.push(p):!p.pure&&f!==null&&f.indexOf(p)===-1&&f.push(p),p.pure&&p.accessor)){let L=z.get(p.accessor);L&&dr(Array.from(L),_=>P(_,!0))}}};var d=P;let h=Array.from(v),O=[],x=new Set;dr(h,P);for(let p of O)Eo(p)}}}return i.toObservable=()=>new q(a=>{let l=!0;return Qt(()=>{let d=i();l?l=!1:a.next(d)})}),Object.defineProperty(i,ho,{value:!0,enumerable:!0}),Object.defineProperty(i,So,{value:r,enumerable:!1}),o}function Qt(e,t,n){let r={fn:e,state:pt,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=B&&Ce(B);return o&&(r.suspense=o),yr(r,t),()=>Ae(r)}function yr(e,t){if(e.sources){for(let o of e.sources){let s=z.get(o);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.owned){for(let o=0;o<e.owned.length;o++)Ae(e.owned[o]);e.owned=null}let n=R,r=S;if(R=e,S=e,dt++,dt>go)throw dt=0,R=n,S=r,new Error("Potential infinite loop detected. Exceeded maximum iterations.");try{e.state=Re;let o=e.fn(t);typeof o=="function"&&(e.cleanups?e.cleanups.push(o):e.cleanups=[o]),e.state===Re&&(e.state=Ve)}catch(o){if(bt(o)){let s=B&&Ce(B);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}pr(o)}finally{R=n,S=r}}function Jt(e){if(!(e.disposed||!e.fn||e.state===Ve)&&(e.state===pt||e.state===Yt||e.state===Re)){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++)Ae(e.owned[t]);e.owned=null}e.renderEffect?vr(e):yr(e,e.value)}}function Ae(e){if(e.disposed=!0,e.sources)for(let t of e.sources){let n=z.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++)Ae(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 yt(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=z.get(o.accessor);if(s&&s.size>0){let u=R;R=null,o.accessor(),R=u}let i=f.splice(0);for(let u of i)u.pure&&!u.computed&&u.accessor?t.indexOf(u)===-1&&t.push(u):(u.computed||!u.pure)&&n.indexOf(u)===-1&&n.push(u)}f=null;for(let o of n)(o.computed||!o.pure)&&Jt(o)}function ne(e){if(f&&Oe>0)return e();if(f&&Oe===0){let t=f,n=[];f=n,Oe++;let r;try{r=e()}finally{Oe--,f=t}let o=f;return yt(n),f=o,r}Oe++,f=[],ft=[];try{return e()}finally{Oe--,Po()}}function Po(){if(!Xt){Xt=!0,dt=0;try{for(;f&&f.length>0;){let e=f;f=null,yt(e)}if(f=null,ft){let e=ft;ft=null;for(let t=0;t<e.length;t++)Jt(e[t])}}finally{Xt=!1}}}function ke(e){let t=R;R=null;try{return e()}finally{R=t}}function Tr(e){S&&(S.cleanups?S.cleanups.push(e):S.cleanups=[e])}function _o(e){let t=Symbol("context"),n=Do(t);return{id:t,Provider:n,defaultValue:e}}function Do(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 Fo(()=>{r=ke(()=>{let o=S;return o&&(o.contexts||(o.contexts=new Map),o.contexts.set(e,t.value)),tt(()=>t.children)})}),r}}function Ce(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 Fo(e,t,n){let r={fn:e,state:pt,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=B&&Ce(B);return o&&(r.suspense=o),vr(r),()=>Ae(r)}function vr(e){if(e.sources){for(let o of e.sources){let s=z.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++)Ae(e.owned[o]);e.owned=null}let t=R,n=S,r=f;R=e,S=e,f===null&&(f=[]),e.state=Re;try{let o=e.fn(e.value);typeof o=="function"&&(e.cleanups||(e.cleanups=[]),e.cleanups.push(o)),e.value=o,e.state===Re&&(e.state=Ve)}catch(o){if(bt(o)){let s=B&&Ce(B);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}pr(o)}finally{R=t,S=n;let o=f;if(f=r,o!==r&&o&&o.length>0){let s=f;yt(o),f=s}}}var B;function br(){return B||(B=_o())}var oe=new Map,re=new Map,Uo=0,Io=Symbol.for("signal"),jo=Symbol.for("resource");function No(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:u=`_auto_${Uo++}`,staleWhileRevalidate:a=!0}=s,l=u,m=T=>`${l}:${JSON.stringify(T)}`,d=T=>i===1/0||Date.now()-T.timestamp<=i,[v,h]=te(void 0,{equals:!1}),[O,x]=te("unresolved",{equals:!1}),[P,p]=te(void 0,{equals:!1}),[I,A]=te(void 0,{equals:!1}),[L,_]=te(!1),[C,j]=te(0,{equals:!1}),K=Symbol("unset"),X=K,Ee=!1,se=!1;function M(T,D,F,$){if(re.has(D)){re.get(D).then(w=>{$()||Y(w,F)},w=>{!$()&&!F&&Zt(w)}),F||A(re.get(D));return}let ie=Promise.resolve(o(T)).then(w=>(oe.set(D,{value:w,timestamp:Date.now()}),re.delete(D),w),w=>{throw re.delete(D),w});if(re.set(D,ie),!F){Z(ie),A(ie);let w=Ke&&Ce(Ke);w&&(w.increment(),ie.finally(()=>w.decrement()))}ie.then(w=>{$()||Y(w,F)},w=>{!$()&&!F&&Zt(w)})}function Y(T,D){ne(()=>{h(()=>T),x("ready"),_(!1),A(void 0),p(void 0)})}function Zt(T){ne(()=>{p(T),x("errored"),A(void 0)})}let Ke;Qt(()=>{Ke===void 0&&(Ke=br());let T=r();if(C(),T===!1||T===null||T===void 0){X=K,ne(()=>{x("unresolved"),A(void 0),p(void 0)});return}let D=Ee,F=se;Ee=!1,se=!1;let $=m(T);F&&oe.delete($);let ie=X===K||T!==X;X=T;let w=!1;Tr(()=>{w=!0});let ae=oe.get($);if(ae&&d(ae)&&!D&&!F){(ke(O)!=="ready"||ke(v)!==ae.value)&&ne(()=>{h(()=>ae.value),x("ready"),_(!1),p(void 0)});return}if(ae&&a&&!F){ne(()=>{h(()=>ae.value),x("ready"),_(!0),p(void 0),A(void 0)}),M(T,$,!0,()=>w);return}let en=ke(O),mr=en==="ready"||en==="refreshing";ne(()=>{x(mr?"refreshing":"pending"),p(void 0),_(!1)}),M(T,$,!1,()=>w)});let He=(()=>{let T=P();if(T)throw T;if(O()==="pending"){let F=I();if(F)throw F}return v()});return Object.defineProperty(He,jo,{value:!0,enumerable:!0}),Object.defineProperty(He,Io,{value:!0,enumerable:!0}),Object.defineProperties(He,{state:{get:O},loading:{get:()=>{let T=O();return T==="pending"||T==="refreshing"}},error:{get:P},latest:{get:v},stale:{get:L}}),[He,{mutate:h,refetch:()=>{Ee=!0,j(T=>T+1)},invalidate:()=>{let T=ke(r);T!=null&&T!==!1&&oe.delete(m(T)),se=!0,j(D=>D+1)}}]}function Mo(e){let t=`${e}:`;for(let n of oe.keys())n.startsWith(t)&&oe.delete(n)}function qo(){oe.clear(),re.clear()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Fluixi=(()=>{var it=Object.defineProperty;var Tr=Object.getOwnPropertyDescriptor;var mr=Object.getOwnPropertyNames;var br=Object.prototype.hasOwnProperty;var vr=(e,t)=>{for(var n in t)it(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&&it(e,o,{get:()=>t[o],enumerable:!(r=Tr(t,o))||r.enumerable});return e};var xr=e=>Sr(it({},"__esModule",{value:!0}),e);var es={};vr(es,{$NAME:()=>Kn,$NODE:()=>Q,$PROXY:()=>Nr,$RAW:()=>qe,$SELF:()=>Qe,$SIGNAL:()=>jr,$STORE:()=>Hn,$TRACK:()=>Je,Observable:()=>j,SafeSubscriber:()=>Be,Signal:()=>Rn,Store:()=>H,StoreAPI:()=>or,Subject:()=>ct,Subscriber:()=>ie,Subscription:()=>se,SuspenseContext:()=>Ge,VERSION:()=>zt,__DEV__:()=>de,batch:()=>V,clearAllCachedResources:()=>Zo,clearCachedResourceNamespace:()=>Jo,combineSignal:()=>xo,combineSignals:()=>go,createCachedResource:()=>Qo,createChildOwner:()=>en,createComputed:()=>fn,createComputedStore:()=>Yn,createContext:()=>ce,createDebounce:()=>bn,createDebouncedResource:()=>vn,createDebouncedSignal:()=>kt,createDeferred:()=>mn,createEffect:()=>U,createErrorBoundary:()=>wn,createMemo:()=>y,createMutableStore:()=>Nt,createRenderEffect:()=>dn,createResource:()=>pe,createRoot:()=>X,createSelector:()=>Tn,createSignal:()=>b,createStore:()=>Ue,createStoreEffect:()=>Qn,createStoreMemo:()=>Jn,createSuspenseBoundary:()=>Sn,debounceSignal:()=>Eo,disposeScope:()=>tn,distinctSignal:()=>So,effect:()=>Vr,everySignal:()=>bo,filterSignal:()=>ho,findSignal:()=>To,flush:()=>hn,getNode:()=>tr,getOwner:()=>Ae,getServerData:()=>ke,getStoreNode:()=>nr,guardSignal:()=>ko,indexArray:()=>Pr,isComponent:()=>mt,isMemo:()=>yt,isOwnerDisposed:()=>nn,isProvider:()=>vt,isResource:()=>Tt,isSignal:()=>_e,isStore:()=>er,isStoreProxy:()=>et,isSuspense:()=>bt,keyArray:()=>Er,makeArrayFlat:()=>Ke,mapArray:()=>kr,mapSignal:()=>po,memo:()=>Lr,mergeSignal:()=>wo,modifiable:()=>rr,nextResourceId:()=>Ee,omitSignal:()=>Co,on:()=>yn,onCleanup:()=>D,operate:()=>gr,pickSignal:()=>Ao,produceUtil:()=>sr,provide:()=>le,provideErrorBoundary:()=>On,provideSuspense:()=>xn,readChildren:()=>We,readSignal:()=>Do,reconcileUtil:()=>ir,reduceSignal:()=>yo,reportResourceData:()=>Pe,resource:()=>An,runWithOwner:()=>fe,selectSignal:()=>Ro,setOwner:()=>dt,setResourceDataSink:()=>Ct,setResourceIdSource:()=>At,setResourceTracker:()=>Ot,setServerDataGetter:()=>Rt,signal:()=>Br,someSignal:()=>mo,sortSignal:()=>vo,startTransition:()=>ht,store:()=>ur,throttleSignal:()=>Po,trackResourcePromise:()=>Y,untrack:()=>F,untrackStore:()=>Bt,unwrap:()=>ye,useContext:()=>rn,useTransition:()=>pn,whenSignal:()=>_o,wrap:()=>Zn,zipSignal:()=>Oo});var zt="1.0.0-alpha.81";function ut(e){return typeof e=="function"&&!/^class\s/.test(Function.prototype.toString.call(e))}function Xt(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 at(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(ut(r)&&!(r instanceof e))try{r()}catch(o){console.error("Error in unsubscribe function:",o)}else if(Xt(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(ut(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())}},Be=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 Be(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 ct=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 Yt=0,Qt=1,ge=2,Le=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 Le{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(ge);lt(this)}}peek(){return this._value}},K=class extends Le{constructor(n,r){super();this._threw=!1;this._initialized=!1;this.state=ge;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===ge)break}(this.state===ge||!this._initialized)&&this.recompute(),this.state=Yt}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(ge);lt(this)}}markDirty(n){if(this.state>=n)return;let r=this.state===Yt;if(this.state=n,r){if(this.observers)for(let o of[...this.observers])o.markDirty(Qt);lt(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function lt(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 we(e){if(a.untracked)return e();a.untracked=!0;try{return e()}finally{a.untracked=!1}}function Jt(){return a.consumer}function Zt(e){return!!(e.observers&&e.observers.size)||!!(e.watchers&&e.watchers.size)}function en(e){let t=Re(e);return e&&(e.owned??=[]).push(t),t}function tn(e,t=!0){Oe(e,t)}function nn(e){return!!e&&e.disposed===!0}function Re(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=Re(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 rn(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 Ve(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=Re(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 on(e){a.onSuspend=e}function sn(e){return a.onSuspend?(a.onSuspend(e,a.owner),!0):!1}function un(e){a.onError=e}function Ae(){return a.owner}function dt(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 Oe(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)Oe(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 X(e){let t=Re(a.owner);a.owner&&(a.owner.owned??=[]).push(t);let n=a.owner;a.owner=t;try{return e(()=>Oe(t))}finally{a.owner=n}}function an(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(Ce)))}function Ce(){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 cn(){a.batchDepth===0&&Ce()}function pt(e){a.batchDepth++;try{return e()}finally{--a.batchDepth===0&&Ce()}}var ft=class{constructor(t){this.queued=!1;this.disposed=!1;this.owner=Re(a.owner),a.owner&&(a.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new K(()=>{Oe(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),Oe(this.owner))}};function $e(e){let t=new ft(e);return()=>t.dispose()}function Ar(e){return!!e&&typeof e.then=="function"}an(()=>{});var ln=Symbol.for("signal"),Cr=Symbol.for("memo"),_r=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),cn(),i});return Object.defineProperty(r,ln,{value:!0,enumerable:!0}),Object.defineProperty(r,_r,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[r,o]}function y(e,t,n){let r=t,o=Ae(),s=new K(()=>fe(o,()=>{try{return r=e(r)}catch(c){if(Ar(c))return sn(c),r;throw c}}),{equals:n?.equals}),i=(()=>s.get());return Object.defineProperty(i,ln,{value:!0,enumerable:!0}),Object.defineProperty(i,Cr,{value:!0,enumerable:!0}),i}function U(e,t){let n=t;return $e(()=>{n=e(n)})}function fn(e,t){let n=t;$e(()=>{n=e(n)})}function dn(e,t){let n=t;return $e(()=>{n=e(n)})}function V(e){return pt(e)}function F(e){return we(e)}function ht(e){return pt(e),Promise.resolve()}function pn(){return[()=>!1,ht]}function hn(){return Ce(),Promise.resolve()}function yn(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=we(()=>t(c,o,i));return o=c,u}}function kr(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;X(g=>{S=g;let[_,h]=b(u);m=h,p=t(f,_)});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,_;X(h=>{_=h;let[I,A]=b(p);g=A;let B=y(k=>{let q=(e()||[])[I()];return q??k},i[p]);O=n(B,I)}),u.push({rendered:O,dispose:_,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];X(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 Dr=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,de=typeof process>"u"?Dr:!1,Fr=Symbol.for("signal"),Ir=Symbol.for("memo"),qr=Symbol.for("resource");function _e(e){return typeof e=="function"&&e[Fr]===!0}function yt(e){return typeof e=="function"&&e[Ir]===!0}function Tt(e){return typeof e=="function"&&e[qr]===!0}function mt(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function bt(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function vt(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function Ke(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Ke(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var St=null;function Ot(e){St=e}function Y(e){St&&St(e)}var xt=null;function Rt(e){xt=e}function ke(e){return xt?xt(e):void 0}var gt=null;function At(e){gt=e}function Ee(){return gt?gt():void 0}var wt=null;function Ct(e){wt=e}function Pe(e,t){wt&&wt(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 Ur(e){return!!e&&typeof e.then=="function"}var _t=Symbol();function pe(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:Ee(),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}),[_,h]=b(void 0,{equals:!1}),I=_t,A=!1;U(()=>{let C=r();if(_(),C===!1||C===null||C===void 0){I=_t,V(()=>{S("unresolved"),g(void 0),p(void 0)});return}let q=A;if(A=!1,I!==_t&&C===I&&!q)return;if(I=C,c){c=!1;return}let $=!1;D(()=>$=!0);let G=F(m),xe=F(u),ne=G==="ready"||G==="refreshing";V(()=>{S(ne?"refreshing":"pending"),p(void 0)});try{let M=o(C,{value:xe,refetching:ne});Ur(M)?(g(M),Y(M),M.then(z=>{$||(s!==void 0&&Pe(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"},k=(()=>{let C=v();if(C)throw C;if(B()){let q=O();if(q)throw q}return u()});return Object.defineProperties(k,{state:{get:m},loading:{get:B},error:{get:v},latest:{get:u}}),Object.defineProperty(k,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(k,Symbol.for("signal"),{value:!0,enumerable:!0}),[k,{mutate:f,refetch:()=>{A=!0,h(void 0)}}]}function kt(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 Mr(e){return e!=null&&e!==""}function vn(e,t,n={}){let{delay:r=300,initialValue:o,shouldFetch:s=Mr}=n,[i,c,u]=kt(e,r),f=()=>s(i())?i():!1,[v,{refetch:p}]=pe(f,t,o===void 0?{}:{initialValue:o});return[v,{...u,query:i,setQuery:c,refetch:p}]}function He(e){if(typeof e=="function"&&!e.length){let t=e();return _e(t)?t:He(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=He(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function We(e){let t=y(e);return de?y(()=>He(t()),void 0,{name:"children"}):y(()=>He(t()))}var Ge=ce();on((e,t)=>{let n=Ve(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();un((e,t)=>{let n=Ve(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:we,currentComputed:Jt,hasSinks:Zt}};var jr=Symbol.for("signal"),Nr=Symbol.for("fluixi-proxy");function Br(e,t){let[n,r]=b(e,t);return Object.assign(n,{set:r})}function Lr(e,t,n){return y(e,t,n)}function Vr(e,t){return U(e,t)}function An(...e){let[t,n]=pe(...e);return Object.assign(t,n)}var $r="__fluixi_signal_next_state__",Kr=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},l=globalThis[$r]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Kr,onSuspend:null,onError:null},Cn=0,_n=1,De=2,kn=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))}},Hr=class extends kn{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(De);Et(this)}}peek(){return this._value}},En=class extends kn{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=De,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===_n&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===De)break}(this.state===De||!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(De);Et(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(_n);Et(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function Et(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var Wr=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 zr(e){l.onSuspend=e}function Xr(e){return l.onSuspend?(l.onSuspend(e,l.owner),!0):!1}function Yr(e){l.onError=e}function Qr(){return l.owner}function In(e,t){let n=l.owner;l.owner=e;try{return t()}finally{l.owner=n}}function Pt(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)Pt(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function Jr(e){l.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Zr(e){e.queued||(e.queued=!0,l.queue.push(e),!l.scheduled&&l.batchDepth===0&&(l.scheduled=!0,l.hostSchedule(Dt)))}function Dt(){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 eo(){l.batchDepth===0&&Dt()}function to(e){l.batchDepth++;try{return e()}finally{--l.batchDepth===0&&Dt()}}var no=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(()=>{Pt(this.owner,!1),In(this.owner,()=>{let t=e();typeof t=="function"&&(this.owner.cleanups??=[]).push(t)})}),this.watcher=new Wr(()=>Zr(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),Pt(this.owner))}};function ro(e){let t=new no(e);return()=>t.dispose()}function oo(e){return!!e&&typeof e.then=="function"}Jr(()=>{});var qn=Symbol.for("signal"),so=Symbol.for("memo"),io=Symbol.for("signal-node");function Ft(e,t){let n=new Hr(e,{equals:t?.equals}),r=(()=>n.get()),o=(s=>{let i=typeof s=="function"?s(n.peek()):s;return n.set(i),eo(),i});return Object.defineProperty(r,qn,{value:!0,enumerable:!0}),Object.defineProperty(r,io,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[r,o]}function ze(e,t,n){let r=t,o=Qr(),s=new En(()=>In(o,()=>{try{return r=e(r)}catch(c){if(oo(c))return Xr(c),r;throw c}}),{equals:n?.equals}),i=(()=>s.get());return Object.defineProperty(i,qn,{value:!0,enumerable:!0}),Object.defineProperty(i,so,{value:!0,enumerable:!0}),i}function Fe(e,t){let n=t;return ro(()=>{n=e(n)})}function It(e){return to(e)}function Un(e){return Gr(e)}var pi=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0;var uo=Dn();zr((e,t)=>{let n=Fn(t,uo);n&&(n.increment(),e.finally(()=>n.decrement()))});var ao=Dn();Yr((e,t)=>{let n=Fn(t,ao);return n?(n.setError(e),!0):!1});var Xe=Symbol.for("fluixi-proxy");var qe=Symbol("store-raw"),Q=Symbol("store-node"),Mn=Symbol("store-has"),Qe=Symbol("store-self"),Je=Symbol("store-track"),Kn=Symbol("store-name"),Hn=Symbol("store-store"),jn=new WeakMap,Nn=new WeakMap;function Wn(e){let[t,n]=Ft(e),r=t;return r.$=n,r}function Ze(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=Wn(n)),r}function Ln(e){let t=Ze(e);(t.all||(t.all=Wn()))()}function Vn(e,t){e.$(typeof t=="function"?()=>t:t)}function Gn(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(!Gn(e))return e;let t=Nn.get(e);if(t)return t;let n=new Proxy(e,co);return Nn.set(e,n),n}var co={get(e,t,n){if(t===qe||t===Q)return e;if(t===Xe)return n;if(t===Mn)return i=>i in e;if(t==="__proxy")return!0;if(t===Je||t===Qe)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(Ze(e),t,r)();return Gn(s)?Ye(s):s},set(){return!0},deleteProperty(e,t){return t in e&&Ie(e,t,void 0),!0},has(e,t){return t===qe||t===Xe||t===Q||t===Mn||t===Qe||t===Je?!0:(Bn(Ze(e),t,e[t])(),t in e)},ownKeys(e){return Ln(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function Ie(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&&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 Ut(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)?Ut(o,r):Ie(e,n,r)}}function jt(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])?[]:{},Ie(e,i,c)),e=c}let o=t[r];if(o==="*"){if(Array.isArray(e))for(let s=0;s<e.length;s++)Ie(e,s,$n(n,e[s]));return}Ie(e,o,$n(n,e[o]))}function qt(e,t,n){zn(e,jt(t),n)}function lo(e,t){let n=t[0];if(typeof n=="function"&&t.length===1){let r=n(e);r&&r!==e&&Ut(e,r);return}if(Array.isArray(n)&&t.length===1){for(let r of n)Array.isArray(r)&&qt(e,r[0],r[1]);return}if(n&&typeof n=="object"&&!Array.isArray(n)&&t.length===1){Ut(e,n);return}if(Array.isArray(t[1])&&t.length>=3){qt(e,`${n}.${t[1].join(".")}`,t[2]);return}qt(e,String(n),t[1])}function Mt(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Mt);let t={};for(let n of Object.keys(e))t[n]=Mt(e[n]);return t}function he(e,t){let n=e;for(let r of jt(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)=>It(()=>lo(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 ye(this.state);let n=this.state;for(let r of jt(t)){if(n==null)return;n=n[r]}return ye(n)}select(t){return ze(()=>t(this.state))}subscribe(t){return Fe(()=>t(this.state))}watch(t,n){let r;return Fe(()=>{let o=t(this.state);Object.is(o,r)||(n(o,r),r=o)})}reactive(t){return ze(()=>this.state[t])}produce(t){this.set((n=>{let r=Mt(n);return t(r),r}))}reconcile(t,n={}){this.set(t)}push(t,...n){let r=he(this.root,t);this.set(t,r.concat(n))}pop(t){let n=he(this.root,t).slice(),r=n.pop();return this.set(t,n),r}shift(t){let n=he(this.root,t).slice(),r=n.shift();return this.set(t,n),r}splice(t,n,r,...o){let s=he(this.root,t).slice(),i=s.splice(n,r,...o);return this.set(t,s),i}insert(t,n,r){let o=he(this.root,t).slice();o.splice(n,0,r),this.set(t,o)}removeAt(t,n){let r=he(this.root,t).slice(),o=r.splice(n,1);return this.set(t,r),o}toObservable(){let[t]=Ft(this.state);return t.toObservable()}dispose(){}},fo=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","unwrap","toObservable"];function Xn(e,t){for(let n of fo)e[n]=t[n].bind(t);e.$=t.reactive.bind(t)}function Ue(e,t={immutable:!0}){let n=new H(e,t);return Xn(n.set,n),[n.proxy,n.set]}function Nt(e,t={}){return new H(e,{...t,immutable:!1})}function Yn(e,t={}){let n=new H(e(),t);return Fe(()=>n.set(e())),n}function Qn(e,t,n){return Fe(()=>n(t(e)))}function Jn(e,t,n){return ze(()=>t(e),void 0,n)}function Zn(e,t={}){let n=new H(e,t),r=(()=>n.proxy);return Xn(r,n),r}function ye(e){if(e==null||typeof e!="object")return e;let t=e[qe];return t!==void 0?t:e}function Bt(e){return Un(()=>ye(e))}function er(e){return et(e)}function tr(e){return et(e)?e[Q]:null}function nr(e){return e&&typeof e=="object"&&Q in e?e[Q]:null}function et(e){return!!e&&typeof e=="object"&&(Xe in e||e.__proxy===!0)}function rr(e){return e}var or=Object.freeze({createStore:Ue,createMutableStore:Nt,batch:It,unwrap:ye,untrackStore:Bt});function Lt(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Lt);let t={};for(let n of Object.keys(e))t[n]=Lt(e[n]);return t}function sr(e){return t=>{let n=Lt(t);return e(n),n}}function ir(e,t={}){return()=>e}function ur(e,t){let[n,r]=Ue(e,t);return new Proxy(n,{get:(o,s)=>s==="set"?r:o[s],has:(o,s)=>s==="set"||Reflect.has(o,s)})}function po(e,t,n){return y(()=>t(e()),void 0,n)}function ho(e,t,n){return y(()=>e().filter(t),void 0,n)}function yo(e,t,n,r){return y(()=>e().reduce(t,n),void 0,r)}function To(e,t,n){return y(()=>e().find(t),void 0,n)}function mo(e,t,n){return y(()=>e().some(t),void 0,n)}function bo(e,t,n){return y(()=>e().every(t),void 0,n)}function vo(e,t,n){return y(()=>[...e()].sort(t),void 0,n)}function So(e,t){return y(()=>[...new Set(e())],void 0,t)}function xo(e,t,n){return y(()=>{let r=e.map(o=>o());return t(r)},void 0,n)}function go(...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 wo(e,t,n){return y(()=>e()||t(),void 0,n)}function Oo(e,t,n,r){return y(()=>n(e(),t()),void 0,r)}function Ro(e,t,n){return y(()=>t(e()),void 0,{equals:n,internal:!0})}function Ao(e,t,n){return y(()=>{let r=e(),o={};for(let s of t)o[s]=r[s];return o},void 0,n)}function Co(e,t,n){return y(()=>{let o={...e()};for(let s of t)delete o[s];return o},void 0,n)}function _o(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 Eo(e,t,n){let[r,o]=b(e()),s;return y(()=>{let i=e();clearTimeout(s),s=setTimeout(()=>o(()=>i),t)}),r}function Po(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 Do(e){let t=e;for(;typeof t=="function";)t=t();return t}var Fo=Symbol.for("signal");var ar=Symbol("fluixi-proxy"),Io=Symbol.for("signal-node"),Me=0,$t=1,ot=2,me=3,x=null,R=null,d=null,nt=null,rt=0,qo=!1,Vt=!1,Te=0,Uo=1e6,W=new WeakMap,tt=null;var Mo=new Map,jo=0;function No(){return`node_${++jo}_${Date.now()}`}function Bo(e){de&&Mo.set(e.id,new WeakRef(e))}function Lo(e,t,n){let r={id:No(),type:e,value:t,version:0,equals:n?.equals,name:n?.name,created:Date.now(),updated:Date.now()};return Bo(r),r}function Vo(e,t){return e===t}function lr(e){throw typeof console<"u"&&console.error("Reactive error:",e),e}function $o(e){if(d)d.indexOf(e)===-1&&d.push(e);else if(tt&&tt.running&&!e.pure)tt.effects.indexOf(e)===-1&&tt.effects.push(e);else if(!e.pure||e.computed)Ht(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;st(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=Lo("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 f=W.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||Vo;if(t?.equals===!1||!v(n,f)){n=f,r.value=f,r.version++,r.updated=Date.now();let m=W.get(o);if(m&&m.size>0){let _=function(h,I=!1){let A=h.state;if(!(A===me&&h===R)){if(I&&!h.pure){A===Me&&(h.state=$t,qo&&(d!==null&&d.indexOf(h)===-1?d.push(h):O.push(h)));return}if(!g.has(h)&&(g.add(h),h.state=ot,A===Me||A===$t?O.push(h):!h.pure&&d!==null&&d.indexOf(h)===-1&&d.push(h),h.pure&&h.accessor)){let B=W.get(h.accessor);B&&cr(Array.from(B),k=>_(k,!0))}}};var p=_;let S=Array.from(m),O=[],g=new Set;cr(S,_);for(let h of O)$o(h)}}}return i.toObservable=()=>new j(u=>{let f=!0;return Kt(()=>{let p=i();f?f=!1:u.next(p)})}),Object.defineProperty(i,Fo,{value:!0,enumerable:!0}),Object.defineProperty(i,Io,{value:r,enumerable:!1}),o}function Kt(e,t,n){let r={fn:e,state:ot,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&&Se(N);return o&&(r.suspense=o),fr(r,t),()=>be(r)}function fr(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++)be(e.owned[o]);e.owned=null}let n=R,r=x;if(R=e,x=e,rt++,rt>Uo)throw rt=0,R=n,x=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=Me)}catch(o){if(at(o)){let s=N&&Se(N);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}lr(o)}finally{R=n,x=r}}function Ht(e){if(!(e.disposed||!e.fn||e.state===Me)&&(e.state===ot||e.state===$t||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++)be(e.owned[t]);e.owned=null}e.renderEffect?pr(e):fr(e,e.value)}}function be(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++)be(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 st(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=W.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)&&Ht(o)}function Z(e){if(d&&Te>0)return e();if(d&&Te===0){let t=d,n=[];d=n,Te++;let r;try{r=e()}finally{Te--,d=t}let o=d;return st(n),d=o,r}Te++,d=[],nt=[];try{return e()}finally{Te--,Ko()}}function Ko(){if(!Vt){Vt=!0,rt=0;try{for(;d&&d.length>0;){let e=d;d=null,st(e)}if(d=null,nt){let e=nt;nt=null;for(let t=0;t<e.length;t++)Ht(e[t])}}finally{Vt=!1}}}function ve(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 Ho(e){let t=Symbol("context"),n=Wo(t);return{id:t,Provider:n,defaultValue:e}}function Wo(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=ve(()=>{let o=x;return o&&(o.contexts||(o.contexts=new Map),o.contexts.set(e,t.value)),We(()=>t.children)})}),r}}function Se(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:ot,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&&Se(N);return o&&(r.suspense=o),pr(r),()=>be(r)}function pr(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++)be(e.owned[o]);e.owned=null}let t=R,n=x,r=d;R=e,x=e,d===null&&(d=[]),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=Me)}catch(o){if(at(o)){let s=N&&Se(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;st(o),d=s}}}var N;function hr(){return N||(N=Ho())}var te=new Map,ee=new Map,zo=0,Xo=Symbol.for("signal"),Yo=Symbol.for("resource");function Qo(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_${zo++}`,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}),[_,h]=J(void 0,{equals:!1}),[I,A]=J(void 0,{equals:!1}),[B,k]=J(!1),[C,q]=J(0,{equals:!1}),$=Symbol("unset"),G=$,xe=!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&&Wt(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){Y(re),A(re);let w=je&&Se(je);w&&(w.increment(),re.finally(()=>w.decrement()))}re.then(w=>{L()||z(w,P)},w=>{!L()&&!P&&Wt(w)})}function z(T,E){Z(()=>{S(()=>T),g("ready"),k(!1),A(void 0),h(void 0)})}function Wt(T){Z(()=>{h(T),g("errored"),A(void 0)})}let je;Kt(()=>{je===void 0&&(je=hr());let T=r();if(C(),T===!1||T===null||T===void 0){G=$,Z(()=>{g("unresolved"),A(void 0),h(void 0)});return}let E=xe,P=ne;xe=!1,ne=!1;let L=v(T);P&&te.delete(L);let re=G===$||T!==G;G=T;let w=!1;dr(()=>{w=!0});let oe=te.get(L);if(oe&&p(oe)&&!E&&!P){(ve(O)!=="ready"||ve(m)!==oe.value)&&Z(()=>{S(()=>oe.value),g("ready"),k(!1),h(void 0)});return}if(oe&&u&&!P){Z(()=>{S(()=>oe.value),g("ready"),k(!0),h(void 0),A(void 0)}),M(T,L,!0,()=>w);return}let Gt=ve(O),yr=Gt==="ready"||Gt==="refreshing";Z(()=>{g(yr?"refreshing":"pending"),h(void 0),k(!1)}),M(T,L,!1,()=>w)});let Ne=(()=>{let T=_();if(T)throw T;if(O()==="pending"){let P=I();if(P)throw P}return m()});return Object.defineProperty(Ne,Yo,{value:!0,enumerable:!0}),Object.defineProperty(Ne,Xo,{value:!0,enumerable:!0}),Object.defineProperties(Ne,{state:{get:O},loading:{get:()=>{let T=O();return T==="pending"||T==="refreshing"}},error:{get:_},latest:{get:m},stale:{get:B}}),[Ne,{mutate:S,refetch:()=>{xe=!0,q(T=>T+1)},invalidate:()=>{let T=ve(r);T!=null&&T!==!1&&te.delete(v(T)),ne=!0,q(E=>E+1)}}]}function Jo(e){let t=`${e}:`;for(let n of te.keys())n.startsWith(t)&&te.delete(n)}function Zo(){te.clear(),ee.clear()}return xr(es);})();
|
|
1
|
+
"use strict";var Fluixi=(()=>{var St=Object.defineProperty;var Kr=Object.getOwnPropertyDescriptor;var Hr=Object.getOwnPropertyNames;var Wr=Object.prototype.hasOwnProperty;var Gr=(e,t)=>{for(var n in t)St(e,n,{get:t[n],enumerable:!0})},zr=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Hr(t))!Wr.call(e,o)&&o!==n&&St(e,o,{get:()=>t[o],enumerable:!(r=Kr(t,o))||r.enumerable});return e};var Xr=e=>zr(St({},"__esModule",{value:!0}),e);var Bs={};Gr(Bs,{$NAME:()=>mr,$NODE:()=>ee,$PROXY:()=>yo,$RAW:()=>we,$SELF:()=>ct,$SIGNAL:()=>ho,$STORE:()=>br,$TRACK:()=>lt,Observable:()=>M,SafeSubscriber:()=>Ye,Signal:()=>Jn,Store:()=>G,StoreAPI:()=>Dr,Subject:()=>xt,Subscriber:()=>ce,Subscription:()=>ae,SuspenseContext:()=>st,VERSION:()=>Xe,__DEV__:()=>Te,batch:()=>$,clearAllCachedResources:()=>Ls,clearCachedResourceNamespace:()=>Ms,combineSignal:()=>as,combineSignals:()=>cs,createCachedResource:()=>Ns,createChildOwner:()=>Cn,createComputed:()=>Nn,createComputedStore:()=>Or,createContext:()=>he,createDebounce:()=>Hn,createDebouncedResource:()=>Wn,createDebouncedSignal:()=>Ht,createDeferred:()=>Kn,createEffect:()=>U,createErrorBoundary:()=>Yn,createMemo:()=>y,createMutableStore:()=>on,createRenderEffect:()=>Mn,createResource:()=>me,createRoot:()=>J,createSelector:()=>$n,createSignal:()=>m,createStore:()=>He,createStoreEffect:()=>Rr,createStoreMemo:()=>Ar,createSuspenseBoundary:()=>Gn,debounceSignal:()=>Ts,disposeScope:()=>_n,distinctSignal:()=>us,effect:()=>mo,everySignal:()=>ss,filterSignal:()=>ts,findSignal:()=>rs,flush:()=>Bn,getNode:()=>_r,getOwner:()=>je,getServerData:()=>Ne,getStoreNode:()=>Er,guardSignal:()=>vs,indexArray:()=>io,isComponent:()=>Ft,isMemo:()=>Pt,isOwnerDisposed:()=>En,isProvider:()=>jt,isResource:()=>Dt,isSignal:()=>Ue,isStore:()=>Cr,isStoreProxy:()=>ht,isSuspense:()=>It,keyArray:()=>so,makeArrayFlat:()=>nt,mapArray:()=>oo,mapSignal:()=>es,memo:()=>To,mergeSignal:()=>ls,modifiable:()=>Pr,nextResourceId:()=>Me,observeReactiveNodes:()=>Ot,omitSignal:()=>hs,on:()=>Vn,onCleanup:()=>k,operate:()=>Yr,pickSignal:()=>ps,produceUtil:()=>Fr,provide:()=>ye,provideErrorBoundary:()=>Qn,provideSuspense:()=>zn,readChildren:()=>ot,readSignal:()=>bs,reconcileUtil:()=>Ir,reduceSignal:()=>ns,reportReactiveBinding:()=>gn,reportReactiveContext:()=>le,reportReactiveContextCreated:()=>Je,reportReactiveDirective:()=>xn,reportReactiveProps:()=>wn,reportResourceData:()=>Le,resource:()=>Zn,runWithOwner:()=>ve,selectSignal:()=>ds,setOwner:()=>Ct,setResourceDataSink:()=>$t,setResourceIdSource:()=>Vt,setResourceTracker:()=>Lt,setServerDataGetter:()=>Bt,signal:()=>vo,someSignal:()=>os,sortSignal:()=>is,startTransition:()=>Et,store:()=>jr,throttleSignal:()=>ms,trackResourcePromise:()=>Z,untrack:()=>I,untrackStore:()=>sn,unwrap:()=>Oe,useContext:()=>Pn,useTransition:()=>Ln,whenSignal:()=>ys,wrap:()=>kr,zipSignal:()=>fs});var Xe="1.0.0-alpha.83";function gt(e){return typeof e=="function"&&!/^class\s/.test(Function.prototype.toString.call(e))}function hn(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 wt(e){return e instanceof Promise||!!e&&(typeof e=="object"||typeof e=="function")&&"then"in e}var ae=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(gt(r)&&!(r instanceof e))try{r()}catch(o){console.error("Error in unsubscribe function:",o)}else if(hn(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(gt(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 ce=class extends ae{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())}},Ye=class extends ce{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 Yr(e){return new ce(e.next,e.error,e.complete)}var M=class extends ae{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 ce?o=t:o=new Ye(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 xt=class extends M{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 M(r=>this.subscribe(r))}};var Qr="__fluixi_signal_next_state__",Jr=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},c=globalThis[Qr]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Jr,onSuspend:null,onError:null,observer:null};function Ot(e){return c.observer=e,()=>{c.observer===e&&(c.observer=null)}}var _=[],Qe;function vn(e,t){if(!c.observer)return t();let n=Qe;Qe=e;try{return t()}finally{Qe=n}}function Q(e){let t=c.observer;t&&t.created(e.parents===void 0?{...e,parents:_,origin:e.origin??Qe}:e)}function Tn(e){return c.observer?(_.push(e),!0):!1}function mn(){_.pop()}function bn(e){c.observer?.ran?.(e)}function Sn(e,t){c.observer?.wrote?.(e,t)}function gn(e,t,n,r){let o=c.observer;!o?.bound||!_.length||o.bound(_[_.length-1],e,t,n,r)}function wn(e){let t=c.observer;!t?.props||!_.length||!e||t.props(_[_.length-1],e)}function xn(e,t,n,r){let o=c.observer;!o?.directive||!_.length||o.directive(_[_.length-1],e,t,n,r)}function Je(e){c.observer?.contextCreated?.(e)}function le(e,t,n){let r=c.observer;!r?.context||!_.length||r.context(_[_.length-1],e,t,n)}function Rt(e,t,n){c.observer?.moved?.(e,t,n)}function H(e){c.observer?.disposed?.(e)}var Zr="__FLUIXI_DEVTOOLS_HOOK__",yn=globalThis[Zr];if(typeof yn?.inject=="function")try{yn.inject({observeReactiveNodes:Ot,version:Xe})}catch{}function fe(){return c.observer!=null}var On=0,Rn=1,Pe=2,Ze=class{constructor(){this.observers=null;this.watchers=null;this.version=0}updateIfNecessary(){}track(){if(c.untracked)return;let t=c.consumer;t&&((this.observers??=new Set).add(t),(t.sources??=new Set).add(this))}},de=class extends Ze{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++,Sn(this,c.consumer),this.observers)for(let n of[...this.observers])n.markDirty(Pe);At(this)}}peek(){return this._value}},W=class extends Ze{constructor(n,r){super();this._threw=!1;this._initialized=!1;this.state=Pe;this.sources=null;this._fn=n,this._equals=r?.equals===!1?()=>!1:r?.equals??Object.is}get(){if(c.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===Rn&&this.sources){for(let n of this.sources)if(n.updateIfNecessary(),this.state===Pe)break}(this.state===Pe||!this._initialized)&&this.recompute(),this.state=On}recompute(){if(this.sources){for(let f of this.sources)f.observers?.delete(this);this.sources.clear()}let n=c.consumer,r=c.untracked,o=Tn(this);c.consumer=this,c.untracked=!1;let s,i=!1,u;try{s=this._fn()}catch(f){i=!0,u=f,s=this._value}finally{c.consumer=n,c.untracked=r,o&&mn()}let a=!this._initialized||this._threw!==i||(i?u!==this._error:!this._equals(this._value,s));if(this._initialized=!0,this._threw=i,this._error=u,this._value=s,bn(this),a){if(this.version++,this.observers)for(let f of[...this.observers])f.markDirty(Pe);At(this)}}markDirty(n){if(this.state>=n)return;let r=this.state===On;if(this.state=n,r){if(this.observers)for(let o of[...this.observers])o.markDirty(Rn);At(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function At(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var pe=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 De(e){if(c.untracked)return e();c.untracked=!0;try{return e()}finally{c.untracked=!1}}function An(){return c.consumer}function kn(e){return!!(e.observers&&e.observers.size)||!!(e.watchers&&e.watchers.size)}function Cn(e){let t=Ie(e);return e&&(e.owned??=[]).push(t),t}function _n(e,t=!0){Fe(e,t)}function En(e){return!!e&&e.disposed===!0}function Ie(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function he(e,t){let n=Symbol(t??"context");return Je(n),{id:n,defaultValue:e,Provider:o=>{le(n,"provide",o.value);let s=c.owner,i=Ie(s);(i.contexts=new Map).set(n,o.value),s&&(s.owned??=[]).push(i),c.owner=i;try{return o.children}finally{c.owner=s}}}}function Pn(e){let t=c.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id)){let n=t.contexts.get(e.id);return le(e.id,"read",n),n}t=t.parent}return le(e.id,"read",e.defaultValue),e.defaultValue}function et(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 ye(e,t,n){let r=Ie(c.owner);(r.contexts=new Map).set(e.id,t),c.owner&&(c.owner.owned??=[]).push(r);let o=c.owner;c.owner=r;try{return n()}finally{c.owner=o}}function Dn(e){c.onSuspend=e}function Fn(e){return c.onSuspend?(c.onSuspend(e,c.owner),!0):!1}function In(e){c.onError=e}function je(){return c.owner}function Ct(e){let t=c.owner;return c.owner=e,t}function ve(e,t){let n=c.owner;c.owner=e;try{return t()}finally{c.owner=n}}function k(e){if(c.owner){if(c.owner.disposed){e();return}(c.owner.cleanups??=[]).push(e)}}function Fe(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)Fe(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 J(e){let t=Ie(c.owner);c.owner&&(c.owner.owned??=[]).push(t);let n=c.owner;c.owner=t;try{return e(()=>Fe(t))}finally{c.owner=n}}function jn(e){c.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function eo(e){e.queued||(e.queued=!0,c.queue.push(e),!c.scheduled&&c.batchDepth===0&&(c.scheduled=!0,c.hostSchedule(qe)))}function qe(){if(c.scheduled=!1,c.flushing)return;c.flushing=!0;let e=0;try{for(;c.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=c.queue;c.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{c.flushing=!1}}function qn(){c.batchDepth===0&&qe()}function _t(e){c.batchDepth++;try{return e()}finally{--c.batchDepth===0&&qe()}}var kt=class{constructor(t,n=!1){this.queued=!1;this.disposed=!1;this.owner=Ie(c.owner),c.owner&&(c.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new W(()=>{Fe(this.owner,!1),ve(this.owner,()=>{let r=t();typeof r=="function"&&(this.owner.cleanups??=[]).push(r)})}),Q({kind:"effect",node:this.computed,handle:this,internal:!n}),this.watcher=new pe(()=>eo(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"&&c.onSuspend){c.onSuspend(t,this.owner);return}if(c.onError&&c.onError(t,this.owner))return;throw t}}}dispose(){this.disposed||(this.disposed=!0,H(this.computed),this.watcher.unwatch(this.computed),Fe(this.owner))}};function tt(e,t=!1){let n=new kt(e,t);return()=>n.dispose()}function to(e){return!!e&&typeof e.then=="function"}jn(()=>{});var Un=Symbol.for("signal"),no=Symbol.for("memo"),ro=Symbol.for("signal-node");function m(e,t){let n=new de(e,{equals:t?.equals}),r=(()=>n.get()),o=(s=>{let i=typeof s=="function"?s(n.peek()):s;return n.set(i),qn(),i});return Object.defineProperty(r,Un,{value:!0,enumerable:!0}),Object.defineProperty(r,ro,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),Q({kind:"signal",node:n,handle:r,name:t?.name,set:o}),fe()&&k(()=>H(n)),[r,o]}function y(e,t,n){let r=t,o=je(),s=new W(()=>ve(o,()=>{try{return r=e(r)}catch(u){if(to(u))return Fn(u),r;throw u}}),{equals:n?.equals}),i=(()=>s.get());return Object.defineProperty(i,Un,{value:!0,enumerable:!0}),Object.defineProperty(i,no,{value:!0,enumerable:!0}),Q({kind:"memo",node:s,handle:i,name:n?.name}),fe()&&k(()=>H(s)),i}function U(e,t){let n=t;return tt(()=>{n=e(n)},!0)}function Nn(e,t){let n=t;tt(()=>{n=e(n)})}function Mn(e,t){let n=t;return tt(()=>{n=e(n)})}function $(e){return _t(e)}function I(e){return De(e)}function Et(e){return _t(e),Promise.resolve()}function Ln(){return[()=>!1,Et]}function Bn(){return qe(),Promise.resolve()}function Vn(e,t,n){let r=Array.isArray(e),o,s=n?.defer??!1;return i=>{let u=r?e.map(f=>f()):e();if(s){s=!1,o=u;return}let a=De(()=>t(u,o,i));return o=u,a}}function oo(e,t,n){let r=[];return k(()=>{for(let o of r)o.dispose();r=[]}),y(()=>{let o=e()||[];return I(()=>{if(o.length===0){for(let a of r)a.dispose();return r=[],n?.fallback?n.fallback():[]}let s=new Map;for(let a of r)s.has(a.item)||s.set(a.item,a);let i=[],u=new Set;for(let a=0;a<o.length;a++){let f=o[a],b=s.get(f);if(b&&!u.has(b))b.setIndex(a),i.push(b),u.add(b);else{let p,T,S;J(w=>{S=w;let[E,h]=m(a,{name:"row index"});T=h,p=t(f,E)});let O={item:f,rendered:p,dispose:S,setIndex:T};i.push(O),u.add(O)}}for(let a of r)u.has(a)||a.dispose();return r=i,i.map(a=>a.rendered)})},void 0,{name:"mapArray"})}function so(e,t,n,r){let o=[],s=[];return k(()=>{for(let i of s)i.dispose();o=[],s=[]}),y(()=>{let i=e()||[];return I(()=>{if(i.length===0){for(let p of s)p.dispose();return o=[],s=[],r?.fallback?r.fallback():[]}let u=new Map;for(let p=0;p<o.length;p++)u.set(o[p],s[p]);let a=[],f=[],b=new Set;for(let p=0;p<i.length;p++){let T=t(i[p]),S=u.get(T);if(S&&!b.has(T))S.setIndex(p),a.push(S);else{let O,w,E;J(h=>{E=h;let[j,A]=m(p,{name:"row index"});w=A;let B=y(P=>{let q=(e()||[])[j()];return q??P},i[p]);O=n(B,j)}),a.push({rendered:O,dispose:E,setIndex:w})}f.push(T),b.add(T)}for(let[p,T]of u)b.has(p)||T.dispose();return o=f,s=a,a.map(p=>p.rendered)})},void 0,{name:"keyArray"})}function io(e,t,n){let r=[];return k(()=>{for(let o of r)o.dispose();r=[]}),y(()=>{let o=e()||[];return I(()=>{if(o.length===0){for(let a of r)a.dispose();return r=[],n?.fallback?n.fallback():[]}let s=r.length,i=o.length;for(let a=s;a<i;a++){let f,b,p,T=o[a];J(S=>{p=S;let[O,w]=m(T);b=w,f=t(O,a)}),r.push({rendered:f,setItem:b,dispose:p})}for(let a=i;a<s;a++)r[a].dispose();i<s&&(r=r.slice(0,i));let u=Math.min(s,i);for(let a=0;a<u;a++)r[a].setItem(o[a]);return r.map(a=>a.rendered)})},void 0,{name:"indexArray"})}var uo=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,Te=typeof process>"u"?uo:!1,ao=Symbol.for("signal"),co=Symbol.for("memo"),lo=Symbol.for("resource");function Ue(e){return typeof e=="function"&&e[ao]===!0}function Pt(e){return typeof e=="function"&&e[co]===!0}function Dt(e){return typeof e=="function"&&e[lo]===!0}function Ft(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function It(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function jt(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 qt=null;function Lt(e){qt=e}function Z(e){qt&&qt(e)}var Ut=null;function Bt(e){Ut=e}function Ne(e){return Ut?Ut(e):void 0}var Nt=null;function Vt(e){Nt=e}function Me(){return Nt?Nt():void 0}var Mt=null;function $t(e){Mt=e}function Le(e,t){Mt&&Mt(e,t)}function $n(e,t=(n,r)=>n===r){let n=new Map;return U(()=>{let r=e();for(let[o,s]of n){let[i,u]=s,a=t(o,r);i()!==a&&u(a)}}),r=>{let o=n.get(r);if(!o){let[s,i]=m(!1);o=[s,i],n.set(r,o);let u=e();i(t(r,u))}return o[0]()}}function Kn(e,t){let[n,r]=m(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 Hn(e,t){let n,r=(...o)=>{n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0,e(...o)},t)};return k(()=>{n!==void 0&&clearTimeout(n)}),r}function fo(e){return!!e&&typeof e.then=="function"}var Kt=Symbol();function me(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:Me(),i=s!==void 0?Ne(s):void 0,u=i!==void 0,[a,f]=m(i!==void 0?i.value:n.initialValue,{equals:!1}),[b,p]=m(void 0,{equals:!1}),[T,S]=m(i!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[O,w]=m(void 0,{equals:!1}),[E,h]=m(void 0,{equals:!1}),j=Kt,A=!1;U(()=>{let C=r();if(E(),C===!1||C===null||C===void 0){j=Kt,$(()=>{S("unresolved"),w(void 0),p(void 0)});return}let q=A;if(A=!1,j!==Kt&&C===j&&!q)return;if(j=C,u){u=!1;return}let K=!1;k(()=>K=!0);let X=I(T),Ee=I(a),se=X==="ready"||X==="refreshing";$(()=>{S(se?"refreshing":"pending"),p(void 0)});try{let N=o(C,{value:Ee,refetching:se});fo(N)?(w(N),Z(N),N.then(Y=>{K||(s!==void 0&&Le(s,Y),$(()=>{f(()=>Y),S("ready"),w(void 0)}))},Y=>{K||$(()=>{p(Y),S("errored"),w(void 0)})})):$(()=>{f(()=>N),S("ready"),w(void 0)})}catch(N){if(K)return;$(()=>{p(N),S("errored"),w(void 0)})}});let B=()=>{let C=T();return C==="pending"||C==="refreshing"},P=(()=>{let C=b();if(C)throw C;if(B()){let q=O();if(q)throw q}return a()});return Object.defineProperties(P,{state:{get:T},loading:{get:B},error:{get:b},latest:{get:a}}),Object.defineProperty(P,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(P,Symbol.for("signal"),{value:!0,enumerable:!0}),[P,{mutate:f,refetch:()=>{A=!0,h(void 0)}}]}function Ht(e,t=300){let[n,r]=m(e),[o,s]=m(e),[i,u]=m(!1),a,f=()=>{a!==void 0&&(clearTimeout(a),a=void 0)},b=()=>{f();let T=I(n);return s(()=>T),u(!1),T},p=(T=>{let S=typeof T=="function"?T(I(n)):T;return r(()=>S),u(!0),f(),a=setTimeout(b,t),S});return k(f),[o,p,{immediate:n,pending:i,flush:b,cancel:()=>{f(),u(!1)}}]}function po(e){return e!=null&&e!==""}function Wn(e,t,n={}){let{delay:r=300,initialValue:o,shouldFetch:s=po}=n,[i,u,a]=Ht(e,r),f=()=>s(i())?i():!1,[b,{refetch:p}]=me(f,t,o===void 0?{}:{initialValue:o});return[b,{...a,query:i,setQuery:u,refetch:p}]}function rt(e){if(typeof e=="function"&&!e.length){let t=e();return Ue(t)?t:rt(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=rt(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function ot(e){let t=y(e);return Te?y(()=>rt(t()),void 0,{name:"children"}):y(()=>rt(t()))}var st=he();Dn((e,t)=>{let n=et(t,st);n&&(n.increment(),e.finally(()=>n.decrement()))});function Gn(){let[e,t]=m(0),n=0;return{increment:()=>t(n+=1),decrement:()=>t(n-=1),inFallback:()=>e()>0}}function zn(e,t){return ye(st,e,t)}var Xn=he();In((e,t)=>{let n=et(t,Xn);return n?(n.setError(e),!0):!1});function Yn(){let[e,t]=m(void 0,{equals:!1});return{error:e,reset:()=>t(()=>{}),setError:r=>t(()=>r)}}function Qn(e,t){return ye(Xn,e,t)}var Jn={State:de,Computed:W,subtle:{Watcher:pe,untrack:De,currentComputed:An,hasSinks:kn}};var ho=Symbol.for("signal"),yo=Symbol.for("fluixi-proxy");function vo(e,t){let[n,r]=m(e,t);return Object.assign(n,{set:r})}function To(e,t,n){return y(e,t,n)}function mo(e,t){return U(e,t)}function Zn(...e){let[t,n]=me(...e);return Object.assign(t,n)}var bo="__fluixi_signal_next_state__",So=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},l=globalThis[bo]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:So,onSuspend:null,onError:null,observer:null},go="1.0.0-alpha.83";function wo(e){return l.observer=e,()=>{l.observer===e&&(l.observer=null)}}var be=[],xo;function zt(e){let t=l.observer;t&&t.created(e.parents===void 0?{...e,parents:be,origin:e.origin??xo}:e)}function Oo(e){return l.observer?(be.push(e),!0):!1}function Ro(){be.pop()}function Ao(e){l.observer?.ran?.(e)}function ko(e,t){l.observer?.wrote?.(e,t)}function Co(e){l.observer?.contextCreated?.(e)}function _o(e,t,n){let r=l.observer;!r?.context||!be.length||r.context(be[be.length-1],e,t,n)}function Xt(e){l.observer?.disposed?.(e)}var Eo="__FLUIXI_DEVTOOLS_HOOK__",er=globalThis[Eo];if(typeof er?.inject=="function")try{er.inject({observeReactiveNodes:wo,version:go})}catch{}function rr(){return l.observer!=null}var tr=0,nr=1,Be=2,or=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))}},Po=class extends or{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++,ko(this,l.consumer),this.observers)for(let t of[...this.observers])t.markDirty(Be);Wt(this)}}peek(){return this._value}},sr=class extends or{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=Be,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(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===nr&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===Be)break}(this.state===Be||!this._initialized)&&this.recompute(),this.state=tr}recompute(){if(this.sources){for(let u of this.sources)u.observers?.delete(this);this.sources.clear()}let e=l.consumer,t=l.untracked,n=Oo(this);l.consumer=this,l.untracked=!1;let r,o=!1,s;try{r=this._fn()}catch(u){o=!0,s=u,r=this._value}finally{l.consumer=e,l.untracked=t,n&&Ro()}let i=!this._initialized||this._threw!==o||(o?s!==this._error:!this._equals(this._value,r));if(this._initialized=!0,this._threw=o,this._error=s,this._value=r,Ao(this),i){if(this.version++,this.observers)for(let u of[...this.observers])u.markDirty(Be);Wt(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===tr;if(this.state=e,t){if(this.observers)for(let n of[...this.observers])n.markDirty(nr);Wt(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function Wt(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var Do=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 Fo(e){if(l.untracked)return e();l.untracked=!0;try{return e()}finally{l.untracked=!1}}function ir(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function ur(e,t){let n=Symbol(t??"context");return Co(n),{id:n,defaultValue:e,Provider:r=>{_o(n,"provide",r.value);let o=l.owner,s=ir(o);(s.contexts=new Map).set(n,r.value),o&&(o.owned??=[]).push(s),l.owner=s;try{return r.children}finally{l.owner=o}}}}function ar(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 Io(e){l.onSuspend=e}function jo(e){return l.onSuspend?(l.onSuspend(e,l.owner),!0):!1}function qo(e){l.onError=e}function Uo(){return l.owner}function cr(e,t){let n=l.owner;l.owner=e;try{return t()}finally{l.owner=n}}function lr(e){if(l.owner){if(l.owner.disposed){e();return}(l.owner.cleanups??=[]).push(e)}}function Gt(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)Gt(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 No(e){l.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Mo(e){e.queued||(e.queued=!0,l.queue.push(e),!l.scheduled&&l.batchDepth===0&&(l.scheduled=!0,l.hostSchedule(Yt)))}function Yt(){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 Lo(){l.batchDepth===0&&Yt()}function Bo(e){l.batchDepth++;try{return e()}finally{--l.batchDepth===0&&Yt()}}var Vo=class{constructor(e,t=!1){this.queued=!1,this.disposed=!1,this.owner=ir(l.owner),l.owner&&(l.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new sr(()=>{Gt(this.owner,!1),cr(this.owner,()=>{let n=e();typeof n=="function"&&(this.owner.cleanups??=[]).push(n)})}),zt({kind:"effect",node:this.computed,handle:this,internal:!t}),this.watcher=new Do(()=>Mo(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,Xt(this.computed),this.watcher.unwatch(this.computed),Gt(this.owner))}};function $o(e,t=!1){let n=new Vo(e,t);return()=>n.dispose()}function Ko(e){return!!e&&typeof e.then=="function"}No(()=>{});var fr=Symbol.for("signal"),Ho=Symbol.for("memo"),Wo=Symbol.for("signal-node");function Qt(e,t){let n=new Po(e,{equals:t?.equals}),r=(()=>n.get()),o=(s=>{let i=typeof s=="function"?s(n.peek()):s;return n.set(i),Lo(),i});return Object.defineProperty(r,fr,{value:!0,enumerable:!0}),Object.defineProperty(r,Wo,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),zt({kind:"signal",node:n,handle:r,name:t?.name,set:o}),rr()&&lr(()=>Xt(n)),[r,o]}function it(e,t,n){let r=t,o=Uo(),s=new sr(()=>cr(o,()=>{try{return r=e(r)}catch(u){if(Ko(u))return jo(u),r;throw u}}),{equals:n?.equals}),i=(()=>s.get());return Object.defineProperty(i,fr,{value:!0,enumerable:!0}),Object.defineProperty(i,Ho,{value:!0,enumerable:!0}),zt({kind:"memo",node:s,handle:i,name:n?.name}),rr()&&lr(()=>Xt(s)),i}function Ve(e,t){let n=t;return $o(()=>{n=e(n)},!0)}function Jt(e){return Bo(e)}function dr(e){return Fo(e)}var uu=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0;var Go=ur();Io((e,t)=>{let n=ar(t,Go);n&&(n.increment(),e.finally(()=>n.decrement()))});var zo=ur();qo((e,t)=>{let n=ar(t,zo);return n?(n.setError(e),!0):!1});var ut=Symbol.for("fluixi-proxy");var we=Symbol("store-raw"),ee=Symbol("store-node"),pr=Symbol("store-has"),ct=Symbol("store-self"),lt=Symbol("store-track"),mr=Symbol("store-name"),br=Symbol("store-store"),Ke=new WeakMap,en=new WeakMap,xe=new WeakMap,ft=new WeakMap;function Xo(e,t){if(!ge(e)||!fe())return;let n=new Set,r=i=>{if(!(!ge(i)||n.has(i))){n.add(i);for(let u of Object.values(i))r(u)}};r(ft.get(t)??t);let o=new Set,s=i=>{if(!ge(i))return;let u=i;if(n.has(u)||o.has(u))return;o.add(u);let a=Ke.get(u);if(a){for(let f of a.keys.values())H(f);a.all&&H(a.all),Ke.delete(u),xe.delete(u),en.delete(u)}for(let f of Object.values(u))s(f)};s(e)}var dt=(e,t,n)=>n?`${e}[${String(t)}]`:`${e}.${String(t)}`;function Sr(e,t,n){let r=t?.owner,o=r&&n!==void 0?dt(r.name,n,t?.array):void 0,[s,i]=vn(r?.store,()=>Qt(e,o?{name:o}:void 0)),u=s;return u.$=i,u}function pt(e){let t=Ke.get(e);return t?t.owner||(t.owner=xe.get(e)):Ke.set(e,t={keys:new Map,owner:xe.get(e),array:Array.isArray(e)}),t}function hr(e,t,n){let r=e.keys.get(t);return r||e.keys.set(t,r=Sr(n,e,t)),r}function Yo(e,t,n,r){let o=xe.get(e);if(o&&o.store===t&&o.name===n)return;let s={store:t,name:n};xe.set(e,s),ft.set(e,ft.get(r)??r);let i=Ke.get(e);if(i&&(i.owner=s,!!fe())){for(let[u,a]of i.keys)Rt(a,t,dt(n,u,i.array));i.all&&Rt(i.all,t,dt(n,"*",i.array))}}function yr(e){let t=pt(e);(t.all||(t.all=Sr(void 0,t,"*")))()}function vr(e,t){e.$(typeof t=="function"?()=>t:t)}function ge(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 at(e){if(!ge(e))return e;let t=en.get(e);if(t)return t;let n=new Proxy(e,Qo);return en.set(e,n),n}var Qo={get(e,t,n){if(t===we||t===ee)return e;if(t===ut)return n;if(t===pr)return a=>a in e;if(t==="__proxy")return!0;if(t===lt||t===ct)return yr(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=pt(e),i=hr(s,t,r),u=i();return ge(u)?(s.owner&&Yo(u,i,dt(s.owner.name,t,s.array),e),at(u)):u},set(){return!0},deleteProperty(e,t){return t in e&&$e(e,t,void 0),!0},has(e,t){return t===we||t===ut||t===ee||t===pr||t===ct||t===lt?!0:(hr(pt(e),t,e[t])(),t in e)},ownKeys(e){return yr(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function gr(e,t=new Set){if(e==null||typeof e!="object")return e;let n=e[we]??e;if(t.has(n)||!ge(n))return n;t.add(n);let r=!1,o=i=>{let u=gr(i,t);return u!==i&&(r=!0),u};if(Array.isArray(n)){let i=n.map(o);return r?i:n}let s={};for(let i of Object.keys(n))s[i]=o(n[i]);return r?s:n}function $e(e,t,n){let r=gr(n),o=e[t];if(o===r&&(r!==void 0||t in e))return;let s=Array.isArray(e),i=s?e.length:0;r===void 0?delete e[t]:e[t]=r;let u=pt(e),a=u.keys.get(t);if(a&&vr(a,r),Xo(o,e),s&&e.length!==i){let f=u.keys.get("length");f&&vr(f,e.length)}u.all&&u.all.$(void 0)}function Tr(e,t){return typeof e=="function"?e(t):e}function tn(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)?tn(o,r):$e(e,n,r)}}function rn(e){let t=[],n=e.replace(/\[([^\]]*)\]/g,".$1");for(let r of n.split("."))r.length&&t.push(r);return t}function wr(e,t,n){let r=t.length-1;for(let s=0;s<r;s++){let i=t[s];if(i==="*"){let a=t.slice(s+1);if(Array.isArray(e))for(let f=0;f<e.length;f++)wr(e[f],a,n);return}let u=e[i];(u==null||typeof u!="object")&&(u=/^\d+$/.test(t[s+1])?[]:{},$e(e,i,u)),e=u}let o=t[r];if(o==="*"){if(Array.isArray(e))for(let s=0;s<e.length;s++)$e(e,s,Tr(n,e[s]));return}$e(e,o,Tr(n,e[o]))}function Zt(e,t,n){wr(e,rn(t),n)}function Jo(e,t){let n=t[0];if(typeof n=="function"&&t.length===1){let r=n(e);r&&r!==e&&tn(e,r);return}if(Array.isArray(n)&&t.length===1){for(let r of n)Array.isArray(r)&&Zt(e,r[0],r[1]);return}if(n&&typeof n=="object"&&!Array.isArray(n)&&t.length===1){tn(e,n);return}if(Array.isArray(t[1])&&t.length>=3){Zt(e,`${n}.${t[1].join(".")}`,t[2]);return}Zt(e,String(n),t[1])}function nn(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(nn);let t={};for(let n of Object.keys(e))t[n]=nn(e[n]);return t}function Se(e,t){let n=e;for(let r of rn(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(()=>Jo(this.root,r))),t&&typeof t=="object"&&(xe.set(t,{store:this,name:n.name??"store"}),ft.set(t,t)),Q({kind:"store",node:this,handle:()=>this.root,name:n.name})}get state(){return at(this.root)}get proxy(){return at(this.root)}get accessor(){return(()=>at(this.root))}unwrap(){return this.root}getNode(t){return this.root&&this.root[t]}get(t){if(t==null||t==="")return Oe(this.state);let n=this.state;for(let r of rn(t)){if(n==null)return;n=n[r]}return Oe(n)}select(t){return it(()=>t(this.state))}subscribe(t){return Ve(()=>t(this.state))}watch(t,n){let r;return Ve(()=>{let o=t(this.state);Object.is(o,r)||(n(o,r),r=o)})}reactive(t){return it(()=>this.state[t])}produce(t){this.set((n=>{let r=nn(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]=Qt(this.state);return t.toObservable()}dispose(){}},Zo=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","unwrap","toObservable"];function xr(e,t){for(let n of Zo)e[n]=t[n].bind(t);e.$=t.reactive.bind(t)}function He(e,t={immutable:!0}){let n=new G(e,t);return xr(n.set,n),[n.proxy,n.set]}function on(e,t={}){return new G(e,{...t,immutable:!1})}function Or(e,t={}){let n=new G(e(),t);return Ve(()=>n.set(e())),n}function Rr(e,t,n){return Ve(()=>n(t(e)))}function Ar(e,t,n){return it(()=>t(e),void 0,n)}function kr(e,t={}){let n=new G(e,t),r=(()=>n.proxy);return xr(r,n),r}function Oe(e){if(e==null||typeof e!="object")return e;let t=e[we];return t!==void 0?t:e}function sn(e){return dr(()=>Oe(e))}function Cr(e){return ht(e)}function _r(e){return ht(e)?e[ee]:null}function Er(e){return e&&typeof e=="object"&&ee in e?e[ee]:null}function ht(e){return!!e&&typeof e=="object"&&(ut in e||e.__proxy===!0)}function Pr(e){return e}var Dr=Object.freeze({createStore:He,createMutableStore:on,batch:Jt,unwrap:Oe,untrackStore:sn});function un(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(un);let t={};for(let n of Object.keys(e))t[n]=un(e[n]);return t}function Fr(e){return t=>{let n=un(t);return e(n),n}}function Ir(e,t={}){return()=>e}function jr(e,t){let[n,r]=He(e,t);return new Proxy(n,{get:(o,s)=>s==="set"?r:o[s],has:(o,s)=>s==="set"||Reflect.has(o,s)})}function es(e,t,n){return y(()=>t(e()),void 0,n)}function ts(e,t,n){return y(()=>e().filter(t),void 0,n)}function ns(e,t,n,r){return y(()=>e().reduce(t,n),void 0,r)}function rs(e,t,n){return y(()=>e().find(t),void 0,n)}function os(e,t,n){return y(()=>e().some(t),void 0,n)}function ss(e,t,n){return y(()=>e().every(t),void 0,n)}function is(e,t,n){return y(()=>[...e()].sort(t),void 0,n)}function us(e,t){return y(()=>[...new Set(e())],void 0,t)}function as(e,t,n){return y(()=>{let r=e.map(o=>o());return t(r)},void 0,n)}function cs(...e){return new M(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 ls(e,t,n){return y(()=>e()||t(),void 0,n)}function fs(e,t,n,r){return y(()=>n(e(),t()),void 0,r)}function ds(e,t,n){return y(()=>t(e()),void 0,{equals:n,internal:!0})}function ps(e,t,n){return y(()=>{let r=e(),o={};for(let s of t)o[s]=r[s];return o},void 0,n)}function hs(e,t,n){return y(()=>{let o={...e()};for(let s of t)delete o[s];return o},void 0,n)}function ys(e,t,n,r){return y(()=>e()?t():n(),void 0,r)}function vs(e,t,n){return y(()=>e()?t():void 0,void 0,n)}function Ts(e,t,n){let[r,o]=m(e()),s;return y(()=>{let i=e();clearTimeout(s),s=setTimeout(()=>o(()=>i),t)}),r}function ms(e,t,n){let[r,o]=m(e()),s=0,i;return y(()=>{let u=e(),a=Date.now();a-s>=t?(s=a,o(()=>u)):(clearTimeout(i),i=setTimeout(()=>{s=Date.now(),o(()=>u)},t-(a-s)))}),r}function bs(e){let t=e;for(;typeof t=="function";)t=t();return t}var Ss=Symbol.for("signal");var qr=Symbol("fluixi-proxy"),gs=Symbol.for("signal-node"),We=0,cn=1,mt=2,Ae=3,g=null,R=null,d=null,vt=null,Tt=0,ws=!1,an=!1,Re=0,xs=1e6,z=new WeakMap,yt=null;var Os=new Map,Rs=0;function As(){return`node_${++Rs}_${Date.now()}`}function ks(e){Te&&Os.set(e.id,new WeakRef(e))}function Cs(e,t,n){let r={id:As(),type:e,value:t,version:0,equals:n?.equals,name:n?.name,created:Date.now(),updated:Date.now()};return ks(r),r}function _s(e,t){return e===t}function Nr(e){throw typeof console<"u"&&console.error("Reactive error:",e),e}function Es(e){if(d)d.indexOf(e)===-1&&d.push(e);else if(yt&&yt.running&&!e.pure)yt.effects.indexOf(e)===-1&&yt.effects.push(e);else if(!e.pure||e.computed)fn(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;bt(r),d=o}}}function Ur(e,t){for(let n=0;n<e.length;n++)t(e[n])}function te(e,t){let n=e;typeof n=="object"&&n&&qr in n&&delete n[qr];let r=Cs("signal",n,{equals:t?.equals===!1?void 0:t?.equals,name:t?.name}),o=[i,u];z.set(o,new Set);let s;function i(){let a=R;if(a){a.sources?a.sources.indexOf(o)===-1&&a.sources.push(o):a.sources=[o];let f=z.get(o);f&&!f.has(a)&&f.add(a)}return n}function u(a){let f=typeof a=="function"?a(n):a,b=r.equals||_s;if(t?.equals===!1||!b(n,f)){n=f,r.value=f,r.version++,r.updated=Date.now();let T=z.get(o);if(T&&T.size>0){let E=function(h,j=!1){let A=h.state;if(!(A===Ae&&h===R)){if(j&&!h.pure){A===We&&(h.state=cn,ws&&(d!==null&&d.indexOf(h)===-1?d.push(h):O.push(h)));return}if(!w.has(h)&&(w.add(h),h.state=mt,A===We||A===cn?O.push(h):!h.pure&&d!==null&&d.indexOf(h)===-1&&d.push(h),h.pure&&h.accessor)){let B=z.get(h.accessor);B&&Ur(Array.from(B),P=>E(P,!0))}}};var p=E;let S=Array.from(T),O=[],w=new Set;Ur(S,E);for(let h of O)Es(h)}}}return i.toObservable=()=>new M(a=>{let f=!0;return ln(()=>{let p=i();f?f=!1:a.next(p)})}),Object.defineProperty(i,Ss,{value:!0,enumerable:!0}),Object.defineProperty(i,gs,{value:r,enumerable:!1}),o}function ln(e,t,n){let r={fn:e,state:mt,sources:null,sourceSlots:null,owned:null,cleanups:null,owner:g,contexts:null,pure:!1,updatedAt:null};g&&(g.owned?g.owned.push(r):g.owned=[r]);let o=L&&_e(L);return o&&(r.suspense=o),Mr(r,t),()=>ke(r)}function Mr(e,t){if(e.sources){for(let o of e.sources){let s=z.get(o);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.owned){for(let o=0;o<e.owned.length;o++)ke(e.owned[o]);e.owned=null}let n=R,r=g;if(R=e,g=e,Tt++,Tt>xs)throw Tt=0,R=n,g=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=We)}catch(o){if(wt(o)){let s=L&&_e(L);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Nr(o)}finally{R=n,g=r}}function fn(e){if(!(e.disposed||!e.fn||e.state===We)&&(e.state===mt||e.state===cn||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++)ke(e.owned[t]);e.owned=null}e.renderEffect?Br(e):Mr(e,e.value)}}function ke(e){if(e.disposed=!0,e.sources)for(let t of e.sources){let n=z.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++)ke(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 bt(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=z.get(o.accessor);if(s&&s.size>0){let u=R;R=null,o.accessor(),R=u}let i=d.splice(0);for(let u of i)u.pure&&!u.computed&&u.accessor?t.indexOf(u)===-1&&t.push(u):(u.computed||!u.pure)&&n.indexOf(u)===-1&&n.push(u)}d=null;for(let o of n)(o.computed||!o.pure)&&fn(o)}function ne(e){if(d&&Re>0)return e();if(d&&Re===0){let t=d,n=[];d=n,Re++;let r;try{r=e()}finally{Re--,d=t}let o=d;return bt(n),d=o,r}Re++,d=[],vt=[];try{return e()}finally{Re--,Ps()}}function Ps(){if(!an){an=!0,Tt=0;try{for(;d&&d.length>0;){let e=d;d=null,bt(e)}if(d=null,vt){let e=vt;vt=null;for(let t=0;t<e.length;t++)fn(e[t])}}finally{an=!1}}}function Ce(e){let t=R;R=null;try{return e()}finally{R=t}}function Lr(e){g&&(g.cleanups?g.cleanups.push(e):g.cleanups=[e])}function Ds(e){let t=Symbol("context"),n=Fs(t);return{id:t,Provider:n,defaultValue:e}}function Fs(e){return t=>{let n=g;for(;n;)n.contexts||(n.contexts=new Map),n.contexts.has(e)||n.contexts.set(e,t.value),n=n.owner;let r;return Is(()=>{r=Ce(()=>{let o=g;return o&&(o.contexts||(o.contexts=new Map),o.contexts.set(e,t.value)),ot(()=>t.children)})}),r}}function _e(e){let t=g;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 Is(e,t,n){let r={fn:e,state:mt,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:g,contexts:null,pure:!1,updatedAt:null,renderEffect:!0};g&&(g.owned?g.owned.push(r):g.owned=[r]);let o=L&&_e(L);return o&&(r.suspense=o),Br(r),()=>ke(r)}function Br(e){if(e.sources){for(let o of e.sources){let s=z.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++)ke(e.owned[o]);e.owned=null}let t=R,n=g,r=d;R=e,g=e,d===null&&(d=[]),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=We)}catch(o){if(wt(o)){let s=L&&_e(L);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Nr(o)}finally{R=t,g=n;let o=d;if(d=r,o!==r&&o&&o.length>0){let s=d;bt(o),d=s}}}var L;function Vr(){return L||(L=Ds())}var oe=new Map,re=new Map,js=0,qs=Symbol.for("signal"),Us=Symbol.for("resource");function Ns(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:u=`_auto_${js++}`,staleWhileRevalidate:a=!0}=s,f=u,b=v=>`${f}:${JSON.stringify(v)}`,p=v=>i===1/0||Date.now()-v.timestamp<=i,[T,S]=te(void 0,{equals:!1}),[O,w]=te("unresolved",{equals:!1}),[E,h]=te(void 0,{equals:!1}),[j,A]=te(void 0,{equals:!1}),[B,P]=te(!1),[C,q]=te(0,{equals:!1}),K=Symbol("unset"),X=K,Ee=!1,se=!1;function N(v,D,F,V){if(re.has(D)){re.get(D).then(x=>{V()||Y(x,F)},x=>{!V()&&!F&&dn(x)}),F||A(re.get(D));return}let ie=Promise.resolve(o(v)).then(x=>(oe.set(D,{value:x,timestamp:Date.now()}),re.delete(D),x),x=>{throw re.delete(D),x});if(re.set(D,ie),!F){Z(ie),A(ie);let x=Ge&&_e(Ge);x&&(x.increment(),ie.finally(()=>x.decrement()))}ie.then(x=>{V()||Y(x,F)},x=>{!V()&&!F&&dn(x)})}function Y(v,D){ne(()=>{S(()=>v),w("ready"),P(!1),A(void 0),h(void 0)})}function dn(v){ne(()=>{h(v),w("errored"),A(void 0)})}let Ge;ln(()=>{Ge===void 0&&(Ge=Vr());let v=r();if(C(),v===!1||v===null||v===void 0){X=K,ne(()=>{w("unresolved"),A(void 0),h(void 0)});return}let D=Ee,F=se;Ee=!1,se=!1;let V=b(v);F&&oe.delete(V);let ie=X===K||v!==X;X=v;let x=!1;Lr(()=>{x=!0});let ue=oe.get(V);if(ue&&p(ue)&&!D&&!F){(Ce(O)!=="ready"||Ce(T)!==ue.value)&&ne(()=>{S(()=>ue.value),w("ready"),P(!1),h(void 0)});return}if(ue&&a&&!F){ne(()=>{S(()=>ue.value),w("ready"),P(!0),h(void 0),A(void 0)}),N(v,V,!0,()=>x);return}let pn=Ce(O),$r=pn==="ready"||pn==="refreshing";ne(()=>{w($r?"refreshing":"pending"),h(void 0),P(!1)}),N(v,V,!1,()=>x)});let ze=(()=>{let v=E();if(v)throw v;if(O()==="pending"){let F=j();if(F)throw F}return T()});return Object.defineProperty(ze,Us,{value:!0,enumerable:!0}),Object.defineProperty(ze,qs,{value:!0,enumerable:!0}),Object.defineProperties(ze,{state:{get:O},loading:{get:()=>{let v=O();return v==="pending"||v==="refreshing"}},error:{get:E},latest:{get:T},stale:{get:B}}),[ze,{mutate:S,refetch:()=>{Ee=!0,q(v=>v+1)},invalidate:()=>{let v=Ce(r);v!=null&&v!==!1&&oe.delete(b(v)),se=!0,q(D=>D+1)}}]}function Ms(e){let t=`${e}:`;for(let n of oe.keys())n.startsWith(t)&&oe.delete(n)}function Ls(){oe.clear(),re.clear()}return Xr(Bs);})();
|