import { ListenerResponse, RouterMessage } from "../../../clients/routerClientInstance";
import { ResponderMessage } from "../../../clients/routerClientInstance";
import { CreateSplinterAndInject } from "./createSplinterAndInject";
import { StandardCallback, StandardError, StandardErrorCallback } from "../../../types";
import { WindowIdentifier, WindowDescriptor, SpawnParams, ILauncherGroup, AdjustedSpawnParams, ComponentConfig, FSBLWindow, ShowWindowParams } from "../types";
import { Monitors, MonitorCommand } from "../../../common/Monitors";
import { MonitorInfoDetail, FEAWindow } from "../../../FEA";
import { IRouterClient } from "../../../clients/routerClientInstance";
import DockingMain from "../Docking/dockingMain";
import StackedWindowManagement from "../StackedWindowManager/stackedWindowManager";
import FinsembleEvent from "../../../common/events/FinsembleEvent";
export declare const activeWindows: ILauncherGroup;
declare type Manifest = {
    finsemble: object;
};
export interface LauncherResponseMessage extends ResponderMessage {
    functionName: string;
}
declare type PendingWindow = {
    componentType: string;
    addToWorkspace: boolean;
};
/**
 * The Launcher Service receives calls from the launcherClient, and spawns windows.
 * @constructor
 */
export declare class Launcher {
    /** @alias Launcher# */
    createSplinterAndInject: CreateSplinterAndInject;
    windowGroups: object;
    lastOpenedMap: object;
    lastAdjustedMap: object;
    persistURL: boolean;
    persistPath: boolean;
    shuttingDown: boolean;
    monitors: any;
    shutdownList: any;
    RouterClient: IRouterClient | undefined;
    groupStore: object | undefined;
    finsembleConfig: any;
    appConfig: any;
    pendingWindows: Record<string, PendingWindow>;
    rawManifest: object | undefined;
    originalVisibilityValueMap: object;
    pendingEvergreenWindows: Array<string>;
    monitorsInstance: Monitors;
    doingMonitorAdjustments: boolean;
    dockingMain: DockingMain;
    constructor(manifest: Manifest, stackedWindowManager: typeof StackedWindowManagement, monitorsInstance: Monitors, dockingMain: DockingMain);
    /**
     * Main function that starts everything up.
     * @param {*} callback
     */
    initialize(callback: () => void): Promise<void>;
    /**
     * This method gets called when someone calls `window.open`. We capture an event bubbled up from
     * FEA, and then 'appropriate' that window so that all of the finsemble stuff will work with it.
     * This method makes sure the window can participate in finsemble things. Without a wrap that
     * the windowService knows of, it won't be able to do anything.
     */
    addExternallyOpenedWindow({ appUUID, name, windowType, }: {
        appUUID: string;
        name: string;
        windowType: string;
    }): Promise<void>;
    /**
     * This method handles the shutdownList sequence for the Launcher.
     */
    shutdown(allDone: () => void): Promise<unknown>;
    getComponents(): Record<string, any>;
    addWindowsToGroups(params: {
        groupName: string;
        windowList: string[];
    }): string | null;
    getWindowsInGroup(groupName: string): any;
    removeWindowsFromGroup(params: {
        groupName: string;
        windowList: string[];
    }): string | null;
    addWindowToGroups(data: {
        windowIdentifier: WindowIdentifier;
        groupNames?: string[];
    }): void;
    /**
     * Adds 2 components: StackedWindow (which users could need at any time) and the
     * Smart Desktop Designer (which users need when SDD mode is enabled).
     * "StackedWindow" is a special built-in component that the launcher uses internally. We need
     * to make sure that the StackedWindow is *always* in the component list.
     * @private
     */
    addPredefinedComponents(): void;
    /**
     * Returns staggerPixels value.
     */
    private getStaggerPixels;
    /**
     * Returns the viewPort data. The viewport is a box that is identified by coordinates in the virtual space (all monitors) left, right, top, bottom calculations are done in that space
     */
    private getViewData;
    /**
     * This allows us to add a component that isn't in our list. We use the default manifest config so that our configs are the same across the board.
     * We also allow these components to be included in workspaces.
     * @param {*} message
     * @param {*} cb
     */
    addUserDefinedComponent(message: RouterMessage, cb?: Function): void;
    private getWidthAndHeight;
    /**
     * Returns an updated set of window coordinates with an emphasis on the left parameters
     *
     * @private
     * @param {*} params
     * @returns
     * @memberof Launcher
     */
    private getLeftPlus;
    /**
     * Returns an updated set of window coordinates with an emphasis on the right parameters
     *
     * @private
     * @param {*} params
     * @returns
     * @memberof Launcher
     */
    private getRightPlus;
    /**
     * Returns an updated set of window coordinates with an emphasis on the top parameters
     *
     * @private
     * @param {*} params
     * @returns
     * @memberof Launcher
     */
    private getTopPlus;
    /**
     * Returns an updated set of window coordinates with an emphasis on the bottom parameters
     *
     * @private
     * @param {*} params
     * @returns
     * @memberof Launcher
     */
    private getBottomPlus;
    /**
     * Based on input, update a set of window coordinates to potential force a window on to a specific monitor
     *
     * @private
     * @param {*} params
     * @returns
     * @memberof Launcher
     */
    private potentiallyForceOnMonitor;
    /**
     * Returns a set of new window coordinates based on various input
     *
     * @private
     * @param {*} params
     * @returns
     * @memberof Launcher
     */
    private getNewWindowCoordinates;
    /**
     * Returns previous-coordinate data
     *
     * @private
     * @param {*} launcherParams
     * @param {*} monitor
     * @returns
     * @memberof Launcher
     */
    private getPreviousData;
    /**
     * Returns an updated window descriptor
     *
     * @private
     * @param {*} windowDescriptor
     * @param {*} params
     * @returns
     * @memberof Launcher
     */
    private updateWindowDescriptor;
    /**
     * Brings a list, group, componentType or all windows to front
     * @param {*} windowList list of window names or window identifiers.
     * @param {*} groupName group name
     * @param {*} componentType component type.
     */
    bringWindowsToFront(request: ResponderMessage, cb?: Function): void;
    /**
     * Calculate window bound values based on launch parameters plus other class variables
     *
     * @param {MonitorInfoDetail} foundMonitor
     * @param {WindowDescriptor} windowDescriptor
     * @param {AdjustedSpawnParams} launcherParams
     * @returns {Promise<WindowDescriptor>}
     * @memberof Launcher
     */
    calculateBounds(foundMonitor: MonitorInfoDetail, windowDescriptor: WindowDescriptor, launcherParams: AdjustedSpawnParams): Promise<WindowDescriptor>;
    /**
     * Takes the window descriptor's bounds and makes sure it's on a monitor. If the window isn't on a monitor, we determine the closest monitor
     * based on the distance from the top-left corner of the window to the center of the monitor, and then pull the monitor along that line
     * until the window is on the edge of the monitor
     * @param {*} windowDescriptor Window descriptor, e.g. from a saved workspace
     * @param {*} previousWindowBounds not used, unfortunately
     * @returns windowDescriptor updated window descriptor
     */
    adjustWindowDescriptorBoundsToBeOnMonitor(windowDescriptor: WindowDescriptor, rectToUse?: string): WindowDescriptor;
    clearSequentialNames(): void;
    getWindowTitleBarUrl(): string;
    private updateEphemeralSettings;
    private updateTitleBarSettings;
    private updateOptionSettings;
    private updateSpawnDataSettings;
    private updatePreloadSettings;
    private updateURLPathSettings;
    /**
     * @private
     */
    compileWindowDescriptor(config: ComponentConfig, params: AdjustedSpawnParams, baseDescriptor: WindowDescriptor, resultFromDeriveBounds: WindowDescriptor): WindowDescriptor;
    /**
     * Locates a window based on a componentType
     * @param {object} windowIdentifier The parameters
     * @param  {string}   windowIdentifier.componentType	 The type of component
     * @return {finWindow} Returns a finWindow for the component, or null if not found
     */
    componentFinder(windowIdentifier: WindowIdentifier): FSBLWindow | null;
    /**
     * Create Window Group
     */
    createWindowGroup(err: StandardError, message: ResponderMessage | {
        data: any;
        sendQueryResponse?: Function;
    }): any;
    deleteWindowGroup(err: StandardError, message: ResponderMessage): any;
    /**
     * Sets the dimensions and placement of the window by translating the launcherParams
     *
     * @params	object	launcherParams Params from spawn()
     * @returns {Promise} A promise that resolves to a new windowDescriptor that describes the new window.
     * with defaultLeft, defaultTop, defaultWidth, defaultHeight, and claimMonitorSpace set.
     */
    deriveBounds(launcherParams: SpawnParams): Promise<{
        windowDescriptor: WindowDescriptor;
        adjustedSpawnParams: AdjustedSpawnParams;
    }>;
    /**
     * The basic algorithm for handling monitor adjustments is:
     * 1) Remove any orphaned components. These would be any spawnOnAllMonitor components that are now located
     * on a different monitor than they started. We simply compare their existing monitor with the one they were
     * spawned upon, and remove them if they aren't where they belong.
     *
     * 2) Add any motherless components. These would be any spawnOnAllMonitor components that are missing from a
     * particular monitor, presumably because the monitor just got added.
     *
     * 3) Adjust component dimensions. Since the monitor size may have changed we need to adjust any components
     * that had previously made assumptions about monitor size (such as a toolbar that is supposed to stretch across
     * the top of the screen). We cycle through any components that have made a "claim" on monitor space and then
     * simply call showWindow() with their original params in order to give them a chance to resettle.
     */
    doMonitorAdjustments(changeData: {
        monitors: MonitorInfoDetail[];
    }): void;
    /**
     * Convenient way to execute stuff on a group or all windows
     */
    executeWindowGroupFunctionByListGroupOrType(response: LauncherResponseMessage, cb?: Function): void;
    /**
     * Returns a list of window descriptors that includes each window that the launcher has spawned.
     */
    getActiveDescriptors(): Record<string, WindowDescriptor>;
    /**
     * Gets all active or pending window names. Active windows have completed spawning.  Pending windows have been spawned but haven't yet completed.
     * @return {array} list of active or pending window names
     */
    getActiveAndPendingWindowNames(): string[];
    /**
     * Get list of windows objects that haven't finished spawning
     * Individual window objects are not full windows,
     * they contain the window name and a few other attributes
     */
    getPendingWindows(): Record<string, PendingWindow>;
    /**
     * Returns an map of components that can receive specific data types based on "advertiseReceivers" in the component config
     *
     * @param {array} dataTypes A list of dataTypes (string)
     */
    getComponentsThatCanReceiveDataTypes(dataTypes: object): {};
    getDefaultConfig(componentType: string): ComponentConfig | null;
    getComponentConfig(cb?: Function): Promise<null>;
    onComponentListChanged(err: string | null, componentConfig: {
        value: Record<string, ComponentConfig>;
    }): void;
    /**
     * Gets the list of components, listens for changes on the components.
     * @param {*} cb
     */
    getConfig(cb?: Function): Promise<void>;
    /**
     *
     * @param {*} params
     * @param {string} params.windowIdentifier
     *
     */
    getGroupsForWindow(params: {
        windowIdentifier: WindowIdentifier;
    }): any[];
    /**
     * Gets the proper monitor for a config.
     * @param {string|number} params.monitor Monitor description, eg, "0" or "primary" or "mine".
     * @param {*} cb
     */
    getMonitorInfo(params: {
        monitor?: MonitorCommand;
        windowIdentifier?: WindowIdentifier;
        monitors: MonitorInfoDetail[];
        wiMonitorInfo: MonitorInfoDetail;
    }, cb: (err: any, monitor: MonitorInfoDetail) => void): Promise<void>;
    /**
     * Gets all monitors.
     * @param {*} cb
     */
    getMonitorInfoAll(cb?: (err: any, monitors?: MonitorInfoDetail[] | undefined) => void): void;
    /**
     * Gets the manifest that's stashed on the window's customData.
     * @param {*} cb
     */
    getRawManifest(cb?: (err?: any) => void): void;
    getSequentialName(name: string): string;
    /**
     * convert a list of window names or identifiers to a list of window objects
     */
    getWindowsFromNamesOrIdentifiers(windowList: any, outputAsObject?: boolean): FSBLWindow[];
    /**
     * When each component finishes shutting down, it reports back to the Launcher via this channel.
     */
    handleShutdownCompleted(err: string | null, response: ResponderMessage): void;
    /**
     * After being notified that it needs to shutdown, the component will respond to the launcher. This message will tell the Launcher whether it should wait for the component to do some cleanup methods.
     */
    handleShutdownResponse(err: string | null, response: ResponderMessage): void;
    /**
     * Periodically send heartbeat check to all the open windows and log errors or warnings as needed.
     */
    startHeartbeatMonitor(): void;
    resetHeartbeats(): void;
    /**
     * Hyper-focus a list, group, componentType or all windows
     * @param {*} response.data.windowList list of window names or window identifiers
     * @param {*} response.data.groupName group name
     * @param {*} response.data.componentType component type
     */
    hyperFocus(err: StandardError, response: ListenerResponse): void;
    isWindowNameAlreadyUsed(windowName: string): boolean;
    /**
     * Retrieves a list of components from the configService.
     * @param {function} cb callback.
     * @private
     */
    loadComponents(cb?: (err: any, components: ComponentConfig[]) => void): ComponentConfig[];
    /**
     *
     * @param {*} response  - query responder response
     * @param {String} response.data.componentType - The component name
     * @param {Object} response.data.manifest - ""
     */
    registerComponent(err: StandardError, message: ResponderMessage): any;
    /**
     *
     * @param {*} response
     * @param {String} response.data.componentType - The component name
     */
    unRegisterComponent(err: StandardError, message: ResponderMessage): any;
    /**
     * Force-kill/close a window if it is in a pending state (i.e. spawn didn't complete); otherwise do nothing.
     * @param {*} windowIdentifier of window to force kill
     */
    forceKillWindowIfPending(windowIdentifier: WindowIdentifier): Promise<{
        err: string;
    }>;
    /**
     * Private utility function to sleep/wait for a specified time before accepting the returned promise.
     * @private
     */
    private sleep;
    /**
     * Changes initial window bounds to cached window bounds -- typically cached bounds are the restore location when window is in a maximized state
     * @param {object} params -- same params passed into finishSpawn.
     * @param {object} windowDescriptor -- window descriptor passed into spawn.
     * @private
     */
    private changeCurrentBoundToRestoreBounds;
    /**
     * Override window properties to spawn hidden, but track the override so can later return back to original values in restoreOriginalVisibilityValues
     * @param {object} params -- same params passed into finishSpawn.
     * @param {object} windowDescriptor -- window descriptor passed into spawn.
     * @private
     */
    private overRideVisibilityToSpawnHidden;
    /**
     * If a window's properties have been modified to spawn hidden, restore here back to original value
     * @param {object} params -- same params passed into finishSpawn.
     * @param {object} activeWindow -- wrapper of active window
     * @private
     */
    private restoreOriginalVisibilityValues;
    /**
     * Adds special pre-spawn behavior to support min/max behavior, based on min/max state in params.options (which comes from what was saved in workspace)
     * @param {object} params -- same params passed into spawn.
     * @param {object} windowDescriptor -- window descriptor passed into spawn.
     * @private
     */
    private preSpawnHandleMinMaxWindowState;
    /**
     * Adds special post-spawn code to handle cases where spawn must have finished on both the client and service side.
     * Handles case to support min/max behavior, based on min/max state in params.options (which comes from what was saved in workspace)
     * Handles a request to group on spawn that was initiated from the spawn command.
     * @param {object} activeWindow -- wrapper of active window
     * @param {object} params -- same params passed into finishSpawn.
     * @private
     */
    private handlePostSpawnBehavior;
    /**
     *
     * @private
     */
    private finishSpawn;
    /**
     * Makes a slave window which will automatically close when the master closes.
     * @param  {finWindow} slave  An Electron window
     * @param  {LauncherClient~windowIdentifier} master The window identifier of the master
     */
    makeSlave(slave: FEAWindow, master: WindowIdentifier): void;
    /**
     * Minimizes a list, group or all windows
     * @param {*} response.data.windowList list of window names or window identifiers
     * @param {*} response.data.groupName group name
     * @param {*} response.data.componentType component type
     */
    minimizeWindows(err: StandardError, response: LauncherResponseMessage): void;
    /**
     * See doMonitorAdjustments()
     * Adds any motherless components. These would be any spawnOnAllMonitor components that are missing from a
     * particular monitor, presumably because the monitor just got added.
     */
    monitorAddMotherless(monitors: MonitorInfoDetail[], components: Record<string, ComponentConfig>, done: any): void;
    /**
     * See doMonitorAdjustments()
     * Adjust component dimensions. Since the monitor size may have changed we need to adjust any components
     * that had previously made assumptions about monitor size (such as a toolbar that is supposed to stretch across
     * the top of the screen). We cycle through any components that have made a "claim" on monitor space and then
     * simply call showWindow() with their original params in order to give them a chance to resettle.
     */
    monitorAdjustDimensions(done: () => {}): void;
    /**
     * see doMonitorAdjustments()
     * Removes any orphaned components. These would be any spawnOnAllMonitor components that are now located
     * on a different monitor than they started. We simply compare their existing monitor with the one they were
     * spawned upon, and remove them if they aren't where they belong.
     */
    monitorRemoveOrphans(monitors: MonitorInfoDetail[], components: Record<string, ComponentConfig>, done: any): void;
    /**
     * Removes a component. This is called when a window receives a closed event.
     * If the window is still open then it is closed.
     *
     * @param  {string}   windowName Name of window that was closed
     */
    remove(event: FinsembleEvent): void;
    removeUserDefinedComponent(message: RouterMessage, cb: StandardCallback): void;
    /**
     * Will reset the spawn stagger.
     * @param {object} [params]
     * @param {number} [params.monitorPosition] position of monitor to reset the stagger for
     */
    resetSpawnStagger(params: {
        monitorPosition: number;
    }): void;
    /**
     * Whenever windows are added/removed from groups, send updates to existing windows with their group memberships.
     * @param {} windowList
     */
    sendUpdatesToWindows(windowList: any): void;
    private getActiveWindow;
    private specificMonitorFinder;
    private monitorFinder;
    private relativeMonitorFinder;
    private getNewBounds;
    private showIt;
    private getAbsoluteShowParams;
    private getNonAbsoluteShowParams;
    private getNonRelativeParams;
    private getShowParams;
    private showActiveWindow;
    /**
     * Shows and/or relocates a component window
     * @param  {LauncherClient~windowIdentifier} windowIdentifier The window to show/move
     * @param	object params	Parameters, see spawn()
     * @param function cb Callback
     */
    showWindow(windowIdentifier: WindowIdentifier, params: ShowWindowParams, cb: StandardCallback): Promise<void>;
    /**
     * Rewrite of shutdownComponents to call close on components.
     * @param {function} done
     */
    shutdownComponents(done: () => {}): void;
    /**
     * Removes disallowed parameters before we pass data into compileWindowDescriptor.
     * @param params SpawnParams
     */
    _removeDisallowedSpawnParams(params: SpawnParams): SpawnParams;
    private getPreloadScripts;
    private cleanupPendingWindowsMap;
    private initConfigAndAdjustForTitleBar;
    addToolbarVisibilityBugWorkaround(name: any, config: any, adjustedSpawnParams: any, windowDescriptor: any): Promise<void>;
    spawnWithUpdatedData(config: any, windowDescriptor: any, baseDescriptor: any, adjustedSpawnParams: any, addToWorkspace: any): Promise<{
        errorString: any;
        descriptor: any;
    }>;
    /**
     * Show the component if it is existing evergreen component
     * @return true if handled and nothing else needs to be done; otherwise false
     */
    showIfExistingEvergreen(params: any, config: any, component: any, cb: any): Promise<boolean>;
    /**
     * Show the component if it is existing singleton
     * @return true if handled and nothing else needs to be done; otherwise false
     */
    showIfExistingSingleton(params: any, config: any, component: any, cb: any): Promise<boolean>;
    private updateInitialSpawnConfigAndComponent;
    private updateParamsForAdjacentSideEffects;
    private updateDescriptorForWorkspace;
    private stripPreloadOptionsFromParams;
    private getBaseDescriptor;
    private getSpawnedWindowDescriptorName;
    private intermediateUpdateParamsUsingConfig;
    /**
     * Launches a component, either though LauncherClient API or for internal use.
     * @param {object} params See LauncherClient
     * @param {function} cb Callback
     */
    spawn(params: SpawnParams, cb: StandardCallback): Promise<void>;
    private updateWindowDescriptorBounds;
    /**
     * Takes a preload alias and converts it into preload URL if needed.
     *
     * @param path The file path
     */
    private generateURL;
    getPreloadUrlFromAlias(preloadAlias: string): string;
    getUnknownComponentName(): any;
    /**
     * Launches a copy of the requested component on each of a user's monitors.
     * @param {string} component The type of the component to launch
     * @param {object} params See spawn.
     * @param {function} cb Callback
     */
    spawnOnAllMonitors(component: ComponentConfig, params: SpawnParams, workspaceParams: {
        descriptorName: string;
        addToWorkspace?: boolean;
    }, cb: StandardErrorCallback): Promise<void>;
    /**
     * Spawns an OF window, or sends a request to the native service to spawn a native window.
     * Callback returns a handle to the new window
     * @param {LauncherClient~windowDescriptor} windowDescriptor The descriptor to launch
     * @param {function} cb Callback
     */
    doSpawn(windowDescriptor: WindowDescriptor): Promise<{
        err: string;
        windowIdentifier: WindowIdentifier;
    }>;
    /**
     * Given an object where the keys are component names and the values are component configs, it spawns the list of components.
     * @private */
    spawnGroup(components: ComponentConfig[], params: SpawnParams, cb: StandardErrorCallback): void;
    /**
     * Spawns a launchGroup component - i.e. a component made of other components such as tabbed component or a group.
     *
     * @param {Array.<string>} components - The components that form the tabbed group.
     * @param {*} componentConfig - Object containing the component configuration.
     * @param {Function} cb A callback function to be invoked after the window is spawned.
     *
     * @private
     */
    spawnLaunchGroupComponent(componentConfig: ComponentConfig, cb?: StandardErrorCallback): Promise<void>;
    spawnLaunchGroup(launchGroupComponentConfiguration: {
        componentsToSpawn: any;
    }): Promise<any[]>;
    spawnTabbedComponent(tabbedComponent: ComponentConfig): Promise<any>;
    _compileSpawnParams(component: ComponentConfig): any;
    /**
     * Splintering.
     */
    update(): void;
}
export {};
//# sourceMappingURL=launcher.d.ts.map