import { BrowserContext, Page } from 'playwright';
import { EventEmitter } from 'events';
import { IBrowserSession, SessionState, SessionConfig, InteractionEvent, PreviewInteractionEvent, DOMUpdate } from '../types';
/**
 * BrowserSession manages a single browser context and page
 * Provides streaming capabilities for DOM updates and user interactions
 */
export declare class BrowserSession extends EventEmitter implements IBrowserSession {
    readonly sessionId: string;
    readonly context: BrowserContext;
    readonly page: Page;
    state: SessionState;
    private updateQueue;
    private observers;
    private htmlDebounceTimer;
    private lastHtmlSnapshot;
    constructor(sessionId: string, context: BrowserContext, page: Page, sessionConfig: SessionConfig);
    /**
     * Static factory method to create a new browser session
     */
    static create(sessionConfig: SessionConfig): Promise<BrowserSession>;
    /**
     * Setup page event listeners for streaming
     */
    private setupPageListeners;
    /**
     * Emit a DOM update to all observers
     */
    private emitUpdate;
    /**
     * Subscribe to DOM updates
     */
    subscribe(observer: (update: DOMUpdate) => void): () => void;
    /**
     * Navigate to a URL
     */
    navigate(url: string): Promise<void>;
    /**
     * Rewrite links and prevent default navigation
     * This is mainly to prevent the page from navigating away in the browser context
     */
    private rewriteLinks;
    /**
     * Handle user interactions
     */
    interact(event: InteractionEvent): Promise<void>;
    /**
     * Emit HTML snapshot with debouncing
     */
    private emitHtmlSnapshot;
    /**
     * Handle preview interactions from the live HTML preview
     */
    handlePreviewInteraction(event: PreviewInteractionEvent): Promise<void>;
    /**
     * Get current page HTML
     */
    getHTML(): Promise<string>;
    /**
     * Get current page screenshot
     */
    getScreenshot(): Promise<Buffer>;
    /**
     * Update last activity timestamp
     */
    private updateLastActivity;
    /**
     * Check if session is idle
     */
    isIdle(): boolean;
    /**
     * Close the browser session
     */
    close(): Promise<void>;
}
//# sourceMappingURL=BrowserSession.d.ts.map