mutts 1.0.1 → 1.0.2

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.
Files changed (60) hide show
  1. package/README.md +24 -2
  2. package/dist/chunks/_tslib-C-cuVLvZ.js +73 -0
  3. package/dist/chunks/_tslib-C-cuVLvZ.js.map +1 -0
  4. package/dist/chunks/_tslib-CMEnd0VE.esm.js +68 -0
  5. package/dist/chunks/_tslib-CMEnd0VE.esm.js.map +1 -0
  6. package/dist/chunks/{decorator-8qjFb7dw.js → decorator-D4DU97Zg.js} +70 -4
  7. package/dist/chunks/decorator-D4DU97Zg.js.map +1 -0
  8. package/dist/chunks/{decorator-AbRkXM5O.esm.js → decorator-GnHw1Az7.esm.js} +67 -5
  9. package/dist/chunks/decorator-GnHw1Az7.esm.js.map +1 -0
  10. package/dist/chunks/index-DBScoeCX.esm.js +1960 -0
  11. package/dist/chunks/index-DBScoeCX.esm.js.map +1 -0
  12. package/dist/chunks/index-DOTmXL89.js +1983 -0
  13. package/dist/chunks/index-DOTmXL89.js.map +1 -0
  14. package/dist/decorator.d.ts +57 -0
  15. package/dist/decorator.esm.js +1 -1
  16. package/dist/decorator.js +1 -1
  17. package/dist/destroyable.d.ts +42 -0
  18. package/dist/destroyable.esm.js +19 -1
  19. package/dist/destroyable.esm.js.map +1 -1
  20. package/dist/destroyable.js +19 -1
  21. package/dist/destroyable.js.map +1 -1
  22. package/dist/eventful.d.ts +10 -1
  23. package/dist/eventful.esm.js +5 -27
  24. package/dist/eventful.esm.js.map +1 -1
  25. package/dist/eventful.js +15 -37
  26. package/dist/eventful.js.map +1 -1
  27. package/dist/index.d.ts +52 -3
  28. package/dist/index.esm.js +3 -2
  29. package/dist/index.esm.js.map +1 -1
  30. package/dist/index.js +17 -3
  31. package/dist/index.js.map +1 -1
  32. package/dist/indexable.d.ts +26 -0
  33. package/dist/indexable.esm.js +6 -0
  34. package/dist/indexable.esm.js.map +1 -1
  35. package/dist/indexable.js +6 -0
  36. package/dist/indexable.js.map +1 -1
  37. package/dist/mutts.umd.js +1 -1
  38. package/dist/mutts.umd.js.map +1 -1
  39. package/dist/mutts.umd.min.js +1 -1
  40. package/dist/mutts.umd.min.js.map +1 -1
  41. package/dist/promiseChain.d.ts +10 -0
  42. package/dist/promiseChain.esm.js +6 -0
  43. package/dist/promiseChain.esm.js.map +1 -1
  44. package/dist/promiseChain.js +6 -0
  45. package/dist/promiseChain.js.map +1 -1
  46. package/dist/reactive.d.ts +255 -18
  47. package/dist/reactive.esm.js +4 -1458
  48. package/dist/reactive.esm.js.map +1 -1
  49. package/dist/reactive.js +29 -1471
  50. package/dist/reactive.js.map +1 -1
  51. package/dist/std-decorators.d.ts +35 -0
  52. package/dist/std-decorators.esm.js +36 -1
  53. package/dist/std-decorators.esm.js.map +1 -1
  54. package/dist/std-decorators.js +36 -1
  55. package/dist/std-decorators.js.map +1 -1
  56. package/docs/mixin.md +229 -0
  57. package/docs/reactive.md +7739 -882
  58. package/package.json +1 -1
  59. package/dist/chunks/decorator-8qjFb7dw.js.map +0 -1
  60. package/dist/chunks/decorator-AbRkXM5O.esm.js.map +0 -1
package/dist/mutts.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Mutts={})}(this,function(t){"use strict";const e=new Set([Object,Array,Date,Function,Set,Map,WeakMap,WeakSet,Promise,Error,TypeError,ReferenceError,SyntaxError,RangeError,URIError,EvalError,Reflect,Proxy,RegExp,String,Number,Boolean]);function n(t){return t&&(e.has(t)||t.toString?.().startsWith("class "))}function r(t,e){return Object.defineProperties(t,{name:{value:e}})}class o extends Error{constructor(t){super(t),this.name="DecoratorException"}}function s(t){return function(e,r,o,...s){if(void 0===r){if(n(e)){if(!("class"in t))throw new Error("Decorator cannot be applied to a class");return t.class?.(e)}}else if("object"==typeof e&&["string","symbol"].includes(typeof r)){if(!o)throw new Error("Decorator cannot be applied to a field");if("object"==typeof o&&"configurable"in o){if("get"in o||"set"in o){if(!("getter"in t)&&!("setter"in t))throw new Error("Decorator cannot be applied to a getter or setter");if("getter"in t){const e=t.getter?.(o.get,r);e&&(o.get=e)}if("setter"in t){const e=t.setter?.(o.set,r);e&&(o.set=e)}return o}if("function"==typeof o.value){if(!("method"in t))throw new Error("Decorator cannot be applied to a method");const e=t.method?.(o.value,r);return e&&(o.value=e),o}}}if(!("default"in t))throw new Error("Decorator do not have a default implementation");return t.default.call(this,e,r,o,...s)}}function i(t){return function(e,n,...r){if(!n?.kind||"string"!=typeof n.kind){if(!("default"in t))throw new Error("Decorator do not have a default implementation");return t.default.call(this,e,n,...r)}switch(n.kind){case"class":if(!("class"in t))throw new Error("Decorator cannot be applied to a class");return t.class?.(e);case"field":throw new Error("Decorator cannot be applied to a field");case"getter":if(!("getter"in t))throw new Error("Decorator cannot be applied to a getter");return t.getter?.(e,n.name);case"setter":if(!("setter"in t))throw new Error("Decorator cannot be applied to a setter");return t.setter?.(e,n.name);case"method":if(!("method"in t))throw new Error("Decorator cannot be applied to a method");return t.method?.(e,n.name);case"accessor":{if(!("getter"in t)&&!("setter"in t))throw new Error("Decorator cannot be applied to a getter or setter");const r={};if("getter"in t){const o=t.getter?.(e.get,n.name);o&&(r.get=o)}if("setter"in t){const o=t.setter?.(e.set,n.name);o&&(r.set=o)}return r}}}}const c=t=>(e,n,...r)=>{const o=function(t,e){return"object"==typeof e&&null!==e&&"string"==typeof e.kind?"modern":"legacy"}(0,n,r[0]);return"modern"===o?i(t)(e,n,...r):s(t)(e,n,...r)},a=new FinalizationRegistry(t=>t()),l=Symbol("destructor"),h=Symbol("allocated");class u extends Error{static throw(t){return()=>{throw new u(t)}}constructor(t){super(`Object is destroyed. ${t}`),this.name="DestroyedAccessError"}}const f={[Symbol.toStringTag]:"MutTs Destroyable",get:u.throw("Cannot access destroyed object"),set:u.throw("Cannot access destroyed object")};const d=c({setter:(t,e)=>function(n){return this[h][e]=n,t.call(this,n)}});function p(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}var y,g;"function"==typeof SuppressedError&&SuppressedError;y=new WeakMap,g=new WeakMap;const b=Symbol("getAt"),m=Symbol("setAt");function w(t,e){t&&"function"!=typeof t&&(e=t,t=void 0),t||(t=class{}),e||(e={get(t){if("function"!=typeof this[b])throw new Error("Indexable class must have an [getAt] method");return this[b](t)},set(t,e){if("function"!=typeof this[m])throw new Error("Indexable class has read-only numeric index access");this[m](t,e)}});class n extends t{}return Object.setPrototypeOf(n.prototype,new Proxy(t.prototype,{[Symbol.toStringTag]:"MutTs Indexable",get(t,n,r){if(n in t){const e=Object.getOwnPropertyDescriptor(t,n)?.get;return e?e.call(r):t[n]}if("string"==typeof n){if("length"===n&&e.getLength)return e.getLength.call(r);const t=Number(n);if(!Number.isNaN(t))return e.get.call(r,t)}},set(t,n,r,o){if(n in t){const e=Object.getOwnPropertyDescriptor(t,n)?.set;return e?e.call(o,r):t[n]=r,!0}if("string"==typeof n){if("length"===n&&e.setLength)return e.setLength.call(o,r),!0;const t=Number(n);if(!Number.isNaN(t)){if(!e.set)throw new Error("Indexable class has read-only numeric index access");return e.set.call(o,t,r),!0}}return Object.defineProperty(o,n,{value:r,writable:!0,enumerable:!0,configurable:!0}),!0}})),n}const v=new WeakMap,S=new WeakMap,j=new WeakMap,x=new WeakMap,O=new WeakSet,E=new WeakMap,k=new WeakMap,M=new WeakSet,D=Symbol("absent");function*R(t){let e=t.next();for(;!e.done;)yield ht(e.value),e=t.next()}function*W(t){let e=t.next();for(;!e.done;){const[n,r]=e.value;yield[ht(n),ht(r)],e=t.next()}}const P=new WeakMap,T={objectToProxy:S,proxyToObject:j,effectToReactiveObjects:v,watchers:P,objectParents:x,objectsWithDeepWatchers:O,deepWatchers:E,effectToDeepWatchedObjects:k,nonReactiveObjects:M},z=Symbol("native-reactive"),A=Symbol("non-reactive"),N=Symbol("unreactive-properties"),C=Symbol("prototype-forwarding"),I=Symbol("all-props"),$=Symbol("root-function");function L(t,e){return Object.defineProperty(t,$,{value:F(e),writable:!1})}function F(t){return t?.[$]||t}class B extends Error{constructor(t){super(t),this.name="ReactiveError"}}const K={enter:t=>{},leave:t=>{},chain:(t,e)=>{},maxEffectChain:100,maxDeepWatchDepth:100,instanceMembers:!0,warn:(...t)=>{}};function U(t,...e){for(const n of e)for(const e of n){const n=t.get(e);if(n)for(const t of Array.from(n))Z(t)}}function G(t,e,n){V(t,e,[n])}function V(t,e,n){!function(t,e){t=ut(t);const n={},r=H(t);r&&Object.assign(r,{evolution:e,next:n});q.set(t,n)}(t=ut(t),e);const r=P.get(t);r&&(n?U(r,[I],n):U(r,r.keys())),O.has(t)&&st(t)}const q=new WeakMap;function H(t){t=ut(t);let e=q.get(t);return e||(e={},q.set(t,e)),e}function J(t,e=I){if(t=ut(t),Q&&("symbol"!=typeof e||e===I)){let n=P.get(t);n||(n=new Map,P.set(t,n));let r=n.get(e);r||(r=new Set,n.set(e,r)),r.add(Q);let o=v.get(Q);o||(o=new Set,v.set(Q,o)),o.add(t)}}let Q,X,Y;function Z(t,e){const n=F(t);if(K?.chain(F(t),F(Q)),Y){if(Y.set(n,t),e)try{return t()}finally{Y.delete(n)}}else{const e=[];Y=new Map([[n,t]]);const r={};try{for(;Y.size;){if(e.length>K.maxEffectChain)throw new B("[reactive] Max effect chain reached");const[t,n]=Y.entries().next().value;e.push(t);const o=n();"value"in r||(r.value=o),Y.delete(t)}return r.value}finally{Y=void 0}}}const _=c({method:t=>function(...e){return Z(L(()=>t.apply(this,e),t),"immediate")},default:t=>function(...e){return Z(L(()=>t.apply(this,e),t),"immediate")}});function tt(t,e,n){if(F(t)===F(Q))return e();const r=Q,o=X;Q=t,n||(X=t);try{return e()}finally{Q=r,X=o}}function et(t,e,n){let r=x.get(t);r||(r=new Set,x.set(t,r)),r.add({parent:e,prop:n})}function nt(t,e,n){const r=x.get(t);r&&(r.delete({parent:e,prop:n}),0===r.size&&x.delete(t))}function rt(t){return O.has(t)||ot(t)}function ot(t){const e=x.get(t);if(!e)return!1;for(const{parent:t}of e){if(O.has(t))return!0;if(ot(t))return!0}return!1}function st(t,e){const n=x.get(t);if(n)for(const{parent:t}of n){const e=E.get(t);if(e)for(const t of e)Z(t);st(t)}}const it={[Symbol.toStringTag]:"MutTs Reactive",get(t,e,n){if(e===A)return!1;if(t[N]?.has(e)||"symbol"==typeof e)return Reflect.get(t,e,n);K.instanceMembers&&!Object.hasOwn(n,e)&&Reflect.has(n,e)||J(t,e);const r=Reflect.get(t,e,n);if("object"==typeof r&&null!==r){const n=ht(r);return rt(t)&&et(n,t,e),n}return r},set(t,e,n,r){if(t[N]?.has(e))return Reflect.set(t,e,n,r);const o=C in t&&t[C]instanceof Array&&(!Number.isNaN(Number(e))||"length"===e),s=ut(n);if(o)return t[e]=s,!0;const i=Reflect.has(r,e)?Reflect.get(t,e,r):D;return function(t,e,n,r){O.has(t)&&("object"==typeof n&&null!==n&&nt(n,t,e),"object"==typeof r&&null!==r)&&et(ht(r),t,e)}(t,e,i,s),i!==s&&(Reflect.set(t,e,s,r),G(t,{type:i!==D?"set":"add",prop:e},e)),!0},deleteProperty(t,e){if(!Object.hasOwn(t,e))return!1;const n=t[e];return O.has(t)&&"object"==typeof n&&null!==n&&nt(n,t,e),delete t[e],G(t,{type:"del",prop:e},e),O.has(t)&&st(t),!0},getPrototypeOf:t=>C in t?t[C]:Object.getPrototypeOf(t),setPrototypeOf:(t,e)=>!(C in t)&&(Object.setPrototypeOf(t,e),!0),ownKeys:t=>(J(t,I),Reflect.ownKeys(t))},ct=new WeakSet;class at{constructor(){return ct.has(new.target)?ht(this):this}}function lt(t){if(!t||"object"!=typeof t)return t;const e=t;if(j.has(e)||bt(e))return e;if(S.has(e))return S.get(e);const n=!(z in e)||e instanceof e[z]?e:new e[z](e);n!==e&&j.set(n,e);const r=new Proxy(n,it);return S.set(e,r),j.set(r,e),r}const ht=c({class(t){if(t.prototype instanceof at)return ct.add(t),t;class e extends t{constructor(...n){return super(...n),new.target===e||ct.has(new.target)||K.warn(`${t.name} has been inherited by ${this.constructor.name} that is not reactive.\n@reactive decorator must be applied to the leaf class OR classes have to extend ReactiveBase.`),ht(this)}}return Object.defineProperty(e,"name",{value:`Reactive<${t.name}>`}),e},get:t=>lt(t),default:lt});function ut(t){return j.get(t)??t}function ft(t){tt(void 0,t,!0)}const dt=new WeakMap,pt=new FinalizationRegistry(t=>t());function yt(t,...e){let n=null;const r=L(t=>tt(s,t),t);let o=!1;function s(){n?.(),K.enter(t);const i=tt(o?void 0:s,()=>t(r,...e));K.leave(t),n=()=>{n=null,i?.();const t=v.get(s);if(t){for(const e of t){const t=P.get(e);if(t){for(const[e,n]of t.entries())n.delete(s),0===n.size&&t.delete(e);0===t.size&&P.delete(e)}}v.delete(s)}}}L(s,t),Z(s,"immediate");const i=()=>{if(o)return;o=!0,n?.();const t=dt.get(s);if(t){for(const e of t)e();dt.delete(s)}pt.unregister(i)};if(!X){const t=()=>i();return pt.register(t,i,t),t}let c=dt.get(X);c||(c=new Set,dt.set(X,c));const a=X,l=()=>{c.delete(l),0===c.size&&dt.delete(a),i()};return c.add(l),l}const gt=new Set;function bt(t){return null===t||"object"!=typeof t||(!!M.has(t)||(!!t[A]||!!Array.from(gt).some(e=>e(t))))}function mt(...t){for(const e of t)e&&(e.prototype[A]=!0);return t[0]}function wt(t,e){t.prototype[z]=e,mt(e)}function vt(t,e,{immediate:n=!1}={}){if(null==t)return;if("object"!=typeof t)throw new Error("Target of deep watching must be an object");const r=L(()=>e(t),e);return yt(()=>{O.add(t);let o=k.get(r);o||(o=new Set,k.set(r,o)),o.add(t);const s=new WeakSet;return function t(e,n=0){if(!(s.has(e)||!function(t){return null!==t&&"object"==typeof t}(e)||n>K.maxDeepWatchDepth||bt(e))){s.add(e),O.add(e),o.add(e);for(const r in ut(e))if(Object.hasOwn(e,r)){const o=e[r];t("object"==typeof o&&null!==o?ht(o):o,n+1)}if(Array.isArray(e)||e instanceof Array){const r=e.length;for(let o=0;o<r;o++){const r=e[o];t("object"==typeof r&&null!==r?ht(r):r,n+1)}}else if(e instanceof Set)for(const r of e){t("object"==typeof r&&null!==r?ht(r):r,n+1)}else if(e instanceof Map)for(const[r,o]of e){t("object"==typeof o&&null!==o?ht(o):o,n+1)}}}(t),n&&e(t),n=!0,()=>{const t=k.get(r);if(t){for(const e of t){const t=E.get(e);t?(t.delete(r),0===t.size&&(E.delete(e),O.delete(e))):O.delete(e)}k.delete(r)}}})}let St;mt(Date,RegExp,Error,Promise,Function),"undefined"!=typeof window&&function(...t){for(const e of t){try{Object.defineProperty(e,A,{value:!0,writable:!1,enumerable:!1,configurable:!1})}catch{}A in e||M.add(e)}t[0]}(window,document),"undefined"!=typeof Element&&mt(Element,Node);const jt=new WeakMap;function xt(t){const e=F(t);let n=[];if(J(jt,e),jt.has(e))return jt.get(e);let r=!1;const o=yt(L(s=>{if(r)return;const i=St;if(jt.has(e)){for(const t of n)t();n=[],jt.delete(e),G(jt,{type:"invalidate",prop:e},e),o(),r=!0}else try{St=n,jt.set(e,t(s))}finally{St=i}},t));return jt.get(e)}const Ot=c({getter(t,e){const n=new WeakMap;return function(){return n.has(this)||n.set(this,r(()=>t.call(this),`${String(this.constructor.name)}.${String(e)}`)),xt(n.get(this))}},default:t=>xt(t)}),Et=Symbol("unset-yet");function kt(t){if(bt(t=ut(t)))return t;try{Object.defineProperty(t,A,{value:!0,writable:!1,enumerable:!1,configurable:!0})}catch{}A in t||M.add(t);for(const e in t)kt(t[e]);return t}const Mt=c({class(t){mt(t)},default:function(t,...e){return"object"==typeof t?kt(t):n=>{n.prototype[N]=new Set(n.prototype[N]||[]),n.prototype[N].add(t);for(const t of e)n.prototype[N].add(t);return n}}});Object.assign(T,{computedCache:jt});const Dt=Symbol("native"),Rt=Array.isArray;Array.isArray=t=>Rt(t)||t instanceof Array&&Dt in t;class Wt{}function*Pt(t,{length:e=!0}={}){yield t,e&&(yield"length")}function*Tt(t,e,{length:n=!1}={}){const r=Math.min(t,e),o=Math.max(t,e);for(let t=r;t<=o;t++)yield t;n&&(yield"length")}class zt extends(w(Wt,{get(t){return J(this[Dt],t),ht(this[Dt][t])},set(t,e){const n=t>=this[Dt].length;this[Dt][t]=e,V(this[Dt],{type:"bunch",method:"set"},Pt(t,{length:n}))},getLength(){return J(this[Dt],"length"),this[Dt].length},setLength(t){const e=this[Dt].length;try{this[Dt].length=t}finally{V(this[Dt],{type:"set",prop:"length"},Tt(e,t,{length:!0}))}}})){constructor(t){super(),Object.defineProperties(this,{[Dt]:{value:t},[C]:{value:t}})}at(t){const e=t<0?this[Dt].length+t:t;if(J(this,e),!(e<0||e>=this[Dt].length))return ht(this[Dt][e])}push(...t){const e=this[Dt].length;try{return this[Dt].push(...t)}finally{V(this,{type:"bunch",method:"push"},Tt(e,e+t.length-1,{length:!0}))}}pop(){if(0!==this[Dt].length)try{return ht(this[Dt].pop())}finally{V(this,{type:"bunch",method:"pop"},Pt(this[Dt].length))}}shift(){if(0!==this[Dt].length)try{return ht(this[Dt].shift())}finally{V(this,{type:"bunch",method:"shift"},Tt(0,this[Dt].length+1,{length:!0}))}}unshift(...t){try{return this[Dt].unshift(...t)}finally{V(this,{type:"bunch",method:"unshift"},Tt(0,this[Dt].length-t.length,{length:!0}))}}splice(t,e,...n){const r=this[Dt].length;void 0===e&&(e=r-t);try{return ht(void 0===e?this[Dt].splice(t):this[Dt].splice(t,e,...n))}finally{V(this,{type:"bunch",method:"splice"},e===n.length?Tt(t,t+e):Tt(t,r+Math.max(n.length-e,0),{length:!0}))}}reverse(){try{return this[Dt].reverse()}finally{V(this,{type:"bunch",method:"reverse"},Tt(0,this[Dt].length-1))}}sort(t){try{return this[Dt].sort(t)}finally{V(this,{type:"bunch",method:"sort"},Tt(0,this[Dt].length-1))}}fill(t,e,n){try{return void 0===e?this[Dt].fill(t):void 0===n?this[Dt].fill(t,e):this[Dt].fill(t,e,n)}finally{V(this,{type:"bunch",method:"fill"},Tt(0,this[Dt].length-1))}}copyWithin(t,e,n){try{return void 0===n?this[Dt].copyWithin(t,e):this[Dt].copyWithin(t,e,n)}finally{V(this,{type:"bunch",method:"copyWithin"},Tt(0,this[Dt].length-1))}}toReversed(){return J(this),ht(this[Dt].toReversed())}toSorted(t){return J(this),ht(this[Dt].toSorted(t))}toSpliced(t,e,...n){return J(this),void 0===e?this[Dt].toSpliced(t):this[Dt].toSpliced(t,e,...n)}with(t,e){return J(this),ht(this[Dt].with(t,e))}entries(){return J(this),W(this[Dt].entries())}keys(){return J(this),this[Dt].keys()}values(){return J(this),R(this[Dt].values())}[Symbol.iterator](){J(this);const t=this[Dt][Symbol.iterator]();return{next(){const e=t.next();return e.done?e:{value:ht(e.value),done:!1}}}}indexOf(t,e){return J(this),this[Dt].indexOf(t,e)}lastIndexOf(t,e){return J(this),this[Dt].lastIndexOf(t,e)}includes(t,e){return J(this),this[Dt].includes(t,e)}find(t,e){return J(this),ht(this[Dt].find(t,e))}findIndex(t,e){return J(this),this[Dt].findIndex(t,e)}flat(){return J(this),ht(this[Dt].flat())}flatMap(t,e){return J(this),ht(this[Dt].flatMap(t,e))}filter(t,e){return J(this),ht(this[Dt].filter(t,e))}map(t,e){return J(this),ht(this[Dt].map(t,e))}reduce(t,e){J(this);const n=void 0===e?this[Dt].reduce(t):this[Dt].reduce(t,e);return ht(n)}reduceRight(t,e){J(this);const n=void 0!==e?this[Dt].reduceRight(t,e):this[Dt].reduceRight(t);return ht(n)}slice(t,e){for(const n of Tt(t||0,e||this[Dt].length-1))J(this,n);return void 0===t?this[Dt].slice():void 0===e?this[Dt].slice(t):this[Dt].slice(t,e)}concat(...t){return J(this),ht(this[Dt].concat(...t))}join(t){return J(this),this[Dt].join(t)}forEach(t,e){J(this),this[Dt].forEach(t,e)}every(t,e){return J(this),this[Dt].every(t,e)}some(t,e){return J(this),this[Dt].some(t,e)}}const At=Symbol("native");class Nt{constructor(t){Object.defineProperties(this,{[At]:{value:t},[C]:{value:t},content:{value:Symbol("content")},[Symbol.toStringTag]:{value:"ReactiveMap"}})}get size(){return J(this,"size"),this[At].size}clear(){const t=this[At].size>0;if(this[At].clear(),t){const t={type:"bunch",method:"clear"};G(this,t,"size"),V(this.content,t)}}entries(){return J(this.content),W(this[At].entries())}forEach(t,e){J(this.content),this[At].forEach(t,e)}keys(){return J(this.content),this[At].keys()}values(){return J(this.content),R(this[At].values())}[Symbol.iterator](){J(this.content);const t=this[At][Symbol.iterator]();return{next(){const e=t.next();return e.done?e:{value:[e.value[0],ht(e.value[1])],done:!1}}}}delete(t){const e=this[At].has(t),n=this[At].delete(t);if(e){const e={type:"del",prop:t};G(this.content,e,t),G(this,e,"size")}return n}get(t){return J(this.content,t),ht(this[At].get(t))}has(t){return J(this.content,t),this[At].has(t)}set(t,e){const n=this[At].has(t),r=this[At].get(t),o=ht(e);if(this[At].set(t,o),!n||r!==o){const e={type:n?"set":"add",prop:t};G(this.content,e,t),G(this,e,"size")}return this}}const Ct=Symbol("native");class It{constructor(t){Object.defineProperties(this,{[Ct]:{value:t},[C]:{value:t},content:{value:Symbol("content")},[Symbol.toStringTag]:{value:"ReactiveSet"}})}get size(){return J(this,"size"),this[Ct].size}add(t){const e=this[Ct].has(t),n=ht(t);if(this[Ct].add(n),!e){const t={type:"add",prop:n};G(this.content,t,n),G(this,t,"size")}return this}clear(){const t=this[Ct].size>0;if(this[Ct].clear(),t){const t={type:"bunch",method:"clear"};G(this,t,"size"),V(this.content,t)}}delete(t){const e=this[Ct].has(t),n=this[Ct].delete(t);if(e){const e={type:"del",prop:t};G(this.content,e,t),G(this,e,"size")}return n}has(t){return J(this.content,t),this[Ct].has(t)}entries(){return J(this.content),W(this[Ct].entries())}forEach(t,e){J(this.content),this[Ct].forEach(t,e)}keys(){return J(this.content),R(this[Ct].keys())}values(){return J(this.content),R(this[Ct].values())}[Symbol.iterator](){J(this.content);const t=this[Ct][Symbol.iterator]();return{next(){const e=t.next();return e.done?e:{value:ht(e.value),done:!1}}}}}wt(WeakMap,class{constructor(t){Object.defineProperties(this,{[At]:{value:t},[C]:{value:t},content:{value:Symbol("content")},[Symbol.toStringTag]:{value:"ReactiveWeakMap"}})}delete(t){const e=this[At].has(t),n=this[At].delete(t);return e&&G(this.content,{type:"del",prop:t},t),n}get(t){return J(this.content,t),ht(this[At].get(t))}has(t){return J(this.content,t),this[At].has(t)}set(t,e){return G(this.content,{type:this[At].has(t)?"set":"add",prop:t},t),this[At].set(t,e),this}}),wt(Map,Nt),wt(WeakSet,class{constructor(t){Object.defineProperties(this,{[Ct]:{value:t},[C]:{value:t},content:{value:Symbol("content")},[Symbol.toStringTag]:{value:"ReactiveWeakSet"}})}add(t){const e=this[Ct].has(t);return this[Ct].add(t),e||G(this.content,{type:"add",prop:t},t),this}delete(t){const e=this[Ct].has(t),n=this[Ct].delete(t);return e&&G(this.content,{type:"del",prop:t},t),n}has(t){return J(this.content,t),this[Ct].has(t)}}),wt(Set,It),wt(Array,zt);const $t=[],Lt=c({getter:(t,e)=>function(){const n=$t.findIndex(t=>t.object===this&&t.prop===e);if(n>-1)throw new Error(`Circular dependency detected: ${$t.slice(n).map(t=>`${t.object.constructor.name}.${String(t.prop)}`).join(" -> ")} -> again`);$t.push({object:this,prop:e});try{const n=t.call(this);return Ft(this,e,n),n}finally{$t.pop()}}});function Ft(t,e,n){Object.defineProperty(t,e,{value:n})}const Bt=Object.assign(c({method:(t,e)=>function(...n){return Bt.warn(this,e),t.apply(this,n)},getter:(t,e)=>function(){return Bt.warn(this,e),t.call(this)},setter:(t,e)=>function(n){return Bt.warn(this,e),t.call(this,n)},class:t=>class extends t{constructor(...t){super(...t),Bt.warn(this,"constructor")}},default:t=>c({method:(e,n)=>function(...r){return Bt.warn(this,n,t),e.apply(this,r)},getter:(e,n)=>function(){return Bt.warn(this,n,t),e.call(this)},setter:(e,n)=>function(r){return Bt.warn(this,n,t),e.call(this,r)},class:e=>class extends e{constructor(...e){super(...e),Bt.warn(this,"constructor",t)}}})}),{warn:(t,e,n)=>{}});t.DecoratorError=o,t.Destroyable=function(t,e){var n;return t&&"function"!=typeof t&&(e=t,t=void 0),t||(t=class{}),n=class extends t{static destroy(t){const e=n.destructors.get(t);if(!e)return!1;a.unregister(t),n.destructors.delete(t),Object.setPrototypeOf(t,new Proxy({},f));for(const e of Object.getOwnPropertyNames(t))delete t[e];return e(),!0}static isDestroyable(t){return n.destructors.has(t)}constructor(...t){super(...t);const r={};this[h]=r;const o=e?.destructor??this[l];if(!o)throw new u("Destructor is not defined");function s(){o(r)}n.destructors.set(this,s),a.register(this,s,this)}},n.destructors=new WeakMap,n},t.DestructionError=u,t.Eventful=class{constructor(){y.set(this,new Map),g.set(this,[])}hook(t){return p(this,g,"f").includes(t)||p(this,g,"f").push(t),()=>{p(this,g,"f").splice(p(this,g,"f").indexOf(t),1)}}on(t,e){if("object"==typeof t)for(const e of Object.keys(t))this.on(e,t[e]);else if(void 0!==e){let n=p(this,y,"f").get(t);n||(n=[],p(this,y,"f").set(t,n)),n.push(e)}return()=>this.off(t,e)}off(t,e){if("object"==typeof t)for(const e of Object.keys(t))this.off(e,t[e]);else if(null!=e){const n=p(this,y,"f").get(t);n&&p(this,y,"f").set(t,n.filter(t=>t!==e))}else p(this,y,"f").delete(t)}emit(t,...e){const n=p(this,y,"f").get(t);if(n)for(const t of n)t.apply(this,e);for(const n of p(this,g,"f"))n.call(this,t,...e)}},t.Indexable=w,t.ReactiveBase=at,t.ReactiveError=B,t.allocated=d,t.allocatedValues=h,t.atomic=_,t.cache=Ft,t.cached=Lt,t.callOnGC=function(t){let e=!1;const n=()=>{e||(e=!0,t())};return a.register(n,t,t),n},t.computed=Ot,t.debounce=function(t){return c({method(e,n){let r=null;return function(...n){r&&clearTimeout(r),r=setTimeout(()=>{e.apply(this,n),r=null},t)}}})},t.decorator=c,t.deprecated=Bt,t.describe=function(t){return(...e)=>n=>class extends n{constructor(...n){super(...n);for(const n of e)Object.defineProperty(this,n,{...Object.getOwnPropertyDescriptor(this,n),...t})}}},t.destructor=l,t.effect=yt,t.getAt=b,t.getState=H,t.immutables=gt,t.invalidateComputed=function(t,e=!0){St?St.push(t):e&&K.warn("Using `invalidateComputed` outside of a computed property")},t.isCached=function(t,e){return!!Object.getOwnPropertyDescriptor(t,e)},t.isConstructor=n,t.isNonReactive=bt,t.isReactive=function(t){return j.has(t)},t.legacyDecorator=s,t.modernDecorator=i,t.profileInfo=T,t.reactive=ht,t.reactiveOptions=K,t.renamed=r,t.setAt=m,t.throttle=function(t){return c({method(e,n){let r=0,o=null;return function(...n){const s=Date.now();if(s-r>=t)return o&&(clearTimeout(o),o=null),r=s,e.apply(this,n);if(!o){const i=t-(s-r),c=[...n];o=setTimeout(()=>{r=Date.now(),e.apply(this,c),o=null},i)}}}})},t.unreactive=Mt,t.untracked=ft,t.unwrap=ut,t.watch=function(t,e,n={}){return"function"==typeof t?function(t,e,{immediate:n=!1,deep:r=!1}={}){let o,s=Et;const i=yt(L(i=>{const c=t(i);s!==c&&ft(L(()=>{s===Et?n&&e(c):e(c,s),s=c,r&&(o&&o(),o=vt(c,L(t=>e(t,t),e)))},e))},t));return()=>{i(),o&&o()}}(t,e,n):"object"==typeof t?function(t,e,{immediate:n=!1,deep:r=!1}={}){return r?vt(t,e,{immediate:n}):yt(L(()=>{J(t),n&&ft(()=>e(t)),n=!0},e))}(t,e,n):(()=>{throw new Error("watch: value must be a function or an object")})()},t.zip=function(...t){if(!t.length)return[];const e=Math.min(...t.map(t=>t.length)),n=[];for(let r=0;r<e;r++){const e=t.map(t=>t[r]);n.push(e)}return n}});
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Mutts={})}(this,function(t){"use strict";const e=new Set([Object,Array,Date,Function,Set,Map,WeakMap,WeakSet,Promise,Error,TypeError,ReferenceError,SyntaxError,RangeError,URIError,EvalError,Reflect,Proxy,RegExp,String,Number,Boolean]);function n(t){return t&&"function"==typeof t&&(e.has(t)||t.toString?.().startsWith("class "))}function r(t,e){return Object.defineProperties(t,{name:{value:e}})}function o(t,e,n){return"undefined"!=typeof Node&&t instanceof Node?t[e]:Reflect.get(t,e,n)}function s(t,e,n,r){return"undefined"!=typeof Node&&t instanceof Node?(t[e]=n,n):Reflect.set(t,e,n,r)}function i(t,e){const n=Object.getOwnPropertyDescriptor(t,e);return!(!n?.get&&!n?.set)}function c(t){return null!==t&&"object"==typeof t}class a extends Error{constructor(t){super(t),this.name="DecoratorException"}}function l(t){return function(e,r,o,...s){if(void 0===r){if(n(e)){if(!("class"in t))throw new Error("Decorator cannot be applied to a class");return t.class?.(e)}}else if("object"==typeof e&&["string","symbol"].includes(typeof r)){if(!o)throw new Error("Decorator cannot be applied to a field");if("object"==typeof o&&"configurable"in o){if("get"in o||"set"in o){if(!("getter"in t)&&!("setter"in t))throw new Error("Decorator cannot be applied to a getter or setter");if("getter"in t){const e=t.getter?.(o.get,r);e&&(o.get=e)}if("setter"in t){const e=t.setter?.(o.set,r);e&&(o.set=e)}return o}if("function"==typeof o.value){if(!("method"in t))throw new Error("Decorator cannot be applied to a method");const e=t.method?.(o.value,r);return e&&(o.value=e),o}}}if(!("default"in t))throw new Error("Decorator do not have a default implementation");return t.default.call(this,e,r,o,...s)}}function u(t){return function(e,n,...r){if(!n?.kind||"string"!=typeof n.kind){if(!("default"in t))throw new Error("Decorator do not have a default implementation");return t.default.call(this,e,n,...r)}switch(n.kind){case"class":if(!("class"in t))throw new Error("Decorator cannot be applied to a class");return t.class?.(e);case"field":throw new Error("Decorator cannot be applied to a field");case"getter":if(!("getter"in t))throw new Error("Decorator cannot be applied to a getter");return t.getter?.(e,n.name);case"setter":if(!("setter"in t))throw new Error("Decorator cannot be applied to a setter");return t.setter?.(e,n.name);case"method":if(!("method"in t))throw new Error("Decorator cannot be applied to a method");return t.method?.(e,n.name);case"accessor":{if(!("getter"in t)&&!("setter"in t))throw new Error("Decorator cannot be applied to a getter or setter");const r={};if("getter"in t){const o=t.getter?.(e.get,n.name);o&&(r.get=o)}if("setter"in t){const o=t.setter?.(e.set,n.name);o&&(r.set=o)}return r}}}}const f=t=>{const e=u(t),n=l(t);return(t,r,...o)=>{const s=function(t,e){return"object"==typeof e&&null!==e&&"string"==typeof e.kind?"modern":"legacy"}(0,r,o[0]);return"modern"===s?e(t,r,...o):n(t,r,...o)}},h=new FinalizationRegistry(t=>t()),p=Symbol("destructor"),d=Symbol("allocated");class y extends Error{static throw(t){return()=>{throw new y(t)}}constructor(t){super(`Object is destroyed. ${t}`),this.name="DestroyedAccessError"}}const g={[Symbol.toStringTag]:"MutTs Destroyable",get:y.throw("Cannot access destroyed object"),set:y.throw("Cannot access destroyed object")};const b=f({setter:(t,e)=>function(n){return this[d][e]=n,t.call(this,n)}});function m(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}var w,v;"function"==typeof SuppressedError&&SuppressedError;w=new WeakMap,v=new WeakMap;const j=Symbol("getAt"),O=Symbol("setAt");function S(t,e){t&&"function"!=typeof t&&(e=t,t=void 0),t||(t=class{}),e||(e={get(t){if("function"!=typeof this[j])throw new Error("Indexable class must have an [getAt] method");return this[j](t)},set(t,e){if("function"!=typeof this[O])throw new Error("Indexable class has read-only numeric index access");this[O](t,e)}});class n extends t{}return Object.setPrototypeOf(n.prototype,new Proxy(t.prototype,{[Symbol.toStringTag]:"MutTs Indexable",get(t,n,r){if(n in t){const e=Object.getOwnPropertyDescriptor(t,n)?.get;return e?e.call(r):t[n]}if("string"==typeof n){if("length"===n&&e.getLength)return e.getLength.call(r);const t=Number(n);if(!Number.isNaN(t))return e.get.call(r,t)}},set(t,n,r,o){if(n in t){const e=Object.getOwnPropertyDescriptor(t,n)?.set;return e?e.call(o,r):t[n]=r,!0}if("string"==typeof n){if("length"===n&&e.setLength)return e.setLength.call(o,r),!0;const t=Number(n);if(!Number.isNaN(t)){if(!e.set)throw new Error("Indexable class has read-only numeric index access");return e.set.call(o,t,r),!0}}return Object.defineProperty(o,n,{value:r,writable:!0,enumerable:!0,configurable:!0}),!0}})),n}function E(t,e){const r=new WeakMap,s=t(Object);return r.set(Object,s),new Proxy(s,{apply(s,i,c){if(0===c.length)throw new Error("Mixin requires a base class");const a=c[0];if("function"!=typeof a)throw new Error("Mixin requires a constructor function");if(!(n(a)||a&&"function"==typeof a&&a.prototype))throw new Error("Mixin requires a valid constructor");const l=r.get(a);if(l)return l;let u=a;if(e){const t=class extends a{},n=a.prototype,r=new Proxy(n,{get(t,n,r){const s=o(t,n,r);return"function"!=typeof s||"string"!=typeof n||["constructor","toString","valueOf"].includes(n)?s:function(...t){const n=e(this);return s.apply(n,t)}}});Object.setPrototypeOf(t.prototype,r),u=t}const f=t(u);return r.set(a,f),f}})}const x=new WeakMap,k=new WeakMap,M=new WeakMap,P=new WeakMap,R=new WeakSet,D=new WeakMap,W=new WeakMap,z=new WeakSet,A=Symbol("absent");function*T(t){let e=t.next();for(;!e.done;)yield mt(e.value),e=t.next()}function*C(t){let e=t.next();for(;!e.done;){const[n,r]=e.value;yield[mt(n),mt(r)],e=t.next()}}const N=new WeakMap,I={objectToProxy:k,proxyToObject:M,effectToReactiveObjects:x,watchers:N,objectParents:P,objectsWithDeepWatchers:R,deepWatchers:D,effectToDeepWatchedObjects:W,nonReactiveObjects:z},$=Symbol("native-reactive"),L=Symbol("non-reactive"),B=Symbol("unreactive-properties"),F=Symbol("prototype-forwarding"),_=Symbol("all-props"),q=Symbol("root-function");function G(t,e){return Object.defineProperty(t,q,{value:K(e),writable:!1})}function K(t){return t?.[q]||t}class U extends Error{constructor(t){super(t),this.name="ReactiveError"}}const V={enter:t=>{},leave:t=>{},chain:(t,e)=>{},beginChain:t=>{},endChain:()=>{},touched:(t,e,n,r)=>{},maxEffectChain:100,maxEffectReaction:"throw",maxDeepWatchDepth:100,instanceMembers:!0,ignoreAccessors:!0,warn:(...t)=>{}};const H=new WeakMap;function J(t,e,n,r,...o){for(const s of o)for(const o of s){const s=r.get(o);if(s)for(const r of Array.from(s)){n.add(r);const s=H.get(r);if(s){for(const n of s)n(t,e,o);s.delete(r)}}}}function Q(t,e,n){X(t,e,[n])}function X(t,e,n){!function(t,e){t=wt(t);const n={},r=Z(t);r&&Object.assign(r,{evolution:e,next:n});Y.set(t,n)}(t=wt(t),e);const r=N.get(t);if(r){const o=new Set;n?(n=Array.from(n),J(t,e,o,r,[_],n)):J(t,e,o,r,r.keys()),V.touched(t,e,n,o),st(Array.from(o))}R.has(t)&&ht(t)}const Y=new WeakMap;function Z(t){t=wt(t);let e=Y.get(t);return e||(e={},Y.set(t,e)),e}function tt(e,n=_){if(e=wt(e),t.activeEffect&&("symbol"!=typeof n||n===_)){let r=N.get(e);r||(r=new Map,N.set(e,r));let o=r.get(n);o||(o=new Set,r.set(n,o)),o.add(t.activeEffect);let s=x.get(t.activeEffect);s||(s=new Set,x.set(t.activeEffect,s)),s.add(e)}}let et,nt;t.activeEffect=void 0;const rt=new Set;function ot(t){nt?rt.add(t):t()}function st(e,n){Array.isArray(e)||(e=[e]);const r=e.map(K);if(nt){V?.chain(r,K(t.activeEffect));for(let t=0;t<e.length;t++)nt.set(r[t],e[t]);if(n)for(let t=0;t<e.length;t++)try{return e[t]()}finally{nt.delete(r[t])}}else{V.beginChain(r);const t=[];nt=new Map(r.map((t,n)=>[t,e[n]]));const n={};try{for(;nt.size;){if(t.length>V.maxEffectChain)switch(V.maxEffectReaction){case"throw":throw new U("[reactive] Max effect chain reached");case"debug":break;case"warn":V.warn("[reactive] Max effect chain reached")}const[e,r]=nt.entries().next().value;t.push(e);const o=r();"value"in n||(n.value=o),nt.delete(e)}const e=Array.from(rt);rt.clear();for(const t of e)t();return n.value}finally{nt=void 0,V.endChain()}}}const it=f({method:t=>function(...e){return st(G(()=>t.apply(this,e),t),"immediate")},default:t=>function(...e){return st(G(()=>t.apply(this,e),t),"immediate")}});function ct(e,n,r){if(K(e)===K(t.activeEffect))return n();const o=t.activeEffect,s=et;t.activeEffect=e,et=e;try{return n()}finally{t.activeEffect=o,et=s}}function at(t,e,n){let r=P.get(t);r||(r=new Set,P.set(t,r)),r.add({parent:e,prop:n})}function lt(t,e,n){const r=P.get(t);r&&(r.delete({parent:e,prop:n}),0===r.size&&P.delete(t))}function ut(t){return R.has(t)||ft(t)}function ft(t){const e=P.get(t);if(!e)return!1;for(const{parent:t}of e){if(R.has(t))return!0;if(ft(t))return!0}return!1}function ht(t,e){const n=P.get(t);if(n)for(const{parent:t}of n){const e=D.get(t);if(e)for(const t of e)st(t);ht(t)}}const pt={[Symbol.toStringTag]:"MutTs Reactive",get(t,e,n){if(e===L)return!1;if(wt(t)[B]?.has(e)||"symbol"==typeof e)return o(t,e,n);Reflect.has(n,e)&&(V.instanceMembers&&!Object.hasOwn(n,e)||V.ignoreAccessors&&i(n,e))||tt(t,e);const r=o(Object.hasOwn(t,e)?t:Object.getPrototypeOf(t),e,n);if("object"==typeof r&&null!==r){const n=mt(r);return ut(t)&&at(n,t,e),n}return r},set(t,e,n,r){if(wt(t)[B]?.has(e))return s(t,e,n,r);const i=F in t&&t[F]instanceof Array&&(!Number.isNaN(Number(e))||"length"===e),c=wt(n);if(i)return t[e]=c,!0;const a=Reflect.has(r,e)?wt(o(t,e,r)):A;return function(t,e,n,r){R.has(t)&&("object"==typeof n&&null!==n&&lt(n,t,e),"object"==typeof r&&null!==r)&&at(mt(r),t,e)}(t,e,a,c),a!==c&&(s(t,e,c,r),Q(t,{type:a!==A?"set":"add",prop:e},e)),!0},deleteProperty(t,e){if(!Object.hasOwn(t,e))return!1;const n=t[e];return R.has(t)&&"object"==typeof n&&null!==n&&lt(n,t,e),delete t[e],Q(t,{type:"del",prop:e},e),R.has(t)&&ht(t),!0},getPrototypeOf:t=>F in t?t[F]:Object.getPrototypeOf(t),setPrototypeOf:(t,e)=>!(F in t)&&(Object.setPrototypeOf(t,e),!0),ownKeys:t=>(tt(t,_),Reflect.ownKeys(t))},dt=new WeakSet,yt=E(t=>class extends t{constructor(...t){return super(...t),dt.has(new.target)?mt(this):this}}),gt=E(t=>{class e extends t{constructor(...t){return super(...t),mt(this)}}return e.__isReactiveMixin=!0,e},wt);function bt(t){if(!t||"object"!=typeof t)return t;const e=t;if(M.has(e)||xt(e))return e;if(k.has(e))return k.get(e);const n=!($ in e)||e instanceof e[$]?e:new e[$](e);n!==e&&M.set(n,e);const r=new Proxy(n,pt);return k.set(e,r),M.set(r,e),r}const mt=f({class(t){if(t.prototype instanceof yt)return dt.add(t),t;let e=t.prototype;for(;e&&e!==Object.prototype;){if(e.constructor&&e.constructor.__isReactiveMixin)throw new Error("@reactive decorator cannot be used with Reactive mixin. Reactive mixin already provides reactivity.");e=Object.getPrototypeOf(e)}class n extends t{constructor(...e){return super(...e),new.target===n||dt.has(new.target)||V.warn(`${t.name} has been inherited by ${this.constructor.name} that is not reactive.\n@reactive decorator must be applied to the leaf class OR classes have to extend ReactiveBase.`),mt(this)}}return Object.defineProperty(n,"name",{value:`Reactive<${t.name}>`}),n},get:t=>bt(t),default:bt});function wt(t){return M.get(t)??t}function vt(t){let e;return ct(void 0,()=>{e=t()}),e}const jt=new WeakMap,Ot=new FinalizationRegistry(t=>t());function St(t,...e){let n=null;const r=et,o=G(t=>ct(a,t),t),s=G(t=>ct(r,t),K(r));let i=!1,c=!0;function a(){if(i)return;let r;n?.(),V.enter(K(t));try{r=ct(a,()=>t({tracked:o,ascend:s,init:c},...e))}finally{c=!1,V.leave(t)}n=()=>{n=null,r?.();const t=x.get(a);if(t){for(const e of t){const t=N.get(e);if(t){for(const[e,n]of t.entries())n.delete(a),0===n.size&&t.delete(e);0===t.size&&N.delete(e)}}x.delete(a)}const e=jt.get(a);if(e){for(const t of e)t();jt.delete(a)}}}G(a,t),st(a,"immediate");const l=()=>{i||(i=!0,n?.(),Ot.unregister(l))},u=et;if(!u){const t=()=>l();return Ot.register(t,l,l),t}let f=jt.get(u);f||(f=new Set,jt.set(u,f));const h=()=>{f.delete(h),0===f.size&&jt.delete(u),l()};return f.add(h),h}const Et=new Set;function xt(t){return null===t||"object"!=typeof t||(!!z.has(t)||(!!t[L]||!!Array.from(Et).some(e=>e(t))))}function kt(...t){for(const e of t)e&&(e.prototype[L]=!0);return t[0]}function Mt(t,e){t.prototype[$]=e,kt(e)}function Pt(t,e,{immediate:n=!1}={}){if(null==t)return;if("object"!=typeof t)throw new Error("Target of deep watching must be an object");const r=G(()=>e(t),e);return St(()=>{R.add(t);let o=W.get(r);o||(o=new Set,W.set(r,o)),o.add(t);const s=new WeakSet;return function t(e,n=0){if(!(s.has(e)||!c(e)||n>V.maxDeepWatchDepth||xt(e))){s.add(e),R.add(e),o.add(e);for(const r in wt(e))if(Object.hasOwn(e,r)){const o=e[r];t("object"==typeof o&&null!==o?mt(o):o,n+1)}if(Array.isArray(e)||e instanceof Array){const r=e.length;for(let o=0;o<r;o++){const r=e[o];t("object"==typeof r&&null!==r?mt(r):r,n+1)}}else if(e instanceof Set)for(const r of e){t("object"==typeof r&&null!==r?mt(r):r,n+1)}else if(e instanceof Map)for(const[r,o]of e){t("object"==typeof o&&null!==o?mt(o):o,n+1)}}}(t),n&&e(t),n=!0,()=>{const t=W.get(r);if(t){for(const e of t){const t=D.get(e);t?(t.delete(r),0===t.size&&(D.delete(e),R.delete(e))):R.delete(e)}W.delete(r)}}})}let Rt;kt(Date,RegExp,Error,Promise,Function),"undefined"!=typeof window&&function(...t){for(const e of t){try{Object.defineProperty(e,L,{value:!0,writable:!1,enumerable:!1,configurable:!1})}catch{}L in e||z.add(e)}t[0]}(window,document);const Dt=new WeakMap;function Wt(t){const e=K(t);let n=[];if(tt(Dt,e),Dt.has(e))return Dt.get(e);let r=!1;const o=St(G(s=>{if(r)return;const i=Rt;if(Dt.has(e)){for(const t of n)t();n=[],Dt.delete(e),Q(Dt,{type:"invalidate",prop:e},e),o(),r=!0}else try{Rt=n,Dt.set(e,t(s))}finally{Rt=i}},t));return Dt.get(e)}const zt=Object.assign(f({getter(t,e){const n=new WeakMap;return function(){return n.has(this)||n.set(this,r(()=>t.call(this),`${String(this.constructor.name)}.${String(e)}`)),Wt(n.get(this))}},default:Wt}),{map:It,memo:function(t,e){const n=new $t(e),r=mt([]);return Nt(r,St(()=>{const e="function"==typeof t?t():t;function o(){vt(()=>{n.reduceInputs(new Set(e))})}const s=It(e,t=>(ot(o),n.get(t)),()=>ot(o));St(()=>{r.length=0,r.push(...s)})}))},self:function(t){let e;const n=St(n=>{e=t(n)});return Nt(e,n)}}),At=Symbol("unset-yet");function Tt(t){if(xt(t=wt(t)))return t;try{Object.defineProperty(t,L,{value:!0,writable:!1,enumerable:!1,configurable:!0})}catch{}L in t||z.add(t);for(const e in t)Tt(t[e]);return t}const Ct=f({class(t){kt(t)},default:function(t,...e){return"object"==typeof t?Tt(t):n=>{n.prototype[B]=new Set(n.prototype[B]||[]),n.prototype[B].add(t);for(const t of e)n.prototype[B].add(t);return n}}});function Nt(t,e){return Object.defineProperty(t,"cleanup",{value:e,writable:!1,enumerable:!1,configurable:!0})}function It(t,e,n){const r=mt([]),o=[];function s(n){return St(function(){r[n]=e(t[n],n,r[n])})}return St(function({ascend:e}){const i=t.length,c=vt(()=>r.length);if(n?.(i,c),i<c){const t=o.splice(i);for(const e of t)e();r.length=i}else i>c&&e(function(){for(let t=c;t<i;t++)o.push(s(t))})}),Nt(r,()=>{for(const t of o)t();o.length=0})}Object.assign(I,{computedCache:Dt});let $t=(()=>{let t,e,n=[Ct],r=[];var o,s,i;return e=class{constructor(t){this.compute=t,this.cache=new Map,this.keepCleanups=St(({ascend:t})=>(this.inEffect=t,()=>{this.cleanup()}))}cleanup(){for(const{cleanup:t}of this.cache.values())t();this.cache.clear()}get(t){let e;return tt(this,t),this.cache.has(t)?e=this.cache.get(t):(e={},e.cleanup=this.inEffect(()=>St(Object.defineProperties(()=>{"value"in e?(this.cache.delete(t),Q(this,{type:"invalidate",prop:t},t)):e.value=this.compute(t)},{name:{value:"Memoize"}}))),this.cache.set(t,e)),e.value}reduceInputs(t){for(const e of this.cache.keys())if("function"==typeof t?!t(e):!t.has(e)){this.cache.get(e).cleanup(),this.cache.delete(e)}}},o=e,"symbol"==typeof(s="Memoized")&&(s=s.description?"[".concat(s.description,"]"):""),Object.defineProperty(o,"name",{configurable:!0,value:i?"".concat(i," ",s):s}),(()=>{const o="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;!function(t,e,n,r,o,s){function i(t){if(void 0!==t&&"function"!=typeof t)throw new TypeError("Function expected");return t}for(var c,a=r.kind,l="getter"===a?"get":"setter"===a?"set":"value",u=!e&&t?r.static?t:t.prototype:null,f=e||(u?Object.getOwnPropertyDescriptor(u,r.name):{}),h=!1,p=n.length-1;p>=0;p--){var d={};for(var y in r)d[y]="access"===y?{}:r[y];for(var y in r.access)d.access[y]=r.access[y];d.addInitializer=function(t){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(i(t||null))};var g=(0,n[p])("accessor"===a?{get:f.get,set:f.set}:f[l],d);if("accessor"===a){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(c=i(g.get))&&(f.get=c),(c=i(g.set))&&(f.set=c),(c=i(g.init))&&o.unshift(c)}else(c=i(g))&&("field"===a?o.unshift(c):f[l]=c)}u&&Object.defineProperty(u,r.name,f),h=!0}(null,t={value:e},n,{kind:"class",name:e.name,metadata:o},null,r),e=t.value,o&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o}),function(t,e,n){for(var r=arguments.length>2,o=0;o<e.length;o++)n=r?e[o].call(t,n):e[o].call(t)}(e,r)})(),e})();const Lt=Symbol("native"),Bt=Array.isArray;Array.isArray=t=>Bt(t)||t instanceof Array&&Lt in t;class Ft{}function*_t(t,{length:e=!0}={}){e&&(yield"length"),yield t}function*qt(t,e,{length:n=!1}={}){const r=Math.min(t,e),o=Math.max(t,e);n&&(yield"length");for(let t=r;t<=o;t++)yield t}class Gt extends(S(Ft,{get(t){return tt(this[Lt],t),mt(this[Lt][t])},set(t,e){const n=t>=this[Lt].length;this[Lt][t]=e,X(this[Lt],{type:"set",prop:t},_t(t,{length:n}))},getLength(){return tt(this[Lt],"length"),this[Lt].length},setLength(t){const e=this[Lt].length;try{this[Lt].length=t}finally{X(this[Lt],{type:"set",prop:"length"},qt(e,t,{length:!0}))}}})){constructor(t){super(),Object.defineProperties(this,{[Lt]:{value:t},[F]:{value:t}})}at(t){const e=t<0?this[Lt].length+t:t;if(tt(this,e),!(e<0||e>=this[Lt].length))return mt(this[Lt][e])}push(...t){const e=this[Lt].length;try{return this[Lt].push(...t)}finally{X(this,{type:"bunch",method:"push"},qt(e,e+t.length-1,{length:!0}))}}pop(){if(0!==this[Lt].length)try{return mt(this[Lt].pop())}finally{X(this,{type:"bunch",method:"pop"},_t(this[Lt].length))}}shift(){if(0!==this[Lt].length)try{return mt(this[Lt].shift())}finally{X(this,{type:"bunch",method:"shift"},qt(0,this[Lt].length+1,{length:!0}))}}unshift(...t){try{return this[Lt].unshift(...t)}finally{X(this,{type:"bunch",method:"unshift"},qt(0,this[Lt].length-t.length,{length:!0}))}}splice(t,e,...n){const r=this[Lt].length;void 0===e&&(e=r-t);try{return mt(void 0===e?this[Lt].splice(t):this[Lt].splice(t,e,...n))}finally{X(this,{type:"bunch",method:"splice"},e===n.length?qt(t,t+e):qt(t,r+Math.max(n.length-e,0),{length:!0}))}}reverse(){try{return this[Lt].reverse()}finally{X(this,{type:"bunch",method:"reverse"},qt(0,this[Lt].length-1))}}sort(t){t=t||((t,e)=>t.toString().localeCompare(e.toString()));try{return this[Lt].sort((e,n)=>t(mt(e),mt(n)))}finally{X(this,{type:"bunch",method:"sort"},qt(0,this[Lt].length-1))}}fill(t,e,n){try{return void 0===e?this[Lt].fill(t):void 0===n?this[Lt].fill(t,e):this[Lt].fill(t,e,n)}finally{X(this,{type:"bunch",method:"fill"},qt(0,this[Lt].length-1))}}copyWithin(t,e,n){try{return void 0===n?this[Lt].copyWithin(t,e):this[Lt].copyWithin(t,e,n)}finally{X(this,{type:"bunch",method:"copyWithin"},qt(0,this[Lt].length-1))}}toReversed(){return tt(this),mt(this[Lt].toReversed())}toSorted(t){return tt(this),mt(this[Lt].toSorted(t))}toSpliced(t,e,...n){return tt(this),void 0===e?this[Lt].toSpliced(t):this[Lt].toSpliced(t,e,...n)}with(t,e){return tt(this),mt(this[Lt].with(t,e))}entries(){return tt(this),C(this[Lt].entries())}keys(){return tt(this,"length"),this[Lt].keys()}values(){return tt(this),T(this[Lt].values())}[Symbol.iterator](){tt(this);const t=this[Lt][Symbol.iterator]();return{next(){const e=t.next();return e.done?e:{value:mt(e.value),done:!1}}}}indexOf(t,e){return tt(this),this[Lt].indexOf(t,e)}lastIndexOf(t,e){return tt(this),this[Lt].lastIndexOf(t,e)}includes(t,e){return tt(this),this[Lt].includes(t,e)}find(t,e){return tt(this),mt(this[Lt].find(t,e))}findIndex(t,e){return tt(this),this[Lt].findIndex(t,e)}flat(){return tt(this),mt(this[Lt].flat())}flatMap(t,e){return tt(this),mt(this[Lt].flatMap(t,e))}filter(t,e){return tt(this),mt(this[Lt].filter((e,n,r)=>t(mt(e),n,r),e))}map(t,e){return tt(this),mt(this[Lt].map((e,n,r)=>t(mt(e),n,r),e))}reduce(t,e){tt(this);const n=void 0===e?this[Lt].reduce(t):this[Lt].reduce(t,e);return mt(n)}reduceRight(t,e){tt(this);const n=void 0!==e?this[Lt].reduceRight(t,e):this[Lt].reduceRight(t);return mt(n)}slice(t,e){for(const n of qt(t||0,e||this[Lt].length-1))tt(this,n);return void 0===t?this[Lt].slice():void 0===e?this[Lt].slice(t):this[Lt].slice(t,e)}concat(...t){return tt(this),mt(this[Lt].concat(...t))}join(t){return tt(this),this[Lt].join(t)}forEach(t,e){tt(this),this[Lt].forEach(t,e)}every(t,e){return tt(this),this[Lt].every(t,e)}some(t,e){return tt(this),this[Lt].some(t,e)}}const Kt=Symbol("native");class Ut{constructor(t){Object.defineProperties(this,{[Kt]:{value:t},[F]:{value:t},content:{value:Symbol("content")},[Symbol.toStringTag]:{value:"ReactiveMap"}})}get size(){return tt(this,"size"),this[Kt].size}clear(){const t=this[Kt].size>0;if(this[Kt].clear(),t){const t={type:"bunch",method:"clear"};Q(this,t,"size"),X(this.content,t)}}entries(){return tt(this.content),C(this[Kt].entries())}forEach(t,e){tt(this.content),this[Kt].forEach(t,e)}keys(){return tt(this.content),this[Kt].keys()}values(){return tt(this.content),T(this[Kt].values())}[Symbol.iterator](){tt(this.content);const t=this[Kt][Symbol.iterator]();return{next(){const e=t.next();return e.done?e:{value:[e.value[0],mt(e.value[1])],done:!1}}}}delete(t){const e=this[Kt].has(t),n=this[Kt].delete(t);if(e){const e={type:"del",prop:t};Q(this.content,e,t),Q(this,e,"size")}return n}get(t){return tt(this.content,t),mt(this[Kt].get(t))}has(t){return tt(this.content,t),this[Kt].has(t)}set(t,e){const n=this[Kt].has(t),r=this[Kt].get(t),o=mt(e);if(this[Kt].set(t,o),!n||r!==o){const e={type:n?"set":"add",prop:t};Q(this.content,e,t),Q(this,e,"size")}return this}}const Vt=Symbol("native");class Ht{constructor(t){Object.defineProperties(this,{[Vt]:{value:t},[F]:{value:t},content:{value:Symbol("content")},[Symbol.toStringTag]:{value:"ReactiveSet"}})}get size(){return tt(this,"size"),this[Vt].size}add(t){const e=this[Vt].has(t),n=mt(t);if(this[Vt].add(n),!e){const t={type:"add",prop:n};Q(this.content,t,n),Q(this,t,"size")}return this}clear(){const t=this[Vt].size>0;if(this[Vt].clear(),t){const t={type:"bunch",method:"clear"};Q(this,t,"size"),X(this.content,t)}}delete(t){const e=this[Vt].has(t),n=this[Vt].delete(t);if(e){const e={type:"del",prop:t};Q(this.content,e,t),Q(this,e,"size")}return n}has(t){return tt(this.content,t),this[Vt].has(t)}entries(){return tt(this.content),C(this[Vt].entries())}forEach(t,e){tt(this.content),this[Vt].forEach(t,e)}keys(){return tt(this.content),T(this[Vt].keys())}values(){return tt(this.content),T(this[Vt].values())}[Symbol.iterator](){tt(this.content);const t=this[Vt][Symbol.iterator]();return{next(){const e=t.next();return e.done?e:{value:mt(e.value),done:!1}}}}}Mt(WeakMap,class{constructor(t){Object.defineProperties(this,{[Kt]:{value:t},[F]:{value:t},content:{value:Symbol("content")},[Symbol.toStringTag]:{value:"ReactiveWeakMap"}})}delete(t){const e=this[Kt].has(t),n=this[Kt].delete(t);return e&&Q(this.content,{type:"del",prop:t},t),n}get(t){return tt(this.content,t),mt(this[Kt].get(t))}has(t){return tt(this.content,t),this[Kt].has(t)}set(t,e){return Q(this.content,{type:this[Kt].has(t)?"set":"add",prop:t},t),this[Kt].set(t,e),this}}),Mt(Map,Ut),Mt(WeakSet,class{constructor(t){Object.defineProperties(this,{[Vt]:{value:t},[F]:{value:t},content:{value:Symbol("content")},[Symbol.toStringTag]:{value:"ReactiveWeakSet"}})}add(t){const e=this[Vt].has(t);return this[Vt].add(t),e||Q(this.content,{type:"add",prop:t},t),this}delete(t){const e=this[Vt].has(t),n=this[Vt].delete(t);return e&&Q(this.content,{type:"del",prop:t},t),n}has(t){return tt(this.content,t),this[Vt].has(t)}}),Mt(Set,Ht),Mt(Array,Gt);const Jt=[],Qt=f({getter:(t,e)=>function(){const n=Jt.findIndex(t=>t.object===this&&t.prop===e);if(n>-1)throw new Error(`Circular dependency detected: ${Jt.slice(n).map(t=>`${t.object.constructor.name}.${String(t.prop)}`).join(" -> ")} -> again`);Jt.push({object:this,prop:e});try{const n=t.call(this);return Xt(this,e,n),n}finally{Jt.pop()}}});function Xt(t,e,n){Object.defineProperty(t,e,{value:n})}const Yt=Object.assign(f({method:(t,e)=>function(...n){return Yt.warn(this,e),t.apply(this,n)},getter:(t,e)=>function(){return Yt.warn(this,e),t.call(this)},setter:(t,e)=>function(n){return Yt.warn(this,e),t.call(this,n)},class:t=>class extends t{constructor(...t){super(...t),Yt.warn(this,"constructor")}},default:t=>f({method:(e,n)=>function(...r){return Yt.warn(this,n,t),e.apply(this,r)},getter:(e,n)=>function(){return Yt.warn(this,n,t),e.call(this)},setter:(e,n)=>function(r){return Yt.warn(this,n,t),e.call(this,r)},class:e=>class extends e{constructor(...e){super(...e),Yt.warn(this,"constructor",t)}}})}),{warn:(t,e,n)=>{}});t.DecoratorError=a,t.Destroyable=function(t,e){var n;return t&&"function"!=typeof t&&(e=t,t=void 0),t||(t=class{}),n=class extends t{static destroy(t){const e=n.destructors.get(t);if(!e)return!1;h.unregister(t),n.destructors.delete(t),Object.setPrototypeOf(t,new Proxy({},g));for(const e of Object.getOwnPropertyNames(t))delete t[e];return e(),!0}static isDestroyable(t){return n.destructors.has(t)}constructor(...t){super(...t);const r={};this[d]=r;const o=e?.destructor??this[p];if(!o)throw new y("Destructor is not defined");function s(){o(r)}n.destructors.set(this,s),h.register(this,s,this)}},n.destructors=new WeakMap,n},t.DestructionError=y,t.Eventful=class{constructor(){w.set(this,new Map),v.set(this,[])}hook(t){return m(this,v,"f").includes(t)||m(this,v,"f").push(t),()=>{m(this,v,"f").splice(m(this,v,"f").indexOf(t),1)}}on(t,e){if("object"==typeof t)for(const e of Object.keys(t))this.on(e,t[e]);else if(void 0!==e){let n=m(this,w,"f").get(t);n||(n=[],m(this,w,"f").set(t,n)),n.push(e)}return()=>this.off(t,e)}off(t,e){if("object"==typeof t)for(const e of Object.keys(t))this.off(e,t[e]);else if(null!=e){const n=m(this,w,"f").get(t);n&&m(this,w,"f").set(t,n.filter(t=>t!==e))}else m(this,w,"f").delete(t)}emit(t,...e){const n=m(this,w,"f").get(t);if(n)for(const t of n)t.apply(this,e);for(const n of m(this,v,"f"))n.call(this,t,...e)}},t.Indexable=S,t.Reactive=gt,t.ReactiveBase=yt,t.ReactiveError=U,t.ReflectGet=o,t.ReflectSet=s,t.addBatchCleanup=ot,t.allocated=b,t.allocatedValues=d,t.atomic=it,t.cache=Xt,t.cached=Qt,t.callOnGC=function(t){let e=!1;const n=()=>{e||(e=!0,t())};return h.register(n,t,t),n},t.cleanedBy=Nt,t.computed=zt,t.debounce=function(t){return f({method(e,n){let r=null;return function(...n){r&&clearTimeout(r),r=setTimeout(()=>{e.apply(this,n),r=null},t)}}})},t.decorator=f,t.deprecated=Yt,t.describe=function(t){return(...e)=>n=>class extends n{constructor(...n){super(...n);for(const n of e)Object.defineProperty(this,n,{...Object.getOwnPropertyDescriptor(this,n),...t})}}},t.destructor=p,t.effect=St,t.getAt=j,t.getState=Z,t.immutables=Et,t.invalidateComputed=function(t,e=!0){Rt?Rt.push(t):e&&V.warn("Using `invalidateComputed` outside of a computed property")},t.isCached=function(t,e){return!!Object.getOwnPropertyDescriptor(t,e)},t.isConstructor=n,t.isNonReactive=xt,t.isObject=c,t.isOwnAccessor=i,t.isReactive=function(t){return M.has(t)},t.legacyDecorator=l,t.mixin=E,t.modernDecorator=u,t.profileInfo=I,t.reactive=mt,t.reactiveOptions=V,t.renamed=r,t.setAt=O,t.throttle=function(t){return f({method(e,n){let r=0,o=null;return function(...n){const s=Date.now();if(s-r>=t)return o&&(clearTimeout(o),o=null),r=s,e.apply(this,n);if(!o){const i=t-(s-r),c=[...n];o=setTimeout(()=>{r=Date.now(),e.apply(this,c),o=null},i)}}}})},t.trackEffect=function(e){if(!t.activeEffect)throw new Error("Not in an effect");H.has(t.activeEffect)?H.get(t.activeEffect).add(e):H.set(t.activeEffect,new Set([e]))},t.unreactive=Ct,t.untracked=vt,t.unwrap=wt,t.watch=function(e,n,r={}){return"function"==typeof e?function(e,n,{immediate:r=!1,deep:o=!1}={}){const s=t.activeEffect;let i,c=At;const a=St(G(function(t){const a=e(t);c!==a&&ct(s,G(()=>{c===At?r&&n(a):n(a,c),c=a,o&&(i&&i(),i=Pt(a,G(t=>n(t,t),n)))},n))},e));return()=>{a(),i&&i()}}(e,n,r):"object"==typeof e?function(e,n,{immediate:r=!1,deep:o=!1}={}){const s=t.activeEffect;return o?Pt(e,n,{immediate:r}):St(G(function(){tt(e),r&&ct(s,()=>n(e)),r=!0},n))}(e,n,r):(()=>{throw new Error("watch: value must be a function or an object")})()},t.zip=function(...t){if(!t.length)return[];const e=Math.min(...t.map(t=>t.length)),n=[];for(let r=0;r<e;r++){const e=t.map(t=>t[r]);n.push(e)}return n}});
2
2
  //# sourceMappingURL=mutts.umd.js.map