"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_lsp-extension_lib_index_js"],{

/***/ "../node_modules/@jupyterlab/lsp-extension/lib/index.js":
/*!**************************************************************!*\
  !*** ../node_modules/@jupyterlab/lsp-extension/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 */   \"RunningLanguageServer\": () => (/* binding */ RunningLanguageServer),\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/lsp */ \"webpack/sharing/consume/default/@jupyterlab/lsp/@jupyterlab/lsp\");\n/* harmony import */ var _jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_running__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/running */ \"webpack/sharing/consume/default/@jupyterlab/running/@jupyterlab/running\");\n/* harmony import */ var _jupyterlab_running__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_running__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyterlab/settingregistry */ \"webpack/sharing/consume/default/@jupyterlab/settingregistry/@jupyterlab/settingregistry\");\n/* harmony import */ var _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_settingregistry__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 _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 _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 _renderer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./renderer */ \"../node_modules/@jupyterlab/lsp-extension/lib/renderer.js\");\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * @packageDocumentation\n * @module lsp-extension\n */\n\n\n\n\n\n\n\nconst plugin = {\n    activate,\n    id: '@jupyterlab/lsp-extension:plugin',\n    description: 'Provides the language server connection manager.',\n    requires: [_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3__.ITranslator],\n    optional: [_jupyterlab_running__WEBPACK_IMPORTED_MODULE_1__.IRunningSessionManagers],\n    provides: _jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_0__.ILSPDocumentConnectionManager,\n    autoStart: true\n};\nconst featurePlugin = {\n    id: '@jupyterlab/lsp-extension:feature',\n    description: 'Provides the language server feature manager.',\n    activate: () => new _jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_0__.FeatureManager(),\n    provides: _jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_0__.ILSPFeatureManager,\n    autoStart: true\n};\nconst settingsPlugin = {\n    activate: activateSettings,\n    id: '@jupyterlab/lsp-extension:settings',\n    description: 'Provides the language server settings.',\n    requires: [_jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_0__.ILSPDocumentConnectionManager, _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_2__.ISettingRegistry, _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3__.ITranslator],\n    optional: [_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_4__.IFormRendererRegistry],\n    autoStart: true\n};\nconst codeExtractorManagerPlugin = {\n    id: _jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_0__.ILSPCodeExtractorsManager.name,\n    description: 'Provides the code extractor manager.',\n    activate: app => {\n        const extractorManager = new _jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_0__.CodeExtractorsManager();\n        const markdownCellExtractor = new _jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_0__.TextForeignCodeExtractor({\n            language: 'markdown',\n            isStandalone: false,\n            file_extension: 'md',\n            cellType: ['markdown']\n        });\n        extractorManager.register(markdownCellExtractor, null);\n        const rawCellExtractor = new _jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_0__.TextForeignCodeExtractor({\n            language: 'text',\n            isStandalone: false,\n            file_extension: 'txt',\n            cellType: ['raw']\n        });\n        extractorManager.register(rawCellExtractor, null);\n        return extractorManager;\n    },\n    provides: _jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_0__.ILSPCodeExtractorsManager,\n    autoStart: true\n};\n/**\n * Activate the lsp plugin.\n */\nfunction activate(app, translator, runningSessionManagers) {\n    const languageServerManager = new _jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_0__.LanguageServerManager({\n        settings: app.serviceManager.serverSettings\n    });\n    const connectionManager = new _jupyterlab_lsp__WEBPACK_IMPORTED_MODULE_0__.DocumentConnectionManager({\n        languageServerManager\n    });\n    // Add a sessions manager if the running extension is available\n    if (runningSessionManagers) {\n        addRunningSessionManager(runningSessionManagers, connectionManager, translator);\n    }\n    return connectionManager;\n}\n/**\n * Activate the lsp settings plugin.\n */\nfunction activateSettings(app, connectionManager, settingRegistry, translator, settingRendererRegistry) {\n    const LANGUAGE_SERVERS = 'languageServers';\n    const languageServerManager = connectionManager.languageServerManager;\n    const updateOptions = (settings) => {\n        const options = settings.composite;\n        const languageServerSettings = (options.languageServers ||\n            {});\n        if (options.activate === 'on' && !languageServerManager.isEnabled) {\n            languageServerManager.enable().catch(console.error);\n        }\n        else if (options.activate === 'off' && languageServerManager.isEnabled) {\n            languageServerManager.disable();\n            return;\n        }\n        connectionManager.initialConfigurations = languageServerSettings;\n        // TODO: if priorities changed reset connections\n        connectionManager.updateConfiguration(languageServerSettings);\n        connectionManager.updateServerConfigurations(languageServerSettings);\n        connectionManager.updateLogging(options.logAllCommunication, options.setTrace);\n    };\n    settingRegistry.transform(plugin.id, {\n        fetch: plugin => {\n            const schema = plugin.schema.properties;\n            const defaultValue = {};\n            languageServerManager.sessions.forEach((_, key) => {\n                defaultValue[key] = { rank: 50, configuration: {} };\n            });\n            schema[LANGUAGE_SERVERS]['default'] = defaultValue;\n            return plugin;\n        },\n        compose: plugin => {\n            const properties = plugin.schema.properties;\n            const user = plugin.data.user;\n            const serverDefaultSettings = properties[LANGUAGE_SERVERS]['default'];\n            const serverUserSettings = user[LANGUAGE_SERVERS];\n            let serverComposite = { ...serverDefaultSettings };\n            if (serverUserSettings) {\n                serverComposite = { ...serverComposite, ...serverUserSettings };\n            }\n            const composite = {\n                [LANGUAGE_SERVERS]: serverComposite\n            };\n            Object.entries(properties).forEach(([key, value]) => {\n                if (key !== LANGUAGE_SERVERS) {\n                    if (key in user) {\n                        composite[key] = user[key];\n                    }\n                    else {\n                        composite[key] = value.default;\n                    }\n                }\n            });\n            plugin.data.composite = composite;\n            return plugin;\n        }\n    });\n    languageServerManager.sessionsChanged.connect(async () => {\n        await settingRegistry.load(plugin.id, true);\n    });\n    settingRegistry\n        .load(plugin.id)\n        .then(settings => {\n        updateOptions(settings);\n        settings.changed.connect(() => {\n            updateOptions(settings);\n        });\n        languageServerManager.disable();\n    })\n        .catch((reason) => {\n        console.error(reason.message);\n    });\n    if (settingRendererRegistry) {\n        const renderer = {\n            fieldRenderer: (props) => {\n                return (0,_renderer__WEBPACK_IMPORTED_MODULE_6__.renderServerSetting)(props, translator);\n            }\n        };\n        settingRendererRegistry.addRenderer(`${plugin.id}.${LANGUAGE_SERVERS}`, renderer);\n    }\n}\nclass RunningLanguageServer {\n    constructor(connection, manager) {\n        this._connection = new WeakSet([connection]);\n        this._manager = manager;\n        this._serverIdentifier = connection.serverIdentifier;\n        this._serverLanguage = connection.serverLanguage;\n    }\n    /**\n     * This is no-op because we do not do anything on server click event\n     */\n    open() {\n        /** no-op */\n    }\n    icon() {\n        return _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_4__.pythonIcon;\n    }\n    label() {\n        var _a, _b;\n        return `${(_a = this._serverIdentifier) !== null && _a !== void 0 ? _a : ''} (${(_b = this._serverLanguage) !== null && _b !== void 0 ? _b : ''})`;\n    }\n    shutdown() {\n        for (const [key, value] of this._manager.connections.entries()) {\n            if (this._connection.has(value)) {\n                const { uri } = this._manager.documents.get(key);\n                this._manager.unregisterDocument(uri);\n            }\n        }\n        this._manager.disconnect(this._serverIdentifier);\n    }\n}\n/**\n * Add the running terminal manager to the running panel.\n */\nfunction addRunningSessionManager(managers, lsManager, translator) {\n    const trans = translator.load('jupyterlab');\n    const signal = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_5__.Signal(lsManager);\n    lsManager.connected.connect(() => signal.emit(lsManager));\n    lsManager.disconnected.connect(() => signal.emit(lsManager));\n    lsManager.closed.connect(() => signal.emit(lsManager));\n    lsManager.documentsChanged.connect(() => signal.emit(lsManager));\n    let currentRunning = [];\n    managers.add({\n        name: trans.__('Language servers'),\n        running: () => {\n            const connections = new Set([...lsManager.connections.values()]);\n            currentRunning = [...connections].map(conn => new RunningLanguageServer(conn, lsManager));\n            return currentRunning;\n        },\n        shutdownAll: () => {\n            currentRunning.forEach(item => {\n                item.shutdown();\n            });\n        },\n        refreshRunning: () => {\n            return void 0;\n        },\n        runningChanged: signal,\n        shutdownLabel: trans.__('Shut Down'),\n        shutdownAllLabel: trans.__('Shut Down All'),\n        shutdownAllConfirmationText: trans.__('Are you sure you want to permanently shut down all running language servers?')\n    });\n}\n/**\n * Export the plugin as default.\n */\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ([\n    plugin,\n    featurePlugin,\n    settingsPlugin,\n    codeExtractorManagerPlugin\n]);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/lsp-extension/lib/index.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/lsp-extension/lib/renderer.js":
/*!*****************************************************************!*\
  !*** ../node_modules/@jupyterlab/lsp-extension/lib/renderer.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 */   \"renderServerSetting\": () => (/* binding */ renderServerSetting)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__ = __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_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/coreutils */ \"webpack/sharing/consume/default/@lumino/coreutils/@lumino/coreutils\");\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _lumino_polling__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/polling */ \"webpack/sharing/consume/default/@lumino/polling/@lumino/polling\");\n/* harmony import */ var _lumino_polling__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_lumino_polling__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// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n\n\n\nconst SETTING_NAME = 'languageServers';\nconst SERVER_SETTINGS = 'configuration';\n/**\n * The React component of the setting field\n */\nfunction BuildSettingForm(props) {\n    const { [SERVER_SETTINGS]: serverSettingsSchema, ...otherSettingsSchema } = props.schema;\n    const { [SERVER_SETTINGS]: serverSettings, serverName, ...otherSettings } = props.settings;\n    const [currentServerName, setCurrentServerName] = (0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(serverName);\n    /**\n     * Callback on server name field change event\n     */\n    const onServerNameChange = (e) => {\n        props.updateSetting\n            .invoke(props.serverHash, {\n            serverName: e.target.value\n        })\n            .catch(console.error);\n        setCurrentServerName(e.target.value);\n    };\n    const serverSettingWithType = {};\n    Object.entries(serverSettings).forEach(([key, value]) => {\n        const newProps = {\n            property: key,\n            type: typeof value,\n            value\n        };\n        serverSettingWithType[_lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.UUID.uuid4()] = newProps;\n    });\n    const [propertyMap, setPropertyMap] = (0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(serverSettingWithType);\n    const defaultOtherSettings = {};\n    Object.entries(otherSettingsSchema).forEach(([key, value]) => {\n        if (key in otherSettings) {\n            defaultOtherSettings[key] = otherSettings[key];\n        }\n        else {\n            defaultOtherSettings[key] = value['default'];\n        }\n    });\n    const [otherSettingsComposite, setOtherSettingsComposite] = (0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(defaultOtherSettings);\n    /**\n     * Callback on additional setting field change event\n     */\n    const onOtherSettingsChange = (property, value, type) => {\n        let settingValue = value;\n        if (type === 'number') {\n            settingValue = parseFloat(value);\n        }\n        const newProps = {\n            ...otherSettingsComposite,\n            [property]: settingValue\n        };\n        props.updateSetting.invoke(props.serverHash, newProps).catch(console.error);\n        setOtherSettingsComposite(newProps);\n    };\n    /**\n     * Callback on `Add property` button click event.\n     */\n    const addProperty = () => {\n        const hash = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.UUID.uuid4();\n        const newMap = {\n            ...propertyMap,\n            [hash]: { property: '', type: 'string', value: '' }\n        };\n        const payload = {};\n        Object.values(newMap).forEach(value => {\n            payload[value.property] = value.value;\n        });\n        props.updateSetting\n            .invoke(props.serverHash, {\n            [SERVER_SETTINGS]: payload\n        })\n            .catch(console.error);\n        setPropertyMap(newMap);\n    };\n    /**\n     * Callback on `Remove property` button click event.\n     */\n    const removeProperty = (entryHash) => {\n        const newMap = {};\n        Object.entries(propertyMap).forEach(([hash, value]) => {\n            if (hash !== entryHash) {\n                newMap[hash] = value;\n            }\n            const payload = {};\n            Object.values(newMap).forEach(value => {\n                payload[value.property] = value.value;\n            });\n            props.updateSetting\n                .invoke(props.serverHash, {\n                [SERVER_SETTINGS]: payload\n            })\n                .catch(console.error);\n            setPropertyMap(newMap);\n        });\n    };\n    /**\n     * Save setting to the setting registry on field change event.\n     */\n    const setProperty = (hash, property) => {\n        if (hash in propertyMap) {\n            const newMap = { ...propertyMap, [hash]: property };\n            const payload = {};\n            Object.values(newMap).forEach(value => {\n                payload[value.property] = value.value;\n            });\n            setPropertyMap(newMap);\n            props.updateSetting\n                .invoke(props.serverHash, {\n                [SERVER_SETTINGS]: payload\n            })\n                .catch(console.error);\n        }\n    };\n    const debouncedSetProperty = new _lumino_polling__WEBPACK_IMPORTED_MODULE_2__.Debouncer(setProperty);\n    return (react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", { className: \"array-item\" },\n        react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", { className: \"form-group \" },\n            react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", { className: \"jp-FormGroup-content\" },\n                react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", { className: \"jp-objectFieldWrapper\" },\n                    react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"fieldset\", null,\n                        react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", { className: \"form-group small-field\" },\n                            react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", { className: \"jp-modifiedIndicator jp-errorIndicator\" }),\n                            react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", { className: \"jp-FormGroup-content\" },\n                                react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"h3\", { className: \"jp-FormGroup-fieldLabel jp-FormGroup-contentItem\" }, props.trans.__('Server name:')),\n                                react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", { className: \"jp-inputFieldWrapper jp-FormGroup-contentItem\" },\n                                    react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"input\", { className: \"form-control\", type: \"text\", required: true, value: currentServerName, onChange: e => {\n                                            onServerNameChange(e);\n                                        } })),\n                                react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", { className: \"validationErrors\" },\n                                    react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", null,\n                                        react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"ul\", { className: \"error-detail bs-callout bs-callout-info\" },\n                                            react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"li\", { className: \"text-danger\" }, props.trans.__('is a required property'))))))),\n                        Object.entries(otherSettingsSchema).map(([property, value], idx) => {\n                            return (react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", { key: `${idx}-${property}`, className: \"form-group small-field\" },\n                                react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", { className: \"jp-FormGroup-content\" },\n                                    react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"h3\", { className: \"jp-FormGroup-fieldLabel jp-FormGroup-contentItem\" }, value.title),\n                                    react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", { className: \"jp-inputFieldWrapper jp-FormGroup-contentItem\" },\n                                        react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"input\", { className: \"form-control\", placeholder: \"\", type: value.type, value: otherSettingsComposite[property], onChange: e => onOtherSettingsChange(property, e.target.value, value.type) })),\n                                    react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", { className: \"jp-FormGroup-description\" }, value.description),\n                                    react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", { className: \"validationErrors\" }))));\n                        }),\n                        react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"fieldset\", null,\n                            react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"legend\", null, serverSettingsSchema['title']),\n                            Object.entries(propertyMap).map(([hash, property]) => {\n                                return (react__WEBPACK_IMPORTED_MODULE_3___default().createElement(PropertyFrom, { key: hash, hash: hash, property: property, removeProperty: removeProperty, setProperty: debouncedSetProperty }));\n                            }),\n                            react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"span\", null, serverSettingsSchema['description'])))))),\n        react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", { className: \"jp-ArrayOperations\" },\n            react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"button\", { className: \"jp-mod-styled jp-mod-reject\", onClick: addProperty }, props.trans.__('Add property')),\n            react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"button\", { className: \"jp-mod-styled jp-mod-warn jp-FormGroup-removeButton\", onClick: () => props.removeSetting(props.serverHash) }, props.trans.__('Remove server')))));\n}\nfunction PropertyFrom(props) {\n    const [state, setState] = (0,react__WEBPACK_IMPORTED_MODULE_3__.useState)({ ...props.property });\n    const TYPE_MAP = { string: 'text', number: 'number', boolean: 'checkbox' };\n    const removeItem = () => {\n        props.removeProperty(props.hash);\n    };\n    const changeName = (newName) => {\n        const newState = { ...state, property: newName };\n        props.setProperty.invoke(props.hash, newState).catch(console.error);\n        setState(newState);\n    };\n    const changeValue = (newValue, type) => {\n        let value = newValue;\n        if (type === 'number') {\n            value = parseFloat(newValue);\n        }\n        const newState = { ...state, value };\n        props.setProperty.invoke(props.hash, newState).catch(console.error);\n        setState(newState);\n    };\n    const changeType = (newType) => {\n        let value;\n        if (newType === 'boolean') {\n            value = false;\n        }\n        else if (newType === 'number') {\n            value = 0;\n        }\n        else {\n            value = '';\n        }\n        const newState = { ...state, type: newType, value };\n        setState(newState);\n        props.setProperty.invoke(props.hash, newState).catch(console.error);\n    };\n    return (react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", { key: props.hash, className: \"form-group small-field\" },\n        react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", { className: \"jp-FormGroup-content jp-LSPExtension-FormGroup-content\" },\n            react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"input\", { className: \"form-control\", type: \"text\", required: true, placeholder: 'Property name', value: state.property, onChange: e => {\n                    changeName(e.target.value);\n                } }),\n            react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"select\", { className: \"form-control\", value: state.type, onChange: e => changeType(e.target.value) },\n                react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"option\", { value: \"string\" }, \"String\"),\n                react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"option\", { value: \"number\" }, \"Number\"),\n                react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"option\", { value: \"boolean\" }, \"Boolean\")),\n            react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"input\", { className: \"form-control\", type: TYPE_MAP[state.type], required: false, placeholder: 'Property value', value: state.type !== 'boolean' ? state.value : undefined, checked: state.type === 'boolean' ? state.value : undefined, onChange: state.type !== 'boolean'\n                    ? e => changeValue(e.target.value, state.type)\n                    : e => changeValue(e.target.checked, state.type) }),\n            react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"button\", { className: \"jp-mod-minimal jp-Button\", onClick: removeItem },\n                react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__.closeIcon.react, null)))));\n}\n/**\n * React setting component\n */\nclass SettingRenderer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Component) {\n    constructor(props) {\n        super(props);\n        /**\n         * Remove a setting item by its hash\n         *\n         * @param hash - hash of the item to be removed.\n         */\n        this.removeSetting = (hash) => {\n            if (hash in this.state.items) {\n                const items = {};\n                for (const key in this.state.items) {\n                    if (key !== hash) {\n                        items[key] = this.state.items[key];\n                    }\n                }\n                this.setState(old => {\n                    return { ...old, items };\n                }, () => {\n                    this.saveServerSetting();\n                });\n            }\n        };\n        /**\n         * Update a setting item by its hash\n         *\n         * @param hash - hash of the item to be updated.\n         * @param newSetting - new setting value.\n         */\n        this.updateSetting = (hash, newSetting) => {\n            if (hash in this.state.items) {\n                const items = {};\n                for (const key in this.state.items) {\n                    if (key === hash) {\n                        items[key] = { ...this.state.items[key], ...newSetting };\n                    }\n                    else {\n                        items[key] = this.state.items[key];\n                    }\n                }\n                this.setState(old => {\n                    return { ...old, items };\n                }, () => {\n                    this.saveServerSetting();\n                });\n            }\n        };\n        /**\n         * Add setting item to the setting component.\n         */\n        this.addServerSetting = () => {\n            let index = 0;\n            let key = 'newKey';\n            while (Object.values(this.state.items)\n                .map(val => val.serverName)\n                .includes(key)) {\n                index += 1;\n                key = `newKey-${index}`;\n            }\n            this.setState(old => ({\n                ...old,\n                items: {\n                    ...old.items,\n                    [_lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.UUID.uuid4()]: { ...this._defaultSetting, serverName: key }\n                }\n            }), () => {\n                this.saveServerSetting();\n            });\n        };\n        /**\n         * Save the value of setting items to the setting registry.\n         */\n        this.saveServerSetting = () => {\n            const settings = {};\n            Object.values(this.state.items).forEach(item => {\n                const { serverName, ...setting } = item;\n                settings[serverName] = setting;\n            });\n            this._setting.set(SETTING_NAME, settings).catch(console.error);\n        };\n        this._setting = props.formContext.settings;\n        this._trans = props.translator.load('jupyterlab');\n        const schema = this._setting.schema['definitions'];\n        this._defaultSetting = schema['languageServer']['default'];\n        this._schema = schema['languageServer']['properties'];\n        const title = props.schema.title;\n        const desc = props.schema.description;\n        const settings = props.formContext.settings;\n        const compositeData = settings.get(SETTING_NAME).composite;\n        let items = {};\n        if (compositeData) {\n            Object.entries(compositeData).forEach(([key, value]) => {\n                if (value) {\n                    const hash = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.UUID.uuid4();\n                    items[hash] = { serverName: key, ...value };\n                }\n            });\n        }\n        this.state = { title, desc, items };\n        this._debouncedUpdateSetting = new _lumino_polling__WEBPACK_IMPORTED_MODULE_2__.Debouncer(this.updateSetting.bind(this));\n    }\n    render() {\n        return (react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", null,\n            react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"fieldset\", null,\n                react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"legend\", null, this.state.title),\n                react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"p\", { className: \"field-description\" }, this.state.desc),\n                react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", { className: \"field field-array field-array-of-object\" }, Object.entries(this.state.items).map(([hash, value], idx) => {\n                    return (react__WEBPACK_IMPORTED_MODULE_3___default().createElement(BuildSettingForm, { key: `${idx}-${hash}`, trans: this._trans, removeSetting: this.removeSetting, updateSetting: this._debouncedUpdateSetting, serverHash: hash, settings: value, schema: this._schema }));\n                })),\n                react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"div\", null,\n                    react__WEBPACK_IMPORTED_MODULE_3___default().createElement(\"button\", { style: { margin: 2 }, className: \"jp-mod-styled jp-mod-reject\", onClick: this.addServerSetting }, this._trans.__('Add server'))))));\n    }\n}\n/**\n * Custom setting renderer for language server extension.\n */\nfunction renderServerSetting(props, translator) {\n    return react__WEBPACK_IMPORTED_MODULE_3___default().createElement(SettingRenderer, { ...props, translator: translator });\n}\n//# sourceMappingURL=renderer.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/lsp-extension/lib/renderer.js?");

/***/ })

}]);