/*
 * 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_tree-extension_lib_index_js"],{

/***/ "../packages/tree-extension/lib/index.js":
/*!***********************************************!*\
  !*** ../packages/tree-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_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_docmanager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @jupyterlab/docmanager */ \"webpack/sharing/consume/default/@jupyterlab/docmanager/@jupyterlab/docmanager\");\n/* harmony import */ var _jupyterlab_docmanager__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_docmanager__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _jupyterlab_filebrowser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @jupyterlab/filebrowser */ \"webpack/sharing/consume/default/@jupyterlab/filebrowser/@jupyterlab/filebrowser\");\n/* harmony import */ var _jupyterlab_filebrowser__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_filebrowser__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @jupyterlab/mainmenu */ \"webpack/sharing/consume/default/@jupyterlab/mainmenu/@jupyterlab/mainmenu\");\n/* harmony import */ var _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _jupyterlab_running__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @jupyterlab/running */ \"webpack/sharing/consume/default/@jupyterlab/running/@jupyterlab/running\");\n/* harmony import */ var _jupyterlab_running__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_running__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @jupyterlab/settingregistry */ \"webpack/sharing/consume/default/@jupyterlab/settingregistry/@jupyterlab/settingregistry\");\n/* harmony import */ var _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _jupyterlab_statedb__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @jupyterlab/statedb */ \"webpack/sharing/consume/default/@jupyterlab/statedb/@jupyterlab/statedb\");\n/* harmony import */ var _jupyterlab_statedb__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_statedb__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @jupyterlab/translation */ \"webpack/sharing/consume/default/@jupyterlab/translation/@jupyterlab/translation\");\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_9__);\n/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @jupyterlab/ui-components */ \"webpack/sharing/consume/default/@jupyterlab/ui-components/@jupyterlab/ui-components\");\n/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__);\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @lumino/algorithm */ \"webpack/sharing/consume/default/@lumino/algorithm/@lumino/algorithm\");\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_lumino_algorithm__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// Vendored from https://github.com/jupyterlab/jupyterlab/blob/b9511a52557d6ae56e597d0f48392993bdc432ae/packages/filebrowser-extension/src/index.ts\n// Because of ILabShell being a required dependency in some of the plugins\n// TODO: remove this package when ILabShell is optional upstream\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 command IDs used by the file browser plugin.\n */\nvar CommandIDs;\n(function (CommandIDs) {\n    CommandIDs.copy = 'filebrowser:copy';\n    CommandIDs.copyDownloadLink = 'filebrowser:copy-download-link';\n    CommandIDs.cut = 'filebrowser:cut';\n    CommandIDs.del = 'filebrowser:delete';\n    CommandIDs.download = 'filebrowser:download';\n    CommandIDs.duplicate = 'filebrowser:duplicate';\n    CommandIDs.goToPath = 'filebrowser:go-to-path';\n    CommandIDs.openPath = 'filebrowser:open-path';\n    CommandIDs.open = 'filebrowser:open';\n    CommandIDs.openBrowserTab = 'filebrowser:open-browser-tab';\n    CommandIDs.paste = 'filebrowser:paste';\n    CommandIDs.createNewDirectory = 'filebrowser:create-new-directory';\n    CommandIDs.createNewFile = 'filebrowser:create-new-file';\n    CommandIDs.createNewMarkdownFile = 'filebrowser:create-new-markdown-file';\n    CommandIDs.rename = 'filebrowser:rename';\n    // For main browser only.\n    CommandIDs.share = 'filebrowser:share-main';\n    // For main browser only.\n    CommandIDs.copyPath = 'filebrowser:copy-path';\n    CommandIDs.shutdown = 'filebrowser:shutdown';\n    CommandIDs.toggleNavigateToCurrentDirectory = 'filebrowser:toggle-navigate-to-current-directory';\n    CommandIDs.toggleLastModified = 'filebrowser:toggle-last-modified';\n    CommandIDs.search = 'filebrowser:search';\n})(CommandIDs || (CommandIDs = {}));\n/**\n * Plugin to add extra buttons to the file browser to create\n * new notebooks, files and terminals.\n */\nconst newFiles = {\n    id: '@retrolab/tree-extension:buttons',\n    requires: [_jupyterlab_filebrowser__WEBPACK_IMPORTED_MODULE_4__.IFileBrowserFactory],\n    autoStart: true,\n    activate: (app, filebrowser) => {\n        const { commands } = app;\n        const browser = filebrowser.defaultBrowser;\n        // wrapper commands to be able to override the label\n        const newNotebookCommand = 'tree:new-notebook';\n        commands.addCommand(newNotebookCommand, {\n            label: 'New Notebook',\n            icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.notebookIcon,\n            execute: () => {\n                return commands.execute('notebook:create-new');\n            }\n        });\n        const newNotebook = new _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.CommandToolbarButton({\n            commands,\n            id: newNotebookCommand\n        });\n        const newFile = new _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.CommandToolbarButton({\n            commands,\n            id: CommandIDs.createNewFile\n        });\n        browser.toolbar.insertItem(0, 'new-notebook', newNotebook);\n        browser.toolbar.insertItem(1, 'new-file', newFile);\n    }\n};\n/**\n * Plugin to add a \"New Terminal\" button to the file browser toolbar.\n */\nconst newTerminal = {\n    id: '@retrolab/tree-extension:new-terminal',\n    requires: [_jupyterlab_filebrowser__WEBPACK_IMPORTED_MODULE_4__.IFileBrowserFactory],\n    autoStart: true,\n    activate: (app, filebrowser) => {\n        const { commands } = app;\n        const browser = filebrowser.defaultBrowser;\n        const newTerminalCommand = 'tree:new-terminal';\n        commands.addCommand(newTerminalCommand, {\n            label: 'New Terminal',\n            icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.terminalIcon,\n            execute: () => {\n                return commands.execute('terminal:create-new');\n            }\n        });\n        const newTerminal = new _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.CommandToolbarButton({\n            commands,\n            id: newTerminalCommand\n        });\n        browser.toolbar.insertItem(2, 'new-terminal', newTerminal);\n    }\n};\n/**\n * The default file browser extension.\n */\nconst browser = {\n    activate: activateBrowser,\n    id: '@retrolab/tree-extension:browser',\n    requires: [\n        _jupyterlab_filebrowser__WEBPACK_IMPORTED_MODULE_4__.IFileBrowserFactory,\n        _jupyterlab_docmanager__WEBPACK_IMPORTED_MODULE_3__.IDocumentManager,\n        _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_7__.ISettingRegistry,\n        _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_9__.ITranslator\n    ],\n    optional: [\n        _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.ICommandPalette,\n        _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_5__.IMainMenu,\n        _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.ILayoutRestorer,\n        _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.ITreePathUpdater,\n        _jupyterlab_running__WEBPACK_IMPORTED_MODULE_6__.IRunningSessionManagers\n    ],\n    autoStart: true\n};\n/**\n * The default file browser factory provider.\n *\n * TODO: remove and use upstream plugin\n */\nconst factory = {\n    activate: activateFactory,\n    id: '@retrolab/tree-extension:factory',\n    provides: _jupyterlab_filebrowser__WEBPACK_IMPORTED_MODULE_4__.IFileBrowserFactory,\n    requires: [_jupyterlab_docmanager__WEBPACK_IMPORTED_MODULE_3__.IDocumentManager, _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_9__.ITranslator],\n    optional: [_jupyterlab_statedb__WEBPACK_IMPORTED_MODULE_8__.IStateDB, _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.IRouter, _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.JupyterFrontEnd.ITreeResolver]\n};\n/**\n * The file browser namespace token.\n */\nconst namespace = 'filebrowser';\n/**\n * Activate the file browser factory provider.\n */\nasync function activateFactory(app, docManager, translator, state, router, tree) {\n    const { commands } = app;\n    const tracker = new _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.WidgetTracker({ namespace });\n    const createFileBrowser = (id, options = {}) => {\n        var _a;\n        const model = new _jupyterlab_filebrowser__WEBPACK_IMPORTED_MODULE_4__.FilterFileBrowserModel({\n            translator: translator,\n            auto: (_a = options.auto) !== null && _a !== void 0 ? _a : true,\n            manager: docManager,\n            driveName: options.driveName || '',\n            refreshInterval: options.refreshInterval,\n            state: options.state === null ? undefined : options.state || state || undefined\n        });\n        const restore = options.restore;\n        const widget = new _jupyterlab_filebrowser__WEBPACK_IMPORTED_MODULE_4__.FileBrowser({ id, model, restore, translator });\n        // Track the newly created file browser.\n        void tracker.add(widget);\n        return widget;\n    };\n    // Manually restore and load the default file browser.\n    const defaultBrowser = createFileBrowser('filebrowser', {\n        auto: false,\n        restore: false\n    });\n    void Private.restoreBrowser(defaultBrowser, commands, router, tree);\n    return { createFileBrowser, defaultBrowser, tracker };\n}\n/**\n * Activate the default file browser in the sidebar.\n */\nfunction activateBrowser(app, factory, docManager, settingRegistry, translator, commandPalette, mainMenu, restorer, treePathUpdater, manager) {\n    const browser = factory.defaultBrowser;\n    // Let the application restorer track the primary file browser (that is\n    // automatically created) for restoration of application state (e.g. setting\n    // the file browser as the current side bar widget).\n    //\n    // All other file browsers created by using the factory function are\n    // responsible for their own restoration behavior, if any.\n    if (restorer) {\n        restorer.add(browser, namespace);\n    }\n    addCommands(app, factory, settingRegistry, translator, commandPalette, mainMenu);\n    browser.title.icon = _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.folderIcon;\n    const tabPanel = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_12__.TabPanel({ tabPlacement: 'top', tabsMovable: true });\n    tabPanel.addClass('jp-TreePanel');\n    browser.title.label = 'Files';\n    tabPanel.addWidget(browser);\n    tabPanel.tabBar.addTab(browser.title);\n    if (manager) {\n        const running = new _jupyterlab_running__WEBPACK_IMPORTED_MODULE_6__.RunningSessions(manager, translator);\n        running.id = 'jp-running-sessions';\n        running.title.label = 'Running';\n        running.title.icon = _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.runningIcon;\n        tabPanel.addWidget(running);\n        tabPanel.tabBar.addTab(running.title);\n    }\n    app.shell.add(tabPanel, 'main', { rank: 100 });\n    void Promise.all([app.restored, browser.model.restored]).then(() => {\n        let navigateToCurrentDirectory = false;\n        let useFuzzyFilter = true;\n        void settingRegistry\n            .load('@jupyterlab/filebrowser-extension:browser')\n            .then(settings => {\n            settings.changed.connect(settings => {\n                navigateToCurrentDirectory = settings.get('navigateToCurrentDirectory').composite;\n                browser.navigateToCurrentDirectory = navigateToCurrentDirectory;\n            });\n            navigateToCurrentDirectory = settings.get('navigateToCurrentDirectory')\n                .composite;\n            browser.navigateToCurrentDirectory = navigateToCurrentDirectory;\n            settings.changed.connect(settings => {\n                useFuzzyFilter = settings.get('useFuzzyFilter').composite;\n                browser.useFuzzyFilter = useFuzzyFilter;\n            });\n            useFuzzyFilter = settings.get('useFuzzyFilter').composite;\n            browser.useFuzzyFilter = useFuzzyFilter;\n        });\n        if (treePathUpdater) {\n            browser.model.pathChanged.connect((sender, args) => {\n                treePathUpdater(args.newValue);\n            });\n        }\n    });\n}\n/**\n * Add the main file browser commands to the application's command registry.\n */\nfunction addCommands(app, factory, settingRegistry, translator, commandPalette, mainMenu) {\n    const trans = translator.load('jupyterlab');\n    const { docRegistry: registry, commands } = app;\n    const { defaultBrowser: browser, tracker } = factory;\n    commands.addCommand(CommandIDs.del, {\n        execute: () => {\n            const widget = tracker.currentWidget;\n            if (widget) {\n                return widget.delete();\n            }\n        },\n        icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.closeIcon.bindprops({ stylesheet: 'menuItem' }),\n        label: trans.__('Delete'),\n        mnemonic: 0\n    });\n    commands.addCommand(CommandIDs.copy, {\n        execute: () => {\n            const widget = tracker.currentWidget;\n            if (widget) {\n                return widget.copy();\n            }\n        },\n        icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.copyIcon.bindprops({ stylesheet: 'menuItem' }),\n        label: trans.__('Copy'),\n        mnemonic: 0\n    });\n    commands.addCommand(CommandIDs.cut, {\n        execute: () => {\n            const widget = tracker.currentWidget;\n            if (widget) {\n                return widget.cut();\n            }\n        },\n        icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.cutIcon.bindprops({ stylesheet: 'menuItem' }),\n        label: trans.__('Cut')\n    });\n    commands.addCommand(CommandIDs.download, {\n        execute: () => {\n            const widget = tracker.currentWidget;\n            if (widget) {\n                return widget.download();\n            }\n        },\n        icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.downloadIcon.bindprops({ stylesheet: 'menuItem' }),\n        label: trans.__('Download')\n    });\n    commands.addCommand(CommandIDs.duplicate, {\n        execute: () => {\n            const widget = tracker.currentWidget;\n            if (widget) {\n                return widget.duplicate();\n            }\n        },\n        icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.copyIcon.bindprops({ stylesheet: 'menuItem' }),\n        label: trans.__('Duplicate')\n    });\n    commands.addCommand(CommandIDs.goToPath, {\n        execute: async (args) => {\n            const path = args.path || '';\n            try {\n                const item = await Private.navigateToPath(path, factory, translator);\n                if (item.type !== 'directory') {\n                    const browserForPath = Private.getBrowserForPath(path, factory);\n                    if (browserForPath) {\n                        browserForPath.clearSelectedItems();\n                        const parts = path.split('/');\n                        const name = parts[parts.length - 1];\n                        if (name) {\n                            await browserForPath.selectItemByName(name);\n                        }\n                    }\n                }\n            }\n            catch (reason) {\n                console.warn(`${CommandIDs.goToPath} failed to go to: ${path}`, reason);\n            }\n        }\n    });\n    commands.addCommand(CommandIDs.openPath, {\n        label: args => args.path ? trans.__('Open %1', args.path) : trans.__('Open from Path…'),\n        caption: args => args.path ? trans.__('Open %1', args.path) : trans.__('Open from path'),\n        execute: async (args) => {\n            var _a;\n            let path;\n            if (args === null || args === void 0 ? void 0 : args.path) {\n                path = args.path;\n            }\n            else {\n                path = (_a = (await _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.InputDialog.getText({\n                    label: trans.__('Path'),\n                    placeholder: '/path/relative/to/jlab/root',\n                    title: trans.__('Open Path'),\n                    okLabel: trans.__('Open')\n                })).value) !== null && _a !== void 0 ? _a : undefined;\n            }\n            if (!path) {\n                return;\n            }\n            try {\n                const trailingSlash = path !== '/' && path.endsWith('/');\n                if (trailingSlash) {\n                    // The normal contents service errors on paths ending in slash\n                    path = path.slice(0, path.length - 1);\n                }\n                const browserForPath = Private.getBrowserForPath(path, factory);\n                const { services } = browserForPath.model.manager;\n                const item = await services.contents.get(path, {\n                    content: false\n                });\n                if (trailingSlash && item.type !== 'directory') {\n                    throw new Error(`Path ${path}/ is not a directory`);\n                }\n                await commands.execute(CommandIDs.goToPath, {\n                    path,\n                    dontShowBrowser: args.dontShowBrowser\n                });\n                if (item.type === 'directory') {\n                    return;\n                }\n                return commands.execute('docmanager:open', { path });\n            }\n            catch (reason) {\n                if (reason.response && reason.response.status === 404) {\n                    reason.message = trans.__('Could not find path: %1', path);\n                }\n                return (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.showErrorMessage)(trans.__('Cannot open'), reason);\n            }\n        }\n    });\n    // Add the openPath command to the command palette\n    if (commandPalette) {\n        commandPalette.addItem({\n            command: CommandIDs.openPath,\n            category: trans.__('File Operations')\n        });\n    }\n    commands.addCommand(CommandIDs.open, {\n        execute: args => {\n            const factory = args['factory'] || void 0;\n            const widget = tracker.currentWidget;\n            if (!widget) {\n                return;\n            }\n            const { contents } = widget.model.manager.services;\n            return Promise.all((0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_11__.toArray)((0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_11__.map)(widget.selectedItems(), item => {\n                if (item.type === 'directory') {\n                    const localPath = contents.localPath(item.path);\n                    return widget.model.cd(`/${localPath}`);\n                }\n                return commands.execute('docmanager:open', {\n                    factory: factory,\n                    path: item.path\n                });\n            })));\n        },\n        icon: args => {\n            var _a;\n            const factory = args['factory'] || void 0;\n            if (factory) {\n                // if an explicit factory is passed...\n                const ft = registry.getFileType(factory);\n                // ...set an icon if the factory name corresponds to a file type name...\n                // ...or leave the icon blank\n                return (_a = ft === null || ft === void 0 ? void 0 : ft.icon) === null || _a === void 0 ? void 0 : _a.bindprops({ stylesheet: 'menuItem' });\n            }\n            else {\n                return _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.folderIcon.bindprops({ stylesheet: 'menuItem' });\n            }\n        },\n        // FIXME-TRANS: Is this localizable?\n        label: args => (args['label'] || args['factory'] || trans.__('Open')),\n        mnemonic: 0\n    });\n    commands.addCommand(CommandIDs.openBrowserTab, {\n        execute: () => {\n            const widget = tracker.currentWidget;\n            if (!widget) {\n                return;\n            }\n            return Promise.all((0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_11__.toArray)((0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_11__.map)(widget.selectedItems(), item => {\n                return commands.execute('docmanager:open-browser-tab', {\n                    path: item.path\n                });\n            })));\n        },\n        icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.addIcon.bindprops({ stylesheet: 'menuItem' }),\n        label: trans.__('Open in New Browser Tab'),\n        mnemonic: 0\n    });\n    commands.addCommand(CommandIDs.copyDownloadLink, {\n        execute: () => {\n            const widget = tracker.currentWidget;\n            if (!widget) {\n                return;\n            }\n            return widget.model.manager.services.contents\n                .getDownloadUrl(widget.selectedItems().next().path)\n                .then(url => {\n                _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.Clipboard.copyToSystem(url);\n            });\n        },\n        icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.copyIcon.bindprops({ stylesheet: 'menuItem' }),\n        label: trans.__('Copy Download Link'),\n        mnemonic: 0\n    });\n    commands.addCommand(CommandIDs.paste, {\n        execute: () => {\n            const widget = tracker.currentWidget;\n            if (widget) {\n                return widget.paste();\n            }\n        },\n        icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.pasteIcon.bindprops({ stylesheet: 'menuItem' }),\n        label: trans.__('Paste'),\n        mnemonic: 0\n    });\n    commands.addCommand(CommandIDs.createNewDirectory, {\n        execute: () => {\n            const widget = tracker.currentWidget;\n            if (widget) {\n                return widget.createNewDirectory();\n            }\n        },\n        icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.newFolderIcon.bindprops({ stylesheet: 'menuItem' }),\n        label: trans.__('New Folder')\n    });\n    commands.addCommand(CommandIDs.createNewFile, {\n        execute: () => {\n            const { model: { path } } = browser;\n            void commands.execute('docmanager:new-untitled', {\n                path,\n                type: 'file',\n                ext: 'txt'\n            });\n        },\n        icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.textEditorIcon.bindprops({ stylesheet: 'menuItem' }),\n        label: trans.__('New File')\n    });\n    commands.addCommand(CommandIDs.createNewMarkdownFile, {\n        execute: () => {\n            const { model: { path } } = browser;\n            void commands.execute('docmanager:new-untitled', {\n                path,\n                type: 'file',\n                ext: 'md'\n            });\n        },\n        icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.markdownIcon.bindprops({ stylesheet: 'menuItem' }),\n        label: trans.__('New Markdown File')\n    });\n    commands.addCommand(CommandIDs.rename, {\n        execute: args => {\n            const widget = tracker.currentWidget;\n            if (widget) {\n                return widget.rename();\n            }\n        },\n        icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.editIcon.bindprops({ stylesheet: 'menuItem' }),\n        label: trans.__('Rename'),\n        mnemonic: 0\n    });\n    commands.addCommand(CommandIDs.copyPath, {\n        execute: () => {\n            const widget = tracker.currentWidget;\n            if (!widget) {\n                return;\n            }\n            const item = widget.selectedItems().next();\n            if (!item) {\n                return;\n            }\n            _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.Clipboard.copyToSystem(item.path);\n        },\n        isVisible: () => !!tracker.currentWidget &&\n            tracker.currentWidget.selectedItems().next !== undefined,\n        icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.fileIcon.bindprops({ stylesheet: 'menuItem' }),\n        label: trans.__('Copy Path')\n    });\n    commands.addCommand(CommandIDs.shutdown, {\n        execute: () => {\n            const widget = tracker.currentWidget;\n            if (widget) {\n                return widget.shutdownKernels();\n            }\n        },\n        icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_10__.stopIcon.bindprops({ stylesheet: 'menuItem' }),\n        label: trans.__('Shut Down Kernel')\n    });\n    commands.addCommand(CommandIDs.toggleNavigateToCurrentDirectory, {\n        label: trans.__('Show Active File in File Browser'),\n        isToggled: () => browser.navigateToCurrentDirectory,\n        execute: () => {\n            const value = !browser.navigateToCurrentDirectory;\n            const key = 'navigateToCurrentDirectory';\n            return settingRegistry\n                .set('@jupyterlab/filebrowser-extension:browser', key, value)\n                .catch((reason) => {\n                console.error('Failed to set navigateToCurrentDirectory setting');\n            });\n        }\n    });\n    commands.addCommand(CommandIDs.toggleLastModified, {\n        label: trans.__('Toggle Last Modified Column'),\n        execute: () => {\n            const header = _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.DOMUtils.findElement(document.body, 'jp-id-modified');\n            const column = _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.DOMUtils.findElements(document.body, 'jp-DirListing-itemModified');\n            if (header.classList.contains('jp-LastModified-hidden')) {\n                header.classList.remove('jp-LastModified-hidden');\n                for (let i = 0; i < column.length; i++) {\n                    column[i].classList.remove('jp-LastModified-hidden');\n                }\n            }\n            else {\n                header.classList.add('jp-LastModified-hidden');\n                for (let i = 0; i < column.length; i++) {\n                    column[i].classList.add('jp-LastModified-hidden');\n                }\n            }\n        }\n    });\n    commands.addCommand(CommandIDs.search, {\n        label: trans.__('Search on File Names'),\n        execute: () => alert('search')\n    });\n    if (mainMenu) {\n        mainMenu.settingsMenu.addGroup([{ command: CommandIDs.toggleNavigateToCurrentDirectory }], 5);\n    }\n    if (commandPalette) {\n        commandPalette.addItem({\n            command: CommandIDs.toggleNavigateToCurrentDirectory,\n            category: trans.__('File Operations')\n        });\n    }\n    // matches anywhere on filebrowser\n    const selectorContent = '.jp-DirListing-content';\n    // matches all filebrowser items\n    const selectorItem = '.jp-DirListing-item[data-isdir]';\n    // matches only non-directory items\n    const selectorNotDir = '.jp-DirListing-item[data-isdir=\"false\"]';\n    // If the user did not click on any file, we still want to show paste and new folder,\n    // so target the content rather than an item.\n    app.contextMenu.addItem({\n        command: CommandIDs.createNewDirectory,\n        selector: selectorContent,\n        rank: 1\n    });\n    app.contextMenu.addItem({\n        command: CommandIDs.createNewFile,\n        selector: selectorContent,\n        rank: 2\n    });\n    app.contextMenu.addItem({\n        command: CommandIDs.createNewMarkdownFile,\n        selector: selectorContent,\n        rank: 3\n    });\n    app.contextMenu.addItem({\n        command: CommandIDs.paste,\n        selector: selectorContent,\n        rank: 4\n    });\n    app.contextMenu.addItem({\n        command: CommandIDs.open,\n        selector: selectorItem,\n        rank: 1\n    });\n    app.contextMenu.addItem({\n        command: CommandIDs.openBrowserTab,\n        selector: selectorNotDir,\n        rank: 3\n    });\n    app.contextMenu.addItem({\n        command: CommandIDs.rename,\n        selector: selectorItem,\n        rank: 4\n    });\n    app.contextMenu.addItem({\n        command: CommandIDs.del,\n        selector: selectorItem,\n        rank: 5\n    });\n    app.contextMenu.addItem({\n        command: CommandIDs.cut,\n        selector: selectorItem,\n        rank: 6\n    });\n    app.contextMenu.addItem({\n        command: CommandIDs.copy,\n        selector: selectorNotDir,\n        rank: 7\n    });\n    app.contextMenu.addItem({\n        command: CommandIDs.duplicate,\n        selector: selectorNotDir,\n        rank: 8\n    });\n    app.contextMenu.addItem({\n        command: CommandIDs.download,\n        selector: selectorNotDir,\n        rank: 9\n    });\n    app.contextMenu.addItem({\n        command: CommandIDs.shutdown,\n        selector: selectorNotDir,\n        rank: 10\n    });\n    app.contextMenu.addItem({\n        command: CommandIDs.share,\n        selector: selectorItem,\n        rank: 11\n    });\n    app.contextMenu.addItem({\n        command: CommandIDs.copyPath,\n        selector: selectorItem,\n        rank: 12\n    });\n    app.contextMenu.addItem({\n        command: CommandIDs.copyDownloadLink,\n        selector: selectorNotDir,\n        rank: 13\n    });\n    app.contextMenu.addItem({\n        command: CommandIDs.toggleLastModified,\n        selector: '.jp-DirListing-header',\n        rank: 14\n    });\n}\n/**\n * A namespace for private module data.\n */\nvar Private;\n(function (Private) {\n    /**\n     * Get browser object given file path.\n     */\n    function getBrowserForPath(path, factory) {\n        const { defaultBrowser: browser, tracker } = factory;\n        const driveName = browser.model.manager.services.contents.driveName(path);\n        if (driveName) {\n            const browserForPath = tracker.find(_path => _path.model.driveName === driveName);\n            if (!browserForPath) {\n                // warn that no filebrowser could be found for this driveName\n                console.warn(`${CommandIDs.goToPath} failed to find filebrowser for path: ${path}`);\n                return;\n            }\n            return browserForPath;\n        }\n        // if driveName is empty, assume the main filebrowser\n        return browser;\n    }\n    Private.getBrowserForPath = getBrowserForPath;\n    /**\n     * Navigate to a path or the path containing a file.\n     */\n    async function navigateToPath(path, factory, translator) {\n        const trans = translator.load('jupyterlab');\n        const browserForPath = Private.getBrowserForPath(path, factory);\n        if (!browserForPath) {\n            throw new Error(trans.__('No browser for path'));\n        }\n        const { services } = browserForPath.model.manager;\n        const localPath = services.contents.localPath(path);\n        await services.ready;\n        const item = await services.contents.get(path, { content: false });\n        const { model } = browserForPath;\n        await model.restored;\n        if (item.type === 'directory') {\n            await model.cd(`/${localPath}`);\n        }\n        else {\n            await model.cd(`/${_jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_2__.PathExt.dirname(localPath)}`);\n        }\n        return item;\n    }\n    Private.navigateToPath = navigateToPath;\n    /**\n     * Restores file browser state and overrides state if tree resolver resolves.\n     */\n    async function restoreBrowser(browser, commands, router, tree) {\n        const restoring = 'jp-mod-restoring';\n        browser.addClass(restoring);\n        if (!router) {\n            await browser.model.restore(browser.id);\n            await browser.model.refresh();\n            browser.removeClass(restoring);\n            return;\n        }\n        const listener = async () => {\n            router.routed.disconnect(listener);\n            const paths = await (tree === null || tree === void 0 ? void 0 : tree.paths);\n            if ((paths === null || paths === void 0 ? void 0 : paths.file) || (paths === null || paths === void 0 ? void 0 : paths.browser)) {\n                // Restore the model without populating it.\n                await browser.model.restore(browser.id, false);\n                if (paths.file) {\n                    await commands.execute(CommandIDs.openPath, {\n                        path: paths.file,\n                        dontShowBrowser: true\n                    });\n                }\n                if (paths.browser) {\n                    await commands.execute(CommandIDs.openPath, {\n                        path: paths.browser,\n                        dontShowBrowser: true\n                    });\n                }\n            }\n            else {\n                await browser.model.restore(browser.id);\n                await browser.model.refresh();\n            }\n            browser.removeClass(restoring);\n        };\n        router.routed.connect(listener);\n    }\n    Private.restoreBrowser = restoreBrowser;\n})(Private || (Private = {}));\n/**\n * Export the plugins as default.\n */\nconst plugins = [\n    browser,\n    factory,\n    newFiles,\n    newTerminal\n];\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (plugins);\n\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../packages/tree-extension/lib/index.js?");

/***/ })

}]);