/*
 * 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([["vendors-node_modules_jupyterlab_mainmenu-extension_lib_index_js"],{

/***/ "../node_modules/@jupyterlab/mainmenu-extension/lib/index.js":
/*!*******************************************************************!*\
  !*** ../node_modules/@jupyterlab/mainmenu-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 */   \"CommandIDs\": () => (/* binding */ CommandIDs),\n/* harmony export */   \"createEditMenu\": () => (/* binding */ createEditMenu),\n/* harmony export */   \"createFileMenu\": () => (/* binding */ createFileMenu),\n/* harmony export */   \"createKernelMenu\": () => (/* binding */ createKernelMenu),\n/* harmony export */   \"createViewMenu\": () => (/* binding */ createViewMenu),\n/* harmony export */   \"createRunMenu\": () => (/* binding */ createRunMenu),\n/* harmony export */   \"createTabsMenu\": () => (/* binding */ createTabsMenu),\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_coreutils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyterlab/coreutils */ \"webpack/sharing/consume/default/@jupyterlab/coreutils/@jupyterlab/coreutils\");\n/* harmony import */ var _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @jupyterlab/mainmenu */ \"webpack/sharing/consume/default/@jupyterlab/mainmenu/@jupyterlab/mainmenu\");\n/* harmony import */ var _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _jupyterlab_services__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @jupyterlab/services */ \"webpack/sharing/consume/default/@jupyterlab/services/@jupyterlab/services\");\n/* harmony import */ var _jupyterlab_services__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_services__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @jupyterlab/settingregistry */ \"webpack/sharing/consume/default/@jupyterlab/settingregistry/@jupyterlab/settingregistry\");\n/* harmony import */ var _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @jupyterlab/translation */ \"webpack/sharing/consume/default/@jupyterlab/translation/@jupyterlab/translation\");\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @lumino/algorithm */ \"webpack/sharing/consume/default/@lumino/algorithm/@lumino/algorithm\");\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @lumino/coreutils */ \"webpack/sharing/consume/default/@lumino/coreutils/@lumino/coreutils\");\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @lumino/widgets */ \"webpack/sharing/consume/default/@lumino/widgets/@lumino/widgets\");\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_lumino_widgets__WEBPACK_IMPORTED_MODULE_9__);\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * @packageDocumentation\n * @module mainmenu-extension\n */\n\n\n\n\n\n\n\n\n\n\nconst PLUGIN_ID = '@jupyterlab/mainmenu-extension:plugin';\n/**\n * A namespace for command IDs of semantic extension points.\n */\nvar CommandIDs;\n(function (CommandIDs) {\n    CommandIDs.openEdit = 'editmenu:open';\n    CommandIDs.undo = 'editmenu:undo';\n    CommandIDs.redo = 'editmenu:redo';\n    CommandIDs.clearCurrent = 'editmenu:clear-current';\n    CommandIDs.clearAll = 'editmenu:clear-all';\n    CommandIDs.find = 'editmenu:find';\n    CommandIDs.goToLine = 'editmenu:go-to-line';\n    CommandIDs.openFile = 'filemenu:open';\n    CommandIDs.closeAndCleanup = 'filemenu:close-and-cleanup';\n    CommandIDs.createConsole = 'filemenu:create-console';\n    CommandIDs.shutdown = 'filemenu:shutdown';\n    CommandIDs.logout = 'filemenu:logout';\n    CommandIDs.openKernel = 'kernelmenu:open';\n    CommandIDs.interruptKernel = 'kernelmenu:interrupt';\n    CommandIDs.reconnectToKernel = 'kernelmenu:reconnect-to-kernel';\n    CommandIDs.restartKernel = 'kernelmenu:restart';\n    CommandIDs.restartKernelAndClear = 'kernelmenu:restart-and-clear';\n    CommandIDs.changeKernel = 'kernelmenu:change';\n    CommandIDs.shutdownKernel = 'kernelmenu:shutdown';\n    CommandIDs.shutdownAllKernels = 'kernelmenu:shutdownAll';\n    CommandIDs.openView = 'viewmenu:open';\n    CommandIDs.wordWrap = 'viewmenu:word-wrap';\n    CommandIDs.lineNumbering = 'viewmenu:line-numbering';\n    CommandIDs.matchBrackets = 'viewmenu:match-brackets';\n    CommandIDs.openRun = 'runmenu:open';\n    CommandIDs.run = 'runmenu:run';\n    CommandIDs.runAll = 'runmenu:run-all';\n    CommandIDs.restartAndRunAll = 'runmenu:restart-and-run-all';\n    CommandIDs.runAbove = 'runmenu:run-above';\n    CommandIDs.runBelow = 'runmenu:run-below';\n    CommandIDs.openTabs = 'tabsmenu:open';\n    CommandIDs.activateById = 'tabsmenu:activate-by-id';\n    CommandIDs.activatePreviouslyUsedTab = 'tabsmenu:activate-previously-used-tab';\n    CommandIDs.openSettings = 'settingsmenu:open';\n    CommandIDs.openHelp = 'helpmenu:open';\n    CommandIDs.openFirst = 'mainmenu:open-first';\n})(CommandIDs || (CommandIDs = {}));\n/**\n * A service providing an interface to the main menu.\n */\nconst plugin = {\n    id: PLUGIN_ID,\n    requires: [_jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.IRouter, _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_6__.ITranslator],\n    optional: [_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.ICommandPalette, _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.ILabShell, _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_5__.ISettingRegistry],\n    provides: _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_3__.IMainMenu,\n    activate: async (app, router, translator, palette, labShell, registry) => {\n        const { commands } = app;\n        const trans = translator.load('jupyterlab');\n        const menu = new _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_3__.MainMenu(commands);\n        menu.id = 'jp-MainMenu';\n        menu.addClass('jp-scrollbar-tiny');\n        // Built menu from settings\n        if (registry) {\n            await Private.loadSettingsMenu(registry, (aMenu) => {\n                menu.addMenu(aMenu, { rank: aMenu.rank });\n            }, options => _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_3__.MainMenu.generateMenu(commands, options, trans), translator);\n        }\n        // Only add quit button if the back-end supports it by checking page config.\n        const quitButton = _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_2__.PageConfig.getOption('quitButton').toLowerCase();\n        menu.fileMenu.quitEntry = quitButton === 'true';\n        // Create the application menus.\n        createEditMenu(app, menu.editMenu, trans);\n        createFileMenu(app, menu.fileMenu, router, trans);\n        createKernelMenu(app, menu.kernelMenu, trans);\n        createRunMenu(app, menu.runMenu, trans);\n        createViewMenu(app, menu.viewMenu, trans);\n        // The tabs menu relies on lab shell functionality.\n        if (labShell) {\n            createTabsMenu(app, menu.tabsMenu, labShell, trans);\n        }\n        // Create commands to open the main application menus.\n        const activateMenu = (item) => {\n            menu.activeMenu = item;\n            menu.openActiveMenu();\n        };\n        commands.addCommand(CommandIDs.openEdit, {\n            label: trans.__('Open Edit Menu'),\n            execute: () => activateMenu(menu.editMenu)\n        });\n        commands.addCommand(CommandIDs.openFile, {\n            label: trans.__('Open File Menu'),\n            execute: () => activateMenu(menu.fileMenu)\n        });\n        commands.addCommand(CommandIDs.openKernel, {\n            label: trans.__('Open Kernel Menu'),\n            execute: () => activateMenu(menu.kernelMenu)\n        });\n        commands.addCommand(CommandIDs.openRun, {\n            label: trans.__('Open Run Menu'),\n            execute: () => activateMenu(menu.runMenu)\n        });\n        commands.addCommand(CommandIDs.openView, {\n            label: trans.__('Open View Menu'),\n            execute: () => activateMenu(menu.viewMenu)\n        });\n        commands.addCommand(CommandIDs.openSettings, {\n            label: trans.__('Open Settings Menu'),\n            execute: () => activateMenu(menu.settingsMenu)\n        });\n        commands.addCommand(CommandIDs.openTabs, {\n            label: trans.__('Open Tabs Menu'),\n            execute: () => activateMenu(menu.tabsMenu)\n        });\n        commands.addCommand(CommandIDs.openHelp, {\n            label: trans.__('Open Help Menu'),\n            execute: () => activateMenu(menu.helpMenu)\n        });\n        commands.addCommand(CommandIDs.openFirst, {\n            label: trans.__('Open First Menu'),\n            execute: () => {\n                menu.activeIndex = 0;\n                menu.openActiveMenu();\n            }\n        });\n        if (palette) {\n            // Add some of the commands defined here to the command palette.\n            palette.addItem({\n                command: CommandIDs.shutdown,\n                category: trans.__('Main Area')\n            });\n            palette.addItem({\n                command: CommandIDs.logout,\n                category: trans.__('Main Area')\n            });\n            palette.addItem({\n                command: CommandIDs.shutdownAllKernels,\n                category: trans.__('Kernel Operations')\n            });\n            palette.addItem({\n                command: CommandIDs.activatePreviouslyUsedTab,\n                category: trans.__('Main Area')\n            });\n        }\n        app.shell.add(menu, 'menu', { rank: 100 });\n        return menu;\n    }\n};\n/**\n * Create the basic `Edit` menu.\n */\nfunction createEditMenu(app, menu, trans) {\n    const commands = app.commands;\n    // Add the undo/redo commands the the Edit menu.\n    commands.addCommand(CommandIDs.undo, {\n        label: trans.__('Undo'),\n        isEnabled: Private.delegateEnabled(app, menu.undoers, 'undo'),\n        execute: Private.delegateExecute(app, menu.undoers, 'undo')\n    });\n    commands.addCommand(CommandIDs.redo, {\n        label: trans.__('Redo'),\n        isEnabled: Private.delegateEnabled(app, menu.undoers, 'redo'),\n        execute: Private.delegateExecute(app, menu.undoers, 'redo')\n    });\n    // Add the clear commands to the Edit menu.\n    commands.addCommand(CommandIDs.clearCurrent, {\n        label: () => {\n            const enabled = Private.delegateEnabled(app, menu.clearers, 'clearCurrent')();\n            let localizedLabel = trans.__('Clear');\n            if (enabled) {\n                localizedLabel = Private.delegateLabel(app, menu.clearers, 'clearCurrentLabel');\n            }\n            return localizedLabel;\n        },\n        isEnabled: Private.delegateEnabled(app, menu.clearers, 'clearCurrent'),\n        execute: Private.delegateExecute(app, menu.clearers, 'clearCurrent')\n    });\n    commands.addCommand(CommandIDs.clearAll, {\n        label: () => {\n            const enabled = Private.delegateEnabled(app, menu.clearers, 'clearAll')();\n            let localizedLabel = trans.__('Clear All');\n            if (enabled) {\n                localizedLabel = Private.delegateLabel(app, menu.clearers, 'clearAllLabel');\n            }\n            return localizedLabel;\n        },\n        isEnabled: Private.delegateEnabled(app, menu.clearers, 'clearAll'),\n        execute: Private.delegateExecute(app, menu.clearers, 'clearAll')\n    });\n    commands.addCommand(CommandIDs.goToLine, {\n        label: trans.__('Go to Line…'),\n        isEnabled: Private.delegateEnabled(app, menu.goToLiners, 'goToLine'),\n        execute: Private.delegateExecute(app, menu.goToLiners, 'goToLine')\n    });\n}\n/**\n * Create the basic `File` menu.\n */\nfunction createFileMenu(app, menu, router, trans) {\n    const commands = app.commands;\n    // Add a delegator command for closing and cleaning up an activity.\n    // This one is a bit different, in that we consider it enabled\n    // even if it cannot find a delegate for the activity.\n    // In that case, we instead call the application `close` command.\n    commands.addCommand(CommandIDs.closeAndCleanup, {\n        label: () => {\n            const localizedLabel = Private.delegateLabel(app, menu.closeAndCleaners, 'closeAndCleanupLabel');\n            return localizedLabel ? localizedLabel : trans.__('Close and Shutdown');\n        },\n        isEnabled: () => !!app.shell.currentWidget && !!app.shell.currentWidget.title.closable,\n        execute: () => {\n            // Check if we have a registered delegate. If so, call that.\n            if (Private.delegateEnabled(app, menu.closeAndCleaners, 'closeAndCleanup')()) {\n                return Private.delegateExecute(app, menu.closeAndCleaners, 'closeAndCleanup')();\n            }\n            // If we have no delegate, call the top-level application close.\n            return app.commands.execute('application:close');\n        }\n    });\n    // Add a delegator command for creating a console for an activity.\n    commands.addCommand(CommandIDs.createConsole, {\n        label: () => {\n            const localizedLabel = Private.delegateLabel(app, menu.consoleCreators, 'createConsoleLabel');\n            return localizedLabel\n                ? localizedLabel\n                : trans.__('New Console for Activity');\n        },\n        isEnabled: Private.delegateEnabled(app, menu.consoleCreators, 'createConsole'),\n        execute: Private.delegateExecute(app, menu.consoleCreators, 'createConsole')\n    });\n    commands.addCommand(CommandIDs.shutdown, {\n        label: trans.__('Shut Down'),\n        caption: trans.__('Shut down JupyterLab'),\n        isVisible: () => menu.quitEntry,\n        isEnabled: () => menu.quitEntry,\n        execute: () => {\n            return (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.showDialog)({\n                title: trans.__('Shutdown confirmation'),\n                body: trans.__('Please confirm you want to shut down JupyterLab.'),\n                buttons: [\n                    _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.Dialog.cancelButton(),\n                    _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.Dialog.warnButton({ label: trans.__('Shut Down') })\n                ]\n            }).then(async (result) => {\n                if (result.button.accept) {\n                    const setting = _jupyterlab_services__WEBPACK_IMPORTED_MODULE_4__.ServerConnection.makeSettings();\n                    const apiURL = _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_2__.URLExt.join(setting.baseUrl, 'api/shutdown');\n                    // Shutdown all kernel and terminal sessions before shutting down the server\n                    // If this fails, we continue execution so we can post an api/shutdown request\n                    try {\n                        await Promise.all([\n                            app.serviceManager.sessions.shutdownAll(),\n                            app.serviceManager.terminals.shutdownAll()\n                        ]);\n                    }\n                    catch (e) {\n                        // Do nothing\n                        console.log(`Failed to shutdown sessions and terminals: ${e}`);\n                    }\n                    return _jupyterlab_services__WEBPACK_IMPORTED_MODULE_4__.ServerConnection.makeRequest(apiURL, { method: 'POST' }, setting)\n                        .then(result => {\n                        if (result.ok) {\n                            // Close this window if the shutdown request has been successful\n                            const body = document.createElement('div');\n                            const p1 = document.createElement('p');\n                            p1.textContent = trans.__('You have shut down the Jupyter server. You can now close this tab.');\n                            const p2 = document.createElement('p');\n                            p2.textContent = trans.__('To use JupyterLab again, you will need to relaunch it.');\n                            body.appendChild(p1);\n                            body.appendChild(p2);\n                            void (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.showDialog)({\n                                title: trans.__('Server stopped'),\n                                body: new _lumino_widgets__WEBPACK_IMPORTED_MODULE_9__.Widget({ node: body }),\n                                buttons: []\n                            });\n                            window.close();\n                        }\n                        else {\n                            throw new _jupyterlab_services__WEBPACK_IMPORTED_MODULE_4__.ServerConnection.ResponseError(result);\n                        }\n                    })\n                        .catch(data => {\n                        throw new _jupyterlab_services__WEBPACK_IMPORTED_MODULE_4__.ServerConnection.NetworkError(data);\n                    });\n                }\n            });\n        }\n    });\n    commands.addCommand(CommandIDs.logout, {\n        label: trans.__('Log Out'),\n        caption: trans.__('Log out of JupyterLab'),\n        isVisible: () => menu.quitEntry,\n        isEnabled: () => menu.quitEntry,\n        execute: () => {\n            router.navigate('/logout', { hard: true });\n        }\n    });\n}\n/**\n * Create the basic `Kernel` menu.\n */\nfunction createKernelMenu(app, menu, trans) {\n    const commands = app.commands;\n    commands.addCommand(CommandIDs.interruptKernel, {\n        label: trans.__('Interrupt Kernel'),\n        isEnabled: Private.delegateEnabled(app, menu.kernelUsers, 'interruptKernel'),\n        execute: Private.delegateExecute(app, menu.kernelUsers, 'interruptKernel')\n    });\n    commands.addCommand(CommandIDs.reconnectToKernel, {\n        label: trans.__('Reconnect to Kernel'),\n        isEnabled: Private.delegateEnabled(app, menu.kernelUsers, 'reconnectToKernel'),\n        execute: Private.delegateExecute(app, menu.kernelUsers, 'reconnectToKernel')\n    });\n    commands.addCommand(CommandIDs.restartKernel, {\n        label: trans.__('Restart Kernel…'),\n        isEnabled: Private.delegateEnabled(app, menu.kernelUsers, 'restartKernel'),\n        execute: Private.delegateExecute(app, menu.kernelUsers, 'restartKernel')\n    });\n    commands.addCommand(CommandIDs.restartKernelAndClear, {\n        label: () => {\n            const enabled = Private.delegateEnabled(app, menu.kernelUsers, 'restartKernelAndClear')();\n            let localizedLabel = trans.__('Restart Kernel and Clear…');\n            if (enabled) {\n                localizedLabel = Private.delegateLabel(app, menu.kernelUsers, 'restartKernelAndClearLabel');\n            }\n            return localizedLabel;\n        },\n        isEnabled: Private.delegateEnabled(app, menu.kernelUsers, 'restartKernelAndClear'),\n        execute: Private.delegateExecute(app, menu.kernelUsers, 'restartKernelAndClear')\n    });\n    commands.addCommand(CommandIDs.changeKernel, {\n        label: trans.__('Change Kernel…'),\n        isEnabled: Private.delegateEnabled(app, menu.kernelUsers, 'changeKernel'),\n        execute: Private.delegateExecute(app, menu.kernelUsers, 'changeKernel')\n    });\n    commands.addCommand(CommandIDs.shutdownKernel, {\n        label: trans.__('Shut Down Kernel'),\n        isEnabled: Private.delegateEnabled(app, menu.kernelUsers, 'shutdownKernel'),\n        execute: Private.delegateExecute(app, menu.kernelUsers, 'shutdownKernel')\n    });\n    commands.addCommand(CommandIDs.shutdownAllKernels, {\n        label: trans.__('Shut Down All Kernels…'),\n        isEnabled: () => {\n            return app.serviceManager.sessions.running().next() !== undefined;\n        },\n        execute: () => {\n            return (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.showDialog)({\n                title: trans.__('Shut Down All?'),\n                body: trans.__('Shut down all kernels?'),\n                buttons: [\n                    _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.Dialog.cancelButton({ label: trans.__('Dismiss') }),\n                    _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.Dialog.warnButton({ label: trans.__('Shut Down All') })\n                ]\n            }).then(result => {\n                if (result.button.accept) {\n                    return app.serviceManager.sessions.shutdownAll();\n                }\n            });\n        }\n    });\n}\n/**\n * Create the basic `View` menu.\n */\nfunction createViewMenu(app, menu, trans) {\n    const commands = app.commands;\n    commands.addCommand(CommandIDs.lineNumbering, {\n        label: trans.__('Show Line Numbers'),\n        isEnabled: Private.delegateEnabled(app, menu.editorViewers, 'toggleLineNumbers'),\n        isToggled: Private.delegateToggled(app, menu.editorViewers, 'lineNumbersToggled'),\n        execute: Private.delegateExecute(app, menu.editorViewers, 'toggleLineNumbers')\n    });\n    commands.addCommand(CommandIDs.matchBrackets, {\n        label: trans.__('Match Brackets'),\n        isEnabled: Private.delegateEnabled(app, menu.editorViewers, 'toggleMatchBrackets'),\n        isToggled: Private.delegateToggled(app, menu.editorViewers, 'matchBracketsToggled'),\n        execute: Private.delegateExecute(app, menu.editorViewers, 'toggleMatchBrackets')\n    });\n    commands.addCommand(CommandIDs.wordWrap, {\n        label: trans.__('Wrap Words'),\n        isEnabled: Private.delegateEnabled(app, menu.editorViewers, 'toggleWordWrap'),\n        isToggled: Private.delegateToggled(app, menu.editorViewers, 'wordWrapToggled'),\n        execute: Private.delegateExecute(app, menu.editorViewers, 'toggleWordWrap')\n    });\n}\n/**\n * Create the basic `Run` menu.\n */\nfunction createRunMenu(app, menu, trans) {\n    const commands = app.commands;\n    commands.addCommand(CommandIDs.run, {\n        label: () => {\n            const localizedLabel = Private.delegateLabel(app, menu.codeRunners, 'runLabel');\n            const enabled = Private.delegateEnabled(app, menu.codeRunners, 'run')();\n            return enabled ? localizedLabel : trans.__('Run Selected');\n        },\n        isEnabled: Private.delegateEnabled(app, menu.codeRunners, 'run'),\n        execute: Private.delegateExecute(app, menu.codeRunners, 'run')\n    });\n    commands.addCommand(CommandIDs.runAll, {\n        label: () => {\n            let localizedLabel = trans.__('Run All');\n            const enabled = Private.delegateEnabled(app, menu.codeRunners, 'runAll')();\n            if (enabled) {\n                localizedLabel = Private.delegateLabel(app, menu.codeRunners, 'runAllLabel');\n            }\n            return localizedLabel;\n        },\n        isEnabled: Private.delegateEnabled(app, menu.codeRunners, 'runAll'),\n        execute: Private.delegateExecute(app, menu.codeRunners, 'runAll')\n    });\n    commands.addCommand(CommandIDs.restartAndRunAll, {\n        label: () => {\n            let localizedLabel = trans.__('Restart Kernel and Run All');\n            const enabled = Private.delegateEnabled(app, menu.codeRunners, 'restartAndRunAll')();\n            if (enabled) {\n                localizedLabel = Private.delegateLabel(app, menu.codeRunners, 'restartAndRunAllLabel');\n            }\n            return localizedLabel;\n        },\n        isEnabled: Private.delegateEnabled(app, menu.codeRunners, 'restartAndRunAll'),\n        execute: Private.delegateExecute(app, menu.codeRunners, 'restartAndRunAll')\n    });\n}\n/**\n * Create the basic `Tabs` menu.\n */\nfunction createTabsMenu(app, menu, labShell, trans) {\n    const commands = app.commands;\n    // A list of the active tabs in the main area.\n    const tabGroup = [];\n    // A disposable for getting rid of the out-of-date tabs list.\n    let disposable;\n    // Command to activate a widget by id.\n    commands.addCommand(CommandIDs.activateById, {\n        label: args => {\n            const id = args['id'] || '';\n            const widget = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_7__.find)(app.shell.widgets('main'), w => w.id === id);\n            return (widget && widget.title.label) || '';\n        },\n        isToggled: args => {\n            const id = args['id'] || '';\n            return !!app.shell.currentWidget && app.shell.currentWidget.id === id;\n        },\n        execute: args => app.shell.activateById(args['id'] || '')\n    });\n    let previousId = '';\n    // Command to toggle between the current\n    // tab and the last modified tab.\n    commands.addCommand(CommandIDs.activatePreviouslyUsedTab, {\n        label: trans.__('Activate Previously Used Tab'),\n        isEnabled: () => !!previousId,\n        execute: () => commands.execute(CommandIDs.activateById, { id: previousId })\n    });\n    if (labShell) {\n        void app.restored.then(() => {\n            // Iterate over the current widgets in the\n            // main area, and add them to the tab group\n            // of the menu.\n            const populateTabs = () => {\n                // remove the previous tab list\n                if (disposable && !disposable.isDisposed) {\n                    disposable.dispose();\n                }\n                tabGroup.length = 0;\n                let isPreviouslyUsedTabAttached = false;\n                (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_7__.each)(app.shell.widgets('main'), widget => {\n                    if (widget.id === previousId) {\n                        isPreviouslyUsedTabAttached = true;\n                    }\n                    tabGroup.push({\n                        command: CommandIDs.activateById,\n                        args: { id: widget.id }\n                    });\n                });\n                disposable = menu.addGroup(tabGroup, 1);\n                previousId = isPreviouslyUsedTabAttached ? previousId : '';\n            };\n            populateTabs();\n            labShell.layoutModified.connect(() => {\n                populateTabs();\n            });\n            // Update the ID of the previous active tab if a new tab is selected.\n            labShell.currentChanged.connect((_, args) => {\n                const widget = args.oldValue;\n                if (!widget) {\n                    return;\n                }\n                previousId = widget.id;\n            });\n        });\n    }\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (plugin);\n/**\n * A namespace for Private data.\n */\nvar Private;\n(function (Private) {\n    /**\n     * Return the first value of the iterable that satisfies the predicate\n     * function.\n     */\n    function find(it, predicate) {\n        for (const value of it) {\n            if (predicate(value)) {\n                return value;\n            }\n        }\n        return undefined;\n    }\n    /**\n     * A utility function that delegates a portion of a label to an IMenuExtender.\n     */\n    function delegateLabel(app, s, label) {\n        const widget = app.shell.currentWidget;\n        const extender = widget\n            ? find(s, value => value.tracker.has(widget))\n            : undefined;\n        if (!extender) {\n            return '';\n        }\n        else {\n            const count = extender.tracker.size;\n            // Coerce the result to be a string. When Typedoc is updated to use\n            // Typescript 2.8, we can possibly use conditional types to get Typescript\n            // to recognize this is a string.\n            return extender[label](count);\n        }\n    }\n    Private.delegateLabel = delegateLabel;\n    /**\n     * A utility function that delegates command execution\n     * to an IMenuExtender.\n     */\n    function delegateExecute(app, s, executor) {\n        return () => {\n            const widget = app.shell.currentWidget;\n            const extender = widget\n                ? find(s, value => value.tracker.has(widget))\n                : undefined;\n            if (!extender) {\n                return Promise.resolve(void 0);\n            }\n            // Coerce the result to be a function. When Typedoc is updated to use\n            // Typescript 2.8, we can possibly use conditional types to get Typescript\n            // to recognize this is a function.\n            const f = extender[executor];\n            return f(widget);\n        };\n    }\n    Private.delegateExecute = delegateExecute;\n    /**\n     * A utility function that delegates whether a command is enabled\n     * to an IMenuExtender.\n     */\n    function delegateEnabled(app, s, executor) {\n        return () => {\n            const widget = app.shell.currentWidget;\n            const extender = widget\n                ? find(s, value => value.tracker.has(widget))\n                : undefined;\n            return (!!extender &&\n                !!extender[executor] &&\n                (extender.isEnabled && widget ? extender.isEnabled(widget) : true));\n        };\n    }\n    Private.delegateEnabled = delegateEnabled;\n    /**\n     * A utility function that delegates whether a command is toggled\n     * for an IMenuExtender.\n     */\n    function delegateToggled(app, s, toggled) {\n        return () => {\n            const widget = app.shell.currentWidget;\n            const extender = widget\n                ? find(s, value => value.tracker.has(widget))\n                : undefined;\n            // Coerce extender[toggled] to be a function. When Typedoc is updated to use\n            // Typescript 2.8, we can possibly use conditional types to get Typescript\n            // to recognize this is a function.\n            return (!!extender &&\n                !!extender[toggled] &&\n                !!widget &&\n                !!extender[toggled](widget));\n        };\n    }\n    Private.delegateToggled = delegateToggled;\n    async function displayInformation(trans) {\n        const result = await (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.showDialog)({\n            title: trans.__('Information'),\n            body: trans.__('Menu customization has changed. You will need to reload JupyterLab to see the changes.'),\n            buttons: [\n                _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.Dialog.cancelButton(),\n                _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.Dialog.okButton({ label: trans.__('Reload') })\n            ]\n        });\n        if (result.button.accept) {\n            location.reload();\n        }\n    }\n    async function loadSettingsMenu(registry, addMenu, menuFactory, translator) {\n        var _a;\n        const trans = translator.load('jupyterlab');\n        let canonical;\n        let loaded = {};\n        /**\n         * Populate the plugin's schema defaults.\n         */\n        function populate(schema) {\n            var _a, _b;\n            loaded = {};\n            schema.properties.menus.default = Object.keys(registry.plugins)\n                .map(plugin => {\n                var _a, _b;\n                const menus = (_b = (_a = registry.plugins[plugin].schema['jupyter.lab.menus']) === null || _a === void 0 ? void 0 : _a.main) !== null && _b !== void 0 ? _b : [];\n                loaded[plugin] = menus;\n                return menus;\n            })\n                .concat([\n                (_b = (_a = schema['jupyter.lab.menus']) === null || _a === void 0 ? void 0 : _a.main) !== null && _b !== void 0 ? _b : [],\n                schema.properties.menus.default\n            ])\n                .reduceRight((acc, val) => _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_5__.SettingRegistry.reconcileMenus(acc, val, true), []) // flatten one level\n                .sort((a, b) => { var _a, _b; return ((_a = a.rank) !== null && _a !== void 0 ? _a : Infinity) - ((_b = b.rank) !== null && _b !== void 0 ? _b : Infinity); });\n        }\n        // Transform the plugin object to return different schema than the default.\n        registry.transform(PLUGIN_ID, {\n            compose: plugin => {\n                var _a, _b, _c, _d;\n                // Only override the canonical schema the first time.\n                if (!canonical) {\n                    canonical = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_8__.JSONExt.deepCopy(plugin.schema);\n                    populate(canonical);\n                }\n                const defaults = (_c = (_b = (_a = canonical.properties) === null || _a === void 0 ? void 0 : _a.menus) === null || _b === void 0 ? void 0 : _b.default) !== null && _c !== void 0 ? _c : [];\n                const user = {\n                    menus: (_d = plugin.data.user.menus) !== null && _d !== void 0 ? _d : []\n                };\n                const composite = {\n                    menus: _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_5__.SettingRegistry.reconcileMenus(defaults, user.menus)\n                };\n                plugin.data = { composite, user };\n                return plugin;\n            },\n            fetch: plugin => {\n                // Only override the canonical schema the first time.\n                if (!canonical) {\n                    canonical = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_8__.JSONExt.deepCopy(plugin.schema);\n                    populate(canonical);\n                }\n                return {\n                    data: plugin.data,\n                    id: plugin.id,\n                    raw: plugin.raw,\n                    schema: canonical,\n                    version: plugin.version\n                };\n            }\n        });\n        // Repopulate the canonical variable after the setting registry has\n        // preloaded all initial plugins.\n        canonical = null;\n        const settings = await registry.load(PLUGIN_ID);\n        const currentMenus = (_a = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_8__.JSONExt.deepCopy(settings.composite.menus)) !== null && _a !== void 0 ? _a : [];\n        const menus = new Array();\n        // Create menu for non-disabled element\n        _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.MenuFactory.createMenus(currentMenus\n            .filter(menu => !menu.disabled)\n            .map(menu => {\n            var _a;\n            return Object.assign(Object.assign({}, menu), { items: _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_5__.SettingRegistry.filterDisabledItems((_a = menu.items) !== null && _a !== void 0 ? _a : []) });\n        }), menuFactory).forEach(menu => {\n            menus.push(menu);\n            addMenu(menu);\n        });\n        settings.changed.connect(() => {\n            var _a;\n            // As extension may change menu through API, prompt the user to reload if the\n            // menu has been updated.\n            const newMenus = (_a = settings.composite.menus) !== null && _a !== void 0 ? _a : [];\n            if (!_lumino_coreutils__WEBPACK_IMPORTED_MODULE_8__.JSONExt.deepEqual(currentMenus, newMenus)) {\n                void displayInformation(trans);\n            }\n        });\n        registry.pluginChanged.connect(async (sender, plugin) => {\n            var _a, _b, _c;\n            if (plugin !== PLUGIN_ID) {\n                // If the plugin changed its menu.\n                const oldMenus = (_a = loaded[plugin]) !== null && _a !== void 0 ? _a : [];\n                const newMenus = (_c = (_b = registry.plugins[plugin].schema['jupyter.lab.menus']) === null || _b === void 0 ? void 0 : _b.main) !== null && _c !== void 0 ? _c : [];\n                if (!_lumino_coreutils__WEBPACK_IMPORTED_MODULE_8__.JSONExt.deepEqual(oldMenus, newMenus)) {\n                    if (loaded[plugin]) {\n                        // The plugin has changed, request the user to reload the UI - this should not happen\n                        await displayInformation(trans);\n                    }\n                    else {\n                        // The plugin was not yet loaded when the menu was built => update the menu\n                        loaded[plugin] = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_8__.JSONExt.deepCopy(newMenus);\n                        // Merge potential disabled state\n                        const toAdd = _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_5__.SettingRegistry.reconcileMenus(newMenus, currentMenus, false, false)\n                            .filter(menu => !menu.disabled)\n                            .map(menu => {\n                            var _a;\n                            return Object.assign(Object.assign({}, menu), { items: _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_5__.SettingRegistry.filterDisabledItems((_a = menu.items) !== null && _a !== void 0 ? _a : []) });\n                        });\n                        _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.MenuFactory.updateMenus(menus, toAdd, menuFactory).forEach(menu => {\n                            addMenu(menu);\n                        });\n                    }\n                }\n            }\n        });\n    }\n    Private.loadSettingsMenu = loadSettingsMenu;\n})(Private || (Private = {}));\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/mainmenu-extension/lib/index.js?");

/***/ })

}]);