import type { EngineOp } from '@bilig/workbook';
import { type OpOrder, type ReplicaState } from '../../replica-state.js';
import type { WorkbookPivotRecord, WorkbookSpillRecord } from '../../workbook-store.js';
type OperationSpillRangeOp = Extract<EngineOp, {
    kind: 'upsertSpillRange' | 'deleteSpillRange';
}>;
type OperationPivotUpsertOp = Extract<EngineOp, {
    kind: 'upsertPivotTable';
}>;
type OperationPivotDeleteOp = Extract<EngineOp, {
    kind: 'deletePivotTable';
}>;
export type OperationDerivedOp = OperationSpillRangeOp | OperationPivotUpsertOp | OperationPivotDeleteOp;
export interface OperationDerivedWorkbookAccess {
    readonly setSpill: (sheetName: string, address: string, rows: number, cols: number) => WorkbookSpillRecord;
    readonly deleteSpill: (sheetName: string, address: string) => boolean;
    readonly setPivot: (record: WorkbookPivotRecord) => WorkbookPivotRecord;
    readonly getPivot: (sheetName: string, address: string) => WorkbookPivotRecord | undefined;
    readonly deletePivot: (sheetName: string, address: string) => boolean;
}
export interface OperationDerivedOpApplier {
    readonly applySpillRangeOp: (op: OperationSpillRangeOp, order: OpOrder) => number[];
    readonly applyPivotUpsertOp: (op: OperationPivotUpsertOp, order: OpOrder) => number[];
    readonly applyPivotDeleteOp: (op: OperationPivotDeleteOp, order: OpOrder) => number[];
    readonly applyDerivedOpNow: (op: OperationDerivedOp) => number[];
}
export declare function createOperationDerivedOpApplier(args: {
    readonly state: {
        readonly workbook: OperationDerivedWorkbookAccess;
        readonly replicaState: ReplicaState;
    };
    readonly reverseSpillEdges: Map<string, Set<number>>;
    readonly setEntityVersionForOp: (op: OperationDerivedOp, order: OpOrder) => void;
    readonly materializePivot: (pivot: WorkbookPivotRecord) => number[];
    readonly clearOwnedPivot: (pivot: WorkbookPivotRecord) => number[];
    readonly rebindFormulaCells: (candidates: readonly number[], formulaChangedCount: number) => number;
}): OperationDerivedOpApplier;
export {};
