mutts 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -2
- package/dist/chunks/_tslib-C-cuVLvZ.js +73 -0
- package/dist/chunks/_tslib-C-cuVLvZ.js.map +1 -0
- package/dist/chunks/_tslib-CMEnd0VE.esm.js +68 -0
- package/dist/chunks/_tslib-CMEnd0VE.esm.js.map +1 -0
- package/dist/chunks/{decorator-8qjFb7dw.js → decorator-D4DU97Zg.js} +70 -4
- package/dist/chunks/decorator-D4DU97Zg.js.map +1 -0
- package/dist/chunks/{decorator-AbRkXM5O.esm.js → decorator-GnHw1Az7.esm.js} +67 -5
- package/dist/chunks/decorator-GnHw1Az7.esm.js.map +1 -0
- package/dist/chunks/index-DBScoeCX.esm.js +1960 -0
- package/dist/chunks/index-DBScoeCX.esm.js.map +1 -0
- package/dist/chunks/index-DOTmXL89.js +1983 -0
- package/dist/chunks/index-DOTmXL89.js.map +1 -0
- package/dist/decorator.d.ts +57 -0
- package/dist/decorator.esm.js +1 -1
- package/dist/decorator.js +1 -1
- package/dist/destroyable.d.ts +42 -0
- package/dist/destroyable.esm.js +19 -1
- package/dist/destroyable.esm.js.map +1 -1
- package/dist/destroyable.js +19 -1
- package/dist/destroyable.js.map +1 -1
- package/dist/eventful.d.ts +10 -1
- package/dist/eventful.esm.js +5 -27
- package/dist/eventful.esm.js.map +1 -1
- package/dist/eventful.js +15 -37
- package/dist/eventful.js.map +1 -1
- package/dist/index.d.ts +52 -3
- package/dist/index.esm.js +3 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/dist/indexable.d.ts +26 -0
- package/dist/indexable.esm.js +6 -0
- package/dist/indexable.esm.js.map +1 -1
- package/dist/indexable.js +6 -0
- package/dist/indexable.js.map +1 -1
- package/dist/mutts.umd.js +1 -1
- package/dist/mutts.umd.js.map +1 -1
- package/dist/mutts.umd.min.js +1 -1
- package/dist/mutts.umd.min.js.map +1 -1
- package/dist/promiseChain.d.ts +10 -0
- package/dist/promiseChain.esm.js +6 -0
- package/dist/promiseChain.esm.js.map +1 -1
- package/dist/promiseChain.js +6 -0
- package/dist/promiseChain.js.map +1 -1
- package/dist/reactive.d.ts +255 -18
- package/dist/reactive.esm.js +4 -1458
- package/dist/reactive.esm.js.map +1 -1
- package/dist/reactive.js +29 -1471
- package/dist/reactive.js.map +1 -1
- package/dist/std-decorators.d.ts +35 -0
- package/dist/std-decorators.esm.js +36 -1
- package/dist/std-decorators.esm.js.map +1 -1
- package/dist/std-decorators.js +36 -1
- package/dist/std-decorators.js.map +1 -1
- package/docs/mixin.md +229 -0
- package/docs/reactive.md +7739 -882
- package/package.json +1 -1
- package/dist/chunks/decorator-8qjFb7dw.js.map +0 -1
- package/dist/chunks/decorator-AbRkXM5O.esm.js.map +0 -1
package/dist/mutts.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutts.umd.js","sources":["../src/utils.ts","../src/decorator.ts","../src/destroyable.ts","../src/indexable.ts","../src/reactive/core.ts","../src/reactive/interface.ts","../src/reactive/array.ts","../src/reactive/map.ts","../src/reactive/set.ts","../src/reactive/index.ts","../src/std-decorators.ts","../src/eventful.ts"],"sourcesContent":["type ElementTypes<T extends readonly unknown[]> = {\n\t[K in keyof T]: T[K] extends readonly (infer U)[] ? U : T[K]\n}\n\nexport function zip<T extends (readonly unknown[])[]>(...args: T): ElementTypes<T>[] {\n\tif (!args.length) return []\n\tconst minLength = Math.min(...args.map((arr) => arr.length))\n\tconst result: ElementTypes<T>[] = []\n\n\tfor (let i = 0; i < minLength; i++) {\n\t\tconst tuple = args.map((arr) => arr[i]) as ElementTypes<T>\n\t\tresult.push(tuple)\n\t}\n\n\treturn result\n}\n\nconst nativeConstructors = new Set<Function>([\n\tObject,\n\tArray,\n\tDate,\n\tFunction,\n\tSet,\n\tMap,\n\tWeakMap,\n\tWeakSet,\n\tPromise,\n\tError,\n\tTypeError,\n\tReferenceError,\n\tSyntaxError,\n\tRangeError,\n\tURIError,\n\tEvalError,\n\tReflect,\n\tProxy,\n\tRegExp,\n\tString,\n\tNumber,\n\tBoolean,\n] as Function[])\nexport function isConstructor(fn: Function): boolean {\n\treturn fn && (nativeConstructors.has(fn) || fn.toString?.().startsWith('class '))\n}\n\nexport function renamed<F extends Function>(fct: F, name: string): F {\n\treturn Object.defineProperties(fct, {\n\t\tname: {\n\t\t\tvalue: name,\n\t\t},\n\t})\n}\n","// biome-ignore-all lint/suspicious/noConfusingVoidType: We *love* voids\n// Standardized decorator system that works with both Legacy and Modern decorators\n\nimport { isConstructor } from './utils'\n\nexport class DecoratorError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message)\n\t\tthis.name = 'DecoratorException'\n\t}\n}\n//#region all decorator types\n\n// Used for get/set and method decorators\nexport type LegacyPropertyDecorator<T> = (\n\ttarget: T,\n\tname: string | symbol,\n\tdescriptor: PropertyDescriptor\n) => any\n\nexport type LegacyClassDecorator<T> = (target: T) => any\n\nexport type ModernMethodDecorator<T> = (target: T, context: ClassMethodDecoratorContext) => any\n\nexport type ModernGetterDecorator<T> = (target: T, context: ClassGetterDecoratorContext) => any\n\nexport type ModernSetterDecorator<T> = (target: T, context: ClassSetterDecoratorContext) => any\n\nexport type ModernAccessorDecorator<T> = (target: T, context: ClassAccessorDecoratorContext) => any\n\nexport type ModernClassDecorator<T> = (target: T, context: ClassDecoratorContext) => any\n\n//#endregion\n\ntype DDMethod<T> = (\n\toriginal: (this: T, ...args: any[]) => any,\n\tname: PropertyKey\n) => ((this: T, ...args: any[]) => any) | void\n\ntype DDGetter<T> = (original: (this: T) => any, name: PropertyKey) => ((this: T) => any) | void\n\ntype DDSetter<T> = (\n\toriginal: (this: T, value: any) => void,\n\tname: PropertyKey\n) => ((this: T, value: any) => void) | void\n\ntype DDClass<T> = <Ctor extends new (...args: any[]) => T = new (...args: any[]) => T>(\n\ttarget: Ctor\n) => Ctor | void\nexport interface DecoratorDescription<T> {\n\tmethod?: DDMethod<T>\n\tclass?: DDClass<T>\n\tgetter?: DDGetter<T>\n\tsetter?: DDSetter<T>\n\tdefault?: (...args: any[]) => any\n}\n\nexport type Decorator<T, Description extends DecoratorDescription<T>> = (Description extends {\n\tmethod: DDMethod<T>\n}\n\t? LegacyPropertyDecorator<T> & ModernMethodDecorator<T>\n\t: unknown) &\n\t(Description extends { class: DDClass<new (...args: any[]) => T> }\n\t\t? LegacyClassDecorator<new (...args: any[]) => T> &\n\t\t\t\tModernClassDecorator<new (...args: any[]) => T>\n\t\t: unknown) &\n\t(Description extends { getter: DDGetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernGetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { setter: DDSetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernSetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { default: infer Signature } ? Signature : unknown)\n\nexport type DecoratorFactory<T> = <Description extends DecoratorDescription<T>>(\n\tdescription: Description\n) => (Description extends { method: DDMethod<T> }\n\t? LegacyPropertyDecorator<T> & ModernMethodDecorator<T>\n\t: unknown) &\n\t(Description extends { class: DDClass<new (...args: any[]) => T> }\n\t\t? LegacyClassDecorator<new (...args: any[]) => T> &\n\t\t\t\tModernClassDecorator<new (...args: any[]) => T>\n\t\t: unknown) &\n\t(Description extends { getter: DDGetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernGetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { setter: DDSetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernSetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { default: infer Signature } ? Signature : unknown)\n\nexport function legacyDecorator<T = any>(description: DecoratorDescription<T>): any {\n\treturn function (\n\t\ttarget: any,\n\t\tpropertyKey?: PropertyKey,\n\t\tdescriptor?: PropertyDescriptor,\n\t\t...args: any[]\n\t) {\n\t\tif (propertyKey === undefined) {\n\t\t\tif (isConstructor(target)) {\n\t\t\t\tif (!('class' in description)) throw new Error('Decorator cannot be applied to a class')\n\t\t\t\treturn description.class?.(target)\n\t\t\t}\n\t\t} else if (typeof target === 'object' && ['string', 'symbol'].includes(typeof propertyKey)) {\n\t\t\tif (!descriptor) throw new Error('Decorator cannot be applied to a field')\n\t\t\telse if (typeof descriptor === 'object' && 'configurable' in descriptor) {\n\t\t\t\tif ('get' in descriptor || 'set' in descriptor) {\n\t\t\t\t\tif (!('getter' in description || 'setter' in description))\n\t\t\t\t\t\tthrow new Error('Decorator cannot be applied to a getter or setter')\n\t\t\t\t\tif ('getter' in description) {\n\t\t\t\t\t\tconst newGetter = description.getter?.(descriptor.get, propertyKey)\n\t\t\t\t\t\tif (newGetter) descriptor.get = newGetter\n\t\t\t\t\t}\n\t\t\t\t\tif ('setter' in description) {\n\t\t\t\t\t\tconst newSetter = description.setter?.(descriptor.set, propertyKey)\n\t\t\t\t\t\tif (newSetter) descriptor.set = newSetter\n\t\t\t\t\t}\n\t\t\t\t\treturn descriptor\n\t\t\t\t} else if (typeof descriptor.value === 'function') {\n\t\t\t\t\tif (!('method' in description)) throw new Error('Decorator cannot be applied to a method')\n\t\t\t\t\tconst newMethod = description.method?.(descriptor.value, propertyKey)\n\t\t\t\t\tif (newMethod) descriptor.value = newMethod\n\t\t\t\t\treturn descriptor\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!('default' in description))\n\t\t\tthrow new Error('Decorator do not have a default implementation')\n\t\treturn description.default.call(this, target, propertyKey, descriptor, ...args)\n\t}\n}\n\nexport function modernDecorator<T = any>(description: DecoratorDescription<T>): any {\n\treturn function (target: any, context?: DecoratorContext, ...args: any[]) {\n\t\tif (!context?.kind || typeof context.kind !== 'string') {\n\t\t\tif (!('default' in description))\n\t\t\t\tthrow new Error('Decorator do not have a default implementation')\n\t\t\treturn description.default.call(this, target, context, ...args)\n\t\t}\n\t\tswitch (context.kind) {\n\t\t\tcase 'class':\n\t\t\t\tif (!('class' in description)) throw new Error('Decorator cannot be applied to a class')\n\t\t\t\treturn description.class?.(target)\n\t\t\tcase 'field':\n\t\t\t\tthrow new Error('Decorator cannot be applied to a field')\n\t\t\tcase 'getter':\n\t\t\t\tif (!('getter' in description)) throw new Error('Decorator cannot be applied to a getter')\n\t\t\t\treturn description.getter?.(target, context.name)\n\t\t\tcase 'setter':\n\t\t\t\tif (!('setter' in description)) throw new Error('Decorator cannot be applied to a setter')\n\t\t\t\treturn description.setter?.(target, context.name)\n\t\t\tcase 'method':\n\t\t\t\tif (!('method' in description)) throw new Error('Decorator cannot be applied to a method')\n\t\t\t\treturn description.method?.(target, context.name)\n\t\t\tcase 'accessor': {\n\t\t\t\tif (!('getter' in description || 'setter' in description))\n\t\t\t\t\tthrow new Error('Decorator cannot be applied to a getter or setter')\n\t\t\t\tconst rv: Partial<ClassAccessorDecoratorResult<any, any>> = {}\n\t\t\t\tif ('getter' in description) {\n\t\t\t\t\tconst newGetter = description.getter?.(target.get, context.name)\n\t\t\t\t\tif (newGetter) rv.get = newGetter\n\t\t\t\t}\n\t\t\t\tif ('setter' in description) {\n\t\t\t\t\tconst newSetter = description.setter?.(target.set, context.name)\n\t\t\t\t\tif (newSetter) rv.set = newSetter\n\t\t\t\t}\n\t\t\t\treturn rv\n\t\t\t}\n\t\t\t//return description.accessor?.(target, context.name, target)\n\t\t}\n\t}\n}\n\n/**\n * Detects if the decorator is being called in modern (Modern) or legacy (Legacy) mode\n * based on the arguments passed to the decorator function\n */\nfunction detectDecoratorMode(\n\t_target: any,\n\tcontextOrKey?: any,\n\t_descriptor?: any\n): 'modern' | 'legacy' {\n\t// Modern decorators have a context object as the second parameter\n\t// Legacy decorators have a string/symbol key as the second parameter\n\tif (\n\t\ttypeof contextOrKey === 'object' &&\n\t\tcontextOrKey !== null &&\n\t\ttypeof contextOrKey.kind === 'string'\n\t) {\n\t\treturn 'modern'\n\t}\n\treturn 'legacy'\n}\n\nexport const decorator: DecoratorFactory<any> = (description: DecoratorDescription<any>) => {\n\treturn ((target: any, contextOrKey?: any, ...args: any[]) => {\n\t\tconst mode = detectDecoratorMode(target, contextOrKey, args[0])\n\t\treturn mode === 'modern'\n\t\t\t? modernDecorator(description)(target, contextOrKey, ...args)\n\t\t\t: legacyDecorator(description)(target, contextOrKey, ...args)\n\t}) as any\n}\n\nexport type GenericClassDecorator<T> = LegacyClassDecorator<abstract new (...args: any[]) => T> &\n\tModernClassDecorator<abstract new (...args: any[]) => T>\n","import { decorator } from './decorator'\n\n// Integrated with `using` statement via Symbol.dispose\nconst fr = new FinalizationRegistry<() => void>((f) => f())\nexport const destructor = Symbol('destructor')\nexport const allocatedValues = Symbol('allocated')\nexport class DestructionError extends Error {\n\tstatic throw<_T = void>(msg: string) {\n\t\treturn () => {\n\t\t\tthrow new DestructionError(msg)\n\t\t}\n\t}\n\tconstructor(msg: string) {\n\t\tsuper(`Object is destroyed. ${msg}`)\n\t\tthis.name = 'DestroyedAccessError'\n\t}\n}\nconst destroyedHandler = {\n\t[Symbol.toStringTag]: 'MutTs Destroyable',\n\tget: DestructionError.throw('Cannot access destroyed object'),\n\tset: DestructionError.throw('Cannot access destroyed object'),\n} as const\n\nabstract class AbstractDestroyable<Allocated> {\n\tabstract [destructor](allocated: Allocated): void\n\t[Symbol.dispose](): void {\n\t\tthis[destructor](this as unknown as Allocated)\n\t}\n}\n\ninterface Destructor<Allocated> {\n\tdestructor(allocated: Allocated): void\n}\n\nexport function Destroyable<\n\tT extends new (\n\t\t...args: any[]\n\t) => any,\n\tAllocated extends Partial<typeof this>,\n>(\n\tbase: T,\n\tdestructorObj: Destructor<Allocated>\n): (new (\n\t...args: ConstructorParameters<T>\n) => InstanceType<T> & { [allocatedValues]: Allocated }) & {\n\tdestroy(obj: InstanceType<T>): boolean\n\tisDestroyable(obj: InstanceType<T>): boolean\n}\n\nexport function Destroyable<Allocated extends Record<PropertyKey, any> = Record<PropertyKey, any>>(\n\tdestructorObj: Destructor<Allocated>\n): (new () => { [allocatedValues]: Allocated }) & {\n\tdestroy(obj: any): boolean\n\tisDestroyable(obj: any): boolean\n}\n\nexport function Destroyable<\n\tT extends new (\n\t\t...args: any[]\n\t) => any,\n\tAllocated extends Record<PropertyKey, any> = Record<PropertyKey, any>,\n>(\n\tbase: T\n): (new (\n\t...args: ConstructorParameters<T>\n) => AbstractDestroyable<Allocated> & InstanceType<T> & { [allocatedValues]: Allocated }) & {\n\tdestroy(obj: InstanceType<T>): boolean\n\tisDestroyable(obj: InstanceType<T>): boolean\n}\n\nexport function Destroyable<\n\tAllocated extends Record<PropertyKey, any> = Record<PropertyKey, any>,\n>(): abstract new () => (AbstractDestroyable<Allocated> & {\n\t[allocatedValues]: Allocated\n}) & {\n\tdestroy(obj: any): boolean\n\tisDestroyable(obj: any): boolean\n}\n\nexport function Destroyable<\n\tT extends new (\n\t\t...args: any[]\n\t) => any,\n\tAllocated extends Record<PropertyKey, any> = Record<PropertyKey, any>,\n>(base?: T | Destructor<Allocated>, destructorObj?: Destructor<Allocated>) {\n\tif (base && typeof base !== 'function') {\n\t\tdestructorObj = base as Destructor<Allocated>\n\t\tbase = undefined\n\t}\n\tif (!base) {\n\t\tbase = class {} as T\n\t}\n\n\treturn class Destroyable extends (base as T) {\n\t\tstatic readonly destructors = new WeakMap<any, () => void>()\n\t\tstatic destroy(obj: Destroyable) {\n\t\t\tconst destructor = Destroyable.destructors.get(obj)\n\t\t\tif (!destructor) return false\n\t\t\tfr.unregister(obj)\n\t\t\tDestroyable.destructors.delete(obj)\n\t\t\tObject.setPrototypeOf(obj, new Proxy({}, destroyedHandler))\n\t\t\t// Clear all own properties\n\t\t\tfor (const key of Object.getOwnPropertyNames(obj)) {\n\t\t\t\tdelete (obj as any)[key]\n\t\t\t}\n\t\t\tdestructor()\n\t\t\treturn true\n\t\t}\n\t\tstatic isDestroyable(obj: Destroyable) {\n\t\t\treturn Destroyable.destructors.has(obj)\n\t\t}\n\n\t\tdeclare [forwardProperties]: PropertyKey[]\n\t\treadonly [allocatedValues]: Allocated\n\t\tconstructor(...args: any[]) {\n\t\t\tsuper(...args)\n\t\t\tconst allocated = {} as Allocated\n\t\t\tthis[allocatedValues] = allocated\n\t\t\t// @ts-expect-error `this` is an AbstractDestroyable\n\t\t\tconst myDestructor = destructorObj?.destructor ?? this[destructor]\n\t\t\tif (!myDestructor) {\n\t\t\t\tthrow new DestructionError('Destructor is not defined')\n\t\t\t}\n\t\t\tfunction destruction() {\n\t\t\t\tmyDestructor(allocated)\n\t\t\t}\n\t\t\tDestroyable.destructors.set(this, destruction)\n\t\t\tfr.register(this, destruction, this)\n\t\t}\n\t}\n}\n\nconst forwardProperties = Symbol('forwardProperties')\nexport const allocated = decorator({\n\tsetter(original, propertyKey) {\n\t\treturn function (value) {\n\t\t\tthis[allocatedValues][propertyKey] = value\n\t\t\treturn original.call(this, value)\n\t\t}\n\t},\n})\n\nexport function callOnGC(cb: () => void) {\n\tlet called = false\n\tconst forward = () => {\n\t\tif (called) return\n\t\tcalled = true\n\t\tcb()\n\t}\n\tfr.register(forward, cb, cb)\n\treturn forward\n}\n\n// Context Manager Protocol for `with` statement integration\nexport interface ContextManager<T = any> {\n\t[Symbol.dispose](): void\n\tvalue?: T\n}\n","export const getAt = Symbol('getAt')\nexport const setAt = Symbol('setAt')\n\ninterface IndexingAt<Items = any> {\n\t[getAt](index: number): Items\n}\n\ninterface Accessor<T, Items> {\n\tget(this: T, index: number): Items\n\tset?(this: T, index: number, value: Items): void\n\tgetLength?(this: T): number\n\tsetLength?(this: T, value: number): void\n}\n\nabstract class AbstractGetAt<Items = any> {\n\tabstract [getAt](index: number): Items\n}\n\nexport function Indexable<Items, Base extends abstract new (...args: any[]) => any>(\n\tbase: Base,\n\taccessor: Accessor<InstanceType<Base>, Items>\n): new (\n\t...args: ConstructorParameters<Base>\n) => InstanceType<Base> & { [x: number]: Items }\n\nexport function Indexable<Items>(accessor: Accessor<any, Items>): new () => { [x: number]: Items }\n\nexport function Indexable<Base extends new (...args: any[]) => IndexingAt>(\n\tbase: Base\n): new (\n\t...args: ConstructorParameters<Base>\n) => InstanceType<Base> & { [x: number]: AtReturnType<InstanceType<Base>> }\n\nexport function Indexable<Items>(): abstract new (\n\t...args: any[]\n) => AbstractGetAt & { [x: number]: Items }\n\nexport function Indexable<Items, Base extends abstract new (...args: any[]) => any>(\n\tbase?: Base | Accessor<Base, Items>,\n\taccessor?: Accessor<Base, Items>\n) {\n\tif (base && typeof base !== 'function') {\n\t\taccessor = base as Accessor<Base, Items>\n\t\tbase = undefined\n\t}\n\tif (!base) {\n\t\t//@ts-expect-error\n\t\tbase = class {} as Base\n\t}\n\tif (!accessor) {\n\t\taccessor = {\n\t\t\tget(this: any, index: number) {\n\t\t\t\tif (typeof this[getAt] !== 'function') {\n\t\t\t\t\tthrow new Error('Indexable class must have an [getAt] method')\n\t\t\t\t}\n\t\t\t\treturn this[getAt](index)\n\t\t\t},\n\t\t\tset(this: any, index: number, value: Items) {\n\t\t\t\tif (typeof this[setAt] !== 'function') {\n\t\t\t\t\tthrow new Error('Indexable class has read-only numeric index access')\n\t\t\t\t}\n\t\t\t\tthis[setAt](index, value)\n\t\t\t},\n\t\t}\n\t}\n\n\tabstract class Indexable extends (base as Base) {\n\t\t[x: number]: Items\n\t}\n\n\tObject.setPrototypeOf(\n\t\tIndexable.prototype,\n\t\tnew Proxy((base as Base).prototype, {\n\t\t\t//@ts-expect-error\n\t\t\t[Symbol.toStringTag]: 'MutTs Indexable',\n\t\t\tget(target, prop, receiver) {\n\t\t\t\tif (prop in target) {\n\t\t\t\t\tconst getter = Object.getOwnPropertyDescriptor(target, prop)?.get\n\t\t\t\t\treturn getter ? getter.call(receiver) : target[prop]\n\t\t\t\t}\n\t\t\t\tif (typeof prop === 'string') {\n\t\t\t\t\tif (prop === 'length' && accessor.getLength) return accessor.getLength.call(receiver)\n\t\t\t\t\tconst numProp = Number(prop)\n\t\t\t\t\tif (!Number.isNaN(numProp)) {\n\t\t\t\t\t\treturn accessor.get!.call(receiver, numProp) as Items\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn undefined\n\t\t\t},\n\t\t\tset(target, prop, value, receiver) {\n\t\t\t\tif (prop in target) {\n\t\t\t\t\tconst setter = Object.getOwnPropertyDescriptor(target, prop)?.set\n\t\t\t\t\tif (setter) setter.call(receiver, value)\n\t\t\t\t\telse target[prop] = value\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tif (typeof prop === 'string') {\n\t\t\t\t\tif (prop === 'length' && accessor.setLength) {\n\t\t\t\t\t\taccessor.setLength.call(receiver, value)\n\t\t\t\t\t\treturn true\n\t\t\t\t\t}\n\t\t\t\t\tconst numProp = Number(prop)\n\t\t\t\t\tif (!Number.isNaN(numProp)) {\n\t\t\t\t\t\tif (!accessor.set) {\n\t\t\t\t\t\t\tthrow new Error('Indexable class has read-only numeric index access')\n\t\t\t\t\t\t}\n\t\t\t\t\t\taccessor.set!.call(receiver, numProp, value)\n\t\t\t\t\t\treturn true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tObject.defineProperty(receiver, prop, {\n\t\t\t\t\tvalue,\n\t\t\t\t\twritable: true,\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t})\n\t\t\t\treturn true\n\t\t\t},\n\t\t})\n\t)\n\treturn Indexable\n}\n\ntype AtReturnType<T> = T extends { [getAt](index: number): infer R } ? R : never\n","// biome-ignore-all lint/suspicious/noConfusingVoidType: Type 'void' is not assignable to type 'ScopedCallback | undefined'.\n// Argument of type '() => void' is not assignable to parameter of type '(dep: DependencyFunction) => ScopedCallback | undefined'.\n\nimport { decorator } from '../decorator'\n\nexport type DependencyFunction = <T>(cb: () => T) => T\n// TODO: proper async management, read when fn returns a promise and let the effect as \"running\",\n// either to cancel the running one or to avoid running 2 in \"parallel\" and debounce the second one\n\n// TODO: generic \"batch\" forcing even if not in an effect (perhaps when calling a reactive' function ?)\n// example: storage will make 2 modifications (add slot, modify count), they could raise 2 effects\nexport type ScopedCallback = () => void\n\nexport type PropEvolution = {\n\ttype: 'set' | 'del' | 'add' | 'invalidate'\n\tprop: any\n}\n\nexport type BunchEvolution = {\n\ttype: 'bunch'\n\tmethod: string\n}\ntype Evolution = PropEvolution | BunchEvolution\n\ntype State =\n\t| {\n\t\t\tevolution: Evolution\n\t\t\tnext: State\n\t }\n\t| {}\n// Track which effects are watching which reactive objects for cleanup\nconst effectToReactiveObjects = new WeakMap<ScopedCallback, Set<object>>()\n\n// Track object -> proxy and proxy -> object relationships\nconst objectToProxy = new WeakMap<object, object>()\nconst proxyToObject = new WeakMap<object, object>()\n// Deep watching data structures\n// Track which objects contain which other objects (back-references)\nconst objectParents = new WeakMap<object, Set<{ parent: object; prop: PropertyKey }>>()\n\n// Track which objects have deep watchers\nconst objectsWithDeepWatchers = new WeakSet<object>()\n\n// Track deep watchers per object\nconst deepWatchers = new WeakMap<object, Set<ScopedCallback>>()\n\n// Track which effects are doing deep watching\nconst effectToDeepWatchedObjects = new WeakMap<ScopedCallback, Set<object>>()\n\n// Track objects that should never be reactive and cannot be modified\nexport const nonReactiveObjects = new WeakSet<object>()\nconst absent = Symbol('absent')\n/**\n * Converts an iterator to a generator that yields reactive values\n */\nexport function* makeReactiveIterator<T>(iterator: Iterator<T>): Generator<T> {\n\tlet result = iterator.next()\n\twhile (!result.done) {\n\t\tyield reactive(result.value)\n\t\tresult = iterator.next()\n\t}\n}\n\n/**\n * Converts an iterator of key-value pairs to a generator that yields reactive key-value pairs\n */\nexport function* makeReactiveEntriesIterator<K, V>(iterator: Iterator<[K, V]>): Generator<[K, V]> {\n\tlet result = iterator.next()\n\twhile (!result.done) {\n\t\tconst [key, value] = result.value\n\t\tyield [reactive(key), reactive(value)]\n\t\tresult = iterator.next()\n\t}\n}\n\n// Track effects per reactive object and property\nconst watchers = new WeakMap<object, Map<any, Set<ScopedCallback>>>()\n\nexport const profileInfo: any = {\n\tobjectToProxy,\n\tproxyToObject,\n\teffectToReactiveObjects,\n\twatchers,\n\tobjectParents,\n\tobjectsWithDeepWatchers,\n\tdeepWatchers,\n\teffectToDeepWatchedObjects,\n\tnonReactiveObjects,\n}\n// Track native reactivity\nconst nativeReactive = Symbol('native-reactive')\n\n// Symbol to mark individual objects as non-reactive\nexport const nonReactiveMark = Symbol('non-reactive')\n// Symbol to mark class properties as non-reactive\nexport const unreactiveProperties = Symbol('unreactive-properties')\nexport const prototypeForwarding: unique symbol = Symbol('prototype-forwarding')\n\nexport const allProps = Symbol('all-props')\n\n// Symbol to mark functions with their root function\nconst rootFunction = Symbol('root-function')\n\n/**\n * Mark a function with its root function. If the function already has a root,\n * the root becomes the root of the new root (transitive root tracking).\n * @param fn - The function to mark\n * @param root - The root function to associate with fn\n */\nexport function markWithRoot<T extends Function>(fn: T, root: Function): T {\n\t// Mark fn with the new root\n\treturn Object.defineProperty(fn, rootFunction, {\n\t\tvalue: getRoot(root),\n\t\twritable: false,\n\t})\n}\n\n/**\n * Retrieve the root function from a callback. Returns the function itself if it has no root.\n * @param fn - The function to get the root from\n * @returns The root function, or the function itself if no root exists\n */\nexport function getRoot<T extends Function | undefined>(fn: T): T {\n\treturn (fn as any)?.[rootFunction] || fn\n}\n\nexport class ReactiveError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message)\n\t\tthis.name = 'ReactiveError'\n\t}\n}\n\n// biome-ignore-start lint/correctness/noUnusedFunctionParameters: Interface declaration with empty defaults\n/**\n * Options for the reactive system, can be configured at runtime\n */\nexport const options = {\n\t/**\n\t * Debug purpose: called when an effect is entered\n\t * @param effect - The effect that is entered\n\t */\n\tenter: (effect: Function) => {},\n\t/**\n\t * Debug purpose: called when an effect is left\n\t * @param effect - The effect that is left\n\t */\n\tleave: (effect: Function) => {},\n\t/**\n\t * Debug purpose: called when an effect is chained\n\t * @param target - The effect that is being triggered\n\t * @param caller - The effect that is calling the target\n\t */\n\tchain: (target: Function, caller?: Function) => {},\n\t/**\n\t * Debug purpose: maximum effect chain (like call stack max depth)\n\t * Used to prevent infinite loops\n\t * @default 100\n\t */\n\tmaxEffectChain: 100,\n\t/**\n\t * Maximum depth for deep watching traversal\n\t * Used to prevent infinite recursion in circular references\n\t * @default 100\n\t */\n\tmaxDeepWatchDepth: 100,\n\t/**\n\t * Only react on instance members modification (not inherited properties)\n\t * For instance, do not track class methods\n\t * @default true\n\t */\n\tinstanceMembers: true,\n\t// biome-ignore lint/suspicious/noConsole: This is the whole point here\n\twarn: (...args: any[]) => console.warn(...args),\n}\n// biome-ignore-end lint/correctness/noUnusedFunctionParameters: Interface declaration with empty defaults\n\n//#region evolution\n\nfunction raiseDeps(objectWatchers: Map<any, Set<ScopedCallback>>, ...keyChains: Iterable<any>[]) {\n\tfor (const keys of keyChains)\n\t\tfor (const key of keys) {\n\t\t\tconst deps = objectWatchers.get(key)\n\t\t\tif (deps) for (const effect of Array.from(deps)) atomicEffect(effect)\n\t\t}\n}\n\nexport function touched1(obj: any, evolution: Evolution, prop: any) {\n\ttouched(obj, evolution, [prop])\n}\n\nexport function touched(obj: any, evolution: Evolution, props?: Iterable<any>) {\n\tobj = unwrap(obj)\n\taddState(obj, evolution)\n\tconst objectWatchers = watchers.get(obj)\n\tif (objectWatchers) {\n\t\tif (props) raiseDeps(objectWatchers, [allProps], props)\n\t\telse raiseDeps(objectWatchers, objectWatchers.keys())\n\t}\n\n\t// Bubble up changes if this object has deep watchers\n\tif (objectsWithDeepWatchers.has(obj)) {\n\t\tbubbleUpChange(obj, evolution)\n\t}\n}\n\nconst states = new WeakMap<object, State>()\n\nfunction addState(obj: any, evolution: Evolution) {\n\tobj = unwrap(obj)\n\tconst next = {}\n\tconst state = getState(obj)\n\tif (state) Object.assign(state, { evolution, next })\n\tstates.set(obj, next)\n}\n\nexport function getState(obj: any) {\n\tobj = unwrap(obj)\n\tlet state = states.get(obj)\n\tif (!state) {\n\t\tstate = {}\n\t\tstates.set(obj, state)\n\t}\n\treturn state\n}\n\nexport function dependant(obj: any, prop: any = allProps) {\n\tobj = unwrap(obj)\n\tif (activeEffect && (typeof prop !== 'symbol' || prop === allProps)) {\n\t\tlet objectWatchers = watchers.get(obj)\n\t\tif (!objectWatchers) {\n\t\t\tobjectWatchers = new Map<PropertyKey, Set<ScopedCallback>>()\n\t\t\twatchers.set(obj, objectWatchers)\n\t\t}\n\t\tlet deps = objectWatchers.get(prop)\n\t\tif (!deps) {\n\t\t\tdeps = new Set<ScopedCallback>()\n\t\t\tobjectWatchers.set(prop, deps)\n\t\t}\n\t\tdeps.add(activeEffect)\n\n\t\t// Track which reactive objects this effect is watching\n\t\tlet effectObjects = effectToReactiveObjects.get(activeEffect)\n\t\tif (!effectObjects) {\n\t\t\teffectObjects = new Set<object>()\n\t\t\teffectToReactiveObjects.set(activeEffect, effectObjects)\n\t\t}\n\t\teffectObjects.add(obj)\n\t}\n}\n\n// Stack of active effects to handle nested effects\nlet activeEffect: ScopedCallback | undefined\n// Parent effect used for lifecycle/cleanup relationships (can diverge later)\nlet parentEffect: ScopedCallback | undefined\n\n// Track currently executing effects to prevent re-execution\n// These are all the effects triggered under `activeEffect`\nlet batchedEffects: Map<Function, ScopedCallback> | undefined\n\n// Track which sub-effects have been executed to prevent infinite loops\n// These are all the effects triggered under `activeEffect` and all their sub-effects\nfunction atomicEffect(effect: ScopedCallback, immediate?: 'immediate') {\n\tconst root = getRoot(effect)\n\n\toptions?.chain(getRoot(effect), getRoot(activeEffect))\n\tif (batchedEffects) {\n\t\tbatchedEffects.set(root, effect)\n\t\tif (immediate)\n\t\t\ttry {\n\t\t\t\treturn effect()\n\t\t\t} finally {\n\t\t\t\tbatchedEffects.delete(root)\n\t\t\t}\n\t} else {\n\t\tconst runEffects: any[] = []\n\t\tbatchedEffects = new Map<Function, ScopedCallback>([[root, effect]])\n\t\tconst firstReturn: { value?: any } = {}\n\t\ttry {\n\t\t\twhile (batchedEffects.size) {\n\t\t\t\tif (runEffects.length > options.maxEffectChain)\n\t\t\t\t\tthrow new ReactiveError('[reactive] Max effect chain reached')\n\t\t\t\tconst [root, effect] = batchedEffects.entries().next().value!\n\t\t\t\trunEffects.push(root)\n\t\t\t\tconst rv = effect()\n\t\t\t\tif (!('value' in firstReturn)) firstReturn.value = rv\n\t\t\t\tbatchedEffects.delete(root)\n\t\t\t}\n\t\t\treturn firstReturn.value\n\t\t} finally {\n\t\t\tbatchedEffects = undefined\n\t\t}\n\t}\n}\n\nexport const atomic = decorator({\n\tmethod(original) {\n\t\treturn function (...args: any[]) {\n\t\t\treturn atomicEffect(\n\t\t\t\tmarkWithRoot(() => original.apply(this, args), original),\n\t\t\t\t'immediate'\n\t\t\t)\n\t\t}\n\t},\n\tdefault<Args extends any[], Return>(\n\t\toriginal: (...args: Args) => Return\n\t): (...args: Args) => Return {\n\t\treturn function (...args: Args) {\n\t\t\treturn atomicEffect(\n\t\t\t\tmarkWithRoot(() => original.apply(this, args), original),\n\t\t\t\t'immediate'\n\t\t\t)\n\t\t}\n\t},\n})\n\nexport function withEffect<T>(\n\teffect: ScopedCallback | undefined,\n\tfn: () => T,\n\tkeepParent?: true\n): T {\n\tif (getRoot(effect) === getRoot(activeEffect)) return fn()\n\tconst oldActiveEffect = activeEffect\n\tconst oldParentEffect = parentEffect\n\tactiveEffect = effect\n\tif (!keepParent) parentEffect = effect\n\ttry {\n\t\treturn fn()\n\t} finally {\n\t\tactiveEffect = oldActiveEffect\n\t\tparentEffect = oldParentEffect\n\t}\n}\n\n//#endregion\n\n//#region deep watching\n\n/**\n * Add a back-reference from child to parent\n */\nfunction addBackReference(child: object, parent: object, prop: any) {\n\tlet parents = objectParents.get(child)\n\tif (!parents) {\n\t\tparents = new Set()\n\t\tobjectParents.set(child, parents)\n\t}\n\tparents.add({ parent, prop })\n}\n\n/**\n * Remove a back-reference from child to parent\n */\nfunction removeBackReference(child: object, parent: object, prop: any) {\n\tconst parents = objectParents.get(child)\n\tif (parents) {\n\t\tparents.delete({ parent, prop })\n\t\tif (parents.size === 0) {\n\t\t\tobjectParents.delete(child)\n\t\t}\n\t}\n}\n\n/**\n * Check if an object needs back-references (has deep watchers or parents with deep watchers)\n */\nfunction needsBackReferences(obj: object): boolean {\n\treturn objectsWithDeepWatchers.has(obj) || hasParentWithDeepWatchers(obj)\n}\n\n/**\n * Check if an object has any parent with deep watchers\n */\nfunction hasParentWithDeepWatchers(obj: object): boolean {\n\tconst parents = objectParents.get(obj)\n\tif (!parents) return false\n\n\tfor (const { parent } of parents) {\n\t\tif (objectsWithDeepWatchers.has(parent)) return true\n\t\tif (hasParentWithDeepWatchers(parent)) return true\n\t}\n\treturn false\n}\n\n/**\n * Bubble up changes through the back-reference chain\n */\nfunction bubbleUpChange(changedObject: object, evolution: Evolution) {\n\tconst parents = objectParents.get(changedObject)\n\tif (!parents) return\n\n\tfor (const { parent } of parents) {\n\t\t// Trigger deep watchers on parent\n\t\tconst parentDeepWatchers = deepWatchers.get(parent)\n\t\tif (parentDeepWatchers) for (const watcher of parentDeepWatchers) atomicEffect(watcher)\n\n\t\t// Continue bubbling up\n\t\tbubbleUpChange(parent, evolution)\n\t}\n}\n\nexport function track1(obj: object, prop: any, oldVal: any, newValue: any) {\n\t// Manage back-references if this object has deep watchers\n\tif (objectsWithDeepWatchers.has(obj)) {\n\t\t// Remove old back-references\n\t\tif (typeof oldVal === 'object' && oldVal !== null) {\n\t\t\tremoveBackReference(oldVal, obj, prop)\n\t\t}\n\n\t\t// Add new back-references\n\t\tif (typeof newValue === 'object' && newValue !== null) {\n\t\t\tconst reactiveValue = reactive(newValue)\n\t\t\taddBackReference(reactiveValue, obj, prop)\n\t\t}\n\t}\n\treturn newValue\n}\n\n//#endregion\n\nconst reactiveHandlers = {\n\t[Symbol.toStringTag]: 'MutTs Reactive',\n\tget(obj: any, prop: PropertyKey, receiver: any) {\n\t\tif (prop === nonReactiveMark) return false\n\t\t// Check if this property is marked as unreactive\n\t\tif (obj[unreactiveProperties]?.has(prop) || typeof prop === 'symbol')\n\t\t\treturn Reflect.get(obj, prop, receiver)\n\t\t// Depend if...\n\t\tif (!options.instanceMembers || Object.hasOwn(receiver, prop) || !Reflect.has(receiver, prop))\n\t\t\tdependant(obj, prop)\n\n\t\tconst value = Reflect.get(obj, prop, receiver)\n\t\tif (typeof value === 'object' && value !== null) {\n\t\t\tconst reactiveValue = reactive(value)\n\n\t\t\t// Only create back-references if this object needs them\n\t\t\tif (needsBackReferences(obj)) {\n\t\t\t\taddBackReference(reactiveValue, obj, prop)\n\t\t\t}\n\n\t\t\treturn reactiveValue\n\t\t}\n\t\treturn value\n\t},\n\tset(obj: any, prop: PropertyKey, value: any, receiver: any): boolean {\n\t\t// Check if this property is marked as unreactive\n\t\tif (obj[unreactiveProperties]?.has(prop)) return Reflect.set(obj, prop, value, receiver)\n\t\t// Really specific case for when Array is forwarder, in order to let it manage the reactivity\n\t\tconst isArrayCase =\n\t\t\tprototypeForwarding in obj &&\n\t\t\t// biome-ignore lint/suspicious/useIsArray: This is the whole point here\n\t\t\tobj[prototypeForwarding] instanceof Array &&\n\t\t\t(!Number.isNaN(Number(prop)) || prop === 'length')\n\t\tconst newValue = unwrap(value)\n\n\t\tif (isArrayCase) {\n\t\t\t;(obj as any)[prop] = newValue\n\t\t\treturn true\n\t\t}\n\n\t\tconst oldVal = Reflect.has(receiver, prop) ? Reflect.get(obj, prop, receiver) : absent\n\t\ttrack1(obj, prop, oldVal, newValue)\n\n\t\tif (oldVal !== newValue) {\n\t\t\tReflect.set(obj, prop, newValue, receiver)\n\t\t\t// try to find a \"generic\" way to express that\n\t\t\ttouched1(obj, { type: oldVal !== absent ? 'set' : 'add', prop }, prop)\n\t\t}\n\t\treturn true\n\t},\n\tdeleteProperty(obj: any, prop: PropertyKey): boolean {\n\t\tif (!Object.hasOwn(obj, prop)) return false\n\n\t\tconst oldVal = (obj as any)[prop]\n\n\t\t// Remove back-references if this object has deep watchers\n\t\tif (objectsWithDeepWatchers.has(obj) && typeof oldVal === 'object' && oldVal !== null) {\n\t\t\tremoveBackReference(oldVal, obj, prop)\n\t\t}\n\n\t\tdelete (obj as any)[prop]\n\t\ttouched1(obj, { type: 'del', prop }, prop)\n\n\t\t// Bubble up changes if this object has deep watchers\n\t\tif (objectsWithDeepWatchers.has(obj)) {\n\t\t\tbubbleUpChange(obj, { type: 'del', prop })\n\t\t}\n\n\t\treturn true\n\t},\n\tgetPrototypeOf(obj: any): object | null {\n\t\tif (prototypeForwarding in obj) return obj[prototypeForwarding]\n\t\treturn Object.getPrototypeOf(obj)\n\t},\n\tsetPrototypeOf(obj: any, proto: object | null): boolean {\n\t\tif (prototypeForwarding in obj) return false\n\t\tObject.setPrototypeOf(obj, proto)\n\t\treturn true\n\t},\n\townKeys(obj: any): (string | symbol)[] {\n\t\tdependant(obj, allProps)\n\t\treturn Reflect.ownKeys(obj)\n\t},\n} as const\n\nconst reactiveClasses = new WeakSet<Function>()\nexport class ReactiveBase {\n\tconstructor() {\n\t\t// biome-ignore lint/correctness/noConstructorReturn: This is the whole point here\n\t\treturn reactiveClasses.has(new.target) ? reactive(this) : this\n\t}\n}\n\nfunction reactiveObject<T>(anyTarget: T): T {\n\tif (!anyTarget || typeof anyTarget !== 'object') return anyTarget\n\tconst target = anyTarget as any\n\t// If target is already a proxy, return it\n\tif (proxyToObject.has(target) || isNonReactive(target)) return target as T\n\n\t// If we already have a proxy for this object, return it\n\tif (objectToProxy.has(target)) return objectToProxy.get(target) as T\n\n\tconst proxied =\n\t\tnativeReactive in target && !(target instanceof target[nativeReactive])\n\t\t\t? new target[nativeReactive](target)\n\t\t\t: target\n\tif (proxied !== target) proxyToObject.set(proxied, target)\n\tconst proxy = new Proxy(proxied, reactiveHandlers)\n\n\t// Store the relationships\n\tobjectToProxy.set(target, proxy)\n\tproxyToObject.set(proxy, target)\n\treturn proxy as T\n}\n\nexport const reactive = decorator({\n\tclass(original) {\n\t\tif (original.prototype instanceof ReactiveBase) {\n\t\t\treactiveClasses.add(original)\n\t\t\treturn original\n\t\t}\n\t\tclass Reactive extends original {\n\t\t\tconstructor(...args: any[]) {\n\t\t\t\tsuper(...args)\n\t\t\t\tif (new.target !== Reactive && !reactiveClasses.has(new.target))\n\t\t\t\t\toptions.warn(\n\t\t\t\t\t\t`${(original as any).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.`\n\t\t\t\t\t)\n\t\t\t\t// biome-ignore lint/correctness/noConstructorReturn: This is the whole point here\n\t\t\t\treturn reactive(this)\n\t\t\t}\n\t\t}\n\t\tObject.defineProperty(Reactive, 'name', {\n\t\t\tvalue: `Reactive<${original.name}>`,\n\t\t})\n\t\treturn Reactive as any\n\t},\n\tget(original) {\n\t\treturn reactiveObject(original)\n\t},\n\tdefault: reactiveObject,\n})\n\nexport function unwrap<T>(proxy: T): T {\n\t// Return the original object\n\treturn (proxyToObject.get(proxy as any) as T) ?? proxy\n}\n\nexport function isReactive(obj: any): boolean {\n\treturn proxyToObject.has(obj)\n}\nexport function untracked(fn: () => ScopedCallback | undefined | void) {\n\twithEffect(undefined, fn, true)\n}\n\n// runEffect -> set<cleanup>\nconst effectChildren = new WeakMap<ScopedCallback, Set<ScopedCallback>>()\nconst fr = new FinalizationRegistry<() => void>((f) => f())\n\n/**\n * @param fn - The effect function to run - provides the cleaner\n * @returns The cleanup function\n */\nexport function effect<Args extends any[]>(\n\tfn: (dep: DependencyFunction, ...args: Args) => ScopedCallback | undefined | void,\n\t...args: Args\n): ScopedCallback {\n\tlet cleanup: (() => void) | null = null\n\tconst dep = markWithRoot(<T>(cb: () => T) => withEffect(runEffect, cb), fn)\n\tlet effectStopped = false\n\n\tfunction runEffect() {\n\t\t// Clear previous dependencies\n\t\tcleanup?.()\n\n\t\toptions.enter(fn)\n\t\tconst reactionCleanup = withEffect(effectStopped ? undefined : runEffect, () =>\n\t\t\tfn(dep, ...args)\n\t\t) as undefined | ScopedCallback\n\t\toptions.leave(fn)\n\n\t\t// Create cleanup function for next run\n\t\tcleanup = () => {\n\t\t\tcleanup = null\n\t\t\treactionCleanup?.()\n\t\t\t// Remove this effect from all reactive objects it's watching\n\t\t\tconst effectObjects = effectToReactiveObjects.get(runEffect)\n\t\t\tif (effectObjects) {\n\t\t\t\tfor (const reactiveObj of effectObjects) {\n\t\t\t\t\tconst objectWatchers = watchers.get(reactiveObj)\n\t\t\t\t\tif (objectWatchers) {\n\t\t\t\t\t\tfor (const [prop, deps] of objectWatchers.entries()) {\n\t\t\t\t\t\t\tdeps.delete(runEffect)\n\t\t\t\t\t\t\tif (deps.size === 0) {\n\t\t\t\t\t\t\t\tobjectWatchers.delete(prop)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (objectWatchers.size === 0) {\n\t\t\t\t\t\t\twatchers.delete(reactiveObj)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\teffectToReactiveObjects.delete(runEffect)\n\t\t\t}\n\t\t}\n\t}\n\t// Mark the runEffect callback with the original function as its root\n\tmarkWithRoot(runEffect, fn)\n\n\tatomicEffect(runEffect, 'immediate')\n\n\tconst mainCleanup = (): void => {\n\t\tif (effectStopped) return\n\t\teffectStopped = true\n\t\tcleanup?.()\n\t\t// Invoke all child cleanups (recursive via subEffectCleanup calling its own mainCleanup)\n\t\tconst children = effectChildren.get(runEffect)\n\t\tif (children) {\n\t\t\tfor (const childCleanup of children) childCleanup()\n\t\t\teffectChildren.delete(runEffect)\n\t\t}\n\n\t\tfr.unregister(mainCleanup)\n\t}\n\n\t// Only ROOT effects are registered for GC cleanup\n\tif (!parentEffect) {\n\t\tconst callIfCollected = () => mainCleanup()\n\t\tfr.register(callIfCollected, mainCleanup, callIfCollected)\n\t\treturn callIfCollected\n\t}\n\t// Register this effect to be cleaned up with the parent effect\n\tlet children = effectChildren.get(parentEffect)\n\tif (!children) {\n\t\tchildren = new Set()\n\t\teffectChildren.set(parentEffect, children)\n\t}\n\tconst parent = parentEffect\n\tconst subEffectCleanup = (): void => {\n\t\tchildren.delete(subEffectCleanup)\n\t\tif (children.size === 0) {\n\t\t\teffectChildren.delete(parent)\n\t\t}\n\t\t// Execute this child effect cleanup (which triggers its own mainCleanup)\n\t\tmainCleanup()\n\t}\n\tchildren.add(subEffectCleanup)\n\treturn subEffectCleanup\n}\n\n/**\n * Mark an object as non-reactive. This object and all its properties will never be made reactive.\n * @param obj - The object to mark as non-reactive\n */\nfunction nonReactive<T extends object[]>(...obj: T): T[0] {\n\tfor (const o of obj) {\n\t\ttry {\n\t\t\tObject.defineProperty(o, nonReactiveMark, {\n\t\t\t\tvalue: true,\n\t\t\t\twritable: false,\n\t\t\t\tenumerable: false,\n\t\t\t\tconfigurable: false,\n\t\t\t})\n\t\t} catch {}\n\t\tif (!(nonReactiveMark in (o as object))) nonReactiveObjects.add(o as object)\n\t}\n\treturn obj[0]\n}\n\n/**\n * Set of functions to test if an object is immutable\n */\nexport const immutables = new Set<(tested: any) => boolean>()\n\n/**\n * Check if an object is marked as non-reactive (for testing purposes)\n * @param obj - The object to check\n * @returns true if the object is marked as non-reactive\n */\nexport function isNonReactive(obj: any): boolean {\n\t// Don't make primitives reactive\n\tif (obj === null || typeof obj !== 'object') return true\n\n\t// Check if the object itself is marked as non-reactive\n\tif (nonReactiveObjects.has(obj)) return true\n\n\t// Check if the object has the non-reactive symbol\n\tif (obj[nonReactiveMark]) return true\n\n\t// Check if the object is immutable\n\tif (Array.from(immutables).some((fn) => fn(obj))) return true\n\n\treturn false\n}\n\n/**\n * Mark a class as non-reactive. All instances of this class will automatically be non-reactive.\n * @param cls - The class constructor to mark as non-reactive\n */\nexport function nonReactiveClass<T extends (new (...args: any[]) => any)[]>(...cls: T): T[0] {\n\tfor (const c of cls) if (c) (c.prototype as any)[nonReactiveMark] = true\n\treturn cls[0]\n}\n\nnonReactiveClass(Date, RegExp, Error, Promise, Function)\nif (typeof window !== 'undefined') nonReactive(window, document)\nif (typeof Element !== 'undefined') nonReactiveClass(Element, Node)\n\nexport function registerNativeReactivity(\n\toriginalClass: new (...args: any[]) => any,\n\treactiveClass: new (...args: any[]) => any\n) {\n\toriginalClass.prototype[nativeReactive] = reactiveClass\n\tnonReactiveClass(reactiveClass)\n}\n\n/**\n * Deep watch an object and all its nested properties\n * @param target - The object to watch deeply\n * @param callback - The callback to call when any nested property changes\n * @param options - Options for the deep watch\n * @returns A cleanup function to stop watching\n */\nexport function deepWatch<T extends object>(\n\ttarget: T,\n\tcallback: (value: T) => void,\n\t{ immediate = false } = {}\n): (() => void) | undefined {\n\tif (target === null || target === undefined) return undefined\n\tif (typeof target !== 'object') throw new Error('Target of deep watching must be an object')\n\t// Create a wrapper callback that matches ScopedCallback signature\n\tconst wrappedCallback: ScopedCallback = markWithRoot(() => callback(target), callback)\n\n\t// Use the existing effect system to register dependencies\n\treturn effect(() => {\n\t\t// Mark the target object as having deep watchers\n\t\tobjectsWithDeepWatchers.add(target)\n\n\t\t// Track which objects this effect is watching for cleanup\n\t\tlet effectObjects = effectToDeepWatchedObjects.get(wrappedCallback)\n\t\tif (!effectObjects) {\n\t\t\teffectObjects = new Set()\n\t\t\teffectToDeepWatchedObjects.set(wrappedCallback, effectObjects)\n\t\t}\n\t\teffectObjects!.add(target)\n\n\t\t// Traverse the object graph and register dependencies\n\t\t// This will re-run every time the effect runs, ensuring we catch all changes\n\t\tconst visited = new WeakSet()\n\t\tfunction traverseAndTrack(obj: any, depth = 0) {\n\t\t\t// Prevent infinite recursion and excessive depth\n\t\t\tif (visited.has(obj) || !isObject(obj) || depth > options.maxDeepWatchDepth) return\n\t\t\t// Do not traverse into unreactive objects\n\t\t\tif (isNonReactive(obj)) return\n\t\t\tvisited.add(obj)\n\n\t\t\t// Mark this object as having deep watchers\n\t\t\tobjectsWithDeepWatchers.add(obj)\n\t\t\teffectObjects!.add(obj)\n\n\t\t\t// Traverse all properties to register dependencies\n\t\t\t// unwrap to avoid kicking dependency\n\t\t\tfor (const key in unwrap(obj)) {\n\t\t\t\tif (Object.hasOwn(obj, key)) {\n\t\t\t\t\t// Access the property to register dependency\n\t\t\t\t\tconst value = (obj as any)[key]\n\t\t\t\t\t// Make the value reactive if it's an object\n\t\t\t\t\tconst reactiveValue =\n\t\t\t\t\t\ttypeof value === 'object' && value !== null ? reactive(value) : value\n\t\t\t\t\ttraverseAndTrack(reactiveValue, depth + 1)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Also handle array indices and length\n\t\t\t// biome-ignore lint/suspicious/useIsArray: Check for both native arrays and reactive arrays\n\t\t\tif (Array.isArray(obj) || obj instanceof Array) {\n\t\t\t\t// Access array length to register dependency on length changes\n\t\t\t\tconst length = obj.length\n\n\t\t\t\t// Access all current array elements to register dependencies\n\t\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\t\t// Access the array element to register dependency\n\t\t\t\t\tconst value = obj[i]\n\t\t\t\t\t// Make the value reactive if it's an object\n\t\t\t\t\tconst reactiveValue =\n\t\t\t\t\t\ttypeof value === 'object' && value !== null ? reactive(value) : value\n\t\t\t\t\ttraverseAndTrack(reactiveValue, depth + 1)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Handle Set values (deep watch values only, not keys since Sets don't have separate keys)\n\t\t\telse if (obj instanceof Set) {\n\t\t\t\t// Access all Set values to register dependencies\n\t\t\t\tfor (const value of obj) {\n\t\t\t\t\t// Make the value reactive if it's an object\n\t\t\t\t\tconst reactiveValue =\n\t\t\t\t\t\ttypeof value === 'object' && value !== null ? reactive(value) : value\n\t\t\t\t\ttraverseAndTrack(reactiveValue, depth + 1)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Handle Map values (deep watch values only, not keys)\n\t\t\telse if (obj instanceof Map) {\n\t\t\t\t// Access all Map values to register dependencies\n\t\t\t\tfor (const [_key, value] of obj) {\n\t\t\t\t\t// Make the value reactive if it's an object\n\t\t\t\t\tconst reactiveValue =\n\t\t\t\t\t\ttypeof value === 'object' && value !== null ? reactive(value) : value\n\t\t\t\t\ttraverseAndTrack(reactiveValue, depth + 1)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Note: WeakSet and WeakMap cannot be iterated, so we can't deep watch their contents\n\t\t\t// They will only trigger when the collection itself is replaced\n\t\t}\n\n\t\t// Traverse the target object to register all dependencies\n\t\t// This will register dependencies on all current properties and array elements\n\t\ttraverseAndTrack(target)\n\n\t\t// Only call the callback if immediate is true or if it's not the first run\n\t\tif (immediate) callback(target)\n\t\timmediate = true\n\n\t\t// Return a cleanup function that properly removes deep watcher tracking\n\t\treturn () => {\n\t\t\t// Get the objects this effect was watching\n\t\t\tconst effectObjects = effectToDeepWatchedObjects.get(wrappedCallback)\n\t\t\tif (effectObjects) {\n\t\t\t\t// Remove deep watcher tracking from all objects this effect was watching\n\t\t\t\tfor (const obj of effectObjects) {\n\t\t\t\t\t// Check if this object still has other deep watchers\n\t\t\t\t\tconst watchers = deepWatchers.get(obj)\n\t\t\t\t\tif (watchers) {\n\t\t\t\t\t\t// Remove this effect's callback from the watchers\n\t\t\t\t\t\twatchers.delete(wrappedCallback)\n\n\t\t\t\t\t\t// If no more watchers, remove the object from deep watchers tracking\n\t\t\t\t\t\tif (watchers.size === 0) {\n\t\t\t\t\t\t\tdeepWatchers.delete(obj)\n\t\t\t\t\t\t\tobjectsWithDeepWatchers.delete(obj)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// No watchers found, remove from deep watchers tracking\n\t\t\t\t\t\tobjectsWithDeepWatchers.delete(obj)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Clean up the tracking data\n\t\t\t\teffectToDeepWatchedObjects.delete(wrappedCallback)\n\t\t\t}\n\t\t}\n\t})\n}\n\n/**\n * Check if an object is an object (not null, not primitive)\n */\nfunction isObject(obj: any): obj is object {\n\treturn obj !== null && typeof obj === 'object'\n}\n","import { decorator, GenericClassDecorator } from '../decorator'\nimport { renamed } from '../utils'\nimport {\n\ttype DependencyFunction,\n\tdeepWatch,\n\tdependant,\n\teffect,\n\tgetRoot,\n\tisNonReactive,\n\tmarkWithRoot,\n\tnonReactiveClass,\n\tnonReactiveMark,\n\tnonReactiveObjects,\n\toptions,\n\ttype ScopedCallback,\n\ttouched1,\n\tunreactiveProperties,\n\tuntracked,\n\tunwrap,\n} from './core'\n\n//#region computed\nlet computedInvalidations: (() => void)[] | undefined\n/**\n * When used in a computed property computation, it will register the callback to be called when the computed property is invalidated\n * @param cb - The callback to register\n * @param warn - Whether to warn if used outside of a computed property\n */\nexport function invalidateComputed(cb: () => void, warn = true) {\n\tif (computedInvalidations) computedInvalidations.push(cb)\n\telse if (warn) options.warn('Using `invalidateComputed` outside of a computed property')\n}\ntype ComputedFunction<T> = (dep: DependencyFunction) => T\nconst computedCache = new WeakMap<ComputedFunction<any>, any>()\nfunction computedFunction<T>(getter: ComputedFunction<T>): T {\n\tconst key = getRoot(getter)\n\tlet invalidations: (() => void)[] = []\n\tdependant(computedCache, key)\n\tif (computedCache.has(key)) return computedCache.get(key)\n\tlet stopped = false\n\tconst stop = effect(\n\t\tmarkWithRoot((dep) => {\n\t\t\tif (stopped) return\n\t\t\tconst oldCI = computedInvalidations\n\t\t\tif (computedCache.has(key)) {\n\t\t\t\t// This should *not* be called in the cleanup chain, as its effects would be lost and cleaned-up\n\t\t\t\tfor (const cb of invalidations) cb()\n\t\t\t\tinvalidations = []\n\t\t\t\tcomputedCache.delete(key)\n\t\t\t\ttouched1(computedCache, { type: 'invalidate', prop: key }, key)\n\t\t\t\tstop()\n\t\t\t\tstopped = true\n\t\t\t} else\n\t\t\t\ttry {\n\t\t\t\t\tcomputedInvalidations = invalidations\n\t\t\t\t\tcomputedCache.set(key, getter(dep))\n\t\t\t\t} finally {\n\t\t\t\t\tcomputedInvalidations = oldCI\n\t\t\t\t}\n\t\t}, getter)\n\t)\n\treturn computedCache.get(key)\n}\n\n/**\n * Get the cached value of a computed function - cache is invalidated when the dependencies change\n */\nexport const computed = decorator({\n\tgetter(original, propertyKey) {\n\t\tconst computers = new WeakMap<any, () => any>()\n\t\treturn function (this: any) {\n\t\t\tif (!computers.has(this)) {\n\t\t\t\tcomputers.set(\n\t\t\t\t\tthis,\n\t\t\t\t\trenamed(\n\t\t\t\t\t\t() => original.call(this),\n\t\t\t\t\t\t`${String(this.constructor.name)}.${String(propertyKey)}`\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn computedFunction(computers.get(this)!)\n\t\t}\n\t},\n\tdefault<T>(getter: ComputedFunction<T>): T {\n\t\treturn computedFunction(getter)\n\t},\n})\n\n//#endregion\n\n//#region watch\n\nconst unsetYet = Symbol('unset-yet')\nexport interface WatchOptions {\n\timmediate?: boolean\n\tdeep?: boolean\n}\nexport function watch<T>(\n\tvalue: (dep: DependencyFunction) => T,\n\tchanged: (value: T, oldValue?: T) => void,\n\toptions?: Omit<WatchOptions, 'deep'> & { deep?: false }\n): ScopedCallback\nexport function watch<T extends object | any[]>(\n\tvalue: (dep: DependencyFunction) => T,\n\tchanged: (value: T, oldValue?: T) => void,\n\toptions?: Omit<WatchOptions, 'deep'> & { deep: true }\n): ScopedCallback\nexport function watch<T extends object | any[]>(\n\tvalue: T,\n\tchanged: (value: T) => void,\n\toptions?: WatchOptions\n): ScopedCallback\n\nexport function watch(\n\tvalue: any, //object | ((dep: DependencyFunction) => object),\n\tchanged: (value?: object, oldValue?: object) => void,\n\toptions: any = {}\n) {\n\treturn typeof value === 'function'\n\t\t? watchCallBack(value, changed, options)\n\t\t: typeof value === 'object'\n\t\t\t? watchObject(value, changed, options)\n\t\t\t: (() => {\n\t\t\t\t\tthrow new Error('watch: value must be a function or an object')\n\t\t\t\t})()\n}\n\nfunction watchObject(\n\tvalue: object,\n\tchanged: (value: object) => void,\n\t{ immediate = false, deep = false } = {}\n): ScopedCallback {\n\tif (deep) return deepWatch(value, changed, { immediate })\n\treturn effect(\n\t\tmarkWithRoot(() => {\n\t\t\tdependant(value)\n\t\t\tif (immediate) untracked(() => changed(value))\n\t\t\timmediate = true\n\t\t}, changed)\n\t)\n}\n\nfunction watchCallBack<T>(\n\tvalue: (dep: DependencyFunction) => T,\n\tchanged: (value: T, oldValue?: T) => void,\n\t{ immediate = false, deep = false } = {}\n): ScopedCallback {\n\tlet oldValue: T | typeof unsetYet = unsetYet\n\tlet deepCleanup: ScopedCallback | undefined\n\tconst cbCleanup = effect(\n\t\tmarkWithRoot((dep) => {\n\t\t\tconst newValue = value(dep)\n\t\t\tif (oldValue !== newValue)\n\t\t\t\tuntracked(\n\t\t\t\t\tmarkWithRoot(() => {\n\t\t\t\t\t\tif (oldValue === unsetYet) {\n\t\t\t\t\t\t\tif (immediate) changed(newValue)\n\t\t\t\t\t\t} else changed(newValue, oldValue)\n\t\t\t\t\t\toldValue = newValue\n\t\t\t\t\t\tif (deep) {\n\t\t\t\t\t\t\tif (deepCleanup) deepCleanup()\n\t\t\t\t\t\t\tdeepCleanup = deepWatch(\n\t\t\t\t\t\t\t\tnewValue as object,\n\t\t\t\t\t\t\t\tmarkWithRoot((value) => changed(value as T, value as T), changed)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t}, changed)\n\t\t\t\t)\n\t\t}, value)\n\t)\n\treturn () => {\n\t\tcbCleanup()\n\t\tif (deepCleanup) deepCleanup()\n\t}\n}\n\n//#endregion\n\n//#region nonReactive\n\n/**\n * Mark an object as non-reactive. This object and all its properties will never be made reactive.\n * @param obj - The object to mark as non-reactive\n */\nfunction deepNonReactive<T>(obj: T): T {\n\tobj = unwrap(obj)\n\tif (isNonReactive(obj)) return obj\n\ttry {\n\t\tObject.defineProperty(obj as object, nonReactiveMark, {\n\t\t\tvalue: true,\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true,\n\t\t})\n\t} catch {}\n\tif (!(nonReactiveMark in (obj as object))) nonReactiveObjects.add(obj as object)\n\tfor (const key in obj) deepNonReactive(obj[key])\n\treturn obj\n}\nfunction unreactiveApplication<T extends object>(...args: (keyof T)[]): GenericClassDecorator<T>\nfunction unreactiveApplication<T extends object>(obj: T): T\nfunction unreactiveApplication<T extends object>(\n\targ1: T | keyof T,\n\t...args: (keyof T)[]\n): GenericClassDecorator<T> | T {\n\treturn typeof arg1 === 'object'\n\t\t? deepNonReactive(arg1)\n\t\t: (((original) => {\n\t\t\t\t// Copy the parent's unreactive properties if they exist\n\t\t\t\toriginal.prototype[unreactiveProperties] = new Set<PropertyKey>(\n\t\t\t\t\toriginal.prototype[unreactiveProperties] || []\n\t\t\t\t)\n\t\t\t\t// Add all arguments (including the first one)\n\t\t\t\toriginal.prototype[unreactiveProperties].add(arg1)\n\t\t\t\tfor (const arg of args) original.prototype[unreactiveProperties].add(arg)\n\t\t\t\treturn original // Return the class\n\t\t\t}) as GenericClassDecorator<T>)\n}\nexport const unreactive = decorator({\n\tclass(original) {\n\t\t// Called without arguments, mark entire class as non-reactive\n\t\tnonReactiveClass(original)\n\t},\n\tdefault: unreactiveApplication,\n})\n\n//#endregion\n\nimport { profileInfo } from './core'\n\nObject.assign(profileInfo, { computedCache })\n","import { Indexable } from '../indexable'\nimport {\n\tdependant,\n\tmakeReactiveEntriesIterator,\n\tmakeReactiveIterator,\n\tprototypeForwarding,\n\treactive,\n\ttouched,\n} from './core'\n\nconst native = Symbol('native')\nconst isArray = Array.isArray\nArray.isArray = ((value: any) =>\n\t// biome-ignore lint/suspicious/useIsArray: We are defining it\n\tisArray(value) || (value instanceof Array && native in value)) as any\nclass ReactiveBaseArray {\n\tdeclare readonly [native]: any[]\n}\nfunction* index(i: number, { length = true } = {}): IterableIterator<number | 'length'> {\n\tyield i\n\tif (length) yield 'length'\n}\n\nfunction* range(\n\ta: number,\n\tb: number,\n\t{ length = false } = {}\n): IterableIterator<number | 'length'> {\n\tconst start = Math.min(a, b)\n\tconst end = Math.max(a, b)\n\tfor (let i = start; i <= end; i++) yield i\n\tif (length) yield 'length'\n}\nexport class ReactiveArray extends Indexable(ReactiveBaseArray, {\n\tget(i: number): any {\n\t\tdependant(this[native], i)\n\t\treturn reactive(this[native][i])\n\t},\n\tset(i: number, value: any) {\n\t\tconst added = i >= this[native].length\n\t\tthis[native][i] = value\n\t\ttouched(this[native], { type: 'bunch', method: 'set' }, index(i, { length: added }))\n\t},\n\tgetLength() {\n\t\tdependant(this[native], 'length')\n\t\treturn this[native].length\n\t},\n\tsetLength(value: number) {\n\t\tconst oldLength = this[native].length\n\t\ttry {\n\t\t\tthis[native].length = value\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis[native],\n\t\t\t\t{ type: 'set', prop: 'length' },\n\t\t\t\trange(oldLength, value, { length: true })\n\t\t\t)\n\t\t}\n\t},\n}) {\n\tdeclare length: number\n\tconstructor(original: any[]) {\n\t\tsuper()\n\t\tObject.defineProperties(this, {\n\t\t\t// We have to make it double, as [native] must be `unique symbol` - impossible through import\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t})\n\t}\n\n\t// Safe array access with negative indices\n\tat(index: number): any {\n\t\tconst actualIndex = index < 0 ? this[native].length + index : index\n\t\tdependant(this, actualIndex)\n\t\tif (actualIndex < 0 || actualIndex >= this[native].length) return undefined\n\t\treturn reactive(this[native][actualIndex])\n\t}\n\n\tpush(...items: any[]) {\n\t\tconst oldLength = this[native].length\n\t\ttry {\n\t\t\treturn this[native].push(...items)\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'push' },\n\t\t\t\trange(oldLength, oldLength + items.length - 1, { length: true })\n\t\t\t)\n\t\t}\n\t}\n\n\tpop() {\n\t\tif (this[native].length === 0) return undefined\n\t\ttry {\n\t\t\treturn reactive(this[native].pop())\n\t\t} finally {\n\t\t\ttouched(this, { type: 'bunch', method: 'pop' }, index(this[native].length))\n\t\t}\n\t}\n\n\tshift() {\n\t\tif (this[native].length === 0) return undefined\n\t\ttry {\n\t\t\treturn reactive(this[native].shift())\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'shift' },\n\t\t\t\trange(0, this[native].length + 1, { length: true })\n\t\t\t)\n\t\t}\n\t}\n\n\tunshift(...items: any[]) {\n\t\ttry {\n\t\t\treturn this[native].unshift(...items)\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'unshift' },\n\t\t\t\trange(0, this[native].length - items.length, { length: true })\n\t\t\t)\n\t\t}\n\t}\n\n\tsplice(start: number, deleteCount?: number, ...items: any[]) {\n\t\tconst oldLength = this[native].length\n\t\tif (deleteCount === undefined) deleteCount = oldLength - start\n\t\ttry {\n\t\t\tif (deleteCount === undefined) return reactive(this[native].splice(start))\n\t\t\treturn reactive(this[native].splice(start, deleteCount, ...items))\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'splice' },\n\t\t\t\t// TODO: edge cases\n\t\t\t\tdeleteCount === items.length\n\t\t\t\t\t? range(start, start + deleteCount)\n\t\t\t\t\t: range(start, oldLength + Math.max(items.length - deleteCount, 0), {\n\t\t\t\t\t\t\tlength: true,\n\t\t\t\t\t\t})\n\t\t\t)\n\t\t}\n\t}\n\n\treverse() {\n\t\ttry {\n\t\t\treturn this[native].reverse()\n\t\t} finally {\n\t\t\ttouched(this, { type: 'bunch', method: 'reverse' }, range(0, this[native].length - 1))\n\t\t}\n\t}\n\n\tsort(compareFn?: (a: any, b: any) => number) {\n\t\ttry {\n\t\t\treturn this[native].sort(compareFn) as any\n\t\t} finally {\n\t\t\ttouched(this, { type: 'bunch', method: 'sort' }, range(0, this[native].length - 1))\n\t\t}\n\t}\n\n\tfill(value: any, start?: number, end?: number) {\n\t\ttry {\n\t\t\tif (start === undefined) return this[native].fill(value) as any\n\t\t\tif (end === undefined) return this[native].fill(value, start) as any\n\t\t\treturn this[native].fill(value, start, end) as any\n\t\t} finally {\n\t\t\ttouched(this, { type: 'bunch', method: 'fill' }, range(0, this[native].length - 1))\n\t\t}\n\t}\n\n\tcopyWithin(target: number, start: number, end?: number) {\n\t\ttry {\n\t\t\tif (end === undefined) return this[native].copyWithin(target, start) as any\n\t\t\treturn this[native].copyWithin(target, start, end) as any\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'copyWithin' },\n\t\t\t\t// TODO: calculate the range properly\n\t\t\t\trange(0, this[native].length - 1)\n\t\t\t)\n\t\t}\n\t\t// Touch all affected indices with a single allProps call\n\t}\n\n\t// Immutable versions of mutator methods\n\ttoReversed(): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].toReversed())\n\t}\n\n\ttoSorted(compareFn?: (a: any, b: any) => number): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].toSorted(compareFn))\n\t}\n\n\ttoSpliced(start: number, deleteCount?: number, ...items: any[]): any[] {\n\t\tdependant(this)\n\t\treturn deleteCount === undefined\n\t\t\t? this[native].toSpliced(start)\n\t\t\t: this[native].toSpliced(start, deleteCount, ...items)\n\t}\n\n\twith(index: number, value: any): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].with(index, value))\n\t}\n\n\t// Iterator methods with reactivity tracking\n\tentries() {\n\t\tdependant(this)\n\t\treturn makeReactiveEntriesIterator(this[native].entries())\n\t}\n\n\tkeys() {\n\t\tdependant(this)\n\t\treturn this[native].keys()\n\t}\n\n\tvalues() {\n\t\tdependant(this)\n\t\treturn makeReactiveIterator(this[native].values())\n\t}\n\n\t[Symbol.iterator]() {\n\t\tdependant(this)\n\t\tconst nativeIterator = this[native][Symbol.iterator]()\n\t\treturn {\n\t\t\tnext() {\n\t\t\t\tconst result = nativeIterator.next()\n\t\t\t\tif (result.done) {\n\t\t\t\t\treturn result\n\t\t\t\t}\n\t\t\t\treturn { value: reactive(result.value), done: false }\n\t\t\t},\n\t\t}\n\t}\n\n\tindexOf(searchElement: any, fromIndex?: number): number {\n\t\tdependant(this)\n\t\treturn this[native].indexOf(searchElement, fromIndex)\n\t}\n\n\tlastIndexOf(searchElement: any, fromIndex?: number): number {\n\t\tdependant(this)\n\t\treturn this[native].lastIndexOf(searchElement, fromIndex)\n\t}\n\n\tincludes(searchElement: any, fromIndex?: number): boolean {\n\t\tdependant(this)\n\t\treturn this[native].includes(searchElement, fromIndex)\n\t}\n\n\tfind(\n\t\tpredicate: (this: any, value: any, index: number, obj: any[]) => boolean,\n\t\tthisArg?: any\n\t): any {\n\t\tdependant(this)\n\t\treturn reactive(this[native].find(predicate, thisArg))\n\t}\n\n\tfindIndex(\n\t\tpredicate: (this: any, value: any, index: number, obj: any[]) => boolean,\n\t\tthisArg?: any\n\t): number {\n\t\tdependant(this)\n\t\treturn this[native].findIndex(predicate, thisArg)\n\t}\n\n\tflat(): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].flat())\n\t}\n\n\tflatMap(\n\t\tcallbackfn: (this: any, value: any, index: number, array: any[]) => any[],\n\t\tthisArg?: any\n\t): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].flatMap(callbackfn, thisArg))\n\t}\n\n\tfilter(callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].filter(callbackfn as any, thisArg))\n\t}\n\n\tmap(callbackfn: (value: any, index: number, array: any[]) => any, thisArg?: any): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].map(callbackfn as any, thisArg))\n\t}\n\n\treduce(\n\t\tcallbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any,\n\t\tinitialValue?: any\n\t): any {\n\t\tdependant(this)\n\t\tconst result =\n\t\t\tinitialValue === undefined\n\t\t\t\t? this[native].reduce(callbackfn as any)\n\t\t\t\t: this[native].reduce(callbackfn as any, initialValue)\n\t\treturn reactive(result)\n\t}\n\n\treduceRight(\n\t\tcallbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any,\n\t\tinitialValue?: any\n\t): any {\n\t\tdependant(this)\n\t\tconst result =\n\t\t\tinitialValue !== undefined\n\t\t\t\t? this[native].reduceRight(callbackfn as any, initialValue)\n\t\t\t\t: (this[native] as any).reduceRight(callbackfn as any)\n\t\treturn reactive(result)\n\t}\n\n\tslice(start?: number, end?: number): any[] {\n\t\tfor (const i of range(start || 0, end || this[native].length - 1)) dependant(this, i)\n\t\treturn start === undefined\n\t\t\t? this[native].slice()\n\t\t\t: end === undefined\n\t\t\t\t? this[native].slice(start)\n\t\t\t\t: this[native].slice(start, end)\n\t}\n\n\tconcat(...items: any[]): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].concat(...items))\n\t}\n\n\tjoin(separator?: string): string {\n\t\tdependant(this)\n\t\treturn this[native].join(separator as any)\n\t}\n\n\tforEach(callbackfn: (value: any, index: number, array: any[]) => void, thisArg?: any): void {\n\t\tdependant(this)\n\t\tthis[native].forEach(callbackfn as any, thisArg)\n\t}\n\n\t// TODO: re-implement for fun dependencies? (eg - every only check the first ones until it find some),\n\t// no need to make it dependant on indexes after the found one\n\tevery(callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any): boolean {\n\t\tdependant(this)\n\t\treturn this[native].every(callbackfn as any, thisArg)\n\t}\n\n\tsome(callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any): boolean {\n\t\tdependant(this)\n\t\treturn this[native].some(callbackfn as any, thisArg)\n\t}\n}\n","import {\n\tdependant,\n\tmakeReactiveEntriesIterator,\n\tmakeReactiveIterator,\n\tprototypeForwarding,\n\treactive,\n\ttouched,\n\ttouched1,\n} from './core'\n\nconst native = Symbol('native')\n\nexport class ReactiveWeakMap<K extends object, V> {\n\tdeclare readonly [native]: WeakMap<K, V>\n\tdeclare readonly content: symbol\n\tconstructor(original: WeakMap<K, V>) {\n\t\tObject.defineProperties(this, {\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t\tcontent: { value: Symbol('content') },\n\t\t\t[Symbol.toStringTag]: { value: 'ReactiveWeakMap' },\n\t\t})\n\t}\n\n\t// Implement WeakMap interface methods with reactivity\n\tdelete(key: K): boolean {\n\t\tconst hadKey = this[native].has(key)\n\t\tconst result = this[native].delete(key)\n\n\t\tif (hadKey) touched1(this.content, { type: 'del', prop: key }, key)\n\n\t\treturn result\n\t}\n\n\tget(key: K): V | undefined {\n\t\tdependant(this.content, key)\n\t\treturn reactive(this[native].get(key))\n\t}\n\n\thas(key: K): boolean {\n\t\tdependant(this.content, key)\n\t\treturn this[native].has(key)\n\t}\n\n\tset(key: K, value: V): this {\n\t\t// Trigger effects for the specific key\n\t\ttouched1(this.content, { type: this[native].has(key) ? 'set' : 'add', prop: key }, key)\n\t\tthis[native].set(key, value)\n\n\t\treturn this\n\t}\n}\n\nexport class ReactiveMap<K, V> {\n\tdeclare readonly [native]: Map<K, V>\n\tdeclare readonly content: symbol\n\n\tconstructor(original: Map<K, V>) {\n\t\tObject.defineProperties(this, {\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t\tcontent: { value: Symbol('content') },\n\t\t\t[Symbol.toStringTag]: { value: 'ReactiveMap' },\n\t\t})\n\t}\n\n\t// Implement Map interface methods with reactivity\n\tget size(): number {\n\t\tdependant(this, 'size') // The ReactiveMap instance still goes through proxy\n\t\treturn this[native].size\n\t}\n\n\tclear(): void {\n\t\tconst hadEntries = this[native].size > 0\n\t\tthis[native].clear()\n\n\t\tif (hadEntries) {\n\t\t\tconst evolution = { type: 'bunch', method: 'clear' } as const\n\t\t\t// Clear triggers all effects since all keys are affected\n\t\t\ttouched1(this, evolution, 'size')\n\t\t\ttouched(this.content, evolution)\n\t\t}\n\t}\n\n\tentries(): Generator<[K, V]> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveEntriesIterator(this[native].entries())\n\t}\n\n\tforEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void {\n\t\tdependant(this.content)\n\t\tthis[native].forEach(callbackfn, thisArg)\n\t}\n\n\tkeys(): MapIterator<K> {\n\t\tdependant(this.content)\n\t\treturn this[native].keys()\n\t}\n\n\tvalues(): Generator<V> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveIterator(this[native].values())\n\t}\n\n\t[Symbol.iterator](): Iterator<[K, V]> {\n\t\tdependant(this.content)\n\t\tconst nativeIterator = this[native][Symbol.iterator]()\n\t\treturn {\n\t\t\tnext() {\n\t\t\t\tconst result = nativeIterator.next()\n\t\t\t\tif (result.done) {\n\t\t\t\t\treturn result\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tvalue: [result.value[0], reactive(result.value[1])],\n\t\t\t\t\tdone: false,\n\t\t\t\t}\n\t\t\t},\n\t\t}\n\t}\n\n\t// Implement Map methods with reactivity\n\tdelete(key: K): boolean {\n\t\tconst hadKey = this[native].has(key)\n\t\tconst result = this[native].delete(key)\n\n\t\tif (hadKey) {\n\t\t\tconst evolution = { type: 'del', prop: key } as const\n\t\t\ttouched1(this.content, evolution, key)\n\t\t\ttouched1(this, evolution, 'size')\n\t\t}\n\n\t\treturn result\n\t}\n\n\tget(key: K): V | undefined {\n\t\tdependant(this.content, key)\n\t\treturn reactive(this[native].get(key))\n\t}\n\n\thas(key: K): boolean {\n\t\tdependant(this.content, key)\n\t\treturn this[native].has(key)\n\t}\n\n\tset(key: K, value: V): this {\n\t\tconst hadKey = this[native].has(key)\n\t\tconst oldValue = this[native].get(key)\n\t\tconst reactiveValue = reactive(value)\n\t\tthis[native].set(key, reactiveValue)\n\n\t\tif (!hadKey || oldValue !== reactiveValue) {\n\t\t\tconst evolution = { type: hadKey ? 'set' : 'add', prop: key } as const\n\t\t\ttouched1(this.content, evolution, key)\n\t\t\ttouched1(this, evolution, 'size')\n\t\t}\n\n\t\treturn this\n\t}\n}\n","import {\n\tdependant,\n\tmakeReactiveEntriesIterator,\n\tmakeReactiveIterator,\n\tprototypeForwarding,\n\treactive,\n\ttouched,\n\ttouched1,\n} from './core'\n\nconst native = Symbol('native')\n\nexport class ReactiveWeakSet<T extends object> {\n\tdeclare readonly [native]: WeakSet<T>\n\tdeclare readonly content: symbol\n\n\tconstructor(original: WeakSet<T>) {\n\t\tObject.defineProperties(this, {\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t\tcontent: { value: Symbol('content') },\n\t\t\t[Symbol.toStringTag]: { value: 'ReactiveWeakSet' },\n\t\t})\n\t}\n\n\tadd(value: T): this {\n\t\tconst had = this[native].has(value)\n\t\tthis[native].add(value)\n\t\tif (!had) {\n\t\t\t// touch the specific value and the collection view\n\t\t\ttouched1(this.content, { type: 'add', prop: value }, value)\n\t\t\t// no size/allProps for WeakSet\n\t\t}\n\t\treturn this\n\t}\n\n\tdelete(value: T): boolean {\n\t\tconst had = this[native].has(value)\n\t\tconst res = this[native].delete(value)\n\t\tif (had) touched1(this.content, { type: 'del', prop: value }, value)\n\t\treturn res\n\t}\n\n\thas(value: T): boolean {\n\t\tdependant(this.content, value)\n\t\treturn this[native].has(value)\n\t}\n}\n\nexport class ReactiveSet<T> {\n\tdeclare readonly [native]: Set<T>\n\tdeclare readonly content: symbol\n\tconstructor(original: Set<T>) {\n\t\tObject.defineProperties(this, {\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t\tcontent: { value: Symbol('content') },\n\t\t\t[Symbol.toStringTag]: { value: 'ReactiveSet' },\n\t\t})\n\t}\n\n\tget size(): number {\n\t\t// size depends on the wrapper instance, like Map counterpart\n\t\tdependant(this, 'size')\n\t\treturn this[native].size\n\t}\n\n\tadd(value: T): this {\n\t\tconst had = this[native].has(value)\n\t\tconst reactiveValue = reactive(value)\n\t\tthis[native].add(reactiveValue)\n\t\tif (!had) {\n\t\t\tconst evolution = { type: 'add', prop: reactiveValue } as const\n\t\t\t// touch for value-specific and aggregate dependencies\n\t\t\ttouched1(this.content, evolution, reactiveValue)\n\t\t\ttouched1(this, evolution, 'size')\n\t\t}\n\t\treturn this\n\t}\n\n\tclear(): void {\n\t\tconst hadEntries = this[native].size > 0\n\t\tthis[native].clear()\n\t\tif (hadEntries) {\n\t\t\tconst evolution = { type: 'bunch', method: 'clear' } as const\n\t\t\ttouched1(this, evolution, 'size')\n\t\t\ttouched(this.content, evolution)\n\t\t}\n\t}\n\n\tdelete(value: T): boolean {\n\t\tconst had = this[native].has(value)\n\t\tconst res = this[native].delete(value)\n\t\tif (had) {\n\t\t\tconst evolution = { type: 'del', prop: value } as const\n\t\t\ttouched1(this.content, evolution, value)\n\t\t\ttouched1(this, evolution, 'size')\n\t\t}\n\t\treturn res\n\t}\n\n\thas(value: T): boolean {\n\t\tdependant(this.content, value)\n\t\treturn this[native].has(value)\n\t}\n\n\tentries(): Generator<[T, T]> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveEntriesIterator(this[native].entries())\n\t}\n\n\tforEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void {\n\t\tdependant(this.content)\n\t\tthis[native].forEach(callbackfn, thisArg)\n\t}\n\n\tkeys(): Generator<T> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveIterator(this[native].keys())\n\t}\n\n\tvalues(): Generator<T> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveIterator(this[native].values())\n\t}\n\n\t[Symbol.iterator](): Iterator<T> {\n\t\tdependant(this.content)\n\t\tconst nativeIterator = this[native][Symbol.iterator]()\n\t\treturn {\n\t\t\tnext() {\n\t\t\t\tconst result = nativeIterator.next()\n\t\t\t\tif (result.done) {\n\t\t\t\t\treturn result\n\t\t\t\t}\n\t\t\t\treturn { value: reactive(result.value), done: false }\n\t\t\t},\n\t\t}\n\t}\n}\n","export {\n\tatomic,\n\teffect,\n\tgetState,\n\timmutables,\n\tisNonReactive,\n\tisReactive,\n\toptions as reactiveOptions,\n\tprofileInfo,\n\tReactiveBase,\n\tReactiveError,\n\treactive,\n\ttype ScopedCallback,\n\tuntracked,\n\tunwrap,\n} from './core'\nexport { computed, invalidateComputed, unreactive, watch } from './interface'\n\nimport { ReactiveArray } from './array'\nimport { registerNativeReactivity } from './core'\nimport { ReactiveMap, ReactiveWeakMap } from './map'\nimport { ReactiveSet, ReactiveWeakSet } from './set'\n\n// Register native collection types to use specialized reactive wrappers\nregisterNativeReactivity(WeakMap, ReactiveWeakMap)\nregisterNativeReactivity(Map, ReactiveMap)\nregisterNativeReactivity(WeakSet, ReactiveWeakSet)\nregisterNativeReactivity(Set, ReactiveSet)\nregisterNativeReactivity(Array, ReactiveArray)\n","import { decorator, GenericClassDecorator } from './decorator'\n\n// In order to avoid async re-entrance, we could use zone.js or something like that.\nconst syncCalculating: { object: object; prop: PropertyKey }[] = []\nexport const cached = decorator({\n\tgetter(original, propertyKey) {\n\t\treturn function (this: any) {\n\t\t\tconst alreadyCalculating = syncCalculating.findIndex(\n\t\t\t\t(c) => c.object === this && c.prop === propertyKey\n\t\t\t)\n\t\t\tif (alreadyCalculating > -1)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Circular dependency detected: ${syncCalculating\n\t\t\t\t\t\t.slice(alreadyCalculating)\n\t\t\t\t\t\t.map((c) => `${c.object.constructor.name}.${String(c.prop)}`)\n\t\t\t\t\t\t.join(' -> ')} -> again`\n\t\t\t\t)\n\t\t\tsyncCalculating.push({ object: this, prop: propertyKey })\n\t\t\ttry {\n\t\t\t\tconst rv = original.call(this)\n\t\t\t\tcache(this, propertyKey, rv)\n\t\t\t\treturn rv\n\t\t\t} finally {\n\t\t\t\tsyncCalculating.pop()\n\t\t\t}\n\t\t}\n\t},\n})\n\nexport function isCached(object: Object, propertyKey: PropertyKey) {\n\treturn !!Object.getOwnPropertyDescriptor(object, propertyKey)\n}\n\nexport function cache(object: Object, propertyKey: PropertyKey, value: any) {\n\tObject.defineProperty(object, propertyKey, { value })\n}\n\nexport function describe(descriptor: {\n\tenumerable?: boolean\n\tconfigurable?: boolean // Not modifiable once the property has been defined ?\n\twritable?: boolean\n}) {\n\treturn <T>(...properties: (keyof T)[]): GenericClassDecorator<T> =>\n\t\t(Base) => {\n\t\t\treturn class extends Base {\n\t\t\t\tconstructor(...args: any[]) {\n\t\t\t\t\tsuper(...args)\n\t\t\t\t\tfor (const key of properties) {\n\t\t\t\t\t\tObject.defineProperty(this, key, {\n\t\t\t\t\t\t\t...Object.getOwnPropertyDescriptor(this, key),\n\t\t\t\t\t\t\t...descriptor,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n}\n\nexport const deprecated = Object.assign(\n\tdecorator({\n\t\tmethod(original, propertyKey) {\n\t\t\treturn function (this: any, ...args: any[]) {\n\t\t\t\tdeprecated.warn(this, propertyKey)\n\t\t\t\treturn original.apply(this, args)\n\t\t\t}\n\t\t},\n\t\tgetter(original, propertyKey) {\n\t\t\treturn function (this: any) {\n\t\t\t\tdeprecated.warn(this, propertyKey)\n\t\t\t\treturn original.call(this)\n\t\t\t}\n\t\t},\n\t\tsetter(original, propertyKey) {\n\t\t\treturn function (this: any, value: any) {\n\t\t\t\tdeprecated.warn(this, propertyKey)\n\t\t\t\treturn original.call(this, value)\n\t\t\t}\n\t\t},\n\t\tclass(original) {\n\t\t\treturn class extends original {\n\t\t\t\tconstructor(...args: any[]) {\n\t\t\t\t\tsuper(...args)\n\t\t\t\t\tdeprecated.warn(this, 'constructor')\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tdefault(message: string) {\n\t\t\treturn decorator({\n\t\t\t\tmethod(original, propertyKey) {\n\t\t\t\t\treturn function (this: any, ...args: any[]) {\n\t\t\t\t\t\tdeprecated.warn(this, propertyKey, message)\n\t\t\t\t\t\treturn original.apply(this, args)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tgetter(original, propertyKey) {\n\t\t\t\t\treturn function (this: any) {\n\t\t\t\t\t\tdeprecated.warn(this, propertyKey, message)\n\t\t\t\t\t\treturn original.call(this)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tsetter(original, propertyKey) {\n\t\t\t\t\treturn function (this: any, value: any) {\n\t\t\t\t\t\tdeprecated.warn(this, propertyKey, message)\n\t\t\t\t\t\treturn original.call(this, value)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tclass(original) {\n\t\t\t\t\treturn class extends original {\n\t\t\t\t\t\tconstructor(...args: any[]) {\n\t\t\t\t\t\t\tsuper(...args)\n\t\t\t\t\t\t\tdeprecated.warn(this, 'constructor', message)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\t}),\n\t{\n\t\twarn: (target: any, propertyKey: PropertyKey, message?: string) => {\n\t\t\t// biome-ignore lint/suspicious/noConsole: To be overridden\n\t\t\tconsole.warn(\n\t\t\t\t`${target.constructor.name}.${String(propertyKey)} is deprecated${message ? `: ${message}` : ''}`\n\t\t\t)\n\t\t},\n\t}\n)\n\nexport function debounce(delay: number) {\n\treturn decorator({\n\t\tmethod(original, _propertyKey) {\n\t\t\tlet timeoutId: ReturnType<typeof setTimeout> | null = null\n\n\t\t\treturn function (this: any, ...args: any[]) {\n\t\t\t\t// Clear existing timeout\n\t\t\t\tif (timeoutId) {\n\t\t\t\t\tclearTimeout(timeoutId)\n\t\t\t\t}\n\n\t\t\t\t// Set new timeout\n\t\t\t\ttimeoutId = setTimeout(() => {\n\t\t\t\t\toriginal.apply(this, args)\n\t\t\t\t\ttimeoutId = null\n\t\t\t\t}, delay)\n\t\t\t}\n\t\t},\n\t})\n}\n\nexport function throttle(delay: number) {\n\treturn decorator({\n\t\tmethod(original, _propertyKey) {\n\t\t\tlet lastCallTime = 0\n\t\t\tlet timeoutId: ReturnType<typeof setTimeout> | null = null\n\n\t\t\treturn function (this: any, ...args: any[]) {\n\t\t\t\tconst now = Date.now()\n\n\t\t\t\t// If enough time has passed since last call, execute immediately\n\t\t\t\tif (now - lastCallTime >= delay) {\n\t\t\t\t\t// Clear any pending timeout since we're executing now\n\t\t\t\t\tif (timeoutId) {\n\t\t\t\t\t\tclearTimeout(timeoutId)\n\t\t\t\t\t\ttimeoutId = null\n\t\t\t\t\t}\n\t\t\t\t\tlastCallTime = now\n\t\t\t\t\treturn original.apply(this, args)\n\t\t\t\t}\n\n\t\t\t\t// Otherwise, schedule execution for when the delay period ends\n\t\t\t\tif (!timeoutId) {\n\t\t\t\t\tconst remainingTime = delay - (now - lastCallTime)\n\t\t\t\t\tconst scheduledArgs = [...args] // Capture args at scheduling time\n\t\t\t\t\ttimeoutId = setTimeout(() => {\n\t\t\t\t\t\tlastCallTime = Date.now()\n\t\t\t\t\t\toriginal.apply(this, scheduledArgs)\n\t\t\t\t\t\ttimeoutId = null\n\t\t\t\t\t}, remainingTime)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t})\n}\n","export class Eventful<Events extends Record<string, (...args: any[]) => void>> {\n\treadonly #events = new Map<keyof Events, ((...args: any[]) => void)[]>()\n\treadonly #hooks = [] as ((...args: any[]) => void)[]\n\n\tpublic hook(\n\t\tcb: <EventType extends keyof Events>(\n\t\t\tevent: EventType,\n\t\t\t...args: Parameters<Events[EventType]>\n\t\t) => void\n\t): () => void {\n\t\tif (!this.#hooks.includes(cb)) this.#hooks.push(cb)\n\t\treturn () => {\n\t\t\tthis.#hooks.splice(this.#hooks.indexOf(cb), 1)\n\t\t}\n\t}\n\n\tpublic on(events: Partial<Events>): void\n\tpublic on<EventType extends keyof Events>(event: EventType, cb: Events[EventType]): () => void\n\tpublic on<EventType extends keyof Events>(\n\t\teventOrEvents: EventType | Partial<Events>,\n\t\tcb?: Events[EventType]\n\t): () => void {\n\t\tif (typeof eventOrEvents === 'object') {\n\t\t\tfor (const e of Object.keys(eventOrEvents) as (keyof Events)[]) {\n\t\t\t\tthis.on(e, eventOrEvents[e]!)\n\t\t\t}\n\t\t} else if (cb !== undefined) {\n\t\t\tlet callbacks = this.#events.get(eventOrEvents)\n\t\t\tif (!callbacks) {\n\t\t\t\tcallbacks = []\n\t\t\t\tthis.#events.set(eventOrEvents, callbacks)\n\t\t\t}\n\t\t\tcallbacks.push(cb)\n\t\t}\n\t\t// @ts-expect-error Generic case leads to generic case\n\t\treturn () => this.off(eventOrEvents, cb)\n\t}\n\tpublic off(events: Partial<Events>): void\n\tpublic off<EventType extends keyof Events>(event: EventType, cb?: Events[EventType]): void\n\tpublic off<EventType extends keyof Events>(\n\t\teventOrEvents: EventType | Partial<Events>,\n\t\tcb?: Events[EventType]\n\t): void {\n\t\tif (typeof eventOrEvents === 'object') {\n\t\t\tfor (const e of Object.keys(eventOrEvents) as (keyof Events)[]) {\n\t\t\t\tthis.off(e, eventOrEvents[e])\n\t\t\t}\n\t\t} else if (cb !== null && cb !== undefined) {\n\t\t\tconst callbacks = this.#events.get(eventOrEvents)\n\t\t\tif (callbacks) {\n\t\t\t\tthis.#events.set(\n\t\t\t\t\teventOrEvents,\n\t\t\t\t\tcallbacks.filter((c) => c !== cb)\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\t// Remove all listeners for this event\n\t\t\tthis.#events.delete(eventOrEvents)\n\t\t}\n\t}\n\tpublic emit<EventType extends keyof Events>(\n\t\tevent: EventType,\n\t\t...args: Parameters<Events[EventType]>\n\t) {\n\t\tconst callbacks = this.#events.get(event)\n\t\tif (callbacks) for (const cb of callbacks) cb.apply(this, args)\n\t\tfor (const cb of this.#hooks) cb.call(this, event, ...args)\n\t}\n}\n"],"names":["nativeConstructors","Set","Object","Array","Date","Function","Map","WeakMap","WeakSet","Promise","Error","TypeError","ReferenceError","SyntaxError","RangeError","URIError","EvalError","Reflect","Proxy","RegExp","String","Number","Boolean","isConstructor","fn","has","toString","startsWith","renamed","fct","name","defineProperties","value","DecoratorError","constructor","message","super","this","legacyDecorator","description","target","propertyKey","descriptor","args","undefined","class","includes","newGetter","getter","get","newSetter","setter","set","newMethod","method","default","call","modernDecorator","context","kind","rv","decorator","contextOrKey","mode","_target","detectDecoratorMode","fr","FinalizationRegistry","f","destructor","Symbol","allocatedValues","DestructionError","msg","destroyedHandler","toStringTag","throw","allocated","original","getAt","setAt","Indexable","base","accessor","index","setPrototypeOf","prototype","prop","receiver","getOwnPropertyDescriptor","getLength","numProp","isNaN","setLength","defineProperty","writable","enumerable","configurable","effectToReactiveObjects","objectToProxy","proxyToObject","objectParents","objectsWithDeepWatchers","deepWatchers","effectToDeepWatchedObjects","nonReactiveObjects","absent","makeReactiveIterator","iterator","result","next","done","reactive","makeReactiveEntriesIterator","key","watchers","profileInfo","nativeReactive","nonReactiveMark","unreactiveProperties","prototypeForwarding","allProps","rootFunction","markWithRoot","root","getRoot","ReactiveError","options","enter","effect","leave","chain","caller","maxEffectChain","maxDeepWatchDepth","instanceMembers","warn","raiseDeps","objectWatchers","keyChains","keys","deps","from","atomicEffect","touched1","obj","evolution","touched","props","unwrap","state","getState","assign","states","addState","bubbleUpChange","dependant","activeEffect","add","effectObjects","parentEffect","batchedEffects","immediate","delete","runEffects","firstReturn","size","length","entries","push","atomic","apply","withEffect","keepParent","oldActiveEffect","oldParentEffect","addBackReference","child","parent","parents","removeBackReference","needsBackReferences","hasParentWithDeepWatchers","changedObject","parentDeepWatchers","watcher","reactiveHandlers","hasOwn","reactiveValue","isArrayCase","newValue","oldVal","track1","type","deleteProperty","getPrototypeOf","proto","ownKeys","reactiveClasses","ReactiveBase","reactiveObject","anyTarget","isNonReactive","proxied","proxy","Reactive","untracked","effectChildren","cleanup","dep","cb","runEffect","effectStopped","reactionCleanup","reactiveObj","mainCleanup","children","childCleanup","unregister","callIfCollected","register","subEffectCleanup","immutables","some","nonReactiveClass","cls","c","registerNativeReactivity","originalClass","reactiveClass","deepWatch","callback","wrappedCallback","visited","traverseAndTrack","depth","isObject","isArray","i","_key","computedInvalidations","window","o","nonReactive","document","Element","Node","computedCache","computedFunction","invalidations","stopped","stop","oldCI","computed","computers","unsetYet","deepNonReactive","unreactive","arg1","arg","native","ReactiveBaseArray","range","a","b","start","Math","min","end","max","ReactiveArray","added","oldLength","native$2","at","actualIndex","items","pop","shift","unshift","splice","deleteCount","reverse","sort","compareFn","fill","copyWithin","toReversed","toSorted","toSpliced","with","values","nativeIterator","indexOf","searchElement","fromIndex","lastIndexOf","find","predicate","thisArg","findIndex","flat","flatMap","callbackfn","filter","map","reduce","initialValue","reduceRight","slice","concat","join","separator","forEach","every","ReactiveMap","native$1","content","clear","hadEntries","hadKey","oldValue","ReactiveSet","had","res","syncCalculating","cached","alreadyCalculating","object","cache","deprecated","destructorObj","_a","destroy","destructors","getOwnPropertyNames","isDestroyable","myDestructor","destruction","_Eventful_events","_Eventful_hooks","hook","__classPrivateFieldGet","on","eventOrEvents","e","callbacks","off","emit","event","called","forward","delay","_propertyKey","timeoutId","clearTimeout","setTimeout","properties","Base","lastCallTime","now","remainingTime","scheduledArgs","changed","deep","deepCleanup","cbCleanup","watchCallBack","watchObject","minLength","arr","tuple"],"mappings":"4OAiBA,MAAMA,EAAqB,IAAIC,IAAc,CAC5CC,OACAC,MACAC,KACAC,SACAJ,IACAK,IACAC,QACAC,QACAC,QACAC,MACAC,UACAC,eACAC,YACAC,WACAC,SACAC,UACAC,QACAC,MACAC,OACAC,OACAC,OACAC,UAEK,SAAUC,EAAcC,GAC7B,OAAOA,IAAOxB,EAAmByB,IAAID,IAAOA,EAAGE,aAAaC,WAAW,UACxE,CAEM,SAAUC,EAA4BC,EAAQC,GACnD,OAAO5B,OAAO6B,iBAAiBF,EAAK,CACnCC,KAAM,CACLE,MAAOF,IAGV,CC9CM,MAAOG,UAAuBvB,MACnC,WAAAwB,CAAYC,GACXC,MAAMD,GACNE,KAAKP,KAAO,oBACb,EAkFK,SAAUQ,EAAyBC,GACxC,OAAO,SACNC,EACAC,EACAC,KACGC,GAEH,QAAoBC,IAAhBH,GACH,GAAIlB,EAAciB,GAAS,CAC1B,KAAM,UAAWD,GAAc,MAAM,IAAI7B,MAAM,0CAC/C,OAAO6B,EAAYM,QAAQL,EAC5B,OACM,GAAsB,iBAAXA,GAAuB,CAAC,SAAU,UAAUM,gBAAgBL,GAAc,CAC3F,IAAKC,EAAY,MAAM,IAAIhC,MAAM,0CAC5B,GAA0B,iBAAfgC,GAA2B,iBAAkBA,EAAY,CACxE,GAAI,QAASA,GAA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SAC9C1D,EAA4B,GAElC,IAAK,IAAIiI,EAAI,EAAGA,EAAImI,EAAWnI,IAAK,CACnC,MAAMqI,EAAQxU,EAAKsQ,IAAKiE,GAAQA,EAAIpI,IACpCjI,EAAO4D,KAAK0M,EACb,CAEA,OAAOtQ,CACR"}
|
|
1
|
+
{"version":3,"file":"mutts.umd.js","sources":["../src/utils.ts","../src/decorator.ts","../src/destroyable.ts","../src/indexable.ts","../src/mixins.ts","../src/reactive/core.ts","../src/reactive/interface.ts","../src/reactive/natives/array.ts","../src/reactive/natives/map.ts","../src/reactive/natives/set.ts","../src/reactive/index.ts","../src/std-decorators.ts","../src/eventful.ts"],"sourcesContent":["type ElementTypes<T extends readonly unknown[]> = {\n\t[K in keyof T]: T[K] extends readonly (infer U)[] ? U : T[K]\n}\n\n/**\n * Combines multiple arrays into an array of tuples, stopping at the shortest array length\n * @param args - Arrays to zip together\n * @returns Array of tuples containing elements from each input array\n */\nexport function zip<T extends (readonly unknown[])[]>(...args: T): ElementTypes<T>[] {\n\tif (!args.length) return []\n\tconst minLength = Math.min(...args.map((arr) => arr.length))\n\tconst result: ElementTypes<T>[] = []\n\n\tfor (let i = 0; i < minLength; i++) {\n\t\tconst tuple = args.map((arr) => arr[i]) as ElementTypes<T>\n\t\tresult.push(tuple)\n\t}\n\n\treturn result\n}\n\nconst nativeConstructors = new Set<Function>([\n\tObject,\n\tArray,\n\tDate,\n\tFunction,\n\tSet,\n\tMap,\n\tWeakMap,\n\tWeakSet,\n\tPromise,\n\tError,\n\tTypeError,\n\tReferenceError,\n\tSyntaxError,\n\tRangeError,\n\tURIError,\n\tEvalError,\n\tReflect,\n\tProxy,\n\tRegExp,\n\tString,\n\tNumber,\n\tBoolean,\n] as Function[])\n/**\n * Checks if a function is a constructor (class or constructor function)\n * @param fn - The function to check\n * @returns True if the function is a constructor\n */\nexport function isConstructor(fn: Function): boolean {\n\treturn (\n\t\tfn &&\n\t\ttypeof fn === 'function' &&\n\t\t(nativeConstructors.has(fn) || fn.toString?.().startsWith('class '))\n\t)\n}\n\n/**\n * Renames a function with a new name\n * @param fct - The function to rename\n * @param name - The new name for the function\n * @returns The function with the new name\n */\nexport function renamed<F extends Function>(fct: F, name: string): F {\n\treturn Object.defineProperties(fct, {\n\t\tname: {\n\t\t\tvalue: name,\n\t\t},\n\t})\n}\n\nexport function ReflectGet(obj: any, prop: any, receiver: any) {\n\t// Check if Node is available and obj is an instance of Node\n\tif (typeof Node !== 'undefined' && obj instanceof Node) return obj[prop]\n\treturn Reflect.get(obj, prop, receiver)\n}\n\nexport function ReflectSet(obj: any, prop: any, value: any, receiver: any) {\n\t// Check if Node is available and obj is an instance of Node\n\tif (typeof Node !== 'undefined' && obj instanceof Node) {\n\t\tobj[prop] = value\n\t\treturn value\n\t}\n\treturn Reflect.set(obj, prop, value, receiver)\n}\n\nexport function isOwnAccessor(obj: any, prop: any) {\n\tconst opd = Object.getOwnPropertyDescriptor(obj, prop)\n\treturn !!(opd?.get || opd?.set)\n}\n\n/**\n * Check if an object is an object (not null, not primitive)\n */\nexport function isObject(obj: any): obj is object {\n\treturn obj !== null && typeof obj === 'object'\n}\n","// biome-ignore-all lint/suspicious/noConfusingVoidType: We *love* voids\n// Standardized decorator system that works with both Legacy and Modern decorators\n\nimport { isConstructor } from './utils'\n\n/**\n * Error thrown when decorator operations fail\n */\nexport class DecoratorError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message)\n\t\tthis.name = 'DecoratorException'\n\t}\n}\n//#region all decorator types\n\n// Used for get/set and method decorators\n/**\n * Legacy property decorator type for methods, getters, and setters\n */\nexport type LegacyPropertyDecorator<T> = (\n\ttarget: T,\n\tname: string | symbol,\n\tdescriptor: PropertyDescriptor\n) => any\n\n/**\n * Legacy class decorator type\n */\nexport type LegacyClassDecorator<T> = (target: T) => any\n\n/**\n * Modern method decorator type\n */\nexport type ModernMethodDecorator<T> = (target: T, context: ClassMethodDecoratorContext) => any\n\n/**\n * Modern getter decorator type\n */\nexport type ModernGetterDecorator<T> = (target: T, context: ClassGetterDecoratorContext) => any\n\n/**\n * Modern setter decorator type\n */\nexport type ModernSetterDecorator<T> = (target: T, context: ClassSetterDecoratorContext) => any\n\n/**\n * Modern accessor decorator type\n */\nexport type ModernAccessorDecorator<T> = (target: T, context: ClassAccessorDecoratorContext) => any\n\n/**\n * Modern class decorator type\n */\nexport type ModernClassDecorator<T> = (target: T, context: ClassDecoratorContext) => any\n\n//#endregion\n\ntype DDMethod<T> = (\n\toriginal: (this: T, ...args: any[]) => any,\n\tname: PropertyKey\n) => ((this: T, ...args: any[]) => any) | void\n\ntype DDGetter<T> = (original: (this: T) => any, name: PropertyKey) => ((this: T) => any) | void\n\ntype DDSetter<T> = (\n\toriginal: (this: T, value: any) => void,\n\tname: PropertyKey\n) => ((this: T, value: any) => void) | void\n\ntype DDClass<T> = <Ctor extends new (...args: any[]) => T = new (...args: any[]) => T>(\n\ttarget: Ctor\n) => Ctor | void\n/**\n * Description object for creating decorators that work with both Legacy and Modern decorator proposals\n */\nexport interface DecoratorDescription<T> {\n\t/** Handler for method decorators */\n\tmethod?: DDMethod<T>\n\t/** Handler for class decorators */\n\tclass?: DDClass<T>\n\t/** Handler for getter decorators */\n\tgetter?: DDGetter<T>\n\t/** Handler for setter decorators */\n\tsetter?: DDSetter<T>\n\t/** Default handler for any decorator type not explicitly defined */\n\tdefault?: (...args: any[]) => any\n}\n\n/**\n * Type for decorators that work with both Legacy and Modern decorator proposals\n * Automatically infers the correct decorator type based on the description\n */\nexport type Decorator<T, Description extends DecoratorDescription<T>> = (Description extends {\n\tmethod: DDMethod<T>\n}\n\t? LegacyPropertyDecorator<T> & ModernMethodDecorator<T>\n\t: unknown) &\n\t(Description extends { class: DDClass<new (...args: any[]) => T> }\n\t\t? LegacyClassDecorator<new (...args: any[]) => T> &\n\t\t\t\tModernClassDecorator<new (...args: any[]) => T>\n\t\t: unknown) &\n\t(Description extends { getter: DDGetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernGetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { setter: DDSetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernSetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { default: infer Signature } ? Signature : unknown)\n\n/**\n * Factory type for creating decorators that work with both Legacy and Modern decorator proposals\n */\nexport type DecoratorFactory<T> = <Description extends DecoratorDescription<T>>(\n\tdescription: Description\n) => (Description extends { method: DDMethod<T> }\n\t? LegacyPropertyDecorator<T> & ModernMethodDecorator<T>\n\t: unknown) &\n\t(Description extends { class: DDClass<new (...args: any[]) => T> }\n\t\t? LegacyClassDecorator<new (...args: any[]) => T> &\n\t\t\t\tModernClassDecorator<new (...args: any[]) => T>\n\t\t: unknown) &\n\t(Description extends { getter: DDGetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernGetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { setter: DDSetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernSetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { default: infer Signature } ? Signature : unknown)\n\n/**\n * Creates a decorator that works with Legacy decorator proposals\n * @param description - The decorator description object\n * @returns A decorator function compatible with Legacy decorators\n */\nexport function legacyDecorator<T = any>(description: DecoratorDescription<T>): any {\n\treturn function (\n\t\ttarget: any,\n\t\tpropertyKey?: PropertyKey,\n\t\tdescriptor?: PropertyDescriptor,\n\t\t...args: any[]\n\t) {\n\t\tif (propertyKey === undefined) {\n\t\t\tif (isConstructor(target)) {\n\t\t\t\tif (!('class' in description)) throw new Error('Decorator cannot be applied to a class')\n\t\t\t\treturn description.class?.(target)\n\t\t\t}\n\t\t} else if (typeof target === 'object' && ['string', 'symbol'].includes(typeof propertyKey)) {\n\t\t\tif (!descriptor) throw new Error('Decorator cannot be applied to a field')\n\t\t\telse if (typeof descriptor === 'object' && 'configurable' in descriptor) {\n\t\t\t\tif ('get' in descriptor || 'set' in descriptor) {\n\t\t\t\t\tif (!('getter' in description || 'setter' in description))\n\t\t\t\t\t\tthrow new Error('Decorator cannot be applied to a getter or setter')\n\t\t\t\t\tif ('getter' in description) {\n\t\t\t\t\t\tconst newGetter = description.getter?.(descriptor.get, propertyKey)\n\t\t\t\t\t\tif (newGetter) descriptor.get = newGetter\n\t\t\t\t\t}\n\t\t\t\t\tif ('setter' in description) {\n\t\t\t\t\t\tconst newSetter = description.setter?.(descriptor.set, propertyKey)\n\t\t\t\t\t\tif (newSetter) descriptor.set = newSetter\n\t\t\t\t\t}\n\t\t\t\t\treturn descriptor\n\t\t\t\t} else if (typeof descriptor.value === 'function') {\n\t\t\t\t\tif (!('method' in description)) throw new Error('Decorator cannot be applied to a method')\n\t\t\t\t\tconst newMethod = description.method?.(descriptor.value, propertyKey)\n\t\t\t\t\tif (newMethod) descriptor.value = newMethod\n\t\t\t\t\treturn descriptor\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!('default' in description))\n\t\t\tthrow new Error('Decorator do not have a default implementation')\n\t\treturn description.default.call(this, target, propertyKey, descriptor, ...args)\n\t}\n}\n\n/**\n * Creates a decorator that works with Modern decorator proposals\n * @param description - The decorator description object\n * @returns A decorator function compatible with Modern decorators\n */\nexport function modernDecorator<T = any>(description: DecoratorDescription<T>): any {\n\treturn function (target: any, context?: DecoratorContext, ...args: any[]) {\n\t\tif (!context?.kind || typeof context.kind !== 'string') {\n\t\t\tif (!('default' in description))\n\t\t\t\tthrow new Error('Decorator do not have a default implementation')\n\t\t\treturn description.default.call(this, target, context, ...args)\n\t\t}\n\t\tswitch (context.kind) {\n\t\t\tcase 'class':\n\t\t\t\tif (!('class' in description)) throw new Error('Decorator cannot be applied to a class')\n\t\t\t\treturn description.class?.(target)\n\t\t\tcase 'field':\n\t\t\t\tthrow new Error('Decorator cannot be applied to a field')\n\t\t\tcase 'getter':\n\t\t\t\tif (!('getter' in description)) throw new Error('Decorator cannot be applied to a getter')\n\t\t\t\treturn description.getter?.(target, context.name)\n\t\t\tcase 'setter':\n\t\t\t\tif (!('setter' in description)) throw new Error('Decorator cannot be applied to a setter')\n\t\t\t\treturn description.setter?.(target, context.name)\n\t\t\tcase 'method':\n\t\t\t\tif (!('method' in description)) throw new Error('Decorator cannot be applied to a method')\n\t\t\t\treturn description.method?.(target, context.name)\n\t\t\tcase 'accessor': {\n\t\t\t\tif (!('getter' in description || 'setter' in description))\n\t\t\t\t\tthrow new Error('Decorator cannot be applied to a getter or setter')\n\t\t\t\tconst rv: Partial<ClassAccessorDecoratorResult<any, any>> = {}\n\t\t\t\tif ('getter' in description) {\n\t\t\t\t\tconst newGetter = description.getter?.(target.get, context.name)\n\t\t\t\t\tif (newGetter) rv.get = newGetter\n\t\t\t\t}\n\t\t\t\tif ('setter' in description) {\n\t\t\t\t\tconst newSetter = description.setter?.(target.set, context.name)\n\t\t\t\t\tif (newSetter) rv.set = newSetter\n\t\t\t\t}\n\t\t\t\treturn rv\n\t\t\t}\n\t\t\t//return description.accessor?.(target, context.name, target)\n\t\t}\n\t}\n}\n\n/**\n * Detects if the decorator is being called in modern (Modern) or legacy (Legacy) mode\n * based on the arguments passed to the decorator function\n */\nfunction detectDecoratorMode(\n\t_target: any,\n\tcontextOrKey?: any,\n\t_descriptor?: any\n): 'modern' | 'legacy' {\n\t// Modern decorators have a context object as the second parameter\n\t// Legacy decorators have a string/symbol key as the second parameter\n\tif (\n\t\ttypeof contextOrKey === 'object' &&\n\t\tcontextOrKey !== null &&\n\t\ttypeof contextOrKey.kind === 'string'\n\t) {\n\t\treturn 'modern'\n\t}\n\treturn 'legacy'\n}\n\n/**\n * Main decorator factory that automatically detects and works with both Legacy and Modern decorator proposals\n * @param description - The decorator description object\n * @returns A decorator that works in both Legacy and Modern environments\n */\nexport const decorator: DecoratorFactory<any> = (description: DecoratorDescription<any>) => {\n\tconst modern = modernDecorator(description)\n\tconst legacy = legacyDecorator(description)\n\treturn ((target: any, contextOrKey?: any, ...args: any[]) => {\n\t\tconst mode = detectDecoratorMode(target, contextOrKey, args[0])\n\t\treturn mode === 'modern'\n\t\t\t? modern(target, contextOrKey, ...args)\n\t\t\t: legacy(target, contextOrKey, ...args)\n\t}) as any\n}\n\n/**\n * Generic class decorator type that works with both Legacy and Modern decorator proposals\n */\nexport type GenericClassDecorator<T> = LegacyClassDecorator<abstract new (...args: any[]) => T> &\n\tModernClassDecorator<abstract new (...args: any[]) => T>\n","import { decorator } from './decorator'\n\n// Integrated with `using` statement via Symbol.dispose\nconst fr = new FinalizationRegistry<() => void>((f) => f())\n/**\n * Symbol for marking destructor methods\n */\nexport const destructor = Symbol('destructor')\n/**\n * Symbol for accessing allocated values in destroyable objects\n */\nexport const allocatedValues = Symbol('allocated')\n/**\n * Error thrown when attempting to access a destroyed object\n */\nexport class DestructionError extends Error {\n\tstatic throw<_T = void>(msg: string) {\n\t\treturn () => {\n\t\t\tthrow new DestructionError(msg)\n\t\t}\n\t}\n\tconstructor(msg: string) {\n\t\tsuper(`Object is destroyed. ${msg}`)\n\t\tthis.name = 'DestroyedAccessError'\n\t}\n}\nconst destroyedHandler = {\n\t[Symbol.toStringTag]: 'MutTs Destroyable',\n\tget: DestructionError.throw('Cannot access destroyed object'),\n\tset: DestructionError.throw('Cannot access destroyed object'),\n} as const\n\nabstract class AbstractDestroyable<Allocated> {\n\tabstract [destructor](allocated: Allocated): void\n\t[Symbol.dispose](): void {\n\t\tthis[destructor](this as unknown as Allocated)\n\t}\n}\n\ninterface Destructor<Allocated> {\n\tdestructor(allocated: Allocated): void\n}\n\n/**\n * Creates a destroyable class with a base class and destructor object\n * @param base - The base class to extend\n * @param destructorObj - Object containing the destructor method\n * @returns A destroyable class with static destroy and isDestroyable methods\n */\nexport function Destroyable<\n\tT extends new (\n\t\t...args: any[]\n\t) => any,\n\tAllocated extends Partial<typeof this>,\n>(\n\tbase: T,\n\tdestructorObj: Destructor<Allocated>\n): (new (\n\t...args: ConstructorParameters<T>\n) => InstanceType<T> & { [allocatedValues]: Allocated }) & {\n\tdestroy(obj: InstanceType<T>): boolean\n\tisDestroyable(obj: InstanceType<T>): boolean\n}\n\n/**\n * Creates a destroyable class with only a destructor object (no base class)\n * @param destructorObj - Object containing the destructor method\n * @returns A destroyable class with static destroy and isDestroyable methods\n */\nexport function Destroyable<Allocated extends Record<PropertyKey, any> = Record<PropertyKey, any>>(\n\tdestructorObj: Destructor<Allocated>\n): (new () => { [allocatedValues]: Allocated }) & {\n\tdestroy(obj: any): boolean\n\tisDestroyable(obj: any): boolean\n}\n\n/**\n * Creates a destroyable class with a base class (requires [destructor] method)\n * @param base - The base class to extend\n * @returns A destroyable class with static destroy and isDestroyable methods\n */\nexport function Destroyable<\n\tT extends new (\n\t\t...args: any[]\n\t) => any,\n\tAllocated extends Record<PropertyKey, any> = Record<PropertyKey, any>,\n>(\n\tbase: T\n): (new (\n\t...args: ConstructorParameters<T>\n) => AbstractDestroyable<Allocated> & InstanceType<T> & { [allocatedValues]: Allocated }) & {\n\tdestroy(obj: InstanceType<T>): boolean\n\tisDestroyable(obj: InstanceType<T>): boolean\n}\n\n/**\n * Creates an abstract destroyable base class\n * @returns An abstract destroyable class with static destroy and isDestroyable methods\n */\nexport function Destroyable<\n\tAllocated extends Record<PropertyKey, any> = Record<PropertyKey, any>,\n>(): abstract new () => (AbstractDestroyable<Allocated> & {\n\t[allocatedValues]: Allocated\n}) & {\n\tdestroy(obj: any): boolean\n\tisDestroyable(obj: any): boolean\n}\n\nexport function Destroyable<\n\tT extends new (\n\t\t...args: any[]\n\t) => any,\n\tAllocated extends Record<PropertyKey, any> = Record<PropertyKey, any>,\n>(base?: T | Destructor<Allocated>, destructorObj?: Destructor<Allocated>) {\n\tif (base && typeof base !== 'function') {\n\t\tdestructorObj = base as Destructor<Allocated>\n\t\tbase = undefined\n\t}\n\tif (!base) {\n\t\tbase = class {} as T\n\t}\n\n\treturn class Destroyable extends (base as T) {\n\t\tstatic readonly destructors = new WeakMap<any, () => void>()\n\t\tstatic destroy(obj: Destroyable) {\n\t\t\tconst destructor = Destroyable.destructors.get(obj)\n\t\t\tif (!destructor) return false\n\t\t\tfr.unregister(obj)\n\t\t\tDestroyable.destructors.delete(obj)\n\t\t\tObject.setPrototypeOf(obj, new Proxy({}, destroyedHandler))\n\t\t\t// Clear all own properties\n\t\t\tfor (const key of Object.getOwnPropertyNames(obj)) {\n\t\t\t\tdelete (obj as any)[key]\n\t\t\t}\n\t\t\tdestructor()\n\t\t\treturn true\n\t\t}\n\t\tstatic isDestroyable(obj: Destroyable) {\n\t\t\treturn Destroyable.destructors.has(obj)\n\t\t}\n\n\t\tdeclare [forwardProperties]: PropertyKey[]\n\t\treadonly [allocatedValues]: Allocated\n\t\tconstructor(...args: any[]) {\n\t\t\tsuper(...args)\n\t\t\tconst allocated = {} as Allocated\n\t\t\tthis[allocatedValues] = allocated\n\t\t\t// @ts-expect-error `this` is an AbstractDestroyable\n\t\t\tconst myDestructor = destructorObj?.destructor ?? this[destructor]\n\t\t\tif (!myDestructor) {\n\t\t\t\tthrow new DestructionError('Destructor is not defined')\n\t\t\t}\n\t\t\tfunction destruction() {\n\t\t\t\tmyDestructor(allocated)\n\t\t\t}\n\t\t\tDestroyable.destructors.set(this, destruction)\n\t\t\tfr.register(this, destruction, this)\n\t\t}\n\t}\n}\n\nconst forwardProperties = Symbol('forwardProperties')\n/**\n * Decorator that marks properties to be stored in the allocated object and passed to the destructor\n * Use with accessor properties or explicit get/set pairs\n */\nexport const allocated = decorator({\n\tsetter(original, propertyKey) {\n\t\treturn function (value) {\n\t\t\tthis[allocatedValues][propertyKey] = value\n\t\t\treturn original.call(this, value)\n\t\t}\n\t},\n})\n\n/**\n * Registers a callback to be called when an object is garbage collected\n * @param cb - The callback function to execute on garbage collection\n * @returns The object whose reference can be collected\n */\nexport function callOnGC(cb: () => void) {\n\tlet called = false\n\tconst forward = () => {\n\t\tif (called) return\n\t\tcalled = true\n\t\tcb()\n\t}\n\tfr.register(forward, cb, cb)\n\treturn forward\n}\n\n/**\n * Context Manager Protocol for `using` statement integration\n * Provides automatic resource cleanup when used with the `using` statement\n */\nexport interface ContextManager<T = any> {\n\t[Symbol.dispose](): void\n\tvalue?: T\n}\n","/**\n * Symbol for defining custom getter logic for numeric index access\n */\nexport const getAt = Symbol('getAt')\n/**\n * Symbol for defining custom setter logic for numeric index access\n */\nexport const setAt = Symbol('setAt')\n\ninterface IndexingAt<Items = any> {\n\t[getAt](index: number): Items\n}\n\ninterface Accessor<T, Items> {\n\tget(this: T, index: number): Items\n\tset?(this: T, index: number, value: Items): void\n\tgetLength?(this: T): number\n\tsetLength?(this: T, value: number): void\n}\n\nabstract class AbstractGetAt<Items = any> {\n\tabstract [getAt](index: number): Items\n}\n\n/**\n * Creates an indexable class with a base class and accessor object\n * @param base - The base class to extend\n * @param accessor - Object containing get/set methods for numeric index access\n * @returns A class that supports numeric index access\n */\nexport function Indexable<Items, Base extends abstract new (...args: any[]) => any>(\n\tbase: Base,\n\taccessor: Accessor<InstanceType<Base>, Items>\n): new (\n\t...args: ConstructorParameters<Base>\n) => InstanceType<Base> & { [x: number]: Items }\n\n/**\n * Creates an indexable class with only an accessor object (no base class)\n * @param accessor - Object containing get/set methods for numeric index access\n * @returns A class that supports numeric index access\n */\nexport function Indexable<Items>(accessor: Accessor<any, Items>): new () => { [x: number]: Items }\n\n/**\n * Creates an indexable class with a base class that has [getAt] method\n * @param base - The base class that implements [getAt] method\n * @returns A class that supports numeric index access using the base class's [getAt] method\n */\nexport function Indexable<Base extends new (...args: any[]) => IndexingAt>(\n\tbase: Base\n): new (\n\t...args: ConstructorParameters<Base>\n) => InstanceType<Base> & { [x: number]: AtReturnType<InstanceType<Base>> }\n\n/**\n * Creates an abstract indexable base class\n * @returns An abstract class that supports numeric index access\n */\nexport function Indexable<Items>(): abstract new (\n\t...args: any[]\n) => AbstractGetAt & { [x: number]: Items }\n\nexport function Indexable<Items, Base extends abstract new (...args: any[]) => any>(\n\tbase?: Base | Accessor<Base, Items>,\n\taccessor?: Accessor<Base, Items>\n) {\n\tif (base && typeof base !== 'function') {\n\t\taccessor = base as Accessor<Base, Items>\n\t\tbase = undefined\n\t}\n\tif (!base) {\n\t\t//@ts-expect-error\n\t\tbase = class {} as Base\n\t}\n\tif (!accessor) {\n\t\taccessor = {\n\t\t\tget(this: any, index: number) {\n\t\t\t\tif (typeof this[getAt] !== 'function') {\n\t\t\t\t\tthrow new Error('Indexable class must have an [getAt] method')\n\t\t\t\t}\n\t\t\t\treturn this[getAt](index)\n\t\t\t},\n\t\t\tset(this: any, index: number, value: Items) {\n\t\t\t\tif (typeof this[setAt] !== 'function') {\n\t\t\t\t\tthrow new Error('Indexable class has read-only numeric index access')\n\t\t\t\t}\n\t\t\t\tthis[setAt](index, value)\n\t\t\t},\n\t\t}\n\t}\n\n\tabstract class Indexable extends (base as Base) {\n\t\t[x: number]: Items\n\t}\n\n\tObject.setPrototypeOf(\n\t\tIndexable.prototype,\n\t\tnew Proxy((base as Base).prototype, {\n\t\t\t//@ts-expect-error\n\t\t\t[Symbol.toStringTag]: 'MutTs Indexable',\n\t\t\tget(target, prop, receiver) {\n\t\t\t\tif (prop in target) {\n\t\t\t\t\tconst getter = Object.getOwnPropertyDescriptor(target, prop)?.get\n\t\t\t\t\treturn getter ? getter.call(receiver) : target[prop]\n\t\t\t\t}\n\t\t\t\tif (typeof prop === 'string') {\n\t\t\t\t\tif (prop === 'length' && accessor.getLength) return accessor.getLength.call(receiver)\n\t\t\t\t\tconst numProp = Number(prop)\n\t\t\t\t\tif (!Number.isNaN(numProp)) {\n\t\t\t\t\t\treturn accessor.get!.call(receiver, numProp) as Items\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn undefined\n\t\t\t},\n\t\t\tset(target, prop, value, receiver) {\n\t\t\t\tif (prop in target) {\n\t\t\t\t\tconst setter = Object.getOwnPropertyDescriptor(target, prop)?.set\n\t\t\t\t\tif (setter) setter.call(receiver, value)\n\t\t\t\t\telse target[prop] = value\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tif (typeof prop === 'string') {\n\t\t\t\t\tif (prop === 'length' && accessor.setLength) {\n\t\t\t\t\t\taccessor.setLength.call(receiver, value)\n\t\t\t\t\t\treturn true\n\t\t\t\t\t}\n\t\t\t\t\tconst numProp = Number(prop)\n\t\t\t\t\tif (!Number.isNaN(numProp)) {\n\t\t\t\t\t\tif (!accessor.set) {\n\t\t\t\t\t\t\tthrow new Error('Indexable class has read-only numeric index access')\n\t\t\t\t\t\t}\n\t\t\t\t\t\taccessor.set!.call(receiver, numProp, value)\n\t\t\t\t\t\treturn true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tObject.defineProperty(receiver, prop, {\n\t\t\t\t\tvalue,\n\t\t\t\t\twritable: true,\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t})\n\t\t\t\treturn true\n\t\t\t},\n\t\t})\n\t)\n\treturn Indexable\n}\n\ntype AtReturnType<T> = T extends { [getAt](index: number): infer R } ? R : never\n","import { isConstructor, ReflectGet } from './utils'\n\n/**\n * A mixin function that takes a base class and returns a new class with mixed-in functionality\n * @template Mixed - The functionality to be mixed in\n */\nexport type MixinFunction<Mixed> = <Base>(\n\tbase: new (...args: any[]) => Base\n) => new (\n\t...args: any[]\n) => Base & Mixed\n\n/**\n * A mixin class that can be used both as a base class and as a mixin function\n * @template Mixed - The functionality to be mixed in\n */\nexport type MixinClass<Mixed> = new (...args: any[]) => Mixed\n\n/**\n * Creates a mixin that can be used both as a class (extends) and as a function (mixin)\n *\n * This function supports:\n * - Using mixins as base classes: `class MyClass extends MyMixin`\n * - Using mixins as functions: `class MyClass extends MyMixin(SomeBase)`\n * - Composing mixins: `const Composed = MixinA(MixinB)`\n * - Type-safe property inference for all patterns\n *\n * @param mixinFunction - The function that creates the mixin\n * @param unwrapFunction - Optional function to unwrap reactive objects for method calls\n * @returns A mixin that can be used both as a class and as a function\n */\nexport function mixin<MixinFn extends (base: any) => new (...args: any[]) => any>(\n\tmixinFunction: MixinFn,\n\tunwrapFunction?: (obj: any) => any\n): (new (\n\t...args: any[]\n) => InstanceType<ReturnType<MixinFn>>) &\n\t(<Base>(\n\t\tbase: abstract new (...args: any[]) => Base\n\t) => new (\n\t\t...args: any[]\n\t) => InstanceType<ReturnType<MixinFn>> & Base) {\n\t/**\n\t * Cache for mixin results to ensure the same base class always returns the same mixed class\n\t */\n\tconst mixinCache = new WeakMap<new (...args: any[]) => any, new (...args: any[]) => any>()\n\n\t// Apply the mixin to Object as the base class\n\tconst MixedBase = mixinFunction(Object)\n\tmixinCache.set(Object, MixedBase)\n\n\t// Create the proxy that handles both constructor and function calls\n\treturn new Proxy(MixedBase, {\n\t\t// Handle `MixinClass(SomeBase)` - use as mixin function\n\t\tapply(_target, _thisArg, args) {\n\t\t\tif (args.length === 0) {\n\t\t\t\tthrow new Error('Mixin requires a base class')\n\t\t\t}\n\n\t\t\tconst baseClass = args[0]\n\t\t\tif (typeof baseClass !== 'function') {\n\t\t\t\tthrow new Error('Mixin requires a constructor function')\n\t\t\t}\n\n\t\t\t// Check if it's a valid constructor or a mixin\n\t\t\tif (\n\t\t\t\t!isConstructor(baseClass) &&\n\t\t\t\t!(baseClass && typeof baseClass === 'function' && baseClass.prototype)\n\t\t\t) {\n\t\t\t\tthrow new Error('Mixin requires a valid constructor')\n\t\t\t}\n\n\t\t\t// Check cache first\n\t\t\tconst cached = mixinCache.get(baseClass)\n\t\t\tif (cached) {\n\t\t\t\treturn cached\n\t\t\t}\n\n\t\t\tlet usedBase = baseClass\n\t\t\tif (unwrapFunction) {\n\t\t\t\t// Create a proxied base class that handles method unwrapping\n\t\t\t\tconst ProxiedBaseClass = class extends baseClass {}\n\n\t\t\t\t// Proxy the prototype methods to handle unwrapping\n\t\t\t\tconst originalPrototype = baseClass.prototype\n\t\t\t\tconst proxiedPrototype = new Proxy(originalPrototype, {\n\t\t\t\t\tget(target, prop, receiver) {\n\t\t\t\t\t\tconst value = ReflectGet(target, prop, receiver)\n\n\t\t\t\t\t\t// Only wrap methods that are likely to access private fields\n\t\t\t\t\t\t// Skip symbols and special properties that the reactive system needs\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttypeof value === 'function' &&\n\t\t\t\t\t\t\ttypeof prop === 'string' &&\n\t\t\t\t\t\t\t!['constructor', 'toString', 'valueOf'].includes(prop)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// Return a wrapped version that uses unwrapped context\n\t\t\t\t\t\t\treturn function (...args: any[]) {\n\t\t\t\t\t\t\t\t// Use the unwrapping function if provided, otherwise use this\n\t\t\t\t\t\t\t\tconst context = unwrapFunction(this)\n\t\t\t\t\t\t\t\treturn value.apply(context, args)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn value\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\t// Set the proxied prototype\n\t\t\t\tObject.setPrototypeOf(ProxiedBaseClass.prototype, proxiedPrototype)\n\t\t\t\tusedBase = ProxiedBaseClass\n\t\t\t}\n\n\t\t\t// Create the mixed class using the proxied base class\n\t\t\tconst mixedClass = mixinFunction(usedBase)\n\n\t\t\t// Cache the result\n\t\t\tmixinCache.set(baseClass, mixedClass)\n\n\t\t\treturn mixedClass\n\t\t},\n\t}) as MixinFn & (new (...args: any[]) => InstanceType<ReturnType<MixinFn>>)\n}\n","// biome-ignore-all lint/suspicious/noConfusingVoidType: Type 'void' is not assignable to type 'ScopedCallback | undefined'.\n// Argument of type '() => void' is not assignable to parameter of type '(dep: DependencyFunction) => ScopedCallback | undefined'.\n\nimport { decorator } from '../decorator'\nimport { mixin } from '../mixins'\nimport { isObject, isOwnAccessor, ReflectGet, ReflectSet } from '../utils'\n\n/**\n * Function type for dependency tracking in effects and computed values\n * Restores the active effect context for dependency tracking\n */\nexport type DependencyFunction = <T>(cb: () => T) => T\n/**\n * Dependency access passed to user callbacks within effects/computed/watch\n * Provides functions to track dependencies and information about the effect execution\n */\nexport interface DependencyAccess {\n\t/**\n\t * Tracks dependencies in the current effect context\n\t * Use this for normal dependency tracking within the effect\n\t * @example\n\t * ```typescript\n\t * effect(({ tracked }) => {\n\t * // In async context, use tracked to restore dependency tracking\n\t * await someAsyncOperation()\n\t * const value = tracked(() => state.count) // Tracks state.count in this effect\n\t * })\n\t * ```\n\t */\n\ttracked: DependencyFunction\n\t/**\n\t * Tracks dependencies in the parent effect context\n\t * Use this when child effects should track dependencies in the parent,\n\t * allowing parent cleanup to manage child effects while dependencies trigger the parent\n\t * @example\n\t * ```typescript\n\t * effect(({ ascend }) => {\n\t * const length = inputs.length\n\t * if (length > 0) {\n\t * ascend(() => {\n\t * // Dependencies here are tracked in the parent effect\n\t * inputs.forEach(item => console.log(item))\n\t * })\n\t * }\n\t * })\n\t * ```\n\t */\n\tascend: DependencyFunction\n\t/**\n\t * Indicates whether this is the initial execution of the effect\n\t * - `true`: First execution when the effect is created\n\t * - `false`: Subsequent executions triggered by dependency changes\n\t * @example\n\t * ```typescript\n\t * effect(({ init }) => {\n\t * if (init) {\n\t * console.log('Effect initialized')\n\t * // Setup code that should only run once\n\t * } else {\n\t * console.log('Effect re-ran due to dependency change')\n\t * // Code that runs on every update\n\t * }\n\t * })\n\t * ```\n\t */\n\tinit: boolean\n}\n// TODO: proper async management, read when fn returns a promise and let the effect as \"running\",\n// either to cancel the running one or to avoid running 2 in \"parallel\" and debounce the second one\n\n/**\n * Type for effect cleanup functions\n */\nexport type ScopedCallback = () => void\n\n/**\n * Type for property evolution events\n */\nexport type PropEvolution = {\n\ttype: 'set' | 'del' | 'add' | 'invalidate'\n\tprop: any\n}\n\n/**\n * Type for collection operation evolution events\n */\nexport type BunchEvolution = {\n\ttype: 'bunch'\n\tmethod: string\n}\nexport type Evolution = PropEvolution | BunchEvolution\n\ntype State =\n\t| {\n\t\t\tevolution: Evolution\n\t\t\tnext: State\n\t }\n\t| {}\n// Track which effects are watching which reactive objects for cleanup\nconst effectToReactiveObjects = new WeakMap<ScopedCallback, Set<object>>()\n\n// Track object -> proxy and proxy -> object relationships\nconst objectToProxy = new WeakMap<object, object>()\nconst proxyToObject = new WeakMap<object, object>()\n// Deep watching data structures\n// Track which objects contain which other objects (back-references)\nconst objectParents = new WeakMap<object, Set<{ parent: object; prop: PropertyKey }>>()\n\n// Track which objects have deep watchers\nconst objectsWithDeepWatchers = new WeakSet<object>()\n\n// Track deep watchers per object\nconst deepWatchers = new WeakMap<object, Set<ScopedCallback>>()\n\n// Track which effects are doing deep watching\nconst effectToDeepWatchedObjects = new WeakMap<ScopedCallback, Set<object>>()\n\n// Track objects that should never be reactive and cannot be modified\n/**\n * WeakSet containing objects that should never be made reactive\n */\nexport const nonReactiveObjects = new WeakSet<object>()\nconst absent = Symbol('absent')\n/**\n * Converts an iterator to a generator that yields reactive values\n */\nexport function* makeReactiveIterator<T>(iterator: Iterator<T>): Generator<T> {\n\tlet result = iterator.next()\n\twhile (!result.done) {\n\t\tyield reactive(result.value)\n\t\tresult = iterator.next()\n\t}\n}\n\n/**\n * Converts an iterator of key-value pairs to a generator that yields reactive key-value pairs\n */\nexport function* makeReactiveEntriesIterator<K, V>(iterator: Iterator<[K, V]>): Generator<[K, V]> {\n\tlet result = iterator.next()\n\twhile (!result.done) {\n\t\tconst [key, value] = result.value\n\t\tyield [reactive(key), reactive(value)]\n\t\tresult = iterator.next()\n\t}\n}\n\n// Track effects per reactive object and property\nconst watchers = new WeakMap<object, Map<any, Set<ScopedCallback>>>()\n\n/**\n * Object containing internal reactive system state for debugging and profiling\n */\nexport const profileInfo: any = {\n\tobjectToProxy,\n\tproxyToObject,\n\teffectToReactiveObjects,\n\twatchers,\n\tobjectParents,\n\tobjectsWithDeepWatchers,\n\tdeepWatchers,\n\teffectToDeepWatchedObjects,\n\tnonReactiveObjects,\n}\n// Track native reactivity\nconst nativeReactive = Symbol('native-reactive')\n\n/**\n * Symbol to mark individual objects as non-reactive\n */\nexport const nonReactiveMark = Symbol('non-reactive')\n/**\n * Symbol to mark class properties as non-reactive\n */\nexport const unreactiveProperties = Symbol('unreactive-properties')\n/**\n * Symbol for prototype forwarding in reactive objects\n */\nexport const prototypeForwarding: unique symbol = Symbol('prototype-forwarding')\n\n/**\n * Symbol representing all properties in reactive tracking\n */\nexport const allProps = Symbol('all-props')\n\n// Symbol to mark functions with their root function\nconst rootFunction = Symbol('root-function')\n\n/**\n * Marks a function with its root function for effect tracking\n * @param fn - The function to mark\n * @param root - The root function\n * @returns The marked function\n */\nexport function markWithRoot<T extends Function>(fn: T, root: Function): T {\n\t// Mark fn with the new root\n\treturn Object.defineProperty(fn, rootFunction, {\n\t\tvalue: getRoot(root),\n\t\twritable: false,\n\t})\n}\n\n/**\n * Gets the root function of a function for effect tracking\n * @param fn - The function to get the root of\n * @returns The root function\n */\nexport function getRoot<T extends Function | undefined>(fn: T): T {\n\treturn (fn as any)?.[rootFunction] || fn\n}\n\n/**\n * Error class for reactive system errors\n */\nexport class ReactiveError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message)\n\t\tthis.name = 'ReactiveError'\n\t}\n}\n\n// biome-ignore-start lint/correctness/noUnusedFunctionParameters: Interface declaration with empty defaults\n/**\n * Global options for the reactive system\n */\nexport const options = {\n\t/**\n\t * Debug purpose: called when an effect is entered\n\t * @param effect - The effect that is entered\n\t */\n\tenter: (effect: Function) => {},\n\t/**\n\t * Debug purpose: called when an effect is left\n\t * @param effect - The effect that is left\n\t */\n\tleave: (effect: Function) => {},\n\t/**\n\t * Debug purpose: called when an effect is chained\n\t * @param target - The effect that is being triggered\n\t * @param caller - The effect that is calling the target\n\t */\n\tchain: (targets: Function[], caller?: Function) => {},\n\t/**\n\t * Debug purpose: called when an effect chain is started\n\t * @param target - The effect that is being triggered\n\t */\n\tbeginChain: (targets: Function[]) => {},\n\t/**\n\t * Debug purpose: called when an effect chain is ended\n\t */\n\tendChain: () => {},\n\t/**\n\t * Debug purpose: called when an object is touched\n\t * @param obj - The object that is touched\n\t * @param evolution - The type of change\n\t * @param props - The properties that changed\n\t * @param deps - The dependencies that changed\n\t */\n\ttouched: (obj: any, evolution: Evolution, props?: any[], deps?: Set<ScopedCallback>) => {},\n\t/**\n\t * Debug purpose: maximum effect chain (like call stack max depth)\n\t * Used to prevent infinite loops\n\t * @default 100\n\t */\n\tmaxEffectChain: 100,\n\t/**\n\t * Debug purpose: maximum effect reaction (like call stack max depth)\n\t * Used to prevent infinite loops\n\t * @default 'throw'\n\t */\n\tmaxEffectReaction: 'throw' as 'throw' | 'debug' | 'warn',\n\t/**\n\t * Maximum depth for deep watching traversal\n\t * Used to prevent infinite recursion in circular references\n\t * @default 100\n\t */\n\tmaxDeepWatchDepth: 100,\n\t/**\n\t * Only react on instance members modification (not inherited properties)\n\t * For instance, do not track class methods\n\t * @default true\n\t */\n\tinstanceMembers: true,\n\t/**\n\t * Ignore accessors (getters and setters) and only track direct properties\n\t * @default true\n\t */\n\tignoreAccessors: true,\n\t// biome-ignore lint/suspicious/noConsole: This is the whole point here\n\twarn: (...args: any[]) => console.warn(...args),\n}\n// biome-ignore-end lint/correctness/noUnusedFunctionParameters: Interface declaration with empty defaults\n\n//#region evolution\ntype EffectTracking = (obj: any, evolution: Evolution, prop: any) => void\n/**\n * Registers a debug callback that is called when the current effect is triggered by a dependency change\n *\n * This function is useful for debugging purposes as it pin-points exactly which reactive property\n * change triggered the effect. The callback receives information about:\n * - The object that changed\n * - The type of change (evolution)\n * - The specific property that changed\n *\n * **Note:** The tracker callback is automatically removed after being called once. If you need\n * to track multiple triggers, call `trackEffect` again within the effect.\n *\n * @param onTouch - Callback function that receives (obj, evolution, prop) when the effect is triggered\n * @throws {Error} If called outside of an effect context\n *\n * @example\n * ```typescript\n * const state = reactive({ count: 0, name: 'John' })\n *\n * effect(() => {\n * // Register a tracker to see what triggers this effect\n * trackEffect((obj, evolution, prop) => {\n * console.log(`Effect triggered by:`, {\n * object: obj,\n * change: evolution.type,\n * property: prop\n * })\n * })\n *\n * // Access reactive properties\n * console.log(state.count, state.name)\n * })\n *\n * state.count = 5\n * // Logs: Effect triggered by: { object: state, change: 'set', property: 'count' }\n * ```\n */\nexport function trackEffect(onTouch: EffectTracking) {\n\tif (!activeEffect) throw new Error('Not in an effect')\n\tif (!effectTrackers.has(activeEffect)) effectTrackers.set(activeEffect, new Set([onTouch]))\n\telse effectTrackers.get(activeEffect)!.add(onTouch)\n}\n\nconst effectTrackers = new WeakMap<ScopedCallback, Set<EffectTracking>>()\n\nfunction collectEffects(\n\tobj: any,\n\tevolution: Evolution,\n\teffects: Set<ScopedCallback>,\n\tobjectWatchers: Map<any, Set<ScopedCallback>>,\n\t...keyChains: Iterable<any>[]\n) {\n\tfor (const keys of keyChains)\n\t\tfor (const key of keys) {\n\t\t\tconst deps = objectWatchers.get(key)\n\t\t\tif (deps)\n\t\t\t\tfor (const effect of Array.from(deps)) {\n\t\t\t\t\teffects.add(effect)\n\t\t\t\t\tconst trackers = effectTrackers.get(effect)\n\t\t\t\t\tif (trackers) {\n\t\t\t\t\t\tfor (const tracker of trackers) tracker(obj, evolution, key)\n\t\t\t\t\t\ttrackers.delete(effect)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n}\n\n/**\n * Triggers effects for a single property change\n * @param obj - The object that changed\n * @param evolution - The type of change\n * @param prop - The property that changed\n */\nexport function touched1(obj: any, evolution: Evolution, prop: any) {\n\ttouched(obj, evolution, [prop])\n}\n\n/**\n * Triggers effects for property changes\n * @param obj - The object that changed\n * @param evolution - The type of change\n * @param props - The properties that changed\n */\nexport function touched(obj: any, evolution: Evolution, props?: Iterable<any>) {\n\tobj = unwrap(obj)\n\taddState(obj, evolution)\n\tconst objectWatchers = watchers.get(obj)\n\tif (objectWatchers) {\n\t\t// Note: we have to collect effects to remove duplicates in the specific case when no batch is running\n\t\tconst effects = new Set<ScopedCallback>()\n\t\tif (props) {\n\t\t\tprops = Array.from(props) // For debug purposes only\n\t\t\tcollectEffects(obj, evolution, effects, objectWatchers, [allProps], props)\n\t\t} else collectEffects(obj, evolution, effects, objectWatchers, objectWatchers.keys())\n\t\toptions.touched(obj, evolution, props as any[] | undefined, effects)\n\t\tbatch(Array.from(effects))\n\t}\n\n\t// Bubble up changes if this object has deep watchers\n\tif (objectsWithDeepWatchers.has(obj)) {\n\t\tbubbleUpChange(obj, evolution)\n\t}\n}\n\nconst states = new WeakMap<object, State>()\n\nfunction addState(obj: any, evolution: Evolution) {\n\tobj = unwrap(obj)\n\tconst next = {}\n\tconst state = getState(obj)\n\tif (state) Object.assign(state, { evolution, next })\n\tstates.set(obj, next)\n}\n\n/**\n * Gets the current state of a reactive object for evolution tracking\n * @param obj - The reactive object\n * @returns The current state object\n */\nexport function getState(obj: any) {\n\tobj = unwrap(obj)\n\tlet state = states.get(obj)\n\tif (!state) {\n\t\tstate = {}\n\t\tstates.set(obj, state)\n\t}\n\treturn state\n}\n\n/**\n * Marks a property as a dependency of the current effect\n * @param obj - The object containing the property\n * @param prop - The property name (defaults to allProps)\n */\nexport function dependant(obj: any, prop: any = allProps) {\n\tobj = unwrap(obj)\n\tif (activeEffect && (typeof prop !== 'symbol' || prop === allProps)) {\n\t\tlet objectWatchers = watchers.get(obj)\n\t\tif (!objectWatchers) {\n\t\t\tobjectWatchers = new Map<PropertyKey, Set<ScopedCallback>>()\n\t\t\twatchers.set(obj, objectWatchers)\n\t\t}\n\t\tlet deps = objectWatchers.get(prop)\n\t\tif (!deps) {\n\t\t\tdeps = new Set<ScopedCallback>()\n\t\t\tobjectWatchers.set(prop, deps)\n\t\t}\n\t\tdeps.add(activeEffect)\n\n\t\t// Track which reactive objects this effect is watching\n\t\tlet effectObjects = effectToReactiveObjects.get(activeEffect)\n\t\tif (!effectObjects) {\n\t\t\teffectObjects = new Set<object>()\n\t\t\teffectToReactiveObjects.set(activeEffect, effectObjects)\n\t\t}\n\t\teffectObjects.add(obj)\n\t}\n}\n\n// Active effects to handle nested effects\nexport let activeEffect: ScopedCallback | undefined\n// Parent effect used for lifecycle/cleanup relationships (can diverge later)\nlet parentEffect: ScopedCallback | undefined\n\n// Track currently executing effects to prevent re-execution\n// These are all the effects triggered under `activeEffect`\nlet batchedEffects: Map<Function, ScopedCallback> | undefined\nconst batchCleanups = new Set<ScopedCallback>()\n\n/**\n * Adds a cleanup function to be called when the current batch of effects completes\n * @param cleanup - The cleanup function to add\n */\nexport function addBatchCleanup(cleanup: ScopedCallback) {\n\tif (!batchedEffects) cleanup()\n\telse batchCleanups.add(cleanup)\n}\n// Track which sub-effects have been executed to prevent infinite loops\n// These are all the effects triggered under `activeEffect` and all their sub-effects\nfunction batch(effect: ScopedCallback | ScopedCallback[], immediate?: 'immediate') {\n\tif (!Array.isArray(effect)) effect = [effect]\n\tconst roots = effect.map(getRoot)\n\n\tif (batchedEffects) {\n\t\toptions?.chain(roots, getRoot(activeEffect))\n\t\tfor (let i = 0; i < effect.length; i++) batchedEffects.set(roots[i], effect[i])\n\t\tif (immediate)\n\t\t\tfor (let i = 0; i < effect.length; i++)\n\t\t\t\ttry {\n\t\t\t\t\treturn effect[i]()\n\t\t\t\t} finally {\n\t\t\t\t\tbatchedEffects.delete(roots[i])\n\t\t\t\t}\n\t} else {\n\t\toptions.beginChain(roots)\n\t\tconst runEffects: any[] = []\n\t\tbatchedEffects = new Map<Function, ScopedCallback>(roots.map((root, i) => [root, effect[i]]))\n\t\tconst firstReturn: { value?: any } = {}\n\t\ttry {\n\t\t\twhile (batchedEffects.size) {\n\t\t\t\tif (runEffects.length > options.maxEffectChain) {\n\t\t\t\t\tswitch (options.maxEffectReaction) {\n\t\t\t\t\t\tcase 'throw':\n\t\t\t\t\t\t\tthrow new ReactiveError('[reactive] Max effect chain reached')\n\t\t\t\t\t\tcase 'debug':\n\t\t\t\t\t\t\t// biome-ignore lint/suspicious/noDebugger: This is the whole point here\n\t\t\t\t\t\t\tdebugger\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase 'warn':\n\t\t\t\t\t\t\toptions.warn('[reactive] Max effect chain reached')\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst [root, effect] = batchedEffects.entries().next().value!\n\t\t\t\trunEffects.push(root)\n\t\t\t\tconst rv = effect()\n\t\t\t\tif (!('value' in firstReturn)) firstReturn.value = rv\n\t\t\t\tbatchedEffects.delete(root)\n\t\t\t}\n\t\t\tconst cleanups = Array.from(batchCleanups)\n\t\t\tbatchCleanups.clear()\n\t\t\tfor (const cleanup of cleanups) cleanup()\n\t\t\treturn firstReturn.value\n\t\t} finally {\n\t\t\tbatchedEffects = undefined\n\t\t\toptions.endChain()\n\t\t}\n\t}\n}\n\n/**\n * Decorator that makes methods atomic - batches all effects triggered within the method\n */\nexport const atomic = decorator({\n\tmethod(original) {\n\t\treturn function (...args: any[]) {\n\t\t\treturn batch(\n\t\t\t\tmarkWithRoot(() => original.apply(this, args), original),\n\t\t\t\t'immediate'\n\t\t\t)\n\t\t}\n\t},\n\tdefault<Args extends any[], Return>(\n\t\toriginal: (...args: Args) => Return\n\t): (...args: Args) => Return {\n\t\treturn function (...args: Args) {\n\t\t\treturn batch(\n\t\t\t\tmarkWithRoot(() => original.apply(this, args), original),\n\t\t\t\t'immediate'\n\t\t\t)\n\t\t}\n\t},\n})\n\n/**\n * Executes a function with a specific effect context\n * @param effect - The effect to use as context\n * @param fn - The function to execute\n * @param keepParent - Whether to keep the parent effect context\n * @returns The result of the function\n */\nexport function withEffect<T>(\n\teffect: ScopedCallback | undefined,\n\tfn: () => T,\n\tkeepParent?: true\n): T {\n\tif (getRoot(effect) === getRoot(activeEffect)) return fn()\n\tconst oldActiveEffect = activeEffect\n\tconst oldParentEffect = parentEffect\n\tactiveEffect = effect\n\tif (!keepParent) parentEffect = effect\n\ttry {\n\t\treturn fn()\n\t} finally {\n\t\tactiveEffect = oldActiveEffect\n\t\tparentEffect = oldParentEffect\n\t}\n}\n\n//#endregion\n\n//#region deep watching\n\n/**\n * Add a back-reference from child to parent\n */\nfunction addBackReference(child: object, parent: object, prop: any) {\n\tlet parents = objectParents.get(child)\n\tif (!parents) {\n\t\tparents = new Set()\n\t\tobjectParents.set(child, parents)\n\t}\n\tparents.add({ parent, prop })\n}\n\n/**\n * Remove a back-reference from child to parent\n */\nfunction removeBackReference(child: object, parent: object, prop: any) {\n\tconst parents = objectParents.get(child)\n\tif (parents) {\n\t\tparents.delete({ parent, prop })\n\t\tif (parents.size === 0) {\n\t\t\tobjectParents.delete(child)\n\t\t}\n\t}\n}\n\n/**\n * Check if an object needs back-references (has deep watchers or parents with deep watchers)\n */\nfunction needsBackReferences(obj: object): boolean {\n\treturn objectsWithDeepWatchers.has(obj) || hasParentWithDeepWatchers(obj)\n}\n\n/**\n * Check if an object has any parent with deep watchers\n */\nfunction hasParentWithDeepWatchers(obj: object): boolean {\n\tconst parents = objectParents.get(obj)\n\tif (!parents) return false\n\n\tfor (const { parent } of parents) {\n\t\tif (objectsWithDeepWatchers.has(parent)) return true\n\t\tif (hasParentWithDeepWatchers(parent)) return true\n\t}\n\treturn false\n}\n\n/**\n * Bubble up changes through the back-reference chain\n */\nfunction bubbleUpChange(changedObject: object, evolution: Evolution) {\n\tconst parents = objectParents.get(changedObject)\n\tif (!parents) return\n\n\tfor (const { parent } of parents) {\n\t\t// Trigger deep watchers on parent\n\t\tconst parentDeepWatchers = deepWatchers.get(parent)\n\t\tif (parentDeepWatchers) for (const watcher of parentDeepWatchers) batch(watcher)\n\n\t\t// Continue bubbling up\n\t\tbubbleUpChange(parent, evolution)\n\t}\n}\n\n/**\n * Tracks property changes and manages back-references for deep watching\n * @param obj - The object that changed\n * @param prop - The property that changed\n * @param oldVal - The old value\n * @param newValue - The new value\n */\nexport function track1(obj: object, prop: any, oldVal: any, newValue: any) {\n\t// Manage back-references if this object has deep watchers\n\tif (objectsWithDeepWatchers.has(obj)) {\n\t\t// Remove old back-references\n\t\tif (typeof oldVal === 'object' && oldVal !== null) {\n\t\t\tremoveBackReference(oldVal, obj, prop)\n\t\t}\n\n\t\t// Add new back-references\n\t\tif (typeof newValue === 'object' && newValue !== null) {\n\t\t\tconst reactiveValue = reactive(newValue)\n\t\t\taddBackReference(reactiveValue, obj, prop)\n\t\t}\n\t}\n\treturn newValue\n}\n\n//#endregion\n\nconst reactiveHandlers = {\n\t[Symbol.toStringTag]: 'MutTs Reactive',\n\tget(obj: any, prop: PropertyKey, receiver: any) {\n\t\tif (prop === nonReactiveMark) return false\n\t\t// Check if this property is marked as unreactive\n\t\tif (unwrap(obj)[unreactiveProperties]?.has(prop) || typeof prop === 'symbol')\n\t\t\treturn ReflectGet(obj, prop, receiver)\n\t\t// Depend if...\n\t\tif (\n\t\t\t!Reflect.has(receiver, prop) ||\n\t\t\t(!(options.instanceMembers && !Object.hasOwn(receiver, prop)) &&\n\t\t\t\t!(options.ignoreAccessors && isOwnAccessor(receiver, prop)))\n\t\t)\n\t\t\tdependant(obj, prop)\n\n\t\tconst value = ReflectGet(\n\t\t\tObject.hasOwn(obj, prop) ? obj : Object.getPrototypeOf(obj),\n\t\t\tprop,\n\t\t\treceiver\n\t\t)\n\t\tif (typeof value === 'object' && value !== null) {\n\t\t\tconst reactiveValue = reactive(value)\n\n\t\t\t// Only create back-references if this object needs them\n\t\t\tif (needsBackReferences(obj)) {\n\t\t\t\taddBackReference(reactiveValue, obj, prop)\n\t\t\t}\n\n\t\t\treturn reactiveValue\n\t\t}\n\t\treturn value\n\t},\n\tset(obj: any, prop: PropertyKey, value: any, receiver: any): boolean {\n\t\t// Check if this property is marked as unreactive\n\t\tif (unwrap(obj)[unreactiveProperties]?.has(prop)) return ReflectSet(obj, prop, value, receiver)\n\t\t// Really specific case for when Array is forwarder, in order to let it manage the reactivity\n\t\tconst isArrayCase =\n\t\t\tprototypeForwarding in obj &&\n\t\t\t// biome-ignore lint/suspicious/useIsArray: This is the whole point here\n\t\t\tobj[prototypeForwarding] instanceof Array &&\n\t\t\t(!Number.isNaN(Number(prop)) || prop === 'length')\n\t\tconst newValue = unwrap(value)\n\n\t\tif (isArrayCase) {\n\t\t\t;(obj as any)[prop] = newValue\n\t\t\treturn true\n\t\t}\n\n\t\tconst oldVal = Reflect.has(receiver, prop) ? unwrap(ReflectGet(obj, prop, receiver)) : absent\n\t\ttrack1(obj, prop, oldVal, newValue)\n\n\t\tif (oldVal !== newValue) {\n\t\t\tReflectSet(obj, prop, newValue, receiver)\n\t\t\t// try to find a \"generic\" way to express that\n\t\t\ttouched1(obj, { type: oldVal !== absent ? 'set' : 'add', prop }, prop)\n\t\t}\n\t\treturn true\n\t},\n\tdeleteProperty(obj: any, prop: PropertyKey): boolean {\n\t\tif (!Object.hasOwn(obj, prop)) return false\n\n\t\tconst oldVal = (obj as any)[prop]\n\n\t\t// Remove back-references if this object has deep watchers\n\t\tif (objectsWithDeepWatchers.has(obj) && typeof oldVal === 'object' && oldVal !== null) {\n\t\t\tremoveBackReference(oldVal, obj, prop)\n\t\t}\n\n\t\tdelete (obj as any)[prop]\n\t\ttouched1(obj, { type: 'del', prop }, prop)\n\n\t\t// Bubble up changes if this object has deep watchers\n\t\tif (objectsWithDeepWatchers.has(obj)) {\n\t\t\tbubbleUpChange(obj, { type: 'del', prop })\n\t\t}\n\n\t\treturn true\n\t},\n\tgetPrototypeOf(obj: any): object | null {\n\t\tif (prototypeForwarding in obj) return obj[prototypeForwarding]\n\t\treturn Object.getPrototypeOf(obj)\n\t},\n\tsetPrototypeOf(obj: any, proto: object | null): boolean {\n\t\tif (prototypeForwarding in obj) return false\n\t\tObject.setPrototypeOf(obj, proto)\n\t\treturn true\n\t},\n\townKeys(obj: any): (string | symbol)[] {\n\t\tdependant(obj, allProps)\n\t\treturn Reflect.ownKeys(obj)\n\t},\n} as const\n\nconst reactiveClasses = new WeakSet<Function>()\n\n// Create the ReactiveBase mixin\n/**\n * Base mixin for reactive classes that provides proper constructor reactivity\n * Solves constructor reactivity issues in complex inheritance trees\n */\nexport const ReactiveBase = mixin((base) => {\n\tclass ReactiveMixin extends base {\n\t\tconstructor(...args: any[]) {\n\t\t\tsuper(...args)\n\t\t\t// Only apply reactive transformation if the class is marked with @reactive\n\t\t\t// This allows the mixin to work properly with method inheritance\n\t\t\t// biome-ignore lint/correctness/noConstructorReturn: This is the whole point here\n\t\t\treturn reactiveClasses.has(new.target) ? reactive(this) : this\n\t\t}\n\t}\n\treturn ReactiveMixin\n})\n/**\n * Always-reactive mixin that makes classes inherently reactive\n * Can be used as both a base class and a mixin function\n */\nexport const Reactive = mixin((base) => {\n\tclass ReactiveMixin extends base {\n\t\tconstructor(...args: any[]) {\n\t\t\tsuper(...args)\n\t\t\t// Only apply reactive transformation if the class is marked with @reactive\n\t\t\t// This allows the mixin to work properly with method inheritance\n\t\t\t// biome-ignore lint/correctness/noConstructorReturn: This is the whole point here\n\t\t\treturn reactive(this)\n\t\t}\n\t}\n\t// Mark this as the Reactive mixin to distinguish it from ReactiveBase\n\t;(ReactiveMixin as any).__isReactiveMixin = true\n\treturn ReactiveMixin\n}, unwrap)\nfunction reactiveObject<T>(anyTarget: T): T {\n\tif (!anyTarget || typeof anyTarget !== 'object') return anyTarget\n\tconst target = anyTarget as any\n\t// If target is already a proxy, return it\n\tif (proxyToObject.has(target) || isNonReactive(target)) return target as T\n\n\t// If we already have a proxy for this object, return it\n\tif (objectToProxy.has(target)) return objectToProxy.get(target) as T\n\n\tconst proxied =\n\t\tnativeReactive in target && !(target instanceof target[nativeReactive])\n\t\t\t? new target[nativeReactive](target)\n\t\t\t: target\n\tif (proxied !== target) proxyToObject.set(proxied, target)\n\tconst proxy = new Proxy(proxied, reactiveHandlers)\n\n\t// Store the relationships\n\tobjectToProxy.set(target, proxy)\n\tproxyToObject.set(proxy, target)\n\treturn proxy as T\n}\n\n/**\n * Main decorator for making classes reactive\n * Automatically makes class instances reactive when created\n */\nexport const reactive = decorator({\n\tclass(original) {\n\t\tif (original.prototype instanceof ReactiveBase) {\n\t\t\treactiveClasses.add(original)\n\t\t\treturn original\n\t\t}\n\n\t\t// Check if the class extends the Reactive mixin (not ReactiveBase) by checking the prototype chain\n\t\tlet current = original.prototype\n\t\twhile (current && current !== Object.prototype) {\n\t\t\t// Check if this is the Reactive mixin specifically (not ReactiveBase)\n\t\t\tif (current.constructor && (current.constructor as any).__isReactiveMixin) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'@reactive decorator cannot be used with Reactive mixin. Reactive mixin already provides reactivity.'\n\t\t\t\t)\n\t\t\t}\n\t\t\tcurrent = Object.getPrototypeOf(current)\n\t\t}\n\t\tclass Reactive extends original {\n\t\t\tconstructor(...args: any[]) {\n\t\t\t\tsuper(...args)\n\t\t\t\tif (new.target !== Reactive && !reactiveClasses.has(new.target))\n\t\t\t\t\toptions.warn(\n\t\t\t\t\t\t`${(original as any).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.`\n\t\t\t\t\t)\n\t\t\t\t// biome-ignore lint/correctness/noConstructorReturn: This is the whole point here\n\t\t\t\treturn reactive(this)\n\t\t\t}\n\t\t}\n\t\tObject.defineProperty(Reactive, 'name', {\n\t\t\tvalue: `Reactive<${original.name}>`,\n\t\t})\n\t\treturn Reactive as any\n\t},\n\tget(original) {\n\t\treturn reactiveObject(original)\n\t},\n\tdefault: reactiveObject,\n})\n\n/**\n * Gets the original, non-reactive object from a reactive proxy\n * @param proxy - The reactive proxy\n * @returns The original object\n */\nexport function unwrap<T>(proxy: T): T {\n\t// Return the original object\n\treturn (proxyToObject.get(proxy as any) as T) ?? proxy\n}\n\n/**\n * Checks if an object is a reactive proxy\n * @param obj - The object to check\n * @returns True if the object is reactive\n */\nexport function isReactive(obj: any): boolean {\n\treturn proxyToObject.has(obj)\n}\n/**\n * Executes a function without tracking dependencies\n * @param fn - The function to execute\n */\nexport function untracked<T>(fn: () => T): T {\n\tlet rv: T\n\twithEffect(\n\t\tundefined,\n\t\t() => {\n\t\t\trv = fn()\n\t\t} /*,\n\t\ttrue*/\n\t)\n\treturn rv\n}\n\n// runEffect -> set<stop>\nconst effectChildren = new WeakMap<ScopedCallback, Set<ScopedCallback>>()\nconst fr = new FinalizationRegistry<() => void>((f) => f())\n\n/**\n * @param fn - The effect function to run - provides the cleaner\n * @returns The cleanup function\n */\n/**\n * Creates a reactive effect that automatically re-runs when dependencies change\n * @param fn - The effect function that provides dependencies and may return a cleanup function\n * @param args - Additional arguments that are forwarded to the effect function\n * @returns A cleanup function to stop the effect\n */\nexport function effect<Args extends any[]>(\n\tfn: (access: DependencyAccess, ...args: Args) => ScopedCallback | undefined | void,\n\t...args: Args\n): ScopedCallback {\n\tlet cleanup: (() => void) | null = null\n\t// capture the parent effect at creation time for ascend\n\tconst parentForAscend = parentEffect\n\tconst tracked = markWithRoot(<T>(cb: () => T) => withEffect(runEffect, cb), fn)\n\tconst ascend = markWithRoot(\n\t\t<T>(cb: () => T) => withEffect(parentForAscend, cb),\n\t\tgetRoot(parentForAscend)\n\t)\n\tlet effectStopped = false\n\tlet init = true\n\n\tfunction runEffect() {\n\t\t// The effect has been stopped after having been planned\n\t\tif (effectStopped) return\n\t\t// Clear previous dependencies\n\t\tcleanup?.()\n\n\t\toptions.enter(getRoot(fn))\n\t\tlet reactionCleanup: ScopedCallback | undefined\n\t\ttry {\n\t\t\treactionCleanup = withEffect(runEffect, () => fn({ tracked, ascend, init }, ...args)) as\n\t\t\t\t| undefined\n\t\t\t\t| ScopedCallback\n\t\t} finally {\n\t\t\tinit = false\n\t\t\toptions.leave(fn)\n\t\t}\n\n\t\t// Create cleanup function for next run\n\t\tcleanup = () => {\n\t\t\tcleanup = null\n\t\t\treactionCleanup?.()\n\t\t\t// Remove this effect from all reactive objects it's watching\n\t\t\tconst effectObjects = effectToReactiveObjects.get(runEffect)\n\t\t\tif (effectObjects) {\n\t\t\t\tfor (const reactiveObj of effectObjects) {\n\t\t\t\t\tconst objectWatchers = watchers.get(reactiveObj)\n\t\t\t\t\tif (objectWatchers) {\n\t\t\t\t\t\tfor (const [prop, deps] of objectWatchers.entries()) {\n\t\t\t\t\t\t\tdeps.delete(runEffect)\n\t\t\t\t\t\t\tif (deps.size === 0) {\n\t\t\t\t\t\t\t\tobjectWatchers.delete(prop)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (objectWatchers.size === 0) {\n\t\t\t\t\t\t\twatchers.delete(reactiveObj)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\teffectToReactiveObjects.delete(runEffect)\n\t\t\t}\n\t\t\t// Invoke all child stops (recursive via subEffectCleanup calling its own mainCleanup)\n\t\t\tconst children = effectChildren.get(runEffect)\n\t\t\tif (children) {\n\t\t\t\tfor (const childCleanup of children) childCleanup()\n\t\t\t\teffectChildren.delete(runEffect)\n\t\t\t}\n\t\t}\n\t}\n\t// Mark the runEffect callback with the original function as its root\n\tmarkWithRoot(runEffect, fn)\n\n\tbatch(runEffect, 'immediate')\n\n\tconst stopEffect = (): void => {\n\t\tif (effectStopped) return\n\t\teffectStopped = true\n\t\tcleanup?.()\n\t\tfr.unregister(stopEffect)\n\t}\n\n\tconst parent = parentEffect\n\t// Only ROOT effects are registered for GC cleanup\n\tif (!parent) {\n\t\tconst callIfCollected = () => stopEffect()\n\t\tfr.register(callIfCollected, stopEffect, stopEffect)\n\t\treturn callIfCollected\n\t}\n\t// Register this effect to be stopped when the parent effect is cleaned up\n\tlet children = effectChildren.get(parent)\n\tif (!children) {\n\t\tchildren = new Set()\n\t\teffectChildren.set(parent, children)\n\t}\n\tconst subEffectCleanup = (): void => {\n\t\tchildren.delete(subEffectCleanup)\n\t\tif (children.size === 0) {\n\t\t\teffectChildren.delete(parent)\n\t\t}\n\t\t// Execute this child effect cleanup (which triggers its own mainCleanup)\n\t\tstopEffect()\n\t}\n\tchildren.add(subEffectCleanup)\n\treturn subEffectCleanup\n}\n\n/**\n * Mark an object as non-reactive. This object and all its properties will never be made reactive.\n * @param obj - The object to mark as non-reactive\n */\nfunction nonReactive<T extends object[]>(...obj: T): T[0] {\n\tfor (const o of obj) {\n\t\ttry {\n\t\t\tObject.defineProperty(o, nonReactiveMark, {\n\t\t\t\tvalue: true,\n\t\t\t\twritable: false,\n\t\t\t\tenumerable: false,\n\t\t\t\tconfigurable: false,\n\t\t\t})\n\t\t} catch {}\n\t\tif (!(nonReactiveMark in (o as object))) nonReactiveObjects.add(o as object)\n\t}\n\treturn obj[0]\n}\n\n/**\n * Set of functions that test if objects are immutable\n * Objects that pass these tests will not be made reactive\n */\nexport const immutables = new Set<(tested: any) => boolean>()\n\n/**\n * Checks if an object is marked as non-reactive\n * @param obj - The object to check\n * @returns True if the object is non-reactive\n */\nexport function isNonReactive(obj: any): boolean {\n\t// Don't make primitives reactive\n\tif (obj === null || typeof obj !== 'object') return true\n\n\t// Check if the object itself is marked as non-reactive\n\tif (nonReactiveObjects.has(obj)) return true\n\n\t// Check if the object has the non-reactive symbol\n\tif (obj[nonReactiveMark]) return true\n\n\t// Check if the object is immutable\n\tif (Array.from(immutables).some((fn) => fn(obj))) return true\n\n\treturn false\n}\n\n/**\n * Marks classes as non-reactive\n * @param cls - Classes to mark as non-reactive\n * @returns The first class (for chaining)\n */\nexport function nonReactiveClass<T extends (new (...args: any[]) => any)[]>(...cls: T): T[0] {\n\tfor (const c of cls) if (c) (c.prototype as any)[nonReactiveMark] = true\n\treturn cls[0]\n}\n\nnonReactiveClass(Date, RegExp, Error, Promise, Function)\nif (typeof window !== 'undefined') nonReactive(window, document)\n//if (typeof Element !== 'undefined') nonReactiveClass(Element, Node)\n\n/**\n * Registers a native class to use a specialized reactive wrapper\n * @param originalClass - The original class to register\n * @param reactiveClass - The reactive wrapper class\n */\nexport function registerNativeReactivity(\n\toriginalClass: new (...args: any[]) => any,\n\treactiveClass: new (...args: any[]) => any\n) {\n\toriginalClass.prototype[nativeReactive] = reactiveClass\n\tnonReactiveClass(reactiveClass)\n}\n\n/**\n * Deep watch an object and all its nested properties\n * @param target - The object to watch deeply\n * @param callback - The callback to call when any nested property changes\n * @param options - Options for the deep watch\n * @returns A cleanup function to stop watching\n */\n/**\n * Sets up deep watching for an object, tracking all nested property changes\n * @param target - The object to watch\n * @param callback - The callback to call when changes occur\n * @param options - Options for deep watching\n * @returns A cleanup function to stop deep watching\n */\nexport function deepWatch<T extends object>(\n\ttarget: T,\n\tcallback: (value: T) => void,\n\t{ immediate = false } = {}\n): (() => void) | undefined {\n\tif (target === null || target === undefined) return undefined\n\tif (typeof target !== 'object') throw new Error('Target of deep watching must be an object')\n\t// Create a wrapper callback that matches ScopedCallback signature\n\tconst wrappedCallback: ScopedCallback = markWithRoot(() => callback(target), callback)\n\n\t// Use the existing effect system to register dependencies\n\treturn effect(() => {\n\t\t// Mark the target object as having deep watchers\n\t\tobjectsWithDeepWatchers.add(target)\n\n\t\t// Track which objects this effect is watching for cleanup\n\t\tlet effectObjects = effectToDeepWatchedObjects.get(wrappedCallback)\n\t\tif (!effectObjects) {\n\t\t\teffectObjects = new Set()\n\t\t\teffectToDeepWatchedObjects.set(wrappedCallback, effectObjects)\n\t\t}\n\t\teffectObjects!.add(target)\n\n\t\t// Traverse the object graph and register dependencies\n\t\t// This will re-run every time the effect runs, ensuring we catch all changes\n\t\tconst visited = new WeakSet()\n\t\tfunction traverseAndTrack(obj: any, depth = 0) {\n\t\t\t// Prevent infinite recursion and excessive depth\n\t\t\tif (visited.has(obj) || !isObject(obj) || depth > options.maxDeepWatchDepth) return\n\t\t\t// Do not traverse into unreactive objects\n\t\t\tif (isNonReactive(obj)) return\n\t\t\tvisited.add(obj)\n\n\t\t\t// Mark this object as having deep watchers\n\t\t\tobjectsWithDeepWatchers.add(obj)\n\t\t\teffectObjects!.add(obj)\n\n\t\t\t// Traverse all properties to register dependencies\n\t\t\t// unwrap to avoid kicking dependency\n\t\t\tfor (const key in unwrap(obj)) {\n\t\t\t\tif (Object.hasOwn(obj, key)) {\n\t\t\t\t\t// Access the property to register dependency\n\t\t\t\t\tconst value = (obj as any)[key]\n\t\t\t\t\t// Make the value reactive if it's an object\n\t\t\t\t\tconst reactiveValue =\n\t\t\t\t\t\ttypeof value === 'object' && value !== null ? reactive(value) : value\n\t\t\t\t\ttraverseAndTrack(reactiveValue, depth + 1)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Also handle array indices and length\n\t\t\t// biome-ignore lint/suspicious/useIsArray: Check for both native arrays and reactive arrays\n\t\t\tif (Array.isArray(obj) || obj instanceof Array) {\n\t\t\t\t// Access array length to register dependency on length changes\n\t\t\t\tconst length = obj.length\n\n\t\t\t\t// Access all current array elements to register dependencies\n\t\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\t\t// Access the array element to register dependency\n\t\t\t\t\tconst value = obj[i]\n\t\t\t\t\t// Make the value reactive if it's an object\n\t\t\t\t\tconst reactiveValue =\n\t\t\t\t\t\ttypeof value === 'object' && value !== null ? reactive(value) : value\n\t\t\t\t\ttraverseAndTrack(reactiveValue, depth + 1)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Handle Set values (deep watch values only, not keys since Sets don't have separate keys)\n\t\t\telse if (obj instanceof Set) {\n\t\t\t\t// Access all Set values to register dependencies\n\t\t\t\tfor (const value of obj) {\n\t\t\t\t\t// Make the value reactive if it's an object\n\t\t\t\t\tconst reactiveValue =\n\t\t\t\t\t\ttypeof value === 'object' && value !== null ? reactive(value) : value\n\t\t\t\t\ttraverseAndTrack(reactiveValue, depth + 1)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Handle Map values (deep watch values only, not keys)\n\t\t\telse if (obj instanceof Map) {\n\t\t\t\t// Access all Map values to register dependencies\n\t\t\t\tfor (const [_key, value] of obj) {\n\t\t\t\t\t// Make the value reactive if it's an object\n\t\t\t\t\tconst reactiveValue =\n\t\t\t\t\t\ttypeof value === 'object' && value !== null ? reactive(value) : value\n\t\t\t\t\ttraverseAndTrack(reactiveValue, depth + 1)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Note: WeakSet and WeakMap cannot be iterated, so we can't deep watch their contents\n\t\t\t// They will only trigger when the collection itself is replaced\n\t\t}\n\n\t\t// Traverse the target object to register all dependencies\n\t\t// This will register dependencies on all current properties and array elements\n\t\ttraverseAndTrack(target)\n\n\t\t// Only call the callback if immediate is true or if it's not the first run\n\t\tif (immediate) callback(target)\n\t\timmediate = true\n\n\t\t// Return a cleanup function that properly removes deep watcher tracking\n\t\treturn () => {\n\t\t\t// Get the objects this effect was watching\n\t\t\tconst effectObjects = effectToDeepWatchedObjects.get(wrappedCallback)\n\t\t\tif (effectObjects) {\n\t\t\t\t// Remove deep watcher tracking from all objects this effect was watching\n\t\t\t\tfor (const obj of effectObjects) {\n\t\t\t\t\t// Check if this object still has other deep watchers\n\t\t\t\t\tconst watchers = deepWatchers.get(obj)\n\t\t\t\t\tif (watchers) {\n\t\t\t\t\t\t// Remove this effect's callback from the watchers\n\t\t\t\t\t\twatchers.delete(wrappedCallback)\n\n\t\t\t\t\t\t// If no more watchers, remove the object from deep watchers tracking\n\t\t\t\t\t\tif (watchers.size === 0) {\n\t\t\t\t\t\t\tdeepWatchers.delete(obj)\n\t\t\t\t\t\t\tobjectsWithDeepWatchers.delete(obj)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// No watchers found, remove from deep watchers tracking\n\t\t\t\t\t\tobjectsWithDeepWatchers.delete(obj)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Clean up the tracking data\n\t\t\t\teffectToDeepWatchedObjects.delete(wrappedCallback)\n\t\t\t}\n\t\t}\n\t})\n}\n","import { decorator, GenericClassDecorator } from '../decorator'\nimport { renamed } from '../utils'\nimport {\n\tactiveEffect,\n\taddBatchCleanup,\n\ttype DependencyAccess,\n\ttype DependencyFunction,\n\tdeepWatch,\n\tdependant,\n\teffect,\n\tgetRoot,\n\tisNonReactive,\n\tmarkWithRoot,\n\tnonReactiveClass,\n\tnonReactiveMark,\n\tnonReactiveObjects,\n\toptions,\n\treactive,\n\ttype ScopedCallback,\n\ttouched1,\n\tunreactiveProperties,\n\tuntracked,\n\tunwrap,\n\twithEffect,\n} from './core'\n\n//#region computed\nlet computedInvalidations: (() => void)[] | undefined\n/**\n * Registers a callback to be called when a computed property is invalidated\n * @param cb - The callback to register\n * @param warn - Whether to warn if used outside of a computed property\n */\nexport function invalidateComputed(cb: () => void, warn = true) {\n\tif (computedInvalidations) computedInvalidations.push(cb)\n\telse if (warn) options.warn('Using `invalidateComputed` outside of a computed property')\n}\ntype ComputedFunction<T> = (dep: DependencyAccess) => T\nconst computedCache = new WeakMap<ComputedFunction<any>, any>()\nfunction computedFunction<T>(getter: ComputedFunction<T>): T {\n\tconst key = getRoot(getter)\n\tlet invalidations: (() => void)[] = []\n\tdependant(computedCache, key)\n\tif (computedCache.has(key)) return computedCache.get(key)\n\tlet stopped = false\n\tconst once = effect(\n\t\tmarkWithRoot((access) => {\n\t\t\tif (stopped) return\n\t\t\tconst oldCI = computedInvalidations\n\t\t\tif (computedCache.has(key)) {\n\t\t\t\t// This should *not* be called in the cleanup chain, as its effects would be lost and cleaned-up\n\t\t\t\tfor (const cb of invalidations) cb()\n\t\t\t\tinvalidations = []\n\t\t\t\tcomputedCache.delete(key)\n\t\t\t\ttouched1(computedCache, { type: 'invalidate', prop: key }, key)\n\t\t\t\tonce()\n\t\t\t\tstopped = true\n\t\t\t} else\n\t\t\t\ttry {\n\t\t\t\t\tcomputedInvalidations = invalidations\n\t\t\t\t\tcomputedCache.set(key, getter(access))\n\t\t\t\t} finally {\n\t\t\t\t\tcomputedInvalidations = oldCI\n\t\t\t\t}\n\t\t}, getter)\n\t)\n\treturn computedCache.get(key)\n}\n\n/**\n * Decorator and function for creating computed properties that cache their values\n * Only recomputes when dependencies change\n */\nexport const computed = Object.assign(\n\tdecorator({\n\t\tgetter(original, propertyKey) {\n\t\t\tconst computers = new WeakMap<any, () => any>()\n\t\t\treturn function (this: any) {\n\t\t\t\tif (!computers.has(this)) {\n\t\t\t\t\tcomputers.set(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\trenamed(\n\t\t\t\t\t\t\t() => original.call(this),\n\t\t\t\t\t\t\t`${String(this.constructor.name)}.${String(propertyKey)}`\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn computedFunction(computers.get(this)!)\n\t\t\t}\n\t\t},\n\t\tdefault: computedFunction,\n\t}),\n\t{\n\t\tmap: computedMap,\n\t\tmemo: computedMapMemo,\n\t\tself: selfReferencing,\n\t}\n)\n\n//#endregion\n\n//#region watch\n\nconst unsetYet = Symbol('unset-yet')\n/**\n * Options for the watch function\n */\nexport interface WatchOptions {\n\t/** Whether to call the callback immediately */\n\timmediate?: boolean\n\t/** Whether to watch nested properties */\n\tdeep?: boolean\n}\n\n/**\n * Watches a computed value and calls a callback when it changes\n * @param value - Function that returns the value to watch\n * @param changed - Callback to call when the value changes\n * @param options - Watch options\n * @returns Cleanup function to stop watching\n */\nexport function watch<T>(\n\tvalue: (dep: DependencyAccess) => T,\n\tchanged: (value: T, oldValue?: T) => void,\n\toptions?: Omit<WatchOptions, 'deep'> & { deep?: false }\n): ScopedCallback\n/**\n * Watches a computed value with deep watching enabled\n * @param value - Function that returns the value to watch\n * @param changed - Callback to call when the value changes\n * @param options - Watch options with deep watching enabled\n * @returns Cleanup function to stop watching\n */\nexport function watch<T extends object | any[]>(\n\tvalue: (dep: DependencyAccess) => T,\n\tchanged: (value: T, oldValue?: T) => void,\n\toptions?: Omit<WatchOptions, 'deep'> & { deep: true }\n): ScopedCallback\n/**\n * Watches a reactive object directly\n * @param value - The reactive object to watch\n * @param changed - Callback to call when the object changes\n * @param options - Watch options\n * @returns Cleanup function to stop watching\n */\nexport function watch<T extends object | any[]>(\n\tvalue: T,\n\tchanged: (value: T) => void,\n\toptions?: WatchOptions\n): ScopedCallback\n\nexport function watch(\n\tvalue: any, //object | ((dep: DependencyAccess) => object),\n\tchanged: (value?: object, oldValue?: object) => void,\n\toptions: any = {}\n) {\n\treturn typeof value === 'function'\n\t\t? watchCallBack(value, changed, options)\n\t\t: typeof value === 'object'\n\t\t\t? watchObject(value, changed, options)\n\t\t\t: (() => {\n\t\t\t\t\tthrow new Error('watch: value must be a function or an object')\n\t\t\t\t})()\n}\n\nfunction watchObject(\n\tvalue: object,\n\tchanged: (value: object) => void,\n\t{ immediate = false, deep = false } = {}\n): ScopedCallback {\n\tconst myParentEffect = activeEffect\n\tif (deep) return deepWatch(value, changed, { immediate })\n\treturn effect(\n\t\tmarkWithRoot(function watchObjectEffect() {\n\t\t\tdependant(value)\n\t\t\tif (immediate) withEffect(myParentEffect, () => changed(value))\n\t\t\timmediate = true\n\t\t}, changed)\n\t)\n}\n\nfunction watchCallBack<T>(\n\tvalue: (dep: DependencyAccess) => T,\n\tchanged: (value: T, oldValue?: T) => void,\n\t{ immediate = false, deep = false } = {}\n): ScopedCallback {\n\tconst myParentEffect = activeEffect\n\tlet oldValue: T | typeof unsetYet = unsetYet\n\tlet deepCleanup: ScopedCallback | undefined\n\tconst cbCleanup = effect(\n\t\tmarkWithRoot(function watchCallBackEffect(access) {\n\t\t\tconst newValue = value(access)\n\t\t\tif (oldValue !== newValue)\n\t\t\t\twithEffect(\n\t\t\t\t\tmyParentEffect,\n\t\t\t\t\tmarkWithRoot(() => {\n\t\t\t\t\t\tif (oldValue === unsetYet) {\n\t\t\t\t\t\t\tif (immediate) changed(newValue)\n\t\t\t\t\t\t} else changed(newValue, oldValue)\n\t\t\t\t\t\toldValue = newValue\n\t\t\t\t\t\tif (deep) {\n\t\t\t\t\t\t\tif (deepCleanup) deepCleanup()\n\t\t\t\t\t\t\tdeepCleanup = deepWatch(\n\t\t\t\t\t\t\t\tnewValue as object,\n\t\t\t\t\t\t\t\tmarkWithRoot((value) => changed(value as T, value as T), changed)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t}, changed)\n\t\t\t\t)\n\t\t}, value)\n\t)\n\treturn () => {\n\t\tcbCleanup()\n\t\tif (deepCleanup) deepCleanup()\n\t}\n}\n\n//#endregion\n\n//#region nonReactive\n\n/**\n * Mark an object as non-reactive. This object and all its properties will never be made reactive.\n * @param obj - The object to mark as non-reactive\n */\nfunction deepNonReactive<T>(obj: T): T {\n\tobj = unwrap(obj)\n\tif (isNonReactive(obj)) return obj\n\ttry {\n\t\tObject.defineProperty(obj as object, nonReactiveMark, {\n\t\t\tvalue: true,\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true,\n\t\t})\n\t} catch {}\n\tif (!(nonReactiveMark in (obj as object))) nonReactiveObjects.add(obj as object)\n\tfor (const key in obj) deepNonReactive(obj[key])\n\treturn obj\n}\nfunction unreactiveApplication<T extends object>(...args: (keyof T)[]): GenericClassDecorator<T>\nfunction unreactiveApplication<T extends object>(obj: T): T\nfunction unreactiveApplication<T extends object>(\n\targ1: T | keyof T,\n\t...args: (keyof T)[]\n): GenericClassDecorator<T> | T {\n\treturn typeof arg1 === 'object'\n\t\t? deepNonReactive(arg1)\n\t\t: (((original) => {\n\t\t\t\t// Copy the parent's unreactive properties if they exist\n\t\t\t\toriginal.prototype[unreactiveProperties] = new Set<PropertyKey>(\n\t\t\t\t\toriginal.prototype[unreactiveProperties] || []\n\t\t\t\t)\n\t\t\t\t// Add all arguments (including the first one)\n\t\t\t\toriginal.prototype[unreactiveProperties].add(arg1)\n\t\t\t\tfor (const arg of args) original.prototype[unreactiveProperties].add(arg)\n\t\t\t\treturn original // Return the class\n\t\t\t}) as GenericClassDecorator<T>)\n}\n/**\n * Decorator that marks classes or properties as non-reactive\n * Prevents objects from being made reactive\n */\nexport const unreactive = decorator({\n\tclass(original) {\n\t\t// Called without arguments, mark entire class as non-reactive\n\t\tnonReactiveClass(original)\n\t},\n\tdefault: unreactiveApplication,\n})\n\n//#endregion\n\nimport { profileInfo } from './core'\n\nObject.assign(profileInfo, { computedCache })\n\nexport function cleanedBy<T extends object>(obj: T, cleanup: ScopedCallback) {\n\treturn Object.defineProperty(obj, 'cleanup', {\n\t\tvalue: cleanup,\n\t\twritable: false,\n\t\tenumerable: false,\n\t\tconfigurable: true,\n\t}) as T & { cleanup: () => void }\n}\n\n//#region greedy caching\n\n/**\n * Creates a derived value that automatically recomputes when dependencies change\n * Unlike computed, this always recomputes immediately when dependencies change\n * @param compute - Function that computes the derived value\n * @returns Object with value and cleanup function\n */\nexport function derived<T>(compute: (dep: DependencyAccess) => T): {\n\tvalue: T\n\tcleanup: ScopedCallback\n} {\n\tconst rv = { value: undefined }\n\treturn cleanedBy(\n\t\trv,\n\t\tuntracked(() =>\n\t\t\teffect(\n\t\t\t\tmarkWithRoot(function derivedEffect(access) {\n\t\t\t\t\trv.value = compute(access)\n\t\t\t\t}, compute)\n\t\t\t)\n\t\t)\n\t)\n}\n\nfunction computedMap<T, U>(\n\tinputs: T[],\n\tcompute: (input: T, index: number, oldValue?: U) => U,\n\tresize?: (newLength: number, oldLength: number) => void\n): U[] {\n\tconst result = reactive([])\n\tconst cleanups: ScopedCallback[] = []\n\tfunction input(index: number) {\n\t\treturn effect(function computedIndexedMapInputEffect() {\n\t\t\tresult[index] = compute(inputs[index], index, result[index])\n\t\t})\n\t}\n\teffect(function computedMapLengthEffect({ ascend }) {\n\t\tconst length = inputs.length\n\t\tconst resultLength = untracked(() => result.length)\n\t\tresize?.(length, resultLength)\n\t\tif (length < resultLength) {\n\t\t\tconst toCleanup = cleanups.splice(length)\n\t\t\tfor (const cleanup of toCleanup) cleanup()\n\t\t\tresult.length = length\n\t\t} else if (length > resultLength)\n\t\t\t// the input effects will be registered as the call's children, so they will remain not cleaned with this effect on length\n\t\t\tascend(function computedMapNewElements() {\n\t\t\t\tfor (let i = resultLength; i < length; i++) cleanups.push(input(i))\n\t\t\t})\n\t})\n\treturn cleanedBy(result, () => {\n\t\tfor (const cleanup of cleanups) cleanup()\n\t\tcleanups.length = 0\n\t})\n}\n\ntype MemoEntry<O> = {\n\tvalue: O\n\tcleanup: ScopedCallback\n}\n\n@unreactive\nexport class Memoized<I, O> {\n\tconstructor(private compute: (input: I) => O) {\n\t\tthis.keepCleanups = effect(({ ascend }) => {\n\t\t\tthis.inEffect = ascend\n\t\t\treturn () => {\n\t\t\t\tthis.cleanup()\n\t\t\t}\n\t\t})\n\t}\n\tprivate keepCleanups: ScopedCallback\n\tcleanup() {\n\t\tfor (const { cleanup } of this.cache.values()) cleanup()\n\t\tthis.cache.clear()\n\t}\n\tprivate inEffect: DependencyFunction\n\tprivate cache = new Map<I, MemoEntry<O>>()\n\tget(input: I): O {\n\t\tdependant(this, input)\n\t\tlet cached: any\n\t\tif (this.cache.has(input)) {\n\t\t\tcached = this.cache.get(input)!\n\t\t} else {\n\t\t\tcached = {}\n\t\t\tcached.cleanup = this.inEffect(() =>\n\t\t\t\teffect(\n\t\t\t\t\tObject.defineProperties(\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tif ('value' in cached) {\n\t\t\t\t\t\t\t\tthis.cache.delete(input)\n\t\t\t\t\t\t\t\ttouched1(this, { type: 'invalidate', prop: input }, input)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcached.value = this.compute(input)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ name: { value: 'Memoize' } }\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t\tthis.cache.set(input, cached)\n\t\t}\n\t\treturn cached.value\n\t}\n\n\treduceInputs(inputs: Set<I> | ((input: I) => boolean)) {\n\t\tfor (const input of this.cache.keys()) {\n\t\t\tif (typeof inputs === 'function' ? !inputs(input) : !inputs.has(input)) {\n\t\t\t\tconst entry = this.cache.get(input)!\n\t\t\t\tentry.cleanup()\n\t\t\t\tthis.cache.delete(input)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction computedMapMemo<I, O>(inputs: I[] | (() => I[]), compute: (input: I) => O): O[] {\n\tconst memo = new Memoized(compute)\n\tconst result = reactive([])\n\treturn cleanedBy(\n\t\tresult,\n\t\teffect(() => {\n\t\t\tconst inputArray = typeof inputs === 'function' ? inputs() : inputs\n\t\t\tfunction reduceKeys() {\n\t\t\t\tuntracked(() => {\n\t\t\t\t\tmemo.reduceInputs(new Set(inputArray))\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst map = computedMap(\n\t\t\t\tinputArray,\n\t\t\t\t(input) => {\n\t\t\t\t\taddBatchCleanup(reduceKeys)\n\t\t\t\t\treturn memo.get(input)\n\t\t\t\t},\n\t\t\t\t() => addBatchCleanup(reduceKeys)\n\t\t\t)\n\t\t\teffect(() => {\n\t\t\t\tresult.length = 0\n\t\t\t\tresult.push(...map)\n\t\t\t})\n\t\t})\n\t)\n}\n\nfunction selfReferencing<T extends object>(compute: (dep: DependencyAccess) => T): T {\n\tlet rv: T | undefined\n\tconst cleanup = effect((access) => {\n\t\trv = compute(access)\n\t})\n\treturn cleanedBy(rv, cleanup)\n}\n","import { Indexable } from '../../indexable'\nimport {\n\tdependant,\n\tmakeReactiveEntriesIterator,\n\tmakeReactiveIterator,\n\tprototypeForwarding,\n\treactive,\n\ttouched,\n} from '../core'\n\nconst native = Symbol('native')\nconst isArray = Array.isArray\nArray.isArray = ((value: any) =>\n\t// biome-ignore lint/suspicious/useIsArray: We are defining it\n\tisArray(value) || (value instanceof Array && native in value)) as any\nclass ReactiveBaseArray {\n\tdeclare readonly [native]: any[]\n}\nfunction* index(i: number, { length = true } = {}): IterableIterator<number | 'length'> {\n\tif (length) yield 'length'\n\tyield i\n}\n\nfunction* range(\n\ta: number,\n\tb: number,\n\t{ length = false } = {}\n): IterableIterator<number | 'length'> {\n\tconst start = Math.min(a, b)\n\tconst end = Math.max(a, b)\n\tif (length) yield 'length'\n\tfor (let i = start; i <= end; i++) yield i\n}\n/**\n * Reactive wrapper around JavaScript's Array class with full array method support\n * Tracks length changes, individual index operations, and collection-wide operations\n */\nexport class ReactiveArray extends Indexable(ReactiveBaseArray, {\n\tget(i: number): any {\n\t\tdependant(this[native], i)\n\t\treturn reactive(this[native][i])\n\t},\n\tset(i: number, value: any) {\n\t\tconst added = i >= this[native].length\n\t\tthis[native][i] = value\n\t\ttouched(this[native], { type: 'set', prop: i }, index(i, { length: added }))\n\t},\n\tgetLength() {\n\t\tdependant(this[native], 'length')\n\t\treturn this[native].length\n\t},\n\tsetLength(value: number) {\n\t\tconst oldLength = this[native].length\n\t\ttry {\n\t\t\tthis[native].length = value\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis[native],\n\t\t\t\t{ type: 'set', prop: 'length' },\n\t\t\t\trange(oldLength, value, { length: true })\n\t\t\t)\n\t\t}\n\t},\n}) {\n\tdeclare length: number\n\tconstructor(original: any[]) {\n\t\tsuper()\n\t\tObject.defineProperties(this, {\n\t\t\t// We have to make it double, as [native] must be `unique symbol` - impossible through import\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t})\n\t}\n\n\t// Safe array access with negative indices\n\tat(index: number): any {\n\t\tconst actualIndex = index < 0 ? this[native].length + index : index\n\t\tdependant(this, actualIndex)\n\t\tif (actualIndex < 0 || actualIndex >= this[native].length) return undefined\n\t\treturn reactive(this[native][actualIndex])\n\t}\n\n\tpush(...items: any[]) {\n\t\tconst oldLength = this[native].length\n\t\ttry {\n\t\t\treturn this[native].push(...items)\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'push' },\n\t\t\t\trange(oldLength, oldLength + items.length - 1, { length: true })\n\t\t\t)\n\t\t}\n\t}\n\n\tpop() {\n\t\tif (this[native].length === 0) return undefined\n\t\ttry {\n\t\t\treturn reactive(this[native].pop())\n\t\t} finally {\n\t\t\ttouched(this, { type: 'bunch', method: 'pop' }, index(this[native].length))\n\t\t}\n\t}\n\n\tshift() {\n\t\tif (this[native].length === 0) return undefined\n\t\ttry {\n\t\t\treturn reactive(this[native].shift())\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'shift' },\n\t\t\t\trange(0, this[native].length + 1, { length: true })\n\t\t\t)\n\t\t}\n\t}\n\n\tunshift(...items: any[]) {\n\t\ttry {\n\t\t\treturn this[native].unshift(...items)\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'unshift' },\n\t\t\t\trange(0, this[native].length - items.length, { length: true })\n\t\t\t)\n\t\t}\n\t}\n\n\tsplice(start: number, deleteCount?: number, ...items: any[]) {\n\t\tconst oldLength = this[native].length\n\t\tif (deleteCount === undefined) deleteCount = oldLength - start\n\t\ttry {\n\t\t\tif (deleteCount === undefined) return reactive(this[native].splice(start))\n\t\t\treturn reactive(this[native].splice(start, deleteCount, ...items))\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'splice' },\n\t\t\t\t// TODO: edge cases\n\t\t\t\tdeleteCount === items.length\n\t\t\t\t\t? range(start, start + deleteCount)\n\t\t\t\t\t: range(start, oldLength + Math.max(items.length - deleteCount, 0), {\n\t\t\t\t\t\t\tlength: true,\n\t\t\t\t\t\t})\n\t\t\t)\n\t\t}\n\t}\n\n\treverse() {\n\t\ttry {\n\t\t\treturn this[native].reverse()\n\t\t} finally {\n\t\t\ttouched(this, { type: 'bunch', method: 'reverse' }, range(0, this[native].length - 1))\n\t\t}\n\t}\n\n\tsort(compareFn?: (a: any, b: any) => number) {\n\t\tcompareFn = compareFn || ((a, b) => a.toString().localeCompare(b.toString()))\n\t\ttry {\n\t\t\treturn this[native].sort((a, b) => compareFn(reactive(a), reactive(b))) as any\n\t\t} finally {\n\t\t\ttouched(this, { type: 'bunch', method: 'sort' }, range(0, this[native].length - 1))\n\t\t}\n\t}\n\n\tfill(value: any, start?: number, end?: number) {\n\t\ttry {\n\t\t\tif (start === undefined) return this[native].fill(value) as any\n\t\t\tif (end === undefined) return this[native].fill(value, start) as any\n\t\t\treturn this[native].fill(value, start, end) as any\n\t\t} finally {\n\t\t\ttouched(this, { type: 'bunch', method: 'fill' }, range(0, this[native].length - 1))\n\t\t}\n\t}\n\n\tcopyWithin(target: number, start: number, end?: number) {\n\t\ttry {\n\t\t\tif (end === undefined) return this[native].copyWithin(target, start) as any\n\t\t\treturn this[native].copyWithin(target, start, end) as any\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'copyWithin' },\n\t\t\t\t// TODO: calculate the range properly\n\t\t\t\trange(0, this[native].length - 1)\n\t\t\t)\n\t\t}\n\t\t// Touch all affected indices with a single allProps call\n\t}\n\n\t// Immutable versions of mutator methods\n\ttoReversed(): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].toReversed())\n\t}\n\n\ttoSorted(compareFn?: (a: any, b: any) => number): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].toSorted(compareFn))\n\t}\n\n\ttoSpliced(start: number, deleteCount?: number, ...items: any[]): any[] {\n\t\tdependant(this)\n\t\treturn deleteCount === undefined\n\t\t\t? this[native].toSpliced(start)\n\t\t\t: this[native].toSpliced(start, deleteCount, ...items)\n\t}\n\n\twith(index: number, value: any): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].with(index, value))\n\t}\n\n\t// Iterator methods with reactivity tracking\n\tentries() {\n\t\tdependant(this)\n\t\treturn makeReactiveEntriesIterator(this[native].entries())\n\t}\n\n\tkeys() {\n\t\tdependant(this, 'length')\n\t\treturn this[native].keys()\n\t}\n\n\tvalues() {\n\t\tdependant(this)\n\t\treturn makeReactiveIterator(this[native].values())\n\t}\n\n\t[Symbol.iterator]() {\n\t\tdependant(this)\n\t\tconst nativeIterator = this[native][Symbol.iterator]()\n\t\treturn {\n\t\t\tnext() {\n\t\t\t\tconst result = nativeIterator.next()\n\t\t\t\tif (result.done) {\n\t\t\t\t\treturn result\n\t\t\t\t}\n\t\t\t\treturn { value: reactive(result.value), done: false }\n\t\t\t},\n\t\t}\n\t}\n\n\tindexOf(searchElement: any, fromIndex?: number): number {\n\t\tdependant(this)\n\t\treturn this[native].indexOf(searchElement, fromIndex)\n\t}\n\n\tlastIndexOf(searchElement: any, fromIndex?: number): number {\n\t\tdependant(this)\n\t\treturn this[native].lastIndexOf(searchElement, fromIndex)\n\t}\n\n\tincludes(searchElement: any, fromIndex?: number): boolean {\n\t\tdependant(this)\n\t\treturn this[native].includes(searchElement, fromIndex)\n\t}\n\n\tfind(\n\t\tpredicate: (this: any, value: any, index: number, obj: any[]) => boolean,\n\t\tthisArg?: any\n\t): any {\n\t\tdependant(this)\n\t\treturn reactive(this[native].find(predicate, thisArg))\n\t}\n\n\tfindIndex(\n\t\tpredicate: (this: any, value: any, index: number, obj: any[]) => boolean,\n\t\tthisArg?: any\n\t): number {\n\t\tdependant(this)\n\t\treturn this[native].findIndex(predicate, thisArg)\n\t}\n\n\tflat(): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].flat())\n\t}\n\n\tflatMap(\n\t\tcallbackfn: (this: any, value: any, index: number, array: any[]) => any[],\n\t\tthisArg?: any\n\t): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].flatMap(callbackfn, thisArg))\n\t}\n\n\tfilter(callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any): any[] {\n\t\tdependant(this)\n\t\treturn reactive(\n\t\t\tthis[native].filter((item, index, array) => callbackfn(reactive(item), index, array), thisArg)\n\t\t)\n\t}\n\n\tmap(callbackfn: (value: any, index: number, array: any[]) => any, thisArg?: any): any[] {\n\t\tdependant(this)\n\t\treturn reactive(\n\t\t\tthis[native].map((item, index, array) => callbackfn(reactive(item), index, array), thisArg)\n\t\t)\n\t}\n\n\treduce(\n\t\tcallbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any,\n\t\tinitialValue?: any\n\t): any {\n\t\tdependant(this)\n\t\tconst result =\n\t\t\tinitialValue === undefined\n\t\t\t\t? this[native].reduce(callbackfn as any)\n\t\t\t\t: this[native].reduce(callbackfn as any, initialValue)\n\t\treturn reactive(result)\n\t}\n\n\treduceRight(\n\t\tcallbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any,\n\t\tinitialValue?: any\n\t): any {\n\t\tdependant(this)\n\t\tconst result =\n\t\t\tinitialValue !== undefined\n\t\t\t\t? this[native].reduceRight(callbackfn as any, initialValue)\n\t\t\t\t: (this[native] as any).reduceRight(callbackfn as any)\n\t\treturn reactive(result)\n\t}\n\n\tslice(start?: number, end?: number): any[] {\n\t\tfor (const i of range(start || 0, end || this[native].length - 1)) dependant(this, i)\n\t\treturn start === undefined\n\t\t\t? this[native].slice()\n\t\t\t: end === undefined\n\t\t\t\t? this[native].slice(start)\n\t\t\t\t: this[native].slice(start, end)\n\t}\n\n\tconcat(...items: any[]): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].concat(...items))\n\t}\n\n\tjoin(separator?: string): string {\n\t\tdependant(this)\n\t\treturn this[native].join(separator as any)\n\t}\n\n\tforEach(callbackfn: (value: any, index: number, array: any[]) => void, thisArg?: any): void {\n\t\tdependant(this)\n\t\tthis[native].forEach(callbackfn as any, thisArg)\n\t}\n\n\t// TODO: re-implement for fun dependencies? (eg - every only check the first ones until it find some),\n\t// no need to make it dependant on indexes after the found one\n\tevery(callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any): boolean {\n\t\tdependant(this)\n\t\treturn this[native].every(callbackfn as any, thisArg)\n\t}\n\n\tsome(callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any): boolean {\n\t\tdependant(this)\n\t\treturn this[native].some(callbackfn as any, thisArg)\n\t}\n}\n","import {\n\tdependant,\n\tmakeReactiveEntriesIterator,\n\tmakeReactiveIterator,\n\tprototypeForwarding,\n\treactive,\n\ttouched,\n\ttouched1,\n} from '../core'\n\nconst native = Symbol('native')\n\n/**\n * Reactive wrapper around JavaScript's WeakMap class\n * Only tracks individual key operations, no size tracking (WeakMap limitation)\n */\nexport class ReactiveWeakMap<K extends object, V> {\n\tdeclare readonly [native]: WeakMap<K, V>\n\tdeclare readonly content: symbol\n\tconstructor(original: WeakMap<K, V>) {\n\t\tObject.defineProperties(this, {\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t\tcontent: { value: Symbol('content') },\n\t\t\t[Symbol.toStringTag]: { value: 'ReactiveWeakMap' },\n\t\t})\n\t}\n\n\t// Implement WeakMap interface methods with reactivity\n\tdelete(key: K): boolean {\n\t\tconst hadKey = this[native].has(key)\n\t\tconst result = this[native].delete(key)\n\n\t\tif (hadKey) touched1(this.content, { type: 'del', prop: key }, key)\n\n\t\treturn result\n\t}\n\n\tget(key: K): V | undefined {\n\t\tdependant(this.content, key)\n\t\treturn reactive(this[native].get(key))\n\t}\n\n\thas(key: K): boolean {\n\t\tdependant(this.content, key)\n\t\treturn this[native].has(key)\n\t}\n\n\tset(key: K, value: V): this {\n\t\t// Trigger effects for the specific key\n\t\ttouched1(this.content, { type: this[native].has(key) ? 'set' : 'add', prop: key }, key)\n\t\tthis[native].set(key, value)\n\n\t\treturn this\n\t}\n}\n\n/**\n * Reactive wrapper around JavaScript's Map class\n * Tracks size changes, individual key operations, and collection-wide operations\n */\nexport class ReactiveMap<K, V> {\n\tdeclare readonly [native]: Map<K, V>\n\tdeclare readonly content: symbol\n\n\tconstructor(original: Map<K, V>) {\n\t\tObject.defineProperties(this, {\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t\tcontent: { value: Symbol('content') },\n\t\t\t[Symbol.toStringTag]: { value: 'ReactiveMap' },\n\t\t})\n\t}\n\n\t// Implement Map interface methods with reactivity\n\tget size(): number {\n\t\tdependant(this, 'size') // The ReactiveMap instance still goes through proxy\n\t\treturn this[native].size\n\t}\n\n\tclear(): void {\n\t\tconst hadEntries = this[native].size > 0\n\t\tthis[native].clear()\n\n\t\tif (hadEntries) {\n\t\t\tconst evolution = { type: 'bunch', method: 'clear' } as const\n\t\t\t// Clear triggers all effects since all keys are affected\n\t\t\ttouched1(this, evolution, 'size')\n\t\t\ttouched(this.content, evolution)\n\t\t}\n\t}\n\n\tentries(): Generator<[K, V]> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveEntriesIterator(this[native].entries())\n\t}\n\n\tforEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void {\n\t\tdependant(this.content)\n\t\tthis[native].forEach(callbackfn, thisArg)\n\t}\n\n\tkeys(): MapIterator<K> {\n\t\tdependant(this.content)\n\t\treturn this[native].keys()\n\t}\n\n\tvalues(): Generator<V> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveIterator(this[native].values())\n\t}\n\n\t[Symbol.iterator](): Iterator<[K, V]> {\n\t\tdependant(this.content)\n\t\tconst nativeIterator = this[native][Symbol.iterator]()\n\t\treturn {\n\t\t\tnext() {\n\t\t\t\tconst result = nativeIterator.next()\n\t\t\t\tif (result.done) {\n\t\t\t\t\treturn result\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tvalue: [result.value[0], reactive(result.value[1])],\n\t\t\t\t\tdone: false,\n\t\t\t\t}\n\t\t\t},\n\t\t}\n\t}\n\n\t// Implement Map methods with reactivity\n\tdelete(key: K): boolean {\n\t\tconst hadKey = this[native].has(key)\n\t\tconst result = this[native].delete(key)\n\n\t\tif (hadKey) {\n\t\t\tconst evolution = { type: 'del', prop: key } as const\n\t\t\ttouched1(this.content, evolution, key)\n\t\t\ttouched1(this, evolution, 'size')\n\t\t}\n\n\t\treturn result\n\t}\n\n\tget(key: K): V | undefined {\n\t\tdependant(this.content, key)\n\t\treturn reactive(this[native].get(key))\n\t}\n\n\thas(key: K): boolean {\n\t\tdependant(this.content, key)\n\t\treturn this[native].has(key)\n\t}\n\n\tset(key: K, value: V): this {\n\t\tconst hadKey = this[native].has(key)\n\t\tconst oldValue = this[native].get(key)\n\t\tconst reactiveValue = reactive(value)\n\t\tthis[native].set(key, reactiveValue)\n\n\t\tif (!hadKey || oldValue !== reactiveValue) {\n\t\t\tconst evolution = { type: hadKey ? 'set' : 'add', prop: key } as const\n\t\t\ttouched1(this.content, evolution, key)\n\t\t\ttouched1(this, evolution, 'size')\n\t\t}\n\n\t\treturn this\n\t}\n}\n","import {\n\tdependant,\n\tmakeReactiveEntriesIterator,\n\tmakeReactiveIterator,\n\tprototypeForwarding,\n\treactive,\n\ttouched,\n\ttouched1,\n} from '../core'\n\nconst native = Symbol('native')\n\n/**\n * Reactive wrapper around JavaScript's WeakSet class\n * Only tracks individual value operations, no size tracking (WeakSet limitation)\n */\nexport class ReactiveWeakSet<T extends object> {\n\tdeclare readonly [native]: WeakSet<T>\n\tdeclare readonly content: symbol\n\n\tconstructor(original: WeakSet<T>) {\n\t\tObject.defineProperties(this, {\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t\tcontent: { value: Symbol('content') },\n\t\t\t[Symbol.toStringTag]: { value: 'ReactiveWeakSet' },\n\t\t})\n\t}\n\n\tadd(value: T): this {\n\t\tconst had = this[native].has(value)\n\t\tthis[native].add(value)\n\t\tif (!had) {\n\t\t\t// touch the specific value and the collection view\n\t\t\ttouched1(this.content, { type: 'add', prop: value }, value)\n\t\t\t// no size/allProps for WeakSet\n\t\t}\n\t\treturn this\n\t}\n\n\tdelete(value: T): boolean {\n\t\tconst had = this[native].has(value)\n\t\tconst res = this[native].delete(value)\n\t\tif (had) touched1(this.content, { type: 'del', prop: value }, value)\n\t\treturn res\n\t}\n\n\thas(value: T): boolean {\n\t\tdependant(this.content, value)\n\t\treturn this[native].has(value)\n\t}\n}\n\n/**\n * Reactive wrapper around JavaScript's Set class\n * Tracks size changes, individual value operations, and collection-wide operations\n */\nexport class ReactiveSet<T> {\n\tdeclare readonly [native]: Set<T>\n\tdeclare readonly content: symbol\n\tconstructor(original: Set<T>) {\n\t\tObject.defineProperties(this, {\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t\tcontent: { value: Symbol('content') },\n\t\t\t[Symbol.toStringTag]: { value: 'ReactiveSet' },\n\t\t})\n\t}\n\n\tget size(): number {\n\t\t// size depends on the wrapper instance, like Map counterpart\n\t\tdependant(this, 'size')\n\t\treturn this[native].size\n\t}\n\n\tadd(value: T): this {\n\t\tconst had = this[native].has(value)\n\t\tconst reactiveValue = reactive(value)\n\t\tthis[native].add(reactiveValue)\n\t\tif (!had) {\n\t\t\tconst evolution = { type: 'add', prop: reactiveValue } as const\n\t\t\t// touch for value-specific and aggregate dependencies\n\t\t\ttouched1(this.content, evolution, reactiveValue)\n\t\t\ttouched1(this, evolution, 'size')\n\t\t}\n\t\treturn this\n\t}\n\n\tclear(): void {\n\t\tconst hadEntries = this[native].size > 0\n\t\tthis[native].clear()\n\t\tif (hadEntries) {\n\t\t\tconst evolution = { type: 'bunch', method: 'clear' } as const\n\t\t\ttouched1(this, evolution, 'size')\n\t\t\ttouched(this.content, evolution)\n\t\t}\n\t}\n\n\tdelete(value: T): boolean {\n\t\tconst had = this[native].has(value)\n\t\tconst res = this[native].delete(value)\n\t\tif (had) {\n\t\t\tconst evolution = { type: 'del', prop: value } as const\n\t\t\ttouched1(this.content, evolution, value)\n\t\t\ttouched1(this, evolution, 'size')\n\t\t}\n\t\treturn res\n\t}\n\n\thas(value: T): boolean {\n\t\tdependant(this.content, value)\n\t\treturn this[native].has(value)\n\t}\n\n\tentries(): Generator<[T, T]> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveEntriesIterator(this[native].entries())\n\t}\n\n\tforEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void {\n\t\tdependant(this.content)\n\t\tthis[native].forEach(callbackfn, thisArg)\n\t}\n\n\tkeys(): Generator<T> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveIterator(this[native].keys())\n\t}\n\n\tvalues(): Generator<T> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveIterator(this[native].values())\n\t}\n\n\t[Symbol.iterator](): Iterator<T> {\n\t\tdependant(this.content)\n\t\tconst nativeIterator = this[native][Symbol.iterator]()\n\t\treturn {\n\t\t\tnext() {\n\t\t\t\tconst result = nativeIterator.next()\n\t\t\t\tif (result.done) {\n\t\t\t\t\treturn result\n\t\t\t\t}\n\t\t\t\treturn { value: reactive(result.value), done: false }\n\t\t\t},\n\t\t}\n\t}\n}\n","export {\n\tactiveEffect,\n\taddBatchCleanup,\n\tatomic,\n\ttype Evolution,\n\teffect,\n\tgetState,\n\timmutables,\n\tisNonReactive,\n\tisReactive,\n\toptions as reactiveOptions,\n\tprofileInfo,\n\tReactive,\n\tReactiveBase,\n\tReactiveError,\n\treactive,\n\ttype ScopedCallback,\n\ttrackEffect,\n\tuntracked,\n\tunwrap,\n} from './core'\nexport {\n\tcleanedBy,\n\tcomputed,\n\tinvalidateComputed,\n\tunreactive,\n\twatch,\n} from './interface'\n\nimport { registerNativeReactivity } from './core'\nimport { ReactiveArray } from './natives/array'\nimport { ReactiveMap, ReactiveWeakMap } from './natives/map'\nimport { ReactiveSet, ReactiveWeakSet } from './natives/set'\n\n// Register native collection types to use specialized reactive wrappers\nregisterNativeReactivity(WeakMap, ReactiveWeakMap)\nregisterNativeReactivity(Map, ReactiveMap)\nregisterNativeReactivity(WeakSet, ReactiveWeakSet)\nregisterNativeReactivity(Set, ReactiveSet)\nregisterNativeReactivity(Array, ReactiveArray)\n","import { decorator, GenericClassDecorator } from './decorator'\n\n// In order to avoid async re-entrance, we could use zone.js or something like that.\nconst syncCalculating: { object: object; prop: PropertyKey }[] = []\n/**\n * Decorator that caches the result of a getter method and only recomputes when dependencies change\n * Prevents circular dependencies and provides automatic cache invalidation\n */\nexport const cached = decorator({\n\tgetter(original, propertyKey) {\n\t\treturn function (this: any) {\n\t\t\tconst alreadyCalculating = syncCalculating.findIndex(\n\t\t\t\t(c) => c.object === this && c.prop === propertyKey\n\t\t\t)\n\t\t\tif (alreadyCalculating > -1)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Circular dependency detected: ${syncCalculating\n\t\t\t\t\t\t.slice(alreadyCalculating)\n\t\t\t\t\t\t.map((c) => `${c.object.constructor.name}.${String(c.prop)}`)\n\t\t\t\t\t\t.join(' -> ')} -> again`\n\t\t\t\t)\n\t\t\tsyncCalculating.push({ object: this, prop: propertyKey })\n\t\t\ttry {\n\t\t\t\tconst rv = original.call(this)\n\t\t\t\tcache(this, propertyKey, rv)\n\t\t\t\treturn rv\n\t\t\t} finally {\n\t\t\t\tsyncCalculating.pop()\n\t\t\t}\n\t\t}\n\t},\n})\n\n/**\n * Checks if a property is cached (has a cached value)\n * @param object - The object to check\n * @param propertyKey - The property key to check\n * @returns True if the property has a cached value\n */\nexport function isCached(object: Object, propertyKey: PropertyKey) {\n\treturn !!Object.getOwnPropertyDescriptor(object, propertyKey)\n}\n\n/**\n * Caches a value for a property on an object\n * @param object - The object to cache the value on\n * @param propertyKey - The property key to cache\n * @param value - The value to cache\n */\nexport function cache(object: Object, propertyKey: PropertyKey, value: any) {\n\tObject.defineProperty(object, propertyKey, { value })\n}\n\n/**\n * Creates a decorator that modifies property descriptors for specified properties\n * @param descriptor - The descriptor properties to apply\n * @returns A class decorator that applies the descriptor to specified properties\n */\nexport function describe(descriptor: {\n\tenumerable?: boolean\n\tconfigurable?: boolean // Not modifiable once the property has been defined ?\n\twritable?: boolean\n}) {\n\treturn <T>(...properties: (keyof T)[]): GenericClassDecorator<T> =>\n\t\t(Base) => {\n\t\t\treturn class extends Base {\n\t\t\t\tconstructor(...args: any[]) {\n\t\t\t\t\tsuper(...args)\n\t\t\t\t\tfor (const key of properties) {\n\t\t\t\t\t\tObject.defineProperty(this, key, {\n\t\t\t\t\t\t\t...Object.getOwnPropertyDescriptor(this, key),\n\t\t\t\t\t\t\t...descriptor,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n}\n\n/**\n * Decorator that marks methods, properties, or classes as deprecated\n * Provides warning messages when deprecated items are used\n */\nexport const deprecated = Object.assign(\n\tdecorator({\n\t\tmethod(original, propertyKey) {\n\t\t\treturn function (this: any, ...args: any[]) {\n\t\t\t\tdeprecated.warn(this, propertyKey)\n\t\t\t\treturn original.apply(this, args)\n\t\t\t}\n\t\t},\n\t\tgetter(original, propertyKey) {\n\t\t\treturn function (this: any) {\n\t\t\t\tdeprecated.warn(this, propertyKey)\n\t\t\t\treturn original.call(this)\n\t\t\t}\n\t\t},\n\t\tsetter(original, propertyKey) {\n\t\t\treturn function (this: any, value: any) {\n\t\t\t\tdeprecated.warn(this, propertyKey)\n\t\t\t\treturn original.call(this, value)\n\t\t\t}\n\t\t},\n\t\tclass(original) {\n\t\t\treturn class extends original {\n\t\t\t\tconstructor(...args: any[]) {\n\t\t\t\t\tsuper(...args)\n\t\t\t\t\tdeprecated.warn(this, 'constructor')\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tdefault(message: string) {\n\t\t\treturn decorator({\n\t\t\t\tmethod(original, propertyKey) {\n\t\t\t\t\treturn function (this: any, ...args: any[]) {\n\t\t\t\t\t\tdeprecated.warn(this, propertyKey, message)\n\t\t\t\t\t\treturn original.apply(this, args)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tgetter(original, propertyKey) {\n\t\t\t\t\treturn function (this: any) {\n\t\t\t\t\t\tdeprecated.warn(this, propertyKey, message)\n\t\t\t\t\t\treturn original.call(this)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tsetter(original, propertyKey) {\n\t\t\t\t\treturn function (this: any, value: any) {\n\t\t\t\t\t\tdeprecated.warn(this, propertyKey, message)\n\t\t\t\t\t\treturn original.call(this, value)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tclass(original) {\n\t\t\t\t\treturn class extends original {\n\t\t\t\t\t\tconstructor(...args: any[]) {\n\t\t\t\t\t\t\tsuper(...args)\n\t\t\t\t\t\t\tdeprecated.warn(this, 'constructor', message)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\t}),\n\t{\n\t\twarn: (target: any, propertyKey: PropertyKey, message?: string) => {\n\t\t\t// biome-ignore lint/suspicious/noConsole: To be overridden\n\t\t\tconsole.warn(\n\t\t\t\t`${target.constructor.name}.${String(propertyKey)} is deprecated${message ? `: ${message}` : ''}`\n\t\t\t)\n\t\t},\n\t}\n)\n\n/**\n * Creates a debounced method decorator that delays execution until after the delay period has passed\n * @param delay - The delay in milliseconds\n * @returns A method decorator that debounces method calls\n */\nexport function debounce(delay: number) {\n\treturn decorator({\n\t\tmethod(original, _propertyKey) {\n\t\t\tlet timeoutId: ReturnType<typeof setTimeout> | null = null\n\n\t\t\treturn function (this: any, ...args: any[]) {\n\t\t\t\t// Clear existing timeout\n\t\t\t\tif (timeoutId) {\n\t\t\t\t\tclearTimeout(timeoutId)\n\t\t\t\t}\n\n\t\t\t\t// Set new timeout\n\t\t\t\ttimeoutId = setTimeout(() => {\n\t\t\t\t\toriginal.apply(this, args)\n\t\t\t\t\ttimeoutId = null\n\t\t\t\t}, delay)\n\t\t\t}\n\t\t},\n\t})\n}\n\n/**\n * Creates a throttled method decorator that limits execution to once per delay period\n * @param delay - The delay in milliseconds\n * @returns A method decorator that throttles method calls\n */\nexport function throttle(delay: number) {\n\treturn decorator({\n\t\tmethod(original, _propertyKey) {\n\t\t\tlet lastCallTime = 0\n\t\t\tlet timeoutId: ReturnType<typeof setTimeout> | null = null\n\n\t\t\treturn function (this: any, ...args: any[]) {\n\t\t\t\tconst now = Date.now()\n\n\t\t\t\t// If enough time has passed since last call, execute immediately\n\t\t\t\tif (now - lastCallTime >= delay) {\n\t\t\t\t\t// Clear any pending timeout since we're executing now\n\t\t\t\t\tif (timeoutId) {\n\t\t\t\t\t\tclearTimeout(timeoutId)\n\t\t\t\t\t\ttimeoutId = null\n\t\t\t\t\t}\n\t\t\t\t\tlastCallTime = now\n\t\t\t\t\treturn original.apply(this, args)\n\t\t\t\t}\n\n\t\t\t\t// Otherwise, schedule execution for when the delay period ends\n\t\t\t\tif (!timeoutId) {\n\t\t\t\t\tconst remainingTime = delay - (now - lastCallTime)\n\t\t\t\t\tconst scheduledArgs = [...args] // Capture args at scheduling time\n\t\t\t\t\ttimeoutId = setTimeout(() => {\n\t\t\t\t\t\tlastCallTime = Date.now()\n\t\t\t\t\t\toriginal.apply(this, scheduledArgs)\n\t\t\t\t\t\ttimeoutId = null\n\t\t\t\t\t}, remainingTime)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t})\n}\n","/**\n * Base type for event maps - all event handlers must be functions\n */\nexport type EventsBase = Record<string, (...args: any[]) => void>\n/**\n * A type-safe event system that provides a clean API for event handling\n * @template Events - The event map defining event names and their handler signatures\n */\nexport class Eventful<Events extends EventsBase> {\n\treadonly #events = new Map<keyof Events, ((...args: any[]) => void)[]>()\n\treadonly #hooks = [] as ((...args: any[]) => void)[]\n\n\tpublic hook(\n\t\tcb: <EventType extends keyof Events>(\n\t\t\tevent: EventType,\n\t\t\t...args: Parameters<Events[EventType]>\n\t\t) => void\n\t): () => void {\n\t\tif (!this.#hooks.includes(cb)) this.#hooks.push(cb)\n\t\treturn () => {\n\t\t\tthis.#hooks.splice(this.#hooks.indexOf(cb), 1)\n\t\t}\n\t}\n\n\tpublic on(events: Partial<Events>): void\n\tpublic on<EventType extends keyof Events>(event: EventType, cb: Events[EventType]): () => void\n\tpublic on<EventType extends keyof Events>(\n\t\teventOrEvents: EventType | Partial<Events>,\n\t\tcb?: Events[EventType]\n\t): () => void {\n\t\tif (typeof eventOrEvents === 'object') {\n\t\t\tfor (const e of Object.keys(eventOrEvents) as (keyof Events)[]) {\n\t\t\t\tthis.on(e, eventOrEvents[e]!)\n\t\t\t}\n\t\t} else if (cb !== undefined) {\n\t\t\tlet callbacks = this.#events.get(eventOrEvents)\n\t\t\tif (!callbacks) {\n\t\t\t\tcallbacks = []\n\t\t\t\tthis.#events.set(eventOrEvents, callbacks)\n\t\t\t}\n\t\t\tcallbacks.push(cb)\n\t\t}\n\t\t// @ts-expect-error Generic case leads to generic case\n\t\treturn () => this.off(eventOrEvents, cb)\n\t}\n\tpublic off(events: Partial<Events>): void\n\tpublic off<EventType extends keyof Events>(event: EventType, cb?: Events[EventType]): void\n\tpublic off<EventType extends keyof Events>(\n\t\teventOrEvents: EventType | Partial<Events>,\n\t\tcb?: Events[EventType]\n\t): void {\n\t\tif (typeof eventOrEvents === 'object') {\n\t\t\tfor (const e of Object.keys(eventOrEvents) as (keyof Events)[]) {\n\t\t\t\tthis.off(e, eventOrEvents[e])\n\t\t\t}\n\t\t} else if (cb !== null && cb !== undefined) {\n\t\t\tconst callbacks = this.#events.get(eventOrEvents)\n\t\t\tif (callbacks) {\n\t\t\t\tthis.#events.set(\n\t\t\t\t\teventOrEvents,\n\t\t\t\t\tcallbacks.filter((c) => c !== cb)\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\t// Remove all listeners for this event\n\t\t\tthis.#events.delete(eventOrEvents)\n\t\t}\n\t}\n\tpublic emit<EventType extends keyof Events>(\n\t\tevent: EventType,\n\t\t...args: Parameters<Events[EventType]>\n\t) {\n\t\tconst callbacks = this.#events.get(event)\n\t\tif (callbacks) for (const cb of callbacks) cb.apply(this, args)\n\t\tfor (const cb of this.#hooks) cb.call(this, event, ...args)\n\t}\n}\n"],"names":["nativeConstructors","Set","Object","Array","Date","Function","Map","WeakMap","WeakSet","Promise","Error","TypeError","ReferenceError","SyntaxError","RangeError","URIError","EvalError","Reflect","Proxy","RegExp","String","Number","Boolean","isConstructor","fn","has","toString","startsWith","renamed","fct","name","defineProperties","value","ReflectGet","obj","prop","receiver","Node","get","ReflectSet","set","isOwnAccessor","opd","getOwnPropertyDescriptor","isObject","DecoratorError","constructor","message","super","this","legacyDecorator","description","target","propertyKey","descriptor","args","undefined","class","includes","newGetter","getter","newSetter","setter","newMethod","method","default","call","modernDecorator","context","kind","rv","decorator","modern","legacy","contextOrKey","mode","_target","detectDecoratorMode","fr","FinalizationRegistry","f","destructor","Symbol","allocatedValues","DestructionError","msg","destroyedHandler","toStringTag","throw","allocated","original","getAt","setAt","Indexable","base","accessor","index","setPrototypeOf","prototype","getLength","numProp","isNaN","setLength","defineProperty","writable","enumerable","configurable","mixin","mixinFunction","unwrapFunction","mixinCache","MixedBase","apply","_thisArg","length","baseClass","cached","usedBase","ProxiedBaseClass","originalPrototype","proxiedPrototype","mixedClass","effectToReactiveObjects","objectToProxy","proxyToObject","objectParents","objectsWithDeepWatchers","deepWatchers","effectToDeepWatchedObjects","nonReactiveObjects","absent","makeReactiveIterator","iterator","result","next","done","reactive","makeReactiveEntriesIterator","key","watchers","profileInfo","nativeReactive","nonReactiveMark","unreactiveProperties","prototypeForwarding","allProps","rootFunction","markWithRoot","root","getRoot","ReactiveError","options","enter","effect","leave","chain","targets","caller","beginChain","endChain","touched","evolution","props","deps","maxEffectChain","maxEffectReaction","maxDeepWatchDepth","instanceMembers","ignoreAccessors","warn","effectTrackers","collectEffects","effects","objectWatchers","keyChains","keys","from","add","trackers","tracker","delete","touched1","unwrap","state","getState","assign","states","addState","batch","bubbleUpChange","dependant","activeEffect","effectObjects","parentEffect","batchedEffects","batchCleanups","addBatchCleanup","cleanup","immediate","isArray","roots","map","i","runEffects","firstReturn","size","entries","push","cleanups","clear","atomic","withEffect","keepParent","oldActiveEffect","oldParentEffect","addBackReference","child","parent","parents","removeBackReference","needsBackReferences","hasParentWithDeepWatchers","changedObject","parentDeepWatchers","watcher","reactiveHandlers","hasOwn","getPrototypeOf","reactiveValue","isArrayCase","newValue","oldVal","track1","type","deleteProperty","proto","ownKeys","reactiveClasses","ReactiveBase","Reactive","ReactiveMixin","__isReactiveMixin","reactiveObject","anyTarget","isNonReactive","proxied","proxy","current","untracked","effectChildren","parentForAscend","tracked","cb","runEffect","ascend","effectStopped","init","reactionCleanup","reactiveObj","children","childCleanup","stopEffect","unregister","callIfCollected","register","subEffectCleanup","immutables","some","nonReactiveClass","cls","c","registerNativeReactivity","originalClass","reactiveClass","deepWatch","callback","wrappedCallback","visited","traverseAndTrack","depth","_key","computedInvalidations","window","o","nonReactive","document","computedCache","computedFunction","invalidations","stopped","once","access","oldCI","computed","computers","computedMap","memo","inputs","compute","Memoized","cleanedBy","inputArray","reduceKeys","reduceInputs","input","self","unsetYet","deepNonReactive","unreactive","arg1","arg","resize","resultLength","toCleanup","splice","cache","keepCleanups","inEffect","values","__esDecorate","_classDescriptor","_classThis","_classDecorators","metadata","_metadata","_classExtraInitializers","__runInitializers","native","ReactiveBaseArray","range","a","b","start","Math","min","end","max","ReactiveArray","added","oldLength","native$2","at","actualIndex","items","pop","shift","unshift","deleteCount","reverse","sort","compareFn","localeCompare","fill","copyWithin","toReversed","toSorted","toSpliced","with","nativeIterator","indexOf","searchElement","fromIndex","lastIndexOf","find","predicate","thisArg","findIndex","flat","flatMap","callbackfn","filter","item","array","reduce","initialValue","reduceRight","slice","concat","join","separator","forEach","every","ReactiveMap","native$1","content","hadEntries","hadKey","oldValue","ReactiveSet","had","res","syncCalculating","alreadyCalculating","object","deprecated","destructorObj","_a","destroy","destructors","getOwnPropertyNames","isDestroyable","myDestructor","destruction","_Eventful_events","_Eventful_hooks","hook","__classPrivateFieldGet","on","eventOrEvents","e","callbacks","off","emit","event","called","forward","delay","_propertyKey","timeoutId","clearTimeout","setTimeout","properties","Base","lastCallTime","now","remainingTime","scheduledArgs","onTouch","changed","deep","myParentEffect","deepCleanup","cbCleanup","watchCallBack","watchObject","minLength","arr","tuple"],"mappings":"4OAsBA,MAAMA,EAAqB,IAAIC,IAAc,CAC5CC,OACAC,MACAC,KACAC,SACAJ,IACAK,IACAC,QACAC,QACAC,QACAC,MACAC,UACAC,eACAC,YACAC,WACAC,SACAC,UACAC,QACAC,MACAC,OACAC,OACAC,OACAC,UAOK,SAAUC,EAAcC,GAC7B,OACCA,GACc,mBAAPA,IACNxB,EAAmByB,IAAID,IAAOA,EAAGE,aAAaC,WAAW,UAE5D,CAQM,SAAUC,EAA4BC,EAAQC,GACnD,OAAO5B,OAAO6B,iBAAiBF,EAAK,CACnCC,KAAM,CACLE,MAAOF,IAGV,UAEgBG,EAAWC,EAAUC,EAAWC,GAE/C,MAAoB,oBAATC,MAAwBH,aAAeG,KAAaH,EAAIC,GAC5DlB,QAAQqB,IAAIJ,EAAKC,EAAMC,EAC/B,CAEM,SAAUG,E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