import { TableCellMeasure, TableCell } from '../../contracts/src/index.js';
/**
 * Describes one block in a table cell with renderer-semantic height values.
 *
 * Maps each measured block to its global line index range and the spacing /
 * height values the DOM painter actually applies. Layout decisions that use
 * these descriptors stay synchronized with `renderTableCell.ts`.
 */
export type CellRenderBlock = {
    kind: 'paragraph' | 'table' | 'other';
    /** First global line index (inclusive). */
    globalStartLine: number;
    /** Past-the-end global line index (exclusive). */
    globalEndLine: number;
    /** Per-segment heights matching `getCellLines()` output. */
    lineHeights: number[];
    /** `ParagraphMeasure.totalHeight ?? sum(lineHeights)`. */
    totalHeight: number;
    /** Height contributing to content flow. 0 for anchored out-of-flow blocks. */
    visibleHeight: number;
    isFirstBlock: boolean;
    isLastBlock: boolean;
    /** Effective spacing.before (first block: excess over padding.top; others: full). */
    spacingBefore: number;
    /** Raw spacing.after; always 0 for last block (renderer skips it). */
    spacingAfter: number;
};
/**
 * Stateful cursor for the `computePartialRow()` fitting loop.
 *
 * Advances one line at a time and reports the rendered cost of each line
 * including block-boundary spacing and totalHeight promotion. O(1) per step.
 */
export interface CellSliceCursor {
    /**
     * Compute the rendered cost of including the line at `globalLineIndex`.
     * Advances internal state — call exactly once per line, in ascending order.
     * After calling, if the line doesn't fit, break; the cursor state no longer
     * matters since it won't be used again for this cell.
     */
    advanceLine(globalLineIndex: number): number;
    /**
     * Minimum rendered cost of the segment at `globalLineIndex`, for
     * force-progress checks. Pure peek — does not modify cursor state.
     */
    minSegmentCost(globalLineIndex: number): number;
}
/**
 * Build an ordered array of block descriptors from a cell's measurement and
 * block data. Descriptors carry all renderer-semantic information needed by
 * `computeCellSliceContentHeight` and the fitting cursor.
 *
 * **Iteration rule**: driven by measured blocks (source of truth for line
 * counts). Block data is attached by index when available; missing data
 * degrades to zero spacing and `totalHeight = sum(lineHeights)`.
 */
export declare function describeCellRenderBlocks(cellMeasure: TableCellMeasure, cellBlock: TableCell | undefined, cellPadding: {
    top: number;
    bottom: number;
}): CellRenderBlock[];
/**
 * Content-area height of a cell slice `[fromLine, toLine)`.
 *
 * Matches the DOM painter's rendering semantics:
 * - `spacing.before` when rendering from the start of a block
 * - `totalHeight` promotion for fully rendered paragraphs
 * - `spacing.after` for fully rendered non-last paragraphs
 *
 * Returns content height only — cell padding is NOT included.
 * O(blocks) per call.
 */
export declare function computeCellSliceContentHeight(blocks: CellRenderBlock[], fromLine: number, toLine: number): number;
/**
 * Create a stateful cursor for the `computePartialRow()` fitting loop.
 *
 * The cursor tracks block boundaries and accumulates spacing / promotion costs
 * so that each `advanceLine()` call is O(1). If the fitting loop starts from a
 * continuation (mid-block), the cursor correctly skips spacing.before and
 * totalHeight promotion for the partially consumed block.
 */
export declare function createCellSliceCursor(blocks: CellRenderBlock[], startLine: number): CellSliceCursor;
/**
 * Content height of a fully rendered cell, using **measurement** semantics.
 *
 * Unlike `describeCellRenderBlocks` + `computeCellSliceContentHeight` (which
 * use renderer semantics and skip last-block spacing.after), this function
 * includes last-block spacing.after via `effectiveTableCellSpacing` to match
 * how `rowMeasure.height` was computed by the measurer. This keeps
 * `getRowContentHeight()` aligned with `rowMeasure.height` so that
 * `hasExplicitRowHeightSlack()` compares like-for-like.
 *
 * Computes in a single pass without allocating intermediate arrays.
 * Returns content height only — cell padding is NOT included.
 */
export declare function computeFullCellContentHeight(cellMeasure: TableCellMeasure, cellBlock: TableCell | undefined, cellPadding: {
    top: number;
    bottom: number;
}): number;
//# sourceMappingURL=table-cell-slice.d.ts.map