import type { IPitcherClient } from "@codesandbox/pitcher-client";
import { Disposable } from "./utils/disposable";
export declare class PortInfo {
    port: number;
    hostname: string;
    constructor(port: number, hostname: string);
    getPreviewUrl(protocol?: string): string;
    /**
     * Get a signed preview URL using a preview token. Private sandbox previews are inaccessible
     * unless a preview token is provided in the URL (or as a header `csb-preview-token` or cookie
     * `csb_preview_token`).
     *
     * @param token - The preview token to sign the URL with
     * @param protocol - The protocol to use for the preview URL, defaults to `https://`
     * @returns The signed preview URL
     */
    getSignedPreviewUrl(token: string, protocol?: string): string;
}
export declare class Ports extends Disposable {
    private pitcherClient;
    private onDidPortOpenEmitter;
    get onDidPortOpen(): import("./utils/event").Event<PortInfo>;
    private onDidPortCloseEmitter;
    get onDidPortClose(): import("./utils/event").Event<number>;
    private lastOpenedPorts;
    constructor(pitcherClient: IPitcherClient);
    getOpenedPort(port: number): PortInfo | undefined;
    getOpenedPorts(): PortInfo[];
    getPreviewUrl(port: number, protocol?: string): string | undefined;
    /**
     * Wait for a port to be opened.
     *
     * @param port - The port to wait for.
     * @returns A promise that resolves when the port is opened.
     */
    waitForPort(port: number): Promise<PortInfo>;
    /**
     * Get a signed preview URL for a port using a preview token.
     *
     * @param port - The port to get a signed preview URL for
     * @param token - The preview token to sign the URL with
     * @returns The signed preview URL, or undefined if the port is not open
     * @throws {Error} If the port is not open
     */
    getSignedPreviewUrl(port: number, token: string, protocol?: string): string;
}
