import { EventEmitter2 } from "@inweb/eventemitter2";
import { Assembly, Client, File, Model } from "@inweb/client";
import { CanvasEventMap, FileSource, IComponent, IDragger, IInfo, ILoader, IOptions, IViewer, IViewpoint, OptionsEventMap, ViewerEventMap } from "@inweb/viewer-core";
import { IMarkup, IWorldTransform } from "@inweb/markup";
import { IModelImpl } from "./Models/IModelImpl";
import { MarkupType } from "./Markup/MarkupFactory";
/**
 * 3D viewer powered by {@link https://cloud.opendesign.com/docs/index.html#/visualizejs | VisualizeJS}.
 */
export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMap & OptionsEventMap> implements IViewer, IWorldTransform {
    client: Client | undefined;
    options: IOptions;
    canvas: HTMLCanvasElement | undefined;
    canvasEvents: string[];
    loaders: ILoader[];
    models: IModelImpl[];
    info: IInfo;
    private canvaseventlistener;
    private _visualizeJsUrl;
    private _visualizeJs;
    private _visualizeTimestamp;
    private _viewer;
    private _crossOrigin;
    private _activeDragger;
    private _components;
    private _renderNeeded;
    private _renderTime;
    private _enableAutoUpdate;
    private _maxRegenTime;
    _abortControllerForReferences: AbortController | undefined;
    private _markup;
    /**
     * @param client - The `Client` instance that is used to load model reference files from the Open Cloud
     *   Server. Do not specify `Client` if you need a standalone viewer instance to view `VSFX` files from
     *   the web or from local computer.
     * @param params - An object containing viewer configuration parameters.
     * @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own library
     *   instance, or specify `undefined` or blank to use the default URL defined by `Viewer.visualize`
     *   library you are using.
     * @param params.crossOrigin - The
     *   {@link https://developer.mozilla.org/docs/Web/HTML/Attributes/crossorigin | crossorigin} content
     *   attribute on `Visalize.js` script element. One of the following values: `""`, `anonymous`, or
     *   `use-credentials`.
     * @param params.enableAutoUpdate - Enable auto-update of the viewer after any changes. If the
     *   auto-update is disabled, you need to register an `update` event handler and update the
     *   `VisualizeJS` viewer and active dragger manually. Default is `true`.
     * @param params.markupType - The type of the markup core: `Visualize` or `Konva`. Default is `Konva`.
     */
    constructor(client?: Client, params?: {
        visualizeJsUrl?: string;
        crossOrigin?: string;
        enableAutoUpdate?: boolean;
        markupType?: MarkupType;
    });
    /**
     * `VisualizeJS` library URL. Use {@link configure | configure()} to change library URL.
     *
     * @readonly
     */
    get visualizeJsUrl(): string;
    /**
     * Returns `VisualizeJS` {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module}
     * instance.
     */
    get visualizeJs(): any;
    /**
     * Returns `VisualizeJS` {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module}
     * instance.
     */
    visLib(): any;
    /**
     * Returns `VisualizeJS` {@link https://cloud.opendesign.com/docs/index.html#/vis/Viewer | Viewer}
     * instance.
     */
    visViewer(): any;
    /**
     * 2D markup core instance used to create markups.
     *
     * @readonly
     */
    get markup(): IMarkup;
    /**
     * Changes the viewer parameters.
     *
     * @param params - An object containing new parameters.
     * @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own library
     *   instance or specify `undefined` or blank to use the default URL defined by `Viewer.visualize`
     *   library you are using.
     * @param params.crossOrigin - The
     *   {@link https://developer.mozilla.org/docs/Web/HTML/Attributes/crossorigin | crossorigin} content
     *   attribute on `Visalize.js` script element. One of the following values: `""`, `anonymous`, or
     *   `use-credentials`.
     */
    configure(params: {
        visualizeJsUrl?: string;
        crossOrigin?: string;
    }): this;
    get draggers(): string[];
    get components(): string[];
    /**
     * Loads the `VisualizeJS` module and initializes it with the specified canvas. Call
     * {@link dispose | dispose()} to release allocated resources.
     *
     * Fires:
     *
     * - {@link InitializeEvent | initialize}
     * - {@link InitializeProgressEvent | initializeprogress}
     *
     * @param canvas -
     *   {@link https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement | HTMLCanvasElement} for
     *   `VisualizeJS`. The canvas element must have an `id` attribute, otherwise an exception will be
     *   thrown.
     * @param onProgress - A callback function that handles events measuring progress of loading of the
     *   `VisualizeJS` library.
     */
    initialize(canvas: HTMLCanvasElement, onProgress?: (event: ProgressEvent) => void): Promise<this>;
    dispose(): this;
    /**
     * Returns `true` if `VisualizeJS` module has been loaded and initialized.
     */
    isInitialized(): boolean;
    setSize(width: number, height: number, updateStyle?: boolean): void;
    /**
     * Updates the viewer.
     *
     * Do nothing if the auto-update mode is disabled in the constructor. In this case, register an
     * `update` event handler and update the `Visualize` viewer and active dragger manually.
     *
     * Fires:
     *
     * - {@link UpdateEvent | update}
     * - {@link RenderEvent | render}
     *
     * @param force - If `true` updates the viewer immidietly. If a `number` is specified and more than the
     *   given amount of milliseconds has elapsed since the last rendering, the update is performed
     *   immediately as well. Otherwise updates on next animation frame. Default is `false`.
     */
    update(force?: boolean | number): void;
    render(time?: DOMHighResTimeStamp): void;
    loadReferences(model: Model | File | Assembly): Promise<this>;
    applyModelTransformMatrix(model: Model | Assembly): void;
    applySceneGraphSettings(options?: IOptions): void;
    /**
     * Loads a file into the viewer.
     *
     * The viewer must be {@link initialize | initialized} before opening the file. Otherwise, `open()` does
     * nothing.
     *
     * This method requires a `Client` instance to be specified to load file from the Open Cloud Server.
     * The file geometry data on the Open Cloud Server must be converted into a `vsfx` format, otherwise an
     * exception will be thrown.
     *
     * For files from Open Cloud Server, the default model will be loaded. If there is no default model,
     * first availiable model will be loaded. If no models are found in the file, an exception will be
     * thrown.
     *
     * For URLs, the file extension is used to determine the file format. For a `ArrayBuffer` and `Data
     * URL`, a file format must be specified using `params.format` parameter. If no appropriate loader is
     * found for the specified format, an exception will be thrown.
     *
     * If there was an active dragger before opening the file, it will be deactivated. After opening the
     * file, you must manually activate the required dragger.
     *
     * To open a large files, enable {@link IOptions.enablePartialMode | partial streaming} mode before
     * opening. Partial streaming is only supported when opening files from an Open Cloud Server, but not
     * local files and URLs. Example:
     *
     * ```javascript
     * viewer.options.enableStreamingMode = true;
     * viewer.options.enablePartialMode = true;
     * await viewer.open(file);
     * ```
     *
     * Fires:
     *
     * - {@link CancelEvent | cancel}
     * - {@link ClearEvent | clear}
     * - {@link OpenEvent | open}
     * - {@link GeometryStartEvent | geometrystart}
     * - {@link GeometryProgressEvent | geometryprogress}
     * - {@link DatabaseChunkEvent | databasechunk}
     * - {@link GeometryChunkEvent | geometrychunk}
     * - {@link GeometryEndEvent | geometryend}
     * - {@link GeometryErrorEvent | geometryerror}
     *
     * @param file - File to load. Can be:
     *
     *   - `File`, `Assembly`, or `Model` instance from the Open Cloud Server
     *   - `URL` string
     *   - {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL} string
     *   - {@link https://developer.mozilla.org/docs/Web/API/File | Web API dFile} object
     *   - {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer}
     *       object
     *
     * @param params - Loading parameters.
     * @param params.format - File format. Can be one of `vsf` or `vsfx`. Required when loading a file as
     *   `ArrayBuffer` or `Data URL`.
     * @param params.mode - Reserved for future use.
     * @param params.modelId - Reserved for future use.
     * @param params.requestHeader - The
     *   {@link https://developer.mozilla.org/docs/Glossary/Request_header | request header} used in HTTP
     *   request.
     * @param params.withCredentials - Whether the HTTP request uses credentials such as cookies,
     *   authorization headers or TLS client certificates. See
     *   {@link https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/withCredentials | XMLHttpRequest.withCredentials}
     *   for more details.
     */
    open(file: FileSource, params?: {
        format?: string;
        mode?: string;
        modelId?: string;
        requestHeader?: HeadersInit;
        withCredentials?: boolean;
    }): Promise<this>;
    cancel(): this;
    clear(): this;
    is3D(): boolean;
    syncOptions(options?: IOptions): this;
    syncOverlay(): void;
    clearOverlay(): void;
    clearSlices(): void;
    getSelected(): string[];
    setSelected(handles?: string[]): void;
    getSelected2(): string[];
    setSelected2(handles?: string[]): void;
    clearSelected(): void;
    hideSelected(): void;
    isolateSelected(): void;
    showAll(): void;
    explode(index?: number): void;
    collect(): void;
    activeDragger(): IDragger | null;
    setActiveDragger(name?: string): IDragger | null;
    resetActiveDragger(): void;
    getComponent(name: string): IComponent;
    drawViewpoint(viewpoint: IViewpoint): void;
    createViewpoint(): IViewpoint;
    getSnapshot(type?: string, quality?: number): string;
    screenToWorld(position: {
        x: number;
        y: number;
    }): {
        x: number;
        y: number;
        z: number;
    };
    worldToScreen(position: {
        x: number;
        y: number;
        z: number;
    }): {
        x: number;
        y: number;
    };
    getScale(): {
        x: number;
        y: number;
        z: number;
    };
    /**
     * Executes the command denoted by the given command. If the command is not found, tries to set active
     * dragger with the specified name.
     *
     * The following commands are available by default:
     *
     * - `applyModelTransform`
     * - `autoTransformAllModelsToCentralPoint`
     * - `clearMarkup`
     * - `clearSelected`
     * - `clearSlices`
     * - `createPreview`
     * - `explode`
     * - `getDefaultViewPositions`
     * - `getModels`
     * - `getSelected`
     * - `hideSelected`
     * - `isolateSelected`
     * - `regenerateAll`
     * - `resetView`
     * - `selectModel`
     * - `setActiveDragger`
     * - `setDefaultViewPosition`
     * - `setMarkupColor`
     * - `setSelected`
     * - `showAll`
     * - `zoomToExtents`
     * - `zoomToObjects`
     * - `zoomToSelected`
     *
     * To register custom command use the {@link commands.registerCommand}.
     *
     * @param id - Command ID or dragger name.
     * @param args - Parameters passed to the command handler function.
     * @returns Returns the result of the command handler function or new active dragger instance. Returns
     *   `undefined` if neither the command nor the dragger exists.
     */
    executeCommand(id: string, ...args: any[]): any;
    /**
     * Adds an empty `Visualize` markup entity to the VisualizeJS overlay.
     */
    addMarkupEntity(entityName: string): any;
    private scheduleUpdateAsync;
    /**
     * Updates the viewer asynchronously without locking the user interface. Used to update the viewer
     * after changes that require a long rendering time.
     *
     * Do nothing if the auto-update mode is disabled in the constructor. In this case, register an
     * `update` event handler and update the `VisualizeJS` viewer and active dragger manually.
     *
     * Fires:
     *
     * - {@link UpdateEvent | update}
     * - {@link RenderEvent | render}
     *
     * @param maxScheduleUpdateTimeInMs - Maximum time for one update, default 30 ms.
     * @param maxScheduleUpdateCount - Maximum count of scheduled updates.
     */
    updateAsync(maxScheduleUpdateTimeInMs?: number, maxScheduleUpdateCount?: number): Promise<void>;
    deviceAutoRegeneration(): void;
}
