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

/***/ "../packages/console-extension/lib/index.js":
/*!**************************************************!*\
  !*** ../packages/console-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_console__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/console */ \"webpack/sharing/consume/default/@jupyterlab/console/@jupyterlab/console\");\n/* harmony import */ var _jupyterlab_console__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_console__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 _lumino_algorithm__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lumino/algorithm */ \"webpack/sharing/consume/default/@lumino/algorithm/@lumino/algorithm\");\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_3__);\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n\n\n\n/**\n * A plugin to open consoles in a new tab\n */\nconst opener = {\n    id: '@retrolab/console-extension:opener',\n    requires: [_jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.IRouter],\n    autoStart: true,\n    activate: (app, router) => {\n        const { commands } = app;\n        const consolePattern = new RegExp('/consoles/(.*)');\n        const command = 'router:console';\n        commands.addCommand(command, {\n            execute: (args) => {\n                const parsed = args;\n                const matches = parsed.path.match(consolePattern);\n                if (!matches) {\n                    return;\n                }\n                const [, match] = matches;\n                if (!match) {\n                    return;\n                }\n                const path = decodeURIComponent(match);\n                commands.execute('console:create', { path });\n            }\n        });\n        router.register({ command, pattern: consolePattern });\n    }\n};\n/**\n * Open consoles in a new tab.\n */\nconst redirect = {\n    id: '@retrolab/console-extension:redirect',\n    requires: [_jupyterlab_console__WEBPACK_IMPORTED_MODULE_1__.IConsoleTracker],\n    autoStart: true,\n    activate: (app, tracker) => {\n        const baseUrl = _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_2__.PageConfig.getBaseUrl();\n        tracker.widgetAdded.connect(async (send, console) => {\n            const { sessionContext } = console;\n            await sessionContext.ready;\n            const widget = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_3__.find)(app.shell.widgets('main'), w => w.id === console.id);\n            if (widget) {\n                // bail if the console is already added to the main area\n                return;\n            }\n            window.open(`${baseUrl}retro/consoles/${sessionContext.path}`, '_blank');\n            // the widget is not needed anymore\n            console.dispose();\n        });\n    }\n};\n/**\n * Export the plugins as default.\n */\nconst plugins = [opener, redirect];\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (plugins);\n\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../packages/console-extension/lib/index.js?");

/***/ })

}]);