{"version":3,"file":"GlobalResourceRegistry.mjs","sources":["../../../src/utils/pool/GlobalResourceRegistry.ts"],"sourcesContent":["/** Interface for objects that can be cleaned up by the PoolCollector. */\ninterface Cleanable\n{\n    clear(): void;\n}\n\n/**\n * A singleton collector that manages and provides cleanup for registered pools and caches.\n * Useful for cleaning up all pools/caches at once during application shutdown or reset.\n * @category utils\n * @internal\n */\nexport const GlobalResourceRegistry = {\n    /**\n     * Set of registered pools and cleanable objects.\n     * @private\n     */\n    _registeredResources: new Set<Cleanable>(),\n\n    /**\n     * Registers a pool or cleanable object for cleanup.\n     * @param {Cleanable} pool - The pool or object to register.\n     */\n    register(pool: Cleanable): void\n    {\n        this._registeredResources.add(pool);\n    },\n\n    /**\n     * Unregisters a pool or cleanable object from cleanup.\n     * @param {Cleanable} pool - The pool or object to unregister.\n     */\n    unregister(pool: Cleanable): void\n    {\n        this._registeredResources.delete(pool);\n    },\n\n    /** Clears all registered pools and cleanable objects. This will call clear() on each registered item. */\n    release(): void\n    {\n        this._registeredResources.forEach((pool) => pool.clear());\n    },\n\n    /**\n     * Gets the number of registered pools and cleanable objects.\n     * @returns {number} The count of registered items.\n     */\n    get registeredCount(): number\n    {\n        return this._registeredResources.size;\n    },\n\n    /**\n     * Checks if a specific pool or cleanable object is registered.\n     * @param {Cleanable} pool - The pool or object to check.\n     * @returns {boolean} True if the item is registered, false otherwise.\n     */\n    isRegistered(pool: Cleanable): boolean\n    {\n        return this._registeredResources.has(pool);\n    },\n\n    /**\n     * Removes all registrations without clearing the pools.\n     * Useful if you want to reset the collector without affecting the pools.\n     */\n    reset(): void\n    {\n        this._registeredResources.clear();\n    }\n};\n"],"names":[],"mappings":";AAYO,MAAM,sBAAyB,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlC,oBAAA,sBAA0B,GAAe,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMzC,SAAS,IACT,EAAA;AACI,IAAK,IAAA,CAAA,oBAAA,CAAqB,IAAI,IAAI,CAAA,CAAA;AAAA,GACtC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,WAAW,IACX,EAAA;AACI,IAAK,IAAA,CAAA,oBAAA,CAAqB,OAAO,IAAI,CAAA,CAAA;AAAA,GACzC;AAAA;AAAA,EAGA,OACA,GAAA;AACI,IAAA,IAAA,CAAK,qBAAqB,OAAQ,CAAA,CAAC,IAAS,KAAA,IAAA,CAAK,OAAO,CAAA,CAAA;AAAA,GAC5D;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,eACJ,GAAA;AACI,IAAA,OAAO,KAAK,oBAAqB,CAAA,IAAA,CAAA;AAAA,GACrC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,aAAa,IACb,EAAA;AACI,IAAO,OAAA,IAAA,CAAK,oBAAqB,CAAA,GAAA,CAAI,IAAI,CAAA,CAAA;AAAA,GAC7C;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,KACA,GAAA;AACI,IAAA,IAAA,CAAK,qBAAqB,KAAM,EAAA,CAAA;AAAA,GACpC;AACJ;;;;"}