import { EventEmitter } from "events";
import PersistentConfig from "./PersistentConfig";
import { default as Tab, PersistedJson as PersistedTabJson } from "./Tab";
import { EndpointSelectConfig, CatalogueItem } from "./endpointSelect";
import * as shareLink from "./linkUtils";
import TabElements from "./TabElements";
import { default as Yasqe, PartialConfig as YasqeConfig, RequestConfig } from "@matdata/yasqe";
import { default as Yasr, Config as YasrConfig } from "@matdata/yasr";
import "@matdata/yasgui-graph-plugin/dist/yasgui-graph-plugin.min.css";
import "@matdata/yasgui-table-plugin/dist/yasgui-table-plugin.min.css";
import { ThemeManager, Theme } from "./ThemeManager";
import QueryBrowser from "./queryManagement/QueryBrowser";
import "./index.scss";
import "./themes.scss";
import "../../yasr/src/scss/global.scss";
import "codemirror/theme/material-palenight.css";
export type YasguiRequestConfig = Omit<RequestConfig<Yasgui>, "adjustQueryBeforeRequest"> & {
    adjustQueryBeforeRequest: RequestConfig<Yasqe>["adjustQueryBeforeRequest"];
};
export interface EndpointButton {
    endpoint: string;
    label: string;
}
export interface EndpointConfig {
    endpoint: string;
    label?: string;
    showAsButton?: boolean;
    authentication?: {
        type: "basic";
        username: string;
        password: string;
    } | {
        type: "bearer";
        token: string;
    } | {
        type: "apiKey";
        headerName: string;
        apiKey: string;
    } | {
        type: "oauth2";
        clientId: string;
        authorizationEndpoint: string;
        tokenEndpoint: string;
        redirectUri?: string;
        scope?: string;
        accessToken?: string;
        idToken?: string;
        refreshToken?: string;
        tokenExpiry?: number;
    };
}
export interface Config<EndpointObject extends CatalogueItem = CatalogueItem> {
    autofocus: boolean;
    endpointInfo: ((tab?: Tab) => Element) | undefined;
    copyEndpointOnNewTab: boolean;
    tabName: string;
    endpointCatalogueOptions: EndpointSelectConfig<EndpointObject>;
    endpointButtons?: EndpointButton[];
    populateFromUrl: boolean | ((configFromUrl: PersistedTabJson) => PersistedTabJson);
    autoAddOnInit: boolean;
    persistenceId: ((yasr: Yasgui) => string) | string | null;
    persistenceLabelConfig: string;
    persistenceLabelResponse: string;
    persistencyExpire: number;
    yasqe: Partial<YasqeConfig>;
    yasr: YasrConfig;
    requestConfig: YasguiRequestConfig;
    contextMenuContainer: HTMLElement | undefined;
    theme?: Theme;
    showThemeToggle?: boolean;
    orientation?: "vertical" | "horizontal";
    showSnippetsBar?: boolean;
}
export type PartialConfig = {
    [P in keyof Config]?: Config[P] extends object ? Partial<Config[P]> : Config[P];
};
export type TabJson = PersistedTabJson;
export interface Yasgui {
    on(event: string | symbol, listener: (...args: any[]) => void): this;
    on(event: "tabSelect", listener: (instance: Yasgui, newTabId: string) => void): this;
    emit(event: "tabSelect", instance: Yasgui, newTabId: string): boolean;
    on(event: "tabClose", listener: (instance: Yasgui, tab: Tab) => void): this;
    emit(event: "tabClose", instance: Yasgui, tab: Tab): boolean;
    on(event: "query", listener: (instance: Yasgui, tab: Tab) => void): this;
    emit(event: "query", instance: Yasgui, tab: Tab): boolean;
    on(event: "queryBefore", listener: (instance: Yasgui, tab: Tab) => void): this;
    emit(event: "queryBefore", instance: Yasgui, tab: Tab): boolean;
    on(event: "queryAbort", listener: (instance: Yasgui, tab: Tab) => void): this;
    emit(event: "queryAbort", instance: Yasgui, tab: Tab): boolean;
    on(event: "queryResponse", listener: (instance: Yasgui, tab: Tab) => void): this;
    emit(event: "queryResponse", instance: Yasgui, tab: Tab): boolean;
    on(event: "tabChange", listener: (instance: Yasgui, tab: Tab) => void): this;
    emit(event: "tabChange", instance: Yasgui, tab: Tab): boolean;
    on(event: "tabAdd", listener: (instance: Yasgui, newTabId: string) => void): this;
    emit(event: "tabAdd", instance: Yasgui, newTabId: string): boolean;
    on(event: "tabOrderChanged", listener: (instance: Yasgui, tabList: string[]) => void): this;
    emit(event: "tabOrderChanged", instance: Yasgui, tabList: string[]): boolean;
    on(event: "fullscreen-enter", listener: (instance: Yasgui) => void): this;
    emit(event: "fullscreen-enter", instance: Yasgui): boolean;
    on(event: "fullscreen-leave", listener: (instance: Yasgui) => void): this;
    emit(event: "fullscreen-leave", instance: Yasgui): boolean;
    on(event: "endpointHistoryChange", listener: (instance: Yasgui, history: string[]) => void): this;
    emit(event: "endpointHistoryChange", instance: Yasgui, history: string[]): boolean;
    on(event: "autocompletionShown", listener: (instance: Yasgui, tab: Tab, widget: any) => void): this;
    emit(event: "autocompletionShown", instance: Yasgui, tab: Tab, widget: any): boolean;
    on(event: "autocompletionClose", listener: (instance: Yasgui, tab: Tab) => void): this;
    emit(event: "autocompletionClose", instance: Yasgui, tab: Tab): boolean;
}
export declare class Yasgui extends EventEmitter {
    rootEl: HTMLDivElement;
    tabElements: TabElements;
    _tabs: {
        [tabId: string]: Tab;
    };
    tabPanelsEl: HTMLDivElement;
    config: Config;
    persistentConfig: PersistentConfig;
    themeManager: ThemeManager;
    queryBrowser: QueryBrowser;
    static Tab: typeof Tab;
    constructor(parent: HTMLElement, config: PartialConfig);
    hasFullscreen(fullscreen: boolean): void;
    getStorageId(label: string, getter?: Config["persistenceId"]): string | undefined;
    createTabName(name?: string, i?: number): string;
    tabNameTaken(name: string): Tab;
    getTab(tabId?: string): Tab | undefined;
    private markTabSelected;
    selectTabId(tabId: string): Tab;
    private tabConfigEquals;
    private findTabIdForConfig;
    private _registerTabListeners;
    _setPanel(panelId: string, panel: HTMLDivElement): void;
    _removePanel(panel: HTMLDivElement | undefined): void;
    addTab(setActive: boolean, partialTabConfig?: Partial<PersistedTabJson>, opts?: {
        atIndex?: number;
        avoidDuplicateTabs?: boolean;
    }): Tab;
    restoreLastTab(): void;
    getTheme(): Theme;
    setTheme(theme: Theme): void;
    toggleTheme(): Theme;
    destroy(): void;
    static linkUtils: typeof shareLink;
    static Yasr: typeof Yasr;
    static Yasqe: typeof Yasqe;
    static defaults: Config<CatalogueItem>;
}
export declare function getRandomId(): string;
export * from "./queryManagement";
export type { Theme } from "./ThemeManager";
export default Yasgui;
