import { type AnyObject } from '@augment-vir/core';
import { type AbstractConstructor, type Constructor } from 'type-fest';
/**
 * Map all ancestor constructors of an object to a set of objects.
 *
 * @category Internal
 */
export declare class ConstructorInstanceMap {
    /**
     * The top most constructor to allow in the map. If this constructor is ever reached, the
     * recursive mapping stops.
     */
    protected readonly topMostConstructor?: Function | undefined;
    /** A map of constructors to their added instances. */
    readonly map: Map<Function, Set<AnyObject>>;
    readonly isDestroyed: boolean;
    constructor(
    /**
     * The top most constructor to allow in the map. If this constructor is ever reached, the
     * recursive mapping stops.
     */
    topMostConstructor?: Function | undefined);
    /**
     * Add a new instance, mapping each of its ancestor constructors to it inside
     * {@link ConstructorInstanceMap.map}.
     */
    add(instance: AnyObject): void;
    /** Gets all added instances of the given constructor. */
    getInstances<T>(constructor: AbstractConstructor<T> | Constructor<T>): Set<T>;
    /** Remove an instance, removing it from all mappings inside {@link ConstructorInstanceMap.map}. */
    remove(instance: AnyObject): void;
    /** Recursively map all ancestor prototypes to the given instance. */
    protected traverseConstructors(instance: AnyObject, prototype: any, operation: 'add' | 'remove'): void;
    /** Clean up the internal map. */
    destroy(): void;
}
