/**
 * @file highlightRanges.ts
 * @input Line divs, per-line token arrays, CSS Custom Highlight API
 * @output Creates/removes highlight Range objects for syntax coloring
 * @position Shared utility consumed by CodeBlock (ranges mode)
 *
 * Tokens are per-line with line-relative offsets, so we map directly
 * from line div → text node → Range. No global text-node map, no
 * binary search, no TreeWalker.
 */
import type { TokenLine } from './tokenizer';
interface RangeEntry {
    range: Range;
    highlight: Highlight;
}
declare function cleanupRanges(ranges: RangeEntry[]): void;
/**
 * Apply CSS Custom Highlight API ranges lazily as content-visibility
 * chunks scroll into view. Visible chunks get ranges immediately;
 * offscreen chunks get ranges when `contentvisibilityautostatechange`
 * fires. Ranges are removed when chunks scroll back offscreen to
 * keep memory usage proportional to the viewport.
 *
 * For small files (no chunk wrappers / below LINE_CHUNK_THRESHOLD),
 * all lines are direct children and get ranges immediately.
 *
 * @param codeEl - The <code> element containing line divs (possibly inside chunk wrappers)
 * @param tokenLines - Per-line token arrays from the tokenizer
 * @returns Cleanup function that removes all ranges and event listeners
 */
export declare function applyHighlightRangesChunked(codeEl: HTMLElement, tokenLines: TokenLine[]): () => void;
/**
 * Apply highlight ranges for a batch of lines starting at a given
 * line index. Used by the streaming tokenizer to apply highlights
 * progressively as tokens arrive.
 */
export declare function applyHighlightRangesBatch(codeEl: HTMLElement, tokenLines: TokenLine[], startLine: number): RangeEntry[];
/**
 * Apply CSS Custom Highlight API ranges to a flat element (no [data-line]
 * structure). Works with contentEditable="plaintext-only" where all text
 * may be a single Text node with embedded newlines.
 *
 * @param el - The element containing text (e.g. contentEditable code element)
 * @param tokenLines - Per-line token arrays from the tokenizer
 * @returns Cleanup function that removes all ranges
 */
export declare function applyHighlightRangesFlat(el: HTMLElement, tokenLines: TokenLine[]): () => void;
/**
 * Cleanup a batch of ranges (returned from applyHighlightRangesBatch).
 */
export { cleanupRanges };
//# sourceMappingURL=highlightRanges.d.ts.map