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/a-concept\";\nimport { A_Frame } from \"@adaas/a-frame/core\";\nimport { A_ExecutionContext } from \"@adaas/a-utils/a-execution\";\nimport { A_Logger } from \"@adaas/a-utils/a-logger\";\nimport type { AreNode } from \"@adaas/are/node/AreNode.entity\";\nimport type { Are } from \"@adaas/are/component/Are.component\";\nimport type { AreMeta } from \"@adaas/are/component/Are.meta\";\nimport { AreStoreAreComponentMetaKeys } from \"./AreStore.constants\";\nimport { AreStorePathValue, AreStoreWatchingEntity } from \"./AreStore.types\";\nimport { AreContext } from \"@adaas/are/component/Are.context\";\nimport { A_UtilsHelper } from \"@adaas/a-utils/helpers\";\n\n\n\n\n@A_Frame.Define({\n    namespace: 'A-ARE',\n    description: 'Runtime data store scoped to an AreNode. Holds interpolation values, dynamic data bindings, and any per-node state that components need to read or write during rendering. Can be injected into directives, attributes, and lifecycle handlers to share mutable data across the render pipeline without exposing it globally.',\n})\nexport class AreStore<\n    T extends Record<string, any> = Record<string, any>\n> extends A_ExecutionContext<T> {\n\n    protected dependencies: Map<string, Set<AreStoreWatchingEntity>> = new Map();\n\n    /**\n     * Reverse index of `dependencies`: for every watcher, the set of\n     * normalized paths it is currently registered against on THIS store.\n     * Maintained alongside `dependencies` so a watcher's stale subscriptions\n     * can be pruned in O(deps) when it re-evaluates (see {@link pruneWatcher}).\n     */\n    protected watcherPaths: Map<AreStoreWatchingEntity, Set<string>> = new Map();\n\n    protected _keys: Set<keyof T> = new Set();\n\n    /**\n     * Re-entrant batch depth. While > 0, `dispatch()` accumulates affected\n     * watchers into `_pendingNotify` instead of notifying synchronously; the\n     * outermost `batch()` flushes them exactly once.\n     */\n    private _batchDepth = 0;\n\n    private _pendingNotify: Set<AreStoreWatchingEntity> = new Set();\n\n\n\n    /**\n     * Allows to define a pure function that will be executed in the context of the store, so it can access the store's data and methods, but it won't have access to the component's scope or other features. This can be useful for example for defining a function that will update the store's data based on some logic, without having access to the component's scope or other features, so we can keep the store's logic separate from the component's logic.\n     */\n    static get Function() {\n        return <T extends Are>(target: T, propertyKey: string, descriptor: PropertyDescriptor) => {\n            // TODO: fix types\n            const targetMeta = A_Context.meta<AreMeta<A_TYPES__ComponentMeta>, T>(target.constructor as any) as any;\n\n            const originalMethod = descriptor.value;\n\n            const allExtensions = targetMeta.get(AreStoreAreComponentMetaKeys.StoreExtensions) || {};\n\n            allExtensions[propertyKey] = originalMethod;\n\n            targetMeta.set(AreStoreAreComponentMetaKeys.StoreExtensions, allExtensions);\n\n            return descriptor;\n        }\n    }\n\n    get owner(): AreNode {\n        return A_Context.scope(this).issuer() as AreNode;\n    }\n\n    get parent(): AreStore | undefined {\n        return this.owner.parent?.scope.resolve<AreStore>(AreStore);\n    }\n\n    get context(): AreContext {\n        return A_Context.scope(this).resolve(AreContext) as AreContext;\n    }\n\n    constructor(aseid: ASEID | string) {\n        super(aseid.toString());\n    }\n\n    get watchers(): Set<AreStoreWatchingEntity> {\n        return this.context.get('watchers') || new Set();\n    }\n\n    get keys(): Set<keyof T> {\n        return this._keys;\n    }\n\n\n    watch(instruction: AreStoreWatchingEntity, reevaluate: boolean = false): void {\n        // A re-evaluating watcher (an Update window) begins a fresh tracking\n        // pass: drop its previously recorded dependencies (this store +\n        // ancestors) so paths it no longer reads stop notifying it (#5).\n        //\n        // Initial application is NOT a re-evaluation. A watcher may read the\n        // store across MULTIPLE apply windows (e.g. the `$for` directive reads\n        // its source array in the Transform phase but not in the Compile\n        // phase). Pruning on every watch window would let a later phase wipe\n        // the subscription an earlier phase established, leaving the watcher\n        // permanently unsubscribed. So only prune when explicitly told this is\n        // a re-evaluation.\n        if (reevaluate) {\n            this.pruneWatcher(instruction);\n        }\n\n        const watchers: Set<AreStoreWatchingEntity> = this.context.get('watchers') || new Set();\n        watchers.add(instruction);\n        this.context.set('watchers', watchers);\n    }\n\n    unwatch(instruction: AreStoreWatchingEntity): void {\n        const watchers: Set<AreStoreWatchingEntity> = this.context.get('watchers') || new Set();\n        watchers.delete(instruction);\n        this.context.set('watchers', watchers);\n    }\n\n\n    /**\n     * Remove a key (or nested path) from the store and notify every watcher\n     * registered against that path — same ancestor/descendant matching rules\n     * as {@link set}. Falls through to `A_ExecutionContext.drop()` for the\n     * underlying meta cleanup so dependent renders re-evaluate against the\n     * now-missing value.\n     */\n    drop<P extends A_TYPES__Paths<T>>(key: P | keyof T): void {\n        const [firstPart, ...pathPart] = String(key).split('.');\n\n        if (pathPart.length === 0) {\n            this._keys.delete(firstPart as keyof T);\n            super.drop(firstPart as keyof T);\n        } else {\n            // Nested drop — clear the leaf inside the existing object so\n            // subscribers reading the parent see the updated shape.\n            const primaryObject = super.get(firstPart);\n            if (primaryObject && typeof primaryObject === 'object') {\n                const result = A_UtilsHelper.setBypath(primaryObject, pathPart.join('.'), undefined);\n                super.set(firstPart as keyof T, result ? result[firstPart] : primaryObject);\n            }\n        }\n\n        this.dispatch(this.collectAffected(String(key)));\n    }\n\n    set<K extends keyof T>(values: Partial<T>): this\n    set<P extends A_TYPES__Paths<T>>(key: P, value: AreStorePathValue<T, P>): this\n    set<K extends keyof T, P extends A_TYPES__Paths<T>>(\n        param1: K | Partial<T> | P,\n        param2?: T[K] | AreStorePathValue<T, P>\n    ): this {\n        if (typeof param1 === 'string' && param2 !== undefined) {\n            this.setAsKeyValue(param1 as P, param2 as AreStorePathValue<T, P>);\n        } else if (typeof param1 === 'object') {\n            this.setAsObject(param1 as Partial<T>);\n        } else {\n            throw new Error('Invalid parameters for set method. Expected either (key: string, value: any) or (values: object).');\n        }\n\n\n        return this;\n    }\n\n\n    get<K extends keyof T>(key: K): T[K] | undefined {\n        const [firstPart, ...pathPart] = String(key).split('.');\n\n        if (!this._keys.has(firstPart as keyof T)) {\n            return this.parent?.get(key as any);\n        }\n\n        if (this.watchers.size > 0) {\n            const ancestors = this.extractPathSegments(String(key))\n\n            for (const ancestor of ancestors) {\n                // normalize once at registration — not at lookup\n                const normAncestor = this.normalizePath(ancestor)\n\n                if (!this.dependencies.has(normAncestor)) {\n                    this.dependencies.set(normAncestor, new Set())\n                }\n\n\n                this.watchers.forEach(watcher => {\n                    this.dependencies.get(normAncestor)!.add(watcher)\n                    // keep the reverse index in sync so this subscription can\n                    // later be pruned when the watcher re-evaluates (#5)\n                    let paths = this.watcherPaths.get(watcher)\n                    if (!paths) {\n                        paths = new Set()\n                        this.watcherPaths.set(watcher, paths)\n                    }\n                    paths.add(normAncestor)\n                })\n            }\n        }\n\n        const primaryObject = super.get(firstPart);\n\n        const value = A_UtilsHelper.getByPath(primaryObject, pathPart.join('.'));\n\n        return value as T[K] | undefined;\n    }\n\n\n    protected setAsObject(values: Partial<T>): this {\n        const entires = Object.entries(values);\n\n        // Collect the union of affected watchers across ALL keys, then notify\n        // once. A multi-key object set is a single logical change, so a watcher\n        // reading several of those keys must re-render only once (#3, #4).\n        const affected = new Set<AreStoreWatchingEntity>();\n\n        for (const [key, value] of entires) {\n            this._keys.add(key as keyof T);\n            super.set(key as keyof T, value as T[keyof T]);\n\n            for (const watcher of this.collectAffected(String(key))) {\n                affected.add(watcher);\n            }\n        }\n\n        this.dispatch(affected);\n        return this;\n    }\n\n    protected setAsKeyValue<K extends keyof T, P extends A_TYPES__Paths<T>>(\n        key: K | P,\n        value: T[K] | AreStorePathValue<T, P>\n    ): this {\n        const [firstPart, ...pathPart] = String(key).split('.');\n\n        this._keys.add(firstPart as keyof T);\n\n        const primaryObject = super.get(firstPart);\n\n        const result = A_UtilsHelper.setBypath(primaryObject, pathPart.join('.'), value);\n\n        super.set(firstPart as keyof T, result ? result[firstPart] : value);\n\n        this.dispatch(this.collectAffected(String(key)));\n\n        return this;\n    }\n\n\n    /**\n     * Force a re-notification of every registered watcher, bypassing the\n     * usual key/path dependency tracking. Useful when external state\n     * (entities, lists, services) has mutated in place and the store\n     * has no way to detect the change through `set()`.\n     *\n     * If `key` is provided, only watchers registered against that key\n     * (or any of its ancestor/descendant paths — same rules as `set()`)\n     * are notified.\n     */\n    forceUpdate<P extends A_TYPES__Paths<T>>(key?: P | keyof T | string): this {\n        if (key === undefined) {\n            const all = new Set<AreStoreWatchingEntity>();\n            for (const instructions of this.dependencies.values()) {\n                for (const watcher of instructions) all.add(watcher);\n            }\n            this.dispatch(all);\n            return this;\n        }\n\n        this.dispatch(this.collectAffected(String(key)));\n\n        return this;\n    }\n\n    /**\n     * Runs `fn` with notifications deferred: every watcher affected by writes\n     * performed inside `fn` is collected and notified exactly once when the\n     * outermost batch completes. Nested `batch()` calls are coalesced into the\n     * outermost flush. Use this to wrap a burst of `set()`/`drop()` calls that\n     * logically belong together so each dependent renders only once (#4).\n     */\n    batch(fn: () => void): this {\n        this._batchDepth++;\n        try {\n            fn();\n        } finally {\n            this._batchDepth--;\n            if (this._batchDepth === 0 && this._pendingNotify.size > 0) {\n                const pending = this._pendingNotify;\n                this._pendingNotify = new Set();\n                this.notify(pending);\n            }\n        }\n        return this;\n    }\n\n    /**\n     * Builds the deduplicated set of watchers affected by a change to\n     * `changedKey`, using the same exact/descendant/ancestor path matching as\n     * `set()`. Returning a single union Set guarantees each watcher appears at\n     * most once regardless of how many of its registered paths matched (#3).\n     */\n    protected collectAffected(changedKey: string): Set<AreStoreWatchingEntity> {\n        const normChanged = this.normalizePath(String(changedKey));\n        const prefix = normChanged + '.';\n        const affected = new Set<AreStoreWatchingEntity>();\n\n        for (const [normRegistered, instructions] of this.dependencies) {\n            if (\n                normRegistered === normChanged ||             // exact\n                normRegistered.startsWith(prefix) ||          // descendant\n                normChanged.startsWith(normRegistered + '.')  // ancestor\n            ) {\n                for (const instruction of instructions) affected.add(instruction);\n            }\n        }\n\n        return affected;\n    }\n\n    /**\n     * Notifies the given watchers now, or defers them to the batch flush when a\n     * `batch()` is active. The incoming set is already deduplicated by\n     * {@link collectAffected}.\n     */\n    protected dispatch(affected: Set<AreStoreWatchingEntity>): void {\n        if (affected.size === 0) return;\n\n        if (this._batchDepth > 0) {\n            for (const watcher of affected) this._pendingNotify.add(watcher);\n            return;\n        }\n\n        this.notify(affected);\n    }\n\n    /**\n     * Removes a watcher from every dependency set it holds on THIS store (and,\n     * best-effort, on ancestor stores reached via parent delegation in\n     * `get()`), clearing the matching reverse-index entries. Called at the\n     * start of each tracking window so a re-evaluating watcher does not keep\n     * stale subscriptions (#5).\n     */\n    protected pruneWatcher(instruction: AreStoreWatchingEntity): void {\n        const paths = this.watcherPaths.get(instruction);\n        if (paths) {\n            for (const path of paths) {\n                const set = this.dependencies.get(path);\n                if (set) {\n                    set.delete(instruction);\n                    if (set.size === 0) this.dependencies.delete(path);\n                }\n            }\n            this.watcherPaths.delete(instruction);\n        }\n\n        // Reads can be delegated to a parent store; prune there too. Guarded\n        // because `parent` requires a live node owner, absent in isolated use.\n        try {\n            this.parent?.pruneWatcher(instruction);\n        } catch {\n            // no node owner / standalone store — nothing to prune upstream\n        }\n    }\n\n    /**\n     * Notifies instructions — immediately or deferred if inside a batch.\n     *\n     * A failing watcher is isolated so one bad `update()` cannot abort the rest\n     * of the flush, but the error is surfaced (no longer swallowed silently) so\n     * render-time failures are diagnosable. Logger resolution is best-effort and\n     * confined to this cold error path.\n     */\n    private notify(instructions: Set<AreStoreWatchingEntity>): void {\n        for (const instruction of instructions) {\n\n            try {\n                instruction.update()\n            } catch (error) {\n                try {\n                    const logger = A_Context.scope(this).resolve(A_Logger);\n                    logger?.error(error as Error);\n                } catch {\n                    // No logger available in this scope — fall back to console so\n                    // the failure is still observable rather than discarded.\n                    console.error('[AreStore] watcher update failed:', error);\n                }\n            }\n            // instruction.owner.scene.unApply(instruction);\n        }\n    }\n    /**\n     * Removes an instruction from all dependency sets on this store, clearing\n     * its reverse-index entry and any pending batched notification. Called when\n     * an instruction is reverted/destroyed so a torn-down node's watcher can\n     * never be re-notified by a later `set()` (#1).\n     */\n    unregister(instruction: AreStoreWatchingEntity): void {\n        for (const [path, instructions] of this.dependencies) {\n            instructions.delete(instruction);\n            if (instructions.size === 0) this.dependencies.delete(path);\n        }\n        this.watcherPaths.delete(instruction);\n        this._pendingNotify.delete(instruction);\n    }\n    /**\n     * Normalizes a path once — reused in both get and set.\n     */\n    private normalizePath(path: string): string {\n        return path.replace(/\\[(\\d+)\\]/g, '.$1')\n    }\n\n    /**\n     * Extracts direct children of the current markup level into typed instances.\n     * No tree walking, recursion, or nested parsing — just direct children.\n     */\n    extractPathSegments(path: string): string[] {\n        const normalized = path.replace(/\\[(\\d+)\\]/g, '.$1')\n        const parts = normalized.split('.').filter(Boolean)\n        const ancestors: string[] = []\n        let current = ''\n\n        for (let i = 0; i < parts.length; i++) {\n            const part = parts[i]\n            const isIndex = /^\\d+$/.test(part)\n\n            if (i === 0) {\n                current = part\n            } else if (isIndex) {\n                current = `${current}[${part}]`\n            } else {\n                current = `${current}.${part}`\n            }\n\n            ancestors.push(current)\n        }\n\n        return ancestors\n    }\n\n    /**\n     * Method allows to initialize all extensions defined in the component with @AreStore.Function decorator, so we can use them in the store's context. This method should be called in the component's constructor after super() call, so the store will have access to the component's instance and its properties.\n     * \n     * @param component \n     */\n    loadExtensions(component: Are) {\n        const targetMeta = A_Context.meta<AreMeta<A_TYPES__ComponentMeta>, Are>(component as any) as any;\n\n        const allExtensions = targetMeta.get(AreStoreAreComponentMetaKeys.StoreExtensions) || {};\n\n        this.set(allExtensions);\n    }\n\n}\n"]}