import { type CellValue } from '@bilig/protocol';
import type { CellStore } from './cell-store.js';
import type { StringPool } from './string-pool.js';
export interface WasmFormulaUploadLayout {
    targets: Uint32Array;
    programs: Uint32Array;
    programOffsets: Uint32Array;
    programLengths: Uint32Array;
    constants: Float64Array;
    constantOffsets: Uint32Array;
    constantLengths: Uint32Array;
}
export interface WasmRangeUploadLayout {
    members: Uint32Array;
    offsets: Uint32Array;
    lengths: Uint32Array;
    rowCounts: Uint32Array;
    colCounts: Uint32Array;
}
export interface WasmSpillResult {
    rows: number;
    cols: number;
    values: CellValue[];
}
export interface WasmDirectScalarValueBatchLayout {
    operators: Uint8Array;
    leftBatchRefs: Uint32Array;
    leftTags: Uint8Array;
    leftValues: Float64Array;
    leftErrors: Uint16Array;
    rightBatchRefs: Uint32Array;
    rightTags: Uint8Array;
    rightValues: Float64Array;
    rightErrors: Uint16Array;
    resultOffsets: Float64Array;
    outTags: Uint8Array;
    outNumbers: Float64Array;
    outErrors: Uint16Array;
}
export interface WasmDirectScalarStoreTargetBatchLayout {
    targets: Uint32Array;
    operators: Uint8Array;
    leftBatchRefs: Uint32Array;
    leftTags: Uint8Array;
    leftValues: Float64Array;
    leftErrors: Uint16Array;
    rightBatchRefs: Uint32Array;
    rightTags: Uint8Array;
    rightValues: Float64Array;
    rightErrors: Uint16Array;
    resultOffsets: Float64Array;
}
export interface WasmDenseDirectScalarRowChainStoreTargetBatchLayout {
    leftValues: Float64Array;
    rightValues: Float64Array;
    firstTargets: Uint32Array;
    secondTargets: Uint32Array;
    rowCount: number;
    firstFormulaCode: number;
    secondFormulaScale: number;
    secondFormulaOffset: number;
}
export interface WasmDenseNumericRowAggregateBatchLayout {
    aggregateKind: number;
    values: Float64Array;
    rowCount: number;
    prefixColCount: number;
    startColOffset: number;
    aggregateColCount: number;
    resultOffset: number;
    outNumbers: Float64Array;
}
export interface WasmAnchoredPrefixAggregateBatchLayout {
    aggregateKind: number;
    tags: Uint8Array;
    numbers: Float64Array;
    errors: Uint16Array;
    rowCount: number;
    colCount: number;
    formulaRowEnds: Uint32Array;
    resultOffsets: Float64Array;
    outTags: Uint8Array;
    outNumbers: Float64Array;
    outErrors: Uint16Array;
}
export interface WasmDirectCriteriaMatchedAggregateBatchLayout {
    aggregateKinds: Uint8Array;
    matchStarts: Uint32Array;
    matchLengths: Uint32Array;
    matchedRows: Uint32Array;
    aggregateTags: Uint8Array;
    aggregateNumbers: Float64Array;
    aggregateErrors: Uint16Array;
    outTags: Uint8Array;
    outNumbers: Float64Array;
    outErrors: Uint16Array;
}
export interface WasmDirectCriteriaPredicateAggregateBatchLayout {
    aggregateKind: number;
    rowCount: number;
    criteriaOps: Uint8Array;
    criteriaKinds: Uint8Array;
    criteriaValues: Float64Array;
    criteriaStringIds: Uint32Array;
    criteriaTags: Uint8Array;
    criteriaNumbers: Float64Array;
    criteriaStringIdsByRow: Uint32Array;
    aggregateTags: Uint8Array;
    aggregateNumbers: Float64Array;
    aggregateErrors: Uint16Array;
    outTags: Uint8Array;
    outNumbers: Float64Array;
    outErrors: Uint16Array;
}
export interface WasmUniformNumericLookupBatchLayout {
    kinds: Uint8Array;
    matchModes: Uint8Array;
    starts: Float64Array;
    steps: Float64Array;
    lengths: Uint32Array;
    repeatedRunLengths: Uint32Array;
    lookupTags: Uint8Array;
    lookupNumbers: Float64Array;
    outTags: Uint8Array;
    outNumbers: Float64Array;
    outErrors: Uint16Array;
}
export declare class WasmKernelFacade {
    private kernel;
    private initPromise;
    private uploadedStringPoolSize;
    private storeSynced;
    get ready(): boolean;
    init(): Promise<void>;
    initSyncIfPossible(): boolean;
    ensureCapacity(cellCapacity: number, formulaCapacity: number, constantCapacity: number, rangeCapacity?: number, memberCapacity?: number): void;
    uploadFormulas(layout: WasmFormulaUploadLayout): void;
    uploadRanges(layout: WasmRangeUploadLayout): void;
    uploadVolatileNowSerial(nowSerial: number): void;
    uploadVolatileRandomValues(values: Float64Array): void;
    syncStringPool(layout: {
        offsets: Uint32Array;
        lengths: Uint32Array;
        data: Uint16Array;
    }): void;
    resetStoreState(): void;
    syncFromStore(store: CellStore, changedCellIndices?: readonly number[] | Uint32Array): void;
    evalBatch(cellIndices: Uint32Array): void;
    evalDirectScalarValueBatch(layout: WasmDirectScalarValueBatchLayout): boolean;
    evalDirectScalarStoreTargetBatch(layout: WasmDirectScalarStoreTargetBatchLayout, cellCapacity: number): boolean;
    evalDenseDirectScalarRowChainStoreTargetBatch(layout: WasmDenseDirectScalarRowChainStoreTargetBatchLayout, cellCapacity: number): boolean;
    evalDenseNumericRowAggregateBatch(layout: WasmDenseNumericRowAggregateBatchLayout): boolean;
    evalAnchoredPrefixAggregateBatch(layout: WasmAnchoredPrefixAggregateBatchLayout): boolean;
    evalDirectCriteriaMatchedAggregateBatch(layout: WasmDirectCriteriaMatchedAggregateBatchLayout): boolean;
    evalDirectCriteriaPredicateAggregateBatch(layout: WasmDirectCriteriaPredicateAggregateBatchLayout): boolean;
    evalUniformNumericLookupBatch(layout: WasmUniformNumericLookupBatchLayout): boolean;
    readSpill(cellIndex: number, strings: StringPool): WasmSpillResult | undefined;
    materializePivotTable(sourceRangeIndex: number, sourceWidth: number, groupByColumnIndices: Uint32Array, valueColumnIndices: Uint32Array, valueAggregations: Uint8Array): {
        rows: number;
        cols: number;
        tags: Uint8Array;
        numbers: Float64Array;
        stringIds: Uint32Array;
        errors: Uint16Array;
    } | undefined;
    syncToStore(store: CellStore, changedCellIndices: Uint32Array, strings: StringPool, onCellValueWritten?: (cellIndex: number) => void): void;
    get tags(): Uint8Array;
    get numbers(): Float64Array;
    get stringIds(): Uint32Array;
    get errors(): Uint16Array;
    get programOffsets(): Uint32Array;
    get programLengths(): Uint32Array;
    get constantOffsets(): Uint32Array;
    get constantLengths(): Uint32Array;
    get constants(): Float64Array;
    get rangeOffsets(): Uint32Array;
    get rangeLengths(): Uint32Array;
    get rangeMembers(): Uint32Array;
}
