/**
 * @license
 * Copyright 2026 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import { StyledLine } from '../styled-line.js';
export declare const rainbowColors: string[];
export type RenderLine = {
    styledChars: StyledLine;
    text: string;
    length: number;
    tainted: boolean;
};
export declare function linesEqual(lineA: StyledLine | undefined, lineB: StyledLine | undefined): boolean;
/**
 * Low level terminal renderer.
 *
 * This class makes it robust and simple to perform efficient incremental updates to the
 * terminal, scroll regions, and inject content into the backbuffer.
 * It handles caching what content was previously rendered and operations
 * such as syncing individual lines without generating flicker, adding
 * lines to the backbuffer, and scrolling content onto the backbuffer.
 */
export declare class TerminalWriter {
    private columns;
    private rows;
    readonly stdout: NodeJS.WriteStream;
    isTainted: boolean;
    debugRainbowColor?: string;
    backbufferDirty: boolean;
    backbufferScrolledIncorrectly: boolean;
    backbufferDirtyCurrentFrame: boolean;
    fullRenderTimeout?: NodeJS.Timeout;
    maxScrollbackLength: number;
    forceScrollToBottomOnBackbufferRefresh: boolean;
    private linesUpdated;
    private screen;
    private backbuffer;
    private cursorX;
    private cursorY;
    private targetCursorX;
    private targetCursorY;
    private scrollRegionTop;
    private scrollRegionBottom;
    private firstRender;
    private readonly enableSynchronizedOutput;
    private cancelSlowFlush;
    private isDone;
    private outputBuffer;
    private currentChunkBuffer;
    constructor(columns: number, rows: number, stdout: NodeJS.WriteStream);
    getLinesUpdated(): number;
    resetLinesUpdated(): void;
    unkownCursorLocation(): void;
    writeRaw(text: string): void;
    taintScreen(): void;
    getBackbufferLength(): number;
    getBackbufferEntry(index: number): RenderLine | undefined;
    getScreenLine(y: number): RenderLine | undefined;
    setBackbuffer(lines: RenderLine[]): void;
    get isFirstRender(): boolean;
    appendLinesBackbuffer(lines: RenderLine[]): void;
    updateBackbuffer(start: number, deleteCount: number, newLines: RenderLine[]): void;
    syncLines(lines: RenderLine[]): void;
    writeLines(lines: RenderLine[]): void;
    setTargetCursorPosition(row: number, col: number): void;
    getExpectedState(): {
        backbuffer: RenderLine[];
        screen: RenderLine[];
        cursorX: number;
        cursorY: number;
    };
    finish(): void;
    done(): void;
    moveCursor(x: number, y: number): void;
    clampLine(line: StyledLine | undefined, width: number): RenderLine;
    syncLine(line: RenderLine, y: number): void;
    scrollLines(options: {
        start: number;
        end: number;
        linesToScroll: number;
        lines: RenderLine[];
        direction: 'up' | 'down';
        scrollToBackbuffer: boolean;
    }): void;
    resize(columns: number, rows: number): void;
    clear(_options?: {
        readonly keepTrackingMaps?: boolean;
    }): void;
    startSynchronizedOutput(): void;
    endSynchronizedOutput(): void;
    flush(): void;
    /**
     * Testing only method that flushes content slowly to simplify debugging
     * hard to diagnose issues.
     *
     * If there are bugs in terminal-writer a good way to debug is to call
     * slowFlush instead of flush() so you can see the incremental states the
     * terminal goes through applying the changes.
     */
    slowFlush(): Promise<void>;
    validateLinesConsistent(lines: RenderLine[]): void;
    private shiftScreenUp;
    /**
     * Trigger a scroll up of content into the backbuffer.
     */
    private applyScrollUpBackbuffer;
    private applyScrollUp;
    private applyScrollDown;
    private performScroll;
    private synchronizedWrite;
    private resetScrollRegion;
    private setScrollRegion;
    private writeHelper;
    private finishChunkAndUpdateCursor;
}
