import { EventEmitter } from "events";
import { default as Yasqe } from "@matdata/yasqe";
import { default as Yasr, Parser, PersistentConfig as YasrPersistentConfig } from "@matdata/yasr";
import * as shareLink from "./linkUtils";
import "./tab.scss";
import { default as Yasgui, YasguiRequestConfig } from "./";
import type { ManagedTabMetadata } from "./queryManagement/types";
export interface PersistedJsonYasr extends YasrPersistentConfig {
    responseSummary: Parser.ResponseSummary;
}
export interface PersistedJson {
    name: string;
    id: string;
    yasqe: {
        value: string;
        editorHeight?: string;
    };
    yasr: {
        settings: YasrPersistentConfig;
        response: Parser.ResponseSummary | undefined;
    };
    requestConfig: YasguiRequestConfig;
    orientation?: "vertical" | "horizontal";
    managedQuery?: ManagedTabMetadata;
}
export interface Tab {
    on(event: string | symbol, listener: (...args: any[]) => void): this;
    on(event: "change", listener: (tab: Tab, config: PersistedJson) => void): this;
    emit(event: "change", tab: Tab, config: PersistedJson): boolean;
    on(event: "query", listener: (tab: Tab) => void): this;
    emit(event: "query", tab: Tab): boolean;
    on(event: "queryBefore", listener: (tab: Tab) => void): this;
    emit(event: "queryBefore", tab: Tab): boolean;
    on(event: "queryAbort", listener: (tab: Tab) => void): this;
    emit(event: "queryAbort", tab: Tab): boolean;
    on(event: "queryResponse", listener: (tab: Tab) => void): this;
    emit(event: "queryResponse", tab: Tab): boolean;
    on(event: "close", listener: (tab: Tab) => void): this;
    emit(event: "close", tab: Tab): boolean;
    on(event: "endpointChange", listener: (tab: Tab, endpoint: string) => void): this;
    emit(event: "endpointChange", tab: Tab, endpoint: string): boolean;
    on(event: "autocompletionShown", listener: (tab: Tab, widget: any) => void): this;
    emit(event: "autocompletionShown", tab: Tab, widget: any): boolean;
    on(event: "autocompletionClose", listener: (tab: Tab) => void): this;
    emit(event: "autocompletionClose", tab: Tab): boolean;
}
export declare class Tab extends EventEmitter {
    private persistentJson;
    yasgui: Yasgui;
    private yasqe;
    private yasr;
    private rootEl;
    private controlBarEl;
    private yasqeWrapperEl;
    private yasrWrapperEl;
    private endpointSelect;
    private endpointButtonsContainer;
    private endpointOverflowButton;
    private endpointOverflowDropdown;
    private endpointButtonConfigs;
    private resizeObserver;
    private settingsModal?;
    private currentOrientation;
    private orientationToggleButton?;
    private verticalResizerEl?;
    private editorWrapperEl?;
    constructor(yasgui: Yasgui, conf: PersistedJson);
    name(): string;
    getPersistedJson(): PersistedJson;
    getId(): string;
    getManagedQueryMetadata(): ManagedTabMetadata | undefined;
    setManagedQueryMetadata(metadata: ManagedTabMetadata | undefined): void;
    isManagedQueryTab(): boolean;
    hasUnsavedManagedChanges(): boolean;
    private getDefaultSaveModalValues;
    private getManagedQueryIdFromMetadata;
    private versionRefFromVersionTag;
    private getQueryTextForSave;
    saveManagedQueryOrSaveAsManagedQuery(): Promise<void>;
    saveAsManagedQuery(): Promise<void>;
    private draw;
    hide(): void;
    show(): void;
    private handleKeyDown;
    private attachKeyboardListeners;
    private detachKeyboardListeners;
    select(): void;
    close(): void;
    private closeNow;
    getQuery(): any;
    setQuery(query: string): this;
    getRequestConfig(): YasguiRequestConfig;
    private initControlbar;
    private initOrientationToggle;
    updateOrientationToggleIcon(): void;
    toggleOrientation(): void;
    getYasqe(): Yasqe;
    getYasr(): Yasr;
    private initTabSettingsMenu;
    private initEndpointSelectField;
    private initEndpointButtons;
    private initEndpointButtonsResizeObserver;
    private updateEndpointButtonsOverflow;
    private showOverflowButton;
    private hideOverflowButton;
    private toggleOverflowDropdown;
    private openOverflowDropdown;
    private closeOverflowDropdown;
    refreshEndpointButtons(): void;
    setEndpoint(endpoint: string, endpointHistory?: string[]): this;
    getEndpoint(): string;
    updateContextMenu(): void;
    getShareableLink(baseURL?: string): string;
    getShareObject(): shareLink.ShareConfigObject;
    private getTabListEl;
    setName(newName: string): this;
    private suggestManagedFilenameFromName;
    renameTab(newName: string): Promise<void>;
    hasResults(): boolean;
    getName(): string;
    query(): Promise<any>;
    setRequestConfig(requestConfig: Partial<YasguiRequestConfig>): void;
    private getAuthForCurrentEndpoint;
    private ensureOAuth2TokenValid;
    private getStaticRequestConfig;
    private initYasqe;
    private updateSaveButtonVisibility;
    private initSaveManagedQueryIcon;
    private destroyYasqe;
    handleYasqeBlur: (yasqe: Yasqe) => void;
    handleYasqeQuery: (yasqe: Yasqe) => void;
    handleYasqeQueryAbort: () => void;
    handleYasqeQueryBefore: () => void;
    handleYasqeResize: (_yasqe: Yasqe, newSize: string) => void;
    handleAutocompletionShown: (_yasqe: Yasqe, widget: string) => void;
    handleAutocompletionClose: (_yasqe: Yasqe) => void;
    handleQueryResponse: (_yasqe: Yasqe, response: any, duration: number) => void;
    private handleYasqeMouseDown;
    private executeBackgroundQuery;
    private attachYasqeMouseHandler;
    private detachYasqeMouseHandler;
    private initYasr;
    private drawVerticalResizer;
    private initVerticalDrag;
    private calculateVerticalDragOffset;
    private doVerticalDrag;
    private stopVerticalDrag;
    private resetVerticalSplit;
    destroy(): void;
    static getDefaults(yasgui?: Yasgui): PersistedJson;
}
export default Tab;
