mutts 1.0.0 → 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 (85) 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-BXsign4Z.js → decorator-D4DU97Zg.js} +70 -4
  7. package/dist/chunks/decorator-D4DU97Zg.js.map +1 -0
  8. package/dist/chunks/{decorator-CPbZNnsX.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 +58 -1
  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 +18 -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 +258 -20
  47. package/dist/reactive.esm.js +4 -1454
  48. package/dist/reactive.esm.js.map +1 -1
  49. package/dist/reactive.js +29 -1466
  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 +7931 -458
  58. package/package.json +1 -2
  59. package/dist/chunks/decorator-BXsign4Z.js.map +0 -1
  60. package/dist/chunks/decorator-CPbZNnsX.esm.js.map +0 -1
  61. package/src/decorator.test.ts +0 -495
  62. package/src/decorator.ts +0 -205
  63. package/src/destroyable.test.ts +0 -155
  64. package/src/destroyable.ts +0 -158
  65. package/src/eventful.test.ts +0 -380
  66. package/src/eventful.ts +0 -69
  67. package/src/index.ts +0 -7
  68. package/src/indexable.test.ts +0 -388
  69. package/src/indexable.ts +0 -124
  70. package/src/promiseChain.test.ts +0 -201
  71. package/src/promiseChain.ts +0 -99
  72. package/src/reactive/array.test.ts +0 -923
  73. package/src/reactive/array.ts +0 -352
  74. package/src/reactive/core.test.ts +0 -1663
  75. package/src/reactive/core.ts +0 -866
  76. package/src/reactive/index.ts +0 -28
  77. package/src/reactive/interface.test.ts +0 -1477
  78. package/src/reactive/interface.ts +0 -231
  79. package/src/reactive/map.test.ts +0 -866
  80. package/src/reactive/map.ts +0 -162
  81. package/src/reactive/set.test.ts +0 -289
  82. package/src/reactive/set.ts +0 -142
  83. package/src/std-decorators.test.ts +0 -679
  84. package/src/std-decorators.ts +0 -182
  85. package/src/utils.ts +0 -52
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()),h=Symbol("destructor"),l=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[l][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;function*D(t){let e=t.next();for(;!e.done;)yield at(e.value),e=t.next()}function*W(t){let e=t.next();for(;!e.done;){const[n,r]=e.value;yield[at(n),at(r)],e=t.next()}}const P=new WeakMap,R={objectToProxy:S,proxyToObject:j,effectToReactiveObjects:v,watchers:P,objectParents:x,objectsWithDeepWatchers:O,deepWatchers:E,effectToDeepWatchedObjects:k,nonReactiveObjects:M},T=Symbol("native-reactive"),z=Symbol("non-reactive"),A=Symbol("unreactive-properties"),N=Symbol("prototype-forwarding"),C=Symbol("all-props"),I=Symbol("root-function");function $(t,e){return Object.defineProperty(t,I,{value:L(e),writable:!1})}function L(t){return t?.[I]||t}class F extends Error{constructor(t){super(t),this.name="ReactiveError"}}const B={enter:t=>{},leave:t=>{},chain:(t,e)=>{},maxEffectChain:100,maxDeepWatchDepth:100,instanceMembers:!0,warn:(...t)=>{}};function K(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))Y(t)}}function U(t,e,n){G(t,e,[n])}function G(t,e,n){!function(t,e){t=ht(t);const n={},r=q(t);r&&Object.assign(r,{evolution:e,next:n});V.set(t,n)}(t=ht(t),e);const r=P.get(t);r&&(n?K(r,[C],n):K(r,r.keys())),O.has(t)&&rt(t)}const V=new WeakMap;function q(t){t=ht(t);let e=V.get(t);return e||(e={},V.set(t,e)),e}function H(t,e=C){if(t=ht(t),J&&("symbol"!=typeof e||e===C)){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(J);let o=v.get(J);o||(o=new Set,v.set(J,o)),o.add(t)}}let J,Q,X;function Y(t){const e=L(t);if(B?.chain(L(t),L(J)),X)X.set(e,t);else{const n=[];X=new Map([[e,t]]);try{for(;X.size;){if(n.length>B.maxEffectChain)throw new F("[reactive] Max effect chain reached");const[t,e]=X.entries().next().value;n.push(t),e(),X.delete(t)}}finally{X=void 0}}}function Z(t,e,n){if(L(t)===L(J))return e();const r=J,o=Q;J=t,n||(Q=t);try{return e()}finally{J=r,Q=o}}function _(t,e,n){let r=x.get(t);r||(r=new Set,x.set(t,r)),r.add({parent:e,prop:n})}function tt(t,e,n){const r=x.get(t);r&&(r.delete({parent:e,prop:n}),0===r.size&&x.delete(t))}function et(t){return O.has(t)||nt(t)}function nt(t){const e=x.get(t);if(!e)return!1;for(const{parent:t}of e){if(O.has(t))return!0;if(nt(t))return!0}return!1}function rt(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)Y(t);rt(t)}}const ot={[Symbol.toStringTag]:"MutTs Reactive",get(t,e,n){if(e===z)return!1;if(t[A]?.has(e)||"symbol"==typeof e)return Reflect.get(t,e,n);const r=!(e in t);(!B.instanceMembers||Object.hasOwn(n,e)||r)&&H(t,e);const o=Reflect.get(t,e,n);if("object"==typeof o&&null!==o){const n=at(o);return et(t)&&_(n,t,e),n}return o},set(t,e,n,r){if(t[A]?.has(e))return Reflect.set(t,e,n,r);const o=N in t&&t[N]instanceof Array&&(!Number.isNaN(Number(e))||"length"===e),s=ht(n);if(o)return t[e]=s,!0;const i=t[e],c=e in t;return function(t,e,n,r){O.has(t)&&("object"==typeof n&&null!==n&&tt(n,t,e),"object"==typeof r&&null!==r)&&_(at(r),t,e)}(t,e,i,s),i!==s&&(Reflect.set(t,e,s,r),U(t,{type:c?"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&&tt(n,t,e),delete t[e],U(t,{type:"del",prop:e},e),O.has(t)&&rt(t),!0},getPrototypeOf:t=>N in t?t[N]:Object.getPrototypeOf(t),setPrototypeOf:(t,e)=>!(N in t)&&(Object.setPrototypeOf(t,e),!0),ownKeys:t=>(H(t,C),Reflect.ownKeys(t))},st=new WeakSet;class it{constructor(){return st.has(new.target)?at(this):this}}function ct(t){if(!t||"object"!=typeof t)return t;const e=t;if(j.has(e)||yt(e))return e;if(S.has(e))return S.get(e);const n=!(T in e)||e instanceof e[T]?e:new e[T](e);n!==e&&j.set(n,e);const r=new Proxy(n,ot);return S.set(e,r),j.set(r,e),r}const at=c({class(t){if(t.prototype instanceof it)return st.add(t),t;class e extends t{constructor(...n){return super(...n),new.target===e||st.has(new.target)||B.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.`),at(this)}}return Object.defineProperty(e,"name",{value:`Reactive<${t.name}>`}),e},get:t=>ct(t),default:ct});function ht(t){return j.get(t)??t}function lt(t){Z(void 0,t,!0)}const ut=new WeakMap,ft=new FinalizationRegistry(t=>t());function dt(t,...e){let n=null;const r=$(t=>Z(s,t),t);let o=!1;function s(){n?.(),B.enter(t);const i=Z(o?void 0:s,()=>t(r,...e));B.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)}}}if($(s,t),X){const e=X;try{X=new Map([[t,s]]),s(),X.delete(t);for(const[t,n]of X)e.set(t,n)}finally{X=e}}else Y(s);const i=()=>{if(o)return;o=!0,n?.();const t=ut.get(s);if(t){for(const e of t)e();ut.delete(s)}ft.unregister(i)};if(!Q){const t=()=>i();return ft.register(t,i,t),t}let c=ut.get(Q);c||(c=new Set,ut.set(Q,c));const a=Q,h=()=>{c.delete(h),0===c.size&&ut.delete(a),i()};return c.add(h),h}const pt=new Set;function yt(t){return null===t||"object"!=typeof t||(!!M.has(t)||(!!t[z]||!!Array.from(pt).some(e=>e(t))))}function gt(...t){for(const e of t)e&&(e.prototype[z]=!0);return t[0]}function bt(t,e){t.prototype[T]=e,gt(e)}function mt(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=$(()=>e(t),e);return dt(()=>{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>B.maxDeepWatchDepth||yt(e))){s.add(e),O.add(e),o.add(e);for(const r in ht(e))if(Object.hasOwn(e,r)){const o=e[r];t("object"==typeof o&&null!==o?at(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?at(r):r,n+1)}}else if(e instanceof Set)for(const r of e){t("object"==typeof r&&null!==r?at(r):r,n+1)}else if(e instanceof Map)for(const[r,o]of e){t("object"==typeof o&&null!==o?at(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 wt;gt(Date,RegExp,Error,Promise,Function),"undefined"!=typeof window&&function(...t){for(const e of t){try{Object.defineProperty(e,z,{value:!0,writable:!1,enumerable:!1,configurable:!1})}catch{}z in e||M.add(e)}t[0]}(window,document),"undefined"!=typeof Element&&gt(Element,Node);const vt=new WeakMap;function St(t){const e=L(t);let n=[];return H(vt,e),vt.has(e)||Z(void 0,()=>{const r=dt($(o=>{const s=wt;if(vt.has(e)){for(const t of n)t();n=[],vt.delete(e),U(vt,{type:"set",prop:e},e),r()}else try{wt=n,vt.set(e,t(o))}finally{wt=s}},t))}),vt.get(e)}const jt=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)}`)),St(n.get(this))}},default:t=>St(t)}),xt=Symbol("unset-yet");function Ot(t){if(yt(t=ht(t)))return t;try{Object.defineProperty(t,z,{value:!0,writable:!1,enumerable:!1,configurable:!0})}catch{}z in t||M.add(t);for(const e in t)Ot(t[e]);return t}const Et=c({class(t){gt(t)},default:function(t,...e){return"object"==typeof t?Ot(t):n=>{n.prototype[A]=new Set(n.prototype[A]||[]),n.prototype[A].add(t);for(const t of e)n.prototype[A].add(t);return n}}});Object.assign(R,{computedCache:vt});const kt=Symbol("native"),Mt=Array.isArray;Array.isArray=t=>Mt(t)||t instanceof Array&&kt in t;class Dt{}function*Wt(t,{length:e=!0}={}){yield t,e&&(yield"length")}function*Pt(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 Rt extends(w(Dt,{get(t){return H(this[kt],t),at(this[kt][t])},set(t,e){const n=t>=this[kt].length;this[kt][t]=e,G(this[kt],{type:"bunch",method:"set"},Wt(t,{length:n}))},getLength(){return H(this[kt],"length"),this[kt].length},setLength(t){const e=this[kt].length;try{this[kt].length=t}finally{G(this[kt],{type:"set",prop:"length"},Pt(e,t,{length:!0}))}}})){constructor(t){super(),Object.defineProperties(this,{[kt]:{value:t},[N]:{value:t}})}at(t){const e=t<0?this[kt].length+t:t;if(H(this,e),!(e<0||e>=this[kt].length))return at(this[kt][e])}push(...t){const e=this[kt].length;try{return this[kt].push(...t)}finally{G(this,{type:"bunch",method:"push"},Pt(e,e+t.length-1,{length:!0}))}}pop(){if(0!==this[kt].length)try{return at(this[kt].pop())}finally{G(this,{type:"bunch",method:"pop"},Wt(this[kt].length))}}shift(){if(0!==this[kt].length)try{return at(this[kt].shift())}finally{G(this,{type:"bunch",method:"shift"},Pt(0,this[kt].length+1,{length:!0}))}}unshift(...t){try{return this[kt].unshift(...t)}finally{G(this,{type:"bunch",method:"unshift"},Pt(0,this[kt].length-t.length,{length:!0}))}}splice(t,e,...n){const r=this[kt].length;void 0===e&&(e=r-t);try{return at(void 0===e?this[kt].splice(t):this[kt].splice(t,e,...n))}finally{G(this,{type:"bunch",method:"splice"},e===n.length?Pt(t,t+e):Pt(t,r+Math.max(n.length-e,0),{length:!0}))}}reverse(){try{return this[kt].reverse()}finally{G(this,{type:"bunch",method:"reverse"},Pt(0,this[kt].length-1))}}sort(t){try{return this[kt].sort(t)}finally{G(this,{type:"bunch",method:"sort"},Pt(0,this[kt].length-1))}}fill(t,e,n){try{return void 0===e?this[kt].fill(t):void 0===n?this[kt].fill(t,e):this[kt].fill(t,e,n)}finally{G(this,{type:"bunch",method:"fill"},Pt(0,this[kt].length-1))}}copyWithin(t,e,n){try{return void 0===n?this[kt].copyWithin(t,e):this[kt].copyWithin(t,e,n)}finally{G(this,{type:"bunch",method:"copyWithin"},Pt(0,this[kt].length-1))}}toReversed(){return H(this),at(this[kt].toReversed())}toSorted(t){return H(this),at(this[kt].toSorted(t))}toSpliced(t,e,...n){return H(this),void 0===e?this[kt].toSpliced(t):this[kt].toSpliced(t,e,...n)}with(t,e){return H(this),at(this[kt].with(t,e))}entries(){return H(this),W(this[kt].entries())}keys(){return H(this),this[kt].keys()}values(){return H(this),D(this[kt].values())}[Symbol.iterator](){H(this);const t=this[kt][Symbol.iterator]();return{next(){const e=t.next();return e.done?e:{value:at(e.value),done:!1}}}}indexOf(t,e){return H(this),this[kt].indexOf(t,e)}lastIndexOf(t,e){return H(this),this[kt].lastIndexOf(t,e)}includes(t,e){return H(this),this[kt].includes(t,e)}find(t,e){return H(this),at(this[kt].find(t,e))}findIndex(t,e){return H(this),this[kt].findIndex(t,e)}flat(){return H(this),at(this[kt].flat())}flatMap(t,e){return H(this),at(this[kt].flatMap(t,e))}filter(t,e){return H(this),at(this[kt].filter(t,e))}map(t,e){return H(this),at(this[kt].map(t,e))}reduce(t,e){H(this);const n=void 0===e?this[kt].reduce(t):this[kt].reduce(t,e);return at(n)}reduceRight(t,e){H(this);const n=void 0!==e?this[kt].reduceRight(t,e):this[kt].reduceRight(t);return at(n)}slice(t,e){for(const n of Pt(t||0,e||this[kt].length-1))H(this,n);return void 0===t?this[kt].slice():void 0===e?this[kt].slice(t):this[kt].slice(t,e)}concat(...t){return H(this),at(this[kt].concat(...t))}join(t){return H(this),this[kt].join(t)}forEach(t,e){H(this),this[kt].forEach(t,e)}every(t,e){return H(this),this[kt].every(t,e)}some(t,e){return H(this),this[kt].some(t,e)}}const Tt=Symbol("native");class zt{constructor(t){Object.defineProperties(this,{[Tt]:{value:t},[N]:{value:t},content:{value:Symbol("content")},[Symbol.toStringTag]:{value:"ReactiveMap"}})}get size(){return H(this,"size"),this[Tt].size}clear(){const t=this[Tt].size>0;if(this[Tt].clear(),t){const t={type:"bunch",method:"clear"};U(this,t,"size"),G(this.content,t)}}entries(){return H(this.content),W(this[Tt].entries())}forEach(t,e){H(this.content),this[Tt].forEach(t,e)}keys(){return H(this.content),this[Tt].keys()}values(){return H(this.content),D(this[Tt].values())}[Symbol.iterator](){H(this.content);const t=this[Tt][Symbol.iterator]();return{next(){const e=t.next();return e.done?e:{value:[e.value[0],at(e.value[1])],done:!1}}}}delete(t){const e=this[Tt].has(t),n=this[Tt].delete(t);if(e){const e={type:"del",prop:t};U(this.content,e,t),U(this,e,"size")}return n}get(t){return H(this.content,t),at(this[Tt].get(t))}has(t){return H(this.content,t),this[Tt].has(t)}set(t,e){const n=this[Tt].has(t),r=this[Tt].get(t),o=at(e);if(this[Tt].set(t,o),!n||r!==o){const e={type:n?"set":"add",prop:t};U(this.content,e,t),U(this,e,"size")}return this}}const At=Symbol("native");class Nt{constructor(t){Object.defineProperties(this,{[At]:{value:t},[N]:{value:t},content:{value:Symbol("content")},[Symbol.toStringTag]:{value:"ReactiveSet"}})}get size(){return H(this,"size"),this[At].size}add(t){const e=this[At].has(t),n=at(t);if(this[At].add(n),!e){const t={type:"add",prop:n};U(this.content,t,n),U(this,t,"size")}return this}clear(){const t=this[At].size>0;if(this[At].clear(),t){const t={type:"bunch",method:"clear"};U(this,t,"size"),G(this.content,t)}}delete(t){const e=this[At].has(t),n=this[At].delete(t);if(e){const e={type:"del",prop:t};U(this.content,e,t),U(this,e,"size")}return n}has(t){return H(this.content,t),this[At].has(t)}entries(){return H(this.content),W(this[At].entries())}forEach(t,e){H(this.content),this[At].forEach(t,e)}keys(){return H(this.content),D(this[At].keys())}values(){return H(this.content),D(this[At].values())}[Symbol.iterator](){H(this.content);const t=this[At][Symbol.iterator]();return{next(){const e=t.next();return e.done?e:{value:at(e.value),done:!1}}}}}bt(WeakMap,class{constructor(t){Object.defineProperties(this,{[Tt]:{value:t},[N]:{value:t},content:{value:Symbol("content")},[Symbol.toStringTag]:{value:"ReactiveWeakMap"}})}delete(t){const e=this[Tt].has(t),n=this[Tt].delete(t);return e&&U(this.content,{type:"del",prop:t},t),n}get(t){return H(this.content,t),at(this[Tt].get(t))}has(t){return H(this.content,t),this[Tt].has(t)}set(t,e){return U(this.content,{type:this[Tt].has(t)?"set":"add",prop:t},t),this[Tt].set(t,e),this}}),bt(Map,zt),bt(WeakSet,class{constructor(t){Object.defineProperties(this,{[At]:{value:t},[N]:{value:t},content:{value:Symbol("content")},[Symbol.toStringTag]:{value:"ReactiveWeakSet"}})}add(t){const e=this[At].has(t);return this[At].add(t),e||U(this.content,{type:"add",prop:t},t),this}delete(t){const e=this[At].has(t),n=this[At].delete(t);return e&&U(this.content,{type:"del",prop:t},t),n}has(t){return H(this.content,t),this[At].has(t)}}),bt(Set,Nt),bt(Array,Rt);const Ct=[],It=c({getter:(t,e)=>function(){const n=Ct.findIndex(t=>t.object===this&&t.prop===e);if(n>-1)throw new Error(`Circular dependency detected: ${Ct.slice(n).map(t=>`${t.object.constructor.name}.${String(t.prop)}`).join(" -> ")} -> again`);Ct.push({object:this,prop:e});try{const n=t.call(this);return $t(this,e,n),n}finally{Ct.pop()}}});function $t(t,e,n){Object.defineProperty(t,e,{value:n})}const Lt=Object.assign(c({method:(t,e)=>function(...n){return Lt.warn(this,e),t.apply(this,n)},getter:(t,e)=>function(){return Lt.warn(this,e),t.call(this)},setter:(t,e)=>function(n){return Lt.warn(this,e),t.call(this,n)},class:t=>class extends t{constructor(...t){super(...t),Lt.warn(this,"constructor")}},default:t=>c({method:(e,n)=>function(...r){return Lt.warn(this,n,t),e.apply(this,r)},getter:(e,n)=>function(){return Lt.warn(this,n,t),e.call(this)},setter:(e,n)=>function(r){return Lt.warn(this,n,t),e.call(this,r)},class:e=>class extends e{constructor(...e){super(...e),Lt.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[l]=r;const o=e?.destructor??this[h];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=it,t.ReactiveError=F,t.allocated=d,t.allocatedValues=l,t.cache=$t,t.cached=It,t.callOnGC=function(t){let e=!1;const n=()=>{e||(e=!0,t())};return a.register(n,t,t),n},t.computed=jt,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=Lt,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=h,t.effect=dt,t.getAt=b,t.getState=q,t.immutables=pt,t.invalidateComputed=function(t,e=!0){wt?wt.push(t):e&&B.warn("Using `invalidateComputed` outside of a computed property")},t.isCached=function(t,e){return!!Object.getOwnPropertyDescriptor(t,e)},t.isConstructor=n,t.isNonReactive=yt,t.isReactive=function(t){return j.has(t)},t.legacyDecorator=s,t.modernDecorator=i,t.profileInfo=R,t.reactive=at,t.reactiveOptions=B,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=Et,t.untracked=lt,t.unwrap=ht,t.watch=function(t,e,n={}){return"function"==typeof t?function(t,e,{immediate:n=!1,deep:r=!1}={}){let o,s=xt;const i=dt($(i=>{const c=t(i);s!==c&&lt($(()=>{s===xt?n&&e(c):e(c,s),s=c,r&&(o&&o(),o=mt(c,$(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?mt(t,e,{immediate:n}):dt($(()=>{H(t),n&&lt(()=>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