import { type RangeIndex } from '@bilig/protocol';
import type { CellRangeAddress, RangeAddress } from '@bilig/formula';
import type { StructuralTransaction } from './engine/structural-transaction.js';
import { type EngineCounters } from './perf/engine-counters.js';
export interface RangeDescriptor {
    index: RangeIndex;
    sheetId: number;
    kind: RangeAddress['kind'];
    row1: number;
    col1: number;
    row2: number;
    col2: number;
    membersOffset: number;
    membersLength: number;
    formulaMembersOffset: number;
    formulaMembersLength: number;
    dependencySourcesOffset: number;
    dependencySourcesLength: number;
    refCount: number;
    dynamic: boolean;
    parentRangeIndex: RangeIndex | undefined;
}
export interface RangeMaterializer {
    ensureCell(sheetId: number, row: number, col: number): number;
    forEachSheetCell(sheetId: number, fn: (cellIndex: number, row: number, col: number) => void): void;
    isFormulaCell?(cellIndex: number): boolean;
}
export interface RegisteredCellRange {
    rangeIndex: number;
    cellRange: CellRangeAddress;
    materialized: boolean;
}
export interface RetargetedRangeDependencies {
    rangeIndex: RangeIndex;
    oldDependencySources: Uint32Array;
    newDependencySources: Uint32Array;
}
export declare class RangeRegistry {
    private readonly counters?;
    private readonly descriptors;
    private readonly byKey;
    private readonly dynamicBySheet;
    private readonly members;
    private readonly memberSlices;
    private readonly formulaMembers;
    private readonly formulaMemberSlices;
    private readonly dependencySources;
    private readonly dependencySourceSlices;
    constructor(counters?: EngineCounters | undefined);
    get size(): number;
    reset(): void;
    intern(sheetId: number, range: RangeAddress, materializer: RangeMaterializer): RegisteredCellRange;
    release(rangeIndex: RangeIndex): {
        removed: boolean;
        members: Uint32Array;
    };
    getDescriptor(rangeIndex: RangeIndex): RangeDescriptor;
    getMembers(rangeIndex: RangeIndex): Uint32Array;
    getDependencySourceEntities(rangeIndex: RangeIndex): Uint32Array;
    getFormulaMembers(rangeIndex: RangeIndex): Uint32Array;
    getMembersView(rangeIndex: RangeIndex): Uint32Array;
    getFormulaMembersView(rangeIndex: RangeIndex): Uint32Array;
    getMemberPoolView(): Uint32Array;
    addDynamicMember(sheetId: number, row: number, col: number, cellIndex: number, includeAsFormulaMember?: boolean): RangeIndex[];
    expandToCells(rangeIndex: RangeIndex): Uint32Array;
    refresh(rangeIndex: RangeIndex, materializer: RangeMaterializer): {
        oldDependencySources: Uint32Array;
        newDependencySources: Uint32Array;
    };
    applyStructuralTransaction(transaction: StructuralTransaction, rangeIndices: readonly RangeIndex[], materializer: RangeMaterializer): RetargetedRangeDependencies[];
}
