"use strict";
/*
 * 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_notebook_lib_index_js"],{

/***/ "../node_modules/@jupyterlab/notebook/lib/actions.js":
/*!***********************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/actions.js ***!
  \***********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   KernelError: () => (/* binding */ KernelError),\n/* harmony export */   NotebookActions: () => (/* binding */ NotebookActions),\n/* harmony export */   setCellExecutor: () => (/* binding */ setCellExecutor)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/apputils */ \"webpack/sharing/consume/default/@jupyterlab/apputils/@jupyterlab/apputils\");\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/cells */ \"webpack/sharing/consume/default/@jupyterlab/cells/@jupyterlab/cells\");\n/* harmony import */ var _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_cells__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_translation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @jupyterlab/translation */ \"webpack/sharing/consume/default/@jupyterlab/translation/@jupyterlab/translation\");\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lumino/algorithm */ \"webpack/sharing/consume/default/@lumino/algorithm/@lumino/algorithm\");\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @lumino/coreutils */ \"webpack/sharing/consume/default/@lumino/coreutils/@lumino/coreutils\");\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @lumino/signaling */ \"webpack/sharing/consume/default/@lumino/signaling/@lumino/signaling\");\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_lumino_signaling__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react */ \"webpack/sharing/consume/default/react/react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _cellexecutor__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./cellexecutor */ \"../node_modules/@jupyterlab/notebook/lib/cellexecutor.js\");\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 * The mimetype used for Jupyter cell data.\n */\nconst JUPYTER_CELL_MIME = 'application/vnd.jupyter.cells';\nclass KernelError extends Error {\n    /**\n     * Construct the kernel error.\n     */\n    constructor(content) {\n        const errorContent = content;\n        const errorName = errorContent.ename;\n        const errorValue = errorContent.evalue;\n        super(`KernelReplyNotOK: ${errorName} ${errorValue}`);\n        this.errorName = errorName;\n        this.errorValue = errorValue;\n        this.traceback = errorContent.traceback;\n        Object.setPrototypeOf(this, KernelError.prototype);\n    }\n}\n/**\n * A collection of actions that run against notebooks.\n *\n * #### Notes\n * All of the actions are a no-op if there is no model on the notebook.\n * The actions set the widget `mode` to `'command'` unless otherwise specified.\n * The actions will preserve the selection on the notebook widget unless\n * otherwise specified.\n */\nclass NotebookActions {\n    /**\n     * A signal that emits whenever a cell completes execution.\n     */\n    static get executed() {\n        return Private.executed;\n    }\n    /**\n     * A signal that emits whenever a cell execution is scheduled.\n     */\n    static get executionScheduled() {\n        return Private.executionScheduled;\n    }\n    /**\n     * A signal that emits when one notebook's cells are all executed.\n     */\n    static get selectionExecuted() {\n        return Private.selectionExecuted;\n    }\n    /**\n     * A signal that emits when a cell's output is cleared.\n     */\n    static get outputCleared() {\n        return Private.outputCleared;\n    }\n    /**\n     * A private constructor for the `NotebookActions` class.\n     *\n     * #### Notes\n     * This class can never be instantiated. Its static member `executed` will be\n     * merged with the `NotebookActions` namespace. The reason it exists as a\n     * standalone class is because at run time, the `Private.executed` variable\n     * does not yet exist, so it needs to be referenced via a getter.\n     */\n    constructor() {\n        // Intentionally empty.\n    }\n}\n/**\n * A namespace for `NotebookActions` static methods.\n */\n(function (NotebookActions) {\n    /**\n     * Split the active cell into two or more cells.\n     *\n     * @param notebook The target notebook widget.\n     *\n     * #### Notes\n     * It will preserve the existing mode.\n     * The last cell will be activated if no selection is found.\n     * If text was selected, the cell containing the selection will\n     * be activated.\n     * The existing selection will be cleared.\n     * The activated cell will have focus and the cursor will\n     * remain in the initial position.\n     * The leading whitespace in the second cell will be removed.\n     * If there is no content, two empty cells will be created.\n     * Both cells will have the same type as the original cell.\n     * This action can be undone.\n     */\n    function splitCell(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        // We force the notebook back in edit mode as splitting a cell\n        // requires using the cursor position within a cell (aka it was recently in edit mode)\n        // However the focus may be stolen if the action is triggered\n        // from the menu entry; switching the notebook in command mode.\n        notebook.mode = 'edit';\n        notebook.deselectAll();\n        const nbModel = notebook.model;\n        const index = notebook.activeCellIndex;\n        const child = notebook.widgets[index];\n        const editor = child.editor;\n        if (!editor) {\n            // TODO\n            return;\n        }\n        const selections = editor.getSelections();\n        const orig = child.model.sharedModel.getSource();\n        const offsets = [0];\n        let start = -1;\n        let end = -1;\n        for (let i = 0; i < selections.length; i++) {\n            // append start and end to handle selections\n            // cursors will have same start and end\n            start = editor.getOffsetAt(selections[i].start);\n            end = editor.getOffsetAt(selections[i].end);\n            if (start < end) {\n                offsets.push(start);\n                offsets.push(end);\n            }\n            else if (end < start) {\n                offsets.push(end);\n                offsets.push(start);\n            }\n            else {\n                offsets.push(start);\n            }\n        }\n        offsets.push(orig.length);\n        const cellCountAfterSplit = offsets.length - 1;\n        const clones = offsets.slice(0, -1).map((offset, offsetIdx) => {\n            const { cell_type, metadata, outputs } = child.model.sharedModel.toJSON();\n            return {\n                cell_type,\n                metadata,\n                source: orig\n                    .slice(offset, offsets[offsetIdx + 1])\n                    .replace(/^\\n+/, '')\n                    .replace(/\\n+$/, ''),\n                outputs: offsetIdx === cellCountAfterSplit - 1 && cell_type === 'code'\n                    ? outputs\n                    : undefined\n            };\n        });\n        nbModel.sharedModel.transact(() => {\n            nbModel.sharedModel.deleteCell(index);\n            nbModel.sharedModel.insertCells(index, clones);\n        });\n        // If there is a selection the selected cell will be activated\n        const activeCellDelta = start !== end ? 2 : 1;\n        notebook.activeCellIndex = index + clones.length - activeCellDelta;\n        notebook\n            .scrollToItem(notebook.activeCellIndex)\n            .then(() => {\n            var _a;\n            (_a = notebook.activeCell) === null || _a === void 0 ? void 0 : _a.editor.focus();\n        })\n            .catch(reason => {\n            // no-op\n        });\n        void Private.handleState(notebook, state);\n    }\n    NotebookActions.splitCell = splitCell;\n    /**\n     * Merge the selected cells.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * @param mergeAbove - If only one cell is selected, indicates whether to merge it\n     *    with the cell above (true) or below (false, default).\n     *\n     * #### Notes\n     * The widget mode will be preserved.\n     * If only one cell is selected and `mergeAbove` is true, the above cell will be selected.\n     * If only one cell is selected and `mergeAbove` is false, the below cell will be selected.\n     * If the active cell is a code cell, its outputs will be cleared.\n     * This action can be undone.\n     * The final cell will have the same type as the active cell.\n     * If the active cell is a markdown cell, it will be unrendered.\n     */\n    function mergeCells(notebook, mergeAbove = false) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        const toMerge = [];\n        const toDelete = [];\n        const model = notebook.model;\n        const cells = model.cells;\n        const primary = notebook.activeCell;\n        const active = notebook.activeCellIndex;\n        const attachments = {};\n        // Get the cells to merge.\n        notebook.widgets.forEach((child, index) => {\n            if (notebook.isSelectedOrActive(child)) {\n                toMerge.push(child.model.sharedModel.getSource());\n                if (index !== active) {\n                    toDelete.push(index);\n                }\n                // Collect attachments if the cell is a markdown cell or a raw cell\n                const model = child.model;\n                if ((0,_jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.isRawCellModel)(model) || (0,_jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.isMarkdownCellModel)(model)) {\n                    for (const key of model.attachments.keys) {\n                        attachments[key] = model.attachments.get(key).toJSON();\n                    }\n                }\n            }\n        });\n        // Check for only a single cell selected.\n        if (toMerge.length === 1) {\n            // Merge with the cell above when mergeAbove is true\n            if (mergeAbove === true) {\n                // Bail if it is the first cell.\n                if (active === 0) {\n                    return;\n                }\n                // Otherwise merge with the previous cell.\n                const cellModel = cells.get(active - 1);\n                toMerge.unshift(cellModel.sharedModel.getSource());\n                toDelete.push(active - 1);\n            }\n            else if (mergeAbove === false) {\n                // Bail if it is the last cell.\n                if (active === cells.length - 1) {\n                    return;\n                }\n                // Otherwise merge with the next cell.\n                const cellModel = cells.get(active + 1);\n                toMerge.push(cellModel.sharedModel.getSource());\n                toDelete.push(active + 1);\n            }\n        }\n        notebook.deselectAll();\n        const primaryModel = primary.model.sharedModel;\n        const { cell_type, metadata } = primaryModel.toJSON();\n        if (primaryModel.cell_type === 'code') {\n            // We can trust this cell because the outputs will be removed.\n            metadata.trusted = true;\n        }\n        const newModel = {\n            cell_type,\n            metadata,\n            source: toMerge.join('\\n\\n'),\n            attachments: primaryModel.cell_type === 'markdown' ||\n                primaryModel.cell_type === 'raw'\n                ? attachments\n                : undefined\n        };\n        // Make the changes while preserving history.\n        model.sharedModel.transact(() => {\n            model.sharedModel.deleteCell(active);\n            model.sharedModel.insertCell(active, newModel);\n            toDelete\n                .sort((a, b) => b - a)\n                .forEach(index => {\n                model.sharedModel.deleteCell(index);\n            });\n        });\n        // If the original cell is a markdown cell, make sure\n        // the new cell is unrendered.\n        if (primary instanceof _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.MarkdownCell) {\n            notebook.activeCell.rendered = false;\n        }\n        void Private.handleState(notebook, state);\n    }\n    NotebookActions.mergeCells = mergeCells;\n    /**\n     * Delete the selected cells.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * #### Notes\n     * The cell after the last selected cell will be activated.\n     * It will add a code cell if all cells are deleted.\n     * This action can be undone.\n     */\n    function deleteCells(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        Private.deleteCells(notebook);\n        void Private.handleState(notebook, state, true);\n    }\n    NotebookActions.deleteCells = deleteCells;\n    /**\n     * Insert a new code cell above the active cell or in index 0 if the notebook is empty.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * #### Notes\n     * The widget mode will be preserved.\n     * This action can be undone.\n     * The existing selection will be cleared.\n     * The new cell will the active cell.\n     */\n    function insertAbove(notebook) {\n        if (!notebook.model) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        const model = notebook.model;\n        const newIndex = notebook.activeCell ? notebook.activeCellIndex : 0;\n        model.sharedModel.insertCell(newIndex, {\n            cell_type: notebook.notebookConfig.defaultCell,\n            metadata: notebook.notebookConfig.defaultCell === 'code'\n                ? {\n                    // This is an empty cell created by user, thus is trusted\n                    trusted: true\n                }\n                : {}\n        });\n        // Make the newly inserted cell active.\n        notebook.activeCellIndex = newIndex;\n        notebook.deselectAll();\n        void Private.handleState(notebook, state, true);\n    }\n    NotebookActions.insertAbove = insertAbove;\n    /**\n     * Insert a new code cell below the active cell or in index 0 if the notebook is empty.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * #### Notes\n     * The widget mode will be preserved.\n     * This action can be undone.\n     * The existing selection will be cleared.\n     * The new cell will be the active cell.\n     */\n    function insertBelow(notebook) {\n        if (!notebook.model) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        const model = notebook.model;\n        const newIndex = notebook.activeCell ? notebook.activeCellIndex + 1 : 0;\n        model.sharedModel.insertCell(newIndex, {\n            cell_type: notebook.notebookConfig.defaultCell,\n            metadata: notebook.notebookConfig.defaultCell === 'code'\n                ? {\n                    // This is an empty cell created by user, thus is trusted\n                    trusted: true\n                }\n                : {}\n        });\n        // Make the newly inserted cell active.\n        notebook.activeCellIndex = newIndex;\n        notebook.deselectAll();\n        void Private.handleState(notebook, state, true);\n    }\n    NotebookActions.insertBelow = insertBelow;\n    function move(notebook, shift) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        const firstIndex = notebook.widgets.findIndex(w => notebook.isSelectedOrActive(w));\n        let lastIndex = notebook.widgets\n            .slice(firstIndex + 1)\n            .findIndex(w => !notebook.isSelectedOrActive(w));\n        if (lastIndex >= 0) {\n            lastIndex += firstIndex + 1;\n        }\n        else {\n            lastIndex = notebook.model.cells.length;\n        }\n        if (shift > 0) {\n            notebook.moveCell(firstIndex, lastIndex, lastIndex - firstIndex);\n        }\n        else {\n            notebook.moveCell(firstIndex, firstIndex + shift, lastIndex - firstIndex);\n        }\n        void Private.handleState(notebook, state, true);\n    }\n    /**\n     * Move the selected cell(s) down.\n     *\n     * @param notebook = The target notebook widget.\n     */\n    function moveDown(notebook) {\n        move(notebook, 1);\n    }\n    NotebookActions.moveDown = moveDown;\n    /**\n     * Move the selected cell(s) up.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    function moveUp(notebook) {\n        move(notebook, -1);\n    }\n    NotebookActions.moveUp = moveUp;\n    /**\n     * Change the selected cell type(s).\n     *\n     * @param notebook - The target notebook widget.\n     * @param value - The target cell type.\n     * @param translator - The application translator.\n     *\n     * #### Notes\n     * It should preserve the widget mode.\n     * This action can be undone.\n     * The existing selection will be cleared.\n     * Any cells converted to markdown will be unrendered.\n     */\n    function changeCellType(notebook, value, translator) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        Private.changeCellType(notebook, value, translator);\n        void Private.handleState(notebook, state);\n    }\n    NotebookActions.changeCellType = changeCellType;\n    /**\n     * Run the selected cell(s).\n     *\n     * @param notebook - The target notebook widget.\n     * @param sessionContext - The client session object.\n     * @param sessionDialogs - The session dialogs.\n     * @param translator - The application translator.\n     *\n     * #### Notes\n     * The last selected cell will be activated, but not scrolled into view.\n     * The existing selection will be cleared.\n     * An execution error will prevent the remaining code cells from executing.\n     * All markdown cells will be rendered.\n     */\n    function run(notebook, sessionContext, sessionDialogs, translator) {\n        if (!notebook.model || !notebook.activeCell) {\n            return Promise.resolve(false);\n        }\n        const state = Private.getState(notebook);\n        const promise = Private.runSelected(notebook, sessionContext, sessionDialogs, translator);\n        void Private.handleRunState(notebook, state);\n        return promise;\n    }\n    NotebookActions.run = run;\n    /**\n     * Run specified cells.\n     *\n     * @param notebook - The target notebook widget.\n     * @param cells - The cells to run.\n     * @param sessionContext - The client session object.\n     * @param sessionDialogs - The session dialogs.\n     * @param translator - The application translator.\n     *\n     * #### Notes\n     * The existing selection will be preserved.\n     * The mode will be changed to command.\n     * An execution error will prevent the remaining code cells from executing.\n     * All markdown cells will be rendered.\n     */\n    function runCells(notebook, cells, sessionContext, sessionDialogs, translator) {\n        if (!notebook.model) {\n            return Promise.resolve(false);\n        }\n        const state = Private.getState(notebook);\n        const promise = Private.runCells(notebook, cells, sessionContext, sessionDialogs, translator);\n        void Private.handleRunState(notebook, state);\n        return promise;\n    }\n    NotebookActions.runCells = runCells;\n    /**\n     * Run the selected cell(s) and advance to the next cell.\n     *\n     * @param notebook - The target notebook widget.\n     * @param sessionContext - The client session object.\n     * @param sessionDialogs - The session dialogs.\n     * @param translator - The application translator.\n     *\n     * #### Notes\n     * The existing selection will be cleared.\n     * The cell after the last selected cell will be activated and scrolled into view.\n     * An execution error will prevent the remaining code cells from executing.\n     * All markdown cells will be rendered.\n     * If the last selected cell is the last cell, a new code cell\n     * will be created in `'edit'` mode.  The new cell creation can be undone.\n     */\n    async function runAndAdvance(notebook, sessionContext, sessionDialogs, translator) {\n        var _a;\n        if (!notebook.model || !notebook.activeCell) {\n            return Promise.resolve(false);\n        }\n        const state = Private.getState(notebook);\n        const promise = Private.runSelected(notebook, sessionContext, sessionDialogs, translator);\n        const model = notebook.model;\n        if (notebook.activeCellIndex === notebook.widgets.length - 1) {\n            // Do not use push here, as we want an widget insertion\n            // to make sure no placeholder widget is rendered.\n            model.sharedModel.insertCell(notebook.widgets.length, {\n                cell_type: notebook.notebookConfig.defaultCell,\n                metadata: notebook.notebookConfig.defaultCell === 'code'\n                    ? {\n                        // This is an empty cell created by user, thus is trusted\n                        trusted: true\n                    }\n                    : {}\n            });\n            notebook.activeCellIndex++;\n            if (((_a = notebook.activeCell) === null || _a === void 0 ? void 0 : _a.inViewport) === false) {\n                await (0,_jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_2__.signalToPromise)(notebook.activeCell.inViewportChanged, 200).catch(() => {\n                    // no-op\n                });\n            }\n            notebook.mode = 'edit';\n        }\n        else {\n            notebook.activeCellIndex++;\n        }\n        // If a cell is outside of viewport and scrolling is needed, the `smart`\n        // logic in `handleRunState` will choose appropriate alignment, except\n        // for the case of a small cell less than one viewport away for which it\n        // would use the `auto` heuristic, for which we set the preferred alignment\n        // to `center` as in most cases there will be space below and above a cell\n        // that is smaller than (or approximately equal to) the viewport size.\n        void Private.handleRunState(notebook, state, 'center');\n        return promise;\n    }\n    NotebookActions.runAndAdvance = runAndAdvance;\n    /**\n     * Run the selected cell(s) and insert a new code cell.\n     *\n     * @param notebook - The target notebook widget.\n     * @param sessionContext - The client session object.\n     * @param sessionDialogs - The session dialogs.\n     * @param translator - The application translator.\n     *\n     * #### Notes\n     * An execution error will prevent the remaining code cells from executing.\n     * All markdown cells will be rendered.\n     * The widget mode will be set to `'edit'` after running.\n     * The existing selection will be cleared.\n     * The cell insert can be undone.\n     * The new cell will be scrolled into view.\n     */\n    async function runAndInsert(notebook, sessionContext, sessionDialogs, translator) {\n        var _a;\n        if (!notebook.model || !notebook.activeCell) {\n            return Promise.resolve(false);\n        }\n        const state = Private.getState(notebook);\n        const promise = Private.runSelected(notebook, sessionContext, sessionDialogs, translator);\n        const model = notebook.model;\n        model.sharedModel.insertCell(notebook.activeCellIndex + 1, {\n            cell_type: notebook.notebookConfig.defaultCell,\n            metadata: notebook.notebookConfig.defaultCell === 'code'\n                ? {\n                    // This is an empty cell created by user, thus is trusted\n                    trusted: true\n                }\n                : {}\n        });\n        notebook.activeCellIndex++;\n        if (((_a = notebook.activeCell) === null || _a === void 0 ? void 0 : _a.inViewport) === false) {\n            await (0,_jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_2__.signalToPromise)(notebook.activeCell.inViewportChanged, 200).catch(() => {\n                // no-op\n            });\n        }\n        notebook.mode = 'edit';\n        void Private.handleRunState(notebook, state, 'center');\n        return promise;\n    }\n    NotebookActions.runAndInsert = runAndInsert;\n    /**\n     * Run all of the cells in the notebook.\n     *\n     * @param notebook - The target notebook widget.\n     * @param sessionContext - The client session object.\n     * @param sessionDialogs - The session dialogs.\n     * @param translator - The application translator.\n     *\n     * #### Notes\n     * The existing selection will be cleared.\n     * An execution error will prevent the remaining code cells from executing.\n     * All markdown cells will be rendered.\n     * The last cell in the notebook will be activated and scrolled into view.\n     */\n    function runAll(notebook, sessionContext, sessionDialogs, translator) {\n        if (!notebook.model || !notebook.activeCell) {\n            return Promise.resolve(false);\n        }\n        const state = Private.getState(notebook);\n        const lastIndex = notebook.widgets.length;\n        const promise = Private.runCells(notebook, notebook.widgets, sessionContext, sessionDialogs, translator);\n        notebook.activeCellIndex = lastIndex;\n        notebook.deselectAll();\n        void Private.handleRunState(notebook, state);\n        return promise;\n    }\n    NotebookActions.runAll = runAll;\n    function renderAllMarkdown(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return Promise.resolve(false);\n        }\n        const previousIndex = notebook.activeCellIndex;\n        const state = Private.getState(notebook);\n        notebook.widgets.forEach((child, index) => {\n            if (child.model.type === 'markdown') {\n                notebook.select(child);\n                // This is to make sure that the activeCell\n                // does not get executed\n                notebook.activeCellIndex = index;\n            }\n        });\n        if (notebook.activeCell.model.type !== 'markdown') {\n            return Promise.resolve(true);\n        }\n        const promise = Private.runSelected(notebook);\n        notebook.activeCellIndex = previousIndex;\n        void Private.handleRunState(notebook, state);\n        return promise;\n    }\n    NotebookActions.renderAllMarkdown = renderAllMarkdown;\n    /**\n     * Run all of the cells before the currently active cell (exclusive).\n     *\n     * @param notebook - The target notebook widget.\n     * @param sessionContext - The client session object.\n     * @param sessionDialogs - The session dialogs.\n     * @param translator - The application translator.\n     *\n     * #### Notes\n     * The existing selection will be cleared.\n     * An execution error will prevent the remaining code cells from executing.\n     * All markdown cells will be rendered.\n     * The currently active cell will remain selected.\n     */\n    function runAllAbove(notebook, sessionContext, sessionDialogs, translator) {\n        const { activeCell, activeCellIndex, model } = notebook;\n        if (!model || !activeCell || activeCellIndex < 1) {\n            return Promise.resolve(false);\n        }\n        const state = Private.getState(notebook);\n        const promise = Private.runCells(notebook, notebook.widgets.slice(0, notebook.activeCellIndex), sessionContext, sessionDialogs, translator);\n        notebook.deselectAll();\n        void Private.handleRunState(notebook, state);\n        return promise;\n    }\n    NotebookActions.runAllAbove = runAllAbove;\n    /**\n     * Run all of the cells after the currently active cell (inclusive).\n     *\n     * @param notebook - The target notebook widget.\n     * @param sessionContext - The client session object.\n     * @param sessionDialogs - The session dialogs.\n     * @param translator - The application translator.\n     *\n     * #### Notes\n     * The existing selection will be cleared.\n     * An execution error will prevent the remaining code cells from executing.\n     * All markdown cells will be rendered.\n     * The last cell in the notebook will be activated and scrolled into view.\n     */\n    function runAllBelow(notebook, sessionContext, sessionDialogs, translator) {\n        if (!notebook.model || !notebook.activeCell) {\n            return Promise.resolve(false);\n        }\n        const state = Private.getState(notebook);\n        const lastIndex = notebook.widgets.length;\n        const promise = Private.runCells(notebook, notebook.widgets.slice(notebook.activeCellIndex), sessionContext, sessionDialogs, translator);\n        notebook.activeCellIndex = lastIndex;\n        notebook.deselectAll();\n        void Private.handleRunState(notebook, state);\n        return promise;\n    }\n    NotebookActions.runAllBelow = runAllBelow;\n    /**\n     * Replaces the selection in the active cell of the notebook.\n     *\n     * @param notebook - The target notebook widget.\n     * @param text - The text to replace the selection.\n     */\n    function replaceSelection(notebook, text) {\n        var _a, _b, _c;\n        if (!notebook.model || !((_a = notebook.activeCell) === null || _a === void 0 ? void 0 : _a.editor)) {\n            return;\n        }\n        (_c = (_b = notebook.activeCell.editor).replaceSelection) === null || _c === void 0 ? void 0 : _c.call(_b, text);\n    }\n    NotebookActions.replaceSelection = replaceSelection;\n    /**\n     * Select the above the active cell.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * #### Notes\n     * The widget mode will be preserved.\n     * This is a no-op if the first cell is the active cell.\n     * This will skip any collapsed cells.\n     * The existing selection will be cleared.\n     */\n    function selectAbove(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const footer = notebook.layout.footer;\n        if (footer && document.activeElement === footer.node) {\n            footer.node.blur();\n            notebook.mode = 'command';\n            return;\n        }\n        if (notebook.activeCellIndex === 0) {\n            return;\n        }\n        let possibleNextCellIndex = notebook.activeCellIndex - 1;\n        // find first non hidden cell above current cell\n        while (possibleNextCellIndex >= 0) {\n            const possibleNextCell = notebook.widgets[possibleNextCellIndex];\n            if (!possibleNextCell.inputHidden && !possibleNextCell.isHidden) {\n                break;\n            }\n            possibleNextCellIndex -= 1;\n        }\n        const state = Private.getState(notebook);\n        notebook.activeCellIndex = possibleNextCellIndex;\n        notebook.deselectAll();\n        void Private.handleState(notebook, state, true);\n    }\n    NotebookActions.selectAbove = selectAbove;\n    /**\n     * Select the cell below the active cell.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * #### Notes\n     * The widget mode will be preserved.\n     * This is a no-op if the last cell is the active cell.\n     * This will skip any collapsed cells.\n     * The existing selection will be cleared.\n     */\n    function selectBelow(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        let maxCellIndex = notebook.widgets.length - 1;\n        // Find last non-hidden cell\n        while (notebook.widgets[maxCellIndex].isHidden ||\n            notebook.widgets[maxCellIndex].inputHidden) {\n            maxCellIndex -= 1;\n        }\n        if (notebook.activeCellIndex === maxCellIndex) {\n            const footer = notebook.layout.footer;\n            footer === null || footer === void 0 ? void 0 : footer.node.focus();\n            return;\n        }\n        let possibleNextCellIndex = notebook.activeCellIndex + 1;\n        // find first non hidden cell below current cell\n        while (possibleNextCellIndex < maxCellIndex) {\n            let possibleNextCell = notebook.widgets[possibleNextCellIndex];\n            if (!possibleNextCell.inputHidden && !possibleNextCell.isHidden) {\n                break;\n            }\n            possibleNextCellIndex += 1;\n        }\n        const state = Private.getState(notebook);\n        notebook.activeCellIndex = possibleNextCellIndex;\n        notebook.deselectAll();\n        void Private.handleState(notebook, state, true);\n    }\n    NotebookActions.selectBelow = selectBelow;\n    /** Insert new heading of same level above active cell.\n     *\n     * @param notebook - The target notebook widget\n     */\n    async function insertSameLevelHeadingAbove(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        let headingLevel = Private.Headings.determineHeadingLevel(notebook.activeCell, notebook);\n        if (headingLevel == -1) {\n            await Private.Headings.insertHeadingAboveCellIndex(0, 1, notebook);\n        }\n        else {\n            await Private.Headings.insertHeadingAboveCellIndex(notebook.activeCellIndex, headingLevel, notebook);\n        }\n    }\n    NotebookActions.insertSameLevelHeadingAbove = insertSameLevelHeadingAbove;\n    /** Insert new heading of same level at end of current section.\n     *\n     * @param notebook - The target notebook widget\n     */\n    async function insertSameLevelHeadingBelow(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        let headingLevel = Private.Headings.determineHeadingLevel(notebook.activeCell, notebook);\n        headingLevel = headingLevel > -1 ? headingLevel : 1;\n        let cellIdxOfHeadingBelow = Private.Headings.findLowerEqualLevelHeadingBelow(notebook.activeCell, notebook, true);\n        await Private.Headings.insertHeadingAboveCellIndex(cellIdxOfHeadingBelow == -1\n            ? notebook.model.cells.length\n            : cellIdxOfHeadingBelow, headingLevel, notebook);\n    }\n    NotebookActions.insertSameLevelHeadingBelow = insertSameLevelHeadingBelow;\n    /**\n     * Select the heading above the active cell or, if already at heading, collapse it.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * #### Notes\n     * The widget mode will be preserved.\n     * This is a no-op if the active cell is the topmost heading in collapsed state\n     * The existing selection will be cleared.\n     */\n    function selectHeadingAboveOrCollapseHeading(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        let hInfoActiveCell = getHeadingInfo(notebook.activeCell);\n        // either collapse or find the right heading to jump to\n        if (hInfoActiveCell.isHeading && !hInfoActiveCell.collapsed) {\n            setHeadingCollapse(notebook.activeCell, true, notebook);\n        }\n        else {\n            let targetHeadingCellIdx = Private.Headings.findLowerEqualLevelParentHeadingAbove(notebook.activeCell, notebook, true);\n            if (targetHeadingCellIdx > -1) {\n                notebook.activeCellIndex = targetHeadingCellIdx;\n            }\n        }\n        // clear selection and handle state\n        notebook.deselectAll();\n        void Private.handleState(notebook, state, true);\n    }\n    NotebookActions.selectHeadingAboveOrCollapseHeading = selectHeadingAboveOrCollapseHeading;\n    /**\n     * Select the heading below the active cell or, if already at heading, expand it.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * #### Notes\n     * The widget mode will be preserved.\n     * This is a no-op if the active cell is the last heading in expanded state\n     * The existing selection will be cleared.\n     */\n    function selectHeadingBelowOrExpandHeading(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        let hInfo = getHeadingInfo(notebook.activeCell);\n        if (hInfo.isHeading && hInfo.collapsed) {\n            setHeadingCollapse(notebook.activeCell, false, notebook);\n        }\n        else {\n            let targetHeadingCellIdx = Private.Headings.findHeadingBelow(notebook.activeCell, notebook, true // return index of heading cell\n            );\n            if (targetHeadingCellIdx > -1) {\n                notebook.activeCellIndex = targetHeadingCellIdx;\n            }\n        }\n        notebook.deselectAll();\n        void Private.handleState(notebook, state, true);\n    }\n    NotebookActions.selectHeadingBelowOrExpandHeading = selectHeadingBelowOrExpandHeading;\n    /**\n     * Extend the selection to the cell above.\n     *\n     * @param notebook - The target notebook widget.\n     * @param toTop - If true, denotes selection to extend to the top.\n     *\n     * #### Notes\n     * This is a no-op if the first cell is the active cell.\n     * The new cell will be activated.\n     */\n    function extendSelectionAbove(notebook, toTop = false) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        // Do not wrap around.\n        if (notebook.activeCellIndex === 0) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        notebook.mode = 'command';\n        // Check if toTop is true, if yes, selection is made to the top.\n        if (toTop) {\n            notebook.extendContiguousSelectionTo(0);\n        }\n        else {\n            notebook.extendContiguousSelectionTo(notebook.activeCellIndex - 1);\n        }\n        void Private.handleState(notebook, state, true);\n    }\n    NotebookActions.extendSelectionAbove = extendSelectionAbove;\n    /**\n     * Extend the selection to the cell below.\n     *\n     * @param notebook - The target notebook widget.\n     * @param toBottom - If true, denotes selection to extend to the bottom.\n     *\n     * #### Notes\n     * This is a no-op if the last cell is the active cell.\n     * The new cell will be activated.\n     */\n    function extendSelectionBelow(notebook, toBottom = false) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        // Do not wrap around.\n        if (notebook.activeCellIndex === notebook.widgets.length - 1) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        notebook.mode = 'command';\n        // Check if toBottom is true, if yes selection is made to the bottom.\n        if (toBottom) {\n            notebook.extendContiguousSelectionTo(notebook.widgets.length - 1);\n        }\n        else {\n            notebook.extendContiguousSelectionTo(notebook.activeCellIndex + 1);\n        }\n        void Private.handleState(notebook, state, true);\n    }\n    NotebookActions.extendSelectionBelow = extendSelectionBelow;\n    /**\n     * Select all of the cells of the notebook.\n     *\n     * @param notebook - the target notebook widget.\n     */\n    function selectAll(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        notebook.widgets.forEach(child => {\n            notebook.select(child);\n        });\n    }\n    NotebookActions.selectAll = selectAll;\n    /**\n     * Deselect all of the cells of the notebook.\n     *\n     * @param notebook - the target notebook widget.\n     */\n    function deselectAll(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        notebook.deselectAll();\n    }\n    NotebookActions.deselectAll = deselectAll;\n    /**\n     * Copy the selected cell(s) data to a clipboard.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    function copy(notebook) {\n        Private.copyOrCut(notebook, false);\n    }\n    NotebookActions.copy = copy;\n    /**\n     * Cut the selected cell data to a clipboard.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * #### Notes\n     * This action can be undone.\n     * A new code cell is added if all cells are cut.\n     */\n    function cut(notebook) {\n        Private.copyOrCut(notebook, true);\n    }\n    NotebookActions.cut = cut;\n    /**\n     * Paste cells from the application clipboard.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * @param mode - the mode of adding cells:\n     *   'below' (default) adds cells below the active cell,\n     *   'belowSelected' adds cells below all selected cells,\n     *   'above' adds cells above the active cell, and\n     *   'replace' removes the currently selected cells and adds cells in their place.\n     *\n     * #### Notes\n     * The last pasted cell becomes the active cell.\n     * This is a no-op if there is no cell data on the clipboard.\n     * This action can be undone.\n     */\n    function paste(notebook, mode = 'below') {\n        const clipboard = _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Clipboard.getInstance();\n        if (!clipboard.hasData(JUPYTER_CELL_MIME)) {\n            return;\n        }\n        const values = clipboard.getData(JUPYTER_CELL_MIME);\n        addCells(notebook, mode, values, true);\n        void focusActiveCell(notebook);\n    }\n    NotebookActions.paste = paste;\n    /**\n     * Duplicate selected cells in the notebook without using the application clipboard.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * @param mode - the mode of adding cells:\n     *   'below' (default) adds cells below the active cell,\n     *   'belowSelected' adds cells below all selected cells,\n     *   'above' adds cells above the active cell, and\n     *   'replace' removes the currently selected cells and adds cells in their place.\n     *\n     * #### Notes\n     * The last pasted cell becomes the active cell.\n     * This is a no-op if there is no cell data on the clipboard.\n     * This action can be undone.\n     */\n    function duplicate(notebook, mode = 'below') {\n        const values = Private.selectedCells(notebook);\n        if (!values || values.length === 0) {\n            return;\n        }\n        addCells(notebook, mode, values, false); // Cells not from the clipboard\n    }\n    NotebookActions.duplicate = duplicate;\n    /**\n     * Adds cells to the notebook.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * @param mode - the mode of adding cells:\n     *   'below' (default) adds cells below the active cell,\n     *   'belowSelected' adds cells below all selected cells,\n     *   'above' adds cells above the active cell, and\n     *   'replace' removes the currently selected cells and adds cells in their place.\n     *\n     * @param values — The cells to add to the notebook.\n     *\n     * @param cellsFromClipboard — True if the cells were sourced from the clipboard.\n     *\n     * #### Notes\n     * The last added cell becomes the active cell.\n     * This is a no-op if values is an empty array.\n     * This action can be undone.\n     */\n    function addCells(notebook, mode = 'below', values, cellsFromClipboard = false) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        const model = notebook.model;\n        notebook.mode = 'command';\n        let index = 0;\n        const prevActiveCellIndex = notebook.activeCellIndex;\n        model.sharedModel.transact(() => {\n            // Set the starting index of the paste operation depending upon the mode.\n            switch (mode) {\n                case 'below':\n                    index = notebook.activeCellIndex + 1;\n                    break;\n                case 'belowSelected':\n                    notebook.widgets.forEach((child, childIndex) => {\n                        if (notebook.isSelectedOrActive(child)) {\n                            index = childIndex + 1;\n                        }\n                    });\n                    break;\n                case 'above':\n                    index = notebook.activeCellIndex;\n                    break;\n                case 'replace': {\n                    // Find the cells to delete.\n                    const toDelete = [];\n                    notebook.widgets.forEach((child, index) => {\n                        const deletable = child.model.sharedModel.getMetadata('deletable') !== false;\n                        if (notebook.isSelectedOrActive(child) && deletable) {\n                            toDelete.push(index);\n                        }\n                    });\n                    // If cells are not deletable, we may not have anything to delete.\n                    if (toDelete.length > 0) {\n                        // Delete the cells as one undo event.\n                        toDelete.reverse().forEach(i => {\n                            model.sharedModel.deleteCell(i);\n                        });\n                    }\n                    index = toDelete[0];\n                    break;\n                }\n                default:\n                    break;\n            }\n            model.sharedModel.insertCells(index, values.map(cell => {\n                cell.id =\n                    cell.cell_type === 'code' &&\n                        notebook.lastClipboardInteraction === 'cut' &&\n                        typeof cell.id === 'string'\n                        ? cell.id\n                        : undefined;\n                return cell;\n            }));\n        });\n        notebook.activeCellIndex = prevActiveCellIndex + values.length;\n        notebook.deselectAll();\n        if (cellsFromClipboard) {\n            notebook.lastClipboardInteraction = 'paste';\n        }\n        void Private.handleState(notebook, state, true);\n    }\n    /**\n     * Undo a cell action.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * #### Notes\n     * This is a no-op if there are no cell actions to undo.\n     */\n    function undo(notebook) {\n        if (!notebook.model) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        notebook.mode = 'command';\n        notebook.model.sharedModel.undo();\n        notebook.deselectAll();\n        void Private.handleState(notebook, state);\n    }\n    NotebookActions.undo = undo;\n    /**\n     * Redo a cell action.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * #### Notes\n     * This is a no-op if there are no cell actions to redo.\n     */\n    function redo(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        notebook.mode = 'command';\n        notebook.model.sharedModel.redo();\n        notebook.deselectAll();\n        void Private.handleState(notebook, state);\n    }\n    NotebookActions.redo = redo;\n    /**\n     * Toggle the line number of all cells.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * #### Notes\n     * The original state is based on the state of the active cell.\n     * The `mode` of the widget will be preserved.\n     */\n    function toggleAllLineNumbers(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        const config = notebook.editorConfig;\n        const lineNumbers = !(config.code.lineNumbers &&\n            config.markdown.lineNumbers &&\n            config.raw.lineNumbers);\n        const newConfig = {\n            code: { ...config.code, lineNumbers },\n            markdown: { ...config.markdown, lineNumbers },\n            raw: { ...config.raw, lineNumbers }\n        };\n        notebook.editorConfig = newConfig;\n        void Private.handleState(notebook, state);\n    }\n    NotebookActions.toggleAllLineNumbers = toggleAllLineNumbers;\n    /**\n     * Clear the code outputs of the selected cells.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * #### Notes\n     * The widget `mode` will be preserved.\n     */\n    function clearOutputs(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        let index = -1;\n        for (const cell of notebook.model.cells) {\n            const child = notebook.widgets[++index];\n            if (notebook.isSelectedOrActive(child) && cell.type === 'code') {\n                cell.sharedModel.transact(() => {\n                    cell.clearExecution();\n                    child.outputHidden = false;\n                }, false);\n                Private.outputCleared.emit({ notebook, cell: child });\n            }\n        }\n        void Private.handleState(notebook, state, true);\n    }\n    NotebookActions.clearOutputs = clearOutputs;\n    /**\n     * Clear all the code outputs on the widget.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * #### Notes\n     * The widget `mode` will be preserved.\n     */\n    function clearAllOutputs(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        let index = -1;\n        for (const cell of notebook.model.cells) {\n            const child = notebook.widgets[++index];\n            if (cell.type === 'code') {\n                cell.sharedModel.transact(() => {\n                    cell.clearExecution();\n                    child.outputHidden = false;\n                }, false);\n                Private.outputCleared.emit({ notebook, cell: child });\n            }\n        }\n        void Private.handleState(notebook, state, true);\n    }\n    NotebookActions.clearAllOutputs = clearAllOutputs;\n    /**\n     * Hide the code on selected code cells.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    function hideCode(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        notebook.widgets.forEach(cell => {\n            if (notebook.isSelectedOrActive(cell) && cell.model.type === 'code') {\n                cell.inputHidden = true;\n            }\n        });\n        void Private.handleState(notebook, state);\n    }\n    NotebookActions.hideCode = hideCode;\n    /**\n     * Show the code on selected code cells.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    function showCode(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        notebook.widgets.forEach(cell => {\n            if (notebook.isSelectedOrActive(cell) && cell.model.type === 'code') {\n                cell.inputHidden = false;\n            }\n        });\n        void Private.handleState(notebook, state);\n    }\n    NotebookActions.showCode = showCode;\n    /**\n     * Hide the code on all code cells.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    function hideAllCode(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        notebook.widgets.forEach(cell => {\n            if (cell.model.type === 'code') {\n                cell.inputHidden = true;\n            }\n        });\n        void Private.handleState(notebook, state);\n    }\n    NotebookActions.hideAllCode = hideAllCode;\n    /**\n     * Show the code on all code cells.\n     *\n     * @param notebook The target notebook widget.\n     */\n    function showAllCode(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        notebook.widgets.forEach(cell => {\n            if (cell.model.type === 'code') {\n                cell.inputHidden = false;\n            }\n        });\n        void Private.handleState(notebook, state);\n    }\n    NotebookActions.showAllCode = showAllCode;\n    /**\n     * Hide the output on selected code cells.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    function hideOutput(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        notebook.widgets.forEach(cell => {\n            if (notebook.isSelectedOrActive(cell) && cell.model.type === 'code') {\n                cell.outputHidden = true;\n            }\n        });\n        void Private.handleState(notebook, state, true);\n    }\n    NotebookActions.hideOutput = hideOutput;\n    /**\n     * Show the output on selected code cells.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    function showOutput(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        notebook.widgets.forEach(cell => {\n            if (notebook.isSelectedOrActive(cell) && cell.model.type === 'code') {\n                cell.outputHidden = false;\n            }\n        });\n        void Private.handleState(notebook, state);\n    }\n    NotebookActions.showOutput = showOutput;\n    /**\n     * Hide the output on all code cells.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    function hideAllOutputs(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        notebook.widgets.forEach(cell => {\n            if (cell.model.type === 'code') {\n                cell.outputHidden = true;\n            }\n        });\n        void Private.handleState(notebook, state, true);\n    }\n    NotebookActions.hideAllOutputs = hideAllOutputs;\n    /**\n     * Render side-by-side.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    function renderSideBySide(notebook) {\n        notebook.renderingLayout = 'side-by-side';\n    }\n    NotebookActions.renderSideBySide = renderSideBySide;\n    /**\n     * Render not side-by-side.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    function renderDefault(notebook) {\n        notebook.renderingLayout = 'default';\n    }\n    NotebookActions.renderDefault = renderDefault;\n    /**\n     * Show the output on all code cells.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    function showAllOutputs(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        notebook.widgets.forEach(cell => {\n            if (cell.model.type === 'code') {\n                cell.outputHidden = false;\n            }\n        });\n        void Private.handleState(notebook, state);\n    }\n    NotebookActions.showAllOutputs = showAllOutputs;\n    /**\n     * Enable output scrolling for all selected cells.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    function enableOutputScrolling(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        notebook.widgets.forEach(cell => {\n            if (notebook.isSelectedOrActive(cell) && cell.model.type === 'code') {\n                cell.outputsScrolled = true;\n            }\n        });\n        void Private.handleState(notebook, state, true);\n    }\n    NotebookActions.enableOutputScrolling = enableOutputScrolling;\n    /**\n     * Disable output scrolling for all selected cells.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    function disableOutputScrolling(notebook) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        notebook.widgets.forEach(cell => {\n            if (notebook.isSelectedOrActive(cell) && cell.model.type === 'code') {\n                cell.outputsScrolled = false;\n            }\n        });\n        void Private.handleState(notebook, state);\n    }\n    NotebookActions.disableOutputScrolling = disableOutputScrolling;\n    /**\n     * Go to the last cell that is run or current if it is running.\n     *\n     * Note: This requires execution timing to be toggled on or this will have\n     * no effect.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    function selectLastRunCell(notebook) {\n        let latestTime = null;\n        let latestCellIdx = null;\n        notebook.widgets.forEach((cell, cellIndx) => {\n            if (cell.model.type === 'code') {\n                const execution = cell.model.getMetadata('execution');\n                if (execution &&\n                    _lumino_coreutils__WEBPACK_IMPORTED_MODULE_5__.JSONExt.isObject(execution) &&\n                    execution['iopub.status.busy'] !== undefined) {\n                    // The busy status is used as soon as a request is received:\n                    // https://jupyter-client.readthedocs.io/en/stable/messaging.html\n                    const timestamp = execution['iopub.status.busy'].toString();\n                    if (timestamp) {\n                        const startTime = new Date(timestamp);\n                        if (!latestTime || startTime >= latestTime) {\n                            latestTime = startTime;\n                            latestCellIdx = cellIndx;\n                        }\n                    }\n                }\n            }\n        });\n        if (latestCellIdx !== null) {\n            notebook.activeCellIndex = latestCellIdx;\n        }\n    }\n    NotebookActions.selectLastRunCell = selectLastRunCell;\n    /**\n     * Set the markdown header level.\n     *\n     * @param notebook - The target notebook widget.\n     * @param level - The header level.\n     * @param translator - The application translator.\n     *\n     * #### Notes\n     * All selected cells will be switched to markdown.\n     * The level will be clamped between 1 and 6.\n     * If there is an existing header, it will be replaced.\n     * There will always be one blank space after the header.\n     * The cells will be unrendered.\n     */\n    function setMarkdownHeader(notebook, level, translator) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = Private.getState(notebook);\n        const cells = notebook.model.cells;\n        level = Math.min(Math.max(level, 1), 6);\n        notebook.widgets.forEach((child, index) => {\n            if (notebook.isSelectedOrActive(child)) {\n                Private.setMarkdownHeader(cells.get(index), level);\n            }\n        });\n        Private.changeCellType(notebook, 'markdown', translator);\n        void Private.handleState(notebook, state);\n    }\n    NotebookActions.setMarkdownHeader = setMarkdownHeader;\n    /**\n     * Collapse all cells in given notebook.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    function collapseAllHeadings(notebook) {\n        const state = Private.getState(notebook);\n        for (const cell of notebook.widgets) {\n            if (NotebookActions.getHeadingInfo(cell).isHeading) {\n                NotebookActions.setHeadingCollapse(cell, true, notebook);\n                NotebookActions.setCellCollapse(cell, true);\n            }\n        }\n        notebook.activeCellIndex = 0;\n        void Private.handleState(notebook, state, true);\n    }\n    NotebookActions.collapseAllHeadings = collapseAllHeadings;\n    /**\n     * Un-collapse all cells in given notebook.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    function expandAllHeadings(notebook) {\n        for (const cell of notebook.widgets) {\n            if (NotebookActions.getHeadingInfo(cell).isHeading) {\n                NotebookActions.setHeadingCollapse(cell, false, notebook);\n                // similar to collapseAll.\n                NotebookActions.setCellCollapse(cell, false);\n            }\n        }\n    }\n    NotebookActions.expandAllHeadings = expandAllHeadings;\n    function findNearestParentHeader(cell, notebook) {\n        const index = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_4__.findIndex)(notebook.widgets, (possibleCell, index) => {\n            return cell.model.id === possibleCell.model.id;\n        });\n        if (index === -1) {\n            return;\n        }\n        // Finds the nearest header above the given cell. If the cell is a header itself, it does not return itself;\n        // this can be checked directly by calling functions.\n        if (index >= notebook.widgets.length) {\n            return;\n        }\n        let childHeaderInfo = getHeadingInfo(notebook.widgets[index]);\n        for (let cellN = index - 1; cellN >= 0; cellN--) {\n            if (cellN < notebook.widgets.length) {\n                let hInfo = getHeadingInfo(notebook.widgets[cellN]);\n                if (hInfo.isHeading &&\n                    hInfo.headingLevel < childHeaderInfo.headingLevel) {\n                    return notebook.widgets[cellN];\n                }\n            }\n        }\n        // else no parent header found.\n        return;\n    }\n    /**\n     * Finds the \"parent\" heading of the given cell and expands.\n     * Used for the case that a cell becomes active that is within a collapsed heading.\n     * @param cell - \"Child\" cell that has become the active cell\n     * @param notebook - The target notebook widget.\n     */\n    function expandParent(cell, notebook) {\n        let nearestParentCell = findNearestParentHeader(cell, notebook);\n        if (!nearestParentCell) {\n            return;\n        }\n        if (!getHeadingInfo(nearestParentCell).collapsed &&\n            !nearestParentCell.isHidden) {\n            return;\n        }\n        if (nearestParentCell.isHidden) {\n            expandParent(nearestParentCell, notebook);\n        }\n        if (getHeadingInfo(nearestParentCell).collapsed) {\n            setHeadingCollapse(nearestParentCell, false, notebook);\n        }\n    }\n    NotebookActions.expandParent = expandParent;\n    /**\n     * Finds the next heading that isn't a child of the given markdown heading.\n     * @param cell - \"Child\" cell that has become the active cell\n     * @param notebook - The target notebook widget.\n     */\n    function findNextParentHeading(cell, notebook) {\n        let index = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_4__.findIndex)(notebook.widgets, (possibleCell, index) => {\n            return cell.model.id === possibleCell.model.id;\n        });\n        if (index === -1) {\n            return -1;\n        }\n        let childHeaderInfo = getHeadingInfo(cell);\n        for (index = index + 1; index < notebook.widgets.length; index++) {\n            let hInfo = getHeadingInfo(notebook.widgets[index]);\n            if (hInfo.isHeading &&\n                hInfo.headingLevel <= childHeaderInfo.headingLevel) {\n                return index;\n            }\n        }\n        // else no parent header found. return the index of the last cell\n        return notebook.widgets.length;\n    }\n    NotebookActions.findNextParentHeading = findNextParentHeading;\n    /**\n     * Set the given cell and ** all \"child\" cells **\n     * to the given collapse / expand if cell is\n     * a markdown header.\n     *\n     * @param cell - The cell\n     * @param collapsing - Whether to collapse or expand the cell\n     * @param notebook - The target notebook widget.\n     */\n    function setHeadingCollapse(cell, collapsing, notebook) {\n        const which = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_4__.findIndex)(notebook.widgets, (possibleCell, index) => {\n            return cell.model.id === possibleCell.model.id;\n        });\n        if (which === -1) {\n            return -1;\n        }\n        if (!notebook.widgets.length) {\n            return which + 1;\n        }\n        let selectedHeadingInfo = NotebookActions.getHeadingInfo(cell);\n        if (cell.isHidden ||\n            !(cell instanceof _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.MarkdownCell) ||\n            !selectedHeadingInfo.isHeading) {\n            // otherwise collapsing and uncollapsing already hidden stuff can\n            // cause some funny looking bugs.\n            return which + 1;\n        }\n        let localCollapsed = false;\n        let localCollapsedLevel = 0;\n        // iterate through all cells after the active cell.\n        let cellNum;\n        for (cellNum = which + 1; cellNum < notebook.widgets.length; cellNum++) {\n            let subCell = notebook.widgets[cellNum];\n            let subCellHeadingInfo = NotebookActions.getHeadingInfo(subCell);\n            if (subCellHeadingInfo.isHeading &&\n                subCellHeadingInfo.headingLevel <= selectedHeadingInfo.headingLevel) {\n                // then reached an equivalent or higher heading level than the\n                // original the end of the collapse.\n                cellNum -= 1;\n                break;\n            }\n            if (localCollapsed &&\n                subCellHeadingInfo.isHeading &&\n                subCellHeadingInfo.headingLevel <= localCollapsedLevel) {\n                // then reached the end of the local collapsed, so unset NotebookActions.\n                localCollapsed = false;\n            }\n            if (collapsing || localCollapsed) {\n                // then no extra handling is needed for further locally collapsed\n                // headings.\n                subCell.setHidden(true);\n                continue;\n            }\n            if (subCellHeadingInfo.collapsed && subCellHeadingInfo.isHeading) {\n                localCollapsed = true;\n                localCollapsedLevel = subCellHeadingInfo.headingLevel;\n                // but don't collapse the locally collapsed heading, so continue to\n                // expand the heading. This will get noticed in the next round.\n            }\n            subCell.setHidden(false);\n        }\n        if (cellNum === notebook.widgets.length) {\n            cell.numberChildNodes = cellNum - which - 1;\n        }\n        else {\n            cell.numberChildNodes = cellNum - which;\n        }\n        NotebookActions.setCellCollapse(cell, collapsing);\n        return cellNum + 1;\n    }\n    NotebookActions.setHeadingCollapse = setHeadingCollapse;\n    /**\n     * Toggles the collapse state of the active cell of the given notebook\n     * and ** all of its \"child\" cells ** if the cell is a heading.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    function toggleCurrentHeadingCollapse(notebook) {\n        if (!notebook.activeCell || notebook.activeCellIndex === undefined) {\n            return;\n        }\n        let headingInfo = NotebookActions.getHeadingInfo(notebook.activeCell);\n        if (headingInfo.isHeading) {\n            // Then toggle!\n            NotebookActions.setHeadingCollapse(notebook.activeCell, !headingInfo.collapsed, notebook);\n        }\n        notebook.scrollToItem(notebook.activeCellIndex).catch(reason => {\n            // no-op\n        });\n    }\n    NotebookActions.toggleCurrentHeadingCollapse = toggleCurrentHeadingCollapse;\n    /**\n     * If cell is a markdown heading, sets the headingCollapsed field,\n     * and otherwise hides the cell.\n     *\n     * @param cell - The cell to collapse / expand\n     * @param collapsing - Whether to collapse or expand the given cell\n     */\n    function setCellCollapse(cell, collapsing) {\n        if (cell instanceof _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.MarkdownCell) {\n            cell.headingCollapsed = collapsing;\n        }\n        else {\n            cell.setHidden(collapsing);\n        }\n    }\n    NotebookActions.setCellCollapse = setCellCollapse;\n    /**\n     * If given cell is a markdown heading, returns the heading level.\n     * If given cell is not markdown, returns 7 (there are only 6 levels of markdown headings)\n     *\n     * @param cell - The target cell widget.\n     */\n    function getHeadingInfo(cell) {\n        if (!(cell instanceof _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.MarkdownCell)) {\n            return { isHeading: false, headingLevel: 7 };\n        }\n        let level = cell.headingInfo.level;\n        let collapsed = cell.headingCollapsed;\n        return { isHeading: level > 0, headingLevel: level, collapsed: collapsed };\n    }\n    NotebookActions.getHeadingInfo = getHeadingInfo;\n    /**\n     * Trust the notebook after prompting the user.\n     *\n     * @param notebook - The target notebook widget.\n     * @param translator - The application translator.\n     *\n     * @returns a promise that resolves when the transaction is finished.\n     *\n     * #### Notes\n     * No dialog will be presented if the notebook is already trusted.\n     */\n    function trust(notebook, translator) {\n        translator = translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3__.nullTranslator;\n        const trans = translator.load('jupyterlab');\n        if (!notebook.model) {\n            return Promise.resolve();\n        }\n        // Do nothing if already trusted.\n        const trusted = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_4__.every)(notebook.model.cells, cell => cell.trusted);\n        // FIXME\n        const trustMessage = (react__WEBPACK_IMPORTED_MODULE_7__.createElement(\"p\", null,\n            trans.__('A trusted Jupyter notebook may execute hidden malicious code when you open it.'),\n            react__WEBPACK_IMPORTED_MODULE_7__.createElement(\"br\", null),\n            trans.__('Selecting \"Trust\" will re-render this notebook in a trusted state.'),\n            react__WEBPACK_IMPORTED_MODULE_7__.createElement(\"br\", null),\n            trans.__('For more information, see'),\n            ' ',\n            react__WEBPACK_IMPORTED_MODULE_7__.createElement(\"a\", { href: \"https://jupyter-server.readthedocs.io/en/stable/operators/security.html\", target: \"_blank\", rel: \"noopener noreferrer\" }, trans.__('the Jupyter security documentation')),\n            \".\"));\n        if (trusted) {\n            return (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.showDialog)({\n                body: trans.__('Notebook is already trusted'),\n                buttons: [_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Dialog.okButton()]\n            }).then(() => undefined);\n        }\n        return (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.showDialog)({\n            body: trustMessage,\n            title: trans.__('Trust this notebook?'),\n            buttons: [\n                _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Dialog.cancelButton(),\n                _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Dialog.warnButton({\n                    label: trans.__('Trust'),\n                    ariaLabel: trans.__('Confirm Trusting this notebook')\n                })\n            ] // FIXME?\n        }).then(result => {\n            if (result.button.accept) {\n                if (notebook.model) {\n                    for (const cell of notebook.model.cells) {\n                        cell.trusted = true;\n                    }\n                }\n            }\n        });\n    }\n    NotebookActions.trust = trust;\n    /**\n     * If the notebook has an active cell, focus it.\n     *\n     * @param notebook The target notebook widget\n     * @param options Optional options to change the behavior of this function\n     * @param options.waitUntilReady If true, do not call focus until activeCell.ready is resolved\n     * @param options.preventScroll If true, do not scroll the active cell into view\n     *\n     * @returns a promise that resolves when focus has been called on the active\n     * cell's node.\n     *\n     * #### Notes\n     * By default, waits until after the active cell has been attached unless\n     * called with { waitUntilReady: false }\n     */\n    async function focusActiveCell(notebook, options = { waitUntilReady: true, preventScroll: false }) {\n        const { activeCell } = notebook;\n        const { waitUntilReady, preventScroll } = options;\n        if (!activeCell) {\n            return;\n        }\n        if (waitUntilReady) {\n            await activeCell.ready;\n        }\n        if (notebook.isDisposed || activeCell.isDisposed) {\n            return;\n        }\n        activeCell.node.focus({\n            preventScroll\n        });\n    }\n    NotebookActions.focusActiveCell = focusActiveCell;\n    /*\n     * Access last notebook history.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    async function accessPreviousHistory(notebook) {\n        if (!notebook.notebookConfig.accessKernelHistory) {\n            return;\n        }\n        const activeCell = notebook.activeCell;\n        if (activeCell) {\n            if (notebook.kernelHistory) {\n                const previousHistory = await notebook.kernelHistory.back(activeCell);\n                notebook.kernelHistory.updateEditor(activeCell, previousHistory);\n            }\n        }\n    }\n    NotebookActions.accessPreviousHistory = accessPreviousHistory;\n    /**\n     * Access next notebook history.\n     *\n     * @param notebook - The target notebook widget.\n     */\n    async function accessNextHistory(notebook) {\n        if (!notebook.notebookConfig.accessKernelHistory) {\n            return;\n        }\n        const activeCell = notebook.activeCell;\n        if (activeCell) {\n            if (notebook.kernelHistory) {\n                const nextHistory = await notebook.kernelHistory.forward(activeCell);\n                notebook.kernelHistory.updateEditor(activeCell, nextHistory);\n            }\n        }\n    }\n    NotebookActions.accessNextHistory = accessNextHistory;\n})(NotebookActions || (NotebookActions = {}));\n/**\n * Set the notebook cell executor and the related signals.\n */\nfunction setCellExecutor(executor) {\n    if (Private.executor) {\n        throw new Error('Cell executor can only be set once.');\n    }\n    Private.executor = executor;\n}\n/**\n * A namespace for private data.\n */\nvar Private;\n(function (Private) {\n    /**\n     * A signal that emits whenever a cell completes execution.\n     */\n    Private.executed = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_6__.Signal({});\n    /**\n     * A signal that emits whenever a cell execution is scheduled.\n     */\n    Private.executionScheduled = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_6__.Signal({});\n    /**\n     * A signal that emits when one notebook's cells are all executed.\n     */\n    Private.selectionExecuted = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_6__.Signal({});\n    /**\n     * A signal that emits when one notebook's cells are all executed.\n     */\n    Private.outputCleared = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_6__.Signal({});\n    /**\n     * Get the state of a widget before running an action.\n     */\n    function getState(notebook) {\n        var _a, _b;\n        return {\n            wasFocused: notebook.node.contains(document.activeElement),\n            activeCellId: (_b = (_a = notebook.activeCell) === null || _a === void 0 ? void 0 : _a.model.id) !== null && _b !== void 0 ? _b : null\n        };\n    }\n    Private.getState = getState;\n    /**\n     * Handle the state of a widget after running an action.\n     */\n    async function handleState(notebook, state, scrollIfNeeded = false) {\n        const { activeCell, activeCellIndex } = notebook;\n        if (scrollIfNeeded && activeCell) {\n            await notebook.scrollToItem(activeCellIndex, 'auto', 0).catch(reason => {\n                // no-op\n            });\n        }\n        if (state.wasFocused || notebook.mode === 'edit') {\n            notebook.activate();\n        }\n    }\n    Private.handleState = handleState;\n    /**\n     * Handle the state of a widget after running a run action.\n     */\n    async function handleRunState(notebook, state, alignPreference) {\n        const { activeCell, activeCellIndex } = notebook;\n        if (activeCell) {\n            await notebook\n                .scrollToItem(activeCellIndex, 'smart', 0, alignPreference)\n                .catch(reason => {\n                // no-op\n            });\n        }\n        if (state.wasFocused || notebook.mode === 'edit') {\n            notebook.activate();\n        }\n    }\n    Private.handleRunState = handleRunState;\n    /**\n     * Run the selected cells.\n     *\n     * @param notebook Notebook\n     * @param cells Cells to run\n     * @param sessionContext Notebook session context\n     * @param sessionDialogs Session dialogs\n     * @param translator Application translator\n     */\n    function runCells(notebook, cells, sessionContext, sessionDialogs, translator) {\n        const lastCell = cells[-1];\n        notebook.mode = 'command';\n        let initializingDialogShown = false;\n        return Promise.all(cells.map(cell => {\n            if (cell.model.type === 'code' &&\n                notebook.notebookConfig.enableKernelInitNotification &&\n                sessionContext &&\n                sessionContext.kernelDisplayStatus === 'initializing' &&\n                !initializingDialogShown) {\n                initializingDialogShown = true;\n                translator = translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3__.nullTranslator;\n                const trans = translator.load('jupyterlab');\n                _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Notification.emit(trans.__(`Kernel '${sessionContext.kernelDisplayName}' for '${sessionContext.path}' is still initializing. You can run code cells when the kernel has initialized.`), 'warning', {\n                    autoClose: false\n                });\n                return Promise.resolve(false);\n            }\n            if (cell.model.type === 'code' &&\n                notebook.notebookConfig.enableKernelInitNotification &&\n                initializingDialogShown) {\n                return Promise.resolve(false);\n            }\n            return runCell(notebook, cell, sessionContext, sessionDialogs, translator);\n        }))\n            .then(results => {\n            if (notebook.isDisposed) {\n                return false;\n            }\n            Private.selectionExecuted.emit({\n                notebook,\n                lastCell\n            });\n            // Post an update request.\n            notebook.update();\n            return results.every(result => result);\n        })\n            .catch(reason => {\n            if (reason.message.startsWith('KernelReplyNotOK')) {\n                cells.map(cell => {\n                    // Remove '*' prompt from cells that didn't execute\n                    if (cell.model.type === 'code' &&\n                        cell.model.executionCount == null) {\n                        cell.setPrompt('');\n                    }\n                });\n            }\n            else {\n                throw reason;\n            }\n            Private.selectionExecuted.emit({\n                notebook,\n                lastCell\n            });\n            notebook.update();\n            return false;\n        });\n    }\n    Private.runCells = runCells;\n    /**\n     * Run the selected cells.\n     *\n     * @param notebook Notebook\n     * @param sessionContext Notebook session context\n     * @param sessionDialogs Session dialogs\n     * @param translator Application translator\n     */\n    function runSelected(notebook, sessionContext, sessionDialogs, translator) {\n        notebook.mode = 'command';\n        let lastIndex = notebook.activeCellIndex;\n        const selected = notebook.widgets.filter((child, index) => {\n            const active = notebook.isSelectedOrActive(child);\n            if (active) {\n                lastIndex = index;\n            }\n            return active;\n        });\n        notebook.activeCellIndex = lastIndex;\n        notebook.deselectAll();\n        return runCells(notebook, selected, sessionContext, sessionDialogs, translator);\n    }\n    Private.runSelected = runSelected;\n    /**\n     * Run a cell.\n     */\n    async function runCell(notebook, cell, sessionContext, sessionDialogs, translator) {\n        if (!Private.executor) {\n            console.warn('Requesting cell execution without any cell executor defined. Falling back to default execution.');\n        }\n        const options = {\n            cell,\n            notebook: notebook.model,\n            notebookConfig: notebook.notebookConfig,\n            onCellExecuted: args => {\n                Private.executed.emit({ notebook, ...args });\n            },\n            onCellExecutionScheduled: args => {\n                Private.executionScheduled.emit({ notebook, ...args });\n            },\n            sessionContext,\n            sessionDialogs,\n            translator\n        };\n        return Private.executor ? Private.executor.runCell(options) : (0,_cellexecutor__WEBPACK_IMPORTED_MODULE_8__.runCell)(options);\n    }\n    /**\n     * Get the selected cell(s) without affecting the clipboard.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * @returns A list of 0 or more selected cells\n     */\n    function selectedCells(notebook) {\n        return notebook.widgets\n            .filter(cell => notebook.isSelectedOrActive(cell))\n            .map(cell => cell.model.toJSON())\n            .map(cellJSON => {\n            if (cellJSON.metadata.deletable !== undefined) {\n                delete cellJSON.metadata.deletable;\n            }\n            return cellJSON;\n        });\n    }\n    Private.selectedCells = selectedCells;\n    /**\n     * Copy or cut the selected cell data to the application clipboard.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * @param cut - True if the cells should be cut, false if they should be copied.\n     */\n    function copyOrCut(notebook, cut) {\n        if (!notebook.model || !notebook.activeCell) {\n            return;\n        }\n        const state = getState(notebook);\n        const clipboard = _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Clipboard.getInstance();\n        notebook.mode = 'command';\n        clipboard.clear();\n        const data = Private.selectedCells(notebook);\n        clipboard.setData(JUPYTER_CELL_MIME, data);\n        if (cut) {\n            deleteCells(notebook);\n        }\n        else {\n            notebook.deselectAll();\n        }\n        if (cut) {\n            notebook.lastClipboardInteraction = 'cut';\n        }\n        else {\n            notebook.lastClipboardInteraction = 'copy';\n        }\n        void handleState(notebook, state);\n    }\n    Private.copyOrCut = copyOrCut;\n    /**\n     * Change the selected cell type(s).\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * @param value - The target cell type.\n     *\n     * #### Notes\n     * It should preserve the widget mode.\n     * This action can be undone.\n     * The existing selection will be cleared.\n     * Any cells converted to markdown will be unrendered.\n     */\n    function changeCellType(notebook, value, translator) {\n        const notebookSharedModel = notebook.model.sharedModel;\n        notebook.widgets.forEach((child, index) => {\n            if (!notebook.isSelectedOrActive(child)) {\n                return;\n            }\n            if (child.model.type === 'code' &&\n                child.outputArea.pendingInput) {\n                translator = translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3__.nullTranslator;\n                const trans = translator.load('jupyterlab');\n                // Do not permit changing cell type when input is pending\n                void (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.showDialog)({\n                    title: trans.__('Cell type not changed due to pending input'),\n                    body: trans.__('The cell type has not been changed to avoid kernel deadlock as this cell has pending input! Submit your pending input and try again.'),\n                    buttons: [_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Dialog.okButton()]\n                });\n                return;\n            }\n            if (child.model.type !== value) {\n                const raw = child.model.toJSON();\n                notebookSharedModel.transact(() => {\n                    notebookSharedModel.deleteCell(index);\n                    if (value === 'code') {\n                        // After change of type outputs are deleted so cell can be trusted.\n                        raw.metadata.trusted = true;\n                    }\n                    else {\n                        // Otherwise clear the metadata as trusted is only \"valid\" on code\n                        // cells (since other cell types cannot have outputs).\n                        raw.metadata.trusted = undefined;\n                    }\n                    const newCell = notebookSharedModel.insertCell(index, {\n                        cell_type: value,\n                        source: raw.source,\n                        metadata: raw.metadata\n                    });\n                    if (raw.attachments && ['markdown', 'raw'].includes(value)) {\n                        newCell.attachments =\n                            raw.attachments;\n                    }\n                });\n            }\n            if (value === 'markdown') {\n                // Fetch the new widget and unrender it.\n                child = notebook.widgets[index];\n                child.rendered = false;\n            }\n        });\n        notebook.deselectAll();\n    }\n    Private.changeCellType = changeCellType;\n    /**\n     * Delete the selected cells.\n     *\n     * @param notebook - The target notebook widget.\n     *\n     * #### Notes\n     * The cell after the last selected cell will be activated.\n     * If the last cell is deleted, then the previous one will be activated.\n     * It will add a code cell if all cells are deleted.\n     * This action can be undone.\n     */\n    function deleteCells(notebook) {\n        const model = notebook.model;\n        const sharedModel = model.sharedModel;\n        const toDelete = [];\n        notebook.mode = 'command';\n        // Find the cells to delete.\n        notebook.widgets.forEach((child, index) => {\n            var _a;\n            const deletable = child.model.getMetadata('deletable') !== false;\n            if (notebook.isSelectedOrActive(child) && deletable) {\n                toDelete.push(index);\n                (_a = notebook.model) === null || _a === void 0 ? void 0 : _a.deletedCells.push(child.model.id);\n            }\n        });\n        // If cells are not deletable, we may not have anything to delete.\n        if (toDelete.length > 0) {\n            // Delete the cells as one undo event.\n            sharedModel.transact(() => {\n                // Delete cells in reverse order to maintain the correct indices.\n                toDelete.reverse().forEach(index => {\n                    sharedModel.deleteCell(index);\n                });\n                // Add a new cell if the notebook is empty. This is done\n                // within the compound operation to make the deletion of\n                // a notebook's last cell undoable.\n                if (sharedModel.cells.length == toDelete.length) {\n                    sharedModel.insertCell(0, {\n                        cell_type: notebook.notebookConfig.defaultCell,\n                        metadata: notebook.notebookConfig.defaultCell === 'code'\n                            ? {\n                                // This is an empty cell created in empty notebook, thus is trusted\n                                trusted: true\n                            }\n                            : {}\n                    });\n                }\n            });\n            // Select the *first* interior cell not deleted or the cell\n            // *after* the last selected cell.\n            // Note: The activeCellIndex is clamped to the available cells,\n            // so if the last cell is deleted the previous cell will be activated.\n            // The *first* index is the index of the last cell in the initial\n            // toDelete list due to the `reverse` operation above.\n            notebook.activeCellIndex = toDelete[0] - toDelete.length + 1;\n        }\n        // Deselect any remaining, undeletable cells. Do this even if we don't\n        // delete anything so that users are aware *something* happened.\n        notebook.deselectAll();\n    }\n    Private.deleteCells = deleteCells;\n    /**\n     * Set the markdown header level of a cell.\n     */\n    function setMarkdownHeader(cell, level) {\n        // Remove existing header or leading white space.\n        let source = cell.sharedModel.getSource();\n        const regex = /^(#+\\s*)|^(\\s*)/;\n        const newHeader = Array(level + 1).join('#') + ' ';\n        const matches = regex.exec(source);\n        if (matches) {\n            source = source.slice(matches[0].length);\n        }\n        cell.sharedModel.setSource(newHeader + source);\n    }\n    Private.setMarkdownHeader = setMarkdownHeader;\n    /** Functionality related to collapsible headings */\n    let Headings;\n    (function (Headings) {\n        /** Find the heading that is parent to cell.\n         *\n         * @param childCell - The cell that is child to the sought heading\n         * @param notebook - The target notebook widget\n         * @param includeChildCell [default=false] - if set to true and childCell is a heading itself, the childCell will be returned\n         * @param returnIndex [default=false] - if set to true, the cell index is returned rather than the cell object.\n         *\n         * @returns the (index | Cell object) of the parent heading or (-1 | null) if there is no parent heading.\n         */\n        function findParentHeading(childCell, notebook, includeChildCell = false, returnIndex = false) {\n            let cellIdx = notebook.widgets.indexOf(childCell) - (includeChildCell ? 1 : 0);\n            while (cellIdx >= 0) {\n                let headingInfo = NotebookActions.getHeadingInfo(notebook.widgets[cellIdx]);\n                if (headingInfo.isHeading) {\n                    return returnIndex ? cellIdx : notebook.widgets[cellIdx];\n                }\n                cellIdx--;\n            }\n            return returnIndex ? -1 : null;\n        }\n        Headings.findParentHeading = findParentHeading;\n        /** Find heading above with leq level than baseCell heading level.\n         *\n         * @param baseCell - cell relative to which so search\n         * @param notebook - target notebook widget\n         * @param returnIndex [default=false] - if set to true, the cell index is returned rather than the cell object.\n         *\n         * @returns the (index | Cell object) of the found heading or (-1 | null) if no heading found.\n         */\n        function findLowerEqualLevelParentHeadingAbove(baseCell, notebook, returnIndex = false) {\n            let baseHeadingLevel = Private.Headings.determineHeadingLevel(baseCell, notebook);\n            if (baseHeadingLevel == -1) {\n                baseHeadingLevel = 1; // if no heading level can be determined, assume we're on level 1\n            }\n            // find the heading above with heading level <= baseHeadingLevel and return its index\n            let cellIdx = notebook.widgets.indexOf(baseCell) - 1;\n            while (cellIdx >= 0) {\n                let cell = notebook.widgets[cellIdx];\n                let headingInfo = NotebookActions.getHeadingInfo(cell);\n                if (headingInfo.isHeading &&\n                    headingInfo.headingLevel <= baseHeadingLevel) {\n                    return returnIndex ? cellIdx : cell;\n                }\n                cellIdx--;\n            }\n            return returnIndex ? -1 : null; // no heading found\n        }\n        Headings.findLowerEqualLevelParentHeadingAbove = findLowerEqualLevelParentHeadingAbove;\n        /** Find next heading with equal or lower level.\n         *\n         * @param baseCell - cell relative to which so search\n         * @param notebook - target notebook widget\n         * @param returnIndex [default=false] - if set to true, the cell index is returned rather than the cell object.\n         *\n         * @returns the (index | Cell object) of the found heading or (-1 | null) if no heading found.\n         */\n        function findLowerEqualLevelHeadingBelow(baseCell, notebook, returnIndex = false) {\n            let baseHeadingLevel = Private.Headings.determineHeadingLevel(baseCell, notebook);\n            if (baseHeadingLevel == -1) {\n                baseHeadingLevel = 1; // if no heading level can be determined, assume we're on level 1\n            }\n            let cellIdx = notebook.widgets.indexOf(baseCell) + 1;\n            while (cellIdx < notebook.widgets.length) {\n                let cell = notebook.widgets[cellIdx];\n                let headingInfo = NotebookActions.getHeadingInfo(cell);\n                if (headingInfo.isHeading &&\n                    headingInfo.headingLevel <= baseHeadingLevel) {\n                    return returnIndex ? cellIdx : cell;\n                }\n                cellIdx++;\n            }\n            return returnIndex ? -1 : null;\n        }\n        Headings.findLowerEqualLevelHeadingBelow = findLowerEqualLevelHeadingBelow;\n        /** Find next heading.\n         *\n         * @param baseCell - cell relative to which so search\n         * @param notebook - target notebook widget\n         * @param returnIndex [default=false] - if set to true, the cell index is returned rather than the cell object.\n         *\n         * @returns the (index | Cell object) of the found heading or (-1 | null) if no heading found.\n         */\n        function findHeadingBelow(baseCell, notebook, returnIndex = false) {\n            let cellIdx = notebook.widgets.indexOf(baseCell) + 1;\n            while (cellIdx < notebook.widgets.length) {\n                let cell = notebook.widgets[cellIdx];\n                let headingInfo = NotebookActions.getHeadingInfo(cell);\n                if (headingInfo.isHeading) {\n                    return returnIndex ? cellIdx : cell;\n                }\n                cellIdx++;\n            }\n            return returnIndex ? -1 : null;\n        }\n        Headings.findHeadingBelow = findHeadingBelow;\n        /** Determine the heading level of a cell.\n         *\n         * @param baseCell - The cell of which the heading level shall be determined\n         * @param notebook - The target notebook widget\n         *\n         * @returns the heading level or -1 if there is no parent heading\n         *\n         * #### Notes\n         * If the baseCell is a heading itself, the heading level of baseCell is returned.\n         * If the baseCell is not a heading itself, the level of the parent heading is returned.\n         * If there is no parent heading, -1 is returned.\n         */\n        function determineHeadingLevel(baseCell, notebook) {\n            let headingInfoBaseCell = NotebookActions.getHeadingInfo(baseCell);\n            // fill baseHeadingLevel or return null if there is no heading at or above baseCell\n            if (headingInfoBaseCell.isHeading) {\n                return headingInfoBaseCell.headingLevel;\n            }\n            else {\n                let parentHeading = findParentHeading(baseCell, notebook, true);\n                if (parentHeading == null) {\n                    return -1;\n                }\n                return NotebookActions.getHeadingInfo(parentHeading).headingLevel;\n            }\n        }\n        Headings.determineHeadingLevel = determineHeadingLevel;\n        /** Insert a new heading cell at given position.\n         *\n         * @param cellIndex - where to insert\n         * @param headingLevel - level of the new heading\n         * @param notebook - target notebook\n         *\n         * #### Notes\n         * Enters edit mode after insert.\n         */\n        async function insertHeadingAboveCellIndex(cellIndex, headingLevel, notebook) {\n            var _a;\n            headingLevel = Math.min(Math.max(headingLevel, 1), 6);\n            const state = Private.getState(notebook);\n            const model = notebook.model;\n            const sharedModel = model.sharedModel;\n            sharedModel.insertCell(cellIndex, {\n                cell_type: 'markdown',\n                source: '#'.repeat(headingLevel) + ' '\n            });\n            notebook.activeCellIndex = cellIndex;\n            if (((_a = notebook.activeCell) === null || _a === void 0 ? void 0 : _a.inViewport) === false) {\n                await (0,_jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_2__.signalToPromise)(notebook.activeCell.inViewportChanged, 200).catch(() => {\n                    // no-op\n                });\n            }\n            notebook.deselectAll();\n            void Private.handleState(notebook, state, true);\n            notebook.mode = 'edit';\n            notebook.widgets[cellIndex].setHidden(false);\n        }\n        Headings.insertHeadingAboveCellIndex = insertHeadingAboveCellIndex;\n    })(Headings = Private.Headings || (Private.Headings = {}));\n})(Private || (Private = {}));\n//# sourceMappingURL=actions.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/actions.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/cellexecutor.js":
/*!****************************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/cellexecutor.js ***!
  \****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   runCell: () => (/* binding */ runCell)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/apputils */ \"webpack/sharing/consume/default/@jupyterlab/apputils/@jupyterlab/apputils\");\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/cells */ \"webpack/sharing/consume/default/@jupyterlab/cells/@jupyterlab/cells\");\n/* harmony import */ var _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyterlab/translation */ \"webpack/sharing/consume/default/@jupyterlab/translation/@jupyterlab/translation\");\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_translation__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/* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./actions */ \"../node_modules/@jupyterlab/notebook/lib/actions.js\");\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n\n\n\n\n/**\n * Run a single notebook cell.\n *\n * @param options Cell execution options\n * @returns Execution status\n */\nasync function runCell({ cell, notebook, notebookConfig, onCellExecuted, onCellExecutionScheduled, sessionContext, sessionDialogs, translator }) {\n    var _a;\n    translator = translator !== null && translator !== void 0 ? translator : _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_2__.nullTranslator;\n    const trans = translator.load('jupyterlab');\n    switch (cell.model.type) {\n        case 'markdown':\n            cell.rendered = true;\n            cell.inputHidden = false;\n            onCellExecuted({ cell, success: true });\n            break;\n        case 'code':\n            if (sessionContext) {\n                if (sessionContext.isTerminating) {\n                    await (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.showDialog)({\n                        title: trans.__('Kernel Terminating'),\n                        body: trans.__('The kernel for %1 appears to be terminating. You can not run any cell for now.', (_a = sessionContext.session) === null || _a === void 0 ? void 0 : _a.path),\n                        buttons: [_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Dialog.okButton()]\n                    });\n                    break;\n                }\n                if (sessionContext.pendingInput) {\n                    await (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.showDialog)({\n                        title: trans.__('Cell not executed due to pending input'),\n                        body: trans.__('The cell has not been executed to avoid kernel deadlock as there is another pending input! Submit your pending input and try again.'),\n                        buttons: [_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Dialog.okButton()]\n                    });\n                    return false;\n                }\n                if (sessionContext.hasNoKernel) {\n                    const shouldSelect = await sessionContext.startKernel();\n                    if (shouldSelect && sessionDialogs) {\n                        await sessionDialogs.selectKernel(sessionContext);\n                    }\n                }\n                if (sessionContext.hasNoKernel) {\n                    cell.model.sharedModel.transact(() => {\n                        cell.model.clearExecution();\n                    });\n                    return true;\n                }\n                const deletedCells = notebook.deletedCells;\n                onCellExecutionScheduled({ cell });\n                let ran = false;\n                try {\n                    const reply = await _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.CodeCell.execute(cell, sessionContext, {\n                        deletedCells,\n                        recordTiming: notebookConfig.recordTiming\n                    });\n                    deletedCells.splice(0, deletedCells.length);\n                    ran = (() => {\n                        if (cell.isDisposed) {\n                            return false;\n                        }\n                        if (!reply) {\n                            return true;\n                        }\n                        if (reply.content.status === 'ok') {\n                            const content = reply.content;\n                            if (content.payload && content.payload.length) {\n                                handlePayload(content, notebook, cell);\n                            }\n                            return true;\n                        }\n                        else {\n                            throw new _actions__WEBPACK_IMPORTED_MODULE_4__.KernelError(reply.content);\n                        }\n                    })();\n                }\n                catch (reason) {\n                    if (cell.isDisposed || reason.message.startsWith('Canceled')) {\n                        ran = false;\n                    }\n                    else {\n                        onCellExecuted({\n                            cell,\n                            success: false,\n                            error: reason\n                        });\n                        throw reason;\n                    }\n                }\n                if (ran) {\n                    onCellExecuted({ cell, success: true });\n                }\n                return ran;\n            }\n            cell.model.sharedModel.transact(() => {\n                cell.model.clearExecution();\n            }, false);\n            break;\n        default:\n            break;\n    }\n    return Promise.resolve(true);\n}\n/**\n * Handle payloads from an execute reply.\n *\n * #### Notes\n * Payloads are deprecated and there are no official interfaces for them in\n * the kernel type definitions.\n * See [Payloads (DEPRECATED)](https://jupyter-client.readthedocs.io/en/latest/messaging.html#payloads-deprecated).\n */\nfunction handlePayload(content, notebook, cell) {\n    var _a;\n    const setNextInput = (_a = content.payload) === null || _a === void 0 ? void 0 : _a.filter(i => {\n        return i.source === 'set_next_input';\n    })[0];\n    if (!setNextInput) {\n        return;\n    }\n    const text = setNextInput.text;\n    const replace = setNextInput.replace;\n    if (replace) {\n        cell.model.sharedModel.setSource(text);\n        return;\n    }\n    // Create a new code cell and add as the next cell.\n    const notebookModel = notebook.sharedModel;\n    const cells = notebook.cells;\n    const index = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_3__.findIndex)(cells, model => model === cell.model);\n    // While this cell has no outputs and could be trusted following the letter\n    // of Jupyter trust model, its content comes from kernel and hence is not\n    // necessarily controlled by the user; if we set it as trusted, a user\n    // executing cells in succession could end up with unwanted trusted output.\n    if (index === -1) {\n        notebookModel.insertCell(notebookModel.cells.length, {\n            cell_type: 'code',\n            source: text,\n            metadata: {\n                trusted: false\n            }\n        });\n    }\n    else {\n        notebookModel.insertCell(index + 1, {\n            cell_type: 'code',\n            source: text,\n            metadata: {\n                trusted: false\n            }\n        });\n    }\n}\n//# sourceMappingURL=cellexecutor.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/cellexecutor.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/celllist.js":
/*!************************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/celllist.js ***!
  \************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   CellList: () => (/* binding */ CellList)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/cells */ \"webpack/sharing/consume/default/@jupyterlab/cells/@jupyterlab/cells\");\n/* harmony import */ var _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/signaling */ \"webpack/sharing/consume/default/@lumino/signaling/@lumino/signaling\");\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_lumino_signaling__WEBPACK_IMPORTED_MODULE_1__);\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n\n/**\n * A cell list object that supports undo/redo.\n */\nclass CellList {\n    /**\n     * Construct the cell list.\n     */\n    constructor(model) {\n        this.model = model;\n        this._cellMap = new WeakMap();\n        this._changed = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__.Signal(this);\n        this._isDisposed = false;\n        this._insertCells(0, this.model.cells);\n        this.model.changed.connect(this._onSharedModelChanged, this);\n    }\n    /**\n     * A signal emitted when the cell list has changed.\n     */\n    get changed() {\n        return this._changed;\n    }\n    /**\n     * Test whether the cell list has been disposed.\n     */\n    get isDisposed() {\n        return this._isDisposed;\n    }\n    /**\n     * Get the length of the cell list.\n     *\n     * @returns The number of cells in the cell list.\n     */\n    get length() {\n        return this.model.cells.length;\n    }\n    /**\n     * Create an iterator over the cells in the cell list.\n     *\n     * @returns A new iterator starting at the front of the cell list.\n     */\n    *[Symbol.iterator]() {\n        for (const cell of this.model.cells) {\n            yield this._cellMap.get(cell);\n        }\n    }\n    /**\n     * Dispose of the resources held by the cell list.\n     */\n    dispose() {\n        var _a;\n        if (this._isDisposed) {\n            return;\n        }\n        this._isDisposed = true;\n        // Clean up the cell map and cell order objects.\n        for (const cell of this.model.cells) {\n            (_a = this._cellMap.get(cell)) === null || _a === void 0 ? void 0 : _a.dispose();\n        }\n        _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__.Signal.clearData(this);\n    }\n    /**\n     * Get the cell at the specified index.\n     *\n     * @param index - The positive integer index of interest.\n     *\n     * @returns The cell at the specified index.\n     */\n    get(index) {\n        return this._cellMap.get(this.model.cells[index]);\n    }\n    _insertCells(index, cells) {\n        cells.forEach(sharedModel => {\n            let cellModel;\n            switch (sharedModel.cell_type) {\n                case 'code': {\n                    cellModel = new _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__.CodeCellModel({\n                        sharedModel: sharedModel\n                    });\n                    break;\n                }\n                case 'markdown': {\n                    cellModel = new _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__.MarkdownCellModel({\n                        sharedModel: sharedModel\n                    });\n                    break;\n                }\n                default: {\n                    cellModel = new _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__.RawCellModel({\n                        sharedModel: sharedModel\n                    });\n                }\n            }\n            this._cellMap.set(sharedModel, cellModel);\n            sharedModel.disposed.connect(() => {\n                cellModel.dispose();\n                this._cellMap.delete(sharedModel);\n            });\n        });\n        return this.length;\n    }\n    _onSharedModelChanged(self, change) {\n        var _a;\n        let currpos = 0;\n        // We differ emitting the list changes to ensure cell model for all current shared cell have been created.\n        const events = new Array();\n        (_a = change.cellsChange) === null || _a === void 0 ? void 0 : _a.forEach(delta => {\n            if (delta.insert != null) {\n                this._insertCells(currpos, delta.insert);\n                events.push({\n                    type: 'add',\n                    newIndex: currpos,\n                    newValues: delta.insert.map(c => this._cellMap.get(c)),\n                    oldIndex: -2,\n                    oldValues: []\n                });\n                currpos += delta.insert.length;\n            }\n            else if (delta.delete != null) {\n                events.push({\n                    type: 'remove',\n                    newIndex: -1,\n                    newValues: [],\n                    oldIndex: currpos,\n                    // Cells have been disposed, so we don't know which one are gone.\n                    oldValues: new Array(delta.delete).fill(undefined)\n                });\n            }\n            else if (delta.retain != null) {\n                currpos += delta.retain;\n            }\n        });\n        events.forEach(msg => this._changed.emit(msg));\n    }\n}\n//# sourceMappingURL=celllist.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/celllist.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/constants.js":
/*!*************************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/constants.js ***!
  \*************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   DROP_SOURCE_CLASS: () => (/* binding */ DROP_SOURCE_CLASS),\n/* harmony export */   DROP_TARGET_CLASS: () => (/* binding */ DROP_TARGET_CLASS)\n/* harmony export */ });\n/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n/**\n * The class name added to a drop target.\n */\nconst DROP_TARGET_CLASS = 'jp-mod-dropTarget';\n/**\n * The class name added to a drop source.\n */\nconst DROP_SOURCE_CLASS = 'jp-mod-dropSource';\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/constants.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/default-toolbar.js":
/*!*******************************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/default-toolbar.js ***!
  \*******************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   CellTypeSwitcher: () => (/* binding */ CellTypeSwitcher),\n/* harmony export */   ToolbarItems: () => (/* binding */ ToolbarItems)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/apputils */ \"webpack/sharing/consume/default/@jupyterlab/apputils/@jupyterlab/apputils\");\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/translation */ \"webpack/sharing/consume/default/@jupyterlab/translation/@jupyterlab/translation\");\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__ = __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_2___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ \"webpack/sharing/consume/default/react/react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./actions */ \"../node_modules/@jupyterlab/notebook/lib/actions.js\");\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n\n\n\n\n/**\n * The class name added to toolbar cell type dropdown wrapper.\n */\nconst TOOLBAR_CELLTYPE_CLASS = 'jp-Notebook-toolbarCellType';\n/**\n * The class name added to toolbar cell type dropdown.\n */\nconst TOOLBAR_CELLTYPE_DROPDOWN_CLASS = 'jp-Notebook-toolbarCellTypeDropdown';\n/**\n * A namespace for the default toolbar items.\n */\nvar ToolbarItems;\n(function (ToolbarItems) {\n    /**\n     * Create save button toolbar item.\n     *\n     * @deprecated since v3.2\n     * This is dead code now.\n     */\n    function createSaveButton(panel, translator) {\n        const trans = (translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__.nullTranslator).load('jupyterlab');\n        function onClick() {\n            if (panel.context.model.readOnly) {\n                return (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.showDialog)({\n                    title: trans.__('Cannot Save'),\n                    body: trans.__('Document is read-only'),\n                    buttons: [_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Dialog.okButton()]\n                });\n            }\n            void panel.context.save().then(() => {\n                if (!panel.isDisposed) {\n                    return panel.context.createCheckpoint();\n                }\n            });\n        }\n        return (0,_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.addToolbarButtonClass)(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.ReactWidget.create(react__WEBPACK_IMPORTED_MODULE_3__.createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.UseSignal, { signal: panel.context.fileChanged }, () => (react__WEBPACK_IMPORTED_MODULE_3__.createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.ToolbarButtonComponent, { icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.saveIcon, onClick: onClick, tooltip: trans.__('Save the notebook contents and create checkpoint'), enabled: !!(panel &&\n                panel.context &&\n                panel.context.contentsModel &&\n                panel.context.contentsModel.writable) })))));\n    }\n    ToolbarItems.createSaveButton = createSaveButton;\n    /**\n     * Create an insert toolbar item.\n     *\n     * @deprecated since v3.2\n     * This is dead code now.\n     */\n    function createInsertButton(panel, translator) {\n        const trans = (translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__.nullTranslator).load('jupyterlab');\n        return new _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.ToolbarButton({\n            icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.addIcon,\n            onClick: () => {\n                _actions__WEBPACK_IMPORTED_MODULE_4__.NotebookActions.insertBelow(panel.content);\n            },\n            tooltip: trans.__('Insert a cell below')\n        });\n    }\n    ToolbarItems.createInsertButton = createInsertButton;\n    /**\n     * Create a cut toolbar item.\n     *\n     * @deprecated since v3.2\n     * This is dead code now.\n     */\n    function createCutButton(panel, translator) {\n        const trans = (translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__.nullTranslator).load('jupyterlab');\n        return new _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.ToolbarButton({\n            icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.cutIcon,\n            onClick: () => {\n                _actions__WEBPACK_IMPORTED_MODULE_4__.NotebookActions.cut(panel.content);\n            },\n            tooltip: trans.__('Cut the selected cells')\n        });\n    }\n    ToolbarItems.createCutButton = createCutButton;\n    /**\n     * Create a copy toolbar item.\n     *\n     * @deprecated since v3.2\n     * This is dead code now.\n     */\n    function createCopyButton(panel, translator) {\n        const trans = (translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__.nullTranslator).load('jupyterlab');\n        return new _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.ToolbarButton({\n            icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.copyIcon,\n            onClick: () => {\n                _actions__WEBPACK_IMPORTED_MODULE_4__.NotebookActions.copy(panel.content);\n            },\n            tooltip: trans.__('Copy the selected cells')\n        });\n    }\n    ToolbarItems.createCopyButton = createCopyButton;\n    /**\n     * Create a paste toolbar item.\n     *\n     * @deprecated since v3.2\n     * This is dead code now.\n     */\n    function createPasteButton(panel, translator) {\n        const trans = (translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__.nullTranslator).load('jupyterlab');\n        return new _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.ToolbarButton({\n            icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.pasteIcon,\n            onClick: () => {\n                _actions__WEBPACK_IMPORTED_MODULE_4__.NotebookActions.paste(panel.content);\n            },\n            tooltip: trans.__('Paste cells from the clipboard')\n        });\n    }\n    ToolbarItems.createPasteButton = createPasteButton;\n    /**\n     * Create a run toolbar item.\n     *\n     * @deprecated since v3.2\n     * This is dead code now.\n     */\n    function createRunButton(panel, sessionDialogs, translator) {\n        const trans = (translator !== null && translator !== void 0 ? translator : _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__.nullTranslator).load('jupyterlab');\n        return new _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.ToolbarButton({\n            icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.runIcon,\n            onClick: () => {\n                void _actions__WEBPACK_IMPORTED_MODULE_4__.NotebookActions.runAndAdvance(panel.content, panel.sessionContext, sessionDialogs, translator);\n            },\n            tooltip: trans.__('Run the selected cells and advance')\n        });\n    }\n    ToolbarItems.createRunButton = createRunButton;\n    /**\n     * Create a restart run all toolbar item\n     *\n     * @deprecated since v3.2\n     * This is dead code now.\n     */\n    function createRestartRunAllButton(panel, dialogs, translator) {\n        const trans = (translator !== null && translator !== void 0 ? translator : _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__.nullTranslator).load('jupyterlab');\n        return new _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.ToolbarButton({\n            icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.fastForwardIcon,\n            onClick: () => {\n                const dialogs_ = dialogs !== null && dialogs !== void 0 ? dialogs : new _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.SessionContextDialogs({ translator });\n                void dialogs_.restart(panel.sessionContext).then(restarted => {\n                    if (restarted) {\n                        void _actions__WEBPACK_IMPORTED_MODULE_4__.NotebookActions.runAll(panel.content, panel.sessionContext, dialogs_, translator);\n                    }\n                    return restarted;\n                });\n            },\n            tooltip: trans.__('Restart the kernel, then re-run the whole notebook')\n        });\n    }\n    ToolbarItems.createRestartRunAllButton = createRestartRunAllButton;\n    /**\n     * Create a cell type switcher item.\n     *\n     * #### Notes\n     * It will display the type of the current active cell.\n     * If more than one cell is selected but are of different types,\n     * it will display `'-'`.\n     * When the user changes the cell type, it will change the\n     * cell types of the selected cells.\n     * It can handle a change to the context.\n     */\n    function createCellTypeItem(panel, translator) {\n        return new CellTypeSwitcher(panel.content, translator);\n    }\n    ToolbarItems.createCellTypeItem = createCellTypeItem;\n    /**\n     * Get the default toolbar items for panel\n     *\n     * @deprecated since v4\n     */\n    function getDefaultItems(panel, sessionDialogs, translator) {\n        return [\n            { name: 'save', widget: createSaveButton(panel, translator) },\n            { name: 'insert', widget: createInsertButton(panel, translator) },\n            { name: 'cut', widget: createCutButton(panel, translator) },\n            { name: 'copy', widget: createCopyButton(panel, translator) },\n            { name: 'paste', widget: createPasteButton(panel, translator) },\n            {\n                name: 'run',\n                widget: createRunButton(panel, sessionDialogs, translator)\n            },\n            {\n                name: 'interrupt',\n                widget: _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Toolbar.createInterruptButton(panel.sessionContext, translator)\n            },\n            {\n                name: 'restart',\n                widget: _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Toolbar.createRestartButton(panel.sessionContext, sessionDialogs, translator)\n            },\n            {\n                name: 'restart-and-run',\n                widget: createRestartRunAllButton(panel, sessionDialogs, translator)\n            },\n            { name: 'cellType', widget: createCellTypeItem(panel, translator) },\n            { name: 'spacer', widget: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.Toolbar.createSpacerItem() },\n            {\n                name: 'kernelName',\n                widget: _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Toolbar.createKernelNameItem(panel.sessionContext, sessionDialogs, translator)\n            }\n        ];\n    }\n    ToolbarItems.getDefaultItems = getDefaultItems;\n})(ToolbarItems || (ToolbarItems = {}));\n/**\n * A toolbar widget that switches cell types.\n */\nclass CellTypeSwitcher extends _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.ReactWidget {\n    /**\n     * Construct a new cell type switcher.\n     */\n    constructor(widget, translator) {\n        super();\n        /**\n         * Handle `change` events for the HTMLSelect component.\n         */\n        this.handleChange = (event) => {\n            if (event.target.value !== '-') {\n                _actions__WEBPACK_IMPORTED_MODULE_4__.NotebookActions.changeCellType(this._notebook, event.target.value);\n                this._notebook.activate();\n            }\n        };\n        /**\n         * Handle `keydown` events for the HTMLSelect component.\n         */\n        this.handleKeyDown = (event) => {\n            if (event.keyCode === 13) {\n                this._notebook.activate();\n            }\n        };\n        this._trans = (translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__.nullTranslator).load('jupyterlab');\n        this.addClass(TOOLBAR_CELLTYPE_CLASS);\n        this._notebook = widget;\n        if (widget.model) {\n            this.update();\n        }\n        widget.activeCellChanged.connect(this.update, this);\n        // Follow a change in the selection.\n        widget.selectionChanged.connect(this.update, this);\n    }\n    render() {\n        let value = '-';\n        if (this._notebook.activeCell) {\n            value = this._notebook.activeCell.model.type;\n        }\n        for (const widget of this._notebook.widgets) {\n            if (this._notebook.isSelectedOrActive(widget)) {\n                if (widget.model.type !== value) {\n                    value = '-';\n                    break;\n                }\n            }\n        }\n        return (react__WEBPACK_IMPORTED_MODULE_3__.createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.HTMLSelect, { className: TOOLBAR_CELLTYPE_DROPDOWN_CLASS, onChange: this.handleChange, onKeyDown: this.handleKeyDown, value: value, \"aria-label\": this._trans.__('Cell type'), title: this._trans.__('Select the cell type') },\n            react__WEBPACK_IMPORTED_MODULE_3__.createElement(\"option\", { value: \"-\" }, \"-\"),\n            react__WEBPACK_IMPORTED_MODULE_3__.createElement(\"option\", { value: \"code\" }, this._trans.__('Code')),\n            react__WEBPACK_IMPORTED_MODULE_3__.createElement(\"option\", { value: \"markdown\" }, this._trans.__('Markdown')),\n            react__WEBPACK_IMPORTED_MODULE_3__.createElement(\"option\", { value: \"raw\" }, this._trans.__('Raw'))));\n    }\n}\n//# sourceMappingURL=default-toolbar.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/default-toolbar.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/executionindicator.js":
/*!**********************************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/executionindicator.js ***!
  \**********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   ExecutionIndicator: () => (/* binding */ ExecutionIndicator),\n/* harmony export */   ExecutionIndicatorComponent: () => (/* binding */ ExecutionIndicatorComponent)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/apputils */ \"webpack/sharing/consume/default/@jupyterlab/apputils/@jupyterlab/apputils\");\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/translation */ \"webpack/sharing/consume/default/@jupyterlab/translation/@jupyterlab/translation\");\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ \"webpack/sharing/consume/default/react/react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _jupyterlab_statusbar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @jupyterlab/statusbar */ \"webpack/sharing/consume/default/@jupyterlab/statusbar/@jupyterlab/statusbar\");\n/* harmony import */ var _jupyterlab_statusbar__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_statusbar__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_4__ = __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_4___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _jupyterlab_services__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @jupyterlab/services */ \"webpack/sharing/consume/default/@jupyterlab/services/@jupyterlab/services\");\n/* harmony import */ var _jupyterlab_services__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_services__WEBPACK_IMPORTED_MODULE_5__);\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n\n\n\n\n\n/**\n * A react functional component for rendering execution indicator.\n */\nfunction ExecutionIndicatorComponent(props) {\n    const translator = props.translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__.nullTranslator;\n    const kernelStatuses = (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.translateKernelStatuses)(translator);\n    const trans = translator.load('jupyterlab');\n    const state = props.state;\n    const showOnToolBar = props.displayOption.showOnToolBar;\n    const showProgress = props.displayOption.showProgress;\n    const tooltipClass = showOnToolBar ? 'down' : 'up';\n    const emptyDiv = react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"div\", null);\n    if (!state) {\n        return emptyDiv;\n    }\n    const kernelStatus = state.kernelStatus;\n    const circleIconProps = {\n        alignSelf: 'normal',\n        height: '24px'\n    };\n    const time = state.totalTime;\n    const scheduledCellNumber = state.scheduledCellNumber || 0;\n    const remainingCellNumber = state.scheduledCell.size || 0;\n    const executedCellNumber = scheduledCellNumber - remainingCellNumber;\n    let percentage = (100 * executedCellNumber) / scheduledCellNumber;\n    let displayClass = showProgress ? '' : 'hidden';\n    if (!showProgress && percentage < 100) {\n        percentage = 0;\n    }\n    const progressBar = (percentage) => (react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_jupyterlab_statusbar__WEBPACK_IMPORTED_MODULE_3__.ProgressCircle, { progress: percentage, width: 16, height: 24, label: trans.__('Kernel status') }));\n    const titleFactory = (translatedStatus) => trans.__('Kernel status: %1', translatedStatus);\n    const reactElement = (status, circle, popup) => (react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"div\", { className: 'jp-Notebook-ExecutionIndicator', title: showProgress ? '' : titleFactory(kernelStatuses[status]), \"data-status\": status },\n        circle,\n        react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"div\", { className: `jp-Notebook-ExecutionIndicator-tooltip ${tooltipClass} ${displayClass}` },\n            react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"span\", null,\n                \" \",\n                titleFactory(kernelStatuses[status]),\n                \" \"),\n            popup)));\n    if (state.kernelStatus === 'connecting' ||\n        state.kernelStatus === 'disconnected' ||\n        state.kernelStatus === 'unknown') {\n        return reactElement(kernelStatus, react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_4__.offlineBoltIcon.react, { ...circleIconProps }), []);\n    }\n    if (state.kernelStatus === 'starting' ||\n        state.kernelStatus === 'terminating' ||\n        state.kernelStatus === 'restarting' ||\n        state.kernelStatus === 'initializing') {\n        return reactElement(kernelStatus, react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_4__.circleIcon.react, { ...circleIconProps }), []);\n    }\n    if (state.executionStatus === 'busy') {\n        return reactElement('busy', progressBar(percentage), [\n            react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"span\", { key: 0 }, trans.__(`Executed ${executedCellNumber}/${scheduledCellNumber} cells`)),\n            react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"span\", { key: 1 }, trans._n('Elapsed time: %1 second', 'Elapsed time: %1 seconds', time))\n        ]);\n    }\n    else {\n        // No cell is scheduled, fall back to the status of kernel\n        const progress = state.kernelStatus === 'busy' ? 0 : 100;\n        const popup = state.kernelStatus === 'busy' || time === 0\n            ? []\n            : [\n                react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"span\", { key: 0 }, trans._n('Executed %1 cell', 'Executed %1 cells', scheduledCellNumber)),\n                react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"span\", { key: 1 }, trans._n('Elapsed time: %1 second', 'Elapsed time: %1 seconds', time))\n            ];\n        return reactElement(state.kernelStatus, progressBar(progress), popup);\n    }\n}\n/**\n * A VDomRenderer widget for displaying the execution status.\n */\nclass ExecutionIndicator extends _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_4__.VDomRenderer {\n    /**\n     * Construct the kernel status widget.\n     */\n    constructor(translator, showProgress = true) {\n        super(new ExecutionIndicator.Model());\n        this.translator = translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__.nullTranslator;\n        this.addClass('jp-mod-highlighted');\n    }\n    /**\n     * Render the execution status item.\n     */\n    render() {\n        if (this.model === null || !this.model.renderFlag) {\n            return react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"div\", null);\n        }\n        else {\n            const nb = this.model.currentNotebook;\n            if (!nb) {\n                return (react__WEBPACK_IMPORTED_MODULE_2___default().createElement(ExecutionIndicatorComponent, { displayOption: this.model.displayOption, state: undefined, translator: this.translator }));\n            }\n            return (react__WEBPACK_IMPORTED_MODULE_2___default().createElement(ExecutionIndicatorComponent, { displayOption: this.model.displayOption, state: this.model.executionState(nb), translator: this.translator }));\n        }\n    }\n}\n/**\n * A namespace for ExecutionIndicator statics.\n */\n(function (ExecutionIndicator) {\n    /**\n     * A VDomModel for the execution status indicator.\n     */\n    class Model extends _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_4__.VDomModel {\n        constructor() {\n            super();\n            /**\n             * A weak map to hold execution status of multiple notebooks.\n             */\n            this._notebookExecutionProgress = new WeakMap();\n            this._displayOption = { showOnToolBar: true, showProgress: true };\n            this._renderFlag = true;\n        }\n        /**\n         * Attach a notebook with session context to model in order to keep\n         * track of multiple notebooks. If a session context is already\n         * attached, only set current activated notebook to input.\n         *\n         * @param data - The  notebook and session context to be attached to model\n         */\n        attachNotebook(data) {\n            var _a, _b, _c, _d;\n            if (data && data.content && data.context) {\n                const nb = data.content;\n                const context = data.context;\n                this._currentNotebook = nb;\n                if (!this._notebookExecutionProgress.has(nb)) {\n                    this._notebookExecutionProgress.set(nb, {\n                        executionStatus: 'idle',\n                        kernelStatus: 'idle',\n                        totalTime: 0,\n                        interval: 0,\n                        timeout: 0,\n                        scheduledCell: new Set(),\n                        scheduledCellNumber: 0,\n                        needReset: true\n                    });\n                    const state = this._notebookExecutionProgress.get(nb);\n                    const contextStatusChanged = (ctx) => {\n                        if (state) {\n                            state.kernelStatus = ctx.kernelDisplayStatus;\n                        }\n                        this.stateChanged.emit(void 0);\n                    };\n                    context.statusChanged.connect(contextStatusChanged, this);\n                    const contextConnectionStatusChanged = (ctx) => {\n                        if (state) {\n                            state.kernelStatus = ctx.kernelDisplayStatus;\n                        }\n                        this.stateChanged.emit(void 0);\n                    };\n                    context.connectionStatusChanged.connect(contextConnectionStatusChanged, this);\n                    context.disposed.connect(ctx => {\n                        ctx.connectionStatusChanged.disconnect(contextConnectionStatusChanged, this);\n                        ctx.statusChanged.disconnect(contextStatusChanged, this);\n                    });\n                    const handleKernelMsg = (sender, msg) => {\n                        const message = msg.msg;\n                        const msgId = message.header.msg_id;\n                        if (message.header.msg_type === 'execute_request') {\n                            // A cell code is scheduled for executing\n                            this._cellScheduledCallback(nb, msgId);\n                        }\n                        else if (_jupyterlab_services__WEBPACK_IMPORTED_MODULE_5__.KernelMessage.isStatusMsg(message) &&\n                            message.content.execution_state === 'idle') {\n                            // Idle status message case.\n                            const parentId = message.parent_header\n                                .msg_id;\n                            this._cellExecutedCallback(nb, parentId);\n                        }\n                        else if (_jupyterlab_services__WEBPACK_IMPORTED_MODULE_5__.KernelMessage.isStatusMsg(message) &&\n                            message.content.execution_state === 'restarting') {\n                            this._restartHandler(nb);\n                        }\n                        else if (message.header.msg_type === 'execute_input') {\n                            // A cell code starts executing.\n                            this._startTimer(nb);\n                        }\n                    };\n                    (_b = (_a = context.session) === null || _a === void 0 ? void 0 : _a.kernel) === null || _b === void 0 ? void 0 : _b.anyMessage.connect(handleKernelMsg);\n                    (_d = (_c = context.session) === null || _c === void 0 ? void 0 : _c.kernel) === null || _d === void 0 ? void 0 : _d.disposed.connect(kernel => kernel.anyMessage.disconnect(handleKernelMsg));\n                    const kernelChangedSlot = (_, kernelData) => {\n                        if (state) {\n                            this._resetTime(state);\n                            this.stateChanged.emit(void 0);\n                            if (kernelData.newValue) {\n                                kernelData.newValue.anyMessage.connect(handleKernelMsg);\n                            }\n                        }\n                    };\n                    context.kernelChanged.connect(kernelChangedSlot);\n                    context.disposed.connect(ctx => ctx.kernelChanged.disconnect(kernelChangedSlot));\n                }\n            }\n        }\n        /**\n         * The current activated notebook in model.\n         */\n        get currentNotebook() {\n            return this._currentNotebook;\n        }\n        /**\n         * The display options for progress bar and elapsed time.\n         */\n        get displayOption() {\n            return this._displayOption;\n        }\n        /**\n         * Set the display options for progress bar and elapsed time.\n         *\n         * @param options - Options to be used\n         */\n        set displayOption(options) {\n            this._displayOption = options;\n        }\n        /**\n         * Get the execution state associated with a notebook.\n         *\n         * @param nb - The notebook used to identify execution\n         * state.\n         *\n         * @returns - The associated execution state.\n         */\n        executionState(nb) {\n            return this._notebookExecutionProgress.get(nb);\n        }\n        /**\n         * Schedule switch to idle status and clearing of the timer.\n         *\n         * ### Note\n         *\n         * To keep track of cells executed under 1 second,\n         * the execution state is marked as `needReset` 1 second after executing\n         * these cells. This `Timeout` will be cleared if there is any cell\n         * scheduled after that.\n         */\n        _scheduleSwitchToIdle(state) {\n            window.setTimeout(() => {\n                state.executionStatus = 'idle';\n                clearInterval(state.interval);\n                this.stateChanged.emit(void 0);\n            }, 150);\n            state.timeout = window.setTimeout(() => {\n                state.needReset = true;\n            }, 1000);\n        }\n        /**\n         * The function is called on kernel's idle status message.\n         * It is used to keep track of number of executed\n         * cells or Comm custom messages and the status of kernel.\n         *\n         * @param nb - The notebook which contains the executed code cell.\n         * @param msg_id - The id of message.\n         */\n        _cellExecutedCallback(nb, msg_id) {\n            const state = this._notebookExecutionProgress.get(nb);\n            if (state && state.scheduledCell.has(msg_id)) {\n                state.scheduledCell.delete(msg_id);\n                if (state.scheduledCell.size === 0) {\n                    this._scheduleSwitchToIdle(state);\n                }\n            }\n        }\n        /**\n         * The function is called on kernel's restarting status message.\n         * It is used to clear the state tracking the number of executed\n         * cells.\n         *\n         * @param nb - The notebook which contains the executed code cell.\n         */\n        _restartHandler(nb) {\n            const state = this._notebookExecutionProgress.get(nb);\n            if (state) {\n                state.scheduledCell.clear();\n                this._scheduleSwitchToIdle(state);\n            }\n        }\n        /**\n         * This function is called on kernel's `execute_input` message to start\n         * the elapsed time counter.\n         *\n         * @param  nb - The notebook which contains the scheduled execution request.\n         */\n        _startTimer(nb) {\n            const state = this._notebookExecutionProgress.get(nb);\n            if (!state) {\n                return;\n            }\n            if (state.scheduledCell.size > 0) {\n                if (state.executionStatus !== 'busy') {\n                    state.executionStatus = 'busy';\n                    clearTimeout(state.timeout);\n                    this.stateChanged.emit(void 0);\n                    state.interval = window.setInterval(() => {\n                        this._tick(state);\n                    }, 1000);\n                }\n            }\n            else {\n                this._resetTime(state);\n            }\n        }\n        /**\n         * The function is called on kernel's `execute_request` message or Comm message, it is\n         * used to keep track number of scheduled cell or Comm execution message\n         * and the status of kernel.\n         *\n         * @param  nb - The notebook which contains the scheduled code.\n         * cell\n         * @param  msg_id - The id of message.\n         */\n        _cellScheduledCallback(nb, msg_id) {\n            const state = this._notebookExecutionProgress.get(nb);\n            if (state && !state.scheduledCell.has(msg_id)) {\n                if (state.needReset) {\n                    this._resetTime(state);\n                }\n                state.scheduledCell.add(msg_id);\n                state.scheduledCellNumber += 1;\n            }\n        }\n        /**\n         * Increment the executed time of input execution state\n         * and emit `stateChanged` signal to re-render the indicator.\n         *\n         * @param  data - the state to be updated.\n         */\n        _tick(data) {\n            data.totalTime += 1;\n            this.stateChanged.emit(void 0);\n        }\n        /**\n         * Reset the input execution state.\n         *\n         * @param  data - the state to be rested.\n         */\n        _resetTime(data) {\n            data.totalTime = 0;\n            data.scheduledCellNumber = 0;\n            data.executionStatus = 'idle';\n            data.scheduledCell = new Set();\n            clearTimeout(data.timeout);\n            clearInterval(data.interval);\n            data.needReset = false;\n        }\n        get renderFlag() {\n            return this._renderFlag;\n        }\n        updateRenderOption(options) {\n            if (this.displayOption.showOnToolBar) {\n                if (!options.showOnToolBar) {\n                    this._renderFlag = false;\n                }\n                else {\n                    this._renderFlag = true;\n                }\n            }\n            this.displayOption.showProgress = options.showProgress;\n            this.stateChanged.emit(void 0);\n        }\n    }\n    ExecutionIndicator.Model = Model;\n    function createExecutionIndicatorItem(panel, translator, loadSettings) {\n        const toolbarItem = new ExecutionIndicator(translator);\n        toolbarItem.model.displayOption = {\n            showOnToolBar: true,\n            showProgress: true\n        };\n        toolbarItem.model.attachNotebook({\n            content: panel.content,\n            context: panel.sessionContext\n        });\n        if (loadSettings) {\n            loadSettings\n                .then(settings => {\n                const updateSettings = (newSettings) => {\n                    toolbarItem.model.updateRenderOption(getSettingValue(newSettings));\n                };\n                settings.changed.connect(updateSettings);\n                updateSettings(settings);\n                toolbarItem.disposed.connect(() => {\n                    settings.changed.disconnect(updateSettings);\n                });\n            })\n                .catch((reason) => {\n                console.error(reason.message);\n            });\n        }\n        return toolbarItem;\n    }\n    ExecutionIndicator.createExecutionIndicatorItem = createExecutionIndicatorItem;\n    function getSettingValue(settings) {\n        let showOnToolBar = true;\n        let showProgress = true;\n        const configValues = settings.get('kernelStatus').composite;\n        if (configValues) {\n            showOnToolBar = !configValues.showOnStatusBar;\n            showProgress = configValues.showProgress;\n        }\n        return { showOnToolBar, showProgress };\n    }\n    ExecutionIndicator.getSettingValue = getSettingValue;\n})(ExecutionIndicator || (ExecutionIndicator = {}));\n//# sourceMappingURL=executionindicator.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/executionindicator.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/history.js":
/*!***********************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/history.js ***!
  \***********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   NotebookHistory: () => (/* binding */ NotebookHistory)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/translation */ \"webpack/sharing/consume/default/@jupyterlab/translation/@jupyterlab/translation\");\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/signaling */ \"webpack/sharing/consume/default/@lumino/signaling/@lumino/signaling\");\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_lumino_signaling__WEBPACK_IMPORTED_MODULE_1__);\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n\n/**\n * A console history manager object.\n */\nclass NotebookHistory {\n    /**\n     * Construct a new console history object.\n     */\n    constructor(options) {\n        /**\n         * The number of history items to increase a batch size by per subsequent request.\n         */\n        this._requestBatchSize = 10;\n        this._cursor = 0;\n        this._hasSession = false;\n        this._history = [];\n        this._placeholder = '';\n        this._kernelSession = '';\n        this._setByHistory = false;\n        this._isDisposed = false;\n        this._editor = null;\n        this._filtered = [];\n        this._kernel = null;\n        this._sessionContext = options.sessionContext;\n        this._trans = (options.translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_0__.nullTranslator).load('jupyterlab');\n        void this._handleKernel().then(() => {\n            this._sessionContext.kernelChanged.connect(this._handleKernel, this);\n        });\n        this._toRequest = this._requestBatchSize;\n    }\n    /**\n     * The current editor used by the history manager.\n     */\n    get editor() {\n        return this._editor;\n    }\n    set editor(value) {\n        if (this._editor === value) {\n            return;\n        }\n        const prev = this._editor;\n        if (prev) {\n            prev.model.sharedModel.changed.disconnect(this.onTextChange, this);\n        }\n        this._editor = value;\n        if (value) {\n            value.model.sharedModel.changed.connect(this.onTextChange, this);\n        }\n    }\n    /**\n     * The placeholder text that a history session began with.\n     */\n    get placeholder() {\n        return this._placeholder;\n    }\n    /**\n     * Kernel session number for filtering\n     */\n    get kernelSession() {\n        return this._kernelSession;\n    }\n    /**\n     * Get whether the notebook history manager is disposed.\n     */\n    get isDisposed() {\n        return this._isDisposed;\n    }\n    /**\n     * Dispose of the resources held by the notebook history manager.\n     */\n    dispose() {\n        this._isDisposed = true;\n        this._history.length = 0;\n        _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__.Signal.clearData(this);\n    }\n    /**\n     * Set placeholder and editor. Start session if one is not already started.\n     *\n     * @param activeCell - The currently selected Cell in the notebook.\n     */\n    async checkSession(activeCell) {\n        var _a;\n        if (!this._hasSession) {\n            await this._retrieveHistory();\n            this._hasSession = true;\n            this.editor = activeCell.editor;\n            this._placeholder = ((_a = this._editor) === null || _a === void 0 ? void 0 : _a.model.sharedModel.getSource()) || '';\n            // Filter the history with the placeholder string.\n            this.setFilter(this._placeholder);\n            this._cursor = this._filtered.length - 1;\n        }\n    }\n    /**\n     * Get the previous item in the notebook history.\n     *\n     * @param activeCell - The currently selected Cell in the notebook.\n     *\n     * @returns A Promise resolving to the historical cell content text.\n     */\n    async back(activeCell) {\n        await this.checkSession(activeCell);\n        --this._cursor;\n        if (this._cursor < 0) {\n            await this.fetchBatch();\n        }\n        this._cursor = Math.max(0, this._cursor);\n        const content = this._filtered[this._cursor];\n        // This shouldn't ever be undefined as `setFilter` will always be run first\n        return content;\n    }\n    /**\n     * Get the next item in the notebook history.\n     *\n     * @param activeCell - The currently selected Cell in the notebook.\n     *\n     * @returns A Promise resolving to the historical cell content text.\n     */\n    async forward(activeCell) {\n        await this.checkSession(activeCell);\n        ++this._cursor;\n        this._cursor = Math.min(this._filtered.length - 1, this._cursor);\n        const content = this._filtered[this._cursor];\n        // This shouldn't ever be undefined as `setFilter` will always be run first\n        return content;\n    }\n    /**\n     * Update the editor of the cell with provided text content.\n     *\n     * @param activeCell - The currently selected Cell in the notebook.\n     * @param content - the result from back or forward\n     */\n    updateEditor(activeCell, content) {\n        var _a, _b;\n        if (activeCell) {\n            const model = (_a = activeCell.editor) === null || _a === void 0 ? void 0 : _a.model;\n            const source = model === null || model === void 0 ? void 0 : model.sharedModel.getSource();\n            if (this.isDisposed || !content) {\n                return;\n            }\n            if (source === content) {\n                return;\n            }\n            this._setByHistory = true;\n            model === null || model === void 0 ? void 0 : model.sharedModel.setSource(content);\n            let columnPos = 0;\n            columnPos = content.indexOf('\\n');\n            if (columnPos < 0) {\n                columnPos = content.length;\n            }\n            (_b = activeCell.editor) === null || _b === void 0 ? void 0 : _b.setCursorPosition({ line: 0, column: columnPos });\n        }\n    }\n    /**\n     * Reset the history navigation state, i.e., start a new history session.\n     */\n    reset() {\n        this._hasSession = false;\n        this._placeholder = '';\n        this._toRequest = this._requestBatchSize;\n    }\n    /**\n     * Fetches a subsequent batch of history. Updates the filtered history and cursor to correct place in history,\n     * accounting for potentially new history items above it.\n     */\n    async fetchBatch() {\n        this._toRequest += this._requestBatchSize;\n        let oldFilteredReversed = this._filtered.slice().reverse();\n        let oldHistory = this._history.slice();\n        await this._retrieveHistory().then(() => {\n            this.setFilter(this._placeholder);\n            let cursorOffset = 0;\n            let filteredReversed = this._filtered.slice().reverse();\n            for (let i = 0; i < oldFilteredReversed.length; i++) {\n                let item = oldFilteredReversed[i];\n                for (let ij = i + cursorOffset; ij < filteredReversed.length; ij++) {\n                    if (item === filteredReversed[ij]) {\n                        break;\n                    }\n                    else {\n                        cursorOffset += 1;\n                    }\n                }\n            }\n            this._cursor =\n                this._filtered.length - (oldFilteredReversed.length + 1) - cursorOffset;\n        });\n        if (this._cursor < 0) {\n            if (this._history.length > oldHistory.length) {\n                await this.fetchBatch();\n            }\n        }\n    }\n    /**\n     * Populate the history collection on history reply from a kernel.\n     *\n     * @param value The kernel message history reply.\n     *\n     * #### Notes\n     * History entries have the shape:\n     * [session: number, line: number, input: string]\n     * Contiguous duplicates are stripped out of the API response.\n     */\n    onHistory(value, cell) {\n        this._history.length = 0;\n        let last = ['', '', ''];\n        let current = ['', '', ''];\n        let kernelSession = '';\n        if (value.content.status === 'ok') {\n            for (let i = 0; i < value.content.history.length; i++) {\n                current = value.content.history[i];\n                if (current !== last) {\n                    kernelSession = value.content.history[i][0];\n                    this._history.push((last = current));\n                }\n            }\n            // set the kernel session for filtering\n            if (!this.kernelSession) {\n                if (current[2] == (cell === null || cell === void 0 ? void 0 : cell.model.sharedModel.getSource())) {\n                    this._kernelSession = kernelSession;\n                }\n            }\n        }\n    }\n    /**\n     * Handle a text change signal from the editor.\n     */\n    onTextChange() {\n        if (this._setByHistory) {\n            this._setByHistory = false;\n            return;\n        }\n        this.reset();\n    }\n    /**\n     * Handle the current kernel changing.\n     */\n    async _handleKernel() {\n        var _a;\n        this._kernel = (_a = this._sessionContext.session) === null || _a === void 0 ? void 0 : _a.kernel;\n        if (!this._kernel) {\n            this._history.length = 0;\n            return;\n        }\n        await this._retrieveHistory().catch();\n        return;\n    }\n    /**\n     * retrieve the history from the kernel\n     *\n     * @param cell - The string to use when filtering the data.\n     */\n    async _retrieveHistory(cell) {\n        var _a;\n        return await ((_a = this._kernel) === null || _a === void 0 ? void 0 : _a.requestHistory(request(this._toRequest)).then(v => {\n            this.onHistory(v, cell);\n        }).catch(() => {\n            console.warn(this._trans.__('History was unable to be retrieved'));\n        }));\n    }\n    /**\n     * Set the filter data.\n     *\n     * @param filterStr - The string to use when filtering the data.\n     */\n    setFilter(filterStr = '') {\n        // Apply the new filter and remove contiguous duplicates.\n        this._filtered.length = 0;\n        let last = '';\n        let current = '';\n        for (let i = 0; i < this._history.length; i++) {\n            current = this._history[i][2];\n            if (current !== last && filterStr !== current) {\n                this._filtered.push((last = current));\n            }\n        }\n        this._filtered.push(filterStr);\n    }\n}\nfunction request(n) {\n    return {\n        output: false,\n        raw: true,\n        hist_access_type: 'tail',\n        n: n\n    };\n}\n//# sourceMappingURL=history.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/history.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/index.js":
/*!*********************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/index.js ***!
  \*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   CellList: () => (/* reexport safe */ _celllist__WEBPACK_IMPORTED_MODULE_2__.CellList),\n/* harmony export */   CellTypeSwitcher: () => (/* reexport safe */ _default_toolbar__WEBPACK_IMPORTED_MODULE_3__.CellTypeSwitcher),\n/* harmony export */   CommandEditStatus: () => (/* reexport safe */ _modestatus__WEBPACK_IMPORTED_MODULE_8__.CommandEditStatus),\n/* harmony export */   ExecutionIndicator: () => (/* reexport safe */ _executionindicator__WEBPACK_IMPORTED_MODULE_4__.ExecutionIndicator),\n/* harmony export */   ExecutionIndicatorComponent: () => (/* reexport safe */ _executionindicator__WEBPACK_IMPORTED_MODULE_4__.ExecutionIndicatorComponent),\n/* harmony export */   INotebookCellExecutor: () => (/* reexport safe */ _tokens__WEBPACK_IMPORTED_MODULE_14__.INotebookCellExecutor),\n/* harmony export */   INotebookTools: () => (/* reexport safe */ _tokens__WEBPACK_IMPORTED_MODULE_14__.INotebookTools),\n/* harmony export */   INotebookTracker: () => (/* reexport safe */ _tokens__WEBPACK_IMPORTED_MODULE_14__.INotebookTracker),\n/* harmony export */   INotebookWidgetFactory: () => (/* reexport safe */ _tokens__WEBPACK_IMPORTED_MODULE_14__.INotebookWidgetFactory),\n/* harmony export */   KernelError: () => (/* reexport safe */ _actions__WEBPACK_IMPORTED_MODULE_0__.KernelError),\n/* harmony export */   Notebook: () => (/* reexport safe */ _widget__WEBPACK_IMPORTED_MODULE_17__.Notebook),\n/* harmony export */   NotebookActions: () => (/* reexport safe */ _actions__WEBPACK_IMPORTED_MODULE_0__.NotebookActions),\n/* harmony export */   NotebookAdapter: () => (/* reexport safe */ _notebooklspadapter__WEBPACK_IMPORTED_MODULE_9__.NotebookAdapter),\n/* harmony export */   NotebookHistory: () => (/* reexport safe */ _history__WEBPACK_IMPORTED_MODULE_5__.NotebookHistory),\n/* harmony export */   NotebookModel: () => (/* reexport safe */ _model__WEBPACK_IMPORTED_MODULE_6__.NotebookModel),\n/* harmony export */   NotebookModelFactory: () => (/* reexport safe */ _modelfactory__WEBPACK_IMPORTED_MODULE_7__.NotebookModelFactory),\n/* harmony export */   NotebookPanel: () => (/* reexport safe */ _panel__WEBPACK_IMPORTED_MODULE_11__.NotebookPanel),\n/* harmony export */   NotebookSearchProvider: () => (/* reexport safe */ _searchprovider__WEBPACK_IMPORTED_MODULE_12__.NotebookSearchProvider),\n/* harmony export */   NotebookToCFactory: () => (/* reexport safe */ _toc__WEBPACK_IMPORTED_MODULE_13__.NotebookToCFactory),\n/* harmony export */   NotebookToCModel: () => (/* reexport safe */ _toc__WEBPACK_IMPORTED_MODULE_13__.NotebookToCModel),\n/* harmony export */   NotebookTools: () => (/* reexport safe */ _notebooktools__WEBPACK_IMPORTED_MODULE_10__.NotebookTools),\n/* harmony export */   NotebookTracker: () => (/* reexport safe */ _tracker__WEBPACK_IMPORTED_MODULE_15__.NotebookTracker),\n/* harmony export */   NotebookTrustStatus: () => (/* reexport safe */ _truststatus__WEBPACK_IMPORTED_MODULE_16__.NotebookTrustStatus),\n/* harmony export */   NotebookViewModel: () => (/* reexport safe */ _windowing__WEBPACK_IMPORTED_MODULE_19__.NotebookViewModel),\n/* harmony export */   NotebookWidgetFactory: () => (/* reexport safe */ _widgetfactory__WEBPACK_IMPORTED_MODULE_18__.NotebookWidgetFactory),\n/* harmony export */   NotebookWindowedLayout: () => (/* reexport safe */ _windowing__WEBPACK_IMPORTED_MODULE_19__.NotebookWindowedLayout),\n/* harmony export */   RunningStatus: () => (/* reexport safe */ _toc__WEBPACK_IMPORTED_MODULE_13__.RunningStatus),\n/* harmony export */   StaticNotebook: () => (/* reexport safe */ _widget__WEBPACK_IMPORTED_MODULE_17__.StaticNotebook),\n/* harmony export */   ToolbarItems: () => (/* reexport safe */ _default_toolbar__WEBPACK_IMPORTED_MODULE_3__.ToolbarItems),\n/* harmony export */   getIdForHeading: () => (/* reexport safe */ _toc__WEBPACK_IMPORTED_MODULE_13__.getIdForHeading),\n/* harmony export */   runCell: () => (/* reexport safe */ _cellexecutor__WEBPACK_IMPORTED_MODULE_1__.runCell),\n/* harmony export */   setCellExecutor: () => (/* reexport safe */ _actions__WEBPACK_IMPORTED_MODULE_0__.setCellExecutor)\n/* harmony export */ });\n/* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./actions */ \"../node_modules/@jupyterlab/notebook/lib/actions.js\");\n/* harmony import */ var _cellexecutor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cellexecutor */ \"../node_modules/@jupyterlab/notebook/lib/cellexecutor.js\");\n/* harmony import */ var _celllist__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./celllist */ \"../node_modules/@jupyterlab/notebook/lib/celllist.js\");\n/* harmony import */ var _default_toolbar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./default-toolbar */ \"../node_modules/@jupyterlab/notebook/lib/default-toolbar.js\");\n/* harmony import */ var _executionindicator__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./executionindicator */ \"../node_modules/@jupyterlab/notebook/lib/executionindicator.js\");\n/* harmony import */ var _history__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./history */ \"../node_modules/@jupyterlab/notebook/lib/history.js\");\n/* harmony import */ var _model__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./model */ \"../node_modules/@jupyterlab/notebook/lib/model.js\");\n/* harmony import */ var _modelfactory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./modelfactory */ \"../node_modules/@jupyterlab/notebook/lib/modelfactory.js\");\n/* harmony import */ var _modestatus__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./modestatus */ \"../node_modules/@jupyterlab/notebook/lib/modestatus.js\");\n/* harmony import */ var _notebooklspadapter__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./notebooklspadapter */ \"../node_modules/@jupyterlab/notebook/lib/notebooklspadapter.js\");\n/* harmony import */ var _notebooktools__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./notebooktools */ \"../node_modules/@jupyterlab/notebook/lib/notebooktools.js\");\n/* harmony import */ var _panel__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./panel */ \"../node_modules/@jupyterlab/notebook/lib/panel.js\");\n/* harmony import */ var _searchprovider__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./searchprovider */ \"../node_modules/@jupyterlab/notebook/lib/searchprovider.js\");\n/* harmony import */ var _toc__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./toc */ \"../node_modules/@jupyterlab/notebook/lib/toc.js\");\n/* harmony import */ var _tokens__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./tokens */ \"../node_modules/@jupyterlab/notebook/lib/tokens.js\");\n/* harmony import */ var _tracker__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./tracker */ \"../node_modules/@jupyterlab/notebook/lib/tracker.js\");\n/* harmony import */ var _truststatus__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./truststatus */ \"../node_modules/@jupyterlab/notebook/lib/truststatus.js\");\n/* harmony import */ var _widget__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./widget */ \"../node_modules/@jupyterlab/notebook/lib/widget.js\");\n/* harmony import */ var _widgetfactory__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./widgetfactory */ \"../node_modules/@jupyterlab/notebook/lib/widgetfactory.js\");\n/* harmony import */ var _windowing__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./windowing */ \"../node_modules/@jupyterlab/notebook/lib/windowing.js\");\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * @packageDocumentation\n * @module notebook\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/index.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/model.js":
/*!*********************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/model.js ***!
  \*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   NotebookModel: () => (/* binding */ NotebookModel)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/apputils */ \"webpack/sharing/consume/default/@jupyterlab/apputils/@jupyterlab/apputils\");\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_nbformat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/nbformat */ \"webpack/sharing/consume/default/@jupyterlab/nbformat/@jupyterlab/nbformat\");\n/* harmony import */ var _jupyterlab_nbformat__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_nbformat__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _jupyter_ydoc__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyter/ydoc */ \"webpack/sharing/consume/default/@jupyter/ydoc/@jupyter/ydoc\");\n/* harmony import */ var _jupyter_ydoc__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_jupyter_ydoc__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @jupyterlab/translation */ \"webpack/sharing/consume/default/@jupyterlab/translation/@jupyterlab/translation\");\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lumino/coreutils */ \"webpack/sharing/consume/default/@lumino/coreutils/@lumino/coreutils\");\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @lumino/signaling */ \"webpack/sharing/consume/default/@lumino/signaling/@lumino/signaling\");\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_lumino_signaling__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _celllist__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./celllist */ \"../node_modules/@jupyterlab/notebook/lib/celllist.js\");\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 * An implementation of a notebook Model.\n */\nclass NotebookModel {\n    /**\n     * Construct a new notebook model.\n     */\n    constructor(options = {}) {\n        var _a, _b;\n        /**\n         * Whether the model should disposed the shared model on disposal or not.\n         */\n        this.standaloneModel = false;\n        this._dirty = false;\n        this._readOnly = false;\n        this._contentChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_5__.Signal(this);\n        this._stateChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_5__.Signal(this);\n        this._isDisposed = false;\n        this._metadataChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_5__.Signal(this);\n        this.standaloneModel = typeof options.sharedModel === 'undefined';\n        if (options.sharedModel) {\n            this.sharedModel = options.sharedModel;\n        }\n        else {\n            this.sharedModel = _jupyter_ydoc__WEBPACK_IMPORTED_MODULE_2__.YNotebook.create({\n                disableDocumentWideUndoRedo: (_a = options.disableDocumentWideUndoRedo) !== null && _a !== void 0 ? _a : true,\n                data: {\n                    nbformat: _jupyterlab_nbformat__WEBPACK_IMPORTED_MODULE_1__.MAJOR_VERSION,\n                    nbformat_minor: _jupyterlab_nbformat__WEBPACK_IMPORTED_MODULE_1__.MINOR_VERSION,\n                    metadata: {\n                        kernelspec: { name: '', display_name: '' },\n                        language_info: { name: (_b = options.languagePreference) !== null && _b !== void 0 ? _b : '' }\n                    }\n                }\n            });\n        }\n        this._cells = new _celllist__WEBPACK_IMPORTED_MODULE_6__.CellList(this.sharedModel);\n        this._trans = (options.translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3__.nullTranslator).load('jupyterlab');\n        this._deletedCells = [];\n        this._collaborationEnabled = !!(options === null || options === void 0 ? void 0 : options.collaborationEnabled);\n        this._cells.changed.connect(this._onCellsChanged, this);\n        this.sharedModel.changed.connect(this._onStateChanged, this);\n        this.sharedModel.metadataChanged.connect(this._onMetadataChanged, this);\n    }\n    /**\n     * A signal emitted when the document content changes.\n     */\n    get contentChanged() {\n        return this._contentChanged;\n    }\n    /**\n     * Signal emitted when notebook metadata changes.\n     */\n    get metadataChanged() {\n        return this._metadataChanged;\n    }\n    /**\n     * A signal emitted when the document state changes.\n     */\n    get stateChanged() {\n        return this._stateChanged;\n    }\n    /**\n     * Get the observable list of notebook cells.\n     */\n    get cells() {\n        return this._cells;\n    }\n    /**\n     * The dirty state of the document.\n     */\n    get dirty() {\n        return this._dirty;\n    }\n    set dirty(newValue) {\n        const oldValue = this._dirty;\n        if (newValue === oldValue) {\n            return;\n        }\n        this._dirty = newValue;\n        this.triggerStateChange({\n            name: 'dirty',\n            oldValue,\n            newValue\n        });\n    }\n    /**\n     * The read only state of the document.\n     */\n    get readOnly() {\n        return this._readOnly;\n    }\n    set readOnly(newValue) {\n        if (newValue === this._readOnly) {\n            return;\n        }\n        const oldValue = this._readOnly;\n        this._readOnly = newValue;\n        this.triggerStateChange({ name: 'readOnly', oldValue, newValue });\n    }\n    /**\n     * The metadata associated with the notebook.\n     *\n     * ### Notes\n     * This is a copy of the metadata. Changing a part of it\n     * won't affect the model.\n     * As this returns a copy of all metadata, it is advised to\n     * use `getMetadata` to speed up the process of getting a single key.\n     */\n    get metadata() {\n        return this.sharedModel.metadata;\n    }\n    /**\n     * The major version number of the nbformat.\n     */\n    get nbformat() {\n        return this.sharedModel.nbformat;\n    }\n    /**\n     * The minor version number of the nbformat.\n     */\n    get nbformatMinor() {\n        return this.sharedModel.nbformat_minor;\n    }\n    /**\n     * The default kernel name of the document.\n     */\n    get defaultKernelName() {\n        var _a;\n        const spec = this.getMetadata('kernelspec');\n        return (_a = spec === null || spec === void 0 ? void 0 : spec.name) !== null && _a !== void 0 ? _a : '';\n    }\n    /**\n     * A list of deleted cells for the notebook..\n     */\n    get deletedCells() {\n        return this._deletedCells;\n    }\n    /**\n     * The default kernel language of the document.\n     */\n    get defaultKernelLanguage() {\n        var _a;\n        const info = this.getMetadata('language_info');\n        return (_a = info === null || info === void 0 ? void 0 : info.name) !== null && _a !== void 0 ? _a : '';\n    }\n    /**\n     * Whether the model is collaborative or not.\n     */\n    get collaborative() {\n        return this._collaborationEnabled;\n    }\n    /**\n     * Dispose of the resources held by the model.\n     */\n    dispose() {\n        // Do nothing if already disposed.\n        if (this.isDisposed) {\n            return;\n        }\n        this._isDisposed = true;\n        const cells = this.cells;\n        this._cells = null;\n        cells.dispose();\n        if (this.standaloneModel) {\n            this.sharedModel.dispose();\n        }\n        _lumino_signaling__WEBPACK_IMPORTED_MODULE_5__.Signal.clearData(this);\n    }\n    /**\n     * Delete a metadata\n     *\n     * @param key Metadata key\n     */\n    deleteMetadata(key) {\n        return this.sharedModel.deleteMetadata(key);\n    }\n    /**\n     * Get a metadata\n     *\n     * ### Notes\n     * This returns a copy of the key value.\n     *\n     * @param key Metadata key\n     */\n    getMetadata(key) {\n        return this.sharedModel.getMetadata(key);\n    }\n    /**\n     * Set a metadata\n     *\n     * @param key Metadata key\n     * @param value Metadata value\n     */\n    setMetadata(key, value) {\n        if (typeof value === 'undefined') {\n            this.sharedModel.deleteMetadata(key);\n        }\n        else {\n            this.sharedModel.setMetadata(key, value);\n        }\n    }\n    /**\n     * Serialize the model to a string.\n     */\n    toString() {\n        return JSON.stringify(this.toJSON());\n    }\n    /**\n     * Deserialize the model from a string.\n     *\n     * #### Notes\n     * Should emit a [contentChanged] signal.\n     */\n    fromString(value) {\n        this.fromJSON(JSON.parse(value));\n    }\n    /**\n     * Serialize the model to JSON.\n     */\n    toJSON() {\n        this._ensureMetadata();\n        return this.sharedModel.toJSON();\n    }\n    /**\n     * Deserialize the model from JSON.\n     *\n     * #### Notes\n     * Should emit a [contentChanged] signal.\n     */\n    fromJSON(value) {\n        var _a, _b;\n        const copy = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_4__.JSONExt.deepCopy(value);\n        const origNbformat = value.metadata.orig_nbformat;\n        // Alert the user if the format changes.\n        copy.nbformat = Math.max(value.nbformat, _jupyterlab_nbformat__WEBPACK_IMPORTED_MODULE_1__.MAJOR_VERSION);\n        if (copy.nbformat !== value.nbformat ||\n            copy.nbformat_minor < _jupyterlab_nbformat__WEBPACK_IMPORTED_MODULE_1__.MINOR_VERSION) {\n            copy.nbformat_minor = _jupyterlab_nbformat__WEBPACK_IMPORTED_MODULE_1__.MINOR_VERSION;\n        }\n        if (origNbformat !== undefined && copy.nbformat !== origNbformat) {\n            const newer = copy.nbformat > origNbformat;\n            let msg;\n            if (newer) {\n                msg = this._trans.__(`This notebook has been converted from an older notebook format (v%1)\nto the current notebook format (v%2).\nThe next time you save this notebook, the current notebook format (v%2) will be used.\n'Older versions of Jupyter may not be able to read the new format.' To preserve the original format version,\nclose the notebook without saving it.`, origNbformat, copy.nbformat);\n            }\n            else {\n                msg = this._trans.__(`This notebook has been converted from an newer notebook format (v%1)\nto the current notebook format (v%2).\nThe next time you save this notebook, the current notebook format (v%2) will be used.\nSome features of the original notebook may not be available.' To preserve the original format version,\nclose the notebook without saving it.`, origNbformat, copy.nbformat);\n            }\n            void (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.showDialog)({\n                title: this._trans.__('Notebook converted'),\n                body: msg,\n                buttons: [_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Dialog.okButton({ label: this._trans.__('Ok') })]\n            });\n        }\n        // Ensure there is at least one cell\n        if (((_b = (_a = copy.cells) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) === 0) {\n            copy['cells'] = [\n                { cell_type: 'code', source: '', metadata: { trusted: true } }\n            ];\n        }\n        this.sharedModel.fromJSON(copy);\n        this._ensureMetadata();\n        this.dirty = true;\n    }\n    /**\n     * Handle a change in the cells list.\n     */\n    _onCellsChanged(list, change) {\n        switch (change.type) {\n            case 'add':\n                change.newValues.forEach(cell => {\n                    cell.contentChanged.connect(this.triggerContentChange, this);\n                });\n                break;\n            case 'remove':\n                break;\n            case 'set':\n                change.newValues.forEach(cell => {\n                    cell.contentChanged.connect(this.triggerContentChange, this);\n                });\n                break;\n            default:\n                break;\n        }\n        this.triggerContentChange();\n    }\n    _onMetadataChanged(sender, changes) {\n        this._metadataChanged.emit(changes);\n        this.triggerContentChange();\n    }\n    _onStateChanged(sender, changes) {\n        if (changes.stateChange) {\n            changes.stateChange.forEach(value => {\n                if (value.name === 'dirty') {\n                    // Setting `dirty` will trigger the state change.\n                    // We always set `dirty` because the shared model state\n                    // and the local attribute are synchronized one way shared model -> _dirty\n                    this.dirty = value.newValue;\n                }\n                else if (value.oldValue !== value.newValue) {\n                    this.triggerStateChange({\n                        newValue: undefined,\n                        oldValue: undefined,\n                        ...value\n                    });\n                }\n            });\n        }\n    }\n    /**\n     * Make sure we have the required metadata fields.\n     */\n    _ensureMetadata(languageName = '') {\n        if (!this.getMetadata('language_info')) {\n            this.sharedModel.setMetadata('language_info', { name: languageName });\n        }\n        if (!this.getMetadata('kernelspec')) {\n            this.sharedModel.setMetadata('kernelspec', {\n                name: '',\n                display_name: ''\n            });\n        }\n    }\n    /**\n     * Trigger a state change signal.\n     */\n    triggerStateChange(args) {\n        this._stateChanged.emit(args);\n    }\n    /**\n     * Trigger a content changed signal.\n     */\n    triggerContentChange() {\n        this._contentChanged.emit(void 0);\n        this.dirty = true;\n    }\n    /**\n     * Whether the model is disposed.\n     */\n    get isDisposed() {\n        return this._isDisposed;\n    }\n}\n//# sourceMappingURL=model.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/model.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/modelfactory.js":
/*!****************************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/modelfactory.js ***!
  \****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   NotebookModelFactory: () => (/* binding */ NotebookModelFactory)\n/* harmony export */ });\n/* harmony import */ var _model__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./model */ \"../node_modules/@jupyterlab/notebook/lib/model.js\");\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n/**\n * A model factory for notebooks.\n */\nclass NotebookModelFactory {\n    /**\n     * Construct a new notebook model factory.\n     */\n    constructor(options = {}) {\n        var _a, _b;\n        this._disposed = false;\n        this._disableDocumentWideUndoRedo =\n            (_a = options.disableDocumentWideUndoRedo) !== null && _a !== void 0 ? _a : true;\n        this._collaborative = (_b = options.collaborative) !== null && _b !== void 0 ? _b : true;\n    }\n    /**\n     * Define the disableDocumentWideUndoRedo property.\n     *\n     * @experimental\n     * @alpha\n     */\n    get disableDocumentWideUndoRedo() {\n        return this._disableDocumentWideUndoRedo;\n    }\n    set disableDocumentWideUndoRedo(disableDocumentWideUndoRedo) {\n        this._disableDocumentWideUndoRedo = disableDocumentWideUndoRedo;\n    }\n    /**\n     * The name of the model.\n     */\n    get name() {\n        return 'notebook';\n    }\n    /**\n     * The content type of the file.\n     */\n    get contentType() {\n        return 'notebook';\n    }\n    /**\n     * The format of the file.\n     */\n    get fileFormat() {\n        return 'json';\n    }\n    /**\n     * Whether the model is collaborative or not.\n     */\n    get collaborative() {\n        return this._collaborative;\n    }\n    /**\n     * Get whether the model factory has been disposed.\n     */\n    get isDisposed() {\n        return this._disposed;\n    }\n    /**\n     * Dispose of the model factory.\n     */\n    dispose() {\n        this._disposed = true;\n    }\n    /**\n     * Create a new model for a given path.\n     *\n     * @param options Model options.\n     *\n     * @returns A new document model.\n     */\n    createNew(options = {}) {\n        return new _model__WEBPACK_IMPORTED_MODULE_0__.NotebookModel({\n            languagePreference: options.languagePreference,\n            sharedModel: options.sharedModel,\n            collaborationEnabled: options.collaborationEnabled && this.collaborative,\n            disableDocumentWideUndoRedo: this._disableDocumentWideUndoRedo\n        });\n    }\n    /**\n     * Get the preferred kernel language given a path.\n     */\n    preferredLanguage(path) {\n        return '';\n    }\n}\n//# sourceMappingURL=modelfactory.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/modelfactory.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/modestatus.js":
/*!**************************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/modestatus.js ***!
  \**************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   CommandEditStatus: () => (/* binding */ CommandEditStatus)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_statusbar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/statusbar */ \"webpack/sharing/consume/default/@jupyterlab/statusbar/@jupyterlab/statusbar\");\n/* harmony import */ var _jupyterlab_statusbar__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_statusbar__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/translation */ \"webpack/sharing/consume/default/@jupyterlab/translation/@jupyterlab/translation\");\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__ = __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_2___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ \"webpack/sharing/consume/default/react/react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);\n/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\n\n\n\n/**\n * A pure function for rendering a Command/Edit mode component.\n *\n * @param props the props for rendering the component.\n *\n * @returns a tsx component for command/edit mode.\n */\nfunction CommandEditComponent(props) {\n    const trans = (props.translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__.nullTranslator).load('jupyterlab');\n    return (react__WEBPACK_IMPORTED_MODULE_3__.createElement(_jupyterlab_statusbar__WEBPACK_IMPORTED_MODULE_0__.TextItem, { source: trans.__('Mode: %1', props.modeNames[props.notebookMode]) }));\n}\n/**\n * StatusBar item to display which notebook mode user is in.\n */\nclass CommandEditStatus extends _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.VDomRenderer {\n    /**\n     * Construct a new CommandEdit status item.\n     */\n    constructor(translator) {\n        super(new CommandEditStatus.Model());\n        this.translator = translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__.nullTranslator;\n        this._trans = this.translator.load('jupyterlab');\n        this._modeNames = {\n            command: this._trans.__('Command'),\n            edit: this._trans.__('Edit')\n        };\n    }\n    /**\n     * Render the CommandEdit status item.\n     */\n    render() {\n        if (!this.model) {\n            return null;\n        }\n        this.node.title = this._trans.__('Notebook is in %1 mode', this._modeNames[this.model.notebookMode]);\n        return (react__WEBPACK_IMPORTED_MODULE_3__.createElement(CommandEditComponent, { notebookMode: this.model.notebookMode, translator: this.translator, modeNames: this._modeNames }));\n    }\n}\n/**\n * A namespace for CommandEdit statics.\n */\n(function (CommandEditStatus) {\n    /**\n     * A VDomModel for the CommandEdit renderer.\n     */\n    class Model extends _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.VDomModel {\n        constructor() {\n            super(...arguments);\n            /**\n             * On a change to the notebook, update the mode.\n             */\n            this._onChanged = (_notebook) => {\n                const oldMode = this._notebookMode;\n                if (this._notebook) {\n                    this._notebookMode = _notebook.mode;\n                }\n                else {\n                    this._notebookMode = 'command';\n                }\n                this._triggerChange(oldMode, this._notebookMode);\n            };\n            this._notebookMode = 'command';\n            this._notebook = null;\n        }\n        /**\n         * The current mode of the current notebook.\n         */\n        get notebookMode() {\n            return this._notebookMode;\n        }\n        /**\n         * Set the current notebook for the model.\n         */\n        set notebook(notebook) {\n            const oldNotebook = this._notebook;\n            if (oldNotebook !== null) {\n                oldNotebook.stateChanged.disconnect(this._onChanged, this);\n                oldNotebook.activeCellChanged.disconnect(this._onChanged, this);\n                oldNotebook.modelContentChanged.disconnect(this._onChanged, this);\n            }\n            const oldMode = this._notebookMode;\n            this._notebook = notebook;\n            if (this._notebook === null) {\n                this._notebookMode = 'command';\n            }\n            else {\n                this._notebookMode = this._notebook.mode;\n                this._notebook.stateChanged.connect(this._onChanged, this);\n                this._notebook.activeCellChanged.connect(this._onChanged, this);\n                this._notebook.modelContentChanged.connect(this._onChanged, this);\n            }\n            this._triggerChange(oldMode, this._notebookMode);\n        }\n        /**\n         * Trigger a state change for the renderer.\n         */\n        _triggerChange(oldState, newState) {\n            if (oldState !== newState) {\n                this.stateChanged.emit(void 0);\n            }\n        }\n    }\n    CommandEditStatus.Model = Model;\n})(CommandEditStatus || (CommandEditStatus = {}));\n//# sourceMappingURL=modestatus.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/modestatus.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/notebookfooter.js":
/*!******************************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/notebookfooter.js ***!
  \******************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   NotebookFooter: () => (/* binding */ NotebookFooter)\n/* harmony export */ });\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/widgets */ \"webpack/sharing/consume/default/@lumino/widgets/@lumino/widgets\");\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_lumino_widgets__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./actions */ \"../node_modules/@jupyterlab/notebook/lib/actions.js\");\n/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\n\nconst NOTEBOOK_FOOTER_CLASS = 'jp-Notebook-footer';\n/**\n * A footer widget added after the last cell of the notebook.\n */\nclass NotebookFooter extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_0__.Widget {\n    /**\n     * Construct a footer widget.\n     */\n    constructor(notebook) {\n        super({ node: document.createElement('button') });\n        this.notebook = notebook;\n        const trans = notebook.translator.load('jupyterlab');\n        this.addClass(NOTEBOOK_FOOTER_CLASS);\n        this.node.setAttribute('tabindex', '-1');\n        this.node.innerText = trans.__('Click to add a cell.');\n    }\n    /**\n     * Handle incoming events.\n     */\n    handleEvent(event) {\n        switch (event.type) {\n            case 'click':\n                this.onClick();\n                break;\n            case 'keydown':\n                if (event.key === 'ArrowUp') {\n                    this.onArrowUp();\n                    break;\n                }\n        }\n    }\n    /**\n     * On single click (mouse event), insert a cell below (at the end of the notebook as default behavior).\n     */\n    onClick() {\n        if (this.notebook.widgets.length > 0) {\n            this.notebook.activeCellIndex = this.notebook.widgets.length - 1;\n        }\n        _actions__WEBPACK_IMPORTED_MODULE_1__.NotebookActions.insertBelow(this.notebook);\n        // Focus on the created cell.\n        void _actions__WEBPACK_IMPORTED_MODULE_1__.NotebookActions.focusActiveCell(this.notebook);\n    }\n    /**\n     * On arrow up key pressed (keydown keyboard event).\n     * @deprecated To be removed in v5, this is a no-op\n     */\n    onArrowUp() {\n        // The specific behavior has been removed in https://github.com/jupyterlab/jupyterlab/pull/14796\n    }\n    /*\n     * Handle `after-detach` messages for the widget.\n     */\n    onAfterAttach(msg) {\n        super.onAfterAttach(msg);\n        this.node.addEventListener('click', this);\n        this.node.addEventListener('keydown', this);\n    }\n    /**\n     * Handle `before-detach` messages for the widget.\n     */\n    onBeforeDetach(msg) {\n        this.node.removeEventListener('click', this);\n        this.node.removeEventListener('keydown', this);\n        super.onBeforeDetach(msg);\n    }\n}\n//# sourceMappingURL=notebookfooter.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/notebookfooter.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/notebooklspadapter.js":
/*!**********************************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/notebooklspadapter.js ***!
  \**********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   NotebookAdapter: () => (/* binding */ NotebookAdapter)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_codeeditor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/codeeditor */ \"webpack/sharing/consume/default/@jupyterlab/codeeditor/@jupyterlab/codeeditor\");\n/* harmony import */ var _jupyterlab_codeeditor__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_codeeditor__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/lsp */ \"webpack/sharing/consume/default/@jupyterlab/lsp/@jupyterlab/lsp\");\n/* harmony import */ var _jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/coreutils */ \"webpack/sharing/consume/default/@lumino/coreutils/@lumino/coreutils\");\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lumino/signaling */ \"webpack/sharing/consume/default/@lumino/signaling/@lumino/signaling\");\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_lumino_signaling__WEBPACK_IMPORTED_MODULE_3__);\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n\n\n\nclass NotebookAdapter extends _jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_1__.WidgetLSPAdapter {\n    constructor(editorWidget, options) {\n        super(editorWidget, options);\n        this.editorWidget = editorWidget;\n        this.options = options;\n        this._type = 'code';\n        this._readyDelegate = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_2__.PromiseDelegate();\n        this._editorToCell = new Map();\n        this.editor = editorWidget.content;\n        this._cellToEditor = new WeakMap();\n        Promise.all([\n            this.widget.context.sessionContext.ready,\n            this.connectionManager.ready\n        ])\n            .then(async () => {\n            await this.initOnceReady();\n            this._readyDelegate.resolve();\n        })\n            .catch(console.error);\n    }\n    /**\n     * Get current path of the document.\n     */\n    get documentPath() {\n        return this.widget.context.path;\n    }\n    /**\n     * Get the mime type of the document.\n     */\n    get mimeType() {\n        var _a;\n        let mimeType;\n        let languageMetadata = this.language_info();\n        if (!languageMetadata || !languageMetadata.mimetype) {\n            // fallback to the code cell mime type if no kernel in use\n            mimeType = this.widget.content.codeMimetype;\n        }\n        else {\n            mimeType = languageMetadata.mimetype;\n        }\n        return Array.isArray(mimeType)\n            ? (_a = mimeType[0]) !== null && _a !== void 0 ? _a : _jupyterlab_codeeditor__WEBPACK_IMPORTED_MODULE_0__.IEditorMimeTypeService.defaultMimeType\n            : mimeType;\n    }\n    /**\n     * Get the file extension of the document.\n     */\n    get languageFileExtension() {\n        let languageMetadata = this.language_info();\n        if (!languageMetadata || !languageMetadata.file_extension) {\n            return;\n        }\n        return languageMetadata.file_extension.replace('.', '');\n    }\n    /**\n     * Get the inner HTMLElement of the document widget.\n     */\n    get wrapperElement() {\n        return this.widget.node;\n    }\n    /**\n     *  Get the list of CM editor with its type in the document,\n     */\n    get editors() {\n        if (this.isDisposed) {\n            return [];\n        }\n        let notebook = this.widget.content;\n        this._editorToCell.clear();\n        if (notebook.isDisposed) {\n            return [];\n        }\n        return notebook.widgets.map(cell => {\n            return {\n                ceEditor: this._getCellEditor(cell),\n                type: cell.model.type,\n                value: cell.model.sharedModel.getSource()\n            };\n        });\n    }\n    /**\n     * Get the activated CM editor.\n     */\n    get activeEditor() {\n        return this.editor.activeCell\n            ? this._getCellEditor(this.editor.activeCell)\n            : undefined;\n    }\n    /**\n     * Promise that resolves once the adapter is initialized\n     */\n    get ready() {\n        return this._readyDelegate.promise;\n    }\n    /**\n     * Get the index of editor from the cursor position in the virtual\n     * document.\n     * @deprecated This is error-prone and will be removed in JupyterLab 5.0, use `getEditorIndex()` with `virtualDocument.getEditorAtVirtualLine(position)` instead.\n     *\n     * @param position - the position of cursor in the virtual document.\n     */\n    getEditorIndexAt(position) {\n        let cell = this._getCellAt(position);\n        let notebook = this.widget.content;\n        return notebook.widgets.findIndex(otherCell => {\n            return cell === otherCell;\n        });\n    }\n    /**\n     * Get the index of input editor\n     *\n     * @param ceEditor - instance of the code editor\n     */\n    getEditorIndex(ceEditor) {\n        let cell = this._editorToCell.get(ceEditor);\n        return this.editor.widgets.findIndex(otherCell => {\n            return cell === otherCell;\n        });\n    }\n    /**\n     * Get the wrapper of input editor.\n     *\n     * @param ceEditor - instance of the code editor\n     */\n    getEditorWrapper(ceEditor) {\n        let cell = this._editorToCell.get(ceEditor);\n        return cell.node;\n    }\n    /**\n     * Callback on kernel changed event, it will disconnect the\n     * document with the language server and then reconnect.\n     *\n     * @param _session - Session context of changed kernel\n     * @param change - Changed data\n     */\n    async onKernelChanged(_session, change) {\n        if (!change.newValue) {\n            return;\n        }\n        try {\n            // note: we need to wait until ready before updating language info\n            const oldLanguageInfo = this._languageInfo;\n            await (0,_jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_1__.untilReady)(this.isReady, -1);\n            await this._updateLanguageInfo();\n            const newLanguageInfo = this._languageInfo;\n            if ((oldLanguageInfo === null || oldLanguageInfo === void 0 ? void 0 : oldLanguageInfo.name) != newLanguageInfo.name ||\n                (oldLanguageInfo === null || oldLanguageInfo === void 0 ? void 0 : oldLanguageInfo.mimetype) != (newLanguageInfo === null || newLanguageInfo === void 0 ? void 0 : newLanguageInfo.mimetype) ||\n                (oldLanguageInfo === null || oldLanguageInfo === void 0 ? void 0 : oldLanguageInfo.file_extension) != (newLanguageInfo === null || newLanguageInfo === void 0 ? void 0 : newLanguageInfo.file_extension)) {\n                console.log(`Changed to ${this._languageInfo.name} kernel, reconnecting`);\n                this.reloadConnection();\n            }\n            else {\n                console.log('Keeping old LSP connection as the new kernel uses the same langauge');\n            }\n        }\n        catch (err) {\n            console.warn(err);\n            // try to reconnect anyway\n            this.reloadConnection();\n        }\n    }\n    /**\n     * Dispose the widget.\n     */\n    dispose() {\n        if (this.isDisposed) {\n            return;\n        }\n        this.widget.context.sessionContext.kernelChanged.disconnect(this.onKernelChanged, this);\n        this.widget.content.activeCellChanged.disconnect(this._activeCellChanged, this);\n        super.dispose();\n        // editors are needed for the parent dispose() to unbind signals, so they are the last to go\n        this._editorToCell.clear();\n        _lumino_signaling__WEBPACK_IMPORTED_MODULE_3__.Signal.clearData(this);\n    }\n    /**\n     * Method to check if the notebook context is ready.\n     */\n    isReady() {\n        var _a;\n        return (!this.widget.isDisposed &&\n            this.widget.context.isReady &&\n            this.widget.content.isVisible &&\n            this.widget.content.widgets.length > 0 &&\n            ((_a = this.widget.context.sessionContext.session) === null || _a === void 0 ? void 0 : _a.kernel) != null);\n    }\n    /**\n     * Update the virtual document on cell changing event.\n     *\n     * @param cells - Observable list of changed cells\n     * @param change - Changed data\n     */\n    async handleCellChange(cells, change) {\n        let cellsAdded = [];\n        let cellsRemoved = [];\n        const type = this._type;\n        if (change.type === 'set') {\n            // handling of conversions is important, because the editors get re-used and their handlers inherited,\n            // so we need to clear our handlers from editors of e.g. markdown cells which previously were code cells.\n            let convertedToMarkdownOrRaw = [];\n            let convertedToCode = [];\n            if (change.newValues.length === change.oldValues.length) {\n                // during conversion the cells should not get deleted nor added\n                for (let i = 0; i < change.newValues.length; i++) {\n                    if (change.oldValues[i].type === type &&\n                        change.newValues[i].type !== type) {\n                        convertedToMarkdownOrRaw.push(change.newValues[i]);\n                    }\n                    else if (change.oldValues[i].type !== type &&\n                        change.newValues[i].type === type) {\n                        convertedToCode.push(change.newValues[i]);\n                    }\n                }\n                cellsAdded = convertedToCode;\n                cellsRemoved = convertedToMarkdownOrRaw;\n            }\n        }\n        else if (change.type == 'add') {\n            cellsAdded = change.newValues.filter(cellModel => cellModel.type === type);\n        }\n        // note: editorRemoved is not emitted for removal of cells by change of type 'remove' (but only during cell type conversion)\n        // because there is no easy way to get the widget associated with the removed cell(s) - because it is no\n        // longer in the notebook widget list! It would need to be tracked on our side, but it is not necessary\n        // as (except for a tiny memory leak) it should not impact the functionality in any way\n        if (cellsRemoved.length ||\n            cellsAdded.length ||\n            change.type === 'set' ||\n            change.type === 'move' ||\n            change.type === 'remove') {\n            // in contrast to the file editor document which can be only changed by the modification of the editor content,\n            // the notebook document cna also get modified by a change in the number or arrangement of editors themselves;\n            // for this reason each change has to trigger documents update (so that LSP mirror is in sync).\n            await this.updateDocuments();\n        }\n        for (let cellModel of cellsAdded) {\n            let cellWidget = this.widget.content.widgets.find(cell => cell.model.id === cellModel.id);\n            if (!cellWidget) {\n                console.warn(`Widget for added cell with ID: ${cellModel.id} not found!`);\n                continue;\n            }\n            // Add editor to the mapping if needed\n            this._getCellEditor(cellWidget);\n        }\n    }\n    /**\n     * Generate the virtual document associated with the document.\n     */\n    createVirtualDocument() {\n        return new _jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_1__.VirtualDocument({\n            language: this.language,\n            foreignCodeExtractors: this.options.foreignCodeExtractorsManager,\n            path: this.documentPath,\n            fileExtension: this.languageFileExtension,\n            // notebooks are continuous, each cell is dependent on the previous one\n            standalone: false,\n            // notebooks are not supported by LSP servers\n            hasLspSupportedFile: false\n        });\n    }\n    /**\n     * Get the metadata of notebook.\n     */\n    language_info() {\n        return this._languageInfo;\n    }\n    /**\n     * Initialization function called once the editor and the LSP connection\n     * manager is ready. This function will create the virtual document and\n     * connect various signals.\n     */\n    async initOnceReady() {\n        await (0,_jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_1__.untilReady)(this.isReady.bind(this), -1);\n        await this._updateLanguageInfo();\n        this.initVirtual();\n        // connect the document, but do not open it as the adapter will handle this\n        // after registering all features\n        this.connectDocument(this.virtualDocument, false).catch(console.warn);\n        this.widget.context.sessionContext.kernelChanged.connect(this.onKernelChanged, this);\n        this.widget.content.activeCellChanged.connect(this._activeCellChanged, this);\n        this._connectModelSignals(this.widget);\n        this.editor.modelChanged.connect(notebook => {\n            // note: this should not usually happen;\n            // there is no default action that would trigger this,\n            // its just a failsafe in case if another extension decides\n            // to swap the notebook model\n            console.warn('Model changed, connecting cell change handler; this is not something we were expecting');\n            this._connectModelSignals(notebook);\n        });\n    }\n    /**\n     * Connect the cell changed event to its handler\n     *\n     * @param  notebook - The notebook that emitted event.\n     */\n    _connectModelSignals(notebook) {\n        if (notebook.model === null) {\n            console.warn(`Model is missing for notebook ${notebook}, cannot connect cell changed signal!`);\n        }\n        else {\n            notebook.model.cells.changed.connect(this.handleCellChange, this);\n        }\n    }\n    /**\n     * Update the stored language info with the one from the notebook.\n     */\n    async _updateLanguageInfo() {\n        var _a, _b, _c, _d;\n        const language_info = (_d = (await ((_c = (_b = (_a = this.widget.context.sessionContext) === null || _a === void 0 ? void 0 : _a.session) === null || _b === void 0 ? void 0 : _b.kernel) === null || _c === void 0 ? void 0 : _c.info))) === null || _d === void 0 ? void 0 : _d.language_info;\n        if (language_info) {\n            this._languageInfo = language_info;\n        }\n        else {\n            throw new Error('Language info update failed (no session, kernel, or info available)');\n        }\n    }\n    /**\n     * Handle the cell changed event\n     * @param  notebook - The notebook that emitted event\n     * @param cell - Changed cell.\n     */\n    _activeCellChanged(notebook, cell) {\n        if (!cell || cell.model.type !== this._type) {\n            return;\n        }\n        this._activeEditorChanged.emit({\n            editor: this._getCellEditor(cell)\n        });\n    }\n    /**\n     * Get the cell at the cursor position of the virtual document.\n     * @param  pos - Position in the virtual document.\n     */\n    _getCellAt(pos) {\n        let editor = this.virtualDocument.getEditorAtVirtualLine(pos);\n        return this._editorToCell.get(editor);\n    }\n    /**\n     * Get the cell editor and add new ones to the mappings.\n     *\n     * @param cell Cell widget\n     * @returns Cell editor accessor\n     */\n    _getCellEditor(cell) {\n        if (!this._cellToEditor.has(cell)) {\n            const editor = Object.freeze({\n                getEditor: () => cell.editor,\n                ready: async () => {\n                    await cell.ready;\n                    return cell.editor;\n                },\n                reveal: async () => {\n                    await this.editor.scrollToCell(cell);\n                    return cell.editor;\n                }\n            });\n            this._cellToEditor.set(cell, editor);\n            this._editorToCell.set(editor, cell);\n            cell.disposed.connect(() => {\n                this._cellToEditor.delete(cell);\n                this._editorToCell.delete(editor);\n                this._editorRemoved.emit({\n                    editor\n                });\n            });\n            this._editorAdded.emit({\n                editor\n            });\n        }\n        return this._cellToEditor.get(cell);\n    }\n}\n//# sourceMappingURL=notebooklspadapter.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/notebooklspadapter.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/notebooktools.js":
/*!*****************************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/notebooktools.js ***!
  \*****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   NotebookTools: () => (/* binding */ NotebookTools)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_codeeditor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/codeeditor */ \"webpack/sharing/consume/default/@jupyterlab/codeeditor/@jupyterlab/codeeditor\");\n/* harmony import */ var _jupyterlab_codeeditor__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_codeeditor__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_observables__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/observables */ \"webpack/sharing/consume/default/@jupyterlab/observables/@jupyterlab/observables\");\n/* harmony import */ var _jupyterlab_observables__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_observables__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyterlab/translation */ \"webpack/sharing/consume/default/@jupyterlab/translation/@jupyterlab/translation\");\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_3__ = __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_3___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lumino/algorithm */ \"webpack/sharing/consume/default/@lumino/algorithm/@lumino/algorithm\");\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _lumino_messaging__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @lumino/messaging */ \"webpack/sharing/consume/default/@lumino/messaging/@lumino/messaging\");\n/* harmony import */ var _lumino_messaging__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_lumino_messaging__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @lumino/widgets */ \"webpack/sharing/consume/default/@lumino/widgets/@lumino/widgets\");\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_lumino_widgets__WEBPACK_IMPORTED_MODULE_6__);\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n\n\n\n\n\n\nclass RankedPanel extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_6__.Widget {\n    constructor() {\n        super();\n        this._items = [];\n        this.layout = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_6__.PanelLayout();\n        this.addClass('jp-RankedPanel');\n    }\n    addWidget(widget, rank) {\n        const rankItem = { widget, rank };\n        const index = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_4__.ArrayExt.upperBound(this._items, rankItem, Private.itemCmp);\n        _lumino_algorithm__WEBPACK_IMPORTED_MODULE_4__.ArrayExt.insert(this._items, index, rankItem);\n        const layout = this.layout;\n        layout.insertWidget(index, widget);\n    }\n    /**\n     * Handle the removal of a child\n     *\n     */\n    onChildRemoved(msg) {\n        const index = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_4__.ArrayExt.findFirstIndex(this._items, item => item.widget === msg.child);\n        if (index !== -1) {\n            _lumino_algorithm__WEBPACK_IMPORTED_MODULE_4__.ArrayExt.removeAt(this._items, index);\n        }\n    }\n}\n/**\n * A widget that provides metadata tools.\n */\nclass NotebookTools extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_6__.Widget {\n    /**\n     * Construct a new NotebookTools object.\n     */\n    constructor(options) {\n        super();\n        this.addClass('jp-NotebookTools');\n        this.translator = options.translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_2__.nullTranslator;\n        this._tools = [];\n        this.layout = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_6__.PanelLayout();\n        this._tracker = options.tracker;\n        this._tracker.currentChanged.connect(this._onActiveNotebookPanelChanged, this);\n        this._tracker.activeCellChanged.connect(this._onActiveCellChanged, this);\n        this._tracker.selectionChanged.connect(this._onSelectionChanged, this);\n        this._onActiveNotebookPanelChanged();\n        this._onActiveCellChanged();\n        this._onSelectionChanged();\n    }\n    /**\n     * The active cell widget.\n     */\n    get activeCell() {\n        return this._tracker.activeCell;\n    }\n    /**\n     * The currently selected cells.\n     */\n    get selectedCells() {\n        const panel = this._tracker.currentWidget;\n        if (!panel) {\n            return [];\n        }\n        const notebook = panel.content;\n        return notebook.widgets.filter(cell => notebook.isSelectedOrActive(cell));\n    }\n    /**\n     * The current notebook.\n     */\n    get activeNotebookPanel() {\n        return this._tracker.currentWidget;\n    }\n    /**\n     * Add a cell tool item.\n     */\n    addItem(options) {\n        var _a;\n        const tool = options.tool;\n        const rank = (_a = options.rank) !== null && _a !== void 0 ? _a : 100;\n        let section;\n        const extendedTool = this._tools.find(extendedTool => extendedTool.section === options.section);\n        if (extendedTool)\n            section = extendedTool.panel;\n        else {\n            throw new Error(`The section ${options.section} does not exist`);\n        }\n        tool.addClass('jp-NotebookTools-tool');\n        section.addWidget(tool, rank);\n        // TODO: perhaps the necessary notebookTools functionality should be\n        // consolidated into a single object, rather than a broad reference to this.\n        tool.notebookTools = this;\n        // Trigger the tool to update its active notebook and cell.\n        _lumino_messaging__WEBPACK_IMPORTED_MODULE_5__.MessageLoop.sendMessage(tool, NotebookTools.ActiveNotebookPanelMessage);\n        _lumino_messaging__WEBPACK_IMPORTED_MODULE_5__.MessageLoop.sendMessage(tool, NotebookTools.ActiveCellMessage);\n    }\n    /*\n     * Add a section to the notebook tool with its widget\n     */\n    addSection(options) {\n        var _a;\n        const sectionName = options.sectionName;\n        const label = options.label || options.sectionName;\n        const widget = options.tool;\n        let rank = (_a = options.rank) !== null && _a !== void 0 ? _a : null;\n        const newSection = new RankedPanel();\n        newSection.title.label = label;\n        if (widget)\n            newSection.addWidget(widget, 0);\n        this._tools.push({\n            section: sectionName,\n            panel: newSection,\n            rank: rank\n        });\n        if (rank != null)\n            this.layout.insertWidget(rank, new _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_3__.Collapser({ widget: newSection }));\n        else {\n            // If no rank is provided, try to add the new section before the AdvancedTools.\n            let advancedToolsRank = null;\n            const layout = this.layout;\n            for (let i = 0; i < layout.widgets.length; i++) {\n                let w = layout.widgets[i];\n                if (w instanceof _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_3__.Collapser) {\n                    if (w.widget.id === 'advancedToolsSection') {\n                        advancedToolsRank = i;\n                        break;\n                    }\n                }\n            }\n            if (advancedToolsRank !== null)\n                this.layout.insertWidget(advancedToolsRank, new _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_3__.Collapser({ widget: newSection }));\n            else\n                this.layout.addWidget(new _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_3__.Collapser({ widget: newSection }));\n        }\n    }\n    /**\n     * Handle a change to the notebook panel.\n     */\n    _onActiveNotebookPanelChanged() {\n        if (this._prevActiveNotebookModel &&\n            !this._prevActiveNotebookModel.isDisposed) {\n            this._prevActiveNotebookModel.metadataChanged.disconnect(this._onActiveNotebookPanelMetadataChanged, this);\n        }\n        const activeNBModel = this.activeNotebookPanel && this.activeNotebookPanel.content\n            ? this.activeNotebookPanel.content.model\n            : null;\n        this._prevActiveNotebookModel = activeNBModel;\n        if (activeNBModel) {\n            activeNBModel.metadataChanged.connect(this._onActiveNotebookPanelMetadataChanged, this);\n        }\n        for (const widget of this._toolChildren()) {\n            _lumino_messaging__WEBPACK_IMPORTED_MODULE_5__.MessageLoop.sendMessage(widget, NotebookTools.ActiveNotebookPanelMessage);\n        }\n    }\n    /**\n     * Handle a change to the active cell.\n     */\n    _onActiveCellChanged() {\n        if (this._prevActiveCell && !this._prevActiveCell.isDisposed) {\n            this._prevActiveCell.metadataChanged.disconnect(this._onActiveCellMetadataChanged, this);\n        }\n        const activeCell = this.activeCell ? this.activeCell.model : null;\n        this._prevActiveCell = activeCell;\n        if (activeCell) {\n            activeCell.metadataChanged.connect(this._onActiveCellMetadataChanged, this);\n        }\n        for (const widget of this._toolChildren()) {\n            _lumino_messaging__WEBPACK_IMPORTED_MODULE_5__.MessageLoop.sendMessage(widget, NotebookTools.ActiveCellMessage);\n        }\n    }\n    /**\n     * Handle a change in the selection.\n     */\n    _onSelectionChanged() {\n        for (const widget of this._toolChildren()) {\n            _lumino_messaging__WEBPACK_IMPORTED_MODULE_5__.MessageLoop.sendMessage(widget, NotebookTools.SelectionMessage);\n        }\n    }\n    /**\n     * Handle a change in the active cell metadata.\n     */\n    _onActiveNotebookPanelMetadataChanged(sender, args) {\n        const message = new _jupyterlab_observables__WEBPACK_IMPORTED_MODULE_1__.ObservableJSON.ChangeMessage('activenotebookpanel-metadata-changed', { oldValue: undefined, newValue: undefined, ...args });\n        for (const widget of this._toolChildren()) {\n            _lumino_messaging__WEBPACK_IMPORTED_MODULE_5__.MessageLoop.sendMessage(widget, message);\n        }\n    }\n    /**\n     * Handle a change in the notebook model metadata.\n     */\n    _onActiveCellMetadataChanged(sender, args) {\n        const message = new _jupyterlab_observables__WEBPACK_IMPORTED_MODULE_1__.ObservableJSON.ChangeMessage('activecell-metadata-changed', { newValue: undefined, oldValue: undefined, ...args });\n        for (const widget of this._toolChildren()) {\n            _lumino_messaging__WEBPACK_IMPORTED_MODULE_5__.MessageLoop.sendMessage(widget, message);\n        }\n    }\n    *_toolChildren() {\n        for (let tool of this._tools) {\n            yield* tool.panel.children();\n        }\n    }\n}\n/**\n * The namespace for NotebookTools class statics.\n */\n(function (NotebookTools) {\n    /**\n     * A singleton conflatable `'activenotebookpanel-changed'` message.\n     */\n    NotebookTools.ActiveNotebookPanelMessage = new _lumino_messaging__WEBPACK_IMPORTED_MODULE_5__.ConflatableMessage('activenotebookpanel-changed');\n    /**\n     * A singleton conflatable `'activecell-changed'` message.\n     */\n    NotebookTools.ActiveCellMessage = new _lumino_messaging__WEBPACK_IMPORTED_MODULE_5__.ConflatableMessage('activecell-changed');\n    /**\n     * A singleton conflatable `'selection-changed'` message.\n     */\n    NotebookTools.SelectionMessage = new _lumino_messaging__WEBPACK_IMPORTED_MODULE_5__.ConflatableMessage('selection-changed');\n    /**\n     * The base notebook tool, meant to be subclassed.\n     */\n    class Tool extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_6__.Widget {\n        dispose() {\n            super.dispose();\n            if (this.notebookTools) {\n                this.notebookTools = null;\n            }\n        }\n        /**\n         * Process a message sent to the widget.\n         *\n         * @param msg - The message sent to the widget.\n         */\n        processMessage(msg) {\n            super.processMessage(msg);\n            switch (msg.type) {\n                case 'activenotebookpanel-changed':\n                    this.onActiveNotebookPanelChanged(msg);\n                    break;\n                case 'activecell-changed':\n                    this.onActiveCellChanged(msg);\n                    break;\n                case 'selection-changed':\n                    this.onSelectionChanged(msg);\n                    break;\n                case 'activecell-metadata-changed':\n                    this.onActiveCellMetadataChanged(msg);\n                    break;\n                case 'activenotebookpanel-metadata-changed':\n                    this.onActiveNotebookPanelMetadataChanged(msg);\n                    break;\n                default:\n                    break;\n            }\n        }\n        /**\n         * Handle a change to the notebook panel.\n         *\n         * #### Notes\n         * The default implementation is a no-op.\n         */\n        onActiveNotebookPanelChanged(msg) {\n            /* no-op */\n        }\n        /**\n         * Handle a change to the active cell.\n         *\n         * #### Notes\n         * The default implementation is a no-op.\n         */\n        onActiveCellChanged(msg) {\n            /* no-op */\n        }\n        /**\n         * Handle a change to the selection.\n         *\n         * #### Notes\n         * The default implementation is a no-op.\n         */\n        onSelectionChanged(msg) {\n            /* no-op */\n        }\n        /**\n         * Handle a change to the metadata of the active cell.\n         *\n         * #### Notes\n         * The default implementation is a no-op.\n         */\n        onActiveCellMetadataChanged(msg) {\n            /* no-op */\n        }\n        /**\n         * Handle a change to the metadata of the active cell.\n         *\n         * #### Notes\n         * The default implementation is a no-op.\n         */\n        onActiveNotebookPanelMetadataChanged(msg) {\n            /* no-op */\n        }\n    }\n    NotebookTools.Tool = Tool;\n    /**\n     * A raw metadata editor.\n     */\n    class MetadataEditorTool extends Tool {\n        /**\n         * Construct a new raw metadata tool.\n         */\n        constructor(options) {\n            super();\n            const { editorFactory } = options;\n            this.addClass('jp-MetadataEditorTool');\n            const layout = (this.layout = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_6__.PanelLayout());\n            this._editorFactory = editorFactory;\n            this._editorLabel = options.label || 'Edit Metadata';\n            this.createEditor();\n            const titleNode = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_6__.Widget({ node: document.createElement('label') });\n            titleNode.node.textContent = options.label || 'Edit Metadata';\n            layout.addWidget(titleNode);\n            layout.addWidget(this.editor);\n        }\n        /**\n         * The editor used by the tool.\n         */\n        get editor() {\n            return this._editor;\n        }\n        /**\n         * Handle a change to the notebook.\n         */\n        onActiveNotebookPanelChanged(msg) {\n            this.editor.dispose();\n            if (this.notebookTools.activeNotebookPanel) {\n                this.createEditor();\n            }\n        }\n        createEditor() {\n            this._editor = new _jupyterlab_codeeditor__WEBPACK_IMPORTED_MODULE_0__.JSONEditor({\n                editorFactory: this._editorFactory\n            });\n            this.editor.title.label = this._editorLabel;\n            this.layout.addWidget(this.editor);\n        }\n    }\n    NotebookTools.MetadataEditorTool = MetadataEditorTool;\n})(NotebookTools || (NotebookTools = {}));\n/**\n * A namespace for private data.\n */\nvar Private;\n(function (Private) {\n    /**\n     * A comparator function for widget rank items.\n     */\n    function itemCmp(first, second) {\n        return first.rank - second.rank;\n    }\n    Private.itemCmp = itemCmp;\n})(Private || (Private = {}));\n//# sourceMappingURL=notebooktools.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/notebooktools.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/panel.js":
/*!*********************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/panel.js ***!
  \*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   NotebookPanel: () => (/* binding */ NotebookPanel)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/apputils */ \"webpack/sharing/consume/default/@jupyterlab/apputils/@jupyterlab/apputils\");\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/cells */ \"webpack/sharing/consume/default/@jupyterlab/cells/@jupyterlab/cells\");\n/* harmony import */ var _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_cells__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_docregistry__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @jupyterlab/docregistry */ \"webpack/sharing/consume/default/@jupyterlab/docregistry/@jupyterlab/docregistry\");\n/* harmony import */ var _jupyterlab_docregistry__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_docregistry__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lumino/coreutils */ \"webpack/sharing/consume/default/@lumino/coreutils/@lumino/coreutils\");\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _widget__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./widget */ \"../node_modules/@jupyterlab/notebook/lib/widget.js\");\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n\n\n\n\n\n/**\n * The class name added to notebook panels.\n */\nconst NOTEBOOK_PANEL_CLASS = 'jp-NotebookPanel';\nconst NOTEBOOK_PANEL_TOOLBAR_CLASS = 'jp-NotebookPanel-toolbar';\nconst NOTEBOOK_PANEL_NOTEBOOK_CLASS = 'jp-NotebookPanel-notebook';\n/**\n * A widget that hosts a notebook toolbar and content area.\n *\n * #### Notes\n * The widget keeps the document metadata in sync with the current\n * kernel on the context.\n */\nclass NotebookPanel extends _jupyterlab_docregistry__WEBPACK_IMPORTED_MODULE_3__.DocumentWidget {\n    /**\n     * Construct a new notebook panel.\n     */\n    constructor(options) {\n        super(options);\n        /**\n         * Whether we are currently in a series of autorestarts we have already\n         * notified the user about.\n         */\n        this._autorestarting = false;\n        // Set up CSS classes\n        this.addClass(NOTEBOOK_PANEL_CLASS);\n        this.toolbar.addClass(NOTEBOOK_PANEL_TOOLBAR_CLASS);\n        this.content.addClass(NOTEBOOK_PANEL_NOTEBOOK_CLASS);\n        // Set up things related to the context\n        this.content.model = this.context.model;\n        this.context.sessionContext.kernelChanged.connect(this._onKernelChanged, this);\n        this.context.sessionContext.statusChanged.connect(this._onSessionStatusChanged, this);\n        // this.content.fullyRendered.connect(this._onFullyRendered, this);\n        this.context.saveState.connect(this._onSave, this);\n        void this.revealed.then(() => {\n            if (this.isDisposed) {\n                // this widget has already been disposed, bail\n                return;\n            }\n            // Set the document edit mode on initial open if it looks like a new document.\n            if (this.content.widgets.length === 1) {\n                const cellModel = this.content.widgets[0].model;\n                if (cellModel.type === 'code' &&\n                    cellModel.sharedModel.getSource() === '') {\n                    this.content.mode = 'edit';\n                }\n            }\n        });\n    }\n    /**\n     * Handle a change to the document registry save state.\n     *\n     * @param sender The document registry context\n     * @param state The document registry save state\n     */\n    _onSave(sender, state) {\n        if (state === 'started' && this.model) {\n            // Find markdown cells\n            for (const cell of this.model.cells) {\n                if ((0,_jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.isMarkdownCellModel)(cell)) {\n                    for (const key of cell.attachments.keys) {\n                        if (!cell.sharedModel.getSource().includes(key)) {\n                            cell.attachments.remove(key);\n                        }\n                    }\n                }\n            }\n        }\n    }\n    /**\n     * The session context used by the panel.\n     */\n    get sessionContext() {\n        return this.context.sessionContext;\n    }\n    /**\n     * The model for the widget.\n     */\n    get model() {\n        return this.content.model;\n    }\n    /**\n     * Update the options for the current notebook panel.\n     *\n     * @param config new options to set\n     */\n    setConfig(config) {\n        this.content.editorConfig = config.editorConfig;\n        this.content.notebookConfig = config.notebookConfig;\n        // Update kernel shutdown behavior\n        const kernelPreference = this.context.sessionContext.kernelPreference;\n        this.context.sessionContext.kernelPreference = {\n            ...kernelPreference,\n            shutdownOnDispose: config.kernelShutdown,\n            autoStartDefault: config.autoStartDefault\n        };\n    }\n    /**\n     * Set URI fragment identifier.\n     */\n    setFragment(fragment) {\n        void this.context.ready.then(() => {\n            void this.content.setFragment(fragment);\n        });\n    }\n    /**\n     * Dispose of the resources used by the widget.\n     */\n    dispose() {\n        this.content.dispose();\n        super.dispose();\n    }\n    /**\n     * Prints the notebook by converting to HTML with nbconvert.\n     */\n    [_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Printing.symbol]() {\n        return async () => {\n            // Save before generating HTML\n            if (this.context.model.dirty && !this.context.model.readOnly) {\n                await this.context.save();\n            }\n            await _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Printing.printURL(_jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_2__.PageConfig.getNBConvertURL({\n                format: 'html',\n                download: false,\n                path: this.context.path\n            }));\n        };\n    }\n    /**\n     * A message handler invoked on a 'before-hide' message.\n     */\n    onBeforeHide(msg) {\n        super.onBeforeHide(msg);\n        // Inform the windowed list that the notebook is gonna be hidden\n        this.content.isParentHidden = true;\n    }\n    /**\n     * A message handler invoked on a 'before-show' message.\n     */\n    onBeforeShow(msg) {\n        // Inform the windowed list that the notebook is gonna be shown\n        // Use onBeforeShow instead of onAfterShow to take into account\n        // resizing (like sidebars got expanded before switching to the notebook tab)\n        this.content.isParentHidden = false;\n        super.onBeforeShow(msg);\n    }\n    /**\n     * Handle a change in the kernel by updating the document metadata.\n     */\n    _onKernelChanged(sender, args) {\n        if (!this.model || !args.newValue) {\n            return;\n        }\n        const { newValue } = args;\n        void newValue.info.then(info => {\n            var _a;\n            if (this.model &&\n                ((_a = this.context.sessionContext.session) === null || _a === void 0 ? void 0 : _a.kernel) === newValue) {\n                this._updateLanguage(info.language_info);\n            }\n        });\n        void this._updateSpec(newValue);\n    }\n    _onSessionStatusChanged(sender, status) {\n        var _a;\n        // If the status is autorestarting, and we aren't already in a series of\n        // autorestarts, show the dialog.\n        if (status === 'autorestarting' && !this._autorestarting) {\n            // The kernel died and the server is restarting it. We notify the user so\n            // they know why their kernel state is gone.\n            void (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.showDialog)({\n                title: this._trans.__('Kernel Restarting'),\n                body: this._trans.__('The kernel for %1 appears to have died. It will restart automatically.', (_a = this.sessionContext.session) === null || _a === void 0 ? void 0 : _a.path),\n                buttons: [_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Dialog.okButton({ label: this._trans.__('Ok') })]\n            });\n            this._autorestarting = true;\n        }\n        else if (status === 'restarting') {\n            // Another autorestart attempt will first change the status to\n            // restarting, then to autorestarting again, so we don't reset the\n            // autorestarting status if the status is 'restarting'.\n            /* no-op */\n        }\n        else {\n            this._autorestarting = false;\n        }\n    }\n    /**\n     * Update the kernel language.\n     */\n    _updateLanguage(language) {\n        this.model.setMetadata('language_info', language);\n    }\n    /**\n     * Update the kernel spec.\n     */\n    async _updateSpec(kernel) {\n        const spec = await kernel.spec;\n        if (this.isDisposed) {\n            return;\n        }\n        this.model.setMetadata('kernelspec', {\n            name: kernel.name,\n            display_name: spec === null || spec === void 0 ? void 0 : spec.display_name,\n            language: spec === null || spec === void 0 ? void 0 : spec.language\n        });\n    }\n}\n/**\n * A namespace for `NotebookPanel` statics.\n */\n(function (NotebookPanel) {\n    /**\n     * The default implementation of an `IContentFactory`.\n     */\n    class ContentFactory extends _widget__WEBPACK_IMPORTED_MODULE_5__.Notebook.ContentFactory {\n        /**\n         * Create a new content area for the panel.\n         */\n        createNotebook(options) {\n            return new _widget__WEBPACK_IMPORTED_MODULE_5__.Notebook(options);\n        }\n    }\n    NotebookPanel.ContentFactory = ContentFactory;\n    /**\n     * The notebook renderer token.\n     */\n    NotebookPanel.IContentFactory = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_4__.Token('@jupyterlab/notebook:IContentFactory', `A factory object that creates new notebooks.\n    Use this if you want to create and host notebooks in your own UI elements.`);\n})(NotebookPanel || (NotebookPanel = {}));\n//# sourceMappingURL=panel.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/panel.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/searchprovider.js":
/*!******************************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/searchprovider.js ***!
  \******************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   NotebookSearchProvider: () => (/* binding */ NotebookSearchProvider)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/apputils */ \"webpack/sharing/consume/default/@jupyterlab/apputils/@jupyterlab/apputils\");\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/cells */ \"webpack/sharing/consume/default/@jupyterlab/cells/@jupyterlab/cells\");\n/* harmony import */ var _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _jupyterlab_documentsearch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyterlab/documentsearch */ \"webpack/sharing/consume/default/@jupyterlab/documentsearch/@jupyterlab/documentsearch\");\n/* harmony import */ var _jupyterlab_documentsearch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_documentsearch__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @jupyterlab/translation */ \"webpack/sharing/consume/default/@jupyterlab/translation/@jupyterlab/translation\");\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lumino/algorithm */ \"webpack/sharing/consume/default/@lumino/algorithm/@lumino/algorithm\");\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _panel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./panel */ \"../node_modules/@jupyterlab/notebook/lib/panel.js\");\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n\n\n\n\n\n/**\n * Notebook document search provider\n */\nclass NotebookSearchProvider extends _jupyterlab_documentsearch__WEBPACK_IMPORTED_MODULE_2__.SearchProvider {\n    /**\n     * Constructor\n     *\n     * @param widget The widget to search in\n     * @param translator Application translator\n     */\n    constructor(widget, translator = _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3__.nullTranslator) {\n        super(widget);\n        this.translator = translator;\n        this._textSelection = null;\n        this._currentProviderIndex = null;\n        this._delayedActiveCellChangeHandler = null;\n        this._onSelection = false;\n        this._selectedCells = 1;\n        this._selectedLines = 0;\n        this._query = null;\n        this._searchProviders = [];\n        this._editorSelectionsObservable = null;\n        this._selectionSearchMode = 'cells';\n        this._selectionLock = false;\n        this._searchActive = false;\n        this._handleHighlightsAfterActiveCellChange =\n            this._handleHighlightsAfterActiveCellChange.bind(this);\n        this.widget.model.cells.changed.connect(this._onCellsChanged, this);\n        this.widget.content.activeCellChanged.connect(this._onActiveCellChanged, this);\n        this.widget.content.selectionChanged.connect(this._onCellSelectionChanged, this);\n        this.widget.content.stateChanged.connect(this._onNotebookStateChanged, this);\n        this._observeActiveCell();\n        this._filtersChanged.connect(this._setEnginesSelectionSearchMode, this);\n    }\n    _onNotebookStateChanged(_, args) {\n        if (args.name === 'mode') {\n            // Delay the update to ensure that `document.activeElement` settled.\n            window.setTimeout(() => {\n                var _a;\n                if (args.newValue === 'command' &&\n                    ((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest('.jp-DocumentSearch-overlay'))) {\n                    // Do not request updating mode when user switched focus to search overlay.\n                    return;\n                }\n                this._updateSelectionMode();\n                this._filtersChanged.emit();\n            }, 0);\n        }\n    }\n    /**\n     * Report whether or not this provider has the ability to search on the given object\n     *\n     * @param domain Widget to test\n     * @returns Search ability\n     */\n    static isApplicable(domain) {\n        // check to see if the CMSearchProvider can search on the\n        // first cell, false indicates another editor is present\n        return domain instanceof _panel__WEBPACK_IMPORTED_MODULE_5__.NotebookPanel;\n    }\n    /**\n     * Instantiate a search provider for the notebook panel.\n     *\n     * #### Notes\n     * The widget provided is always checked using `isApplicable` before calling\n     * this factory.\n     *\n     * @param widget The widget to search on\n     * @param translator [optional] The translator object\n     *\n     * @returns The search provider on the notebook panel\n     */\n    static createNew(widget, translator) {\n        return new NotebookSearchProvider(widget, translator);\n    }\n    /**\n     * The current index of the selected match.\n     */\n    get currentMatchIndex() {\n        let agg = 0;\n        let found = false;\n        for (let idx = 0; idx < this._searchProviders.length; idx++) {\n            const provider = this._searchProviders[idx];\n            if (this._currentProviderIndex == idx) {\n                const localMatch = provider.currentMatchIndex;\n                if (localMatch === null) {\n                    return null;\n                }\n                agg += localMatch;\n                found = true;\n                break;\n            }\n            else {\n                agg += provider.matchesCount;\n            }\n        }\n        return found ? agg : null;\n    }\n    /**\n     * The number of matches.\n     */\n    get matchesCount() {\n        return this._searchProviders.reduce((sum, provider) => (sum += provider.matchesCount), 0);\n    }\n    /**\n     * Set to true if the widget under search is read-only, false\n     * if it is editable. Will be used to determine whether to show\n     * the replace option.\n     */\n    get isReadOnly() {\n        var _a, _b, _c;\n        return (_c = (_b = (_a = this.widget) === null || _a === void 0 ? void 0 : _a.content.model) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;\n    }\n    /**\n     * Support for options adjusting replacement behavior.\n     */\n    get replaceOptionsSupport() {\n        return {\n            preserveCase: true\n        };\n    }\n    getSelectionState() {\n        const cellMode = this._selectionSearchMode === 'cells';\n        const selectedCount = cellMode ? this._selectedCells : this._selectedLines;\n        return selectedCount > 1\n            ? 'multiple'\n            : selectedCount === 1 && !cellMode\n                ? 'single'\n                : 'none';\n    }\n    /**\n     * Dispose of the resources held by the search provider.\n     *\n     * #### Notes\n     * If the object's `dispose` method is called more than once, all\n     * calls made after the first will be a no-op.\n     *\n     * #### Undefined Behavior\n     * It is undefined behavior to use any functionality of the object\n     * after it has been disposed unless otherwise explicitly noted.\n     */\n    dispose() {\n        var _a;\n        if (this.isDisposed) {\n            return;\n        }\n        this.widget.content.activeCellChanged.disconnect(this._onActiveCellChanged, this);\n        (_a = this.widget.model) === null || _a === void 0 ? void 0 : _a.cells.changed.disconnect(this._onCellsChanged, this);\n        this.widget.content.stateChanged.disconnect(this._onNotebookStateChanged, this);\n        this.widget.content.selectionChanged.disconnect(this._onCellSelectionChanged, this);\n        this._stopObservingLastCell();\n        super.dispose();\n        const index = this.widget.content.activeCellIndex;\n        this.endQuery()\n            .then(() => {\n            if (!this.widget.isDisposed) {\n                this.widget.content.activeCellIndex = index;\n            }\n        })\n            .catch(reason => {\n            console.error(`Fail to end search query in notebook:\\n${reason}`);\n        });\n    }\n    /**\n     * Get the filters for the given provider.\n     *\n     * @returns The filters.\n     */\n    getFilters() {\n        const trans = this.translator.load('jupyterlab');\n        return {\n            output: {\n                title: trans.__('Search Cell Outputs'),\n                description: trans.__('Search in the cell outputs.'),\n                disabledDescription: trans.__('Search in the cell outputs (not available when replace options are shown).'),\n                default: false,\n                supportReplace: false\n            },\n            selection: {\n                title: this._selectionSearchMode === 'cells'\n                    ? trans._n('Search in %1 Selected Cell', 'Search in %1 Selected Cells', this._selectedCells)\n                    : trans._n('Search in %1 Selected Line', 'Search in %1 Selected Lines', this._selectedLines),\n                description: trans.__('Search only in the selected cells or text (depending on edit/command mode).'),\n                default: false,\n                supportReplace: true\n            }\n        };\n    }\n    /**\n     * Update the search in selection mode; it should only be called when user\n     * navigates the notebook (enters editing/command mode, changes selection)\n     * but not when the searchbox gets focused (switching the notebook to command\n     * mode) nor when search highlights a match (switching notebook to edit mode).\n     */\n    _updateSelectionMode() {\n        if (this._selectionLock) {\n            return;\n        }\n        this._selectionSearchMode =\n            this._selectedCells === 1 &&\n                this.widget.content.mode === 'edit' &&\n                this._selectedLines !== 0\n                ? 'text'\n                : 'cells';\n    }\n    /**\n     * Get an initial query value if applicable so that it can be entered\n     * into the search box as an initial query\n     *\n     * @returns Initial value used to populate the search box.\n     */\n    getInitialQuery() {\n        var _a;\n        // Get whatever is selected in the browser window.\n        return ((_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.toString()) || '';\n    }\n    /**\n     * Clear currently highlighted match.\n     */\n    async clearHighlight() {\n        this._selectionLock = true;\n        if (this._currentProviderIndex !== null &&\n            this._currentProviderIndex < this._searchProviders.length) {\n            await this._searchProviders[this._currentProviderIndex].clearHighlight();\n            this._currentProviderIndex = null;\n        }\n        this._selectionLock = false;\n    }\n    /**\n     * Highlight the next match.\n     *\n     * @param loop Whether to loop within the matches list.\n     *\n     * @returns The next match if available.\n     */\n    async highlightNext(loop = true, options) {\n        const match = await this._stepNext(false, loop, options);\n        return match !== null && match !== void 0 ? match : undefined;\n    }\n    /**\n     * Highlight the previous match.\n     *\n     * @param loop Whether to loop within the matches list.\n     *\n     * @returns The previous match if available.\n     */\n    async highlightPrevious(loop = true, options) {\n        const match = await this._stepNext(true, loop, options);\n        return match !== null && match !== void 0 ? match : undefined;\n    }\n    /**\n     * Search for a regular expression with optional filters.\n     *\n     * @param query A regular expression to test for\n     * @param filters Filter parameters to pass to provider\n     *\n     */\n    async startQuery(query, filters) {\n        if (!this.widget) {\n            return;\n        }\n        await this.endQuery();\n        this._searchActive = true;\n        let cells = this.widget.content.widgets;\n        this._query = query;\n        this._filters = {\n            output: false,\n            selection: false,\n            ...(filters !== null && filters !== void 0 ? filters : {})\n        };\n        this._onSelection = this._filters.selection;\n        const currentProviderIndex = this.widget.content.activeCellIndex;\n        // For each cell, create a search provider\n        this._searchProviders = await Promise.all(cells.map(async (cell, index) => {\n            const cellSearchProvider = (0,_jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.createCellSearchProvider)(cell);\n            await cellSearchProvider.setIsActive(!this._filters.selection ||\n                this.widget.content.isSelectedOrActive(cell));\n            if (this._onSelection &&\n                this._selectionSearchMode === 'text' &&\n                index === currentProviderIndex) {\n                if (this._textSelection) {\n                    await cellSearchProvider.setSearchSelection(this._textSelection);\n                }\n            }\n            await cellSearchProvider.startQuery(query, this._filters);\n            return cellSearchProvider;\n        }));\n        this._currentProviderIndex = currentProviderIndex;\n        // We do not want to show the first \"current\" closest to cursor as depending\n        // on which way the user dragged the selection it would be:\n        // - the first or last match when searching in selection\n        // - the next match when starting search using ctrl + f\n        // `scroll` and `select` are disabled because `startQuery` is also used as\n        // \"restartQuery\" after each text change and if those were enabled, we would\n        // steal the cursor.\n        await this.highlightNext(true, {\n            from: 'selection-start',\n            scroll: false,\n            select: false\n        });\n        return Promise.resolve();\n    }\n    /**\n     * Stop the search and clear all internal state.\n     */\n    async endQuery() {\n        await Promise.all(this._searchProviders.map(provider => {\n            return provider.endQuery().then(() => {\n                provider.dispose();\n            });\n        }));\n        this._searchActive = false;\n        this._searchProviders.length = 0;\n        this._currentProviderIndex = null;\n    }\n    /**\n     * Replace the currently selected match with the provided text\n     *\n     * @param newText The replacement text.\n     * @param loop Whether to loop within the matches list.\n     *\n     * @returns A promise that resolves with a boolean indicating whether a replace occurred.\n     */\n    async replaceCurrentMatch(newText, loop = true, options) {\n        let replaceOccurred = false;\n        const unrenderMarkdownCell = async (highlightNext = false) => {\n            var _a;\n            // Unrendered markdown cell\n            const activeCell = (_a = this.widget) === null || _a === void 0 ? void 0 : _a.content.activeCell;\n            if ((activeCell === null || activeCell === void 0 ? void 0 : activeCell.model.type) === 'markdown' &&\n                activeCell.rendered) {\n                activeCell.rendered = false;\n                if (highlightNext) {\n                    await this.highlightNext(loop);\n                }\n            }\n        };\n        if (this._currentProviderIndex !== null) {\n            await unrenderMarkdownCell();\n            const searchEngine = this._searchProviders[this._currentProviderIndex];\n            replaceOccurred = await searchEngine.replaceCurrentMatch(newText, false, options);\n            if (searchEngine.currentMatchIndex === null) {\n                // switch to next cell\n                await this.highlightNext(loop, { from: 'previous-match' });\n            }\n        }\n        // TODO: markdown unrendering/highlighting sequence is likely incorrect\n        // Force highlighting the first hit in the unrendered cell\n        await unrenderMarkdownCell(true);\n        return replaceOccurred;\n    }\n    /**\n     * Replace all matches in the notebook with the provided text\n     *\n     * @param newText The replacement text.\n     *\n     * @returns A promise that resolves with a boolean indicating whether a replace occurred.\n     */\n    async replaceAllMatches(newText, options) {\n        const replacementOccurred = await Promise.all(this._searchProviders.map(provider => {\n            return provider.replaceAllMatches(newText, options);\n        }));\n        return replacementOccurred.includes(true);\n    }\n    async validateFilter(name, value) {\n        if (name !== 'output') {\n            // Bail early\n            return value;\n        }\n        // If value is true and some cells have never been rendered, ask confirmation.\n        if (value &&\n            this.widget.content.widgets.some(w => w instanceof _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.CodeCell && w.isPlaceholder())) {\n            const trans = this.translator.load('jupyterlab');\n            const reply = await (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.showDialog)({\n                title: trans.__('Confirmation'),\n                body: trans.__('Searching outputs requires you to run all cells and render their outputs. Are you sure you want to search in the cell outputs?'),\n                buttons: [\n                    _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Dialog.cancelButton({ label: trans.__('Cancel') }),\n                    _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Dialog.okButton({ label: trans.__('Ok') })\n                ]\n            });\n            if (reply.button.accept) {\n                this.widget.content.widgets.forEach((w, i) => {\n                    if (w instanceof _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.CodeCell && w.isPlaceholder()) {\n                        this.widget.content.renderCellOutputs(i);\n                    }\n                });\n            }\n            else {\n                return false;\n            }\n        }\n        return value;\n    }\n    _addCellProvider(index) {\n        var _a, _b;\n        const cell = this.widget.content.widgets[index];\n        const cellSearchProvider = (0,_jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.createCellSearchProvider)(cell);\n        _lumino_algorithm__WEBPACK_IMPORTED_MODULE_4__.ArrayExt.insert(this._searchProviders, index, cellSearchProvider);\n        void cellSearchProvider\n            .setIsActive(!((_b = (_a = this._filters) === null || _a === void 0 ? void 0 : _a.selection) !== null && _b !== void 0 ? _b : false) ||\n            this.widget.content.isSelectedOrActive(cell))\n            .then(() => {\n            if (this._searchActive) {\n                void cellSearchProvider.startQuery(this._query, this._filters);\n            }\n        });\n    }\n    _removeCellProvider(index) {\n        const provider = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_4__.ArrayExt.removeAt(this._searchProviders, index);\n        provider === null || provider === void 0 ? void 0 : provider.dispose();\n    }\n    async _onCellsChanged(cells, changes) {\n        switch (changes.type) {\n            case 'add':\n                changes.newValues.forEach((model, index) => {\n                    this._addCellProvider(changes.newIndex + index);\n                });\n                break;\n            case 'move':\n                _lumino_algorithm__WEBPACK_IMPORTED_MODULE_4__.ArrayExt.move(this._searchProviders, changes.oldIndex, changes.newIndex);\n                break;\n            case 'remove':\n                for (let index = 0; index < changes.oldValues.length; index++) {\n                    this._removeCellProvider(changes.oldIndex);\n                }\n                break;\n            case 'set':\n                changes.newValues.forEach((model, index) => {\n                    this._addCellProvider(changes.newIndex + index);\n                    this._removeCellProvider(changes.newIndex + index + 1);\n                });\n                break;\n        }\n        this._stateChanged.emit();\n    }\n    async _stepNext(reverse = false, loop = false, options) {\n        var _a;\n        const activateNewMatch = async (match) => {\n            var _a;\n            const shouldScroll = (_a = options === null || options === void 0 ? void 0 : options.scroll) !== null && _a !== void 0 ? _a : true;\n            if (!shouldScroll) {\n                // do not activate the match if scrolling was disabled\n                return;\n            }\n            this._selectionLock = true;\n            if (this.widget.content.activeCellIndex !== this._currentProviderIndex) {\n                this.widget.content.activeCellIndex = this._currentProviderIndex;\n            }\n            if (this.widget.content.activeCellIndex === -1) {\n                console.warn('No active cell (no cells or no model), aborting search');\n                this._selectionLock = false;\n                return;\n            }\n            const activeCell = this.widget.content.activeCell;\n            if (!activeCell.inViewport) {\n                try {\n                    await this.widget.content.scrollToItem(this._currentProviderIndex);\n                }\n                catch (error) {\n                    // no-op\n                }\n            }\n            // Unhide cell\n            if (activeCell.inputHidden) {\n                activeCell.inputHidden = false;\n            }\n            if (!activeCell.inViewport) {\n                this._selectionLock = false;\n                // It will not be possible the cell is not in the view\n                return;\n            }\n            await activeCell.ready;\n            const editor = activeCell.editor;\n            editor.revealPosition(editor.getPositionAt(match.position));\n            this._selectionLock = false;\n        };\n        if (this._currentProviderIndex === null) {\n            this._currentProviderIndex = this.widget.content.activeCellIndex;\n        }\n        // When going to previous match in cell mode and there is no current we\n        // want to skip the active cell and go to the previous cell; in edit mode\n        // the appropriate behaviour is induced by searching from nearest cursor.\n        if (reverse && this.widget.content.mode === 'command') {\n            const searchEngine = this._searchProviders[this._currentProviderIndex];\n            const currentMatch = searchEngine.getCurrentMatch();\n            if (!currentMatch) {\n                this._currentProviderIndex -= 1;\n            }\n            if (loop) {\n                this._currentProviderIndex =\n                    (this._currentProviderIndex + this._searchProviders.length) %\n                        this._searchProviders.length;\n            }\n        }\n        // If we're looking for the next match after the previous match,\n        // and we've reached the end of the current cell, start at the next one, if possible\n        const from = (_a = options === null || options === void 0 ? void 0 : options.from) !== null && _a !== void 0 ? _a : '';\n        const atEndOfCurrentCell = from === 'previous-match' &&\n            this._searchProviders[this._currentProviderIndex].currentMatchIndex ===\n                null;\n        const startIndex = this._currentProviderIndex;\n        // If we need to move to the next cell or loop, reset the position of the current search provider.\n        if (atEndOfCurrentCell) {\n            void this._searchProviders[this._currentProviderIndex].clearHighlight();\n        }\n        // If we're at the end of the last cell in the provider list and we need to loop, do so\n        if (loop &&\n            atEndOfCurrentCell &&\n            this._currentProviderIndex + 1 >= this._searchProviders.length) {\n            this._currentProviderIndex = 0;\n        }\n        else {\n            this._currentProviderIndex += atEndOfCurrentCell ? 1 : 0;\n        }\n        do {\n            const searchEngine = this._searchProviders[this._currentProviderIndex];\n            const match = reverse\n                ? await searchEngine.highlightPrevious(false, options)\n                : await searchEngine.highlightNext(false, options);\n            if (match) {\n                await activateNewMatch(match);\n                return match;\n            }\n            else {\n                this._currentProviderIndex =\n                    this._currentProviderIndex + (reverse ? -1 : 1);\n                if (loop) {\n                    this._currentProviderIndex =\n                        (this._currentProviderIndex + this._searchProviders.length) %\n                            this._searchProviders.length;\n                }\n            }\n        } while (loop\n            ? // We looped on all cells, no hit found\n                this._currentProviderIndex !== startIndex\n            : 0 <= this._currentProviderIndex &&\n                this._currentProviderIndex < this._searchProviders.length);\n        if (loop) {\n            // try the first provider again\n            const searchEngine = this._searchProviders[startIndex];\n            const match = reverse\n                ? await searchEngine.highlightPrevious(false, options)\n                : await searchEngine.highlightNext(false, options);\n            if (match) {\n                await activateNewMatch(match);\n                return match;\n            }\n        }\n        this._currentProviderIndex = null;\n        return null;\n    }\n    async _onActiveCellChanged() {\n        if (this._delayedActiveCellChangeHandler !== null) {\n            // Prevent handler from running twice if active cell is changed twice\n            // within the same task of the event loop.\n            clearTimeout(this._delayedActiveCellChangeHandler);\n            this._delayedActiveCellChangeHandler = null;\n        }\n        if (this.widget.content.activeCellIndex !== this._currentProviderIndex) {\n            // At this time we cannot handle the change of active cell, because\n            // `activeCellChanged` is also emitted in the middle of cell selection\n            // change, and if selection is getting extended, we do not want to clear\n            // highlights just to re-apply them shortly after, which has side effects\n            // impacting the functionality and performance.\n            this._delayedActiveCellChangeHandler = window.setTimeout(() => {\n                this.delayedActiveCellChangeHandlerReady =\n                    this._handleHighlightsAfterActiveCellChange();\n            }, 0);\n        }\n        this._observeActiveCell();\n    }\n    async _handleHighlightsAfterActiveCellChange() {\n        if (this._onSelection) {\n            const previousProviderCell = this._currentProviderIndex !== null &&\n                this._currentProviderIndex < this.widget.content.widgets.length\n                ? this.widget.content.widgets[this._currentProviderIndex]\n                : null;\n            const previousProviderInCurrentSelection = previousProviderCell &&\n                this.widget.content.isSelectedOrActive(previousProviderCell);\n            if (!previousProviderInCurrentSelection) {\n                await this._updateCellSelection();\n                // Clear highlight from previous provider\n                await this.clearHighlight();\n                // If we are searching in all cells, we should not change the active\n                // provider when switching active cell to preserve current match;\n                // if we are searching within selected cells we should update\n                this._currentProviderIndex = this.widget.content.activeCellIndex;\n            }\n        }\n        await this._ensureCurrentMatch();\n    }\n    /**\n     * If there are results but no match is designated as current,\n     * mark a result as current and highlight it.\n     */\n    async _ensureCurrentMatch() {\n        if (this._currentProviderIndex !== null) {\n            const searchEngine = this._searchProviders[this._currentProviderIndex];\n            if (!searchEngine) {\n                // This can happen when `startQuery()` has not finished yet.\n                return;\n            }\n            const currentMatch = searchEngine.getCurrentMatch();\n            if (!currentMatch && this.matchesCount) {\n                // Select a match as current by highlighting next (with looping) from\n                // the selection start, to prevent \"current\" match from jumping around.\n                await this.highlightNext(true, {\n                    from: 'start',\n                    scroll: false,\n                    select: false\n                });\n            }\n        }\n    }\n    _observeActiveCell() {\n        var _a;\n        const editor = (_a = this.widget.content.activeCell) === null || _a === void 0 ? void 0 : _a.editor;\n        if (!editor) {\n            return;\n        }\n        this._stopObservingLastCell();\n        editor.model.selections.changed.connect(this._setSelectedLines, this);\n        this._editorSelectionsObservable = editor.model.selections;\n    }\n    _stopObservingLastCell() {\n        if (this._editorSelectionsObservable) {\n            this._editorSelectionsObservable.changed.disconnect(this._setSelectedLines, this);\n        }\n    }\n    _setSelectedLines() {\n        var _a;\n        const editor = (_a = this.widget.content.activeCell) === null || _a === void 0 ? void 0 : _a.editor;\n        if (!editor) {\n            return;\n        }\n        const selection = editor.getSelection();\n        const { start, end } = selection;\n        const newLines = end.line === start.line && end.column === start.column\n            ? 0\n            : end.line - start.line + 1;\n        this._textSelection = selection;\n        if (newLines !== this._selectedLines) {\n            this._selectedLines = newLines;\n            this._updateSelectionMode();\n        }\n        this._filtersChanged.emit();\n    }\n    /**\n     * Set whether the engines should search within selection only or full text.\n     */\n    async _setEnginesSelectionSearchMode() {\n        let textMode;\n        if (!this._onSelection) {\n            // When search in selection is off we always search full text\n            textMode = false;\n        }\n        else {\n            // When search in selection is off we either search in full cells\n            // (toggling off isActive flag on search enginges of non-selected cells)\n            // or in selected text of the active cell.\n            textMode = this._selectionSearchMode === 'text';\n        }\n        if (this._selectionLock) {\n            return;\n        }\n        // Clear old selection restrictions or if relevant, set current restrictions for active provider.\n        await Promise.all(this._searchProviders.map((provider, index) => {\n            const isCurrent = this.widget.content.activeCellIndex === index;\n            provider.setProtectSelection(isCurrent && this._onSelection);\n            return provider.setSearchSelection(isCurrent && textMode ? this._textSelection : null);\n        }));\n    }\n    async _onCellSelectionChanged() {\n        if (this._delayedActiveCellChangeHandler !== null) {\n            // Avoid race condition due to `activeCellChanged` and `selectionChanged`\n            // signals firing in short sequence when selection gets extended, with\n            // handling of the former having potential to undo selection set by the latter.\n            clearTimeout(this._delayedActiveCellChangeHandler);\n            this._delayedActiveCellChangeHandler = null;\n        }\n        await this._updateCellSelection();\n        if (this._currentProviderIndex === null) {\n            // For consistency we set the first cell in selection as current provider.\n            const firstSelectedCellIndex = this.widget.content.widgets.findIndex(cell => this.widget.content.isSelectedOrActive(cell));\n            this._currentProviderIndex = firstSelectedCellIndex;\n        }\n        await this._ensureCurrentMatch();\n    }\n    async _updateCellSelection() {\n        const cells = this.widget.content.widgets;\n        let selectedCells = 0;\n        await Promise.all(cells.map(async (cell, index) => {\n            const provider = this._searchProviders[index];\n            const isSelected = this.widget.content.isSelectedOrActive(cell);\n            if (isSelected) {\n                selectedCells += 1;\n            }\n            if (provider && this._onSelection) {\n                await provider.setIsActive(isSelected);\n            }\n        }));\n        if (selectedCells !== this._selectedCells) {\n            this._selectedCells = selectedCells;\n            this._updateSelectionMode();\n        }\n        this._filtersChanged.emit();\n    }\n}\n//# sourceMappingURL=searchprovider.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/searchprovider.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/toc.js":
/*!*******************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/toc.js ***!
  \*******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   NotebookToCFactory: () => (/* binding */ NotebookToCFactory),\n/* harmony export */   NotebookToCModel: () => (/* binding */ NotebookToCModel),\n/* harmony export */   RunningStatus: () => (/* binding */ RunningStatus),\n/* harmony export */   getIdForHeading: () => (/* binding */ getIdForHeading)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/cells */ \"webpack/sharing/consume/default/@jupyterlab/cells/@jupyterlab/cells\");\n/* harmony import */ var _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_toc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/toc */ \"webpack/sharing/consume/default/@jupyterlab/toc/@jupyterlab/toc\");\n/* harmony import */ var _jupyterlab_toc__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_toc__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./actions */ \"../node_modules/@jupyterlab/notebook/lib/actions.js\");\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n\n\n/**\n * Cell running status\n */\nvar RunningStatus;\n(function (RunningStatus) {\n    /**\n     * Cell is idle\n     */\n    RunningStatus[RunningStatus[\"Idle\"] = -1] = \"Idle\";\n    /**\n     * Cell execution is unsuccessful\n     */\n    RunningStatus[RunningStatus[\"Error\"] = -0.5] = \"Error\";\n    /**\n     * Cell execution is scheduled\n     */\n    RunningStatus[RunningStatus[\"Scheduled\"] = 0] = \"Scheduled\";\n    /**\n     * Cell is running\n     */\n    RunningStatus[RunningStatus[\"Running\"] = 1] = \"Running\";\n})(RunningStatus || (RunningStatus = {}));\n/**\n * Table of content model for Notebook files.\n */\nclass NotebookToCModel extends _jupyterlab_toc__WEBPACK_IMPORTED_MODULE_1__.TableOfContentsModel {\n    /**\n     * Constructor\n     *\n     * @param widget The widget to search in\n     * @param parser Markdown parser\n     * @param sanitizer Sanitizer\n     * @param configuration Default model configuration\n     */\n    constructor(widget, parser, sanitizer, configuration) {\n        super(widget, configuration);\n        this.parser = parser;\n        this.sanitizer = sanitizer;\n        /**\n         * Mapping between configuration options and notebook metadata.\n         *\n         * If it starts with `!`, the boolean value of the configuration option is\n         * opposite to the one stored in metadata.\n         * If it contains `/`, the metadata data is nested.\n         */\n        this.configMetadataMap = {\n            numberHeaders: ['toc-autonumbering', 'toc/number_sections'],\n            numberingH1: ['!toc/skip_h1_title'],\n            baseNumbering: ['toc/base_numbering']\n        };\n        this._runningCells = new Array();\n        this._errorCells = new Array();\n        this._cellToHeadingIndex = new WeakMap();\n        void widget.context.ready.then(() => {\n            // Load configuration from metadata\n            this.setConfiguration({});\n        });\n        this.widget.context.model.metadataChanged.connect(this.onMetadataChanged, this);\n        this.widget.content.activeCellChanged.connect(this.onActiveCellChanged, this);\n        _actions__WEBPACK_IMPORTED_MODULE_2__.NotebookActions.executionScheduled.connect(this.onExecutionScheduled, this);\n        _actions__WEBPACK_IMPORTED_MODULE_2__.NotebookActions.executed.connect(this.onExecuted, this);\n        _actions__WEBPACK_IMPORTED_MODULE_2__.NotebookActions.outputCleared.connect(this.onOutputCleared, this);\n        this.headingsChanged.connect(this.onHeadingsChanged, this);\n    }\n    /**\n     * Type of document supported by the model.\n     *\n     * #### Notes\n     * A `data-document-type` attribute with this value will be set\n     * on the tree view `.jp-TableOfContents-content[data-document-type=\"...\"]`\n     */\n    get documentType() {\n        return 'notebook';\n    }\n    /**\n     * Whether the model gets updated even if the table of contents panel\n     * is hidden or not.\n     */\n    get isAlwaysActive() {\n        return true;\n    }\n    /**\n     * List of configuration options supported by the model.\n     */\n    get supportedOptions() {\n        return [\n            'baseNumbering',\n            'maximalDepth',\n            'numberingH1',\n            'numberHeaders',\n            'includeOutput',\n            'syncCollapseState'\n        ];\n    }\n    /**\n     * Get the headings of a given cell.\n     *\n     * @param cell Cell\n     * @returns The associated headings\n     */\n    getCellHeadings(cell) {\n        const headings = new Array();\n        let headingIndex = this._cellToHeadingIndex.get(cell);\n        if (headingIndex !== undefined) {\n            const candidate = this.headings[headingIndex];\n            headings.push(candidate);\n            while (this.headings[headingIndex - 1] &&\n                this.headings[headingIndex - 1].cellRef === candidate.cellRef) {\n                headingIndex--;\n                headings.unshift(this.headings[headingIndex]);\n            }\n        }\n        return headings;\n    }\n    /**\n     * Dispose the object\n     */\n    dispose() {\n        var _a, _b, _c;\n        if (this.isDisposed) {\n            return;\n        }\n        this.headingsChanged.disconnect(this.onHeadingsChanged, this);\n        (_b = (_a = this.widget.context) === null || _a === void 0 ? void 0 : _a.model) === null || _b === void 0 ? void 0 : _b.metadataChanged.disconnect(this.onMetadataChanged, this);\n        (_c = this.widget.content) === null || _c === void 0 ? void 0 : _c.activeCellChanged.disconnect(this.onActiveCellChanged, this);\n        _actions__WEBPACK_IMPORTED_MODULE_2__.NotebookActions.executionScheduled.disconnect(this.onExecutionScheduled, this);\n        _actions__WEBPACK_IMPORTED_MODULE_2__.NotebookActions.executed.disconnect(this.onExecuted, this);\n        _actions__WEBPACK_IMPORTED_MODULE_2__.NotebookActions.outputCleared.disconnect(this.onOutputCleared, this);\n        this._runningCells.length = 0;\n        this._errorCells.length = 0;\n        super.dispose();\n    }\n    /**\n     * Model configuration setter.\n     *\n     * @param c New configuration\n     */\n    setConfiguration(c) {\n        // Ensure configuration update\n        const metadataConfig = this.loadConfigurationFromMetadata();\n        super.setConfiguration({ ...this.configuration, ...metadataConfig, ...c });\n    }\n    /**\n     * Callback on heading collapse.\n     *\n     * @param options.heading The heading to change state (all headings if not provided)\n     * @param options.collapsed The new collapsed status (toggle existing status if not provided)\n     */\n    toggleCollapse(options) {\n        super.toggleCollapse(options);\n        this.updateRunningStatus(this.headings);\n    }\n    /**\n     * Produce the headings for a document.\n     *\n     * @returns The list of new headings or `null` if nothing needs to be updated.\n     */\n    getHeadings() {\n        const cells = this.widget.content.widgets;\n        const headings = [];\n        const documentLevels = new Array();\n        // Generate headings by iterating through all notebook cells...\n        for (let i = 0; i < cells.length; i++) {\n            const cell = cells[i];\n            const model = cell.model;\n            switch (model.type) {\n                case 'code': {\n                    // Collapsing cells is incompatible with output headings\n                    if (!this.configuration.syncCollapseState &&\n                        this.configuration.includeOutput) {\n                        headings.push(..._jupyterlab_toc__WEBPACK_IMPORTED_MODULE_1__.TableOfContentsUtils.filterHeadings(cell.headings, this.configuration, documentLevels).map(heading => {\n                            return {\n                                ...heading,\n                                cellRef: cell,\n                                collapsed: false,\n                                isRunning: RunningStatus.Idle\n                            };\n                        }));\n                    }\n                    break;\n                }\n                case 'markdown': {\n                    const cellHeadings = _jupyterlab_toc__WEBPACK_IMPORTED_MODULE_1__.TableOfContentsUtils.filterHeadings(cell.headings, this.configuration, documentLevels).map((heading, index) => {\n                        return {\n                            ...heading,\n                            cellRef: cell,\n                            collapsed: false,\n                            isRunning: RunningStatus.Idle\n                        };\n                    });\n                    // If there are multiple headings, only collapse the highest heading (i.e. minimal level)\n                    // consistent with the cell.headingInfo\n                    if (this.configuration.syncCollapseState &&\n                        cell.headingCollapsed) {\n                        const minLevel = Math.min(...cellHeadings.map(h => h.level));\n                        const minHeading = cellHeadings.find(h => h.level === minLevel);\n                        minHeading.collapsed = cell.headingCollapsed;\n                    }\n                    headings.push(...cellHeadings);\n                    break;\n                }\n            }\n            if (headings.length > 0) {\n                this._cellToHeadingIndex.set(cell, headings.length - 1);\n            }\n        }\n        this.updateRunningStatus(headings);\n        return Promise.resolve(headings);\n    }\n    /**\n     * Test if two headings are equal or not.\n     *\n     * @param heading1 First heading\n     * @param heading2 Second heading\n     * @returns Whether the headings are equal.\n     */\n    isHeadingEqual(heading1, heading2) {\n        return (super.isHeadingEqual(heading1, heading2) &&\n            heading1.cellRef === heading2.cellRef);\n    }\n    /**\n     * Read table of content configuration from notebook metadata.\n     *\n     * @returns ToC configuration from metadata\n     */\n    loadConfigurationFromMetadata() {\n        const nbModel = this.widget.content.model;\n        const newConfig = {};\n        if (nbModel) {\n            for (const option in this.configMetadataMap) {\n                const keys = this.configMetadataMap[option];\n                for (const k of keys) {\n                    let key = k;\n                    const negate = key[0] === '!';\n                    if (negate) {\n                        key = key.slice(1);\n                    }\n                    const keyPath = key.split('/');\n                    let value = nbModel.getMetadata(keyPath[0]);\n                    for (let p = 1; p < keyPath.length; p++) {\n                        value = (value !== null && value !== void 0 ? value : {})[keyPath[p]];\n                    }\n                    if (value !== undefined) {\n                        if (typeof value === 'boolean' && negate) {\n                            value = !value;\n                        }\n                        newConfig[option] = value;\n                    }\n                }\n            }\n        }\n        return newConfig;\n    }\n    onActiveCellChanged(notebook, cell) {\n        // Highlight the first title as active (if multiple titles are in the same cell)\n        const activeHeading = this.getCellHeadings(cell)[0];\n        this.setActiveHeading(activeHeading !== null && activeHeading !== void 0 ? activeHeading : null, false);\n    }\n    onHeadingsChanged() {\n        if (this.widget.content.activeCell) {\n            this.onActiveCellChanged(this.widget.content, this.widget.content.activeCell);\n        }\n    }\n    onExecuted(_, args) {\n        this._runningCells.forEach((cell, index) => {\n            var _a;\n            if (cell === args.cell) {\n                this._runningCells.splice(index, 1);\n                const headingIndex = this._cellToHeadingIndex.get(cell);\n                if (headingIndex !== undefined) {\n                    const heading = this.headings[headingIndex];\n                    // when the execution is not successful but errorName is undefined,\n                    // the execution is interrupted by previous cells\n                    if (args.success || ((_a = args.error) === null || _a === void 0 ? void 0 : _a.errorName) === undefined) {\n                        heading.isRunning = RunningStatus.Idle;\n                        return;\n                    }\n                    heading.isRunning = RunningStatus.Error;\n                    if (!this._errorCells.includes(cell)) {\n                        this._errorCells.push(cell);\n                    }\n                }\n            }\n        });\n        this.updateRunningStatus(this.headings);\n        this.stateChanged.emit();\n    }\n    onExecutionScheduled(_, args) {\n        if (!this._runningCells.includes(args.cell)) {\n            this._runningCells.push(args.cell);\n        }\n        this._errorCells.forEach((cell, index) => {\n            if (cell === args.cell) {\n                this._errorCells.splice(index, 1);\n            }\n        });\n        this.updateRunningStatus(this.headings);\n        this.stateChanged.emit();\n    }\n    onOutputCleared(_, args) {\n        this._errorCells.forEach((cell, index) => {\n            if (cell === args.cell) {\n                this._errorCells.splice(index, 1);\n                const headingIndex = this._cellToHeadingIndex.get(cell);\n                if (headingIndex !== undefined) {\n                    const heading = this.headings[headingIndex];\n                    heading.isRunning = RunningStatus.Idle;\n                }\n            }\n        });\n        this.updateRunningStatus(this.headings);\n        this.stateChanged.emit();\n    }\n    onMetadataChanged() {\n        this.setConfiguration({});\n    }\n    updateRunningStatus(headings) {\n        // Update isRunning\n        this._runningCells.forEach((cell, index) => {\n            const headingIndex = this._cellToHeadingIndex.get(cell);\n            if (headingIndex !== undefined) {\n                const heading = this.headings[headingIndex];\n                // Running is prioritized over Scheduled, so if a heading is\n                // running don't change status\n                if (heading.isRunning !== RunningStatus.Running) {\n                    heading.isRunning =\n                        index > 0 ? RunningStatus.Scheduled : RunningStatus.Running;\n                }\n            }\n        });\n        this._errorCells.forEach((cell, index) => {\n            const headingIndex = this._cellToHeadingIndex.get(cell);\n            if (headingIndex !== undefined) {\n                const heading = this.headings[headingIndex];\n                // Running and Scheduled are prioritized over Error, so only if\n                // a heading is idle will it be set to Error\n                if (heading.isRunning === RunningStatus.Idle) {\n                    heading.isRunning = RunningStatus.Error;\n                }\n            }\n        });\n        let globalIndex = 0;\n        while (globalIndex < headings.length) {\n            const heading = headings[globalIndex];\n            globalIndex++;\n            if (heading.collapsed) {\n                const maxIsRunning = Math.max(heading.isRunning, getMaxIsRunning(headings, heading.level));\n                heading.dataset = {\n                    ...heading.dataset,\n                    'data-running': maxIsRunning.toString()\n                };\n            }\n            else {\n                heading.dataset = {\n                    ...heading.dataset,\n                    'data-running': heading.isRunning.toString()\n                };\n            }\n        }\n        function getMaxIsRunning(headings, collapsedLevel) {\n            let maxIsRunning = RunningStatus.Idle;\n            while (globalIndex < headings.length) {\n                const heading = headings[globalIndex];\n                heading.dataset = {\n                    ...heading.dataset,\n                    'data-running': heading.isRunning.toString()\n                };\n                if (heading.level > collapsedLevel) {\n                    globalIndex++;\n                    maxIsRunning = Math.max(heading.isRunning, maxIsRunning);\n                    if (heading.collapsed) {\n                        maxIsRunning = Math.max(maxIsRunning, getMaxIsRunning(headings, heading.level));\n                        heading.dataset = {\n                            ...heading.dataset,\n                            'data-running': maxIsRunning.toString()\n                        };\n                    }\n                }\n                else {\n                    break;\n                }\n            }\n            return maxIsRunning;\n        }\n    }\n}\n/**\n * Table of content model factory for Notebook files.\n */\nclass NotebookToCFactory extends _jupyterlab_toc__WEBPACK_IMPORTED_MODULE_1__.TableOfContentsFactory {\n    /**\n     * Constructor\n     *\n     * @param tracker Widget tracker\n     * @param parser Markdown parser\n     * @param sanitizer Sanitizer\n     */\n    constructor(tracker, parser, sanitizer) {\n        super(tracker);\n        this.parser = parser;\n        this.sanitizer = sanitizer;\n        this._scrollToTop = true;\n    }\n    /**\n     * Whether to scroll the active heading to the top\n     * of the document or not.\n     */\n    get scrollToTop() {\n        return this._scrollToTop;\n    }\n    set scrollToTop(v) {\n        this._scrollToTop = v;\n    }\n    /**\n     * Create a new table of contents model for the widget\n     *\n     * @param widget - widget\n     * @param configuration - Table of contents configuration\n     * @returns The table of contents model\n     */\n    _createNew(widget, configuration) {\n        const model = new NotebookToCModel(widget, this.parser, this.sanitizer, configuration);\n        // Connect model signals to notebook panel\n        let headingToElement = new WeakMap();\n        const onActiveHeadingChanged = (model, heading) => {\n            if (heading) {\n                const onCellInViewport = async (cell) => {\n                    if (!cell.inViewport) {\n                        // Bail early\n                        return;\n                    }\n                    const el = headingToElement.get(heading);\n                    if (el) {\n                        if (this.scrollToTop) {\n                            el.scrollIntoView({ block: 'start' });\n                        }\n                        else {\n                            const widgetBox = widget.content.node.getBoundingClientRect();\n                            const elementBox = el.getBoundingClientRect();\n                            if (elementBox.top > widgetBox.bottom ||\n                                elementBox.bottom < widgetBox.top) {\n                                el.scrollIntoView({ block: 'center' });\n                            }\n                        }\n                    }\n                    else {\n                        console.debug('scrolling to heading: using fallback strategy');\n                        await widget.content.scrollToItem(widget.content.activeCellIndex, this.scrollToTop ? 'start' : undefined, 0);\n                    }\n                };\n                const cell = heading.cellRef;\n                const cells = widget.content.widgets;\n                const idx = cells.indexOf(cell);\n                // Switch to command mode to avoid entering Markdown cell in edit mode\n                // if the document was in edit mode\n                if (cell.model.type == 'markdown' && widget.content.mode != 'command') {\n                    widget.content.mode = 'command';\n                }\n                widget.content.activeCellIndex = idx;\n                if (cell.inViewport) {\n                    onCellInViewport(cell).catch(reason => {\n                        console.error(`Fail to scroll to cell to display the required heading (${reason}).`);\n                    });\n                }\n                else {\n                    widget.content\n                        .scrollToItem(idx, this.scrollToTop ? 'start' : undefined)\n                        .then(() => {\n                        return onCellInViewport(cell);\n                    })\n                        .catch(reason => {\n                        console.error(`Fail to scroll to cell to display the required heading (${reason}).`);\n                    });\n                }\n            }\n        };\n        const findHeadingElement = (cell) => {\n            model.getCellHeadings(cell).forEach(async (heading) => {\n                var _a, _b;\n                const elementId = await getIdForHeading(heading, this.parser, this.sanitizer);\n                const selector = elementId\n                    ? `h${heading.level}[id=\"${CSS.escape(elementId)}\"]`\n                    : `h${heading.level}`;\n                if (heading.outputIndex !== undefined) {\n                    // Code cell\n                    headingToElement.set(heading, _jupyterlab_toc__WEBPACK_IMPORTED_MODULE_1__.TableOfContentsUtils.addPrefix(heading.cellRef.outputArea.widgets[heading.outputIndex].node, selector, (_a = heading.prefix) !== null && _a !== void 0 ? _a : ''));\n                }\n                else {\n                    headingToElement.set(heading, _jupyterlab_toc__WEBPACK_IMPORTED_MODULE_1__.TableOfContentsUtils.addPrefix(heading.cellRef.node, selector, (_b = heading.prefix) !== null && _b !== void 0 ? _b : ''));\n                }\n            });\n        };\n        const onHeadingsChanged = (model) => {\n            if (!this.parser) {\n                return;\n            }\n            // Clear all numbering items\n            _jupyterlab_toc__WEBPACK_IMPORTED_MODULE_1__.TableOfContentsUtils.clearNumbering(widget.content.node);\n            // Create a new mapping\n            headingToElement = new WeakMap();\n            widget.content.widgets.forEach(cell => {\n                findHeadingElement(cell);\n            });\n        };\n        const onHeadingCollapsed = (_, heading) => {\n            var _a, _b, _c, _d;\n            if (model.configuration.syncCollapseState) {\n                if (heading !== null) {\n                    const cell = heading.cellRef;\n                    if (cell.headingCollapsed !== ((_a = heading.collapsed) !== null && _a !== void 0 ? _a : false)) {\n                        cell.headingCollapsed = (_b = heading.collapsed) !== null && _b !== void 0 ? _b : false;\n                    }\n                }\n                else {\n                    const collapseState = (_d = (_c = model.headings[0]) === null || _c === void 0 ? void 0 : _c.collapsed) !== null && _d !== void 0 ? _d : false;\n                    widget.content.widgets.forEach(cell => {\n                        if (cell instanceof _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__.MarkdownCell) {\n                            if (cell.headingInfo.level >= 0) {\n                                cell.headingCollapsed = collapseState;\n                            }\n                        }\n                    });\n                }\n            }\n        };\n        const onCellCollapsed = (_, cell) => {\n            if (model.configuration.syncCollapseState) {\n                const h = model.getCellHeadings(cell)[0];\n                if (h) {\n                    model.toggleCollapse({\n                        heading: h,\n                        collapsed: cell.headingCollapsed\n                    });\n                }\n            }\n        };\n        const onCellInViewportChanged = (_, cell) => {\n            if (cell.inViewport) {\n                findHeadingElement(cell);\n            }\n            else {\n                // Needed to remove prefix in cell outputs\n                _jupyterlab_toc__WEBPACK_IMPORTED_MODULE_1__.TableOfContentsUtils.clearNumbering(cell.node);\n            }\n        };\n        void widget.context.ready.then(() => {\n            onHeadingsChanged(model);\n            model.activeHeadingChanged.connect(onActiveHeadingChanged);\n            model.headingsChanged.connect(onHeadingsChanged);\n            model.collapseChanged.connect(onHeadingCollapsed);\n            widget.content.cellCollapsed.connect(onCellCollapsed);\n            widget.content.cellInViewportChanged.connect(onCellInViewportChanged);\n            widget.disposed.connect(() => {\n                model.activeHeadingChanged.disconnect(onActiveHeadingChanged);\n                model.headingsChanged.disconnect(onHeadingsChanged);\n                model.collapseChanged.disconnect(onHeadingCollapsed);\n                widget.content.cellCollapsed.disconnect(onCellCollapsed);\n                widget.content.cellInViewportChanged.disconnect(onCellInViewportChanged);\n            });\n        });\n        return model;\n    }\n}\n/**\n * Get the element id for an heading\n * @param heading Heading\n * @param parser The markdownparser\n * @returns The element id\n */\nasync function getIdForHeading(heading, parser, sanitizer) {\n    let elementId = null;\n    if (heading.type === _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__.Cell.HeadingType.Markdown) {\n        elementId = await _jupyterlab_toc__WEBPACK_IMPORTED_MODULE_1__.TableOfContentsUtils.Markdown.getHeadingId(parser, \n        // Type from TableOfContentsUtils.Markdown.IMarkdownHeading\n        heading.raw, heading.level, sanitizer);\n    }\n    else if (heading.type === _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__.Cell.HeadingType.HTML) {\n        // Type from TableOfContentsUtils.IHTMLHeading\n        elementId = heading.id;\n    }\n    return elementId;\n}\n//# sourceMappingURL=toc.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/toc.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/tokens.js":
/*!**********************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/tokens.js ***!
  \**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   INotebookCellExecutor: () => (/* binding */ INotebookCellExecutor),\n/* harmony export */   INotebookTools: () => (/* binding */ INotebookTools),\n/* harmony export */   INotebookTracker: () => (/* binding */ INotebookTracker),\n/* harmony export */   INotebookWidgetFactory: () => (/* binding */ INotebookWidgetFactory)\n/* harmony export */ });\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/coreutils */ \"webpack/sharing/consume/default/@lumino/coreutils/@lumino/coreutils\");\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__);\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n/**\n * The notebook widget factory token.\n */\nconst INotebookWidgetFactory = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.Token('@jupyterlab/notebook:INotebookWidgetFactory', 'A service to create the notebook viewer.');\n/**\n * The notebook tools token.\n */\nconst INotebookTools = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.Token('@jupyterlab/notebook:INotebookTools', `A service for the \"Notebook Tools\" panel in the\n  right sidebar. Use this to add your own functionality to the panel.`);\n/**\n * The notebook tracker token.\n */\nconst INotebookTracker = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.Token('@jupyterlab/notebook:INotebookTracker', `A widget tracker for notebooks.\n  Use this if you want to be able to iterate over and interact with notebooks\n  created by the application.`);\n/**\n * The notebook cell executor token.\n */\nconst INotebookCellExecutor = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.Token('@jupyterlab/notebook:INotebookCellExecutor', `The notebook cell executor`);\n//# sourceMappingURL=tokens.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/tokens.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/tracker.js":
/*!***********************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/tracker.js ***!
  \***********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   NotebookTracker: () => (/* binding */ NotebookTracker)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/apputils */ \"webpack/sharing/consume/default/@jupyterlab/apputils/@jupyterlab/apputils\");\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/signaling */ \"webpack/sharing/consume/default/@lumino/signaling/@lumino/signaling\");\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_lumino_signaling__WEBPACK_IMPORTED_MODULE_1__);\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n\nclass NotebookTracker extends _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.WidgetTracker {\n    constructor() {\n        super(...arguments);\n        this._activeCell = null;\n        this._activeCellChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__.Signal(this);\n        this._selectionChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__.Signal(this);\n    }\n    /**\n     * The currently focused cell.\n     *\n     * #### Notes\n     * This is a read-only property. If there is no cell with the focus, then this\n     * value is `null`.\n     */\n    get activeCell() {\n        const widget = this.currentWidget;\n        if (!widget) {\n            return null;\n        }\n        return widget.content.activeCell || null;\n    }\n    /**\n     * A signal emitted when the current active cell changes.\n     *\n     * #### Notes\n     * If there is no cell with the focus, then `null` will be emitted.\n     */\n    get activeCellChanged() {\n        return this._activeCellChanged;\n    }\n    /**\n     * A signal emitted when the selection state changes.\n     */\n    get selectionChanged() {\n        return this._selectionChanged;\n    }\n    /**\n     * Add a new notebook panel to the tracker.\n     *\n     * @param panel - The notebook panel being added.\n     */\n    add(panel) {\n        const promise = super.add(panel);\n        panel.content.activeCellChanged.connect(this._onActiveCellChanged, this);\n        panel.content.selectionChanged.connect(this._onSelectionChanged, this);\n        return promise;\n    }\n    /**\n     * Dispose of the resources held by the tracker.\n     */\n    dispose() {\n        this._activeCell = null;\n        super.dispose();\n    }\n    /**\n     * Handle the current change event.\n     */\n    onCurrentChanged(widget) {\n        // Store an internal reference to active cell to prevent false positives.\n        const activeCell = this.activeCell;\n        if (activeCell && activeCell === this._activeCell) {\n            return;\n        }\n        this._activeCell = activeCell;\n        if (!widget) {\n            return;\n        }\n        // Since the notebook has changed, immediately signal an active cell change\n        this._activeCellChanged.emit(widget.content.activeCell || null);\n    }\n    _onActiveCellChanged(sender, cell) {\n        // Check if the active cell change happened for the current notebook.\n        if (this.currentWidget && this.currentWidget.content === sender) {\n            this._activeCell = cell || null;\n            this._activeCellChanged.emit(this._activeCell);\n        }\n    }\n    _onSelectionChanged(sender) {\n        // Check if the selection change happened for the current notebook.\n        if (this.currentWidget && this.currentWidget.content === sender) {\n            this._selectionChanged.emit(void 0);\n        }\n    }\n}\n//# sourceMappingURL=tracker.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/tracker.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/truststatus.js":
/*!***************************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/truststatus.js ***!
  \***************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   NotebookTrustStatus: () => (/* binding */ NotebookTrustStatus)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/translation */ \"webpack/sharing/consume/default/@jupyterlab/translation/@jupyterlab/translation\");\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__ = __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_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ \"webpack/sharing/consume/default/react/react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);\n/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\n\n\nconst TRUST_CLASS = 'jp-StatusItem-trust';\n/**\n * Determine the notebook trust status message.\n */\nfunction cellTrust(props, translator) {\n    translator = translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_0__.nullTranslator;\n    const trans = translator.load('jupyterlab');\n    if (props.trustedCells === props.totalCells) {\n        return trans.__('Notebook trusted: %1 of %2 code cells trusted.', props.trustedCells, props.totalCells);\n    }\n    else if (props.activeCellTrusted) {\n        return trans.__('Active cell trusted: %1 of %2 code cells trusted.', props.trustedCells, props.totalCells);\n    }\n    else {\n        return trans.__('Notebook not trusted: %1 of %2 code cells trusted.', props.trustedCells, props.totalCells);\n    }\n}\n/**\n * A pure function for a notebook trust status component.\n *\n * @param props the props for the component.\n *\n * @returns a tsx component for notebook trust.\n */\nfunction NotebookTrustComponent(props) {\n    if (props.allCellsTrusted) {\n        return react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__.trustedIcon.react, { top: '2px', stylesheet: 'statusBar' });\n    }\n    else {\n        return react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__.notTrustedIcon.react, { top: '2px', stylesheet: 'statusBar' });\n    }\n}\n/**\n * The NotebookTrust status item.\n */\nclass NotebookTrustStatus extends _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__.VDomRenderer {\n    /**\n     * Construct a new status item.\n     */\n    constructor(translator) {\n        super(new NotebookTrustStatus.Model());\n        this.translator = translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_0__.nullTranslator;\n        this.node.classList.add(TRUST_CLASS);\n    }\n    /**\n     * Render the NotebookTrust status item.\n     */\n    render() {\n        if (!this.model) {\n            return null;\n        }\n        const newTitle = cellTrust(this.model, this.translator);\n        if (newTitle !== this.node.title) {\n            this.node.title = newTitle;\n        }\n        return (react__WEBPACK_IMPORTED_MODULE_2___default().createElement(NotebookTrustComponent, { allCellsTrusted: this.model.trustedCells === this.model.totalCells, activeCellTrusted: this.model.activeCellTrusted, totalCells: this.model.totalCells, trustedCells: this.model.trustedCells }));\n    }\n}\n/**\n * A namespace for NotebookTrust statics.\n */\n(function (NotebookTrustStatus) {\n    /**\n     * A VDomModel for the NotebookTrust status item.\n     */\n    class Model extends _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__.VDomModel {\n        constructor() {\n            super(...arguments);\n            this._trustedCells = 0;\n            this._totalCells = 0;\n            this._activeCellTrusted = false;\n            this._notebook = null;\n        }\n        /**\n         * The number of trusted code cells in the current notebook.\n         */\n        get trustedCells() {\n            return this._trustedCells;\n        }\n        /**\n         * The total number of code cells in the current notebook.\n         */\n        get totalCells() {\n            return this._totalCells;\n        }\n        /**\n         * Whether the active cell is trusted.\n         */\n        get activeCellTrusted() {\n            return this._activeCellTrusted;\n        }\n        /**\n         * The current notebook for the model.\n         */\n        get notebook() {\n            return this._notebook;\n        }\n        set notebook(model) {\n            const oldNotebook = this._notebook;\n            if (oldNotebook !== null) {\n                oldNotebook.activeCellChanged.disconnect(this._onActiveCellChanged, this);\n                oldNotebook.modelContentChanged.disconnect(this._onModelChanged, this);\n            }\n            const oldState = this._getAllState();\n            this._notebook = model;\n            if (this._notebook === null) {\n                this._trustedCells = 0;\n                this._totalCells = 0;\n                this._activeCellTrusted = false;\n            }\n            else {\n                // Add listeners\n                this._notebook.activeCellChanged.connect(this._onActiveCellChanged, this);\n                this._notebook.modelContentChanged.connect(this._onModelChanged, this);\n                // Derive values\n                if (this._notebook.activeCell) {\n                    this._activeCellTrusted = this._notebook.activeCell.model.trusted;\n                }\n                else {\n                    this._activeCellTrusted = false;\n                }\n                const { total, trusted } = this._deriveCellTrustState(this._notebook.model);\n                this._totalCells = total;\n                this._trustedCells = trusted;\n            }\n            this._triggerChange(oldState, this._getAllState());\n        }\n        /**\n         * When the notebook model changes, update the trust state.\n         */\n        _onModelChanged(notebook) {\n            const oldState = this._getAllState();\n            const { total, trusted } = this._deriveCellTrustState(notebook.model);\n            this._totalCells = total;\n            this._trustedCells = trusted;\n            this._triggerChange(oldState, this._getAllState());\n        }\n        /**\n         * When the active cell changes, update the trust state.\n         */\n        _onActiveCellChanged(model, cell) {\n            const oldState = this._getAllState();\n            if (cell) {\n                this._activeCellTrusted = cell.model.trusted;\n            }\n            else {\n                this._activeCellTrusted = false;\n            }\n            this._triggerChange(oldState, this._getAllState());\n        }\n        /**\n         * Given a notebook model, figure out how many of the code cells are trusted.\n         */\n        _deriveCellTrustState(model) {\n            if (model === null) {\n                return { total: 0, trusted: 0 };\n            }\n            let total = 0;\n            let trusted = 0;\n            for (const cell of model.cells) {\n                if (cell.type !== 'code') {\n                    continue;\n                }\n                total++;\n                if (cell.trusted) {\n                    trusted++;\n                }\n            }\n            return { total, trusted };\n        }\n        /**\n         * Get the current state of the model.\n         */\n        _getAllState() {\n            return [this._trustedCells, this._totalCells, this.activeCellTrusted];\n        }\n        /**\n         * Trigger a change in the renderer.\n         */\n        _triggerChange(oldState, newState) {\n            if (oldState[0] !== newState[0] ||\n                oldState[1] !== newState[1] ||\n                oldState[2] !== newState[2]) {\n                this.stateChanged.emit(void 0);\n            }\n        }\n    }\n    NotebookTrustStatus.Model = Model;\n})(NotebookTrustStatus || (NotebookTrustStatus = {}));\n//# sourceMappingURL=truststatus.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/truststatus.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/widget.js":
/*!**********************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/widget.js ***!
  \**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   Notebook: () => (/* binding */ Notebook),\n/* harmony export */   StaticNotebook: () => (/* binding */ StaticNotebook)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/apputils */ \"webpack/sharing/consume/default/@jupyterlab/apputils/@jupyterlab/apputils\");\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/cells */ \"webpack/sharing/consume/default/@jupyterlab/cells/@jupyterlab/cells\");\n/* harmony import */ var _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _jupyterlab_codeeditor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyterlab/codeeditor */ \"webpack/sharing/consume/default/@jupyterlab/codeeditor/@jupyterlab/codeeditor\");\n/* harmony import */ var _jupyterlab_codeeditor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_codeeditor__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _jupyterlab_toc__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @jupyterlab/toc */ \"webpack/sharing/consume/default/@jupyterlab/toc/@jupyterlab/toc\");\n/* harmony import */ var _jupyterlab_toc__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_toc__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @jupyterlab/translation */ \"webpack/sharing/consume/default/@jupyterlab/translation/@jupyterlab/translation\");\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_5__ = __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_5___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @lumino/algorithm */ \"webpack/sharing/consume/default/@lumino/algorithm/@lumino/algorithm\");\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @lumino/coreutils */ \"webpack/sharing/consume/default/@lumino/coreutils/@lumino/coreutils\");\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _lumino_domutils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @lumino/domutils */ \"webpack/sharing/consume/default/@lumino/domutils/@lumino/domutils\");\n/* harmony import */ var _lumino_domutils__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_lumino_domutils__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var _lumino_dragdrop__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @lumino/dragdrop */ \"webpack/sharing/consume/default/@lumino/dragdrop/@lumino/dragdrop\");\n/* harmony import */ var _lumino_dragdrop__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_lumino_dragdrop__WEBPACK_IMPORTED_MODULE_9__);\n/* harmony import */ var _lumino_properties__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @lumino/properties */ \"webpack/sharing/consume/default/@lumino/properties/@lumino/properties\");\n/* harmony import */ var _lumino_properties__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_lumino_properties__WEBPACK_IMPORTED_MODULE_10__);\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @lumino/signaling */ \"webpack/sharing/consume/default/@lumino/signaling/@lumino/signaling\");\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_lumino_signaling__WEBPACK_IMPORTED_MODULE_11__);\n/* harmony import */ var _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @lumino/virtualdom */ \"webpack/sharing/consume/default/@lumino/virtualdom/@lumino/virtualdom\");\n/* harmony import */ var _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__);\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @lumino/widgets */ \"webpack/sharing/consume/default/@lumino/widgets/@lumino/widgets\");\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_lumino_widgets__WEBPACK_IMPORTED_MODULE_13__);\n/* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./actions */ \"../node_modules/@jupyterlab/notebook/lib/actions.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./constants */ \"../node_modules/@jupyterlab/notebook/lib/constants.js\");\n/* harmony import */ var _windowing__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./windowing */ \"../node_modules/@jupyterlab/notebook/lib/windowing.js\");\n/* harmony import */ var _notebookfooter__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./notebookfooter */ \"../node_modules/@jupyterlab/notebook/lib/notebookfooter.js\");\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\n\n\n\n/**\n * The data attribute added to a widget that has an active kernel.\n */\nconst KERNEL_USER = 'jpKernelUser';\n/**\n * The data attribute added to a widget that can run code.\n */\nconst CODE_RUNNER = 'jpCodeRunner';\n/**\n * The data attribute added to a widget that can undo.\n */\nconst UNDOER = 'jpUndoer';\n/**\n * The class name added to notebook widgets.\n */\nconst NB_CLASS = 'jp-Notebook';\n/**\n * The class name added to notebook widget cells.\n */\nconst NB_CELL_CLASS = 'jp-Notebook-cell';\n/**\n * The class name added to a notebook in edit mode.\n */\nconst EDIT_CLASS = 'jp-mod-editMode';\n/**\n * The class name added to a notebook in command mode.\n */\nconst COMMAND_CLASS = 'jp-mod-commandMode';\n/**\n * The class name added to the active cell.\n */\nconst ACTIVE_CLASS = 'jp-mod-active';\n/**\n * The class name added to selected cells.\n */\nconst SELECTED_CLASS = 'jp-mod-selected';\n/**\n * The class name added to an active cell when there are other selected cells.\n */\nconst OTHER_SELECTED_CLASS = 'jp-mod-multiSelected';\n/**\n * The class name added to unconfined images.\n */\nconst UNCONFINED_CLASS = 'jp-mod-unconfined';\n/**\n * The class name added to the notebook when an element within it is focused\n * and takes keyboard input, such as focused <input> or <div contenteditable>.\n *\n * This class is also effective when the focused element is in shadow DOM.\n */\nconst READ_WRITE_CLASS = 'jp-mod-readWrite';\n/**\n * The class name added to drag images.\n */\nconst DRAG_IMAGE_CLASS = 'jp-dragImage';\n/**\n * The class name added to singular drag images\n */\nconst SINGLE_DRAG_IMAGE_CLASS = 'jp-dragImage-singlePrompt';\n/**\n * The class name added to the drag image cell content.\n */\nconst CELL_DRAG_CONTENT_CLASS = 'jp-dragImage-content';\n/**\n * The class name added to the drag image cell content.\n */\nconst CELL_DRAG_PROMPT_CLASS = 'jp-dragImage-prompt';\n/**\n * The class name added to the drag image cell content.\n */\nconst CELL_DRAG_MULTIPLE_BACK = 'jp-dragImage-multipleBack';\n/**\n * The mimetype used for Jupyter cell data.\n */\nconst JUPYTER_CELL_MIME = 'application/vnd.jupyter.cells';\n/**\n * The threshold in pixels to start a drag event.\n */\nconst DRAG_THRESHOLD = 5;\n/**\n * Maximal remaining time for idle callback\n *\n * Ref: https://developer.mozilla.org/en-US/docs/Web/API/Background_Tasks_API#getting_the_most_out_of_idle_callbacks\n */\nconst MAXIMUM_TIME_REMAINING = 50;\n/**\n * The class attached to the heading collapser button\n */\nconst HEADING_COLLAPSER_CLASS = 'jp-collapseHeadingButton';\n/**\n * The class that controls the visibility of \"heading collapser\" and \"show hidden cells\" buttons.\n */\nconst HEADING_COLLAPSER_VISBILITY_CONTROL_CLASS = 'jp-mod-showHiddenCellsButton';\nconst SIDE_BY_SIDE_CLASS = 'jp-mod-sideBySide';\nif (window.requestIdleCallback === undefined) {\n    // On Safari, requestIdleCallback is not available, so we use replacement functions for `idleCallbacks`\n    // See: https://developer.mozilla.org/en-US/docs/Web/API/Background_Tasks_API#falling_back_to_settimeout\n    // eslint-disable-next-line @typescript-eslint/ban-types\n    window.requestIdleCallback = function (handler) {\n        let startTime = Date.now();\n        return setTimeout(function () {\n            handler({\n                didTimeout: false,\n                timeRemaining: function () {\n                    return Math.max(0, 50.0 - (Date.now() - startTime));\n                }\n            });\n        }, 1);\n    };\n    window.cancelIdleCallback = function (id) {\n        clearTimeout(id);\n    };\n}\n/**\n * A widget which renders static non-interactive notebooks.\n *\n * #### Notes\n * The widget model must be set separately and can be changed\n * at any time.  Consumers of the widget must account for a\n * `null` model, and may want to listen to the `modelChanged`\n * signal.\n */\nclass StaticNotebook extends _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_5__.WindowedList {\n    /**\n     * Construct a notebook widget.\n     */\n    constructor(options) {\n        var _a, _b, _c, _d, _e, _f;\n        const cells = new Array();\n        const windowingActive = ((_b = (_a = options.notebookConfig) === null || _a === void 0 ? void 0 : _a.windowingMode) !== null && _b !== void 0 ? _b : StaticNotebook.defaultNotebookConfig.windowingMode) === 'full';\n        super({\n            model: new _windowing__WEBPACK_IMPORTED_MODULE_14__.NotebookViewModel(cells, {\n                overscanCount: (_d = (_c = options.notebookConfig) === null || _c === void 0 ? void 0 : _c.overscanCount) !== null && _d !== void 0 ? _d : StaticNotebook.defaultNotebookConfig.overscanCount,\n                windowingActive\n            }),\n            layout: new _windowing__WEBPACK_IMPORTED_MODULE_14__.NotebookWindowedLayout(),\n            renderer: (_e = options.renderer) !== null && _e !== void 0 ? _e : _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_5__.WindowedList.defaultRenderer,\n            scrollbar: false\n        });\n        this._cellCollapsed = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_11__.Signal(this);\n        this._cellInViewportChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_11__.Signal(this);\n        this._renderingLayoutChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_11__.Signal(this);\n        this.addClass(NB_CLASS);\n        this.cellsArray = cells;\n        this._idleCallBack = null;\n        this._editorConfig = StaticNotebook.defaultEditorConfig;\n        this._notebookConfig = StaticNotebook.defaultNotebookConfig;\n        this._mimetype = _jupyterlab_codeeditor__WEBPACK_IMPORTED_MODULE_2__.IEditorMimeTypeService.defaultMimeType;\n        this._notebookModel = null;\n        this._modelChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_11__.Signal(this);\n        this._modelContentChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_11__.Signal(this);\n        this.node.dataset[KERNEL_USER] = 'true';\n        this.node.dataset[UNDOER] = 'true';\n        this.node.dataset[CODE_RUNNER] = 'true';\n        this.rendermime = options.rendermime;\n        this.translator = options.translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__.nullTranslator;\n        this.contentFactory = options.contentFactory;\n        this.editorConfig =\n            options.editorConfig || StaticNotebook.defaultEditorConfig;\n        this.notebookConfig =\n            options.notebookConfig || StaticNotebook.defaultNotebookConfig;\n        this._updateNotebookConfig();\n        this._mimetypeService = options.mimeTypeService;\n        this.renderingLayout = (_f = options.notebookConfig) === null || _f === void 0 ? void 0 : _f.renderingLayout;\n        this.kernelHistory = options.kernelHistory;\n    }\n    get cellCollapsed() {\n        return this._cellCollapsed;\n    }\n    get cellInViewportChanged() {\n        return this._cellInViewportChanged;\n    }\n    /**\n     * A signal emitted when the model of the notebook changes.\n     */\n    get modelChanged() {\n        return this._modelChanged;\n    }\n    /**\n     * A signal emitted when the model content changes.\n     *\n     * #### Notes\n     * This is a convenience signal that follows the current model.\n     */\n    get modelContentChanged() {\n        return this._modelContentChanged;\n    }\n    /**\n     * A signal emitted when the rendering layout of the notebook changes.\n     */\n    get renderingLayoutChanged() {\n        return this._renderingLayoutChanged;\n    }\n    /**\n     * The model for the widget.\n     */\n    get model() {\n        return this._notebookModel;\n    }\n    set model(newValue) {\n        var _a;\n        newValue = newValue || null;\n        if (this._notebookModel === newValue) {\n            return;\n        }\n        const oldValue = this._notebookModel;\n        this._notebookModel = newValue;\n        // Trigger private, protected, and public changes.\n        this._onModelChanged(oldValue, newValue);\n        this.onModelChanged(oldValue, newValue);\n        this._modelChanged.emit(void 0);\n        // Trigger state change\n        this.viewModel.itemsList = (_a = newValue === null || newValue === void 0 ? void 0 : newValue.cells) !== null && _a !== void 0 ? _a : null;\n    }\n    /**\n     * Get the mimetype for code cells.\n     */\n    get codeMimetype() {\n        return this._mimetype;\n    }\n    /**\n     * A read-only sequence of the widgets in the notebook.\n     */\n    get widgets() {\n        return this.cellsArray;\n    }\n    /**\n     * A configuration object for cell editor settings.\n     */\n    get editorConfig() {\n        return this._editorConfig;\n    }\n    set editorConfig(value) {\n        this._editorConfig = value;\n        this._updateEditorConfig();\n    }\n    /**\n     * A configuration object for notebook settings.\n     */\n    get notebookConfig() {\n        return this._notebookConfig;\n    }\n    set notebookConfig(value) {\n        this._notebookConfig = value;\n        this._updateNotebookConfig();\n    }\n    get renderingLayout() {\n        return this._renderingLayout;\n    }\n    set renderingLayout(value) {\n        var _a;\n        this._renderingLayout = value;\n        if (this._renderingLayout === 'side-by-side') {\n            this.node.classList.add(SIDE_BY_SIDE_CLASS);\n        }\n        else {\n            this.node.classList.remove(SIDE_BY_SIDE_CLASS);\n        }\n        this._renderingLayoutChanged.emit((_a = this._renderingLayout) !== null && _a !== void 0 ? _a : 'default');\n    }\n    /**\n     * Dispose of the resources held by the widget.\n     */\n    dispose() {\n        var _a;\n        // Do nothing if already disposed.\n        if (this.isDisposed) {\n            return;\n        }\n        this._notebookModel = null;\n        (_a = this.layout.header) === null || _a === void 0 ? void 0 : _a.dispose();\n        super.dispose();\n    }\n    /**\n     * Move cells preserving widget view state.\n     *\n     * #### Notes\n     * This is required because at the model level a move is a deletion\n     * followed by an insertion. Hence the view state is not preserved.\n     *\n     * @param from The index of the cell to move\n     * @param to The new index of the cell\n     * @param n Number of cells to move\n     */\n    moveCell(from, to, n = 1) {\n        if (!this.model) {\n            return;\n        }\n        const boundedTo = Math.min(this.model.cells.length - 1, Math.max(0, to));\n        if (boundedTo === from) {\n            return;\n        }\n        const viewModel = new Array(n);\n        let dirtyState = new Array(n);\n        for (let i = 0; i < n; i++) {\n            viewModel[i] = {};\n            const oldCell = this.widgets[from + i];\n            if (oldCell.model.type === 'markdown') {\n                for (const k of ['rendered', 'headingCollapsed']) {\n                    // @ts-expect-error Cell has no index signature\n                    viewModel[i][k] = oldCell[k];\n                }\n            }\n            else if (oldCell.model.type === 'code') {\n                const oldCodeCell = oldCell.model;\n                dirtyState[i] = oldCodeCell.isDirty;\n            }\n        }\n        this.model.sharedModel.moveCells(from, boundedTo, n);\n        for (let i = 0; i < n; i++) {\n            const newCell = this.widgets[to + i];\n            const view = viewModel[i];\n            for (const state in view) {\n                // @ts-expect-error Cell has no index signature\n                newCell[state] = view[state];\n            }\n            if (from > to) {\n                if (this.widgets[to + i].model.type === 'code') {\n                    this.widgets[to + i].model.isDirty = dirtyState[i];\n                }\n            }\n            else {\n                if (this.widgets[to + i - n + 1].model.type === 'code') {\n                    this.widgets[to + i - n + 1].model.isDirty =\n                        dirtyState[i];\n                }\n            }\n        }\n    }\n    /**\n     * Force rendering the cell outputs of a given cell if it is still a placeholder.\n     *\n     * #### Notes\n     * The goal of this method is to allow search on cell outputs (that is based\n     * on DOM tree introspection).\n     *\n     * @param index The cell index\n     */\n    renderCellOutputs(index) {\n        const cell = this.viewModel.widgetRenderer(index);\n        if (cell instanceof _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.CodeCell && cell.isPlaceholder()) {\n            cell.dataset.windowedListIndex = `${index}`;\n            this.layout.insertWidget(index, cell);\n            if (this.notebookConfig.windowingMode === 'full') {\n                // We need to delay slightly the removal to let codemirror properly initialize\n                requestAnimationFrame(() => {\n                    this.layout.removeWidget(cell);\n                });\n            }\n        }\n    }\n    /**\n     * Adds a message to the notebook as a header.\n     */\n    addHeader() {\n        const trans = this.translator.load('jupyterlab');\n        const info = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_13__.Widget();\n        info.node.textContent = trans.__('The notebook is empty. Click the + button on the toolbar to add a new cell.');\n        this.layout.header = info;\n    }\n    /**\n     * Removes the header.\n     */\n    removeHeader() {\n        var _a;\n        (_a = this.layout.header) === null || _a === void 0 ? void 0 : _a.dispose();\n        this.layout.header = null;\n    }\n    /**\n     * Handle a new model.\n     *\n     * #### Notes\n     * This method is called after the model change has been handled\n     * internally and before the `modelChanged` signal is emitted.\n     * The default implementation is a no-op.\n     */\n    onModelChanged(oldValue, newValue) {\n        // No-op.\n    }\n    /**\n     * Handle changes to the notebook model content.\n     *\n     * #### Notes\n     * The default implementation emits the `modelContentChanged` signal.\n     */\n    onModelContentChanged(model, args) {\n        this._modelContentChanged.emit(void 0);\n    }\n    /**\n     * Handle changes to the notebook model metadata.\n     *\n     * #### Notes\n     * The default implementation updates the mimetypes of the code cells\n     * when the `language_info` metadata changes.\n     */\n    onMetadataChanged(sender, args) {\n        switch (args.key) {\n            case 'language_info':\n                this._updateMimetype();\n                break;\n            default:\n                break;\n        }\n    }\n    /**\n     * Handle a cell being inserted.\n     *\n     * The default implementation is a no-op\n     */\n    onCellInserted(index, cell) {\n        // This is a no-op.\n    }\n    /**\n     * Handle a cell being removed.\n     *\n     * The default implementation is a no-op\n     */\n    onCellRemoved(index, cell) {\n        // This is a no-op.\n    }\n    /**\n     * A message handler invoked on an `'update-request'` message.\n     *\n     * #### Notes\n     * The default implementation of this handler is a no-op.\n     */\n    onUpdateRequest(msg) {\n        if (this.notebookConfig.windowingMode === 'defer') {\n            void this._runOnIdleTime();\n        }\n        else {\n            super.onUpdateRequest(msg);\n        }\n    }\n    /**\n     * Handle a new model on the widget.\n     */\n    _onModelChanged(oldValue, newValue) {\n        var _a;\n        if (oldValue) {\n            oldValue.contentChanged.disconnect(this.onModelContentChanged, this);\n            oldValue.metadataChanged.disconnect(this.onMetadataChanged, this);\n            oldValue.cells.changed.disconnect(this._onCellsChanged, this);\n            while (this.cellsArray.length) {\n                this._removeCell(0);\n            }\n        }\n        if (!newValue) {\n            this._mimetype = _jupyterlab_codeeditor__WEBPACK_IMPORTED_MODULE_2__.IEditorMimeTypeService.defaultMimeType;\n            return;\n        }\n        this._updateMimetype();\n        const cells = newValue.cells;\n        const collab = (_a = newValue.collaborative) !== null && _a !== void 0 ? _a : false;\n        if (!collab && !cells.length) {\n            newValue.sharedModel.insertCell(0, {\n                cell_type: this.notebookConfig.defaultCell,\n                metadata: this.notebookConfig.defaultCell === 'code'\n                    ? {\n                        // This is an empty cell created in empty notebook, thus is trusted\n                        trusted: true\n                    }\n                    : {}\n            });\n        }\n        let index = -1;\n        for (const cell of cells) {\n            this._insertCell(++index, cell);\n        }\n        newValue.cells.changed.connect(this._onCellsChanged, this);\n        newValue.metadataChanged.connect(this.onMetadataChanged, this);\n        newValue.contentChanged.connect(this.onModelContentChanged, this);\n    }\n    /**\n     * Handle a change cells event.\n     */\n    _onCellsChanged(sender, args) {\n        this.removeHeader();\n        switch (args.type) {\n            case 'add': {\n                let index = 0;\n                index = args.newIndex;\n                for (const value of args.newValues) {\n                    this._insertCell(index++, value);\n                }\n                this._updateDataWindowedListIndex(args.newIndex, this.model.cells.length, args.newValues.length);\n                break;\n            }\n            case 'remove':\n                for (let length = args.oldValues.length; length > 0; length--) {\n                    this._removeCell(args.oldIndex);\n                }\n                this._updateDataWindowedListIndex(args.oldIndex, this.model.cells.length + args.oldValues.length, -1 * args.oldValues.length);\n                // Add default cell if there are no cells remaining.\n                if (!sender.length) {\n                    const model = this.model;\n                    // Add the cell in a new context to avoid triggering another\n                    // cell changed event during the handling of this signal.\n                    requestAnimationFrame(() => {\n                        if (model && !model.isDisposed && !model.sharedModel.cells.length) {\n                            model.sharedModel.insertCell(0, {\n                                cell_type: this.notebookConfig.defaultCell,\n                                metadata: this.notebookConfig.defaultCell === 'code'\n                                    ? {\n                                        // This is an empty cell created in empty notebook, thus is trusted\n                                        trusted: true\n                                    }\n                                    : {}\n                            });\n                        }\n                    });\n                }\n                break;\n            default:\n                return;\n        }\n        if (!this.model.sharedModel.cells.length) {\n            this.addHeader();\n        }\n        this.update();\n    }\n    /**\n     * Create a cell widget and insert into the notebook.\n     */\n    _insertCell(index, cell) {\n        let widget;\n        switch (cell.type) {\n            case 'code':\n                widget = this._createCodeCell(cell);\n                widget.model.mimeType = this._mimetype;\n                break;\n            case 'markdown':\n                widget = this._createMarkdownCell(cell);\n                if (cell.sharedModel.getSource() === '') {\n                    widget.rendered = false;\n                }\n                break;\n            default:\n                widget = this._createRawCell(cell);\n        }\n        widget.inViewportChanged.connect(this._onCellInViewportChanged, this);\n        widget.addClass(NB_CELL_CLASS);\n        _lumino_algorithm__WEBPACK_IMPORTED_MODULE_6__.ArrayExt.insert(this.cellsArray, index, widget);\n        this.onCellInserted(index, widget);\n        this._scheduleCellRenderOnIdle();\n    }\n    /**\n     * Create a code cell widget from a code cell model.\n     */\n    _createCodeCell(model) {\n        const rendermime = this.rendermime;\n        const contentFactory = this.contentFactory;\n        const editorConfig = this.editorConfig.code;\n        const options = {\n            contentFactory,\n            editorConfig,\n            inputHistoryScope: this.notebookConfig.inputHistoryScope,\n            maxNumberOutputs: this.notebookConfig.maxNumberOutputs,\n            model,\n            placeholder: this._notebookConfig.windowingMode !== 'none',\n            rendermime,\n            translator: this.translator\n        };\n        const cell = this.contentFactory.createCodeCell(options);\n        cell.syncCollapse = true;\n        cell.syncEditable = true;\n        cell.syncScrolled = true;\n        cell.outputArea.inputRequested.connect((_, stdin) => {\n            this._onInputRequested(cell).catch(reason => {\n                console.error('Failed to scroll to cell requesting input.', reason);\n            });\n            stdin.disposed.connect(() => {\n                // The input field is removed from the DOM after the user presses Enter.\n                // This causes focus to be lost if we don't explicitly re-focus\n                // somewhere else.\n                cell.node.focus();\n            });\n        });\n        return cell;\n    }\n    /**\n     * Create a markdown cell widget from a markdown cell model.\n     */\n    _createMarkdownCell(model) {\n        const rendermime = this.rendermime;\n        const contentFactory = this.contentFactory;\n        const editorConfig = this.editorConfig.markdown;\n        const options = {\n            contentFactory,\n            editorConfig,\n            model,\n            placeholder: this._notebookConfig.windowingMode !== 'none',\n            rendermime,\n            showEditorForReadOnlyMarkdown: this._notebookConfig.showEditorForReadOnlyMarkdown\n        };\n        const cell = this.contentFactory.createMarkdownCell(options);\n        cell.syncCollapse = true;\n        cell.syncEditable = true;\n        // Connect collapsed signal for each markdown cell widget\n        cell.headingCollapsedChanged.connect(this._onCellCollapsed, this);\n        return cell;\n    }\n    /**\n     * Create a raw cell widget from a raw cell model.\n     */\n    _createRawCell(model) {\n        const contentFactory = this.contentFactory;\n        const editorConfig = this.editorConfig.raw;\n        const options = {\n            editorConfig,\n            model,\n            contentFactory,\n            placeholder: this._notebookConfig.windowingMode !== 'none'\n        };\n        const cell = this.contentFactory.createRawCell(options);\n        cell.syncCollapse = true;\n        cell.syncEditable = true;\n        return cell;\n    }\n    /**\n     * Remove a cell widget.\n     */\n    _removeCell(index) {\n        const widget = this.cellsArray[index];\n        widget.parent = null;\n        _lumino_algorithm__WEBPACK_IMPORTED_MODULE_6__.ArrayExt.removeAt(this.cellsArray, index);\n        this.onCellRemoved(index, widget);\n        widget.dispose();\n    }\n    /**\n     * Update the mimetype of the notebook.\n     */\n    _updateMimetype() {\n        var _a;\n        const info = (_a = this._notebookModel) === null || _a === void 0 ? void 0 : _a.getMetadata('language_info');\n        if (!info) {\n            return;\n        }\n        this._mimetype = this._mimetypeService.getMimeTypeByLanguage(info);\n        for (const widget of this.widgets) {\n            if (widget.model.type === 'code') {\n                widget.model.mimeType = this._mimetype;\n            }\n        }\n    }\n    /**\n     * Callback when a cell collapsed status changes.\n     *\n     * @param cell Cell changed\n     * @param collapsed New collapsed status\n     */\n    _onCellCollapsed(cell, collapsed) {\n        _actions__WEBPACK_IMPORTED_MODULE_15__.NotebookActions.setHeadingCollapse(cell, collapsed, this);\n        this._cellCollapsed.emit(cell);\n    }\n    /**\n     * Callback when a cell viewport status changes.\n     *\n     * @param cell Cell changed\n     */\n    _onCellInViewportChanged(cell) {\n        this._cellInViewportChanged.emit(cell);\n    }\n    /**\n     * Ensure to load in the DOM a cell requesting an user input\n     *\n     * @param cell Cell requesting an input\n     */\n    async _onInputRequested(cell) {\n        if (!cell.inViewport) {\n            const cellIndex = this.widgets.findIndex(c => c === cell);\n            if (cellIndex >= 0) {\n                await this.scrollToItem(cellIndex);\n                const inputEl = cell.node.querySelector('.jp-Stdin');\n                if (inputEl) {\n                    _lumino_domutils__WEBPACK_IMPORTED_MODULE_8__.ElementExt.scrollIntoViewIfNeeded(this.node, inputEl);\n                    inputEl.focus();\n                }\n            }\n        }\n    }\n    _scheduleCellRenderOnIdle() {\n        if (this.notebookConfig.windowingMode !== 'none' && !this.isDisposed) {\n            if (!this._idleCallBack) {\n                this._idleCallBack = requestIdleCallback((deadline) => {\n                    this._idleCallBack = null;\n                    // In case of timeout, render for some time even if it means freezing the UI\n                    // This avoids the cells to never be loaded.\n                    void this._runOnIdleTime(deadline.didTimeout\n                        ? MAXIMUM_TIME_REMAINING\n                        : deadline.timeRemaining());\n                }, {\n                    timeout: 3000\n                });\n            }\n        }\n    }\n    _updateDataWindowedListIndex(start, end, delta) {\n        for (let cellIdx = 0; cellIdx < this.viewportNode.childElementCount; cellIdx++) {\n            const cell = this.viewportNode.children[cellIdx];\n            const globalIndex = parseInt(cell.dataset.windowedListIndex, 10);\n            if (globalIndex >= start && globalIndex < end) {\n                cell.dataset.windowedListIndex = `${globalIndex + delta}`;\n            }\n        }\n    }\n    /**\n     * Update editor settings for notebook cells.\n     */\n    _updateEditorConfig() {\n        for (let i = 0; i < this.widgets.length; i++) {\n            const cell = this.widgets[i];\n            let config = {};\n            switch (cell.model.type) {\n                case 'code':\n                    config = this._editorConfig.code;\n                    break;\n                case 'markdown':\n                    config = this._editorConfig.markdown;\n                    break;\n                default:\n                    config = this._editorConfig.raw;\n                    break;\n            }\n            cell.updateEditorConfig({ ...config });\n        }\n    }\n    async _runOnIdleTime(remainingTime = MAXIMUM_TIME_REMAINING) {\n        const startTime = Date.now();\n        let cellIdx = 0;\n        while (Date.now() - startTime < remainingTime &&\n            cellIdx < this.cellsArray.length) {\n            const cell = this.cellsArray[cellIdx];\n            if (cell.isPlaceholder()) {\n                if (['defer', 'full'].includes(this.notebookConfig.windowingMode)) {\n                    await this._updateForDeferMode(cell, cellIdx);\n                    if (this.notebookConfig.windowingMode === 'full') {\n                        // We need to delay slightly the removal to let codemirror properly initialize\n                        requestAnimationFrame(() => {\n                            this.viewModel.setEstimatedWidgetSize(cell.model.id, cell.node.getBoundingClientRect().height);\n                            this.layout.removeWidget(cell);\n                        });\n                    }\n                }\n            }\n            cellIdx++;\n        }\n        // If the notebook is not fully rendered\n        if (cellIdx < this.cellsArray.length) {\n            // If we are defering the cell rendering and the rendered cells do\n            // not fill the viewport yet\n            if (this.notebookConfig.windowingMode === 'defer' &&\n                this.viewportNode.clientHeight < this.node.clientHeight) {\n                // Spend more time rendering cells to fill the viewport\n                await this._runOnIdleTime();\n            }\n            else {\n                this._scheduleCellRenderOnIdle();\n            }\n        }\n        else {\n            if (this._idleCallBack) {\n                window.cancelIdleCallback(this._idleCallBack);\n                this._idleCallBack = null;\n            }\n        }\n    }\n    async _updateForDeferMode(cell, cellIdx) {\n        cell.dataset.windowedListIndex = `${cellIdx}`;\n        this.layout.insertWidget(cellIdx, cell);\n        await cell.ready;\n    }\n    /**\n     * Apply updated notebook settings.\n     */\n    _updateNotebookConfig() {\n        // Apply scrollPastEnd setting.\n        this.toggleClass('jp-mod-scrollPastEnd', this._notebookConfig.scrollPastEnd);\n        // Control visibility of heading collapser UI\n        this.toggleClass(HEADING_COLLAPSER_VISBILITY_CONTROL_CLASS, this._notebookConfig.showHiddenCellsButton);\n        // Control editor visibility for read-only Markdown cells\n        const showEditorForReadOnlyMarkdown = this._notebookConfig.showEditorForReadOnlyMarkdown;\n        if (showEditorForReadOnlyMarkdown !== undefined) {\n            for (const cell of this.cellsArray) {\n                if (cell.model.type === 'markdown') {\n                    cell.showEditorForReadOnly =\n                        showEditorForReadOnlyMarkdown;\n                }\n            }\n        }\n        this.viewModel.windowingActive =\n            this._notebookConfig.windowingMode === 'full';\n    }\n}\n/**\n * The namespace for the `StaticNotebook` class statics.\n */\n(function (StaticNotebook) {\n    /**\n     * Default configuration options for cell editors.\n     */\n    StaticNotebook.defaultEditorConfig = {\n        code: {\n            lineNumbers: false,\n            lineWrap: false,\n            matchBrackets: true,\n            tabFocusable: false\n        },\n        markdown: {\n            lineNumbers: false,\n            lineWrap: true,\n            matchBrackets: false,\n            tabFocusable: false\n        },\n        raw: {\n            lineNumbers: false,\n            lineWrap: true,\n            matchBrackets: false,\n            tabFocusable: false\n        }\n    };\n    /**\n     * Default configuration options for notebooks.\n     */\n    StaticNotebook.defaultNotebookConfig = {\n        enableKernelInitNotification: false,\n        showHiddenCellsButton: true,\n        scrollPastEnd: true,\n        defaultCell: 'code',\n        recordTiming: false,\n        inputHistoryScope: 'global',\n        maxNumberOutputs: 50,\n        showEditorForReadOnlyMarkdown: true,\n        disableDocumentWideUndoRedo: true,\n        renderingLayout: 'default',\n        sideBySideLeftMarginOverride: '10px',\n        sideBySideRightMarginOverride: '10px',\n        sideBySideOutputRatio: 1,\n        overscanCount: 1,\n        windowingMode: 'full',\n        accessKernelHistory: false\n    };\n    /**\n     * The default implementation of an `IContentFactory`.\n     */\n    class ContentFactory extends _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.Cell.ContentFactory {\n        /**\n         * Create a new code cell widget.\n         *\n         * #### Notes\n         * If no cell content factory is passed in with the options, the one on the\n         * notebook content factory is used.\n         */\n        createCodeCell(options) {\n            return new _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.CodeCell(options).initializeState();\n        }\n        /**\n         * Create a new markdown cell widget.\n         *\n         * #### Notes\n         * If no cell content factory is passed in with the options, the one on the\n         * notebook content factory is used.\n         */\n        createMarkdownCell(options) {\n            return new _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.MarkdownCell(options).initializeState();\n        }\n        /**\n         * Create a new raw cell widget.\n         *\n         * #### Notes\n         * If no cell content factory is passed in with the options, the one on the\n         * notebook content factory is used.\n         */\n        createRawCell(options) {\n            return new _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.RawCell(options).initializeState();\n        }\n    }\n    StaticNotebook.ContentFactory = ContentFactory;\n})(StaticNotebook || (StaticNotebook = {}));\n/**\n * A notebook widget that supports interactivity.\n */\nclass Notebook extends StaticNotebook {\n    /**\n     * Construct a notebook widget.\n     */\n    constructor(options) {\n        super({\n            renderer: {\n                createOuter() {\n                    return document.createElement('div');\n                },\n                createViewport() {\n                    const el = document.createElement('div');\n                    el.setAttribute('role', 'feed');\n                    el.setAttribute('aria-label', 'Cells');\n                    return el;\n                },\n                createScrollbar() {\n                    return document.createElement('ol');\n                },\n                createScrollbarItem(notebook, index, model) {\n                    const li = document.createElement('li');\n                    li.appendChild(document.createTextNode(`${index + 1}`));\n                    if (notebook.activeCellIndex === index) {\n                        li.classList.add('jp-mod-active');\n                    }\n                    if (notebook.selectedCells.some(cell => model === cell.model)) {\n                        li.classList.add('jp-mod-selected');\n                    }\n                    return li;\n                }\n            },\n            ...options\n        });\n        this._activeCellIndex = -1;\n        this._activeCell = null;\n        this._mode = 'command';\n        this._drag = null;\n        this._dragData = null;\n        this._mouseMode = null;\n        this._activeCellChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_11__.Signal(this);\n        this._stateChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_11__.Signal(this);\n        this._selectionChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_11__.Signal(this);\n        this._checkCacheOnNextResize = false;\n        this._lastClipboardInteraction = null;\n        this._selectedCells = [];\n        // Allow the node to scroll while dragging items.\n        this.outerNode.setAttribute('data-lm-dragscroll', 'true');\n        this.activeCellChanged.connect(this._updateSelectedCells, this);\n        this.jumped.connect((_, index) => (this.activeCellIndex = index));\n        this.selectionChanged.connect(this._updateSelectedCells, this);\n        this.addFooter();\n    }\n    /**\n     * List of selected and active cells\n     */\n    get selectedCells() {\n        return this._selectedCells;\n    }\n    /**\n     * Adds a footer to the notebook.\n     */\n    addFooter() {\n        const info = new _notebookfooter__WEBPACK_IMPORTED_MODULE_16__.NotebookFooter(this);\n        this.layout.footer = info;\n    }\n    /**\n     * Handle a change cells event.\n     */\n    _onCellsChanged(sender, args) {\n        var _a, _b;\n        const activeCellId = (_a = this.activeCell) === null || _a === void 0 ? void 0 : _a.model.id;\n        super._onCellsChanged(sender, args);\n        if (activeCellId) {\n            const newActiveCellIndex = (_b = this.model) === null || _b === void 0 ? void 0 : _b.sharedModel.cells.findIndex(cell => cell.getId() === activeCellId);\n            if (newActiveCellIndex != null) {\n                this.activeCellIndex = newActiveCellIndex;\n            }\n        }\n    }\n    /**\n     * A signal emitted when the active cell changes.\n     *\n     * #### Notes\n     * This can be due to the active index changing or the\n     * cell at the active index changing.\n     */\n    get activeCellChanged() {\n        return this._activeCellChanged;\n    }\n    /**\n     * A signal emitted when the state of the notebook changes.\n     */\n    get stateChanged() {\n        return this._stateChanged;\n    }\n    /**\n     * A signal emitted when the selection state of the notebook changes.\n     */\n    get selectionChanged() {\n        return this._selectionChanged;\n    }\n    /**\n     * The interactivity mode of the notebook.\n     */\n    get mode() {\n        return this._mode;\n    }\n    set mode(newValue) {\n        this.setMode(newValue);\n    }\n    /**\n     * Set the notebook mode.\n     *\n     * @param newValue Notebook mode\n     * @param options Control mode side-effect\n     * @param options.focus Whether to ensure focus (default) or not when setting the mode.\n     */\n    setMode(newValue, options = {}) {\n        var _a;\n        const setFocus = (_a = options.focus) !== null && _a !== void 0 ? _a : true;\n        const activeCell = this.activeCell;\n        if (!activeCell) {\n            newValue = 'command';\n        }\n        if (newValue === this._mode) {\n            if (setFocus) {\n                this._ensureFocus();\n            }\n            return;\n        }\n        // Post an update request.\n        this.update();\n        const oldValue = this._mode;\n        this._mode = newValue;\n        if (newValue === 'edit') {\n            // Edit mode deselects all cells.\n            for (const widget of this.widgets) {\n                this.deselect(widget);\n            }\n            // Edit mode unrenders an active markdown widget.\n            if (activeCell instanceof _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.MarkdownCell) {\n                activeCell.rendered = false;\n            }\n            activeCell.inputHidden = false;\n        }\n        else {\n            if (setFocus) {\n                void _actions__WEBPACK_IMPORTED_MODULE_15__.NotebookActions.focusActiveCell(this, {\n                    // Do not await the active cell because that creates a bug. If the user\n                    // is editing a code cell and presses Accel Shift C to open the command\n                    // palette, then the command palette opens before\n                    // activeCell.node.focus() is called, which closes the command palette.\n                    // To the end user, it looks as if all the keyboard shortcut did was\n                    // move focus from the cell editor to the cell as a whole.\n                    waitUntilReady: false,\n                    preventScroll: true\n                });\n            }\n        }\n        this._stateChanged.emit({ name: 'mode', oldValue, newValue });\n        if (setFocus) {\n            this._ensureFocus();\n        }\n    }\n    /**\n     * The active cell index of the notebook.\n     *\n     * #### Notes\n     * The index will be clamped to the bounds of the notebook cells.\n     */\n    get activeCellIndex() {\n        if (!this.model) {\n            return -1;\n        }\n        return this.widgets.length ? this._activeCellIndex : -1;\n    }\n    set activeCellIndex(newValue) {\n        var _a;\n        const oldValue = this._activeCellIndex;\n        if (!this.model || !this.widgets.length) {\n            newValue = -1;\n        }\n        else {\n            newValue = Math.max(newValue, 0);\n            newValue = Math.min(newValue, this.widgets.length - 1);\n        }\n        this._activeCellIndex = newValue;\n        const cell = (_a = this.widgets[newValue]) !== null && _a !== void 0 ? _a : null;\n        this.layout.activeCell = cell;\n        const cellChanged = cell !== this._activeCell;\n        if (cellChanged) {\n            // Post an update request.\n            this.update();\n            this._activeCell = cell;\n        }\n        if (cellChanged || newValue != oldValue) {\n            this._activeCellChanged.emit(cell);\n        }\n        if (this.mode === 'edit' && cell instanceof _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.MarkdownCell) {\n            cell.rendered = false;\n        }\n        this._ensureFocus();\n        if (newValue === oldValue) {\n            return;\n        }\n        this._trimSelections();\n        this._stateChanged.emit({ name: 'activeCellIndex', oldValue, newValue });\n    }\n    /**\n     * Get the active cell widget.\n     *\n     * #### Notes\n     * This is a cell or `null` if there is no active cell.\n     */\n    get activeCell() {\n        return this._activeCell;\n    }\n    get lastClipboardInteraction() {\n        return this._lastClipboardInteraction;\n    }\n    set lastClipboardInteraction(newValue) {\n        this._lastClipboardInteraction = newValue;\n    }\n    /**\n     * Dispose of the resources held by the widget.\n     */\n    dispose() {\n        if (this.isDisposed) {\n            return;\n        }\n        this._activeCell = null;\n        super.dispose();\n    }\n    /**\n     * Move cells preserving widget view state.\n     *\n     * #### Notes\n     * This is required because at the model level a move is a deletion\n     * followed by an insertion. Hence the view state is not preserved.\n     *\n     * @param from The index of the cell to move\n     * @param to The new index of the cell\n     * @param n Number of cells to move\n     */\n    moveCell(from, to, n = 1) {\n        // Save active cell id to be restored\n        const newActiveCellIndex = from <= this.activeCellIndex && this.activeCellIndex < from + n\n            ? this.activeCellIndex + to - from - (from > to ? 0 : n - 1)\n            : -1;\n        const isSelected = this.widgets\n            .slice(from, from + n)\n            .map(w => this.isSelected(w));\n        super.moveCell(from, to, n);\n        if (newActiveCellIndex >= 0) {\n            this.activeCellIndex = newActiveCellIndex;\n        }\n        if (from > to) {\n            isSelected.forEach((selected, idx) => {\n                if (selected) {\n                    this.select(this.widgets[to + idx]);\n                }\n            });\n        }\n        else {\n            isSelected.forEach((selected, idx) => {\n                if (selected) {\n                    this.select(this.widgets[to - n + 1 + idx]);\n                }\n            });\n        }\n    }\n    /**\n     * Select a cell widget.\n     *\n     * #### Notes\n     * It is a no-op if the value does not change.\n     * It will emit the `selectionChanged` signal.\n     */\n    select(widget) {\n        if (Private.selectedProperty.get(widget)) {\n            return;\n        }\n        Private.selectedProperty.set(widget, true);\n        this._selectionChanged.emit(void 0);\n        this.update();\n    }\n    /**\n     * Deselect a cell widget.\n     *\n     * #### Notes\n     * It is a no-op if the value does not change.\n     * It will emit the `selectionChanged` signal.\n     */\n    deselect(widget) {\n        if (!Private.selectedProperty.get(widget)) {\n            return;\n        }\n        Private.selectedProperty.set(widget, false);\n        this._selectionChanged.emit(void 0);\n        this.update();\n    }\n    /**\n     * Whether a cell is selected.\n     */\n    isSelected(widget) {\n        return Private.selectedProperty.get(widget);\n    }\n    /**\n     * Whether a cell is selected or is the active cell.\n     */\n    isSelectedOrActive(widget) {\n        if (widget === this._activeCell) {\n            return true;\n        }\n        return Private.selectedProperty.get(widget);\n    }\n    /**\n     * Deselect all of the cells.\n     */\n    deselectAll() {\n        let changed = false;\n        for (const widget of this.widgets) {\n            if (Private.selectedProperty.get(widget)) {\n                changed = true;\n            }\n            Private.selectedProperty.set(widget, false);\n        }\n        if (changed) {\n            this._selectionChanged.emit(void 0);\n        }\n        // Make sure we have a valid active cell.\n        this.activeCellIndex = this.activeCellIndex; // eslint-disable-line\n        this.update();\n    }\n    /**\n     * Move the head of an existing contiguous selection to extend the selection.\n     *\n     * @param index - The new head of the existing selection.\n     *\n     * #### Notes\n     * If there is no existing selection, the active cell is considered an\n     * existing one-cell selection.\n     *\n     * If the new selection is a single cell, that cell becomes the active cell\n     * and all cells are deselected.\n     *\n     * There is no change if there are no cells (i.e., activeCellIndex is -1).\n     */\n    extendContiguousSelectionTo(index) {\n        let { head, anchor } = this.getContiguousSelection();\n        let i;\n        // Handle the case of no current selection.\n        if (anchor === null || head === null) {\n            if (index === this.activeCellIndex) {\n                // Already collapsed selection, nothing more to do.\n                return;\n            }\n            // We will start a new selection below.\n            head = this.activeCellIndex;\n            anchor = this.activeCellIndex;\n        }\n        // Move the active cell. We do this before the collapsing shortcut below.\n        this.activeCellIndex = index;\n        // Make sure the index is valid, according to the rules for setting and clipping the\n        // active cell index. This may change the index.\n        index = this.activeCellIndex;\n        // Collapse the selection if it is only the active cell.\n        if (index === anchor) {\n            this.deselectAll();\n            return;\n        }\n        let selectionChanged = false;\n        if (head < index) {\n            if (head < anchor) {\n                Private.selectedProperty.set(this.widgets[head], false);\n                selectionChanged = true;\n            }\n            // Toggle everything strictly between head and index except anchor.\n            for (i = head + 1; i < index; i++) {\n                if (i !== anchor) {\n                    Private.selectedProperty.set(this.widgets[i], !Private.selectedProperty.get(this.widgets[i]));\n                    selectionChanged = true;\n                }\n            }\n        }\n        else if (index < head) {\n            if (anchor < head) {\n                Private.selectedProperty.set(this.widgets[head], false);\n                selectionChanged = true;\n            }\n            // Toggle everything strictly between index and head except anchor.\n            for (i = index + 1; i < head; i++) {\n                if (i !== anchor) {\n                    Private.selectedProperty.set(this.widgets[i], !Private.selectedProperty.get(this.widgets[i]));\n                    selectionChanged = true;\n                }\n            }\n        }\n        // Anchor and index should *always* be selected.\n        if (!Private.selectedProperty.get(this.widgets[anchor])) {\n            selectionChanged = true;\n        }\n        Private.selectedProperty.set(this.widgets[anchor], true);\n        if (!Private.selectedProperty.get(this.widgets[index])) {\n            selectionChanged = true;\n        }\n        Private.selectedProperty.set(this.widgets[index], true);\n        if (selectionChanged) {\n            this._selectionChanged.emit(void 0);\n        }\n    }\n    /**\n     * Get the head and anchor of a contiguous cell selection.\n     *\n     * The head of a contiguous selection is always the active cell.\n     *\n     * If there are no cells selected, `{head: null, anchor: null}` is returned.\n     *\n     * Throws an error if the currently selected cells do not form a contiguous\n     * selection.\n     */\n    getContiguousSelection() {\n        const cells = this.widgets;\n        const first = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_6__.ArrayExt.findFirstIndex(cells, c => this.isSelected(c));\n        // Return early if no cells are selected.\n        if (first === -1) {\n            return { head: null, anchor: null };\n        }\n        const last = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_6__.ArrayExt.findLastIndex(cells, c => this.isSelected(c), -1, first);\n        // Check that the selection is contiguous.\n        for (let i = first; i <= last; i++) {\n            if (!this.isSelected(cells[i])) {\n                throw new Error('Selection not contiguous');\n            }\n        }\n        // Check that the active cell is one of the endpoints of the selection.\n        const activeIndex = this.activeCellIndex;\n        if (first !== activeIndex && last !== activeIndex) {\n            throw new Error('Active cell not at endpoint of selection');\n        }\n        // Determine the head and anchor of the selection.\n        if (first === activeIndex) {\n            return { head: first, anchor: last };\n        }\n        else {\n            return { head: last, anchor: first };\n        }\n    }\n    /**\n     * Scroll so that the given cell is in view. Selects and activates cell.\n     *\n     * @param cell - A cell in the notebook widget.\n     * @param align - Type of alignment.\n     *\n     */\n    async scrollToCell(cell, align = 'auto') {\n        try {\n            await this.scrollToItem(this.widgets.findIndex(c => c === cell), align);\n        }\n        catch (r) {\n            //no-op\n        }\n        // change selection and active cell:\n        this.deselectAll();\n        this.select(cell);\n        cell.activate();\n    }\n    _parseFragment(fragment) {\n        const cleanedFragment = fragment.slice(1);\n        if (!cleanedFragment) {\n            // Bail early\n            return;\n        }\n        const parts = cleanedFragment.split('=');\n        if (parts.length === 1) {\n            // Default to heading if no prefix is given.\n            return {\n                kind: 'heading',\n                value: cleanedFragment\n            };\n        }\n        return {\n            kind: parts[0],\n            value: parts.slice(1).join('=')\n        };\n    }\n    /**\n     * Set URI fragment identifier.\n     */\n    async setFragment(fragment) {\n        const parsedFragment = this._parseFragment(fragment);\n        if (!parsedFragment) {\n            // Bail early\n            return;\n        }\n        let result;\n        switch (parsedFragment.kind) {\n            case 'heading':\n                result = await this._findHeading(parsedFragment.value);\n                break;\n            case 'cell-id':\n                result = this._findCellById(parsedFragment.value);\n                break;\n            default:\n                console.warn(`Unknown target type for URI fragment ${fragment}, interpreting as a heading`);\n                result = await this._findHeading(parsedFragment.kind + '=' + parsedFragment.value);\n                break;\n        }\n        if (result == null) {\n            return;\n        }\n        let { cell, element } = result;\n        if (!cell.inViewport) {\n            await this.scrollToCell(cell, 'center');\n        }\n        if (element == null) {\n            element = cell.node;\n        }\n        const widgetBox = this.node.getBoundingClientRect();\n        const elementBox = element.getBoundingClientRect();\n        if (elementBox.top > widgetBox.bottom ||\n            elementBox.bottom < widgetBox.top) {\n            element.scrollIntoView({ block: 'center' });\n        }\n    }\n    /**\n     * Handle the DOM events for the widget.\n     *\n     * @param event - The DOM event sent to the widget.\n     *\n     * #### Notes\n     * This method implements the DOM `EventListener` interface and is\n     * called in response to events on the notebook panel's node. It should\n     * not be called directly by user code.\n     */\n    handleEvent(event) {\n        if (!this.model) {\n            return;\n        }\n        switch (event.type) {\n            case 'contextmenu':\n                if (event.eventPhase === Event.CAPTURING_PHASE) {\n                    this._evtContextMenuCapture(event);\n                }\n                break;\n            case 'mousedown':\n                if (event.eventPhase === Event.CAPTURING_PHASE) {\n                    this._evtMouseDownCapture(event);\n                }\n                else {\n                    // Skip processing the event when it resulted from a toolbar button click\n                    if (!event.defaultPrevented) {\n                        this._evtMouseDown(event);\n                    }\n                }\n                break;\n            case 'mouseup':\n                if (event.currentTarget === document) {\n                    this._evtDocumentMouseup(event);\n                }\n                break;\n            case 'mousemove':\n                if (event.currentTarget === document) {\n                    this._evtDocumentMousemove(event);\n                }\n                break;\n            case 'keydown':\n                // This works because CodeMirror does not stop the event propagation\n                this._ensureFocus(true);\n                break;\n            case 'dblclick':\n                this._evtDblClick(event);\n                break;\n            case 'focusin':\n                this._evtFocusIn(event);\n                break;\n            case 'focusout':\n                this._evtFocusOut(event);\n                break;\n            case 'lm-dragenter':\n                this._evtDragEnter(event);\n                break;\n            case 'lm-dragleave':\n                this._evtDragLeave(event);\n                break;\n            case 'lm-dragover':\n                this._evtDragOver(event);\n                break;\n            case 'lm-drop':\n                this._evtDrop(event);\n                break;\n            default:\n                super.handleEvent(event);\n                break;\n        }\n    }\n    /**\n     * Handle `after-attach` messages for the widget.\n     */\n    onAfterAttach(msg) {\n        super.onAfterAttach(msg);\n        const node = this.node;\n        node.addEventListener('contextmenu', this, true);\n        node.addEventListener('mousedown', this, true);\n        node.addEventListener('mousedown', this);\n        node.addEventListener('keydown', this);\n        node.addEventListener('dblclick', this);\n        node.addEventListener('focusin', this);\n        node.addEventListener('focusout', this);\n        // Capture drag events for the notebook widget\n        // in order to preempt the drag/drop handlers in the\n        // code editor widgets, which can take text data.\n        node.addEventListener('lm-dragenter', this, true);\n        node.addEventListener('lm-dragleave', this, true);\n        node.addEventListener('lm-dragover', this, true);\n        node.addEventListener('lm-drop', this, true);\n    }\n    /**\n     * Handle `before-detach` messages for the widget.\n     */\n    onBeforeDetach(msg) {\n        const node = this.node;\n        node.removeEventListener('contextmenu', this, true);\n        node.removeEventListener('mousedown', this, true);\n        node.removeEventListener('mousedown', this);\n        node.removeEventListener('keydown', this);\n        node.removeEventListener('dblclick', this);\n        node.removeEventListener('focusin', this);\n        node.removeEventListener('focusout', this);\n        node.removeEventListener('lm-dragenter', this, true);\n        node.removeEventListener('lm-dragleave', this, true);\n        node.removeEventListener('lm-dragover', this, true);\n        node.removeEventListener('lm-drop', this, true);\n        document.removeEventListener('mousemove', this, true);\n        document.removeEventListener('mouseup', this, true);\n        super.onBeforeAttach(msg);\n    }\n    /**\n     * A message handler invoked on an `'after-show'` message.\n     */\n    onAfterShow(msg) {\n        super.onAfterShow(msg);\n        this._checkCacheOnNextResize = true;\n    }\n    /**\n     * A message handler invoked on a `'resize'` message.\n     */\n    onResize(msg) {\n        var _a;\n        // TODO\n        if (!this._checkCacheOnNextResize) {\n            return super.onResize(msg);\n        }\n        super.onResize(msg);\n        this._checkCacheOnNextResize = false;\n        const cache = this._cellLayoutStateCache;\n        const width = parseInt(this.node.style.width, 10);\n        if (cache) {\n            if (width === cache.width) {\n                // Cache identical, do nothing\n                return;\n            }\n        }\n        // Update cache\n        this._cellLayoutStateCache = { width };\n        // Fallback:\n        for (const w of this.widgets) {\n            if (w instanceof _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.Cell && w.inViewport) {\n                (_a = w.editorWidget) === null || _a === void 0 ? void 0 : _a.update();\n            }\n        }\n    }\n    /**\n     * A message handler invoked on an `'before-hide'` message.\n     */\n    onBeforeHide(msg) {\n        super.onBeforeHide(msg);\n        // Update cache\n        const width = parseInt(this.node.style.width, 10);\n        this._cellLayoutStateCache = { width };\n    }\n    /**\n     * Handle `'activate-request'` messages.\n     */\n    onActivateRequest(msg) {\n        super.onActivateRequest(msg);\n        this._ensureFocus(true);\n    }\n    /**\n     * Handle `update-request` messages sent to the widget.\n     */\n    onUpdateRequest(msg) {\n        super.onUpdateRequest(msg);\n        const activeCell = this.activeCell;\n        // Set the appropriate classes on the cells.\n        if (this.mode === 'edit') {\n            this.addClass(EDIT_CLASS);\n            this.removeClass(COMMAND_CLASS);\n        }\n        else {\n            this.addClass(COMMAND_CLASS);\n            this.removeClass(EDIT_CLASS);\n        }\n        let count = 0;\n        for (const widget of this.widgets) {\n            // Set tabIndex to -1 to allow calling .focus() on cell without allowing\n            // focus via tab key. This allows focus (document.activeElement) to move\n            // up and down the document, cell by cell, when the user presses J/K or\n            // ArrowDown/ArrowUp, but (unlike tabIndex = 0) does not add the notebook\n            // cells (which could be numerous) to the set of nodes that the user would\n            // have to visit when pressing the tab key to move about the UI.\n            widget.node.tabIndex = -1;\n            widget.removeClass(ACTIVE_CLASS);\n            widget.removeClass(OTHER_SELECTED_CLASS);\n            if (this.isSelectedOrActive(widget)) {\n                widget.addClass(SELECTED_CLASS);\n                count++;\n            }\n            else {\n                widget.removeClass(SELECTED_CLASS);\n            }\n        }\n        if (activeCell) {\n            activeCell.addClass(ACTIVE_CLASS);\n            activeCell.addClass(SELECTED_CLASS);\n            // Set tab index to 0 on the active cell so that if the user tabs away from\n            // the notebook then tabs back, they will return to the cell where they\n            // left off.\n            activeCell.node.tabIndex = 0;\n            if (count > 1) {\n                activeCell.addClass(OTHER_SELECTED_CLASS);\n            }\n        }\n    }\n    /**\n     * Handle a cell being inserted.\n     */\n    onCellInserted(index, cell) {\n        void cell.ready.then(() => {\n            if (!cell.isDisposed) {\n                cell.editor.edgeRequested.connect(this._onEdgeRequest, this);\n            }\n        });\n        cell.scrollRequested.connect((_emitter, scrollRequest) => {\n            if (cell !== this.activeCell) {\n                // Do nothing for cells other than the active cell\n                // to avoid scroll requests from editor extensions\n                // stealing user focus (this may be revisited).\n                return;\n            }\n            if (!scrollRequest.defaultPrevented) {\n                // Nothing to do if scroll request was already handled.\n                return;\n            }\n            // Node which allows to scroll the notebook\n            const scroller = this.outerNode;\n            if (cell.inViewport) {\n                // If cell got scrolled to the viewport in the meantime,\n                // proceed with scrolling within the cell.\n                return scrollRequest.scrollWithinCell({ scroller });\n            }\n            // If cell is not in the viewport and needs scrolling,\n            // first scroll to the cell and then scroll within the cell.\n            this.scrollToItem(this.activeCellIndex)\n                .then(() => {\n                void cell.ready.then(() => {\n                    scrollRequest.scrollWithinCell({ scroller });\n                });\n            })\n                .catch(reason => {\n                // no-op\n            });\n        });\n        // If the insertion happened above, increment the active cell\n        // index, otherwise it stays the same.\n        this.activeCellIndex =\n            index <= this.activeCellIndex\n                ? this.activeCellIndex + 1\n                : this.activeCellIndex;\n    }\n    /**\n     * Handle a cell being removed.\n     */\n    onCellRemoved(index, cell) {\n        // If the removal happened above, decrement the active\n        // cell index, otherwise it stays the same.\n        this.activeCellIndex =\n            index <= this.activeCellIndex\n                ? this.activeCellIndex - 1\n                : this.activeCellIndex;\n        if (this.isSelected(cell)) {\n            this._selectionChanged.emit(void 0);\n        }\n    }\n    /**\n     * Handle a new model.\n     */\n    onModelChanged(oldValue, newValue) {\n        super.onModelChanged(oldValue, newValue);\n        // Try to set the active cell index to 0.\n        // It will be set to `-1` if there is no new model or the model is empty.\n        this.activeCellIndex = 0;\n    }\n    /**\n     * Handle edge request signals from cells.\n     */\n    _onEdgeRequest(editor, location) {\n        const prev = this.activeCellIndex;\n        if (location === 'top') {\n            this.activeCellIndex--;\n            // Move the cursor to the first position on the last line.\n            if (this.activeCellIndex < prev) {\n                const editor = this.activeCell.editor;\n                if (editor) {\n                    const lastLine = editor.lineCount - 1;\n                    editor.setCursorPosition({ line: lastLine, column: 0 });\n                }\n            }\n        }\n        else if (location === 'bottom') {\n            this.activeCellIndex++;\n            // Move the cursor to the first character.\n            if (this.activeCellIndex > prev) {\n                const editor = this.activeCell.editor;\n                if (editor) {\n                    editor.setCursorPosition({ line: 0, column: 0 });\n                }\n            }\n        }\n        this.mode = 'edit';\n    }\n    /**\n     * Ensure that the notebook has proper focus.\n     */\n    _ensureFocus(force = false) {\n        var _a, _b;\n        // No-op is the footer has the focus.\n        const footer = this.layout.footer;\n        if (footer && document.activeElement === footer.node) {\n            return;\n        }\n        const activeCell = this.activeCell;\n        if (this.mode === 'edit' && activeCell) {\n            // Test for !== true to cover hasFocus is false and editor is not yet rendered.\n            if (((_a = activeCell.editor) === null || _a === void 0 ? void 0 : _a.hasFocus()) !== true) {\n                if (activeCell.inViewport) {\n                    (_b = activeCell.editor) === null || _b === void 0 ? void 0 : _b.focus();\n                }\n                else {\n                    this.scrollToItem(this.activeCellIndex)\n                        .then(() => {\n                        void activeCell.ready.then(() => {\n                            var _a;\n                            (_a = activeCell.editor) === null || _a === void 0 ? void 0 : _a.focus();\n                        });\n                    })\n                        .catch(reason => {\n                        // no-op\n                    });\n                }\n            }\n        }\n        if (force &&\n            activeCell &&\n            !activeCell.node.contains(document.activeElement)) {\n            void _actions__WEBPACK_IMPORTED_MODULE_15__.NotebookActions.focusActiveCell(this, {\n                preventScroll: true\n            });\n        }\n    }\n    /**\n     * Find the cell index containing the target html element.\n     *\n     * #### Notes\n     * Returns -1 if the cell is not found.\n     */\n    _findCell(node) {\n        // Trace up the DOM hierarchy to find the root cell node.\n        // Then find the corresponding child and select it.\n        let n = node;\n        while (n && n !== this.node) {\n            if (n.classList.contains(NB_CELL_CLASS)) {\n                const i = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_6__.ArrayExt.findFirstIndex(this.widgets, widget => widget.node === n);\n                if (i !== -1) {\n                    return i;\n                }\n                break;\n            }\n            n = n.parentElement;\n        }\n        return -1;\n    }\n    /**\n     * Find the target of html mouse event and cell index containing this target.\n     *\n     * #### Notes\n     * Returned index is -1 if the cell is not found.\n     */\n    _findEventTargetAndCell(event) {\n        let target = event.target;\n        let index = this._findCell(target);\n        if (index === -1) {\n            // `event.target` sometimes gives an orphaned node in Firefox 57, which\n            // can have `null` anywhere in its parent line. If we fail to find a cell\n            // using `event.target`, try again using a target reconstructed from the\n            // position of the click event.\n            target = document.elementFromPoint(event.clientX, event.clientY);\n            index = this._findCell(target);\n        }\n        return [target, index];\n    }\n    /**\n     * Find heading with given ID in any of the cells.\n     */\n    async _findHeading(queryId) {\n        // Loop on cells, get headings and search for first matching id.\n        for (let cellIdx = 0; cellIdx < this.widgets.length; cellIdx++) {\n            const cell = this.widgets[cellIdx];\n            if (cell.model.type === 'raw' ||\n                (cell.model.type === 'markdown' && !cell.rendered)) {\n                // Bail early\n                continue;\n            }\n            for (const heading of cell.headings) {\n                let id = '';\n                switch (heading.type) {\n                    case _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.Cell.HeadingType.HTML:\n                        id = heading.id;\n                        break;\n                    case _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.Cell.HeadingType.Markdown:\n                        {\n                            const mdHeading = heading;\n                            id = await _jupyterlab_toc__WEBPACK_IMPORTED_MODULE_3__.TableOfContentsUtils.Markdown.getHeadingId(this.rendermime.markdownParser, mdHeading.raw, mdHeading.level, this.rendermime.sanitizer);\n                        }\n                        break;\n                }\n                if (id === queryId) {\n                    const element = this.node.querySelector(`h${heading.level}[id=\"${CSS.escape(id)}\"]`);\n                    return {\n                        cell,\n                        element\n                    };\n                }\n            }\n        }\n        return null;\n    }\n    /**\n     * Find cell by its unique ID.\n     */\n    _findCellById(queryId) {\n        for (let cellIdx = 0; cellIdx < this.widgets.length; cellIdx++) {\n            const cell = this.widgets[cellIdx];\n            if (cell.model.id === queryId) {\n                return {\n                    cell\n                };\n            }\n        }\n        return null;\n    }\n    /**\n     * Handle `contextmenu` event.\n     */\n    _evtContextMenuCapture(event) {\n        var _a;\n        // Allow the event to propagate un-modified if the user\n        // is holding the shift-key (and probably requesting\n        // the native context menu).\n        if (event.shiftKey) {\n            return;\n        }\n        const [target, index] = this._findEventTargetAndCell(event);\n        const widget = this.widgets[index];\n        if (widget && ((_a = widget.editorWidget) === null || _a === void 0 ? void 0 : _a.node.contains(target))) {\n            // Prevent CodeMirror from focusing the editor.\n            // TODO: find an editor-agnostic solution.\n            event.preventDefault();\n        }\n    }\n    /**\n     * Handle `mousedown` event in the capture phase for the widget.\n     */\n    _evtMouseDownCapture(event) {\n        var _a;\n        const { button, shiftKey } = event;\n        const [target, index] = this._findEventTargetAndCell(event);\n        const widget = this.widgets[index];\n        // On OS X, the context menu may be triggered with ctrl-left-click. In\n        // Firefox, ctrl-left-click gives an event with button 2, but in Chrome,\n        // ctrl-left-click gives an event with button 0 with the ctrl modifier.\n        if (button === 2 &&\n            !shiftKey &&\n            widget &&\n            ((_a = widget.editorWidget) === null || _a === void 0 ? void 0 : _a.node.contains(target))) {\n            this.mode = 'command';\n            // Prevent CodeMirror from focusing the editor.\n            // TODO: find an editor-agnostic solution.\n            event.preventDefault();\n        }\n    }\n    /**\n     * Handle `mousedown` events for the widget.\n     */\n    _evtMouseDown(event) {\n        var _a, _b, _c;\n        const { button, shiftKey } = event;\n        // We only handle main or secondary button actions.\n        if (!(button === 0 || button === 2)) {\n            return;\n        }\n        // Shift right-click gives the browser default behavior.\n        if (shiftKey && button === 2) {\n            return;\n        }\n        const [target, index] = this._findEventTargetAndCell(event);\n        const widget = this.widgets[index];\n        let targetArea;\n        if (widget) {\n            if ((_a = widget.editorWidget) === null || _a === void 0 ? void 0 : _a.node.contains(target)) {\n                targetArea = 'input';\n            }\n            else if ((_b = widget.promptNode) === null || _b === void 0 ? void 0 : _b.contains(target)) {\n                targetArea = 'prompt';\n            }\n            else {\n                targetArea = 'cell';\n            }\n        }\n        else {\n            targetArea = 'notebook';\n        }\n        // Make sure we go to command mode if the click isn't in the cell editor If\n        // we do click in the cell editor, the editor handles the focus event to\n        // switch to edit mode.\n        if (targetArea !== 'input') {\n            this.mode = 'command';\n        }\n        if (targetArea === 'notebook') {\n            this.deselectAll();\n        }\n        else if (targetArea === 'prompt' || targetArea === 'cell') {\n            // We don't want to prevent the default selection behavior\n            // if there is currently text selected in an output.\n            const hasSelection = ((_c = window.getSelection()) !== null && _c !== void 0 ? _c : '').toString() !== '';\n            if (button === 0 &&\n                shiftKey &&\n                !hasSelection &&\n                !['INPUT', 'OPTION'].includes(target.tagName)) {\n                // Prevent browser selecting text in prompt or output\n                event.preventDefault();\n                // Shift-click - extend selection\n                try {\n                    this.extendContiguousSelectionTo(index);\n                }\n                catch (e) {\n                    console.error(e);\n                    this.deselectAll();\n                    return;\n                }\n                // Enter selecting mode\n                this._mouseMode = 'select';\n                document.addEventListener('mouseup', this, true);\n                document.addEventListener('mousemove', this, true);\n            }\n            else if (button === 0 && !shiftKey) {\n                // Prepare to start a drag if we are on the drag region.\n                if (targetArea === 'prompt') {\n                    // Prepare for a drag start\n                    this._dragData = {\n                        pressX: event.clientX,\n                        pressY: event.clientY,\n                        index: index\n                    };\n                    // Enter possible drag mode\n                    this._mouseMode = 'couldDrag';\n                    document.addEventListener('mouseup', this, true);\n                    document.addEventListener('mousemove', this, true);\n                    event.preventDefault();\n                }\n                if (!this.isSelectedOrActive(widget)) {\n                    this.deselectAll();\n                    this.activeCellIndex = index;\n                }\n            }\n            else if (button === 2) {\n                if (!this.isSelectedOrActive(widget)) {\n                    this.deselectAll();\n                    this.activeCellIndex = index;\n                }\n                event.preventDefault();\n            }\n        }\n        else if (targetArea === 'input') {\n            if (button === 2 && !this.isSelectedOrActive(widget)) {\n                this.deselectAll();\n                this.activeCellIndex = index;\n            }\n        }\n        // If we didn't set focus above, make sure we get focus now.\n        this._ensureFocus(true);\n    }\n    /**\n     * Handle the `'mouseup'` event on the document.\n     */\n    _evtDocumentMouseup(event) {\n        event.preventDefault();\n        event.stopPropagation();\n        // Remove the event listeners we put on the document\n        document.removeEventListener('mousemove', this, true);\n        document.removeEventListener('mouseup', this, true);\n        if (this._mouseMode === 'couldDrag') {\n            // We didn't end up dragging if we are here, so treat it as a click event.\n            const [, index] = this._findEventTargetAndCell(event);\n            this.deselectAll();\n            this.activeCellIndex = index;\n            // Focus notebook if active cell changes but does not have focus.\n            if (!this.activeCell.node.contains(document.activeElement)) {\n                void _actions__WEBPACK_IMPORTED_MODULE_15__.NotebookActions.focusActiveCell(this);\n            }\n        }\n        this._mouseMode = null;\n    }\n    /**\n     * Handle the `'mousemove'` event for the widget.\n     */\n    _evtDocumentMousemove(event) {\n        event.preventDefault();\n        event.stopPropagation();\n        // If in select mode, update the selection\n        switch (this._mouseMode) {\n            case 'select': {\n                const target = event.target;\n                const index = this._findCell(target);\n                if (index !== -1) {\n                    this.extendContiguousSelectionTo(index);\n                }\n                break;\n            }\n            case 'couldDrag': {\n                // Check for a drag initialization.\n                const data = this._dragData;\n                const dx = Math.abs(event.clientX - data.pressX);\n                const dy = Math.abs(event.clientY - data.pressY);\n                if (dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD) {\n                    this._mouseMode = null;\n                    this._startDrag(data.index, event.clientX, event.clientY);\n                }\n                break;\n            }\n            default:\n                break;\n        }\n    }\n    /**\n     * Handle the `'lm-dragenter'` event for the widget.\n     */\n    _evtDragEnter(event) {\n        if (!event.mimeData.hasData(JUPYTER_CELL_MIME)) {\n            return;\n        }\n        event.preventDefault();\n        event.stopPropagation();\n        const target = event.target;\n        const index = this._findCell(target);\n        if (index === -1) {\n            return;\n        }\n        const widget = this.cellsArray[index];\n        widget.node.classList.add(_constants__WEBPACK_IMPORTED_MODULE_17__.DROP_TARGET_CLASS);\n    }\n    /**\n     * Handle the `'lm-dragleave'` event for the widget.\n     */\n    _evtDragLeave(event) {\n        if (!event.mimeData.hasData(JUPYTER_CELL_MIME)) {\n            return;\n        }\n        event.preventDefault();\n        event.stopPropagation();\n        const elements = this.node.getElementsByClassName(_constants__WEBPACK_IMPORTED_MODULE_17__.DROP_TARGET_CLASS);\n        if (elements.length) {\n            elements[0].classList.remove(_constants__WEBPACK_IMPORTED_MODULE_17__.DROP_TARGET_CLASS);\n        }\n    }\n    /**\n     * Handle the `'lm-dragover'` event for the widget.\n     */\n    _evtDragOver(event) {\n        if (!event.mimeData.hasData(JUPYTER_CELL_MIME)) {\n            return;\n        }\n        event.preventDefault();\n        event.stopPropagation();\n        event.dropAction = event.proposedAction;\n        const elements = this.node.getElementsByClassName(_constants__WEBPACK_IMPORTED_MODULE_17__.DROP_TARGET_CLASS);\n        if (elements.length) {\n            elements[0].classList.remove(_constants__WEBPACK_IMPORTED_MODULE_17__.DROP_TARGET_CLASS);\n        }\n        const target = event.target;\n        const index = this._findCell(target);\n        if (index === -1) {\n            return;\n        }\n        const widget = this.cellsArray[index];\n        widget.node.classList.add(_constants__WEBPACK_IMPORTED_MODULE_17__.DROP_TARGET_CLASS);\n    }\n    /**\n     * Handle the `'lm-drop'` event for the widget.\n     */\n    _evtDrop(event) {\n        if (!event.mimeData.hasData(JUPYTER_CELL_MIME)) {\n            return;\n        }\n        event.preventDefault();\n        event.stopPropagation();\n        if (event.proposedAction === 'none') {\n            event.dropAction = 'none';\n            return;\n        }\n        let target = event.target;\n        while (target && target.parentElement) {\n            if (target.classList.contains(_constants__WEBPACK_IMPORTED_MODULE_17__.DROP_TARGET_CLASS)) {\n                target.classList.remove(_constants__WEBPACK_IMPORTED_MODULE_17__.DROP_TARGET_CLASS);\n                break;\n            }\n            target = target.parentElement;\n        }\n        // Model presence should be checked before calling event handlers\n        const model = this.model;\n        const source = event.source;\n        if (source === this) {\n            // Handle the case where we are moving cells within\n            // the same notebook.\n            event.dropAction = 'move';\n            const toMove = event.mimeData.getData('internal:cells');\n            // For collapsed markdown headings with hidden \"child\" cells, move all\n            // child cells as well as the markdown heading.\n            const cell = toMove[toMove.length - 1];\n            if (cell instanceof _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_1__.MarkdownCell && cell.headingCollapsed) {\n                const nextParent = _actions__WEBPACK_IMPORTED_MODULE_15__.NotebookActions.findNextParentHeading(cell, source);\n                if (nextParent > 0) {\n                    const index = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_6__.findIndex)(source.widgets, (possibleCell) => {\n                        return cell.model.id === possibleCell.model.id;\n                    });\n                    toMove.push(...source.widgets.slice(index + 1, nextParent));\n                }\n            }\n            // Compute the to/from indices for the move.\n            let fromIndex = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_6__.ArrayExt.firstIndexOf(this.widgets, toMove[0]);\n            let toIndex = this._findCell(target);\n            // This check is needed for consistency with the view.\n            if (toIndex !== -1 && toIndex > fromIndex) {\n                toIndex -= 1;\n            }\n            else if (toIndex === -1) {\n                // If the drop is within the notebook but not on any cell,\n                // most often this means it is past the cell areas, so\n                // set it to move the cells to the end of the notebook.\n                toIndex = this.widgets.length - 1;\n            }\n            // Don't move if we are within the block of selected cells.\n            if (toIndex >= fromIndex && toIndex < fromIndex + toMove.length) {\n                return;\n            }\n            // Move the cells one by one\n            this.moveCell(fromIndex, toIndex, toMove.length);\n        }\n        else {\n            // Handle the case where we are copying cells between\n            // notebooks.\n            event.dropAction = 'copy';\n            // Find the target cell and insert the copied cells.\n            let index = this._findCell(target);\n            if (index === -1) {\n                index = this.widgets.length;\n            }\n            const start = index;\n            const values = event.mimeData.getData(JUPYTER_CELL_MIME);\n            // Insert the copies of the original cells.\n            // We preserve trust status of pasted cells by not modifying metadata.\n            model.sharedModel.insertCells(index, values);\n            // Select the inserted cells.\n            this.deselectAll();\n            this.activeCellIndex = start;\n            this.extendContiguousSelectionTo(index - 1);\n        }\n        void _actions__WEBPACK_IMPORTED_MODULE_15__.NotebookActions.focusActiveCell(this);\n    }\n    /**\n     * Start a drag event.\n     */\n    _startDrag(index, clientX, clientY) {\n        var _a;\n        const cells = this.model.cells;\n        const selected = [];\n        const toMove = [];\n        let i = -1;\n        for (const widget of this.widgets) {\n            const cell = cells.get(++i);\n            if (this.isSelectedOrActive(widget)) {\n                widget.addClass(_constants__WEBPACK_IMPORTED_MODULE_17__.DROP_SOURCE_CLASS);\n                selected.push(cell.toJSON());\n                toMove.push(widget);\n            }\n        }\n        const activeCell = this.activeCell;\n        let dragImage = null;\n        let countString;\n        if ((activeCell === null || activeCell === void 0 ? void 0 : activeCell.model.type) === 'code') {\n            const executionCount = activeCell.model\n                .executionCount;\n            countString = ' ';\n            if (executionCount) {\n                countString = executionCount.toString();\n            }\n        }\n        else {\n            countString = '';\n        }\n        // Create the drag image.\n        dragImage = Private.createDragImage(selected.length, countString, (_a = activeCell === null || activeCell === void 0 ? void 0 : activeCell.model.sharedModel.getSource().split('\\n')[0].slice(0, 26)) !== null && _a !== void 0 ? _a : '');\n        // Set up the drag event.\n        this._drag = new _lumino_dragdrop__WEBPACK_IMPORTED_MODULE_9__.Drag({\n            mimeData: new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_7__.MimeData(),\n            dragImage,\n            supportedActions: 'copy-move',\n            proposedAction: 'copy',\n            source: this\n        });\n        this._drag.mimeData.setData(JUPYTER_CELL_MIME, selected);\n        // Add mimeData for the fully reified cell widgets, for the\n        // case where the target is in the same notebook and we\n        // can just move the cells.\n        this._drag.mimeData.setData('internal:cells', toMove);\n        // Add mimeData for the text content of the selected cells,\n        // allowing for drag/drop into plain text fields.\n        const textContent = toMove\n            .map(cell => cell.model.sharedModel.getSource())\n            .join('\\n');\n        this._drag.mimeData.setData('text/plain', textContent);\n        // Remove mousemove and mouseup listeners and start the drag.\n        document.removeEventListener('mousemove', this, true);\n        document.removeEventListener('mouseup', this, true);\n        this._mouseMode = null;\n        void this._drag.start(clientX, clientY).then(action => {\n            if (this.isDisposed) {\n                return;\n            }\n            this._drag = null;\n            for (const widget of toMove) {\n                widget.removeClass(_constants__WEBPACK_IMPORTED_MODULE_17__.DROP_SOURCE_CLASS);\n            }\n        });\n    }\n    /**\n     * Update the notebook node with class indicating read-write state.\n     */\n    _updateReadWrite() {\n        const inReadWrite = _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.DOMUtils.hasActiveEditableElement(this.node);\n        this.node.classList.toggle(READ_WRITE_CLASS, inReadWrite);\n    }\n    /**\n     * Handle `focus` events for the widget.\n     */\n    _evtFocusIn(event) {\n        var _a, _b;\n        // Update read-write class state.\n        this._updateReadWrite();\n        const target = event.target;\n        const index = this._findCell(target);\n        if (index !== -1) {\n            const widget = this.widgets[index];\n            // If the editor itself does not have focus, ensure command mode.\n            if (widget.editorWidget && !widget.editorWidget.node.contains(target)) {\n                this.setMode('command', { focus: false });\n            }\n            // Cell index needs to be updated before changing mode,\n            // otherwise the previous cell may get un-rendered.\n            this.activeCellIndex = index;\n            // If the editor has focus, ensure edit mode.\n            const node = (_a = widget.editorWidget) === null || _a === void 0 ? void 0 : _a.node;\n            if (node === null || node === void 0 ? void 0 : node.contains(target)) {\n                this.setMode('edit', { focus: false });\n            }\n        }\n        else {\n            // No cell has focus, ensure command mode.\n            this.setMode('command', { focus: false });\n            // Prevents the parent element to get the focus.\n            event.preventDefault();\n            // Check if the focus was previously in the active cell to avoid focus looping\n            // between the cell and the cell toolbar.\n            const source = event.relatedTarget;\n            // Focuses on the active cell if the focus did not come from it.\n            // Otherwise focus on the footer element (add cell button).\n            if (this._activeCell && !this._activeCell.node.contains(source)) {\n                this._activeCell.ready\n                    .then(() => {\n                    var _a;\n                    (_a = this._activeCell) === null || _a === void 0 ? void 0 : _a.node.focus({\n                        preventScroll: true\n                    });\n                })\n                    .catch(() => {\n                    var _a;\n                    (_a = this.layout.footer) === null || _a === void 0 ? void 0 : _a.node.focus({\n                        preventScroll: true\n                    });\n                });\n            }\n            else {\n                (_b = this.layout.footer) === null || _b === void 0 ? void 0 : _b.node.focus({\n                    preventScroll: true\n                });\n            }\n        }\n    }\n    /**\n     * Handle `focusout` events for the notebook.\n     */\n    _evtFocusOut(event) {\n        var _a;\n        // Update read-write class state.\n        this._updateReadWrite();\n        const relatedTarget = event.relatedTarget;\n        // Bail if the window is losing focus, to preserve edit mode. This test\n        // assumes that we explicitly focus things rather than calling blur()\n        if (!relatedTarget) {\n            return;\n        }\n        // Bail if the item gaining focus is another cell,\n        // and we should not be entering command mode.\n        const index = this._findCell(relatedTarget);\n        if (index !== -1) {\n            const widget = this.widgets[index];\n            if ((_a = widget.editorWidget) === null || _a === void 0 ? void 0 : _a.node.contains(relatedTarget)) {\n                return;\n            }\n        }\n        // Otherwise enter command mode if not already.\n        if (this.mode !== 'command') {\n            this.setMode('command', { focus: false });\n        }\n    }\n    /**\n     * Handle `dblclick` events for the widget.\n     */\n    _evtDblClick(event) {\n        const model = this.model;\n        if (!model) {\n            return;\n        }\n        this.deselectAll();\n        const [target, index] = this._findEventTargetAndCell(event);\n        if (event.target.classList.contains(HEADING_COLLAPSER_CLASS)) {\n            return;\n        }\n        if (index === -1) {\n            return;\n        }\n        this.activeCellIndex = index;\n        if (model.cells.get(index).type === 'markdown') {\n            const widget = this.widgets[index];\n            widget.rendered = false;\n        }\n        else if (target.localName === 'img') {\n            target.classList.toggle(UNCONFINED_CLASS);\n        }\n    }\n    /**\n     * Remove selections from inactive cells to avoid\n     * spurious cursors.\n     */\n    _trimSelections() {\n        for (let i = 0; i < this.widgets.length; i++) {\n            if (i !== this._activeCellIndex) {\n                const cell = this.widgets[i];\n                if (!cell.model.isDisposed && cell.editor) {\n                    cell.model.selections.delete(cell.editor.uuid);\n                }\n            }\n        }\n    }\n    _updateSelectedCells() {\n        this._selectedCells = this.widgets.filter(cell => this.isSelectedOrActive(cell));\n        if (this.kernelHistory) {\n            this.kernelHistory.reset();\n        }\n    }\n}\n/**\n * The namespace for the `Notebook` class statics.\n */\n(function (Notebook) {\n    /**\n     * The default implementation of a notebook content factory..\n     *\n     * #### Notes\n     * Override methods on this class to customize the default notebook factory\n     * methods that create notebook content.\n     */\n    class ContentFactory extends StaticNotebook.ContentFactory {\n    }\n    Notebook.ContentFactory = ContentFactory;\n})(Notebook || (Notebook = {}));\n/**\n * A namespace for private data.\n */\nvar Private;\n(function (Private) {\n    /**\n     * An attached property for the selected state of a cell.\n     */\n    Private.selectedProperty = new _lumino_properties__WEBPACK_IMPORTED_MODULE_10__.AttachedProperty({\n        name: 'selected',\n        create: () => false\n    });\n    /**\n     * A custom panel layout for the notebook.\n     */\n    class NotebookPanelLayout extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_13__.PanelLayout {\n        /**\n         * A message handler invoked on an `'update-request'` message.\n         *\n         * #### Notes\n         * This is a reimplementation of the base class method,\n         * and is a no-op.\n         */\n        onUpdateRequest(msg) {\n            // This is a no-op.\n        }\n    }\n    Private.NotebookPanelLayout = NotebookPanelLayout;\n    /**\n     * Create a cell drag image.\n     */\n    function createDragImage(count, promptNumber, cellContent) {\n        if (count > 1) {\n            if (promptNumber !== '') {\n                return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.VirtualDOM.realize(_lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.h.div(_lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.h.div({ className: DRAG_IMAGE_CLASS }, _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.h.span({ className: CELL_DRAG_PROMPT_CLASS }, '[' + promptNumber + ']:'), _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.h.span({ className: CELL_DRAG_CONTENT_CLASS }, cellContent)), _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.h.div({ className: CELL_DRAG_MULTIPLE_BACK }, '')));\n            }\n            else {\n                return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.VirtualDOM.realize(_lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.h.div(_lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.h.div({ className: DRAG_IMAGE_CLASS }, _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.h.span({ className: CELL_DRAG_PROMPT_CLASS }), _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.h.span({ className: CELL_DRAG_CONTENT_CLASS }, cellContent)), _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.h.div({ className: CELL_DRAG_MULTIPLE_BACK }, '')));\n            }\n        }\n        else {\n            if (promptNumber !== '') {\n                return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.VirtualDOM.realize(_lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.h.div(_lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.h.div({ className: `${DRAG_IMAGE_CLASS} ${SINGLE_DRAG_IMAGE_CLASS}` }, _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.h.span({ className: CELL_DRAG_PROMPT_CLASS }, '[' + promptNumber + ']:'), _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.h.span({ className: CELL_DRAG_CONTENT_CLASS }, cellContent))));\n            }\n            else {\n                return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.VirtualDOM.realize(_lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.h.div(_lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.h.div({ className: `${DRAG_IMAGE_CLASS} ${SINGLE_DRAG_IMAGE_CLASS}` }, _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.h.span({ className: CELL_DRAG_PROMPT_CLASS }), _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_12__.h.span({ className: CELL_DRAG_CONTENT_CLASS }, cellContent))));\n            }\n        }\n    }\n    Private.createDragImage = createDragImage;\n})(Private || (Private = {}));\n//# sourceMappingURL=widget.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/widget.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/widgetfactory.js":
/*!*****************************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/widgetfactory.js ***!
  \*****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   NotebookWidgetFactory: () => (/* binding */ NotebookWidgetFactory)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_docregistry__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/docregistry */ \"webpack/sharing/consume/default/@jupyterlab/docregistry/@jupyterlab/docregistry\");\n/* harmony import */ var _jupyterlab_docregistry__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_docregistry__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _panel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./panel */ \"../node_modules/@jupyterlab/notebook/lib/panel.js\");\n/* harmony import */ var _widget__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget */ \"../node_modules/@jupyterlab/notebook/lib/widget.js\");\n/* harmony import */ var _history__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./history */ \"../node_modules/@jupyterlab/notebook/lib/history.js\");\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n\n\n\n/**\n * A widget factory for notebook panels.\n */\nclass NotebookWidgetFactory extends _jupyterlab_docregistry__WEBPACK_IMPORTED_MODULE_0__.ABCWidgetFactory {\n    /**\n     * Construct a new notebook widget factory.\n     *\n     * @param options - The options used to construct the factory.\n     */\n    constructor(options) {\n        super(options);\n        this.rendermime = options.rendermime;\n        this.contentFactory = options.contentFactory;\n        this.mimeTypeService = options.mimeTypeService;\n        this._editorConfig =\n            options.editorConfig || _widget__WEBPACK_IMPORTED_MODULE_1__.StaticNotebook.defaultEditorConfig;\n        this._notebookConfig =\n            options.notebookConfig || _widget__WEBPACK_IMPORTED_MODULE_1__.StaticNotebook.defaultNotebookConfig;\n    }\n    /**\n     * A configuration object for cell editor settings.\n     */\n    get editorConfig() {\n        return this._editorConfig;\n    }\n    set editorConfig(value) {\n        this._editorConfig = value;\n    }\n    /**\n     * A configuration object for notebook settings.\n     */\n    get notebookConfig() {\n        return this._notebookConfig;\n    }\n    set notebookConfig(value) {\n        this._notebookConfig = value;\n    }\n    /**\n     * Create a new widget.\n     *\n     * #### Notes\n     * The factory will start the appropriate kernel.\n     */\n    createNewWidget(context, source) {\n        const translator = context.translator;\n        const kernelHistory = new _history__WEBPACK_IMPORTED_MODULE_2__.NotebookHistory({\n            sessionContext: context.sessionContext,\n            translator: translator\n        });\n        const nbOptions = {\n            rendermime: source\n                ? source.content.rendermime\n                : this.rendermime.clone({ resolver: context.urlResolver }),\n            contentFactory: this.contentFactory,\n            mimeTypeService: this.mimeTypeService,\n            editorConfig: source ? source.content.editorConfig : this._editorConfig,\n            notebookConfig: source\n                ? source.content.notebookConfig\n                : this._notebookConfig,\n            translator,\n            kernelHistory\n        };\n        const content = this.contentFactory.createNotebook(nbOptions);\n        return new _panel__WEBPACK_IMPORTED_MODULE_3__.NotebookPanel({ context, content });\n    }\n}\n//# sourceMappingURL=widgetfactory.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/widgetfactory.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/notebook/lib/windowing.js":
/*!*************************************************************!*\
  !*** ../node_modules/@jupyterlab/notebook/lib/windowing.js ***!
  \*************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   NotebookViewModel: () => (/* binding */ NotebookViewModel),\n/* harmony export */   NotebookWindowedLayout: () => (/* binding */ NotebookWindowedLayout)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/cells */ \"webpack/sharing/consume/default/@jupyterlab/cells/@jupyterlab/cells\");\n/* harmony import */ var _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__ = __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_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/messaging */ \"webpack/sharing/consume/default/@lumino/messaging/@lumino/messaging\");\n/* harmony import */ var _lumino_messaging__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_lumino_messaging__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _lumino_polling__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lumino/polling */ \"webpack/sharing/consume/default/@lumino/polling/@lumino/polling\");\n/* harmony import */ var _lumino_polling__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_lumino_polling__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lumino/widgets */ \"webpack/sharing/consume/default/@lumino/widgets/@lumino/widgets\");\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_lumino_widgets__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./constants */ \"../node_modules/@jupyterlab/notebook/lib/constants.js\");\n/*\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 * Notebook view model for the windowed list.\n */\nclass NotebookViewModel extends _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__.WindowedListModel {\n    /**\n     * Construct a notebook windowed list model.\n     */\n    constructor(cells, options) {\n        super(options);\n        this.cells = cells;\n        /**\n         * Cell size estimator\n         *\n         * @param index Cell index\n         * @returns Cell height in pixels\n         */\n        this.estimateWidgetSize = (index) => {\n            var _a;\n            const model = this.cells[index].model;\n            const height = this.cellsEstimatedHeight.get(model.id);\n            if (typeof height === 'number') {\n                return height;\n            }\n            const nLines = model.sharedModel.getSource().split('\\n').length;\n            let outputsLines = 0;\n            if (model instanceof _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__.CodeCellModel) {\n                for (let outputIdx = 0; outputIdx < model.outputs.length; outputIdx++) {\n                    const output = model.outputs.get(outputIdx);\n                    outputsLines = ((_a = output.data['text/plain']) !== null && _a !== void 0 ? _a : '').split('\\n').length;\n                }\n            }\n            return (NotebookViewModel.DEFAULT_EDITOR_LINE_HEIGHT * (nLines + outputsLines) +\n                NotebookViewModel.DEFAULT_CELL_MARGIN);\n        };\n        /**\n         * Render the cell at index.\n         *\n         * @param index Cell index\n         * @returns Cell widget\n         */\n        this.widgetRenderer = (index) => {\n            return this.cells[index];\n        };\n        /**\n         * Threshold used to decide if the cell should be scrolled to in the `smart` mode.\n         * Defaults to scrolling when less than a full line of the cell is visible.\n         */\n        this.scrollDownThreshold = NotebookViewModel.DEFAULT_CELL_MARGIN / 2 +\n            NotebookViewModel.DEFAULT_EDITOR_LINE_HEIGHT;\n        /**\n         * Threshold used to decide if the cell should be scrolled to in the `smart` mode.\n         * Defaults to scrolling when the cell margin or more is invisible.\n         */\n        this.scrollUpThreshold = NotebookViewModel.DEFAULT_CELL_MARGIN / 2;\n        /**\n         * Mapping between the cell ids and the cell estimated heights\n         *\n         * This height is not refreshed with the changes to the document.\n         * It is only used to measure cells outside the viewport on CPU\n         * idle cycle to improve UX scrolling.\n         */\n        this.cellsEstimatedHeight = new Map();\n        this._emitEstimatedHeightChanged = new _lumino_polling__WEBPACK_IMPORTED_MODULE_3__.Debouncer(() => {\n            this._stateChanged.emit({\n                name: 'estimatedWidgetSize',\n                newValue: null,\n                oldValue: null\n            });\n        });\n        // Set default cell size\n        this._estimatedWidgetSize = NotebookViewModel.DEFAULT_CELL_SIZE;\n    }\n    /**\n     * Set an estimated height for a cell\n     *\n     * @param cellId Cell ID\n     * @param size Cell height\n     */\n    setEstimatedWidgetSize(cellId, size) {\n        if (size === null) {\n            if (this.cellsEstimatedHeight.has(cellId)) {\n                this.cellsEstimatedHeight.delete(cellId);\n            }\n        }\n        else {\n            this.cellsEstimatedHeight.set(cellId, size);\n            this._emitEstimatedHeightChanged.invoke().catch(error => {\n                console.error('Fail to trigger an update following a estimated height update.', error);\n            });\n        }\n    }\n}\n/**\n * Default cell height\n */\nNotebookViewModel.DEFAULT_CELL_SIZE = 39;\n/**\n * Default editor line height\n */\nNotebookViewModel.DEFAULT_EDITOR_LINE_HEIGHT = 17;\n/**\n * Default cell margin (top + bottom)\n */\nNotebookViewModel.DEFAULT_CELL_MARGIN = 22;\n/**\n * Windowed list layout for the notebook.\n */\nclass NotebookWindowedLayout extends _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__.WindowedLayout {\n    constructor() {\n        super(...arguments);\n        this._header = null;\n        this._footer = null;\n        this._willBeRemoved = null;\n        this._topHiddenCodeCells = -1;\n    }\n    /**\n     * Notebook's header\n     */\n    get header() {\n        return this._header;\n    }\n    set header(header) {\n        var _a;\n        if (this._header && this._header.isAttached) {\n            _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__.Widget.detach(this._header);\n        }\n        this._header = header;\n        if (this._header && ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isAttached)) {\n            _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__.Widget.attach(this._header, this.parent.node);\n        }\n    }\n    /**\n     * Notebook widget's footer\n     */\n    get footer() {\n        return this._footer;\n    }\n    set footer(footer) {\n        var _a;\n        if (this._footer && this._footer.isAttached) {\n            _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__.Widget.detach(this._footer);\n        }\n        this._footer = footer;\n        if (this._footer && ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isAttached)) {\n            _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__.Widget.attach(this._footer, this.parent.outerNode);\n        }\n    }\n    /**\n     * Notebook's active cell\n     */\n    get activeCell() {\n        return this._activeCell;\n    }\n    set activeCell(widget) {\n        this._activeCell = widget;\n    }\n    /**\n     * Dispose the layout\n     * */\n    dispose() {\n        var _a, _b;\n        if (this.isDisposed) {\n            return;\n        }\n        (_a = this._header) === null || _a === void 0 ? void 0 : _a.dispose();\n        (_b = this._footer) === null || _b === void 0 ? void 0 : _b.dispose();\n        super.dispose();\n    }\n    /**\n     * * A message handler invoked on a `'child-removed'` message.\n     * *\n     * @param widget - The widget to remove from the layout.\n     *\n     * #### Notes\n     * A widget is automatically removed from the layout when its `parent`\n     * is set to `null`. This method should only be invoked directly when\n     * removing a widget from a layout which has yet to be installed on a\n     * parent widget.\n     *\n     * This method does *not* modify the widget's `parent`.\n     */\n    removeWidget(widget) {\n        const index = this.widgets.indexOf(widget);\n        // We need to deal with code cell widget not in viewport (aka not in this.widgets) but still\n        // partly attached\n        if (index >= 0) {\n            this.removeWidgetAt(index);\n        } // If the layout is parented, detach the widget from the DOM.\n        else if (widget === this._willBeRemoved && this.parent) {\n            this.detachWidget(index, widget);\n        }\n    }\n    /**\n     * Attach a widget to the parent's DOM node.\n     *\n     * @param index - The current index of the widget in the layout.\n     *\n     * @param widget - The widget to attach to the parent.\n     *\n     * #### Notes\n     * This method is called automatically by the panel layout at the\n     * appropriate time. It should not be called directly by user code.\n     *\n     * The default implementation adds the widgets's node to the parent's\n     * node at the proper location, and sends the appropriate attach\n     * messages to the widget if the parent is attached to the DOM.\n     *\n     * Subclasses may reimplement this method to control how the widget's\n     * node is added to the parent's node.\n     */\n    attachWidget(index, widget) {\n        // Status may change in onBeforeAttach\n        const wasPlaceholder = widget.isPlaceholder();\n        // Initialized sub-widgets or attached them for CodeCell\n        // Because this reattaches all sub-widget to the DOM which leads\n        // to a loss of focus, we do not call it for soft-hidden cells.\n        const isSoftHidden = this._isSoftHidden(widget);\n        if (this.parent.isAttached && !isSoftHidden) {\n            _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__.Widget.Msg.BeforeAttach);\n        }\n        if (isSoftHidden) {\n            // Restore visibility for active, or previously active cell\n            this._toggleSoftVisibility(widget, true);\n        }\n        if (!wasPlaceholder &&\n            widget instanceof _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__.CodeCell &&\n            widget.node.parentElement) {\n            // We don't remove code cells to preserve outputs internal state\n            widget.node.style.display = '';\n            // Reset cache\n            this._topHiddenCodeCells = -1;\n        }\n        else if (!isSoftHidden) {\n            // Look up the next sibling reference node.\n            const siblingIndex = this._findNearestChildBinarySearch(this.parent.viewportNode.childElementCount - 1, 0, parseInt(widget.dataset.windowedListIndex, 10) + 1);\n            let ref = this.parent.viewportNode.children[siblingIndex];\n            // Insert the widget's node before the sibling.\n            this.parent.viewportNode.insertBefore(widget.node, ref);\n            // Send an `'after-attach'` message if the parent is attached.\n            // Event listeners will be added here\n            // Some widgets are updating/resetting when attached, so\n            // we should not recall this each time a cell move into the\n            // viewport.\n            if (this.parent.isAttached) {\n                _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__.Widget.Msg.AfterAttach);\n            }\n        }\n        widget.inViewport = true;\n    }\n    /**\n     * Detach a widget from the parent's DOM node.\n     *\n     * @param index - The previous index of the widget in the layout.\n     *\n     * @param widget - The widget to detach from the parent.\n     *\n     * #### Notes\n     * This method is called automatically by the panel layout at the\n     * appropriate time. It should not be called directly by user code.\n     *\n     * The default implementation removes the widget's node from the\n     * parent's node, and sends the appropriate detach messages to the\n     * widget if the parent is attached to the DOM.\n     *\n     * Subclasses may reimplement this method to control how the widget's\n     * node is removed from the parent's node.\n     */\n    detachWidget(index, widget) {\n        widget.inViewport = false;\n        // Note: `index` is relative to the displayed cells, not all cells,\n        // hence we compare with the widget itself.\n        if (widget === this.activeCell && widget !== this._willBeRemoved) {\n            // Do not change display of the active cell to allow user to continue providing input\n            // into the code mirror editor when out of view. We still hide the cell so to prevent\n            // minor visual glitches when scrolling.\n            this._toggleSoftVisibility(widget, false);\n            // Return before sending \"AfterDetach\" message to CodeCell\n            // to prevent removing contents of the active cell.\n            return;\n        }\n        // TODO we could improve this further by discarding also the code cell without outputs\n        if (\n        // We detach the code cell currently dragged otherwise it won't be attached at the correct position\n        widget instanceof _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__.CodeCell &&\n            !widget.node.classList.contains(_constants__WEBPACK_IMPORTED_MODULE_5__.DROP_SOURCE_CLASS) &&\n            widget !== this._willBeRemoved) {\n            // We don't remove code cells to preserve outputs internal state\n            // Transform does not work because the widget height is kept (at least in FF)\n            widget.node.style.display = 'none';\n            // Reset cache\n            this._topHiddenCodeCells = -1;\n        }\n        else {\n            // Send a `'before-detach'` message if the parent is attached.\n            // This should not be called every time a cell leaves the viewport\n            // as it will remove listeners that won't be added back as afterAttach\n            // is shunted to avoid unwanted update/reset.\n            if (this.parent.isAttached) {\n                // Event listeners will be removed here\n                _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__.Widget.Msg.BeforeDetach);\n            }\n            // Remove the widget's node from the parent.\n            this.parent.viewportNode.removeChild(widget.node);\n            // Ensure to clean up drop target class if the widget move out of the viewport\n            widget.node.classList.remove(_constants__WEBPACK_IMPORTED_MODULE_5__.DROP_TARGET_CLASS);\n        }\n        if (this.parent.isAttached) {\n            // Detach sub widget of CodeCell except the OutputAreaWrapper\n            _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__.Widget.Msg.AfterDetach);\n        }\n    }\n    /**\n     * Move a widget in the parent's DOM node.\n     *\n     * @param fromIndex - The previous index of the widget in the layout.\n     *\n     * @param toIndex - The current index of the widget in the layout.\n     *\n     * @param widget - The widget to move in the parent.\n     *\n     * #### Notes\n     * This method is called automatically by the panel layout at the\n     * appropriate time. It should not be called directly by user code.\n     *\n     * The default implementation moves the widget's node to the proper\n     * location in the parent's node and sends the appropriate attach and\n     * detach messages to the widget if the parent is attached to the DOM.\n     *\n     * Subclasses may reimplement this method to control how the widget's\n     * node is moved in the parent's node.\n     */\n    moveWidget(fromIndex, toIndex, widget) {\n        // Optimize move without de-/attaching as motion appends with parent attached\n        // Case fromIndex === toIndex, already checked in PanelLayout.insertWidget\n        if (this._topHiddenCodeCells < 0) {\n            this._topHiddenCodeCells = 0;\n            for (let idx = 0; idx < this.parent.viewportNode.children.length; idx++) {\n                const n = this.parent.viewportNode.children[idx];\n                if (n.style.display == 'none') {\n                    this._topHiddenCodeCells++;\n                }\n                else {\n                    break;\n                }\n            }\n        }\n        const ref = this.parent.viewportNode.children[toIndex + this._topHiddenCodeCells];\n        if (fromIndex < toIndex) {\n            ref.insertAdjacentElement('afterend', widget.node);\n        }\n        else {\n            ref.insertAdjacentElement('beforebegin', widget.node);\n        }\n    }\n    onAfterAttach(msg) {\n        super.onAfterAttach(msg);\n        if (this._header && !this._header.isAttached) {\n            _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__.Widget.attach(this._header, this.parent.node, this.parent.node.firstElementChild);\n        }\n        if (this._footer && !this._footer.isAttached) {\n            _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__.Widget.attach(this._footer, this.parent.outerNode);\n        }\n    }\n    onBeforeDetach(msg) {\n        var _a, _b;\n        if ((_a = this._header) === null || _a === void 0 ? void 0 : _a.isAttached) {\n            _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__.Widget.detach(this._header);\n        }\n        if ((_b = this._footer) === null || _b === void 0 ? void 0 : _b.isAttached) {\n            _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__.Widget.detach(this._footer);\n        }\n        super.onBeforeDetach(msg);\n    }\n    /**\n     * A message handler invoked on a `'child-removed'` message.\n     *\n     * @param msg Message\n     */\n    onChildRemoved(msg) {\n        this._willBeRemoved = msg.child;\n        super.onChildRemoved(msg);\n        this._willBeRemoved = null;\n    }\n    /**\n     * Toggle \"soft\" visibility of the widget.\n     *\n     * #### Notes\n     * To ensure that user events reach the CodeMirror editor, this method\n     * does not toggle `display` nor `visibility` which have side effects,\n     * but instead hides it in the compositor and ensures that the bounding\n     * box is has an area equal to zero.\n     * To ensure we do not trigger style recalculation, we set the styles\n     * directly on the node instead of using a class.\n     */\n    _toggleSoftVisibility(widget, show) {\n        if (show) {\n            widget.node.style.opacity = '';\n            widget.node.style.height = '';\n            widget.node.style.padding = '';\n        }\n        else {\n            widget.node.style.opacity = '0';\n            // Both padding and height need to be set to zero\n            // to ensure bounding box collapses to invisible.\n            widget.node.style.height = '0';\n            widget.node.style.padding = '0';\n        }\n    }\n    _isSoftHidden(widget) {\n        return widget.node.style.opacity === '0';\n    }\n    _findNearestChildBinarySearch(high, low, index) {\n        while (low <= high) {\n            const middle = low + Math.floor((high - low) / 2);\n            const currentIndex = parseInt(this.parent.viewportNode.children[middle].dataset\n                .windowedListIndex, 10);\n            if (currentIndex === index) {\n                return middle;\n            }\n            else if (currentIndex < index) {\n                low = middle + 1;\n            }\n            else if (currentIndex > index) {\n                high = middle - 1;\n            }\n        }\n        if (low > 0) {\n            return low;\n        }\n        else {\n            return 0;\n        }\n    }\n}\n//# sourceMappingURL=windowing.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/notebook/lib/windowing.js?");

/***/ })

}]);