import { Slot } from '@blockeditor/global/utils';
import { type EdgelessElement } from '../../_common/types.js';
import type { BookmarkBlockModel } from '../../bookmark-block/bookmark-model.js';
import type { EmbedFigmaModel } from '../../embed-figma-block/embed-figma-model.js';
import type { EmbedGithubModel } from '../../embed-github-block/index.js';
import type { EmbedLinkedDocModel } from '../../embed-linked-doc-block/embed-linked-doc-model.js';
import type { EmbedYoutubeModel } from '../../embed-youtube-block/embed-youtube-model.js';
import type { FrameBlockModel } from '../../frame-block/frame-model.js';
import type { ImageBlockModel } from '../../image-block/image-model.js';
import type { NoteBlockModel } from '../../note-block/note-model.js';
import type { CanvasElement } from '../../surface-block/elements/index.js';
import { SurfaceElement } from '../elements/surface-element.js';
import { GridManager } from '../grid.js';
export type IndexableBlock = ImageBlockModel | NoteBlockModel | BookmarkBlockModel | EmbedGithubModel | EmbedYoutubeModel | EmbedFigmaModel | EmbedLinkedDocModel;
export type Indexable = CanvasElement | IndexableBlock;
type BaseLayer<T> = {
    set: Set<T>;
    elements: Array<T>;
    /**
     * fractional indexing range
     */
    indexes: [string, string];
};
type BlockLayer = BaseLayer<IndexableBlock> & {
    type: 'block';
    /**
     * The computed DOM z-index used for rendering blocks.
     * One layer contains multiple blocks,
     * so we need the array to mark the start and end of the z-index range.
     */
    zIndexes: [number, number];
};
type CanvasLayer = BaseLayer<CanvasElement> & {
    type: 'canvas';
    /**
     * The computed DOM z-index used for rendering this canvas layer.
     * The canvas layer only contains one DOM element of the canvas,
     * so we only need one number to mark the z-index.
     */
    zIndexes: number;
};
export type Layer = BlockLayer | CanvasLayer;
export declare class LayerManager {
    static INITAL_INDEX: string;
    slots: {
        layerUpdated: Slot<void>;
    };
    canvasElements: SurfaceElement[];
    blocks: IndexableBlock[];
    frames: FrameBlockModel[];
    layers: Layer[];
    canvasLayers: {
        set: Set<CanvasElement>;
        /**
         * fractional index
         */
        indexes: [string, string];
        /**
         * z-index, used for actual rendering
         */
        zIndexes: number;
        elements: Array<CanvasElement>;
    }[];
    blocksGrid: GridManager<IndexableBlock>;
    framesGrid: GridManager<FrameBlockModel>;
    constructor(elements?: EdgelessElement[]);
    init(elements: EdgelessElement[]): void;
    private _initLayers;
    private _insertIntoLayer;
    private _removeFromLayer;
    private _buildCanvasLayers;
    /**
     * @returns a boolean value to indicate whether the layers have been updated
     */
    private _updateLayer;
    add(element: Indexable | FrameBlockModel): void;
    delete(element: Indexable | FrameBlockModel): void;
    update(element: Indexable | FrameBlockModel, props?: Record<string, unknown>): void;
    getCanvasLayers(): {
        set: Set<CanvasElement>;
        /**
         * fractional index
         */
        indexes: [string, string];
        /**
         * z-index, used for actual rendering
         */
        zIndexes: number;
        elements: CanvasElement[];
    }[];
    generateIndex(elementType: string): string;
    /**
     * In some cases, we need to generate a bunch of indexes in advance before acutally adding the elements to the layer manager.
     * Eg. when importing a template. The `generateIndex` is a pure function which depends on the current state of the manager.
     * We cannot use it because it will always return the same index if the element is not added to manager.
     * So we need to create a generator that can "remember" the index it generated without actually adding the element to the manager.
     *
     * This is what this function does.
     *
     * @param ignoreRule If true, the generator will not distinguish between `block` and `canvas` elements.
     * @returns
     */
    preservedIndexGenerator(ignoreRule: boolean): (elementType: string) => string;
    getReorderedIndex(element: Indexable | FrameBlockModel, direction: 'front' | 'forward' | 'back' | 'backward'): string;
}
export {};
//# sourceMappingURL=layer-manager.d.ts.map