import type { ReactNode } from "react";
import { IHostConfigResponse } from "@streamlit/lib/src/hostComm/types";
import type { BaseUriParts } from "@streamlit/lib/src/util/UriUtil";
import { SessionInfo } from "@streamlit/lib/src/SessionInfo";
import type { StreamlitEndpoints } from "@streamlit/lib/src/StreamlitEndpoints";
import { BackMsg, ForwardMsg } from "@streamlit/lib/src/proto";
import { ConnectionState } from "@streamlit/app/src/connection/ConnectionState";
import type { StliteKernel } from "../../kernel";
interface Props {
    /**
     * Kernel object to connect to.
     */
    kernel: StliteKernel;
    /** The app's SessionInfo instance */
    sessionInfo: SessionInfo;
    /** The app's StreamlitEndpoints instance */
    endpoints: StreamlitEndpoints;
    /**
     * Function to be called when we receive a message from the server.
     */
    onMessage: (message: ForwardMsg) => void;
    /**
     * Function to be called when the connection errors out.
     */
    onConnectionError: (errNode: ReactNode) => void;
    /**
     * Called when our ConnectionState is changed.
     */
    connectionStateChanged: (connectionState: ConnectionState) => void;
    /**
     * Function to get the auth token set by the host of this app (if in a
     * relevant deployment scenario).
     */
    claimHostAuthToken: () => Promise<string | undefined>;
    /**
     * Function to clear the withHostCommunication hoc's auth token. This should
     * be called after the promise returned by claimHostAuthToken successfully
     * resolves.
     */
    resetHostAuthToken: () => void;
    /**
     * Function to set the host config for this app (if in a relevant deployment
     * scenario).
     */
    onHostConfigResp: (resp: IHostConfigResponse) => void;
}
/**
 * Manages our connection to the Server.
 */
export declare class ConnectionManager {
    private readonly props;
    private connectionState;
    constructor(props: Props);
    /**
     * Indicates whether we're connected to the server.
     */
    isConnected(): boolean;
    /**
     * Return the BaseUriParts for the server we're connected to,
     * if we are connected to a server.
     */
    getBaseUriParts(): BaseUriParts | undefined;
    sendMessage(obj: BackMsg): void;
    /**
     * To guarantee packet transmission order, this is the index of the last
     * dispatched incoming message.
     */
    private lastDispatchedMessageIndex;
    /**
     * And this is the index of the next message we receive.
     */
    private nextMessageIndex;
    /**
     * This dictionary stores received messages that we haven't sent out yet
     * (because we're still decoding previous messages)
     */
    private readonly messageQueue;
    /**
     * No-op in stlite.
     */
    incrementMessageCacheRunCount(): void;
    /**
     * No-op in stlite.
     */
    disconnect(): void;
    private handleMessage;
    private connect;
    private setConnectionState;
}
export {};
