{"version":3,"sources":["node_modules/@ngx-translate/core/dist/fesm2022/ngx-translate-core.mjs","node_modules/@angular/forms/fesm2022/forms.mjs"],"sourcesContent":["import * as i0 from '@angular/core';\nimport { Injectable, EventEmitter, InjectionToken, Inject, Directive, Input, Pipe, NgModule } from '@angular/core';\nimport { of, isObservable, forkJoin, concat, defer } from 'rxjs';\nimport { take, shareReplay, map, concatMap, switchMap } from 'rxjs/operators';\nclass TranslateLoader {}\n/**\n * This loader is just a placeholder that does nothing, in case you don't need a loader at all\n */\nclass TranslateFakeLoader extends TranslateLoader {\n getTranslation(lang) {\n return of({});\n }\n static ɵfac = /* @__PURE__ */(() => {\n let ɵTranslateFakeLoader_BaseFactory;\n return function TranslateFakeLoader_Factory(t) {\n return (ɵTranslateFakeLoader_BaseFactory || (ɵTranslateFakeLoader_BaseFactory = i0.ɵɵgetInheritedFactory(TranslateFakeLoader)))(t || TranslateFakeLoader);\n };\n })();\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: TranslateFakeLoader,\n factory: TranslateFakeLoader.ɵfac\n });\n}\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(TranslateFakeLoader, [{\n type: Injectable\n }], null, null);\n})();\nclass MissingTranslationHandler {}\n/**\n * This handler is just a placeholder that does nothing, in case you don't need a missing translation handler at all\n */\nclass FakeMissingTranslationHandler {\n handle(params) {\n return params.key;\n }\n static ɵfac = function FakeMissingTranslationHandler_Factory(t) {\n return new (t || FakeMissingTranslationHandler)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: FakeMissingTranslationHandler,\n factory: FakeMissingTranslationHandler.ɵfac\n });\n}\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(FakeMissingTranslationHandler, [{\n type: Injectable\n }], null, null);\n})();\n\n/* tslint:disable */\n/**\n * Determines if two objects or two values are equivalent.\n *\n * Two objects or values are considered equivalent if at least one of the following is true:\n *\n * * Both objects or values pass `===` comparison.\n * * Both objects or values are of the same type and all of their properties are equal by\n * comparing them with `equals`.\n *\n * @param o1 Object or value to compare.\n * @param o2 Object or value to compare.\n * @returns true if arguments are equal.\n */\nfunction equals(o1, o2) {\n if (o1 === o2) return true;\n if (o1 === null || o2 === null) return false;\n if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN\n let t1 = typeof o1,\n t2 = typeof o2,\n length,\n key,\n keySet;\n if (t1 == t2 && t1 == 'object') {\n if (Array.isArray(o1)) {\n if (!Array.isArray(o2)) return false;\n if ((length = o1.length) == o2.length) {\n for (key = 0; key < length; key++) {\n if (!equals(o1[key], o2[key])) return false;\n }\n return true;\n }\n } else {\n if (Array.isArray(o2)) {\n return false;\n }\n keySet = Object.create(null);\n for (key in o1) {\n if (!equals(o1[key], o2[key])) {\n return false;\n }\n keySet[key] = true;\n }\n for (key in o2) {\n if (!(key in keySet) && typeof o2[key] !== 'undefined') {\n return false;\n }\n }\n return true;\n }\n }\n return false;\n}\n/* tslint:enable */\nfunction isDefined(value) {\n return typeof value !== 'undefined' && value !== null;\n}\nfunction isObject(item) {\n return item && typeof item === 'object' && !Array.isArray(item);\n}\nfunction mergeDeep(target, source) {\n let output = Object.assign({}, target);\n if (isObject(target) && isObject(source)) {\n Object.keys(source).forEach(key => {\n if (isObject(source[key])) {\n if (!(key in target)) {\n Object.assign(output, {\n [key]: source[key]\n });\n } else {\n output[key] = mergeDeep(target[key], source[key]);\n }\n } else {\n Object.assign(output, {\n [key]: source[key]\n });\n }\n });\n }\n return output;\n}\nclass TranslateParser {}\nclass TranslateDefaultParser extends TranslateParser {\n templateMatcher = /{{\\s?([^{}\\s]*)\\s?}}/g;\n interpolate(expr, params) {\n let result;\n if (typeof expr === 'string') {\n result = this.interpolateString(expr, params);\n } else if (typeof expr === 'function') {\n result = this.interpolateFunction(expr, params);\n } else {\n // this should not happen, but an unrelated TranslateService test depends on it\n result = expr;\n }\n return result;\n }\n getValue(target, key) {\n let keys = typeof key === 'string' ? key.split('.') : [key];\n key = '';\n do {\n key += keys.shift();\n if (isDefined(target) && isDefined(target[key]) && (typeof target[key] === 'object' || !keys.length)) {\n target = target[key];\n key = '';\n } else if (!keys.length) {\n target = undefined;\n } else {\n key += '.';\n }\n } while (keys.length);\n return target;\n }\n interpolateFunction(fn, params) {\n return fn(params);\n }\n interpolateString(expr, params) {\n if (!params) {\n return expr;\n }\n return expr.replace(this.templateMatcher, (substring, b) => {\n let r = this.getValue(params, b);\n return isDefined(r) ? r : substring;\n });\n }\n static ɵfac = /* @__PURE__ */(() => {\n let ɵTranslateDefaultParser_BaseFactory;\n return function TranslateDefaultParser_Factory(t) {\n return (ɵTranslateDefaultParser_BaseFactory || (ɵTranslateDefaultParser_BaseFactory = i0.ɵɵgetInheritedFactory(TranslateDefaultParser)))(t || TranslateDefaultParser);\n };\n })();\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: TranslateDefaultParser,\n factory: TranslateDefaultParser.ɵfac\n });\n}\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(TranslateDefaultParser, [{\n type: Injectable\n }], null, null);\n})();\nclass TranslateCompiler {}\n/**\n * This compiler is just a placeholder that does nothing, in case you don't need a compiler at all\n */\nclass TranslateFakeCompiler extends TranslateCompiler {\n compile(value, lang) {\n return value;\n }\n compileTranslations(translations, lang) {\n return translations;\n }\n static ɵfac = /* @__PURE__ */(() => {\n let ɵTranslateFakeCompiler_BaseFactory;\n return function TranslateFakeCompiler_Factory(t) {\n return (ɵTranslateFakeCompiler_BaseFactory || (ɵTranslateFakeCompiler_BaseFactory = i0.ɵɵgetInheritedFactory(TranslateFakeCompiler)))(t || TranslateFakeCompiler);\n };\n })();\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: TranslateFakeCompiler,\n factory: TranslateFakeCompiler.ɵfac\n });\n}\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(TranslateFakeCompiler, [{\n type: Injectable\n }], null, null);\n})();\nclass TranslateStore {\n /**\n * The default lang to fallback when translations are missing on the current lang\n */\n defaultLang;\n /**\n * The lang currently used\n */\n currentLang = this.defaultLang;\n /**\n * a list of translations per lang\n */\n translations = {};\n /**\n * an array of langs\n */\n langs = [];\n /**\n * An EventEmitter to listen to translation change events\n * onTranslationChange.subscribe((params: TranslationChangeEvent) => {\n * // do something\n * });\n */\n onTranslationChange = new EventEmitter();\n /**\n * An EventEmitter to listen to lang change events\n * onLangChange.subscribe((params: LangChangeEvent) => {\n * // do something\n * });\n */\n onLangChange = new EventEmitter();\n /**\n * An EventEmitter to listen to default lang change events\n * onDefaultLangChange.subscribe((params: DefaultLangChangeEvent) => {\n * // do something\n * });\n */\n onDefaultLangChange = new EventEmitter();\n}\nconst USE_STORE = new InjectionToken('USE_STORE');\nconst USE_DEFAULT_LANG = new InjectionToken('USE_DEFAULT_LANG');\nconst DEFAULT_LANGUAGE = new InjectionToken('DEFAULT_LANGUAGE');\nconst USE_EXTEND = new InjectionToken('USE_EXTEND');\nclass TranslateService {\n store;\n currentLoader;\n compiler;\n parser;\n missingTranslationHandler;\n useDefaultLang;\n isolate;\n extend;\n loadingTranslations;\n pending = false;\n _onTranslationChange = new EventEmitter();\n _onLangChange = new EventEmitter();\n _onDefaultLangChange = new EventEmitter();\n _defaultLang;\n _currentLang;\n _langs = [];\n _translations = {};\n _translationRequests = {};\n /**\n * An EventEmitter to listen to translation change events\n * onTranslationChange.subscribe((params: TranslationChangeEvent) => {\n * // do something\n * });\n */\n get onTranslationChange() {\n return this.isolate ? this._onTranslationChange : this.store.onTranslationChange;\n }\n /**\n * An EventEmitter to listen to lang change events\n * onLangChange.subscribe((params: LangChangeEvent) => {\n * // do something\n * });\n */\n get onLangChange() {\n return this.isolate ? this._onLangChange : this.store.onLangChange;\n }\n /**\n * An EventEmitter to listen to default lang change events\n * onDefaultLangChange.subscribe((params: DefaultLangChangeEvent) => {\n * // do something\n * });\n */\n get onDefaultLangChange() {\n return this.isolate ? this._onDefaultLangChange : this.store.onDefaultLangChange;\n }\n /**\n * The default lang to fallback when translations are missing on the current lang\n */\n get defaultLang() {\n return this.isolate ? this._defaultLang : this.store.defaultLang;\n }\n set defaultLang(defaultLang) {\n if (this.isolate) {\n this._defaultLang = defaultLang;\n } else {\n this.store.defaultLang = defaultLang;\n }\n }\n /**\n * The lang currently used\n */\n get currentLang() {\n return this.isolate ? this._currentLang : this.store.currentLang;\n }\n set currentLang(currentLang) {\n if (this.isolate) {\n this._currentLang = currentLang;\n } else {\n this.store.currentLang = currentLang;\n }\n }\n /**\n * an array of langs\n */\n get langs() {\n return this.isolate ? this._langs : this.store.langs;\n }\n set langs(langs) {\n if (this.isolate) {\n this._langs = langs;\n } else {\n this.store.langs = langs;\n }\n }\n /**\n * a list of translations per lang\n */\n get translations() {\n return this.isolate ? this._translations : this.store.translations;\n }\n set translations(translations) {\n if (this.isolate) {\n this._translations = translations;\n } else {\n this.store.translations = translations;\n }\n }\n /**\n *\n * @param store an instance of the store (that is supposed to be unique)\n * @param currentLoader An instance of the loader currently used\n * @param compiler An instance of the compiler currently used\n * @param parser An instance of the parser currently used\n * @param missingTranslationHandler A handler for missing translations.\n * @param useDefaultLang whether we should use default language translation when current language translation is missing.\n * @param isolate whether this service should use the store or not\n * @param extend To make a child module extend (and use) translations from parent modules.\n * @param defaultLanguage Set the default language using configuration\n */\n constructor(store, currentLoader, compiler, parser, missingTranslationHandler, useDefaultLang = true, isolate = false, extend = false, defaultLanguage) {\n this.store = store;\n this.currentLoader = currentLoader;\n this.compiler = compiler;\n this.parser = parser;\n this.missingTranslationHandler = missingTranslationHandler;\n this.useDefaultLang = useDefaultLang;\n this.isolate = isolate;\n this.extend = extend;\n /** set the default language from configuration */\n if (defaultLanguage) {\n this.setDefaultLang(defaultLanguage);\n }\n }\n /**\n * Sets the default language to use as a fallback\n */\n setDefaultLang(lang) {\n if (lang === this.defaultLang) {\n return;\n }\n let pending = this.retrieveTranslations(lang);\n if (typeof pending !== \"undefined\") {\n // on init set the defaultLang immediately\n if (this.defaultLang == null) {\n this.defaultLang = lang;\n }\n pending.pipe(take(1)).subscribe(res => {\n this.changeDefaultLang(lang);\n });\n } else {\n // we already have this language\n this.changeDefaultLang(lang);\n }\n }\n /**\n * Gets the default language used\n */\n getDefaultLang() {\n return this.defaultLang;\n }\n /**\n * Changes the lang currently used\n */\n use(lang) {\n // don't change the language if the language given is already selected\n if (lang === this.currentLang) {\n return of(this.translations[lang]);\n }\n let pending = this.retrieveTranslations(lang);\n if (typeof pending !== \"undefined\") {\n // on init set the currentLang immediately\n if (!this.currentLang) {\n this.currentLang = lang;\n }\n pending.pipe(take(1)).subscribe(res => {\n this.changeLang(lang);\n });\n return pending;\n } else {\n // we have this language, return an Observable\n this.changeLang(lang);\n return of(this.translations[lang]);\n }\n }\n /**\n * Retrieves the given translations\n */\n retrieveTranslations(lang) {\n let pending;\n // if this language is unavailable or extend is true, ask for it\n if (typeof this.translations[lang] === \"undefined\" || this.extend) {\n this._translationRequests[lang] = this._translationRequests[lang] || this.getTranslation(lang);\n pending = this._translationRequests[lang];\n }\n return pending;\n }\n /**\n * Gets an object of translations for a given language with the current loader\n * and passes it through the compiler\n */\n getTranslation(lang) {\n this.pending = true;\n const loadingTranslations = this.currentLoader.getTranslation(lang).pipe(shareReplay(1), take(1));\n this.loadingTranslations = loadingTranslations.pipe(map(res => this.compiler.compileTranslations(res, lang)), shareReplay(1), take(1));\n this.loadingTranslations.subscribe({\n next: res => {\n this.translations[lang] = this.extend && this.translations[lang] ? {\n ...res,\n ...this.translations[lang]\n } : res;\n this.updateLangs();\n this.pending = false;\n },\n error: err => {\n this.pending = false;\n }\n });\n return loadingTranslations;\n }\n /**\n * Manually sets an object of translations for a given language\n * after passing it through the compiler\n */\n setTranslation(lang, translations, shouldMerge = false) {\n translations = this.compiler.compileTranslations(translations, lang);\n if ((shouldMerge || this.extend) && this.translations[lang]) {\n this.translations[lang] = mergeDeep(this.translations[lang], translations);\n } else {\n this.translations[lang] = translations;\n }\n this.updateLangs();\n this.onTranslationChange.emit({\n lang: lang,\n translations: this.translations[lang]\n });\n }\n /**\n * Returns an array of currently available langs\n */\n getLangs() {\n return this.langs;\n }\n /**\n * Add available langs\n */\n addLangs(langs) {\n langs.forEach(lang => {\n if (this.langs.indexOf(lang) === -1) {\n this.langs.push(lang);\n }\n });\n }\n /**\n * Update the list of available langs\n */\n updateLangs() {\n this.addLangs(Object.keys(this.translations));\n }\n /**\n * Returns the parsed result of the translations\n */\n getParsedResult(translations, key, interpolateParams) {\n let res;\n if (key instanceof Array) {\n let result = {},\n observables = false;\n for (let k of key) {\n result[k] = this.getParsedResult(translations, k, interpolateParams);\n if (isObservable(result[k])) {\n observables = true;\n }\n }\n if (observables) {\n const sources = key.map(k => isObservable(result[k]) ? result[k] : of(result[k]));\n return forkJoin(sources).pipe(map(arr => {\n let obj = {};\n arr.forEach((value, index) => {\n obj[key[index]] = value;\n });\n return obj;\n }));\n }\n return result;\n }\n if (translations) {\n res = this.parser.interpolate(this.parser.getValue(translations, key), interpolateParams);\n }\n if (typeof res === \"undefined\" && this.defaultLang != null && this.defaultLang !== this.currentLang && this.useDefaultLang) {\n res = this.parser.interpolate(this.parser.getValue(this.translations[this.defaultLang], key), interpolateParams);\n }\n if (typeof res === \"undefined\") {\n let params = {\n key,\n translateService: this\n };\n if (typeof interpolateParams !== 'undefined') {\n params.interpolateParams = interpolateParams;\n }\n res = this.missingTranslationHandler.handle(params);\n }\n return typeof res !== \"undefined\" ? res : key;\n }\n /**\n * Gets the translated value of a key (or an array of keys)\n * @returns the translated key, or an object of translated keys\n */\n get(key, interpolateParams) {\n if (!isDefined(key) || !key.length) {\n throw new Error(`Parameter \"key\" required`);\n }\n // check if we are loading a new translation to use\n if (this.pending) {\n return this.loadingTranslations.pipe(concatMap(res => {\n res = this.getParsedResult(res, key, interpolateParams);\n return isObservable(res) ? res : of(res);\n }));\n } else {\n let res = this.getParsedResult(this.translations[this.currentLang], key, interpolateParams);\n return isObservable(res) ? res : of(res);\n }\n }\n /**\n * Returns a stream of translated values of a key (or an array of keys) which updates\n * whenever the translation changes.\n * @returns A stream of the translated key, or an object of translated keys\n */\n getStreamOnTranslationChange(key, interpolateParams) {\n if (!isDefined(key) || !key.length) {\n throw new Error(`Parameter \"key\" required`);\n }\n return concat(defer(() => this.get(key, interpolateParams)), this.onTranslationChange.pipe(switchMap(event => {\n const res = this.getParsedResult(event.translations, key, interpolateParams);\n if (typeof res.subscribe === 'function') {\n return res;\n } else {\n return of(res);\n }\n })));\n }\n /**\n * Returns a stream of translated values of a key (or an array of keys) which updates\n * whenever the language changes.\n * @returns A stream of the translated key, or an object of translated keys\n */\n stream(key, interpolateParams) {\n if (!isDefined(key) || !key.length) {\n throw new Error(`Parameter \"key\" required`);\n }\n return concat(defer(() => this.get(key, interpolateParams)), this.onLangChange.pipe(switchMap(event => {\n const res = this.getParsedResult(event.translations, key, interpolateParams);\n return isObservable(res) ? res : of(res);\n })));\n }\n /**\n * Returns a translation instantly from the internal state of loaded translation.\n * All rules regarding the current language, the preferred language of even fallback languages will be used except any promise handling.\n */\n instant(key, interpolateParams) {\n if (!isDefined(key) || !key.length) {\n throw new Error(`Parameter \"key\" required`);\n }\n let res = this.getParsedResult(this.translations[this.currentLang], key, interpolateParams);\n if (isObservable(res)) {\n if (key instanceof Array) {\n let obj = {};\n key.forEach((value, index) => {\n obj[key[index]] = key[index];\n });\n return obj;\n }\n return key;\n } else {\n return res;\n }\n }\n /**\n * Sets the translated value of a key, after compiling it\n */\n set(key, value, lang = this.currentLang) {\n this.translations[lang][key] = this.compiler.compile(value, lang);\n this.updateLangs();\n this.onTranslationChange.emit({\n lang: lang,\n translations: this.translations[lang]\n });\n }\n /**\n * Changes the current lang\n */\n changeLang(lang) {\n this.currentLang = lang;\n this.onLangChange.emit({\n lang: lang,\n translations: this.translations[lang]\n });\n // if there is no default lang, use the one that we just set\n if (this.defaultLang == null) {\n this.changeDefaultLang(lang);\n }\n }\n /**\n * Changes the default lang\n */\n changeDefaultLang(lang) {\n this.defaultLang = lang;\n this.onDefaultLangChange.emit({\n lang: lang,\n translations: this.translations[lang]\n });\n }\n /**\n * Allows to reload the lang file from the file\n */\n reloadLang(lang) {\n this.resetLang(lang);\n return this.getTranslation(lang);\n }\n /**\n * Deletes inner translation\n */\n resetLang(lang) {\n this._translationRequests[lang] = undefined;\n this.translations[lang] = undefined;\n }\n /**\n * Returns the language code name from the browser, e.g. \"de\"\n */\n getBrowserLang() {\n if (typeof window === 'undefined' || typeof window.navigator === 'undefined') {\n return undefined;\n }\n let browserLang = window.navigator.languages ? window.navigator.languages[0] : null;\n browserLang = browserLang || window.navigator.language || window.navigator.browserLanguage || window.navigator.userLanguage;\n if (typeof browserLang === 'undefined') {\n return undefined;\n }\n if (browserLang.indexOf('-') !== -1) {\n browserLang = browserLang.split('-')[0];\n }\n if (browserLang.indexOf('_') !== -1) {\n browserLang = browserLang.split('_')[0];\n }\n return browserLang;\n }\n /**\n * Returns the culture language code name from the browser, e.g. \"de-DE\"\n */\n getBrowserCultureLang() {\n if (typeof window === 'undefined' || typeof window.navigator === 'undefined') {\n return undefined;\n }\n let browserCultureLang = window.navigator.languages ? window.navigator.languages[0] : null;\n browserCultureLang = browserCultureLang || window.navigator.language || window.navigator.browserLanguage || window.navigator.userLanguage;\n return browserCultureLang;\n }\n static ɵfac = function TranslateService_Factory(t) {\n return new (t || TranslateService)(i0.ɵɵinject(TranslateStore), i0.ɵɵinject(TranslateLoader), i0.ɵɵinject(TranslateCompiler), i0.ɵɵinject(TranslateParser), i0.ɵɵinject(MissingTranslationHandler), i0.ɵɵinject(USE_DEFAULT_LANG), i0.ɵɵinject(USE_STORE), i0.ɵɵinject(USE_EXTEND), i0.ɵɵinject(DEFAULT_LANGUAGE));\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: TranslateService,\n factory: TranslateService.ɵfac\n });\n}\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(TranslateService, [{\n type: Injectable\n }], function () {\n return [{\n type: TranslateStore\n }, {\n type: TranslateLoader\n }, {\n type: TranslateCompiler\n }, {\n type: TranslateParser\n }, {\n type: MissingTranslationHandler\n }, {\n type: undefined,\n decorators: [{\n type: Inject,\n args: [USE_DEFAULT_LANG]\n }]\n }, {\n type: undefined,\n decorators: [{\n type: Inject,\n args: [USE_STORE]\n }]\n }, {\n type: undefined,\n decorators: [{\n type: Inject,\n args: [USE_EXTEND]\n }]\n }, {\n type: undefined,\n decorators: [{\n type: Inject,\n args: [DEFAULT_LANGUAGE]\n }]\n }];\n }, null);\n})();\nclass TranslateDirective {\n translateService;\n element;\n _ref;\n key;\n lastParams;\n currentParams;\n onLangChangeSub;\n onDefaultLangChangeSub;\n onTranslationChangeSub;\n set translate(key) {\n if (key) {\n this.key = key;\n this.checkNodes();\n }\n }\n set translateParams(params) {\n if (!equals(this.currentParams, params)) {\n this.currentParams = params;\n this.checkNodes(true);\n }\n }\n constructor(translateService, element, _ref) {\n this.translateService = translateService;\n this.element = element;\n this._ref = _ref;\n // subscribe to onTranslationChange event, in case the translations of the current lang change\n if (!this.onTranslationChangeSub) {\n this.onTranslationChangeSub = this.translateService.onTranslationChange.subscribe(event => {\n if (event.lang === this.translateService.currentLang) {\n this.checkNodes(true, event.translations);\n }\n });\n }\n // subscribe to onLangChange event, in case the language changes\n if (!this.onLangChangeSub) {\n this.onLangChangeSub = this.translateService.onLangChange.subscribe(event => {\n this.checkNodes(true, event.translations);\n });\n }\n // subscribe to onDefaultLangChange event, in case the default language changes\n if (!this.onDefaultLangChangeSub) {\n this.onDefaultLangChangeSub = this.translateService.onDefaultLangChange.subscribe(event => {\n this.checkNodes(true);\n });\n }\n }\n ngAfterViewChecked() {\n this.checkNodes();\n }\n checkNodes(forceUpdate = false, translations) {\n let nodes = this.element.nativeElement.childNodes;\n // if the element is empty\n if (!nodes.length) {\n // we add the key as content\n this.setContent(this.element.nativeElement, this.key);\n nodes = this.element.nativeElement.childNodes;\n }\n for (let i = 0; i < nodes.length; ++i) {\n let node = nodes[i];\n if (node.nodeType === 3) {\n // node type 3 is a text node\n let key;\n if (forceUpdate) {\n node.lastKey = null;\n }\n if (isDefined(node.lookupKey)) {\n key = node.lookupKey;\n } else if (this.key) {\n key = this.key;\n } else {\n let content = this.getContent(node);\n let trimmedContent = content.trim();\n if (trimmedContent.length) {\n node.lookupKey = trimmedContent;\n // we want to use the content as a key, not the translation value\n if (content !== node.currentValue) {\n key = trimmedContent;\n // the content was changed from the user, we'll use it as a reference if needed\n node.originalContent = content || node.originalContent;\n } else if (node.originalContent) {\n // the content seems ok, but the lang has changed\n // the current content is the translation, not the key, use the last real content as key\n key = node.originalContent.trim();\n } else if (content !== node.currentValue) {\n // we want to use the content as a key, not the translation value\n key = trimmedContent;\n // the content was changed from the user, we'll use it as a reference if needed\n node.originalContent = content || node.originalContent;\n }\n }\n }\n this.updateValue(key, node, translations);\n }\n }\n }\n updateValue(key, node, translations) {\n if (key) {\n if (node.lastKey === key && this.lastParams === this.currentParams) {\n return;\n }\n this.lastParams = this.currentParams;\n let onTranslation = res => {\n if (res !== key) {\n node.lastKey = key;\n }\n if (!node.originalContent) {\n node.originalContent = this.getContent(node);\n }\n node.currentValue = isDefined(res) ? res : node.originalContent || key;\n // we replace in the original content to preserve spaces that we might have trimmed\n this.setContent(node, this.key ? node.currentValue : node.originalContent.replace(key, node.currentValue));\n this._ref.markForCheck();\n };\n if (isDefined(translations)) {\n let res = this.translateService.getParsedResult(translations, key, this.currentParams);\n if (isObservable(res)) {\n res.subscribe({\n next: onTranslation\n });\n } else {\n onTranslation(res);\n }\n } else {\n this.translateService.get(key, this.currentParams).subscribe(onTranslation);\n }\n }\n }\n getContent(node) {\n return isDefined(node.textContent) ? node.textContent : node.data;\n }\n setContent(node, content) {\n if (isDefined(node.textContent)) {\n node.textContent = content;\n } else {\n node.data = content;\n }\n }\n ngOnDestroy() {\n if (this.onLangChangeSub) {\n this.onLangChangeSub.unsubscribe();\n }\n if (this.onDefaultLangChangeSub) {\n this.onDefaultLangChangeSub.unsubscribe();\n }\n if (this.onTranslationChangeSub) {\n this.onTranslationChangeSub.unsubscribe();\n }\n }\n static ɵfac = function TranslateDirective_Factory(t) {\n return new (t || TranslateDirective)(i0.ɵɵdirectiveInject(TranslateService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef));\n };\n static ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: TranslateDirective,\n selectors: [[\"\", \"translate\", \"\"], [\"\", \"ngx-translate\", \"\"]],\n inputs: {\n translate: \"translate\",\n translateParams: \"translateParams\"\n }\n });\n}\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(TranslateDirective, [{\n type: Directive,\n args: [{\n selector: '[translate],[ngx-translate]'\n }]\n }], function () {\n return [{\n type: TranslateService\n }, {\n type: i0.ElementRef\n }, {\n type: i0.ChangeDetectorRef\n }];\n }, {\n translate: [{\n type: Input\n }],\n translateParams: [{\n type: Input\n }]\n });\n})();\nclass TranslatePipe {\n translate;\n _ref;\n value = '';\n lastKey = null;\n lastParams = [];\n onTranslationChange;\n onLangChange;\n onDefaultLangChange;\n constructor(translate, _ref) {\n this.translate = translate;\n this._ref = _ref;\n }\n updateValue(key, interpolateParams, translations) {\n let onTranslation = res => {\n this.value = res !== undefined ? res : key;\n this.lastKey = key;\n this._ref.markForCheck();\n };\n if (translations) {\n let res = this.translate.getParsedResult(translations, key, interpolateParams);\n if (isObservable(res.subscribe)) {\n res.subscribe(onTranslation);\n } else {\n onTranslation(res);\n }\n }\n this.translate.get(key, interpolateParams).subscribe(onTranslation);\n }\n transform(query, ...args) {\n if (!query || !query.length) {\n return query;\n }\n // if we ask another time for the same key, return the last value\n if (equals(query, this.lastKey) && equals(args, this.lastParams)) {\n return this.value;\n }\n let interpolateParams = undefined;\n if (isDefined(args[0]) && args.length) {\n if (typeof args[0] === 'string' && args[0].length) {\n // we accept objects written in the template such as {n:1}, {'n':1}, {n:'v'}\n // which is why we might need to change it to real JSON objects such as {\"n\":1} or {\"n\":\"v\"}\n let validArgs = args[0].replace(/(\\')?([a-zA-Z0-9_]+)(\\')?(\\s)?:/g, '\"$2\":').replace(/:(\\s)?(\\')(.*?)(\\')/g, ':\"$3\"');\n try {\n interpolateParams = JSON.parse(validArgs);\n } catch (e) {\n throw new SyntaxError(`Wrong parameter in TranslatePipe. Expected a valid Object, received: ${args[0]}`);\n }\n } else if (typeof args[0] === 'object' && !Array.isArray(args[0])) {\n interpolateParams = args[0];\n }\n }\n // store the query, in case it changes\n this.lastKey = query;\n // store the params, in case they change\n this.lastParams = args;\n // set the value\n this.updateValue(query, interpolateParams);\n // if there is a subscription to onLangChange, clean it\n this._dispose();\n // subscribe to onTranslationChange event, in case the translations change\n if (!this.onTranslationChange) {\n this.onTranslationChange = this.translate.onTranslationChange.subscribe(event => {\n if (this.lastKey && event.lang === this.translate.currentLang) {\n this.lastKey = null;\n this.updateValue(query, interpolateParams, event.translations);\n }\n });\n }\n // subscribe to onLangChange event, in case the language changes\n if (!this.onLangChange) {\n this.onLangChange = this.translate.onLangChange.subscribe(event => {\n if (this.lastKey) {\n this.lastKey = null; // we want to make sure it doesn't return the same value until it's been updated\n this.updateValue(query, interpolateParams, event.translations);\n }\n });\n }\n // subscribe to onDefaultLangChange event, in case the default language changes\n if (!this.onDefaultLangChange) {\n this.onDefaultLangChange = this.translate.onDefaultLangChange.subscribe(() => {\n if (this.lastKey) {\n this.lastKey = null; // we want to make sure it doesn't return the same value until it's been updated\n this.updateValue(query, interpolateParams);\n }\n });\n }\n return this.value;\n }\n /**\n * Clean any existing subscription to change events\n */\n _dispose() {\n if (typeof this.onTranslationChange !== 'undefined') {\n this.onTranslationChange.unsubscribe();\n this.onTranslationChange = undefined;\n }\n if (typeof this.onLangChange !== 'undefined') {\n this.onLangChange.unsubscribe();\n this.onLangChange = undefined;\n }\n if (typeof this.onDefaultLangChange !== 'undefined') {\n this.onDefaultLangChange.unsubscribe();\n this.onDefaultLangChange = undefined;\n }\n }\n ngOnDestroy() {\n this._dispose();\n }\n static ɵfac = function TranslatePipe_Factory(t) {\n return new (t || TranslatePipe)(i0.ɵɵdirectiveInject(TranslateService, 16), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef, 16));\n };\n static ɵpipe = /* @__PURE__ */i0.ɵɵdefinePipe({\n name: \"translate\",\n type: TranslatePipe,\n pure: false\n });\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: TranslatePipe,\n factory: TranslatePipe.ɵfac\n });\n}\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(TranslatePipe, [{\n type: Injectable\n }, {\n type: Pipe,\n args: [{\n name: 'translate',\n pure: false // required to update the value when the promise is resolved\n }]\n }], function () {\n return [{\n type: TranslateService\n }, {\n type: i0.ChangeDetectorRef\n }];\n }, null);\n})();\nclass TranslateModule {\n /**\n * Use this method in your root module to provide the TranslateService\n */\n static forRoot(config = {}) {\n return {\n ngModule: TranslateModule,\n providers: [config.loader || {\n provide: TranslateLoader,\n useClass: TranslateFakeLoader\n }, config.compiler || {\n provide: TranslateCompiler,\n useClass: TranslateFakeCompiler\n }, config.parser || {\n provide: TranslateParser,\n useClass: TranslateDefaultParser\n }, config.missingTranslationHandler || {\n provide: MissingTranslationHandler,\n useClass: FakeMissingTranslationHandler\n }, TranslateStore, {\n provide: USE_STORE,\n useValue: config.isolate\n }, {\n provide: USE_DEFAULT_LANG,\n useValue: config.useDefaultLang\n }, {\n provide: USE_EXTEND,\n useValue: config.extend\n }, {\n provide: DEFAULT_LANGUAGE,\n useValue: config.defaultLanguage\n }, TranslateService]\n };\n }\n /**\n * Use this method in your other (non root) modules to import the directive/pipe\n */\n static forChild(config = {}) {\n return {\n ngModule: TranslateModule,\n providers: [config.loader || {\n provide: TranslateLoader,\n useClass: TranslateFakeLoader\n }, config.compiler || {\n provide: TranslateCompiler,\n useClass: TranslateFakeCompiler\n }, config.parser || {\n provide: TranslateParser,\n useClass: TranslateDefaultParser\n }, config.missingTranslationHandler || {\n provide: MissingTranslationHandler,\n useClass: FakeMissingTranslationHandler\n }, {\n provide: USE_STORE,\n useValue: config.isolate\n }, {\n provide: USE_DEFAULT_LANG,\n useValue: config.useDefaultLang\n }, {\n provide: USE_EXTEND,\n useValue: config.extend\n }, {\n provide: DEFAULT_LANGUAGE,\n useValue: config.defaultLanguage\n }, TranslateService]\n };\n }\n static ɵfac = function TranslateModule_Factory(t) {\n return new (t || TranslateModule)();\n };\n static ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: TranslateModule\n });\n static ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({});\n}\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(TranslateModule, [{\n type: NgModule,\n args: [{\n declarations: [TranslatePipe, TranslateDirective],\n exports: [TranslatePipe, TranslateDirective]\n }]\n }], null, null);\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { DEFAULT_LANGUAGE, FakeMissingTranslationHandler, MissingTranslationHandler, TranslateCompiler, TranslateDefaultParser, TranslateDirective, TranslateFakeCompiler, TranslateFakeLoader, TranslateLoader, TranslateModule, TranslateParser, TranslatePipe, TranslateService, TranslateStore, USE_DEFAULT_LANG, USE_EXTEND, USE_STORE };\n","/**\n * @license Angular v17.2.3\n * (c) 2010-2022 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport * as i0 from '@angular/core';\nimport { Directive, InjectionToken, forwardRef, Optional, Inject, ɵisPromise, ɵisSubscribable, ɵRuntimeError, Self, EventEmitter, Input, Host, SkipSelf, booleanAttribute, ChangeDetectorRef, Output, Injectable, inject, NgModule, Version } from '@angular/core';\nimport { ɵgetDOM } from '@angular/common';\nimport { from, forkJoin } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\n/**\n * Base class for all ControlValueAccessor classes defined in Forms package.\n * Contains common logic and utility functions.\n *\n * Note: this is an *internal-only* class and should not be extended or used directly in\n * applications code.\n */\nclass BaseControlValueAccessor {\n constructor(_renderer, _elementRef) {\n this._renderer = _renderer;\n this._elementRef = _elementRef;\n /**\n * The registered callback function called when a change or input event occurs on the input\n * element.\n * @nodoc\n */\n this.onChange = _ => {};\n /**\n * The registered callback function called when a blur event occurs on the input element.\n * @nodoc\n */\n this.onTouched = () => {};\n }\n /**\n * Helper method that sets a property on a target element using the current Renderer\n * implementation.\n * @nodoc\n */\n setProperty(key, value) {\n this._renderer.setProperty(this._elementRef.nativeElement, key, value);\n }\n /**\n * Registers a function called when the control is touched.\n * @nodoc\n */\n registerOnTouched(fn) {\n this.onTouched = fn;\n }\n /**\n * Registers a function called when the control value changes.\n * @nodoc\n */\n registerOnChange(fn) {\n this.onChange = fn;\n }\n /**\n * Sets the \"disabled\" property on the range input element.\n * @nodoc\n */\n setDisabledState(isDisabled) {\n this.setProperty('disabled', isDisabled);\n }\n static {\n this.ɵfac = function BaseControlValueAccessor_Factory(t) {\n return new (t || BaseControlValueAccessor)(i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ElementRef));\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: BaseControlValueAccessor\n });\n }\n}\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(BaseControlValueAccessor, [{\n type: Directive\n }], () => [{\n type: i0.Renderer2\n }, {\n type: i0.ElementRef\n }], null);\n})();\n/**\n * Base class for all built-in ControlValueAccessor classes (except DefaultValueAccessor, which is\n * used in case no other CVAs can be found). We use this class to distinguish between default CVA,\n * built-in CVAs and custom CVAs, so that Forms logic can recognize built-in CVAs and treat custom\n * ones with higher priority (when both built-in and custom CVAs are present).\n *\n * Note: this is an *internal-only* class and should not be extended or used directly in\n * applications code.\n */\nclass BuiltInControlValueAccessor extends BaseControlValueAccessor {\n static {\n this.ɵfac = /* @__PURE__ */(() => {\n let ɵBuiltInControlValueAccessor_BaseFactory;\n return function BuiltInControlValueAccessor_Factory(t) {\n return (ɵBuiltInControlValueAccessor_BaseFactory || (ɵBuiltInControlValueAccessor_BaseFactory = i0.ɵɵgetInheritedFactory(BuiltInControlValueAccessor)))(t || BuiltInControlValueAccessor);\n };\n })();\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: BuiltInControlValueAccessor,\n features: [i0.ɵɵInheritDefinitionFeature]\n });\n }\n}\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(BuiltInControlValueAccessor, [{\n type: Directive\n }], null, null);\n})();\n/**\n * Used to provide a `ControlValueAccessor` for form controls.\n *\n * See `DefaultValueAccessor` for how to implement one.\n *\n * @publicApi\n */\nconst NG_VALUE_ACCESSOR = new InjectionToken(ngDevMode ? 'NgValueAccessor' : '');\nconst CHECKBOX_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => CheckboxControlValueAccessor),\n multi: true\n};\n/**\n * @description\n * A `ControlValueAccessor` for writing a value and listening to changes on a checkbox input\n * element.\n *\n * @usageNotes\n *\n * ### Using a checkbox with a reactive form.\n *\n * The following example shows how to use a checkbox with a reactive form.\n *\n * ```ts\n * const rememberLoginControl = new FormControl();\n * ```\n *\n * ```\n * \n * ```\n *\n * @ngModule ReactiveFormsModule\n * @ngModule FormsModule\n * @publicApi\n */\nclass CheckboxControlValueAccessor extends BuiltInControlValueAccessor {\n /**\n * Sets the \"checked\" property on the input element.\n * @nodoc\n */\n writeValue(value) {\n this.setProperty('checked', value);\n }\n static {\n this.ɵfac = /* @__PURE__ */(() => {\n let ɵCheckboxControlValueAccessor_BaseFactory;\n return function CheckboxControlValueAccessor_Factory(t) {\n return (ɵCheckboxControlValueAccessor_BaseFactory || (ɵCheckboxControlValueAccessor_BaseFactory = i0.ɵɵgetInheritedFactory(CheckboxControlValueAccessor)))(t || CheckboxControlValueAccessor);\n };\n })();\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: CheckboxControlValueAccessor,\n selectors: [[\"input\", \"type\", \"checkbox\", \"formControlName\", \"\"], [\"input\", \"type\", \"checkbox\", \"formControl\", \"\"], [\"input\", \"type\", \"checkbox\", \"ngModel\", \"\"]],\n hostBindings: function CheckboxControlValueAccessor_HostBindings(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵlistener(\"change\", function CheckboxControlValueAccessor_change_HostBindingHandler($event) {\n return ctx.onChange($event.target.checked);\n })(\"blur\", function CheckboxControlValueAccessor_blur_HostBindingHandler() {\n return ctx.onTouched();\n });\n }\n },\n features: [i0.ɵɵProvidersFeature([CHECKBOX_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature]\n });\n }\n}\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(CheckboxControlValueAccessor, [{\n type: Directive,\n args: [{\n selector: 'input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]',\n host: {\n '(change)': 'onChange($event.target.checked)',\n '(blur)': 'onTouched()'\n },\n providers: [CHECKBOX_VALUE_ACCESSOR]\n }]\n }], null, null);\n})();\nconst DEFAULT_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => DefaultValueAccessor),\n multi: true\n};\n/**\n * We must check whether the agent is Android because composition events\n * behave differently between iOS and Android.\n */\nfunction _isAndroid() {\n const userAgent = ɵgetDOM() ? ɵgetDOM().getUserAgent() : '';\n return /android (\\d+)/.test(userAgent.toLowerCase());\n}\n/**\n * @description\n * Provide this token to control if form directives buffer IME input until\n * the \"compositionend\" event occurs.\n * @publicApi\n */\nconst COMPOSITION_BUFFER_MODE = new InjectionToken(ngDevMode ? 'CompositionEventMode' : '');\n/**\n * The default `ControlValueAccessor` for writing a value and listening to changes on input\n * elements. The accessor is used by the `FormControlDirective`, `FormControlName`, and\n * `NgModel` directives.\n *\n * {@searchKeywords ngDefaultControl}\n *\n * @usageNotes\n *\n * ### Using the default value accessor\n *\n * The following example shows how to use an input element that activates the default value accessor\n * (in this case, a text field).\n *\n * ```ts\n * const firstNameControl = new FormControl();\n * ```\n *\n * ```\n * \n * ```\n *\n * This value accessor is used by default for `` and `