import { type BridgeCapability, type BridgeCapabilitySet, type BridgeCommandName, type BridgeCommandPayloadByName, type BridgeEvent, type BridgeEventName, type BridgeEventPayloadByName, type BridgeRuntimeInfo, type BridgeVersion } from "./protocol";
export type BridgeConnectionStatus = "connecting" | "ready" | "incompatible" | "unreachable";
export type BridgeDiagnostics = {
    status: BridgeConnectionStatus;
    editorVersion: BridgeVersion;
    hostVersion?: BridgeVersion;
    compatible?: boolean;
    hostOrigin?: string;
    hostAdvertisedCapabilities: BridgeCapabilitySet;
    acknowledgedCapabilities: BridgeCapabilitySet;
    runtime?: BridgeRuntimeInfo;
    lastError?: {
        message: string;
        at: number;
    };
};
export type BridgeClientOptions = {
    iframe: HTMLIFrameElement;
    editorOrigin: string;
    allowedHostOrigins: string[];
    onEvent?: (event: BridgeEvent, client: BridgeClient) => void;
    onError?: (error: Error, client: BridgeClient) => void;
    onReadyChange?: (ready: boolean) => void;
    readyTimeoutMs?: number;
};
export declare class BridgeClient {
    private iframe;
    private editorOrigin;
    private allowedHostOrigins;
    private onEvent?;
    private onError?;
    private onReadyChange?;
    private readyTimeoutMs;
    private readyTimeoutId?;
    private hostOrigin?;
    private connected;
    private ready;
    private status;
    private hostVersion?;
    private compatible?;
    private hostAdvertisedCapabilities;
    private acknowledgedCapabilities;
    private hostRuntime?;
    private lastError?;
    private helloIntervalId?;
    private pendingRequests;
    constructor(options: BridgeClientOptions);
    connect(): void;
    disconnect(): void;
    isReady(): boolean;
    supportsCapability(capability: BridgeCapability): boolean;
    sendCommand<TName extends BridgeCommandName>(name: TName, payload: BridgeCommandPayloadByName[TName], options?: {
        requestId?: string;
    }): boolean;
    requestCommand<TCommandName extends BridgeCommandName, TEventName extends BridgeEventName>(name: TCommandName, payload: BridgeCommandPayloadByName[TCommandName], expectedEventName: TEventName, options?: {
        requestId?: string;
        timeoutMs?: number;
    }): Promise<BridgeEventPayloadByName[TEventName]>;
    getEditorOrigin(): string;
    getAcknowledgedCapabilities(): BridgeCapabilitySet;
    getDiagnostics(): BridgeDiagnostics;
    private handleMessage;
    private handleReady;
    private resolvePendingRequest;
    private rejectPendingRequests;
    private armReadyTimeout;
    private clearReadyTimeout;
    private armHelloHandshake;
    private sendHello;
    private clearHelloHandshake;
    private getAllowedOrigins;
    private getConfiguredHostOrigin;
}
