"use strict";
/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Utilities
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.UiFramework = exports.UiVisibilityChangedEvent = void 0;
const core_bentley_1 = require("@itwin/core-bentley");
const core_frontend_1 = require("@itwin/core-frontend");
const appui_abstract_1 = require("@itwin/appui-abstract");
const core_react_1 = require("@itwin/core-react");
const core_react_2 = require("@itwin/core-react");
const imodel_components_react_1 = require("@itwin/imodel-components-react");
const BackstageManager_1 = require("./backstage/BackstageManager");
const InternalChildWindowManager_1 = require("./childwindow/InternalChildWindowManager");
const InternalConfigurableUiManager_1 = require("./configurableui/InternalConfigurableUiManager");
const state_1 = require("./configurableui/state");
const SessionState_1 = require("./redux/SessionState");
const StateManager_1 = require("./redux/StateManager");
const HideIsolateEmphasizeManager_1 = require("./selection/HideIsolateEmphasizeManager");
const ThemeManager_1 = require("./theme/ThemeManager");
const keyinPaletteTools = require("./tools/KeyinPaletteTools");
const openSettingTools = require("./tools/OpenSettingsTool");
const restoreLayoutTools = require("./tools/RestoreLayoutTool");
const toolSettingTools = require("./tools/ToolSettingsTools");
const InternalUiShowHideManager_1 = require("./utils/InternalUiShowHideManager");
const WidgetManager_1 = require("./widgets/WidgetManager");
const InternalFrontstageManager_1 = require("./frontstage/InternalFrontstageManager");
const InternalContentViewManager_1 = require("./content/InternalContentViewManager");
const InternalModalDialogManager_1 = require("./dialog/InternalModalDialogManager");
const InternalModelessDialogManager_1 = require("./dialog/InternalModelessDialogManager");
const InternalKeyboardShortcut_1 = require("./keyboardshortcut/InternalKeyboardShortcut");
const InternalToolSettingsManager_1 = require("./toolsettings/InternalToolSettingsManager");
const SyncUiEventDispatcher_1 = require("./syncui/SyncUiEventDispatcher");
/** UiVisibility Event class.
 * @public
 */
class UiVisibilityChangedEvent extends appui_abstract_1.UiEvent {
}
exports.UiVisibilityChangedEvent = UiVisibilityChangedEvent;
/** Main entry point to configure and interact with the features provided by the AppUi-react package.
 * @public
 */
class UiFramework {
    /**
     * Operation on the backstage component.
     * @public
     */
    static get backstage() {
        // istanbul ignore next
        if (!UiFramework._backstageManager)
            throw new appui_abstract_1.UiError(UiFramework.loggerCategory(this), UiFramework._complaint);
        return UiFramework._backstageManager;
    }
    /**
     * Manage access to the child windows.
     * @public
     */
    static get childWindows() {
        return this._childWindowManager;
    }
    /**
     * Manage registered controls
     * @public
     */
    static get controls() {
        return InternalConfigurableUiManager_1.InternalConfigurableUiManager;
    }
    /**
     * Manage access to frontstages and related helper methods.
     * @public
     */
    static get frontstages() {
        return InternalFrontstageManager_1.InternalFrontstageManager;
    }
    /**
     * Manage access and behavior of the tool settings.
     * @public
     */
    static get toolSettings() {
        return InternalToolSettingsManager_1.InternalToolSettingsManager;
    }
    /**
     * Manage content presented by the frontstages.
     * @public
     */
    static get content() {
        return InternalContentViewManager_1.InternalContentViewManager;
    }
    /**
     * Manage displayed dialogs.
     * @public
     */
    static get dialogs() {
        return {
            modal: InternalModalDialogManager_1.InternalModalDialogManager,
            modeless: InternalModelessDialogManager_1.InternalModelessDialogManager,
        };
    }
    /**
     * Manages global keyboard shortcuts
     *
     * Note: This only manages the list of available shortcuts registered with it. It does not listens to the actual
     * keyboard events. In order for these shortcuts to be called upon a keyboard event, the application can
     * override the `IModelApp.toolAdmin` and assign it [[FrameworkToolAdmin]] or create an event listener
     * and call `UiFramework.keyboardShortcuts.processKey`.
     * @public
     */
    static get keyboardShortcuts() {
        return InternalKeyboardShortcut_1.InternalKeyboardShortcutManager;
    }
    /**
     * Manages UI visibility (Show/Hide)
     * @public
     */
    static get visibility() {
        return InternalUiShowHideManager_1.InternalUiShowHideManager;
    }
    /** Registers class that will be informed when the UserSettingsStorage location has been set or changed. This allows
     * classes to load any previously saved settings from the new storage location. Common storage locations are the browser's
     * local storage, or the iTwin Product Settings cloud storage available via the SettingsAdmin see `IModelApp.settingsAdmin`.
     * @public
     */
    static registerUserSettingsProvider(entry) {
        if (this._uiSettingsProviderRegistry.has(entry.providerId))
            return false;
        this._uiSettingsProviderRegistry.set(entry.providerId, entry);
        return true;
    }
    /**
     * Called by the application to initialize the UiFramework. Also initializes UIIModelComponents, UiComponents, UiCore.
     * @param store The single Redux store created by the host application. If this is `undefined` then it is assumed that the [[StateManager]] is being used to provide the Redux store.
     * @param frameworkStateKey The name of the key used by the app when adding the UiFramework state into the Redux store. If not defined "frameworkState" is assumed. This value is ignored if [[StateManager]] is being used. The StateManager use "frameworkState".
     */
    static async initialize(store, frameworkStateKey) {
        var _a;
        if (UiFramework._initialized) {
            core_bentley_1.Logger.logInfo(UiFramework.loggerCategory(UiFramework), `UiFramework.initialize already called`);
            return;
        }
        /* if store is undefined then the StateManager class should have been initialized by parent app and the apps default set of reducers registered with it.
          If the app has no reducers to add and does not initialize a StateManager then just initialize the StateManager with the default framework reducer now */
        if (undefined === store && !StateManager_1.StateManager.isInitialized(true))
            new StateManager_1.StateManager();
        UiFramework._store = store;
        // ignore setting _frameworkStateKeyInStore if not using store
        if (frameworkStateKey && store)
            UiFramework._frameworkStateKeyInStore = frameworkStateKey;
        // set up namespace and register all tools from package
        const frameworkNamespace = (_a = core_frontend_1.IModelApp.localization) === null || _a === void 0 ? void 0 : _a.registerNamespace(UiFramework.localizationNamespace);
        [
            restoreLayoutTools,
            keyinPaletteTools,
            openSettingTools,
            toolSettingTools,
        ].forEach((tool) => core_frontend_1.IModelApp.tools.registerModule(tool, this.localizationNamespace));
        UiFramework._backstageManager = new BackstageManager_1.BackstageManager();
        UiFramework._hideIsolateEmphasizeActionHandler =
            new HideIsolateEmphasizeManager_1.HideIsolateEmphasizeManager(); // this allows user to override the default HideIsolateEmphasizeManager implementation.
        UiFramework._widgetManager = new WidgetManager_1.WidgetManager();
        // Initialize ui-imodel-components, ui-components, ui-core & ui-abstract
        await imodel_components_react_1.UiIModelComponents.initialize();
        UiFramework.settingsManager.onSettingsProvidersChanged.addListener(() => {
            SyncUiEventDispatcher_1.SyncUiEventDispatcher.dispatchSyncUiEvent(SyncUiEventDispatcher_1.SyncUiEventId.SettingsProvidersChanged);
        });
        // Initialize the MessagePresenter interface in UiAdmin for Editor notifications
        appui_abstract_1.UiAdmin.messagePresenter = core_frontend_1.IModelApp.notifications;
        UiFramework._initialized = true;
        // initialize any standalone settings providers that don't need to have defaults set by iModelApp
        InternalUiShowHideManager_1.UiShowHideSettingsProvider.initialize();
        InternalConfigurableUiManager_1.InternalConfigurableUiManager.initialize();
        return frameworkNamespace;
    }
    /** Un-registers the UiFramework internationalization service namespace */
    static terminate() {
        var _a;
        UiFramework._store = undefined;
        UiFramework._frameworkStateKeyInStore = "frameworkState";
        if (StateManager_1.StateManager.isInitialized(true))
            StateManager_1.StateManager.clearStore();
        // istanbul ignore next
        (_a = core_frontend_1.IModelApp.localization) === null || _a === void 0 ? void 0 : _a.unregisterNamespace(UiFramework.localizationNamespace);
        UiFramework._backstageManager = undefined;
        UiFramework._widgetManager = undefined;
        UiFramework._hideIsolateEmphasizeActionHandler = undefined;
        UiFramework._settingsManager = undefined;
        imodel_components_react_1.UiIModelComponents.terminate();
        InternalUiShowHideManager_1.InternalUiShowHideManager.terminate();
        UiFramework._initialized = false;
    }
    /** Determines if UiFramework has been initialized */
    static get initialized() {
        return UiFramework._initialized;
    }
    /** Property that returns the SettingManager used by AppUI-based applications.
     * @public
     */
    static get settingsManager() {
        if (undefined === UiFramework._settingsManager)
            UiFramework._settingsManager = new core_react_1.SettingsManager();
        return UiFramework._settingsManager;
    }
    /** @public */
    static get frameworkStateKey() {
        return UiFramework._frameworkStateKeyInStore;
    }
    /** The UiFramework state maintained by Redux
     * @public
     */
    static get frameworkState() {
        try {
            return UiFramework.store.getState()[UiFramework.frameworkStateKey];
        }
        catch (_e) {
            return undefined;
        }
    }
    /** The Redux store */
    static get store() {
        if (UiFramework._store)
            return UiFramework._store;
        // istanbul ignore else
        if (!StateManager_1.StateManager.isInitialized(true))
            throw new appui_abstract_1.UiError(UiFramework.loggerCategory(this), `Error trying to access redux store before either store or StateManager has been initialized.`);
        // istanbul ignore next
        return StateManager_1.StateManager.store;
    }
    /** The internationalization service created by the app.
     * @internal
     */
    static get localization() {
        // istanbul ignore next
        if (!core_frontend_1.IModelApp.localization)
            throw new appui_abstract_1.UiError(UiFramework.loggerCategory(this), `IModelApp.localization has not been defined.`);
        return core_frontend_1.IModelApp.localization;
    }
    /** The internationalization service namespace. */
    static get localizationNamespace() {
        return "UiFramework";
    }
    /** @public */
    static get hideIsolateEmphasizeActionHandler() {
        // istanbul ignore next
        if (!UiFramework._hideIsolateEmphasizeActionHandler)
            throw new appui_abstract_1.UiError(UiFramework.loggerCategory(this), UiFramework._complaint);
        return UiFramework._hideIsolateEmphasizeActionHandler;
    }
    /** @public */
    static setHideIsolateEmphasizeActionHandler(handler) {
        // istanbul ignore else
        if (handler)
            UiFramework._hideIsolateEmphasizeActionHandler = handler;
        else
            UiFramework._hideIsolateEmphasizeActionHandler =
                new HideIsolateEmphasizeManager_1.HideIsolateEmphasizeManager();
    }
    /** @alpha */
    static get widgetManager() {
        // istanbul ignore next
        if (!UiFramework._widgetManager)
            throw new appui_abstract_1.UiError(UiFramework.loggerCategory(this), UiFramework._complaint);
        return UiFramework._widgetManager;
    }
    /** Calls localization.getLocalizedStringWithNamespace with the "UiFramework" namespace. Do NOT include the namespace in the key.
     * @internal
     */
    static translate(key) {
        return core_frontend_1.IModelApp.localization.getLocalizedString(key, {
            ns: UiFramework.localizationNamespace,
        });
    }
    /** @internal */
    static get packageName() {
        return "appui-react";
    }
    /** @internal */
    static loggerCategory(obj) {
        const className = (0, core_react_2.getObjectClassName)(obj);
        const category = UiFramework.packageName + (className ? `.${className}` : "");
        return category;
    }
    static dispatchActionToStore(type, payload, immediateSync = false) {
        UiFramework.store.dispatch({ type, payload });
        if (immediateSync)
            SyncUiEventDispatcher_1.SyncUiEventDispatcher.dispatchImmediateSyncUiEvent(type);
        else
            SyncUiEventDispatcher_1.SyncUiEventDispatcher.dispatchSyncUiEvent(type);
    }
    static setAccudrawSnapMode(snapMode) {
        UiFramework.dispatchActionToStore(state_1.ConfigurableUiActionId.SetSnapMode, snapMode, true);
    }
    static getAccudrawSnapMode() {
        return UiFramework.frameworkState
            ? UiFramework.frameworkState.configurableUiState.snapMode
            : /* istanbul ignore next */ core_frontend_1.SnapMode.NearestKeypoint;
    }
    /**
     * Returns the stored active selection scope id.
     */
    static getActiveSelectionScope() {
        return UiFramework.frameworkState
            ? UiFramework.frameworkState.sessionState.activeSelectionScope
            : /* istanbul ignore next */ "element";
    }
    /**
     * This method stores the active selection scope to the supplied scope id, and triggers
     * a `SessionStateActionId.SetSelectionScope` event in the `SyncUiEventDispatcher`.
     * Note: As of 4.0, this method *does not change* the active selection scope in the `Presentation.selection.scopes.activeScope` property.
     * This event should be listened to and the change should typically be applied to
     * `Presentation.selection.scopes.activeScope` property from the `@itwin/presentation-frontend` package.
     */
    static setActiveSelectionScope(selectionScopeId) {
        // istanbul ignore else
        if (UiFramework.frameworkState) {
            const foundIndex = UiFramework.frameworkState.sessionState.availableSelectionScopes.findIndex((selectionScope) => selectionScope.id === selectionScopeId);
            if (-1 !== foundIndex) {
                const scope = UiFramework.frameworkState.sessionState.availableSelectionScopes[foundIndex];
                UiFramework.dispatchActionToStore(SessionState_1.SessionStateActionId.SetSelectionScope, scope.id);
            }
        }
    }
    /** @public */
    static openCursorMenu(menuData) {
        UiFramework.dispatchActionToStore(SessionState_1.SessionStateActionId.UpdateCursorMenu, menuData);
    }
    /** @public */
    static closeCursorMenu() {
        UiFramework.dispatchActionToStore(SessionState_1.SessionStateActionId.UpdateCursorMenu, undefined);
    }
    /** @public */
    static getCursorMenuData() {
        return UiFramework.frameworkState
            ? UiFramework.frameworkState.sessionState.cursorMenuData
            : /* istanbul ignore next */ undefined;
    }
    static getActiveIModelId() {
        return UiFramework.frameworkState
            ? UiFramework.frameworkState.sessionState.iModelId
            : /* istanbul ignore next */ "";
    }
    static setActiveIModelId(iModelId) {
        UiFramework.dispatchActionToStore(SessionState_1.SessionStateActionId.SetActiveIModelId, iModelId);
    }
    static setIModelConnection(iModelConnection, immediateSync = false) {
        var _a;
        const oldConnection = UiFramework.getIModelConnection();
        if (oldConnection === iModelConnection)
            return;
        InternalFrontstageManager_1.InternalFrontstageManager.clearFrontstageDefsForIModelId(oldConnection === null || oldConnection === void 0 ? void 0 : oldConnection.iModelId);
        oldConnection && SyncUiEventDispatcher_1.SyncUiEventDispatcher.clearConnectionEvents(oldConnection);
        iModelConnection &&
            SyncUiEventDispatcher_1.SyncUiEventDispatcher.initializeConnectionEvents(iModelConnection);
        UiFramework.dispatchActionToStore(SessionState_1.SessionStateActionId.SetIModelConnection, iModelConnection, immediateSync);
        const itemsSelected = iModelConnection
            ? iModelConnection.selectionSet.elements.size
            : 0;
        UiFramework.dispatchActionToStore(SessionState_1.SessionStateActionId.SetNumItemsSelected, itemsSelected);
        UiFramework.setActiveIModelId((_a = iModelConnection === null || iModelConnection === void 0 ? void 0 : iModelConnection.iModelId) !== null && _a !== void 0 ? _a : "");
    }
    static getIModelConnection() {
        return UiFramework.frameworkState
            ? UiFramework.frameworkState.sessionState.iModelConnection
            : /* istanbul ignore next */ undefined;
    }
    /** Called by iModelApp to initialize saved UI state from registered UseSettingsProviders
     * @public
     */
    static async initializeStateFromUserSettingsProviders(immediateSync = false) {
        // let any registered providers to load values from the new storage location
        const providerKeys = [...this._uiSettingsProviderRegistry.keys()];
        for await (const key of providerKeys) {
            await this._uiSettingsProviderRegistry
                .get(key)
                .loadUserSettings(UiFramework._uiStateStorage);
        }
        // istanbul ignore next
        if (immediateSync)
            SyncUiEventDispatcher_1.SyncUiEventDispatcher.dispatchImmediateSyncUiEvent(SyncUiEventDispatcher_1.SyncUiEventId.UiStateStorageChanged);
        else
            SyncUiEventDispatcher_1.SyncUiEventDispatcher.dispatchSyncUiEvent(SyncUiEventDispatcher_1.SyncUiEventId.UiStateStorageChanged);
    }
    /** @public */
    static async setUiStateStorage(storage, immediateSync = false) {
        if (UiFramework._uiStateStorage === storage)
            return;
        UiFramework._uiStateStorage = storage;
        await this.initializeStateFromUserSettingsProviders(immediateSync);
    }
    /** The UI Settings Storage is a convenient wrapper around Local Storage to assist in caching state information across user sessions.
     * It was previously used to conflate both the state information across session and the information driven directly from user explicit action,
     * which are now handled with user preferences.
     * @public
     */
    static getUiStateStorage() {
        return UiFramework._uiStateStorage;
    }
    static setDefaultIModelViewportControlId(iModelViewportControlId, immediateSync = false) {
        UiFramework.dispatchActionToStore(SessionState_1.SessionStateActionId.SetDefaultIModelViewportControlId, iModelViewportControlId, immediateSync);
    }
    static getDefaultIModelViewportControlId() {
        return UiFramework.frameworkState
            ? UiFramework.frameworkState.sessionState.defaultIModelViewportControlId
            : /* istanbul ignore next */ undefined;
    }
    static setDefaultViewId(viewId, immediateSync = false) {
        UiFramework.dispatchActionToStore(SessionState_1.SessionStateActionId.SetDefaultViewId, viewId, immediateSync);
    }
    static getDefaultViewId() {
        return UiFramework.frameworkState
            ? UiFramework.frameworkState.sessionState.defaultViewId
            : /* istanbul ignore next */ undefined;
    }
    static setDefaultViewState(viewState, immediateSync = false) {
        UiFramework.dispatchActionToStore(SessionState_1.SessionStateActionId.SetDefaultViewState, viewState, immediateSync);
    }
    static getDefaultViewState() {
        return UiFramework.frameworkState
            ? UiFramework.frameworkState.sessionState.defaultViewState
            : /* istanbul ignore next */ undefined;
    }
    /**
     * Returns the stored list of available selection scopes. This list should be set by the application
     * by dispatching the `setAvailableSelectionScopes` action.
     * The value for this action typically come from `Presentation.selection.scopes.getSelectionScopes()`
     * method found in the `@itwin/presentation-frontend` package.
     * @public */
    static getAvailableSelectionScopes() {
        return UiFramework.frameworkState
            ? UiFramework.frameworkState.sessionState.availableSelectionScopes
            : /* istanbul ignore next */
                [{ id: "element", label: "Element" }];
    }
    static getIsUiVisible() {
        return UiFramework.visibility.isUiVisible;
    }
    static setIsUiVisible(visible) {
        if (UiFramework.visibility.isUiVisible !== visible) {
            UiFramework.visibility.isUiVisible = visible;
            UiFramework.onUiVisibilityChanged.emit({ visible });
        }
    }
    /**
     * Set the theme value used by the [[ThemeManager]] component.
     */
    static setColorTheme(theme) {
        if (UiFramework.getColorTheme() === theme)
            return;
        UiFramework.dispatchActionToStore(state_1.ConfigurableUiActionId.SetTheme, theme, true);
    }
    static getColorTheme() {
        return UiFramework.frameworkState
            ? UiFramework.frameworkState.configurableUiState.theme
            : /* istanbul ignore next */ ThemeManager_1.SYSTEM_PREFERRED_COLOR_THEME;
    }
    /** UiFramework.setToolbarOpacity() sets the non-hovered opacity to the value specified.
     * @param opacity a value between 0 and 1. The default value is 0.5. IT IS NOT ADVISED TO USE A VALUE BELOW 0.2
     * @public
     */
    static setToolbarOpacity(opacity) {
        if (UiFramework.getToolbarOpacity() === opacity)
            return;
        UiFramework.dispatchActionToStore(state_1.ConfigurableUiActionId.SetToolbarOpacity, opacity, true);
    }
    /** UiFramework.getToolbarOpacity() returns a number between 0 and 1 that is the non-hovered opacity for toolbars.
     * @public
     */
    static getToolbarOpacity() {
        return UiFramework.frameworkState
            ? UiFramework.frameworkState.configurableUiState.toolbarOpacity
            : /* istanbul ignore next */ ThemeManager_1.TOOLBAR_OPACITY_DEFAULT;
    }
    static setWidgetOpacity(opacity) {
        if (UiFramework.getWidgetOpacity() === opacity)
            return;
        UiFramework.dispatchActionToStore(state_1.ConfigurableUiActionId.SetWidgetOpacity, opacity, true);
    }
    static getWidgetOpacity() {
        return UiFramework.frameworkState
            ? UiFramework.frameworkState.configurableUiState.widgetOpacity
            : /* istanbul ignore next */ ThemeManager_1.WIDGET_OPACITY_DEFAULT;
    }
    // eslint-disable-next-line @itwin/prefer-get
    static isMobile() {
        return core_bentley_1.ProcessDetector.isMobileBrowser;
    }
    static get showWidgetIcon() {
        return UiFramework.frameworkState
            ? UiFramework.frameworkState.configurableUiState.showWidgetIcon
            : /* istanbul ignore next */ false;
    }
    static setShowWidgetIcon(value) {
        if (UiFramework.showWidgetIcon === value)
            return;
        UiFramework.dispatchActionToStore(state_1.ConfigurableUiActionId.SetShowWidgetIcon, value, true);
    }
    /** Animate Tool Settings on appear  */
    static get animateToolSettings() {
        return UiFramework.frameworkState
            ? UiFramework.frameworkState.configurableUiState.animateToolSettings
            : /* istanbul ignore next */ false;
    }
    static setAnimateToolSettings(value) {
        if (UiFramework.animateToolSettings === value)
            return;
        UiFramework.dispatchActionToStore(state_1.ConfigurableUiActionId.AnimateToolSettings, value, true);
    }
    /** Use Tool Name As Tool Settings Widget Tab Label */
    static get useToolAsToolSettingsLabel() {
        return UiFramework.frameworkState
            ? UiFramework.frameworkState.configurableUiState
                .useToolAsToolSettingsLabel
            : /* istanbul ignore next */ false;
    }
    static setUseToolAsToolSettingsLabel(value) {
        if (UiFramework.useToolAsToolSettingsLabel === value)
            return;
        UiFramework.dispatchActionToStore(state_1.ConfigurableUiActionId.UseToolAsToolSettingsLabel, value, true);
    }
    /** When `true`, panels will close as soon as the mouse leave the panel.
     * When `false` (default), panels will close on next click outside the panel.
     * @public */
    static get autoCollapseUnpinnedPanels() {
        return UiFramework.frameworkState
            ? UiFramework.frameworkState.configurableUiState
                .autoCollapseUnpinnedPanels
            : /* istanbul ignore next */ false;
    }
    /** Method used to enable the automatic closing of an unpinned widget panel as soon as the
     * mouse leaves the widget panel. The default behavior is to require a mouse click outside
     * the panel before it is closed.
     * @public */
    static setAutoCollapseUnpinnedPanels(value) {
        if (UiFramework.autoCollapseUnpinnedPanels === value)
            return;
        UiFramework.dispatchActionToStore(state_1.ConfigurableUiActionId.AutoCollapseUnpinnedPanels, value, true);
    }
    static get useDragInteraction() {
        return UiFramework.frameworkState
            ? UiFramework.frameworkState.configurableUiState.useDragInteraction
            : false;
    }
    static setUseDragInteraction(useDragInteraction) {
        UiFramework.dispatchActionToStore(state_1.ConfigurableUiActionId.SetDragInteraction, useDragInteraction, true);
    }
    /** Returns the variable controlling whether the overlay is displayed in a Viewport
     * @public
     */
    static get viewOverlayDisplay() {
        return UiFramework.frameworkState
            ? UiFramework.frameworkState.configurableUiState.viewOverlayDisplay
            : /* istanbul ignore next */ true;
    }
    /** Set the variable that controls display of the view overlay. Applies to all viewports in the app
     * @public
     */
    static setViewOverlayDisplay(display) {
        if (UiFramework.viewOverlayDisplay === display)
            return;
        UiFramework.dispatchActionToStore(state_1.ConfigurableUiActionId.SetViewOverlayDisplay, display);
    }
    /** Determines whether a ContextMenu is open
     * @alpha
     * */
    static get isContextMenuOpen() {
        const contextMenu = document.querySelector("div.core-context-menu-opened");
        return contextMenu !== null && contextMenu !== undefined;
    }
}
UiFramework._initialized = false;
UiFramework._complaint = "UiFramework not initialized";
UiFramework._frameworkStateKeyInStore = "frameworkState"; // default name
/** this provides a default state storage handler */
UiFramework._uiStateStorage = new core_react_1.LocalStateStorage();
UiFramework._uiSettingsProviderRegistry = new Map();
UiFramework._childWindowManager = new InternalChildWindowManager_1.InternalChildWindowManager();
UiFramework.useDefaultPopoutUrl = false;
/** Get Show Ui event.
 * @public
 */
UiFramework.onUiVisibilityChanged = new UiVisibilityChangedEvent();
exports.UiFramework = UiFramework;
//# sourceMappingURL=UiFramework.js.map