/*
 * 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_jupyter_ydoc_lib_index_js-node_modules_process_browser_js"],{

/***/ "../node_modules/@jupyter/ydoc/lib/api.js":
/*!************************************************!*\
  !*** ../node_modules/@jupyter/ydoc/lib/api.js ***!
  \************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n\n//# sourceMappingURL=api.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyter/ydoc/lib/api.js?");

/***/ }),

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

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"YBaseCell\": () => (/* reexport safe */ _ycell_js__WEBPACK_IMPORTED_MODULE_6__.YBaseCell),\n/* harmony export */   \"YCodeCell\": () => (/* reexport safe */ _ycell_js__WEBPACK_IMPORTED_MODULE_6__.YCodeCell),\n/* harmony export */   \"YDocument\": () => (/* reexport safe */ _ydocument_js__WEBPACK_IMPORTED_MODULE_3__.YDocument),\n/* harmony export */   \"YFile\": () => (/* reexport safe */ _yfile_js__WEBPACK_IMPORTED_MODULE_4__.YFile),\n/* harmony export */   \"YMarkdownCell\": () => (/* reexport safe */ _ycell_js__WEBPACK_IMPORTED_MODULE_6__.YMarkdownCell),\n/* harmony export */   \"YNotebook\": () => (/* reexport safe */ _ynotebook_js__WEBPACK_IMPORTED_MODULE_5__.YNotebook),\n/* harmony export */   \"YRawCell\": () => (/* reexport safe */ _ycell_js__WEBPACK_IMPORTED_MODULE_6__.YRawCell),\n/* harmony export */   \"convertYMapEventToMapChange\": () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_1__.convertYMapEventToMapChange),\n/* harmony export */   \"createMutex\": () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_1__.createMutex),\n/* harmony export */   \"createStandaloneCell\": () => (/* reexport safe */ _ycell_js__WEBPACK_IMPORTED_MODULE_6__.createStandaloneCell)\n/* harmony export */ });\n/* harmony import */ var _api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./api.js */ \"../node_modules/@jupyter/ydoc/lib/api.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"../node_modules/@jupyter/ydoc/lib/utils.js\");\n/* harmony import */ var _ytext_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ytext.js */ \"../node_modules/@jupyter/ydoc/lib/ytext.js\");\n/* harmony import */ var _ydocument_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ydocument.js */ \"../node_modules/@jupyter/ydoc/lib/ydocument.js\");\n/* harmony import */ var _yfile_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./yfile.js */ \"../node_modules/@jupyter/ydoc/lib/yfile.js\");\n/* harmony import */ var _ynotebook_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ynotebook.js */ \"../node_modules/@jupyter/ydoc/lib/ynotebook.js\");\n/* harmony import */ var _ycell_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ycell.js */ \"../node_modules/@jupyter/ydoc/lib/ycell.js\");\n/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n/**\n * @packageDocumentation\n * @module ydoc\n */\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyter/ydoc/lib/index.js?");

/***/ }),

/***/ "../node_modules/@jupyter/ydoc/lib/utils.js":
/*!**************************************************!*\
  !*** ../node_modules/@jupyter/ydoc/lib/utils.js ***!
  \**************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"convertYMapEventToMapChange\": () => (/* binding */ convertYMapEventToMapChange),\n/* harmony export */   \"createMutex\": () => (/* binding */ createMutex)\n/* harmony export */ });\n/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\nfunction convertYMapEventToMapChange(event) {\n    let changes = new Map();\n    event.changes.keys.forEach((event, key) => {\n        changes.set(key, {\n            action: event.action,\n            oldValue: event.oldValue,\n            newValue: this.ymeta.get(key)\n        });\n    });\n    return changes;\n}\n/**\n * Creates a mutual exclude function with the following property:\n *\n * ```js\n * const mutex = createMutex()\n * mutex(() => {\n *   // This function is immediately executed\n *   mutex(() => {\n *     // This function is not executed, as the mutex is already active.\n *   })\n * })\n * ```\n */\nconst createMutex = () => {\n    let token = true;\n    return (f) => {\n        if (token) {\n            token = false;\n            try {\n                f();\n            }\n            finally {\n                token = true;\n            }\n        }\n    };\n};\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyter/ydoc/lib/utils.js?");

/***/ }),

/***/ "../node_modules/@jupyter/ydoc/lib/ycell.js":
/*!**************************************************!*\
  !*** ../node_modules/@jupyter/ydoc/lib/ycell.js ***!
  \**************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"YBaseCell\": () => (/* binding */ YBaseCell),\n/* harmony export */   \"YCodeCell\": () => (/* binding */ YCodeCell),\n/* harmony export */   \"YMarkdownCell\": () => (/* binding */ YMarkdownCell),\n/* harmony export */   \"YRawCell\": () => (/* binding */ YRawCell),\n/* harmony export */   \"createCell\": () => (/* binding */ createCell),\n/* harmony export */   \"createCellModelFromSharedType\": () => (/* binding */ createCellModelFromSharedType),\n/* harmony export */   \"createStandaloneCell\": () => (/* binding */ createStandaloneCell)\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/* 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/* harmony import */ var y_protocols_awareness__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! y-protocols/awareness */ \"../node_modules/y-protocols/awareness.js\");\n/* harmony import */ var yjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! yjs */ \"webpack/sharing/consume/default/yjs/yjs\");\n/* harmony import */ var yjs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(yjs__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 * Create a new shared cell model given the YJS shared type.\n */\nconst createCellModelFromSharedType = (type, options = {}) => {\n    switch (type.get('cell_type')) {\n        case 'code':\n            return new YCodeCell(type, type.get('source'), type.get('outputs'), options);\n        case 'markdown':\n            return new YMarkdownCell(type, type.get('source'), options);\n        case 'raw':\n            return new YRawCell(type, type.get('source'), options);\n        default:\n            throw new Error('Found unknown cell type');\n    }\n};\n/**\n * Create a new cell that can be inserted in an existing shared model.\n *\n * If no notebook is specified the cell will be standalone.\n *\n * @param cell Cell JSON representation\n * @param notebook Notebook to which the cell will be added\n */\nconst createCell = (cell, notebook) => {\n    var _a, _b;\n    const ymodel = new yjs__WEBPACK_IMPORTED_MODULE_3__.Map();\n    const ysource = new yjs__WEBPACK_IMPORTED_MODULE_3__.Text();\n    const ymetadata = new yjs__WEBPACK_IMPORTED_MODULE_3__.Map();\n    ymodel.set('source', ysource);\n    ymodel.set('metadata', ymetadata);\n    ymodel.set('cell_type', cell.cell_type);\n    ymodel.set('id', (_a = cell.id) !== null && _a !== void 0 ? _a : _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.UUID.uuid4());\n    let ycell;\n    switch (cell.cell_type) {\n        case 'markdown': {\n            ycell = new YMarkdownCell(ymodel, ysource, { notebook }, ymetadata);\n            if (cell.attachments != null) {\n                ycell.setAttachments(cell.attachments);\n            }\n            break;\n        }\n        case 'code': {\n            const youtputs = new yjs__WEBPACK_IMPORTED_MODULE_3__.Array();\n            ymodel.set('outputs', youtputs);\n            ycell = new YCodeCell(ymodel, ysource, youtputs, {\n                notebook\n            }, ymetadata);\n            const cCell = cell;\n            ycell.execution_count = (_b = cCell.execution_count) !== null && _b !== void 0 ? _b : null;\n            if (cCell.outputs) {\n                ycell.setOutputs(cCell.outputs);\n            }\n            break;\n        }\n        default: {\n            // raw\n            ycell = new YRawCell(ymodel, ysource, { notebook }, ymetadata);\n            if (cell.attachments) {\n                ycell.setAttachments(cell.attachments);\n            }\n            break;\n        }\n    }\n    if (cell.metadata != null) {\n        ycell.setMetadata(cell.metadata);\n    }\n    if (cell.source != null) {\n        ycell.setSource(typeof cell.source === 'string' ? cell.source : cell.source.join('\\n'));\n    }\n    return ycell;\n};\n/**\n * Create a new cell that cannot be inserted in an existing shared model.\n *\n * @param cell Cell JSON representation\n */\nconst createStandaloneCell = (cell) => createCell(cell);\nclass YBaseCell {\n    /**\n     * Create a new YCell that works standalone. It cannot be\n     * inserted into a YNotebook because the Yjs model is already\n     * attached to an anonymous Y.Doc instance.\n     */\n    static create(id) {\n        return createCell({ id, cell_type: this.prototype.cell_type });\n    }\n    /**\n     * Base cell constructor\n     *\n     * ### Notes\n     * Don't use the constructor directly - prefer using ``YNotebook.insertCell``\n     *\n     * The ``ysource`` is needed because ``ymodel.get('source')`` will\n     * not return the real source if the model is not yet attached to\n     * a document. Requesting it explicitly allows to introspect a non-empty\n     * source before the cell is attached to the document.\n     *\n     * @param ymodel Cell map\n     * @param ysource Cell source\n     * @param options \\{ notebook?: The notebook the cell is attached to \\}\n     * @param ymetadata Cell metadata\n     */\n    constructor(ymodel, ysource, options = {}, ymetadata) {\n        /**\n         * Handle a change to the ymodel.\n         */\n        this._modelObserver = (events) => {\n            this._changed.emit(this.getChanges(events));\n        };\n        this._metadataChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__.Signal(this);\n        /**\n         * The notebook that this cell belongs to.\n         */\n        this._notebook = null;\n        this._changed = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__.Signal(this);\n        this._disposed = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__.Signal(this);\n        this._isDisposed = false;\n        this._undoManager = null;\n        this.ymodel = ymodel;\n        this._ysource = ysource;\n        this._ymetadata = ymetadata !== null && ymetadata !== void 0 ? ymetadata : this.ymodel.get('metadata');\n        this._prevSourceLength = ysource ? ysource.length : 0;\n        this._notebook = null;\n        this._awareness = null;\n        this._undoManager = null;\n        if (options.notebook) {\n            this._notebook = options.notebook;\n            // We cannot create a undo manager with the cell not yet attached in the notebook\n            // so we defer that to the notebook insertCell method\n        }\n        else {\n            // Standalone cell\n            const doc = new yjs__WEBPACK_IMPORTED_MODULE_3__.Doc();\n            doc.getArray().insert(0, [this.ymodel]);\n            this._awareness = new y_protocols_awareness__WEBPACK_IMPORTED_MODULE_2__.Awareness(doc);\n            this._undoManager = new yjs__WEBPACK_IMPORTED_MODULE_3__.UndoManager([this.ymodel], {\n                trackedOrigins: new Set([this])\n            });\n        }\n        this.ymodel.observeDeep(this._modelObserver);\n    }\n    /**\n     * Cell notebook awareness or null if the cell is standalone.\n     */\n    get awareness() {\n        var _a, _b, _c;\n        return (_c = (_a = this._awareness) !== null && _a !== void 0 ? _a : (_b = this.notebook) === null || _b === void 0 ? void 0 : _b.awareness) !== null && _c !== void 0 ? _c : null;\n    }\n    /**\n     * The type of the cell.\n     */\n    get cell_type() {\n        throw new Error('A YBaseCell must not be constructed');\n    }\n    /**\n     * The changed signal.\n     */\n    get changed() {\n        return this._changed;\n    }\n    /**\n     * Signal emitted when the cell is disposed.\n     */\n    get disposed() {\n        return this._disposed;\n    }\n    /**\n     * Cell id\n     */\n    get id() {\n        return this.getId();\n    }\n    /**\n     * Whether the model has been disposed or not.\n     */\n    get isDisposed() {\n        return this._isDisposed;\n    }\n    /**\n     * Whether the cell is standalone or not.\n     *\n     * If the cell is standalone. It cannot be\n     * inserted into a YNotebook because the Yjs model is already\n     * attached to an anonymous Y.Doc instance.\n     */\n    get isStandalone() {\n        return this._notebook !== null;\n    }\n    /**\n     * Cell metadata.\n     *\n     * #### Notes\n     * You should prefer to access and modify the specific key of interest.\n     */\n    get metadata() {\n        return this.getMetadata();\n    }\n    set metadata(v) {\n        this.setMetadata(v);\n    }\n    /**\n     * Signal triggered when the cell metadata changes.\n     */\n    get metadataChanged() {\n        return this._metadataChanged;\n    }\n    /**\n     * The notebook that this cell belongs to.\n     */\n    get notebook() {\n        return this._notebook;\n    }\n    /**\n     * Cell input content.\n     */\n    get source() {\n        return this.getSource();\n    }\n    set source(v) {\n        this.setSource(v);\n    }\n    /**\n     * The cell undo manager.\n     */\n    get undoManager() {\n        var _a;\n        if (!this.notebook) {\n            return this._undoManager;\n        }\n        return ((_a = this.notebook) === null || _a === void 0 ? void 0 : _a.disableDocumentWideUndoRedo)\n            ? this._undoManager\n            : this.notebook.undoManager;\n    }\n    /**\n     * Defer setting the undo manager as it requires the\n     * cell to be attached to the notebook Y document.\n     */\n    setUndoManager() {\n        if (this._undoManager) {\n            throw new Error('The cell undo manager is already set.');\n        }\n        if (this._notebook && this._notebook.disableDocumentWideUndoRedo) {\n            this._undoManager = new yjs__WEBPACK_IMPORTED_MODULE_3__.UndoManager([this.ymodel], {\n                trackedOrigins: new Set([this])\n            });\n        }\n    }\n    get ysource() {\n        return this._ysource;\n    }\n    /**\n     * Whether the object can undo changes.\n     */\n    canUndo() {\n        return !!this.undoManager && this.undoManager.undoStack.length > 0;\n    }\n    /**\n     * Whether the object can redo changes.\n     */\n    canRedo() {\n        return !!this.undoManager && this.undoManager.redoStack.length > 0;\n    }\n    /**\n     * Clear the change stack.\n     */\n    clearUndoHistory() {\n        var _a;\n        (_a = this.undoManager) === null || _a === void 0 ? void 0 : _a.clear();\n    }\n    /**\n     * Undo an operation.\n     */\n    undo() {\n        var _a;\n        (_a = this.undoManager) === null || _a === void 0 ? void 0 : _a.undo();\n    }\n    /**\n     * Redo an operation.\n     */\n    redo() {\n        var _a;\n        (_a = this.undoManager) === null || _a === void 0 ? void 0 : _a.redo();\n    }\n    /**\n     * Dispose of the resources.\n     */\n    dispose() {\n        var _a;\n        if (this._isDisposed)\n            return;\n        this._isDisposed = true;\n        this.ymodel.unobserveDeep(this._modelObserver);\n        if (this._awareness) {\n            // A new document is created for standalone cell.\n            const doc = this._awareness.doc;\n            this._awareness.destroy();\n            doc.destroy();\n        }\n        if (this._undoManager) {\n            // Be sure to not destroy the document undo manager.\n            if (this._undoManager === ((_a = this.notebook) === null || _a === void 0 ? void 0 : _a.undoManager)) {\n                this._undoManager = null;\n            }\n            else {\n                this._undoManager.destroy();\n            }\n        }\n        this._disposed.emit();\n        _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__.Signal.clearData(this);\n    }\n    /**\n     * Get cell id.\n     *\n     * @returns Cell id\n     */\n    getId() {\n        return this.ymodel.get('id');\n    }\n    /**\n     * Gets cell's source.\n     *\n     * @returns Cell's source.\n     */\n    getSource() {\n        return this.ysource.toString();\n    }\n    /**\n     * Sets cell's source.\n     *\n     * @param value: New source.\n     */\n    setSource(value) {\n        this.transact(() => {\n            this.ysource.delete(0, this.ysource.length);\n            this.ysource.insert(0, value);\n        });\n        // @todo Do we need proper replace semantic? This leads to issues in editor bindings because they don't switch source.\n        // this.ymodel.set('source', new Y.Text(value));\n    }\n    /**\n     * Replace content from `start' to `end` with `value`.\n     *\n     * @param start: The start index of the range to replace (inclusive).\n     *\n     * @param end: The end index of the range to replace (exclusive).\n     *\n     * @param value: New source (optional).\n     */\n    updateSource(start, end, value = '') {\n        this.transact(() => {\n            const ysource = this.ysource;\n            // insert and then delete.\n            // This ensures that the cursor position is adjusted after the replaced content.\n            ysource.insert(start, value);\n            ysource.delete(start + value.length, end - start);\n        });\n    }\n    /**\n     * Delete a metadata cell.\n     *\n     * @param key The key to delete\n     */\n    deleteMetadata(key) {\n        if (typeof this.getMetadata(key) === 'undefined') {\n            return;\n        }\n        this.transact(() => {\n            this._ymetadata.delete(key);\n            const jupyter = this.getMetadata('jupyter');\n            if (key === 'collapsed' && jupyter) {\n                // eslint-disable-next-line @typescript-eslint/no-unused-vars\n                const { outputs_hidden, ...others } = jupyter;\n                if (Object.keys(others).length === 0) {\n                    this._ymetadata.delete('jupyter');\n                }\n                else {\n                    this._ymetadata.set('jupyter', others);\n                }\n            }\n            else if (key === 'jupyter') {\n                this._ymetadata.delete('collapsed');\n            }\n        }, false);\n    }\n    getMetadata(key) {\n        const metadata = this._ymetadata;\n        // Transiently the metadata can be missing - like during destruction\n        if (metadata === undefined) {\n            return undefined;\n        }\n        if (typeof key === 'string') {\n            const value = metadata.get(key);\n            return typeof value === 'undefined'\n                ? undefined // undefined is converted to `{}` by `JSONExt.deepCopy`\n                : _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.JSONExt.deepCopy(metadata.get(key));\n        }\n        else {\n            return _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.JSONExt.deepCopy(metadata.toJSON());\n        }\n    }\n    setMetadata(metadata, value) {\n        var _a, _b;\n        if (typeof metadata === 'string') {\n            if (typeof value === 'undefined') {\n                throw new TypeError(`Metadata value for ${metadata} cannot be 'undefined'; use deleteMetadata.`);\n            }\n            const key = metadata;\n            // Only set metadata if we change something to avoid infinite\n            // loop of signal changes.\n            if (_lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.JSONExt.deepEqual((_a = this.getMetadata(key)) !== null && _a !== void 0 ? _a : null, value)) {\n                return;\n            }\n            this.transact(() => {\n                var _a;\n                this._ymetadata.set(key, value);\n                if (key === 'collapsed') {\n                    const jupyter = ((_a = this.getMetadata('jupyter')) !== null && _a !== void 0 ? _a : {});\n                    if (jupyter.outputs_hidden !== value) {\n                        this.setMetadata('jupyter', {\n                            ...jupyter,\n                            outputs_hidden: value\n                        });\n                    }\n                }\n                else if (key === 'jupyter') {\n                    const isHidden = value['outputs_hidden'];\n                    if (typeof isHidden !== 'undefined') {\n                        if (this.getMetadata('collapsed') !== isHidden) {\n                            this.setMetadata('collapsed', isHidden);\n                        }\n                    }\n                    else {\n                        this.deleteMetadata('collapsed');\n                    }\n                }\n            }, false);\n        }\n        else {\n            const clone = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.JSONExt.deepCopy(metadata);\n            if (clone.collapsed != null) {\n                clone.jupyter = clone.jupyter || {};\n                clone.jupyter.outputs_hidden = clone.collapsed;\n            }\n            else if (((_b = clone === null || clone === void 0 ? void 0 : clone.jupyter) === null || _b === void 0 ? void 0 : _b.outputs_hidden) != null) {\n                clone.collapsed = clone.jupyter.outputs_hidden;\n            }\n            if (!_lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.JSONExt.deepEqual(clone, this.getMetadata())) {\n                this.transact(() => {\n                    for (const [key, value] of Object.entries(clone)) {\n                        this._ymetadata.set(key, value);\n                    }\n                }, false);\n            }\n        }\n    }\n    /**\n     * Serialize the model to JSON.\n     */\n    toJSON() {\n        return {\n            id: this.getId(),\n            cell_type: this.cell_type,\n            source: this.getSource(),\n            metadata: this.getMetadata()\n        };\n    }\n    /**\n     * Perform a transaction. While the function f is called, all changes to the shared\n     * document are bundled into a single event.\n     *\n     * @param f Transaction to execute\n     * @param undoable Whether to track the change in the action history or not (default `true`)\n     */\n    transact(f, undoable = true) {\n        !this.notebook || this.notebook.disableDocumentWideUndoRedo\n            ? this.ymodel.doc == null\n                ? f()\n                : this.ymodel.doc.transact(f, undoable ? this : null)\n            : this.notebook.transact(f, undoable);\n    }\n    /**\n     * Extract changes from YJS events\n     *\n     * @param events YJS events\n     * @returns Cell changes\n     */\n    getChanges(events) {\n        const changes = {};\n        const sourceEvent = events.find(event => event.target === this.ymodel.get('source'));\n        if (sourceEvent) {\n            changes.sourceChange = sourceEvent.changes.delta;\n        }\n        const metadataEvents = events.find(event => event.target === this._ymetadata);\n        if (metadataEvents) {\n            changes.metadataChange = metadataEvents.changes.keys;\n            metadataEvents.changes.keys.forEach((change, key) => {\n                switch (change.action) {\n                    case 'add':\n                        this._metadataChanged.emit({\n                            key,\n                            newValue: this._ymetadata.get(key),\n                            type: 'add'\n                        });\n                        break;\n                    case 'delete':\n                        this._metadataChanged.emit({\n                            key,\n                            oldValue: change.oldValue,\n                            type: 'remove'\n                        });\n                        break;\n                    case 'update':\n                        {\n                            const newValue = this._ymetadata.get(key);\n                            const oldValue = change.oldValue;\n                            let equal = true;\n                            if (typeof oldValue == 'object' && typeof newValue == 'object') {\n                                equal = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.JSONExt.deepEqual(oldValue, newValue);\n                            }\n                            else {\n                                equal = oldValue === newValue;\n                            }\n                            if (!equal) {\n                                this._metadataChanged.emit({\n                                    key,\n                                    type: 'change',\n                                    oldValue,\n                                    newValue\n                                });\n                            }\n                        }\n                        break;\n                }\n            });\n        }\n        const modelEvent = events.find(event => event.target === this.ymodel);\n        // The model allows us to replace the complete source with a new string. We express this in the Delta format\n        // as a replace of the complete string.\n        const ysource = this.ymodel.get('source');\n        if (modelEvent && modelEvent.keysChanged.has('source')) {\n            changes.sourceChange = [\n                { delete: this._prevSourceLength },\n                { insert: ysource.toString() }\n            ];\n        }\n        this._prevSourceLength = ysource.length;\n        return changes;\n    }\n}\n/**\n * Shareable code cell.\n */\nclass YCodeCell extends YBaseCell {\n    /**\n     * Create a new YCodeCell that works standalone. It cannot be\n     * inserted into a YNotebook because the Yjs model is already\n     * attached to an anonymous Y.Doc instance.\n     */\n    static create(id) {\n        return super.create(id);\n    }\n    /**\n     * Code cell constructor\n     *\n     * ### Notes\n     * Don't use the constructor directly - prefer using ``YNotebook.insertCell``\n     *\n     * The ``ysource`` is needed because ``ymodel.get('source')`` will\n     * not return the real source if the model is not yet attached to\n     * a document. Requesting it explicitly allows to introspect a non-empty\n     * source before the cell is attached to the document.\n     *\n     * @param ymodel Cell map\n     * @param ysource Cell source\n     * @param youtputs Code cell outputs\n     * @param options \\{ notebook?: The notebook the cell is attached to \\}\n     * @param ymetadata Cell metadata\n     */\n    constructor(ymodel, ysource, youtputs, options = {}, ymetadata) {\n        super(ymodel, ysource, options, ymetadata);\n        this._youtputs = youtputs;\n    }\n    /**\n     * The type of the cell.\n     */\n    get cell_type() {\n        return 'code';\n    }\n    /**\n     * The code cell's prompt number. Will be null if the cell has not been run.\n     */\n    get execution_count() {\n        return this.ymodel.get('execution_count') || null;\n    }\n    set execution_count(count) {\n        // Do not use `this.execution_count`. When initializing the\n        // cell, we need to set execution_count to `null` if we compare\n        // using `this.execution_count` it will return `null` and we will\n        // never initialize it\n        if (this.ymodel.get('execution_count') !== count) {\n            this.transact(() => {\n                this.ymodel.set('execution_count', count);\n            }, false);\n        }\n    }\n    /**\n     * Cell outputs.\n     */\n    get outputs() {\n        return this.getOutputs();\n    }\n    set outputs(v) {\n        this.setOutputs(v);\n    }\n    /**\n     * Execution, display, or stream outputs.\n     */\n    getOutputs() {\n        return _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.JSONExt.deepCopy(this._youtputs.toArray());\n    }\n    /**\n     * Replace all outputs.\n     */\n    setOutputs(outputs) {\n        this.transact(() => {\n            this._youtputs.delete(0, this._youtputs.length);\n            this._youtputs.insert(0, outputs);\n        }, false);\n    }\n    /**\n     * Replace content from `start' to `end` with `outputs`.\n     *\n     * @param start: The start index of the range to replace (inclusive).\n     *\n     * @param end: The end index of the range to replace (exclusive).\n     *\n     * @param outputs: New outputs (optional).\n     */\n    updateOutputs(start, end, outputs = []) {\n        const fin = end < this._youtputs.length ? end - start : this._youtputs.length - start;\n        this.transact(() => {\n            this._youtputs.delete(start, fin);\n            this._youtputs.insert(start, outputs);\n        }, false);\n    }\n    /**\n     * Serialize the model to JSON.\n     */\n    toJSON() {\n        return {\n            ...super.toJSON(),\n            outputs: this.getOutputs(),\n            execution_count: this.execution_count\n        };\n    }\n    /**\n     * Extract changes from YJS events\n     *\n     * @param events YJS events\n     * @returns Cell changes\n     */\n    getChanges(events) {\n        const changes = super.getChanges(events);\n        const outputEvent = events.find(event => event.target === this.ymodel.get('outputs'));\n        if (outputEvent) {\n            changes.outputsChange = outputEvent.changes.delta;\n        }\n        const modelEvent = events.find(event => event.target === this.ymodel);\n        if (modelEvent && modelEvent.keysChanged.has('execution_count')) {\n            const change = modelEvent.changes.keys.get('execution_count');\n            changes.executionCountChange = {\n                oldValue: change.oldValue,\n                newValue: this.ymodel.get('execution_count')\n            };\n        }\n        return changes;\n    }\n}\nclass YAttachmentCell extends YBaseCell {\n    /**\n     * Cell attachments\n     */\n    get attachments() {\n        return this.getAttachments();\n    }\n    set attachments(v) {\n        this.setAttachments(v);\n    }\n    /**\n     * Gets the cell attachments.\n     *\n     * @returns The cell attachments.\n     */\n    getAttachments() {\n        return this.ymodel.get('attachments');\n    }\n    /**\n     * Sets the cell attachments\n     *\n     * @param attachments: The cell attachments.\n     */\n    setAttachments(attachments) {\n        this.transact(() => {\n            if (attachments == null) {\n                this.ymodel.delete('attachments');\n            }\n            else {\n                this.ymodel.set('attachments', attachments);\n            }\n        }, false);\n    }\n    /**\n     * Extract changes from YJS events\n     *\n     * @param events YJS events\n     * @returns Cell changes\n     */\n    getChanges(events) {\n        const changes = super.getChanges(events);\n        const modelEvent = events.find(event => event.target === this.ymodel);\n        if (modelEvent && modelEvent.keysChanged.has('attachments')) {\n            const change = modelEvent.changes.keys.get('attachments');\n            changes.executionCountChange = {\n                oldValue: change.oldValue,\n                newValue: this.ymodel.get('attachments')\n            };\n        }\n        return changes;\n    }\n}\n/**\n * Shareable raw cell.\n */\nclass YRawCell extends YAttachmentCell {\n    /**\n     * Create a new YRawCell that works standalone. It cannot be\n     * inserted into a YNotebook because the Yjs model is already\n     * attached to an anonymous Y.Doc instance.\n     */\n    static create(id) {\n        return super.create(id);\n    }\n    /**\n     * String identifying the type of cell.\n     */\n    get cell_type() {\n        return 'raw';\n    }\n    /**\n     * Serialize the model to JSON.\n     */\n    toJSON() {\n        return {\n            id: this.getId(),\n            cell_type: 'raw',\n            source: this.getSource(),\n            metadata: this.getMetadata(),\n            attachments: this.getAttachments()\n        };\n    }\n}\n/**\n * Shareable markdown cell.\n */\nclass YMarkdownCell extends YAttachmentCell {\n    /**\n     * Create a new YMarkdownCell that works standalone. It cannot be\n     * inserted into a YNotebook because the Yjs model is already\n     * attached to an anonymous Y.Doc instance.\n     */\n    static create(id) {\n        return super.create(id);\n    }\n    /**\n     * String identifying the type of cell.\n     */\n    get cell_type() {\n        return 'markdown';\n    }\n    /**\n     * Serialize the model to JSON.\n     */\n    toJSON() {\n        return {\n            id: this.getId(),\n            cell_type: 'markdown',\n            source: this.getSource(),\n            metadata: this.getMetadata(),\n            attachments: this.getAttachments()\n        };\n    }\n}\n//# sourceMappingURL=ycell.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyter/ydoc/lib/ycell.js?");

/***/ }),

/***/ "../node_modules/@jupyter/ydoc/lib/ydocument.js":
/*!******************************************************!*\
  !*** ../node_modules/@jupyter/ydoc/lib/ydocument.js ***!
  \******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"YDocument\": () => (/* binding */ YDocument)\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/* 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/* harmony import */ var y_protocols_awareness__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! y-protocols/awareness */ \"../node_modules/y-protocols/awareness.js\");\n/* harmony import */ var yjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! yjs */ \"webpack/sharing/consume/default/yjs/yjs\");\n/* harmony import */ var yjs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(yjs__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 * Generic shareable document.\n */\nclass YDocument {\n    constructor(options) {\n        var _a;\n        /**\n         * Handle a change to the ystate.\n         */\n        this.onStateChanged = (event) => {\n            const stateChange = new Array();\n            event.keysChanged.forEach(key => {\n                const change = event.changes.keys.get(key);\n                if (change) {\n                    stateChange.push({\n                        name: key,\n                        oldValue: change.oldValue,\n                        newValue: this.ystate.get(key)\n                    });\n                }\n            });\n            this._changed.emit({ stateChange });\n        };\n        this._changed = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__.Signal(this);\n        this._isDisposed = false;\n        this._disposed = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__.Signal(this);\n        this._ydoc = (_a = options === null || options === void 0 ? void 0 : options.ydoc) !== null && _a !== void 0 ? _a : new yjs__WEBPACK_IMPORTED_MODULE_3__.Doc();\n        this._ystate = this._ydoc.getMap('state');\n        this._undoManager = new yjs__WEBPACK_IMPORTED_MODULE_3__.UndoManager([], {\n            trackedOrigins: new Set([this]),\n            doc: this._ydoc\n        });\n        this._awareness = new y_protocols_awareness__WEBPACK_IMPORTED_MODULE_2__.Awareness(this._ydoc);\n        this._ystate.observe(this.onStateChanged);\n    }\n    /**\n     * YJS document.\n     */\n    get ydoc() {\n        return this._ydoc;\n    }\n    /**\n     * Shared state\n     */\n    get ystate() {\n        return this._ystate;\n    }\n    /**\n     * YJS document undo manager\n     */\n    get undoManager() {\n        return this._undoManager;\n    }\n    /**\n     * Shared awareness\n     */\n    get awareness() {\n        return this._awareness;\n    }\n    /**\n     * The changed signal.\n     */\n    get changed() {\n        return this._changed;\n    }\n    /**\n     * A signal emitted when the document is disposed.\n     */\n    get disposed() {\n        return this._disposed;\n    }\n    /**\n     * Whether the document is disposed or not.\n     */\n    get isDisposed() {\n        return this._isDisposed;\n    }\n    /**\n     * Document state\n     */\n    get state() {\n        return _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.JSONExt.deepCopy(this.ystate.toJSON());\n    }\n    /**\n     * Whether the object can undo changes.\n     */\n    canUndo() {\n        return this.undoManager.undoStack.length > 0;\n    }\n    /**\n     * Whether the object can redo changes.\n     */\n    canRedo() {\n        return this.undoManager.redoStack.length > 0;\n    }\n    /**\n     * Dispose of the resources.\n     */\n    dispose() {\n        if (this._isDisposed) {\n            return;\n        }\n        this._isDisposed = true;\n        this.ystate.unobserve(this.onStateChanged);\n        this.awareness.destroy();\n        this.undoManager.destroy();\n        this.ydoc.destroy();\n        this._disposed.emit();\n        _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__.Signal.clearData(this);\n    }\n    /**\n     * Get the value for a state attribute\n     *\n     * @param key Key to get\n     */\n    getState(key) {\n        const value = this.ystate.get(key);\n        return typeof value === 'undefined'\n            ? value\n            : _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.JSONExt.deepCopy(value);\n    }\n    /**\n     * Set the value of a state attribute\n     *\n     * @param key Key to set\n     * @param value New attribute value\n     */\n    setState(key, value) {\n        if (!_lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.JSONExt.deepEqual(this.ystate.get(key), value)) {\n            this.ystate.set(key, value);\n        }\n    }\n    /**\n     * Undo an operation.\n     */\n    undo() {\n        this.undoManager.undo();\n    }\n    /**\n     * Redo an operation.\n     */\n    redo() {\n        this.undoManager.redo();\n    }\n    /**\n     * Clear the change stack.\n     */\n    clearUndoHistory() {\n        this.undoManager.clear();\n    }\n    /**\n     * Perform a transaction. While the function f is called, all changes to the shared\n     * document are bundled into a single event.\n     */\n    transact(f, undoable = true) {\n        this.ydoc.transact(f, undoable ? this : null);\n    }\n}\n//# sourceMappingURL=ydocument.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyter/ydoc/lib/ydocument.js?");

/***/ }),

/***/ "../node_modules/@jupyter/ydoc/lib/yfile.js":
/*!**************************************************!*\
  !*** ../node_modules/@jupyter/ydoc/lib/yfile.js ***!
  \**************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"YFile\": () => (/* binding */ YFile)\n/* harmony export */ });\n/* harmony import */ var _ydocument_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ydocument.js */ \"../node_modules/@jupyter/ydoc/lib/ydocument.js\");\n/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n\n/**\n * Shareable text file.\n */\nclass YFile extends _ydocument_js__WEBPACK_IMPORTED_MODULE_0__.YDocument {\n    /**\n     * Create a new file\n     *\n     * #### Notes\n     * The document is empty and must be populated\n     */\n    constructor() {\n        super();\n        /**\n         * Document version\n         */\n        this.version = '1.0.0';\n        /**\n         * YJS file text.\n         */\n        this.ysource = this.ydoc.getText('source');\n        /**\n         * Handle a change to the ymodel.\n         */\n        this._modelObserver = (event) => {\n            this._changed.emit({ sourceChange: event.changes.delta });\n        };\n        this.undoManager.addToScope(this.ysource);\n        this.ysource.observe(this._modelObserver);\n    }\n    /**\n     * Creates a standalone YFile\n     */\n    static create() {\n        return new YFile();\n    }\n    /**\n     * File text\n     */\n    get source() {\n        return this.getSource();\n    }\n    set source(v) {\n        this.setSource(v);\n    }\n    /**\n     * Dispose of the resources.\n     */\n    dispose() {\n        if (this.isDisposed) {\n            return;\n        }\n        this.ysource.unobserve(this._modelObserver);\n        super.dispose();\n    }\n    /**\n     * Get the file text.\n     *\n     * @returns File text.\n     */\n    getSource() {\n        return this.ysource.toString();\n    }\n    /**\n     * Set the file text.\n     *\n     * @param value New text\n     */\n    setSource(value) {\n        this.transact(() => {\n            const ytext = this.ysource;\n            ytext.delete(0, ytext.length);\n            ytext.insert(0, value);\n        });\n    }\n    /**\n     * Replace content from `start' to `end` with `value`.\n     *\n     * @param start: The start index of the range to replace (inclusive).\n     * @param end: The end index of the range to replace (exclusive).\n     * @param value: New source (optional).\n     */\n    updateSource(start, end, value = '') {\n        this.transact(() => {\n            const ysource = this.ysource;\n            // insert and then delete.\n            // This ensures that the cursor position is adjusted after the replaced content.\n            ysource.insert(start, value);\n            ysource.delete(start + value.length, end - start);\n        });\n    }\n}\n//# sourceMappingURL=yfile.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyter/ydoc/lib/yfile.js?");

/***/ }),

/***/ "../node_modules/@jupyter/ydoc/lib/ynotebook.js":
/*!******************************************************!*\
  !*** ../node_modules/@jupyter/ydoc/lib/ynotebook.js ***!
  \******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"YNotebook\": () => (/* binding */ YNotebook)\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/* 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/* harmony import */ var yjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! yjs */ \"webpack/sharing/consume/default/yjs/yjs\");\n/* harmony import */ var yjs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(yjs__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _ydocument_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ydocument.js */ \"../node_modules/@jupyter/ydoc/lib/ydocument.js\");\n/* harmony import */ var _ycell_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ycell.js */ \"../node_modules/@jupyter/ydoc/lib/ycell.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 * Shared implementation of the Shared Document types.\n *\n * Shared cells can be inserted into a SharedNotebook.\n * Shared cells only start emitting events when they are connected to a SharedNotebook.\n *\n * \"Standalone\" cells must not be inserted into a (Shared)Notebook.\n * Standalone cells emit events immediately after they have been created, but they must not\n * be included into a (Shared)Notebook.\n */\nclass YNotebook extends _ydocument_js__WEBPACK_IMPORTED_MODULE_3__.YDocument {\n    /**\n     * Create a new notebook\n     *\n     * #### Notes\n     * The document is empty and must be populated\n     *\n     * @param options\n     */\n    constructor(options = {}) {\n        var _a;\n        super();\n        /**\n         * Document version\n         */\n        this.version = '1.0.0';\n        /**\n         * YJS map for the notebook metadata\n         */\n        this.ymeta = this.ydoc.getMap('meta');\n        /**\n         * Handle a change to the ystate.\n         */\n        this._onMetaChanged = (events) => {\n            const metadataEvents = events.find(event => event.target === this.ymeta.get('metadata'));\n            if (metadataEvents) {\n                const metadataChange = metadataEvents.changes.keys;\n                const ymetadata = this.ymeta.get('metadata');\n                metadataEvents.changes.keys.forEach((change, key) => {\n                    switch (change.action) {\n                        case 'add':\n                            this._metadataChanged.emit({\n                                key,\n                                type: 'add',\n                                newValue: ymetadata.get(key)\n                            });\n                            break;\n                        case 'delete':\n                            this._metadataChanged.emit({\n                                key,\n                                type: 'remove',\n                                oldValue: change.oldValue\n                            });\n                            break;\n                        case 'update':\n                            {\n                                const newValue = ymetadata.get(key);\n                                const oldValue = change.oldValue;\n                                let equal = true;\n                                if (typeof oldValue == 'object' && typeof newValue == 'object') {\n                                    equal = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.JSONExt.deepEqual(oldValue, newValue);\n                                }\n                                else {\n                                    equal = oldValue === newValue;\n                                }\n                                if (!equal) {\n                                    this._metadataChanged.emit({\n                                        key,\n                                        type: 'change',\n                                        oldValue,\n                                        newValue\n                                    });\n                                }\n                            }\n                            break;\n                    }\n                });\n                this._changed.emit({ metadataChange });\n            }\n            const metaEvent = events.find(event => event.target === this.ymeta);\n            if (!metaEvent) {\n                return;\n            }\n            if (metaEvent.keysChanged.has('metadata')) {\n                // Handle metadata change when adding/removing the YMap\n                const change = metaEvent.changes.keys.get('metadata');\n                if ((change === null || change === void 0 ? void 0 : change.action) === 'add' && !change.oldValue) {\n                    const metadataChange = new Map();\n                    for (const key of Object.keys(this.metadata)) {\n                        metadataChange.set(key, {\n                            action: 'add',\n                            oldValue: undefined\n                        });\n                        this._metadataChanged.emit({\n                            key,\n                            type: 'add',\n                            newValue: this.getMetadata(key)\n                        });\n                    }\n                    this._changed.emit({ metadataChange });\n                }\n            }\n            if (metaEvent.keysChanged.has('nbformat')) {\n                const change = metaEvent.changes.keys.get('nbformat');\n                const nbformatChanged = {\n                    key: 'nbformat',\n                    oldValue: (change === null || change === void 0 ? void 0 : change.oldValue) ? change.oldValue : undefined,\n                    newValue: this.nbformat\n                };\n                this._changed.emit({ nbformatChanged });\n            }\n            if (metaEvent.keysChanged.has('nbformat_minor')) {\n                const change = metaEvent.changes.keys.get('nbformat_minor');\n                const nbformatChanged = {\n                    key: 'nbformat_minor',\n                    oldValue: (change === null || change === void 0 ? void 0 : change.oldValue) ? change.oldValue : undefined,\n                    newValue: this.nbformat_minor\n                };\n                this._changed.emit({ nbformatChanged });\n            }\n        };\n        /**\n         * Handle a change to the list of cells.\n         */\n        this._onYCellsChanged = (event) => {\n            // update the type cell mapping by iterating through the added/removed types\n            event.changes.added.forEach(item => {\n                const type = item.content.type;\n                if (!this._ycellMapping.has(type)) {\n                    const c = (0,_ycell_js__WEBPACK_IMPORTED_MODULE_4__.createCellModelFromSharedType)(type, { notebook: this });\n                    c.setUndoManager();\n                    this._ycellMapping.set(type, c);\n                }\n            });\n            event.changes.deleted.forEach(item => {\n                const type = item.content.type;\n                const model = this._ycellMapping.get(type);\n                if (model) {\n                    model.dispose();\n                    this._ycellMapping.delete(type);\n                }\n            });\n            let index = 0;\n            // this reflects the event.changes.delta, but replaces the content of delta.insert with ycells\n            const cellsChange = [];\n            event.changes.delta.forEach((d) => {\n                if (d.insert != null) {\n                    const insertedCells = d.insert.map((ycell) => this._ycellMapping.get(ycell));\n                    cellsChange.push({ insert: insertedCells });\n                    this.cells.splice(index, 0, ...insertedCells);\n                    index += d.insert.length;\n                }\n                else if (d.delete != null) {\n                    cellsChange.push(d);\n                    this.cells.splice(index, d.delete);\n                }\n                else if (d.retain != null) {\n                    cellsChange.push(d);\n                    index += d.retain;\n                }\n            });\n            this._changed.emit({\n                cellsChange: cellsChange\n            });\n        };\n        this._metadataChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__.Signal(this);\n        /**\n         * Internal Yjs cells list\n         */\n        this._ycells = this.ydoc.getArray('cells');\n        this._ycellMapping = new WeakMap();\n        this._disableDocumentWideUndoRedo =\n            (_a = options.disableDocumentWideUndoRedo) !== null && _a !== void 0 ? _a : false;\n        this.cells = this._ycells.toArray().map(ycell => {\n            if (!this._ycellMapping.has(ycell)) {\n                this._ycellMapping.set(ycell, (0,_ycell_js__WEBPACK_IMPORTED_MODULE_4__.createCellModelFromSharedType)(ycell, { notebook: this }));\n            }\n            return this._ycellMapping.get(ycell);\n        });\n        this.undoManager.addToScope(this._ycells);\n        this._ycells.observe(this._onYCellsChanged);\n        this.ymeta.observeDeep(this._onMetaChanged);\n    }\n    /**\n     * Creates a standalone YNotebook\n     *\n     * Note: This method is useful when we need to initialize\n     * the YNotebook from the JavaScript side.\n     */\n    static create(options = {}) {\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j;\n        const ynotebook = new YNotebook({\n            disableDocumentWideUndoRedo: (_a = options.disableDocumentWideUndoRedo) !== null && _a !== void 0 ? _a : false\n        });\n        const data = {\n            cells: (_c = (_b = options.data) === null || _b === void 0 ? void 0 : _b.cells) !== null && _c !== void 0 ? _c : [],\n            nbformat: (_e = (_d = options.data) === null || _d === void 0 ? void 0 : _d.nbformat) !== null && _e !== void 0 ? _e : 4,\n            nbformat_minor: (_g = (_f = options.data) === null || _f === void 0 ? void 0 : _f.nbformat_minor) !== null && _g !== void 0 ? _g : 5,\n            metadata: (_j = (_h = options.data) === null || _h === void 0 ? void 0 : _h.metadata) !== null && _j !== void 0 ? _j : {}\n        };\n        ynotebook.fromJSON(data);\n        return ynotebook;\n    }\n    /**\n     * Wether the undo/redo logic should be\n     * considered on the full document across all cells.\n     *\n     * Default: false\n     */\n    get disableDocumentWideUndoRedo() {\n        return this._disableDocumentWideUndoRedo;\n    }\n    /**\n     * Notebook metadata\n     */\n    get metadata() {\n        return this.getMetadata();\n    }\n    set metadata(v) {\n        this.setMetadata(v);\n    }\n    /**\n     * Signal triggered when a metadata changes.\n     */\n    get metadataChanged() {\n        return this._metadataChanged;\n    }\n    /**\n     * nbformat major version\n     */\n    get nbformat() {\n        return this.ymeta.get('nbformat');\n    }\n    set nbformat(value) {\n        this.transact(() => {\n            this.ymeta.set('nbformat', value);\n        }, false);\n    }\n    /**\n     * nbformat minor version\n     */\n    get nbformat_minor() {\n        return this.ymeta.get('nbformat_minor');\n    }\n    set nbformat_minor(value) {\n        this.transact(() => {\n            this.ymeta.set('nbformat_minor', value);\n        }, false);\n    }\n    /**\n     * Dispose of the resources.\n     */\n    dispose() {\n        if (this.isDisposed) {\n            return;\n        }\n        this._ycells.unobserve(this._onYCellsChanged);\n        this.ymeta.unobserveDeep(this._onMetaChanged);\n        super.dispose();\n    }\n    /**\n     * Get a shared cell by index.\n     *\n     * @param index: Cell's position.\n     *\n     * @returns The requested shared cell.\n     */\n    getCell(index) {\n        return this.cells[index];\n    }\n    /**\n     * Add a shared cell at the notebook bottom.\n     *\n     * @param cell Cell to add.\n     *\n     * @returns The added cell.\n     */\n    addCell(cell) {\n        return this.insertCell(this._ycells.length, cell);\n    }\n    /**\n     * Insert a shared cell into a specific position.\n     *\n     * @param index: Cell's position.\n     * @param cell: Cell to insert.\n     *\n     * @returns The inserted cell.\n     */\n    insertCell(index, cell) {\n        return this.insertCells(index, [cell])[0];\n    }\n    /**\n     * Insert a list of shared cells into a specific position.\n     *\n     * @param index: Position to insert the cells.\n     * @param cells: Array of shared cells to insert.\n     *\n     * @returns The inserted cells.\n     */\n    insertCells(index, cells) {\n        const yCells = cells.map(c => {\n            const cell = (0,_ycell_js__WEBPACK_IMPORTED_MODULE_4__.createCell)(c, this);\n            this._ycellMapping.set(cell.ymodel, cell);\n            return cell;\n        });\n        this.transact(() => {\n            this._ycells.insert(index, yCells.map(cell => cell.ymodel));\n        });\n        yCells.forEach(c => {\n            c.setUndoManager();\n        });\n        return yCells;\n    }\n    /**\n     * Move a cell.\n     *\n     * @param fromIndex: Index of the cell to move.\n     * @param toIndex: New position of the cell.\n     */\n    moveCell(fromIndex, toIndex) {\n        this.moveCells(fromIndex, toIndex);\n    }\n    /**\n     * Move cells.\n     *\n     * @param fromIndex: Index of the first cells to move.\n     * @param toIndex: New position of the first cell (in the current array).\n     * @param n: Number of cells to move (default 1)\n     */\n    moveCells(fromIndex, toIndex, n = 1) {\n        // FIXME we need to use yjs move feature to preserve undo history\n        const clones = new Array(n)\n            .fill(true)\n            .map((_, idx) => this.getCell(fromIndex + idx).toJSON());\n        this.transact(() => {\n            this._ycells.delete(fromIndex, n);\n            this._ycells.insert(fromIndex > toIndex ? toIndex : toIndex - n + 1, clones.map(clone => (0,_ycell_js__WEBPACK_IMPORTED_MODULE_4__.createCell)(clone, this).ymodel));\n        });\n    }\n    /**\n     * Remove a cell.\n     *\n     * @param index: Index of the cell to remove.\n     */\n    deleteCell(index) {\n        this.deleteCellRange(index, index + 1);\n    }\n    /**\n     * Remove a range of cells.\n     *\n     * @param from: The start index of the range to remove (inclusive).\n     * @param to: The end index of the range to remove (exclusive).\n     */\n    deleteCellRange(from, to) {\n        // Cells will be removed from the mapping in the model event listener.\n        this.transact(() => {\n            this._ycells.delete(from, to - from);\n        });\n    }\n    /**\n     * Delete a metadata notebook.\n     *\n     * @param key The key to delete\n     */\n    deleteMetadata(key) {\n        if (typeof this.getMetadata(key) === 'undefined') {\n            return;\n        }\n        const allMetadata = this.metadata;\n        delete allMetadata[key];\n        this.setMetadata(allMetadata);\n    }\n    getMetadata(key) {\n        const ymetadata = this.ymeta.get('metadata');\n        // Transiently the metadata can be missing - like during destruction\n        if (ymetadata === undefined) {\n            return undefined;\n        }\n        if (typeof key === 'string') {\n            const value = ymetadata.get(key);\n            return typeof value === 'undefined'\n                ? undefined // undefined is converted to `{}` by `JSONExt.deepCopy`\n                : _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.JSONExt.deepCopy(value);\n        }\n        else {\n            return _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.JSONExt.deepCopy(ymetadata.toJSON());\n        }\n    }\n    setMetadata(metadata, value) {\n        var _a;\n        if (typeof metadata === 'string') {\n            if (typeof value === 'undefined') {\n                throw new TypeError(`Metadata value for ${metadata} cannot be 'undefined'; use deleteMetadata.`);\n            }\n            if (_lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.JSONExt.deepEqual((_a = this.getMetadata(metadata)) !== null && _a !== void 0 ? _a : null, value)) {\n                return;\n            }\n            const update = {};\n            update[metadata] = value;\n            this.updateMetadata(update);\n        }\n        else {\n            if (!this.metadata || !_lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.JSONExt.deepEqual(this.metadata, metadata)) {\n                const clone = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.JSONExt.deepCopy(metadata);\n                const ymetadata = this.ymeta.get('metadata');\n                // Transiently the metadata can be missing - like during destruction\n                if (ymetadata === undefined) {\n                    return undefined;\n                }\n                this.transact(() => {\n                    ymetadata.clear();\n                    for (const [key, value] of Object.entries(clone)) {\n                        ymetadata.set(key, value);\n                    }\n                });\n            }\n        }\n    }\n    /**\n     * Updates the metadata associated with the notebook.\n     *\n     * @param value: Metadata's attribute to update.\n     */\n    updateMetadata(value) {\n        // TODO: Maybe modify only attributes instead of replacing the whole metadata?\n        const clone = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.JSONExt.deepCopy(value);\n        const ymetadata = this.ymeta.get('metadata');\n        // Transiently the metadata can be missing - like during destruction\n        if (ymetadata === undefined) {\n            return undefined;\n        }\n        this.transact(() => {\n            for (const [key, value] of Object.entries(clone)) {\n                ymetadata.set(key, value);\n            }\n        });\n    }\n    /**\n     * Override the notebook with a JSON-serialized document.\n     *\n     * @param value The notebook\n     */\n    fromJSON(value) {\n        this.transact(() => {\n            this.nbformat = value.nbformat;\n            this.nbformat_minor = value.nbformat_minor;\n            const metadata = value.metadata;\n            if (metadata['orig_nbformat'] !== undefined) {\n                delete metadata['orig_nbformat'];\n            }\n            if (!this.metadata) {\n                const ymetadata = new yjs__WEBPACK_IMPORTED_MODULE_2__.Map();\n                for (const [key, value] of Object.entries(metadata)) {\n                    ymetadata.set(key, value);\n                }\n                this.ymeta.set('metadata', ymetadata);\n            }\n            else {\n                this.metadata = metadata;\n            }\n            const useId = value.nbformat === 4 && value.nbformat_minor >= 5;\n            const ycells = value.cells.map(cell => {\n                if (!useId) {\n                    delete cell.id;\n                }\n                return cell;\n            });\n            this.insertCells(this.cells.length, ycells);\n            this.deleteCellRange(0, this.cells.length);\n        });\n    }\n    /**\n     * Serialize the model to JSON.\n     */\n    toJSON() {\n        // strip cell ids if we have notebook format 4.0-4.4\n        const pruneCellId = this.nbformat === 4 && this.nbformat_minor <= 4;\n        return {\n            metadata: this.metadata,\n            nbformat_minor: this.nbformat_minor,\n            nbformat: this.nbformat,\n            cells: this.cells.map(c => {\n                const raw = c.toJSON();\n                if (pruneCellId) {\n                    delete raw.id;\n                }\n                return raw;\n            })\n        };\n    }\n}\n//# sourceMappingURL=ynotebook.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyter/ydoc/lib/ynotebook.js?");

/***/ }),

/***/ "../node_modules/@jupyter/ydoc/lib/ytext.js":
/*!**************************************************!*\
  !*** ../node_modules/@jupyter/ydoc/lib/ytext.js ***!
  \**************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n\n//# sourceMappingURL=ytext.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyter/ydoc/lib/ytext.js?");

/***/ }),

/***/ "../node_modules/process/browser.js":
/*!******************************************!*\
  !*** ../node_modules/process/browser.js ***!
  \******************************************/
/***/ ((module) => {

eval("// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things.  But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals.  It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n    throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n    throw new Error('clearTimeout has not been defined');\n}\n(function () {\n    try {\n        if (typeof setTimeout === 'function') {\n            cachedSetTimeout = setTimeout;\n        } else {\n            cachedSetTimeout = defaultSetTimout;\n        }\n    } catch (e) {\n        cachedSetTimeout = defaultSetTimout;\n    }\n    try {\n        if (typeof clearTimeout === 'function') {\n            cachedClearTimeout = clearTimeout;\n        } else {\n            cachedClearTimeout = defaultClearTimeout;\n        }\n    } catch (e) {\n        cachedClearTimeout = defaultClearTimeout;\n    }\n} ())\nfunction runTimeout(fun) {\n    if (cachedSetTimeout === setTimeout) {\n        //normal enviroments in sane situations\n        return setTimeout(fun, 0);\n    }\n    // if setTimeout wasn't available but was latter defined\n    if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n        cachedSetTimeout = setTimeout;\n        return setTimeout(fun, 0);\n    }\n    try {\n        // when when somebody has screwed with setTimeout but no I.E. maddness\n        return cachedSetTimeout(fun, 0);\n    } catch(e){\n        try {\n            // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n            return cachedSetTimeout.call(null, fun, 0);\n        } catch(e){\n            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n            return cachedSetTimeout.call(this, fun, 0);\n        }\n    }\n\n\n}\nfunction runClearTimeout(marker) {\n    if (cachedClearTimeout === clearTimeout) {\n        //normal enviroments in sane situations\n        return clearTimeout(marker);\n    }\n    // if clearTimeout wasn't available but was latter defined\n    if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n        cachedClearTimeout = clearTimeout;\n        return clearTimeout(marker);\n    }\n    try {\n        // when when somebody has screwed with setTimeout but no I.E. maddness\n        return cachedClearTimeout(marker);\n    } catch (e){\n        try {\n            // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally\n            return cachedClearTimeout.call(null, marker);\n        } catch (e){\n            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n            // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n            return cachedClearTimeout.call(this, marker);\n        }\n    }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n    if (!draining || !currentQueue) {\n        return;\n    }\n    draining = false;\n    if (currentQueue.length) {\n        queue = currentQueue.concat(queue);\n    } else {\n        queueIndex = -1;\n    }\n    if (queue.length) {\n        drainQueue();\n    }\n}\n\nfunction drainQueue() {\n    if (draining) {\n        return;\n    }\n    var timeout = runTimeout(cleanUpNextTick);\n    draining = true;\n\n    var len = queue.length;\n    while(len) {\n        currentQueue = queue;\n        queue = [];\n        while (++queueIndex < len) {\n            if (currentQueue) {\n                currentQueue[queueIndex].run();\n            }\n        }\n        queueIndex = -1;\n        len = queue.length;\n    }\n    currentQueue = null;\n    draining = false;\n    runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n    var args = new Array(arguments.length - 1);\n    if (arguments.length > 1) {\n        for (var i = 1; i < arguments.length; i++) {\n            args[i - 1] = arguments[i];\n        }\n    }\n    queue.push(new Item(fun, args));\n    if (queue.length === 1 && !draining) {\n        runTimeout(drainQueue);\n    }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n    this.fun = fun;\n    this.array = array;\n}\nItem.prototype.run = function () {\n    this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n    throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n    throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/process/browser.js?");

/***/ }),

/***/ "../node_modules/y-protocols/awareness.js":
/*!************************************************!*\
  !*** ../node_modules/y-protocols/awareness.js ***!
  \************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"Awareness\": () => (/* binding */ Awareness),\n/* harmony export */   \"applyAwarenessUpdate\": () => (/* binding */ applyAwarenessUpdate),\n/* harmony export */   \"encodeAwarenessUpdate\": () => (/* binding */ encodeAwarenessUpdate),\n/* harmony export */   \"modifyAwarenessUpdate\": () => (/* binding */ modifyAwarenessUpdate),\n/* harmony export */   \"outdatedTimeout\": () => (/* binding */ outdatedTimeout),\n/* harmony export */   \"removeAwarenessStates\": () => (/* binding */ removeAwarenessStates)\n/* harmony export */ });\n/* harmony import */ var lib0_encoding__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lib0/encoding */ \"../node_modules/lib0/encoding.js\");\n/* harmony import */ var lib0_decoding__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lib0/decoding */ \"../node_modules/lib0/decoding.js\");\n/* harmony import */ var lib0_time__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lib0/time */ \"../node_modules/lib0/time.js\");\n/* harmony import */ var lib0_math__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lib0/math */ \"../node_modules/lib0/math.js\");\n/* harmony import */ var lib0_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lib0/observable */ \"../node_modules/lib0/observable.js\");\n/* harmony import */ var lib0_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lib0/function */ \"../node_modules/lib0/function.js\");\n/* harmony import */ var yjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! yjs */ \"webpack/sharing/consume/default/yjs/yjs\");\n/* harmony import */ var yjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(yjs__WEBPACK_IMPORTED_MODULE_0__);\n/**\n * @module awareness-protocol\n */\n\n\n\n\n\n\n\n // eslint-disable-line\n\nconst outdatedTimeout = 30000\n\n/**\n * @typedef {Object} MetaClientState\n * @property {number} MetaClientState.clock\n * @property {number} MetaClientState.lastUpdated unix timestamp\n */\n\n/**\n * The Awareness class implements a simple shared state protocol that can be used for non-persistent data like awareness information\n * (cursor, username, status, ..). Each client can update its own local state and listen to state changes of\n * remote clients. Every client may set a state of a remote peer to `null` to mark the client as offline.\n *\n * Each client is identified by a unique client id (something we borrow from `doc.clientID`). A client can override\n * its own state by propagating a message with an increasing timestamp (`clock`). If such a message is received, it is\n * applied if the known state of that client is older than the new state (`clock < newClock`). If a client thinks that\n * a remote client is offline, it may propagate a message with\n * `{ clock: currentClientClock, state: null, client: remoteClient }`. If such a\n * message is received, and the known clock of that client equals the received clock, it will override the state with `null`.\n *\n * Before a client disconnects, it should propagate a `null` state with an updated clock.\n *\n * Awareness states must be updated every 30 seconds. Otherwise the Awareness instance will delete the client state.\n *\n * @extends {Observable<string>}\n */\nclass Awareness extends lib0_observable__WEBPACK_IMPORTED_MODULE_1__.Observable {\n  /**\n   * @param {Y.Doc} doc\n   */\n  constructor (doc) {\n    super()\n    this.doc = doc\n    /**\n     * @type {number}\n     */\n    this.clientID = doc.clientID\n    /**\n     * Maps from client id to client state\n     * @type {Map<number, Object<string, any>>}\n     */\n    this.states = new Map()\n    /**\n     * @type {Map<number, MetaClientState>}\n     */\n    this.meta = new Map()\n    this._checkInterval = /** @type {any} */ (setInterval(() => {\n      const now = lib0_time__WEBPACK_IMPORTED_MODULE_2__.getUnixTime()\n      if (this.getLocalState() !== null && (outdatedTimeout / 2 <= now - /** @type {{lastUpdated:number}} */ (this.meta.get(this.clientID)).lastUpdated)) {\n        // renew local clock\n        this.setLocalState(this.getLocalState())\n      }\n      /**\n       * @type {Array<number>}\n       */\n      const remove = []\n      this.meta.forEach((meta, clientid) => {\n        if (clientid !== this.clientID && outdatedTimeout <= now - meta.lastUpdated && this.states.has(clientid)) {\n          remove.push(clientid)\n        }\n      })\n      if (remove.length > 0) {\n        removeAwarenessStates(this, remove, 'timeout')\n      }\n    }, lib0_math__WEBPACK_IMPORTED_MODULE_3__.floor(outdatedTimeout / 10)))\n    doc.on('destroy', () => {\n      this.destroy()\n    })\n    this.setLocalState({})\n  }\n\n  destroy () {\n    this.emit('destroy', [this])\n    this.setLocalState(null)\n    super.destroy()\n    clearInterval(this._checkInterval)\n  }\n\n  /**\n   * @return {Object<string,any>|null}\n   */\n  getLocalState () {\n    return this.states.get(this.clientID) || null\n  }\n\n  /**\n   * @param {Object<string,any>|null} state\n   */\n  setLocalState (state) {\n    const clientID = this.clientID\n    const currLocalMeta = this.meta.get(clientID)\n    const clock = currLocalMeta === undefined ? 0 : currLocalMeta.clock + 1\n    const prevState = this.states.get(clientID)\n    if (state === null) {\n      this.states.delete(clientID)\n    } else {\n      this.states.set(clientID, state)\n    }\n    this.meta.set(clientID, {\n      clock,\n      lastUpdated: lib0_time__WEBPACK_IMPORTED_MODULE_2__.getUnixTime()\n    })\n    const added = []\n    const updated = []\n    const filteredUpdated = []\n    const removed = []\n    if (state === null) {\n      removed.push(clientID)\n    } else if (prevState == null) {\n      if (state != null) {\n        added.push(clientID)\n      }\n    } else {\n      updated.push(clientID)\n      if (!lib0_function__WEBPACK_IMPORTED_MODULE_4__.equalityDeep(prevState, state)) {\n        filteredUpdated.push(clientID)\n      }\n    }\n    if (added.length > 0 || filteredUpdated.length > 0 || removed.length > 0) {\n      this.emit('change', [{ added, updated: filteredUpdated, removed }, 'local'])\n    }\n    this.emit('update', [{ added, updated, removed }, 'local'])\n  }\n\n  /**\n   * @param {string} field\n   * @param {any} value\n   */\n  setLocalStateField (field, value) {\n    const state = this.getLocalState()\n    if (state !== null) {\n      this.setLocalState({\n        ...state,\n        [field]: value\n      })\n    }\n  }\n\n  /**\n   * @return {Map<number,Object<string,any>>}\n   */\n  getStates () {\n    return this.states\n  }\n}\n\n/**\n * Mark (remote) clients as inactive and remove them from the list of active peers.\n * This change will be propagated to remote clients.\n *\n * @param {Awareness} awareness\n * @param {Array<number>} clients\n * @param {any} origin\n */\nconst removeAwarenessStates = (awareness, clients, origin) => {\n  const removed = []\n  for (let i = 0; i < clients.length; i++) {\n    const clientID = clients[i]\n    if (awareness.states.has(clientID)) {\n      awareness.states.delete(clientID)\n      if (clientID === awareness.clientID) {\n        const curMeta = /** @type {MetaClientState} */ (awareness.meta.get(clientID))\n        awareness.meta.set(clientID, {\n          clock: curMeta.clock + 1,\n          lastUpdated: lib0_time__WEBPACK_IMPORTED_MODULE_2__.getUnixTime()\n        })\n      }\n      removed.push(clientID)\n    }\n  }\n  if (removed.length > 0) {\n    awareness.emit('change', [{ added: [], updated: [], removed }, origin])\n    awareness.emit('update', [{ added: [], updated: [], removed }, origin])\n  }\n}\n\n/**\n * @param {Awareness} awareness\n * @param {Array<number>} clients\n * @return {Uint8Array}\n */\nconst encodeAwarenessUpdate = (awareness, clients, states = awareness.states) => {\n  const len = clients.length\n  const encoder = lib0_encoding__WEBPACK_IMPORTED_MODULE_5__.createEncoder()\n  lib0_encoding__WEBPACK_IMPORTED_MODULE_5__.writeVarUint(encoder, len)\n  for (let i = 0; i < len; i++) {\n    const clientID = clients[i]\n    const state = states.get(clientID) || null\n    const clock = /** @type {MetaClientState} */ (awareness.meta.get(clientID)).clock\n    lib0_encoding__WEBPACK_IMPORTED_MODULE_5__.writeVarUint(encoder, clientID)\n    lib0_encoding__WEBPACK_IMPORTED_MODULE_5__.writeVarUint(encoder, clock)\n    lib0_encoding__WEBPACK_IMPORTED_MODULE_5__.writeVarString(encoder, JSON.stringify(state))\n  }\n  return lib0_encoding__WEBPACK_IMPORTED_MODULE_5__.toUint8Array(encoder)\n}\n\n/**\n * Modify the content of an awareness update before re-encoding it to an awareness update.\n *\n * This might be useful when you have a central server that wants to ensure that clients\n * cant hijack somebody elses identity.\n *\n * @param {Uint8Array} update\n * @param {function(any):any} modify\n * @return {Uint8Array}\n */\nconst modifyAwarenessUpdate = (update, modify) => {\n  const decoder = lib0_decoding__WEBPACK_IMPORTED_MODULE_6__.createDecoder(update)\n  const encoder = lib0_encoding__WEBPACK_IMPORTED_MODULE_5__.createEncoder()\n  const len = lib0_decoding__WEBPACK_IMPORTED_MODULE_6__.readVarUint(decoder)\n  lib0_encoding__WEBPACK_IMPORTED_MODULE_5__.writeVarUint(encoder, len)\n  for (let i = 0; i < len; i++) {\n    const clientID = lib0_decoding__WEBPACK_IMPORTED_MODULE_6__.readVarUint(decoder)\n    const clock = lib0_decoding__WEBPACK_IMPORTED_MODULE_6__.readVarUint(decoder)\n    const state = JSON.parse(lib0_decoding__WEBPACK_IMPORTED_MODULE_6__.readVarString(decoder))\n    const modifiedState = modify(state)\n    lib0_encoding__WEBPACK_IMPORTED_MODULE_5__.writeVarUint(encoder, clientID)\n    lib0_encoding__WEBPACK_IMPORTED_MODULE_5__.writeVarUint(encoder, clock)\n    lib0_encoding__WEBPACK_IMPORTED_MODULE_5__.writeVarString(encoder, JSON.stringify(modifiedState))\n  }\n  return lib0_encoding__WEBPACK_IMPORTED_MODULE_5__.toUint8Array(encoder)\n}\n\n/**\n * @param {Awareness} awareness\n * @param {Uint8Array} update\n * @param {any} origin This will be added to the emitted change event\n */\nconst applyAwarenessUpdate = (awareness, update, origin) => {\n  const decoder = lib0_decoding__WEBPACK_IMPORTED_MODULE_6__.createDecoder(update)\n  const timestamp = lib0_time__WEBPACK_IMPORTED_MODULE_2__.getUnixTime()\n  const added = []\n  const updated = []\n  const filteredUpdated = []\n  const removed = []\n  const len = lib0_decoding__WEBPACK_IMPORTED_MODULE_6__.readVarUint(decoder)\n  for (let i = 0; i < len; i++) {\n    const clientID = lib0_decoding__WEBPACK_IMPORTED_MODULE_6__.readVarUint(decoder)\n    let clock = lib0_decoding__WEBPACK_IMPORTED_MODULE_6__.readVarUint(decoder)\n    const state = JSON.parse(lib0_decoding__WEBPACK_IMPORTED_MODULE_6__.readVarString(decoder))\n    const clientMeta = awareness.meta.get(clientID)\n    const prevState = awareness.states.get(clientID)\n    const currClock = clientMeta === undefined ? 0 : clientMeta.clock\n    if (currClock < clock || (currClock === clock && state === null && awareness.states.has(clientID))) {\n      if (state === null) {\n        // never let a remote client remove this local state\n        if (clientID === awareness.clientID && awareness.getLocalState() != null) {\n          // remote client removed the local state. Do not remote state. Broadcast a message indicating\n          // that this client still exists by increasing the clock\n          clock++\n        } else {\n          awareness.states.delete(clientID)\n        }\n      } else {\n        awareness.states.set(clientID, state)\n      }\n      awareness.meta.set(clientID, {\n        clock,\n        lastUpdated: timestamp\n      })\n      if (clientMeta === undefined && state !== null) {\n        added.push(clientID)\n      } else if (clientMeta !== undefined && state === null) {\n        removed.push(clientID)\n      } else if (state !== null) {\n        if (!lib0_function__WEBPACK_IMPORTED_MODULE_4__.equalityDeep(state, prevState)) {\n          filteredUpdated.push(clientID)\n        }\n        updated.push(clientID)\n      }\n    }\n  }\n  if (added.length > 0 || filteredUpdated.length > 0 || removed.length > 0) {\n    awareness.emit('change', [{\n      added, updated: filteredUpdated, removed\n    }, origin])\n  }\n  if (added.length > 0 || updated.length > 0 || removed.length > 0) {\n    awareness.emit('update', [{\n      added, updated, removed\n    }, origin])\n  }\n}\n\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/y-protocols/awareness.js?");

/***/ })

}]);