/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
(self["webpackChunk_JUPYTERLAB_CORE_OUTPUT"] = self["webpackChunk_JUPYTERLAB_CORE_OUTPUT"] || []).push([["packages_application-extension_lib_index_js"],{

/***/ "../packages/application-extension/lib/index.js":
/*!******************************************************!*\
  !*** ../packages/application-extension/lib/index.js ***!
  \******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/application */ \"webpack/sharing/consume/default/@jupyterlab/application/@jupyterlab/application\");\n/* harmony import */ var _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/apputils */ \"webpack/sharing/consume/default/@jupyterlab/apputils/@jupyterlab/apputils\");\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _jupyterlab_console__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyterlab/console */ \"webpack/sharing/consume/default/@jupyterlab/console/@jupyterlab/console\");\n/* harmony import */ var _jupyterlab_console__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_console__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @jupyterlab/coreutils */ \"webpack/sharing/consume/default/@jupyterlab/coreutils/@jupyterlab/coreutils\");\n/* harmony import */ var _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _jupyterlab_docmanager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @jupyterlab/docmanager */ \"webpack/sharing/consume/default/@jupyterlab/docmanager/@jupyterlab/docmanager\");\n/* harmony import */ var _jupyterlab_docmanager__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_docmanager__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _jupyterlab_docregistry__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @jupyterlab/docregistry */ \"webpack/sharing/consume/default/@jupyterlab/docregistry/@jupyterlab/docregistry\");\n/* harmony import */ var _jupyterlab_docregistry__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_docregistry__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @jupyterlab/mainmenu */ \"webpack/sharing/consume/default/@jupyterlab/mainmenu/@jupyterlab/mainmenu\");\n/* harmony import */ var _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @jupyterlab/translation */ \"webpack/sharing/consume/default/@jupyterlab/translation/@jupyterlab/translation\");\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _retrolab_application__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @retrolab/application */ \"webpack/sharing/consume/default/@retrolab/application/@retrolab/application\");\n/* harmony import */ var _retrolab_application__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_retrolab_application__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var _retrolab_ui_components__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @retrolab/ui-components */ \"webpack/sharing/consume/default/@retrolab/ui-components/@retrolab/ui-components\");\n/* harmony import */ var _retrolab_ui_components__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_retrolab_ui_components__WEBPACK_IMPORTED_MODULE_9__);\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @lumino/coreutils */ \"webpack/sharing/consume/default/@lumino/coreutils/@lumino/coreutils\");\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_10__);\n/* harmony import */ var _lumino_disposable__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @lumino/disposable */ \"webpack/sharing/consume/default/@lumino/disposable/@lumino/disposable\");\n/* harmony import */ var _lumino_disposable__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_lumino_disposable__WEBPACK_IMPORTED_MODULE_11__);\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @lumino/widgets */ \"webpack/sharing/consume/default/@lumino/widgets/@lumino/widgets\");\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_lumino_widgets__WEBPACK_IMPORTED_MODULE_12__);\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * The default notebook factory.\n */\nconst NOTEBOOK_FACTORY = 'Notebook';\n/**\n * The editor factory.\n */\nconst EDITOR_FACTORY = 'Editor';\n/**\n * A regular expression to match path to notebooks and documents\n */\nconst TREE_PATTERN = new RegExp('/(notebooks|edit)/(.*)');\n/**\n * The command IDs used by the application plugin.\n */\nvar CommandIDs;\n(function (CommandIDs) {\n    /**\n     * Toggle Top Bar visibility\n     */\n    CommandIDs.toggleTop = 'application:toggle-top';\n    /**\n     * Toggle the Zen mode\n     */\n    CommandIDs.toggleZen = 'application:toggle-zen';\n    /**\n     * Open JupyterLab\n     */\n    CommandIDs.openLab = 'application:open-lab';\n    /**\n     * Open the tree page.\n     */\n    CommandIDs.openTree = 'application:open-tree';\n    /**\n     * Resolve tree path\n     */\n    CommandIDs.resolveTree = 'application:resolve-tree';\n})(CommandIDs || (CommandIDs = {}));\n/**\n * Check if the application is dirty before closing the browser tab.\n */\nconst dirty = {\n    id: '@retrolab/application-extension:dirty',\n    autoStart: true,\n    requires: [_jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.ILabStatus, _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_7__.ITranslator],\n    activate: (app, status, translator) => {\n        if (!(app instanceof _retrolab_application__WEBPACK_IMPORTED_MODULE_8__.RetroApp)) {\n            throw new Error(`${dirty.id} must be activated in RetroLab.`);\n        }\n        const trans = translator.load('jupyterlab');\n        const message = trans.__('Are you sure you want to exit RetroLab?\\n\\nAny unsaved changes will be lost.');\n        window.addEventListener('beforeunload', event => {\n            if (app.status.isDirty) {\n                return (event.returnValue = message);\n            }\n        });\n    }\n};\n/**\n * The logo plugin.\n */\nconst logo = {\n    id: '@retrolab/application-extension:logo',\n    autoStart: true,\n    activate: (app) => {\n        const baseUrl = _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_3__.PageConfig.getBaseUrl();\n        const node = document.createElement('a');\n        node.href = `${baseUrl}retro/tree`;\n        node.target = '_blank';\n        node.rel = 'noopener noreferrer';\n        const logo = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_12__.Widget({ node });\n        const retroLogo = _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_3__.PageConfig.getOption('retroLogo') === 'true';\n        const icon = retroLogo ? _retrolab_ui_components__WEBPACK_IMPORTED_MODULE_9__.retroInlineIcon : _retrolab_ui_components__WEBPACK_IMPORTED_MODULE_9__.jupyterIcon;\n        icon.element({\n            container: node,\n            elementPosition: 'center',\n            padding: '2px 2px 2px 8px',\n            height: '28px',\n            width: 'auto'\n        });\n        logo.id = 'jp-RetroLogo';\n        app.shell.add(logo, 'top', { rank: 0 });\n    }\n};\n/**\n * A plugin to open documents in the main area.\n */\nconst opener = {\n    id: '@retrolab/application-extension:opener',\n    autoStart: true,\n    requires: [_jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.IRouter, _jupyterlab_docmanager__WEBPACK_IMPORTED_MODULE_4__.IDocumentManager],\n    activate: (app, router, docManager) => {\n        const { commands } = app;\n        const command = 'router:tree';\n        commands.addCommand(command, {\n            execute: (args) => {\n                var _a;\n                const parsed = args;\n                const matches = (_a = parsed.path.match(TREE_PATTERN)) !== null && _a !== void 0 ? _a : [];\n                const [, , path] = matches;\n                if (!path) {\n                    return;\n                }\n                const file = decodeURIComponent(path);\n                const ext = _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_3__.PathExt.extname(file);\n                app.restored.then(() => {\n                    // TODO: get factory from file type instead?\n                    if (ext === '.ipynb') {\n                        docManager.open(file, NOTEBOOK_FACTORY, undefined, {\n                            ref: '_noref'\n                        });\n                    }\n                    else {\n                        docManager.open(file, EDITOR_FACTORY, undefined, {\n                            ref: '_noref'\n                        });\n                    }\n                });\n            }\n        });\n        router.register({ command, pattern: TREE_PATTERN });\n    }\n};\n/**\n * A plugin to dispose the Tabs menu\n */\nconst noTabsMenu = {\n    id: '@retrolab/application-extension:no-tabs-menu',\n    requires: [_jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_6__.IMainMenu],\n    autoStart: true,\n    activate: (app, menu) => {\n        menu.tabsMenu.dispose();\n    }\n};\n/**\n * Add commands to open the tree and running pages.\n */\nconst pages = {\n    id: '@retrolab/application-extension:pages',\n    autoStart: true,\n    optional: [_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.ICommandPalette, _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_6__.IMainMenu],\n    activate: (app, palette, menu) => {\n        const baseUrl = _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_3__.PageConfig.getBaseUrl();\n        app.commands.addCommand(CommandIDs.openLab, {\n            label: 'Open JupyterLab',\n            execute: () => {\n                window.open(`${baseUrl}lab`);\n            }\n        });\n        app.commands.addCommand(CommandIDs.openTree, {\n            label: 'Open Files',\n            execute: () => {\n                window.open(`${baseUrl}retro/tree`);\n            }\n        });\n        if (palette) {\n            [CommandIDs.openLab, CommandIDs.openTree].forEach(command => {\n                palette.addItem({ command, category: 'View' });\n            });\n        }\n        if (menu) {\n            menu.viewMenu.addGroup([{ command: CommandIDs.openLab }, { command: CommandIDs.openTree }], 0);\n        }\n    }\n};\n/**\n * The default paths for a RetroLab app.\n */\nconst paths = {\n    id: '@retrolab/application-extension:paths',\n    autoStart: true,\n    provides: _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.JupyterFrontEnd.IPaths,\n    activate: (app) => {\n        if (!(app instanceof _retrolab_application__WEBPACK_IMPORTED_MODULE_8__.RetroApp)) {\n            throw new Error(`${paths.id} must be activated in RetroLab.`);\n        }\n        return app.paths;\n    }\n};\n/**\n * The default URL router provider.\n */\nconst router = {\n    id: '@retrolab/application-extension:router',\n    autoStart: true,\n    provides: _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.IRouter,\n    requires: [_jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.JupyterFrontEnd.IPaths],\n    activate: (app, paths) => {\n        const { commands } = app;\n        const base = paths.urls.base;\n        const router = new _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.Router({ base, commands });\n        void app.started.then(() => {\n            // Route the very first request on load.\n            void router.route();\n            // Route all pop state events.\n            window.addEventListener('popstate', () => {\n                void router.route();\n            });\n        });\n        return router;\n    }\n};\n/**\n * The default session dialogs plugin\n */\nconst sessionDialogs = {\n    id: '@retrolab/application-extension:session-dialogs',\n    provides: _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.ISessionContextDialogs,\n    autoStart: true,\n    activate: () => _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.sessionContextDialogs\n};\n/**\n * The default RetroLab application shell.\n */\nconst shell = {\n    id: '@retrolab/application-extension:shell',\n    activate: (app) => {\n        if (!(app.shell instanceof _retrolab_application__WEBPACK_IMPORTED_MODULE_8__.RetroShell)) {\n            throw new Error(`${shell.id} did not find a RetroShell instance.`);\n        }\n        return app.shell;\n    },\n    autoStart: true,\n    provides: _retrolab_application__WEBPACK_IMPORTED_MODULE_8__.IRetroShell\n};\n/**\n * A plugin to provide a spacer at rank 10000 for flex panels\n */\nconst spacer = {\n    id: '@retrolab/application-extension:spacer',\n    autoStart: true,\n    activate: (app) => {\n        const top = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_12__.Widget();\n        top.id = _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.DOMUtils.createDomID();\n        top.addClass('jp-RetroSpacer');\n        app.shell.add(top, 'top', { rank: 10000 });\n        const menu = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_12__.Widget();\n        menu.id = _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.DOMUtils.createDomID();\n        menu.addClass('jp-RetroSpacer');\n        app.shell.add(menu, 'menu', { rank: 10000 });\n    }\n};\n/**\n * The default JupyterLab application status provider.\n */\nconst status = {\n    id: '@retrolab/application-extension:status',\n    autoStart: true,\n    provides: _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.ILabStatus,\n    activate: (app) => {\n        if (!(app instanceof _retrolab_application__WEBPACK_IMPORTED_MODULE_8__.RetroApp)) {\n            throw new Error(`${status.id} must be activated in RetroLab.`);\n        }\n        return app.status;\n    }\n};\n/**\n * A plugin to display the document title in the browser tab title\n */\nconst tabTitle = {\n    id: '@retrolab/application-extension:tab-title',\n    autoStart: true,\n    requires: [_retrolab_application__WEBPACK_IMPORTED_MODULE_8__.IRetroShell],\n    activate: (app, shell) => {\n        const setTabTitle = () => {\n            const current = shell.currentWidget;\n            if (current instanceof _jupyterlab_console__WEBPACK_IMPORTED_MODULE_2__.ConsolePanel) {\n                const update = () => {\n                    const title = current.sessionContext.path || current.sessionContext.name;\n                    const basename = _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_3__.PathExt.basename(title);\n                    document.title = basename;\n                };\n                current.sessionContext.sessionChanged.connect(update);\n                update();\n                return;\n            }\n            else if (current instanceof _jupyterlab_docregistry__WEBPACK_IMPORTED_MODULE_5__.DocumentWidget) {\n                const update = () => {\n                    const basename = _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_3__.PathExt.basename(current.context.path);\n                    document.title = basename;\n                };\n                current.context.pathChanged.connect(update);\n                update();\n            }\n        };\n        shell.currentChanged.connect(setTabTitle);\n        setTabTitle();\n    }\n};\n/**\n * A plugin to display and rename the title of a file\n */\nconst title = {\n    id: '@retrolab/application-extension:title',\n    autoStart: true,\n    requires: [_retrolab_application__WEBPACK_IMPORTED_MODULE_8__.IRetroShell],\n    optional: [_jupyterlab_docmanager__WEBPACK_IMPORTED_MODULE_4__.IDocumentManager, _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.IRouter],\n    activate: (app, shell, docManager, router) => {\n        const widget = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_12__.Widget();\n        widget.id = 'jp-title';\n        app.shell.add(widget, 'top', { rank: 10 });\n        const addTitle = async () => {\n            const current = shell.currentWidget;\n            if (!current || !(current instanceof _jupyterlab_docregistry__WEBPACK_IMPORTED_MODULE_5__.DocumentWidget)) {\n                return;\n            }\n            if (widget.node.children.length > 0) {\n                return;\n            }\n            const h = document.createElement('h1');\n            h.textContent = current.title.label;\n            widget.node.appendChild(h);\n            widget.node.style.marginLeft = '10px';\n            if (!docManager) {\n                return;\n            }\n            widget.node.onclick = async () => {\n                var _a, _b;\n                const result = await (0,_jupyterlab_docmanager__WEBPACK_IMPORTED_MODULE_4__.renameDialog)(docManager, current.context.path);\n                // activate the current widget to bring the focus\n                if (current) {\n                    current.activate();\n                }\n                if (result === null) {\n                    return;\n                }\n                const newPath = (_a = current.context.path) !== null && _a !== void 0 ? _a : result.path;\n                const basename = _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_3__.PathExt.basename(newPath);\n                h.textContent = basename;\n                if (!router) {\n                    return;\n                }\n                const matches = (_b = router.current.path.match(TREE_PATTERN)) !== null && _b !== void 0 ? _b : [];\n                const [, route, path] = matches;\n                if (!route || !path) {\n                    return;\n                }\n                const encoded = encodeURIComponent(newPath);\n                router.navigate(`/retro/${route}/${encoded}`, {\n                    skipRouting: true\n                });\n            };\n        };\n        shell.currentChanged.connect(addTitle);\n        addTitle();\n    }\n};\n/**\n * Plugin to toggle the top header visibility.\n */\nconst topVisibility = {\n    id: '@retrolab/application-extension:top',\n    requires: [_retrolab_application__WEBPACK_IMPORTED_MODULE_8__.IRetroShell],\n    optional: [_jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_6__.IMainMenu],\n    activate: (app, retroShell, menu) => {\n        const top = retroShell.top;\n        app.commands.addCommand(CommandIDs.toggleTop, {\n            label: 'Show Header',\n            execute: () => {\n                top.setHidden(top.isVisible);\n            },\n            isToggled: () => top.isVisible\n        });\n        if (menu) {\n            menu.viewMenu.addGroup([{ command: CommandIDs.toggleTop }], 2);\n        }\n        const onChanged = () => {\n            if (app.format === 'desktop') {\n                retroShell.expandTop();\n            }\n            else {\n                retroShell.collapseTop();\n            }\n        };\n        // listen on format change (mobile and desktop) to make the view more compact\n        app.formatChanged.connect(onChanged);\n        onChanged();\n    },\n    autoStart: true\n};\n/**\n * A simplified Translator\n */\nconst translator = {\n    id: '@retrolab/application-extension:translator',\n    activate: (app) => {\n        const translationManager = new _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_7__.TranslationManager();\n        return translationManager;\n    },\n    autoStart: true,\n    provides: _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_7__.ITranslator\n};\n/**\n * The default tree route resolver plugin.\n */\nconst tree = {\n    id: '@retrolab/application-extension:tree-resolver',\n    autoStart: true,\n    requires: [_jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.IRouter],\n    provides: _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.JupyterFrontEnd.ITreeResolver,\n    activate: (app, router) => {\n        const { commands } = app;\n        const set = new _lumino_disposable__WEBPACK_IMPORTED_MODULE_11__.DisposableSet();\n        const delegate = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_10__.PromiseDelegate();\n        const treePattern = new RegExp('/retro(/tree/.*)?');\n        set.add(commands.addCommand(CommandIDs.resolveTree, {\n            execute: (async (args) => {\n                var _a;\n                if (set.isDisposed) {\n                    return;\n                }\n                const query = _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_3__.URLExt.queryStringToObject((_a = args.search) !== null && _a !== void 0 ? _a : '');\n                const browser = query['file-browser-path'] || '';\n                // Remove the file browser path from the query string.\n                delete query['file-browser-path'];\n                // Clean up artifacts immediately upon routing.\n                set.dispose();\n                delegate.resolve({ browser, file: _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_3__.PageConfig.getOption('treePath') });\n            })\n        }));\n        set.add(router.register({ command: CommandIDs.resolveTree, pattern: treePattern }));\n        // If a route is handled by the router without the tree command being\n        // invoked, resolve to `null` and clean up artifacts.\n        const listener = () => {\n            if (set.isDisposed) {\n                return;\n            }\n            set.dispose();\n            delegate.resolve(null);\n        };\n        router.routed.connect(listener);\n        set.add(new _lumino_disposable__WEBPACK_IMPORTED_MODULE_11__.DisposableDelegate(() => {\n            router.routed.disconnect(listener);\n        }));\n        return { paths: delegate.promise };\n    }\n};\nconst treePathUpdater = {\n    id: '@retrolab/application-extension:tree-updater',\n    requires: [_jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.IRouter],\n    provides: _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.ITreePathUpdater,\n    activate: (app, router) => {\n        function updateTreePath(treePath) {\n            if (treePath !== _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_3__.PageConfig.getOption('treePath')) {\n                const path = _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_3__.URLExt.join(_jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_3__.PageConfig.getOption('baseUrl') || '/', 'retro', 'tree', _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_3__.URLExt.encodeParts(treePath));\n                router.navigate(path, { skipRouting: true });\n                // Persist the new tree path to PageConfig as it is used elsewhere at runtime.\n                _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_3__.PageConfig.setOption('treePath', treePath);\n            }\n        }\n        return updateTreePath;\n    },\n    autoStart: true\n};\n/**\n * Zen mode plugin\n */\nconst zen = {\n    id: '@retrolab/application-extension:zen',\n    autoStart: true,\n    optional: [_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.ICommandPalette, _retrolab_application__WEBPACK_IMPORTED_MODULE_8__.IRetroShell, _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_6__.IMainMenu],\n    activate: (app, palette, retroShell, menu) => {\n        const { commands } = app;\n        const elem = document.documentElement;\n        const toggleOn = () => {\n            retroShell === null || retroShell === void 0 ? void 0 : retroShell.collapseTop();\n            retroShell === null || retroShell === void 0 ? void 0 : retroShell.menu.setHidden(true);\n            zenModeEnabled = true;\n        };\n        const toggleOff = () => {\n            retroShell === null || retroShell === void 0 ? void 0 : retroShell.expandTop();\n            retroShell === null || retroShell === void 0 ? void 0 : retroShell.menu.setHidden(false);\n            zenModeEnabled = false;\n        };\n        let zenModeEnabled = false;\n        commands.addCommand(CommandIDs.toggleZen, {\n            label: 'Toggle Zen Mode',\n            execute: () => {\n                if (!zenModeEnabled) {\n                    elem.requestFullscreen();\n                    toggleOn();\n                }\n                else {\n                    document.exitFullscreen();\n                    toggleOff();\n                }\n            }\n        });\n        document.addEventListener('fullscreenchange', () => {\n            if (!document.fullscreenElement) {\n                toggleOff();\n            }\n        });\n        if (palette) {\n            palette.addItem({ command: CommandIDs.toggleZen, category: 'Mode' });\n        }\n        if (menu) {\n            menu.viewMenu.addGroup([{ command: CommandIDs.toggleZen }], 3);\n        }\n    }\n};\n/**\n * Export the plugins as default.\n */\nconst plugins = [\n    dirty,\n    logo,\n    noTabsMenu,\n    opener,\n    pages,\n    paths,\n    router,\n    sessionDialogs,\n    shell,\n    spacer,\n    status,\n    tabTitle,\n    title,\n    topVisibility,\n    translator,\n    tree,\n    treePathUpdater,\n    zen\n];\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (plugins);\n\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../packages/application-extension/lib/index.js?");

/***/ })

}]);