// Ambient module shims. Must stay script-scoped (no top-level imports /
// exports) so `declare module` registers globally; adding an import/export
// turns the file into a module and scopes the declaration away.

declare module "@chenglou/pretext" {
  export interface PretextLayoutLine {
    text: string;
  }

  export interface PretextLayoutResult {
    height: number;
    lineCount: number;
    lines: PretextLayoutLine[];
  }

  export function prepare(
    text: string,
    font: string,
    options?: Record<string, unknown>,
  ): unknown;

  export function prepareWithSegments(
    text: string,
    font: string,
    options?: Record<string, unknown>,
  ): unknown;

  export function layout(
    prepared: unknown,
    maxWidth: number,
    lineHeight: number,
  ): PretextLayoutResult;

  export function layoutWithLines(
    prepared: unknown,
    maxWidth: number,
    lineHeight: number,
  ): PretextLayoutResult;
}
