@estjs/signals 0.0.17-beta.1 → 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 Ze=Object.defineProperty;var Se=Object.getOwnPropertySymbols;var et=Object.prototype.hasOwnProperty,tt=Object.prototype.propertyIsEnumerable;var Ee=(e,t,n)=>t in e?Ze(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n,ge=(e,t)=>{for(var n in t||(t={}))et.call(t,n)&&Ee(e,n,t[n]);if(Se)for(var n of Se(t))tt.call(t,n)&&Ee(e,n,t[n]);return e};var T={SET:"SET",ADD:"ADD",DELETE:"DELETE",CLEAR:"CLEAR"};var P=Symbol(""),g=Symbol(""),N=Symbol(""),ve=Symbol("");var L=Symbol("");var K=0,_,G=false,ie=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 re(e){e.notify();}function D(e,t){if(G)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=K,t.depLinkTail=i,i;let r=e.subLinkTail;if(r&&r.version===K&&r.subNode===t)return t.depLinkTail=r,r;let o={version:K,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 R(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=R(c,n);n.depLinkTail=void 0,n.isDep||(n.flag|=16);}return s}function U(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&&O(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 O(e){for(;e;){let t=e.subNode,n=t.flag;(n&48)===32&&(t.flag=n|16,(n&6)===2&&re(t)),e=e.nextSubLink;}}function j(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)&&rt(e,i)?(i.flag=o|40,r&&re(i),o&=1):o=0:i.flag=o&-9|32:o=0:(i.flag=o|32,r&&re(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 oe(e){let t=_;return _=e,t}function W(e){return K++,e.depLinkTail=void 0,e.flag=e.flag&-57|4,oe(e)}function H(e,t){_=t;let n=e.depLinkTail,i=n?n.nextDepLink:e.depLink;for(;i;)i=R(i,e);e.flag&=-5;}function it(e){let t=oe(void 0),n=G;G=true;try{return e()}finally{G=n,oe(t);}}function rt(e,t){let n=t.depLinkTail;for(;n;){if(n===e)return true;n=n.prevDepLink;}return false}var se=new WeakMap,ot=0;function ne(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(!_||G)return;let n=se.get(e);n||(n=new Map,se.set(e,n));let i=n.get(t);i||(i=new ie(n,t),n.set(t,i)),D(i,_);}function S(e,t,n,i){var c;let r=se.get(e);if(!r)return;let o=[],s=++ot;if(n!==void 0)if(Array.isArray(n))for(let u of n)ne(r.get(u),o,s);else ne(r.get(n),o,s);if(t==="ADD"||t==="DELETE"||t==="CLEAR"){let u=Array.isArray(e)?L:ve;ne(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&&j(u.subLink));}var lt=new WeakMap,pt=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 be=dt();function dt(){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=y(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,[P,L]),r};}),["toReversed","toSorted","toSpliced"].forEach(t=>{e[t]=function(...n){let i=a(this),r=y(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=y(this);l(n,P);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 Le(e,t){let n=h(t)?t:a(t);return shared.hasChanged(e,n)}var we=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(be,n))return be[n];let r=Reflect.get(t,n,i);return shared.isStringNumber(n)&&l(t,n),l(t,P),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 Le(s,o)&&(shared.isStringNumber(n)?S(t,T.SET,[n,L,P]):S(t,T.SET,n)),c}}),ht=we(true),Tt=we(false),Re=e=>({get(t,n){return n==="_IS_REACTIVE"?true:n==="_RAW"?t:n==="_IS_SHALLOW"?e:Reflect.get(shared.hasOwn(me,n)?me:t,n,t)}}),xe=e=>({get(t,n){return n==="_IS_REACTIVE"?true:n==="_RAW"?t:n==="_IS_SHALLOW"?e:Reflect.get(shared.hasOwn(ke,n)&&n in t?ke:t,n,t)}}),St=Re(true),Et=Re(false),gt=xe(true),vt=xe(false),me={get(e){let t=a(this);l(t,g);let n=t.get(e);return shared.isUndefined(n)&&!t.has(e)&&b(e)&&(n=t.get(a(e))),shared.isObject(n)&&!y(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=y(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=y(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=y(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=y(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=y(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}}}},ke={get(e){let t=a(this);l(t,N);let n=t.get(e);return shared.isUndefined(n)&&!t.has(e)&&b(e)&&(n=t.get(a(e))),shared.isObject(n)&&!y(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&&b(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}},De=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 Le(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}}),_t=De(true),bt=De(false);function d(e,t=false){if(!shared.isObject(e)||b(e))return e;let n=t?pt:lt,i=n.get(e);if(i)return i;let r;shared.isArray(e)?r=t?ht:Tt:shared.isSet(e)||shared.isMap(e)?r=t?St:Et:shared.isWeakMap(e)||shared.isWeakSet(e)?r=t?gt:vt:r=t?_t:bt;let o=new Proxy(e,r);return n.set(e,o),o}function b(e){return !!(e&&e._IS_REACTIVE)}function I(e){return b(e)||h(e)?e:d(e)}function q(e){return b(e)||h(e)?e:d(e,true)}function y(e){return !!(e&&e._IS_SHALLOW)}var mt=e=>shared.isObject(e)?I(e):e;var Ae;Ae="_IS_SIGNAL";var V=class{constructor(t,n=false){this.flag=1;this[Ae]=true;let i=a(t);this._rawValue=i,this._IS_SHALLOW=n,Ce(i)?b(t)?this._value=t:this._value=n?q(i):I(i):this._value=i;}get dep(){return this}get value(){let t=_;if(t&&D(this,t),this.flag&16&&this.shouldUpdate()){let i=this.subLink;i&&O(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,!Ce(i))this._value=i;else if(b(n))this._value=n;else {let o=this._IS_SHALLOW;this._value=o?q(i):I(i);}let r=this.subLink;r&&j(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 Ce(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 It(e){return h(e)?e:new V(e)}function Ct(e){return h(e)&&(e=e.peek()),new V(e,true)}function h(e){return !!e&&!!e._IS_SIGNAL}var B=new Set,ce=new Set,Ne=Promise.resolve(),ue=false;function Ve(e){return e?Ne.then(e):Ne}function C(e){B.add(e),Pe();}function Pe(){ue||(ue=true,Ve(fe));}function Ge(e){ce.add(e),Pe();}function fe(){for(ue=false,At();B.size>0;){for(let e of B)try{e();}catch(t){}B.clear();}}function At(){let e=Array.from(ce);ce.clear();for(let t of e)try{t();}catch(n){}}function Oe(e,t){switch(t){case "sync":return ()=>e();case "pre":return ()=>Ge(e);case "post":return ()=>C(e);default:return ()=>C(e)}}var Y=0;function $(e){je();try{return e()}finally{Ye();}}function je(){Y++;}function Ye(){Y--,Y===0&&fe();}function le(){return Y>0}function Nt(){return Y}var m,J=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 Vt(e=false){return new J(e)}function Pt(){return m}function Gt(e){let t=m;return m=e,t}function Ot(e,t=false){m&&m._pushCleanup(e);}function z(e,t=m){t&&t.active&&t._record(e);}function Q(e){let t=e.scope;t&&(e.scope=void 0,t._remove(e));}var Ke;Ke="_IS_EFFECT";var pe=class{constructor(t,n){this.flag=18;this[Ke]=true;this._active=true;if(this.fn=t,n){this.options=n;let i=n.flush||n.scheduler;i&&!shared.isFunction(i)&&(this._flushScheduler=Oe(()=>this.run(),i));}z(this);}get active(){return this._active}get dirty(){let t=this.flag;if(t&16)return true;if(t&32){if(this.depLink&&U(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=W(this);try{return this.fn()}catch(i){throw this.flag|=16,i}finally{this.flag&=-513,H(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):le()?C(this.getJob()):this.run();}stop(){var i;if(!this._active)return;this._active=false,Q(this);let t=this.depLink;for(;t;)t=R(t,this);let n=this.subLink;for(;n;)n=R(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 X(e,t){let n=new pe(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 jt(e){e.effect.stop();}function Yt(e){return !!(e&&e._IS_EFFECT)}function Mt(e,t,n){let i=t;return X(()=>{i=e(i);},n)}var w=Symbol("computed-no-value"),He;He="_IS_COMPUTED";var Z=class{constructor(t,n,i,r){this.flag=17;this[He]=true;this._value=w;this._active=true;this.getter=t,this.setter=n,this.onTrack=i,this.onTrigger=r,this.flag|=16,z(this);}get value(){if(!this.active)return this._value===w?this.getter():this._value;_&&D(this,_);let t=this.flag,n=this._value!==w;return n&&!(t&48)?this._value:!n||t&16?(this.recompute(),this._value):(t&32&&(this.depLink&&U(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===w&&this.recompute(),this._value):this._value===w?this.getter():this._value}get active(){return this._active}recompute(){if(!this._active){this._value===w&&(this._value=this.getter());return}let t=this._value,n=t!==w,i=W(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&&O(s)):this.flag=o&c;}catch(r){let o=-49;throw this.flag&=o,this._value=w,r}finally{H(this,i);}}shouldUpdate(){let t=this._value!==w,n=this._value;return this.recompute(),t?shared.hasChanged(this._value,n):true}stop(){if(!this._active)return;this._active=false,Q(this);let t=this.depLink;for(;t;)t=R(t,this);let n=this.subLink;for(;n;)n=R(n);this.depLinkTail=void 0,this.subLinkTail=void 0,this.flag&=-49;}};function de(e){if(M(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 Z(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
- Received: ${typeof t}`);return new Z(t,n,i,r)}throw new Error(`[Computed] Invalid argument: expected a function or options object.
4
- Received: ${typeof e}`)}function M(e){return !!e&&!!e._IS_COMPUTED}function Ut(e){let{state:t,getters:n,actions:i}=e,r=ge({},t),o=I(t),s=new Set,c=new Set,u=f=>{s.forEach(k=>k(f)),c.forEach(k=>k(f));},x={patch$(f){$(()=>{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$(){$(()=>{Object.assign(o,r);}),u(o);}},E={};for(let f of Object.keys(r))Object.defineProperty(E,f,{get:()=>o[f],set:k=>{o[f]=k;},enumerable:true,configurable:true});if(Object.defineProperty(E,"state",{value:o,enumerable:true,configurable:true,writable:true}),Object.assign(E,x),n)for(let f in n){let k=n[f];if(!k)continue;let te=de(()=>k.call(E,o));Object.defineProperty(E,f,{get:()=>te.value,enumerable:true,configurable:true});}if(i)for(let f in i){let k=i[f];k&&(E[f]=(...te)=>{let Qe=k.apply(E,te);return c.forEach(Xe=>Xe(o)),Qe});}return E}function Wt(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 Ht(e){return ()=>{let t;return shared.isFunction(e)?t=Wt(e):t=e,Ut(t)}}var Fe,qe,ee=class extends(qe=V,Fe="_IS_REF",qe){constructor(n){super(n,true);this[Fe]=true;}get value(){let n=_;return n&&D(this,n),this._value}set value(n){h(n)&&(n=n.peek()),Te(n)&&(n=n.value),shared.hasChanged(this._value,n)&&(this._rawValue=n,this._value=n,this.flag|=16,this.subLink&&j(this.subLink));}};function qt(e=void 0){return Te(e)?e:h(e)?new ee(e.peek()):new ee(e)}function Te(e){return !!e&&!!e._IS_REF}var Be={},$e=new Set;function A(e,t){if(t||($e.clear(),t=$e),!shared.isObject(e)||t.has(e))return e;if(t.add(e),h(e)||M(e))return A(e.value,t);if(Array.isArray(e))for(let n of e)A(n,t);else shared.isMap(e)?(e.forEach(n=>{A(n,t);}),e.keys(),e.values()):shared.isSet(e)?(e.forEach(n=>{A(n,t);}),e.values()):Object.keys(e).forEach(n=>{A(e[n],t);});return e}function Je(e){return shared.isFunction(e)?e:h(e)||M(e)?()=>e.value:b(e)?()=>A(e):()=>e}function Qt(e){if(Array.isArray(e)){let t=e.map(n=>Je(n));return ()=>t.map(n=>n())}return Je(e)}function Xt(e,t,n={}){let{immediate:i=false,deep:r=false}=n,o=Be,s=Qt(e),c=()=>{let x=u.effect;if(!x.run)return;let E=x.run();(r||shared.isObject(E)||shared.hasChanged(E,o))&&(t(E,o===Be?void 0:o),o=E);},u=X(()=>{let x=s();return r&&A(x),x},{scheduler:()=>C(c)});return i?c():o=u.effect.run(),()=>{u.stop();}}exports.EffectScope=J;exports.TriggerOpTypes=T;exports.batch=$;exports.computed=de;exports.createStore=Ht;exports.effect=X;exports.effectScope=Vt;exports.endBatch=Ye;exports.getBatchDepth=Nt;exports.getCurrentScope=Pt;exports.isBatching=le;exports.isComputed=M;exports.isEffect=Yt;exports.isReactive=b;exports.isRef=Te;exports.isShallow=y;exports.isSignal=h;exports.memoEffect=Mt;exports.nextTick=Ve;exports.onScopeDispose=Ot;exports.queueJob=C;exports.queuePreFlushCb=Ge;exports.reactive=I;exports.ref=qt;exports.setCurrentScope=Gt;exports.shallowReactive=q;exports.shallowSignal=Ct;exports.signal=It;exports.startBatch=je;exports.stop=jt;exports.toRaw=a;exports.toReactive=mt;exports.trigger=S;exports.untrack=it;exports.watch=Xt;
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 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.
@@ -1040,19 +1042,72 @@ declare function ref<T>(value?: T): Ref<T>;
1040
1042
  declare function isRef<T>(value: unknown): value is Ref<T>;
1041
1043
 
1042
1044
  interface WatchOptions {
1045
+ /** Whether to execute the callback immediately once on setup. */
1043
1046
  immediate?: boolean;
1047
+ /** Whether to deeply traverse the source to track nested changes. */
1044
1048
  deep?: boolean;
1049
+ /**
1050
+ * When the callback fires relative to the reactive flush cycle.
1051
+ * - `'post'` (default) — queued on the microtask job queue (essor's historical
1052
+ * behavior). NOTE: Vue defaults `watch` to `'pre'`; essor keeps `'post'`.
1053
+ * - `'pre'` — queued before the main job queue.
1054
+ * - `'sync'` — run synchronously the instant the source changes. Use sparingly:
1055
+ * a callback that mutates a tracked dependency can recurse.
1056
+ */
1057
+ flush?: FlushTiming;
1058
+ /** Stop the watcher automatically after the callback fires once. */
1059
+ once?: boolean;
1045
1060
  }
1046
1061
  type WatchSource<T = any> = T | {
1047
1062
  value: T;
1048
1063
  } | (() => T);
1049
- type WatchCallback<T = any> = (newValue: T, oldValue: T | undefined) => void;
1064
+ /**
1065
+ * Register a cleanup handler that runs right before the next callback invocation
1066
+ * and when the watcher stops. Mirrors Vue's `onCleanup`/`onInvalidate` — use it
1067
+ * to cancel stale async work (timers, fetches, subscriptions).
1068
+ */
1069
+ type OnCleanup = (cleanupFn: () => void) => void;
1070
+ type WatchCallback<T = any> = (newValue: T, oldValue: T | undefined, onCleanup: OnCleanup) => void;
1050
1071
  /**
1051
1072
  * Watch one or more reactive data sources and execute callback when sources change.
1052
1073
  *
1074
+ * ⚠️ **`oldValue` caveat for object / reactive sources.** For performance,
1075
+ * `watch` does NOT deep-clone the watched value between runs (deep cloning
1076
+ * every tick is prohibitively expensive). The `newValue` and `oldValue` passed
1077
+ * to your callback are therefore the *same reference* whenever the source is a
1078
+ * reactive object, array, Map/Set, or a getter that returns one — i.e.
1079
+ * `newValue === oldValue` and reading `oldValue.foo` yields the already-mutated
1080
+ * value. This differs from Vue, which snapshots primitives but likewise shares
1081
+ * the reference for deep/reactive sources.
1082
+ *
1083
+ * To capture a previous snapshot for object sources, derive the specific
1084
+ * primitive you care about in a getter:
1085
+ *
1086
+ * ```ts
1087
+ * // ❌ old === new — both point at the mutated object
1088
+ * watch(state, (n, o) => { ... });
1089
+ *
1090
+ * // ✅ watch a derived primitive; oldValue is a real previous value
1091
+ * watch(() => state.count, (n, o) => { ... }); // o is the prior count
1092
+ * ```
1093
+ *
1094
+ * For primitive sources (signals/computed/getters returning primitives),
1095
+ * `oldValue` behaves as expected.
1096
+ *
1097
+ * **Cleanup for async side effects.** The callback receives a third argument,
1098
+ * `onCleanup`, to cancel stale work before the next run (and on stop):
1099
+ *
1100
+ * ```ts
1101
+ * watch(id, async (id, _old, onCleanup) => {
1102
+ * const controller = new AbortController();
1103
+ * onCleanup(() => controller.abort());
1104
+ * const data = await fetch(`/api/${id}`, { signal: controller.signal });
1105
+ * });
1106
+ * ```
1107
+ *
1053
1108
  * @param source - The source(s) to watch.
1054
1109
  * @param callback - The callback function to execute when source changes.
1055
- * @param options - Configuration options like immediate and deep.
1110
+ * @param options - Configuration options (`immediate`, `deep`, `flush`, `once`).
1056
1111
  * @returns {Function} A function to stop watching.
1057
1112
  */
1058
1113
  declare function watch<T = any>(source: WatchSource<T>, callback: WatchCallback<T>, options?: WatchOptions): () => void;
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.
@@ -1040,19 +1042,72 @@ declare function ref<T>(value?: T): Ref<T>;
1040
1042
  declare function isRef<T>(value: unknown): value is Ref<T>;
1041
1043
 
1042
1044
  interface WatchOptions {
1045
+ /** Whether to execute the callback immediately once on setup. */
1043
1046
  immediate?: boolean;
1047
+ /** Whether to deeply traverse the source to track nested changes. */
1044
1048
  deep?: boolean;
1049
+ /**
1050
+ * When the callback fires relative to the reactive flush cycle.
1051
+ * - `'post'` (default) — queued on the microtask job queue (essor's historical
1052
+ * behavior). NOTE: Vue defaults `watch` to `'pre'`; essor keeps `'post'`.
1053
+ * - `'pre'` — queued before the main job queue.
1054
+ * - `'sync'` — run synchronously the instant the source changes. Use sparingly:
1055
+ * a callback that mutates a tracked dependency can recurse.
1056
+ */
1057
+ flush?: FlushTiming;
1058
+ /** Stop the watcher automatically after the callback fires once. */
1059
+ once?: boolean;
1045
1060
  }
1046
1061
  type WatchSource<T = any> = T | {
1047
1062
  value: T;
1048
1063
  } | (() => T);
1049
- type WatchCallback<T = any> = (newValue: T, oldValue: T | undefined) => void;
1064
+ /**
1065
+ * Register a cleanup handler that runs right before the next callback invocation
1066
+ * and when the watcher stops. Mirrors Vue's `onCleanup`/`onInvalidate` — use it
1067
+ * to cancel stale async work (timers, fetches, subscriptions).
1068
+ */
1069
+ type OnCleanup = (cleanupFn: () => void) => void;
1070
+ type WatchCallback<T = any> = (newValue: T, oldValue: T | undefined, onCleanup: OnCleanup) => void;
1050
1071
  /**
1051
1072
  * Watch one or more reactive data sources and execute callback when sources change.
1052
1073
  *
1074
+ * ⚠️ **`oldValue` caveat for object / reactive sources.** For performance,
1075
+ * `watch` does NOT deep-clone the watched value between runs (deep cloning
1076
+ * every tick is prohibitively expensive). The `newValue` and `oldValue` passed
1077
+ * to your callback are therefore the *same reference* whenever the source is a
1078
+ * reactive object, array, Map/Set, or a getter that returns one — i.e.
1079
+ * `newValue === oldValue` and reading `oldValue.foo` yields the already-mutated
1080
+ * value. This differs from Vue, which snapshots primitives but likewise shares
1081
+ * the reference for deep/reactive sources.
1082
+ *
1083
+ * To capture a previous snapshot for object sources, derive the specific
1084
+ * primitive you care about in a getter:
1085
+ *
1086
+ * ```ts
1087
+ * // ❌ old === new — both point at the mutated object
1088
+ * watch(state, (n, o) => { ... });
1089
+ *
1090
+ * // ✅ watch a derived primitive; oldValue is a real previous value
1091
+ * watch(() => state.count, (n, o) => { ... }); // o is the prior count
1092
+ * ```
1093
+ *
1094
+ * For primitive sources (signals/computed/getters returning primitives),
1095
+ * `oldValue` behaves as expected.
1096
+ *
1097
+ * **Cleanup for async side effects.** The callback receives a third argument,
1098
+ * `onCleanup`, to cancel stale work before the next run (and on stop):
1099
+ *
1100
+ * ```ts
1101
+ * watch(id, async (id, _old, onCleanup) => {
1102
+ * const controller = new AbortController();
1103
+ * onCleanup(() => controller.abort());
1104
+ * const data = await fetch(`/api/${id}`, { signal: controller.signal });
1105
+ * });
1106
+ * ```
1107
+ *
1053
1108
  * @param source - The source(s) to watch.
1054
1109
  * @param callback - The callback function to execute when source changes.
1055
- * @param options - Configuration options like immediate and deep.
1110
+ * @param options - Configuration options (`immediate`, `deep`, `flush`, `once`).
1056
1111
  * @returns {Function} A function to stop watching.
1057
1112
  */
1058
1113
  declare function watch<T = any>(source: WatchSource<T>, callback: WatchCallback<T>, options?: WatchOptions): () => void;
@@ -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;
@@ -1173,6 +1168,7 @@ var queue = /* @__PURE__ */ new Set();
1173
1168
  var activePreFlushCbs = /* @__PURE__ */ new Set();
1174
1169
  var p = Promise.resolve();
1175
1170
  var isFlushPending = false;
1171
+ var RECURSION_LIMIT = 100;
1176
1172
  function nextTick(fn) {
1177
1173
  return fn ? p.then(fn) : p;
1178
1174
  }
@@ -1193,8 +1189,20 @@ function queuePreFlushCb(cb) {
1193
1189
  function flushJobs() {
1194
1190
  isFlushPending = false;
1195
1191
  flushPreFlushCbs();
1192
+ let drainCount = 0;
1196
1193
  while (queue.size > 0) {
1197
- for (const job of queue) {
1194
+ if (++drainCount > RECURSION_LIMIT) {
1195
+ queue.clear();
1196
+ {
1197
+ shared.warn(
1198
+ `[Scheduler] Maximum recursive flush count (${RECURSION_LIMIT}) exceeded. This usually means an effect or watch callback is mutating a reactive dependency it also reads, causing an infinite update loop. The remaining queued jobs have been dropped to keep the app responsive.`
1199
+ );
1200
+ }
1201
+ return;
1202
+ }
1203
+ const jobs = [...queue];
1204
+ queue.clear();
1205
+ for (const job of jobs) {
1198
1206
  try {
1199
1207
  job();
1200
1208
  } catch (_error) {
@@ -1203,7 +1211,6 @@ function flushJobs() {
1203
1211
  }
1204
1212
  }
1205
1213
  }
1206
- queue.clear();
1207
1214
  }
1208
1215
  }
1209
1216
  function flushPreFlushCbs() {
@@ -1272,39 +1279,40 @@ var EffectScope = class {
1272
1279
  this.detached = detached;
1273
1280
  this.parent = parent;
1274
1281
  this._active = true;
1275
- this.effects = [];
1276
- 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();
1277
1285
  this.cleanups = [];
1278
1286
  if (!detached && activeEffectScope) {
1279
1287
  this.parent = activeEffectScope;
1280
- activeEffectScope.scopes.push(this);
1288
+ activeEffectScope.scopes.add(this);
1281
1289
  }
1282
1290
  }
1283
1291
  get active() {
1284
1292
  return this._active;
1285
1293
  }
1286
1294
  pause() {
1287
- var _a5, _b2;
1295
+ var _a5;
1288
1296
  if (!this._active) {
1289
1297
  return;
1290
1298
  }
1291
- for (let i = 0; i < this.scopes.length; i++) {
1292
- this.scopes[i].pause();
1299
+ for (const scope of this.scopes) {
1300
+ scope.pause();
1293
1301
  }
1294
- for (let i = 0; i < this.effects.length; i++) {
1295
- (_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);
1296
1304
  }
1297
1305
  }
1298
1306
  resume() {
1299
- var _a5, _b2;
1307
+ var _a5;
1300
1308
  if (!this._active) {
1301
1309
  return;
1302
1310
  }
1303
- for (let i = 0; i < this.scopes.length; i++) {
1304
- this.scopes[i].resume();
1311
+ for (const scope of this.scopes) {
1312
+ scope.resume();
1305
1313
  }
1306
- for (let i = 0; i < this.effects.length; i++) {
1307
- (_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);
1308
1316
  }
1309
1317
  }
1310
1318
  run(fn) {
@@ -1327,12 +1335,12 @@ var EffectScope = class {
1327
1335
  return;
1328
1336
  }
1329
1337
  this._active = false;
1330
- for (let i = 0; i < this.scopes.length; i++) {
1331
- this.scopes[i].stop(true);
1338
+ for (const scope of this.scopes) {
1339
+ scope.stop(true);
1332
1340
  }
1333
- this.scopes.length = 0;
1334
- const effects = this.effects.slice();
1335
- this.effects.length = 0;
1341
+ this.scopes.clear();
1342
+ const effects = Array.from(this.effects);
1343
+ this.effects.clear();
1336
1344
  for (const effect2 of effects) {
1337
1345
  effect2.stop();
1338
1346
  }
@@ -1341,22 +1349,16 @@ var EffectScope = class {
1341
1349
  }
1342
1350
  this.cleanups.length = 0;
1343
1351
  if (!fromParent && this.parent) {
1344
- const index = this.parent.scopes.indexOf(this);
1345
- if (index >= 0) {
1346
- this.parent.scopes.splice(index, 1);
1347
- }
1352
+ this.parent.scopes.delete(this);
1348
1353
  }
1349
1354
  this.parent = void 0;
1350
1355
  }
1351
1356
  _record(effect2) {
1352
- this.effects.push(effect2);
1357
+ this.effects.add(effect2);
1353
1358
  effect2.scope = this;
1354
1359
  }
1355
1360
  _remove(effect2) {
1356
- const index = this.effects.indexOf(effect2);
1357
- if (index >= 0) {
1358
- this.effects.splice(index, 1);
1359
- }
1361
+ this.effects.delete(effect2);
1360
1362
  }
1361
1363
  _pushCleanup(fn) {
1362
1364
  this.cleanups.push(fn);
@@ -1885,64 +1887,45 @@ function createOptionsStore(options) {
1885
1887
  const reactiveState = reactive(state);
1886
1888
  const subscriptions = /* @__PURE__ */ new Set();
1887
1889
  const actionCallbacks = /* @__PURE__ */ new Set();
1888
- const notifySubscribers = (state2) => {
1890
+ const notify = (state2) => {
1889
1891
  subscriptions.forEach((callback) => callback(state2));
1890
1892
  actionCallbacks.forEach((callback) => callback(state2));
1891
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
+ };
1892
1907
  const defaultActions = {
1893
- /**
1894
- * Applies a partial patch to the reactive store state.
1895
- */
1896
- patch$(payload) {
1908
+ $patch(payload) {
1897
1909
  if (!payload) {
1898
1910
  shared.warn("Patch payload is required");
1899
1911
  return;
1900
1912
  }
1901
- batch(() => {
1902
- Object.assign(reactiveState, payload);
1903
- });
1904
- notifySubscribers(reactiveState);
1913
+ commit(() => Object.assign(reactiveState, payload));
1905
1914
  },
1906
- /**
1907
- * Registers a store subscriber callback.
1908
- */
1909
- subscribe$(callback) {
1910
- if (!callback) {
1911
- shared.warn("Subscribe callback is required");
1912
- return;
1913
- }
1914
- subscriptions.add(callback);
1915
+ $subscribe(callback) {
1916
+ return addCallback(subscriptions, callback, "Subscribe callback");
1915
1917
  },
1916
- /**
1917
- * Removes a previously registered store subscriber.
1918
- */
1919
- unsubscribe$(callback) {
1918
+ $unsubscribe(callback) {
1920
1919
  subscriptions.delete(callback);
1921
1920
  },
1922
- /**
1923
- * Registers a callback for store action notifications.
1924
- */
1925
- onAction$(callback) {
1926
- if (!callback) {
1927
- shared.warn("Action callback is required");
1928
- return;
1929
- }
1930
- actionCallbacks.add(callback);
1921
+ $onAction(callback) {
1922
+ return addCallback(actionCallbacks, callback, "Action callback");
1931
1923
  },
1932
- /**
1933
- * Removes a previously registered action callback.
1934
- */
1935
- offAction$(callback) {
1924
+ $offAction(callback) {
1936
1925
  actionCallbacks.delete(callback);
1937
1926
  },
1938
- /**
1939
- * Resets the reactive state back to its initial snapshot.
1940
- */
1941
- reset$() {
1942
- batch(() => {
1943
- Object.assign(reactiveState, initState);
1944
- });
1945
- notifySubscribers(reactiveState);
1927
+ $reset() {
1928
+ commit(() => Object.assign(reactiveState, initState));
1946
1929
  }
1947
1930
  };
1948
1931
  const store = {};
@@ -2092,40 +2075,48 @@ function isRef(value) {
2092
2075
  }
2093
2076
  var INITIAL_WATCHER_VALUE = {};
2094
2077
  var _traverseSeen = /* @__PURE__ */ new Set();
2095
- function traverse(value, seen) {
2096
- if (!seen) {
2097
- _traverseSeen.clear();
2098
- seen = _traverseSeen;
2099
- }
2078
+ var _traverseBusy = false;
2079
+ function traverseValue(value, seen) {
2100
2080
  if (!shared.isObject(value) || seen.has(value)) {
2101
2081
  return value;
2102
2082
  }
2103
2083
  seen.add(value);
2104
2084
  if (isSignal(value) || isComputed(value)) {
2105
- return traverse(value.value, seen);
2106
- }
2107
- if (Array.isArray(value)) {
2085
+ traverseValue(value.value, seen);
2086
+ } else if (Array.isArray(value)) {
2108
2087
  for (const element of value) {
2109
- traverse(element, seen);
2088
+ traverseValue(element, seen);
2110
2089
  }
2111
2090
  } else if (shared.isMap(value)) {
2112
2091
  value.forEach((v) => {
2113
- traverse(v, seen);
2092
+ traverseValue(v, seen);
2114
2093
  });
2115
2094
  value.keys();
2116
2095
  value.values();
2117
2096
  } else if (shared.isSet(value)) {
2118
2097
  value.forEach((v) => {
2119
- traverse(v, seen);
2098
+ traverseValue(v, seen);
2120
2099
  });
2121
2100
  value.values();
2122
2101
  } else {
2123
- Object.keys(value).forEach((key) => {
2124
- traverse(value[key], seen);
2125
- });
2102
+ for (const key of Object.keys(value)) {
2103
+ traverseValue(value[key], seen);
2104
+ }
2126
2105
  }
2127
2106
  return value;
2128
2107
  }
2108
+ function traverse(value) {
2109
+ if (_traverseBusy) {
2110
+ return traverseValue(value, /* @__PURE__ */ new Set());
2111
+ }
2112
+ _traverseBusy = true;
2113
+ _traverseSeen.clear();
2114
+ try {
2115
+ return traverseValue(value, _traverseSeen);
2116
+ } finally {
2117
+ _traverseBusy = false;
2118
+ }
2119
+ }
2129
2120
  function cloneValue(value) {
2130
2121
  return value;
2131
2122
  }
@@ -2149,41 +2140,67 @@ function resolveSource(source) {
2149
2140
  return resolveSingleSource(source);
2150
2141
  }
2151
2142
  function watch(source, callback, options = {}) {
2152
- const { immediate = false, deep = false } = options;
2143
+ const { immediate = false, deep = false, flush = "post", once = false } = options;
2153
2144
  let oldValue = INITIAL_WATCHER_VALUE;
2145
+ let lastValue;
2146
+ let active = true;
2147
+ const isSingleReactive = !Array.isArray(source) && isReactive(source);
2148
+ const needTraverse = deep && !isSingleReactive;
2154
2149
  const getter = resolveSource(source);
2150
+ let cleanup;
2151
+ const onCleanup = (fn) => {
2152
+ cleanup = () => {
2153
+ cleanup = void 0;
2154
+ try {
2155
+ fn();
2156
+ } catch (error5) {
2157
+ shared.warn("[watch] cleanup handler threw:", error5);
2158
+ }
2159
+ };
2160
+ };
2161
+ const runCleanup = () => {
2162
+ if (cleanup) cleanup();
2163
+ };
2164
+ const invoke = (newValue) => {
2165
+ runCleanup();
2166
+ callback(newValue, oldValue === INITIAL_WATCHER_VALUE ? void 0 : oldValue, onCleanup);
2167
+ oldValue = cloneValue(newValue);
2168
+ if (once) stop2();
2169
+ };
2155
2170
  const job = () => {
2171
+ if (!active) return;
2156
2172
  const currentEffect = runner.effect;
2157
- if (!currentEffect.run) {
2158
- return;
2159
- }
2173
+ if (!currentEffect.active) return;
2160
2174
  const newValue = currentEffect.run();
2161
2175
  if (deep || shared.isObject(newValue) || shared.hasChanged(newValue, oldValue)) {
2162
- callback(newValue, oldValue === INITIAL_WATCHER_VALUE ? void 0 : oldValue);
2163
- oldValue = cloneValue(newValue);
2176
+ invoke(newValue);
2164
2177
  }
2165
2178
  };
2166
2179
  const runner = effect(
2167
2180
  () => {
2168
2181
  const value = getter();
2169
- if (deep) {
2182
+ if (needTraverse) {
2170
2183
  traverse(value);
2171
2184
  }
2185
+ lastValue = value;
2172
2186
  return value;
2173
2187
  },
2174
2188
  {
2175
- // Use scheduler to queue job, implementing async and debouncing.
2176
- scheduler: () => queueJob(job)
2189
+ scheduler: createScheduler(job, flush)
2177
2190
  }
2178
2191
  );
2192
+ function stop2() {
2193
+ if (!active) return;
2194
+ active = false;
2195
+ runCleanup();
2196
+ runner.stop();
2197
+ }
2179
2198
  if (immediate) {
2180
- job();
2199
+ invoke(lastValue);
2181
2200
  } else {
2182
- oldValue = cloneValue(runner.effect.run());
2201
+ oldValue = cloneValue(lastValue);
2183
2202
  }
2184
- return () => {
2185
- runner.stop();
2186
- };
2203
+ return stop2;
2187
2204
  }
2188
2205
 
2189
2206
  exports.EffectScope = EffectScope;
@@ -1,4 +1,4 @@
1
- import { isFunction, isObject, warn, error, isPlainObject, hasChanged, isArray, isSet, isMap, isWeakMap, isWeakSet, isStringNumber, hasOwn, isUndefined } from '@estjs/shared';
1
+ import { isFunction, isObject, warn, error, isPlainObject, isArray, isSet, isMap, isWeakMap, isWeakSet, hasChanged, isStringNumber, hasOwn, isUndefined } from '@estjs/shared';
2
2
 
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -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;
@@ -1171,6 +1166,7 @@ var queue = /* @__PURE__ */ new Set();
1171
1166
  var activePreFlushCbs = /* @__PURE__ */ new Set();
1172
1167
  var p = Promise.resolve();
1173
1168
  var isFlushPending = false;
1169
+ var RECURSION_LIMIT = 100;
1174
1170
  function nextTick(fn) {
1175
1171
  return fn ? p.then(fn) : p;
1176
1172
  }
@@ -1191,8 +1187,20 @@ function queuePreFlushCb(cb) {
1191
1187
  function flushJobs() {
1192
1188
  isFlushPending = false;
1193
1189
  flushPreFlushCbs();
1190
+ let drainCount = 0;
1194
1191
  while (queue.size > 0) {
1195
- for (const job of queue) {
1192
+ if (++drainCount > RECURSION_LIMIT) {
1193
+ queue.clear();
1194
+ {
1195
+ warn(
1196
+ `[Scheduler] Maximum recursive flush count (${RECURSION_LIMIT}) exceeded. This usually means an effect or watch callback is mutating a reactive dependency it also reads, causing an infinite update loop. The remaining queued jobs have been dropped to keep the app responsive.`
1197
+ );
1198
+ }
1199
+ return;
1200
+ }
1201
+ const jobs = [...queue];
1202
+ queue.clear();
1203
+ for (const job of jobs) {
1196
1204
  try {
1197
1205
  job();
1198
1206
  } catch (_error) {
@@ -1201,7 +1209,6 @@ function flushJobs() {
1201
1209
  }
1202
1210
  }
1203
1211
  }
1204
- queue.clear();
1205
1212
  }
1206
1213
  }
1207
1214
  function flushPreFlushCbs() {
@@ -1270,39 +1277,40 @@ var EffectScope = class {
1270
1277
  this.detached = detached;
1271
1278
  this.parent = parent;
1272
1279
  this._active = true;
1273
- this.effects = [];
1274
- 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();
1275
1283
  this.cleanups = [];
1276
1284
  if (!detached && activeEffectScope) {
1277
1285
  this.parent = activeEffectScope;
1278
- activeEffectScope.scopes.push(this);
1286
+ activeEffectScope.scopes.add(this);
1279
1287
  }
1280
1288
  }
1281
1289
  get active() {
1282
1290
  return this._active;
1283
1291
  }
1284
1292
  pause() {
1285
- var _a5, _b2;
1293
+ var _a5;
1286
1294
  if (!this._active) {
1287
1295
  return;
1288
1296
  }
1289
- for (let i = 0; i < this.scopes.length; i++) {
1290
- this.scopes[i].pause();
1297
+ for (const scope of this.scopes) {
1298
+ scope.pause();
1291
1299
  }
1292
- for (let i = 0; i < this.effects.length; i++) {
1293
- (_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);
1294
1302
  }
1295
1303
  }
1296
1304
  resume() {
1297
- var _a5, _b2;
1305
+ var _a5;
1298
1306
  if (!this._active) {
1299
1307
  return;
1300
1308
  }
1301
- for (let i = 0; i < this.scopes.length; i++) {
1302
- this.scopes[i].resume();
1309
+ for (const scope of this.scopes) {
1310
+ scope.resume();
1303
1311
  }
1304
- for (let i = 0; i < this.effects.length; i++) {
1305
- (_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);
1306
1314
  }
1307
1315
  }
1308
1316
  run(fn) {
@@ -1325,12 +1333,12 @@ var EffectScope = class {
1325
1333
  return;
1326
1334
  }
1327
1335
  this._active = false;
1328
- for (let i = 0; i < this.scopes.length; i++) {
1329
- this.scopes[i].stop(true);
1336
+ for (const scope of this.scopes) {
1337
+ scope.stop(true);
1330
1338
  }
1331
- this.scopes.length = 0;
1332
- const effects = this.effects.slice();
1333
- this.effects.length = 0;
1339
+ this.scopes.clear();
1340
+ const effects = Array.from(this.effects);
1341
+ this.effects.clear();
1334
1342
  for (const effect2 of effects) {
1335
1343
  effect2.stop();
1336
1344
  }
@@ -1339,22 +1347,16 @@ var EffectScope = class {
1339
1347
  }
1340
1348
  this.cleanups.length = 0;
1341
1349
  if (!fromParent && this.parent) {
1342
- const index = this.parent.scopes.indexOf(this);
1343
- if (index >= 0) {
1344
- this.parent.scopes.splice(index, 1);
1345
- }
1350
+ this.parent.scopes.delete(this);
1346
1351
  }
1347
1352
  this.parent = void 0;
1348
1353
  }
1349
1354
  _record(effect2) {
1350
- this.effects.push(effect2);
1355
+ this.effects.add(effect2);
1351
1356
  effect2.scope = this;
1352
1357
  }
1353
1358
  _remove(effect2) {
1354
- const index = this.effects.indexOf(effect2);
1355
- if (index >= 0) {
1356
- this.effects.splice(index, 1);
1357
- }
1359
+ this.effects.delete(effect2);
1358
1360
  }
1359
1361
  _pushCleanup(fn) {
1360
1362
  this.cleanups.push(fn);
@@ -1883,64 +1885,45 @@ function createOptionsStore(options) {
1883
1885
  const reactiveState = reactive(state);
1884
1886
  const subscriptions = /* @__PURE__ */ new Set();
1885
1887
  const actionCallbacks = /* @__PURE__ */ new Set();
1886
- const notifySubscribers = (state2) => {
1888
+ const notify = (state2) => {
1887
1889
  subscriptions.forEach((callback) => callback(state2));
1888
1890
  actionCallbacks.forEach((callback) => callback(state2));
1889
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
+ };
1890
1905
  const defaultActions = {
1891
- /**
1892
- * Applies a partial patch to the reactive store state.
1893
- */
1894
- patch$(payload) {
1906
+ $patch(payload) {
1895
1907
  if (!payload) {
1896
1908
  warn("Patch payload is required");
1897
1909
  return;
1898
1910
  }
1899
- batch(() => {
1900
- Object.assign(reactiveState, payload);
1901
- });
1902
- notifySubscribers(reactiveState);
1911
+ commit(() => Object.assign(reactiveState, payload));
1903
1912
  },
1904
- /**
1905
- * Registers a store subscriber callback.
1906
- */
1907
- subscribe$(callback) {
1908
- if (!callback) {
1909
- warn("Subscribe callback is required");
1910
- return;
1911
- }
1912
- subscriptions.add(callback);
1913
+ $subscribe(callback) {
1914
+ return addCallback(subscriptions, callback, "Subscribe callback");
1913
1915
  },
1914
- /**
1915
- * Removes a previously registered store subscriber.
1916
- */
1917
- unsubscribe$(callback) {
1916
+ $unsubscribe(callback) {
1918
1917
  subscriptions.delete(callback);
1919
1918
  },
1920
- /**
1921
- * Registers a callback for store action notifications.
1922
- */
1923
- onAction$(callback) {
1924
- if (!callback) {
1925
- warn("Action callback is required");
1926
- return;
1927
- }
1928
- actionCallbacks.add(callback);
1919
+ $onAction(callback) {
1920
+ return addCallback(actionCallbacks, callback, "Action callback");
1929
1921
  },
1930
- /**
1931
- * Removes a previously registered action callback.
1932
- */
1933
- offAction$(callback) {
1922
+ $offAction(callback) {
1934
1923
  actionCallbacks.delete(callback);
1935
1924
  },
1936
- /**
1937
- * Resets the reactive state back to its initial snapshot.
1938
- */
1939
- reset$() {
1940
- batch(() => {
1941
- Object.assign(reactiveState, initState);
1942
- });
1943
- notifySubscribers(reactiveState);
1925
+ $reset() {
1926
+ commit(() => Object.assign(reactiveState, initState));
1944
1927
  }
1945
1928
  };
1946
1929
  const store = {};
@@ -2090,40 +2073,48 @@ function isRef(value) {
2090
2073
  }
2091
2074
  var INITIAL_WATCHER_VALUE = {};
2092
2075
  var _traverseSeen = /* @__PURE__ */ new Set();
2093
- function traverse(value, seen) {
2094
- if (!seen) {
2095
- _traverseSeen.clear();
2096
- seen = _traverseSeen;
2097
- }
2076
+ var _traverseBusy = false;
2077
+ function traverseValue(value, seen) {
2098
2078
  if (!isObject(value) || seen.has(value)) {
2099
2079
  return value;
2100
2080
  }
2101
2081
  seen.add(value);
2102
2082
  if (isSignal(value) || isComputed(value)) {
2103
- return traverse(value.value, seen);
2104
- }
2105
- if (Array.isArray(value)) {
2083
+ traverseValue(value.value, seen);
2084
+ } else if (Array.isArray(value)) {
2106
2085
  for (const element of value) {
2107
- traverse(element, seen);
2086
+ traverseValue(element, seen);
2108
2087
  }
2109
2088
  } else if (isMap(value)) {
2110
2089
  value.forEach((v) => {
2111
- traverse(v, seen);
2090
+ traverseValue(v, seen);
2112
2091
  });
2113
2092
  value.keys();
2114
2093
  value.values();
2115
2094
  } else if (isSet(value)) {
2116
2095
  value.forEach((v) => {
2117
- traverse(v, seen);
2096
+ traverseValue(v, seen);
2118
2097
  });
2119
2098
  value.values();
2120
2099
  } else {
2121
- Object.keys(value).forEach((key) => {
2122
- traverse(value[key], seen);
2123
- });
2100
+ for (const key of Object.keys(value)) {
2101
+ traverseValue(value[key], seen);
2102
+ }
2124
2103
  }
2125
2104
  return value;
2126
2105
  }
2106
+ function traverse(value) {
2107
+ if (_traverseBusy) {
2108
+ return traverseValue(value, /* @__PURE__ */ new Set());
2109
+ }
2110
+ _traverseBusy = true;
2111
+ _traverseSeen.clear();
2112
+ try {
2113
+ return traverseValue(value, _traverseSeen);
2114
+ } finally {
2115
+ _traverseBusy = false;
2116
+ }
2117
+ }
2127
2118
  function cloneValue(value) {
2128
2119
  return value;
2129
2120
  }
@@ -2147,41 +2138,67 @@ function resolveSource(source) {
2147
2138
  return resolveSingleSource(source);
2148
2139
  }
2149
2140
  function watch(source, callback, options = {}) {
2150
- const { immediate = false, deep = false } = options;
2141
+ const { immediate = false, deep = false, flush = "post", once = false } = options;
2151
2142
  let oldValue = INITIAL_WATCHER_VALUE;
2143
+ let lastValue;
2144
+ let active = true;
2145
+ const isSingleReactive = !Array.isArray(source) && isReactive(source);
2146
+ const needTraverse = deep && !isSingleReactive;
2152
2147
  const getter = resolveSource(source);
2148
+ let cleanup;
2149
+ const onCleanup = (fn) => {
2150
+ cleanup = () => {
2151
+ cleanup = void 0;
2152
+ try {
2153
+ fn();
2154
+ } catch (error5) {
2155
+ warn("[watch] cleanup handler threw:", error5);
2156
+ }
2157
+ };
2158
+ };
2159
+ const runCleanup = () => {
2160
+ if (cleanup) cleanup();
2161
+ };
2162
+ const invoke = (newValue) => {
2163
+ runCleanup();
2164
+ callback(newValue, oldValue === INITIAL_WATCHER_VALUE ? void 0 : oldValue, onCleanup);
2165
+ oldValue = cloneValue(newValue);
2166
+ if (once) stop2();
2167
+ };
2153
2168
  const job = () => {
2169
+ if (!active) return;
2154
2170
  const currentEffect = runner.effect;
2155
- if (!currentEffect.run) {
2156
- return;
2157
- }
2171
+ if (!currentEffect.active) return;
2158
2172
  const newValue = currentEffect.run();
2159
2173
  if (deep || isObject(newValue) || hasChanged(newValue, oldValue)) {
2160
- callback(newValue, oldValue === INITIAL_WATCHER_VALUE ? void 0 : oldValue);
2161
- oldValue = cloneValue(newValue);
2174
+ invoke(newValue);
2162
2175
  }
2163
2176
  };
2164
2177
  const runner = effect(
2165
2178
  () => {
2166
2179
  const value = getter();
2167
- if (deep) {
2180
+ if (needTraverse) {
2168
2181
  traverse(value);
2169
2182
  }
2183
+ lastValue = value;
2170
2184
  return value;
2171
2185
  },
2172
2186
  {
2173
- // Use scheduler to queue job, implementing async and debouncing.
2174
- scheduler: () => queueJob(job)
2187
+ scheduler: createScheduler(job, flush)
2175
2188
  }
2176
2189
  );
2190
+ function stop2() {
2191
+ if (!active) return;
2192
+ active = false;
2193
+ runCleanup();
2194
+ runner.stop();
2195
+ }
2177
2196
  if (immediate) {
2178
- job();
2197
+ invoke(lastValue);
2179
2198
  } else {
2180
- oldValue = cloneValue(runner.effect.run());
2199
+ oldValue = cloneValue(lastValue);
2181
2200
  }
2182
- return () => {
2183
- runner.stop();
2184
- };
2201
+ return stop2;
2185
2202
  }
2186
2203
 
2187
2204
  export { EffectScope, TriggerOpTypes, batch, computed, createStore, effect, effectScope, endBatch, getBatchDepth, getCurrentScope, isBatching, isComputed, isEffect, isReactive, isRef, isShallow, isSignal, memoEffect, nextTick, onScopeDispose, queueJob, queuePreFlushCb, reactive, ref, setCurrentScope, shallowReactive, shallowSignal, signal, startBatch, stop, toRaw, toReactive, trigger, untrack, watch };
package/dist/signals.js CHANGED
@@ -1,4 +1,4 @@
1
- import {isObject,isFunction,isPlainObject,hasChanged,isArray,isSet,isMap,isWeakMap,isWeakSet,isStringNumber,hasOwn,isUndefined}from'@estjs/shared';var et=Object.defineProperty;var Ee=Object.getOwnPropertySymbols;var tt=Object.prototype.hasOwnProperty,nt=Object.prototype.propertyIsEnumerable;var ge=(e,t,n)=>t in e?et(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n,ve=(e,t)=>{for(var n in t||(t={}))tt.call(t,n)&&ge(e,n,t[n]);if(Ee)for(var n of Ee(t))nt.call(t,n)&&ge(e,n,t[n]);return e};var T={SET:"SET",ADD:"ADD",DELETE:"DELETE",CLEAR:"CLEAR"};var G=Symbol(""),g=Symbol(""),V=Symbol(""),_e=Symbol("");var w=Symbol("");var U=0,b,O=false,re=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 oe(e){e.notify();}function I(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=U,t.depLinkTail=i,i;let r=e.subLinkTail;if(r&&r.version===U&&r.subNode===t)return t.depLinkTail=r,r;let o={version:U,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 W(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&&oe(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)&&ot(e,i)?(i.flag=o|40,r&&oe(i),o&=1):o=0:i.flag=o&-9|32:o=0:(i.flag=o|32,r&&oe(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 se(e){let t=b;return b=e,t}function H(e){return U++,e.depLinkTail=void 0,e.flag=e.flag&-57|4,se(e)}function F(e,t){b=t;let n=e.depLinkTail,i=n?n.nextDepLink:e.depLink;for(;i;)i=x(i,e);e.flag&=-5;}function rt(e){let t=se(void 0),n=O;O=true;try{return e()}finally{O=n,se(t);}}function ot(e,t){let n=t.depLinkTail;for(;n;){if(n===e)return true;n=n.prevDepLink;}return false}var ae=new WeakMap,st=0;function ie(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=ae.get(e);n||(n=new Map,ae.set(e,n));let i=n.get(t);i||(i=new re(n,t),n.set(t,i)),I(i,b);}function S(e,t,n,i){var c;let r=ae.get(e);if(!r)return;let o=[],s=++st;if(n!==void 0)if(Array.isArray(n))for(let u of n)ie(r.get(u),o,s);else ie(r.get(n),o,s);if(t==="ADD"||t==="DELETE"||t==="CLEAR"){let u=Array.isArray(e)?w:_e;ie(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 pt=new WeakMap,dt=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 me=ht();function ht(){let e={};return ["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){let i=a(this);l(i,w);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=L(this);l(i,w);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,[G,w]),r};}),["toReversed","toSorted","toSpliced"].forEach(t=>{e[t]=function(...n){let i=a(this),r=L(this);if(l(i,w),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,w),Array.prototype[t].apply(this,n)};}),["join","toString","toLocaleString"].forEach(t=>{e[t]=function(...n){let i=a(this);return l(i,w),Array.prototype[t].apply(i,n)};}),["values","keys","entries",Symbol.iterator].forEach(t=>{e[t]=function(){let n=a(this),i=L(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=>isObject(c)?d(c,i):c),done:s}:{value:isObject(o)?d(o,i):o,done:s}},[Symbol.iterator](){return this}}};}),e}function we(e,t){let n=h(t)?t:a(t);return hasChanged(e,n)}var Re=e=>({get:(t,n,i)=>{if(n==="_RAW")return t;if(n==="_IS_REACTIVE")return true;if(n==="_IS_SHALLOW")return e;if(hasOwn(me,n))return me[n];let r=Reflect.get(t,n,i);return isStringNumber(n)&&l(t,n),l(t,G),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 we(s,o)&&(isStringNumber(n)?S(t,T.SET,[n,w,G]):S(t,T.SET,n)),c}}),Tt=Re(true),St=Re(false),xe=e=>({get(t,n){return n==="_IS_REACTIVE"?true:n==="_RAW"?t:n==="_IS_SHALLOW"?e:Reflect.get(hasOwn(ke,n)?ke:t,n,t)}}),De=e=>({get(t,n){return n==="_IS_REACTIVE"?true:n==="_RAW"?t:n==="_IS_SHALLOW"?e:Reflect.get(hasOwn(ye,n)&&n in t?ye:t,n,t)}}),Et=xe(true),gt=xe(false),vt=De(true),_t=De(false),ke={get(e){let t=a(this);l(t,g);let n=t.get(e);return isUndefined(n)&&!t.has(e)&&m(e)&&(n=t.get(a(e))),isObject(n)&&!L(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=L(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=L(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=L(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=L(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=L(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}}}},ye={get(e){let t=a(this);l(t,V);let n=t.get(e);return isUndefined(n)&&!t.has(e)&&m(e)&&(n=t.get(a(e))),isObject(n)&&!L(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&&m(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}},Ie=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 we(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}}),bt=Ie(true),mt=Ie(false);function d(e,t=false){if(!isObject(e)||m(e))return e;let n=t?dt:pt,i=n.get(e);if(i)return i;let r;isArray(e)?r=t?Tt:St:isSet(e)||isMap(e)?r=t?Et:gt:isWeakMap(e)||isWeakSet(e)?r=t?vt:_t:r=t?bt:mt;let o=new Proxy(e,r);return n.set(e,o),o}function m(e){return !!(e&&e._IS_REACTIVE)}function C(e){return m(e)||h(e)?e:d(e)}function B(e){return m(e)||h(e)?e:d(e,true)}function L(e){return !!(e&&e._IS_SHALLOW)}var kt=e=>isObject(e)?C(e):e;var Ne;Ne="_IS_SIGNAL";var P=class{constructor(t,n=false){this.flag=1;this[Ne]=true;let i=a(t);this._rawValue=i,this._IS_SHALLOW=n,Ae(i)?m(t)?this._value=t:this._value=n?B(i):C(i):this._value=i;}get dep(){return this}get value(){let t=b;if(t&&I(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(!hasChanged(this._rawValue,i))return;if(this._oldValue=this._rawValue,this._rawValue=i,this.flag|=16,!Ae(i))this._value=i;else if(m(n))this._value=n;else {let o=this._IS_SHALLOW;this._value=o?B(i):C(i);}let r=this.subLink;r&&Y(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 Ae(e){return isObject(e)?isArray(e)||isMap(e)||isSet(e)||isWeakMap(e)||isWeakSet(e)||isPlainObject(e):false}function Ct(e){return h(e)?e:new P(e)}function At(e){return h(e)&&(e=e.peek()),new P(e,true)}function h(e){return !!e&&!!e._IS_SIGNAL}var $=new Set,ue=new Set,Ve=Promise.resolve(),fe=false;function Pe(e){return e?Ve.then(e):Ve}function A(e){$.add(e),Ge();}function Ge(){fe||(fe=true,Pe(le));}function Oe(e){ue.add(e),Ge();}function le(){for(fe=false,Nt();$.size>0;){for(let e of $)try{e();}catch(t){}$.clear();}}function Nt(){let e=Array.from(ue);ue.clear();for(let t of e)try{t();}catch(n){}}function je(e,t){switch(t){case "sync":return ()=>e();case "pre":return ()=>Oe(e);case "post":return ()=>A(e);default:return ()=>A(e)}}var M=0;function J(e){Ye();try{return e()}finally{Me();}}function Ye(){M++;}function Me(){M--,M===0&&le();}function pe(){return M>0}function Vt(){return M}var k,z=class{constructor(t=false,n=void 0){this.detached=t;this.parent=n;this._active=true;this.effects=[];this.scopes=[];this.cleanups=[];!t&&k&&(this.parent=k,k.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=k;k=this;try{return t()}finally{k=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 Pt(e=false){return new z(e)}function Gt(){return k}function Ot(e){let t=k;return k=e,t}function jt(e,t=false){k&&k._pushCleanup(e);}function Q(e,t=k){t&&t.active&&t._record(e);}function X(e){let t=e.scope;t&&(e.scope=void 0,t._remove(e));}var Ue;Ue="_IS_EFFECT";var de=class{constructor(t,n){this.flag=18;this[Ue]=true;this._active=true;if(this.fn=t,n){this.options=n;let i=n.flush||n.scheduler;i&&!isFunction(i)&&(this._flushScheduler=je(()=>this.run(),i));}Q(this);}get active(){return this._active}get dirty(){let t=this.flag;if(t&16)return true;if(t&32){if(this.depLink&&W(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=H(this);try{return this.fn()}catch(i){throw this.flag|=16,i}finally{this.flag&=-513,F(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):pe()?A(this.getJob()):this.run();}stop(){var i;if(!this._active)return;this._active=false,X(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 Z(e,t){let n=new de(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 Yt(e){e.effect.stop();}function Mt(e){return !!(e&&e._IS_EFFECT)}function Kt(e,t,n){let i=t;return Z(()=>{i=e(i);},n)}var R=Symbol("computed-no-value"),Fe;Fe="_IS_COMPUTED";var ee=class{constructor(t,n,i,r){this.flag=17;this[Fe]=true;this._value=R;this._active=true;this.getter=t,this.setter=n,this.onTrack=i,this.onTrigger=r,this.flag|=16,Q(this);}get value(){if(!this.active)return this._value===R?this.getter():this._value;b&&I(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&&W(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=H(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&&j(s)):this.flag=o&c;}catch(r){let o=-49;throw this.flag&=o,this._value=R,r}finally{F(this,i);}}shouldUpdate(){let t=this._value!==R,n=this._value;return this.recompute(),t?hasChanged(this._value,n):true}stop(){if(!this._active)return;this._active=false,X(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 he(e){if(K(e))return e;if(!e)throw new Error("[Computed] Invalid argument: computed() requires a getter function or options object.");if(isFunction(e))return new ee(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
- Received: ${typeof t}`);return new ee(t,n,i,r)}throw new Error(`[Computed] Invalid argument: expected a function or options object.
4
- Received: ${typeof e}`)}function K(e){return !!e&&!!e._IS_COMPUTED}function Wt(e){let{state:t,getters:n,actions:i}=e,r=ve({},t),o=C(t),s=new Set,c=new Set,u=f=>{s.forEach(y=>y(f)),c.forEach(y=>y(f));},D={patch$(f){J(()=>{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$(){J(()=>{Object.assign(o,r);}),u(o);}},E={};for(let f of Object.keys(r))Object.defineProperty(E,f,{get:()=>o[f],set:y=>{o[f]=y;},enumerable:true,configurable:true});if(Object.defineProperty(E,"state",{value:o,enumerable:true,configurable:true,writable:true}),Object.assign(E,D),n)for(let f in n){let y=n[f];if(!y)continue;let ne=he(()=>y.call(E,o));Object.defineProperty(E,f,{get:()=>ne.value,enumerable:true,configurable:true});}if(i)for(let f in i){let y=i[f];y&&(E[f]=(...ne)=>{let Xe=y.apply(E,ne);return c.forEach(Ze=>Ze(o)),Xe});}return E}function Ht(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 Ft(e){return ()=>{let t;return isFunction(e)?t=Ht(e):t=e,Wt(t)}}var qe,Be,te=class extends(Be=P,qe="_IS_REF",Be){constructor(n){super(n,true);this[qe]=true;}get value(){let n=b;return n&&I(this,n),this._value}set value(n){h(n)&&(n=n.peek()),Se(n)&&(n=n.value),hasChanged(this._value,n)&&(this._rawValue=n,this._value=n,this.flag|=16,this.subLink&&Y(this.subLink));}};function Bt(e=void 0){return Se(e)?e:h(e)?new te(e.peek()):new te(e)}function Se(e){return !!e&&!!e._IS_REF}var $e={},Je=new Set;function N(e,t){if(t||(Je.clear(),t=Je),!isObject(e)||t.has(e))return e;if(t.add(e),h(e)||K(e))return N(e.value,t);if(Array.isArray(e))for(let n of e)N(n,t);else isMap(e)?(e.forEach(n=>{N(n,t);}),e.keys(),e.values()):isSet(e)?(e.forEach(n=>{N(n,t);}),e.values()):Object.keys(e).forEach(n=>{N(e[n],t);});return e}function ze(e){return isFunction(e)?e:h(e)||K(e)?()=>e.value:m(e)?()=>N(e):()=>e}function Xt(e){if(Array.isArray(e)){let t=e.map(n=>ze(n));return ()=>t.map(n=>n())}return ze(e)}function Zt(e,t,n={}){let{immediate:i=false,deep:r=false}=n,o=$e,s=Xt(e),c=()=>{let D=u.effect;if(!D.run)return;let E=D.run();(r||isObject(E)||hasChanged(E,o))&&(t(E,o===$e?void 0:o),o=E);},u=Z(()=>{let D=s();return r&&N(D),D},{scheduler:()=>A(c)});return i?c():o=u.effect.run(),()=>{u.stop();}}export{z as EffectScope,T as TriggerOpTypes,J as batch,he as computed,Ft as createStore,Z as effect,Pt as effectScope,Me as endBatch,Vt as getBatchDepth,Gt as getCurrentScope,pe as isBatching,K as isComputed,Mt as isEffect,m as isReactive,Se as isRef,L as isShallow,h as isSignal,Kt as memoEffect,Pe as nextTick,jt as onScopeDispose,A as queueJob,Oe as queuePreFlushCb,C as reactive,Bt as ref,Ot as setCurrentScope,B as shallowReactive,At as shallowSignal,Ct as signal,Ye as startBatch,Yt as stop,a as toRaw,kt as toReactive,S as trigger,rt as untrack,Zt as watch};
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 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.1",
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.1"
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",