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

/***/ "../packages/notebook-extension/lib/index.js":
/*!***************************************************!*\
  !*** ../packages/notebook-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_notebook__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @jupyterlab/notebook */ \"webpack/sharing/consume/default/@jupyterlab/notebook/@jupyterlab/notebook\");\n/* harmony import */ var _jupyterlab_notebook__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_notebook__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _retrolab_application__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @retrolab/application */ \"webpack/sharing/consume/default/@retrolab/application/@retrolab/application\");\n/* harmony import */ var _retrolab_application__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_retrolab_application__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _lumino_polling__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @lumino/polling */ \"webpack/sharing/consume/default/@lumino/polling/@lumino/polling\");\n/* harmony import */ var _lumino_polling__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_lumino_polling__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @lumino/widgets */ \"webpack/sharing/consume/default/@lumino/widgets/@lumino/widgets\");\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_lumino_widgets__WEBPACK_IMPORTED_MODULE_7__);\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 * The class for kernel status errors.\n */\nconst KERNEL_STATUS_ERROR_CLASS = 'jp-RetroKernelStatus-error';\n/**\n * The class for kernel status warnings.\n */\nconst KERNEL_STATUS_WARN_CLASS = 'jp-RetroKernelStatus-warn';\n/**\n * The class for kernel status infos.\n */\nconst KERNEL_STATUS_INFO_CLASS = 'jp-RetroKernelStatus-info';\n/**\n * The class to fade out the kernel status.\n */\nconst KERNEL_STATUS_FADE_OUT_CLASS = 'jp-RetroKernelStatus-fade';\n/**\n * A plugin for the checkpoint indicator\n */\nconst checkpoints = {\n    id: '@retrolab/application-extension:checkpoints',\n    autoStart: true,\n    requires: [_jupyterlab_docmanager__WEBPACK_IMPORTED_MODULE_3__.IDocumentManager],\n    optional: [_retrolab_application__WEBPACK_IMPORTED_MODULE_5__.IRetroShell],\n    activate: (app, docManager, retroShell) => {\n        const { shell } = app;\n        const widget = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_7__.Widget();\n        widget.id = _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.DOMUtils.createDomID();\n        widget.addClass('jp-RetroCheckpoint');\n        app.shell.add(widget, 'top', { rank: 100 });\n        const onChange = async () => {\n            const current = shell.currentWidget;\n            if (!current) {\n                return;\n            }\n            const context = docManager.contextForWidget(current);\n            context === null || context === void 0 ? void 0 : context.fileChanged.disconnect(onChange);\n            context === null || context === void 0 ? void 0 : context.fileChanged.connect(onChange);\n            const checkpoints = await (context === null || context === void 0 ? void 0 : context.listCheckpoints());\n            if (!checkpoints) {\n                return;\n            }\n            const checkpoint = checkpoints[checkpoints.length - 1];\n            widget.node.textContent = `Last Checkpoint: ${_jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_2__.Time.formatHuman(new Date(checkpoint.last_modified))}`;\n        };\n        if (retroShell) {\n            retroShell.currentChanged.connect(onChange);\n        }\n        new _lumino_polling__WEBPACK_IMPORTED_MODULE_6__.Poll({\n            auto: true,\n            factory: () => onChange(),\n            frequency: {\n                interval: 2000,\n                backoff: false\n            },\n            standby: 'when-hidden'\n        });\n    }\n};\n/**\n * The kernel logo plugin.\n */\nconst kernelLogo = {\n    id: '@retrolab/application-extension:kernel-logo',\n    autoStart: true,\n    requires: [_retrolab_application__WEBPACK_IMPORTED_MODULE_5__.IRetroShell],\n    activate: (app, shell) => {\n        const { serviceManager } = app;\n        const baseUrl = _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_2__.PageConfig.getBaseUrl();\n        let widget;\n        const onChange = async () => {\n            var _a, _b, _c, _d, _e;\n            if (widget) {\n                widget.dispose();\n                widget.parent = null;\n            }\n            const current = shell.currentWidget;\n            if (!(current instanceof _jupyterlab_notebook__WEBPACK_IMPORTED_MODULE_4__.NotebookPanel)) {\n                return;\n            }\n            await current.sessionContext.ready;\n            current.sessionContext.kernelChanged.disconnect(onChange);\n            current.sessionContext.kernelChanged.connect(onChange);\n            const name = (_c = (_b = (_a = current.sessionContext.session) === null || _a === void 0 ? void 0 : _a.kernel) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '';\n            const spec = (_e = (_d = serviceManager.kernelspecs) === null || _d === void 0 ? void 0 : _d.specs) === null || _e === void 0 ? void 0 : _e.kernelspecs[name];\n            if (!spec) {\n                return;\n            }\n            let kernelIconUrl = spec.resources['logo-64x64'];\n            if (!kernelIconUrl) {\n                return;\n            }\n            const index = kernelIconUrl.indexOf('kernelspecs');\n            kernelIconUrl = baseUrl + kernelIconUrl.slice(index);\n            const node = document.createElement('div');\n            const img = document.createElement('img');\n            img.src = kernelIconUrl;\n            img.title = spec.display_name;\n            node.appendChild(img);\n            widget = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_7__.Widget({ node });\n            widget.addClass('jp-RetroKernelLogo');\n            app.shell.add(widget, 'top', { rank: 10010 });\n        };\n        shell.currentChanged.connect(onChange);\n    }\n};\n/**\n * A plugin to display the kernel status;\n */\nconst kernelStatus = {\n    id: '@retrolab/application-extension:kernel-status',\n    autoStart: true,\n    requires: [_retrolab_application__WEBPACK_IMPORTED_MODULE_5__.IRetroShell],\n    activate: (app, shell) => {\n        const widget = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_7__.Widget();\n        widget.addClass('jp-RetroKernelStatus');\n        app.shell.add(widget, 'menu', { rank: 10010 });\n        const removeClasses = () => {\n            widget.removeClass(KERNEL_STATUS_ERROR_CLASS);\n            widget.removeClass(KERNEL_STATUS_WARN_CLASS);\n            widget.removeClass(KERNEL_STATUS_INFO_CLASS);\n            widget.removeClass(KERNEL_STATUS_FADE_OUT_CLASS);\n        };\n        const onStatusChanged = (sessionContext) => {\n            const status = sessionContext.kernelDisplayStatus;\n            let text = `Kernel ${_jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_2__.Text.titleCase(status)}`;\n            removeClasses();\n            switch (status) {\n                case 'busy':\n                case 'idle':\n                    text = '';\n                    widget.addClass(KERNEL_STATUS_FADE_OUT_CLASS);\n                    break;\n                case 'dead':\n                case 'terminating':\n                    widget.addClass(KERNEL_STATUS_ERROR_CLASS);\n                    break;\n                case 'unknown':\n                    widget.addClass(KERNEL_STATUS_WARN_CLASS);\n                    break;\n                default:\n                    widget.addClass(KERNEL_STATUS_INFO_CLASS);\n                    widget.addClass(KERNEL_STATUS_FADE_OUT_CLASS);\n                    break;\n            }\n            widget.node.textContent = text;\n        };\n        const onChange = async () => {\n            const current = shell.currentWidget;\n            if (!(current instanceof _jupyterlab_notebook__WEBPACK_IMPORTED_MODULE_4__.NotebookPanel)) {\n                return;\n            }\n            const sessionContext = current.sessionContext;\n            sessionContext.statusChanged.connect(onStatusChanged);\n        };\n        shell.currentChanged.connect(onChange);\n    }\n};\n/**\n * The default paths for a RetroLab app.\n */\nconst paths = {\n    id: '@retrolab/application-extension:paths',\n    activate: (app) => {\n        if (!(app instanceof _retrolab_application__WEBPACK_IMPORTED_MODULE_5__.RetroApp)) {\n            throw new Error(`${paths.id} must be activated in RetroLab.`);\n        }\n        return app.paths;\n    },\n    autoStart: true,\n    provides: _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.JupyterFrontEnd.IPaths\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_5__.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_5__.IRetroShell\n};\n/**\n * Export the plugins as default.\n */\nconst plugins = [\n    checkpoints,\n    kernelLogo,\n    kernelStatus\n];\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (plugins);\n\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../packages/notebook-extension/lib/index.js?");

/***/ })

}]);