mutts 1.0.5 → 1.0.6

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 (66) hide show
  1. package/README.md +1 -0
  2. package/dist/chunks/{_tslib-Mzh1rNsX.esm.js → _tslib-MCKDzsSq.esm.js} +2 -2
  3. package/dist/chunks/_tslib-MCKDzsSq.esm.js.map +1 -0
  4. package/dist/chunks/decorator-BGILvPtN.esm.js +627 -0
  5. package/dist/chunks/decorator-BGILvPtN.esm.js.map +1 -0
  6. package/dist/chunks/decorator-BQ2eBTCj.js +651 -0
  7. package/dist/chunks/decorator-BQ2eBTCj.js.map +1 -0
  8. package/dist/chunks/{index-Cvxdw6Ax.js → index-CDCOjzTy.js} +396 -500
  9. package/dist/chunks/index-CDCOjzTy.js.map +1 -0
  10. package/dist/chunks/{index-qiWwozOc.esm.js → index-DiP0RXoZ.esm.js} +301 -403
  11. package/dist/chunks/index-DiP0RXoZ.esm.js.map +1 -0
  12. package/dist/decorator.d.ts +3 -3
  13. package/dist/decorator.esm.js +1 -1
  14. package/dist/decorator.js +1 -1
  15. package/dist/destroyable.esm.js +4 -4
  16. package/dist/destroyable.esm.js.map +1 -1
  17. package/dist/destroyable.js +4 -4
  18. package/dist/destroyable.js.map +1 -1
  19. package/dist/devtools/panel.js.map +1 -1
  20. package/dist/eventful.esm.js +1 -1
  21. package/dist/index.esm.js +48 -3
  22. package/dist/index.esm.js.map +1 -1
  23. package/dist/index.js +48 -4
  24. package/dist/index.js.map +1 -1
  25. package/dist/mutts.umd.js +1 -1
  26. package/dist/mutts.umd.js.map +1 -1
  27. package/dist/mutts.umd.min.js +1 -1
  28. package/dist/mutts.umd.min.js.map +1 -1
  29. package/dist/reactive.d.ts +25 -0
  30. package/dist/reactive.esm.js +3 -3
  31. package/dist/reactive.js +4 -4
  32. package/dist/std-decorators.d.ts +1 -1
  33. package/dist/std-decorators.esm.js +10 -10
  34. package/dist/std-decorators.esm.js.map +1 -1
  35. package/dist/std-decorators.js +10 -10
  36. package/dist/std-decorators.js.map +1 -1
  37. package/docs/ai/manual.md +14 -95
  38. package/docs/reactive/advanced.md +6 -107
  39. package/docs/reactive/debugging.md +158 -0
  40. package/docs/reactive.md +6 -5
  41. package/package.json +16 -66
  42. package/src/decorator.ts +11 -9
  43. package/src/destroyable.ts +3 -3
  44. package/src/index.ts +46 -0
  45. package/src/reactive/change.ts +1 -1
  46. package/src/reactive/debug.ts +1 -1
  47. package/src/reactive/deep-touch.ts +1 -1
  48. package/src/reactive/deep-watch.ts +1 -1
  49. package/src/reactive/effect-context.ts +2 -2
  50. package/src/reactive/effects.ts +44 -16
  51. package/src/reactive/index.ts +1 -1
  52. package/src/reactive/interface.ts +9 -8
  53. package/src/reactive/memoize.ts +77 -31
  54. package/src/reactive/proxy.ts +4 -4
  55. package/src/reactive/registry.ts +67 -0
  56. package/src/reactive/tracking.ts +12 -41
  57. package/src/reactive/types.ts +37 -0
  58. package/src/std-decorators.ts +9 -9
  59. package/src/utils.ts +141 -0
  60. package/dist/chunks/_tslib-Mzh1rNsX.esm.js.map +0 -1
  61. package/dist/chunks/decorator-DLvrD0UF.js +0 -265
  62. package/dist/chunks/decorator-DLvrD0UF.js.map +0 -1
  63. package/dist/chunks/decorator-DqiszP7i.esm.js +0 -253
  64. package/dist/chunks/decorator-DqiszP7i.esm.js.map +0 -1
  65. package/dist/chunks/index-Cvxdw6Ax.js.map +0 -1
  66. package/dist/chunks/index-qiWwozOc.esm.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { _ as __classPrivateFieldGet } from './chunks/_tslib-Mzh1rNsX.esm.js';
1
+ import { d as __classPrivateFieldGet } from './chunks/_tslib-MCKDzsSq.esm.js';
2
2
 
3
3
  var _Eventful_events, _Eventful_hooks;
4
4
  /**
package/dist/index.esm.js CHANGED
@@ -1,8 +1,53 @@
1
- export { D as DecoratorError, R as ReflectGet, b as ReflectSet, a as arrayEquals, d as decorator, i as isConstructor, c as isOwnAccessor, l as legacyDecorator, m as modernDecorator, r as renamed, z as zip } from './chunks/decorator-DqiszP7i.esm.js';
1
+ export { D as DecoratorError, R as ReactiveError, a as ReflectGet, b as ReflectSet, c as arrayEquals, d as decorator, e as deepCompare, i as isConstructor, f as isOwnAccessor, l as legacyDecorator, m as modernDecorator, o as reactiveOptions, r as renamed, z as zip } from './chunks/decorator-BGILvPtN.esm.js';
2
2
  export { Destroyable, DestructionError, allocated, allocatedValues, callOnGC, destructor } from './destroyable.esm.js';
3
3
  export { Eventful } from './eventful.esm.js';
4
4
  export { ArrayReadForward, Indexable, forwardArray, getAt, setAt } from './indexable.esm.js';
5
- export { I as IterableWeakMap, a as IterableWeakSet, O as ReactiveBase, X as ReactiveError, R as ReadOnlyError, U as Register, j as addBatchCleanup, k as atomic, l as batch, n as biDi, c as buildReactivityGraph, z as cleanedBy, A as cleanup, h as deepWatch, o as defer, B as derived, q as effect, e as enableDevTools, u as getActivationLog, v as getActiveEffect, L as getActiveProjection, g as getState, H as immutables, i as isDevtoolsEnabled, J as isNonReactive, N as isReactive, Y as isZoneEnabled, E as mapped, G as memoize, m as mixin, S as organize, T as organized, p as profileInfo, M as project, P as reactive, W as reactiveOptions, F as reduced, V as register, r as registerEffectForDebug, K as registerNativeReactivity, d as registerObjectForDebug, w as root, s as setEffectName, f as setObjectName, Z as setZoneEnabled, t as touched, b as touched1, x as trackEffect, C as unreactive, y as untracked, Q as unwrap, D as watch } from './chunks/index-qiWwozOc.esm.js';
5
+ export { I as IterableWeakMap, a as IterableWeakSet, R as ReactiveBase, b as ReadOnlyError, c as Register, d as addBatchCleanup, e as atomic, f as batch, g as biDi, h as buildReactivityGraph, i as cleanedBy, j as cleanup, k as deepWatch, l as defer, m as derived, n as effect, o as enableDevTools, p as getActivationLog, q as getActiveEffect, r as getActiveProjection, s as getState, t as immutables, u as isDevtoolsEnabled, v as isNonReactive, w as isReactive, x as isZoneEnabled, y as mapped, z as memoize, A as mixin, B as organize, C as organized, D as profileInfo, E as project, F as reactive, G as reduced, H as register, J as registerEffectForDebug, K as registerNativeReactivity, L as registerObjectForDebug, M as root, N as setEffectName, O as setObjectName, P as setZoneEnabled, Q as touched, S as touched1, T as trackEffect, U as unreactive, V as untracked, W as unwrap, X as watch } from './chunks/index-DiP0RXoZ.esm.js';
6
6
  export { cache, cached, debounce, deprecated, describe, isCached, throttle } from './std-decorators.esm.js';
7
- import './chunks/_tslib-Mzh1rNsX.esm.js';
7
+ import './chunks/_tslib-MCKDzsSq.esm.js';
8
+
9
+ var version$1 = "1.0.6";
10
+ var pkg = {
11
+ version: version$1};
12
+
13
+ const { version } = pkg;
14
+ // Singleton verification
15
+ const GLOBAL_MUTTS_KEY = '__MUTTS_INSTANCE__';
16
+ const globalScope = (typeof globalThis !== 'undefined' ? globalThis :
17
+ (typeof window !== 'undefined' ? window :
18
+ (typeof global !== 'undefined' ? global : false)));
19
+ if (globalScope) {
20
+ // Detect the source of this instance safely across different environments
21
+ let source = 'mutts/index';
22
+ try {
23
+ // @ts-ignore
24
+ if (typeof __filename !== 'undefined')
25
+ source = __filename;
26
+ // @ts-ignore
27
+ else {
28
+ // Using eval to avoid SyntaxError in CJS environments where import.meta is not allowed
29
+ const meta = eval('import.meta');
30
+ if (meta && meta.url)
31
+ source = meta.url;
32
+ }
33
+ }
34
+ catch (e) {
35
+ // Fallback for environments where neither is available or accessible
36
+ }
37
+ const currentSourceInfo = {
38
+ version,
39
+ source,
40
+ timestamp: Date.now()
41
+ };
42
+ if (globalScope[GLOBAL_MUTTS_KEY]) {
43
+ const existing = globalScope[GLOBAL_MUTTS_KEY];
44
+ throw new Error(`[Mutts] Multiple instances detected!\n` +
45
+ `Existing instance: ${JSON.stringify(existing, null, 2)}\n` +
46
+ `New instance: ${JSON.stringify(currentSourceInfo, null, 2)}\n` +
47
+ `This usually happens when 'mutts' is both installed as a dependency and bundled, ` +
48
+ `or when different versions are loaded. ` +
49
+ `Please check your build configuration (aliases, externals) to ensure a single source of truth.`);
50
+ }
51
+ globalScope[GLOBAL_MUTTS_KEY] = currentSourceInfo;
52
+ }
8
53
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/index.ts"],"sourcesContent":["export * from './decorator'\nexport * from './destroyable'\nexport * from './eventful'\nexport * from './indexable'\nexport * from './iterableWeak'\nexport * from './mixins'\nexport * from './reactive'\nexport * from './std-decorators'\nexport * from './utils'\n\nimport pkg from '../package.json'\nconst { version } = pkg\n\n// Singleton verification\nconst GLOBAL_MUTTS_KEY = '__MUTTS_INSTANCE__'\nconst globalScope = \n\t(typeof globalThis !== 'undefined' ? globalThis : \n\t(typeof window !== 'undefined' ? window : \n\t(typeof global !== 'undefined' ? global : false))) as any\nif(globalScope) {\n\t// Detect the source of this instance safely across different environments\n\tlet source = 'mutts/index'\n\ttry {\n\t\t// @ts-ignore\n\t\tif (typeof __filename !== 'undefined') source = __filename\n\t\t// @ts-ignore\n\t\telse {\n\t\t\t// Using eval to avoid SyntaxError in CJS environments where import.meta is not allowed\n\t\t\tconst meta = eval('import.meta')\n\t\t\tif (meta && meta.url) source = meta.url\n\t\t}\n\t} catch (e) {\n\t\t// Fallback for environments where neither is available or accessible\n\t}\n\n\tconst currentSourceInfo = {\n\t\tversion,\n\t\tsource,\n\t\ttimestamp: Date.now()\n\t}\n\n\tif (globalScope[GLOBAL_MUTTS_KEY]) {\n\t\tconst existing = globalScope[GLOBAL_MUTTS_KEY]\n\t\tthrow new Error(\n\t\t\t`[Mutts] Multiple instances detected!\\n` + \n\t\t\t`Existing instance: ${JSON.stringify(existing, null, 2)}\\n` +\n\t\t\t`New instance: ${JSON.stringify(currentSourceInfo, null, 2)}\\n` +\n\t\t\t`This usually happens when 'mutts' is both installed as a dependency and bundled, ` +\n\t\t\t`or when different versions are loaded. ` +\n\t\t\t`Please check your build configuration (aliases, externals) to ensure a single source of truth.`\n\t\t)\n\t}\n\n\tglobalScope[GLOBAL_MUTTS_KEY] = currentSourceInfo\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAWA,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG;AAEvB;AACA,MAAM,gBAAgB,GAAG,oBAAoB;AAC7C,MAAM,WAAW,IACf,OAAO,UAAU,KAAK,WAAW,GAAG,UAAU;KAC9C,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM;AACvC,SAAC,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC,CAAC,CAAQ;AAC1D,IAAG,WAAW,EAAE;;IAEf,IAAI,MAAM,GAAG,aAAa;AAC1B,IAAA,IAAI;;QAEH,IAAI,OAAO,UAAU,KAAK,WAAW;YAAE,MAAM,GAAG,UAAU;;aAErD;;AAEJ,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC;AAChC,YAAA,IAAI,IAAI,IAAI,IAAI,CAAC,GAAG;AAAE,gBAAA,MAAM,GAAG,IAAI,CAAC,GAAG;QACxC;IACD;IAAE,OAAO,CAAC,EAAE;;IAEZ;AAEA,IAAA,MAAM,iBAAiB,GAAG;QACzB,OAAO;QACP,MAAM;AACN,QAAA,SAAS,EAAE,IAAI,CAAC,GAAG;KACnB;AAED,IAAA,IAAI,WAAW,CAAC,gBAAgB,CAAC,EAAE;AAClC,QAAA,MAAM,QAAQ,GAAG,WAAW,CAAC,gBAAgB,CAAC;QAC9C,MAAM,IAAI,KAAK,CACd,CAAA,sCAAA,CAAwC;YACxC,CAAA,mBAAA,EAAsB,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA,EAAA,CAAI;YAC3D,CAAA,cAAA,EAAiB,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA,EAAA,CAAI;YAC/D,CAAA,iFAAA,CAAmF;YACnF,CAAA,uCAAA,CAAyC;AACzC,YAAA,CAAA,8FAAA,CAAgG,CAChG;IACF;AAEA,IAAA,WAAW,CAAC,gBAAgB,CAAC,GAAG,iBAAiB;AAClD"}
package/dist/index.js CHANGED
@@ -1,24 +1,70 @@
1
1
  'use strict';
2
2
 
3
- var decorator = require('./chunks/decorator-DLvrD0UF.js');
3
+ var decorator = require('./chunks/decorator-BQ2eBTCj.js');
4
4
  var destroyable = require('./destroyable.js');
5
5
  var eventful = require('./eventful.js');
6
6
  var indexable = require('./indexable.js');
7
- var reactive = require('./chunks/index-Cvxdw6Ax.js');
7
+ var reactive = require('./chunks/index-CDCOjzTy.js');
8
8
  var stdDecorators = require('./std-decorators.js');
9
9
  require('./chunks/_tslib-BgjropY9.js');
10
10
 
11
+ var version$1 = "1.0.6";
12
+ var pkg = {
13
+ version: version$1};
11
14
 
15
+ const { version } = pkg;
16
+ // Singleton verification
17
+ const GLOBAL_MUTTS_KEY = '__MUTTS_INSTANCE__';
18
+ const globalScope = (typeof globalThis !== 'undefined' ? globalThis :
19
+ (typeof window !== 'undefined' ? window :
20
+ (typeof global !== 'undefined' ? global : false)));
21
+ if (globalScope) {
22
+ // Detect the source of this instance safely across different environments
23
+ let source = 'mutts/index';
24
+ try {
25
+ // @ts-ignore
26
+ if (typeof __filename !== 'undefined')
27
+ source = __filename;
28
+ // @ts-ignore
29
+ else {
30
+ // Using eval to avoid SyntaxError in CJS environments where import.meta is not allowed
31
+ const meta = eval('import.meta');
32
+ if (meta && meta.url)
33
+ source = meta.url;
34
+ }
35
+ }
36
+ catch (e) {
37
+ // Fallback for environments where neither is available or accessible
38
+ }
39
+ const currentSourceInfo = {
40
+ version,
41
+ source,
42
+ timestamp: Date.now()
43
+ };
44
+ if (globalScope[GLOBAL_MUTTS_KEY]) {
45
+ const existing = globalScope[GLOBAL_MUTTS_KEY];
46
+ throw new Error(`[Mutts] Multiple instances detected!\n` +
47
+ `Existing instance: ${JSON.stringify(existing, null, 2)}\n` +
48
+ `New instance: ${JSON.stringify(currentSourceInfo, null, 2)}\n` +
49
+ `This usually happens when 'mutts' is both installed as a dependency and bundled, ` +
50
+ `or when different versions are loaded. ` +
51
+ `Please check your build configuration (aliases, externals) to ensure a single source of truth.`);
52
+ }
53
+ globalScope[GLOBAL_MUTTS_KEY] = currentSourceInfo;
54
+ }
12
55
 
13
56
  exports.DecoratorError = decorator.DecoratorError;
57
+ exports.ReactiveError = decorator.ReactiveError;
14
58
  exports.ReflectGet = decorator.ReflectGet;
15
59
  exports.ReflectSet = decorator.ReflectSet;
16
60
  exports.arrayEquals = decorator.arrayEquals;
17
61
  exports.decorator = decorator.decorator;
62
+ exports.deepCompare = decorator.deepCompare;
18
63
  exports.isConstructor = decorator.isConstructor;
19
64
  exports.isOwnAccessor = decorator.isOwnAccessor;
20
65
  exports.legacyDecorator = decorator.legacyDecorator;
21
66
  exports.modernDecorator = decorator.modernDecorator;
67
+ exports.reactiveOptions = decorator.options;
22
68
  exports.renamed = decorator.renamed;
23
69
  exports.zip = decorator.zip;
24
70
  exports.Destroyable = destroyable.Destroyable;
@@ -36,7 +82,6 @@ exports.setAt = indexable.setAt;
36
82
  exports.IterableWeakMap = reactive.IterableWeakMap;
37
83
  exports.IterableWeakSet = reactive.IterableWeakSet;
38
84
  exports.ReactiveBase = reactive.ReactiveBase;
39
- exports.ReactiveError = reactive.ReactiveError;
40
85
  exports.ReadOnlyError = reactive.ReadOnlyError;
41
86
  exports.Register = reactive.Register;
42
87
  exports.addBatchCleanup = reactive.addBatchCleanup;
@@ -68,7 +113,6 @@ exports.organized = reactive.organized;
68
113
  exports.profileInfo = reactive.profileInfo;
69
114
  exports.project = reactive.project;
70
115
  exports.reactive = reactive.reactive;
71
- exports.reactiveOptions = reactive.options;
72
116
  exports.reduced = reactive.reduced;
73
117
  exports.register = reactive.register;
74
118
  exports.registerEffectForDebug = reactive.registerEffectForDebug;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["export * from './decorator'\nexport * from './destroyable'\nexport * from './eventful'\nexport * from './indexable'\nexport * from './iterableWeak'\nexport * from './mixins'\nexport * from './reactive'\nexport * from './std-decorators'\nexport * from './utils'\n\nimport pkg from '../package.json'\nconst { version } = pkg\n\n// Singleton verification\nconst GLOBAL_MUTTS_KEY = '__MUTTS_INSTANCE__'\nconst globalScope = \n\t(typeof globalThis !== 'undefined' ? globalThis : \n\t(typeof window !== 'undefined' ? window : \n\t(typeof global !== 'undefined' ? global : false))) as any\nif(globalScope) {\n\t// Detect the source of this instance safely across different environments\n\tlet source = 'mutts/index'\n\ttry {\n\t\t// @ts-ignore\n\t\tif (typeof __filename !== 'undefined') source = __filename\n\t\t// @ts-ignore\n\t\telse {\n\t\t\t// Using eval to avoid SyntaxError in CJS environments where import.meta is not allowed\n\t\t\tconst meta = eval('import.meta')\n\t\t\tif (meta && meta.url) source = meta.url\n\t\t}\n\t} catch (e) {\n\t\t// Fallback for environments where neither is available or accessible\n\t}\n\n\tconst currentSourceInfo = {\n\t\tversion,\n\t\tsource,\n\t\ttimestamp: Date.now()\n\t}\n\n\tif (globalScope[GLOBAL_MUTTS_KEY]) {\n\t\tconst existing = globalScope[GLOBAL_MUTTS_KEY]\n\t\tthrow new Error(\n\t\t\t`[Mutts] Multiple instances detected!\\n` + \n\t\t\t`Existing instance: ${JSON.stringify(existing, null, 2)}\\n` +\n\t\t\t`New instance: ${JSON.stringify(currentSourceInfo, null, 2)}\\n` +\n\t\t\t`This usually happens when 'mutts' is both installed as a dependency and bundled, ` +\n\t\t\t`or when different versions are loaded. ` +\n\t\t\t`Please check your build configuration (aliases, externals) to ensure a single source of truth.`\n\t\t)\n\t}\n\n\tglobalScope[GLOBAL_MUTTS_KEY] = currentSourceInfo\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAWA,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG;AAEvB;AACA,MAAM,gBAAgB,GAAG,oBAAoB;AAC7C,MAAM,WAAW,IACf,OAAO,UAAU,KAAK,WAAW,GAAG,UAAU;KAC9C,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM;AACvC,SAAC,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC,CAAC,CAAQ;AAC1D,IAAG,WAAW,EAAE;;IAEf,IAAI,MAAM,GAAG,aAAa;AAC1B,IAAA,IAAI;;QAEH,IAAI,OAAO,UAAU,KAAK,WAAW;YAAE,MAAM,GAAG,UAAU;;aAErD;;AAEJ,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC;AAChC,YAAA,IAAI,IAAI,IAAI,IAAI,CAAC,GAAG;AAAE,gBAAA,MAAM,GAAG,IAAI,CAAC,GAAG;QACxC;IACD;IAAE,OAAO,CAAC,EAAE;;IAEZ;AAEA,IAAA,MAAM,iBAAiB,GAAG;QACzB,OAAO;QACP,MAAM;AACN,QAAA,SAAS,EAAE,IAAI,CAAC,GAAG;KACnB;AAED,IAAA,IAAI,WAAW,CAAC,gBAAgB,CAAC,EAAE;AAClC,QAAA,MAAM,QAAQ,GAAG,WAAW,CAAC,gBAAgB,CAAC;QAC9C,MAAM,IAAI,KAAK,CACd,CAAA,sCAAA,CAAwC;YACxC,CAAA,mBAAA,EAAsB,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA,EAAA,CAAI;YAC3D,CAAA,cAAA,EAAiB,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA,EAAA,CAAI;YAC/D,CAAA,iFAAA,CAAmF;YACnF,CAAA,uCAAA,CAAyC;AACzC,YAAA,CAAA,8FAAA,CAAgG,CAChG;IACF;AAEA,IAAA,WAAW,CAAC,gBAAgB,CAAC,GAAG,iBAAiB;AAClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
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&&"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,!0):t instanceof Object||Reflect.has(t,e)?Reflect.set(t,e,n,r):(Object.defineProperty(t,e,{value:n,configurable:!0,writable:!0,enumerable:!0}),!0)}function i(t,e){const n=Object.getOwnPropertyDescriptor(t,e);return!(!n?.get&&!n?.set)}class c extends Error{constructor(t){super(t),this.name="DecoratorException"}}function a(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 f(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 l=t=>{const e=f(t),n=a(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)}},u=new FinalizationRegistry(t=>t()),h=Symbol("destructor"),d=Symbol("allocated");class p extends Error{static throw(t){return()=>{throw new p(t)}}constructor(t){super(`Object is destroyed. ${t}`),this.name="DestroyedAccessError"}}const g={[Symbol.toStringTag]:"MutTs Destroyable",get:p.throw("Cannot access destroyed object"),set:p.throw("Cannot access destroyed object")};const y=l({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)}function b(t,e,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(t,n):o?o.value=n:e.set(t,n),n}var w,v;"function"==typeof SuppressedError&&SuppressedError;w=new WeakMap,v=new WeakMap;const S=Symbol("getAt"),j=Symbol("setAt");function k(t,e){t&&"function"!=typeof t&&(e=t,t=void 0),t||(t=class{}),e||(e={get(t){if("function"!=typeof this[S])throw new Error("Indexable class must have an [getAt] method");return this[S](t)},set(t,e){if("function"!=typeof this[j])throw new Error("Indexable class has read-only numeric index access");this[j](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 O=Symbol("forwardArray");class E{get[O](){throw new Error("ArrayReadForward is not implemented")}get length(){return this[O].length}[Symbol.iterator](){return this[O][Symbol.iterator]()}map(t,e){return this[O].map(t,e)}filter(t,e){return this[O].filter(t,e)}reduce(t,e){return void 0!==e?this[O].reduce(t,e):this[O].reduce(t)}reduceRight(t,e){return void 0!==e?this[O].reduceRight(t,e):this[O].reduceRight(t)}forEach(t,e){this[O].forEach(t,e)}find(t,e){return this[O].find(t,e)}findIndex(t,e){return this[O].findIndex(t,e)}findLast(t,e){return this[O].findLast(t,e)}findLastIndex(t,e){return this[O].findLastIndex(t,e)}includes(t,e){return this[O].includes(t,e)}indexOf(t,e){return this[O].indexOf(t,e)}lastIndexOf(t,e){return this[O].lastIndexOf(t,e)}slice(t,e){return this[O].slice(t,e)}concat(...t){return this[O].concat(...t)}every(t,e){return this[O].every(t,e)}some(t,e){return this[O].some(t,e)}join(t){return this[O].join(t)}keys(){return this[O].keys()}values(){return this[O].values()}entries(){return this[O].entries()}toString(){return this[O].toString()}toLocaleString(t,e){return this[O].toLocaleString(t,e)}at(t){return this[O].at(t)}flat(t){return this[O].flat(t)}flatMap(t,e){return this[O].flatMap(t,e)}toReversed(){return this[O].toReversed?.()??[...this[O]].reverse()}toSorted(t){return this[O].toSorted?.(t)??[...this[O]].sort(t)}toSpliced(t,e,...n){return void 0===e?this[O].toSpliced(t):this[O].toSpliced(t,e,...n)}with(t,e){return this[O].with(t,e)}get[Symbol.unscopables](){return this[O][Symbol.unscopables]}}var x,M;class P{constructor(t){if(this.uuids=new WeakMap,this.refs={},this[x]="IterableWeakMap",this.registry=new FinalizationRegistry(t=>{delete this.refs[t]}),t)for(const[e,n]of t)this.set(e,n)}createIterator(t){const{refs:e}=this;return function*(){for(const n of Object.keys(e)){const[r,o]=e[n],s=r.deref();s?yield t(s,o):delete e[n]}}()}clear(){for(const t of Object.keys(this.refs)){const e=this.refs[t][0].deref();e&&this.registry.unregister(e)}this.uuids=new WeakMap,this.refs={}}delete(t){const e=this.uuids.get(t);return!!e&&(delete this.refs[e],this.uuids.delete(t),this.registry.unregister(t),!0)}forEach(t,e){for(const[n,r]of this)t.call(e??this,r,n,e??this)}get(t){const e=this.uuids.get(t);if(e)return this.refs[e][1]}has(t){return this.uuids.has(t)}set(t,e){let n=this.uuids.get(t);return n?this.refs[n][1]=e:(n=crypto.randomUUID(),this.uuids.set(t,n),this.refs[n]=[new WeakRef(t),e],this.registry.register(t,n,t)),this}get size(){return[...this].length}entries(){return this.createIterator((t,e)=>[t,e])}keys(){return this.createIterator((t,e)=>t)}values(){return this.createIterator((t,e)=>e)}[Symbol.iterator](){return this.entries()}}x=Symbol.toStringTag;class A{constructor(t){if(this.uuids=new WeakMap,this.refs={},this[M]="IterableWeakSet",this.registry=new FinalizationRegistry(t=>{delete this.refs[t]}),t)for(const e of t)this.add(e)}createIterator(t){const{refs:e}=this;return function*(){for(const n of Object.keys(e)){const r=e[n].deref();r?yield t(r):delete e[n]}}()}clear(){for(const t of Object.keys(this.refs)){const e=this.refs[t].deref();e&&this.registry.unregister(e)}this.uuids=new WeakMap,this.refs={}}add(t){let e=this.uuids.get(t);return e||(e=crypto.randomUUID(),this.uuids.set(t,e),this.refs[e]=new WeakRef(t),this.registry.register(t,e,t)),this}delete(t){const e=this.uuids.get(t);return!!e&&(delete this.refs[e],this.uuids.delete(t),this.registry.unregister(t),!0)}forEach(t,e){for(const n of this)t.call(e??this,n,n,e??this)}has(t){return this.uuids.has(t)}get size(){return[...this].length}entries(){return this.createIterator(t=>[t,t])}keys(){return this.createIterator(t=>t)}values(){return this.createIterator(t=>t)}[Symbol.iterator](){return this.keys()}union(t){const e={[Symbol.iterator]:()=>t.keys()},n=this;return new Set(function*(){yield*n;for(const t of e)n.has(t)||(yield t)}())}intersection(t){const e=this;return new Set(function*(){for(const n of e)t.has(n)&&(yield n)}())}difference(t){const e=this;return new Set(function*(){for(const n of e)t.has(n)||(yield n)}())}symmetricDifference(t){const e={[Symbol.iterator]:()=>t.keys()},n=this;return new Set(function*(){for(const e of n)t.has(e)||(yield e);for(const t of e)n.has(t)||(yield t)}())}isSubsetOf(t){for(const e of this)if(!t.has(e))return!1;return!0}isSupersetOf(t){const e={[Symbol.iterator]:()=>t.keys()};for(const t of e)if(!this.has(t))return!1;return!0}isDisjointFrom(t){for(const e of this)if(t.has(e))return!1;return!0}}function R(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 f=r.get(a);if(f)return f;let l=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),l=t}const u=t(l);return r.set(a,u),u}})}M=Symbol.toStringTag;const D=Symbol("native-reactive"),W=Symbol("non-reactive"),T=Symbol("unreactive-properties"),$=Symbol("prototype-forwarding"),C=Symbol("all-props"),z=Symbol("projection-info"),I=Symbol("root-function");var K;!function(t){t.CycleDetected="CYCLE_DETECTED",t.MaxDepthExceeded="MAX_DEPTH_EXCEEDED",t.MaxReactionExceeded="MAX_REACTION_EXCEEDED",t.WriteInComputed="WRITE_IN_COMPUTED",t.TrackingError="TRACKING_ERROR"}(K||(K={}));class N extends Error{constructor(t,e){super(t),this.debugInfo=e,this.name="ReactiveError"}}const q={enter:t=>{},leave:t=>{},chain:(t,e)=>{},beginChain:t=>{},endChain:()=>{},garbageCollected:t=>{},touched:(t,e,n,r)=>{},skipRunningEffect:(t,e)=>{},maxEffectChain:100,maxTriggerPerBatch:10,maxEffectReaction:"throw",cycleHandling:"throw",maxDeepWatchDepth:100,instanceMembers:!0,ignoreAccessors:!0,recursiveTouching:!0,asyncMode:"cancel",warn:(...t)=>{},introspection:{enableHistory:!1,historySize:50},zones:{setTimeout:!0,setInterval:!0,requestAnimationFrame:!0,queueMicrotask:!0}},F=[];function L(){return F.slice()}function V(t){const e=nt(t),n=F.indexOf(e);if(-1!==n)return F.slice(0,n+1).reverse();for(let t=0;t<F.length;t++){let n=F[t];const r=new WeakSet,o=[];for(;n&&!r.has(n);){r.add(n);const s=nt(n);if(o.push(s),s===e){const n=o.reverse();n[0]!==e&&n.unshift(e);const r=F.slice(0,t+1).reverse();return n.length>0&&r.length>0&&r.shift(),[...n,...r]}n=tt.get(n)}}return!1}function U(t,e){const n=F.slice();H(t);try{return e()}finally{H(n)}}function _(){return F[0]}function B(t,e){if(nt(t)===nt(_()))return e();F.unshift(t);try{return e()}finally{if(F.shift()!==t)throw new N("[reactive] Effect stack mismatch")}}function H(t){F.length=0,F.push(...t)}const G=new WeakMap,X=new WeakMap;function Z(t){let e=t;for(;e&&"object"==typeof e&&null!==e&&X.has(e);)e=X.get(e);return e}const Y=new WeakMap,J=new WeakMap,Q=new WeakMap,tt=new WeakMap;function et(t,e){return Object.defineProperty(t,I,{value:nt(e),writable:!1})}function nt(t){return t?.[I]||t}const rt=new WeakSet;let ot=!1;function st(){const t=_();return t?rt.has(nt(t)):ot}function it(t){const e=_();if(!e)return void(ot=t);const n=nt(e);t?rt.add(n):rt.delete(n)}function ct(t,e=C){t=Z(t);const n=_();!n||st()||"symbol"==typeof e&&e!==C||function(t,e,n){let r=J.get(t);r||(r=new Map,J.set(t,r));let o=r.get(e);o||(o=new Set,r.set(e,o));o.add(n);const s=Y.get(n);s?s.add(t):Y.set(n,new Set([t]))}(t,e,n)}const at=Symbol("external-source");let ft=!1;const lt=new Set,ut=new Set,ht=new WeakMap,dt=new WeakMap;let pt=0,gt=0;const yt=new Map;function mt(t){let e=ht.get(t);if(!e){const n=nt(t);e=n?.name?.trim()||"effect_"+ ++pt,ht.set(t,e)}return e}function bt(t){let e=dt.get(t);if(!e){const n=t?.constructor?.name;e=`${n&&"Object"!==n?n:"object"}_${++gt}`,dt.set(t,e)}return e}function wt(t){if(!t||lt.has(t))return;lt.add(t);const e=Y.get(t);if(e)for(const t of e)vt(t)}function vt(t){ut.has(t)||function(t){ut.add(t),bt(t)}(t)}function St(t,e,n,r,o,s){const i=function(t){let e=yt.get(t);return e||(e=new Map,yt.set(t,e)),e}(t);let c=i.get(e);c||(c=new Map,i.set(e,c));let a=c.get(n);return a||(a={label:n,object:r,prop:o,evolution:s,count:0,lastTriggered:Date.now()},c.set(n,a)),a}function jt(t,e){ht.set(t,e)}function kt(t,e){dt.set(t,e),ut.add(t)}function Ot(t){t&&ft&&wt(t)}function Et(t){ft&&vt(t)}function xt(t,e,n,r,o){if(q.introspection.enableHistory&&function(t,e,n,r,o){const s={id:++Dt,timestamp:Date.now(),source:t?mt(t):"External",target:mt(e),objectName:bt(n),prop:String(r),type:o.type};Rt.push(s),Rt.length>q.introspection.historySize&&Rt.shift()}(t,e,n,r,o),!ft)return;wt(e),t&&wt(t);const s=function(t,e){const n=bt(t);return e===C?`${n}.*`:"symbol"==typeof e?`${n}.${e.description??e.toString()}`:`${n}.${String(e)}`}(n,r),i=St(t??at,e,s,n,r,o);i.count+=1,i.lastTriggered=Date.now(),vt(n)}function Mt(t,e=5){const n=[];let r=t;for(let t=0;t<e;t++){let t,e="";t:for(const[n,o]of yt)for(const[s,i]of o)if(s===r){let r=0;for(const o of i.values())o.lastTriggered>r&&(r=o.lastTriggered,e=o.label,t=n===at?void 0:n);if(t||e)break t}if(!t){if(e){n.push(`External -> (${e}) -> ${mt(r)}`);break}break}n.push(`${mt(t)} -> (${e}) -> ${mt(r)}`),r=t}return n.reverse()}function Pt(){const t=[],e=[],n=new Map,r=new Set(lt);!function(t){const e=Array.from(t);for(let n=0;n<e.length;n++){const r=e[n],o=tt.get(r);o&&!t.has(o)&&(t.add(o),e.push(o))}}(r);const{nodes:o,nodeByEffect:s}=function(t){const e=[],n=new Map,r=Array.from(t);for(const t of r){const r=mt(t),o={id:`effect_${e.length}`,label:r,type:"effect",depth:0,debugName:r};e.push(o),n.set(t,o)}const o=new Map,s=t=>{if(!t)return 0;const e=o.get(t);if(void 0!==e)return e;const n=tt.get(t),r=s(n)+(n?1:0);return o.set(t,r),r};for(const[t,e]of n){e.depth=s(t);const r=tt.get(t);if(r){const t=n.get(r);t&&(e.parentId=t.id)}}return{nodes:e,nodeByEffect:n}}(r);for(const e of o)t.push(e);for(const[t,e]of s)n.set(t,e.id);for(const e of ut){const r=`object_${t.length}`;t.push({id:r,label:bt(e),type:"state",debugName:dt.get(e)}),n.set(e,r)}if(yt.has(at)){const e="effect_external";t.push({id:e,label:"External",type:"external",depth:0}),n.set(at,e)}for(const t of r){const r=n.get(t);if(!r)continue;const o=Y.get(t);if(o)for(const t of o){const o=n.get(t);o&&e.push({id:`${r}->${o}`,source:r,target:o,type:"dependency",label:"depends"})}}for(const[t,r]of yt)for(const[o,s]of r){const r=n.get(o);if(!r)continue;const i=n.get(t);if(i)for(const t of s.values())e.push({id:`${i}->${r}:${t.label}`,source:i,target:r,type:"cause",label:t.count>1?`${t.label} (${t.count})`:t.label,count:t.count})}return{nodes:t,edges:e,meta:{generatedAt:Date.now(),devtoolsEnabled:ft}}}function At(){return ft}const Rt=[];let Dt=0;let Wt=!1;const Tt=Object.getOwnPropertyDescriptor(Promise.prototype,"then")?.value||Promise.prototype.then,$t=Object.getOwnPropertyDescriptor(Promise.prototype,"catch")?.value||Promise.prototype.catch,Ct=Object.getOwnPropertyDescriptor(Promise.prototype,"finally")?.value||Promise.prototype.finally,zt=globalThis.setTimeout,It=globalThis.setInterval,Kt=void 0!==globalThis.requestAnimationFrame?globalThis.requestAnimationFrame:void 0,Nt=void 0!==globalThis.queueMicrotask?globalThis.queueMicrotask:void 0;let qt,Ft;function Lt(){Promise.prototype.then=function(t,e){const n=L();return Tt.call(this,Vt(t,n),Vt(e,n))},Promise.prototype.catch=function(t){const e=L();return $t.call(this,Vt(t,e))},Promise.prototype.finally=function(t){const e=L();return Ct.call(this,Vt(t,e))};const t=(t,e,...n)=>{const r=q.zones.setTimeout?L():void 0;return zt.apply(globalThis,[Vt(t,r),e,...n])};Object.assign(t,zt),globalThis.setTimeout=t;const e=(t,e,...n)=>{const r=q.zones.setInterval?L():void 0;return It.apply(globalThis,[Vt(t,r),e,...n])};Object.assign(e,It),globalThis.setInterval=e,Kt&&(globalThis.requestAnimationFrame=t=>{const e=q.zones.requestAnimationFrame?L():void 0;return Kt.call(globalThis,Vt(t,e))}),Nt&&(globalThis.queueMicrotask=t=>{const e=q.zones.queueMicrotask?L():void 0;Nt.call(globalThis,Vt(t,e))})}function Vt(t,e){if(t)return e&&e.length||qt?(...n)=>{const r=()=>e?.length?U(e,()=>t(...n)):t(...n);return qt?qt(r,"immediate"):r()}:t}function Ut(t){const e=new Map;for(let n=0;n<t.length;n++){const r=t[n];if(e.has(r))return t.slice(e.get(r));e.set(r,n)}return null}function _t(t,e=20){const n=t.map(t=>t.name||"<anonymous>");if(n.length<=e)return n.join(" → ");const r=n.slice(0,5),o=n.slice(-10);return`${r.join(" → ")} ... (${n.length-15} more) ... ${o.join(" → ")}`}const Bt=new Array(100);function Ht(t,e,n,r){const o=nt(t);if(!Ft)return;let s=Ft.get(o);s||(s=new Map,Ft.set(o,s));let i=s.get(e);i||(i=new Map,s.set(e,i));const c=(i.get(r)??0)+1;if(i.set(r,c),Bt.unshift({effect:t,obj:e,evolution:n,prop:r}),Bt.pop(),c>=q.maxTriggerPerBatch){const t=o?.name||"anonymous",e=`Aggressive trigger detected: effect "${t}" triggered ${c} times in the batch by the same cause.`;if("throw"===q.maxEffectReaction)throw new N(e,{code:K.MaxReactionExceeded,count:c,effect:t});q.warn(`[reactive] ${e}`)}}const Gt=new WeakMap,Xt=new WeakSet,Zt=new WeakMap,Yt=new WeakMap,Jt=new WeakMap,Qt=new WeakMap,te=new WeakMap;function ee(t,e){let n=t.get(e);return n||(n=new A,t.set(e,n)),n}function ne(t,e,n){if(t===e)return!0;if(t===n)return!1;const r=new Set,o=[t];for(r.add(t),r.add(n);o.length>0;){const t=o.shift(),n=Zt.get(t);if(n)for(const t of n){if(t===e)return!0;r.has(t)||(r.add(t),o.push(t))}}return!1}let re;function oe(t){return re?.all.has(nt(t))}const se=new Set;function ie(t,e,n=new Set,r=[]){if(t===e)return[...r,e];if(n.has(t))return[];n.add(t);const o=[...r,t],s=Zt.get(t);if(s)for(const t of s){const r=ie(t,e,n,o);if(r.length>0)return r}return[]}function ce(t,e){const n=ie(e,t);return n.length>0?[t,...n]:[]}function ae(t,e,n){if(!re)return;const r=nt(t);if(re.all.set(r,t),e&&!n){const n=nt(e);if(function(t,e){if(t===e)return!1;const n=Qt.get(e);return!!n?.has(t)}(n,r)){const e=ce(n,r),o=e.length>0?`Cycle detected: ${e.map(t=>t.name||t.toString()).join(" → ")}`:`Cycle detected: ${n.name||n.toString()} → ${r.name||r.toString()} (and back)`,s=q.cycleHandling;if("strict"===s){re.all.delete(r);const n=Mt(t),s=te.get(r);throw new N(`[reactive] Strict Cycle Prevention: ${o}`,{code:K.CycleDetected,cycle:e.map(t=>t.name||t.toString()),details:o,causalChain:n,creationStack:s})}switch(s){case"throw":{re.all.delete(r);const n=Mt(t),s=te.get(r);throw new N(`[reactive] ${o}`,{code:K.CycleDetected,cycle:e.map(t=>t.name||t.toString()),details:o,causalChain:n,creationStack:s})}case"warn":return q.warn(`[reactive] ${o}`),void re.all.delete(r);case"break":return void re.all.delete(r)}}!function(t,e){const n=Zt.get(t);if(n?.has(e))return;if(n)n.add(e);else{const n=new A;n.add(e),Zt.set(t,n)}let r=Yt.get(e);if(r||(r=new A,Yt.set(e,r)),r.add(t),t===e)return;const o=ee(Qt,t),s=ee(Jt,e);o.add(e),s.add(t);const i=Jt.get(t);if(i)for(const t of i)t!==e&&(ee(Qt,t).add(e),s.add(t));const c=Qt.get(e);if(c)for(const e of c)e!==t&&(ee(Jt,e).add(t),o.add(e));if(i&&c)for(const t of i){const e=ee(Qt,t);for(const n of c)t!==n&&(e.add(n),ee(Jt,n).add(t))}}(n,r)}}function fe(t){re?se.add(t):t()}const le=fe;function ue(t,e,n,r,o){if(n.has(t)){const e=r.indexOf(t);return r.slice(e).concat([t])}if(e.has(t))return[];e.add(t),n.add(t),r.push(t);const s=Zt.get(t);if(s)for(const t of s)if(o.all.has(t)){const s=ue(t,e,n,r,o);if(s.length>0)return s}return r.pop(),n.delete(t),[]}function he(t){let e=null,n=null;for(const[t,r]of re.all){if(0===(re.inDegrees.get(t)??0)){e=r,n=t;break}}if(!e){if(re.all.size>0){let t=function(t){const e=new Set,n=new Set,r=[];for(const[o]of t.all){if(e.has(o))continue;const s=ue(o,e,n,r,t);if(s.length>0)return s}return[]}(re);if(0===t.length)for(const[e]of re.all){const n=Qt.get(e);if(n){for(const r of n)if(r!==e&&re.all.has(r)){const n=Qt.get(r);if(n?.has(e)){t=[e,r,e];break}}if(t.length>0)break}}const e=t.length>0?`Cycle detected: ${t.map(t=>t.name||"<anonymous>").join(" → ")}`:"Cycle detected in effect batch - all effects have dependencies that prevent execution";switch(q.cycleHandling){case"throw":throw new N(`[reactive] ${e}`);case"warn":{q.warn(`[reactive] ${e}`);const t=re.all.values().next().value;if(t){const e=nt(t);return re.all.delete(e),re.inDegrees.delete(e),t()}break}case"break":{const t=re.all.values().next().value;if(t){const e=nt(t);return re.all.delete(e),re.inDegrees.delete(e),t()}break}}}return null}t.push(nt(e));const r=e();return re.all.delete(n),re.inDegrees.delete(n),function(t,e){const n=Qt.get(e);if(n)for(const e of n)if(t.all.has(e)){const n=t.inDegrees.get(e)??0;n>0&&t.inDegrees.set(e,n-1)}}(re,n),r}function de(t,e){Array.isArray(t)||(t=[t]);const n=t.map(nt);if(re){q?.chain(n,nt(_()));const r=_();for(let n=0;n<t.length;n++)ae(t[n],r,"immediate"===e);if(e){const e={};for(let n=0;n<t.length;n++)try{const r=t[n]();void 0===r||"value"in e||(e.value=r)}finally{const e=nt(t[n]);re.all.delete(e)}return e.value}}else{if(Ft)throw new Error("Batch already in progress");Ft=new Map,q.beginChain(n),re={all:new Map,inDegrees:new Map};const r=_();for(let n=0;n<t.length;n++)ae(t[n],r,"immediate"===e);const o=[];if(function(t){const e=_(),n=e?nt(e):null;t.inDegrees.clear();for(const[e]of t.all){let r=0;const o=Jt.get(e);if(o)for(const s of o)t.all.has(s)&&s!==n&&s!==e&&r++;t.inDegrees.set(e,r)}}(re),e){const e={};try{for(let n=0;n<t.length;n++)try{const r=t[n]();void 0===r||"value"in e||(e.value=r)}finally{const e=nt(t[n]);re.all.delete(e)}for(;re.all.size>0;){if(o.length>q.maxEffectChain){const t=Ut(o),e=_t(o),n=t?`Max effect chain reached (cycle detected: ${_t(t)})`:`Max effect chain reached (trace: ${e})`,r=(re?Array.from(re.all.keys()):[]).map(t=>t.name||"<anonymous>"),s={code:K.MaxDepthExceeded,effectuatedRoots:o,cycle:t,trace:e,maxEffectChain:q.maxEffectChain,queued:r.slice(0,50),queuedCount:r.length,causalChain:o.length>0?Mt(re.all.get(o[o.length-1])):[]};switch(q.maxEffectReaction){case"throw":case"debug":throw new N(`[reactive] ${n}`,s);case"warn":q.warn(`[reactive] ${n} (queued: ${r.slice(0,10).join(", ")}${r.length>10?", …":""})`)}}if(!re||0===re.all.size)break;const t=he(o);void 0===t||"value"in e||(e.value=t)}const n=Array.from(se);se.clear();for(const t of n)t();return e.value}finally{Ft=void 0,re=void 0,q.endChain()}}else{const t={};try{for(;re.all.size>0||se.size>0;){for(;re.all.size>0;){if(o.length>q.maxEffectChain){const t=Ut(o),e=_t(o),n=t?`Max effect chain reached (cycle detected: ${_t(t)})`:`Max effect chain reached (trace: ${e})`,r=(re?Array.from(re.all.keys()):[]).map(t=>t.name||"<anonymous>"),s={code:K.MaxDepthExceeded,effectuatedRoots:o,cycle:t,trace:e,maxEffectChain:q.maxEffectChain,queued:r.slice(0,50),queuedCount:r.length,causalChain:o.length>0?Mt(re.all.get(o[o.length-1])):[]};switch(q.maxEffectReaction){case"throw":case"debug":throw new N(`[reactive] ${n}`,s);case"warn":q.warn(`[reactive] ${n} (queued: ${r.slice(0,10).join(", ")}${r.length>10?", …":""})`)}}const e=he(o);if(0===re.all.size)break;void 0===e||"value"in t||(t.value=e)}if(se.size>0){const t=Array.from(se);se.clear();for(const e of t)e()}}return t.value}finally{Ft=void 0,re=void 0,q.endChain()}}}}const pe=l({method:t=>function(...e){return de(et(()=>t.apply(this,e),t),"immediate")},default:t=>function(...e){return de(et(()=>t.apply(this,e),t),"immediate")}}),ge=new FinalizationRegistry(t=>t());function ye(t,e){!function(t){t&&(qt=t),!Wt&&q.asyncMode&&(Lt(),Wt=!0)}(de);const n=e?.asyncMode??q.asyncMode??"cancel";if(q.introspection.enableHistory){const e=(new Error).stack;if(e){const n=e.split("\n").slice(2).join("\n");te.set(nt(t),n)}}let r=null;const o=L(),s=et(t=>B(u,t),t),i=t=>U(o,t);let c=!1,a=!1,f=null,l=null;function u(){if(r){const t=r;r=null,B(void 0,()=>t())}if(f)if("cancel"===n&&l)l(),l=null,f=null;else if("ignore"===n)return;if(c)return;let e,o;q.enter(nt(t));try{if(o=B(u,()=>t({tracked:s,ascend:i,reaction:a})),o&&"function"!=typeof o&&("object"!=typeof o||!("then"in o)))throw new N(`[reactive] Effect returned a non-function value: ${o}`);if(o&&"object"==typeof o&&"function"==typeof o.then){const t=o;let e=null;const n=new Promise((t,n)=>{e=n}),r=new N("[reactive] Effect canceled due to dependency change");f=Promise.race([t,n]),l=()=>{e&&e(r)}}else e=o}finally{a=!0,q.leave(t)}r=()=>{r=null,e?.();const t=Y.get(u);if(t){for(const e of t){const t=J.get(e);if(t){for(const[e,n]of t.entries())n.delete(u),0===n.size&&t.delete(e);0===t.size&&J.delete(e)}}Y.delete(u)}const n=Q.get(u);if(n){for(const t of n)t();Q.delete(u)}}}et(u,t),e?.opaque&&Xt.add(u),At()&&Ot(u),de(u,"immediate");const h=o[0];tt.set(u,h);const d=()=>{c||(c=!0,l&&(l(),l=null,f=null),r?.(),function(t){const e=nt(t),n=Jt.get(e),r=Qt.get(e),o=Zt.get(e);if(o){for(const t of o){const n=Yt.get(t);n?.delete(e)}Zt.delete(e)}const s=Yt.get(e);if(s){for(const t of s){const n=Zt.get(t);n?.delete(e)}Yt.delete(e)}if(n)for(const t of n){const n=Qt.get(t);if(n&&(n.delete(e),r))for(const o of r)ne(t,o,e)||n.delete(o)}if(r)for(const t of r){const r=Jt.get(t);if(r&&(r.delete(e),n))for(const o of n)ne(o,t,e)||r.delete(o)}if(n&&r)for(const t of n){const n=Qt.get(t);if(n)for(const o of r)if(!ne(t,o,e)){n.delete(o);const e=Jt.get(o);e?.delete(t)}}Jt.delete(e),Qt.delete(e)}(u),ge.unregister(d))};if(!h){const e=()=>d();return ge.register(e,()=>{d(),q.garbageCollected(t)},d),e}let p=Q.get(h);p||(p=new Set,Q.set(h,p));const g=()=>{p.delete(g),0===p.size&&Q.delete(h),d()};return p.add(g),g}function me(t){const e=st();it(!0);try{return t()}finally{it(e)}}function be(t){let e;return B(void 0,()=>{e=t()}),e}const we=new WeakMap,ve=new WeakSet,Se=new WeakMap,je=new WeakMap;function ke(t,e,n){let r=we.get(t);r||(r=new Set,we.set(t,r)),r.add({parent:e,prop:n})}function Oe(t,e,n){const r=we.get(t);if(r){for(const t of r)if(t.parent===e&&t.prop===n){r.delete(t);break}0===r.size&&we.delete(t)}}function Ee(t){return!!ve.has(t)||Me(t)}function xe(t,e){const n=we.get(t);if(n)for(const{parent:t}of n){const e=Se.get(t);if(e)for(const t of e)de(t);xe(t)}}function Me(t){const e=we.get(t);if(!e)return!1;for(const{parent:t}of e){if(ve.has(t))return!0;if(Me(t))return!0}return!1}const Pe=new WeakMap;function Ae(t,e){const n={},r=Re(t=Z(t));r&&Object.assign(r,{evolution:e,next:n}),Pe.set(t,n)}function Re(t){t=Z(t);let e=Pe.get(t);return e||(e={},Pe.set(t,e)),e}function De(t,e,n,r,...o){const s=_();for(const i of o)for(const o of i){const i=r.get(o);if(i)for(const r of i){const i=V(r);if(i){q.skipRunningEffect(r,i);continue}n.has(r)||(n.add(r),oe(r)||Ht(r,t,e,o));const c=Gt.get(r);if(xt(s,r,t,o,e),c){for(const n of c)n(t,e,o);c.delete(r)}}}}function We(t,e,n){Te(t,e,[n])}function Te(t,e,n){Ae(t=Z(t),e);const r=J.get(t);if(r){const o=new Set;n?De(t,e,o,r,[C],n):De(t,e,o,r,r.keys()),q.touched(t,e,n,o),de(Array.from(o))}ve.has(t)&&xe(t)}const $e=new WeakSet,Ce=new Set,ze=Symbol("absent");function Ie(...t){for(const e of t)e&&(e.prototype[W]=!0);return t[0]}function Ke(t){if(null===t||"object"!=typeof t)return!0;if($e.has(t))return!0;if(t[W])return!0;for(const e of Ce)if(e(t))return!0;return!1}function Ne(t,e){t.prototype[D]=e,Ie(e)}function qe(t){return function(t){return"object"==typeof t&&null!==t}(t)}function Fe(t){if(qe(t)){if(Array.isArray(t))return Array.prototype;try{return t.constructor}catch{return}}}function Le(t,e){return t!==e&&(!(!qe(t)||!qe(e))&&(!Ke(t)&&!Ke(e)&&Fe(t)===Fe(e)))}function Ve(t,e,n,r,o){const s={type:o?"set":"add",prop:e};if(q.recursiveTouching&&void 0!==n&&Le(n,r)){const o={obj:Z(t),prop:e};!function(t){if(!t.length)return;const e=new Set,n=t[0]?.origin;let r;if(n){r=new Set;const t=J.get(n.obj);if(t){const e=new Set;De(n.obj,{type:"set",prop:n.prop},e,t,[C],[n.prop]);for(const t of e)r.add(t)}if(0===r.size)return}for(const{target:o,evolution:s,prop:i}of t){if(!qe(o))continue;const t=Z(o);Ae(t,s);const c=J.get(t);let a;const f=[i];if(c){if(a=new Set,De(t,s,a,c,[C],f),n&&r){const t=new Set;for(const e of a)(r.has(e)||Be(e,r))&&t.add(e);a=t}for(const t of a)e.add(t)}q.touched(t,s,f,a),ve.has(t)&&xe(t)}e.size&&de([...e])}(_e(n,r,new WeakMap,[],o)),function(t,e,n){t=Z(t);const r=J.get(t);if(!r)return;const o=r.get(n);if(!o)return;const s=new Set,i=_();for(const r of o){if(!Xt.has(r))continue;const o=V(r);if(o){q.skipRunningEffect(r,o);continue}s.add(r),Ht(r,t,e,n);const c=Gt.get(r);if(xt(i,r,t,n,e),c){for(const r of c)r(t,e,n);c.delete(r)}}s.size>0&&(q.touched(t,e,[n],s),de(Array.from(s)))}(t,s,e)}else We(t,s,e)}function Ue(t){const e=new Set(Reflect.ownKeys(t));let n=Object.getPrototypeOf(t);for(;n&&!Object.hasOwn(n,"constructor");){for(const t of Reflect.ownKeys(n))e.add(t);n=Object.getPrototypeOf(n)}return e}function _e(t,e,n=new WeakMap,r=[],o){return Le(t,e)&&qe(t)&&qe(e)?function(t,e,n){let r=t.get(e);return r||(r=new WeakSet,t.set(e,r)),!!r.has(n)||(r.add(n),!1)}(n,t,e)?r:Array.isArray(t)&&Array.isArray(e)?(function(t,e,n,r,o){const s=[],i=t.length,c=e.length,a=Math.max(i,c);for(let n=0;n<a;n++){const r=n<i,a=n<c;if(r&&!a){s.push({target:t,evolution:{type:"del",prop:n},prop:n,origin:o});continue}if(!r&&a){s.push({target:t,evolution:{type:"add",prop:n},prop:n,origin:o});continue}if(!r||!a)continue;const f=Z(t[n]),l=Z(e[n]);Object.is(f,l)||s.push({target:t,evolution:{type:"set",prop:n},prop:n,origin:o})}i!==c&&s.push({target:t,evolution:{type:"set",prop:"length"},prop:"length",origin:o});r.push(...s)}(t,e,0,r,o),r):(function(t,e,n,r,o){const s=Ue(t),i=Ue(e),c=[];for(const e of s)i.has(e)||c.push({target:t,evolution:{type:"del",prop:e},prop:e,origin:o});for(const e of i)s.has(e)||c.push({target:t,evolution:{type:"add",prop:e},prop:e,origin:o});for(const a of i){if(!s.has(a))continue;const i=Z(t[a]),f=Z(e[a]);Le(i,f)?_e(i,f,n,r,o):Object.is(i,f)||c.push({target:t,evolution:{type:"set",prop:a},prop:a,origin:o})}r.push(...c)}(t,e,n,r,o),r):r}function Be(t,e){let n=t;const r=new WeakSet;for(;n&&!r.has(n);){if(r.add(n),e.has(n))return!0;n=tt.get(n)}return!1}Ie(Date,RegExp,Error,Promise,Function),"undefined"!=typeof window&&(!function(...t){for(const e of t){try{Object.defineProperty(e,W,{value:!0,writable:!1,enumerable:!1,configurable:!1})}catch{}W in e||$e.add(e)}t[0]}(window,document),Ie(Node,Element,HTMLElement,EventTarget));const He=[],Ge={[Symbol.toStringTag]:"MutTs Reactive",get(t,e,n){if(e===W)return!1;const r=Z(t);if(r[T]?.has(e)||"symbol"==typeof e)return o(t,e,n);$ in t&&t[$]instanceof Array&&"string"==typeof e&&("length"===e||!Number.isNaN(Number(e)))&&ct(t,"length"===e?"length":Number(e));const s=Reflect.has(n,e),c=s&&Object.hasOwn(n,e),a=s&&!c,f=q.ignoreAccessors&&c&&(i(n,e)||i(r,e));if(s&&(q.instanceMembers&&a&&t instanceof Object||f)||ct(t,e),a&&(!q.instanceMembers||!(t instanceof Object))){let n=Ye(Object.getPrototypeOf(t));for(;n&&n!==Object.prototype&&(ct(n,e),!Object.hasOwn(n,e));){let t=Ye(Object.getPrototypeOf(n));t===n&&(t=Ye(Object.getPrototypeOf(Z(n)))),n=t}}const l=o(t,e,n);if("object"==typeof l&&null!==l){const n=Ye(l);return Ee(t)&&ke(n,t,e),n}return l},set(t,e,n,r){const o=Z(t),i=Z(r);if(o[T]?.has(e)||o!==i)return s(t,e,n,r);const c=$ in t&&t[$]instanceof Array&&(!Number.isNaN(Number(e))||"length"===e),a=Z(n);if(c)return t[e]=a,!0;let f=ze;if(Reflect.has(i,e)){const t=Object.getOwnPropertyDescriptor(i,e),n=Object.getOwnPropertyDescriptor(o,e),r=t||n;f=r?.get&&!r?.set?B(void 0,()=>Reflect.get(o,e,i)):Reflect.get(o,e,i)}if(ve.has(t)&&("object"==typeof f&&null!==f&&Oe(f,t,e),"object"==typeof a&&null!==a)){ke(Ye(a),t,e)}return f!==a&&s(t,e,a,r)&&Ve(t,e,f,a,f!==ze),!0},has(t,e){if(He.includes(t))throw new N(`[reactive] Circular dependency detected in 'has' check for property '${String(e)}'`,{code:K.CycleDetected,cycle:[]});He.push(t),ct(t,e);const n=Reflect.has(t,e);return He.pop(),n},deleteProperty(t,e){if(!Object.hasOwn(t,e))return!1;const n=t[e];return ve.has(t)&&"object"==typeof n&&null!==n&&Oe(n,t,e),delete t[e],We(t,{type:"del",prop:e},e),ve.has(t)&&xe(t),!0},getPrototypeOf:t=>$ in t?t[$]:Object.getPrototypeOf(t),setPrototypeOf:(t,e)=>!($ in t)&&(Object.setPrototypeOf(t,e),!0),ownKeys:t=>(ct(t,C),Reflect.ownKeys(t))},Xe=new WeakSet,Ze=R(t=>class extends t{constructor(...t){return super(...t),Xe.has(new.target)?Je(this):this}});function Ye(t){if(!t||"object"!=typeof t)return t;const e=t;if(Ke(e))return e;if(X.has(e))return e;const n=function(t){return G.get(t)}(e);if(void 0!==n)return n;const r=!(D in e)||e instanceof e[D]?e:new e[D](e);r!==e&&function(t,e){X.set(t,e)}(r,e);const o=new Proxy(r,Ge);return function(t,e){G.set(t,e),X.set(e,t)}(e,o),o}const Je=l({class(t){if(t.prototype instanceof Ze)return Xe.add(t),t;class e extends t{constructor(...n){return super(...n),new.target===e||Xe.has(new.target)||q.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.`),Je(this)}}return Object.defineProperty(e,"name",{value:`Reactive<${t.name}>`}),e},get:t=>Ye(t),default:Ye});function Qe(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=et(()=>e(t),e);return ye(()=>{ve.add(t);let o=je.get(r);o||(o=new Set,je.set(r,o)),o.add(t);const s=new WeakSet;return function t(e,n=0){var r;if(!(!e||s.has(e)||(r=e,"object"!=typeof r||null===r)||n>q.maxDeepWatchDepth||Ke(e))){s.add(e),ve.add(e),o.add(e);for(const r in Z(e))if(Object.hasOwn(e,r)){const o=e[r];t("object"==typeof o&&null!==o?Je(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?Je(r):r,n+1)}}else if(e instanceof Set)for(const r of e){t("object"==typeof r&&null!==r?Je(r):r,n+1)}else if(e instanceof Map)for(const[r,o]of e){t("object"==typeof o&&null!==o?Je(o):o,n+1)}}}(t),n&&e(t),n=!0,()=>{const t=je.get(r);if(t){for(const e of t){const t=Se.get(e);t?(t.delete(r),0===t.size&&(Se.delete(e),ve.delete(e))):ve.delete(e)}je.delete(r)}}})}const tn=Symbol("cleanup"),en=Symbol("unset-yet");const nn=l({class(t){Ie(t)},default:function(t,...e){return"object"==typeof t?function(t){if(Ke(t=Z(t)))return t;try{Object.defineProperty(t,W,{value:!0,writable:!1,enumerable:!1,configurable:!0})}catch{}return W in t||$e.add(t),t}(t):n=>{n.prototype[T]=new Set(n.prototype[T]||[]),n.prototype[T].add(t);for(const t of e)n.prototype[T].add(t);return n}}});function rn(t,e){return Object.defineProperty(t,tn,{value:e,writable:!1,enumerable:!1,configurable:!0})}function*on(t){let e=t.next();for(;!e.done;)yield Je(e.value),e=t.next()}function*sn(t){let e=t.next();for(;!e.done;){const[n,r]=e.value;yield[Je(n),Je(r)],e=t.next()}}const cn=Symbol("native"),an=Array.isArray;Array.isArray=t=>an(t)||t&&"object"==typeof t&&$ in t&&Array.isArray(t[$]);class fn{at(t){const e=t<0?this[cn].length+t:t;if(ct(this,e),!(e<0||e>=this[cn].length))return Je(this[cn][e])}toReversed(){return ct(this),Je(this[cn].toReversed())}toSorted(t){return ct(this),Je(this[cn].toSorted(t))}toSpliced(t,e,...n){return ct(this),void 0===e?this[cn].toSpliced(t):this[cn].toSpliced(t,e,...n)}with(t,e){return ct(this),Je(this[cn].with(t,e))}entries(){return ct(this),sn(this[cn].entries())}keys(){return ct(this,"length"),this[cn].keys()}values(){return ct(this),on(this[cn].values())}[Symbol.iterator](){ct(this);const t=this[cn][Symbol.iterator]();return{next(){const e=t.next();return e.done?e:{value:Je(e.value),done:!1}}}}indexOf(t,e){ct(this);const n=Z(t),r=this[cn].indexOf(n,e);return-1!==r?r:this[cn].indexOf(t,e)}lastIndexOf(t,e){ct(this);const n=Z(t),r=this[cn].lastIndexOf(n,e);return-1!==r?r:this[cn].lastIndexOf(t,e)}includes(t,e){ct(this);const n=Z(t);return this[cn].includes(n,e)||this[cn].includes(t,e)}find(t,e){if(ct(this),"function"==typeof t){const n=t;return Je(this[cn].find((t,r,o)=>n.call(e,Je(t),r,o),e))}const n="number"==typeof e?e:void 0,r=this[cn].indexOf(t,n);if(-1!==r)return Je(this[cn][r])}findIndex(t,e){if(ct(this),"function"==typeof t){const n=t;return this[cn].findIndex((t,r,o)=>n.call(e,Je(t),r,o),e)}const n="number"==typeof e?e:void 0;return this[cn].indexOf(t,n)}flat(){return ct(this),Je(this[cn].flat())}flatMap(t,e){return ct(this),Je(this[cn].flatMap(t,e))}filter(t,e){return ct(this),Je(this[cn].filter((e,n,r)=>t(Je(e),n,r),e))}map(t,e){return ct(this),Je(this[cn].map((e,n,r)=>t(Je(e),n,r),e))}reduce(t,e){ct(this);const n=void 0===e?this[cn].reduce(t):this[cn].reduce(t,e);return Je(n)}reduceRight(t,e){ct(this);const n=void 0!==e?this[cn].reduceRight(t,e):this[cn].reduceRight(t);return Je(n)}slice(t,e){for(const n of un(t||0,e||this[cn].length-1))ct(this,n);return void 0===t?this[cn].slice():void 0===e?this[cn].slice(t):this[cn].slice(t,e)}concat(...t){return ct(this),Je(this[cn].concat(...t))}join(t){return ct(this),this[cn].join(t)}forEach(t,e){ct(this),this[cn].forEach((n,r,o)=>{t.call(e,Je(n),r,o)})}every(t,e){return ct(this),this[cn].every((n,r,o)=>t.call(e,Je(n),r,o),e)}some(t,e){return ct(this),this[cn].some((n,r,o)=>t.call(e,Je(n),r,o),e)}}function*ln(t,{length:e=!0}={}){e&&(yield"length"),yield t}function*un(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 hn extends(k(fn,{get(t){return ct(this,t),Je(this[cn][t])},set(t,e){const n=t>=this[cn].length;this[cn][t]=e,Te(this,{type:"set",prop:t},ln(t,{length:n}))},getLength(){return ct(this,"length"),this[cn].length},setLength(t){const e=this[cn].length;try{this[cn].length=t}finally{Te(this,{type:"set",prop:"length"},un(e,t,{length:!0}))}}})){constructor(t){super(),Object.defineProperties(this,{[cn]:{value:t},[$]:{value:t}})}push(...t){const e=this[cn].length;try{return this[cn].push(...t)}finally{Te(this,{type:"bunch",method:"push"},un(e,e+t.length-1,{length:!0}))}}pop(){if(0!==this[cn].length)try{return Je(this[cn].pop())}finally{Te(this,{type:"bunch",method:"pop"},ln(this[cn].length))}}shift(){if(0!==this[cn].length)try{return Je(this[cn].shift())}finally{Te(this,{type:"bunch",method:"shift"},un(0,this[cn].length+1,{length:!0}))}}unshift(...t){try{return this[cn].unshift(...t)}finally{Te(this,{type:"bunch",method:"unshift"},un(0,this[cn].length-t.length,{length:!0}))}}splice(t,e,...n){const r=this[cn].length;void 0===e&&(e=r-t);try{return Je(void 0===e?this[cn].splice(t):this[cn].splice(t,e,...n))}finally{Te(this,{type:"bunch",method:"splice"},e===n.length?un(t,t+e):un(t,r+Math.max(n.length-e,0),{length:!0}))}}reverse(){try{return this[cn].reverse()}finally{Te(this,{type:"bunch",method:"reverse"},un(0,this[cn].length-1))}}sort(t){t=t||((t,e)=>t.toString().localeCompare(e.toString()));try{return this[cn].sort((e,n)=>t(Je(e),Je(n)))}finally{Te(this,{type:"bunch",method:"sort"},un(0,this[cn].length-1))}}fill(t,e,n){try{return void 0===e?this[cn].fill(t):void 0===n?this[cn].fill(t,e):this[cn].fill(t,e,n)}finally{Te(this,{type:"bunch",method:"fill"},un(0,this[cn].length-1))}}copyWithin(t,e,n){try{return void 0===n?this[cn].copyWithin(t,e):this[cn].copyWithin(t,e,n)}finally{Te(this,{type:"bunch",method:"copyWithin"},un(0,this[cn].length-1))}}}class dn extends Error{}class pn extends(k(fn,{get(t){return ct(this,t),Je(this[cn][t])},set(t,e){throw new dn(`Setting index ${t} on a read-only array`)},getLength(){return ct(this,"length"),this[cn].length},setLength(t){throw new dn(`Setting length to ${t} on a read-only array`)}})){constructor(t){super(),Object.defineProperties(this,{[cn]:{value:t},[$]:{value:t}})}push(...t){throw new dn("Pushing items to a read-only array")}pop(){throw new dn("Popping from a read-only array")}shift(){throw new dn("Shifting from a read-only array")}unshift(...t){throw new dn("Unshifting items to a read-only array")}splice(t,e,...n){throw new dn("Splice from a read-only array")}reverse(){throw new dn("Reversing a read-only array")}sort(t){throw new dn("Sorting a read-only array")}fill(t,e,n){throw new dn("Filling a read-only array")}copyWithin(t,e,n){throw new dn("Copying within a read-only array")}}const gn=Je(pn);const yn=new WeakMap;function mn(t,e){t.branches??(t.branches=new WeakMap);let n=t.branches.get(e);return n||(n={},t.branches.set(e,n)),n}function bn(t){const e=nt(t),n=yn.get(e);if(n)return n;const r={},o=et((...n)=>{const o=n;if(o.some(t=>!(t&&["object","symbol","function"].includes(typeof t))))throw new Error("memoize expects non-null object arguments");let s=r;for(const t of o)s=mn(s,t);return ct(s,"memoize"),"result"in s||(s.cleanup=be(()=>ye(et(()=>(s.result=t(...o),()=>{delete s.result,We(s,{type:"invalidate",prop:o},"memoize")}),e),{opaque:!0}))),s.result},t);return yn.set(e,o),yn.set(o,o),o}const wn=l({getter(t,e){const n=bn(et(r(e=>t.call(e),`${String(this.constructor.name)}.${String(e)}`),t));return function(){return n(this)}},method(t,e){const n=bn(et(r((e,...n)=>t.call(e,...n),`${String(this.constructor.name)}.${String(e)}`),t));return function(...t){return n(this,...t)}},default:bn});let vn=(()=>{var t,e,n,r,o,s,i,c,a;let f,l,u=[nn],h=[],d=function(){class t extends(k(E,{get(t){return this[S](t)},set(t,e){this[j](t,e)},getLength(){return this.length},setLength(t){this.length=t}})){toArray(){return Array.from(this)}}return t}();var p,g,y;return l=class extends d{get[(e=new WeakMap,n=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,i=new WeakMap,c=new WeakMap,t=new WeakSet,O)](){return this.toArray()}constructor(a,f){let l;if(super(),t.add(this),e.set(this,void 0),n.set(this,void 0),r.set(this,void 0),o.set(this,new Map),s.set(this,new Map),i.set(this,new Set),c.set(this,void 0),ye(({ascend:t})=>{l=t}),b(this,c,l,"f"),"function"!=typeof a)throw new Error("Register requires a key function");b(this,e,a,"f"),b(this,n,Je([]),"f"),b(this,r,Je(new Map),"f"),Object.defineProperties(this,{[$]:{value:m(this,n,"f")}}),f&&this.push(...f)}ensureKey(n){let r=m(this,s,"f").get(n);if(r)return r.key;if(r={key:void 0},m(this,s,"f").set(n,r),m(this,c,"f").call(this,()=>{const o=ye(({reaction:o})=>{const s=m(this,e,"f").call(this,n);this.assertValidKey(s);const i=r.key;o&&void 0!==i&&!Object.is(s,i)&&m(this,t,"m",a).call(this,n,i,s),r.key=s});r.stop=o,m(this,i,"f").add(o)}),void 0===r.key)throw new Error("Register key function must return a property key");return r.key}assertValidKey(t){const e=typeof t;if("string"!==e&&"number"!==e&&"symbol"!==e)throw new Error("Register key function must return a property key")}setKeyValue(t,e){const n=m(this,r,"f").get(t);void 0!==n&&n!==e&&this.cleanupValue(n),m(this,r,"f").set(t,e)}cleanupValue(t){const e=m(this,s,"f").get(t);if(!e)return;const n=e.stop;n&&(e.stop=void 0,m(this,i,"f").delete(n),n()),m(this,s,"f").delete(t)}disposeKeyEffects(){for(const t of Array.from(m(this,s,"f").keys()))this.cleanupValue(t);m(this,i,"f").clear()}incrementUsage(t){const e=m(this,o,"f").get(t)??0;m(this,o,"f").set(t,e+1)}decrementUsage(t){const e=m(this,o,"f").get(t);if(e)if(e<=1){const e=m(this,r,"f").get(t);m(this,o,"f").delete(t),m(this,r,"f").delete(t),void 0!==e&&this.cleanupValue(e)}else m(this,o,"f").set(t,e-1)}normalizeIndex(t,e=!1){const n=this.length;let r=t;if(r<0&&(r=Math.max(n+r,0)),r>n){if(!e)throw new RangeError("Index out of bounds");r=n}if(!e&&r===n)throw new RangeError("Index out of bounds");return r}assignAt(t,e,r){const o=m(this,n,"f")[t];void 0!==o&&Object.is(o,e)||(void 0!==o&&this.decrementUsage(o),m(this,n,"f")[t]=e,this.incrementUsage(e)),this.setKeyValue(e,r)}insertKeyValue(t,e,r){m(this,n,"f").splice(t,0,e),this.incrementUsage(e),this.setKeyValue(e,r)}rebuildFrom(t){this.disposeKeyEffects(),m(this,n,"f").splice(0,m(this,n,"f").length),m(this,o,"f").clear(),m(this,r,"f").clear();for(const e of t){const t=this.ensureKey(e);m(this,n,"f").push(t),this.incrementUsage(t),m(this,r,"f").set(t,e)}}get length(){return m(this,n,"f").length}[(a=function(t,e,i){if(Object.is(e,i))return;const c=m(this,r,"f").get(i);if(void 0!==c&&c!==t)throw new Error(`Register key collision for key ${String(i)}`);const a=m(this,o,"f").get(e);if(!a)return;const f=m(this,o,"f").get(i)??0;this.setKeyValue(i,t);for(let t=0;t<m(this,n,"f").length;t++)Object.is(m(this,n,"f")[t],e)&&(m(this,n,"f")[t]=i);m(this,o,"f").set(i,f+a),m(this,o,"f").delete(e),m(this,r,"f").delete(e);const l=m(this,s,"f").get(t);l&&(l.key=i)},S)](t){const e=m(this,n,"f")[t];return void 0===e?void 0:m(this,r,"f").get(e)}[j](t,e){const n=this.ensureKey(e);if(t===this.length)return void this.insertKeyValue(t,n,e);const r=this.normalizeIndex(t);this.assignAt(r,n,e)}push(...t){for(const e of t){const t=this.ensureKey(e);this.insertKeyValue(this.length,t,e)}return this.length}pop(){if(this.length)return this.removeAt(this.length-1)}shift(){if(this.length)return this.removeAt(0)}unshift(...t){let e=0;for(const n of t){const t=this.ensureKey(n);this.insertKeyValue(e++,t,n)}return this.length}splice(t,e,...o){const s=this.normalizeIndex(t,!0),i=this.length-s,c=Math.min(void 0===e?i:Math.max(e,0),i),a=[];for(const t of o)a.push(this.ensureKey(t));const f=m(this,n,"f").splice(s,c,...a),l=[];for(const t of f){if(void 0===t)continue;const e=m(this,r,"f").get(t);this.decrementUsage(t),l.push(e)}for(let t=0;t<a.length;t++){const e=a[t],n=o[t];this.incrementUsage(e),this.setKeyValue(e,n)}return l}clear(){m(this,n,"f").length=0,m(this,o,"f").clear(),m(this,r,"f").clear(),this.disposeKeyEffects()}get(t){return m(this,r,"f").get(t)}set(t,e){m(this,r,"f").has(t)&&this.setKeyValue(t,e)}remove(t){let e=this.indexOfKey(t);for(;-1!==e;)this.removeAt(e),e=this.indexOfKey(t)}removeAt(t){const[e]=m(this,n,"f").splice(t,1);if(void 0===e)return;const o=m(this,r,"f").get(e);return this.decrementUsage(e),o}keep(t){const e=new Map;for(const[o,s]of m(this,n,"f").entries()){if(e.has(s)){e.get(s)||this.removeAt(o);continue}const n=t(m(this,r,"f").get(s));e.set(s,n),n||this.removeAt(o)}}hasKey(t){return m(this,o,"f").has(t)}indexOfKey(t){return m(this,n,"f").indexOf(t)}mapKeys(){return m(this,r,"f").keys()}update(...t){for(const e of t){const t=this.ensureKey(e);m(this,r,"f").has(t)&&this.setKeyValue(t,e)}}upsert(t,...e){for(const n of e){const e=this.ensureKey(n);m(this,r,"f").has(e)?this.setKeyValue(e,n):t(n)}}entries(){const t=this;return function*(){for(let e=0;e<m(t,n,"f").length;e++){const o=m(t,r,"f").get(m(t,n,"f")[e]);void 0!==o&&(yield[e,o])}}()}[Symbol.iterator](){const t=this;return function*(){for(const e of m(t,n,"f")){const n=m(t,r,"f").get(e);void 0!==n&&(yield n)}}()}toString(){return`[Register length=${this.length}]`}at(t){const e=t<0?this.length+t:t;if(!(e<0||e>=this.length))return this[S](e)}reverse(){return m(this,n,"f").reverse(),this}sort(t){const e=t?(e,n)=>t(m(this,r,"f").get(e),m(this,r,"f").get(n)):void 0;return m(this,n,"f").sort(e),this}fill(t,e=0,n=this.length){const r=this.toArray();return r.fill(t,e,n),this.rebuildFrom(r),this}copyWithin(t,e,n){const r=this.toArray();return r.copyWithin(t,e,n),this.rebuildFrom(r),this}},p=l,"symbol"==typeof(g="RegisterClass")&&(g=g.description?"[".concat(g.description,"]"):""),Object.defineProperty(p,"name",{configurable:!0,value:y?"".concat(y," ",g):g}),(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??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,f="getter"===a?"get":"setter"===a?"set":"value",l=!e&&t?r.static?t:t.prototype:null,u=e||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),h=!1,d=n.length-1;d>=0;d--){var p={};for(var g in r)p[g]="access"===g?{}:r[g];for(var g in r.access)p.access[g]=r.access[g];p.addInitializer=function(t){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(i(t||null))};var y=(0,n[d])("accessor"===a?{get:u.get,set:u.set}:u[f],p);if("accessor"===a){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(c=i(y.get))&&(u.get=c),(c=i(y.set))&&(u.set=c),(c=i(y.init))&&o.unshift(c)}else(c=i(y))&&("field"===a?o.unshift(c):u[f]=c)}l&&Object.defineProperty(l,r.name,u),h=!0}(null,f={value:l},u,{kind:"class",name:l.name,metadata:t},null,h),l=f.value,t&&Object.defineProperty(l,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t}),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)}(l,h)})(),l})();const Sn=vn;const jn=new WeakMap;function kn(){const t=_();return t?jn.get(t):void 0}function On(t){Object.defineProperty(t,"value",{get:t.get,set:t.set,configurable:!0,enumerable:!0})}function En(t,e,n,r){return r&&Object.defineProperty(t,z,{value:r,writable:!1,enumerable:!1,configurable:!0}),rn(t,()=>{n();for(const t of e.values())t?.();e.clear()})}function xn(t,e){const n=Je(t),r=Je([]),i=new Map;function c(t){const e=i.get(t);e&&(i.delete(t),e(),Reflect.deleteProperty(r,t))}const a=kn(),f=a?a.depth+1:0,l=ye(function({ascend:t}){const l=n.length;!function(t){s(r,"length",t,r)}(l);const u=Array.from(i.keys());for(let c=0;c<l;c++)i.has(c)||t(()=>{const t=c,l=ye(function(){const i=me(()=>r[t]),c={key:t,source:n,get:()=>o(n,t,n),set:e=>s(n,t,e,n),old:i};On(c);const a=e(c,r);r[t]=a});jt(l,`project[${f}]:${t}`),jn.set(l,{source:n,key:t,target:r,depth:f,parent:a}),i.set(c,l)});for(const t of u)t>=l&&c(t)});return En(r,i,()=>l(),{source:n,target:r,apply:e,depth:f,parent:a})}function Mn(t,e){const n=Je(t),r=new Map,o=Je(r),s=new Map;function i(t){const e=s.get(t);e&&(e(),s.delete(t),o.delete(t))}const c=kn(),a=c?c.depth+1:0,f=ye(function({ascend:t}){const r=new Set;for(const t of n.mapKeys())r.add(t);for(const i of r)s.has(i)||t(()=>{const t=ye(function(){const t=me(()=>o.get(i)),r={key:i,source:n,get:()=>n.get(i),set:t=>(n.set(i,t),!0),old:t};On(r);const s=e(r,o);o.set(i,s)});jt(t,`project[${a}]:${String(i)}`),jn.set(t,{source:n,key:i,target:o,depth:a,parent:c}),s.set(i,t)});for(const t of Array.from(s.keys()))r.has(t)||i(t)});return En(o,s,()=>f(),{source:n,target:o,apply:e,depth:a,parent:c})}function Pn(t,e){const n=Je(t),r=Je({}),i=new Map;function c(t){const e=i.get(t);e&&(e(),i.delete(t),Reflect.deleteProperty(r,t))}const a=kn(),f=a?a.depth+1:0,l=ye(function({ascend:t}){const l=new Set;for(const t in n)l.add(t);const u=Reflect.ownKeys(n);for(const t of u)l.add(t);for(const c of l)i.has(c)||t(()=>{const t=ye(function(){const t=c,i=me(()=>r[c]),a={key:t,source:n,get:()=>o(n,t,n),set:e=>s(n,t,e,n),old:i};On(a);const f=e(a,r);r[t]=f});jt(t,`project[${f}]:${String(c)}`),jn.set(t,{source:n,key:c,target:r,depth:f,parent:a}),i.set(c,t)});for(const t of Array.from(i.keys()))l.has(t)||c(t)});return En(r,i,()=>l(),{source:n,target:r,apply:e,depth:f,parent:a})}function An(t,e){const n=Je(t),r=new Map,o=Je(r),s=new Map;function i(t){const e=s.get(t);e&&(e(),s.delete(t),o.delete(t))}const c=kn(),a=c?c.depth+1:0,f=ye(function({ascend:t}){const r=new Set;for(const t of n.keys())r.add(t);for(const i of r)s.has(i)||t(()=>{const t=ye(function(){const t=me(()=>o.get(i)),r={key:i,source:n,get:()=>n.get(i),set:t=>(n.set(i,t),!0),old:t};On(r);const s=e(r,o);o.set(i,s)});jt(t,`project[${a}]:${String(i)}`),jn.set(t,{source:n,key:i,target:o,depth:a,parent:c}),s.set(i,t)});for(const t of Array.from(s.keys()))r.has(t)||i(t)});return En(o,s,()=>f(),{source:n,target:o,apply:e,depth:a,parent:c})}const Rn=Object.assign(function(t,e){if(Array.isArray(t))return xn(t,e);if(t instanceof Map)return An(t,e);if(t instanceof Sn)return Mn(t,e);if(t&&(t.constructor===Object||void 0===t.constructor))return Pn(t,e);throw new Error("Unsupported source type")},{array:xn,register:Mn,record:Pn,map:An});const Dn=Symbol("native");class Wn{constructor(t){Object.defineProperties(this,{[Dn]:{value:t},[$]:{value:t},content:{value:Symbol("MapContent")},[Symbol.toStringTag]:{value:"ReactiveMap"}})}get size(){return ct(this,"size"),this[Dn].size}clear(){const t=this[Dn].size>0;if(this[Dn].clear(),t){const t={type:"bunch",method:"clear"};We(this,t,"size"),Te(this.content,t)}}entries(){return ct(this.content),sn(this[Dn].entries())}forEach(t,e){ct(this.content),this[Dn].forEach(t,e)}keys(){return ct(this.content),this[Dn].keys()}values(){return ct(this.content),on(this[Dn].values())}[Symbol.iterator](){ct(this.content);const t=this[Dn][Symbol.iterator]();return{next(){const e=t.next();return e.done?e:{value:[e.value[0],Je(e.value[1])],done:!1}}}}delete(t){const e=this[Dn].has(t),n=this[Dn].delete(t);if(e){const e={type:"del",prop:t};We(this.content,e,t),We(this,e,"size")}return n}get(t){return ct(this.content,t),Je(this[Dn].get(t))}has(t){return ct(this.content,t),this[Dn].has(t)}set(t,e){const n=this[Dn].has(t),r=this[Dn].get(t),o=Je(e);if(this[Dn].set(t,o),!n||r!==o){Ve(this.content,t,r,o,n);We(this,{type:n?"set":"add",prop:t},"size")}return this}}const Tn=Symbol("native");class $n{constructor(t){Object.defineProperties(this,{[Tn]:{value:t},[$]:{value:t},content:{value:Symbol("SetContent")},[Symbol.toStringTag]:{value:"ReactiveSet"}})}get size(){return ct(this,"size"),this[Tn].size}add(t){const e=this[Tn].has(t),n=Je(t);if(this[Tn].add(n),!e){const t={type:"add",prop:n};We(this.content,t,n),We(this,t,"size")}return this}clear(){const t=this[Tn].size>0;if(this[Tn].clear(),t){const t={type:"bunch",method:"clear"};We(this,t,"size"),Te(this.content,t)}}delete(t){const e=this[Tn].has(t),n=this[Tn].delete(t);if(e){const e={type:"del",prop:t};We(this.content,e,t),We(this,e,"size")}return n}has(t){return ct(this.content,t),this[Tn].has(t)}entries(){return ct(this.content),sn(this[Tn].entries())}forEach(t,e){ct(this.content),this[Tn].forEach(t,e)}keys(){return ct(this.content),on(this[Tn].keys())}values(){return ct(this.content),on(this[Tn].values())}[Symbol.iterator](){ct(this.content);const t=this[Tn][Symbol.iterator]();return{next(){const e=t.next();return e.done?e:{value:Je(e.value),done:!1}}}}}Ne(WeakMap,class{constructor(t){Object.defineProperties(this,{[Dn]:{value:t},[$]:{value:t},content:{value:Symbol("WeakMapContent")},[Symbol.toStringTag]:{value:"ReactiveWeakMap"}})}delete(t){const e=this[Dn].has(t),n=this[Dn].delete(t);return e&&We(this.content,{type:"del",prop:t},t),n}get(t){return ct(this.content,t),Je(this[Dn].get(t))}has(t){return ct(this.content,t),this[Dn].has(t)}set(t,e){const n=this[Dn].has(t),r=this[Dn].get(t),o=Je(e);return this[Dn].set(t,o),n&&r===o||Ve(this.content,t,r,o,n),this}}),Ne(Map,Wn),Ne(WeakSet,class{constructor(t){Object.defineProperties(this,{[Tn]:{value:t},[$]:{value:t},content:{value:Symbol("WeakSetContent")},[Symbol.toStringTag]:{value:"ReactiveWeakSet"}})}add(t){const e=this[Tn].has(t);return this[Tn].add(t),e||We(this.content,{type:"add",prop:t},t),this}delete(t){const e=this[Tn].has(t),n=this[Tn].delete(t);return e&&We(this.content,{type:"del",prop:t},t),n}has(t){return ct(this.content,t),this[Tn].has(t)}}),Ne(Set,$n),Ne(Array,hn);const Cn={objectToProxy:G,proxyToObject:X,effectToReactiveObjects:Y,watchers:J,objectParents:we,objectsWithDeepWatchers:ve,deepWatchers:Se,effectToDeepWatchedObjects:je,nonReactiveObjects:$e},zn=[],In=l({getter:(t,e)=>function(){const n=zn.findIndex(t=>t.object===this&&t.prop===e);if(n>-1)throw new Error(`Circular dependency detected: ${zn.slice(n).map(t=>`${t.object.constructor.name}.${String(t.prop)}`).join(" -> ")} -> again`);zn.push({object:this,prop:e});try{const n=t.call(this);return Kn(this,e,n),n}finally{zn.pop()}}});function Kn(t,e,n){Object.defineProperty(t,e,{value:n})}const Nn=Object.assign(l({method:(t,e)=>function(...n){return Nn.warn(this,e),t.apply(this,n)},getter:(t,e)=>function(){return Nn.warn(this,e),t.call(this)},setter:(t,e)=>function(n){return Nn.warn(this,e),t.call(this,n)},class:t=>class extends t{constructor(...t){super(...t),Nn.warn(this,"constructor")}},default:t=>l({method:(e,n)=>function(...r){return Nn.warn(this,n,t),e.apply(this,r)},getter:(e,n)=>function(){return Nn.warn(this,n,t),e.call(this)},setter:(e,n)=>function(r){return Nn.warn(this,n,t),e.call(this,r)},class:e=>class extends e{constructor(...e){super(...e),Nn.warn(this,"constructor",t)}}})}),{warn:(t,e,n)=>{}});t.ArrayReadForward=E,t.DecoratorError=c,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;u.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[h];if(!o)throw new p("Destructor is not defined");function s(){o(r)}n.destructors.set(this,s),u.register(this,s,this)}},n.destructors=new WeakMap,n},t.DestructionError=p,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=k,t.IterableWeakMap=P,t.IterableWeakSet=A,t.ReactiveBase=Ze,t.ReactiveError=N,t.ReadOnlyError=dn,t.ReflectGet=o,t.ReflectSet=s,t.Register=Sn,t.addBatchCleanup=fe,t.allocated=y,t.allocatedValues=d,t.arrayEquals=function(t,e){if(t===e)return!0;if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0},t.atomic=pe,t.batch=de,t.biDi=function(t,e,n){"function"!=typeof e&&(n=e.set,e=e.get);const r=nt(t);return ye(et(()=>{t(e())},r)),pe(t=>{n(t),re?.all.has(r)&&re.all.delete(r)})},t.buildReactivityGraph=Pt,t.cache=Kn,t.cached=In,t.callOnGC=function(t){let e=!1;const n=()=>{e||(e=!0,t())};return u.register(n,t,t),n},t.cleanedBy=rn,t.cleanup=tn,t.debounce=function(t){return l({method(e,n){let r=null;return function(...n){r&&clearTimeout(r),r=setTimeout(()=>{e.apply(this,n),r=null},t)}}})},t.decorator=l,t.deepWatch=Qe,t.defer=le,t.deprecated=Nn,t.derived=function(t){const e={value:void 0};return rn(e,me(()=>ye(et(function(n){e.value=t(n)},t))))},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=ye,t.enableDevTools=function(){"undefined"!=typeof window&&(ft||(ft=!0,window.__MUTTS_DEVTOOLS__={getGraph:Pt,setEffectName:jt,setObjectName:kt,registerEffect:Ot,registerObject:Et}))},t.forwardArray=O,t.getActivationLog=function(){return Bt},t.getActiveEffect=_,t.getActiveProjection=kn,t.getAt=S,t.getState=Re,t.immutables=Ce,t.isCached=function(t,e){return!!Object.getOwnPropertyDescriptor(t,e)},t.isConstructor=n,t.isDevtoolsEnabled=At,t.isNonReactive=Ke,t.isOwnAccessor=i,t.isReactive=function(t){return X.has(t)},t.isZoneEnabled=function(){return Wt},t.legacyDecorator=a,t.mapped=function(t,e,n){const r=[],o=new gn(r),s=[];function i(n){return ye(function(){r[n]=e(t[n],n,o),We(o,{type:"set",prop:n},n)})}const c=ye(function({ascend:e}){const c=t.length,a=me(()=>r.length);if(n?.(c,a),We(o,{type:"set",prop:"length"},"length"),c<a){const t=s.splice(c);for(const e of t)e();r.length=c}else c>a&&e(function(){for(let t=a;t<c;t++)s.push(i(t))})});return rn(o,()=>{for(const t of s)t();s.length=0,c()})},t.memoize=wn,t.mixin=R,t.modernDecorator=f,t.organize=function(t,e,n){return Object.defineProperty(t,e,{get:n.get,set:n.set,configurable:!0,enumerable:!0}),We(t,{type:"set",prop:e},e),()=>delete t[e]},t.organized=function(t,e,n={}){const r=Je(t),i=Je(n),c=new Map;function a(t){const e=c.get(t);e&&(c.delete(t),e())}const f=ye(function({ascend:t}){const n=new Set;for(const t in r)n.add(t);for(const a of n)c.has(a)||t(()=>{const t=ye(function(){const t=a,n={key:t,get:()=>o(r,t,r),set:e=>s(r,t,e,r)};return Object.defineProperty(n,"value",{get:n.get,set:n.set,configurable:!0,enumerable:!0}),e(n,i)});c.set(a,t)});for(const t of Array.from(c.keys()))n.has(t)||a(t)});return rn(i,()=>{f();for(const t of Array.from(c.keys()))a(t)})},t.profileInfo=Cn,t.project=Rn,t.reactive=Je,t.reactiveOptions=q,t.reduced=function(t,e){const n=[],r=new gn(n),o=ye(function(){const o={};n.length=0;for(const r of t)n.push(...e(r,o));Te(r,{type:"invalidate",prop:"reduced"})});return rn(r,o)},t.register=function(t,e){return new vn(t,e)},t.registerEffectForDebug=Ot,t.registerNativeReactivity=Ne,t.registerObjectForDebug=Et,t.renamed=r,t.root=be,t.setAt=j,t.setEffectName=jt,t.setObjectName=kt,t.setZoneEnabled=function(t){t&&!Wt?(Lt(),Wt=!0):!t&&Wt&&(Promise.prototype.then=Tt,Promise.prototype.catch=$t,Promise.prototype.finally=Ct,globalThis.setTimeout=zt,globalThis.setInterval=It,Kt&&(globalThis.requestAnimationFrame=Kt),Nt&&(globalThis.queueMicrotask=Nt),Wt=!1)},t.throttle=function(t){return l({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.touched=Te,t.touched1=We,t.trackEffect=function(t){const e=_();if(!e)throw new Error("Not in an effect");Gt.has(e)?Gt.get(e).add(t):Gt.set(e,new Set([t]))},t.unreactive=nn,t.untracked=me,t.unwrap=Z,t.watch=function(t,e,n={}){return"function"==typeof t?function(t,e,{immediate:n=!1,deep:r=!1}={}){const o=_();let s,i=en;const c=ye(et(function(c){const a=t(c);i!==a&&B(o,et(()=>{i===en?n&&e(a):e(a,i),i=a,r&&(s&&s(),s=Qe(a,et(t=>e(t,t),e)))},e))},t));return()=>{c(),s&&s()}}(t,e,n):"object"==typeof t&&null!==t?function(t,e,{immediate:n=!1,deep:r=!1}={}){const o=_();return r?Qe(t,e,{immediate:n}):ye(et(function(){ct(t),n&&B(o,()=>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(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Mutts={})}(this,function(exports){"use strict";const nativeReactive=Symbol("native-reactive"),nonReactiveMark=Symbol("non-reactive"),unreactiveProperties=Symbol("unreactive-properties"),prototypeForwarding=Symbol("prototype-forwarding"),allProps=Symbol("all-props"),projectionInfo=Symbol("projection-info"),stopped=Symbol("stopped"),cleanup$1=Symbol("cleanup"),rootFunction=Symbol("root-function");var ReactiveErrorCode;!function(e){e.CycleDetected="CYCLE_DETECTED",e.MaxDepthExceeded="MAX_DEPTH_EXCEEDED",e.MaxReactionExceeded="MAX_REACTION_EXCEEDED",e.WriteInComputed="WRITE_IN_COMPUTED",e.TrackingError="TRACKING_ERROR"}(ReactiveErrorCode||(ReactiveErrorCode={}));class ReactiveError extends Error{constructor(e,t){super(e),this.debugInfo=t,this.name="ReactiveError"}}const options={enter:e=>{},leave:e=>{},chain:(e,t)=>{},beginChain:e=>{},endChain:()=>{},garbageCollected:e=>{},touched:(e,t,r,n)=>{},skipRunningEffect:(e,t)=>{},maxEffectChain:100,maxTriggerPerBatch:10,maxEffectReaction:"throw",onMemoizationDiscrepancy:void 0,cycleHandling:"throw",isVerificationRun:!1,maxDeepWatchDepth:100,instanceMembers:!0,ignoreAccessors:!0,recursiveTouching:!0,asyncMode:"cancel",warn:(...e)=>{},introspection:{enableHistory:!1,historySize:50},zones:{setTimeout:!0,setInterval:!0,requestAnimationFrame:!0,queueMicrotask:!0}};function zip(...e){if(!e.length)return[];const t=Math.min(...e.map(e=>e.length)),r=[];for(let n=0;n<t;n++){const t=e.map(e=>e[n]);r.push(t)}return r}function arrayEquals(e,t){if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}const nativeConstructors=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 isConstructor(e){return e&&"function"==typeof e&&(nativeConstructors.has(e)||e.toString?.().startsWith("class "))}function renamed(e,t){return Object.defineProperties(e,{name:{value:t}})}function ReflectGet(e,t,r){return"undefined"!=typeof Node&&e instanceof Node?e[t]:Reflect.get(e,t,r)}function ReflectSet(e,t,r,n){return"undefined"!=typeof Node&&e instanceof Node?(e[t]=r,!0):e instanceof Object||Reflect.has(e,t)?Reflect.set(e,t,r,n):(Object.defineProperty(e,t,{value:r,configurable:!0,writable:!0,enumerable:!0}),!0)}function isOwnAccessor(e,t){const r=Object.getOwnPropertyDescriptor(e,t);return!(!r?.get&&!r?.set)}function deepCompare(e,t,r=new Map){for(;e&&"object"==typeof e&&prototypeForwarding in e;)e=e[prototypeForwarding];for(;t&&"object"==typeof t&&prototypeForwarding in t;)t=t[prototypeForwarding];if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return e===t;if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;let n=r.get(e);if(n?.has(t))return!0;if(n||(n=new Set,r.set(e,n)),n.add(t),Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!deepCompare(e[n],t[n],r))return!1;return!0}if(e instanceof Date){const r=t instanceof Date&&e.getTime()===t.getTime();return r}if(e instanceof RegExp){const r=t instanceof RegExp&&e.toString()===t.toString();return r}if(e instanceof Set){if(!(t instanceof Set)||e.size!==t.size)return!1;for(const n of e){let e=!1;for(const o of t)if(deepCompare(n,o,r)){e=!0;break}if(!e)return!1}return!0}if(e instanceof Map){if(!(t instanceof Map)||e.size!==t.size)return!1;for(const[n,o]of e)if(t.has(n)){if(!deepCompare(o,t.get(n),r))return!1}else{let e=!1;for(const[i,s]of t)if(deepCompare(n,i,r)&&deepCompare(o,s,r)){e=!0;break}if(!e)return!1}return!0}const o=Object.keys(e),i=Object.keys(t);if(o.length!==i.length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!deepCompare(e[n],t[n],r))return!1}return!0}class DecoratorError extends Error{constructor(e){super(e),this.name="DecoratorException"}}function legacyDecorator(e){return function(t,r,n,...o){if(void 0===r){if(isConstructor(t)){if(!("class"in e))throw new Error("Decorator cannot be applied to a class");return e.class(t)}}else if("object"==typeof t&&["string","symbol"].includes(typeof r)){if(!n)throw new Error("Decorator cannot be applied to a field");if("object"==typeof n&&"configurable"in n){if("get"in n||"set"in n){if(!("getter"in e)&&!("setter"in e))throw new Error("Decorator cannot be applied to a getter or setter");if("getter"in e){const o=e.getter(n.get,t,r);o&&(n.get=o)}if("setter"in e){const o=e.setter(n.set,t,r);o&&(n.set=o)}return n}if("function"==typeof n.value){if(!("method"in e))throw new Error("Decorator cannot be applied to a method");const o=e.method(n.value,t,r);return o&&(n.value=o),n}}}if(!("default"in e))throw new Error("Decorator do not have a default implementation");return e.default.call(this,t,r,n,...o)}}function modernDecorator(e){return function(t,r,...n){if(!r?.kind||"string"!=typeof r.kind){if(!("default"in e))throw new Error("Decorator do not have a default implementation");return e.default.call(this,t,r,...n)}switch(r.kind){case"class":if(!("class"in e))throw new Error("Decorator cannot be applied to a class");return e.class(t);case"field":throw new Error("Decorator cannot be applied to a field");case"getter":if(!("getter"in e))throw new Error("Decorator cannot be applied to a getter");return e.getter(t,t,r.name);case"setter":if(!("setter"in e))throw new Error("Decorator cannot be applied to a setter");return e.setter(t,t,r.name);case"method":if(!("method"in e))throw new Error("Decorator cannot be applied to a method");return e.method(t,t,r.name);case"accessor":{if(!("getter"in e)&&!("setter"in e))throw new Error("Decorator cannot be applied to a getter or setter");const n={};if("getter"in e){const o=e.getter(t.get,t,r.name);o&&(n.get=o)}if("setter"in e){const o=e.setter(t.set,t,r.name);o&&(n.set=o)}return n}}}}function detectDecoratorMode(e,t,r){return"object"==typeof t&&null!==t&&"string"==typeof t.kind?"modern":"legacy"}const decorator=e=>{const t=modernDecorator(e),r=legacyDecorator(e);return(e,n,...o)=>"modern"===detectDecoratorMode(e,n,o[0])?t(e,n,...o):r(e,n,...o)},fr$1=new FinalizationRegistry(e=>e()),destructor=Symbol("destructor"),allocatedValues=Symbol("allocated");class DestructionError extends Error{static throw(e){return()=>{throw new DestructionError(e)}}constructor(e){super(`Object is destroyed. ${e}`),this.name="DestroyedAccessError"}}const destroyedHandler={[Symbol.toStringTag]:"MutTs Destroyable",get:DestructionError.throw("Cannot access destroyed object"),set:DestructionError.throw("Cannot access destroyed object")};function Destroyable(e,t){var r;return e&&"function"!=typeof e&&(t=e,e=void 0),e||(e=class{}),r=class extends e{static destroy(e){const t=r.destructors.get(e);if(!t)return!1;fr$1.unregister(e[allocatedValues]),r.destructors.delete(e),Object.setPrototypeOf(e,new Proxy({},destroyedHandler));for(const t of Object.getOwnPropertyNames(e))delete e[t];return t(),!0}static isDestroyable(e){return r.destructors.has(e)}constructor(...e){super(...e);const n={};this[allocatedValues]=n;const o=t?.destructor??this[destructor];if(!o)throw new DestructionError("Destructor is not defined");function i(){o(n)}r.destructors.set(this,i),fr$1.register(this,i,n)}},r.destructors=new WeakMap,r}const allocated=decorator({setter:(e,t,r)=>function(t){return this[allocatedValues][r]=t,e.call(this,t)}});function callOnGC(e){let t=!1;const r=()=>{t||(t=!0,e())};return fr$1.register(r,e,e),r}function __esDecorate(e,t,r,n,o,i){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,c=n.kind,l="getter"===c?"get":"setter"===c?"set":"value",f=!t&&e?n.static?e:e.prototype:null,u=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),d=!1,h=r.length-1;h>=0;h--){var p={};for(var g in n)p[g]="access"===g?{}:n[g];for(var g in n.access)p.access[g]=n.access[g];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");i.push(s(e||null))};var y=(0,r[h])("accessor"===c?{get:u.get,set:u.set}:u[l],p);if("accessor"===c){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(a=s(y.get))&&(u.get=a),(a=s(y.set))&&(u.set=a),(a=s(y.init))&&o.unshift(a)}else(a=s(y))&&("field"===c?o.unshift(a):u[l]=a)}f&&Object.defineProperty(f,n.name,u),d=!0}function __runInitializers(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0}function __setFunctionName(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function __classPrivateFieldGet(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function __classPrivateFieldSet(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r}var _Eventful_events,_Eventful_hooks;"function"==typeof SuppressedError&&SuppressedError;class Eventful{constructor(){_Eventful_events.set(this,new Map),_Eventful_hooks.set(this,[])}hook(e){return __classPrivateFieldGet(this,_Eventful_hooks,"f").includes(e)||__classPrivateFieldGet(this,_Eventful_hooks,"f").push(e),()=>{__classPrivateFieldGet(this,_Eventful_hooks,"f").splice(__classPrivateFieldGet(this,_Eventful_hooks,"f").indexOf(e),1)}}on(e,t){if("object"==typeof e)for(const t of Object.keys(e))this.on(t,e[t]);else if(void 0!==t){let r=__classPrivateFieldGet(this,_Eventful_events,"f").get(e);r||(r=[],__classPrivateFieldGet(this,_Eventful_events,"f").set(e,r)),r.push(t)}return()=>this.off(e,t)}off(e,t){if("object"==typeof e)for(const t of Object.keys(e))this.off(t,e[t]);else if(null!=t){const r=__classPrivateFieldGet(this,_Eventful_events,"f").get(e);r&&__classPrivateFieldGet(this,_Eventful_events,"f").set(e,r.filter(e=>e!==t))}else __classPrivateFieldGet(this,_Eventful_events,"f").delete(e)}emit(e,...t){const r=__classPrivateFieldGet(this,_Eventful_events,"f").get(e);if(r)for(const e of r)e.apply(this,t);for(const r of __classPrivateFieldGet(this,_Eventful_hooks,"f"))r.call(this,e,...t)}}_Eventful_events=new WeakMap,_Eventful_hooks=new WeakMap;const getAt=Symbol("getAt"),setAt=Symbol("setAt");function Indexable(e,t){e&&"function"!=typeof e&&(t=e,e=void 0),e||(e=class{}),t||(t={get(e){if("function"!=typeof this[getAt])throw new Error("Indexable class must have an [getAt] method");return this[getAt](e)},set(e,t){if("function"!=typeof this[setAt])throw new Error("Indexable class has read-only numeric index access");this[setAt](e,t)}});class r extends e{}return Object.setPrototypeOf(r.prototype,new Proxy(e.prototype,{[Symbol.toStringTag]:"MutTs Indexable",get(e,r,n){if(r in e){const t=Object.getOwnPropertyDescriptor(e,r)?.get;return t?t.call(n):e[r]}if("string"==typeof r){if("length"===r&&t.getLength)return t.getLength.call(n);const e=Number(r);if(!Number.isNaN(e))return t.get.call(n,e)}},set(e,r,n,o){if(r in e){const t=Object.getOwnPropertyDescriptor(e,r)?.set;return t?t.call(o,n):e[r]=n,!0}if("string"==typeof r){if("length"===r&&t.setLength)return t.setLength.call(o,n),!0;const e=Number(r);if(!Number.isNaN(e)){if(!t.set)throw new Error("Indexable class has read-only numeric index access");return t.set.call(o,e,n),!0}}return Object.defineProperty(o,r,{value:n,writable:!0,enumerable:!0,configurable:!0}),!0}})),r}const forwardArray=Symbol("forwardArray");class ArrayReadForward{get[forwardArray](){throw new Error("ArrayReadForward is not implemented")}get length(){return this[forwardArray].length}[Symbol.iterator](){return this[forwardArray][Symbol.iterator]()}map(e,t){return this[forwardArray].map(e,t)}filter(e,t){return this[forwardArray].filter(e,t)}reduce(e,t){return void 0!==t?this[forwardArray].reduce(e,t):this[forwardArray].reduce(e)}reduceRight(e,t){return void 0!==t?this[forwardArray].reduceRight(e,t):this[forwardArray].reduceRight(e)}forEach(e,t){this[forwardArray].forEach(e,t)}find(e,t){return this[forwardArray].find(e,t)}findIndex(e,t){return this[forwardArray].findIndex(e,t)}findLast(e,t){return this[forwardArray].findLast(e,t)}findLastIndex(e,t){return this[forwardArray].findLastIndex(e,t)}includes(e,t){return this[forwardArray].includes(e,t)}indexOf(e,t){return this[forwardArray].indexOf(e,t)}lastIndexOf(e,t){return this[forwardArray].lastIndexOf(e,t)}slice(e,t){return this[forwardArray].slice(e,t)}concat(...e){return this[forwardArray].concat(...e)}every(e,t){return this[forwardArray].every(e,t)}some(e,t){return this[forwardArray].some(e,t)}join(e){return this[forwardArray].join(e)}keys(){return this[forwardArray].keys()}values(){return this[forwardArray].values()}entries(){return this[forwardArray].entries()}toString(){return this[forwardArray].toString()}toLocaleString(e,t){return this[forwardArray].toLocaleString(e,t)}at(e){return this[forwardArray].at(e)}flat(e){return this[forwardArray].flat(e)}flatMap(e,t){return this[forwardArray].flatMap(e,t)}toReversed(){return this[forwardArray].toReversed?.()??[...this[forwardArray]].reverse()}toSorted(e){return this[forwardArray].toSorted?.(e)??[...this[forwardArray]].sort(e)}toSpliced(e,t,...r){return void 0===t?this[forwardArray].toSpliced(e):this[forwardArray].toSpliced(e,t,...r)}with(e,t){return this[forwardArray].with(e,t)}get[Symbol.unscopables](){return this[forwardArray][Symbol.unscopables]}}var _a,_b;class IterableWeakMap{constructor(e){if(this.uuids=new WeakMap,this.refs={},this[_a]="IterableWeakMap",this.registry=new FinalizationRegistry(e=>{delete this.refs[e]}),e)for(const[t,r]of e)this.set(t,r)}createIterator(e){const{refs:t}=this;return function*(){for(const r of Object.keys(t)){const[n,o]=t[r],i=n.deref();i?yield e(i,o):delete t[r]}}()}clear(){for(const e of Object.keys(this.refs)){const t=this.refs[e][0].deref();t&&this.registry.unregister(t)}this.uuids=new WeakMap,this.refs={}}delete(e){const t=this.uuids.get(e);return!!t&&(delete this.refs[t],this.uuids.delete(e),this.registry.unregister(e),!0)}forEach(e,t){for(const[r,n]of this)e.call(t??this,n,r,t??this)}get(e){const t=this.uuids.get(e);if(t)return this.refs[t][1]}has(e){return this.uuids.has(e)}set(e,t){let r=this.uuids.get(e);return r?this.refs[r][1]=t:(r=crypto.randomUUID(),this.uuids.set(e,r),this.refs[r]=[new WeakRef(e),t],this.registry.register(e,r,e)),this}get size(){return[...this].length}entries(){return this.createIterator((e,t)=>[e,t])}keys(){return this.createIterator((e,t)=>e)}values(){return this.createIterator((e,t)=>t)}[Symbol.iterator](){return this.entries()}}_a=Symbol.toStringTag;class IterableWeakSet{constructor(e){if(this.uuids=new WeakMap,this.refs={},this[_b]="IterableWeakSet",this.registry=new FinalizationRegistry(e=>{delete this.refs[e]}),e)for(const t of e)this.add(t)}createIterator(e){const{refs:t}=this;return function*(){for(const r of Object.keys(t)){const n=t[r].deref();n?yield e(n):delete t[r]}}()}clear(){for(const e of Object.keys(this.refs)){const t=this.refs[e].deref();t&&this.registry.unregister(t)}this.uuids=new WeakMap,this.refs={}}add(e){let t=this.uuids.get(e);return t||(t=crypto.randomUUID(),this.uuids.set(e,t),this.refs[t]=new WeakRef(e),this.registry.register(e,t,e)),this}delete(e){const t=this.uuids.get(e);return!!t&&(delete this.refs[t],this.uuids.delete(e),this.registry.unregister(e),!0)}forEach(e,t){for(const r of this)e.call(t??this,r,r,t??this)}has(e){return this.uuids.has(e)}get size(){return[...this].length}entries(){return this.createIterator(e=>[e,e])}keys(){return this.createIterator(e=>e)}values(){return this.createIterator(e=>e)}[Symbol.iterator](){return this.keys()}union(e){const t={[Symbol.iterator]:()=>e.keys()},r=this;return new Set(function*(){yield*r;for(const e of t)r.has(e)||(yield e)}())}intersection(e){const t=this;return new Set(function*(){for(const r of t)e.has(r)&&(yield r)}())}difference(e){const t=this;return new Set(function*(){for(const r of t)e.has(r)||(yield r)}())}symmetricDifference(e){const t={[Symbol.iterator]:()=>e.keys()},r=this;return new Set(function*(){for(const t of r)e.has(t)||(yield t);for(const e of t)r.has(e)||(yield e)}())}isSubsetOf(e){for(const t of this)if(!e.has(t))return!1;return!0}isSupersetOf(e){const t={[Symbol.iterator]:()=>e.keys()};for(const e of t)if(!this.has(e))return!1;return!0}isDisjointFrom(e){for(const t of this)if(e.has(t))return!1;return!0}}function mixin(e,t){const r=new WeakMap,n=e(Object);return r.set(Object,n),new Proxy(n,{apply(n,o,i){if(0===i.length)throw new Error("Mixin requires a base class");const s=i[0];if("function"!=typeof s)throw new Error("Mixin requires a constructor function");if(!(isConstructor(s)||s&&"function"==typeof s&&s.prototype))throw new Error("Mixin requires a valid constructor");const a=r.get(s);if(a)return a;let c=s;if(t){const e=class extends s{},r=s.prototype,n=new Proxy(r,{get(e,r,n){const o=ReflectGet(e,r,n);return"function"!=typeof o||"string"!=typeof r||["constructor","toString","valueOf"].includes(r)?o:function(...e){const r=t(this);return o.apply(r,e)}}});Object.setPrototypeOf(e.prototype,n),c=e}const l=e(c);return r.set(s,l),l}})}_b=Symbol.toStringTag;const effectToReactiveObjects=new WeakMap,watchers=new WeakMap,effectChildren=new WeakMap,effectParent=new WeakMap,reverseRoots=new WeakMap;function markWithRoot(e,t){const r=reverseRoots.get(t),n=r?.deref();if(n&&n!==e){const r=t.name||"anonymous",o=n.name||"anonymous",i=e.name||"anonymous";throw new Error(`[reactive] Abusive Shared Root detected: Root '${r}' is already identifying function '${o}'. Cannot reuse it for '${i}'. Shared roots cause lost updates and broken identity logic.`)}return reverseRoots.set(t,new WeakRef(e)),Object.defineProperty(e,rootFunction,{value:getRoot(t),writable:!1})}function getRoot(e){for(;e&&rootFunction in e;)e=e[rootFunction];return e}const trackingDisabledEffects=new WeakSet;let globalTrackingDisabled=!1;function setGlobalTrackingDisabled(e){globalTrackingDisabled=e}const EXTERNAL_SOURCE=Symbol("external-source");let devtoolsEnabled=!1;const debugEffectRegistry=new Set,debugObjectRegistry=new Set,effectNames=new WeakMap,objectNames=new WeakMap;let effectCounter=0,objectCounter=0;const triggerGraph=new Map;function ensureEffectName(e){let t=effectNames.get(e);if(!t){const r=getRoot(e);t=r?.name?.trim()||"effect_"+ ++effectCounter,effectNames.set(e,t)}return t}function ensureObjectName(e){let t=objectNames.get(e);if(!t){const r=e?.constructor?.name;t=`${r&&"Object"!==r?r:"object"}_${++objectCounter}`,objectNames.set(e,t)}return t}function describeProp(e,t){const r=ensureObjectName(e);return t===allProps?`${r}.*`:"symbol"==typeof t?`${r}.${t.description??t.toString()}`:`${r}.${String(t)}`}function addEffectToRegistry(e){if(!e||debugEffectRegistry.has(e))return;debugEffectRegistry.add(e);const t=effectToReactiveObjects.get(e);if(t)for(const e of t)documentObject(e)}function documentObject(e){debugObjectRegistry.has(e)||dbRegisterObject(e)}function dbRegisterObject(e){debugObjectRegistry.add(e),ensureObjectName(e)}function ensureParentChains(e){const t=Array.from(e);for(let r=0;r<t.length;r++){const n=t[r],o=effectParent.get(n);o&&!e.has(o)&&(e.add(o),t.push(o))}}function ensureTriggerContainers(e){let t=triggerGraph.get(e);return t||(t=new Map,triggerGraph.set(e,t)),t}function ensureTriggerRecord(e,t,r,n,o,i){const s=ensureTriggerContainers(e);let a=s.get(t);a||(a=new Map,s.set(t,a));let c=a.get(r);return c||(c={label:r,object:n,prop:o,evolution:i,count:0,lastTriggered:Date.now()},a.set(r,c)),c}function setEffectName(e,t){effectNames.set(e,t)}function setObjectName(e,t){objectNames.set(e,t),debugObjectRegistry.add(e)}function registerEffectForDebug(e){e&&devtoolsEnabled&&addEffectToRegistry(e)}function registerObjectForDebug(e){devtoolsEnabled&&documentObject(e)}function recordTriggerLink(e,t,r,n,o){if(options.introspection.enableHistory&&addToMutationHistory(e,t,r,n,o),!devtoolsEnabled)return;addEffectToRegistry(t),e&&addEffectToRegistry(e);const i=describeProp(r,n),s=ensureTriggerRecord(e??EXTERNAL_SOURCE,t,i,r,n,o);s.count+=1,s.lastTriggered=Date.now(),documentObject(r)}function getTriggerChain(e,t=5){const r=[];let n=e;for(let e=0;e<t;e++){let e,t="";e:for(const[r,o]of triggerGraph)for(const[i,s]of o)if(i===n){let n=0;for(const o of s.values())o.lastTriggered>n&&(n=o.lastTriggered,t=o.label,e=r===EXTERNAL_SOURCE?void 0:r);if(e||t)break e}if(!e){if(t){r.push(`External -> (${t}) -> ${ensureEffectName(n)}`);break}break}r.push(`${ensureEffectName(e)} -> (${t}) -> ${ensureEffectName(n)}`),n=e}return r.reverse()}function buildEffectNodes(e){const t=[],r=new Map,n=Array.from(e);for(const e of n){const n=ensureEffectName(e),o={id:`effect_${t.length}`,label:n,type:"effect",depth:0,debugName:n};t.push(o),r.set(e,o)}const o=new Map,i=e=>{if(!e)return 0;const t=o.get(e);if(void 0!==t)return t;const r=effectParent.get(e),n=i(r)+(r?1:0);return o.set(e,n),n};for(const[e,t]of r){t.depth=i(e);const n=effectParent.get(e);if(n){const e=r.get(n);e&&(t.parentId=e.id)}}return{nodes:t,nodeByEffect:r}}function buildReactivityGraph(){const e=[],t=[],r=new Map,n=new Set(debugEffectRegistry);ensureParentChains(n);const{nodes:o,nodeByEffect:i}=buildEffectNodes(n);for(const t of o)e.push(t);for(const[e,t]of i)r.set(e,t.id);for(const t of debugObjectRegistry){const n=`object_${e.length}`;e.push({id:n,label:ensureObjectName(t),type:"state",debugName:objectNames.get(t)}),r.set(t,n)}if(triggerGraph.has(EXTERNAL_SOURCE)){const t="effect_external";e.push({id:t,label:"External",type:"external",depth:0}),r.set(EXTERNAL_SOURCE,t)}for(const e of n){const n=r.get(e);if(!n)continue;const o=effectToReactiveObjects.get(e);if(o)for(const e of o){const o=r.get(e);o&&t.push({id:`${n}->${o}`,source:n,target:o,type:"dependency",label:"depends"})}}for(const[e,n]of triggerGraph)for(const[o,i]of n){const n=r.get(o);if(!n)continue;const s=r.get(e);if(s)for(const e of i.values())t.push({id:`${s}->${n}:${e.label}`,source:s,target:n,type:"cause",label:e.count>1?`${e.label} (${e.count})`:e.label,count:e.count})}return{nodes:e,edges:t,meta:{generatedAt:Date.now(),devtoolsEnabled:devtoolsEnabled}}}function enableDevTools(){"undefined"!=typeof window&&(devtoolsEnabled||(devtoolsEnabled=!0,window.__MUTTS_DEVTOOLS__={getGraph:buildReactivityGraph,setEffectName:setEffectName,setObjectName:setObjectName,registerEffect:registerEffectForDebug,registerObject:registerObjectForDebug}))}function isDevtoolsEnabled(){return devtoolsEnabled}const mutationHistory=[];let mutationCounter=0;function addToMutationHistory(e,t,r,n,o){const i={id:++mutationCounter,timestamp:Date.now(),source:e?ensureEffectName(e):"External",target:ensureEffectName(t),objectName:ensureObjectName(r),prop:String(n),type:o.type};mutationHistory.push(i),mutationHistory.length>options.introspection.historySize&&mutationHistory.shift()}const stack=[];function captureEffectStack(){return stack.slice()}function isRunning(e){const t=getRoot(e),r=stack.indexOf(t);if(-1!==r)return stack.slice(0,r+1).reverse();for(let e=0;e<stack.length;e++){let r=stack[e];const n=new WeakSet,o=[];for(;r&&!n.has(r);){n.add(r);const i=getRoot(r);if(o.push(i),i===t){const r=o.reverse();r[0]!==t&&r.unshift(t);const n=stack.slice(0,e+1).reverse();return r.length>0&&n.length>0&&n.shift(),[...r,...n]}r=effectParent.get(r)}}return!1}function withEffectStack(e,t){const r=stack.slice();assignStack(e);try{return t()}finally{assignStack(r)}}function getActiveEffect(){return stack[0]}function withEffect(e,t){if(getRoot(e)===getRoot(getActiveEffect()))return t();stack.unshift(e);try{return t()}finally{if(stack.shift()!==e)throw new ReactiveError("[reactive] Effect stack mismatch")}}function assignStack(e){stack.length=0,stack.push(...e)}const objectToProxy=new WeakMap,proxyToObject=new WeakMap;function storeProxyRelationship(e,t){objectToProxy.set(e,t),proxyToObject.set(t,e)}function getExistingProxy(e){return objectToProxy.get(e)}function trackProxyObject(e,t){proxyToObject.set(e,t)}function unwrap(e){let t=e;for(;t&&"object"==typeof t&&null!==t&&proxyToObject.has(t);)t=proxyToObject.get(t);return t}function isReactive(e){return proxyToObject.has(e)}function getTrackingDisabled(){const e=getActiveEffect();return e?trackingDisabledEffects.has(getRoot(e)):globalTrackingDisabled}function setTrackingDisabled(e){const t=getActiveEffect();if(!t)return void setGlobalTrackingDisabled(e);const r=getRoot(t);e?trackingDisabledEffects.add(r):trackingDisabledEffects.delete(r)}function dependant(e,t=allProps){e=unwrap(e);const r=getActiveEffect();!r||getTrackingDisabled()||"symbol"==typeof t&&t!==allProps||registerDependency(e,t,r)}function registerDependency(e,t,r){let n=watchers.get(e);n||(n=new Map,watchers.set(e,n));let o=n.get(t);o||(o=new Set,n.set(t,o)),o.add(r);const i=effectToReactiveObjects.get(r);i?i.add(e):effectToReactiveObjects.set(r,new Set([e]))}let zoneHooked=!1;const originalPromiseThen=Object.getOwnPropertyDescriptor(Promise.prototype,"then")?.value||Promise.prototype.then,originalPromiseCatch=Object.getOwnPropertyDescriptor(Promise.prototype,"catch")?.value||Promise.prototype.catch,originalPromiseFinally=Object.getOwnPropertyDescriptor(Promise.prototype,"finally")?.value||Promise.prototype.finally,originalSetTimeout=globalThis.setTimeout,originalSetInterval=globalThis.setInterval,originalRequestAnimationFrame=void 0!==globalThis.requestAnimationFrame?globalThis.requestAnimationFrame:void 0,originalQueueMicrotask=void 0!==globalThis.queueMicrotask?globalThis.queueMicrotask:void 0;let batchFn,activationRegistry;function ensureZoneHooked(e){e&&(batchFn=e),!zoneHooked&&options.asyncMode&&(hookZone(),zoneHooked=!0)}function hookZone(){Promise.prototype.then=function(e,t){const r=captureEffectStack();return originalPromiseThen.call(this,wrapCallback(e,r),wrapCallback(t,r))},Promise.prototype.catch=function(e){const t=captureEffectStack();return originalPromiseCatch.call(this,wrapCallback(e,t))},Promise.prototype.finally=function(e){const t=captureEffectStack();return originalPromiseFinally.call(this,wrapCallback(e,t))};const e=(e,t,...r)=>{const n=options.zones.setTimeout?captureEffectStack():void 0;return originalSetTimeout.apply(globalThis,[wrapCallback(e,n),t,...r])};Object.assign(e,originalSetTimeout),globalThis.setTimeout=e;const t=(e,t,...r)=>{const n=options.zones.setInterval?captureEffectStack():void 0;return originalSetInterval.apply(globalThis,[wrapCallback(e,n),t,...r])};Object.assign(t,originalSetInterval),globalThis.setInterval=t,originalRequestAnimationFrame&&(globalThis.requestAnimationFrame=e=>{const t=options.zones.requestAnimationFrame?captureEffectStack():void 0;return originalRequestAnimationFrame.call(globalThis,wrapCallback(e,t))}),originalQueueMicrotask&&(globalThis.queueMicrotask=e=>{const t=options.zones.queueMicrotask?captureEffectStack():void 0;originalQueueMicrotask.call(globalThis,wrapCallback(e,t))})}function wrapCallback(e,t){if(e)return t&&t.length||batchFn?(...r)=>{const n=()=>t?.length?withEffectStack(t,()=>e(...r)):e(...r);return batchFn?batchFn(n,"immediate"):n()}:e}function setZoneEnabled(e){e&&!zoneHooked?(hookZone(),zoneHooked=!0):!e&&zoneHooked&&(Promise.prototype.then=originalPromiseThen,Promise.prototype.catch=originalPromiseCatch,Promise.prototype.finally=originalPromiseFinally,globalThis.setTimeout=originalSetTimeout,globalThis.setInterval=originalSetInterval,originalRequestAnimationFrame&&(globalThis.requestAnimationFrame=originalRequestAnimationFrame),originalQueueMicrotask&&(globalThis.queueMicrotask=originalQueueMicrotask),zoneHooked=!1)}function isZoneEnabled(){return zoneHooked}function findCycleInChain(e){const t=new Map;for(let r=0;r<e.length;r++){const n=e[r];if(t.has(n))return e.slice(t.get(n));t.set(n,r)}return null}function formatRoots(e,t=20){const r=e.map(e=>e.name||"<anonymous>");if(r.length<=t)return r.join(" → ");const n=r.slice(0,5),o=r.slice(-10);return`${n.join(" → ")} ... (${r.length-15} more) ... ${o.join(" → ")}`}const activationLog=new Array(100);function getActivationLog(){return activationLog}function recordActivation(e,t,r,n){const o=getRoot(e);if(!activationRegistry)return;let i=activationRegistry.get(o);i||(i=new Map,activationRegistry.set(o,i));let s=i.get(t);s||(s=new Map,i.set(t,s));const a=(s.get(n)??0)+1;if(s.set(n,a),activationLog.unshift({effect:e,obj:t,evolution:r,prop:n}),activationLog.pop(),a>=options.maxTriggerPerBatch){const e=o?.name||"anonymous",t=`Aggressive trigger detected: effect "${e}" triggered ${a} times in the batch by the same cause.`;if("throw"===options.maxEffectReaction)throw new ReactiveError(t,{code:ReactiveErrorCode.MaxReactionExceeded,count:a,effect:e});options.warn(`[reactive] ${t}`)}}function trackEffect(e){const t=getActiveEffect();if(!t)throw new Error("Not in an effect");effectTrackers.has(t)?effectTrackers.get(t).add(e):effectTrackers.set(t,new Set([e]))}const effectTrackers=new WeakMap,opaqueEffects=new WeakSet,effectTriggers=new WeakMap,effectTriggeredBy=new WeakMap,causesClosure=new WeakMap,consequencesClosure=new WeakMap,effectCreationStacks=new WeakMap;function getOrCreateClosure(e,t){let r=e.get(t);return r||(r=new IterableWeakSet,e.set(t,r)),r}function addGraphEdge(e,t){const r=effectTriggers.get(e);if(r?.has(t))return;if(r)r.add(t);else{const r=new IterableWeakSet;r.add(t),effectTriggers.set(e,r)}let n=effectTriggeredBy.get(t);if(n||(n=new IterableWeakSet,effectTriggeredBy.set(t,n)),n.add(e),e===t)return;const o=getOrCreateClosure(consequencesClosure,e),i=getOrCreateClosure(causesClosure,t);o.add(t),i.add(e);const s=causesClosure.get(e);if(s)for(const e of s){if(e===t)continue;getOrCreateClosure(consequencesClosure,e).add(t),i.add(e)}const a=consequencesClosure.get(t);if(a)for(const t of a){if(t===e)continue;getOrCreateClosure(causesClosure,t).add(e),o.add(t)}if(s&&a)for(const e of s){const t=getOrCreateClosure(consequencesClosure,e);for(const r of a){if(e===r)continue;t.add(r);getOrCreateClosure(causesClosure,r).add(e)}}}function hasPathExcluding(e,t,r){if(e===t)return!0;if(e===r)return!1;const n=new Set,o=[e];for(n.add(e),n.add(r);o.length>0;){const e=o.shift(),r=effectTriggers.get(e);if(r)for(const e of r){if(e===t)return!0;n.has(e)||(n.add(e),o.push(e))}}return!1}function cleanupEffectFromGraph(e){const t=getRoot(e),r=causesClosure.get(t),n=consequencesClosure.get(t),o=effectTriggers.get(t);if(o){for(const e of o){const r=effectTriggeredBy.get(e);r?.delete(t)}effectTriggers.delete(t)}const i=effectTriggeredBy.get(t);if(i){for(const e of i){const r=effectTriggers.get(e);r?.delete(t)}effectTriggeredBy.delete(t)}if(r)for(const e of r){const r=consequencesClosure.get(e);if(r&&(r.delete(t),n))for(const o of n)hasPathExcluding(e,o,t)||r.delete(o)}if(n)for(const e of n){const n=causesClosure.get(e);if(n&&(n.delete(t),r))for(const o of r)hasPathExcluding(o,e,t)||n.delete(o)}if(r&&n)for(const e of r){const r=consequencesClosure.get(e);if(r)for(const o of n)if(!hasPathExcluding(e,o,t)){r.delete(o);const t=causesClosure.get(o);t?.delete(e)}}causesClosure.delete(t),consequencesClosure.delete(t)}let batchQueue;function hasBatched(e){return batchQueue?.all.has(getRoot(e))}const batchCleanups=new Set;function computeAllInDegrees(e){const t=getActiveEffect(),r=t?getRoot(t):null;e.inDegrees.clear();for(const[t]of e.all){let n=0;const o=causesClosure.get(t);if(o)for(const i of o)e.all.has(i)&&i!==r&&i!==t&&n++;e.inDegrees.set(t,n)}}function decrementInDegreesForExecuted(e,t){const r=consequencesClosure.get(t);if(r)for(const t of r)if(e.all.has(t)){const r=e.inDegrees.get(t)??0;r>0&&e.inDegrees.set(t,r-1)}}function findPath(e,t,r=new Set,n=[]){if(e===t)return[...n,t];if(r.has(e))return[];r.add(e);const o=[...n,e],i=effectTriggers.get(e);if(i)for(const e of i){const n=findPath(e,t,r,o);if(n.length>0)return n}return[]}function getCyclePathForEdge(e,t){const r=findPath(t,e);return r.length>0?[e,...r]:[]}function wouldCreateCycle(e,t){if(e===t)return!1;const r=consequencesClosure.get(t);return!!r?.has(e)}function addToBatch(e,t,r){const n=e[cleanup$1];if(n&&n(),e[stopped])return;if(!batchQueue)return;const o=getRoot(e);if(batchQueue.all.set(o,e),t&&!r){const r=getRoot(t);if(wouldCreateCycle(r,o)){const t=getCyclePathForEdge(r,o),n=t.length>0?`Cycle detected: ${t.map(e=>e.name||e.toString()).join(" → ")}`:`Cycle detected: ${r.name||r.toString()} → ${o.name||o.toString()} (and back)`,i=options.cycleHandling;if("strict"===i){batchQueue.all.delete(o);const r=getTriggerChain(e),i=effectCreationStacks.get(o);throw new ReactiveError(`[reactive] Strict Cycle Prevention: ${n}`,{code:ReactiveErrorCode.CycleDetected,cycle:t.map(e=>e.name||e.toString()),details:n,causalChain:r,creationStack:i})}switch(i){case"throw":{batchQueue.all.delete(o);const r=getTriggerChain(e),i=effectCreationStacks.get(o);throw new ReactiveError(`[reactive] ${n}`,{code:ReactiveErrorCode.CycleDetected,cycle:t.map(e=>e.name||e.toString()),details:n,causalChain:r,creationStack:i})}case"warn":return options.warn(`[reactive] ${n}`),void batchQueue.all.delete(o);case"break":return void batchQueue.all.delete(o)}}addGraphEdge(r,o)}}function addBatchCleanup(e){batchQueue?batchCleanups.add(e):e()}const defer=addBatchCleanup;function getCyclePath(e){const t=new Set,r=new Set,n=[];for(const[o]of e.all){if(t.has(o))continue;const i=findCycle(o,t,r,n,e);if(i.length>0)return i}return[]}function findCycle(e,t,r,n,o){if(r.has(e)){const t=n.indexOf(e);return n.slice(t).concat([e])}if(t.has(e))return[];t.add(e),r.add(e),n.push(e);const i=effectTriggers.get(e);if(i)for(const e of i)if(o.all.has(e)){const i=findCycle(e,t,r,n,o);if(i.length>0)return i}return n.pop(),r.delete(e),[]}function executeNext(e){let t=null,r=null;for(const[e,n]of batchQueue.all){if(0===(batchQueue.inDegrees.get(e)??0)){t=n,r=e;break}}if(!t){if(batchQueue.all.size>0){let e=getCyclePath(batchQueue);if(0===e.length)for(const[t]of batchQueue.all){const r=consequencesClosure.get(t);if(r){for(const n of r)if(n!==t&&batchQueue.all.has(n)){const r=consequencesClosure.get(n);if(r?.has(t)){e=[t,n,t];break}}if(e.length>0)break}}const t=e.length>0?`Cycle detected: ${e.map(e=>e.name||"<anonymous>").join(" → ")}`:"Cycle detected in effect batch - all effects have dependencies that prevent execution";switch(options.cycleHandling){case"throw":throw new ReactiveError(`[reactive] ${t}`);case"warn":{options.warn(`[reactive] ${t}`);const e=batchQueue.all.values().next().value;if(e){const t=getRoot(e);return batchQueue.all.delete(t),batchQueue.inDegrees.delete(t),e()}break}case"break":{const e=batchQueue.all.values().next().value;if(e){const t=getRoot(e);return batchQueue.all.delete(t),batchQueue.inDegrees.delete(t),e()}break}}}return null}e.push(getRoot(t));const n=t();return batchQueue.all.delete(r),batchQueue.inDegrees.delete(r),decrementInDegreesForExecuted(batchQueue,r),n}function batch(e,t){Array.isArray(e)||(e=[e]);const r=e.map(getRoot);if(batchQueue){options?.chain(r,getRoot(getActiveEffect()));const n=getActiveEffect();for(let r=0;r<e.length;r++)addToBatch(e[r],n,"immediate"===t);if(t){const t={};for(let r=0;r<e.length;r++)try{const n=e[r]();void 0===n||"value"in t||(t.value=n)}finally{const t=getRoot(e[r]);batchQueue.all.delete(t)}return t.value}}else{if(activationRegistry)throw new Error("Batch already in progress");activationRegistry=new Map,options.beginChain(r),batchQueue={all:new Map,inDegrees:new Map};const n=getActiveEffect();for(let r=0;r<e.length;r++)addToBatch(e[r],n,"immediate"===t);const o=[];if(computeAllInDegrees(batchQueue),t){const t={};try{for(let r=0;r<e.length;r++)try{const n=e[r]();void 0===n||"value"in t||(t.value=n)}finally{const t=getRoot(e[r]);batchQueue.all.delete(t)}for(;batchQueue.all.size>0;){if(o.length>options.maxEffectChain){const e=findCycleInChain(o),t=formatRoots(o),r=e?`Max effect chain reached (cycle detected: ${formatRoots(e)})`:`Max effect chain reached (trace: ${t})`,n=(batchQueue?Array.from(batchQueue.all.keys()):[]).map(e=>e.name||"<anonymous>"),i={code:ReactiveErrorCode.MaxDepthExceeded,effectuatedRoots:o,cycle:e,trace:t,maxEffectChain:options.maxEffectChain,queued:n.slice(0,50),queuedCount:n.length,causalChain:o.length>0?getTriggerChain(batchQueue.all.get(o[o.length-1])):[]};switch(options.maxEffectReaction){case"throw":case"debug":throw new ReactiveError(`[reactive] ${r}`,i);case"warn":options.warn(`[reactive] ${r} (queued: ${n.slice(0,10).join(", ")}${n.length>10?", …":""})`)}}if(!batchQueue||0===batchQueue.all.size)break;const e=executeNext(o);void 0===e||"value"in t||(t.value=e)}const r=Array.from(batchCleanups);batchCleanups.clear();for(const e of r)e();return t.value}finally{activationRegistry=void 0,batchQueue=void 0,options.endChain()}}else{const e={};try{for(;batchQueue.all.size>0||batchCleanups.size>0;){for(;batchQueue.all.size>0;){if(o.length>options.maxEffectChain){const e=findCycleInChain(o),t=formatRoots(o),r=e?`Max effect chain reached (cycle detected: ${formatRoots(e)})`:`Max effect chain reached (trace: ${t})`,n=(batchQueue?Array.from(batchQueue.all.keys()):[]).map(e=>e.name||"<anonymous>"),i={code:ReactiveErrorCode.MaxDepthExceeded,effectuatedRoots:o,cycle:e,trace:t,maxEffectChain:options.maxEffectChain,queued:n.slice(0,50),queuedCount:n.length,causalChain:o.length>0?getTriggerChain(batchQueue.all.get(o[o.length-1])):[]};switch(options.maxEffectReaction){case"throw":case"debug":throw new ReactiveError(`[reactive] ${r}`,i);case"warn":options.warn(`[reactive] ${r} (queued: ${n.slice(0,10).join(", ")}${n.length>10?", …":""})`)}}const t=executeNext(o);if(0===batchQueue.all.size)break;void 0===t||"value"in e||(e.value=t)}if(batchCleanups.size>0){const e=Array.from(batchCleanups);batchCleanups.clear();for(const t of e)t()}}return e.value}finally{activationRegistry=void 0,batchQueue=void 0,options.endChain()}}}}const atomic=decorator({method:e=>function(...t){const r=()=>e.apply(this,t);return Object.defineProperty(r,"name",{value:`atomic(${e.name})`}),batch(r,"immediate")},default:e=>function(...t){const r=()=>e.apply(this,t);return Object.defineProperty(r,"name",{value:`atomic(${e.name})`}),batch(r,"immediate")}}),fr=new FinalizationRegistry(e=>e());function effect(e,t){ensureZoneHooked(batch);const r=t?.asyncMode??options.asyncMode??"cancel";if(options.introspection.enableHistory){const t=(new Error).stack;if(t){const r=t.split("\n").slice(2).join("\n");effectCreationStacks.set(getRoot(e),r)}}let n=null;const o=captureEffectStack(),i=e=>withEffect(u,e),s=e=>withEffectStack(o,e);let a=!1,c=!1,l=null,f=null;function u(){if(n){const e=n;n=null,withEffect(void 0,()=>e())}if(l)if("cancel"===r&&f)f(),f=null,l=null;else if("ignore"===r)return;if(a)return;let t,o;options.enter(getRoot(e));try{if(o=withEffect(u,()=>e({tracked:i,ascend:s,reaction:c})),o&&"function"!=typeof o&&("object"!=typeof o||!("then"in o)))throw new ReactiveError(`[reactive] Effect returned a non-function value: ${o}`);if(o&&"object"==typeof o&&"function"==typeof o.then){const e=o;let t=null;const r=new Promise((e,r)=>{t=r}),n=new ReactiveError("[reactive] Effect canceled due to dependency change");l=Promise.race([e,r]),f=()=>{t&&t(n)}}else t=o}finally{c=!0,options.leave(e)}n=()=>{n=null,t?.();const e=effectToReactiveObjects.get(u);if(e){for(const t of e){const e=watchers.get(t);if(e){for(const[t,r]of e.entries())r.delete(u),0===r.size&&e.delete(t);0===e.size&&watchers.delete(t)}}effectToReactiveObjects.delete(u)}const r=effectChildren.get(u);if(r){for(const e of r)e();effectChildren.delete(u)}}}markWithRoot(u,e),t?.opaque&&opaqueEffects.add(u),isDevtoolsEnabled()&&registerEffectForDebug(u),batch(u,"immediate");const d=o[0];effectParent.set(u,d);const h=()=>{a||(a=!0,f&&(f(),f=null,l=null),n?.(),cleanupEffectFromGraph(u),fr.unregister(h))};function p(e){return Object.defineProperty(e,stopped,{get:()=>a}),Object.defineProperty(e,cleanup$1,{value:()=>{if(n){const e=n;n=null,withEffect(void 0,()=>e())}}}),e}if(!d){const t=p(()=>h());return fr.register(t,()=>{h(),options.garbageCollected(e)},h),t}let g=effectChildren.get(d);g||(g=new Set,effectChildren.set(d,g));const y=p(()=>{g.delete(y),0===g.size&&effectChildren.delete(d),h()});return g.add(y),y}function untracked(e){const t=getTrackingDisabled();setTrackingDisabled(!0);try{return e()}finally{setTrackingDisabled(t)}}function root(e){let t;return withEffect(void 0,()=>{t=e()}),t}function biDi(e,t,r){"function"!=typeof t&&(r=t.set,t=t.get);const n=getRoot(e);return effect(markWithRoot(()=>{e(t())},n)),atomic(e=>{r(e),batchQueue?.all.has(n)&&batchQueue.all.delete(n)})}const objectParents=new WeakMap,objectsWithDeepWatchers=new WeakSet,deepWatchers=new WeakMap,effectToDeepWatchedObjects=new WeakMap;function addBackReference(e,t,r){let n=objectParents.get(e);n||(n=new Set,objectParents.set(e,n)),n.add({parent:t,prop:r})}function removeBackReference(e,t,r){const n=objectParents.get(e);if(n){for(const e of n)if(e.parent===t&&e.prop===r){n.delete(e);break}0===n.size&&objectParents.delete(e)}}function needsBackReferences(e){return!!objectsWithDeepWatchers.has(e)||hasParentWithDeepWatchers(e)}function bubbleUpChange(e,t){const r=objectParents.get(e);if(r)for(const{parent:e}of r){const t=deepWatchers.get(e);if(t)for(const e of t)batch(e);bubbleUpChange(e)}}function hasParentWithDeepWatchers(e){const t=objectParents.get(e);if(!t)return!1;for(const{parent:e}of t){if(objectsWithDeepWatchers.has(e))return!0;if(hasParentWithDeepWatchers(e))return!0}return!1}const states=new WeakMap;function addState(e,t){const r={},n=getState(e=unwrap(e));n&&Object.assign(n,{evolution:t,next:r}),states.set(e,r)}function getState(e){e=unwrap(e);let t=states.get(e);return t||(t={},states.set(e,t)),t}function collectEffects(e,t,r,n,...o){const i=getActiveEffect();for(const s of o)for(const o of s){const s=n.get(o);if(s)for(const n of s){const s=isRunning(n);if(s){options.skipRunningEffect(n,s);continue}r.has(n)||(r.add(n),hasBatched(n)||recordActivation(n,e,t,o));const a=effectTrackers.get(n);if(recordTriggerLink(i,n,e,o,t),a){for(const r of a)r(e,t,o);a.delete(n)}}}}function touched1(e,t,r){touched(e,t,[r])}function touched(e,t,r){addState(e=unwrap(e),t);const n=watchers.get(e);if(n){const o=new Set;r?collectEffects(e,t,o,n,[allProps],r):collectEffects(e,t,o,n,n.keys()),options.touched(e,t,r,o),batch(Array.from(o))}objectsWithDeepWatchers.has(e)&&bubbleUpChange(e)}function touchedOpaque(e,t,r){e=unwrap(e);const n=watchers.get(e);if(!n)return;const o=n.get(r);if(!o)return;const i=new Set,s=getActiveEffect();for(const n of o){if(!opaqueEffects.has(n))continue;const o=isRunning(n);if(o){options.skipRunningEffect(n,o);continue}i.add(n),recordActivation(n,e,t,r);const a=effectTrackers.get(n);if(recordTriggerLink(s,n,e,r,t),a){for(const n of a)n(e,t,r);a.delete(n)}}i.size>0&&(options.touched(e,t,[r],i),batch(Array.from(i)))}const nonReactiveObjects=new WeakSet,immutables=new Set,absent=Symbol("absent");function markNonReactive(...e){for(const t of e){try{Object.defineProperty(t,nonReactiveMark,{value:!0,writable:!1,enumerable:!1,configurable:!1})}catch{}nonReactiveMark in t||nonReactiveObjects.add(t)}return e[0]}function nonReactiveClass(...e){for(const t of e)t&&(t.prototype[nonReactiveMark]=!0);return e[0]}function isNonReactive(e){if(null===e||"object"!=typeof e)return!0;if(nonReactiveObjects.has(e))return!0;if(e[nonReactiveMark])return!0;for(const t of immutables)if(t(e))return!0;return!1}function registerNativeReactivity(e,t){e.prototype[nativeReactive]=t,nonReactiveClass(t)}function isObject$1(e){return"object"==typeof e&&null!==e}function isObjectLike(e){return isObject$1(e)}function getPrototypeToken(e){if(isObjectLike(e)){if(Array.isArray(e))return Array.prototype;try{return e.constructor}catch{return}}}function shouldRecurseTouch(e,t){return e!==t&&(!(!isObjectLike(e)||!isObjectLike(t))&&(!isNonReactive(e)&&!isNonReactive(t)&&getPrototypeToken(e)===getPrototypeToken(t)))}function notifyPropertyChange(e,t,r,n,o){const i={type:o?"set":"add",prop:t};if(options.recursiveTouching&&void 0!==r&&shouldRecurseTouch(r,n)){const o={obj:unwrap(e),prop:t};dispatchNotifications(recursiveTouch(r,n,new WeakMap,[],o)),touchedOpaque(e,i,t)}else touched1(e,i,t)}function hasVisitedPair(e,t,r){let n=e.get(t);return n||(n=new WeakSet,e.set(t,n)),!!n.has(r)||(n.add(r),!1)}function collectObjectKeys(e){const t=new Set(Reflect.ownKeys(e));let r=Object.getPrototypeOf(e);for(;r&&!Object.hasOwn(r,"constructor");){for(const e of Reflect.ownKeys(r))t.add(e);r=Object.getPrototypeOf(r)}return t}function recursiveTouch(e,t,r=new WeakMap,n=[],o){return shouldRecurseTouch(e,t)&&isObjectLike(e)&&isObjectLike(t)?hasVisitedPair(r,e,t)?n:Array.isArray(e)&&Array.isArray(t)?(diffArrayElements(e,t,r,n,o),n):(diffObjectProperties(e,t,r,n,o),n):n}function diffArrayElements(e,t,r,n,o){const i=[],s=e.length,a=t.length,c=Math.max(s,a);for(let r=0;r<c;r++){const n=r<s,c=r<a;if(n&&!c){i.push({target:e,evolution:{type:"del",prop:r},prop:r,origin:o});continue}if(!n&&c){i.push({target:e,evolution:{type:"add",prop:r},prop:r,origin:o});continue}if(!n||!c)continue;const l=unwrap(e[r]),f=unwrap(t[r]);Object.is(l,f)||i.push({target:e,evolution:{type:"set",prop:r},prop:r,origin:o})}s!==a&&i.push({target:e,evolution:{type:"set",prop:"length"},prop:"length",origin:o}),n.push(...i)}function diffObjectProperties(e,t,r,n,o){const i=collectObjectKeys(e),s=collectObjectKeys(t),a=[];for(const t of i)s.has(t)||a.push({target:e,evolution:{type:"del",prop:t},prop:t,origin:o});for(const t of s)i.has(t)||a.push({target:e,evolution:{type:"add",prop:t},prop:t,origin:o});for(const c of s){if(!i.has(c))continue;const s=unwrap(e[c]),l=unwrap(t[c]);shouldRecurseTouch(s,l)?recursiveTouch(s,l,r,n,o):Object.is(s,l)||a.push({target:e,evolution:{type:"set",prop:c},prop:c,origin:o})}n.push(...a)}function hasAncestorInSet(e,t){let r=e;const n=new WeakSet;for(;r&&!n.has(r);){if(n.add(r),t.has(r))return!0;r=effectParent.get(r)}return!1}function dispatchNotifications(e){if(!e.length)return;const t=new Set,r=e[0]?.origin;let n;if(r){n=new Set;const e=watchers.get(r.obj);if(e){const t=new Set;collectEffects(r.obj,{type:"set",prop:r.prop},t,e,[allProps],[r.prop]);for(const e of t)n.add(e)}if(0===n.size)return}for(const{target:o,evolution:i,prop:s}of e){if(!isObjectLike(o))continue;const e=unwrap(o);addState(e,i);const a=watchers.get(e);let c;const l=[s];if(a){if(c=new Set,collectEffects(e,i,c,a,[allProps],l),r&&n){const e=new Set;for(const t of c)(n.has(t)||hasAncestorInSet(t,n))&&e.add(t);c=e}for(const e of c)t.add(e)}options.touched(e,i,l,c),objectsWithDeepWatchers.has(e)&&bubbleUpChange(e)}t.size&&batch([...t])}nonReactiveClass(Date,RegExp,Error,Promise,Function),"undefined"!=typeof window&&(markNonReactive(window,document),nonReactiveClass(Node,Element,HTMLElement,EventTarget));const hasReentry=[],reactiveHandlers={[Symbol.toStringTag]:"MutTs Reactive",get(e,t,r){if(t===nonReactiveMark)return!1;const n=unwrap(e);if(n[unreactiveProperties]?.has(t)||"symbol"==typeof t)return ReflectGet(e,t,r);prototypeForwarding in e&&e[prototypeForwarding]instanceof Array&&"string"==typeof t&&("length"===t||!Number.isNaN(Number(t)))&&dependant(e,"length"===t?"length":Number(t));const o=Reflect.has(r,t),i=o&&Object.hasOwn(r,t),s=o&&!i,a=options.ignoreAccessors&&i&&(isOwnAccessor(r,t)||isOwnAccessor(n,t));if(o&&(options.instanceMembers&&s&&e instanceof Object||a)||dependant(e,t),s&&(!options.instanceMembers||!(e instanceof Object))){let r=reactiveObject(Object.getPrototypeOf(e));for(;r&&r!==Object.prototype&&(dependant(r,t),!Object.hasOwn(r,t));){let e=reactiveObject(Object.getPrototypeOf(r));e===r&&(e=reactiveObject(Object.getPrototypeOf(unwrap(r)))),r=e}}const c=ReflectGet(e,t,r);if("object"==typeof c&&null!==c){const r=reactiveObject(c);return needsBackReferences(e)&&addBackReference(r,e,t),r}return c},set(e,t,r,n){const o=unwrap(e),i=unwrap(n);if(o[unreactiveProperties]?.has(t)||o!==i)return ReflectSet(e,t,r,n);const s=prototypeForwarding in e&&e[prototypeForwarding]instanceof Array&&(!Number.isNaN(Number(t))||"length"===t),a=unwrap(r);if(s)return e[t]=a,!0;let c=absent;if(Reflect.has(i,t)){Object.getOwnPropertyDescriptor(i,t),Object.getOwnPropertyDescriptor(o,t);c=withEffect(void 0,()=>Reflect.get(o,t,n))}if(objectsWithDeepWatchers.has(e)&&("object"==typeof c&&null!==c&&removeBackReference(c,e,t),"object"==typeof a&&null!==a)){addBackReference(reactiveObject(a),e,t)}return c!==a&&ReflectSet(e,t,a,n)&&notifyPropertyChange(e,t,c,a,c!==absent),!0},has(e,t){if(hasReentry.includes(e))throw new ReactiveError(`[reactive] Circular dependency detected in 'has' check for property '${String(t)}'`,{code:ReactiveErrorCode.CycleDetected,cycle:[]});hasReentry.push(e),dependant(e,t);const r=Reflect.has(e,t);return hasReentry.pop(),r},deleteProperty(e,t){if(!Object.hasOwn(e,t))return!1;const r=e[t];return objectsWithDeepWatchers.has(e)&&"object"==typeof r&&null!==r&&removeBackReference(r,e,t),delete e[t],touched1(e,{type:"del",prop:t},t),objectsWithDeepWatchers.has(e)&&bubbleUpChange(e),!0},getPrototypeOf:e=>prototypeForwarding in e?e[prototypeForwarding]:Object.getPrototypeOf(e),setPrototypeOf:(e,t)=>!(prototypeForwarding in e)&&(Object.setPrototypeOf(e,t),!0),ownKeys:e=>(dependant(e,allProps),Reflect.ownKeys(e))},reactiveClasses=new WeakSet,ReactiveBase=mixin(e=>class extends e{constructor(...e){return super(...e),reactiveClasses.has(new.target)?reactive(this):this}});function reactiveObject(e){if(!e||"object"!=typeof e)return e;const t=e;if(isNonReactive(t))return t;if(proxyToObject.has(t))return t;const r=getExistingProxy(t);if(void 0!==r)return r;const n=!(nativeReactive in t)||t instanceof t[nativeReactive]?t:new t[nativeReactive](t);n!==t&&trackProxyObject(n,t);const o=new Proxy(n,reactiveHandlers);return storeProxyRelationship(t,o),o}const reactive=decorator({class(e){if(e.prototype instanceof ReactiveBase)return reactiveClasses.add(e),e;class t extends e{constructor(...r){return super(...r),new.target===t||reactiveClasses.has(new.target)||options.warn(`${e.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.`),reactive(this)}}return Object.defineProperty(t,"name",{value:`Reactive<${e.name}>`}),t},get:e=>reactiveObject(e),default:reactiveObject});function isObject(e){return"object"==typeof e&&null!==e}function deepWatch(e,t,{immediate:r=!1}={}){if(null==e)return;if("object"!=typeof e)throw new Error("Target of deep watching must be an object");const n=markWithRoot(()=>t(e),t);return effect(()=>{objectsWithDeepWatchers.add(e);let o=effectToDeepWatchedObjects.get(n);o||(o=new Set,effectToDeepWatchedObjects.set(n,o)),o.add(e);const i=new WeakSet;return function e(t,r=0){if(t&&!i.has(t)&&isObject(t)&&!(r>options.maxDeepWatchDepth)&&!isNonReactive(t)){i.add(t),objectsWithDeepWatchers.add(t),o.add(t);for(const n in unwrap(t))if(Object.hasOwn(t,n)){const o=t[n];e("object"==typeof o&&null!==o?reactive(o):o,r+1)}if(Array.isArray(t)||t instanceof Array){const n=t.length;for(let o=0;o<n;o++){const n=t[o];e("object"==typeof n&&null!==n?reactive(n):n,r+1)}}else if(t instanceof Set)for(const n of t){e("object"==typeof n&&null!==n?reactive(n):n,r+1)}else if(t instanceof Map)for(const[n,o]of t){e("object"==typeof o&&null!==o?reactive(o):o,r+1)}}}(e),r&&t(e),r=!0,()=>{const e=effectToDeepWatchedObjects.get(n);if(e){for(const t of e){const e=deepWatchers.get(t);e?(e.delete(n),0===e.size&&(deepWatchers.delete(t),objectsWithDeepWatchers.delete(t))):objectsWithDeepWatchers.delete(t)}effectToDeepWatchedObjects.delete(n)}}})}const cleanup=Symbol("cleanup"),unsetYet=Symbol("unset-yet");function watch(e,t,r={}){return"function"==typeof e?watchCallBack(e,t,r):"object"==typeof e&&null!==e?watchObject(e,t,r):(()=>{throw new Error("watch: value must be a function or an object")})()}function watchObject(e,t,{immediate:r=!1,deep:n=!1}={}){const o=getActiveEffect();return n?deepWatch(e,t,{immediate:r}):effect(function(){dependant(e),r&&withEffect(o,()=>t(e)),r=!0})}function watchCallBack(e,t,{immediate:r=!1,deep:n=!1}={}){const o=getActiveEffect();let i,s=unsetYet;const a=effect(markWithRoot(function(a){const c=e(a);s!==c&&withEffect(o,()=>{s===unsetYet?r&&t(c):t(c,s),s=c,n&&(i&&i(),i=deepWatch(c,e=>t(e,e)))})},e));return()=>{a(),i&&i()}}function deepNonReactive(e){if(isNonReactive(e=unwrap(e)))return e;try{Object.defineProperty(e,nonReactiveMark,{value:!0,writable:!1,enumerable:!1,configurable:!0})}catch{}return nonReactiveMark in e||nonReactiveObjects.add(e),e}function unreactiveApplication(e,...t){return"object"==typeof e?deepNonReactive(e):r=>{r.prototype[unreactiveProperties]=new Set(r.prototype[unreactiveProperties]||[]),r.prototype[unreactiveProperties].add(e);for(const e of t)r.prototype[unreactiveProperties].add(e);return r}}const unreactive=decorator({class(e){nonReactiveClass(e)},default:unreactiveApplication});function cleanedBy(e,t){return Object.defineProperty(e,cleanup,{value:t,writable:!1,enumerable:!1,configurable:!0})}function derived(e){const t={value:void 0};return cleanedBy(t,untracked(()=>effect(function(r){t.value=e(r)})))}function*makeReactiveIterator(e){let t=e.next();for(;!t.done;)yield reactive(t.value),t=e.next()}function*makeReactiveEntriesIterator(e){let t=e.next();for(;!t.done;){const[r,n]=t.value;yield[reactive(r),reactive(n)],t=e.next()}}const native$2=Symbol("native"),isArray=Array.isArray;Array.isArray=e=>isArray(e)||e&&"object"==typeof e&&prototypeForwarding in e&&Array.isArray(e[prototypeForwarding]);class ReactiveBaseArray{at(e){const t=e<0?this[native$2].length+e:e;if(dependant(this,t),!(t<0||t>=this[native$2].length))return reactive(this[native$2][t])}toReversed(){return dependant(this),reactive(this[native$2].toReversed())}toSorted(e){return dependant(this),reactive(this[native$2].toSorted(e))}toSpliced(e,t,...r){return dependant(this),void 0===t?this[native$2].toSpliced(e):this[native$2].toSpliced(e,t,...r)}with(e,t){return dependant(this),reactive(this[native$2].with(e,t))}entries(){return dependant(this),makeReactiveEntriesIterator(this[native$2].entries())}keys(){return dependant(this,"length"),this[native$2].keys()}values(){return dependant(this),makeReactiveIterator(this[native$2].values())}[Symbol.iterator](){dependant(this);const e=this[native$2][Symbol.iterator]();return{next(){const t=e.next();return t.done?t:{value:reactive(t.value),done:!1}}}}indexOf(e,t){dependant(this);const r=unwrap(e),n=this[native$2].indexOf(r,t);return-1!==n?n:this[native$2].indexOf(e,t)}lastIndexOf(e,t){dependant(this);const r=unwrap(e),n=this[native$2].lastIndexOf(r,t);return-1!==n?n:this[native$2].lastIndexOf(e,t)}includes(e,t){dependant(this);const r=unwrap(e);return this[native$2].includes(r,t)||this[native$2].includes(e,t)}find(e,t){if(dependant(this),"function"==typeof e){const r=e;return reactive(this[native$2].find((e,n,o)=>r.call(t,reactive(e),n,o),t))}const r="number"==typeof t?t:void 0,n=this[native$2].indexOf(e,r);if(-1!==n)return reactive(this[native$2][n])}findIndex(e,t){if(dependant(this),"function"==typeof e){const r=e;return this[native$2].findIndex((e,n,o)=>r.call(t,reactive(e),n,o),t)}const r="number"==typeof t?t:void 0;return this[native$2].indexOf(e,r)}flat(){return dependant(this),reactive(this[native$2].flat())}flatMap(e,t){return dependant(this),reactive(this[native$2].flatMap(e,t))}filter(e,t){return dependant(this),reactive(this[native$2].filter((t,r,n)=>e(reactive(t),r,n),t))}map(e,t){return dependant(this),reactive(this[native$2].map((t,r,n)=>e(reactive(t),r,n),t))}reduce(e,t){dependant(this);const r=void 0===t?this[native$2].reduce(e):this[native$2].reduce(e,t);return reactive(r)}reduceRight(e,t){dependant(this);const r=void 0!==t?this[native$2].reduceRight(e,t):this[native$2].reduceRight(e);return reactive(r)}slice(e,t){for(const r of range(e||0,t||this[native$2].length-1))dependant(this,r);return void 0===e?this[native$2].slice():void 0===t?this[native$2].slice(e):this[native$2].slice(e,t)}concat(...e){return dependant(this),reactive(this[native$2].concat(...e))}join(e){return dependant(this),this[native$2].join(e)}forEach(e,t){dependant(this),this[native$2].forEach((r,n,o)=>{e.call(t,reactive(r),n,o)})}every(e,t){return dependant(this),this[native$2].every((r,n,o)=>e.call(t,reactive(r),n,o),t)}some(e,t){return dependant(this),this[native$2].some((r,n,o)=>e.call(t,reactive(r),n,o),t)}}function*index(e,{length:t=!0}={}){t&&(yield"length"),yield e}function*range(e,t,{length:r=!1}={}){const n=Math.min(e,t),o=Math.max(e,t);r&&(yield"length");for(let e=n;e<=o;e++)yield e}class ReactiveArray extends(Indexable(ReactiveBaseArray,{get(e){return dependant(this,e),reactive(this[native$2][e])},set(e,t){const r=e>=this[native$2].length;this[native$2][e]=t,touched(this,{type:"set",prop:e},index(e,{length:r}))},getLength(){return dependant(this,"length"),this[native$2].length},setLength(e){const t=this[native$2].length;try{this[native$2].length=e}finally{touched(this,{type:"set",prop:"length"},range(t,e,{length:!0}))}}})){constructor(e){super(),Object.defineProperties(this,{[native$2]:{value:e},[prototypeForwarding]:{value:e}})}push(...e){const t=this[native$2].length;try{return this[native$2].push(...e)}finally{touched(this,{type:"bunch",method:"push"},range(t,t+e.length-1,{length:!0}))}}pop(){if(0!==this[native$2].length)try{return reactive(this[native$2].pop())}finally{touched(this,{type:"bunch",method:"pop"},index(this[native$2].length))}}shift(){if(0!==this[native$2].length)try{return reactive(this[native$2].shift())}finally{touched(this,{type:"bunch",method:"shift"},range(0,this[native$2].length+1,{length:!0}))}}unshift(...e){try{return this[native$2].unshift(...e)}finally{touched(this,{type:"bunch",method:"unshift"},range(0,this[native$2].length-e.length,{length:!0}))}}splice(e,t,...r){const n=this[native$2].length;void 0===t&&(t=n-e);try{return reactive(void 0===t?this[native$2].splice(e):this[native$2].splice(e,t,...r))}finally{touched(this,{type:"bunch",method:"splice"},t===r.length?range(e,e+t):range(e,n+Math.max(r.length-t,0),{length:!0}))}}reverse(){try{return this[native$2].reverse()}finally{touched(this,{type:"bunch",method:"reverse"},range(0,this[native$2].length-1))}}sort(e){e=e||((e,t)=>e.toString().localeCompare(t.toString()));try{return this[native$2].sort((t,r)=>e(reactive(t),reactive(r)))}finally{touched(this,{type:"bunch",method:"sort"},range(0,this[native$2].length-1))}}fill(e,t,r){try{return void 0===t?this[native$2].fill(e):void 0===r?this[native$2].fill(e,t):this[native$2].fill(e,t,r)}finally{touched(this,{type:"bunch",method:"fill"},range(0,this[native$2].length-1))}}copyWithin(e,t,r){try{return void 0===r?this[native$2].copyWithin(e,t):this[native$2].copyWithin(e,t,r)}finally{touched(this,{type:"bunch",method:"copyWithin"},range(0,this[native$2].length-1))}}}class ReadOnlyError extends Error{}class ReactiveReadOnlyArrayClass extends(Indexable(ReactiveBaseArray,{get(e){return dependant(this,e),reactive(this[native$2][e])},set(e,t){throw new ReadOnlyError(`Setting index ${e} on a read-only array`)},getLength(){return dependant(this,"length"),this[native$2].length},setLength(e){throw new ReadOnlyError(`Setting length to ${e} on a read-only array`)}})){constructor(e){super(),Object.defineProperties(this,{[native$2]:{value:e},[prototypeForwarding]:{value:e}})}push(...e){throw new ReadOnlyError("Pushing items to a read-only array")}pop(){throw new ReadOnlyError("Popping from a read-only array")}shift(){throw new ReadOnlyError("Shifting from a read-only array")}unshift(...e){throw new ReadOnlyError("Unshifting items to a read-only array")}splice(e,t,...r){throw new ReadOnlyError("Splice from a read-only array")}reverse(){throw new ReadOnlyError("Reversing a read-only array")}sort(e){throw new ReadOnlyError("Sorting a read-only array")}fill(e,t,r){throw new ReadOnlyError("Filling a read-only array")}copyWithin(e,t,r){throw new ReadOnlyError("Copying within a read-only array")}}const ReactiveReadOnlyArray=reactive(ReactiveReadOnlyArrayClass);function mapped(e,t,r){const n=[],o=new ReactiveReadOnlyArray(n),i=[];function s(r){return effect(function(){n[r]=t(e[r],r,o),touched1(o,{type:"set",prop:r},r)})}const a=effect(function({ascend:t}){const a=e.length,c=untracked(()=>n.length);if(r?.(a,c),touched1(o,{type:"set",prop:"length"},"length"),a<c){const e=i.splice(a);for(const t of e)t();n.length=a}else a>c&&t(function(){for(let e=c;e<a;e++)i.push(s(e))})});return cleanedBy(o,()=>{for(const e of i)e();i.length=0,a()})}function reduced(e,t){const r=[],n=new ReactiveReadOnlyArray(r),o=effect(function(){const o={};r.length=0;for(const n of e)r.push(...t(n,o));touched(n,{type:"invalidate",prop:"reduced"})});return cleanedBy(n,o)}const memoizedRegistry=new WeakMap,wrapperRegistry=new WeakMap;function getBranch(e,t){e.branches??(e.branches=new WeakMap);let r=e.branches.get(t);return r||(r={},e.branches.set(t,r)),r}function memoizeFunction(e){const t=getRoot(e),r=memoizedRegistry.get(t);if(r)return r;const n={},o=markWithRoot((...t)=>{const r=t;if(r.some(e=>!(e&&["object","symbol","function"].includes(typeof e))))throw new Error("memoize expects non-null object arguments");let o=n;for(const e of r)o=getBranch(o,e);if(dependant(o,"memoize"),"result"in o){if(options.onMemoizationDiscrepancy){const t=options.isVerificationRun;options.isVerificationRun=!0;try{const t=untracked(()=>e(...r));deepCompare(o.result,t)||options.onMemoizationDiscrepancy(o.result,t,e,r,"calculation")}finally{options.isVerificationRun=t}}return o.result}if(o.cleanup=root(()=>effect(()=>(o.result=e(...r),()=>{delete o.result,touched1(o,{type:"invalidate",prop:r},"memoize"),o.cleanup&&(o.cleanup(),o.cleanup=void 0)}),{opaque:!0})),options.onMemoizationDiscrepancy){const t=options.isVerificationRun;options.isVerificationRun=!0;try{const t=untracked(()=>e(...r));deepCompare(o.result,t)||options.onMemoizationDiscrepancy(o.result,t,e,r,"comparison")}finally{options.isVerificationRun=t}}return o.result},e);return memoizedRegistry.set(t,o),memoizedRegistry.set(o,o),o}const memoize=decorator({getter:(e,t,r)=>function(){let n=wrapperRegistry.get(e);n||(n=markWithRoot(renamed(t=>e.call(t),`${String(t?.constructor?.name??t?.name??"Object")}.${String(r)}`),{method:e,propertyKey:r,...e[rootFunction]?{[rootFunction]:e[rootFunction]}:{}}),wrapperRegistry.set(e,n));return memoizeFunction(n)(this)},method:(e,t,r)=>function(...n){let o=wrapperRegistry.get(e);o||(o=markWithRoot(renamed((t,...r)=>e.call(t,...r),`${String(t?.constructor?.name??t?.name??"Object")}.${String(r)}`),{method:e,propertyKey:r,...e[rootFunction]?{[rootFunction]:e[rootFunction]}:{}}),wrapperRegistry.set(e,o));return memoizeFunction(o)(this,...n)},default:memoizeFunction});function getRegisterBase(){class e extends(Indexable(ArrayReadForward,{get(e){return this[getAt](e)},set(e,t){this[setAt](e,t)},getLength(){return this.length},setLength(e){this.length=e}})){toArray(){return Array.from(this)}}return e}let RegisterClass=(()=>{var e,t,r,n,o,i,s,a,c;let l,f,u=[unreactive],d=[],h=getRegisterBase();return f=class extends h{get[(t=new WeakMap,r=new WeakMap,n=new WeakMap,o=new WeakMap,i=new WeakMap,s=new WeakMap,a=new WeakMap,e=new WeakSet,forwardArray)](){return this.toArray()}constructor(c,l){let f;if(super(),e.add(this),t.set(this,void 0),r.set(this,void 0),n.set(this,void 0),o.set(this,new Map),i.set(this,new Map),s.set(this,new Set),a.set(this,void 0),effect(({ascend:e})=>{f=e}),__classPrivateFieldSet(this,a,f,"f"),"function"!=typeof c)throw new Error("Register requires a key function");__classPrivateFieldSet(this,t,c,"f"),__classPrivateFieldSet(this,r,reactive([]),"f"),__classPrivateFieldSet(this,n,reactive(new Map),"f"),Object.defineProperties(this,{[prototypeForwarding]:{value:__classPrivateFieldGet(this,r,"f")}}),l&&this.push(...l)}ensureKey(r){let n=__classPrivateFieldGet(this,i,"f").get(r);if(n)return n.key;if(n={key:void 0},__classPrivateFieldGet(this,i,"f").set(r,n),__classPrivateFieldGet(this,a,"f").call(this,()=>{const o=effect(({reaction:o})=>{const i=__classPrivateFieldGet(this,t,"f").call(this,r);this.assertValidKey(i);const s=n.key;o&&void 0!==s&&!Object.is(i,s)&&__classPrivateFieldGet(this,e,"m",c).call(this,r,s,i),n.key=i});n.stop=o,__classPrivateFieldGet(this,s,"f").add(o)}),void 0===n.key)throw new Error("Register key function must return a property key");return n.key}assertValidKey(e){const t=typeof e;if("string"!==t&&"number"!==t&&"symbol"!==t)throw new Error("Register key function must return a property key")}setKeyValue(e,t){const r=__classPrivateFieldGet(this,n,"f").get(e);void 0!==r&&r!==t&&this.cleanupValue(r),__classPrivateFieldGet(this,n,"f").set(e,t)}cleanupValue(e){const t=__classPrivateFieldGet(this,i,"f").get(e);if(!t)return;const r=t.stop;r&&(t.stop=void 0,__classPrivateFieldGet(this,s,"f").delete(r),r()),__classPrivateFieldGet(this,i,"f").delete(e)}disposeKeyEffects(){for(const e of Array.from(__classPrivateFieldGet(this,i,"f").keys()))this.cleanupValue(e);__classPrivateFieldGet(this,s,"f").clear()}incrementUsage(e){const t=__classPrivateFieldGet(this,o,"f").get(e)??0;__classPrivateFieldGet(this,o,"f").set(e,t+1)}decrementUsage(e){const t=__classPrivateFieldGet(this,o,"f").get(e);if(t)if(t<=1){const t=__classPrivateFieldGet(this,n,"f").get(e);__classPrivateFieldGet(this,o,"f").delete(e),__classPrivateFieldGet(this,n,"f").delete(e),void 0!==t&&this.cleanupValue(t)}else __classPrivateFieldGet(this,o,"f").set(e,t-1)}normalizeIndex(e,t=!1){const r=this.length;let n=e;if(n<0&&(n=Math.max(r+n,0)),n>r){if(!t)throw new RangeError("Index out of bounds");n=r}if(!t&&n===r)throw new RangeError("Index out of bounds");return n}assignAt(e,t,n){const o=__classPrivateFieldGet(this,r,"f")[e];void 0!==o&&Object.is(o,t)||(void 0!==o&&this.decrementUsage(o),__classPrivateFieldGet(this,r,"f")[e]=t,this.incrementUsage(t)),this.setKeyValue(t,n)}insertKeyValue(e,t,n){__classPrivateFieldGet(this,r,"f").splice(e,0,t),this.incrementUsage(t),this.setKeyValue(t,n)}rebuildFrom(e){this.disposeKeyEffects(),__classPrivateFieldGet(this,r,"f").splice(0,__classPrivateFieldGet(this,r,"f").length),__classPrivateFieldGet(this,o,"f").clear(),__classPrivateFieldGet(this,n,"f").clear();for(const t of e){const e=this.ensureKey(t);__classPrivateFieldGet(this,r,"f").push(e),this.incrementUsage(e),__classPrivateFieldGet(this,n,"f").set(e,t)}}get length(){return __classPrivateFieldGet(this,r,"f").length}[(c=function(e,t,s){if(Object.is(t,s))return;const a=__classPrivateFieldGet(this,n,"f").get(s);if(void 0!==a&&a!==e)throw new Error(`Register key collision for key ${String(s)}`);const c=__classPrivateFieldGet(this,o,"f").get(t);if(!c)return;const l=__classPrivateFieldGet(this,o,"f").get(s)??0;this.setKeyValue(s,e);for(let e=0;e<__classPrivateFieldGet(this,r,"f").length;e++)Object.is(__classPrivateFieldGet(this,r,"f")[e],t)&&(__classPrivateFieldGet(this,r,"f")[e]=s);__classPrivateFieldGet(this,o,"f").set(s,l+c),__classPrivateFieldGet(this,o,"f").delete(t),__classPrivateFieldGet(this,n,"f").delete(t);const f=__classPrivateFieldGet(this,i,"f").get(e);f&&(f.key=s)},getAt)](e){const t=__classPrivateFieldGet(this,r,"f")[e];return void 0===t?void 0:__classPrivateFieldGet(this,n,"f").get(t)}[setAt](e,t){const r=this.ensureKey(t);if(e===this.length)return void this.insertKeyValue(e,r,t);const n=this.normalizeIndex(e);this.assignAt(n,r,t)}push(...e){for(const t of e){const e=this.ensureKey(t);this.insertKeyValue(this.length,e,t)}return this.length}pop(){if(this.length)return this.removeAt(this.length-1)}shift(){if(this.length)return this.removeAt(0)}unshift(...e){let t=0;for(const r of e){const e=this.ensureKey(r);this.insertKeyValue(t++,e,r)}return this.length}splice(e,t,...o){const i=this.normalizeIndex(e,!0),s=this.length-i,a=Math.min(void 0===t?s:Math.max(t,0),s),c=[];for(const e of o)c.push(this.ensureKey(e));const l=__classPrivateFieldGet(this,r,"f").splice(i,a,...c),f=[];for(const e of l){if(void 0===e)continue;const t=__classPrivateFieldGet(this,n,"f").get(e);this.decrementUsage(e),f.push(t)}for(let e=0;e<c.length;e++){const t=c[e],r=o[e];this.incrementUsage(t),this.setKeyValue(t,r)}return f}clear(){__classPrivateFieldGet(this,r,"f").length=0,__classPrivateFieldGet(this,o,"f").clear(),__classPrivateFieldGet(this,n,"f").clear(),this.disposeKeyEffects()}get(e){return __classPrivateFieldGet(this,n,"f").get(e)}set(e,t){__classPrivateFieldGet(this,n,"f").has(e)&&this.setKeyValue(e,t)}remove(e){let t=this.indexOfKey(e);for(;-1!==t;)this.removeAt(t),t=this.indexOfKey(e)}removeAt(e){const[t]=__classPrivateFieldGet(this,r,"f").splice(e,1);if(void 0===t)return;const o=__classPrivateFieldGet(this,n,"f").get(t);return this.decrementUsage(t),o}keep(e){const t=new Map;for(const[o,i]of __classPrivateFieldGet(this,r,"f").entries()){if(t.has(i)){t.get(i)||this.removeAt(o);continue}const r=e(__classPrivateFieldGet(this,n,"f").get(i));t.set(i,r),r||this.removeAt(o)}}hasKey(e){return __classPrivateFieldGet(this,o,"f").has(e)}indexOfKey(e){return __classPrivateFieldGet(this,r,"f").indexOf(e)}mapKeys(){return __classPrivateFieldGet(this,n,"f").keys()}update(...e){for(const t of e){const e=this.ensureKey(t);__classPrivateFieldGet(this,n,"f").has(e)&&this.setKeyValue(e,t)}}upsert(e,...t){for(const r of t){const t=this.ensureKey(r);__classPrivateFieldGet(this,n,"f").has(t)?this.setKeyValue(t,r):e(r)}}entries(){const e=this;return function*(){for(let t=0;t<__classPrivateFieldGet(e,r,"f").length;t++){const o=__classPrivateFieldGet(e,n,"f").get(__classPrivateFieldGet(e,r,"f")[t]);void 0!==o&&(yield[t,o])}}()}[Symbol.iterator](){const e=this;return function*(){for(const t of __classPrivateFieldGet(e,r,"f")){const r=__classPrivateFieldGet(e,n,"f").get(t);void 0!==r&&(yield r)}}()}toString(){return`[Register length=${this.length}]`}at(e){const t=e<0?this.length+e:e;if(!(t<0||t>=this.length))return this[getAt](t)}reverse(){return __classPrivateFieldGet(this,r,"f").reverse(),this}sort(e){const t=e?(t,r)=>e(__classPrivateFieldGet(this,n,"f").get(t),__classPrivateFieldGet(this,n,"f").get(r)):void 0;return __classPrivateFieldGet(this,r,"f").sort(t),this}fill(e,t=0,r=this.length){const n=this.toArray();return n.fill(e,t,r),this.rebuildFrom(n),this}copyWithin(e,t,r){const n=this.toArray();return n.copyWithin(e,t,r),this.rebuildFrom(n),this}},__setFunctionName(f,"RegisterClass"),(()=>{const e="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;__esDecorate(null,l={value:f},u,{kind:"class",name:f.name,metadata:e},null,d),f=l.value,e&&Object.defineProperty(f,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e}),__runInitializers(f,d)})(),f})();const Register=RegisterClass;function register(e,t){return new RegisterClass(e,t)}const effectProjectionMetadata=new WeakMap;function getActiveProjection(){const e=getActiveEffect();return e?effectProjectionMetadata.get(e):void 0}function defineAccessValue(e){Object.defineProperty(e,"value",{get:e.get,set:e.set,configurable:!0,enumerable:!0})}function makeCleanup(e,t,r,n){return n&&Object.defineProperty(e,projectionInfo,{value:n,writable:!1,enumerable:!1,configurable:!0}),cleanedBy(e,()=>{r();for(const e of t.values())e?.();t.clear()})}function projectArray(e,t){const r=reactive(e),n=reactive([]),o=new Map;function i(e){const t=o.get(e);t&&(o.delete(e),t(),Reflect.deleteProperty(n,e))}const s=getActiveProjection(),a=s?s.depth+1:0,c=effect(function({ascend:e}){const c=r.length;!function(e){ReflectSet(n,"length",e,n)}(c);const l=Array.from(o.keys());for(let i=0;i<c;i++)o.has(i)||e(()=>{const e=i,c=effect(function(){const o=untracked(()=>n[e]),i={key:e,source:r,get:()=>ReflectGet(r,e,r),set:t=>ReflectSet(r,e,t,r),old:o};defineAccessValue(i);const s=t(i,n);n[e]=s});setEffectName(c,`project[${a}]:${e}`),effectProjectionMetadata.set(c,{source:r,key:e,target:n,depth:a,parent:s}),o.set(i,c)});for(const e of l)e>=c&&i(e)});return makeCleanup(n,o,()=>c(),{source:r,target:n,apply:t,depth:a,parent:s})}function projectRegister(e,t){const r=reactive(e),n=new Map,o=reactive(n),i=new Map;function s(e){const t=i.get(e);t&&(t(),i.delete(e),o.delete(e))}const a=getActiveProjection(),c=a?a.depth+1:0,l=effect(function({ascend:e}){const n=new Set;for(const e of r.mapKeys())n.add(e);for(const s of n)i.has(s)||e(()=>{const e=effect(function(){const e=untracked(()=>o.get(s)),n={key:s,source:r,get:()=>r.get(s),set:e=>(r.set(s,e),!0),old:e};defineAccessValue(n);const i=t(n,o);o.set(s,i)});setEffectName(e,`project[${c}]:${String(s)}`),effectProjectionMetadata.set(e,{source:r,key:s,target:o,depth:c,parent:a}),i.set(s,e)});for(const e of Array.from(i.keys()))n.has(e)||s(e)});return makeCleanup(o,i,()=>l(),{source:r,target:o,apply:t,depth:c,parent:a})}function projectRecord(e,t){const r=reactive(e),n=reactive({}),o=new Map;function i(e){const t=o.get(e);t&&(t(),o.delete(e),Reflect.deleteProperty(n,e))}const s=getActiveProjection(),a=s?s.depth+1:0,c=effect(function({ascend:e}){const c=new Set;for(const e in r)c.add(e);const l=Reflect.ownKeys(r);for(const e of l)c.add(e);for(const i of c)o.has(i)||e(()=>{const e=effect(function(){const e=i,o=untracked(()=>n[i]),s={key:e,source:r,get:()=>ReflectGet(r,e,r),set:t=>ReflectSet(r,e,t,r),old:o};defineAccessValue(s);const a=t(s,n);n[e]=a});setEffectName(e,`project[${a}]:${String(i)}`),effectProjectionMetadata.set(e,{source:r,key:i,target:n,depth:a,parent:s}),o.set(i,e)});for(const e of Array.from(o.keys()))c.has(e)||i(e)});return makeCleanup(n,o,()=>c(),{source:r,target:n,apply:t,depth:a,parent:s})}function projectMap(e,t){const r=reactive(e),n=new Map,o=reactive(n),i=new Map;function s(e){const t=i.get(e);t&&(t(),i.delete(e),o.delete(e))}const a=getActiveProjection(),c=a?a.depth+1:0,l=effect(function({ascend:e}){const n=new Set;for(const e of r.keys())n.add(e);for(const s of n)i.has(s)||e(()=>{const e=effect(function(){const e=untracked(()=>o.get(s)),n={key:s,source:r,get:()=>r.get(s),set:e=>(r.set(s,e),!0),old:e};defineAccessValue(n);const i=t(n,o);o.set(s,i)});setEffectName(e,`project[${c}]:${String(s)}`),effectProjectionMetadata.set(e,{source:r,key:s,target:o,depth:c,parent:a}),i.set(s,e)});for(const e of Array.from(i.keys()))n.has(e)||s(e)});return makeCleanup(o,i,()=>l(),{source:r,target:o,apply:t,depth:c,parent:a})}function projectCore(e,t){if(Array.isArray(e))return projectArray(e,t);if(e instanceof Map)return projectMap(e,t);if(e instanceof Register)return projectRegister(e,t);if(e&&(e.constructor===Object||void 0===e.constructor))return projectRecord(e,t);throw new Error("Unsupported source type")}const project=Object.assign(projectCore,{array:projectArray,register:projectRegister,record:projectRecord,map:projectMap});function organized(e,t,r={}){const n=reactive(e),o=reactive(r),i=new Map;function s(e){const t=i.get(e);t&&(i.delete(e),t())}const a=effect(function({ascend:e}){const r=new Set;for(const e in n)r.add(e);for(const s of r)i.has(s)||e(()=>{const e=effect(function(){const e=s,r={key:e,get:()=>ReflectGet(n,e,n),set:t=>ReflectSet(n,e,t,n)};return Object.defineProperty(r,"value",{get:r.get,set:r.set,configurable:!0,enumerable:!0}),t(r,o)});i.set(s,e)});for(const e of Array.from(i.keys()))r.has(e)||s(e)});return cleanedBy(o,()=>{a();for(const e of Array.from(i.keys()))s(e)})}function organize(e,t,r){return Object.defineProperty(e,t,{get:r.get,set:r.set,configurable:!0,enumerable:!0}),touched1(e,{type:"set",prop:t},t),()=>delete e[t]}const native$1=Symbol("native");class ReactiveWeakMap{constructor(e){Object.defineProperties(this,{[native$1]:{value:e},[prototypeForwarding]:{value:e},content:{value:Symbol("WeakMapContent")},[Symbol.toStringTag]:{value:"ReactiveWeakMap"}})}delete(e){const t=this[native$1].has(e),r=this[native$1].delete(e);return t&&touched1(this.content,{type:"del",prop:e},e),r}get(e){return dependant(this.content,e),reactive(this[native$1].get(e))}has(e){return dependant(this.content,e),this[native$1].has(e)}set(e,t){const r=this[native$1].has(e),n=this[native$1].get(e),o=reactive(t);return this[native$1].set(e,o),r&&n===o||notifyPropertyChange(this.content,e,n,o,r),this}}class ReactiveMap{constructor(e){Object.defineProperties(this,{[native$1]:{value:e},[prototypeForwarding]:{value:e},content:{value:Symbol("MapContent")},[Symbol.toStringTag]:{value:"ReactiveMap"}})}get size(){return dependant(this,"size"),this[native$1].size}clear(){const e=this[native$1].size>0;if(this[native$1].clear(),e){const e={type:"bunch",method:"clear"};touched1(this,e,"size"),touched(this.content,e)}}entries(){return dependant(this.content),makeReactiveEntriesIterator(this[native$1].entries())}forEach(e,t){dependant(this.content),this[native$1].forEach(e,t)}keys(){return dependant(this.content),this[native$1].keys()}values(){return dependant(this.content),makeReactiveIterator(this[native$1].values())}[Symbol.iterator](){dependant(this.content);const e=this[native$1][Symbol.iterator]();return{next(){const t=e.next();return t.done?t:{value:[t.value[0],reactive(t.value[1])],done:!1}}}}delete(e){const t=this[native$1].has(e),r=this[native$1].delete(e);if(t){const t={type:"del",prop:e};touched1(this.content,t,e),touched1(this,t,"size")}return r}get(e){return dependant(this.content,e),reactive(this[native$1].get(e))}has(e){return dependant(this.content,e),this[native$1].has(e)}set(e,t){const r=this[native$1].has(e),n=this[native$1].get(e),o=reactive(t);if(this[native$1].set(e,o),!r||n!==o){notifyPropertyChange(this.content,e,n,o,r);touched1(this,{type:r?"set":"add",prop:e},"size")}return this}}const native=Symbol("native");class ReactiveWeakSet{constructor(e){Object.defineProperties(this,{[native]:{value:e},[prototypeForwarding]:{value:e},content:{value:Symbol("WeakSetContent")},[Symbol.toStringTag]:{value:"ReactiveWeakSet"}})}add(e){const t=this[native].has(e);return this[native].add(e),t||touched1(this.content,{type:"add",prop:e},e),this}delete(e){const t=this[native].has(e),r=this[native].delete(e);return t&&touched1(this.content,{type:"del",prop:e},e),r}has(e){return dependant(this.content,e),this[native].has(e)}}class ReactiveSet{constructor(e){Object.defineProperties(this,{[native]:{value:e},[prototypeForwarding]:{value:e},content:{value:Symbol("SetContent")},[Symbol.toStringTag]:{value:"ReactiveSet"}})}get size(){return dependant(this,"size"),this[native].size}add(e){const t=this[native].has(e),r=reactive(e);if(this[native].add(r),!t){const e={type:"add",prop:r};touched1(this.content,e,r),touched1(this,e,"size")}return this}clear(){const e=this[native].size>0;if(this[native].clear(),e){const e={type:"bunch",method:"clear"};touched1(this,e,"size"),touched(this.content,e)}}delete(e){const t=this[native].has(e),r=this[native].delete(e);if(t){const t={type:"del",prop:e};touched1(this.content,t,e),touched1(this,t,"size")}return r}has(e){return dependant(this.content,e),this[native].has(e)}entries(){return dependant(this.content),makeReactiveEntriesIterator(this[native].entries())}forEach(e,t){dependant(this.content),this[native].forEach(e,t)}keys(){return dependant(this.content),makeReactiveIterator(this[native].keys())}values(){return dependant(this.content),makeReactiveIterator(this[native].values())}[Symbol.iterator](){dependant(this.content);const e=this[native][Symbol.iterator]();return{next(){const t=e.next();return t.done?t:{value:reactive(t.value),done:!1}}}}}registerNativeReactivity(WeakMap,ReactiveWeakMap),registerNativeReactivity(Map,ReactiveMap),registerNativeReactivity(WeakSet,ReactiveWeakSet),registerNativeReactivity(Set,ReactiveSet),registerNativeReactivity(Array,ReactiveArray);const profileInfo={objectToProxy:objectToProxy,proxyToObject:proxyToObject,effectToReactiveObjects:effectToReactiveObjects,watchers:watchers,objectParents:objectParents,objectsWithDeepWatchers:objectsWithDeepWatchers,deepWatchers:deepWatchers,effectToDeepWatchedObjects:effectToDeepWatchedObjects,nonReactiveObjects:nonReactiveObjects},syncCalculating=[],cached=decorator({getter:(e,t,r)=>function(){const t=syncCalculating.findIndex(e=>e.object===this&&e.prop===r);if(t>-1)throw new Error(`Circular dependency detected: ${syncCalculating.slice(t).map(e=>`${e.object.constructor.name}.${String(e.prop)}`).join(" -> ")} -> again`);syncCalculating.push({object:this,prop:r});try{const t=e.call(this);return cache(this,r,t),t}finally{syncCalculating.pop()}}});function isCached(e,t){return!!Object.getOwnPropertyDescriptor(e,t)}function cache(e,t,r){Object.defineProperty(e,t,{value:r})}function describe(e){return(...t)=>r=>class extends r{constructor(...r){super(...r);for(const r of t)Object.defineProperty(this,r,{...Object.getOwnPropertyDescriptor(this,r),...e})}}}const deprecated=Object.assign(decorator({method:(e,t,r)=>function(...t){return deprecated.warn(this,r),e.apply(this,t)},getter:(e,t,r)=>function(){return deprecated.warn(this,r),e.call(this)},setter:(e,t,r)=>function(t){return deprecated.warn(this,r),e.call(this,t)},class:e=>class extends e{constructor(...e){super(...e),deprecated.warn(this,"constructor")}},default:e=>decorator({method:(t,r,n)=>function(...r){return deprecated.warn(this,n,e),t.apply(this,r)},getter:(t,r,n)=>function(){return deprecated.warn(this,n,e),t.call(this)},setter:(t,r,n)=>function(r){return deprecated.warn(this,n,e),t.call(this,r)},class:t=>class extends t{constructor(...t){super(...t),deprecated.warn(this,"constructor",e)}}})}),{warn:(e,t,r)=>{}});function debounce(e){return decorator({method(t,r,n){let o=null;return function(...r){o&&clearTimeout(o),o=setTimeout(()=>{t.apply(this,r),o=null},e)}}})}function throttle(e){return decorator({method(t,r,n){let o=0,i=null;return function(...r){const n=Date.now();if(n-o>=e)return i&&(clearTimeout(i),i=null),o=n,t.apply(this,r);if(!i){const s=e-(n-o),a=[...r];i=setTimeout(()=>{o=Date.now(),t.apply(this,a),i=null},s)}}}})}var version$1="1.0.6",pkg={version:version$1};const{version:version}=pkg,GLOBAL_MUTTS_KEY="__MUTTS_INSTANCE__",globalScope="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global&&global;if(globalScope){let source="mutts/index";try{if("undefined"!=typeof __filename)source=__filename;else{const meta=eval("import.meta");meta&&meta.url&&(source=meta.url)}}catch(e){}const currentSourceInfo={version:version,source:source,timestamp:Date.now()};if(globalScope[GLOBAL_MUTTS_KEY]){const e=globalScope[GLOBAL_MUTTS_KEY];throw new Error(`[Mutts] Multiple instances detected!\nExisting instance: ${JSON.stringify(e,null,2)}\nNew instance: ${JSON.stringify(currentSourceInfo,null,2)}\nThis usually happens when 'mutts' is both installed as a dependency and bundled, or when different versions are loaded. Please check your build configuration (aliases, externals) to ensure a single source of truth.`)}globalScope[GLOBAL_MUTTS_KEY]=currentSourceInfo}exports.ArrayReadForward=ArrayReadForward,exports.DecoratorError=DecoratorError,exports.Destroyable=Destroyable,exports.DestructionError=DestructionError,exports.Eventful=Eventful,exports.Indexable=Indexable,exports.IterableWeakMap=IterableWeakMap,exports.IterableWeakSet=IterableWeakSet,exports.ReactiveBase=ReactiveBase,exports.ReactiveError=ReactiveError,exports.ReadOnlyError=ReadOnlyError,exports.ReflectGet=ReflectGet,exports.ReflectSet=ReflectSet,exports.Register=Register,exports.addBatchCleanup=addBatchCleanup,exports.allocated=allocated,exports.allocatedValues=allocatedValues,exports.arrayEquals=arrayEquals,exports.atomic=atomic,exports.batch=batch,exports.biDi=biDi,exports.buildReactivityGraph=buildReactivityGraph,exports.cache=cache,exports.cached=cached,exports.callOnGC=callOnGC,exports.cleanedBy=cleanedBy,exports.cleanup=cleanup,exports.debounce=debounce,exports.decorator=decorator,exports.deepCompare=deepCompare,exports.deepWatch=deepWatch,exports.defer=defer,exports.deprecated=deprecated,exports.derived=derived,exports.describe=describe,exports.destructor=destructor,exports.effect=effect,exports.enableDevTools=enableDevTools,exports.forwardArray=forwardArray,exports.getActivationLog=getActivationLog,exports.getActiveEffect=getActiveEffect,exports.getActiveProjection=getActiveProjection,exports.getAt=getAt,exports.getState=getState,exports.immutables=immutables,exports.isCached=isCached,exports.isConstructor=isConstructor,exports.isDevtoolsEnabled=isDevtoolsEnabled,exports.isNonReactive=isNonReactive,exports.isOwnAccessor=isOwnAccessor,exports.isReactive=isReactive,exports.isZoneEnabled=isZoneEnabled,exports.legacyDecorator=legacyDecorator,exports.mapped=mapped,exports.memoize=memoize,exports.mixin=mixin,exports.modernDecorator=modernDecorator,exports.organize=organize,exports.organized=organized,exports.profileInfo=profileInfo,exports.project=project,exports.reactive=reactive,exports.reactiveOptions=options,exports.reduced=reduced,exports.register=register,exports.registerEffectForDebug=registerEffectForDebug,exports.registerNativeReactivity=registerNativeReactivity,exports.registerObjectForDebug=registerObjectForDebug,exports.renamed=renamed,exports.root=root,exports.setAt=setAt,exports.setEffectName=setEffectName,exports.setObjectName=setObjectName,exports.setZoneEnabled=setZoneEnabled,exports.throttle=throttle,exports.touched=touched,exports.touched1=touched1,exports.trackEffect=trackEffect,exports.unreactive=unreactive,exports.untracked=untracked,exports.unwrap=unwrap,exports.watch=watch,exports.zip=zip});
2
2
  //# sourceMappingURL=mutts.umd.js.map