import type { OFFICE_KERNEL_PROTOCOL_VERSION } from './office-kernel-version'; export declare const OFFICE_KERNEL_SPREADSHEET_MAX_ROWS = 1048576; export declare const OFFICE_KERNEL_SPREADSHEET_MAX_COLUMNS = 16384; export declare const OFFICE_KERNEL_SPREADSHEET_MAX_TEXT_BYTES = 32767; export type OfficeKernelSpreadsheetValue = { kind: 'blank'; } | { kind: 'number'; value: number; } | { kind: 'text'; value: string; } | { kind: 'boolean'; value: boolean; } | { kind: 'error'; value: OfficeKernelSpreadsheetError; }; export type OfficeKernelSpreadsheetError = '#BLOCKED!' | '#BUSY!' | '#CALC!' | '#CONNECT!' | '#DIV/0!' | '#FIELD!' | '#GETTING_DATA' | '#N/A' | '#NAME?' | '#NULL!' | '#NUM!' | '#PYTHON!' | '#REF!' | '#SPILL!' | '#UNKNOWN!' | '#VALUE!'; export interface OfficeKernelSpreadsheetCoordinate { sheetId: string; row: number; column: number; } export interface OfficeKernelSpreadsheetInputCell { row: number; column: number; formula?: string; value: OfficeKernelSpreadsheetValue; } /** * The bounded table metadata needed to resolve native structured references. * Ranges are zero-based and inclusive, matching the controlled workbook * model. Styling, filters, and drawing metadata intentionally stay outside * the calculation kernel. */ export interface OfficeKernelSpreadsheetInputTable { name: string; displayName?: string; startRow: number; endRow: number; startColumn: number; endColumn: number; columns: string[]; headerRow: boolean; totalsRow: boolean; } export interface OfficeKernelSpreadsheetInputSheet { id: string; name: string; cells: OfficeKernelSpreadsheetInputCell[]; tables?: OfficeKernelSpreadsheetInputTable[]; } export interface OfficeKernelSpreadsheetCalculationRequest { protocol: typeof OFFICE_KERNEL_PROTOCOL_VERSION; kind: 'spreadsheetCalculation'; requestId: number; revision: number; documentRevision: number; sheets: OfficeKernelSpreadsheetInputSheet[]; targets?: OfficeKernelSpreadsheetCoordinate[]; } export type OfficeKernelSpreadsheetSessionCellChange = (OfficeKernelSpreadsheetCoordinate & { kind: 'upsert'; formula?: string; value: OfficeKernelSpreadsheetValue; }) | (OfficeKernelSpreadsheetCoordinate & { kind: 'remove'; }); export type OfficeKernelSpreadsheetSessionUpdate = { kind: 'replace'; sheets: OfficeKernelSpreadsheetInputSheet[]; } | { kind: 'patch'; baseDocumentRevision: number; changes: OfficeKernelSpreadsheetSessionCellChange[]; }; export type OfficeKernelSpreadsheetSessionCalculationScope = { kind: 'workbook'; } | { kind: 'dirty'; } | { kind: 'targets'; targets: OfficeKernelSpreadsheetCoordinate[]; }; export interface OfficeKernelSpreadsheetSessionCalculationRequest { protocol: typeof OFFICE_KERNEL_PROTOCOL_VERSION; kind: 'spreadsheetSessionCalculation'; requestId: number; revision: number; documentRevision: number; update: OfficeKernelSpreadsheetSessionUpdate; calculation: OfficeKernelSpreadsheetSessionCalculationScope; } export interface OfficeKernelSpreadsheetCalculatedCell extends OfficeKernelSpreadsheetCoordinate { value: OfficeKernelSpreadsheetValue; } export interface OfficeKernelSpreadsheetCalculationIssue { cell: OfficeKernelSpreadsheetCoordinate; code: string; message: string; } export interface OfficeKernelSpreadsheetCalculationResult { protocol: typeof OFFICE_KERNEL_PROTOCOL_VERSION; kind: 'spreadsheetCalculationResult'; requestId: number; revision: number; documentRevision: number; engine: 'wasm' | 'javascript'; cells: OfficeKernelSpreadsheetCalculatedCell[]; calculationOrder: OfficeKernelSpreadsheetCoordinate[]; issues: OfficeKernelSpreadsheetCalculationIssue[]; } export interface OfficeKernelSpreadsheetSessionCalculationStats { updateKind: 'replace' | 'patch'; calculationScope: 'workbook' | 'dirty' | 'targets'; formulaCellCount: number; dirtyFormulaCellCount: number; evaluatedFormulaCellCount: number; reusedFormulaCellCount: number; dependencyEdgeCount: number; } export interface OfficeKernelSpreadsheetSessionCalculationResult extends Omit { kind: 'spreadsheetSessionCalculationResult'; stats: OfficeKernelSpreadsheetSessionCalculationStats; } export declare function isOfficeKernelSpreadsheetError(value: unknown): value is OfficeKernelSpreadsheetError; export declare function isOfficeKernelSpreadsheetCalculationResult(value: unknown): value is OfficeKernelSpreadsheetCalculationResult; export declare function isOfficeKernelSpreadsheetSessionCalculationResult(value: unknown): value is OfficeKernelSpreadsheetSessionCalculationResult;