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CAAArN,EAAAsN,GACA,MAAAxO,EAAA,GASA,SARAH,QAAAc,IAAA3B,KAAAqP,aAAAxN,IAAAL,MAAAiO,IACA,UACAA,EAAAvN,EAAAsN,EACA,CACA,MAAAtM,GACAlC,EAAAf,KAAAiD,EACA,KAEAlC,EAAAE,OAAA,EACA,UAAAC,eAAAH,EAAA,sDAEA,CACA,iBAAA0O,CAAAxN,SACcU,EAA0BV,EACxC","sources":["webpack://wraplet/webpack/bootstrap","webpack://wraplet/webpack/runtime/define property getters","webpack://wraplet/webpack/runtime/hasOwnProperty shorthand","webpack://wraplet/webpack/runtime/make namespace object","webpack://wraplet/./src/errors.ts","webpack://wraplet/./src/utils/is.ts","webpack://wraplet/./src/Wraplet/types/WrapletApi.ts","webpack://wraplet/./src/Wraplet/types/Wraplet.ts","webpack://wraplet/./src/Wraplet/types/WrapletDependencyMap.ts","webpack://wraplet/./src/Set/types/WrapletSet.ts","webpack://wraplet/./src/Set/DefaultSearchableSet.ts","webpack://wraplet/./src/Set/types/WrapletSetReadonly.ts","webpack://wraplet/./src/Set/DefaultWrapletSet.ts","webpack://wraplet/./src/utils/utils.ts","webpack://wraplet/./src/NodeTreeManager/utils.ts","webpack://wraplet/./src/DependencyManager/types/DependencyManager.ts","webpack://wraplet/./src/Map/utils.ts","webpack://wraplet/./src/Map/MapTreeBuilder.ts","webpack://wraplet/./src/DependencyManager/DDM.ts","webpack://wraplet/./src/Wraplet/NodeManager.ts","webpack://wraplet/./src/Wraplet/createOuterDestroyCallback.ts","webpack://wraplet/./src/Wraplet/createOuterInitializeCallback.ts","webpack://wraplet/./src/Wraplet/createWrapletApi.ts","webpack://wraplet/./src/Wraplet/composeWrapletApi.ts","webpack://wraplet/./src/Wraplet/AbstractWraplet.ts","webpack://wraplet/./src/Wraplet/AbstractDependentWraplet.ts","webpack://wraplet/./src/Set/DefaultWrapletSetReadonly.ts","webpack://wraplet/./src/NodeTreeManager/DNTM.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export class MissingRequiredDependencyError extends Error {\n}\nexport class MapError extends Error {\n}\nexport class RequiredDependencyDestroyedError extends Error {\n}\nexport class DependenciesAreNotAvailableError extends Error {\n}\nexport class TooManyChildrenFoundError extends Error {\n}\nexport class InternalLogicError extends Error {\n}\nexport class UnsupportedNodeTypeError extends Error {\n}\nexport class LifecycleError extends Error {\n}\n","/**\n * Generic guard.\n */\nconst is = (object, symbol) => {\n    return (typeof object === \"object\" &&\n        object !== null &&\n        object[symbol] === true);\n};\nexport { is };\n","import { is } from \"../../utils/is\";\nexport const WrapletApiSymbol = Symbol(\"WrapletApi\");\nexport function isWrapletApi(object) {\n    return is(object, WrapletApiSymbol);\n}\n","import { is } from \"../../utils/is\";\nimport { WrapletApiSymbol } from \"./WrapletApi\";\nexport function isWraplet(value) {\n    return (typeof value === \"object\" &&\n        value !== null &&\n        is(value.wraplet, WrapletApiSymbol));\n}\n","function isSimpleObject(input) {\n    return (typeof input === \"object\" &&\n        input !== null &&\n        Object.getPrototypeOf(input) === Object.prototype);\n}\nfunction isDependencyMapItem(item) {\n    for (const key of Object.keys(item)) {\n        if (![\n            \"selector\",\n            \"Class\",\n            \"multiple\",\n            \"required\",\n            \"destructible\",\n            \"injector\",\n            \"args\",\n        ].includes(key)) {\n            return false;\n        }\n    }\n    if (![\"string\", \"function\", \"undefined\"].includes(typeof item[\"selector\"])) {\n        return false;\n    }\n    if (typeof item[\"Class\"] !== \"function\") {\n        return false;\n    }\n    if (typeof item[\"required\"] !== \"boolean\") {\n        return false;\n    }\n    return typeof item[\"multiple\"] === \"boolean\";\n}\nexport function isWrapletDependencyMap(object) {\n    if (!isSimpleObject(object)) {\n        return false;\n    }\n    for (const key in object) {\n        if (!isSimpleObject(object[key])) {\n            return false;\n        }\n        const item = object[key];\n        if (!isDependencyMapItem(item)) {\n            return false;\n        }\n    }\n    return true;\n}\n","import { is } from \"../../utils/is\";\nconst WrapletSetSymbol = Symbol(\"WrapletSet\");\nexport { WrapletSetSymbol };\nexport function isWrapletSet(object) {\n    return is(object, WrapletSetSymbol);\n}\n","export class DefaultSearchableSet extends Set {\n    find(filter) {\n        const results = [];\n        for (const item of this) {\n            if (!filter(item)) {\n                continue;\n            }\n            results.push(item);\n        }\n        return results;\n    }\n    findOne(filter) {\n        for (const item of this) {\n            if (filter(item)) {\n                return item;\n            }\n        }\n        return null;\n    }\n    getOrdered(callback) {\n        return Array.from(this).sort((a, b) => callback(a) - callback(b));\n    }\n}\n","const WrapletSetReadonlySymbol = Symbol(\"WrapletSetReadonly\");\nexport { WrapletSetReadonlySymbol };\n","import { WrapletSetSymbol } from \"./types/WrapletSet\";\nimport { DefaultSearchableSet } from \"./DefaultSearchableSet\";\nimport { WrapletSetReadonlySymbol, } from \"./types/WrapletSetReadonly\";\nexport class DefaultWrapletSet extends DefaultSearchableSet {\n    [WrapletSetReadonlySymbol] = true;\n    [WrapletSetSymbol] = true;\n}\n","import { isWrapletSet } from \"../Set/types/WrapletSet\";\nexport const RESOLVE = Promise.resolve();\nexport function throwIfErrors(errors, message) {\n    if (errors.length === 0)\n        return;\n    throw new AggregateError(errors, `${message}`);\n}\n/**\n * @deprecated\n *   Will be removed with the next major release.\n */\nexport function flattenDependencies(dependencies) {\n    const wraplets = [];\n    for (const item of Object.values(dependencies)) {\n        if (isWrapletSet(item)) {\n            wraplets.push(...item.values());\n            continue;\n        }\n        if (item) {\n            wraplets.push(item);\n        }\n    }\n    return wraplets;\n}\nexport async function actOnDependencies(deps, callback) {\n    await Promise.all(Object.entries(deps).map(async ([id, dependency]) => {\n        await callback(id, dependency);\n    }));\n}\nexport async function actOnDependenciesWraplets(deps, callback) {\n    await actOnDependencies(deps, async (id, dependency) => {\n        if (!dependency)\n            return;\n        const wraplets = isWrapletSet(dependency)\n            ? Array.from(dependency)\n            : [dependency];\n        await Promise.all(wraplets.map(async (wraplet) => {\n            await callback(id, wraplet);\n        }));\n    });\n}\n","import { DefaultWrapletSet } from \"../Set/DefaultWrapletSet\";\nimport { isWrapletSet } from \"../Set/types/WrapletSet\";\nimport { throwIfErrors } from \"../utils/utils\";\nexport function isParentNode(node) {\n    return (typeof node.querySelectorAll ===\n        \"function\");\n}\nexport function getWrapletsFromNode(node) {\n    const wraplets = node.wraplets;\n    if (isWrapletSet(wraplets)) {\n        return wraplets;\n    }\n    return null;\n}\nexport function removeWrapletFromNode(wraplet, node) {\n    const wraplets = getWrapletsFromNode(node);\n    if (!wraplets) {\n        return false;\n    }\n    return wraplets.delete(wraplet);\n}\nexport function addWrapletToNode(wraplet, node) {\n    if (!node.wraplets) {\n        node.wraplets = new DefaultWrapletSet();\n    }\n    node.wraplets.add(wraplet);\n}\nexport function actOnNodesRecursively(node, callback) {\n    const stack = [node];\n    while (stack.length > 0) {\n        const current = stack.pop();\n        callback(current);\n        const children = current.childNodes;\n        for (let i = children.length - 1; i >= 0; i--) {\n            stack.push(children[i]);\n        }\n    }\n}\nexport async function findWrapletsOutsideTheTree(wraplets, node) {\n    const wrapletsOutsideTree = new DefaultWrapletSet(wraplets);\n    actOnNodesRecursively(node, (node) => {\n        const nodeWraplets = getWrapletsFromNode(node);\n        if (!nodeWraplets) {\n            return;\n        }\n        for (const wraplet of nodeWraplets) {\n            wrapletsOutsideTree.delete(wraplet);\n        }\n    });\n    return Array.from(wrapletsOutsideTree);\n}\nexport async function destroyWrapletsRecursively(node) {\n    const allWraplets = [];\n    actOnNodesRecursively(node, (node) => {\n        const wraplets = getWrapletsFromNode(node);\n        if (!wraplets) {\n            return;\n        }\n        for (const wraplet of [...wraplets]) {\n            if (wraplet.wraplet.status.isGettingDestroyed ||\n                wraplet.wraplet.status.isDestroyed) {\n                continue;\n            }\n            allWraplets.push(wraplet);\n        }\n    });\n    const errors = [];\n    await Promise.all(allWraplets.map(async (wraplet) => {\n        try {\n            await wraplet.wraplet.destroy();\n        }\n        catch (error) {\n            errors.push(error);\n        }\n    }));\n    throwIfErrors(errors, \"Some wraplets threw exceptions during destruction\");\n}\n","import { is } from \"../../utils/is\";\nexport const DependencyManagerSymbol = Symbol(\"DependencyManager\");\nexport function isDependencyManager(object) {\n    return is(object, DependencyManagerSymbol);\n}\n","export function addDefaultsToDependencyDefinition(definition) {\n    return {\n        ...{\n            args: [],\n            destructible: true,\n            injector: {\n                callback: (node) => node,\n            },\n        },\n        ...definition,\n    };\n}\nexport function fillMapWithDefaults(map) {\n    const newMap = {};\n    for (const id of Object.keys(map)) {\n        const def = map[id];\n        newMap[id] = addDefaultsToDependencyDefinition(def);\n    }\n    return newMap;\n}\n","import { fillMapWithDefaults } from \"./utils\";\nconst MapTreeBuilderSymbol = Symbol(\"MapTreeBuilder\");\nexport class MapTreeBuilder {\n    parent;\n    [MapTreeBuilderSymbol] = true;\n    map;\n    children = {};\n    constructor(parent) {\n        this.parent = parent;\n    }\n    getParent() {\n        if (!this.parent) {\n            throw new Error(\"Parent not found.\");\n        }\n        return this.parent;\n    }\n    createChild(name) {\n        const mapBuilder = new MapTreeBuilder(this);\n        this.children[name] = mapBuilder;\n        return mapBuilder;\n    }\n    setMap(map) {\n        this.map = fillMapWithDefaults(map);\n    }\n    getMap() {\n        if (!this.map) {\n            throw new Error(\"Map is not set.\");\n        }\n        return this.map;\n    }\n}\nexport function isMapTreeBuilder(object) {\n    return (typeof object === \"object\" &&\n        object !== null &&\n        MapTreeBuilderSymbol in object);\n}\n","import { DependenciesAreNotAvailableError, TooManyChildrenFoundError, InternalLogicError, MapError, MissingRequiredDependencyError, UnsupportedNodeTypeError, LifecycleError, RequiredDependencyDestroyedError, } from \"../errors\";\nimport { isWraplet } from \"../Wraplet/types/Wraplet\";\nimport { isWrapletDependencyMap, } from \"../Wraplet/types/WrapletDependencyMap\";\nimport { findWrapletsOutsideTheTree, isParentNode, } from \"../NodeTreeManager/utils\";\nimport { DependencyManagerSymbol, } from \"./types/DependencyManager\";\nimport { isWrapletSet } from \"../Set/types/WrapletSet\";\nimport { DefaultWrapletSet } from \"../Set/DefaultWrapletSet\";\nimport { isMapTreeBuilder, MapTreeBuilder } from \"../Map/MapTreeBuilder\";\nimport { actOnDependencies, actOnDependenciesWraplets, RESOLVE, throwIfErrors, } from \"../utils/utils\";\nexport class DDM {\n    node;\n    [DependencyManagerSymbol] = true;\n    dependenciesAreInstantiated = false;\n    initializePromise = null;\n    destroyPromise = null;\n    syncPromise = null;\n    status = {\n        isDestroyed: false,\n        isGettingDestroyed: false,\n        isGettingSynced: false,\n        isInitialized: false,\n        isGettingInitialized: false,\n    };\n    mapTree;\n    directDependencies = {};\n    wrappedDependencies = {};\n    instantiatedDependencyListeners;\n    initializedDependencyListeners;\n    destroyedDependencyListeners;\n    constructor(node, map, options = {}) {\n        this.node = node;\n        if (!(node instanceof Node)) {\n            throw new Error(\"The node provided to the DDM is not a valid node.\");\n        }\n        if (isWrapletDependencyMap(map)) {\n            this.mapTree = new MapTreeBuilder();\n            this.mapTree.setMap(map);\n        }\n        else if (isMapTreeBuilder(map)) {\n            this.mapTree = map;\n        }\n        else {\n            throw new MapError(\"The map provided to the DDM is not a valid map.\");\n        }\n        // Process init options.\n        const optionsWithDefaults = Object.assign(this.defaultOptions(), options);\n        this.instantiatedDependencyListeners =\n            optionsWithDefaults.dependencyInstantiatedListeners;\n        this.initializedDependencyListeners =\n            optionsWithDefaults.dependencyInitializedListeners;\n        this.destroyedDependencyListeners =\n            optionsWithDefaults.dependencyDestroyedListeners;\n    }\n    initializeDependencies() {\n        if (this.status.isInitialized) {\n            return RESOLVE;\n        }\n        if (this.initializePromise) {\n            return this.initializePromise;\n        }\n        this.initializePromise = (async () => {\n            try {\n                this.status.isGettingInitialized = true;\n                await this.initializeDeps();\n                this.status.isInitialized = true;\n            }\n            finally {\n                this.initializePromise = null;\n                this.status.isGettingInitialized = false;\n            }\n        })();\n        return this.initializePromise;\n    }\n    /**\n     * Initialize dependencies.\n     */\n    async initializeDeps() {\n        const errors = [];\n        await actOnDependenciesWraplets(this.directDependencies, async (id, wraplet) => {\n            if (wraplet.wraplet.status.isInitialized ||\n                wraplet.wraplet.status.isGettingInitialized) {\n                return;\n            }\n            try {\n                await wraplet.wraplet.initialize();\n            }\n            catch (error) {\n                errors.push(new AggregateError([error], `Error during initialization of the \"${id}\" dependency.`));\n                return;\n            }\n            const listenersErrors = [];\n            const listeners = this.initializedDependencyListeners.get(id);\n            if (listeners) {\n                for (const fn of listeners) {\n                    try {\n                        await fn(wraplet);\n                    }\n                    catch (error) {\n                        listenersErrors.push(error);\n                    }\n                }\n                if (listenersErrors.length > 0) {\n                    errors.push(new AggregateError(listenersErrors, `At least one listener of the \"${id}\" dependency threw exception`));\n                }\n            }\n        });\n        throwIfErrors(errors, `Errors during the dependencies initialization.`);\n    }\n    syncDependencies() {\n        if (this.syncPromise) {\n            return this.syncPromise;\n        }\n        this.syncPromise = (async () => {\n            try {\n                this.status.isGettingSynced = true;\n                this.instantiateDeps(true);\n                await this.initializeDeps();\n                await this.destroyDeps(true);\n            }\n            finally {\n                this.syncPromise = null;\n                this.status.isGettingSynced = false;\n            }\n        })();\n        return this.syncPromise;\n    }\n    get map() {\n        return this.mapTree.getMap();\n    }\n    instantiateDeps(sync = false) {\n        const dependencies = this.directDependencies;\n        // We check if are dealing with the ParentNode object.\n        if (!isParentNode(this.node)) {\n            for (const id in this.map) {\n                const dependencyDefinition = this.map[id];\n                this.validateMapItemForNonParent(id, dependencyDefinition);\n            }\n            this.dependenciesAreInstantiated = true;\n            return;\n        }\n        for (const id in this.map) {\n            const dependencyDefinition = this.map[id];\n            const multiple = dependencyDefinition.multiple;\n            this.validateMapItem(id, dependencyDefinition);\n            if (multiple) {\n                if (!dependencies[id]) {\n                    dependencies[id] = new DefaultWrapletSet();\n                }\n                const currentDependencies = dependencies[id];\n                // We can assert as much because items\n                const instantiatedDependencies = this.instantiateMultipleDependencies(dependencyDefinition, this.node, id);\n                // Add new items to the current wraplet set.\n                for (const item of instantiatedDependencies) {\n                    currentDependencies.add(item);\n                }\n                continue;\n            }\n            const newDep = this.instantiateSingleWrapletDependency(dependencyDefinition, this.node, id);\n            // This might happen when we are syncing and the dependency hasn't changed.\n            if (newDep === dependencies[id]) {\n                continue;\n            }\n            // If we are syncing, invoke destruction of the old dependency.\n            if (sync && newDep && dependencies[id]) {\n                dependencies[id].wraplet.destroy();\n            }\n            dependencies[id] = newDep;\n        }\n    }\n    instantiateDependencies() {\n        if (this.dependenciesAreInstantiated) {\n            throw new LifecycleError(\"Dependencies are already instantiated.\");\n        }\n        this.wrappedDependencies = this.wrapDependencies(this.directDependencies);\n        this.instantiateDeps();\n        this.dependenciesAreInstantiated = true;\n    }\n    findExistingWraplet(id, childElement) {\n        // If an element doesn't have instantiated wraplets yet, then return null.\n        if (this.directDependencies === undefined || !this.directDependencies[id]) {\n            return null;\n        }\n        const existingDependency = this.directDependencies[id];\n        // Handle multiple.\n        if (this.map[id][\"multiple\"]) {\n            if (!isWrapletSet(existingDependency)) {\n                throw new InternalLogicError(\"Internal logic error. Expected a WrapletSet.\");\n            }\n            const childElementWraplets = childElement.wraplets;\n            if (!childElementWraplets) {\n                return null;\n            }\n            const existingDependencies = existingDependency.find((wraplet) => {\n                return childElementWraplets.has(wraplet);\n            });\n            if (existingDependencies.length > 1) {\n                throw new InternalLogicError(\"Internal logic error. Multiple instances wrapping the same element found in the DDM.\");\n            }\n            return existingDependencies[0];\n        }\n        else {\n            if (!isWraplet(existingDependency)) {\n                throw new InternalLogicError(\"Internal logic error. Expected a Wraplet.\");\n            }\n            if (!childElement.wraplets) {\n                return null;\n            }\n            if (!childElement.wraplets.has(existingDependency)) {\n                return null;\n            }\n        }\n        // Handle single.\n        return existingDependency;\n    }\n    instantiateSingleWrapletDependency(dependencyDefinition, node, id) {\n        if (!dependencyDefinition.selector) {\n            return this.directDependencies[id] || null;\n        }\n        if (!this.dependenciesAreInstantiated && this.directDependencies[id]) {\n            throw new MapError(`It's not possible to provide a single-type dependency manually and use selector at the same time.`);\n        }\n        const selector = dependencyDefinition.selector;\n        // Find children elements based on the map.\n        const childrenElements = this.findChildrenElements(selector, node);\n        this.validateElements(id, childrenElements, dependencyDefinition);\n        if (childrenElements.length === 0) {\n            return null;\n        }\n        if (childrenElements.length > 1) {\n            throw new TooManyChildrenFoundError(`${this.constructor.name}: More than one element was found for the \"${id}\" dependency. Selector used: \"${selector}\".`);\n        }\n        const childElement = childrenElements[0];\n        return this.instantiateWrapletItem(id, dependencyDefinition, childElement);\n    }\n    instantiateWrapletItem(id, dependencyDefinition, node) {\n        // Re-use existing wraplet.\n        const existingWraplet = this.findExistingWraplet(id, node);\n        if (existingWraplet) {\n            return existingWraplet;\n        }\n        let wraplet;\n        try {\n            const instance = new dependencyDefinition.Class(dependencyDefinition.injector.callback(node, this.mapTree.createChild(id), dependencyDefinition.injector.data), ...dependencyDefinition.args);\n            if (!isWraplet(instance)) {\n                throw new Error(\"Created dependency is not a Wraplet instance.\");\n            }\n            wraplet = instance;\n        }\n        catch (e) {\n            if (e instanceof UnsupportedNodeTypeError) {\n                if (!dependencyDefinition.required) {\n                    console.warn(`${e.message} Skipping instantiation of the \"${id}\" dependency.`);\n                    return null;\n                }\n            }\n            throw e;\n        }\n        this.prepareIndividualWraplet(id, wraplet);\n        for (const listener of this.instantiatedDependencyListeners.get(id) || []) {\n            listener(wraplet);\n        }\n        return wraplet;\n    }\n    instantiateMultipleDependencies(dependencyDefinition, node, id) {\n        const selector = dependencyDefinition.selector;\n        if (!selector) {\n            return new DefaultWrapletSet();\n        }\n        // Find children elements based on the map.\n        const childElements = this.findChildrenElements(selector, node);\n        this.validateElements(id, childElements, dependencyDefinition);\n        const items = new DefaultWrapletSet();\n        for (const childElement of childElements) {\n            let wraplet = this.findExistingWraplet(id, childElement);\n            if (!wraplet) {\n                wraplet = this.instantiateWrapletItem(id, dependencyDefinition, childElement);\n            }\n            if (wraplet) {\n                items.add(wraplet);\n            }\n        }\n        return items;\n    }\n    addDependencyInstantiatedListener(id, callback) {\n        const listeners = this.instantiatedDependencyListeners.get(id) || [];\n        listeners.push(callback);\n        this.instantiatedDependencyListeners.set(id, listeners);\n    }\n    addDependencyInitializedListener(id, callback) {\n        const listeners = this.initializedDependencyListeners.get(id) || [];\n        listeners.push(callback);\n        this.initializedDependencyListeners.set(id, listeners);\n    }\n    addDependencyDestroyedListener(id, callback) {\n        const listeners = this.destroyedDependencyListeners.get(id) || [];\n        listeners.push(callback);\n        this.destroyedDependencyListeners.set(id, listeners);\n    }\n    setExistingInstance(id, wraplet) {\n        const map = this.map;\n        if (map[id].multiple) {\n            throw new MapError(`This method can only be used to set a single-value dependency.`);\n        }\n        if (!isWraplet(wraplet)) {\n            throw new MapError(`Provided instance is not a valid dependency.`);\n        }\n        this.prepareIndividualWraplet(id, wraplet);\n        this.directDependencies[id] = wraplet;\n    }\n    addExistingInstance(id, wraplet) {\n        const map = this.map;\n        if (!map[id].multiple) {\n            throw new MapError(`This method can only be used to set a multi-value dependency.`);\n        }\n        this.prepareIndividualWraplet(id, wraplet);\n        const items = this.directDependencies && this.directDependencies[id]\n            ? this.directDependencies[id]\n            : new DefaultWrapletSet();\n        items.add(wraplet);\n        this.directDependencies[id] = items;\n    }\n    prepareIndividualWraplet(id, wraplet) {\n        // Listen for the dependency's destruction.\n        wraplet.wraplet.addDestroyListener(this.createDependencyDestroyListener(id));\n    }\n    createDependencyDestroyListener(id) {\n        return (async (w) => {\n            this.removeDependency(w, id);\n            const errors = [];\n            const listeners = this.destroyedDependencyListeners.get(id);\n            if (listeners && listeners.length > 0) {\n                await Promise.all(listeners.map(async (fn) => {\n                    try {\n                        await fn(w);\n                    }\n                    catch (error) {\n                        errors.push(error);\n                    }\n                }));\n            }\n            // Collect the required-dependency error alongside listener errors\n            // so that everything surfaces through the same error-aggregation pipeline.\n            const requiredError = this.validateRequiredDependencyAfterRemoval(id);\n            if (requiredError) {\n                errors.push(requiredError);\n            }\n            throwIfErrors(errors, `Errors in the destruction callbacks of the \"${id}\" dependency.`);\n        });\n    }\n    /**\n     * Checks whether a required dependency has been removed while the DDM\n     * is NOT being destroyed itself. Returns the error instance instead of\n     * throwing, so the caller can route it through the lifecycle error pipeline.\n     */\n    validateRequiredDependencyAfterRemoval(id) {\n        if (this.map[id].required &&\n            !this.status.isGettingDestroyed &&\n            // Don't allow removing a required dependency only if there is no\n            // replacement in place.\n            this.directDependencies[id] === null) {\n            return new RequiredDependencyDestroyedError(`Required dependency \"${id}\" has been destroyed.`);\n        }\n        return null;\n    }\n    /**\n     * This method removes from nodes references to this wraplet and its dependencies recursively.\n     */\n    destroyDependencies() {\n        if (this.status.isDestroyed) {\n            return RESOLVE;\n        }\n        if (this.destroyPromise) {\n            return this.destroyPromise;\n        }\n        this.destroyPromise = (async () => {\n            try {\n                this.status.isGettingDestroyed = true;\n                if (this.initializePromise) {\n                    // If we are still initializing, then postpone destruction until after\n                    // initialization is finished.\n                    await this.initializePromise;\n                }\n                if (!this.status.isInitialized) {\n                    // If we are not initialized, then we have nothing to do here.\n                    this.status.isDestroyed = true;\n                    this.status.isGettingDestroyed = false;\n                    return;\n                }\n                await this.destroyDeps();\n                this.status.isInitialized = false;\n                this.status.isDestroyed = true;\n            }\n            finally {\n                this.destroyPromise = null;\n                this.status.isGettingDestroyed = false;\n            }\n        })();\n        return this.destroyPromise;\n    }\n    findChildrenElements(selector, node) {\n        const defaultSelectorCallback = (selector, node) => {\n            return Array.from(node.querySelectorAll(selector));\n        };\n        // Find children elements based on the map.\n        return typeof selector === \"string\"\n            ? defaultSelectorCallback(selector, node)\n            : selector(node);\n    }\n    get dependencies() {\n        if (!this.dependenciesAreInstantiated) {\n            throw new DependenciesAreNotAvailableError(\"Wraplet is not yet fully initialized.\");\n        }\n        return this.wrappedDependencies;\n    }\n    removeDependency(wraplet, id) {\n        if (isWrapletSet(this.directDependencies[id])) {\n            this.directDependencies[id].delete(wraplet);\n            return;\n        }\n        // Only nullify the dependency if the current instance is the same one.\n        // If it's not, then we don't care as there is no reference either way.\n        if (this.directDependencies[id] === wraplet) {\n            // @ts-expect-error The type is unknown because we are dealing with a generic here.\n            this.directDependencies[id] = null;\n        }\n    }\n    validateMapItem(id, item) {\n        const selector = item.selector;\n        const isRequired = item.required;\n        if (!selector &&\n            isRequired &&\n            (!this.directDependencies[id] ||\n                (isWrapletSet(this.directDependencies[id]) &&\n                    this.directDependencies[id].size === 0))) {\n            throw new MapError(`${this.constructor.name}: Dependency \"${id}\" cannot at the same be required, have no selector, and be not provided otherwise.`);\n        }\n    }\n    validateMapItemForNonParent(id, item) {\n        if (item.required) {\n            throw new MapError(`Dependency \"${id}\" error: If the node provided cannot have children, there should be no required dependencies.`);\n        }\n    }\n    validateElements(id, elements, mapItem) {\n        if (elements.length === 0 && mapItem.required) {\n            throw new MissingRequiredDependencyError(`${this.constructor.name}: Couldn't find a node for the wraplet \"${id}\". Selector used: \"${mapItem.selector}\".`);\n        }\n    }\n    /**\n     * Set up a proxy to check if dependencies have not been destroyed before fetching them.\n     */\n    wrapDependencies(dependencies) {\n        return new Proxy(dependencies, {\n            get: (target, name) => {\n                if (typeof name === \"symbol\") {\n                    throw new Error(`Symbol access is not supported for dependencies.`);\n                }\n                if (!(name in target)) {\n                    throw new Error(`Dependency '${name}' has not been found.`);\n                }\n                return target[name];\n            },\n            set: () => {\n                throw new Error(`Dependencies cannot be set directly. Use the 'setExistingInstance' or 'addExistingInstance' methods instead.`);\n            },\n        });\n    }\n    defaultOptions() {\n        return {\n            dependencyInstantiatedListeners: new Map(),\n            dependencyInitializedListeners: new Map(),\n            dependencyDestroyedListeners: new Map(),\n        };\n    }\n    async destroyDeps(sync = false) {\n        const errors = [];\n        await actOnDependencies(this.directDependencies, async (id, dependency) => {\n            if (!dependency)\n                return;\n            if (!this.map[id][\"destructible\"]) {\n                return;\n            }\n            let wraplets = isWrapletSet(dependency)\n                ? Array.from(dependency)\n                : [dependency];\n            if (sync) {\n                if (!this.map[id][\"selector\"]) {\n                    return;\n                }\n                wraplets = await findWrapletsOutsideTheTree(wraplets, this.node);\n            }\n            await Promise.all(wraplets.map(async (wraplet) => {\n                if (wraplet.wraplet.status.isDestroyed ||\n                    wraplet.wraplet.status.isGettingDestroyed) {\n                    return;\n                }\n                try {\n                    await wraplet.wraplet.destroy();\n                }\n                catch (error) {\n                    errors.push(new AggregateError([error], `There was an error during destruction of the \"${id}\" dependency.`));\n                }\n            }));\n        });\n        throwIfErrors(errors, `There were errors during the dependencies destruction.`);\n    }\n    /**\n     * Creates a definition for creating a node wrapper.\n     *\n     * @param map_or_position\n     *   You can provide a map or a number representing the\n     *   relative position of the ancestor map that should be\n     *   reused.\n     *\n     *   This is useful for recursive maps.\n     * @param options\n     */\n    static createInjector(map_or_position, options) {\n        return {\n            data: options || {},\n            callback: (node, map, data) => {\n                let currentMap = map;\n                const integerGuard = (input) => Number.isInteger(input);\n                if (integerGuard(map_or_position)) {\n                    for (let i = 0; i < map_or_position; i++) {\n                        currentMap = currentMap.getParent();\n                    }\n                }\n                else if (isWrapletDependencyMap(map_or_position)) {\n                    currentMap.setMap(map_or_position);\n                }\n                else {\n                    throw new Error(`Invalid map argument.`);\n                }\n                return new DDM(node, currentMap, data);\n            },\n        };\n    }\n}\n","import { isParentNode } from \"../NodeTreeManager/utils\";\nexport class NodeManager {\n    node;\n    listeners = new Map();\n    constructor(node) {\n        this.node = node;\n    }\n    /**\n     * Add a listener to the current node.\n     */\n    addListener(eventName, callback, options) {\n        this.node.addEventListener(eventName, callback, options);\n        const listeners = this.listeners.get(this.node) || [];\n        listeners.push({\n            callback,\n            event: eventName,\n            options: options,\n        });\n        this.listeners.set(this.node, listeners);\n    }\n    /**\n     * Add a listener to one of the descendants.\n     *\n     * Note: Most of the time it's not recommended to use this\n     * method because it makes a wraplet impure.\n     *\n     * Ideally, wraplet should directly interact only with its\n     * own node. However, you can make a wraplet impure if you\n     * know what you are doing.\n     */\n    addListenerTo(target, eventName, callback, options, required = true) {\n        if (!isParentNode(this.node)) {\n            throw new Error(\"Target node is not a parent node. Cannot add listener to its child.\");\n        }\n        const nodes = [];\n        if (typeof target === \"string\") {\n            nodes.push(...Array.from(this.node.querySelectorAll(target)));\n        }\n        else {\n            nodes.push(...target(this.node));\n        }\n        if (required && nodes.length === 0) {\n            throw new Error(\"No nodes found\");\n        }\n        for (const node of nodes) {\n            node.addEventListener(eventName, callback, options);\n            const listeners = this.listeners.get(node) || [];\n            listeners.push({\n                event: eventName,\n                callback,\n                options,\n            });\n            this.listeners.set(node, listeners);\n        }\n    }\n    destroy() {\n        for (const listenerData of this.listeners) {\n            const node = listenerData[0];\n            const listeners = listenerData[1];\n            for (const listener of listeners) {\n                node.removeEventListener(listener.event, listener.callback, listener.options);\n            }\n        }\n        this.listeners.clear();\n    }\n    wiring() {\n        return {\n            destroyCallback: async () => {\n                this.destroy();\n            },\n        };\n    }\n    /**\n     * @deprecated\n     *   For an existing instance, use `nodeManager.wiring()`.\n     *   For lazy wiring, use `lazyWiring`, but note that it evaluates the provider\n     *   on the first lifecycle event, which may be initialization.\n     */\n    static wire(nodeManager) {\n        return {\n            destroyCallback: async () => {\n                const nm = typeof nodeManager === \"object\" ? nodeManager : nodeManager();\n                if (!nm) {\n                    return;\n                }\n                nm.destroy();\n            },\n        };\n    }\n}\n","import { LifecycleError } from \"../errors\";\nexport function createOuterDestroyCallback(args, destroyLogic) {\n    let promise = null;\n    return function () {\n        if (promise) {\n            return promise;\n        }\n        promise = (async () => {\n            const status = args.status;\n            if (status.isDestroyed) {\n                return;\n            }\n            status.isGettingDestroyed = true;\n            if (status.isGettingInitialized) {\n                // If we are still initializing, then postpone destruction until after\n                // initialization is finished.\n                // We are leaving this method, but with `isGettingDestroyed` set to true, so\n                // the initialization process will know to return here after it will finish.\n                return;\n            }\n            if (!status.isInitialized) {\n                // If we are not initialized, then we have nothing to do here.\n                throw new LifecycleError(\"Wraplet cannot be destroyed before it is initialized.\");\n            }\n            if (destroyLogic) {\n                await destroyLogic();\n            }\n            status.isGettingDestroyed = false;\n            status.isInitialized = false;\n            status.isDestroyed = true;\n            for (const listener of [...args.destroyListeners].reverse()) {\n                await listener(args.wraplet);\n            }\n            args.destroyListeners.length = 0;\n        })().finally(() => {\n            promise = null;\n        });\n        return promise;\n    };\n}\n","import { LifecycleError } from \"../errors\";\nexport function createOuterInitializeCallback(args, initializeLogic) {\n    let promise = null;\n    return function () {\n        if (promise) {\n            return promise;\n        }\n        promise = (async () => {\n            const status = args.status;\n            if (status.isDestroyed || status.isGettingDestroyed) {\n                throw new LifecycleError(\"Wraplet cannot be initialized when destroyed or in the process of being destroyed\");\n            }\n            if (status.isInitialized || status.isGettingInitialized) {\n                return;\n            }\n            status.isGettingInitialized = true;\n            if (initializeLogic) {\n                await initializeLogic();\n            }\n            status.isInitialized = true;\n            status.isGettingInitialized = false;\n            // If destruction has been invoked in the meantime, we can finally do it, when initialization\n            // is finished.\n            if (status.isGettingDestroyed) {\n                await args.destroyCallback();\n            }\n        })().finally(() => {\n            promise = null;\n        });\n        return promise;\n    };\n}\n","import { addWrapletToNode, removeWrapletFromNode, } from \"../NodeTreeManager/utils\";\nimport { WrapletApiSymbol, } from \"./types/WrapletApi\";\nimport { createOuterDestroyCallback } from \"./createOuterDestroyCallback\";\nimport { createOuterInitializeCallback } from \"./createOuterInitializeCallback\";\nfunction validateNodeWrapletApiFactoryArgs(args) {\n    if (args.node && !(args.node instanceof Node)) {\n        throw new Error(\"Correct node has to be provided.\");\n    }\n    if (args.initializeCallback &&\n        typeof args.initializeCallback !== \"function\") {\n        throw new Error(\"initializeCallback has to be a function.\");\n    }\n    if (args.destroyCallback && typeof args.destroyCallback !== \"function\") {\n        throw new Error(\"destroyCallback has to be a function.\");\n    }\n}\nexport const createWrapletApi = (args) => {\n    validateNodeWrapletApiFactoryArgs(args);\n    const newArgs = { ...args };\n    const defaultStatus = {\n        isGettingInitialized: false,\n        isDestroyed: false,\n        isInitialized: false,\n        isGettingDestroyed: false,\n    };\n    const api = {};\n    const destroyListeners = [];\n    const destroyCallback = createOuterDestroyCallback({\n        status: defaultStatus,\n        wraplet: newArgs.wraplet,\n        destroyListeners: destroyListeners,\n    }, async () => {\n        if (newArgs.destroyCallback) {\n            await newArgs.destroyCallback();\n        }\n        if (newArgs.node) {\n            removeWrapletFromNode(newArgs.wraplet, newArgs.node);\n        }\n    }).bind(api);\n    const initializeCallback = createOuterInitializeCallback({\n        status: defaultStatus,\n        destroyCallback: destroyCallback,\n        wraplet: newArgs.wraplet,\n    }, async () => {\n        if (newArgs.initializeCallback) {\n            await newArgs.initializeCallback();\n        }\n    }).bind(api);\n    // Note that it's added immediately without initialization required.\n    if (newArgs.node) {\n        addWrapletToNode(newArgs.wraplet, newArgs.node);\n    }\n    return Object.assign(api, {\n        [WrapletApiSymbol]: true,\n        __destroyListeners: destroyListeners,\n        status: defaultStatus,\n        addDestroyListener: (callback) => {\n            destroyListeners.push(callback);\n        },\n        initialize: initializeCallback,\n        destroy: destroyCallback,\n    });\n};\n","import { createWrapletApi } from \"./createWrapletApi\";\nexport function mergeWirings(wirings) {\n    const initializeCallbacks = wirings.map((config) => config.initializeCallback);\n    // Destruction happens in the reverse order of initialization.\n    const destroyCallbacks = wirings\n        .map((config) => config.destroyCallback)\n        .reverse();\n    return {\n        initializeCallback: async () => {\n            for (const callback of initializeCallbacks) {\n                await callback?.();\n            }\n        },\n        destroyCallback: async () => {\n            for (const callback of destroyCallbacks) {\n                await callback?.();\n            }\n        },\n    };\n}\nexport function wireCallback(callbackName, callback) {\n    return {\n        [callbackName]: callback,\n    };\n}\n/**\n * Returns a wiring that evaluates the callback lazily on the first lifecycle event\n * and then reuses the same returned wiring for subsequent lifecycle events.\n */\nexport function lazyWiring(callback) {\n    let evaluated = false;\n    let cachedCallbackResult;\n    const getWiring = () => {\n        if (!evaluated) {\n            cachedCallbackResult = callback();\n            evaluated = true;\n        }\n        return cachedCallbackResult;\n    };\n    return {\n        initializeCallback: async () => {\n            return getWiring()?.initializeCallback?.();\n        },\n        destroyCallback: async () => {\n            return getWiring()?.destroyCallback?.();\n        },\n    };\n}\nexport function composeWrapletApi(node, wraplet, wirings) {\n    return createWrapletApi(Object.assign({ node, wraplet }, mergeWirings(wirings)));\n}\n","import { UnsupportedNodeTypeError } from \"../errors\";\nimport { NodeManager } from \"./NodeManager\";\nimport { createWrapletApi } from \"./createWrapletApi\";\nimport { RESOLVE } from \"../utils/utils\";\nimport { composeWrapletApi, mergeWirings } from \"./composeWrapletApi\";\nexport class AbstractWraplet {\n    node;\n    wraplet;\n    _nodeManager;\n    constructor(node) {\n        this.node = node;\n        if (!(node instanceof Node)) {\n            throw new Error(\"AbstractWraplet requires a Node instance.\");\n        }\n        const supportedNodeTypes = this.supportedNodeTypes();\n        if (supportedNodeTypes !== null) {\n            if (!supportedNodeTypes.find((value) => node instanceof value)) {\n                throw new UnsupportedNodeTypeError(`Node type ${node.constructor.name} is not supported by the ${this.constructor.name} wraplet.`);\n            }\n        }\n        this.wraplet = this.createWrapletApi();\n    }\n    /**\n     * Creates the WrapletApi for this wraplet. Subclasses (e.g. AbstractDependentWraplet)\n     * can override this to supply their own lifecycle callbacks without causing a\n     * double-creation of WrapletApi.\n     */\n    createWrapletApi() {\n        // @todo Remove this condition for the next major release.\n        if (Object.getPrototypeOf(this).buildWrapletApi !==\n            AbstractWraplet.prototype.buildWrapletApi) {\n            return this.buildWrapletApi(this.onInitialize.bind(this), this.onDestroy.bind(this));\n        }\n        return composeWrapletApi(this.node, this, [\n            ...this.wrapletApiWirings(),\n            this.defaultWrapletApiWiring(),\n        ]);\n    }\n    defaultWrapletApiWiring() {\n        return AbstractWraplet.wiring({\n            initializeCallback: this.onInitialize.bind(this),\n            destroyCallback: this.onDestroy.bind(this),\n            nodeManager: () => this._nodeManager,\n        });\n    }\n    /**\n     * Builds a WrapletApi with the given callbacks and ensures NodeManager cleanup\n     * is always wired into the destroy path.\n     *\n     * @deprecated\n     *   The new method of building WrapletApi is through adding wirings in the `wrapletApiWirings` method.\n     *   `buildWrapletApi` method will be removed in future versions.\n     */\n    buildWrapletApi(initializeCallback, destroyCallback) {\n        return createWrapletApi({\n            node: this.node,\n            wraplet: this,\n            initializeCallback,\n            destroyCallback: async () => {\n                if (destroyCallback) {\n                    await destroyCallback();\n                }\n                if (this._nodeManager) {\n                    this._nodeManager.destroy();\n                }\n            },\n        });\n    }\n    /**\n     * Wires up the WrapletApi with lifecycle callbacks and NodeManager integration.\n     */\n    wrapletApiWirings() {\n        return [];\n    }\n    get nodeManager() {\n        if (!this._nodeManager) {\n            this._nodeManager = new NodeManager(this.node);\n        }\n        return this._nodeManager;\n    }\n    /**\n     * Subclasses must return an array of constructors covering all types in union N.\n     * Wrap the result in the `supportedTypeGuard` helper to make sure that the array contains all\n     * and only classes that extend the given type.\n     */\n    supportedNodeTypes() {\n        return null;\n    }\n    /**\n     * Helper for subclasses to easily satisfy the exhaustive check.\n     */\n    supportedNodeTypesGuard(types) {\n        return types;\n    }\n    /**\n     * This method gets invoked when the wraplet is initialized.\n     */\n    onInitialize() {\n        return RESOLVE;\n    }\n    /**\n     * This method gets invoked when the wraplet is destroyed.\n     */\n    onDestroy() {\n        return RESOLVE;\n    }\n    static wiring(args) {\n        const wirings = [];\n        const callbackWiring = {};\n        if (args.initializeCallback) {\n            callbackWiring.initializeCallback = args.initializeCallback;\n        }\n        if (args.destroyCallback) {\n            callbackWiring.destroyCallback = args.destroyCallback;\n        }\n        wirings.push(callbackWiring);\n        if (args.nodeManager) {\n            const nodeManagerArg = args.nodeManager;\n            wirings.push({\n                destroyCallback: async () => {\n                    const nodeManager = typeof nodeManagerArg === \"function\"\n                        ? nodeManagerArg()\n                        : nodeManagerArg;\n                    // NodeManager implements only destroyCallback.\n                    // @todo We don't use the new lazyWiring function here because\n                    //   it would evaluate the callback on initialization,\n                    //   which would be a subtle BC break.\n                    await nodeManager?.wiring().destroyCallback?.();\n                },\n            });\n        }\n        return mergeWirings(wirings);\n    }\n    /**\n     * Instantiates wraplets on a given ParentNode.\n     *\n     * @param node - The ParentNode to instantiate wraplets on.\n     * @param attribute - The attribute to look for or a function to retrieve nodes.\n     * @param additional_args - Additional arguments to pass to the wraplet constructor.\n     *\n     * @returns An array of instantiated wraplets.\n     */\n    static createWraplets(node, attribute, additional_args = []) {\n        // @ts-expect-error TypeScript doesn't like this, but we still do this check.\n        if (this === AbstractWraplet) {\n            throw new Error(\"You cannot instantiate an abstract class.\");\n        }\n        const result = [];\n        let elements;\n        if (typeof attribute === \"function\") {\n            elements = attribute(node);\n        }\n        else {\n            if (node instanceof Element && node.hasAttribute(attribute)) {\n                result.push(new this(node, ...additional_args));\n            }\n            elements = node.querySelectorAll(`[${attribute}]`);\n        }\n        for (const element of elements) {\n            result.push(new this(element, ...additional_args));\n        }\n        return result;\n    }\n    /**\n     * Instantiates and initializes wraplets on a given ParentNode.\n     *\n     * @param node - The ParentNode to instantiate wraplets on.\n     * @param attribute - The attribute to look for or a function to retrieve nodes.\n     * @param additional_args - Additional arguments to pass to the wraplet constructor.\n     *\n     * @returns An array of instantiated wraplets.\n     */\n    static async createAndInitializeWraplets(node, attribute, additional_args = []) {\n        const self = this;\n        const wraplets = self.createWraplets(node, attribute, additional_args);\n        for (const wraplet of wraplets) {\n            await wraplet.wraplet.initialize();\n        }\n        return wraplets;\n    }\n}\n","import { isDependencyManager, } from \"../DependencyManager/types/DependencyManager\";\nimport { DDM } from \"../DependencyManager/DDM\";\nimport { AbstractWraplet } from \"./AbstractWraplet\";\nimport { composeWrapletApi, mergeWirings } from \"./composeWrapletApi\";\nexport class AbstractDependentWraplet extends AbstractWraplet {\n    dm;\n    constructor(dm) {\n        if (!isDependencyManager(dm)) {\n            throw new Error(\"AbstractDependentWraplet requires an instance implementing the DependencyManager interface.\");\n        }\n        super(dm.node);\n        this.dm = dm;\n        dm.instantiateDependencies();\n    }\n    createWrapletApi() {\n        // @todo Remove this condition for the next major release.\n        if (Object.getPrototypeOf(this).buildWrapletApi !==\n            AbstractDependentWraplet.prototype.buildWrapletApi) {\n            return this.buildWrapletApi(async () => {\n                await this.dm.initializeDependencies();\n                await this.onInitialize.bind(this)();\n            }, async () => {\n                await this.onDestroy.bind(this)();\n                await this.dm.destroyDependencies();\n            });\n        }\n        return composeWrapletApi(this.node, this, [\n            ...this.wrapletApiWirings(),\n            this.defaultWrapletApiWiring(),\n        ]);\n    }\n    defaultWrapletApiWiring() {\n        return mergeWirings([\n            AbstractDependentWraplet.wiring({\n                dependencyManager: () => this.dm,\n            }),\n            super.defaultWrapletApiWiring(),\n        ]);\n    }\n    /**\n     * Dependencies.\n     */\n    get d() {\n        return this.dm.dependencies;\n    }\n    static wiring(args) {\n        const parentWiring = super.wiring(args);\n        const dependencyManagerArg = args.dependencyManager;\n        const dependencyManagerProvider = typeof dependencyManagerArg === \"function\"\n            ? dependencyManagerArg\n            : () => dependencyManagerArg;\n        // The dependency manager wiring is placed *before* the parent's wirings:\n        //  - initialize runs first (dependencies ready for the parent's init code),\n        //  - destroy runs last (parent's destroy code still has access to dependencies),\n        //    because the composer reverses the destroy order.\n        const wiring = {\n            initializeCallback: async () => {\n                await dependencyManagerProvider().initializeDependencies();\n            },\n            destroyCallback: async () => {\n                await dependencyManagerProvider().destroyDependencies();\n            },\n        };\n        return mergeWirings([parentWiring, wiring]);\n    }\n    static createDependencyManager(node, map) {\n        return new DDM(node, map);\n    }\n    static createWraplets() {\n        throw new Error(\"This method is not supported for AbstractDependentWraplet.\");\n    }\n    static createAndInitializeWraplets() {\n        throw new Error(\"This method is not supported for AbstractDependentWraplet.\");\n    }\n    /**\n     * Instantiates wraplets on a given ParentNode.\n     *\n     * @param node - The ParentNode to instantiate wraplets on.\n     * @param attribute - The attribute to look for or a function to retrieve nodes.\n     * @param map - The dependency map for the wraplets.\n     * @param additional_args - Additional arguments to pass to the wraplet constructor.\n     *\n     * @returns An array of instantiated wraplets.\n     */\n    static createDependentWraplets(node, attribute, map, additional_args = []) {\n        // @ts-expect-error TypeScript doesn't like this, but we still do this check.\n        if (this === AbstractDependentWraplet) {\n            throw new Error(\"You cannot instantiate an abstract class.\");\n        }\n        const self = this;\n        const result = [];\n        let elements;\n        if (typeof attribute === \"function\") {\n            elements = attribute(node);\n        }\n        else {\n            if (node instanceof Element && node.hasAttribute(attribute)) {\n                const dm = self.createDependencyManager(node, map);\n                result.push(new this(dm, ...additional_args));\n            }\n            elements = node.querySelectorAll(`[${attribute}]`);\n        }\n        for (const element of elements) {\n            const dm = self.createDependencyManager(element, map);\n            result.push(new this(dm, ...additional_args));\n        }\n        return result;\n    }\n    /**\n     * Instantiates and initializes wraplets on a given ParentNode.\n     *\n     * @param node - The ParentNode to instantiate wraplets on.\n     * @param attribute - The attribute to look for or a function to retrieve nodes.\n     * @param map - The dependency map for the wraplets.\n     * @param additional_args - Additional arguments to pass to the wraplet constructor.\n     *\n     * @returns An array of instantiated and initialized wraplets.\n     */\n    static async createAndInitializeDependentWraplets(node, attribute, map, additional_args = []) {\n        const self = this;\n        const wraplets = self.createDependentWraplets(node, attribute, map, additional_args);\n        for (const wraplet of wraplets) {\n            await wraplet.wraplet.initialize();\n        }\n        return wraplets;\n    }\n}\n","import { WrapletSetReadonlySymbol, } from \"./types/WrapletSetReadonly\";\nimport { DefaultSearchableSet } from \"./DefaultSearchableSet\";\nexport class DefaultWrapletSetReadonly extends DefaultSearchableSet {\n    [WrapletSetReadonlySymbol] = true;\n}\n","import { destroyWrapletsRecursively } from \"./utils\";\nexport class DNTM {\n    initializers = [];\n    addNodeInitializer(callback) {\n        this.initializers.push(callback);\n    }\n    async initializeNode(node, context) {\n        const errors = [];\n        await Promise.all(this.initializers.map(async (initializer) => {\n            try {\n                await initializer(node, context);\n            }\n            catch (error) {\n                errors.push(error);\n            }\n        }));\n        if (errors.length > 0) {\n            throw new AggregateError(errors, `There were errors during the node's initialization.`);\n        }\n    }\n    async destroyNode(node) {\n        await destroyWrapletsRecursively(node);\n    }\n}\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","MissingRequiredDependencyError","Error","MapError","RequiredDependencyDestroyedError","DependenciesAreNotAvailableError","TooManyChildrenFoundError","InternalLogicError","UnsupportedNodeTypeError","LifecycleError","is","object","symbol","WrapletApiSymbol","isWraplet","wraplet","isSimpleObject","input","getPrototypeOf","isDependencyMapItem","item","keys","includes","isWrapletDependencyMap","WrapletSetSymbol","isWrapletSet","DefaultSearchableSet","Set","find","filter","results","this","push","findOne","getOrdered","callback","Array","from","sort","a","b","WrapletSetReadonlySymbol","DefaultWrapletSet","RESOLVE","Promise","resolve","throwIfErrors","errors","message","length","AggregateError","flattenDependencies","dependencies","wraplets","values","async","actOnDependencies","deps","all","entries","map","id","dependency","actOnDependenciesWraplets","isParentNode","node","querySelectorAll","getWrapletsFromNode","actOnNodesRecursively","stack","current","pop","children","childNodes","i","destroyWrapletsRecursively","allWraplets","status","isGettingDestroyed","isDestroyed","destroy","error","DependencyManagerSymbol","addDefaultsToDependencyDefinition","args","destructible","injector","MapTreeBuilderSymbol","MapTreeBuilder","parent","constructor","getParent","createChild","name","mapBuilder","setMap","newMap","def","fillMapWithDefaults","getMap","DDM","dependenciesAreInstantiated","initializePromise","destroyPromise","syncPromise","isGettingSynced","isInitialized","isGettingInitialized","mapTree","directDependencies","wrappedDependencies","instantiatedDependencyListeners","initializedDependencyListeners","destroyedDependencyListeners","options","Node","optionsWithDefaults","assign","defaultOptions","dependencyInstantiatedListeners","dependencyInitializedListeners","dependencyDestroyedListeners","initializeDependencies","initializeDeps","initialize","listenersErrors","listeners","fn","syncDependencies","instantiateDeps","destroyDeps","sync","dependencyDefinition","multiple","validateMapItem","currentDependencies","instantiatedDependencies","instantiateMultipleDependencies","add","newDep","instantiateSingleWrapletDependency","validateMapItemForNonParent","instantiateDependencies","wrapDependencies","findExistingWraplet","childElement","undefined","existingDependency","childElementWraplets","existingDependencies","has","selector","childrenElements","findChildrenElements","validateElements","instantiateWrapletItem","existingWraplet","instance","Class","data","e","required","console","warn","prepareIndividualWraplet","listener","childElements","items","addDependencyInstantiatedListener","set","addDependencyInitializedListener","addDependencyDestroyedListener","setExistingInstance","addExistingInstance","addDestroyListener","createDependencyDestroyListener","w","removeDependency","requiredError","validateRequiredDependencyAfterRemoval","destroyDependencies","defaultSelectorCallback","delete","isRequired","size","elements","mapItem","Proxy","target","Map","wrapletsOutsideTree","nodeWraplets","findWrapletsOutsideTheTree","createInjector","map_or_position","currentMap","Number","isInteger","NodeManager","addListener","eventName","addEventListener","event","addListenerTo","nodes","listenerData","removeEventListener","clear","wiring","destroyCallback","wire","nodeManager","nm","createOuterDestroyCallback","destroyLogic","promise","destroyListeners","reverse","finally","createOuterInitializeCallback","initializeLogic","createWrapletApi","initializeCallback","validateNodeWrapletApiFactoryArgs","newArgs","defaultStatus","api","removeWrapletFromNode","bind","__destroyListeners","mergeWirings","wirings","initializeCallbacks","config","destroyCallbacks","wireCallback","callbackName","lazyWiring","cachedCallbackResult","evaluated","getWiring","composeWrapletApi","AbstractWraplet","_nodeManager","supportedNodeTypes","buildWrapletApi","onInitialize","onDestroy","wrapletApiWirings","defaultWrapletApiWiring","supportedNodeTypesGuard","types","callbackWiring","nodeManagerArg","createWraplets","attribute","additional_args","result","Element","hasAttribute","element","createAndInitializeWraplets","AbstractDependentWraplet","dm","super","dependencyManager","d","parentWiring","dependencyManagerArg","dependencyManagerProvider","createDependencyManager","createDependentWraplets","self","createAndInitializeDependentWraplets","DefaultWrapletSetReadonly","DNTM","initializers","addNodeInitializer","initializeNode","context","initializer","destroyNode"],"sourceRoot":""}