import type { Cell } from '../cell/cell'; import { type CellRangeBoundaries } from '../utils/coordinate'; /** Re-export under the plan's canonical name. */ export type CellRange = CellRangeBoundaries; /** Build a CellRange from explicit 1-based bounds. */ export declare function makeCellRange(minRow: number, minCol: number, maxRow: number, maxCol: number): CellRange; /** Parse a range expression — wraps {@link rangeBoundaries}. */ export declare function parseRange(input: string): CellRange; /** Format a CellRange back into the canonical OOXML string. */ export declare function rangeToString(r: CellRange): string; /** * Compute the bounding A1-style range string for a list of cells. Walks the * input once to find min/max row+col. A single-cell input returns a single-cell * ref (`"A1"`); two or more cells (even collinear) return the `"A1:B5"` form. * * Throws when the array is empty — there's no meaningful zero-cell range, and * silently returning `""` would defeat downstream `parseRange` consumers. */ export declare function cellRangeFromCells(cells: ReadonlyArray>): string; /** Inclusive containment of a single (row, col) within a range. */ export declare function rangeContainsCell(r: CellRange, row: number, col: number): boolean; /** * A1-string convenience for {@link rangeContainsCell}. Parses `cellRef` (e.g. * `"B3"`) and `rangeRef` (e.g. `"A1:C5"`) and returns `true` iff the cell sits * inside the range (boundary-inclusive). Throws when either input is malformed. */ export declare function isCellInRange(cellRef: string, rangeRef: string): boolean; /** * A1-string convenience for {@link rangeContainsRange}. Returns `true` iff the * `inner` range is wholly contained by `outer` (boundary-inclusive). * Single-cell refs are accepted on either side via parseRange. Throws on * malformed input. */ export declare function isRangeInRange(inner: string, outer: string): boolean; /** * A1-string convenience for {@link rangesOverlap}. Returns `true` iff the two * ranges share at least one cell. Boundary-inclusive (a 1-row gap = no * overlap). Single-cell refs are accepted via parseRange. Throws on malformed * input. */ export declare function rangesOverlapStr(a: string, b: string): boolean; /** * A1-string convenience for {@link unionRange}. Returns the smallest A1 range * that contains both inputs (always non-null; ranges that don't overlap still * get a valid bounding box). */ export declare function unionRangeStr(a: string, b: string): string; /** * A1-string convenience for {@link intersectionRange}. Returns the shared * rectangular sub-range as A1 string, or `undefined` when the inputs are * disjoint. */ export declare function intersectionRangeStr(a: string, b: string): string | undefined; /** * A1-string convenience for {@link shiftRange}. Translates the range by `(dr, * dc)` integer offsets and re-serialises. Negative offsets shift up/left. * Throws when the resulting bounds fall outside the OOXML grid (rows * 1..1048576, cols 1..16384). */ export declare function shiftRangeStr(range: string, dr: number, dc: number): string; /** * A1-string convenience for {@link rangeArea}. Returns the inclusive cell count * covered by the range (rows × cols). Single-cell refs return 1. */ export declare function rangeAreaStr(range: string): number; /** * A1-string range dimensions: how many rows and columns the range spans * (inclusive). Distinct from {@link rangeAreaStr} which returns the product. * Single-cell refs return `{ rows: 1, cols: 1 }`. */ export declare function rangeDimensionsStr(range: string): { rows: number; cols: number; }; /** * Expand (or shrink) an A1 range by adding `deltaRows` to its bottom edge and * `deltaCols` to its right edge. The top-left corner is preserved. Negative * deltas shrink the range; the result must still have at least 1 row and 1 * column (otherwise throws). * * Useful for "this is the data range — also reserve room for a totals row" or * "include one more column to the right" patterns. */ export declare function expandRangeStr(range: string, deltaRows: number, deltaCols: number): string; /** Inclusive containment of `inner` within `outer`. */ export declare function rangeContainsRange(outer: CellRange, inner: CellRange): boolean; /** * Shift a range by (dr, dc) integer offsets. The returned range is clamped to * the OOXML grid; callers that want hard bounds should pass values that keep * the result inside the spec. */ export declare function shiftRange(r: CellRange, dr: number, dc: number): CellRange; /** Bounding-box union of two ranges. Always non-null. */ export declare function unionRange(a: CellRange, b: CellRange): CellRange; /** Returns the rectangular intersection of two ranges, or `null` when disjoint. */ export declare function intersectionRange(a: CellRange, b: CellRange): CellRange | null; /** True iff two ranges share at least one cell. */ export declare function rangesOverlap(a: CellRange, b: CellRange): boolean; /** Inclusive cell count covered by a range. */ export declare function rangeArea(r: CellRange): number; /** Yield every (row, col) coordinate in the range, row-major. */ export declare function iterRangeCoordinates(r: CellRange): IterableIterator<{ row: number; col: number; }>; /** * Excel's `sqref` attribute: a space-separated list of CellRanges. Used by data * validations, conditional formatting, hyperlinks etc. */ export interface MultiCellRange { ranges: CellRange[]; } export declare function makeMultiCellRange(ranges?: ReadonlyArray): MultiCellRange; /** Parse an sqref string: `"A1:B2 D5 E10:F20"`. Whitespace-delimited. */ export declare function parseMultiCellRange(input: string): MultiCellRange; /** Format a MultiCellRange back into an sqref string. */ export declare function multiCellRangeToString(m: MultiCellRange): string; /** Total cell count across all ranges (no de-duplication of overlaps). */ export declare function multiCellRangeArea(m: MultiCellRange): number; /** True iff any contained range covers (row, col). */ export declare function multiCellRangeContainsCell(m: MultiCellRange, row: number, col: number): boolean;