{"version":3,"file":"app-a7ea5710.981ca8458d389c9a476a.bundle.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAMA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AAAA;;AAIA;AACA;AAsBA;AAZA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AAMA;AALA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AAGA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;;AAGA;AACA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AACA;AACA;AAEA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAIA;AAFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AAAA;AACA;AAEA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACzYA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AAGA;AAGA;;AAIA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AAAA;;AAIA;AACA;AAkBA;AARA;AAAA;AACA;AACA;AACA;AACA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AAKA;AAJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAGA;AACA;AACA;AAGA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;;AAGA;AACA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AAEA;;;;;;;;;;;;;;AC5RA;;AAEA;AACA;AAEA;AADA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;ACtBA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;AC9CA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AAAA;;AAIA;AACA;AAWA;AARA;AAAA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;;AAGA;AACA;AAMA;AALA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;;AAGA;AACA;AAEA;AAAA;AAAA;AACA;AACA;AAEA;AAEA;AAAA;AAAA;AACA;AACA;AAEA;AAEA;AAAA;AAAA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AAEA;;;;;;;;;;;;;;;;;;;;AC7HA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAGA;AACA;AAOA;AAJA;AAAA;AACA;AAIA;AACA;AACA;;AAGA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;;;ACpDA;AACA;AACA;AACA;;;;;;;;;;;ACHA;AACA;AACA;AACA;;;;;;;;;;;ACHA;AACA;AACA;AACA;;;;;;;;;;;ACHA;AACA;AACA;AACA","sources":["webpack://latinera/./sources/dialogs/definitions.js","webpack://latinera/./sources/dialogs/generators.js","webpack://latinera/./sources/dialogs/generators/is-lemma-inflected.js","webpack://latinera/./sources/dialogs/generators/wait-for-lemma-to-be-inflected.js","webpack://latinera/./sources/dialogs/inflectors.js","webpack://latinera/./sources/dialogs/reset-password-success.js","webpack://latinera/./sources/dialogs/definitions.html","webpack://latinera/./sources/dialogs/generators.html","webpack://latinera/./sources/dialogs/inflectors.html","webpack://latinera/./sources/dialogs/reset-password-success.html"],"sourcesContent":["// Define the view-model for the \"definitions\" dialog\n\n// Import library modules\nimport { DialogController, DialogService } from \"aurelia-dialog\";\nimport { inject, computedFrom } from \"aurelia-framework\";\nimport { I18N } from \"aurelia-i18n\";\n\n// Import utility modules\nimport { setEventHandlers, unsetEventHandlers } from \"utilities/event\";\nimport { computeAbsoluteTimeString } from \"utilities/time\";\n\n// Import parameter modules\nimport { tBindingBehavior as i18nParams } from \"parameters/i18n\";\nimport { \n runMode as defaultRunMode,\n uiLocaleCode as defaultUILocaleCode,\n outLocaleCode as defaultOutLocaleCode\n} from \"parameters/environment\";\n\n// Import dialog modules\nimport { ConfirmReportDefinition } from \"dialogs/confirm-report-definition\";\nimport { ConfirmUnreportDefinition } from \"dialogs/confirm-unreport-definition\";\nimport { CreateDefinition } from \"dialogs/create-definition\";\n\n// Import service modules\nimport DefinitionService from \"services/definition\";\nimport EventService from \"services/event\";\nimport NotificationService from \"services/notification\";\n\n// Define internal parameters\nconst eventsData = [\n { name: \"sessionClosing\" }\n];\n\n\n// Export the \"Definitions\" class\n@inject(\n DefinitionService,\n DialogController,\n DialogService,\n EventService,\n I18N,\n NotificationService\n)\nexport class Definitions {\n\n // Local attributes\n lemmaData = null;\n activeDefinitionData = null;\n definitionsData = [];\n expandedDefinitionIndex = -1;\n i18nDefinitionsData = [];\n titleBodyHelpI18nParams = null;\n uiLocaleCode = defaultUILocaleCode;\n outLocaleCode = defaultOutLocaleCode;\n i18nParams = i18nParams;\n runMode = defaultRunMode;\n\n constructor(\n definitionService,\n dialogController,\n dialogService,\n eventService,\n i18n,\n notificationService\n ) {\n this.definitionService = definitionService;\n this.dialogController = dialogController;\n this.dialogService = dialogService;\n this.eventService = eventService;\n this.i18n = i18n;\n this.notificationService = notificationService;\n }\n\n // Lifecycle methods\n async activate({ \n lemmaData = null,\n activeDefinitionData = null,\n uiLocaleCode = defaultUILocaleCode,\n outLocaleCode = defaultOutLocaleCode,\n runMode = defaultRunMode\n } = {}) {\n this.lemmaData = lemmaData;\n this.activeDefinitionData = activeDefinitionData;\n this.uiLocaleCode = uiLocaleCode;\n this.outLocaleCode = outLocaleCode;\n this.runMode = runMode;\n this.titleBodyHelpI18nParams = { \n ...i18nParams, \n lemmaText: this.lemmaText\n };\n\n // Load definitions from server\n // note: loaded fresh each time because other users could have added/\n // reported/unreported (or the moderators could have disabled) some \n // definition\n this.definitionsData = await this.loadDefinitions({ \n lemmaKey: this.lemmaKey\n })\n this.updateI18nDefinitionsData();\n\n // Auto-open \"addDefinition\" dialog if no definition is available\n if (this.definitionsData.length === 0) {\n console.info(`Automatically opening the \"addDefinition\" dialog ` +\n `because lemma \"${this.lemmaText}\" does not have any ` +\n `associated definition`);\n await this.openAddDefinitionDialog();\n }\n }\n\n bind() {\n this.eventsSubscriptions = setEventHandlers.call(this, {\n entityName: \"selectOrAddDefinition\",\n eventService: this.eventService,\n eventsData\n });\n }\n\n unbind() {\n unsetEventHandlers.call(this, {\n eventsSubscriptions: this.eventsSubscriptions\n });\n }\n\n\n // Getter and setter methods\n @computedFrom(\"lemmaData.key\")\n get lemmaKey() {\n const { key: lemmaKey = \"\" } = this.lemmaData || {};\n return lemmaKey;\n }\n @computedFrom(\"lemmaData.text\")\n get lemmaText() {\n const { text: lemmaText = \"\" } = this.lemmaData || {};\n return lemmaText;\n }\n\n @computedFrom(\"activeDefinitionData.key\")\n get activeDefinitionKey() {\n const { key: activeDefinitionKey = \"\" } = this.activeDefinitionData || {};\n return activeDefinitionKey;\n }\n @computedFrom(\"activeDefinitionData.text\")\n get activeDefinitionText() {\n const { text: activeDefinitionText = \"\" } = this.activeDefinitionData || {};\n return activeDefinitionText;\n }\n @computedFrom(\"lemmaText\", \"activeDefinitionText\")\n get activeDefinitionI18nData() {\n return { \n ...i18nParams, \n lemmaText: this.lemmaText,\n definitionText: this.activeDefinitionText\n };\n }\n\n\n // Core methods\n async loadDefinitions({ lemmaKey = \"\" }) {\n let definitionsData;\n try {\n definitionsData = await this.definitionService.getDefinitionsByLemma({\n lemmaKey,\n localeCode: this.outLocaleCode\n });\n } catch(error) {\n console.warn(`Error loading definitions for lemma \"${lemmaKey}\"`, error);\n definitionsData = [];\n }\n return definitionsData;\n }\n\n updateI18nDefinitionsData() {\n this.i18nDefinitionsData = this.definitionsData\n .map(({ \n text: definitionText = \"\",\n userReport: userReportData\n }) => { \n const { \n type: reportType = \"\",\n reportedOn: reportedOnMs\n } = userReportData || {};\n const i18nReportType = reportType ?\n this.i18n.tr(`enums:longDefinitionReportType.${reportType}`) : \"\";\n const i18nReportDate = reportedOnMs ? computeAbsoluteTimeString({\n timeStampMs: reportedOnMs,\n formatString: \"P\",\n localeCode: this.uiLocaleCode\n }) : \"\";\n return {\n ...i18nParams,\n lemmaText: this.lemmaText,\n definitionText,\n ...(i18nReportType ? { reportType: i18nReportType } : {}),\n ...(i18nReportDate ? { reportDate: i18nReportDate } : {})\n };\n });\n }\n\n async reportDefinition(definitionData, definitionIndex) {\n const { \n key: definitionKey = \"\",\n text: definitionText = \"\",\n } = definitionData || {};\n const confirmReportDefinitionDialogOpenResult = await this.dialogService\n .open({\n viewModel: ConfirmReportDefinition,\n model: { \n definitionData,\n lemmaData: this.lemmaData \n },\n //keyboard: [\"Escape\"] // keys that close the dialog\n });\n const confirmReportDefinitionDialogCloseResult =\n await confirmReportDefinitionDialogOpenResult.closeResult;\n if (confirmReportDefinitionDialogCloseResult.wasCancelled) {\n console.info(`User canceled the reporting of definition ` +\n `\"${definitionKey}\" for lemma \"${this.lemmaKey}\"`);\n return;\n }\n const { \n output: reportDefinitionData = null \n } = confirmReportDefinitionDialogCloseResult;\n if (reportDefinitionData) {\n const { reportTarget = \"\" } = reportDefinitionData || {};\n const reportDefinitionPromise = reportTarget === \"lemma\" ?\n this.definitionService.reportLemmaDefinition(reportDefinitionData) :\n this.definitionService.reportDefinition(reportDefinitionData);\n let updatedDefinitionData;\n try {\n updatedDefinitionData = await reportDefinitionPromise;\n } catch(error) {\n console.warn(`Error reporting definition \"${definitionKey}` +\n `for lemma \"${this.lemmaKey}\"`, error);\n this.notificationService.showUINotification({\n message: \"notifications:definitionReportingError\",\n status: \"failure\",\n group: \"private\"\n });\n return;\n }\n this.definitionsData.splice(definitionIndex, 1, updatedDefinitionData);\n this.updateI18nDefinitionsData();\n const { userReport: userReportData = null } = updatedDefinitionData || {};\n const { type: reportType = \"\" } = userReportData || {};\n const i18nReportType = \n this.i18n.tr(`enums:longDefinitionReportType.${reportType}`);\n this.notificationService.showUINotification({\n message: \"notifications:definitionReported\",\n params: { \n definitionText, \n reportType: i18nReportType \n },\n status: \"success\",\n group: \"private\"\n });\n } else {\n console.warn(`Unexpected output from \"ConfirmReportDefinition\" dialog`);\n this.notificationService.showUINotification({\n message: \"notifications:definitionReportingError\",\n status: \"failure\",\n group: \"private\"\n });\n }\n }\n\n async unreportDefinition(definitionData, definitionIndex) {\n const { \n key: definitionKey = \"\",\n text: definitionText = \"\"\n } = definitionData || {};\n const confirmUnreportDefinitionDialogOpenResult = await this.dialogService\n .open({\n viewModel: ConfirmUnreportDefinition,\n model: { \n definitionData,\n lemmaData: this.lemmaData \n },\n //keyboard: [\"Escape\"] // keys that close the dialog\n });\n const confirmUnreportDefinitionDialogCloseResult =\n await confirmUnreportDefinitionDialogOpenResult.closeResult;\n if (confirmUnreportDefinitionDialogCloseResult.wasCancelled) {\n console.info(`User canceled the reporting of definition ` +\n `\"${definitionKey}\" for lemma \"${this.lemmaKey}\"`);\n return;\n }\n const { \n output: unreportDefinitionData = null \n } = confirmUnreportDefinitionDialogCloseResult;\n if (unreportDefinitionData) {\n const { reportTarget = \"\" } = unreportDefinitionData || {};\n const unreportDefinitionPromise = reportTarget === \"lemma\" ?\n this.definitionService.unreportLemmaDefinition(unreportDefinitionData) :\n this.definitionService.unreportDefinition(unreportDefinitionData);\n let updatedDefinitionData;\n try {\n updatedDefinitionData = await unreportDefinitionPromise;\n } catch(error) {\n console.warn(`Error un-reporting definition \"${definitionKey}` +\n `for lemma \"${this.lemmaKey}\"`, error);\n this.notificationService.showUINotification({\n message: \"notifications:definitionUnreportingError\",\n status: \"failure\",\n group: \"private\"\n });\n return;\n }\n this.definitionsData.splice(definitionIndex, 1, updatedDefinitionData);\n this.updateI18nDefinitionsData();\n const { userReport: userReportData = null } = definitionData || {};\n const { type: reportType = \"\" } = userReportData || {};\n const i18nReportType = \n this.i18n.tr(`enums:longDefinitionReportType.${reportType}`);\n this.notificationService.showUINotification({\n message: \"notifications:definitionUnreported\",\n params: { \n definitionText, \n reportType: i18nReportType \n },\n status: \"success\",\n group: \"private\"\n });\n } else {\n console.warn(`Unexpected output from \"ConfirmUnreportDefinition\" dialog`);\n this.notificationService.showUINotification({\n message: \"notifications:definitionUnreportingError\",\n status: \"failure\",\n group: \"private\"\n });\n }\n }\n\n async openAddDefinitionDialog() {\n const addDefinitionDialogOpenResult = await this.dialogService.open({\n viewModel: CreateDefinition,\n model: { lemmaData: this.lemmaData },\n //keyboard: [\"Escape\"] // keys that close the dialog\n });\n const addDefinitionDialogCloseResult =\n await addDefinitionDialogOpenResult.closeResult;\n if (addDefinitionDialogCloseResult.wasCancelled) {\n console.info(`User canceled the creation of a new definition`);\n return;\n }\n const { output: newDefinitionData = null } = addDefinitionDialogCloseResult;\n if (newDefinitionData) {\n const {\n key: newDefinitionKey = \"\",\n text: newDefinitionText = \"\"\n } = newDefinitionData || {};\n\n // Verify whether the new definition is among the known definitions\n const isNewDefinitionAmongKnownDefinitions = this.definitionsData\n .some(({ key: definitionKey = \"\" }) => {\n return definitionKey === newDefinitionKey;\n });\n if (isNewDefinitionAmongKnownDefinitions) {\n console.info(`New definition \"${newDefinitionText}\" is already ` +\n `among the definitions of lemma \"${this.lemmaText}\"`);\n this.selectDefinition(newDefinitionData);\n return;\n }\n\n\n this.definitionsData = [ ...this.definitionsData, newDefinitionData ];\n this.updateI18nDefinitionsData();\n }\n }\n\n toggleExpandedDefinition(definitionIndex = -1) {\n this.expandedDefinitionIndex =\n this.expandedDefinitionIndex === definitionIndex ? -1 : definitionIndex;\n }\n\n selectDefinition(activeDefinitionData) {\n this.activeDefinitionData = activeDefinitionData;\n this.closeDialog();\n }\n\n closeDialog() {\n this.dialogController.ok({\n activeDefinitionData: this.activeDefinitionData,\n definitionsData: this.definitionsData\n });\n }\n\n\n // Event handlers\n handleSessionClosingEvent() {\n this.dialogController.cancel();\n }\n\n}\n","// Define the view-model for the \"generators\" dialog\n\n// Import library modules\nimport { DialogController, DialogService } from \"aurelia-dialog\";\nimport { inject, computedFrom } from \"aurelia-framework\";\nimport { I18N } from \"aurelia-i18n\";\n\n// Import utility modules\nimport { setEventHandlers, unsetEventHandlers } from \"utilities/event\";\nimport { clone } from \"utilities/etc\";\n\n// Import parameter modules\nimport { tBindingBehavior as i18nParams } from \"parameters/i18n\";\nimport { runMode as defaultRunMode } from \"parameters/environment\";\n\n// Import method modules\nimport { \n loadGeneratorsData \n} from \"components/private/generator/load-generators-data\";\nimport {\n waitForLemmaToBeInflected\n} from \"./generators/wait-for-lemma-to-be-inflected\";\nimport {\n isLemmaInflected\n} from \"./generators/is-lemma-inflected\";\n\n// Import service modules\nimport GeneratorService from \"services/generator\";\nimport EventService from \"services/event\";\nimport LemmaService from \"services/lemma\";\n\n// Import dialog modules\nimport { CreateLemma } from \"dialogs/create-lemma\";\n\n// Define internal parameters\nconst eventsData = [\n { name: \"sessionClosing\" }\n];\n\n\n// Export \"Generators\" class\n@inject(\n I18N,\n DialogController,\n DialogService,\n EventService,\n GeneratorService,\n LemmaService\n)\nexport class Generators {\n\n // Local attributes\n inElementData = null;\n activeGeneratorData = null;\n generatorsData = [];\n i18nGeneratorsData = [];\n isLoadingData = false;\n runMode = defaultRunMode;\n\n constructor(\n i18n,\n dialogController,\n dialogService,\n eventService,\n generatorService,\n lemmaService\n ) {\n this.i18n = i18n;\n this.dialogController = dialogController;\n this.dialogService = dialogService;\n this.eventService = eventService;\n this.generatorService = generatorService;\n this.lemmaService = lemmaService;\n }\n\n\n // Lifecycle methods\n activate({\n activeGeneratorData = null,\n generatorsData = [],\n inElementData = null,\n runMode = defaultRunMode\n } = {}) {\n this.activeGeneratorData = clone(activeGeneratorData);\n this.generatorsData = clone(generatorsData);\n this.inElementData = clone(inElementData);\n this.runMode = runMode;\n this.updateI18nGeneratorsData();\n }\n\n async attached() {\n // Auto-open \"addGenerator\" dialog if no generator is available\n if (this.generatorsData.length === 0) {\n console.debug(`Automatically opening the \"addGenerator\" dialog ` +\n `because input element \"${this.inElementKey}\" does not have ` +\n `any generator lemma associated with it`);\n await this.openAddGeneratorLemmaDialog();\n if (this.generatorsData.length === 1) {\n console.debug(`Automatically closing the \"selectOrAddGenerator\" ` +\n `dialog because input element \"${this.inElementKey}\" has got ` +\n `one generator lemma associated with it`);\n this.closeDialog();\n }\n }\n }\n\n bind() {\n this.eventsSubscriptions = setEventHandlers.call(this, {\n entityName: \"selectOrAddGenerator\",\n eventService: this.eventService,\n eventsData\n });\n }\n\n unbind() {\n unsetEventHandlers.call(this, {\n eventsSubscriptions: this.eventsSubscriptions\n });\n }\n\n\n // Getter and setter methods\n @computedFrom(\"inElementData.key\")\n get inElementKey() {\n const { key: inElementKey = \"\" } = this.inElementData || {};\n return inElementKey;\n }\n @computedFrom(\"inElementData.text\")\n get inElementText() {\n const { text: inElementText = \"\" } = this.inElementData || {};\n return inElementText;\n }\n\n @computedFrom(\"inElementText\")\n get titleBodyHelpI18nParams() {\n return {\n ...i18nParams,\n inElementText: this.inElementText\n };\n }\n\n @computedFrom(\"activeGeneratorData.lemma\")\n get activeLemmaData() {\n const { lemma: activeLemmaData = null } = this.activeGeneratorData || {};\n return activeLemmaData;\n }\n @computedFrom(\"activeLemmaData.key\")\n get activeLemmaKey() {\n const { key: activeLemmaKey = \"\" } = this.activeLemmaData || {};\n return activeLemmaKey;\n }\n @computedFrom(\"activeLemmaData.text\")\n get lemmaText() {\n const { text: lemmaText = \"\" } = this.activeLemmaData || {};\n return lemmaText;\n }\n @computedFrom(\"lemmaText\", \"inElementText\")\n get i18nGeneratorData() {\n return {\n ...i18nParams,\n lemmaText: this.lemmaText,\n inElementText: this.inElementText\n };\n }\n\n \n // Core methods\n async updateGeneratorsData() {\n // Gets updated generators for the input element\n this.generatorsData = await loadGeneratorsData.call(this, { \n inElementData: this.inElementData,\n fetchFromIndex: false\n });\n this.updateI18nGeneratorsData();\n }\n\n updateI18nGeneratorsData() {\n this.i18nGeneratorsData = this.generatorsData\n .map(generatorData => {\n const { lemma: lemmaData = null } = generatorData || {};\n const { text: lemmaText = \"\" } = lemmaData || {};\n return { \n ...i18nParams, \n lemmaText,\n inElementText: this.inElementText\n };\n });\n }\n\n async openAddGeneratorLemmaDialog() {\n const addGeneratorLemmaDialogOpenResult = await this.dialogService.open({\n viewModel: CreateLemma,\n model: {\n inElementData: this.inElementData,\n runMode: this.runMode\n },\n //keyboard: [\"Escape\"] // keys that close the dialog\n });\n const addGeneratorLemmaDialogCloseResult =\n await addGeneratorLemmaDialogOpenResult.closeResult;\n if (addGeneratorLemmaDialogCloseResult.wasCancelled) {\n console.info(`User canceled the creation of a new generator lemma ` +\n `for input element \"${this.inElementKey}\"`);\n return;\n }\n const { output: newLemmaData = null } = addGeneratorLemmaDialogCloseResult;\n if (newLemmaData) {\n const { \n key: newLemmaKey = \"\",\n text: newLemmaText = \"\"\n } = newLemmaData || {};\n\n // Verify whether the new lemma is among the generators already\n const isNewLemmaAmongKnownGenerators = this.generatorsData\n .some(({ lemma: lemmaData = null }) => {\n const { key: lemmaKey = \"\" } = lemmaData || {};\n return lemmaKey === newLemmaKey;\n });\n if (isNewLemmaAmongKnownGenerators) {\n console.info(`New lemma \"${newLemmaText}\" is already among the ` +\n `generators of input element \"${this.inElementKey}\"`);\n this.selectGeneratorByLemma(newLemmaData);\n return;\n }\n\n // Wait for the new lemma to be inflected\n this.isLoadingData = true;\n const isLemmaInflected = \n await this.waitForLemmaToBeInflected(newLemmaData);\n if (isLemmaInflected) {\n console.info(`Lemma \"${newLemmaKey}\" has been inflected`);\n } else {\n console.warn(`Lemma \"${newLemmaKey}\" has not been inflected`);\n // do not return here -> proceed and try to get generators\n // even if lemma has not been inflected\n }\n \n // Update the generators for the input element\n await this.updateGeneratorsData();\n this.isLoadingData = false;\n\n // Select new active generator\n this.selectGeneratorByLemma(newLemmaData);\n }\n }\n\n async waitForLemmaToBeInflected(lemmaData) {\n return await waitForLemmaToBeInflected.call(this, lemmaData);\n }\n\n async isLemmaInflected(lemmaData) {\n return await isLemmaInflected.call(this, lemmaData);\n }\n\n selectGenerator(activeGeneratorData) {\n this.activeGeneratorData = activeGeneratorData;\n this.closeDialog();\n }\n\n selectGeneratorByLemma(activeLemmaData) {\n const { key: activeLemmaKey = \"\" } = activeLemmaData || {};\n const activeGeneratorData = this.generatorsData\n .find(({ lemma: lemmaData = null }) => {\n const { key: lemmaKey = \"\" } = lemmaData || {};\n return lemmaKey === activeLemmaKey;\n }) || null;\n if (activeGeneratorData) {\n this.activeGeneratorData = activeGeneratorData;\n }\n }\n\n closeDialog() {\n this.dialogController.ok({\n activeGeneratorData: this.activeGeneratorData,\n generatorsData: this.generatorsData\n });\n }\n\n\n // Event handlers\n handleSessionClosingEvent() {\n this.dialogController.cancel();\n }\n\n}\n","// Define the \"isLemmaInflected\" selectOrAddGenerator class method\n\n// isLemmaInflected: async\nexport async function isLemmaInflected({ \n key: lemmaKey = \"\" \n}) {\n if (!this.lemmaService) {\n throw new Error(`Missing required lemma service`);\n }\n\n let lemmaInflectionStatusData;\n try {\n lemmaInflectionStatusData = await this.lemmaService\n .getLemmaInflectionStatus(lemmaKey);\n } catch(error) {\n return false;\n }\n const {\n toBeInflected: lemmaToBeInflected = false,\n isBeingInflected: lemmaIsBeingInflected = false\n } = lemmaInflectionStatusData || {};\n return !(lemmaToBeInflected || lemmaIsBeingInflected);\n}\n","// Define the \"waitForLemmaToBeInflected\" selectOrAddGenerator class method\n\n// Import library modules\nimport ms from \"ms\";\n\n// Import utility modules\nimport { exponentialBackoff } from \"utilities/promise\";\n\n// Define internal parameters\nconst backoffTimeoutsMs = [ \"2s\", \"2s\", \"2s\", \"2s\", \"2s\", \"5s\", \"5s\" ]\n .map(timeString => ms(timeString));\n\n\n// waitForLemmaToBeInflected: async\n// returns a promise which resolves with a boolean indicating whether the\n// specified lemma has been inflected or not (i.e. the maximum back-off\n// timeout has expired)\nexport async function waitForLemmaToBeInflected(lemmaData) {\n if (!this.isLemmaInflected) {\n throw new Error(`Missing required method \"isLemmaInflected\"`);\n }\n\n const { key: lemmaKey = \"\" } = lemmaData;\n console.info(`Waiting for lemma \"${lemmaKey}\" to be inflected`);\n let isLemmaInflected;\n try {\n isLemmaInflected = await exponentialBackoff(async() => {\n const isLemmaInflected = await this.isLemmaInflected(lemmaData);\n if (isLemmaInflected) {\n return isLemmaInflected;\n }\n throw new Error(`Lemma \"${lemmaKey}\" is still un-inflected`);\n }, {\n backoffTimeoutsMs,\n backoffCallback: ({ cumulatedBackoffTimeoutMs }) => {\n console.debug(`Lemma \"${lemmaKey}\" is still un-inflected ` +\n `after ${ms(cumulatedBackoffTimeoutMs)}`);\n return true; // continue exponential back-off\n }\n });\n } catch(error) {\n console.warn(`Last timeout elapsed while waiting for lemma \"${lemmaKey}\" ` +\n `to be inflected`);\n return false; // lemma has not been inflected\n }\n return isLemmaInflected;\n}\n","// Define the view-model for the \"inflectors\" dialog\n\n// Import library modules\nimport { inject, computedFrom } from \"aurelia-framework\";\nimport { DialogController } from \"aurelia-dialog\";\n\n// Import utility modules\nimport { setEventHandlers, unsetEventHandlers } from \"utilities/event\";\n\n// Import parameter modules\nimport { tBindingBehavior as i18nParams } from \"parameters/i18n\";\nimport { runMode as defaultRunMode } from \"parameters/environment\";\n\n// Import service modules\nimport EventService from \"services/event\";\n\n// Define internal parameters\nconst eventsData = [\n { name: \"sessionClosing\" }\n];\n\n\n// Export the \"Inflectors\" class\n@inject(DialogController, EventService)\nexport class Inflectors {\n\n // Local attributes\n lemmaData = null;\n inElementData = null;\n activeInInflectorData = null;\n inInflectorsData = [];\n i18nParams = i18nParams;\n runMode = defaultRunMode;\n\n constructor(dialogController, eventService) {\n this.dialogController = dialogController;\n this.eventService = eventService;\n }\n\n\n // Lifecycle methods\n activate({ \n lemmaData = null,\n inElementData = null,\n activeInInflectorData = null,\n inInflectorsData = [],\n runMode = defaultRunMode\n } = {}) {\n this.lemmaData = lemmaData;\n this.inElementData = inElementData;\n this.activeInInflectorData = activeInInflectorData;\n this.inInflectorsData = inInflectorsData;\n this.runMode = runMode;\n }\n\n bind() {\n this.eventsSubscriptions = setEventHandlers.call(this, {\n entityName: \"selectInInflector\",\n eventService: this.eventService,\n eventsData\n });\n }\n\n unbind() {\n unsetEventHandlers.call(this, {\n eventsSubscriptions: this.eventsSubscriptions\n });\n }\n\n\n // Getter and setter mathods\n @computedFrom(\"lemmaData.text\")\n get lemmaText() {\n const { text: lemmaText = \"\" } = this.lemmaData || {};\n return lemmaText;\n }\n\n @computedFrom(\"inElementData.text\")\n get inElementText() {\n const { text: inElementText = \"\" } = this.inElementData || {};\n return inElementText;\n }\n\n @computedFrom(\"activeInInflectorData.key\")\n get activeInInflectorKey() {\n const { key: activeInInflectorKey = \"\" } = this.activeInInflectorData || {};\n return activeInInflectorKey;\n }\n\n @computedFrom(\"lemmaText\", \"inElementText\")\n get titleBodyHelpI18nParams() { \n return {\n ...i18nParams,\n lemmaText: this.lemmaText,\n inElementText: this.inElementText\n };\n }\n @computedFrom(\"lemmaText\")\n get inInflectorI18nParams() {\n return { \n ...i18nParams, \n lemmaText: this.lemmaText,\n inElementText: this.inElementText\n };\n }\n\n\n // Core methods\n selectInInflector(activeInInflectorData) {\n this.activeInInflectorData = activeInInflectorData;\n this.closeDialog();\n }\n\n closeDialog() {\n this.dialogController.ok({\n activeInInflectorData: this.activeInInflectorData\n });\n }\n\n\n // Event handlers\n handleSessionClosingEvent() {\n this.dialogController.cancel();\n }\n\n}\n","// Define the view-model for the \"reset-password-success\" dialog\n\n// Import library modules\nimport { inject } from \"aurelia-framework\";\nimport { DialogController } from \"aurelia-dialog\";\n\n// Import utility modules\nimport { setEventHandlers, unsetEventHandlers } from \"utilities/event\";\n\n// Import parameter modules\nimport { tBindingBehavior as i18nParams } from \"parameters/i18n\";\n\n// Import service modules\nimport EventService from \"services/event\";\n\n// Define internal parameters\nconst eventsData = [];\n\n\n// Export \"ResetPasswordSuccess\" class\n@inject(DialogController, EventService)\nexport class ResetPasswordSuccess {\n\n // Local attributes\n i18nParams = i18nParams;\n formData = null;\n\n constructor(dialogController, eventService) {\n this.dialogController = dialogController;\n this.eventService = eventService;\n }\n\n\n // Lifecycle methods\n activate({ emailAddress }) {\n this.i18nParams.emailAddress = emailAddress;\n }\n\n bind() {\n this.eventsSubscriptions = setEventHandlers.call(this, {\n entityName: \"resetPasswordSuccess\",\n eventService: this.eventService,\n eventsData\n });\n }\n\n unbind() {\n unsetEventHandlers.call(this, {\n eventsSubscriptions: this.eventsSubscriptions\n });\n }\n\n}\n","// Module\nvar code = \"\\n\\n \\n \\n \\n \\n \\n\\n\\n \\n \\n\\n \\n \\n \\n\\n \\n \\n ${\\\"main:noDefinition\\\" & t}…\\n \\n\\n \\n 0\\\">\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n\\n \\n \\n 0 ? 'uk-alert uk-padding-smaller' : ''}\\n uk-flex uk-flex-middle\\n uk-margin-remove\\\">\\n \\n \\n \\n \\n\\n \\n \\n \\n …\\n \\n \\n\\n \\n \\n \\n \\n \\n \\n\\n \\n \\n \\n \\n\\n \\n \\n \\n \\n \\n \\n ${\\\"main:withdraw\\\" & t: i18nParams}\\n \\n \\n \\n \\n\\n \\n \\n \\n \\n \\n \\n \\n \\n ${\\\"main:report\\\" & t: i18nParams}\\n \\n \\n \\n \\n\\n \\n\\n \\n \\n \\n \\n ${\\\"main:noDefinition\\\" & t}\\n \\n \\n \\n \\n\\n \\n \\n \\n \\n \\n \\n ${\\\"main:addDefinition\\\" & t}\\n \\n \\n\\n \\n \\n ${\\\"main:close\\\" & t}\\n \\n \\n\\n \\n\\n\\n\";\n// Exports\nexport default code;","// Module\nvar code = \"\\n\\n \\n \\n \\n \\n \\n\\n\\n \\n \\n \\n \\n \\n\\n \\n \\n \\n \\n ${\\\"main:loadingGenerators\\\" & t}…\\n \\n \\n\\n \\n \\n \\n ${\\\"main:noGenerator\\\" & t}…\\n \\n\\n \\n 0\\\">\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n\\n \\n \\n \\n \\n \\n \\n \\n\\n \\n \\n \\n \\n ${\\\"main:noLemma\\\" & t}\\n \\n \\n \\n \\n \\n\\n \\n \\n \\n \\n \\n \\n ${\\\"main:addGenerator\\\" & t}\\n \\n \\n\\n \\n \\n ${\\\"main:close\\\" & t}\\n \\n \\n \\n\\n\\n\";\n// Exports\nexport default code;","// Module\nvar code = \"\\n\\n \\n \\n \\n \\n\\n\\n \\n \\n \\n \\n \\n\\n \\n 0\\\">\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n\\n \\n \\n \\n \\n \\n \\n \\n\\n \\n \\n \\n \\n ${\\\"main:noInflector\\\" & t}\\n \\n \\n \\n \\n\\n \\n \\n \\n \\n ${\\\"main:close\\\" & t}\\n \\n \\n \\n\\n\\n\";\n// Exports\nexport default code;","// Module\nvar code = \"\\n\\n \\n \\n \\n\\n \\n \\n\\n \\n \\n \\n\\n \\n \\n \\n ${\\\"dialogs:resetPasswordSuccess.okAction\\\" & t: i18nParams}\\n \\n \\n\\n \\n\\n\\n\";\n// Exports\nexport default code;"],"names":[],"sourceRoot":""}