"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([["node_modules_jupyterlab_translation-extension_lib_index_js"],{

/***/ "../node_modules/@jupyterlab/translation-extension/lib/index.js":
/*!**********************************************************************!*\
  !*** ../node_modules/@jupyterlab/translation-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 */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/application */ \"webpack/sharing/consume/default/@jupyterlab/application/@jupyterlab/application\");\n/* harmony import */ var _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/apputils */ \"webpack/sharing/consume/default/@jupyterlab/apputils/@jupyterlab/apputils\");\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyterlab/mainmenu */ \"webpack/sharing/consume/default/@jupyterlab/mainmenu/@jupyterlab/mainmenu\");\n/* harmony import */ var _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @jupyterlab/settingregistry */ \"webpack/sharing/consume/default/@jupyterlab/settingregistry/@jupyterlab/settingregistry\");\n/* harmony import */ var _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @jupyterlab/translation */ \"webpack/sharing/consume/default/@jupyterlab/translation/@jupyterlab/translation\");\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__);\n/* ----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n/**\n * @packageDocumentation\n * @module translation-extension\n */\n\n\n\n\n\n/**\n * Translation plugins\n */\nconst PLUGIN_ID = '@jupyterlab/translation-extension:plugin';\n/**\n * Provide the translator connector as a separate plugin to allow for alternative\n * implementations that may want to fetch translation bundles from a different\n * source or endpoint.\n */\nconst translatorConnector = {\n    id: '@jupyterlab/translation-extension:translator-connector',\n    description: 'Provides the application translation connector.',\n    autoStart: true,\n    requires: [_jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.JupyterFrontEnd.IPaths],\n    provides: _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__.ITranslatorConnector,\n    activate: (app, paths) => {\n        const url = paths.urls.translations;\n        const serverSettings = app.serviceManager.serverSettings;\n        return new _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__.TranslatorConnector(url, serverSettings);\n    }\n};\n/**\n * The main translator plugin.\n */\nconst translator = {\n    id: '@jupyterlab/translation-extension:translator',\n    description: 'Provides the application translation object.',\n    autoStart: true,\n    requires: [_jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.JupyterFrontEnd.IPaths, _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_3__.ISettingRegistry],\n    optional: [_jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.ILabShell, _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__.ITranslatorConnector],\n    provides: _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__.ITranslator,\n    activate: async (app, paths, settings, labShell, connector) => {\n        const setting = await settings.load(PLUGIN_ID);\n        const currentLocale = setting.get('locale').composite;\n        let stringsPrefix = setting.get('stringsPrefix')\n            .composite;\n        const displayStringsPrefix = setting.get('displayStringsPrefix')\n            .composite;\n        stringsPrefix = displayStringsPrefix ? stringsPrefix : '';\n        const serverSettings = app.serviceManager.serverSettings;\n        const translationManager = new _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__.TranslationManager(paths.urls.translations, stringsPrefix, serverSettings, connector !== null && connector !== void 0 ? connector : undefined);\n        // As we wait for fetching the translation, ITranslator is guarantee to be\n        // ready when consumed in other plugins.\n        await translationManager.fetch(currentLocale);\n        // Set the document language after optionally fetching the system language\n        // if the setting 'locale' is set to 'default'\n        document.documentElement.lang = translationManager.languageCode;\n        // Set translator to UI\n        if (labShell) {\n            labShell.translator = translationManager;\n        }\n        _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.Dialog.translator = translationManager;\n        return translationManager;\n    }\n};\n/**\n * Initialization data for the extension.\n */\nconst langMenu = {\n    id: PLUGIN_ID,\n    description: 'Adds translation commands and settings.',\n    requires: [_jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_3__.ISettingRegistry, _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__.ITranslator, _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__.ITranslatorConnector],\n    optional: [_jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_2__.IMainMenu, _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.ICommandPalette],\n    autoStart: true,\n    activate: (app, settings, translator, translatorConnector, mainMenu, palette) => {\n        var _a;\n        const trans = translator.load('jupyterlab');\n        const { commands } = app;\n        // Create a languages menu\n        const languagesMenu = mainMenu\n            ? (_a = mainMenu.settingsMenu.items.find(item => {\n                var _a;\n                return item.type === 'submenu' &&\n                    ((_a = item.submenu) === null || _a === void 0 ? void 0 : _a.id) === 'jp-mainmenu-settings-language';\n            })) === null || _a === void 0 ? void 0 : _a.submenu\n            : null;\n        // Get list of available locales\n        translatorConnector\n            .fetch()\n            .then(languageList => {\n            const appLocale = translator.languageCode.replace('-', '_');\n            for (const locale in languageList.data) {\n                const value = languageList.data[locale];\n                const displayName = value.displayName;\n                const nativeName = value.nativeName;\n                const toggled = appLocale === locale;\n                const label = toggled\n                    ? `${displayName}`\n                    : `${displayName} - ${nativeName}`;\n                // Add a command per language\n                const command = `jupyterlab-translation:${locale}`;\n                commands.addCommand(command, {\n                    label: label,\n                    caption: trans.__('Change interface language to %1', label),\n                    isEnabled: () => !toggled,\n                    isToggled: () => toggled,\n                    execute: async () => {\n                        const result = await (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.showDialog)({\n                            title: trans.__('Change interface language?'),\n                            body: trans.__('After changing the interface language to %1, you will need to reload JupyterLab to see the changes.', label),\n                            buttons: [\n                                _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.Dialog.cancelButton(),\n                                _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.Dialog.okButton({ label: trans.__('Change and reload') })\n                            ]\n                        });\n                        if (result.button.accept) {\n                            try {\n                                await settings.set(PLUGIN_ID, 'locale', locale);\n                                window.location.reload();\n                            }\n                            catch (reason) {\n                                console.error(`Failed to update language locale to ${locale}`, reason);\n                            }\n                        }\n                    }\n                });\n                // Add the language command to the menu\n                if (languagesMenu) {\n                    languagesMenu.addItem({\n                        command,\n                        args: {}\n                    });\n                }\n                if (palette) {\n                    palette.addItem({\n                        category: trans.__('Display Languages'),\n                        command\n                    });\n                }\n            }\n        })\n            .catch(reason => {\n            console.error(`Available locales errored!\\n${reason}`);\n        });\n    }\n};\n/**\n * Export the plugins as default.\n */\nconst plugins = [\n    translatorConnector,\n    translator,\n    langMenu\n];\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (plugins);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/translation-extension/lib/index.js?");

/***/ })

}]);