import { type ZoomLimits } from "./camera.js";
import { type InputOptions } from "./input.js";
import type { SessionDiagnostics, SessionRaster, ViewerSessionLike } from "./session.js";
/** Structured load/init failure. */
export type ViewerErrorCode = "PARSE_ERROR" | "UNSUPPORTED" | "GPU_UNAVAILABLE";
export declare class ViewerError extends Error {
    readonly code: ViewerErrorCode;
    readonly diagnostics: SessionDiagnostics | undefined;
    constructor(code: ViewerErrorCode, message: string, diagnostics?: SessionDiagnostics);
}
export type LayoutMode = "single" | "continuous";
export interface ViewerEvents extends Record<string, unknown> {
    loaded: {
        pageCount: number;
    };
    pageChanged: {
        page: number;
    };
    zoomChanged: {
        zoom: number;
    };
    scrollChanged: {
        x: number;
        y: number;
    };
    error: ViewerError;
}
export interface CreateViewerOptions {
    canvas: HTMLCanvasElement;
    /**
     * The wasm session (or a factory). Embedders typically pass
     * `await ViewerSession.new()` from `@paged-media/sdk` after
     * `init(wasmUrl)`; tests pass a fake.
     */
    session: ViewerSessionLike | (() => Promise<ViewerSessionLike>);
    /** Zoom clamps in CSS px per pt. Default `{ min: 0.1, max: 8 }`. */
    zoomLimits?: Partial<ZoomLimits>;
    /** Input lanes; each defaults to enabled. */
    input?: InputOptions;
    /** Initial layout mode. Default `"continuous"`. */
    layoutMode?: LayoutMode;
    /**
     * Frame scheduler — injectable for tests. Defaults to
     * `requestAnimationFrame` (microtask fallback off-DOM).
     */
    schedule?: (frame: () => void) => void;
    /** Device pixel ratio override (defaults to `window.devicePixelRatio`). */
    devicePixelRatio?: number;
}
export interface Viewer {
    load(source: ArrayBuffer | Uint8Array | Blob | string): Promise<void>;
    readonly zoom: number;
    setZoom(zoom: number, opts?: {
        anchor?: {
            x: number;
            y: number;
        };
    }): void;
    zoomIn(): void;
    zoomOut(): void;
    fit(mode: "page" | "width"): void;
    readonly minZoom: number;
    readonly maxZoom: number;
    readonly scroll: {
        x: number;
        y: number;
    };
    scrollTo(x: number, y: number): void;
    scrollBy(dx: number, dy: number): void;
    readonly pageCount: number;
    readonly currentPage: number;
    goToPage(index: number): void;
    layoutMode(mode?: LayoutMode): LayoutMode;
    renderPageThumbnail(index: number, opts?: {
        width?: number;
    }): Promise<SessionRaster>;
    on<K extends keyof ViewerEvents>(event: K, listener: (payload: ViewerEvents[K]) => void): () => void;
    dispose(): void;
}
export declare function createViewer(options: CreateViewerOptions): Promise<Viewer>;
