@estjs/signals 0.0.17-beta.2 → 0.0.17-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/signals.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var shared=require('@estjs/shared');var st=Object.defineProperty;var we=Object.getOwnPropertySymbols;var at=Object.prototype.hasOwnProperty,ct=Object.prototype.propertyIsEnumerable;var Le=(e,t,n)=>t in e?st(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n,Re=(e,t)=>{for(var n in t||(t={}))at.call(t,n)&&Le(e,n,t[n]);if(we)for(var n of we(t))ct.call(t,n)&&Le(e,n,t[n]);return e};var T={SET:"SET",ADD:"ADD",DELETE:"DELETE",CLEAR:"CLEAR"};var G=Symbol(""),g=Symbol(""),N=Symbol(""),xe=Symbol("");var L=Symbol("");var q=0,b,O=false,ce=class{constructor(t,n){this.map=t;this.key=n;this.isDep=true;this.flag=0;}get subLink(){return this._subLink}set subLink(t){this._subLink=t,t===void 0&&this.map.delete(this.key);}};function ue(e){e.notify();}function C(e,t){if(O)return;let n=t.depLinkTail;if(n&&n.depNode===e)return n;let i=n?n.nextDepLink:t.depLink;if(i&&i.depNode===e)return i.version=q,t.depLinkTail=i,i;let r=e.subLinkTail;if(r&&r.version===q&&r.subNode===t)return t.depLinkTail=r,r;let o={version:q,depNode:e,subNode:t,prevSubLink:r,nextSubLink:void 0,prevDepLink:n,nextDepLink:i};return i&&(i.prevDepLink=o),n?n.nextDepLink=o:t.depLink=o,r?r.nextSubLink=o:e.subLink=o,e.subLinkTail=o,t.depLinkTail=o,o}function D(e,t=e.subNode){let n=e.depNode,i=e.prevSubLink,r=e.nextSubLink,o=e.prevDepLink,s=e.nextDepLink;if(s?s.prevDepLink=o:t.depLinkTail=o,o?o.nextDepLink=s:t.depLink=s,r?r.prevSubLink=i:n.subLinkTail=i,i)i.nextSubLink=r;else if(n.subLink=r,r===void 0){let c=n.depLink;for(;c;)c=D(c,n);n.depLinkTail=void 0,n.isDep||(n.flag|=16);}return s}function B(e,t){let n,i=0,r=false;e:do{let o=false;if(t.flag&16)o=true;else {let s=e.depNode,c=s.flag;if((c&17)===17){let u=s.subLink;u&&u.nextSubLink&&j(u),o=true;}else if((c&33)===33)if(s.depLink){n={link:e,prev:n},e=s.depLink,t=s,++i;continue e}else s.flag&=-33;else c&32&&(s.flag&=-33);}if(!o&&e.nextDepLink!==void 0){e=e.nextDepLink;continue e}for(r=o;i--;){e=n.link,n=n.prev,t=e.subNode;let s=e.depNode;if(r?s.flag=s.flag&-33|16:s.flag&=-33,s.flag&16&&(r=true),!r&&e.nextDepLink!==void 0){e=e.nextDepLink;continue e}}return r?t.flag=t.flag&-33|16:t.flag&=-33,r}while(true)}function j(e){for(;e;){let t=e.subNode,n=t.flag;(n&48)===32&&(t.flag=n|16,(n&6)===2&&ue(t)),e=e.nextSubLink;}}function Y(e){let t=e.nextSubLink,n;e:do{let i=e.subNode,r=i.flag&2,o=i.flag;if(o&60?o&12?o&4?!(o&48)&&lt(e,i)?(i.flag=o|40,r&&ue(i),o&=1):o=0:i.flag=o&-9|32:o=0:(i.flag=o|32,r&&ue(i)),o&1){let s=i.subLink;if(s!==void 0){let c=s.nextSubLink;c!==void 0&&(n={value:t,prev:n},t=c),e=s;continue}}if((e=t)!==void 0){t=e.nextSubLink;continue}for(;n!==void 0;)if(e=n.value,n=n.prev,e!==void 0){t=e.nextSubLink;continue e}break}while(true)}function fe(e){let t=b;return b=e,t}function $(e){return q++,e.depLinkTail=void 0,e.flag=e.flag&-57|4,fe(e)}function J(e,t){b=t;let n=e.depLinkTail,i=n?n.nextDepLink:e.depLink;for(;i;)i=D(i,e);e.flag&=-5;}function ft(e){let t=fe(void 0),n=O;O=true;try{return e()}finally{O=n,fe(t);}}function lt(e,t){let n=t.depLinkTail;for(;n;){if(n===e)return true;n=n.prevDepLink;}return false}var le=new WeakMap,pt=0;function ae(e,t,n){if(e)for(let i=e.subLink;i;i=i.nextSubLink){let r=i.subNode;r._triggerVersion!==n&&(r._triggerVersion=n,t.push(r));}}function l(e,t){if(!b||O)return;let n=le.get(e);n||(n=new Map,le.set(e,n));let i=n.get(t);i||(i=new ce(n,t),n.set(t,i)),C(i,b);}function S(e,t,n,i){var c;let r=le.get(e);if(!r)return;let o=[],s=++pt;if(n!==void 0)if(Array.isArray(n))for(let u of n)ae(r.get(u),o,s);else ae(r.get(n),o,s);if(t==="ADD"||t==="DELETE"||t==="CLEAR"){let u=Array.isArray(e)?L:xe;ae(r.get(u),o,s);}for(let u of o)u.flag&2?(c=u.notify)==null||c.call(u):u.flag&1&&(u.flag|=16,u.subLink&&Y(u.subLink));}var gt=new WeakMap,vt=new WeakMap;function a(e){if(!e||!shared.isObject(e))return e;let t=e._RAW;return t?a(t):h(e)?a(e.peek()):e}var Ce=_t();function _t(){let e={};return ["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){let i=a(this);l(i,L);let r=i[t](...n);if((r===-1||r===false)&&n.length>0){let o=n.map(s=>a(s));r=i[t](...o);}return r};}),["find","findIndex","findLast","findLastIndex"].forEach(t=>{e[t]=function(...n){let i=a(this),r=k(this);l(i,L);let o=i[t](...n);return (t==="find"||t==="findLast")&&shared.isObject(o)&&!r?d(o):o};}),["push","pop","shift","unshift","splice","sort","reverse","fill","copyWithin"].forEach(t=>{e[t]=function(...n){let i=a(this),r=Array.prototype[t].apply(i,n);return S(i,T.SET,[G,L]),r};}),["toReversed","toSorted","toSpliced"].forEach(t=>{e[t]=function(...n){let i=a(this),r=k(this);if(l(i,L),t==="toSpliced")for(let s=0,c=i.length;s<c;s++)l(i,`${s}`);let o=Array.prototype[t].apply(i,n);return Array.isArray(o)?o.map(s=>shared.isObject(s)?d(s,r):s):o};}),["concat","slice","filter","map","flatMap","flat"].forEach(t=>{e[t]=function(...n){let i=a(this);return l(i,L),Array.prototype[t].apply(this,n)};}),["join","toString","toLocaleString"].forEach(t=>{e[t]=function(...n){let i=a(this);return l(i,L),Array.prototype[t].apply(i,n)};}),["values","keys","entries",Symbol.iterator].forEach(t=>{e[t]=function(){let n=a(this),i=k(this);l(n,G);let r=t===Symbol.iterator?n[Symbol.iterator]():n[t]();return {next(){let{value:o,done:s}=r.next();return s?{value:o,done:s}:Array.isArray(o)?{value:o.map(c=>shared.isObject(c)?d(c,i):c),done:s}:{value:shared.isObject(o)?d(o,i):o,done:s}},[Symbol.iterator](){return this}}};}),e}function Ve(e,t){let n=h(t)?t:a(t);return shared.hasChanged(e,n)}var Pe=e=>({get:(t,n,i)=>{if(n==="_RAW")return t;if(n==="_IS_REACTIVE")return true;if(n==="_IS_SHALLOW")return e;if(shared.hasOwn(Ce,n))return Ce[n];let r=Reflect.get(t,n,i);return shared.isStringNumber(n)&&l(t,n),l(t,G),shared.isObject(r)&&!e?d(r):r},set:(t,n,i,r)=>{let o=Reflect.get(t,n,r),s=a(i),c=Reflect.set(t,n,s,r);return Ve(s,o)&&(shared.isStringNumber(n)?S(t,T.SET,[n,L,G]):S(t,T.SET,n)),c}}),bt=Pe(true),mt=Pe(false),Ge=e=>({get(t,n){return n==="_IS_REACTIVE"?true:n==="_RAW"?t:n==="_IS_SHALLOW"?e:Reflect.get(shared.hasOwn(Ie,n)?Ie:t,n,t)}}),Oe=e=>({get(t,n){return n==="_IS_REACTIVE"?true:n==="_RAW"?t:n==="_IS_SHALLOW"?e:Reflect.get(shared.hasOwn(Ae,n)&&n in t?Ae:t,n,t)}}),yt=Ge(true),kt=Ge(false),wt=Oe(true),Lt=Oe(false),Ie={get(e){let t=a(this);l(t,g);let n=t.get(e);return shared.isUndefined(n)&&!t.has(e)&&v(e)&&(n=t.get(a(e))),shared.isObject(n)&&!k(this)?d(n):n},set(e,t){let n=a(this),i=a(e),r=n.has(i),o=n.get(i),s=a(t);return n.set(i,s),(!r||shared.hasChanged(o,s))&&S(n,T.SET,g),this},add(e){let t=a(this),n=a(e),i=t.has(n);return t.add(n),i||S(t,T.ADD,g),this},has(e){let t=a(this);l(t,g);let n=t.has(e);return !n&&shared.isObject(e)?t.has(a(e)):n},delete(e){let t=a(this),n=t.has(e),i=t.delete(e);return !i&&shared.isObject(e)&&(i=t.delete(a(e))),(n||i)&&S(t,T.DELETE,g),i},clear(){let e=a(this),t=e.size>0,n=e.clear();return t&&S(e,T.CLEAR,g),n},forEach(e,t){let n=a(this),i=k(this);l(n,g),n.forEach((r,o)=>{let s=i||!shared.isObject(r)?r:d(r),c=i||!shared.isObject(o)?o:d(o);e.call(t,s,c,this);});},[Symbol.iterator](){let e=a(this),t=k(this);l(e,g);let n=e[Symbol.iterator]();return {next(){let{value:i,done:r}=n.next();return r?{value:i,done:r}:t?{value:i,done:r}:Array.isArray(i)?{value:i.map(o=>shared.isObject(o)?d(o):o),done:r}:{value:shared.isObject(i)?d(i):i,done:r}},[Symbol.iterator](){return this}}},get size(){let e=a(this);return l(e,g),e.size},keys(){let e=a(this),t=k(this);l(e,g);let n=e.keys();return {next(){let{value:i,done:r}=n.next();return r?{value:i,done:r}:{value:t||!shared.isObject(i)?i:d(i),done:r}},[Symbol.iterator](){return this}}},values(){let e=a(this),t=k(this);l(e,g);let n=e.values();return {next(){let{value:i,done:r}=n.next();return r?{value:i,done:r}:{value:t||!shared.isObject(i)?i:d(i),done:r}},[Symbol.iterator](){return this}}},entries(){let e=a(this),t=k(this);l(e,g);let n=e.entries();return {next(){let{value:i,done:r}=n.next();return r?{value:i,done:r}:t?{value:i,done:r}:{value:i.map(o=>shared.isObject(o)?d(o):o),done:r}},[Symbol.iterator](){return this}}}},Ae={get(e){let t=a(this);l(t,N);let n=t.get(e);return shared.isUndefined(n)&&!t.has(e)&&v(e)&&(n=t.get(a(e))),shared.isObject(n)&&!k(this)?d(n):n},set(e,t){let n=a(this),i=a(e),r=n.has(i),o=n.get(i),s=a(t);return n.set(i,s),(!r||shared.hasChanged(o,s))&&S(n,T.SET,N),this},add(e){let t=a(this),n=a(e),i=t.has(n);return t.add(n),i||S(t,T.ADD,N),this},has(e){let t=a(this);l(t,N);let n=t.has(e);return !n&&v(e)&&(n=t.has(a(e))),n},delete(e){let t=a(this),n=a(e),i=t.has(n),r=t.delete(n);return (i||r)&&S(t,T.DELETE,N),r}},je=e=>({get(t,n,i){if(n==="_RAW")return t;if(n==="_IS_REACTIVE")return true;if(n==="_IS_SHALLOW")return e;let r=Reflect.get(t,n,i),o=h(r)?r.value:r;return l(t,n),shared.isObject(o)&&!e?d(o):o},set:(t,n,i,r)=>{let o=Reflect.get(t,n,r),s=a(i),c=Reflect.set(t,n,s,r);return Ve(s,o)&&S(t,T.SET,n),c},deleteProperty:(t,n)=>{let i=shared.hasOwn(t,n),r=Reflect.deleteProperty(t,n);return i&&r&&S(t,T.DELETE,n),r}}),Rt=je(true),xt=je(false);function d(e,t=false){if(!shared.isObject(e)||v(e))return e;let n=t?vt:gt,i=n.get(e);if(i)return i;let r;shared.isArray(e)?r=t?bt:mt:shared.isSet(e)||shared.isMap(e)?r=t?yt:kt:shared.isWeakMap(e)||shared.isWeakSet(e)?r=t?wt:Lt:r=t?Rt:xt;let o=new Proxy(e,r);return n.set(e,o),o}function v(e){return !!(e&&e._IS_REACTIVE)}function I(e){return v(e)||h(e)?e:d(e)}function Q(e){return v(e)||h(e)?e:d(e,true)}function k(e){return !!(e&&e._IS_SHALLOW)}var Dt=e=>shared.isObject(e)?I(e):e;var Ke;Ke="_IS_SIGNAL";var V=class{constructor(t,n=false){this.flag=1;this[Ke]=true;let i=a(t);this._rawValue=i,this._IS_SHALLOW=n,Me(i)?v(t)?this._value=t:this._value=n?Q(i):I(i):this._value=i;}get dep(){return this}get value(){let t=b;if(t&&C(this,t),this.flag&16&&this.shouldUpdate()){let i=this.subLink;i&&j(i);}return this._value}set value(t){h(t)&&(t=t.peek());let n=t,i=a(t);if(!shared.hasChanged(this._rawValue,i))return;if(this._oldValue=this._rawValue,this._rawValue=i,this.flag|=16,!Me(i))this._value=i;else if(v(n))this._value=n;else {let o=this._IS_SHALLOW;this._value=o?Q(i):I(i);}let r=this.subLink;r&&Y(r);}shouldUpdate(){if(this.flag&=-17,!("_oldValue"in this))return true;let t=shared.hasChanged(this._oldValue,this._rawValue);return this._oldValue=this._rawValue,t}peek(){return this._value}set(t){this.value=t;}update(t){let n=t(this.peek());h(n)?this.value=n.peek():this.value=n;}};function Me(e){return shared.isObject(e)?shared.isArray(e)||shared.isMap(e)||shared.isSet(e)||shared.isWeakMap(e)||shared.isWeakSet(e)||shared.isPlainObject(e):false}function Ot(e){return h(e)?e:new V(e)}function jt(e){return h(e)&&(e=e.peek()),new V(e,true)}function h(e){return !!e&&!!e._IS_SIGNAL}var M=new Set,de=new Set,Ue=Promise.resolve(),he=false,Yt=100;function We(e){return e?Ue.then(e):Ue}function K(e){M.add(e),He();}function He(){he||(he=true,We(Te));}function Fe(e){de.add(e),He();}function Te(){he=false,Mt();let e=0;for(;M.size>0;){if(++e>Yt){M.clear();return}let t=[...M];M.clear();for(let n of t)try{n();}catch(i){}}}function Mt(){let e=Array.from(de);de.clear();for(let t of e)try{t();}catch(n){}}function X(e,t){switch(t){case "sync":return ()=>e();case "pre":return ()=>Fe(e);case "post":return ()=>K(e);default:return ()=>K(e)}}var U=0;function Z(e){qe();try{return e()}finally{Be();}}function qe(){U++;}function Be(){U--,U===0&&Te();}function Se(){return U>0}function Kt(){return U}var m,ee=class{constructor(t=false,n=void 0){this.detached=t;this.parent=n;this._active=true;this.effects=[];this.scopes=[];this.cleanups=[];!t&&m&&(this.parent=m,m.scopes.push(this));}get active(){return this._active}pause(){var t,n;if(this._active){for(let i=0;i<this.scopes.length;i++)this.scopes[i].pause();for(let i=0;i<this.effects.length;i++)(n=(t=this.effects[i]).pause)==null||n.call(t);}}resume(){var t,n;if(this._active){for(let i=0;i<this.scopes.length;i++)this.scopes[i].resume();for(let i=0;i<this.effects.length;i++)(n=(t=this.effects[i]).resume)==null||n.call(t);}}run(t){if(!this._active)return;let n=m;m=this;try{return t()}finally{m=n;}}stop(t=false){if(!this._active)return;this._active=false;for(let i=0;i<this.scopes.length;i++)this.scopes[i].stop(true);this.scopes.length=0;let n=this.effects.slice();this.effects.length=0;for(let i of n)i.stop();for(let i=0;i<this.cleanups.length;i++)this.cleanups[i]();if(this.cleanups.length=0,!t&&this.parent){let i=this.parent.scopes.indexOf(this);i>=0&&this.parent.scopes.splice(i,1);}this.parent=void 0;}_record(t){this.effects.push(t),t.scope=this;}_remove(t){let n=this.effects.indexOf(t);n>=0&&this.effects.splice(n,1);}_pushCleanup(t){this.cleanups.push(t);}};function Ut(e=false){return new ee(e)}function Wt(){return m}function Ht(e){let t=m;return m=e,t}function Ft(e,t=false){m&&m._pushCleanup(e);}function te(e,t=m){t&&t.active&&t._record(e);}function ne(e){let t=e.scope;t&&(e.scope=void 0,t._remove(e));}var Je;Je="_IS_EFFECT";var Ee=class{constructor(t,n){this.flag=18;this[Je]=true;this._active=true;if(this.fn=t,n){this.options=n;let i=n.flush||n.scheduler;i&&!shared.isFunction(i)&&(this._flushScheduler=X(()=>this.run(),i));}te(this);}get active(){return this._active}get dirty(){let t=this.flag;if(t&16)return true;if(t&32){if(this.depLink&&B(this.depLink,this))return this.flag=t&-33|16,true;this.flag=t&-33;}return false}pause(){this.flag|=256;}resume(){let n=this.flag&-257;this.flag=n;let i=(n&16)!==0,r=(n&32)!==0;(i||r)&&this.notify();}run(){if(!this._active)return this.fn();let t=this.flag;this.flag=t&-49|512;let n=$(this);try{return this.fn()}catch(i){throw this.flag|=16,i}finally{this.flag&=-513,J(this,n);}}getJob(){return this._job||(this._job=()=>this.run()),this._job}notify(){var r,o,s;let t=this.flag;if(!this._active||t&784)return;this.flag=t|16;let n=((r=this.options)==null?void 0:r.flush)||((o=this.options)==null?void 0:o.scheduler);n?shared.isFunction(n)?n(this):(s=this._flushScheduler)==null||s.call(this):Se()?K(this.getJob()):this.run();}stop(){var i;if(!this._active)return;this._active=false,ne(this);let t=this.depLink;for(;t;)t=D(t,this);let n=this.subLink;for(;n;)n=D(n);this._job=void 0,this._flushScheduler=void 0,this.depLinkTail=void 0,this.subLinkTail=void 0,(i=this.options)!=null&&i.onStop&&this.options.onStop();}};function ie(e,t){let n=new Ee(e,t);try{n.run();}catch(r){throw n.stop(),r}let i=()=>n.run();return i.effect=n,i.stop=()=>n.stop(),i}function qt(e){e.effect.stop();}function Bt(e){return !!(e&&e._IS_EFFECT)}function $t(e,t,n){let i=t;return ie(()=>{i=e(i);},n)}var R=Symbol("computed-no-value"),Xe;Xe="_IS_COMPUTED";var re=class{constructor(t,n,i,r){this.flag=17;this[Xe]=true;this._value=R;this._active=true;this.getter=t,this.setter=n,this.onTrack=i,this.onTrigger=r,this.flag|=16,te(this);}get value(){if(!this.active)return this._value===R?this.getter():this._value;b&&C(this,b);let t=this.flag,n=this._value!==R;return n&&!(t&48)?this._value:!n||t&16?(this.recompute(),this._value):(t&32&&(this.depLink&&B(this.depLink,this)?this.recompute():this.flag=t&-33),this._value)}set value(t){this.setter&&this.setter(t);}peek(){return this.active?(this._value===R&&this.recompute(),this._value):this._value===R?this.getter():this._value}get active(){return this._active}recompute(){if(!this._active){this._value===R&&(this._value=this.getter());return}let t=this._value,n=t!==R,i=$(this);try{let r=this.getter(),o=this.flag,s=this.subLink,c=-49;!n||shared.hasChanged(t,r)?(this._value=r,this.flag=o&c,s&&j(s)):this.flag=o&c;}catch(r){let o=-49;throw this.flag&=o,this._value=R,r}finally{J(this,i);}}shouldUpdate(){let t=this._value!==R,n=this._value;return this.recompute(),t?shared.hasChanged(this._value,n):true}stop(){if(!this._active)return;this._active=false,ne(this);let t=this.depLink;for(;t;)t=D(t,this);let n=this.subLink;for(;n;)n=D(n);this.depLinkTail=void 0,this.subLinkTail=void 0,this.flag&=-49;}};function ge(e){if(W(e))return e;if(!e)throw new Error("[Computed] Invalid argument: computed() requires a getter function or options object.");if(shared.isFunction(e))return new re(e);if(shared.isPlainObject(e)){let{get:t,set:n,onTrack:i,onTrigger:r}=e;if(!t)throw new Error(`[Computed] Invalid options: getter function is required.
1
+ 'use strict';var shared=require('@estjs/shared');var at=Object.defineProperty;var Le=Object.getOwnPropertySymbols;var ct=Object.prototype.hasOwnProperty,ut=Object.prototype.propertyIsEnumerable;var Re=(e,t,n)=>t in e?at(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n,xe=(e,t)=>{for(var n in t||(t={}))ct.call(t,n)&&Re(e,n,t[n]);if(Le)for(var n of Le(t))ut.call(t,n)&&Re(e,n,t[n]);return e};var S={SET:"SET",ADD:"ADD",DELETE:"DELETE",CLEAR:"CLEAR"};var G=Symbol(""),E=Symbol(""),V=Symbol(""),De=Symbol("");var L=Symbol("");var B=0,b,O=false,ce=class{constructor(t,n){this.map=t;this.key=n;this.isDep=true;this.flag=0;}get subLink(){return this._subLink}set subLink(t){this._subLink=t,t===void 0&&this.map.delete(this.key);}};function ue(e){e.notify();}function C(e,t){if(O)return;let n=t.depLinkTail;if(n&&n.depNode===e)return n;let i=n?n.nextDepLink:t.depLink;if(i&&i.depNode===e)return i.version=B,t.depLinkTail=i,i;let r=e.subLinkTail;if(r&&r.version===B&&r.subNode===t)return t.depLinkTail=r,r;let o={version:B,depNode:e,subNode:t,prevSubLink:r,nextSubLink:void 0,prevDepLink:n,nextDepLink:i};return i&&(i.prevDepLink=o),n?n.nextDepLink=o:t.depLink=o,r?r.nextSubLink=o:e.subLink=o,e.subLinkTail=o,t.depLinkTail=o,o}function x(e,t=e.subNode){let n=e.depNode,i=e.prevSubLink,r=e.nextSubLink,o=e.prevDepLink,s=e.nextDepLink;if(s?s.prevDepLink=o:t.depLinkTail=o,o?o.nextDepLink=s:t.depLink=s,r?r.prevSubLink=i:n.subLinkTail=i,i)i.nextSubLink=r;else if(n.subLink=r,r===void 0){let c=n.depLink;for(;c;)c=x(c,n);n.depLinkTail=void 0,n.isDep||(n.flag|=16);}return s}function $(e,t){let n,i=0,r=false;e:do{let o=false;if(t.flag&16)o=true;else {let s=e.depNode,c=s.flag;if((c&17)===17){let f=s.subLink;f&&f.nextSubLink&&j(f),o=true;}else if((c&33)===33)if(s.depLink){n={link:e,prev:n},e=s.depLink,t=s,++i;continue e}else s.flag&=-33;else c&32&&(s.flag&=-33);}if(!o&&e.nextDepLink!==void 0){e=e.nextDepLink;continue e}for(r=o;i--;){e=n.link,n=n.prev,t=e.subNode;let s=e.depNode;if(r?s.flag=s.flag&-33|16:s.flag&=-33,s.flag&16&&(r=true),!r&&e.nextDepLink!==void 0){e=e.nextDepLink;continue e}}return r?t.flag=t.flag&-33|16:t.flag&=-33,r}while(true)}function j(e){for(;e;){let t=e.subNode,n=t.flag;(n&48)===32&&(t.flag=n|16,(n&6)===2&&ue(t)),e=e.nextSubLink;}}function Y(e){let t=e.nextSubLink,n;e:do{let i=e.subNode,r=i.flag&2,o=i.flag;if(o&60?o&12?o&4?!(o&48)&&pt(e,i)?(i.flag=o|40,r&&ue(i),o&=1):o=0:i.flag=o&-9|32:o=0:(i.flag=o|32,r&&ue(i)),o&1){let s=i.subLink;if(s!==void 0){let c=s.nextSubLink;c!==void 0&&(n={value:t,prev:n},t=c),e=s;continue}}if((e=t)!==void 0){t=e.nextSubLink;continue}for(;n!==void 0;)if(e=n.value,n=n.prev,e!==void 0){t=e.nextSubLink;continue e}break}while(true)}function fe(e){let t=b;return b=e,t}function J(e){return B++,e.depLinkTail=void 0,e.flag=e.flag&-57|4,fe(e)}function z(e,t){b=t;let n=e.depLinkTail,i=n?n.nextDepLink:e.depLink;for(;i;)i=x(i,e);e.flag&=-5;}function lt(e){let t=fe(void 0),n=O;O=true;try{return e()}finally{O=n,fe(t);}}function pt(e,t){let n=t.depLinkTail;for(;n;){if(n===e)return true;n=n.prevDepLink;}return false}var le=new WeakMap,dt=0;function ae(e,t,n){if(e)for(let i=e.subLink;i;i=i.nextSubLink){let r=i.subNode;r._triggerVersion!==n&&(r._triggerVersion=n,t.push(r));}}function l(e,t){if(!b||O)return;let n=le.get(e);n||(n=new Map,le.set(e,n));let i=n.get(t);i||(i=new ce(n,t),n.set(t,i)),C(i,b);}function v(e,t,n,i){var c;let r=le.get(e);if(!r)return;let o=[],s=++dt;if(n!==void 0)if(Array.isArray(n))for(let f of n)ae(r.get(f),o,s);else ae(r.get(n),o,s);if(t==="ADD"||t==="DELETE"||t==="CLEAR"){let f=Array.isArray(e)?L:De;ae(r.get(f),o,s);}for(let f of o)f.flag&2?(c=f.notify)==null||c.call(f):f.flag&1&&(f.flag|=16,f.subLink&&Y(f.subLink));}var gt=new WeakMap,_t=new WeakMap;function a(e){if(!e||!shared.isObject(e))return e;let t=e._RAW;return t?a(t):h(e)?a(e.peek()):e}var Ie=bt();function bt(){let e={};return ["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){let i=a(this);l(i,L);let r=i[t](...n);if((r===-1||r===false)&&n.length>0){let o=n.map(s=>a(s));r=i[t](...o);}return r};}),["find","findIndex","findLast","findLastIndex"].forEach(t=>{e[t]=function(...n){let i=a(this),r=k(this);l(i,L);let o=i[t](...n);return (t==="find"||t==="findLast")&&shared.isObject(o)&&!r?d(o):o};}),["push","pop","shift","unshift","splice","sort","reverse","fill","copyWithin"].forEach(t=>{e[t]=function(...n){let i=a(this),r=Array.prototype[t].apply(i,n);return v(i,S.SET,[G,L]),r};}),["toReversed","toSorted","toSpliced"].forEach(t=>{e[t]=function(...n){let i=a(this),r=k(this);l(i,L);let o=Array.prototype[t].apply(i,n);return Array.isArray(o)?o.map(s=>shared.isObject(s)?d(s,r):s):o};}),["concat","slice","filter","map","flatMap","flat"].forEach(t=>{e[t]=function(...n){let i=a(this);return l(i,L),Array.prototype[t].apply(this,n)};}),["join","toString","toLocaleString"].forEach(t=>{e[t]=function(...n){let i=a(this);return l(i,L),Array.prototype[t].apply(i,n)};}),["values","keys","entries",Symbol.iterator].forEach(t=>{e[t]=function(){let n=a(this),i=k(this);l(n,G);let r=t===Symbol.iterator?n[Symbol.iterator]():n[t]();return {next(){let{value:o,done:s}=r.next();return s?{value:o,done:s}:Array.isArray(o)?{value:o.map(c=>shared.isObject(c)?d(c,i):c),done:s}:{value:shared.isObject(o)?d(o,i):o,done:s}},[Symbol.iterator](){return this}}};}),e}function Pe(e,t){let n=h(t)?t:a(t);return shared.hasChanged(e,n)}var Ge=e=>({get:(t,n,i)=>{if(n==="_RAW")return t;if(n==="_IS_REACTIVE")return true;if(n==="_IS_SHALLOW")return e;if(shared.hasOwn(Ie,n))return Ie[n];let r=Reflect.get(t,n,i);return shared.isStringNumber(n)&&l(t,n),l(t,G),shared.isObject(r)&&!e?d(r):r},set:(t,n,i,r)=>{let o=Reflect.get(t,n,r),s=a(i),c=Reflect.set(t,n,s,r);return Pe(s,o)&&(shared.isStringNumber(n)?v(t,S.SET,[n,L,G]):v(t,S.SET,n)),c}}),mt=Ge(true),yt=Ge(false),Oe=e=>({get(t,n){return n==="_IS_REACTIVE"?true:n==="_RAW"?t:n==="_IS_SHALLOW"?e:Reflect.get(shared.hasOwn(Ae,n)?Ae:t,n,t)}}),je=e=>({get(t,n){return n==="_IS_REACTIVE"?true:n==="_RAW"?t:n==="_IS_SHALLOW"?e:Reflect.get(shared.hasOwn(Ne,n)&&n in t?Ne:t,n,t)}}),kt=Oe(true),wt=Oe(false),Lt=je(true),Rt=je(false),Ae={get(e){let t=a(this);l(t,E);let n=t.get(e);return shared.isUndefined(n)&&!t.has(e)&&g(e)&&(n=t.get(a(e))),shared.isObject(n)&&!k(this)?d(n):n},set(e,t){let n=a(this),i=a(e),r=n.has(i),o=n.get(i),s=a(t);return n.set(i,s),(!r||shared.hasChanged(o,s))&&v(n,S.SET,E),this},add(e){let t=a(this),n=a(e),i=t.has(n);return t.add(n),i||v(t,S.ADD,E),this},has(e){let t=a(this);l(t,E);let n=t.has(e);return !n&&shared.isObject(e)?t.has(a(e)):n},delete(e){let t=a(this),n=t.has(e),i=t.delete(e);return !i&&shared.isObject(e)&&(i=t.delete(a(e))),(n||i)&&v(t,S.DELETE,E),i},clear(){let e=a(this),t=e.size>0,n=e.clear();return t&&v(e,S.CLEAR,E),n},forEach(e,t){let n=a(this),i=k(this);l(n,E),n.forEach((r,o)=>{let s=i||!shared.isObject(r)?r:d(r),c=i||!shared.isObject(o)?o:d(o);e.call(t,s,c,this);});},[Symbol.iterator](){let e=a(this),t=k(this);l(e,E);let n=e[Symbol.iterator]();return {next(){let{value:i,done:r}=n.next();return r?{value:i,done:r}:t?{value:i,done:r}:Array.isArray(i)?{value:i.map(o=>shared.isObject(o)?d(o):o),done:r}:{value:shared.isObject(i)?d(i):i,done:r}},[Symbol.iterator](){return this}}},get size(){let e=a(this);return l(e,E),e.size},keys(){let e=a(this),t=k(this);l(e,E);let n=e.keys();return {next(){let{value:i,done:r}=n.next();return r?{value:i,done:r}:{value:t||!shared.isObject(i)?i:d(i),done:r}},[Symbol.iterator](){return this}}},values(){let e=a(this),t=k(this);l(e,E);let n=e.values();return {next(){let{value:i,done:r}=n.next();return r?{value:i,done:r}:{value:t||!shared.isObject(i)?i:d(i),done:r}},[Symbol.iterator](){return this}}},entries(){let e=a(this),t=k(this);l(e,E);let n=e.entries();return {next(){let{value:i,done:r}=n.next();return r?{value:i,done:r}:t?{value:i,done:r}:{value:i.map(o=>shared.isObject(o)?d(o):o),done:r}},[Symbol.iterator](){return this}}}},Ne={get(e){let t=a(this);l(t,V);let n=t.get(e);return shared.isUndefined(n)&&!t.has(e)&&g(e)&&(n=t.get(a(e))),shared.isObject(n)&&!k(this)?d(n):n},set(e,t){let n=a(this),i=a(e),r=n.has(i),o=n.get(i),s=a(t);return n.set(i,s),(!r||shared.hasChanged(o,s))&&v(n,S.SET,V),this},add(e){let t=a(this),n=a(e),i=t.has(n);return t.add(n),i||v(t,S.ADD,V),this},has(e){let t=a(this);l(t,V);let n=t.has(e);return !n&&g(e)&&(n=t.has(a(e))),n},delete(e){let t=a(this),n=a(e),i=t.has(n),r=t.delete(n);return (i||r)&&v(t,S.DELETE,V),r}},Ye=e=>({get(t,n,i){if(n==="_RAW")return t;if(n==="_IS_REACTIVE")return true;if(n==="_IS_SHALLOW")return e;let r=Reflect.get(t,n,i),o=h(r)?r.value:r;return l(t,n),shared.isObject(o)&&!e?d(o):o},set:(t,n,i,r)=>{let o=Reflect.get(t,n,r),s=a(i),c=Reflect.set(t,n,s,r);return Pe(s,o)&&v(t,S.SET,n),c},deleteProperty:(t,n)=>{let i=shared.hasOwn(t,n),r=Reflect.deleteProperty(t,n);return i&&r&&v(t,S.DELETE,n),r}}),xt=Ye(true),Dt=Ye(false);function d(e,t=false){if(!shared.isObject(e)||g(e))return e;let n=t?_t:gt,i=n.get(e);if(i)return i;let r;shared.isArray(e)?r=t?mt:yt:shared.isSet(e)||shared.isMap(e)?r=t?kt:wt:shared.isWeakMap(e)||shared.isWeakSet(e)?r=t?Lt:Rt:r=t?xt:Dt;let o=new Proxy(e,r);return n.set(e,o),o}function g(e){return !!(e&&e._IS_REACTIVE)}function I(e){return g(e)||h(e)?e:d(e)}function X(e){return g(e)||h(e)?e:d(e,true)}function k(e){return !!(e&&e._IS_SHALLOW)}var Ct=e=>shared.isObject(e)?I(e):e;var Ue;Ue="_IS_SIGNAL";var P=class{constructor(t,n=false){this.flag=1;this[Ue]=true;let i=a(t);this._rawValue=i,this._IS_SHALLOW=n,Ke(i)?g(t)?this._value=t:this._value=n?X(i):I(i):this._value=i;}get dep(){return this}get value(){let t=b;if(t&&C(this,t),this.flag&16&&this.shouldUpdate()){let i=this.subLink;i&&j(i);}return this._value}set value(t){h(t)&&(t=t.peek());let n=t,i=a(t);if(!shared.hasChanged(this._rawValue,i))return;if(this._oldValue=this._rawValue,this._rawValue=i,this.flag|=16,!Ke(i))this._value=i;else if(g(n))this._value=n;else {let o=this._IS_SHALLOW;this._value=o?X(i):I(i);}let r=this.subLink;r&&Y(r);}shouldUpdate(){if(this.flag&=-17,!("_oldValue"in this))return true;let t=shared.hasChanged(this._oldValue,this._rawValue);return this._oldValue=this._rawValue,t}peek(){return this._value}set(t){this.value=t;}update(t){let n=t(this.peek());h(n)?this.value=n.peek():this.value=n;}};function Ke(e){return shared.isObject(e)?shared.isArray(e)||shared.isMap(e)||shared.isSet(e)||shared.isWeakMap(e)||shared.isWeakSet(e)||shared.isPlainObject(e):false}function jt(e){return h(e)?e:new P(e)}function Yt(e){return h(e)&&(e=e.peek()),new P(e,true)}function h(e){return !!e&&!!e._IS_SIGNAL}var M=new Set,de=new Set,We=Promise.resolve(),he=false,Mt=100;function He(e){return e?We.then(e):We}function K(e){M.add(e),Fe();}function Fe(){he||(he=true,He(Te));}function qe(e){de.add(e),Fe();}function Te(){he=false,Kt();let e=0;for(;M.size>0;){if(++e>Mt){M.clear();return}let t=[...M];M.clear();for(let n of t)try{n();}catch(i){}}}function Kt(){let e=Array.from(de);de.clear();for(let t of e)try{t();}catch(n){}}function Z(e,t){switch(t){case "sync":return ()=>e();case "pre":return ()=>qe(e);case "post":return ()=>K(e);default:return ()=>K(e)}}var U=0;function Se(e){Be();try{return e()}finally{$e();}}function Be(){U++;}function $e(){U--,U===0&&Te();}function ve(){return U>0}function Ut(){return U}var m,ee=class{constructor(t=false,n=void 0){this.detached=t;this.parent=n;this._active=true;this.effects=new Set;this.scopes=new Set;this.cleanups=[];!t&&m&&(this.parent=m,m.scopes.add(this));}get active(){return this._active}pause(){var t;if(this._active){for(let n of this.scopes)n.pause();for(let n of this.effects)(t=n.pause)==null||t.call(n);}}resume(){var t;if(this._active){for(let n of this.scopes)n.resume();for(let n of this.effects)(t=n.resume)==null||t.call(n);}}run(t){if(!this._active)return;let n=m;m=this;try{return t()}finally{m=n;}}stop(t=false){if(!this._active)return;this._active=false;for(let i of this.scopes)i.stop(true);this.scopes.clear();let n=Array.from(this.effects);this.effects.clear();for(let i of n)i.stop();for(let i=0;i<this.cleanups.length;i++)this.cleanups[i]();this.cleanups.length=0,!t&&this.parent&&this.parent.scopes.delete(this),this.parent=void 0;}_record(t){this.effects.add(t),t.scope=this;}_remove(t){this.effects.delete(t);}_pushCleanup(t){this.cleanups.push(t);}};function Wt(e=false){return new ee(e)}function Ht(){return m}function Ft(e){let t=m;return m=e,t}function qt(e,t=false){m&&m._pushCleanup(e);}function te(e,t=m){t&&t.active&&t._record(e);}function ne(e){let t=e.scope;t&&(e.scope=void 0,t._remove(e));}var ze;ze="_IS_EFFECT";var Ee=class{constructor(t,n){this.flag=18;this[ze]=true;this._active=true;if(this.fn=t,n){this.options=n;let i=n.flush||n.scheduler;i&&!shared.isFunction(i)&&(this._flushScheduler=Z(()=>this.run(),i));}te(this);}get active(){return this._active}get dirty(){let t=this.flag;if(t&16)return true;if(t&32){if(this.depLink&&$(this.depLink,this))return this.flag=t&-33|16,true;this.flag=t&-33;}return false}pause(){this.flag|=256;}resume(){let n=this.flag&-257;this.flag=n;let i=(n&16)!==0,r=(n&32)!==0;(i||r)&&this.notify();}run(){if(!this._active)return this.fn();let t=this.flag;this.flag=t&-49|512;let n=J(this);try{return this.fn()}catch(i){throw this.flag|=16,i}finally{this.flag&=-513,z(this,n);}}getJob(){return this._job||(this._job=()=>this.run()),this._job}notify(){var r,o,s;let t=this.flag;if(!this._active||t&784)return;this.flag=t|16;let n=((r=this.options)==null?void 0:r.flush)||((o=this.options)==null?void 0:o.scheduler);n?shared.isFunction(n)?n(this):(s=this._flushScheduler)==null||s.call(this):ve()?K(this.getJob()):this.run();}stop(){var i;if(!this._active)return;this._active=false,ne(this);let t=this.depLink;for(;t;)t=x(t,this);let n=this.subLink;for(;n;)n=x(n);this._job=void 0,this._flushScheduler=void 0,this.depLinkTail=void 0,this.subLinkTail=void 0,(i=this.options)!=null&&i.onStop&&this.options.onStop();}};function ie(e,t){let n=new Ee(e,t);try{n.run();}catch(r){throw n.stop(),r}let i=()=>n.run();return i.effect=n,i.stop=()=>n.stop(),i}function Bt(e){e.effect.stop();}function $t(e){return !!(e&&e._IS_EFFECT)}function Jt(e,t,n){let i=t;return ie(()=>{i=e(i);},n)}var R=Symbol("computed-no-value"),Ze;Ze="_IS_COMPUTED";var re=class{constructor(t,n,i,r){this.flag=17;this[Ze]=true;this._value=R;this._active=true;this.getter=t,this.setter=n,this.onTrack=i,this.onTrigger=r,this.flag|=16,te(this);}get value(){if(!this.active)return this._value===R?this.getter():this._value;b&&C(this,b);let t=this.flag,n=this._value!==R;return n&&!(t&48)?this._value:!n||t&16?(this.recompute(),this._value):(t&32&&(this.depLink&&$(this.depLink,this)?this.recompute():this.flag=t&-33),this._value)}set value(t){this.setter&&this.setter(t);}peek(){return this.active?(this._value===R&&this.recompute(),this._value):this._value===R?this.getter():this._value}get active(){return this._active}recompute(){if(!this._active){this._value===R&&(this._value=this.getter());return}let t=this._value,n=t!==R,i=J(this);try{let r=this.getter(),o=this.flag,s=this.subLink,c=-49;!n||shared.hasChanged(t,r)?(this._value=r,this.flag=o&c,s&&j(s)):this.flag=o&c;}catch(r){let o=-49;throw this.flag&=o,this._value=R,r}finally{z(this,i);}}shouldUpdate(){let t=this._value!==R,n=this._value;return this.recompute(),t?shared.hasChanged(this._value,n):true}stop(){if(!this._active)return;this._active=false,ne(this);let t=this.depLink;for(;t;)t=x(t,this);let n=this.subLink;for(;n;)n=x(n);this.depLinkTail=void 0,this.subLinkTail=void 0,this.flag&=-49;}};function ge(e){if(W(e))return e;if(!e)throw new Error("[Computed] Invalid argument: computed() requires a getter function or options object.");if(shared.isFunction(e))return new re(e);if(shared.isPlainObject(e)){let{get:t,set:n,onTrack:i,onTrigger:r}=e;if(!t)throw new Error(`[Computed] Invalid options: getter function is required.
2
2
  Usage: computed({ get: () => value, set: (v) => { ... } })`);if(!shared.isFunction(t))throw new TypeError(`[Computed] Invalid options: getter must be a function.
3
3
  Received: ${typeof t}`);return new re(t,n,i,r)}throw new Error(`[Computed] Invalid argument: expected a function or options object.
4
- Received: ${typeof e}`)}function W(e){return !!e&&!!e._IS_COMPUTED}function zt(e){let{state:t,getters:n,actions:i}=e,r=Re({},t),o=I(t),s=new Set,c=new Set,u=f=>{s.forEach(E=>E(f)),c.forEach(E=>E(f));},P={patch$(f){Z(()=>{Object.assign(o,f);}),u(o);},subscribe$(f){s.add(f);},unsubscribe$(f){s.delete(f);},onAction$(f){c.add(f);},offAction$(f){c.delete(f);},reset$(){Z(()=>{Object.assign(o,r);}),u(o);}},w={};for(let f of Object.keys(r))Object.defineProperty(w,f,{get:()=>o[f],set:E=>{o[f]=E;},enumerable:true,configurable:true});if(Object.defineProperty(w,"state",{value:o,enumerable:true,configurable:true,writable:true}),Object.assign(w,P),n)for(let f in n){let E=n[f];if(!E)continue;let x=ge(()=>E.call(w,o));Object.defineProperty(w,f,{get:()=>x.value,enumerable:true,configurable:true});}if(i)for(let f in i){let E=i[f];E&&(w[f]=(...x)=>{let se=E.apply(w,x);return c.forEach(H=>H(o)),se});}return w}function Qt(e){let t=new e,n=Object.create(null),i={},r={};return Object.getOwnPropertyNames(t).forEach(o=>{n[o]=t[o];}),Object.getOwnPropertyNames(e.prototype).forEach(o=>{let s=Object.getOwnPropertyDescriptor(e.prototype,o);s&&(shared.isFunction(s.get)?i[o]=function(){return s.get.call(this)}:shared.isFunction(s.value)&&o!=="constructor"&&(r[o]=function(...c){return s.value.apply(this,c)}));}),{state:n,getters:i,actions:r}}function Xt(e){return ()=>{let t;return shared.isFunction(e)?t=Qt(e):t=e,zt(t)}}var Ze,et,oe=class extends(et=V,Ze="_IS_REF",et){constructor(n){super(n,true);this[Ze]=true;}get value(){let n=b;return n&&C(this,n),this._value}set value(n){h(n)&&(n=n.peek()),_e(n)&&(n=n.value),shared.hasChanged(this._value,n)&&(this._rawValue=n,this._value=n,this.flag|=16,this.subLink&&Y(this.subLink));}};function en(e=void 0){return _e(e)?e:h(e)?new oe(e.peek()):new oe(e)}function _e(e){return !!e&&!!e._IS_REF}var tt={},nt=new Set,be=false;function A(e,t){if(!shared.isObject(e)||t.has(e))return e;if(t.add(e),h(e)||W(e))A(e.value,t);else if(Array.isArray(e))for(let n of e)A(n,t);else if(shared.isMap(e))e.forEach(n=>{A(n,t);}),e.keys(),e.values();else if(shared.isSet(e))e.forEach(n=>{A(n,t);}),e.values();else for(let n of Object.keys(e))A(e[n],t);return e}function ot(e){if(be)return A(e,new Set);be=true,nt.clear();try{return A(e,nt)}finally{be=false;}}function it(e){return shared.isFunction(e)?e:h(e)||W(e)?()=>e.value:v(e)?()=>ot(e):()=>e}function sn(e){if(Array.isArray(e)){let t=e.map(n=>it(n));return ()=>t.map(n=>n())}return it(e)}function an(e,t,n={}){let{immediate:i=false,deep:r=false,flush:o="post",once:s=false}=n,c=tt,u,P=true,w=!Array.isArray(e)&&v(e),f=r&&!w,E=sn(e),x,se=y=>{x=()=>{x=void 0;try{y();}catch(F){}};},H=()=>{x&&x();},me=y=>{H(),t(y,c===tt?void 0:c,se),c=y,s&&ke();},ye=ie(()=>{let y=E();return f&&ot(y),u=y,y},{scheduler:X(()=>{if(!P)return;let y=ye.effect;if(!y.active)return;let F=y.run();(r||shared.isObject(F)||shared.hasChanged(F,c))&&me(F);},o)});function ke(){P&&(P=false,H(),ye.stop());}return i?me(u):c=u,ke}exports.EffectScope=ee;exports.TriggerOpTypes=T;exports.batch=Z;exports.computed=ge;exports.createStore=Xt;exports.effect=ie;exports.effectScope=Ut;exports.endBatch=Be;exports.getBatchDepth=Kt;exports.getCurrentScope=Wt;exports.isBatching=Se;exports.isComputed=W;exports.isEffect=Bt;exports.isReactive=v;exports.isRef=_e;exports.isShallow=k;exports.isSignal=h;exports.memoEffect=$t;exports.nextTick=We;exports.onScopeDispose=Ft;exports.queueJob=K;exports.queuePreFlushCb=Fe;exports.reactive=I;exports.ref=en;exports.setCurrentScope=Ht;exports.shallowReactive=Q;exports.shallowSignal=jt;exports.signal=Ot;exports.startBatch=qe;exports.stop=qt;exports.toRaw=a;exports.toReactive=Dt;exports.trigger=S;exports.untrack=ft;exports.watch=an;
4
+ Received: ${typeof e}`)}function W(e){return !!e&&!!e._IS_COMPUTED}function Qt(e){let{state:t,getters:n,actions:i}=e,r=xe({},t),o=I(t),s=new Set,c=new Set,f=u=>{s.forEach(T=>T(u)),c.forEach(T=>T(u));},N=(u,T,D)=>(u.add(T),()=>u.delete(T)),H=u=>{Se(u),f(o);},se={$patch(u){H(()=>Object.assign(o,u));},$subscribe(u){return N(s,u)},$unsubscribe(u){s.delete(u);},$onAction(u){return N(c,u)},$offAction(u){c.delete(u);},$reset(){H(()=>Object.assign(o,r));}},w={};for(let u of Object.keys(r))Object.defineProperty(w,u,{get:()=>o[u],set:T=>{o[u]=T;},enumerable:true,configurable:true});if(Object.defineProperty(w,"state",{value:o,enumerable:true,configurable:true,writable:true}),Object.assign(w,se),n)for(let u in n){let T=n[u];if(!T)continue;let D=ge(()=>T.call(w,o));Object.defineProperty(w,u,{get:()=>D.value,enumerable:true,configurable:true});}if(i)for(let u in i){let T=i[u];T&&(w[u]=(...D)=>{let F=T.apply(w,D);return c.forEach(ye=>ye(o)),F});}return w}function Xt(e){let t=new e,n=Object.create(null),i={},r={};return Object.getOwnPropertyNames(t).forEach(o=>{n[o]=t[o];}),Object.getOwnPropertyNames(e.prototype).forEach(o=>{let s=Object.getOwnPropertyDescriptor(e.prototype,o);s&&(shared.isFunction(s.get)?i[o]=function(){return s.get.call(this)}:shared.isFunction(s.value)&&o!=="constructor"&&(r[o]=function(...c){return s.value.apply(this,c)}));}),{state:n,getters:i,actions:r}}function Zt(e){return ()=>{let t;return shared.isFunction(e)?t=Xt(e):t=e,Qt(t)}}var et,tt,oe=class extends(tt=P,et="_IS_REF",tt){constructor(n){super(n,true);this[et]=true;}get value(){let n=b;return n&&C(this,n),this._value}set value(n){h(n)&&(n=n.peek()),be(n)&&(n=n.value),shared.hasChanged(this._value,n)&&(this._rawValue=n,this._value=n,this.flag|=16,this.subLink&&Y(this.subLink));}};function tn(e=void 0){return be(e)?e:h(e)?new oe(e.peek()):new oe(e)}function be(e){return !!e&&!!e._IS_REF}var nt={},it=new Set,me=false;function A(e,t){if(!shared.isObject(e)||t.has(e))return e;if(t.add(e),h(e)||W(e))A(e.value,t);else if(Array.isArray(e))for(let n of e)A(n,t);else if(shared.isMap(e))e.forEach(n=>{A(n,t);}),e.keys(),e.values();else if(shared.isSet(e))e.forEach(n=>{A(n,t);}),e.values();else for(let n of Object.keys(e))A(e[n],t);return e}function st(e){if(me)return A(e,new Set);me=true,it.clear();try{return A(e,it)}finally{me=false;}}function rt(e){return shared.isFunction(e)?e:h(e)||W(e)?()=>e.value:g(e)?()=>st(e):()=>e}function an(e){if(Array.isArray(e)){let t=e.map(n=>rt(n));return ()=>t.map(n=>n())}return rt(e)}function cn(e,t,n={}){let{immediate:i=false,deep:r=false,flush:o="post",once:s=false}=n,c=nt,f,N=true,H=!Array.isArray(e)&&g(e),se=r&&!H,w=an(e),u,T=y=>{u=()=>{u=void 0;try{y();}catch(q){}};},D=()=>{u&&u();},F=y=>{D(),t(y,c===nt?void 0:c,T),c=y,s&&we();},ke=ie(()=>{let y=w();return se&&st(y),f=y,y},{scheduler:Z(()=>{if(!N)return;let y=ke.effect;if(!y.active)return;let q=y.run();(r||shared.isObject(q)||shared.hasChanged(q,c))&&F(q);},o)});function we(){N&&(N=false,D(),ke.stop());}return i?F(f):c=f,we}exports.EffectScope=ee;exports.TriggerOpTypes=S;exports.batch=Se;exports.computed=ge;exports.createStore=Zt;exports.effect=ie;exports.effectScope=Wt;exports.endBatch=$e;exports.getBatchDepth=Ut;exports.getCurrentScope=Ht;exports.isBatching=ve;exports.isComputed=W;exports.isEffect=$t;exports.isReactive=g;exports.isRef=be;exports.isShallow=k;exports.isSignal=h;exports.memoEffect=Jt;exports.nextTick=He;exports.onScopeDispose=qt;exports.queueJob=K;exports.queuePreFlushCb=qe;exports.reactive=I;exports.ref=tn;exports.setCurrentScope=Ft;exports.shallowReactive=X;exports.shallowSignal=Yt;exports.signal=jt;exports.startBatch=Be;exports.stop=Bt;exports.toRaw=a;exports.toReactive=Ct;exports.trigger=v;exports.untrack=lt;exports.watch=cn;
@@ -909,37 +909,39 @@ interface StoreActions<S extends State> {
909
909
  *
910
910
  * @param payload - Object containing state updates
911
911
  */
912
- patch$: (payload: PatchPayload<S>) => void;
912
+ $patch: (payload: PatchPayload<S>) => void;
913
913
  /**
914
914
  * Subscribes to state changes.
915
915
  * The callback is called whenever the state changes.
916
916
  *
917
917
  * @param callback - Function to call on state changes
918
+ * @returns Cleanup function that unsubscribes the callback
918
919
  */
919
- subscribe$: (callback: StoreCallback<S>) => void;
920
+ $subscribe: (callback: StoreCallback<S>) => () => void;
920
921
  /**
921
922
  * Unsubscribes from state changes.
922
923
  *
923
924
  * @param callback - The callback to remove
924
925
  */
925
- unsubscribe$: (callback: StoreCallback<S>) => void;
926
+ $unsubscribe: (callback: StoreCallback<S>) => void;
926
927
  /**
927
928
  * Subscribes to action executions.
928
929
  * The callback is called whenever an action is executed.
929
930
  *
930
931
  * @param callback - Function to call on action execution
932
+ * @returns Cleanup function that removes the callback
931
933
  */
932
- onAction$: (callback: StoreCallback<S>) => void;
934
+ $onAction: (callback: StoreCallback<S>) => () => void;
933
935
  /**
934
936
  * Removes a previously registered action callback.
935
937
  *
936
938
  * @param callback - The callback to remove.
937
939
  */
938
- offAction$: (callback: StoreCallback<S>) => void;
940
+ $offAction: (callback: StoreCallback<S>) => void;
939
941
  /**
940
942
  * Resets the store state to its initial values.
941
943
  */
942
- reset$: () => void;
944
+ $reset: () => void;
943
945
  }
944
946
  /**
945
947
  * Computed values from getters.
package/dist/signals.d.ts CHANGED
@@ -909,37 +909,39 @@ interface StoreActions<S extends State> {
909
909
  *
910
910
  * @param payload - Object containing state updates
911
911
  */
912
- patch$: (payload: PatchPayload<S>) => void;
912
+ $patch: (payload: PatchPayload<S>) => void;
913
913
  /**
914
914
  * Subscribes to state changes.
915
915
  * The callback is called whenever the state changes.
916
916
  *
917
917
  * @param callback - Function to call on state changes
918
+ * @returns Cleanup function that unsubscribes the callback
918
919
  */
919
- subscribe$: (callback: StoreCallback<S>) => void;
920
+ $subscribe: (callback: StoreCallback<S>) => () => void;
920
921
  /**
921
922
  * Unsubscribes from state changes.
922
923
  *
923
924
  * @param callback - The callback to remove
924
925
  */
925
- unsubscribe$: (callback: StoreCallback<S>) => void;
926
+ $unsubscribe: (callback: StoreCallback<S>) => void;
926
927
  /**
927
928
  * Subscribes to action executions.
928
929
  * The callback is called whenever an action is executed.
929
930
  *
930
931
  * @param callback - Function to call on action execution
932
+ * @returns Cleanup function that removes the callback
931
933
  */
932
- onAction$: (callback: StoreCallback<S>) => void;
934
+ $onAction: (callback: StoreCallback<S>) => () => void;
933
935
  /**
934
936
  * Removes a previously registered action callback.
935
937
  *
936
938
  * @param callback - The callback to remove.
937
939
  */
938
- offAction$: (callback: StoreCallback<S>) => void;
940
+ $offAction: (callback: StoreCallback<S>) => void;
939
941
  /**
940
942
  * Resets the store state to its initial values.
941
943
  */
942
- reset$: () => void;
944
+ $reset: () => void;
943
945
  }
944
946
  /**
945
947
  * Computed values from getters.
@@ -449,11 +449,6 @@ function createArrayInstrumentations() {
449
449
  const arr = toRaw(this);
450
450
  const isShallowMode = isShallow(this);
451
451
  track(arr, ARRAY_ITERATE_KEY);
452
- if (key === "toSpliced") {
453
- for (let i = 0, l = arr.length; i < l; i++) {
454
- track(arr, `${i}`);
455
- }
456
- }
457
452
  const res = Array.prototype[key].apply(arr, args);
458
453
  if (!Array.isArray(res)) {
459
454
  return res;
@@ -1284,39 +1279,40 @@ var EffectScope = class {
1284
1279
  this.detached = detached;
1285
1280
  this.parent = parent;
1286
1281
  this._active = true;
1287
- this.effects = [];
1288
- this.scopes = [];
1282
+ // Use Sets instead of arrays for O(1) add/delete instead of O(n) indexOf+splice
1283
+ this.effects = /* @__PURE__ */ new Set();
1284
+ this.scopes = /* @__PURE__ */ new Set();
1289
1285
  this.cleanups = [];
1290
1286
  if (!detached && activeEffectScope) {
1291
1287
  this.parent = activeEffectScope;
1292
- activeEffectScope.scopes.push(this);
1288
+ activeEffectScope.scopes.add(this);
1293
1289
  }
1294
1290
  }
1295
1291
  get active() {
1296
1292
  return this._active;
1297
1293
  }
1298
1294
  pause() {
1299
- var _a5, _b2;
1295
+ var _a5;
1300
1296
  if (!this._active) {
1301
1297
  return;
1302
1298
  }
1303
- for (let i = 0; i < this.scopes.length; i++) {
1304
- this.scopes[i].pause();
1299
+ for (const scope of this.scopes) {
1300
+ scope.pause();
1305
1301
  }
1306
- for (let i = 0; i < this.effects.length; i++) {
1307
- (_b2 = (_a5 = this.effects[i]).pause) == null ? void 0 : _b2.call(_a5);
1302
+ for (const effect2 of this.effects) {
1303
+ (_a5 = effect2.pause) == null ? void 0 : _a5.call(effect2);
1308
1304
  }
1309
1305
  }
1310
1306
  resume() {
1311
- var _a5, _b2;
1307
+ var _a5;
1312
1308
  if (!this._active) {
1313
1309
  return;
1314
1310
  }
1315
- for (let i = 0; i < this.scopes.length; i++) {
1316
- this.scopes[i].resume();
1311
+ for (const scope of this.scopes) {
1312
+ scope.resume();
1317
1313
  }
1318
- for (let i = 0; i < this.effects.length; i++) {
1319
- (_b2 = (_a5 = this.effects[i]).resume) == null ? void 0 : _b2.call(_a5);
1314
+ for (const effect2 of this.effects) {
1315
+ (_a5 = effect2.resume) == null ? void 0 : _a5.call(effect2);
1320
1316
  }
1321
1317
  }
1322
1318
  run(fn) {
@@ -1339,12 +1335,12 @@ var EffectScope = class {
1339
1335
  return;
1340
1336
  }
1341
1337
  this._active = false;
1342
- for (let i = 0; i < this.scopes.length; i++) {
1343
- this.scopes[i].stop(true);
1338
+ for (const scope of this.scopes) {
1339
+ scope.stop(true);
1344
1340
  }
1345
- this.scopes.length = 0;
1346
- const effects = this.effects.slice();
1347
- this.effects.length = 0;
1341
+ this.scopes.clear();
1342
+ const effects = Array.from(this.effects);
1343
+ this.effects.clear();
1348
1344
  for (const effect2 of effects) {
1349
1345
  effect2.stop();
1350
1346
  }
@@ -1353,22 +1349,16 @@ var EffectScope = class {
1353
1349
  }
1354
1350
  this.cleanups.length = 0;
1355
1351
  if (!fromParent && this.parent) {
1356
- const index = this.parent.scopes.indexOf(this);
1357
- if (index >= 0) {
1358
- this.parent.scopes.splice(index, 1);
1359
- }
1352
+ this.parent.scopes.delete(this);
1360
1353
  }
1361
1354
  this.parent = void 0;
1362
1355
  }
1363
1356
  _record(effect2) {
1364
- this.effects.push(effect2);
1357
+ this.effects.add(effect2);
1365
1358
  effect2.scope = this;
1366
1359
  }
1367
1360
  _remove(effect2) {
1368
- const index = this.effects.indexOf(effect2);
1369
- if (index >= 0) {
1370
- this.effects.splice(index, 1);
1371
- }
1361
+ this.effects.delete(effect2);
1372
1362
  }
1373
1363
  _pushCleanup(fn) {
1374
1364
  this.cleanups.push(fn);
@@ -1897,64 +1887,45 @@ function createOptionsStore(options) {
1897
1887
  const reactiveState = reactive(state);
1898
1888
  const subscriptions = /* @__PURE__ */ new Set();
1899
1889
  const actionCallbacks = /* @__PURE__ */ new Set();
1900
- const notifySubscribers = (state2) => {
1890
+ const notify = (state2) => {
1901
1891
  subscriptions.forEach((callback) => callback(state2));
1902
1892
  actionCallbacks.forEach((callback) => callback(state2));
1903
1893
  };
1894
+ const addCallback = (set, callback, label) => {
1895
+ if (!callback) {
1896
+ shared.warn(`${label} is required`);
1897
+ return () => {
1898
+ };
1899
+ }
1900
+ set.add(callback);
1901
+ return () => set.delete(callback);
1902
+ };
1903
+ const commit = (mutate) => {
1904
+ batch(mutate);
1905
+ notify(reactiveState);
1906
+ };
1904
1907
  const defaultActions = {
1905
- /**
1906
- * Applies a partial patch to the reactive store state.
1907
- */
1908
- patch$(payload) {
1908
+ $patch(payload) {
1909
1909
  if (!payload) {
1910
1910
  shared.warn("Patch payload is required");
1911
1911
  return;
1912
1912
  }
1913
- batch(() => {
1914
- Object.assign(reactiveState, payload);
1915
- });
1916
- notifySubscribers(reactiveState);
1913
+ commit(() => Object.assign(reactiveState, payload));
1917
1914
  },
1918
- /**
1919
- * Registers a store subscriber callback.
1920
- */
1921
- subscribe$(callback) {
1922
- if (!callback) {
1923
- shared.warn("Subscribe callback is required");
1924
- return;
1925
- }
1926
- subscriptions.add(callback);
1915
+ $subscribe(callback) {
1916
+ return addCallback(subscriptions, callback, "Subscribe callback");
1927
1917
  },
1928
- /**
1929
- * Removes a previously registered store subscriber.
1930
- */
1931
- unsubscribe$(callback) {
1918
+ $unsubscribe(callback) {
1932
1919
  subscriptions.delete(callback);
1933
1920
  },
1934
- /**
1935
- * Registers a callback for store action notifications.
1936
- */
1937
- onAction$(callback) {
1938
- if (!callback) {
1939
- shared.warn("Action callback is required");
1940
- return;
1941
- }
1942
- actionCallbacks.add(callback);
1921
+ $onAction(callback) {
1922
+ return addCallback(actionCallbacks, callback, "Action callback");
1943
1923
  },
1944
- /**
1945
- * Removes a previously registered action callback.
1946
- */
1947
- offAction$(callback) {
1924
+ $offAction(callback) {
1948
1925
  actionCallbacks.delete(callback);
1949
1926
  },
1950
- /**
1951
- * Resets the reactive state back to its initial snapshot.
1952
- */
1953
- reset$() {
1954
- batch(() => {
1955
- Object.assign(reactiveState, initState);
1956
- });
1957
- notifySubscribers(reactiveState);
1927
+ $reset() {
1928
+ commit(() => Object.assign(reactiveState, initState));
1958
1929
  }
1959
1930
  };
1960
1931
  const store = {};
@@ -447,11 +447,6 @@ function createArrayInstrumentations() {
447
447
  const arr = toRaw(this);
448
448
  const isShallowMode = isShallow(this);
449
449
  track(arr, ARRAY_ITERATE_KEY);
450
- if (key === "toSpliced") {
451
- for (let i = 0, l = arr.length; i < l; i++) {
452
- track(arr, `${i}`);
453
- }
454
- }
455
450
  const res = Array.prototype[key].apply(arr, args);
456
451
  if (!Array.isArray(res)) {
457
452
  return res;
@@ -1282,39 +1277,40 @@ var EffectScope = class {
1282
1277
  this.detached = detached;
1283
1278
  this.parent = parent;
1284
1279
  this._active = true;
1285
- this.effects = [];
1286
- this.scopes = [];
1280
+ // Use Sets instead of arrays for O(1) add/delete instead of O(n) indexOf+splice
1281
+ this.effects = /* @__PURE__ */ new Set();
1282
+ this.scopes = /* @__PURE__ */ new Set();
1287
1283
  this.cleanups = [];
1288
1284
  if (!detached && activeEffectScope) {
1289
1285
  this.parent = activeEffectScope;
1290
- activeEffectScope.scopes.push(this);
1286
+ activeEffectScope.scopes.add(this);
1291
1287
  }
1292
1288
  }
1293
1289
  get active() {
1294
1290
  return this._active;
1295
1291
  }
1296
1292
  pause() {
1297
- var _a5, _b2;
1293
+ var _a5;
1298
1294
  if (!this._active) {
1299
1295
  return;
1300
1296
  }
1301
- for (let i = 0; i < this.scopes.length; i++) {
1302
- this.scopes[i].pause();
1297
+ for (const scope of this.scopes) {
1298
+ scope.pause();
1303
1299
  }
1304
- for (let i = 0; i < this.effects.length; i++) {
1305
- (_b2 = (_a5 = this.effects[i]).pause) == null ? void 0 : _b2.call(_a5);
1300
+ for (const effect2 of this.effects) {
1301
+ (_a5 = effect2.pause) == null ? void 0 : _a5.call(effect2);
1306
1302
  }
1307
1303
  }
1308
1304
  resume() {
1309
- var _a5, _b2;
1305
+ var _a5;
1310
1306
  if (!this._active) {
1311
1307
  return;
1312
1308
  }
1313
- for (let i = 0; i < this.scopes.length; i++) {
1314
- this.scopes[i].resume();
1309
+ for (const scope of this.scopes) {
1310
+ scope.resume();
1315
1311
  }
1316
- for (let i = 0; i < this.effects.length; i++) {
1317
- (_b2 = (_a5 = this.effects[i]).resume) == null ? void 0 : _b2.call(_a5);
1312
+ for (const effect2 of this.effects) {
1313
+ (_a5 = effect2.resume) == null ? void 0 : _a5.call(effect2);
1318
1314
  }
1319
1315
  }
1320
1316
  run(fn) {
@@ -1337,12 +1333,12 @@ var EffectScope = class {
1337
1333
  return;
1338
1334
  }
1339
1335
  this._active = false;
1340
- for (let i = 0; i < this.scopes.length; i++) {
1341
- this.scopes[i].stop(true);
1336
+ for (const scope of this.scopes) {
1337
+ scope.stop(true);
1342
1338
  }
1343
- this.scopes.length = 0;
1344
- const effects = this.effects.slice();
1345
- this.effects.length = 0;
1339
+ this.scopes.clear();
1340
+ const effects = Array.from(this.effects);
1341
+ this.effects.clear();
1346
1342
  for (const effect2 of effects) {
1347
1343
  effect2.stop();
1348
1344
  }
@@ -1351,22 +1347,16 @@ var EffectScope = class {
1351
1347
  }
1352
1348
  this.cleanups.length = 0;
1353
1349
  if (!fromParent && this.parent) {
1354
- const index = this.parent.scopes.indexOf(this);
1355
- if (index >= 0) {
1356
- this.parent.scopes.splice(index, 1);
1357
- }
1350
+ this.parent.scopes.delete(this);
1358
1351
  }
1359
1352
  this.parent = void 0;
1360
1353
  }
1361
1354
  _record(effect2) {
1362
- this.effects.push(effect2);
1355
+ this.effects.add(effect2);
1363
1356
  effect2.scope = this;
1364
1357
  }
1365
1358
  _remove(effect2) {
1366
- const index = this.effects.indexOf(effect2);
1367
- if (index >= 0) {
1368
- this.effects.splice(index, 1);
1369
- }
1359
+ this.effects.delete(effect2);
1370
1360
  }
1371
1361
  _pushCleanup(fn) {
1372
1362
  this.cleanups.push(fn);
@@ -1895,64 +1885,45 @@ function createOptionsStore(options) {
1895
1885
  const reactiveState = reactive(state);
1896
1886
  const subscriptions = /* @__PURE__ */ new Set();
1897
1887
  const actionCallbacks = /* @__PURE__ */ new Set();
1898
- const notifySubscribers = (state2) => {
1888
+ const notify = (state2) => {
1899
1889
  subscriptions.forEach((callback) => callback(state2));
1900
1890
  actionCallbacks.forEach((callback) => callback(state2));
1901
1891
  };
1892
+ const addCallback = (set, callback, label) => {
1893
+ if (!callback) {
1894
+ warn(`${label} is required`);
1895
+ return () => {
1896
+ };
1897
+ }
1898
+ set.add(callback);
1899
+ return () => set.delete(callback);
1900
+ };
1901
+ const commit = (mutate) => {
1902
+ batch(mutate);
1903
+ notify(reactiveState);
1904
+ };
1902
1905
  const defaultActions = {
1903
- /**
1904
- * Applies a partial patch to the reactive store state.
1905
- */
1906
- patch$(payload) {
1906
+ $patch(payload) {
1907
1907
  if (!payload) {
1908
1908
  warn("Patch payload is required");
1909
1909
  return;
1910
1910
  }
1911
- batch(() => {
1912
- Object.assign(reactiveState, payload);
1913
- });
1914
- notifySubscribers(reactiveState);
1911
+ commit(() => Object.assign(reactiveState, payload));
1915
1912
  },
1916
- /**
1917
- * Registers a store subscriber callback.
1918
- */
1919
- subscribe$(callback) {
1920
- if (!callback) {
1921
- warn("Subscribe callback is required");
1922
- return;
1923
- }
1924
- subscriptions.add(callback);
1913
+ $subscribe(callback) {
1914
+ return addCallback(subscriptions, callback, "Subscribe callback");
1925
1915
  },
1926
- /**
1927
- * Removes a previously registered store subscriber.
1928
- */
1929
- unsubscribe$(callback) {
1916
+ $unsubscribe(callback) {
1930
1917
  subscriptions.delete(callback);
1931
1918
  },
1932
- /**
1933
- * Registers a callback for store action notifications.
1934
- */
1935
- onAction$(callback) {
1936
- if (!callback) {
1937
- warn("Action callback is required");
1938
- return;
1939
- }
1940
- actionCallbacks.add(callback);
1919
+ $onAction(callback) {
1920
+ return addCallback(actionCallbacks, callback, "Action callback");
1941
1921
  },
1942
- /**
1943
- * Removes a previously registered action callback.
1944
- */
1945
- offAction$(callback) {
1922
+ $offAction(callback) {
1946
1923
  actionCallbacks.delete(callback);
1947
1924
  },
1948
- /**
1949
- * Resets the reactive state back to its initial snapshot.
1950
- */
1951
- reset$() {
1952
- batch(() => {
1953
- Object.assign(reactiveState, initState);
1954
- });
1955
- notifySubscribers(reactiveState);
1925
+ $reset() {
1926
+ commit(() => Object.assign(reactiveState, initState));
1956
1927
  }
1957
1928
  };
1958
1929
  const store = {};
package/dist/signals.js CHANGED
@@ -1,4 +1,4 @@
1
- import {isObject,isFunction,isPlainObject,isArray,isSet,isMap,isWeakMap,isWeakSet,hasChanged,isStringNumber,hasOwn,isUndefined}from'@estjs/shared';var at=Object.defineProperty;var Le=Object.getOwnPropertySymbols;var ct=Object.prototype.hasOwnProperty,ut=Object.prototype.propertyIsEnumerable;var Re=(e,t,n)=>t in e?at(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n,xe=(e,t)=>{for(var n in t||(t={}))ct.call(t,n)&&Re(e,n,t[n]);if(Le)for(var n of Le(t))ut.call(t,n)&&Re(e,n,t[n]);return e};var T={SET:"SET",ADD:"ADD",DELETE:"DELETE",CLEAR:"CLEAR"};var O=Symbol(""),g=Symbol(""),V=Symbol(""),De=Symbol("");var R=Symbol("");var B=0,m,j=false,ue=class{constructor(t,n){this.map=t;this.key=n;this.isDep=true;this.flag=0;}get subLink(){return this._subLink}set subLink(t){this._subLink=t,t===void 0&&this.map.delete(this.key);}};function fe(e){e.notify();}function I(e,t){if(j)return;let n=t.depLinkTail;if(n&&n.depNode===e)return n;let i=n?n.nextDepLink:t.depLink;if(i&&i.depNode===e)return i.version=B,t.depLinkTail=i,i;let r=e.subLinkTail;if(r&&r.version===B&&r.subNode===t)return t.depLinkTail=r,r;let o={version:B,depNode:e,subNode:t,prevSubLink:r,nextSubLink:void 0,prevDepLink:n,nextDepLink:i};return i&&(i.prevDepLink=o),n?n.nextDepLink=o:t.depLink=o,r?r.nextSubLink=o:e.subLink=o,e.subLinkTail=o,t.depLinkTail=o,o}function C(e,t=e.subNode){let n=e.depNode,i=e.prevSubLink,r=e.nextSubLink,o=e.prevDepLink,s=e.nextDepLink;if(s?s.prevDepLink=o:t.depLinkTail=o,o?o.nextDepLink=s:t.depLink=s,r?r.prevSubLink=i:n.subLinkTail=i,i)i.nextSubLink=r;else if(n.subLink=r,r===void 0){let c=n.depLink;for(;c;)c=C(c,n);n.depLinkTail=void 0,n.isDep||(n.flag|=16);}return s}function $(e,t){let n,i=0,r=false;e:do{let o=false;if(t.flag&16)o=true;else {let s=e.depNode,c=s.flag;if((c&17)===17){let u=s.subLink;u&&u.nextSubLink&&Y(u),o=true;}else if((c&33)===33)if(s.depLink){n={link:e,prev:n},e=s.depLink,t=s,++i;continue e}else s.flag&=-33;else c&32&&(s.flag&=-33);}if(!o&&e.nextDepLink!==void 0){e=e.nextDepLink;continue e}for(r=o;i--;){e=n.link,n=n.prev,t=e.subNode;let s=e.depNode;if(r?s.flag=s.flag&-33|16:s.flag&=-33,s.flag&16&&(r=true),!r&&e.nextDepLink!==void 0){e=e.nextDepLink;continue e}}return r?t.flag=t.flag&-33|16:t.flag&=-33,r}while(true)}function Y(e){for(;e;){let t=e.subNode,n=t.flag;(n&48)===32&&(t.flag=n|16,(n&6)===2&&fe(t)),e=e.nextSubLink;}}function M(e){let t=e.nextSubLink,n;e:do{let i=e.subNode,r=i.flag&2,o=i.flag;if(o&60?o&12?o&4?!(o&48)&&pt(e,i)?(i.flag=o|40,r&&fe(i),o&=1):o=0:i.flag=o&-9|32:o=0:(i.flag=o|32,r&&fe(i)),o&1){let s=i.subLink;if(s!==void 0){let c=s.nextSubLink;c!==void 0&&(n={value:t,prev:n},t=c),e=s;continue}}if((e=t)!==void 0){t=e.nextSubLink;continue}for(;n!==void 0;)if(e=n.value,n=n.prev,e!==void 0){t=e.nextSubLink;continue e}break}while(true)}function le(e){let t=m;return m=e,t}function J(e){return B++,e.depLinkTail=void 0,e.flag=e.flag&-57|4,le(e)}function z(e,t){m=t;let n=e.depLinkTail,i=n?n.nextDepLink:e.depLink;for(;i;)i=C(i,e);e.flag&=-5;}function lt(e){let t=le(void 0),n=j;j=true;try{return e()}finally{j=n,le(t);}}function pt(e,t){let n=t.depLinkTail;for(;n;){if(n===e)return true;n=n.prevDepLink;}return false}var pe=new WeakMap,dt=0;function ce(e,t,n){if(e)for(let i=e.subLink;i;i=i.nextSubLink){let r=i.subNode;r._triggerVersion!==n&&(r._triggerVersion=n,t.push(r));}}function l(e,t){if(!m||j)return;let n=pe.get(e);n||(n=new Map,pe.set(e,n));let i=n.get(t);i||(i=new ue(n,t),n.set(t,i)),I(i,m);}function S(e,t,n,i){var c;let r=pe.get(e);if(!r)return;let o=[],s=++dt;if(n!==void 0)if(Array.isArray(n))for(let u of n)ce(r.get(u),o,s);else ce(r.get(n),o,s);if(t==="ADD"||t==="DELETE"||t==="CLEAR"){let u=Array.isArray(e)?R:De;ce(r.get(u),o,s);}for(let u of o)u.flag&2?(c=u.notify)==null||c.call(u):u.flag&1&&(u.flag|=16,u.subLink&&M(u.subLink));}var vt=new WeakMap,_t=new WeakMap;function a(e){if(!e||!isObject(e))return e;let t=e._RAW;return t?a(t):h(e)?a(e.peek()):e}var Ie=bt();function bt(){let e={};return ["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){let i=a(this);l(i,R);let r=i[t](...n);if((r===-1||r===false)&&n.length>0){let o=n.map(s=>a(s));r=i[t](...o);}return r};}),["find","findIndex","findLast","findLastIndex"].forEach(t=>{e[t]=function(...n){let i=a(this),r=w(this);l(i,R);let o=i[t](...n);return (t==="find"||t==="findLast")&&isObject(o)&&!r?d(o):o};}),["push","pop","shift","unshift","splice","sort","reverse","fill","copyWithin"].forEach(t=>{e[t]=function(...n){let i=a(this),r=Array.prototype[t].apply(i,n);return S(i,T.SET,[O,R]),r};}),["toReversed","toSorted","toSpliced"].forEach(t=>{e[t]=function(...n){let i=a(this),r=w(this);if(l(i,R),t==="toSpliced")for(let s=0,c=i.length;s<c;s++)l(i,`${s}`);let o=Array.prototype[t].apply(i,n);return Array.isArray(o)?o.map(s=>isObject(s)?d(s,r):s):o};}),["concat","slice","filter","map","flatMap","flat"].forEach(t=>{e[t]=function(...n){let i=a(this);return l(i,R),Array.prototype[t].apply(this,n)};}),["join","toString","toLocaleString"].forEach(t=>{e[t]=function(...n){let i=a(this);return l(i,R),Array.prototype[t].apply(i,n)};}),["values","keys","entries",Symbol.iterator].forEach(t=>{e[t]=function(){let n=a(this),i=w(this);l(n,O);let r=t===Symbol.iterator?n[Symbol.iterator]():n[t]();return {next(){let{value:o,done:s}=r.next();return s?{value:o,done:s}:Array.isArray(o)?{value:o.map(c=>isObject(c)?d(c,i):c),done:s}:{value:isObject(o)?d(o,i):o,done:s}},[Symbol.iterator](){return this}}};}),e}function Pe(e,t){let n=h(t)?t:a(t);return hasChanged(e,n)}var Ge=e=>({get:(t,n,i)=>{if(n==="_RAW")return t;if(n==="_IS_REACTIVE")return true;if(n==="_IS_SHALLOW")return e;if(hasOwn(Ie,n))return Ie[n];let r=Reflect.get(t,n,i);return isStringNumber(n)&&l(t,n),l(t,O),isObject(r)&&!e?d(r):r},set:(t,n,i,r)=>{let o=Reflect.get(t,n,r),s=a(i),c=Reflect.set(t,n,s,r);return Pe(s,o)&&(isStringNumber(n)?S(t,T.SET,[n,R,O]):S(t,T.SET,n)),c}}),mt=Ge(true),yt=Ge(false),Oe=e=>({get(t,n){return n==="_IS_REACTIVE"?true:n==="_RAW"?t:n==="_IS_SHALLOW"?e:Reflect.get(hasOwn(Ae,n)?Ae:t,n,t)}}),je=e=>({get(t,n){return n==="_IS_REACTIVE"?true:n==="_RAW"?t:n==="_IS_SHALLOW"?e:Reflect.get(hasOwn(Ne,n)&&n in t?Ne:t,n,t)}}),kt=Oe(true),wt=Oe(false),Lt=je(true),Rt=je(false),Ae={get(e){let t=a(this);l(t,g);let n=t.get(e);return isUndefined(n)&&!t.has(e)&&v(e)&&(n=t.get(a(e))),isObject(n)&&!w(this)?d(n):n},set(e,t){let n=a(this),i=a(e),r=n.has(i),o=n.get(i),s=a(t);return n.set(i,s),(!r||hasChanged(o,s))&&S(n,T.SET,g),this},add(e){let t=a(this),n=a(e),i=t.has(n);return t.add(n),i||S(t,T.ADD,g),this},has(e){let t=a(this);l(t,g);let n=t.has(e);return !n&&isObject(e)?t.has(a(e)):n},delete(e){let t=a(this),n=t.has(e),i=t.delete(e);return !i&&isObject(e)&&(i=t.delete(a(e))),(n||i)&&S(t,T.DELETE,g),i},clear(){let e=a(this),t=e.size>0,n=e.clear();return t&&S(e,T.CLEAR,g),n},forEach(e,t){let n=a(this),i=w(this);l(n,g),n.forEach((r,o)=>{let s=i||!isObject(r)?r:d(r),c=i||!isObject(o)?o:d(o);e.call(t,s,c,this);});},[Symbol.iterator](){let e=a(this),t=w(this);l(e,g);let n=e[Symbol.iterator]();return {next(){let{value:i,done:r}=n.next();return r?{value:i,done:r}:t?{value:i,done:r}:Array.isArray(i)?{value:i.map(o=>isObject(o)?d(o):o),done:r}:{value:isObject(i)?d(i):i,done:r}},[Symbol.iterator](){return this}}},get size(){let e=a(this);return l(e,g),e.size},keys(){let e=a(this),t=w(this);l(e,g);let n=e.keys();return {next(){let{value:i,done:r}=n.next();return r?{value:i,done:r}:{value:t||!isObject(i)?i:d(i),done:r}},[Symbol.iterator](){return this}}},values(){let e=a(this),t=w(this);l(e,g);let n=e.values();return {next(){let{value:i,done:r}=n.next();return r?{value:i,done:r}:{value:t||!isObject(i)?i:d(i),done:r}},[Symbol.iterator](){return this}}},entries(){let e=a(this),t=w(this);l(e,g);let n=e.entries();return {next(){let{value:i,done:r}=n.next();return r?{value:i,done:r}:t?{value:i,done:r}:{value:i.map(o=>isObject(o)?d(o):o),done:r}},[Symbol.iterator](){return this}}}},Ne={get(e){let t=a(this);l(t,V);let n=t.get(e);return isUndefined(n)&&!t.has(e)&&v(e)&&(n=t.get(a(e))),isObject(n)&&!w(this)?d(n):n},set(e,t){let n=a(this),i=a(e),r=n.has(i),o=n.get(i),s=a(t);return n.set(i,s),(!r||hasChanged(o,s))&&S(n,T.SET,V),this},add(e){let t=a(this),n=a(e),i=t.has(n);return t.add(n),i||S(t,T.ADD,V),this},has(e){let t=a(this);l(t,V);let n=t.has(e);return !n&&v(e)&&(n=t.has(a(e))),n},delete(e){let t=a(this),n=a(e),i=t.has(n),r=t.delete(n);return (i||r)&&S(t,T.DELETE,V),r}},Ye=e=>({get(t,n,i){if(n==="_RAW")return t;if(n==="_IS_REACTIVE")return true;if(n==="_IS_SHALLOW")return e;let r=Reflect.get(t,n,i),o=h(r)?r.value:r;return l(t,n),isObject(o)&&!e?d(o):o},set:(t,n,i,r)=>{let o=Reflect.get(t,n,r),s=a(i),c=Reflect.set(t,n,s,r);return Pe(s,o)&&S(t,T.SET,n),c},deleteProperty:(t,n)=>{let i=hasOwn(t,n),r=Reflect.deleteProperty(t,n);return i&&r&&S(t,T.DELETE,n),r}}),xt=Ye(true),Dt=Ye(false);function d(e,t=false){if(!isObject(e)||v(e))return e;let n=t?_t:vt,i=n.get(e);if(i)return i;let r;isArray(e)?r=t?mt:yt:isSet(e)||isMap(e)?r=t?kt:wt:isWeakMap(e)||isWeakSet(e)?r=t?Lt:Rt:r=t?xt:Dt;let o=new Proxy(e,r);return n.set(e,o),o}function v(e){return !!(e&&e._IS_REACTIVE)}function A(e){return v(e)||h(e)?e:d(e)}function X(e){return v(e)||h(e)?e:d(e,true)}function w(e){return !!(e&&e._IS_SHALLOW)}var Ct=e=>isObject(e)?A(e):e;var Ue;Ue="_IS_SIGNAL";var P=class{constructor(t,n=false){this.flag=1;this[Ue]=true;let i=a(t);this._rawValue=i,this._IS_SHALLOW=n,Ke(i)?v(t)?this._value=t:this._value=n?X(i):A(i):this._value=i;}get dep(){return this}get value(){let t=m;if(t&&I(this,t),this.flag&16&&this.shouldUpdate()){let i=this.subLink;i&&Y(i);}return this._value}set value(t){h(t)&&(t=t.peek());let n=t,i=a(t);if(!hasChanged(this._rawValue,i))return;if(this._oldValue=this._rawValue,this._rawValue=i,this.flag|=16,!Ke(i))this._value=i;else if(v(n))this._value=n;else {let o=this._IS_SHALLOW;this._value=o?X(i):A(i);}let r=this.subLink;r&&M(r);}shouldUpdate(){if(this.flag&=-17,!("_oldValue"in this))return true;let t=hasChanged(this._oldValue,this._rawValue);return this._oldValue=this._rawValue,t}peek(){return this._value}set(t){this.value=t;}update(t){let n=t(this.peek());h(n)?this.value=n.peek():this.value=n;}};function Ke(e){return isObject(e)?isArray(e)||isMap(e)||isSet(e)||isWeakMap(e)||isWeakSet(e)||isPlainObject(e):false}function jt(e){return h(e)?e:new P(e)}function Yt(e){return h(e)&&(e=e.peek()),new P(e,true)}function h(e){return !!e&&!!e._IS_SIGNAL}var K=new Set,he=new Set,We=Promise.resolve(),Te=false,Mt=100;function He(e){return e?We.then(e):We}function U(e){K.add(e),Fe();}function Fe(){Te||(Te=true,He(Se));}function qe(e){he.add(e),Fe();}function Se(){Te=false,Kt();let e=0;for(;K.size>0;){if(++e>Mt){K.clear();return}let t=[...K];K.clear();for(let n of t)try{n();}catch(i){}}}function Kt(){let e=Array.from(he);he.clear();for(let t of e)try{t();}catch(n){}}function Z(e,t){switch(t){case "sync":return ()=>e();case "pre":return ()=>qe(e);case "post":return ()=>U(e);default:return ()=>U(e)}}var W=0;function ee(e){Be();try{return e()}finally{$e();}}function Be(){W++;}function $e(){W--,W===0&&Se();}function Ee(){return W>0}function Ut(){return W}var y,te=class{constructor(t=false,n=void 0){this.detached=t;this.parent=n;this._active=true;this.effects=[];this.scopes=[];this.cleanups=[];!t&&y&&(this.parent=y,y.scopes.push(this));}get active(){return this._active}pause(){var t,n;if(this._active){for(let i=0;i<this.scopes.length;i++)this.scopes[i].pause();for(let i=0;i<this.effects.length;i++)(n=(t=this.effects[i]).pause)==null||n.call(t);}}resume(){var t,n;if(this._active){for(let i=0;i<this.scopes.length;i++)this.scopes[i].resume();for(let i=0;i<this.effects.length;i++)(n=(t=this.effects[i]).resume)==null||n.call(t);}}run(t){if(!this._active)return;let n=y;y=this;try{return t()}finally{y=n;}}stop(t=false){if(!this._active)return;this._active=false;for(let i=0;i<this.scopes.length;i++)this.scopes[i].stop(true);this.scopes.length=0;let n=this.effects.slice();this.effects.length=0;for(let i of n)i.stop();for(let i=0;i<this.cleanups.length;i++)this.cleanups[i]();if(this.cleanups.length=0,!t&&this.parent){let i=this.parent.scopes.indexOf(this);i>=0&&this.parent.scopes.splice(i,1);}this.parent=void 0;}_record(t){this.effects.push(t),t.scope=this;}_remove(t){let n=this.effects.indexOf(t);n>=0&&this.effects.splice(n,1);}_pushCleanup(t){this.cleanups.push(t);}};function Wt(e=false){return new te(e)}function Ht(){return y}function Ft(e){let t=y;return y=e,t}function qt(e,t=false){y&&y._pushCleanup(e);}function ne(e,t=y){t&&t.active&&t._record(e);}function ie(e){let t=e.scope;t&&(e.scope=void 0,t._remove(e));}var ze;ze="_IS_EFFECT";var ge=class{constructor(t,n){this.flag=18;this[ze]=true;this._active=true;if(this.fn=t,n){this.options=n;let i=n.flush||n.scheduler;i&&!isFunction(i)&&(this._flushScheduler=Z(()=>this.run(),i));}ne(this);}get active(){return this._active}get dirty(){let t=this.flag;if(t&16)return true;if(t&32){if(this.depLink&&$(this.depLink,this))return this.flag=t&-33|16,true;this.flag=t&-33;}return false}pause(){this.flag|=256;}resume(){let n=this.flag&-257;this.flag=n;let i=(n&16)!==0,r=(n&32)!==0;(i||r)&&this.notify();}run(){if(!this._active)return this.fn();let t=this.flag;this.flag=t&-49|512;let n=J(this);try{return this.fn()}catch(i){throw this.flag|=16,i}finally{this.flag&=-513,z(this,n);}}getJob(){return this._job||(this._job=()=>this.run()),this._job}notify(){var r,o,s;let t=this.flag;if(!this._active||t&784)return;this.flag=t|16;let n=((r=this.options)==null?void 0:r.flush)||((o=this.options)==null?void 0:o.scheduler);n?isFunction(n)?n(this):(s=this._flushScheduler)==null||s.call(this):Ee()?U(this.getJob()):this.run();}stop(){var i;if(!this._active)return;this._active=false,ie(this);let t=this.depLink;for(;t;)t=C(t,this);let n=this.subLink;for(;n;)n=C(n);this._job=void 0,this._flushScheduler=void 0,this.depLinkTail=void 0,this.subLinkTail=void 0,(i=this.options)!=null&&i.onStop&&this.options.onStop();}};function re(e,t){let n=new ge(e,t);try{n.run();}catch(r){throw n.stop(),r}let i=()=>n.run();return i.effect=n,i.stop=()=>n.stop(),i}function Bt(e){e.effect.stop();}function $t(e){return !!(e&&e._IS_EFFECT)}function Jt(e,t,n){let i=t;return re(()=>{i=e(i);},n)}var x=Symbol("computed-no-value"),Ze;Ze="_IS_COMPUTED";var oe=class{constructor(t,n,i,r){this.flag=17;this[Ze]=true;this._value=x;this._active=true;this.getter=t,this.setter=n,this.onTrack=i,this.onTrigger=r,this.flag|=16,ne(this);}get value(){if(!this.active)return this._value===x?this.getter():this._value;m&&I(this,m);let t=this.flag,n=this._value!==x;return n&&!(t&48)?this._value:!n||t&16?(this.recompute(),this._value):(t&32&&(this.depLink&&$(this.depLink,this)?this.recompute():this.flag=t&-33),this._value)}set value(t){this.setter&&this.setter(t);}peek(){return this.active?(this._value===x&&this.recompute(),this._value):this._value===x?this.getter():this._value}get active(){return this._active}recompute(){if(!this._active){this._value===x&&(this._value=this.getter());return}let t=this._value,n=t!==x,i=J(this);try{let r=this.getter(),o=this.flag,s=this.subLink,c=-49;!n||hasChanged(t,r)?(this._value=r,this.flag=o&c,s&&Y(s)):this.flag=o&c;}catch(r){let o=-49;throw this.flag&=o,this._value=x,r}finally{z(this,i);}}shouldUpdate(){let t=this._value!==x,n=this._value;return this.recompute(),t?hasChanged(this._value,n):true}stop(){if(!this._active)return;this._active=false,ie(this);let t=this.depLink;for(;t;)t=C(t,this);let n=this.subLink;for(;n;)n=C(n);this.depLinkTail=void 0,this.subLinkTail=void 0,this.flag&=-49;}};function ve(e){if(H(e))return e;if(!e)throw new Error("[Computed] Invalid argument: computed() requires a getter function or options object.");if(isFunction(e))return new oe(e);if(isPlainObject(e)){let{get:t,set:n,onTrack:i,onTrigger:r}=e;if(!t)throw new Error(`[Computed] Invalid options: getter function is required.
1
+ import {isObject,isFunction,isPlainObject,isArray,isSet,isMap,isWeakMap,isWeakSet,hasChanged,isStringNumber,hasOwn,isUndefined}from'@estjs/shared';var ct=Object.defineProperty;var Re=Object.getOwnPropertySymbols;var ut=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable;var xe=(e,t,n)=>t in e?ct(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n,De=(e,t)=>{for(var n in t||(t={}))ut.call(t,n)&&xe(e,n,t[n]);if(Re)for(var n of Re(t))ft.call(t,n)&&xe(e,n,t[n]);return e};var S={SET:"SET",ADD:"ADD",DELETE:"DELETE",CLEAR:"CLEAR"};var O=Symbol(""),E=Symbol(""),P=Symbol(""),Ce=Symbol("");var R=Symbol("");var $=0,m,j=false,ue=class{constructor(t,n){this.map=t;this.key=n;this.isDep=true;this.flag=0;}get subLink(){return this._subLink}set subLink(t){this._subLink=t,t===void 0&&this.map.delete(this.key);}};function fe(e){e.notify();}function I(e,t){if(j)return;let n=t.depLinkTail;if(n&&n.depNode===e)return n;let i=n?n.nextDepLink:t.depLink;if(i&&i.depNode===e)return i.version=$,t.depLinkTail=i,i;let r=e.subLinkTail;if(r&&r.version===$&&r.subNode===t)return t.depLinkTail=r,r;let o={version:$,depNode:e,subNode:t,prevSubLink:r,nextSubLink:void 0,prevDepLink:n,nextDepLink:i};return i&&(i.prevDepLink=o),n?n.nextDepLink=o:t.depLink=o,r?r.nextSubLink=o:e.subLink=o,e.subLinkTail=o,t.depLinkTail=o,o}function D(e,t=e.subNode){let n=e.depNode,i=e.prevSubLink,r=e.nextSubLink,o=e.prevDepLink,s=e.nextDepLink;if(s?s.prevDepLink=o:t.depLinkTail=o,o?o.nextDepLink=s:t.depLink=s,r?r.prevSubLink=i:n.subLinkTail=i,i)i.nextSubLink=r;else if(n.subLink=r,r===void 0){let c=n.depLink;for(;c;)c=D(c,n);n.depLinkTail=void 0,n.isDep||(n.flag|=16);}return s}function J(e,t){let n,i=0,r=false;e:do{let o=false;if(t.flag&16)o=true;else {let s=e.depNode,c=s.flag;if((c&17)===17){let f=s.subLink;f&&f.nextSubLink&&Y(f),o=true;}else if((c&33)===33)if(s.depLink){n={link:e,prev:n},e=s.depLink,t=s,++i;continue e}else s.flag&=-33;else c&32&&(s.flag&=-33);}if(!o&&e.nextDepLink!==void 0){e=e.nextDepLink;continue e}for(r=o;i--;){e=n.link,n=n.prev,t=e.subNode;let s=e.depNode;if(r?s.flag=s.flag&-33|16:s.flag&=-33,s.flag&16&&(r=true),!r&&e.nextDepLink!==void 0){e=e.nextDepLink;continue e}}return r?t.flag=t.flag&-33|16:t.flag&=-33,r}while(true)}function Y(e){for(;e;){let t=e.subNode,n=t.flag;(n&48)===32&&(t.flag=n|16,(n&6)===2&&fe(t)),e=e.nextSubLink;}}function M(e){let t=e.nextSubLink,n;e:do{let i=e.subNode,r=i.flag&2,o=i.flag;if(o&60?o&12?o&4?!(o&48)&&dt(e,i)?(i.flag=o|40,r&&fe(i),o&=1):o=0:i.flag=o&-9|32:o=0:(i.flag=o|32,r&&fe(i)),o&1){let s=i.subLink;if(s!==void 0){let c=s.nextSubLink;c!==void 0&&(n={value:t,prev:n},t=c),e=s;continue}}if((e=t)!==void 0){t=e.nextSubLink;continue}for(;n!==void 0;)if(e=n.value,n=n.prev,e!==void 0){t=e.nextSubLink;continue e}break}while(true)}function le(e){let t=m;return m=e,t}function z(e){return $++,e.depLinkTail=void 0,e.flag=e.flag&-57|4,le(e)}function Q(e,t){m=t;let n=e.depLinkTail,i=n?n.nextDepLink:e.depLink;for(;i;)i=D(i,e);e.flag&=-5;}function pt(e){let t=le(void 0),n=j;j=true;try{return e()}finally{j=n,le(t);}}function dt(e,t){let n=t.depLinkTail;for(;n;){if(n===e)return true;n=n.prevDepLink;}return false}var pe=new WeakMap,ht=0;function ce(e,t,n){if(e)for(let i=e.subLink;i;i=i.nextSubLink){let r=i.subNode;r._triggerVersion!==n&&(r._triggerVersion=n,t.push(r));}}function l(e,t){if(!m||j)return;let n=pe.get(e);n||(n=new Map,pe.set(e,n));let i=n.get(t);i||(i=new ue(n,t),n.set(t,i)),I(i,m);}function v(e,t,n,i){var c;let r=pe.get(e);if(!r)return;let o=[],s=++ht;if(n!==void 0)if(Array.isArray(n))for(let f of n)ce(r.get(f),o,s);else ce(r.get(n),o,s);if(t==="ADD"||t==="DELETE"||t==="CLEAR"){let f=Array.isArray(e)?R:Ce;ce(r.get(f),o,s);}for(let f of o)f.flag&2?(c=f.notify)==null||c.call(f):f.flag&1&&(f.flag|=16,f.subLink&&M(f.subLink));}var _t=new WeakMap,bt=new WeakMap;function a(e){if(!e||!isObject(e))return e;let t=e._RAW;return t?a(t):h(e)?a(e.peek()):e}var Ae=mt();function mt(){let e={};return ["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){let i=a(this);l(i,R);let r=i[t](...n);if((r===-1||r===false)&&n.length>0){let o=n.map(s=>a(s));r=i[t](...o);}return r};}),["find","findIndex","findLast","findLastIndex"].forEach(t=>{e[t]=function(...n){let i=a(this),r=w(this);l(i,R);let o=i[t](...n);return (t==="find"||t==="findLast")&&isObject(o)&&!r?d(o):o};}),["push","pop","shift","unshift","splice","sort","reverse","fill","copyWithin"].forEach(t=>{e[t]=function(...n){let i=a(this),r=Array.prototype[t].apply(i,n);return v(i,S.SET,[O,R]),r};}),["toReversed","toSorted","toSpliced"].forEach(t=>{e[t]=function(...n){let i=a(this),r=w(this);l(i,R);let o=Array.prototype[t].apply(i,n);return Array.isArray(o)?o.map(s=>isObject(s)?d(s,r):s):o};}),["concat","slice","filter","map","flatMap","flat"].forEach(t=>{e[t]=function(...n){let i=a(this);return l(i,R),Array.prototype[t].apply(this,n)};}),["join","toString","toLocaleString"].forEach(t=>{e[t]=function(...n){let i=a(this);return l(i,R),Array.prototype[t].apply(i,n)};}),["values","keys","entries",Symbol.iterator].forEach(t=>{e[t]=function(){let n=a(this),i=w(this);l(n,O);let r=t===Symbol.iterator?n[Symbol.iterator]():n[t]();return {next(){let{value:o,done:s}=r.next();return s?{value:o,done:s}:Array.isArray(o)?{value:o.map(c=>isObject(c)?d(c,i):c),done:s}:{value:isObject(o)?d(o,i):o,done:s}},[Symbol.iterator](){return this}}};}),e}function Ge(e,t){let n=h(t)?t:a(t);return hasChanged(e,n)}var Oe=e=>({get:(t,n,i)=>{if(n==="_RAW")return t;if(n==="_IS_REACTIVE")return true;if(n==="_IS_SHALLOW")return e;if(hasOwn(Ae,n))return Ae[n];let r=Reflect.get(t,n,i);return isStringNumber(n)&&l(t,n),l(t,O),isObject(r)&&!e?d(r):r},set:(t,n,i,r)=>{let o=Reflect.get(t,n,r),s=a(i),c=Reflect.set(t,n,s,r);return Ge(s,o)&&(isStringNumber(n)?v(t,S.SET,[n,R,O]):v(t,S.SET,n)),c}}),yt=Oe(true),kt=Oe(false),je=e=>({get(t,n){return n==="_IS_REACTIVE"?true:n==="_RAW"?t:n==="_IS_SHALLOW"?e:Reflect.get(hasOwn(Ne,n)?Ne:t,n,t)}}),Ye=e=>({get(t,n){return n==="_IS_REACTIVE"?true:n==="_RAW"?t:n==="_IS_SHALLOW"?e:Reflect.get(hasOwn(Ve,n)&&n in t?Ve:t,n,t)}}),wt=je(true),Lt=je(false),Rt=Ye(true),xt=Ye(false),Ne={get(e){let t=a(this);l(t,E);let n=t.get(e);return isUndefined(n)&&!t.has(e)&&g(e)&&(n=t.get(a(e))),isObject(n)&&!w(this)?d(n):n},set(e,t){let n=a(this),i=a(e),r=n.has(i),o=n.get(i),s=a(t);return n.set(i,s),(!r||hasChanged(o,s))&&v(n,S.SET,E),this},add(e){let t=a(this),n=a(e),i=t.has(n);return t.add(n),i||v(t,S.ADD,E),this},has(e){let t=a(this);l(t,E);let n=t.has(e);return !n&&isObject(e)?t.has(a(e)):n},delete(e){let t=a(this),n=t.has(e),i=t.delete(e);return !i&&isObject(e)&&(i=t.delete(a(e))),(n||i)&&v(t,S.DELETE,E),i},clear(){let e=a(this),t=e.size>0,n=e.clear();return t&&v(e,S.CLEAR,E),n},forEach(e,t){let n=a(this),i=w(this);l(n,E),n.forEach((r,o)=>{let s=i||!isObject(r)?r:d(r),c=i||!isObject(o)?o:d(o);e.call(t,s,c,this);});},[Symbol.iterator](){let e=a(this),t=w(this);l(e,E);let n=e[Symbol.iterator]();return {next(){let{value:i,done:r}=n.next();return r?{value:i,done:r}:t?{value:i,done:r}:Array.isArray(i)?{value:i.map(o=>isObject(o)?d(o):o),done:r}:{value:isObject(i)?d(i):i,done:r}},[Symbol.iterator](){return this}}},get size(){let e=a(this);return l(e,E),e.size},keys(){let e=a(this),t=w(this);l(e,E);let n=e.keys();return {next(){let{value:i,done:r}=n.next();return r?{value:i,done:r}:{value:t||!isObject(i)?i:d(i),done:r}},[Symbol.iterator](){return this}}},values(){let e=a(this),t=w(this);l(e,E);let n=e.values();return {next(){let{value:i,done:r}=n.next();return r?{value:i,done:r}:{value:t||!isObject(i)?i:d(i),done:r}},[Symbol.iterator](){return this}}},entries(){let e=a(this),t=w(this);l(e,E);let n=e.entries();return {next(){let{value:i,done:r}=n.next();return r?{value:i,done:r}:t?{value:i,done:r}:{value:i.map(o=>isObject(o)?d(o):o),done:r}},[Symbol.iterator](){return this}}}},Ve={get(e){let t=a(this);l(t,P);let n=t.get(e);return isUndefined(n)&&!t.has(e)&&g(e)&&(n=t.get(a(e))),isObject(n)&&!w(this)?d(n):n},set(e,t){let n=a(this),i=a(e),r=n.has(i),o=n.get(i),s=a(t);return n.set(i,s),(!r||hasChanged(o,s))&&v(n,S.SET,P),this},add(e){let t=a(this),n=a(e),i=t.has(n);return t.add(n),i||v(t,S.ADD,P),this},has(e){let t=a(this);l(t,P);let n=t.has(e);return !n&&g(e)&&(n=t.has(a(e))),n},delete(e){let t=a(this),n=a(e),i=t.has(n),r=t.delete(n);return (i||r)&&v(t,S.DELETE,P),r}},Me=e=>({get(t,n,i){if(n==="_RAW")return t;if(n==="_IS_REACTIVE")return true;if(n==="_IS_SHALLOW")return e;let r=Reflect.get(t,n,i),o=h(r)?r.value:r;return l(t,n),isObject(o)&&!e?d(o):o},set:(t,n,i,r)=>{let o=Reflect.get(t,n,r),s=a(i),c=Reflect.set(t,n,s,r);return Ge(s,o)&&v(t,S.SET,n),c},deleteProperty:(t,n)=>{let i=hasOwn(t,n),r=Reflect.deleteProperty(t,n);return i&&r&&v(t,S.DELETE,n),r}}),Dt=Me(true),Ct=Me(false);function d(e,t=false){if(!isObject(e)||g(e))return e;let n=t?bt:_t,i=n.get(e);if(i)return i;let r;isArray(e)?r=t?yt:kt:isSet(e)||isMap(e)?r=t?wt:Lt:isWeakMap(e)||isWeakSet(e)?r=t?Rt:xt:r=t?Dt:Ct;let o=new Proxy(e,r);return n.set(e,o),o}function g(e){return !!(e&&e._IS_REACTIVE)}function A(e){return g(e)||h(e)?e:d(e)}function Z(e){return g(e)||h(e)?e:d(e,true)}function w(e){return !!(e&&e._IS_SHALLOW)}var It=e=>isObject(e)?A(e):e;var We;We="_IS_SIGNAL";var G=class{constructor(t,n=false){this.flag=1;this[We]=true;let i=a(t);this._rawValue=i,this._IS_SHALLOW=n,Ue(i)?g(t)?this._value=t:this._value=n?Z(i):A(i):this._value=i;}get dep(){return this}get value(){let t=m;if(t&&I(this,t),this.flag&16&&this.shouldUpdate()){let i=this.subLink;i&&Y(i);}return this._value}set value(t){h(t)&&(t=t.peek());let n=t,i=a(t);if(!hasChanged(this._rawValue,i))return;if(this._oldValue=this._rawValue,this._rawValue=i,this.flag|=16,!Ue(i))this._value=i;else if(g(n))this._value=n;else {let o=this._IS_SHALLOW;this._value=o?Z(i):A(i);}let r=this.subLink;r&&M(r);}shouldUpdate(){if(this.flag&=-17,!("_oldValue"in this))return true;let t=hasChanged(this._oldValue,this._rawValue);return this._oldValue=this._rawValue,t}peek(){return this._value}set(t){this.value=t;}update(t){let n=t(this.peek());h(n)?this.value=n.peek():this.value=n;}};function Ue(e){return isObject(e)?isArray(e)||isMap(e)||isSet(e)||isWeakMap(e)||isWeakSet(e)||isPlainObject(e):false}function Yt(e){return h(e)?e:new G(e)}function Mt(e){return h(e)&&(e=e.peek()),new G(e,true)}function h(e){return !!e&&!!e._IS_SIGNAL}var K=new Set,he=new Set,He=Promise.resolve(),Te=false,Kt=100;function Fe(e){return e?He.then(e):He}function U(e){K.add(e),qe();}function qe(){Te||(Te=true,Fe(Se));}function Be(e){he.add(e),qe();}function Se(){Te=false,Ut();let e=0;for(;K.size>0;){if(++e>Kt){K.clear();return}let t=[...K];K.clear();for(let n of t)try{n();}catch(i){}}}function Ut(){let e=Array.from(he);he.clear();for(let t of e)try{t();}catch(n){}}function ee(e,t){switch(t){case "sync":return ()=>e();case "pre":return ()=>Be(e);case "post":return ()=>U(e);default:return ()=>U(e)}}var W=0;function ve(e){$e();try{return e()}finally{Je();}}function $e(){W++;}function Je(){W--,W===0&&Se();}function Ee(){return W>0}function Wt(){return W}var y,te=class{constructor(t=false,n=void 0){this.detached=t;this.parent=n;this._active=true;this.effects=new Set;this.scopes=new Set;this.cleanups=[];!t&&y&&(this.parent=y,y.scopes.add(this));}get active(){return this._active}pause(){var t;if(this._active){for(let n of this.scopes)n.pause();for(let n of this.effects)(t=n.pause)==null||t.call(n);}}resume(){var t;if(this._active){for(let n of this.scopes)n.resume();for(let n of this.effects)(t=n.resume)==null||t.call(n);}}run(t){if(!this._active)return;let n=y;y=this;try{return t()}finally{y=n;}}stop(t=false){if(!this._active)return;this._active=false;for(let i of this.scopes)i.stop(true);this.scopes.clear();let n=Array.from(this.effects);this.effects.clear();for(let i of n)i.stop();for(let i=0;i<this.cleanups.length;i++)this.cleanups[i]();this.cleanups.length=0,!t&&this.parent&&this.parent.scopes.delete(this),this.parent=void 0;}_record(t){this.effects.add(t),t.scope=this;}_remove(t){this.effects.delete(t);}_pushCleanup(t){this.cleanups.push(t);}};function Ht(e=false){return new te(e)}function Ft(){return y}function qt(e){let t=y;return y=e,t}function Bt(e,t=false){y&&y._pushCleanup(e);}function ne(e,t=y){t&&t.active&&t._record(e);}function ie(e){let t=e.scope;t&&(e.scope=void 0,t._remove(e));}var Qe;Qe="_IS_EFFECT";var ge=class{constructor(t,n){this.flag=18;this[Qe]=true;this._active=true;if(this.fn=t,n){this.options=n;let i=n.flush||n.scheduler;i&&!isFunction(i)&&(this._flushScheduler=ee(()=>this.run(),i));}ne(this);}get active(){return this._active}get dirty(){let t=this.flag;if(t&16)return true;if(t&32){if(this.depLink&&J(this.depLink,this))return this.flag=t&-33|16,true;this.flag=t&-33;}return false}pause(){this.flag|=256;}resume(){let n=this.flag&-257;this.flag=n;let i=(n&16)!==0,r=(n&32)!==0;(i||r)&&this.notify();}run(){if(!this._active)return this.fn();let t=this.flag;this.flag=t&-49|512;let n=z(this);try{return this.fn()}catch(i){throw this.flag|=16,i}finally{this.flag&=-513,Q(this,n);}}getJob(){return this._job||(this._job=()=>this.run()),this._job}notify(){var r,o,s;let t=this.flag;if(!this._active||t&784)return;this.flag=t|16;let n=((r=this.options)==null?void 0:r.flush)||((o=this.options)==null?void 0:o.scheduler);n?isFunction(n)?n(this):(s=this._flushScheduler)==null||s.call(this):Ee()?U(this.getJob()):this.run();}stop(){var i;if(!this._active)return;this._active=false,ie(this);let t=this.depLink;for(;t;)t=D(t,this);let n=this.subLink;for(;n;)n=D(n);this._job=void 0,this._flushScheduler=void 0,this.depLinkTail=void 0,this.subLinkTail=void 0,(i=this.options)!=null&&i.onStop&&this.options.onStop();}};function re(e,t){let n=new ge(e,t);try{n.run();}catch(r){throw n.stop(),r}let i=()=>n.run();return i.effect=n,i.stop=()=>n.stop(),i}function $t(e){e.effect.stop();}function Jt(e){return !!(e&&e._IS_EFFECT)}function zt(e,t,n){let i=t;return re(()=>{i=e(i);},n)}var x=Symbol("computed-no-value"),et;et="_IS_COMPUTED";var oe=class{constructor(t,n,i,r){this.flag=17;this[et]=true;this._value=x;this._active=true;this.getter=t,this.setter=n,this.onTrack=i,this.onTrigger=r,this.flag|=16,ne(this);}get value(){if(!this.active)return this._value===x?this.getter():this._value;m&&I(this,m);let t=this.flag,n=this._value!==x;return n&&!(t&48)?this._value:!n||t&16?(this.recompute(),this._value):(t&32&&(this.depLink&&J(this.depLink,this)?this.recompute():this.flag=t&-33),this._value)}set value(t){this.setter&&this.setter(t);}peek(){return this.active?(this._value===x&&this.recompute(),this._value):this._value===x?this.getter():this._value}get active(){return this._active}recompute(){if(!this._active){this._value===x&&(this._value=this.getter());return}let t=this._value,n=t!==x,i=z(this);try{let r=this.getter(),o=this.flag,s=this.subLink,c=-49;!n||hasChanged(t,r)?(this._value=r,this.flag=o&c,s&&Y(s)):this.flag=o&c;}catch(r){let o=-49;throw this.flag&=o,this._value=x,r}finally{Q(this,i);}}shouldUpdate(){let t=this._value!==x,n=this._value;return this.recompute(),t?hasChanged(this._value,n):true}stop(){if(!this._active)return;this._active=false,ie(this);let t=this.depLink;for(;t;)t=D(t,this);let n=this.subLink;for(;n;)n=D(n);this.depLinkTail=void 0,this.subLinkTail=void 0,this.flag&=-49;}};function _e(e){if(H(e))return e;if(!e)throw new Error("[Computed] Invalid argument: computed() requires a getter function or options object.");if(isFunction(e))return new oe(e);if(isPlainObject(e)){let{get:t,set:n,onTrack:i,onTrigger:r}=e;if(!t)throw new Error(`[Computed] Invalid options: getter function is required.
2
2
  Usage: computed({ get: () => value, set: (v) => { ... } })`);if(!isFunction(t))throw new TypeError(`[Computed] Invalid options: getter must be a function.
3
3
  Received: ${typeof t}`);return new oe(t,n,i,r)}throw new Error(`[Computed] Invalid argument: expected a function or options object.
4
- Received: ${typeof e}`)}function H(e){return !!e&&!!e._IS_COMPUTED}function Qt(e){let{state:t,getters:n,actions:i}=e,r=xe({},t),o=A(t),s=new Set,c=new Set,u=f=>{s.forEach(E=>E(f)),c.forEach(E=>E(f));},G={patch$(f){ee(()=>{Object.assign(o,f);}),u(o);},subscribe$(f){s.add(f);},unsubscribe$(f){s.delete(f);},onAction$(f){c.add(f);},offAction$(f){c.delete(f);},reset$(){ee(()=>{Object.assign(o,r);}),u(o);}},L={};for(let f of Object.keys(r))Object.defineProperty(L,f,{get:()=>o[f],set:E=>{o[f]=E;},enumerable:true,configurable:true});if(Object.defineProperty(L,"state",{value:o,enumerable:true,configurable:true,writable:true}),Object.assign(L,G),n)for(let f in n){let E=n[f];if(!E)continue;let D=ve(()=>E.call(L,o));Object.defineProperty(L,f,{get:()=>D.value,enumerable:true,configurable:true});}if(i)for(let f in i){let E=i[f];E&&(L[f]=(...D)=>{let ae=E.apply(L,D);return c.forEach(F=>F(o)),ae});}return L}function Xt(e){let t=new e,n=Object.create(null),i={},r={};return Object.getOwnPropertyNames(t).forEach(o=>{n[o]=t[o];}),Object.getOwnPropertyNames(e.prototype).forEach(o=>{let s=Object.getOwnPropertyDescriptor(e.prototype,o);s&&(isFunction(s.get)?i[o]=function(){return s.get.call(this)}:isFunction(s.value)&&o!=="constructor"&&(r[o]=function(...c){return s.value.apply(this,c)}));}),{state:n,getters:i,actions:r}}function Zt(e){return ()=>{let t;return isFunction(e)?t=Xt(e):t=e,Qt(t)}}var et,tt,se=class extends(tt=P,et="_IS_REF",tt){constructor(n){super(n,true);this[et]=true;}get value(){let n=m;return n&&I(this,n),this._value}set value(n){h(n)&&(n=n.peek()),be(n)&&(n=n.value),hasChanged(this._value,n)&&(this._rawValue=n,this._value=n,this.flag|=16,this.subLink&&M(this.subLink));}};function tn(e=void 0){return be(e)?e:h(e)?new se(e.peek()):new se(e)}function be(e){return !!e&&!!e._IS_REF}var nt={},it=new Set,me=false;function N(e,t){if(!isObject(e)||t.has(e))return e;if(t.add(e),h(e)||H(e))N(e.value,t);else if(Array.isArray(e))for(let n of e)N(n,t);else if(isMap(e))e.forEach(n=>{N(n,t);}),e.keys(),e.values();else if(isSet(e))e.forEach(n=>{N(n,t);}),e.values();else for(let n of Object.keys(e))N(e[n],t);return e}function st(e){if(me)return N(e,new Set);me=true,it.clear();try{return N(e,it)}finally{me=false;}}function rt(e){return isFunction(e)?e:h(e)||H(e)?()=>e.value:v(e)?()=>st(e):()=>e}function an(e){if(Array.isArray(e)){let t=e.map(n=>rt(n));return ()=>t.map(n=>n())}return rt(e)}function cn(e,t,n={}){let{immediate:i=false,deep:r=false,flush:o="post",once:s=false}=n,c=nt,u,G=true,L=!Array.isArray(e)&&v(e),f=r&&!L,E=an(e),D,ae=k=>{D=()=>{D=void 0;try{k();}catch(q){}};},F=()=>{D&&D();},ye=k=>{F(),t(k,c===nt?void 0:c,ae),c=k,s&&we();},ke=re(()=>{let k=E();return f&&st(k),u=k,k},{scheduler:Z(()=>{if(!G)return;let k=ke.effect;if(!k.active)return;let q=k.run();(r||isObject(q)||hasChanged(q,c))&&ye(q);},o)});function we(){G&&(G=false,F(),ke.stop());}return i?ye(u):c=u,we}export{te as EffectScope,T as TriggerOpTypes,ee as batch,ve as computed,Zt as createStore,re as effect,Wt as effectScope,$e as endBatch,Ut as getBatchDepth,Ht as getCurrentScope,Ee as isBatching,H as isComputed,$t as isEffect,v as isReactive,be as isRef,w as isShallow,h as isSignal,Jt as memoEffect,He as nextTick,qt as onScopeDispose,U as queueJob,qe as queuePreFlushCb,A as reactive,tn as ref,Ft as setCurrentScope,X as shallowReactive,Yt as shallowSignal,jt as signal,Be as startBatch,Bt as stop,a as toRaw,Ct as toReactive,S as trigger,lt as untrack,cn as watch};
4
+ Received: ${typeof e}`)}function H(e){return !!e&&!!e._IS_COMPUTED}function Xt(e){let{state:t,getters:n,actions:i}=e,r=De({},t),o=A(t),s=new Set,c=new Set,f=u=>{s.forEach(T=>T(u)),c.forEach(T=>T(u));},V=(u,T,C)=>(u.add(T),()=>u.delete(T)),F=u=>{ve(u),f(o);},ae={$patch(u){F(()=>Object.assign(o,u));},$subscribe(u){return V(s,u)},$unsubscribe(u){s.delete(u);},$onAction(u){return V(c,u)},$offAction(u){c.delete(u);},$reset(){F(()=>Object.assign(o,r));}},L={};for(let u of Object.keys(r))Object.defineProperty(L,u,{get:()=>o[u],set:T=>{o[u]=T;},enumerable:true,configurable:true});if(Object.defineProperty(L,"state",{value:o,enumerable:true,configurable:true,writable:true}),Object.assign(L,ae),n)for(let u in n){let T=n[u];if(!T)continue;let C=_e(()=>T.call(L,o));Object.defineProperty(L,u,{get:()=>C.value,enumerable:true,configurable:true});}if(i)for(let u in i){let T=i[u];T&&(L[u]=(...C)=>{let q=T.apply(L,C);return c.forEach(ke=>ke(o)),q});}return L}function Zt(e){let t=new e,n=Object.create(null),i={},r={};return Object.getOwnPropertyNames(t).forEach(o=>{n[o]=t[o];}),Object.getOwnPropertyNames(e.prototype).forEach(o=>{let s=Object.getOwnPropertyDescriptor(e.prototype,o);s&&(isFunction(s.get)?i[o]=function(){return s.get.call(this)}:isFunction(s.value)&&o!=="constructor"&&(r[o]=function(...c){return s.value.apply(this,c)}));}),{state:n,getters:i,actions:r}}function en(e){return ()=>{let t;return isFunction(e)?t=Zt(e):t=e,Xt(t)}}var tt,nt,se=class extends(nt=G,tt="_IS_REF",nt){constructor(n){super(n,true);this[tt]=true;}get value(){let n=m;return n&&I(this,n),this._value}set value(n){h(n)&&(n=n.peek()),me(n)&&(n=n.value),hasChanged(this._value,n)&&(this._rawValue=n,this._value=n,this.flag|=16,this.subLink&&M(this.subLink));}};function nn(e=void 0){return me(e)?e:h(e)?new se(e.peek()):new se(e)}function me(e){return !!e&&!!e._IS_REF}var it={},rt=new Set,ye=false;function N(e,t){if(!isObject(e)||t.has(e))return e;if(t.add(e),h(e)||H(e))N(e.value,t);else if(Array.isArray(e))for(let n of e)N(n,t);else if(isMap(e))e.forEach(n=>{N(n,t);}),e.keys(),e.values();else if(isSet(e))e.forEach(n=>{N(n,t);}),e.values();else for(let n of Object.keys(e))N(e[n],t);return e}function at(e){if(ye)return N(e,new Set);ye=true,rt.clear();try{return N(e,rt)}finally{ye=false;}}function ot(e){return isFunction(e)?e:h(e)||H(e)?()=>e.value:g(e)?()=>at(e):()=>e}function cn(e){if(Array.isArray(e)){let t=e.map(n=>ot(n));return ()=>t.map(n=>n())}return ot(e)}function un(e,t,n={}){let{immediate:i=false,deep:r=false,flush:o="post",once:s=false}=n,c=it,f,V=true,F=!Array.isArray(e)&&g(e),ae=r&&!F,L=cn(e),u,T=k=>{u=()=>{u=void 0;try{k();}catch(B){}};},C=()=>{u&&u();},q=k=>{C(),t(k,c===it?void 0:c,T),c=k,s&&Le();},we=re(()=>{let k=L();return ae&&at(k),f=k,k},{scheduler:ee(()=>{if(!V)return;let k=we.effect;if(!k.active)return;let B=k.run();(r||isObject(B)||hasChanged(B,c))&&q(B);},o)});function Le(){V&&(V=false,C(),we.stop());}return i?q(f):c=f,Le}export{te as EffectScope,S as TriggerOpTypes,ve as batch,_e as computed,en as createStore,re as effect,Ht as effectScope,Je as endBatch,Wt as getBatchDepth,Ft as getCurrentScope,Ee as isBatching,H as isComputed,Jt as isEffect,g as isReactive,me as isRef,w as isShallow,h as isSignal,zt as memoEffect,Fe as nextTick,Bt as onScopeDispose,U as queueJob,Be as queuePreFlushCb,A as reactive,nn as ref,qt as setCurrentScope,Z as shallowReactive,Mt as shallowSignal,Yt as signal,$e as startBatch,$t as stop,a as toRaw,It as toReactive,v as trigger,pt as untrack,un as watch};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@estjs/signals",
3
- "version": "0.0.17-beta.2",
3
+ "version": "0.0.17-beta.3",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -52,7 +52,7 @@
52
52
  "unpkg": "dist/signals.js",
53
53
  "jsdelivr": "dist/signals.js",
54
54
  "dependencies": {
55
- "@estjs/shared": "0.0.17-beta.2"
55
+ "@estjs/shared": "0.0.17-beta.3"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsup && cross-env NODE_ENV=production tsup --clean=false",