/**
 * Minimal terminal interface for TUI
 */
export interface Terminal {
  start(onInput: (data: string) => void, onResize: () => void): void;
  stop(): void;
  /**
   * Drain stdin before exiting to prevent Kitty key release events from
   * leaking to the parent shell over slow SSH connections.
   * @param maxMs - Maximum time to drain (default: 1000ms)
   * @param idleMs - Exit early if no input arrives within this time (default: 50ms)
   */
  drainInput(maxMs?: number, idleMs?: number): Promise<void>;
  write(data: string): void;
  get columns(): number;
  get rows(): number;
  get kittyProtocolActive(): boolean;
  moveBy(lines: number): void;
  hideCursor(): void;
  showCursor(): void;
  clearLine(): void;
  clearFromCursor(): void;
  clearScreen(): void;
  setTitle(title: string): void;
}
export interface ProcessTerminalOptions {
  useAlternateBuffer?: boolean;
  useMouseTracking?: boolean;
  writeLogPath?: string;
}
/**
 * Real terminal using process.stdin/stdout
 */
export declare class ProcessTerminal implements Terminal {
  private useAlternateBuffer;
  private useMouseTracking;
  private wasRaw;
  private inputHandler?;
  private resizeHandler?;
  private _kittyProtocolActive;
  private alternateBufferActive;
  private mouseTrackingActive;
  private stdinBuffer?;
  private stdinDataHandler?;
  private writeLogPath;
  constructor(options?: ProcessTerminalOptions);
  get kittyProtocolActive(): boolean;
  start(onInput: (data: string) => void, onResize: () => void): void;
  /**
   * Set up StdinBuffer to split batched input into individual sequences.
   * This ensures components receive single events, making matchesKey/isKeyRelease work correctly.
   *
   * Also watches for Kitty protocol response and enables it when detected.
   * This is done here (after stdinBuffer parsing) rather than on raw stdin
   * to handle the case where the response arrives split across multiple events.
   */
  private setupStdinBuffer;
  /**
   * Query terminal for Kitty keyboard protocol support and enable if available.
   *
   * Sends CSI ? u to query current flags. If terminal responds with CSI ? <flags> u,
   * it supports the protocol and we enable it with CSI > 1 u.
   *
   * The response is detected in setupStdinBuffer's data handler, which properly
   * handles the case where the response arrives split across multiple stdin events.
   */
  private queryAndEnableKittyProtocol;
  /**
   * On Windows, add ENABLE_VIRTUAL_TERMINAL_INPUT (0x0200) to the stdin
   * console handle so the terminal sends VT sequences for modified keys
   * (e.g. \x1b[Z for Shift+Tab). Without this, libuv's ReadConsoleInputW
   * discards modifier state and Shift+Tab arrives as plain \t.
   */
  private enableWindowsVTInput;
  drainInput(maxMs?: number, idleMs?: number): Promise<void>;
  stop(): void;
  write(data: string): void;
  private writeRaw;
  get columns(): number;
  get rows(): number;
  moveBy(lines: number): void;
  hideCursor(): void;
  showCursor(): void;
  clearLine(): void;
  clearFromCursor(): void;
  clearScreen(): void;
  setTitle(title: string): void;
}
//# sourceMappingURL=terminal.d.ts.map
