import { IRPCProtocol } from '@opensumi/ide-connection';
import { Disposable, IDisposable, IEventBus, IExtensionInfo, ILogger, MaybeNull, URI } from '@opensumi/ide-core-browser';
import { StaticResourceService } from '@opensumi/ide-core-browser/lib/static-resource';
import { CancellationToken, WithEventBus } from '@opensumi/ide-core-common';
import { IResource, WorkbenchEditorService } from '@opensumi/ide-editor';
import { IEditorOpenType } from '@opensumi/ide-editor/lib/browser';
import { IMainLayoutService } from '@opensumi/ide-main-layout';
import { IIconService } from '@opensumi/ide-theme';
import { IEditorWebviewComponent, IWebview, IWebviewService } from '@opensumi/ide-webview';
import { IExtHostWebviewView, IMainThreadWebview, IMainThreadWebviewView, IWebviewExtensionDescription, IWebviewOptions, IWebviewPanelOptions, type ViewBadge, WebviewPanelShowOptions, WebviewViewOptions } from '../../../common/vscode';
import { WebviewViewShouldShowEvent } from '../../components/extension-webview-view';
import { IActivationEventService } from '../../types';
export declare class MainThreadWebview extends Disposable implements IMainThreadWebview {
    private rpcProtocol;
    webviewService: IWebviewService;
    activation: IActivationEventService;
    private webviewPanels;
    private webviews;
    private plainWebviews;
    private webviewPanelStates;
    private proxy;
    private sumiProxy;
    private _hasSerializer;
    private getStorage;
    editorService: WorkbenchEditorService;
    iconService: IIconService;
    eventBus: IEventBus;
    logger: ILogger;
    staticResourceService: StaticResourceService;
    private readonly openerService;
    private readonly commandRegistry;
    private statePersister;
    private extWebviewStorage;
    constructor(rpcProtocol: IRPCProtocol);
    init(): Promise<void>;
    private isSupportedLink;
    initEvents(): void;
    isActive(webviewPanel: WebviewPanel, resource: IResource, openType: MaybeNull<IEditorOpenType>): boolean;
    onChange(): void;
    $createWebviewPanel(id: string, viewType: string, title: string, showOptions: WebviewPanelShowOptions | undefined, options: (IWebviewPanelOptions & IWebviewOptions) | undefined, extension: IExtensionInfo): void;
    pipeBrowserHostedWebviewPanel(webview: IWebview, resourceState: {
        uri: URI;
        openTypeId: string;
    }, viewType: string, options: IWebviewPanelOptions, extension: IExtensionInfo): void;
    reviveWebview(id: string): Promise<void>;
    private onCreateWebviewPanel;
    private doCreateWebviewPanel;
    private getWebviewPanel;
    private hasWebviewPanel;
    $disposeWebview(id: string): void;
    $reveal(id: string, showOptions?: WebviewPanelShowOptions): void;
    $setTitle(id: string, value: string): void;
    $setIconPath(id: string, value: {
        light: string;
        dark: string;
    } | undefined): void;
    connectWebview(id: string, webview: IWebview): IDisposable;
    private getWebview;
    $setHtml(id: string, value: string): void;
    $setOptions(id: string, options: IWebviewOptions): void;
    $postMessage(id: string, value: any): Promise<boolean>;
    $registerSerializer(viewType: string): void;
    $unregisterSerializer(viewType: string): void;
    private _persistWebviewPanelMeta;
    persistWebviewState(viewType: string, id: string, state: any): Promise<void>;
    getPersistedWebviewState(viewType: any, id: any): Promise<any>;
    $connectPlainWebview(id: string): void;
    $postMessageToPlainWebview(id: string, value: any): Promise<boolean>;
    $createPlainWebview(id: string, title: string, iconPath?: string | undefined): Promise<void>;
    $plainWebviewLoadUrl(id: string, uri: string): Promise<void>;
    /**
     * A string that sets the session used by the page.
     *
     * fallback to a generated id.
     */
    $setPlainWebviewPartition(id: string, value?: string): Promise<void>;
    $disposePlainWebview(id: string): Promise<void>;
    $revealPlainWebview(id: string, groupIndex: number): Promise<void>;
    $getWebviewResourceRoots(): Promise<string[]>;
}
declare class WebviewPanel extends Disposable {
    readonly id: string;
    readonly viewType: string;
    readonly resourceState: {
        uri: URI;
        openTypeId: string;
    };
    readonly showOptions: WebviewPanelShowOptions;
    readonly options: IWebviewOptions;
    readonly extensionInfo: IExtensionInfo;
    readonly webview: IWebview;
    readonly editorWebview?: IEditorWebviewComponent<IWebview> | undefined;
    title: string;
    viewColumn: number;
    constructor(id: string, viewType: string, resourceState: {
        uri: URI;
        openTypeId: string;
    }, showOptions: WebviewPanelShowOptions, options: IWebviewOptions, extensionInfo: IExtensionInfo, webview: IWebview, editorWebview?: IEditorWebviewComponent<IWebview> | undefined);
    toJSON(): IWebviewPanelData;
}
export declare class MainThreadWebviewView extends WithEventBus implements IMainThreadWebviewView {
    private mainThreadWebview;
    private _webviewViews;
    private _resolvers;
    proxy: IExtHostWebviewView;
    mainLayout: IMainLayoutService;
    webviewService: IWebviewService;
    constructor(rpcProtocol: IRPCProtocol, mainThreadWebview: MainThreadWebview);
    $registerWebviewViewProvider(extension: IWebviewExtensionDescription, viewType: string, options?: WebviewViewOptions): void;
    $unregisterWebviewViewProvider(viewType: string): void;
    $setWebviewViewTitle(handle: string, value: string | undefined): void;
    $setWebviewViewDescription(handle: string, value: string | undefined): void;
    onWebviewViewShouldShow(e: WebviewViewShouldShowEvent): void;
    resolveWebviewView(container: HTMLElement, viewType: string, title: string, cancellationToken: CancellationToken): IDisposable;
    $setBadge(handle: string, badge?: ViewBadge): void;
    $show(handle: string, preserveFocus: boolean): void;
}
interface IWebviewPanelData {
    id: string;
    viewType: string;
    viewColumn: number;
    webviewOptions: IWebviewOptions & IWebviewPanelOptions;
    title: string;
    extensionInfo: IExtensionInfo;
}
export {};
//# sourceMappingURL=main.thread.api.webview.d.ts.map