/**
 * Browser Manager
 *
 * OpenClaw-inspired browser automation using Playwright for CDP control.
 * Provides:
 * - Tab management
 * - Smart Snapshot for element references
 * - Navigation and interaction
 * - Media capture (screenshots, PDFs)
 * - Device emulation
 */
import { EventEmitter } from 'events';
import { BrowserTab, WebElement, WebSnapshot, SnapshotOptions, ClickOptions, TypeOptions, FillOptions, ScrollOptions, SelectOptions, NavigateOptions, ScreenshotOptions, PDFOptions, Cookie, DeviceConfig, GeolocationConfig, EvaluateOptions, EvaluateResult, DialogAction, FileUploadOptions, BrowserConfig, ConsoleEntry, RouteRule, ExtendedDeviceConfig } from './types.js';
export declare class BrowserManager extends EventEmitter {
    private config;
    private browser;
    private context;
    private pages;
    private currentPageId;
    private currentSnapshot;
    private nextRef;
    private playwright;
    private consoleBuffer;
    private static readonly MAX_CONSOLE_ENTRIES;
    private _routeInterceptor;
    private _profileManager;
    constructor(config?: Partial<BrowserConfig>);
    /**
     * Launch browser
     */
    launch(): Promise<void>;
    /**
     * Connect to existing browser via CDP
     */
    connect(cdpUrl: string): Promise<void>;
    /**
     * Close browser
     */
    close(): Promise<void>;
    private setupPageListeners;
    /**
     * List all tabs
     */
    getTabs(): Promise<BrowserTab[]>;
    /**
     * Create new tab
     */
    newTab(url?: string): Promise<BrowserTab>;
    /**
     * Focus tab
     */
    focusTab(tabId: string): Promise<void>;
    /**
     * Close tab
     */
    closeTab(tabId: string): Promise<void>;
    /**
     * Take snapshot of current page
     */
    /**
     * Get next available ref number (for shared ref space with desktop)
     */
    getNextRef(): number;
    takeSnapshot(options?: SnapshotOptions): Promise<WebSnapshot>;
    /**
     * Extract elements from page
     */
    private extractElements;
    private isInteractiveRole;
    private roleToTagName;
    /**
     * Get element by reference
     */
    getElement(ref: number): WebElement | undefined;
    /**
     * Generate text representation for AI
     */
    toTextRepresentation(snapshot?: WebSnapshot): string;
    /**
     * Navigate to URL
     */
    navigate(options: NavigateOptions): Promise<void>;
    /**
     * Go back
     */
    goBack(): Promise<void>;
    /**
     * Go forward
     */
    goForward(): Promise<void>;
    /**
     * Reload page
     */
    reload(): Promise<void>;
    /**
     * Click element by reference
     */
    click(ref: number, options?: ClickOptions): Promise<void>;
    /**
     * Type text into element
     */
    type(ref: number, text: string, options?: TypeOptions): Promise<void>;
    /**
     * Fill multiple fields
     */
    fill(options: FillOptions): Promise<void>;
    /**
     * Scroll page
     */
    scroll(options: ScrollOptions): Promise<void>;
    /**
     * Select option in dropdown
     */
    select(options: SelectOptions): Promise<void>;
    /**
     * Press keyboard key
     */
    press(key: string, modifiers?: string[]): Promise<void>;
    /**
     * Hover over element
     */
    hover(ref: number): Promise<void>;
    /**
     * Take screenshot
     */
    screenshot(options?: ScreenshotOptions): Promise<Buffer>;
    /**
     * Generate PDF
     */
    pdf(options?: PDFOptions): Promise<Buffer>;
    /**
     * Get cookies
     */
    getCookies(urls?: string[]): Promise<Cookie[]>;
    /**
     * Set cookies
     */
    setCookies(cookies: Cookie[]): Promise<void>;
    /**
     * Clear cookies
     */
    clearCookies(): Promise<void>;
    /**
     * Set extra headers
     */
    setHeaders(headers: Record<string, string>): Promise<void>;
    /**
     * Set offline mode
     */
    setOffline(offline: boolean): Promise<void>;
    /**
     * Emulate device
     */
    emulateDevice(device: DeviceConfig): Promise<void>;
    /**
     * Set geolocation
     */
    setGeolocation(geo: GeolocationConfig): Promise<void>;
    /**
     * Evaluate JavaScript in page context
     */
    evaluate(options: EvaluateOptions): Promise<EvaluateResult>;
    /**
     * Get page content
     */
    getContent(): Promise<string>;
    /**
     * Get page title
     */
    getTitle(): Promise<string>;
    /**
     * Get page URL
     */
    getUrl(): string;
    /**
     * Handle dialog
     */
    handleDialog(action: DialogAction): Promise<void>;
    /**
     * Upload files
     */
    uploadFiles(options: FileUploadOptions): Promise<void>;
    private getCurrentPage;
    /**
     * Check if browser is launched
     */
    isLaunched(): boolean;
    /**
     * Get console history buffer
     */
    getConsoleHistory(type?: string, limit?: number): ConsoleEntry[];
    /**
     * Clear console history buffer
     */
    clearConsoleHistory(): void;
    /**
     * Get localStorage for the current page's origin
     */
    getLocalStorage(): Promise<Record<string, string>>;
    /**
     * Set localStorage entries for the current page
     */
    setLocalStorage(data: Record<string, string>): Promise<void>;
    /**
     * Get sessionStorage for the current page's origin
     */
    getSessionStorage(): Promise<Record<string, string>>;
    /**
     * Set sessionStorage entries for the current page
     */
    setSessionStorage(data: Record<string, string>): Promise<void>;
    /**
     * Set timezone for the browser context
     */
    setTimezone(timezoneId: string): Promise<void>;
    /**
     * Set locale for the browser context
     */
    setLocale(locale: string): Promise<void>;
    /**
     * Set color scheme preference
     */
    setColorScheme(colorScheme: 'light' | 'dark' | 'no-preference'): Promise<void>;
    /**
     * Grant permissions to the browser context
     */
    grantPermissions(permissions: string[]): Promise<void>;
    /**
     * Extended device emulation with timezone, locale, colorScheme, permissions
     */
    emulateDeviceExtended(device: ExtendedDeviceConfig): Promise<void>;
    private getProfileManager;
    /**
     * Save current browser state as a named profile
     */
    saveProfile(name: string): Promise<void>;
    /**
     * Load a named profile into the browser
     */
    loadProfile(name: string): Promise<boolean>;
    private getRouteInterceptor;
    /**
     * Add a route interception rule
     */
    addRouteRule(rule: RouteRule): Promise<void>;
    /**
     * Remove a route interception rule
     */
    removeRouteRule(ruleId: string): Promise<void>;
    /**
     * List active route rules
     */
    listRouteRules(): RouteRule[];
    /**
     * Clear all route rules
     */
    clearRouteRules(): Promise<void>;
    /**
     * Get current snapshot
     */
    getCurrentSnapshot(): WebSnapshot | null;
}
export declare function getBrowserManager(config?: Partial<BrowserConfig>): BrowserManager;
export declare function resetBrowserManager(): void;
export default BrowserManager;
