@tolgee/web
Advanced tools
Comparing version 5.28.1 to 5.28.2-prerelease.2842344b.0
@@ -1,2 +0,2 @@ | ||
var e;function t(e,t){for(var n=0;n<t.length;n++){const a=t[n];if("string"!=typeof a&&!Array.isArray(a))for(const t in a)if("default"!==t&&!(t in e)){const n=Object.getOwnPropertyDescriptor(a,t);n&&Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>a[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function n(e){return Boolean(e&&"function"==typeof e.then)}function a(e,t){return n(e)?Promise.resolve(e).then(t):t(e)}function o(e,t,a){function o(n){const a=t(n);throw e.emit(a),console.error(a),a}try{const e=a();return n(e)?e.catch(o):e}catch(e){o(e)}}function r(e){const t=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),n=t.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...t.slice(0,-2),n].join(", ")} option`}function i(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function s(e){return i(e)||[]}function l(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?s(t):s(null==t?void 0:t[e]);var n}function c(e){return Array.from(new Set(e))}function u(e){return e?e.replace(/\/+$/,""):e}const g=(e,t)=>fetch(e,t),d=(e=g)=>(t,n)=>e(t,Object.assign(Object.assign({},n),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":"5.28.1"},null==n?void 0:n.headers)}));function f(e){let t=[];return Object.freeze({listen(e){const n=t=>{e(t)};return t.push(n),{unsubscribe(){t=t.filter((e=>n!==e))}}},emit(n){e()&&t.forEach((e=>e({value:n})))}})}function p(e,t,n){const a=new Set,o=new Set;let r=[];function i(){if(0===r.length)return;const e=r;r=[],a.forEach((e=>{e({value:void 0})}));let n=new Set;e.forEach((e=>{void 0===e?n=void 0:void 0!==n&&e.forEach((e=>n.add(e)))}));!function(e){const n=new Set(t());o.forEach((t=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>n.has(e)||t.namespaces.has(e)))))&&t.fn({value:void 0})}))}(n?Array.from(n.keys()):void 0)}return Object.freeze({emit(t,n){e()&&(r.push(t),n?setTimeout(i,0):i())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const t={fn:t=>{e(t)},namespaces:new Set};o.add(t);const a={unsubscribe:()=>{o.delete(t)},subscribeNs:e=>(s(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a}})}class h extends Error{constructor(e,t,n=!1){const{language:a,namespace:o}=e;super(`Tolgee: Failed to fetch record for "${a}"${o&&` and "${o}"`}`),this.cause=t,this.isDev=n,this.name="RecordFetchError",this.language=a,this.namespace=o}}class v extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageDetectorError"}}class m extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageStorageError"}}const y=e=>{const t=new Map;return Object.entries(e).forEach((([e,n])=>{null!=n&&("object"!=typeof n?t.set(e,n):y(n).forEach(((n,a)=>{t.set(e+"."+a,n)})))})),t},b=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},E=({language:e,namespace:t})=>t?`${e}:${t}`:e;function L(e,t,a,o,r,i,l){const u=new Map,g=new Map;let d={},f=0;function p(t,n,a){const o=E(t);g.set(o,{data:y(n),version:a}),e.onCacheChange.emit(t)}async function v(o,r){let i;if(r)try{i=await a(o)}catch(t){const n=new h(o,t,!0);e.onError.emit(n),console.warn(n)}return i||(i=await async function(a){let o;const r=d[E(a)];return"function"==typeof r&&(o=r()),o||(o=t(a)),n(o)?null==o?void 0:o.catch((t=>{const n=new h(a,t);throw e.onError.emit(n),console.error(n),n})):o}(o)),i}const m=Object.freeze({addStaticData(e){e&&(d=Object.assign(Object.assign({},d),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=b(e),a=g.get(e);a&&0!==a.version||p(n,t,0)}})))},invalidate(){u.clear(),f+=1},addRecord(e,t){p(e,t,f)},exists(e,t=!1){const n=g.get(E(e));return n&&t?n.version===f:Boolean(n)},getRecord(e){var t;return null===(t=g.get(E(o(e))))||void 0===t?void 0:t.data},getTranslation(e,t){var n;return null===(n=g.get(E(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=g.get(E({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[o]}return c(e)},getTranslationFallback(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=g.get(E({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation(t,n,a){var o;const r=null===(o=g.get(E(t)))||void 0===o?void 0:o.data;null==r||r.set(n,a),e.onCacheChange.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching(e){if(r())return!0;if(void 0===e)return u.size>0;const t=s(e);return Boolean(Array.from(u.keys()).find((e=>t.includes(b(e).namespace))))},isLoading(e,t){const n=s(t);return Boolean(r()||Array.from(u.keys()).find((t=>{const a=b(t);return(!n.length||n.includes(a.namespace))&&!m.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,t){const n=e.map((e=>{const n=o(e),a=E(n),r=u.get(a);if(r)return{new:!1,promise:r,keyObject:n,cacheKey:a};const i=v(n,t)||Promise.resolve(void 0);return u.set(a,i),{new:!0,promise:i,keyObject:n,cacheKey:a}}));i.notify(),l.notify();const a=await Promise.all(n.map((e=>e.promise)));return n.forEach(((e,t)=>{const n=u.get(e.cacheKey)!==e.promise;if(e.new&&!n){u.delete(e.cacheKey);const n=a[t];n?m.addRecord(e.keyObject,n):m.getRecord(e.keyObject)||m.addRecord(e.keyObject,{})}})),i.notify(),l.notify(),n.map((e=>m.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(g.entries()).map((([e,t])=>Object.assign(Object.assign({},b(e)),{data:t.data})))});return m}function w(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n}const O="invalid",A={defaultNs:"",observerOptions:{tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:["Alt"],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"],fullKeyEncode:!1},observerType:"invisible",onFormatError:O,apiUrl:"https://app.tolgee.io",fetch:d(),onTranslationMissing:({key:e})=>e},k=(...e)=>{let t={};return e.forEach((e=>{t=Object.assign(Object.assign(Object.assign({},t),e),{observerOptions:Object.assign(Object.assign({},t.observerOptions),null==e?void 0:e.observerOptions)})})),t};function N(e,t){const n=k(A,null==t?void 0:t.initialOptions,e);return n.apiUrl=u(n.apiUrl),(null==e?void 0:e.fetch)&&(n.fetch=d(e.fetch)),{initialOptions:n,activeNamespaces:(null==t?void 0:t.activeNamespaces)||new Map,language:null==t?void 0:t.language,pendingLanguage:null==t?void 0:t.language,isInitialLoading:!1,isRunning:!1}}function T(e,t,n,r,i,s,l,c){const u={ui:void 0},g={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},d=async({keysAndDefaults:e,target:t})=>{var n;const a=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,fallbackNamespaces:r(t),namespace:i({key:e,ns:t})[0],translation:s({key:e,ns:t})})));null===(n=g.ui)||void 0===n||n.handleElementClick(a,t)},f=(e,t)=>{var n;return(null===(n=g.observer)||void 0===n?void 0:n.findPositions(e,t))||[]};function p(e){const t=s({key:e.key,ns:e.ns});return R.formatTranslation(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))}function h(){return{fetch:t().fetch}}function y(e){g.observer=null==e?void 0:e()}function b(){return Boolean(g.observer)}function E(e){e&&g.formatters.push(e)}function L(e){g.finalFormatter=e}function A(e){u.ui=e}function k(){return Boolean(u.ui)}function N(e){g.languageStorage=e}function T(e){g.languageDetector=e}function j(e){e&&g.backends.push(e)}function C(e){g.devBackend=e}const R=Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:L,addFormatter:E,setObserver:y,hasObserver:b,setUi:A,hasUi:k,setDevBackend:C,addBackend:j,setLanguageDetector:T,setLanguageStorage:N}))},findPositions:f,run(){var e,n;const{apiKey:a,apiUrl:o,projectId:r,observerOptions:i,tagNewKeys:s}=t();g.ui=null===(e=u.ui)||void 0===e?void 0:e.call(u,{apiKey:a,apiUrl:o,projectId:r,highlight:R.highlight,changeTranslation:l,findPositions:f,onPermanentChange:e=>c.onPermanentChange.emit(e),tagNewKeys:s}),null===(n=g.observer)||void 0===n||n.run({mouseHighlight:!0,options:i,translate:p,onClick:d})},stop(){var e;g.ui=void 0,null===(e=g.observer)||void 0===e||e.stop()},getLanguageStorage:()=>g.languageStorage,getInitialLanguage(){const e=n();return a(o(c.onError,(e=>new m("Tolgee: Failed to load language",e)),(()=>{var e;return null===(e=g.languageStorage)||void 0===e?void 0:e.getLanguage(h())})),(t=>e&&!e.includes(t)||!t?function(){if(!g.languageDetector)return;const e=n();return o(c.onError,(e=>new v("Tolgee: Failed to detect language",e)),(()=>{var t;return null===(t=g.languageDetector)||void 0===t?void 0:t.getLanguage(Object.assign({availableLanguages:e},h()))}))}():t))},setStoredLanguage:e=>o(c.onError,(e=>new m("Tolgee: Failed to store language",e)),(()=>{var t;return null===(t=g.languageStorage)||void 0===t?void 0:t.setLanguage(e,h())})),getDevBackend:()=>g.devBackend,getBackendRecord:async({language:e,namespace:t})=>{for(const n of g.backends){const a=await n.getRecord(Object.assign({language:e,namespace:t},h()));if(void 0!==a)return a}},getBackendDevRecord:async({language:e,namespace:n})=>{var a;const{apiKey:o,apiUrl:r,projectId:i}=t();return null===(a=g.devBackend)||void 0===a?void 0:a.getRecord(Object.assign({apiKey:o,apiUrl:r,projectId:i,language:e,namespace:n},h()))},getLanguageDetector:()=>g.languageDetector,retranslate(){var e;null===(e=g.observer)||void 0===e||e.retranslate()},highlight:(e,t)=>{var n,a;return(null===(a=null===(n=g.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},unwrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:()=>Boolean(R.getDevBackend()),formatTranslation(n){var a,{formatEnabled:o}=n,r=w(n,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:c,params:u,ns:d,orEmpty:f}=r,p=null!=s?s:l;let h="";null==s&&(h=t().onTranslationMissing(r));let v=null!=p?p:f?"":h;const m=e(),y=o||!(null===(a=g.observer)||void 0===a?void 0:a.outputNotFormattable),b=e=>g.observer&&!c?g.observer.wrap({key:i,translation:e,defaultValue:l,params:u,ns:d}):e;v=b(v);try{if(p&&m&&y)for(const e of g.formatters)v=e.format({translation:v,language:m,params:u});g.finalFormatter&&p&&m&&y&&(v=g.finalFormatter.format({translation:v,language:m,params:u}))}catch(e){console.error(e);const n=("string"==typeof(E=e)?E:"string"==typeof(null==E?void 0:E.message)?E.message:void 0)||O,a=t().onFormatError,o=typeof a;v="string"===o?a:"function"===o?a(n,r):O,v=b(v)}var E;return v}});return R}const j=(e,t,n)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=t();a!==e&&n(e),a=e}})};const C=(e,...t)=>{let n,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof t[0]?(a.defaultValue=t[0],n=t[1]):"object"==typeof t[0]&&(n=t[0])),n&&(a=Object.assign(Object.assign({},function(e){var{ns:t,noWrap:n,orEmpty:a,params:o,language:r}=e,i=w(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:t,noWrap:n,orEmpty:a,language:r};return Object.assign(Object.assign({},s),{params:Object.assign({},i)})}(n)),a)),a};function R({options:e}){const t=function(e,t){let n=!0;function a(){return n}const o=Object.freeze({onPendingLanguageChange:f(a),onLanguageChange:f(a),onLoadingChange:f(a),onFetchingChange:f(a),onInitialLoaded:f(a),onRunningChange:f(a),onCacheChange:f(a),onUpdate:p(a,e,t),onPermanentChange:f(a),onError:f(a),setEmitterActive(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return o.onPendingLanguageChange.listen(t);case"language":return o.onLanguageChange.listen(t);case"loading":return o.onLoadingChange.listen(t);case"fetching":return o.onFetchingChange.listen(t);case"initialLoad":return o.onInitialLoaded.listen(t);case"running":return o.onRunningChange.listen(t);case"cache":return o.onCacheChange.listen(t);case"update":return o.onUpdate.listen(t);case"permanentChange":return o.onPermanentChange.listen(t);case"error":return o.onError.listen(t)}}});return o.onInitialLoaded.listen((()=>o.onUpdate.emit())),o.onLanguageChange.listen((()=>o.onUpdate.emit())),o.onCacheChange.listen((({value:e})=>o.onUpdate.emit([e.namespace],!0))),o}(m,y),o=j(!1,(()=>h.isFetching()),t.onFetchingChange.emit),i=j(!1,(()=>D.isLoading()),t.onLoadingChange.emit),g=function(e,t,n){let a,o=N();const r=Object.freeze({init(e){o=N(e,o)},isRunning:()=>o.isRunning,setRunning(e){o.isRunning!==e&&(o.isRunning=e,n.emit(e))},isInitialLoading:()=>o.isInitialLoading,setInitialLoading(e){o.isInitialLoading=e},getLanguage:()=>o.language||o.initialOptions.language,setLanguage(t){o.language!==t&&(o.language=t,e.emit(t))},getPendingLanguage:()=>o.pendingLanguage||r.getLanguage(),setPendingLanguage(e){o.pendingLanguage!==e&&(o.pendingLanguage=e,t.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},o.initialOptions),a),addActiveNs(e){s(e).forEach((e=>{const t=o.activeNamespaces.get(e);void 0!==t?o.activeNamespaces.set(e,t+1):o.activeNamespaces.set(e,1)}))},removeActiveNs(e){s(e).forEach((e=>{const t=o.activeNamespaces.get(e);void 0!==t&&t>1?o.activeNamespaces.set(e,t-1):o.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>c([...o.initialOptions.ns||[o.initialOptions.defaultNs],...s(o.initialOptions.fallbackNs),...o.activeNamespaces.keys()]),getFallbackLangs(e){const t=e||r.getLanguage();return t?c([t,...l(t,o.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>s(o.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?o.initialOptions.defaultNs:e,getAvailableLanguages(){if(o.initialOptions.availableLanguages)return o.initialOptions.availableLanguages;if(o.initialOptions.staticData){const e=Object.keys(o.initialOptions.staticData).map((e=>b(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?r.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:u(e.apiUrl)}):void 0}});return r}(t.onLanguageChange,t.onPendingLanguageChange,t.onRunningChange),d=T(g.getLanguage,g.getInitialOptions,g.getAvailableLanguages,E,x,P,O,t),h=L(t,d.getBackendRecord,d.getBackendDevRecord,g.withDefaultNs,g.isInitialLoading,o,i);let v;function m(){return g.getFallbackNs()}function y(e){return g.getDefaultNs(e)}function E(e){return[...s(y(e)),...m()]}function w(e){return[...s(null!=e?e:y()),...g.getRequiredNamespaces()]}function O(e,t,n){const a=g.withDefaultNs(e),o=h.getTranslation(a,t);return h.changeTranslation(a,t,n),{revert(){h.changeTranslation(a,t,o)}}}function A(e){g.init(e),h.addStaticData(g.getInitialOptions().staticData)}function k(e,t){const n=g.getFallbackLangs(e),a=w(t),o=[];return n.forEach((e=>{a.forEach((t=>{h.exists({language:e,namespace:t},!0)||o.push({language:e,namespace:t})}))})),o}function R(e,t){const n=k(e,t);if(n.length)return a(D.loadRecords(n),(()=>{}))}function x({key:e,ns:t}){const n=g.getFallbackLangs(),a=E(null!=t?t:void 0);return h.getTranslationNs(a,n,e)}function P({key:e,ns:t,language:n}){const a=E(null!=t?t:void 0),o=g.getFallbackLangs(n);return h.getTranslationFallback(a,o,e)}function S(){const e=a(function(){if(g.getLanguage())return;return a(d.getInitialLanguage(),(e=>{const t=e||g.getInitialOptions().defaultLanguage;t&&g.setLanguage(t)}))}(),(()=>R()));if(n(e))return g.setInitialLoading(!0),o.notify(),i.notify(),Promise.resolve(e).then((()=>{g.setInitialLoading(!1),o.notify(),i.notify(),t.onInitialLoaded.emit()}));t.onInitialLoaded.emit()}e&&A(e),t.onUpdate.listen((()=>{g.isRunning()&&d.retranslate()}));const D=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),g),d),h),{init:A,getTranslation:P,changeTranslation:O,getTranslationNs:x,getDefaultAndFallbackNs:E,findPositions:d.findPositions,getRequiredRecords:k,async changeLanguage(e){g.getPendingLanguage()===e&&g.getLanguage()===e||(g.setPendingLanguage(e),g.isRunning()&&await R(e),e===g.getPendingLanguage()&&(g.setLanguage(e),await d.setStoredLanguage(e)))},async addActiveNs(e,t){t||g.addActiveNs(e),g.isRunning()&&await R(void 0,e)},loadRecords:e=>h.loadRecords(e,D.isDev()),loadRecord:async e=>(await D.loadRecords([e]))[0],isLoading:e=>h.isLoading(g.getLanguage(),e),isLoaded(e){const t=g.getLanguage();if(!t)return!1;const n=g.getFallbackLangs(t),a=w(e),o=[];return n.forEach((e=>{a.forEach((t=>{h.exists({language:e,namespace:t})||o.push({language:e,namespace:t})}))})),0===o.length},t:(...e)=>{const t=C(...e),n=P(t);return d.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:()=>Boolean(g.getInitialOptions().apiKey&&g.getInitialOptions().apiUrl),run:()=>(function(){if((d.getLanguageDetector()||d.getLanguageStorage())&&!g.getAvailableLanguages())throw new Error(r("availableLanguages"));if(!g.getLanguage()&&!g.getInitialOptions().defaultLanguage)throw new Error(r(["defaultLanguage","language"]))}(),g.isRunning()||(g.setRunning(!0),d.run(),v=S()),Promise.resolve(v)),stop(){g.isRunning()&&(d.stop(),g.setRunning(!1))}}));return D}const x=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=k(e.options,n),t),init(t){const n=function(e){const t=R({options:e});function n(e){const n=t.isRunning();n&&t.stop(),e(),t.isDev()&&t.invalidate(),n&&t.run()}t.isDev()&&t.invalidate();const a=Object.freeze({on:t.on,onNsUpdate:t.onUpdate.listenSome,setEmitterActive:t.setEmitterActive,getLanguage:t.getLanguage,getPendingLanguage:t.getPendingLanguage,changeLanguage:t.changeLanguage,changeTranslation:t.changeTranslation,addActiveNs:t.addActiveNs,removeActiveNs:t.removeActiveNs,loadRecords:t.loadRecords,loadRecord:t.loadRecord,addStaticData:t.addStaticData,getRecord:t.getRecord,getAllRecords:t.getAllRecords,isLoaded:t.isLoaded,getRequiredRecords:t.getRequiredRecords,isInitialLoading:t.isInitialLoading,isLoading:t.isLoading,isFetching:t.isFetching,isRunning:t.isRunning,run:t.run,stop:t.stop,t:t.t,highlight:t.highlight,findPositions:t.findPositions,getInitialOptions:t.getInitialOptions,isDev:t.isDev,wrap:t.wrap,unwrap:t.unwrap,overrideCredentials(e){n((()=>t.overrideCredentials(e)))},addPlugin(e){e&&n((()=>t.addPlugin(a,e)))},updateOptions(e){e&&n((()=>t.init(e)))}});return a}(k(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},P=0,S=1,D=2;class I extends Error{constructor(e,t,n){let a;a=e===P?"Empty parameter":e===S?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${t} in "${n}"`),this.code=e,this.index=t}}function U(e){return/\s/.test(e)}const F=0,_=1,$=2,M=3,K=4,B=new Set([$,_,F]),V="'",z=new Set(["{","}",V]),W=e=>/[0-9a-zA-Z_]/.test(e);function Y(e,t){const[n,a]=function(e){let t=F,n="",a="",o="";const r=[],i=[];let s=0;function l(t){throw new I(t,s,e)}const c=()=>{r.push(n),n=""},u=()=>{""===a&&l(P),i.push(a),a=""};for(s=0;s<e.length;s++)switch(o=e[s],t){case F:o===V?(n+=o,t=_):"{"===o?(c(),t=M):(n+=o,t=F);break;case _:z.has(o)?(n=n.slice(0,-1)+o,t=$):(n+=o,t=F);break;case $:o===V?t=F:(n+=o,t=$);break;case M:"}"===o?(u(),t=F):U(o)?""!==a&&(u(),t=K):(W(o)||l(S),a+=o,t=M);break;case K:"}"==o?t=F:U(o)?t=K:l(S)}return B.has(t)||l(D),c(),[r,i]}(e),o=[n[0]];for(let r=1;r<n.length;r++){const i=null==t?void 0:t[a[r-1]];if(void 0===i)throw new Error(`Missing parameter "${a[r-1]}" in "${e}"`);o.push(String(i)),o.push(n[r])}return o.join("")}const H=()=>(e,t)=>(t.setFinalFormatter({format:({translation:e,params:t})=>Y(e,t)}),e),X="__tolgee_dev_tools",G="__tolgee_preferredLanguages",q="data-tolgee-key-only",J="data-tolgee-restricted",Z="_tolgee",Q="_tolgee-highlighter";function ee(){var e,t;return void 0===(null==(t=null==(e=globalThis.window)?void 0:e.document)?void 0:t.createElement)}function te(e){if(ee())throw new Error(`${e}: Can't run on the server`)}function ne(e,t){return{oldTextContent:e,keys:t}}function ae(e){return e.textContent}function oe(e,t){e.textContent=t}function re(e,t){var n;const a=void 0===e.key||void 0===t.key||t.key===e.key,o=void 0===e.ns||void 0===t.ns||-1!==(null==(n=e.ns)?void 0:n.findIndex((e=>{var n;return null==(n=t.ns)?void 0:n.includes(e)})));return a&&o}const ie={position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"};function se({highlightColor:e,highlightWidth:t}){return Object.freeze({initHighlighter(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;const o=function(e){for(;e;){if(null!==e.getAttribute("disabled"))return!1;e=e.parentElement}return!0}(n);let r=a.highlightEl;r||(r=document.createElement("div"),r.classList.add(Q),Object.entries(ie).forEach((([e,t])=>{r.style[e]=t})),r.style.borderColor=e,a.highlightEl=r,document.body.appendChild(r));const i=n.getBoundingClientRect();r.style.pointerEvents=o?"none":"auto",r.style.borderWidth=t+"px",r.style.top=i.top-t+"px",r.style.left=i.left-t+"px",r.style.width=i.width+"px",r.style.height=i.height+"px"}}(n,a),function(e,t){t.unhighlight=()=>{var e;null==(e=t.highlightEl)||e.remove(),t.highlightEl=void 0}}(0,a)}})}const le={capture:!0},ce={capture:!0,passive:!0},ue=new Map([["Control","ctrlKey"],["Alt","altKey"],["Meta","metaKey"],["Shift","shiftKey"]]);function ge({highlightKeys:e,elementStore:t,onClick:n,options:a}){var o,r;const i=new Set;let s,l,c=[];const u=(null==(o=a.targetElement)?void 0:o.getRootNode())||document,g=(null==(r=a.targetElement)?void 0:r.ownerDocument)||document;function d(){var e;const n=t.get(s);n&&(n.preventClean=!1,null==(e=n.unhighlight)||e.call(n),s=void 0)}function f(){const e=l;let n;if(e&&A()){n=function(e){for(const n of e){const e=O(n,(e=>t.get(e)));if(void 0!==e)return e||void 0}}(u.elementsFromPoint(e.x,e.y)||[])}!function(e){var n;if(s!==e){d();const a=t.get(e);a&&(a.preventClean=!0,null==(n=a.highlight)||n.call(a),s=e)}}(n)}function p(e){l=e,f()}function h(e){for(const[t,n]of ue.entries())i.has(t)&&!e[n]?i.delete(t):!i.has(t)&&e[n]&&i.add(t)}function v(e){var t;h(e),A()&&(t=e.target,!Boolean(O(t,(e=>e.id===X))))&&(e.stopPropagation(),e.preventDefault())}function m(e){h(e),p({x:e.clientX,y:e.clientY})}function y(e){h(e),f()}function b(e){h(e),f()}function E(){var e;const n=t.get(s);null==(e=null==n?void 0:n.highlight)||e.call(n)}function L(e){v(e),h(e),p({x:e.clientX,y:e.clientY}),A()&&s&&(n(s),d())}function w(e,t,n){g.addEventListener(e,t,n),c.push([e,t,n])}function O(e,t){return e.id===X?null:t(e)?e:(null==e?void 0:e.parentElement)?O(e.parentElement,t):void 0}function A(){for(const t of e)if(!i.has(t))return!1;return!0}return Object.freeze({stop(){!function(){for(const e of c)g.removeEventListener(...e);c=[]}()},run(){w("keydown",y,le),w("keyup",b,le),w("mousemove",m,ce),w("scroll",E,ce),w("click",L,le),w("mouseenter",v,le),w("mouseover",v,le),w("mouseout",v,le),w("mouseleave",v,le),w("mousedown",v,le),w("mouseup",v,le)}})}function de(e,t,n){const a=se({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),o=ge({highlightKeys:e.highlightKeys,elementStore:t,onClick(e){const a=t.get(e);n({target:e,keysAndDefaults:l(a)})},options:e});function r(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${J}]`)}function s(e,n){var a;n.highlightEl&&(null==(a=n.unhighlight)||a.call(n)),e.removeAttribute(Z),t.remove(e)}function l(e){return function(e){return Array.from(e.nodes.values()).reduce(((e,t)=>[...e,...t.keys.map((e=>({key:e.key,defaultValue:e.defaultValue,ns:e.ns})))]),[])}(e)}return Object.freeze({isRestricted:r,register(e,n,o){if(r(e))return;const i=e;let s=t.get(i);s||(s=function(e){return{element:e,nodes:new Map}}(i),t.set(i,s),i.setAttribute(Z,"true")),s.nodes.set(n,o),a.initHighlighter(i,s)},forEachElement:t.forEachElement,cleanupLingeringKeyAttributes(){t.forEachElement(((e,t)=>{if(!t.preventClean){for(const[e]of t.nodes)if(e.nodeType===Node.ATTRIBUTE_NODE){const n=e;n.name===q&&null===n.ownerElement&&t.nodes.delete(n)}0===t.nodes.size&&s(e,t)}}))},cleanupRemovedNodes(e){t.forEachElement(((t,n)=>{n.preventClean||(e.has(t)||function(e,t){for(const[n]of e.nodes)t.has(n)&&e.nodes.delete(n)}(n,e),(e.has(t)||0===n.nodes.size)&&s(t,n))}))},findAll(e,n){const a=[];return t.forEachElement(((t,o)=>{for(const t of o.nodes.values()){if(t.keys.find((t=>re({key:e,ns:i(n)},{key:t.key,ns:i(t.ns)})))){a.push(o);break}}})),a},run(e){e&&o.run()},stop(){o.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null==(n=t.unhighlight)||n.call(t))}))}})}function fe(){let e,t=!1;const n=function(){const e=new Map;return Object.freeze({set(t,n){e.set(t,n)},get:t=>t&&e.get(t),remove:t=>e.delete(t),forEachElement(t){e.forEach(((e,n)=>t(n,e)))}})}();function a({mouseHighlight:e,options:a,wrapper:o,onClick:r}){if(ee())return{stop(){t=!1},wrapper:o};const i=function(e){const t=Object.freeze({getSuitableParent(n){const a=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(n);if(void 0===a)throw console.error(n),new Error("No suitable parent found for node above.");if(!e.passToParent)return a;if(Array.isArray(e.passToParent)){const t=e=>a.tagName.toLowerCase()===e.toLowerCase();if(-1===e.passToParent.findIndex(t))return a}return"function"!=typeof e.passToParent||e.passToParent(a)?t.getSuitableParent(a):a}});return t}(a),s=function(e,t){const n=Object.freeze({handleAttributes(n,a=!0){const o=[],r=Object.fromEntries(Object.entries(e.tagAttributes).map((([e,t])=>[e.toUpperCase(),t])));if(n.nodeType===Node.ELEMENT_NODE){const e=n;let a=r[e.tagName.toUpperCase()]??[];"*"in r&&(a=a.concat(r["*"])),o.push(...a.filter((t=>e.hasAttribute(t))).map((t=>e.getAttributeNode(t))).filter((e=>t.testAttribute(e))))}if(a){const e=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,(e=>{var t,n;return(null==(t=r[e.tagName.toUpperCase()])?void 0:t.some((t=>e.hasAttribute(t))))||(null==(n=r["*"])?void 0:n.some((t=>e.hasAttribute(t))))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}));for(;e.nextNode();){const n=e.currentNode;let a=r[n.tagName.toUpperCase()]??[];"*"in r&&(a=a.concat(r["*"])),o.push(...a.filter((e=>n.hasAttribute(e))).map((e=>n.getAttributeNode(e))).filter((e=>t.testAttribute(e))))}}return o},handleChildList(e){const t=[];return t.push(...e.flatMap((e=>n.handleAttributes(e,!0)))),t.push(...e.flatMap((e=>n.handleText(e)))),t},handleText(e){if(e.nodeType===Node.TEXT_NODE)return t.testTextNode(e)?[e]:[];const n=[],a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,(e=>t.testTextNode(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;a.nextNode();)n.push(a.currentNode);return n}});return n}(a,o),l=de(a,n,r);function c(e){for(const t of e){const e=t.parentElement;if(e&&l.isRestricted(e))continue;const n=ae(t),a=n?o.unwrap(n):null;if(a){const{text:e,keys:o}=a;oe(t,e);const r=ne(n,o),s=i.getSuitableParent(t);l.register(s,t,r)}}}function u(e){const t=i.getSuitableParent(e);l.register(t,e,{oldTextContent:"",keys:[{key:ae(e)}],keyAttributeOnly:!0})}function g(e,t){if(e.nodeType===Node.ATTRIBUTE_NODE){const t=e;if(t.name===q)return void u(t)}if(e.nodeType===Node.ELEMENT_NODE){const t=e.getAttributeNode(q);t&&u(t)}if(!t)return;const n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,(e=>e.hasAttribute(q)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;n.nextNode();){u(n.currentNode.getAttributeNode(q))}}const d=new MutationObserver((e=>{if(!t)return;const n=e.filter((e=>"childList"===e.type)).flatMap((e=>Array.from(e.removedNodes))),a=new Set(n);for(const e of n){if(e.nodeType===Node.ELEMENT_NODE)for(let t=0;t<e.attributes.length;t++)a.add(e.attributes[t]);const t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(;t.nextNode();){const e=t.currentNode;if(e.nodeType===Node.ELEMENT_NODE){const t=e;for(let e=0;e<t.attributes.length;e++)a.add(t.attributes[e])}a.add(e)}}a.size>0&&l.cleanupRemovedNodes(a),e.some((e=>"attributes"===e.type&&e.attributeName===q))&&l.cleanupLingeringKeyAttributes();const o=new Set;for(const t of e)switch(t.type){case"characterData":s.handleText(t.target).forEach((e=>o.add(e)));break;case"childList":g(t.target,!0),t.addedNodes.length>0&&s.handleChildList(Array.from(t.addedNodes)).forEach((e=>o.add(e))),t.removedNodes.length>0&&s.handleChildList(Array.from(t.removedNodes)).forEach((e=>o.delete(e)));break;case"attributes":t.attributeName===q&&g(t.target,!1),s.handleAttributes(t.target,!1).forEach((e=>o.add(e)))}c([...o])})),f=a.targetElement||document.body;t=!0,l.run(e),g(f,!0),c(s.handleChildList([f]));const p=new Set;return p.add(q),Object.values(a.tagAttributes).forEach((e=>e.forEach((e=>p.add(e.toLowerCase()))))),d.observe(f,{attributes:!0,attributeFilter:[...p],childList:!0,subtree:!0,characterData:!0}),{stop(){t=!1,l.stop(),d.disconnect()},elementRegistry:l,wrapper:o}}return Object.freeze({run(t){e=a(t)},stop(){null==e||e.stop()},forEachElement(t){var n,a;null==(a=null==(n=null==e?void 0:e.elementRegistry)?void 0:n.forEachElement)||a.call(n,t)},highlight(t,n){var a;const o=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[];return o.forEach((e=>{var t;return null==(t=e.highlight)?void 0:t.call(e)})),{unhighlight(){o.forEach((e=>{var t;return null==(t=e.unhighlight)?void 0:t.call(e)}))}}},findPositions(t,n){var a;const o=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[],r=[];return o.sort(((e,t)=>e.element.compareDocumentPosition(t.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)),o.forEach((e=>{const a=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{re({key:t,ns:i(n)},{key:e.key,ns:i(e.ns)})&&r.push({position:{x:a.x,y:a.y,width:a.width,height:a.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),r},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})}var pe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},he={};!function(e){function t(e){for(var t=0,n=Math.min(65536,e.length+1),a=new Uint16Array(n),o=[],r=0;;){var i=t<e.length;if(!i||r>=n-1){var s=a.subarray(0,r);if(o.push(String.fromCharCode.apply(null,s)),!i)return o.join("");e=e.subarray(t),t=0,r=0}var l=e[t++];if(0==(128&l))a[r++]=l;else if(192==(224&l)){var c=63&e[t++];a[r++]=(31&l)<<6|c}else if(224==(240&l)){c=63&e[t++];var u=63&e[t++];a[r++]=(31&l)<<12|c<<6|u}else if(240==(248&l)){var g=(7&l)<<18|(c=63&e[t++])<<12|(u=63&e[t++])<<6|63&e[t++];g>65535&&(g-=65536,a[r++]=g>>>10&1023|55296,g=56320|1023&g),a[r++]=g}}}var n="Failed to ",a=function(e,t,a){if(e)throw new Error("".concat(n).concat(t,": the '").concat(a,"' option is unsupported."))},o="function"==typeof Buffer&&Buffer.from,r=o?function(e){return Buffer.from(e)}:function(e){for(var t=0,n=e.length,a=0,o=Math.max(32,n+(n>>>1)+7),r=new Uint8Array(o>>>3<<3);t<n;){var i=e.charCodeAt(t++);if(i>=55296&&i<=56319){if(t<n){var s=e.charCodeAt(t);56320==(64512&s)&&(++t,i=((1023&i)<<10)+(1023&s)+65536)}if(i>=55296&&i<=56319)continue}if(a+4>r.length){o+=8,o=(o*=1+t/e.length*2)>>>3<<3;var l=new Uint8Array(o);l.set(r),r=l}if(0!=(4294967168&i)){if(0==(4294965248&i))r[a++]=i>>>6&31|192;else if(0==(4294901760&i))r[a++]=i>>>12&15|224,r[a++]=i>>>6&63|128;else{if(0!=(4292870144&i))continue;r[a++]=i>>>18&7|240,r[a++]=i>>>12&63|128,r[a++]=i>>>6&63|128}r[a++]=63&i|128}else r[a++]=i}return r.slice?r.slice(0,a):r.subarray(0,a)};function i(){this.encoding="utf-8"}i.prototype.encode=function(e,t){return a(t&&t.stream,"encode","stream"),r(e)};var s=!o&&"function"==typeof Blob&&"function"==typeof URL&&"function"==typeof URL.createObjectURL,l=["utf-8","utf8","unicode-1-1-utf-8"],c=t;o?c=function(e,t){return(e instanceof Buffer?e:Buffer.from(e.buffer,e.byteOffset,e.byteLength)).toString(t)}:s&&(c=function(e){try{return function(e){var t;try{var n=new Blob([e],{type:"text/plain;charset=UTF-8"});t=URL.createObjectURL(n);var a=new XMLHttpRequest;return a.open("GET",t,!1),a.send(),a.responseText}finally{t&&URL.revokeObjectURL(t)}}(e)}catch(n){return t(e)}});var u="construct 'TextDecoder'",g="".concat(n," ").concat(u,": the ");function d(e,t){if(a(t&&t.fatal,u,"fatal"),e=e||"utf-8",!(o?Buffer.isEncoding(e):-1!==l.indexOf(e.toLowerCase())))throw new RangeError("".concat(g," encoding label provided ('").concat(e,"') is invalid."));this.encoding=e,this.fatal=!1,this.ignoreBOM=!1}d.prototype.decode=function(e,t){var n;return a(t&&t.stream,"decode","stream"),n=e instanceof Uint8Array?e:e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer):new Uint8Array(e),c(n,this.encoding)},e.TextEncoder=e.TextEncoder||i,e.TextDecoder=e.TextDecoder||d}("undefined"!=typeof window?window:pe);const ve=t({__proto__:null,default:he},[he]);null==(e=console.assert)||e.call(console,ve);const me=["",""],ye=RegExp(`([${me.join("")}]{9})+`,"gu");function be(e){const t=function(e){return Array.from((new TextEncoder).encode(e))}(e).map(Number),n=t.map((e=>function(e){const t=8-e.length;return"0".repeat(t)+e}(e.toString(2))+"0")).join("");return Array.from(n).map((e=>me[Number(e)])).join("")}function Ee(e){const t=Array.from(e).map((e=>me.indexOf(e))).map(String).join("").match(/(.{9})/g),n=Uint8Array.from((null==t?void 0:t.map((e=>parseInt(e.slice(0,8),2))))||[]);return a=n,(new TextDecoder).decode(new Uint8Array(a));var a}function Le({fullKeyEncode:e}){const t=function(){const e=[];return Object.freeze({valueToNumber(t){let n=e.indexOf(t);return-1===n&&(n=e.length,e.push(t)),n},numberToValue:t=>e[t]})}();function n(e){const t={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(t)}return Object.freeze({unwrap(e){const n=[],a=function(e){var t;const n=null==(t=e.match(ye))?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(Ee))||[]}(e);a.forEach((e=>{const a=function(e){if(e.length<=4){const[n]=function(e){const t=[];for(const n of e)t.push(n.codePointAt(0));return t}(e);return t.numberToValue(n)}return e}(e),o=function(e){try{return JSON.parse(e||"{}")}catch(e){return void console.error(e)}}(a);if(o){const{k:e,d:t,n:a}=o;n.push({key:e,defaultValue:t,ns:a})}}));const o=function(e){return e.replace(ye,"")}(e);return{text:o,keys:n}},wrap({key:a,defaultValue:o,translation:r,ns:i}){let s;if(e){s=be(n({key:a,ns:i}))}else{const e=n({key:a,ns:i,defaultValue:o}),r=t.valueToNumber(e);s=be(String.fromCodePoint(r))}const l=r||"";return"string"==typeof l?l+s:l},testTextNode(e){var t,n;return((null==(t=e.textContent)?void 0:t.includes(`${me[0]}${me[0]}`))||(null==(n=e.textContent)?void 0:n.includes(`${me[1]}${me[0]}`)))??!1},testAttribute:e=>e.value.includes(`${me[0]}${me[0]}`)||e.value.includes(`${me[1]}${me[0]}`)})}function we(e,t){let n=0;for(;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}function Oe({inputPrefix:e,inputSuffix:t,translate:n}){function a(e){const{key:t,params:a,defaultValue:o,ns:r}=function(e){let t=!1,n="",a="",o="KEY";const r={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{r.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==o||","!==s?"KEY"!==o||"|"!==s?"NAMESPACE"!==o||","!==s?"KEY"!==o||":"!==s?"DEFAULT_VALUE"!==o||":"!==s?"PARAM_NAME"!==o||":"!==s?"PARAM_VALUE"!==o||","!==s?n+=s:(o="PARAM_NAME",r.params[a]=n,n=""):(o="PARAM_VALUE",a=n,n=""):(o="PARAM_NAME",r.defaultValue=n,n=""):(o="PARAM_NAME",r.key=n,n=""):(o="DEFAULT_VALUE",i(n),n=""):(o="NAMESPACE",r.key=n,n=""):(o="DEFAULT_VALUE",r.key=n,n=""):t=!0;return"KEY"===o&&(r.key=n),"DEFAULT_VALUE"===o&&(r.defaultValue=n),"PARAM_VALUE"===o&&(r.params[a]=n),"NAMESPACE"===o&&i(n),r}(e);return{translated:n({key:t,params:a,defaultValue:o,ns:r,noWrap:!0}),key:t,params:a,defaultValue:o,ns:r}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r(e){return"string"==typeof e?e.replace(/[,:|\\]/gs,"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn(`Parameters of type "${typeof e}" are not supported in "text" wrapper mode.`),e)}return Object.freeze({wrap({key:n,params:a,defaultValue:o,ns:i}){let s=Object.entries(a||{}).map((([e,t])=>`${r(e)}:${r(t)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==o?`,${r(o)}`:"",c="string"==typeof i?[i]:i,u=(null==c?void 0:c.length)?`|${c.map((e=>r(e))).join("|")}`:"";return`${e}${r(n)}${u}${l}${s}${t}`},unwrap(n){const r=new RegExp(`(\\\\?)(${o(e)}(.*?)${o(t)})`,"gs"),i=[];let s,l=!1,c=0,u="";for(;null!==(s=r.exec(n));){let e=s[1];const[t,o,r,g]=s,{index:d,input:f}=s;if(u+=f.substr(c,d-c),c=d+t.length,"\\"===e){if(!we(d,n)){u+=r;continue}e=""}const p=a(g);i.push({key:p.key,params:p.params,defaultValue:p.defaultValue,ns:p.ns}),l=!0,u+=e+p.translated}return u+=n.substring(c),l?{text:u,keys:i}:{text:n,keys:[]}},testTextNode(n){var a,o;return((null==(a=n.textContent)?void 0:a.includes(e))&&(null==(o=n.textContent)?void 0:o.includes(t)))??!1},testAttribute:n=>n.value.includes(e)&&n.value.includes(t)})}const Ae=()=>(e,t)=>("text"===e.getInitialOptions().observerType?t.setObserver((()=>{const e=fe();return Object.freeze({...e,run(t){const n=Oe({inputPrefix:t.options.inputPrefix,inputSuffix:t.options.inputSuffix,translate:t.translate});e.run({...t,wrapper:n})},retranslate(){e.forEachElement(((t,n)=>{for(const[t,a]of n.nodes.entries()){if(a.keyAttributeOnly)return;const n=e.unwrap(a.oldTextContent);n&&oe(t,n.text)}}))},outputNotFormattable:!0})})):t.setObserver((()=>{const e=fe();return Object.freeze({...e,run(t){const n=Le({fullKeyEncode:t.options.fullKeyEncode});e.run({...t,wrapper:n})},retranslate(){},outputNotFormattable:!1})})),e),ke="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function Ne(e){const t=ke.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function Te(e){const t=(e=e.toUpperCase()).length;let n=0,a=0,o=0;const r=new Uint8Array(5*t/8|0);for(let i=0;i<t;i++)a=a<<5|Ne(e[i]),n+=5,n>=8&&(r[o++]=a>>>n-8&255,n-=8);return function(e){const t=new Uint8Array(e),n=t.length;let a="",o=Math.pow(2,16)-1;for(let e=0;e<n;e+=o)e+o>n&&(o=n-e),a+=String.fromCharCode.apply(null,t.subarray(e,e+o));return a}(r.buffer)}function je(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=Te(n).split("_");return Number(e)}}catch{console.warn("Tolgee: Api key can't be parsed")}}const Ce=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:o,fetch:r}){const i=je(t)??o;let s=void 0!==i?`${e}/v2/projects/${i}/translations/${n}`:`${e}/v2/projects/translations/${n}`;if(a&&(s+=`?ns=${a}`),"tgpat"===function(e){if(!e)return;const[t]=e.split("_");return"tgpak"===t?"tgpak":"tgpat"===t?"tgpat":"legacy"}(t)&&void 0===o)throw new Error("You need to specify 'projectId' when using PAT key");return r(s,{headers:{"X-API-Key":t||"","Content-Type":"application/json"}}).then((e=>{if(e.ok)return e.json().then((e=>e[n]));throw new Error(e.statusText)}))}}),e);function Re({message:e,recievingMessage:t,data:n,attempts:a=1,timeout:o=300}){let r=!1;const i=()=>new Promise(((a,r)=>{const i=function(e,t){const n=n=>{var a,o;e.includes(null==(a=n.data)?void 0:a.type)&&t(null==(o=n.data)?void 0:o.data)};return window.addEventListener("message",n,!1),{unsubscribe(){window.removeEventListener("message",n)}}}(t,(function(e){clearTimeout(s),l(),a(e)}));window.postMessage({type:e,data:n},window.origin);const s=setTimeout((function(){l(),r()}),o);function l(){i.unsubscribe()}}));return{cancel(){r=!0},promise:(async()=>{for(let e=0;e<a;e++){if(r)return new Promise((()=>{}));try{return await i()}catch(e){continue}}if(!r)throw`Didn't recieve ${t.join(" or ")} in time.`;return new Promise((()=>{}))})()}}let xe=null;function Pe(e){var t;return xe||(xe=(t=`https://cdn.jsdelivr.net/npm/@tolgee/web@${e}/dist/tolgee-in-context-tools.umd.min.js`,new Promise(((e,n)=>{const a=document.createElement("script");a.src=t,a.addEventListener("load",(()=>e())),a.addEventListener("error",(e=>n(e.error))),document.head.appendChild(a)}))).then((()=>window["@tolgee/in-context-tools"].InContextTools))),xe}const Se="__tolgee_apiKey",De="__tolgee_apiUrl";function Ie(){const e=sessionStorage.getItem(Se)||void 0,t=sessionStorage.getItem(De)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function Ue(){sessionStorage.removeItem(Se),sessionStorage.removeItem(De)}let Fe=()=>e=>e;(()=>{if("undefined"==typeof window)return!1;try{return"undefined"!=typeof sessionStorage&&sessionStorage}catch(e){return console.error("sessionStorage not available",e),!1}})()&&(Fe=()=>e=>{const t=function(){let e;return{update:async function(t){null==e||e();const{cancel:n,promise:a}=Re({message:"TOLGEE_READY",recievingMessage:["TOLGEE_PLUGIN_READY","TOLGEE_PLUGIN_UPDATED"],data:t,attempts:4});return e=n,a}}}();e.on("running",(({value:n})=>{var a;n&&(a=()=>{t.update({uiPresent:!0,uiVersion:void 0,mode:e.isDev()?"development":"production",config:{apiUrl:e.getInitialOptions().apiUrl||"",apiKey:e.getInitialOptions().apiKey||""}}).catch(Ue)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Ie()&&(async()=>{const e=await Pe("5.28.1");return t=>{const n=Ie();return t.addPlugin(e({credentials:n})),t}})().then((t=>{e.addPlugin(t)})).catch((e=>{console.error("Tolgee: Failed to load in-context tools"),console.error(e)})),e});const _e="__tolgee_currentLanguage";const $e=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(te("LanguageStorage"),localStorage.getItem(_e)||void 0),setLanguage(e){te("LanguageStorage"),localStorage.setItem(_e,e)}}),e);const Me=()=>(e,t)=>(t.setLanguageDetector({getLanguage({availableLanguages:e}){te("LanguageDetector");const t=window.navigator.language,n=e.find((e=>e===t));if(n)return n;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),o=a(window.navigator.language);return e.find((e=>a(e)===o))||void 0}}),e);function Ke(e){return e.endsWith("/")?e.slice(0,-1):e}const Be={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${Ke(n)}/${e}/${t}.json`:`${Ke(n)}/${t}.json`,getData:function(e){return e.json()},headers:{Accept:"application/json"}};const Ve=e=>(t,n)=>(n.addBackend(function(e){const{prefix:t,getPath:n,getData:a,headers:o,...r}={...Be,...e,headers:{...Be.headers,...null==e?void 0:e.headers}};return{getRecord:({namespace:e,language:i,fetch:s})=>s(n({namespace:e,language:i,prefix:t}),{headers:o,...r}).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return a(e)}))}}(e)),t);function ze(){return x().use(Fe())}const We=()=>e=>e;export{Ve as BackendFetch,Fe as BrowserExtensionPlugin,X as DEVTOOLS_ID,Ce as DevBackend,We as DevTools,H as FormatSimple,Me as LanguageDetector,v as LanguageDetectorError,$e as LanguageStorage,m as LanguageStorageError,Ae as ObserverPlugin,G as PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY,h as RecordFetchError,Z as TOLGEE_ATTRIBUTE_NAME,J as TOLGEE_RESTRICT_ATTRIBUTE,q as TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE,ze as Tolgee,x as TolgeeCore,d as createFetchFunction,i as getFallback,s as getFallbackArray,je as getProjectIdFromApiKey,C as getTranslateProps}; | ||
var e;function t(e,t){for(var n=0;n<t.length;n++){const a=t[n];if("string"!=typeof a&&!Array.isArray(a))for(const t in a)if("default"!==t&&!(t in e)){const n=Object.getOwnPropertyDescriptor(a,t);n&&Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>a[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function n(e){return Boolean(e&&"function"==typeof e.then)}function a(e,t){return n(e)?Promise.resolve(e).then(t):t(e)}function o(e,t,a){function o(n){const a=t(n);throw e.emit(a),console.error(a),a}try{const e=a();return n(e)?e.catch(o):e}catch(e){o(e)}}function r(e){const t=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),n=t.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...t.slice(0,-2),n].join(", ")} option`}function i(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function s(e){return i(e)||[]}function l(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?s(t):s(null==t?void 0:t[e]);var n}function c(e){return Array.from(new Set(e))}function u(e){return e?e.replace(/\/+$/,""):e}const g=(e,t)=>fetch(e,t),d=(e=g)=>(t,n)=>e(t,Object.assign(Object.assign({},n),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":"5.28.2-prerelease.2842344b.0"},null==n?void 0:n.headers)}));function f(e){let t=[];return Object.freeze({listen(e){const n=t=>{e(t)};return t.push(n),{unsubscribe(){t=t.filter((e=>n!==e))}}},emit(n){e()&&t.forEach((e=>e({value:n})))}})}function p(e,t,n){const a=new Set,o=new Set;let r=[];function i(){if(0===r.length)return;const e=r;r=[],a.forEach((e=>{e({value:void 0})}));let n=new Set;e.forEach((e=>{void 0===e?n=void 0:void 0!==n&&e.forEach((e=>n.add(e)))}));!function(e){const n=new Set(t());o.forEach((t=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>n.has(e)||t.namespaces.has(e)))))&&t.fn({value:void 0})}))}(n?Array.from(n.keys()):void 0)}return Object.freeze({emit(t,n){e()&&(r.push(t),n?setTimeout(i,0):i())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const t={fn:t=>{e(t)},namespaces:new Set};o.add(t);const a={unsubscribe:()=>{o.delete(t)},subscribeNs:e=>(s(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a}})}class h extends Error{constructor(e,t,n=!1){const{language:a,namespace:o}=e;super(`Tolgee: Failed to fetch record for "${a}"${o&&` and "${o}"`}`),this.cause=t,this.isDev=n,this.name="RecordFetchError",this.language=a,this.namespace=o}}class v extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageDetectorError"}}class m extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageStorageError"}}const y=e=>{const t=new Map;return Object.entries(e).forEach((([e,n])=>{null!=n&&("object"!=typeof n?t.set(e,n):y(n).forEach(((n,a)=>{t.set(e+"."+a,n)})))})),t},b=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},E=({language:e,namespace:t})=>t?`${e}:${t}`:e;function L(e,t,a,o,r,i,l){const u=new Map,g=new Map;let d={},f=0;function p(t,n,a){const o=E(t);g.set(o,{data:y(n),version:a}),e.onCacheChange.emit(t)}async function v(o,r){let i;if(r)try{i=await a(o)}catch(t){const n=new h(o,t,!0);e.onError.emit(n),console.warn(n)}return i||(i=await async function(a){let o;const r=d[E(a)];return"function"==typeof r&&(o=r()),o||(o=t(a)),n(o)?null==o?void 0:o.catch((t=>{const n=new h(a,t);throw e.onError.emit(n),console.error(n),n})):o}(o)),i}const m=Object.freeze({addStaticData(e){e&&(d=Object.assign(Object.assign({},d),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=b(e),a=g.get(e);a&&0!==a.version||p(n,t,0)}})))},invalidate(){u.clear(),f+=1},addRecord(e,t){p(e,t,f)},exists(e,t=!1){const n=g.get(E(e));return n&&t?n.version===f:Boolean(n)},getRecord(e){var t;return null===(t=g.get(E(o(e))))||void 0===t?void 0:t.data},getTranslation(e,t){var n;return null===(n=g.get(E(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=g.get(E({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[o]}return c(e)},getTranslationFallback(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=g.get(E({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation(t,n,a){var o;const r=null===(o=g.get(E(t)))||void 0===o?void 0:o.data;null==r||r.set(n,a),e.onCacheChange.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching(e){if(r())return!0;if(void 0===e)return u.size>0;const t=s(e);return Boolean(Array.from(u.keys()).find((e=>t.includes(b(e).namespace))))},isLoading(e,t){const n=s(t);return Boolean(r()||Array.from(u.keys()).find((t=>{const a=b(t);return(!n.length||n.includes(a.namespace))&&!m.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,t){const n=e.map((e=>{const n=o(e),a=E(n),r=u.get(a);if(r)return{new:!1,promise:r,keyObject:n,cacheKey:a};const i=v(n,t)||Promise.resolve(void 0);return u.set(a,i),{new:!0,promise:i,keyObject:n,cacheKey:a}}));i.notify(),l.notify();const a=await Promise.all(n.map((e=>e.promise)));return n.forEach(((e,t)=>{const n=u.get(e.cacheKey)!==e.promise;if(e.new&&!n){u.delete(e.cacheKey);const n=a[t];n?m.addRecord(e.keyObject,n):m.getRecord(e.keyObject)||m.addRecord(e.keyObject,{})}})),i.notify(),l.notify(),n.map((e=>m.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(g.entries()).map((([e,t])=>Object.assign(Object.assign({},b(e)),{data:t.data})))});return m}function w(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n}const O="invalid",A={defaultNs:"",observerOptions:{tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:["Alt"],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"],fullKeyEncode:!1},observerType:"invisible",onFormatError:O,apiUrl:"https://app.tolgee.io",fetch:d(),onTranslationMissing:({key:e})=>e},k=(...e)=>{let t={};return e.forEach((e=>{t=Object.assign(Object.assign(Object.assign({},t),e),{observerOptions:Object.assign(Object.assign({},t.observerOptions),null==e?void 0:e.observerOptions)})})),t};function N(e,t){const n=k(A,null==t?void 0:t.initialOptions,e);return n.apiUrl=u(n.apiUrl),(null==e?void 0:e.fetch)&&(n.fetch=d(e.fetch)),{initialOptions:n,activeNamespaces:(null==t?void 0:t.activeNamespaces)||new Map,language:null==t?void 0:t.language,pendingLanguage:null==t?void 0:t.language,isInitialLoading:!1,isRunning:!1}}function T(e,t,n,r,i,s,l,c){const u={ui:void 0},g={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},d=async({keysAndDefaults:e,target:t})=>{var n;const a=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,fallbackNamespaces:r(t),namespace:i({key:e,ns:t})[0],translation:s({key:e,ns:t})})));null===(n=g.ui)||void 0===n||n.handleElementClick(a,t)},f=(e,t)=>{var n;return(null===(n=g.observer)||void 0===n?void 0:n.findPositions(e,t))||[]};function p(e){const t=s({key:e.key,ns:e.ns});return R.formatTranslation(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))}function h(){return{fetch:t().fetch}}function y(e){g.observer=null==e?void 0:e()}function b(){return Boolean(g.observer)}function E(e){e&&g.formatters.push(e)}function L(e){g.finalFormatter=e}function A(e){u.ui=e}function k(){return Boolean(u.ui)}function N(e){g.languageStorage=e}function T(e){g.languageDetector=e}function j(e){e&&g.backends.push(e)}function C(e){g.devBackend=e}const R=Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:L,addFormatter:E,setObserver:y,hasObserver:b,setUi:A,hasUi:k,setDevBackend:C,addBackend:j,setLanguageDetector:T,setLanguageStorage:N}))},findPositions:f,run(){var e,n;const{apiKey:a,apiUrl:o,projectId:r,observerOptions:i,tagNewKeys:s}=t();g.ui=null===(e=u.ui)||void 0===e?void 0:e.call(u,{apiKey:a,apiUrl:o,projectId:r,highlight:R.highlight,changeTranslation:l,findPositions:f,onPermanentChange:e=>c.onPermanentChange.emit(e),tagNewKeys:s}),null===(n=g.observer)||void 0===n||n.run({mouseHighlight:!0,options:i,translate:p,onClick:d})},stop(){var e;g.ui=void 0,null===(e=g.observer)||void 0===e||e.stop()},getLanguageStorage:()=>g.languageStorage,getInitialLanguage(){const e=n();return a(o(c.onError,(e=>new m("Tolgee: Failed to load language",e)),(()=>{var e;return null===(e=g.languageStorage)||void 0===e?void 0:e.getLanguage(h())})),(t=>e&&!e.includes(t)||!t?function(){if(!g.languageDetector)return;const e=n();return o(c.onError,(e=>new v("Tolgee: Failed to detect language",e)),(()=>{var t;return null===(t=g.languageDetector)||void 0===t?void 0:t.getLanguage(Object.assign({availableLanguages:e},h()))}))}():t))},setStoredLanguage:e=>o(c.onError,(e=>new m("Tolgee: Failed to store language",e)),(()=>{var t;return null===(t=g.languageStorage)||void 0===t?void 0:t.setLanguage(e,h())})),getDevBackend:()=>g.devBackend,getBackendRecord:async({language:e,namespace:t})=>{for(const n of g.backends){const a=await n.getRecord(Object.assign({language:e,namespace:t},h()));if(void 0!==a)return a}},getBackendDevRecord:async({language:e,namespace:n})=>{var a;const{apiKey:o,apiUrl:r,projectId:i}=t();return null===(a=g.devBackend)||void 0===a?void 0:a.getRecord(Object.assign({apiKey:o,apiUrl:r,projectId:i,language:e,namespace:n},h()))},getLanguageDetector:()=>g.languageDetector,retranslate(){var e;null===(e=g.observer)||void 0===e||e.retranslate()},highlight:(e,t)=>{var n,a;return(null===(a=null===(n=g.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},unwrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:()=>Boolean(R.getDevBackend()),formatTranslation(n){var a,{formatEnabled:o}=n,r=w(n,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:c,params:u,ns:d,orEmpty:f}=r,p=null!=s?s:l;let h="";null==s&&(h=t().onTranslationMissing(r));let v=null!=p?p:f?"":h;const m=e(),y=o||!(null===(a=g.observer)||void 0===a?void 0:a.outputNotFormattable),b=e=>g.observer&&!c?g.observer.wrap({key:i,translation:e,defaultValue:l,params:u,ns:d}):e;v=b(v);try{if(p&&m&&y)for(const e of g.formatters)v=e.format({translation:v,language:m,params:u});g.finalFormatter&&p&&m&&y&&(v=g.finalFormatter.format({translation:v,language:m,params:u}))}catch(e){console.error(e);const n=("string"==typeof(E=e)?E:"string"==typeof(null==E?void 0:E.message)?E.message:void 0)||O,a=t().onFormatError,o=typeof a;v="string"===o?a:"function"===o?a(n,r):O,v=b(v)}var E;return v}});return R}const j=(e,t,n)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=t();a!==e&&n(e),a=e}})};const C=(e,...t)=>{let n,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof t[0]?(a.defaultValue=t[0],n=t[1]):"object"==typeof t[0]&&(n=t[0])),n&&(a=Object.assign(Object.assign({},function(e){var{ns:t,noWrap:n,orEmpty:a,params:o,language:r}=e,i=w(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:t,noWrap:n,orEmpty:a,language:r};return Object.assign(Object.assign({},s),{params:Object.assign({},i)})}(n)),a)),a};function R({options:e}){const t=function(e,t){let n=!0;function a(){return n}const o=Object.freeze({onPendingLanguageChange:f(a),onLanguageChange:f(a),onLoadingChange:f(a),onFetchingChange:f(a),onInitialLoaded:f(a),onRunningChange:f(a),onCacheChange:f(a),onUpdate:p(a,e,t),onPermanentChange:f(a),onError:f(a),setEmitterActive(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return o.onPendingLanguageChange.listen(t);case"language":return o.onLanguageChange.listen(t);case"loading":return o.onLoadingChange.listen(t);case"fetching":return o.onFetchingChange.listen(t);case"initialLoad":return o.onInitialLoaded.listen(t);case"running":return o.onRunningChange.listen(t);case"cache":return o.onCacheChange.listen(t);case"update":return o.onUpdate.listen(t);case"permanentChange":return o.onPermanentChange.listen(t);case"error":return o.onError.listen(t)}}});return o.onInitialLoaded.listen((()=>o.onUpdate.emit())),o.onLanguageChange.listen((()=>o.onUpdate.emit())),o.onCacheChange.listen((({value:e})=>o.onUpdate.emit([e.namespace],!0))),o}(m,y),o=j(!1,(()=>h.isFetching()),t.onFetchingChange.emit),i=j(!1,(()=>D.isLoading()),t.onLoadingChange.emit),g=function(e,t,n){let a,o=N();const r=Object.freeze({init(e){o=N(e,o)},isRunning:()=>o.isRunning,setRunning(e){o.isRunning!==e&&(o.isRunning=e,n.emit(e))},isInitialLoading:()=>o.isInitialLoading,setInitialLoading(e){o.isInitialLoading=e},getLanguage:()=>o.language||o.initialOptions.language,setLanguage(t){o.language!==t&&(o.language=t,e.emit(t))},getPendingLanguage:()=>o.pendingLanguage||r.getLanguage(),setPendingLanguage(e){o.pendingLanguage!==e&&(o.pendingLanguage=e,t.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},o.initialOptions),a),addActiveNs(e){s(e).forEach((e=>{const t=o.activeNamespaces.get(e);void 0!==t?o.activeNamespaces.set(e,t+1):o.activeNamespaces.set(e,1)}))},removeActiveNs(e){s(e).forEach((e=>{const t=o.activeNamespaces.get(e);void 0!==t&&t>1?o.activeNamespaces.set(e,t-1):o.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>c([...o.initialOptions.ns||[o.initialOptions.defaultNs],...s(o.initialOptions.fallbackNs),...o.activeNamespaces.keys()]),getFallbackLangs(e){const t=e||r.getLanguage();return t?c([t,...l(t,o.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>s(o.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?o.initialOptions.defaultNs:e,getAvailableLanguages(){if(o.initialOptions.availableLanguages)return o.initialOptions.availableLanguages;if(o.initialOptions.staticData){const e=Object.keys(o.initialOptions.staticData).map((e=>b(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?r.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:u(e.apiUrl)}):void 0}});return r}(t.onLanguageChange,t.onPendingLanguageChange,t.onRunningChange),d=T(g.getLanguage,g.getInitialOptions,g.getAvailableLanguages,E,x,P,O,t),h=L(t,d.getBackendRecord,d.getBackendDevRecord,g.withDefaultNs,g.isInitialLoading,o,i);let v;function m(){return g.getFallbackNs()}function y(e){return g.getDefaultNs(e)}function E(e){return[...s(y(e)),...m()]}function w(e){return[...s(null!=e?e:y()),...g.getRequiredNamespaces()]}function O(e,t,n){const a=g.withDefaultNs(e),o=h.getTranslation(a,t);return h.changeTranslation(a,t,n),{revert(){h.changeTranslation(a,t,o)}}}function A(e){g.init(e),h.addStaticData(g.getInitialOptions().staticData)}function k(e,t){const n=g.getFallbackLangs(e),a=w(t),o=[];return n.forEach((e=>{a.forEach((t=>{h.exists({language:e,namespace:t},!0)||o.push({language:e,namespace:t})}))})),o}function R(e,t){const n=k(e,t);if(n.length)return a(D.loadRecords(n),(()=>{}))}function x({key:e,ns:t}){const n=g.getFallbackLangs(),a=E(null!=t?t:void 0);return h.getTranslationNs(a,n,e)}function P({key:e,ns:t,language:n}){const a=E(null!=t?t:void 0),o=g.getFallbackLangs(n);return h.getTranslationFallback(a,o,e)}function S(){const e=a(function(){if(g.getLanguage())return;return a(d.getInitialLanguage(),(e=>{const t=e||g.getInitialOptions().defaultLanguage;t&&g.setLanguage(t)}))}(),(()=>R()));if(n(e))return g.setInitialLoading(!0),o.notify(),i.notify(),Promise.resolve(e).then((()=>{g.setInitialLoading(!1),o.notify(),i.notify(),t.onInitialLoaded.emit()}));t.onInitialLoaded.emit()}e&&A(e),t.onUpdate.listen((()=>{g.isRunning()&&d.retranslate()}));const D=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),g),d),h),{init:A,getTranslation:P,changeTranslation:O,getTranslationNs:x,getDefaultAndFallbackNs:E,findPositions:d.findPositions,getRequiredRecords:k,async changeLanguage(e){g.getPendingLanguage()===e&&g.getLanguage()===e||(g.setPendingLanguage(e),g.isRunning()&&await R(e),e===g.getPendingLanguage()&&(g.setLanguage(e),await d.setStoredLanguage(e)))},async addActiveNs(e,t){t||g.addActiveNs(e),g.isRunning()&&await R(void 0,e)},loadRecords:e=>h.loadRecords(e,D.isDev()),loadRecord:async e=>(await D.loadRecords([e]))[0],isLoading:e=>h.isLoading(g.getLanguage(),e),isLoaded(e){const t=g.getLanguage();if(!t)return!1;const n=g.getFallbackLangs(t),a=w(e),o=[];return n.forEach((e=>{a.forEach((t=>{h.exists({language:e,namespace:t})||o.push({language:e,namespace:t})}))})),0===o.length},t:(...e)=>{const t=C(...e),n=P(t);return d.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:()=>Boolean(g.getInitialOptions().apiKey&&g.getInitialOptions().apiUrl),run:()=>(function(){if((d.getLanguageDetector()||d.getLanguageStorage())&&!g.getAvailableLanguages())throw new Error(r("availableLanguages"));if(!g.getLanguage()&&!g.getInitialOptions().defaultLanguage)throw new Error(r(["defaultLanguage","language"]))}(),g.isRunning()||(g.setRunning(!0),d.run(),v=S()),Promise.resolve(v)),stop(){g.isRunning()&&(d.stop(),g.setRunning(!1))}}));return D}const x=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=k(e.options,n),t),init(t){const n=function(e){const t=R({options:e});function n(e){const n=t.isRunning();n&&t.stop(),e(),t.isDev()&&t.invalidate(),n&&t.run()}t.isDev()&&t.invalidate();const a=Object.freeze({on:t.on,onNsUpdate:t.onUpdate.listenSome,setEmitterActive:t.setEmitterActive,getLanguage:t.getLanguage,getPendingLanguage:t.getPendingLanguage,changeLanguage:t.changeLanguage,changeTranslation:t.changeTranslation,addActiveNs:t.addActiveNs,removeActiveNs:t.removeActiveNs,loadRecords:t.loadRecords,loadRecord:t.loadRecord,addStaticData:t.addStaticData,getRecord:t.getRecord,getAllRecords:t.getAllRecords,isLoaded:t.isLoaded,getRequiredRecords:t.getRequiredRecords,isInitialLoading:t.isInitialLoading,isLoading:t.isLoading,isFetching:t.isFetching,isRunning:t.isRunning,run:t.run,stop:t.stop,t:t.t,highlight:t.highlight,findPositions:t.findPositions,getInitialOptions:t.getInitialOptions,isDev:t.isDev,wrap:t.wrap,unwrap:t.unwrap,overrideCredentials(e){n((()=>t.overrideCredentials(e)))},addPlugin(e){e&&n((()=>t.addPlugin(a,e)))},updateOptions(e){e&&n((()=>t.init(e)))}});return a}(k(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},P=0,S=1,D=2;class I extends Error{constructor(e,t,n){let a;a=e===P?"Empty parameter":e===S?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${t} in "${n}"`),this.code=e,this.index=t}}function U(e){return/\s/.test(e)}const F=0,_=1,$=2,M=3,K=4,B=new Set([$,_,F]),V="'",z=new Set(["{","}",V]),W=e=>/[0-9a-zA-Z_]/.test(e);function Y(e,t){const[n,a]=function(e){let t=F,n="",a="",o="";const r=[],i=[];let s=0;function l(t){throw new I(t,s,e)}const c=()=>{r.push(n),n=""},u=()=>{""===a&&l(P),i.push(a),a=""};for(s=0;s<e.length;s++)switch(o=e[s],t){case F:o===V?(n+=o,t=_):"{"===o?(c(),t=M):(n+=o,t=F);break;case _:z.has(o)?(n=n.slice(0,-1)+o,t=$):(n+=o,t=F);break;case $:o===V?t=F:(n+=o,t=$);break;case M:"}"===o?(u(),t=F):U(o)?""!==a&&(u(),t=K):(W(o)||l(S),a+=o,t=M);break;case K:"}"==o?t=F:U(o)?t=K:l(S)}return B.has(t)||l(D),c(),[r,i]}(e),o=[n[0]];for(let r=1;r<n.length;r++){const i=null==t?void 0:t[a[r-1]];if(void 0===i)throw new Error(`Missing parameter "${a[r-1]}" in "${e}"`);o.push(String(i)),o.push(n[r])}return o.join("")}const H=()=>(e,t)=>(t.setFinalFormatter({format:({translation:e,params:t})=>Y(e,t)}),e),X="__tolgee_dev_tools",G="__tolgee_preferredLanguages",q="data-tolgee-key-only",J="data-tolgee-restricted",Z="_tolgee",Q="_tolgee-highlighter";function ee(){var e,t;return void 0===(null==(t=null==(e=globalThis.window)?void 0:e.document)?void 0:t.createElement)}function te(e){if(ee())throw new Error(`${e}: Can't run on the server`)}function ne(e,t){return{oldTextContent:e,keys:t}}function ae(e){return e.textContent}function oe(e,t){e.textContent=t}function re(e,t){var n;const a=void 0===e.key||void 0===t.key||t.key===e.key,o=void 0===e.ns||void 0===t.ns||-1!==(null==(n=e.ns)?void 0:n.findIndex((e=>{var n;return null==(n=t.ns)?void 0:n.includes(e)})));return a&&o}const ie={position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"};function se({highlightColor:e,highlightWidth:t}){return Object.freeze({initHighlighter(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;const o=function(e){for(;e;){if(null!==e.getAttribute("disabled"))return!1;e=e.parentElement}return!0}(n);let r=a.highlightEl;r||(r=document.createElement("div"),r.classList.add(Q),Object.entries(ie).forEach((([e,t])=>{r.style[e]=t})),r.style.borderColor=e,a.highlightEl=r,document.body.appendChild(r));const i=n.getBoundingClientRect();r.style.pointerEvents=o?"none":"auto",r.style.borderWidth=t+"px",r.style.top=i.top-t+"px",r.style.left=i.left-t+"px",r.style.width=i.width+"px",r.style.height=i.height+"px"}}(n,a),function(e,t){t.unhighlight=()=>{var e;null==(e=t.highlightEl)||e.remove(),t.highlightEl=void 0}}(0,a)}})}const le={capture:!0},ce={capture:!0,passive:!0},ue=new Map([["Control","ctrlKey"],["Alt","altKey"],["Meta","metaKey"],["Shift","shiftKey"]]);function ge({highlightKeys:e,elementStore:t,onClick:n,options:a}){var o,r;const i=new Set;let s,l,c=[];const u=(null==(o=a.targetElement)?void 0:o.getRootNode())||document,g=(null==(r=a.targetElement)?void 0:r.ownerDocument)||document;function d(){var e;const n=t.get(s);n&&(n.preventClean=!1,null==(e=n.unhighlight)||e.call(n),s=void 0)}function f(){const e=l;let n;if(e&&A()){n=function(e){for(const n of e){const e=O(n,(e=>t.get(e)));if(void 0!==e)return e||void 0}}(u.elementsFromPoint(e.x,e.y)||[])}!function(e){var n;if(s!==e){d();const a=t.get(e);a&&(a.preventClean=!0,null==(n=a.highlight)||n.call(a),s=e)}}(n)}function p(e){l=e,f()}function h(e){for(const[t,n]of ue.entries())i.has(t)&&!e[n]?i.delete(t):!i.has(t)&&e[n]&&i.add(t)}function v(e){var t;h(e),A()&&(t=e.target,!Boolean(O(t,(e=>e.id===X))))&&(e.stopPropagation(),e.preventDefault())}function m(e){h(e),p({x:e.clientX,y:e.clientY})}function y(e){h(e),f()}function b(e){h(e),f()}function E(){var e;const n=t.get(s);null==(e=null==n?void 0:n.highlight)||e.call(n)}function L(e){v(e),h(e),p({x:e.clientX,y:e.clientY}),A()&&s&&(n(s),d())}function w(e,t,n){g.addEventListener(e,t,n),c.push([e,t,n])}function O(e,t){return e.id===X?null:t(e)?e:(null==e?void 0:e.parentElement)?O(e.parentElement,t):void 0}function A(){for(const t of e)if(!i.has(t))return!1;return!0}return Object.freeze({stop(){!function(){for(const e of c)g.removeEventListener(...e);c=[]}()},run(){w("keydown",y,le),w("keyup",b,le),w("mousemove",m,ce),w("scroll",E,ce),w("click",L,le),w("mouseenter",v,le),w("mouseover",v,le),w("mouseout",v,le),w("mouseleave",v,le),w("mousedown",v,le),w("mouseup",v,le)}})}function de(e,t,n){const a=se({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),o=ge({highlightKeys:e.highlightKeys,elementStore:t,onClick(e){const a=t.get(e);n({target:e,keysAndDefaults:l(a)})},options:e});function r(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${J}]`)}function s(e,n){var a;n.highlightEl&&(null==(a=n.unhighlight)||a.call(n)),e.removeAttribute(Z),t.remove(e)}function l(e){return function(e){return Array.from(e.nodes.values()).reduce(((e,t)=>[...e,...t.keys.map((e=>({key:e.key,defaultValue:e.defaultValue,ns:e.ns})))]),[])}(e)}return Object.freeze({isRestricted:r,register(e,n,o){if(r(e))return;const i=e;let s=t.get(i);s||(s=function(e){return{element:e,nodes:new Map}}(i),t.set(i,s),i.setAttribute(Z,"true")),s.nodes.set(n,o),a.initHighlighter(i,s)},forEachElement:t.forEachElement,cleanupLingeringKeyAttributes(){t.forEachElement(((e,t)=>{if(!t.preventClean){for(const[e]of t.nodes)if(e.nodeType===Node.ATTRIBUTE_NODE){const n=e;n.name===q&&null===n.ownerElement&&t.nodes.delete(n)}0===t.nodes.size&&s(e,t)}}))},cleanupRemovedNodes(e){t.forEachElement(((t,n)=>{n.preventClean||(e.has(t)||function(e,t){for(const[n]of e.nodes)t.has(n)&&e.nodes.delete(n)}(n,e),(e.has(t)||0===n.nodes.size)&&s(t,n))}))},findAll(e,n){const a=[];return t.forEachElement(((t,o)=>{for(const t of o.nodes.values()){if(t.keys.find((t=>re({key:e,ns:i(n)},{key:t.key,ns:i(t.ns)})))){a.push(o);break}}})),a},run(e){e&&o.run()},stop(){o.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null==(n=t.unhighlight)||n.call(t))}))}})}function fe(){let e,t=!1;const n=function(){const e=new Map;return Object.freeze({set(t,n){e.set(t,n)},get:t=>t&&e.get(t),remove:t=>e.delete(t),forEachElement(t){e.forEach(((e,n)=>t(n,e)))}})}();function a({mouseHighlight:e,options:a,wrapper:o,onClick:r}){if(ee())return{stop(){t=!1},wrapper:o};const i=function(e){const t=Object.freeze({getSuitableParent(n){const a=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(n);if(void 0===a)throw console.error(n),new Error("No suitable parent found for node above.");if(!e.passToParent)return a;if(Array.isArray(e.passToParent)){const t=e=>a.tagName.toLowerCase()===e.toLowerCase();if(-1===e.passToParent.findIndex(t))return a}return"function"!=typeof e.passToParent||e.passToParent(a)?t.getSuitableParent(a):a}});return t}(a),s=function(e,t){const n=Object.freeze({handleAttributes(n,a=!0){const o=[],r=Object.fromEntries(Object.entries(e.tagAttributes).map((([e,t])=>[e.toUpperCase(),t])));if(n.nodeType===Node.ELEMENT_NODE){const e=n;let a=r[e.tagName.toUpperCase()]??[];"*"in r&&(a=a.concat(r["*"])),o.push(...a.filter((t=>e.hasAttribute(t))).map((t=>e.getAttributeNode(t))).filter((e=>t.testAttribute(e))))}if(a){const e=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,(e=>{var t,n;return(null==(t=r[e.tagName.toUpperCase()])?void 0:t.some((t=>e.hasAttribute(t))))||(null==(n=r["*"])?void 0:n.some((t=>e.hasAttribute(t))))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}));for(;e.nextNode();){const n=e.currentNode;let a=r[n.tagName.toUpperCase()]??[];"*"in r&&(a=a.concat(r["*"])),o.push(...a.filter((e=>n.hasAttribute(e))).map((e=>n.getAttributeNode(e))).filter((e=>t.testAttribute(e))))}}return o},handleChildList(e){const t=[];return t.push(...e.flatMap((e=>n.handleAttributes(e,!0)))),t.push(...e.flatMap((e=>n.handleText(e)))),t},handleText(e){if(e.nodeType===Node.TEXT_NODE)return t.testTextNode(e)?[e]:[];const n=[],a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,(e=>t.testTextNode(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;a.nextNode();)n.push(a.currentNode);return n}});return n}(a,o),l=de(a,n,r);function c(e){for(const t of e){const e=t.parentElement;if(e&&l.isRestricted(e))continue;const n=ae(t),a=n?o.unwrap(n):null;if(a){const{text:e,keys:o}=a;oe(t,e);const r=ne(n,o),s=i.getSuitableParent(t);l.register(s,t,r)}}}function u(e){const t=i.getSuitableParent(e);l.register(t,e,{oldTextContent:"",keys:[{key:ae(e)}],keyAttributeOnly:!0})}function g(e,t){if(e.nodeType===Node.ATTRIBUTE_NODE){const t=e;if(t.name===q)return void u(t)}if(e.nodeType===Node.ELEMENT_NODE){const t=e.getAttributeNode(q);t&&u(t)}if(!t)return;const n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,(e=>e.hasAttribute(q)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;n.nextNode();){u(n.currentNode.getAttributeNode(q))}}const d=new MutationObserver((e=>{if(!t)return;const n=e.filter((e=>"childList"===e.type)).flatMap((e=>Array.from(e.removedNodes))),a=new Set(n);for(const e of n){if(e.nodeType===Node.ELEMENT_NODE)for(let t=0;t<e.attributes.length;t++)a.add(e.attributes[t]);const t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(;t.nextNode();){const e=t.currentNode;if(e.nodeType===Node.ELEMENT_NODE){const t=e;for(let e=0;e<t.attributes.length;e++)a.add(t.attributes[e])}a.add(e)}}a.size>0&&l.cleanupRemovedNodes(a),e.some((e=>"attributes"===e.type&&e.attributeName===q))&&l.cleanupLingeringKeyAttributes();const o=new Set;for(const t of e)switch(t.type){case"characterData":s.handleText(t.target).forEach((e=>o.add(e)));break;case"childList":g(t.target,!0),t.addedNodes.length>0&&s.handleChildList(Array.from(t.addedNodes)).forEach((e=>o.add(e))),t.removedNodes.length>0&&s.handleChildList(Array.from(t.removedNodes)).forEach((e=>o.delete(e)));break;case"attributes":t.attributeName===q&&g(t.target,!1),s.handleAttributes(t.target,!1).forEach((e=>o.add(e)))}c([...o])})),f=a.targetElement||document.body;t=!0,l.run(e),g(f,!0),c(s.handleChildList([f]));const p=new Set;return p.add(q),Object.values(a.tagAttributes).forEach((e=>e.forEach((e=>p.add(e.toLowerCase()))))),d.observe(f,{attributes:!0,attributeFilter:[...p],childList:!0,subtree:!0,characterData:!0}),{stop(){t=!1,l.stop(),d.disconnect()},elementRegistry:l,wrapper:o}}return Object.freeze({run(t){e=a(t)},stop(){null==e||e.stop()},forEachElement(t){var n,a;null==(a=null==(n=null==e?void 0:e.elementRegistry)?void 0:n.forEachElement)||a.call(n,t)},highlight(t,n){var a;const o=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[];return o.forEach((e=>{var t;return null==(t=e.highlight)?void 0:t.call(e)})),{unhighlight(){o.forEach((e=>{var t;return null==(t=e.unhighlight)?void 0:t.call(e)}))}}},findPositions(t,n){var a;const o=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[],r=[];return o.sort(((e,t)=>e.element.compareDocumentPosition(t.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)),o.forEach((e=>{const a=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{re({key:t,ns:i(n)},{key:e.key,ns:i(e.ns)})&&r.push({position:{x:a.x,y:a.y,width:a.width,height:a.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),r},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})}var pe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},he={};!function(e){function t(e){for(var t=0,n=Math.min(65536,e.length+1),a=new Uint16Array(n),o=[],r=0;;){var i=t<e.length;if(!i||r>=n-1){var s=a.subarray(0,r);if(o.push(String.fromCharCode.apply(null,s)),!i)return o.join("");e=e.subarray(t),t=0,r=0}var l=e[t++];if(0==(128&l))a[r++]=l;else if(192==(224&l)){var c=63&e[t++];a[r++]=(31&l)<<6|c}else if(224==(240&l)){c=63&e[t++];var u=63&e[t++];a[r++]=(31&l)<<12|c<<6|u}else if(240==(248&l)){var g=(7&l)<<18|(c=63&e[t++])<<12|(u=63&e[t++])<<6|63&e[t++];g>65535&&(g-=65536,a[r++]=g>>>10&1023|55296,g=56320|1023&g),a[r++]=g}}}var n="Failed to ",a=function(e,t,a){if(e)throw new Error("".concat(n).concat(t,": the '").concat(a,"' option is unsupported."))},o="function"==typeof Buffer&&Buffer.from,r=o?function(e){return Buffer.from(e)}:function(e){for(var t=0,n=e.length,a=0,o=Math.max(32,n+(n>>>1)+7),r=new Uint8Array(o>>>3<<3);t<n;){var i=e.charCodeAt(t++);if(i>=55296&&i<=56319){if(t<n){var s=e.charCodeAt(t);56320==(64512&s)&&(++t,i=((1023&i)<<10)+(1023&s)+65536)}if(i>=55296&&i<=56319)continue}if(a+4>r.length){o+=8,o=(o*=1+t/e.length*2)>>>3<<3;var l=new Uint8Array(o);l.set(r),r=l}if(0!=(4294967168&i)){if(0==(4294965248&i))r[a++]=i>>>6&31|192;else if(0==(4294901760&i))r[a++]=i>>>12&15|224,r[a++]=i>>>6&63|128;else{if(0!=(4292870144&i))continue;r[a++]=i>>>18&7|240,r[a++]=i>>>12&63|128,r[a++]=i>>>6&63|128}r[a++]=63&i|128}else r[a++]=i}return r.slice?r.slice(0,a):r.subarray(0,a)};function i(){this.encoding="utf-8"}i.prototype.encode=function(e,t){return a(t&&t.stream,"encode","stream"),r(e)};var s=!o&&"function"==typeof Blob&&"function"==typeof URL&&"function"==typeof URL.createObjectURL,l=["utf-8","utf8","unicode-1-1-utf-8"],c=t;o?c=function(e,t){return(e instanceof Buffer?e:Buffer.from(e.buffer,e.byteOffset,e.byteLength)).toString(t)}:s&&(c=function(e){try{return function(e){var t;try{var n=new Blob([e],{type:"text/plain;charset=UTF-8"});t=URL.createObjectURL(n);var a=new XMLHttpRequest;return a.open("GET",t,!1),a.send(),a.responseText}finally{t&&URL.revokeObjectURL(t)}}(e)}catch(n){return t(e)}});var u="construct 'TextDecoder'",g="".concat(n," ").concat(u,": the ");function d(e,t){if(a(t&&t.fatal,u,"fatal"),e=e||"utf-8",!(o?Buffer.isEncoding(e):-1!==l.indexOf(e.toLowerCase())))throw new RangeError("".concat(g," encoding label provided ('").concat(e,"') is invalid."));this.encoding=e,this.fatal=!1,this.ignoreBOM=!1}d.prototype.decode=function(e,t){var n;return a(t&&t.stream,"decode","stream"),n=e instanceof Uint8Array?e:e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer):new Uint8Array(e),c(n,this.encoding)},e.TextEncoder=e.TextEncoder||i,e.TextDecoder=e.TextDecoder||d}("undefined"!=typeof window?window:pe);const ve=t({__proto__:null,default:he},[he]);null==(e=console.assert)||e.call(console,ve);const me=["",""],ye=RegExp(`([${me.join("")}]{9})+`,"gu");function be(e){const t=function(e){return Array.from((new TextEncoder).encode(e))}(e).map(Number),n=t.map((e=>function(e){const t=8-e.length;return"0".repeat(t)+e}(e.toString(2))+"0")).join("");return Array.from(n).map((e=>me[Number(e)])).join("")}function Ee(e){const t=Array.from(e).map((e=>me.indexOf(e))).map(String).join("").match(/(.{9})/g),n=Uint8Array.from((null==t?void 0:t.map((e=>parseInt(e.slice(0,8),2))))||[]);return a=n,(new TextDecoder).decode(new Uint8Array(a));var a}function Le({fullKeyEncode:e}){const t=function(){const e=[];return Object.freeze({valueToNumber(t){let n=e.indexOf(t);return-1===n&&(n=e.length,e.push(t)),n},numberToValue:t=>e[t]})}();function n(e){const t={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(t)}return Object.freeze({unwrap(e){const n=[],a=function(e){var t;const n=null==(t=e.match(ye))?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(Ee))||[]}(e);a.forEach((e=>{const a=function(e){if(e.length<=4){const[n]=function(e){const t=[];for(const n of e)t.push(n.codePointAt(0));return t}(e);return t.numberToValue(n)}return e}(e),o=function(e){try{return JSON.parse(e||"{}")}catch(e){return void console.error(e)}}(a);if(o){const{k:e,d:t,n:a}=o;n.push({key:e,defaultValue:t,ns:a})}}));const o=function(e){return e.replace(ye,"")}(e);return{text:o,keys:n}},wrap({key:a,defaultValue:o,translation:r,ns:i}){let s;if(e){s=be(n({key:a,ns:i}))}else{const e=n({key:a,ns:i,defaultValue:o}),r=t.valueToNumber(e);s=be(String.fromCodePoint(r))}const l=r||"";return"string"==typeof l?l+s:l},testTextNode(e){var t,n;return((null==(t=e.textContent)?void 0:t.includes(`${me[0]}${me[0]}`))||(null==(n=e.textContent)?void 0:n.includes(`${me[1]}${me[0]}`)))??!1},testAttribute:e=>e.value.includes(`${me[0]}${me[0]}`)||e.value.includes(`${me[1]}${me[0]}`)})}function we(e,t){let n=0;for(;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}function Oe({inputPrefix:e,inputSuffix:t,translate:n}){function a(e){const{key:t,params:a,defaultValue:o,ns:r}=function(e){let t=!1,n="",a="",o="KEY";const r={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{r.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==o||","!==s?"KEY"!==o||"|"!==s?"NAMESPACE"!==o||","!==s?"KEY"!==o||":"!==s?"DEFAULT_VALUE"!==o||":"!==s?"PARAM_NAME"!==o||":"!==s?"PARAM_VALUE"!==o||","!==s?n+=s:(o="PARAM_NAME",r.params[a]=n,n=""):(o="PARAM_VALUE",a=n,n=""):(o="PARAM_NAME",r.defaultValue=n,n=""):(o="PARAM_NAME",r.key=n,n=""):(o="DEFAULT_VALUE",i(n),n=""):(o="NAMESPACE",r.key=n,n=""):(o="DEFAULT_VALUE",r.key=n,n=""):t=!0;return"KEY"===o&&(r.key=n),"DEFAULT_VALUE"===o&&(r.defaultValue=n),"PARAM_VALUE"===o&&(r.params[a]=n),"NAMESPACE"===o&&i(n),r}(e);return{translated:n({key:t,params:a,defaultValue:o,ns:r,noWrap:!0}),key:t,params:a,defaultValue:o,ns:r}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r(e){return"string"==typeof e?e.replace(/[,:|\\]/gs,"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn(`Parameters of type "${typeof e}" are not supported in "text" wrapper mode.`),e)}return Object.freeze({wrap({key:n,params:a,defaultValue:o,ns:i}){let s=Object.entries(a||{}).map((([e,t])=>`${r(e)}:${r(t)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==o?`,${r(o)}`:"",c="string"==typeof i?[i]:i,u=(null==c?void 0:c.length)?`|${c.map((e=>r(e))).join("|")}`:"";return`${e}${r(n)}${u}${l}${s}${t}`},unwrap(n){const r=new RegExp(`(\\\\?)(${o(e)}(.*?)${o(t)})`,"gs"),i=[];let s,l=!1,c=0,u="";for(;null!==(s=r.exec(n));){let e=s[1];const[t,o,r,g]=s,{index:d,input:f}=s;if(u+=f.substr(c,d-c),c=d+t.length,"\\"===e){if(!we(d,n)){u+=r;continue}e=""}const p=a(g);i.push({key:p.key,params:p.params,defaultValue:p.defaultValue,ns:p.ns}),l=!0,u+=e+p.translated}return u+=n.substring(c),l?{text:u,keys:i}:{text:n,keys:[]}},testTextNode(n){var a,o;return((null==(a=n.textContent)?void 0:a.includes(e))&&(null==(o=n.textContent)?void 0:o.includes(t)))??!1},testAttribute:n=>n.value.includes(e)&&n.value.includes(t)})}const Ae=()=>(e,t)=>("text"===e.getInitialOptions().observerType?t.setObserver((()=>{const e=fe();return Object.freeze({...e,run(t){const n=Oe({inputPrefix:t.options.inputPrefix,inputSuffix:t.options.inputSuffix,translate:t.translate});e.run({...t,wrapper:n})},retranslate(){e.forEachElement(((t,n)=>{for(const[t,a]of n.nodes.entries()){if(a.keyAttributeOnly)return;const n=e.unwrap(a.oldTextContent);n&&oe(t,n.text)}}))},outputNotFormattable:!0})})):t.setObserver((()=>{const e=fe();return Object.freeze({...e,run(t){const n=Le({fullKeyEncode:t.options.fullKeyEncode});e.run({...t,wrapper:n})},retranslate(){},outputNotFormattable:!1})})),e),ke="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function Ne(e){const t=ke.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function Te(e){const t=(e=e.toUpperCase()).length;let n=0,a=0,o=0;const r=new Uint8Array(5*t/8|0);for(let i=0;i<t;i++)a=a<<5|Ne(e[i]),n+=5,n>=8&&(r[o++]=a>>>n-8&255,n-=8);return function(e){const t=new Uint8Array(e),n=t.length;let a="",o=Math.pow(2,16)-1;for(let e=0;e<n;e+=o)e+o>n&&(o=n-e),a+=String.fromCharCode.apply(null,t.subarray(e,e+o));return a}(r.buffer)}function je(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=Te(n).split("_");return Number(e)}}catch{console.warn("Tolgee: Api key can't be parsed")}}const Ce=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:o,fetch:r}){const i=je(t)??o;let s=void 0!==i?`${e}/v2/projects/${i}/translations/${n}`:`${e}/v2/projects/translations/${n}`;if(a&&(s+=`?ns=${a}`),"tgpat"===function(e){if(!e)return;const[t]=e.split("_");return"tgpak"===t?"tgpak":"tgpat"===t?"tgpat":"legacy"}(t)&&void 0===o)throw new Error("You need to specify 'projectId' when using PAT key");return r(s,{headers:{"X-API-Key":t||"","Content-Type":"application/json"}}).then((e=>{if(e.ok)return e.json().then((e=>e[n]));throw new Error(e.statusText)}))}}),e);function Re({message:e,recievingMessage:t,data:n,attempts:a=1,timeout:o=300}){let r=!1;const i=()=>new Promise(((a,r)=>{const i=function(e,t){const n=n=>{var a,o;e.includes(null==(a=n.data)?void 0:a.type)&&t(null==(o=n.data)?void 0:o.data)};return window.addEventListener("message",n,!1),{unsubscribe(){window.removeEventListener("message",n)}}}(t,(function(e){clearTimeout(s),l(),a(e)}));window.postMessage({type:e,data:n},window.origin);const s=setTimeout((function(){l(),r()}),o);function l(){i.unsubscribe()}}));return{cancel(){r=!0},promise:(async()=>{for(let e=0;e<a;e++){if(r)return new Promise((()=>{}));try{return await i()}catch(e){continue}}if(!r)throw`Didn't recieve ${t.join(" or ")} in time.`;return new Promise((()=>{}))})()}}let xe=null;function Pe(e){var t;return xe||(xe=(t=`https://cdn.jsdelivr.net/npm/@tolgee/web@${e}/dist/tolgee-in-context-tools.umd.min.js`,new Promise(((e,n)=>{const a=document.createElement("script");a.src=t,a.addEventListener("load",(()=>e())),a.addEventListener("error",(e=>n(e.error))),document.head.appendChild(a)}))).then((()=>window["@tolgee/in-context-tools"].InContextTools))),xe}const Se="__tolgee_apiKey",De="__tolgee_apiUrl";function Ie(){const e=sessionStorage.getItem(Se)||void 0,t=sessionStorage.getItem(De)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function Ue(){sessionStorage.removeItem(Se),sessionStorage.removeItem(De)}let Fe=()=>e=>e;(()=>{if("undefined"==typeof window)return!1;try{return"undefined"!=typeof sessionStorage&&sessionStorage}catch(e){return console.error("sessionStorage not available",e),!1}})()&&(Fe=()=>e=>{const t=function(){let e;return{update:async function(t){null==e||e();const{cancel:n,promise:a}=Re({message:"TOLGEE_READY",recievingMessage:["TOLGEE_PLUGIN_READY","TOLGEE_PLUGIN_UPDATED"],data:t,attempts:4});return e=n,a}}}();e.on("running",(({value:n})=>{var a;n&&(a=()=>{t.update({uiPresent:!0,uiVersion:void 0,mode:e.isDev()?"development":"production",config:{apiUrl:e.getInitialOptions().apiUrl||"",apiKey:e.getInitialOptions().apiKey||""}}).catch(Ue)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Ie()&&(async()=>{const e=await Pe("5.28.2-prerelease.2842344b.0");return t=>{const n=Ie();return t.addPlugin(e({credentials:n})),t}})().then((t=>{e.addPlugin(t)})).catch((e=>{console.error("Tolgee: Failed to load in-context tools"),console.error(e)})),e});const _e="__tolgee_currentLanguage";const $e=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(te("LanguageStorage"),localStorage.getItem(_e)||void 0),setLanguage(e){te("LanguageStorage"),localStorage.setItem(_e,e)}}),e);const Me=()=>(e,t)=>(t.setLanguageDetector({getLanguage({availableLanguages:e}){te("LanguageDetector");const t=window.navigator.language,n=e.find((e=>e===t));if(n)return n;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),o=a(window.navigator.language);return e.find((e=>a(e)===o))||void 0}}),e);function Ke(e){return e.endsWith("/")?e.slice(0,-1):e}const Be={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${Ke(n)}/${e}/${t}.json`:`${Ke(n)}/${t}.json`,getData:function(e){return e.json()},headers:{Accept:"application/json"}};const Ve=e=>(t,n)=>(n.addBackend(function(e){const{prefix:t,getPath:n,getData:a,headers:o,...r}={...Be,...e,headers:{...Be.headers,...null==e?void 0:e.headers}};return{getRecord:({namespace:e,language:i,fetch:s})=>s(n({namespace:e,language:i,prefix:t}),{headers:o,...r}).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return a(e)}))}}(e)),t);function ze(){return x().use(Fe())}const We=()=>e=>e;export{Ve as BackendFetch,Fe as BrowserExtensionPlugin,X as DEVTOOLS_ID,Ce as DevBackend,We as DevTools,H as FormatSimple,Me as LanguageDetector,v as LanguageDetectorError,$e as LanguageStorage,m as LanguageStorageError,Ae as ObserverPlugin,G as PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY,h as RecordFetchError,Z as TOLGEE_ATTRIBUTE_NAME,J as TOLGEE_RESTRICT_ATTRIBUTE,q as TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE,ze as Tolgee,x as TolgeeCore,d as createFetchFunction,i as getFallback,s as getFallbackArray,je as getProjectIdFromApiKey,C as getTranslateProps}; | ||
//# sourceMappingURL=tolgee-web.production.esm.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/web"]={})}(this,(function(e){"use strict";var t;function n(e,t){for(var n=0;n<t.length;n++){const a=t[n];if("string"!=typeof a&&!Array.isArray(a))for(const t in a)if("default"!==t&&!(t in e)){const n=Object.getOwnPropertyDescriptor(a,t);n&&Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>a[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function a(e){return Boolean(e&&"function"==typeof e.then)}function o(e,t){return a(e)?Promise.resolve(e).then(t):t(e)}function r(e,t,n){function o(n){const a=t(n);throw e.emit(a),console.error(a),a}try{const e=n();return a(e)?e.catch(o):e}catch(e){o(e)}}function i(e){const t=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),n=t.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...t.slice(0,-2),n].join(", ")} option`}function s(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function l(e){return s(e)||[]}function c(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?l(t):l(null==t?void 0:t[e]);var n}function u(e){return Array.from(new Set(e))}function g(e){return e?e.replace(/\/+$/,""):e}const d=(e,t)=>fetch(e,t),f=(e=d)=>(t,n)=>e(t,Object.assign(Object.assign({},n),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":"5.28.1"},null==n?void 0:n.headers)}));function p(e){let t=[];return Object.freeze({listen(e){const n=t=>{e(t)};return t.push(n),{unsubscribe(){t=t.filter((e=>n!==e))}}},emit(n){e()&&t.forEach((e=>e({value:n})))}})}function h(e,t,n){const a=new Set,o=new Set;let r=[];function i(){if(0===r.length)return;const e=r;r=[],a.forEach((e=>{e({value:void 0})}));let n=new Set;e.forEach((e=>{void 0===e?n=void 0:void 0!==n&&e.forEach((e=>n.add(e)))}));!function(e){const n=new Set(t());o.forEach((t=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>n.has(e)||t.namespaces.has(e)))))&&t.fn({value:void 0})}))}(n?Array.from(n.keys()):void 0)}return Object.freeze({emit(t,n){e()&&(r.push(t),n?setTimeout(i,0):i())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const t={fn:t=>{e(t)},namespaces:new Set};o.add(t);const a={unsubscribe:()=>{o.delete(t)},subscribeNs:e=>(l(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a}})}class v extends Error{constructor(e,t,n=!1){const{language:a,namespace:o}=e;super(`Tolgee: Failed to fetch record for "${a}"${o&&` and "${o}"`}`),this.cause=t,this.isDev=n,this.name="RecordFetchError",this.language=a,this.namespace=o}}class m extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageDetectorError"}}class y extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageStorageError"}}const b=e=>{const t=new Map;return Object.entries(e).forEach((([e,n])=>{null!=n&&("object"!=typeof n?t.set(e,n):b(n).forEach(((n,a)=>{t.set(e+"."+a,n)})))})),t},E=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},L=({language:e,namespace:t})=>t?`${e}:${t}`:e;function w(e,t,n,o,r,i,s){const c=new Map,g=new Map;let d={},f=0;function p(t,n,a){const o=L(t);g.set(o,{data:b(n),version:a}),e.onCacheChange.emit(t)}async function h(o,r){let i;if(r)try{i=await n(o)}catch(t){const n=new v(o,t,!0);e.onError.emit(n),console.warn(n)}return i||(i=await async function(n){let o;const r=d[L(n)];return"function"==typeof r&&(o=r()),o||(o=t(n)),a(o)?null==o?void 0:o.catch((t=>{const a=new v(n,t);throw e.onError.emit(a),console.error(a),a})):o}(o)),i}const m=Object.freeze({addStaticData(e){e&&(d=Object.assign(Object.assign({},d),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=E(e),a=g.get(e);a&&0!==a.version||p(n,t,0)}})))},invalidate(){c.clear(),f+=1},addRecord(e,t){p(e,t,f)},exists(e,t=!1){const n=g.get(L(e));return n&&t?n.version===f:Boolean(n)},getRecord(e){var t;return null===(t=g.get(L(o(e))))||void 0===t?void 0:t.data},getTranslation(e,t){var n;return null===(n=g.get(L(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=g.get(L({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[o]}return u(e)},getTranslationFallback(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=g.get(L({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation(t,n,a){var o;const r=null===(o=g.get(L(t)))||void 0===o?void 0:o.data;null==r||r.set(n,a),e.onCacheChange.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching(e){if(r())return!0;if(void 0===e)return c.size>0;const t=l(e);return Boolean(Array.from(c.keys()).find((e=>t.includes(E(e).namespace))))},isLoading(e,t){const n=l(t);return Boolean(r()||Array.from(c.keys()).find((t=>{const a=E(t);return(!n.length||n.includes(a.namespace))&&!m.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,t){const n=e.map((e=>{const n=o(e),a=L(n),r=c.get(a);if(r)return{new:!1,promise:r,keyObject:n,cacheKey:a};const i=h(n,t)||Promise.resolve(void 0);return c.set(a,i),{new:!0,promise:i,keyObject:n,cacheKey:a}}));i.notify(),s.notify();const a=await Promise.all(n.map((e=>e.promise)));return n.forEach(((e,t)=>{const n=c.get(e.cacheKey)!==e.promise;if(e.new&&!n){c.delete(e.cacheKey);const n=a[t];n?m.addRecord(e.keyObject,n):m.getRecord(e.keyObject)||m.addRecord(e.keyObject,{})}})),i.notify(),s.notify(),n.map((e=>m.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(g.entries()).map((([e,t])=>Object.assign(Object.assign({},E(e)),{data:t.data})))});return m}function O(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n}const A="invalid",T={defaultNs:"",observerOptions:{tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:["Alt"],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"],fullKeyEncode:!1},observerType:"invisible",onFormatError:A,apiUrl:"https://app.tolgee.io",fetch:f(),onTranslationMissing:({key:e})=>e},k=(...e)=>{let t={};return e.forEach((e=>{t=Object.assign(Object.assign(Object.assign({},t),e),{observerOptions:Object.assign(Object.assign({},t.observerOptions),null==e?void 0:e.observerOptions)})})),t};function N(e,t){const n=k(T,null==t?void 0:t.initialOptions,e);return n.apiUrl=g(n.apiUrl),(null==e?void 0:e.fetch)&&(n.fetch=f(e.fetch)),{initialOptions:n,activeNamespaces:(null==t?void 0:t.activeNamespaces)||new Map,language:null==t?void 0:t.language,pendingLanguage:null==t?void 0:t.language,isInitialLoading:!1,isRunning:!1}}function j(e,t,n,a,i,s,l,c){const u={ui:void 0},g={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},d=async({keysAndDefaults:e,target:t})=>{var n;const o=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,fallbackNamespaces:a(t),namespace:i({key:e,ns:t})[0],translation:s({key:e,ns:t})})));null===(n=g.ui)||void 0===n||n.handleElementClick(o,t)},f=(e,t)=>{var n;return(null===(n=g.observer)||void 0===n?void 0:n.findPositions(e,t))||[]};function p(e){const t=s({key:e.key,ns:e.ns});return x.formatTranslation(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))}function h(){return{fetch:t().fetch}}function v(e){g.observer=null==e?void 0:e()}function b(){return Boolean(g.observer)}function E(e){e&&g.formatters.push(e)}function L(e){g.finalFormatter=e}function w(e){u.ui=e}function T(){return Boolean(u.ui)}function k(e){g.languageStorage=e}function N(e){g.languageDetector=e}function j(e){e&&g.backends.push(e)}function R(e){g.devBackend=e}const x=Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:L,addFormatter:E,setObserver:v,hasObserver:b,setUi:w,hasUi:T,setDevBackend:R,addBackend:j,setLanguageDetector:N,setLanguageStorage:k}))},findPositions:f,run(){var e,n;const{apiKey:a,apiUrl:o,projectId:r,observerOptions:i,tagNewKeys:s}=t();g.ui=null===(e=u.ui)||void 0===e?void 0:e.call(u,{apiKey:a,apiUrl:o,projectId:r,highlight:x.highlight,changeTranslation:l,findPositions:f,onPermanentChange:e=>c.onPermanentChange.emit(e),tagNewKeys:s}),null===(n=g.observer)||void 0===n||n.run({mouseHighlight:!0,options:i,translate:p,onClick:d})},stop(){var e;g.ui=void 0,null===(e=g.observer)||void 0===e||e.stop()},getLanguageStorage:()=>g.languageStorage,getInitialLanguage(){const e=n();return o(r(c.onError,(e=>new y("Tolgee: Failed to load language",e)),(()=>{var e;return null===(e=g.languageStorage)||void 0===e?void 0:e.getLanguage(h())})),(t=>e&&!e.includes(t)||!t?function(){if(!g.languageDetector)return;const e=n();return r(c.onError,(e=>new m("Tolgee: Failed to detect language",e)),(()=>{var t;return null===(t=g.languageDetector)||void 0===t?void 0:t.getLanguage(Object.assign({availableLanguages:e},h()))}))}():t))},setStoredLanguage:e=>r(c.onError,(e=>new y("Tolgee: Failed to store language",e)),(()=>{var t;return null===(t=g.languageStorage)||void 0===t?void 0:t.setLanguage(e,h())})),getDevBackend:()=>g.devBackend,getBackendRecord:async({language:e,namespace:t})=>{for(const n of g.backends){const a=await n.getRecord(Object.assign({language:e,namespace:t},h()));if(void 0!==a)return a}},getBackendDevRecord:async({language:e,namespace:n})=>{var a;const{apiKey:o,apiUrl:r,projectId:i}=t();return null===(a=g.devBackend)||void 0===a?void 0:a.getRecord(Object.assign({apiKey:o,apiUrl:r,projectId:i,language:e,namespace:n},h()))},getLanguageDetector:()=>g.languageDetector,retranslate(){var e;null===(e=g.observer)||void 0===e||e.retranslate()},highlight:(e,t)=>{var n,a;return(null===(a=null===(n=g.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},unwrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:()=>Boolean(x.getDevBackend()),formatTranslation(n){var a,{formatEnabled:o}=n,r=O(n,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:c,params:u,ns:d,orEmpty:f}=r,p=null!=s?s:l;let h="";null==s&&(h=t().onTranslationMissing(r));let v=null!=p?p:f?"":h;const m=e(),y=o||!(null===(a=g.observer)||void 0===a?void 0:a.outputNotFormattable),b=e=>g.observer&&!c?g.observer.wrap({key:i,translation:e,defaultValue:l,params:u,ns:d}):e;v=b(v);try{if(p&&m&&y)for(const e of g.formatters)v=e.format({translation:v,language:m,params:u});g.finalFormatter&&p&&m&&y&&(v=g.finalFormatter.format({translation:v,language:m,params:u}))}catch(e){console.error(e);const n=("string"==typeof(E=e)?E:"string"==typeof(null==E?void 0:E.message)?E.message:void 0)||A,a=t().onFormatError,o=typeof a;v="string"===o?a:"function"===o?a(n,r):A,v=b(v)}var E;return v}});return x}const R=(e,t,n)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=t();a!==e&&n(e),a=e}})};const x=(e,...t)=>{let n,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof t[0]?(a.defaultValue=t[0],n=t[1]):"object"==typeof t[0]&&(n=t[0])),n&&(a=Object.assign(Object.assign({},function(e){var{ns:t,noWrap:n,orEmpty:a,params:o,language:r}=e,i=O(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:t,noWrap:n,orEmpty:a,language:r};return Object.assign(Object.assign({},s),{params:Object.assign({},i)})}(n)),a)),a};function C({options:e}){const t=function(e,t){let n=!0;function a(){return n}const o=Object.freeze({onPendingLanguageChange:p(a),onLanguageChange:p(a),onLoadingChange:p(a),onFetchingChange:p(a),onInitialLoaded:p(a),onRunningChange:p(a),onCacheChange:p(a),onUpdate:h(a,e,t),onPermanentChange:p(a),onError:p(a),setEmitterActive(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return o.onPendingLanguageChange.listen(t);case"language":return o.onLanguageChange.listen(t);case"loading":return o.onLoadingChange.listen(t);case"fetching":return o.onFetchingChange.listen(t);case"initialLoad":return o.onInitialLoaded.listen(t);case"running":return o.onRunningChange.listen(t);case"cache":return o.onCacheChange.listen(t);case"update":return o.onUpdate.listen(t);case"permanentChange":return o.onPermanentChange.listen(t);case"error":return o.onError.listen(t)}}});return o.onInitialLoaded.listen((()=>o.onUpdate.emit())),o.onLanguageChange.listen((()=>o.onUpdate.emit())),o.onCacheChange.listen((({value:e})=>o.onUpdate.emit([e.namespace],!0))),o}(m,y),n=R(!1,(()=>f.isFetching()),t.onFetchingChange.emit),r=R(!1,(()=>D.isLoading()),t.onLoadingChange.emit),s=function(e,t,n){let a,o=N();const r=Object.freeze({init(e){o=N(e,o)},isRunning:()=>o.isRunning,setRunning(e){o.isRunning!==e&&(o.isRunning=e,n.emit(e))},isInitialLoading:()=>o.isInitialLoading,setInitialLoading(e){o.isInitialLoading=e},getLanguage:()=>o.language||o.initialOptions.language,setLanguage(t){o.language!==t&&(o.language=t,e.emit(t))},getPendingLanguage:()=>o.pendingLanguage||r.getLanguage(),setPendingLanguage(e){o.pendingLanguage!==e&&(o.pendingLanguage=e,t.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},o.initialOptions),a),addActiveNs(e){l(e).forEach((e=>{const t=o.activeNamespaces.get(e);void 0!==t?o.activeNamespaces.set(e,t+1):o.activeNamespaces.set(e,1)}))},removeActiveNs(e){l(e).forEach((e=>{const t=o.activeNamespaces.get(e);void 0!==t&&t>1?o.activeNamespaces.set(e,t-1):o.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>u([...o.initialOptions.ns||[o.initialOptions.defaultNs],...l(o.initialOptions.fallbackNs),...o.activeNamespaces.keys()]),getFallbackLangs(e){const t=e||r.getLanguage();return t?u([t,...c(t,o.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>l(o.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?o.initialOptions.defaultNs:e,getAvailableLanguages(){if(o.initialOptions.availableLanguages)return o.initialOptions.availableLanguages;if(o.initialOptions.staticData){const e=Object.keys(o.initialOptions.staticData).map((e=>E(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?r.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:g(e.apiUrl)}):void 0}});return r}(t.onLanguageChange,t.onPendingLanguageChange,t.onRunningChange),d=j(s.getLanguage,s.getInitialOptions,s.getAvailableLanguages,b,C,P,O,t),f=w(t,d.getBackendRecord,d.getBackendDevRecord,s.withDefaultNs,s.isInitialLoading,n,r);let v;function m(){return s.getFallbackNs()}function y(e){return s.getDefaultNs(e)}function b(e){return[...l(y(e)),...m()]}function L(e){return[...l(null!=e?e:y()),...s.getRequiredNamespaces()]}function O(e,t,n){const a=s.withDefaultNs(e),o=f.getTranslation(a,t);return f.changeTranslation(a,t,n),{revert(){f.changeTranslation(a,t,o)}}}function A(e){s.init(e),f.addStaticData(s.getInitialOptions().staticData)}function T(e,t){const n=s.getFallbackLangs(e),a=L(t),o=[];return n.forEach((e=>{a.forEach((t=>{f.exists({language:e,namespace:t},!0)||o.push({language:e,namespace:t})}))})),o}function k(e,t){const n=T(e,t);if(n.length)return o(D.loadRecords(n),(()=>{}))}function C({key:e,ns:t}){const n=s.getFallbackLangs(),a=b(null!=t?t:void 0);return f.getTranslationNs(a,n,e)}function P({key:e,ns:t,language:n}){const a=b(null!=t?t:void 0),o=s.getFallbackLangs(n);return f.getTranslationFallback(a,o,e)}function S(){const e=o(function(){if(s.getLanguage())return;return o(d.getInitialLanguage(),(e=>{const t=e||s.getInitialOptions().defaultLanguage;t&&s.setLanguage(t)}))}(),(()=>k()));if(a(e))return s.setInitialLoading(!0),n.notify(),r.notify(),Promise.resolve(e).then((()=>{s.setInitialLoading(!1),n.notify(),r.notify(),t.onInitialLoaded.emit()}));t.onInitialLoaded.emit()}e&&A(e),t.onUpdate.listen((()=>{s.isRunning()&&d.retranslate()}));const D=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),s),d),f),{init:A,getTranslation:P,changeTranslation:O,getTranslationNs:C,getDefaultAndFallbackNs:b,findPositions:d.findPositions,getRequiredRecords:T,async changeLanguage(e){s.getPendingLanguage()===e&&s.getLanguage()===e||(s.setPendingLanguage(e),s.isRunning()&&await k(e),e===s.getPendingLanguage()&&(s.setLanguage(e),await d.setStoredLanguage(e)))},async addActiveNs(e,t){t||s.addActiveNs(e),s.isRunning()&&await k(void 0,e)},loadRecords:e=>f.loadRecords(e,D.isDev()),loadRecord:async e=>(await D.loadRecords([e]))[0],isLoading:e=>f.isLoading(s.getLanguage(),e),isLoaded(e){const t=s.getLanguage();if(!t)return!1;const n=s.getFallbackLangs(t),a=L(e),o=[];return n.forEach((e=>{a.forEach((t=>{f.exists({language:e,namespace:t})||o.push({language:e,namespace:t})}))})),0===o.length},t:(...e)=>{const t=x(...e),n=P(t);return d.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:()=>Boolean(s.getInitialOptions().apiKey&&s.getInitialOptions().apiUrl),run:()=>(function(){if((d.getLanguageDetector()||d.getLanguageStorage())&&!s.getAvailableLanguages())throw new Error(i("availableLanguages"));if(!s.getLanguage()&&!s.getInitialOptions().defaultLanguage)throw new Error(i(["defaultLanguage","language"]))}(),s.isRunning()||(s.setRunning(!0),d.run(),v=S()),Promise.resolve(v)),stop(){s.isRunning()&&(d.stop(),s.setRunning(!1))}}));return D}const P=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=k(e.options,n),t),init(t){const n=function(e){const t=C({options:e});function n(e){const n=t.isRunning();n&&t.stop(),e(),t.isDev()&&t.invalidate(),n&&t.run()}t.isDev()&&t.invalidate();const a=Object.freeze({on:t.on,onNsUpdate:t.onUpdate.listenSome,setEmitterActive:t.setEmitterActive,getLanguage:t.getLanguage,getPendingLanguage:t.getPendingLanguage,changeLanguage:t.changeLanguage,changeTranslation:t.changeTranslation,addActiveNs:t.addActiveNs,removeActiveNs:t.removeActiveNs,loadRecords:t.loadRecords,loadRecord:t.loadRecord,addStaticData:t.addStaticData,getRecord:t.getRecord,getAllRecords:t.getAllRecords,isLoaded:t.isLoaded,getRequiredRecords:t.getRequiredRecords,isInitialLoading:t.isInitialLoading,isLoading:t.isLoading,isFetching:t.isFetching,isRunning:t.isRunning,run:t.run,stop:t.stop,t:t.t,highlight:t.highlight,findPositions:t.findPositions,getInitialOptions:t.getInitialOptions,isDev:t.isDev,wrap:t.wrap,unwrap:t.unwrap,overrideCredentials(e){n((()=>t.overrideCredentials(e)))},addPlugin(e){e&&n((()=>t.addPlugin(a,e)))},updateOptions(e){e&&n((()=>t.init(e)))}});return a}(k(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},S=0,D=1,_=2;class I extends Error{constructor(e,t,n){let a;a=e===S?"Empty parameter":e===D?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${t} in "${n}"`),this.code=e,this.index=t}}function F(e){return/\s/.test(e)}const U=0,$=1,M=2,B=3,K=4,V=new Set([M,$,U]),z="'",W=new Set(["{","}",z]),G=e=>/[0-9a-zA-Z_]/.test(e);function Y(e,t){const[n,a]=function(e){let t=U,n="",a="",o="";const r=[],i=[];let s=0;function l(t){throw new I(t,s,e)}const c=()=>{r.push(n),n=""},u=()=>{""===a&&l(S),i.push(a),a=""};for(s=0;s<e.length;s++)switch(o=e[s],t){case U:o===z?(n+=o,t=$):"{"===o?(c(),t=B):(n+=o,t=U);break;case $:W.has(o)?(n=n.slice(0,-1)+o,t=M):(n+=o,t=U);break;case M:o===z?t=U:(n+=o,t=M);break;case B:"}"===o?(u(),t=U):F(o)?""!==a&&(u(),t=K):(G(o)||l(D),a+=o,t=B);break;case K:"}"==o?t=U:F(o)?t=K:l(D)}return V.has(t)||l(_),c(),[r,i]}(e),o=[n[0]];for(let r=1;r<n.length;r++){const i=null==t?void 0:t[a[r-1]];if(void 0===i)throw new Error(`Missing parameter "${a[r-1]}" in "${e}"`);o.push(String(i)),o.push(n[r])}return o.join("")}const H="__tolgee_dev_tools",X="data-tolgee-key-only",q="data-tolgee-restricted",J="_tolgee",Z="_tolgee-highlighter";function Q(){var e,t;return void 0===(null==(t=null==(e=globalThis.window)?void 0:e.document)?void 0:t.createElement)}function ee(e){if(Q())throw new Error(`${e}: Can't run on the server`)}function te(e,t){return{oldTextContent:e,keys:t}}function ne(e){return e.textContent}function ae(e,t){e.textContent=t}function oe(e,t){var n;const a=void 0===e.key||void 0===t.key||t.key===e.key,o=void 0===e.ns||void 0===t.ns||-1!==(null==(n=e.ns)?void 0:n.findIndex((e=>{var n;return null==(n=t.ns)?void 0:n.includes(e)})));return a&&o}const re={position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"};function ie({highlightColor:e,highlightWidth:t}){return Object.freeze({initHighlighter(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;const o=function(e){for(;e;){if(null!==e.getAttribute("disabled"))return!1;e=e.parentElement}return!0}(n);let r=a.highlightEl;r||(r=document.createElement("div"),r.classList.add(Z),Object.entries(re).forEach((([e,t])=>{r.style[e]=t})),r.style.borderColor=e,a.highlightEl=r,document.body.appendChild(r));const i=n.getBoundingClientRect();r.style.pointerEvents=o?"none":"auto",r.style.borderWidth=t+"px",r.style.top=i.top-t+"px",r.style.left=i.left-t+"px",r.style.width=i.width+"px",r.style.height=i.height+"px"}}(n,a),function(e,t){t.unhighlight=()=>{var e;null==(e=t.highlightEl)||e.remove(),t.highlightEl=void 0}}(0,a)}})}const se={capture:!0},le={capture:!0,passive:!0},ce=new Map([["Control","ctrlKey"],["Alt","altKey"],["Meta","metaKey"],["Shift","shiftKey"]]);function ue({highlightKeys:e,elementStore:t,onClick:n,options:a}){var o,r;const i=new Set;let s,l,c=[];const u=(null==(o=a.targetElement)?void 0:o.getRootNode())||document,g=(null==(r=a.targetElement)?void 0:r.ownerDocument)||document;function d(){var e;const n=t.get(s);n&&(n.preventClean=!1,null==(e=n.unhighlight)||e.call(n),s=void 0)}function f(){const e=l;let n;if(e&&A()){n=function(e){for(const n of e){const e=O(n,(e=>t.get(e)));if(void 0!==e)return e||void 0}}(u.elementsFromPoint(e.x,e.y)||[])}!function(e){var n;if(s!==e){d();const a=t.get(e);a&&(a.preventClean=!0,null==(n=a.highlight)||n.call(a),s=e)}}(n)}function p(e){l=e,f()}function h(e){for(const[t,n]of ce.entries())i.has(t)&&!e[n]?i.delete(t):!i.has(t)&&e[n]&&i.add(t)}function v(e){var t;h(e),A()&&(t=e.target,!Boolean(O(t,(e=>e.id===H))))&&(e.stopPropagation(),e.preventDefault())}function m(e){h(e),p({x:e.clientX,y:e.clientY})}function y(e){h(e),f()}function b(e){h(e),f()}function E(){var e;const n=t.get(s);null==(e=null==n?void 0:n.highlight)||e.call(n)}function L(e){v(e),h(e),p({x:e.clientX,y:e.clientY}),A()&&s&&(n(s),d())}function w(e,t,n){g.addEventListener(e,t,n),c.push([e,t,n])}function O(e,t){return e.id===H?null:t(e)?e:(null==e?void 0:e.parentElement)?O(e.parentElement,t):void 0}function A(){for(const t of e)if(!i.has(t))return!1;return!0}return Object.freeze({stop(){!function(){for(const e of c)g.removeEventListener(...e);c=[]}()},run(){w("keydown",y,se),w("keyup",b,se),w("mousemove",m,le),w("scroll",E,le),w("click",L,se),w("mouseenter",v,se),w("mouseover",v,se),w("mouseout",v,se),w("mouseleave",v,se),w("mousedown",v,se),w("mouseup",v,se)}})}function ge(e,t,n){const a=ie({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),o=ue({highlightKeys:e.highlightKeys,elementStore:t,onClick(e){const a=t.get(e);n({target:e,keysAndDefaults:l(a)})},options:e});function r(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${q}]`)}function i(e,n){var a;n.highlightEl&&(null==(a=n.unhighlight)||a.call(n)),e.removeAttribute(J),t.remove(e)}function l(e){return function(e){return Array.from(e.nodes.values()).reduce(((e,t)=>[...e,...t.keys.map((e=>({key:e.key,defaultValue:e.defaultValue,ns:e.ns})))]),[])}(e)}return Object.freeze({isRestricted:r,register(e,n,o){if(r(e))return;const i=e;let s=t.get(i);s||(s=function(e){return{element:e,nodes:new Map}}(i),t.set(i,s),i.setAttribute(J,"true")),s.nodes.set(n,o),a.initHighlighter(i,s)},forEachElement:t.forEachElement,cleanupLingeringKeyAttributes(){t.forEachElement(((e,t)=>{if(!t.preventClean){for(const[e]of t.nodes)if(e.nodeType===Node.ATTRIBUTE_NODE){const n=e;n.name===X&&null===n.ownerElement&&t.nodes.delete(n)}0===t.nodes.size&&i(e,t)}}))},cleanupRemovedNodes(e){t.forEachElement(((t,n)=>{n.preventClean||(e.has(t)||function(e,t){for(const[n]of e.nodes)t.has(n)&&e.nodes.delete(n)}(n,e),(e.has(t)||0===n.nodes.size)&&i(t,n))}))},findAll(e,n){const a=[];return t.forEachElement(((t,o)=>{for(const t of o.nodes.values()){if(t.keys.find((t=>oe({key:e,ns:s(n)},{key:t.key,ns:s(t.ns)})))){a.push(o);break}}})),a},run(e){e&&o.run()},stop(){o.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null==(n=t.unhighlight)||n.call(t))}))}})}function de(){let e,t=!1;const n=function(){const e=new Map;return Object.freeze({set(t,n){e.set(t,n)},get:t=>t&&e.get(t),remove:t=>e.delete(t),forEachElement(t){e.forEach(((e,n)=>t(n,e)))}})}();function a({mouseHighlight:e,options:a,wrapper:o,onClick:r}){if(Q())return{stop(){t=!1},wrapper:o};const i=function(e){const t=Object.freeze({getSuitableParent(n){const a=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(n);if(void 0===a)throw console.error(n),new Error("No suitable parent found for node above.");if(!e.passToParent)return a;if(Array.isArray(e.passToParent)){const t=e=>a.tagName.toLowerCase()===e.toLowerCase();if(-1===e.passToParent.findIndex(t))return a}return"function"!=typeof e.passToParent||e.passToParent(a)?t.getSuitableParent(a):a}});return t}(a),s=function(e,t){const n=Object.freeze({handleAttributes(n,a=!0){const o=[],r=Object.fromEntries(Object.entries(e.tagAttributes).map((([e,t])=>[e.toUpperCase(),t])));if(n.nodeType===Node.ELEMENT_NODE){const e=n;let a=r[e.tagName.toUpperCase()]??[];"*"in r&&(a=a.concat(r["*"])),o.push(...a.filter((t=>e.hasAttribute(t))).map((t=>e.getAttributeNode(t))).filter((e=>t.testAttribute(e))))}if(a){const e=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,(e=>{var t,n;return(null==(t=r[e.tagName.toUpperCase()])?void 0:t.some((t=>e.hasAttribute(t))))||(null==(n=r["*"])?void 0:n.some((t=>e.hasAttribute(t))))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}));for(;e.nextNode();){const n=e.currentNode;let a=r[n.tagName.toUpperCase()]??[];"*"in r&&(a=a.concat(r["*"])),o.push(...a.filter((e=>n.hasAttribute(e))).map((e=>n.getAttributeNode(e))).filter((e=>t.testAttribute(e))))}}return o},handleChildList(e){const t=[];return t.push(...e.flatMap((e=>n.handleAttributes(e,!0)))),t.push(...e.flatMap((e=>n.handleText(e)))),t},handleText(e){if(e.nodeType===Node.TEXT_NODE)return t.testTextNode(e)?[e]:[];const n=[],a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,(e=>t.testTextNode(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;a.nextNode();)n.push(a.currentNode);return n}});return n}(a,o),l=ge(a,n,r);function c(e){for(const t of e){const e=t.parentElement;if(e&&l.isRestricted(e))continue;const n=ne(t),a=n?o.unwrap(n):null;if(a){const{text:e,keys:o}=a;ae(t,e);const r=te(n,o),s=i.getSuitableParent(t);l.register(s,t,r)}}}function u(e){const t=i.getSuitableParent(e);l.register(t,e,{oldTextContent:"",keys:[{key:ne(e)}],keyAttributeOnly:!0})}function g(e,t){if(e.nodeType===Node.ATTRIBUTE_NODE){const t=e;if(t.name===X)return void u(t)}if(e.nodeType===Node.ELEMENT_NODE){const t=e.getAttributeNode(X);t&&u(t)}if(!t)return;const n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,(e=>e.hasAttribute(X)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;n.nextNode();){u(n.currentNode.getAttributeNode(X))}}const d=new MutationObserver((e=>{if(!t)return;const n=e.filter((e=>"childList"===e.type)).flatMap((e=>Array.from(e.removedNodes))),a=new Set(n);for(const e of n){if(e.nodeType===Node.ELEMENT_NODE)for(let t=0;t<e.attributes.length;t++)a.add(e.attributes[t]);const t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(;t.nextNode();){const e=t.currentNode;if(e.nodeType===Node.ELEMENT_NODE){const t=e;for(let e=0;e<t.attributes.length;e++)a.add(t.attributes[e])}a.add(e)}}a.size>0&&l.cleanupRemovedNodes(a),e.some((e=>"attributes"===e.type&&e.attributeName===X))&&l.cleanupLingeringKeyAttributes();const o=new Set;for(const t of e)switch(t.type){case"characterData":s.handleText(t.target).forEach((e=>o.add(e)));break;case"childList":g(t.target,!0),t.addedNodes.length>0&&s.handleChildList(Array.from(t.addedNodes)).forEach((e=>o.add(e))),t.removedNodes.length>0&&s.handleChildList(Array.from(t.removedNodes)).forEach((e=>o.delete(e)));break;case"attributes":t.attributeName===X&&g(t.target,!1),s.handleAttributes(t.target,!1).forEach((e=>o.add(e)))}c([...o])})),f=a.targetElement||document.body;t=!0,l.run(e),g(f,!0),c(s.handleChildList([f]));const p=new Set;return p.add(X),Object.values(a.tagAttributes).forEach((e=>e.forEach((e=>p.add(e.toLowerCase()))))),d.observe(f,{attributes:!0,attributeFilter:[...p],childList:!0,subtree:!0,characterData:!0}),{stop(){t=!1,l.stop(),d.disconnect()},elementRegistry:l,wrapper:o}}return Object.freeze({run(t){e=a(t)},stop(){null==e||e.stop()},forEachElement(t){var n,a;null==(a=null==(n=null==e?void 0:e.elementRegistry)?void 0:n.forEachElement)||a.call(n,t)},highlight(t,n){var a;const o=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[];return o.forEach((e=>{var t;return null==(t=e.highlight)?void 0:t.call(e)})),{unhighlight(){o.forEach((e=>{var t;return null==(t=e.unhighlight)?void 0:t.call(e)}))}}},findPositions(t,n){var a;const o=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[],r=[];return o.sort(((e,t)=>e.element.compareDocumentPosition(t.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)),o.forEach((e=>{const a=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{oe({key:t,ns:s(n)},{key:e.key,ns:s(e.ns)})&&r.push({position:{x:a.x,y:a.y,width:a.width,height:a.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),r},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})}var fe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},pe={};!function(e){function t(e){for(var t=0,n=Math.min(65536,e.length+1),a=new Uint16Array(n),o=[],r=0;;){var i=t<e.length;if(!i||r>=n-1){var s=a.subarray(0,r);if(o.push(String.fromCharCode.apply(null,s)),!i)return o.join("");e=e.subarray(t),t=0,r=0}var l=e[t++];if(0==(128&l))a[r++]=l;else if(192==(224&l)){var c=63&e[t++];a[r++]=(31&l)<<6|c}else if(224==(240&l)){c=63&e[t++];var u=63&e[t++];a[r++]=(31&l)<<12|c<<6|u}else if(240==(248&l)){var g=(7&l)<<18|(c=63&e[t++])<<12|(u=63&e[t++])<<6|63&e[t++];g>65535&&(g-=65536,a[r++]=g>>>10&1023|55296,g=56320|1023&g),a[r++]=g}}}var n="Failed to ",a=function(e,t,a){if(e)throw new Error("".concat(n).concat(t,": the '").concat(a,"' option is unsupported."))},o="function"==typeof Buffer&&Buffer.from,r=o?function(e){return Buffer.from(e)}:function(e){for(var t=0,n=e.length,a=0,o=Math.max(32,n+(n>>>1)+7),r=new Uint8Array(o>>>3<<3);t<n;){var i=e.charCodeAt(t++);if(i>=55296&&i<=56319){if(t<n){var s=e.charCodeAt(t);56320==(64512&s)&&(++t,i=((1023&i)<<10)+(1023&s)+65536)}if(i>=55296&&i<=56319)continue}if(a+4>r.length){o+=8,o=(o*=1+t/e.length*2)>>>3<<3;var l=new Uint8Array(o);l.set(r),r=l}if(0!=(4294967168&i)){if(0==(4294965248&i))r[a++]=i>>>6&31|192;else if(0==(4294901760&i))r[a++]=i>>>12&15|224,r[a++]=i>>>6&63|128;else{if(0!=(4292870144&i))continue;r[a++]=i>>>18&7|240,r[a++]=i>>>12&63|128,r[a++]=i>>>6&63|128}r[a++]=63&i|128}else r[a++]=i}return r.slice?r.slice(0,a):r.subarray(0,a)};function i(){this.encoding="utf-8"}i.prototype.encode=function(e,t){return a(t&&t.stream,"encode","stream"),r(e)};var s=!o&&"function"==typeof Blob&&"function"==typeof URL&&"function"==typeof URL.createObjectURL,l=["utf-8","utf8","unicode-1-1-utf-8"],c=t;o?c=function(e,t){return(e instanceof Buffer?e:Buffer.from(e.buffer,e.byteOffset,e.byteLength)).toString(t)}:s&&(c=function(e){try{return function(e){var t;try{var n=new Blob([e],{type:"text/plain;charset=UTF-8"});t=URL.createObjectURL(n);var a=new XMLHttpRequest;return a.open("GET",t,!1),a.send(),a.responseText}finally{t&&URL.revokeObjectURL(t)}}(e)}catch(n){return t(e)}});var u="construct 'TextDecoder'",g="".concat(n," ").concat(u,": the ");function d(e,t){if(a(t&&t.fatal,u,"fatal"),e=e||"utf-8",!(o?Buffer.isEncoding(e):-1!==l.indexOf(e.toLowerCase())))throw new RangeError("".concat(g," encoding label provided ('").concat(e,"') is invalid."));this.encoding=e,this.fatal=!1,this.ignoreBOM=!1}d.prototype.decode=function(e,t){var n;return a(t&&t.stream,"decode","stream"),n=e instanceof Uint8Array?e:e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer):new Uint8Array(e),c(n,this.encoding)},e.TextEncoder=e.TextEncoder||i,e.TextDecoder=e.TextDecoder||d}("undefined"!=typeof window?window:fe);const he=n({__proto__:null,default:pe},[pe]);null==(t=console.assert)||t.call(console,he);const ve=["",""],me=RegExp(`([${ve.join("")}]{9})+`,"gu");function ye(e){const t=function(e){return Array.from((new TextEncoder).encode(e))}(e).map(Number),n=t.map((e=>function(e){const t=8-e.length;return"0".repeat(t)+e}(e.toString(2))+"0")).join("");return Array.from(n).map((e=>ve[Number(e)])).join("")}function be(e){const t=Array.from(e).map((e=>ve.indexOf(e))).map(String).join("").match(/(.{9})/g),n=Uint8Array.from((null==t?void 0:t.map((e=>parseInt(e.slice(0,8),2))))||[]);return a=n,(new TextDecoder).decode(new Uint8Array(a));var a}function Ee({fullKeyEncode:e}){const t=function(){const e=[];return Object.freeze({valueToNumber(t){let n=e.indexOf(t);return-1===n&&(n=e.length,e.push(t)),n},numberToValue:t=>e[t]})}();function n(e){const t={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(t)}return Object.freeze({unwrap(e){const n=[],a=function(e){var t;const n=null==(t=e.match(me))?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(be))||[]}(e);a.forEach((e=>{const a=function(e){if(e.length<=4){const[n]=function(e){const t=[];for(const n of e)t.push(n.codePointAt(0));return t}(e);return t.numberToValue(n)}return e}(e),o=function(e){try{return JSON.parse(e||"{}")}catch(e){return void console.error(e)}}(a);if(o){const{k:e,d:t,n:a}=o;n.push({key:e,defaultValue:t,ns:a})}}));const o=function(e){return e.replace(me,"")}(e);return{text:o,keys:n}},wrap({key:a,defaultValue:o,translation:r,ns:i}){let s;if(e){s=ye(n({key:a,ns:i}))}else{const e=n({key:a,ns:i,defaultValue:o}),r=t.valueToNumber(e);s=ye(String.fromCodePoint(r))}const l=r||"";return"string"==typeof l?l+s:l},testTextNode(e){var t,n;return((null==(t=e.textContent)?void 0:t.includes(`${ve[0]}${ve[0]}`))||(null==(n=e.textContent)?void 0:n.includes(`${ve[1]}${ve[0]}`)))??!1},testAttribute:e=>e.value.includes(`${ve[0]}${ve[0]}`)||e.value.includes(`${ve[1]}${ve[0]}`)})}function Le(e,t){let n=0;for(;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}function we({inputPrefix:e,inputSuffix:t,translate:n}){function a(e){const{key:t,params:a,defaultValue:o,ns:r}=function(e){let t=!1,n="",a="",o="KEY";const r={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{r.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==o||","!==s?"KEY"!==o||"|"!==s?"NAMESPACE"!==o||","!==s?"KEY"!==o||":"!==s?"DEFAULT_VALUE"!==o||":"!==s?"PARAM_NAME"!==o||":"!==s?"PARAM_VALUE"!==o||","!==s?n+=s:(o="PARAM_NAME",r.params[a]=n,n=""):(o="PARAM_VALUE",a=n,n=""):(o="PARAM_NAME",r.defaultValue=n,n=""):(o="PARAM_NAME",r.key=n,n=""):(o="DEFAULT_VALUE",i(n),n=""):(o="NAMESPACE",r.key=n,n=""):(o="DEFAULT_VALUE",r.key=n,n=""):t=!0;return"KEY"===o&&(r.key=n),"DEFAULT_VALUE"===o&&(r.defaultValue=n),"PARAM_VALUE"===o&&(r.params[a]=n),"NAMESPACE"===o&&i(n),r}(e);return{translated:n({key:t,params:a,defaultValue:o,ns:r,noWrap:!0}),key:t,params:a,defaultValue:o,ns:r}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r(e){return"string"==typeof e?e.replace(/[,:|\\]/gs,"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn(`Parameters of type "${typeof e}" are not supported in "text" wrapper mode.`),e)}return Object.freeze({wrap({key:n,params:a,defaultValue:o,ns:i}){let s=Object.entries(a||{}).map((([e,t])=>`${r(e)}:${r(t)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==o?`,${r(o)}`:"",c="string"==typeof i?[i]:i,u=(null==c?void 0:c.length)?`|${c.map((e=>r(e))).join("|")}`:"";return`${e}${r(n)}${u}${l}${s}${t}`},unwrap(n){const r=new RegExp(`(\\\\?)(${o(e)}(.*?)${o(t)})`,"gs"),i=[];let s,l=!1,c=0,u="";for(;null!==(s=r.exec(n));){let e=s[1];const[t,o,r,g]=s,{index:d,input:f}=s;if(u+=f.substr(c,d-c),c=d+t.length,"\\"===e){if(!Le(d,n)){u+=r;continue}e=""}const p=a(g);i.push({key:p.key,params:p.params,defaultValue:p.defaultValue,ns:p.ns}),l=!0,u+=e+p.translated}return u+=n.substring(c),l?{text:u,keys:i}:{text:n,keys:[]}},testTextNode(n){var a,o;return((null==(a=n.textContent)?void 0:a.includes(e))&&(null==(o=n.textContent)?void 0:o.includes(t)))??!1},testAttribute:n=>n.value.includes(e)&&n.value.includes(t)})}const Oe="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function Ae(e){const t=Oe.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function Te(e){const t=(e=e.toUpperCase()).length;let n=0,a=0,o=0;const r=new Uint8Array(5*t/8|0);for(let i=0;i<t;i++)a=a<<5|Ae(e[i]),n+=5,n>=8&&(r[o++]=a>>>n-8&255,n-=8);return function(e){const t=new Uint8Array(e),n=t.length;let a="",o=Math.pow(2,16)-1;for(let e=0;e<n;e+=o)e+o>n&&(o=n-e),a+=String.fromCharCode.apply(null,t.subarray(e,e+o));return a}(r.buffer)}function ke(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=Te(n).split("_");return Number(e)}}catch{console.warn("Tolgee: Api key can't be parsed")}}function Ne({message:e,recievingMessage:t,data:n,attempts:a=1,timeout:o=300}){let r=!1;const i=()=>new Promise(((a,r)=>{const i=function(e,t){const n=n=>{var a,o;e.includes(null==(a=n.data)?void 0:a.type)&&t(null==(o=n.data)?void 0:o.data)};return window.addEventListener("message",n,!1),{unsubscribe(){window.removeEventListener("message",n)}}}(t,(function(e){clearTimeout(s),l(),a(e)}));window.postMessage({type:e,data:n},window.origin);const s=setTimeout((function(){l(),r()}),o);function l(){i.unsubscribe()}}));return{cancel(){r=!0},promise:(async()=>{for(let e=0;e<a;e++){if(r)return new Promise((()=>{}));try{return await i()}catch(e){continue}}if(!r)throw`Didn't recieve ${t.join(" or ")} in time.`;return new Promise((()=>{}))})()}}let je=null;function Re(e){var t;return je||(je=(t=`https://cdn.jsdelivr.net/npm/@tolgee/web@${e}/dist/tolgee-in-context-tools.umd.min.js`,new Promise(((e,n)=>{const a=document.createElement("script");a.src=t,a.addEventListener("load",(()=>e())),a.addEventListener("error",(e=>n(e.error))),document.head.appendChild(a)}))).then((()=>window["@tolgee/in-context-tools"].InContextTools))),je}const xe="__tolgee_apiKey",Ce="__tolgee_apiUrl";function Pe(){const e=sessionStorage.getItem(xe)||void 0,t=sessionStorage.getItem(Ce)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function Se(){sessionStorage.removeItem(xe),sessionStorage.removeItem(Ce)}e.BrowserExtensionPlugin=()=>e=>e;(()=>{if("undefined"==typeof window)return!1;try{return"undefined"!=typeof sessionStorage&&sessionStorage}catch(e){return console.error("sessionStorage not available",e),!1}})()&&(e.BrowserExtensionPlugin=()=>e=>{const t=function(){let e;return{update:async function(t){null==e||e();const{cancel:n,promise:a}=Ne({message:"TOLGEE_READY",recievingMessage:["TOLGEE_PLUGIN_READY","TOLGEE_PLUGIN_UPDATED"],data:t,attempts:4});return e=n,a}}}();e.on("running",(({value:n})=>{var a;n&&(a=()=>{t.update({uiPresent:!0,uiVersion:void 0,mode:e.isDev()?"development":"production",config:{apiUrl:e.getInitialOptions().apiUrl||"",apiKey:e.getInitialOptions().apiKey||""}}).catch(Se)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Pe()&&(async()=>{const e=await Re("5.28.1");return t=>{const n=Pe();return t.addPlugin(e({credentials:n})),t}})().then((t=>{e.addPlugin(t)})).catch((e=>{console.error("Tolgee: Failed to load in-context tools"),console.error(e)})),e});const De="__tolgee_currentLanguage";function _e(e){return e.endsWith("/")?e.slice(0,-1):e}const Ie={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${_e(n)}/${e}/${t}.json`:`${_e(n)}/${t}.json`,getData:function(e){return e.json()},headers:{Accept:"application/json"}};e.BackendFetch=e=>(t,n)=>(n.addBackend(function(e){const{prefix:t,getPath:n,getData:a,headers:o,...r}={...Ie,...e,headers:{...Ie.headers,...null==e?void 0:e.headers}};return{getRecord:({namespace:e,language:i,fetch:s})=>s(n({namespace:e,language:i,prefix:t}),{headers:o,...r}).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return a(e)}))}}(e)),t),e.DEVTOOLS_ID=H,e.DevBackend=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:o,fetch:r}){const i=ke(t)??o;let s=void 0!==i?`${e}/v2/projects/${i}/translations/${n}`:`${e}/v2/projects/translations/${n}`;if(a&&(s+=`?ns=${a}`),"tgpat"===function(e){if(!e)return;const[t]=e.split("_");return"tgpak"===t?"tgpak":"tgpat"===t?"tgpat":"legacy"}(t)&&void 0===o)throw new Error("You need to specify 'projectId' when using PAT key");return r(s,{headers:{"X-API-Key":t||"","Content-Type":"application/json"}}).then((e=>{if(e.ok)return e.json().then((e=>e[n]));throw new Error(e.statusText)}))}}),e),e.DevTools=()=>e=>e,e.FormatSimple=()=>(e,t)=>(t.setFinalFormatter({format:({translation:e,params:t})=>Y(e,t)}),e),e.LanguageDetector=()=>(e,t)=>(t.setLanguageDetector({getLanguage({availableLanguages:e}){ee("LanguageDetector");const t=window.navigator.language,n=e.find((e=>e===t));if(n)return n;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),o=a(window.navigator.language);return e.find((e=>a(e)===o))||void 0}}),e),e.LanguageDetectorError=m,e.LanguageStorage=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(ee("LanguageStorage"),localStorage.getItem(De)||void 0),setLanguage(e){ee("LanguageStorage"),localStorage.setItem(De,e)}}),e),e.LanguageStorageError=y,e.ObserverPlugin=()=>(e,t)=>("text"===e.getInitialOptions().observerType?t.setObserver((()=>{const e=de();return Object.freeze({...e,run(t){const n=we({inputPrefix:t.options.inputPrefix,inputSuffix:t.options.inputSuffix,translate:t.translate});e.run({...t,wrapper:n})},retranslate(){e.forEachElement(((t,n)=>{for(const[t,a]of n.nodes.entries()){if(a.keyAttributeOnly)return;const n=e.unwrap(a.oldTextContent);n&&ae(t,n.text)}}))},outputNotFormattable:!0})})):t.setObserver((()=>{const e=de();return Object.freeze({...e,run(t){const n=Ee({fullKeyEncode:t.options.fullKeyEncode});e.run({...t,wrapper:n})},retranslate(){},outputNotFormattable:!1})})),e),e.PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY="__tolgee_preferredLanguages",e.RecordFetchError=v,e.TOLGEE_ATTRIBUTE_NAME=J,e.TOLGEE_RESTRICT_ATTRIBUTE=q,e.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=X,e.Tolgee=function(){return P().use(e.BrowserExtensionPlugin())},e.TolgeeCore=P,e.createFetchFunction=f,e.getFallback=s,e.getFallbackArray=l,e.getProjectIdFromApiKey=ke,e.getTranslateProps=x,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/web"]={})}(this,(function(e){"use strict";var t;function n(e,t){for(var n=0;n<t.length;n++){const a=t[n];if("string"!=typeof a&&!Array.isArray(a))for(const t in a)if("default"!==t&&!(t in e)){const n=Object.getOwnPropertyDescriptor(a,t);n&&Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>a[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function a(e){return Boolean(e&&"function"==typeof e.then)}function o(e,t){return a(e)?Promise.resolve(e).then(t):t(e)}function r(e,t,n){function o(n){const a=t(n);throw e.emit(a),console.error(a),a}try{const e=n();return a(e)?e.catch(o):e}catch(e){o(e)}}function i(e){const t=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),n=t.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...t.slice(0,-2),n].join(", ")} option`}function s(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function l(e){return s(e)||[]}function c(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?l(t):l(null==t?void 0:t[e]);var n}function u(e){return Array.from(new Set(e))}function g(e){return e?e.replace(/\/+$/,""):e}const d=(e,t)=>fetch(e,t),f=(e=d)=>(t,n)=>e(t,Object.assign(Object.assign({},n),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":"5.28.2-prerelease.2842344b.0"},null==n?void 0:n.headers)}));function p(e){let t=[];return Object.freeze({listen(e){const n=t=>{e(t)};return t.push(n),{unsubscribe(){t=t.filter((e=>n!==e))}}},emit(n){e()&&t.forEach((e=>e({value:n})))}})}function h(e,t,n){const a=new Set,o=new Set;let r=[];function i(){if(0===r.length)return;const e=r;r=[],a.forEach((e=>{e({value:void 0})}));let n=new Set;e.forEach((e=>{void 0===e?n=void 0:void 0!==n&&e.forEach((e=>n.add(e)))}));!function(e){const n=new Set(t());o.forEach((t=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>n.has(e)||t.namespaces.has(e)))))&&t.fn({value:void 0})}))}(n?Array.from(n.keys()):void 0)}return Object.freeze({emit(t,n){e()&&(r.push(t),n?setTimeout(i,0):i())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const t={fn:t=>{e(t)},namespaces:new Set};o.add(t);const a={unsubscribe:()=>{o.delete(t)},subscribeNs:e=>(l(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a}})}class v extends Error{constructor(e,t,n=!1){const{language:a,namespace:o}=e;super(`Tolgee: Failed to fetch record for "${a}"${o&&` and "${o}"`}`),this.cause=t,this.isDev=n,this.name="RecordFetchError",this.language=a,this.namespace=o}}class m extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageDetectorError"}}class y extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageStorageError"}}const b=e=>{const t=new Map;return Object.entries(e).forEach((([e,n])=>{null!=n&&("object"!=typeof n?t.set(e,n):b(n).forEach(((n,a)=>{t.set(e+"."+a,n)})))})),t},E=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},L=({language:e,namespace:t})=>t?`${e}:${t}`:e;function w(e,t,n,o,r,i,s){const c=new Map,g=new Map;let d={},f=0;function p(t,n,a){const o=L(t);g.set(o,{data:b(n),version:a}),e.onCacheChange.emit(t)}async function h(o,r){let i;if(r)try{i=await n(o)}catch(t){const n=new v(o,t,!0);e.onError.emit(n),console.warn(n)}return i||(i=await async function(n){let o;const r=d[L(n)];return"function"==typeof r&&(o=r()),o||(o=t(n)),a(o)?null==o?void 0:o.catch((t=>{const a=new v(n,t);throw e.onError.emit(a),console.error(a),a})):o}(o)),i}const m=Object.freeze({addStaticData(e){e&&(d=Object.assign(Object.assign({},d),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=E(e),a=g.get(e);a&&0!==a.version||p(n,t,0)}})))},invalidate(){c.clear(),f+=1},addRecord(e,t){p(e,t,f)},exists(e,t=!1){const n=g.get(L(e));return n&&t?n.version===f:Boolean(n)},getRecord(e){var t;return null===(t=g.get(L(o(e))))||void 0===t?void 0:t.data},getTranslation(e,t){var n;return null===(n=g.get(L(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=g.get(L({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[o]}return u(e)},getTranslationFallback(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=g.get(L({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation(t,n,a){var o;const r=null===(o=g.get(L(t)))||void 0===o?void 0:o.data;null==r||r.set(n,a),e.onCacheChange.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching(e){if(r())return!0;if(void 0===e)return c.size>0;const t=l(e);return Boolean(Array.from(c.keys()).find((e=>t.includes(E(e).namespace))))},isLoading(e,t){const n=l(t);return Boolean(r()||Array.from(c.keys()).find((t=>{const a=E(t);return(!n.length||n.includes(a.namespace))&&!m.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,t){const n=e.map((e=>{const n=o(e),a=L(n),r=c.get(a);if(r)return{new:!1,promise:r,keyObject:n,cacheKey:a};const i=h(n,t)||Promise.resolve(void 0);return c.set(a,i),{new:!0,promise:i,keyObject:n,cacheKey:a}}));i.notify(),s.notify();const a=await Promise.all(n.map((e=>e.promise)));return n.forEach(((e,t)=>{const n=c.get(e.cacheKey)!==e.promise;if(e.new&&!n){c.delete(e.cacheKey);const n=a[t];n?m.addRecord(e.keyObject,n):m.getRecord(e.keyObject)||m.addRecord(e.keyObject,{})}})),i.notify(),s.notify(),n.map((e=>m.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(g.entries()).map((([e,t])=>Object.assign(Object.assign({},E(e)),{data:t.data})))});return m}function O(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n}const A="invalid",T={defaultNs:"",observerOptions:{tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:["Alt"],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"],fullKeyEncode:!1},observerType:"invisible",onFormatError:A,apiUrl:"https://app.tolgee.io",fetch:f(),onTranslationMissing:({key:e})=>e},k=(...e)=>{let t={};return e.forEach((e=>{t=Object.assign(Object.assign(Object.assign({},t),e),{observerOptions:Object.assign(Object.assign({},t.observerOptions),null==e?void 0:e.observerOptions)})})),t};function N(e,t){const n=k(T,null==t?void 0:t.initialOptions,e);return n.apiUrl=g(n.apiUrl),(null==e?void 0:e.fetch)&&(n.fetch=f(e.fetch)),{initialOptions:n,activeNamespaces:(null==t?void 0:t.activeNamespaces)||new Map,language:null==t?void 0:t.language,pendingLanguage:null==t?void 0:t.language,isInitialLoading:!1,isRunning:!1}}function j(e,t,n,a,i,s,l,c){const u={ui:void 0},g={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},d=async({keysAndDefaults:e,target:t})=>{var n;const o=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,fallbackNamespaces:a(t),namespace:i({key:e,ns:t})[0],translation:s({key:e,ns:t})})));null===(n=g.ui)||void 0===n||n.handleElementClick(o,t)},f=(e,t)=>{var n;return(null===(n=g.observer)||void 0===n?void 0:n.findPositions(e,t))||[]};function p(e){const t=s({key:e.key,ns:e.ns});return x.formatTranslation(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))}function h(){return{fetch:t().fetch}}function v(e){g.observer=null==e?void 0:e()}function b(){return Boolean(g.observer)}function E(e){e&&g.formatters.push(e)}function L(e){g.finalFormatter=e}function w(e){u.ui=e}function T(){return Boolean(u.ui)}function k(e){g.languageStorage=e}function N(e){g.languageDetector=e}function j(e){e&&g.backends.push(e)}function R(e){g.devBackend=e}const x=Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:L,addFormatter:E,setObserver:v,hasObserver:b,setUi:w,hasUi:T,setDevBackend:R,addBackend:j,setLanguageDetector:N,setLanguageStorage:k}))},findPositions:f,run(){var e,n;const{apiKey:a,apiUrl:o,projectId:r,observerOptions:i,tagNewKeys:s}=t();g.ui=null===(e=u.ui)||void 0===e?void 0:e.call(u,{apiKey:a,apiUrl:o,projectId:r,highlight:x.highlight,changeTranslation:l,findPositions:f,onPermanentChange:e=>c.onPermanentChange.emit(e),tagNewKeys:s}),null===(n=g.observer)||void 0===n||n.run({mouseHighlight:!0,options:i,translate:p,onClick:d})},stop(){var e;g.ui=void 0,null===(e=g.observer)||void 0===e||e.stop()},getLanguageStorage:()=>g.languageStorage,getInitialLanguage(){const e=n();return o(r(c.onError,(e=>new y("Tolgee: Failed to load language",e)),(()=>{var e;return null===(e=g.languageStorage)||void 0===e?void 0:e.getLanguage(h())})),(t=>e&&!e.includes(t)||!t?function(){if(!g.languageDetector)return;const e=n();return r(c.onError,(e=>new m("Tolgee: Failed to detect language",e)),(()=>{var t;return null===(t=g.languageDetector)||void 0===t?void 0:t.getLanguage(Object.assign({availableLanguages:e},h()))}))}():t))},setStoredLanguage:e=>r(c.onError,(e=>new y("Tolgee: Failed to store language",e)),(()=>{var t;return null===(t=g.languageStorage)||void 0===t?void 0:t.setLanguage(e,h())})),getDevBackend:()=>g.devBackend,getBackendRecord:async({language:e,namespace:t})=>{for(const n of g.backends){const a=await n.getRecord(Object.assign({language:e,namespace:t},h()));if(void 0!==a)return a}},getBackendDevRecord:async({language:e,namespace:n})=>{var a;const{apiKey:o,apiUrl:r,projectId:i}=t();return null===(a=g.devBackend)||void 0===a?void 0:a.getRecord(Object.assign({apiKey:o,apiUrl:r,projectId:i,language:e,namespace:n},h()))},getLanguageDetector:()=>g.languageDetector,retranslate(){var e;null===(e=g.observer)||void 0===e||e.retranslate()},highlight:(e,t)=>{var n,a;return(null===(a=null===(n=g.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},unwrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:()=>Boolean(x.getDevBackend()),formatTranslation(n){var a,{formatEnabled:o}=n,r=O(n,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:c,params:u,ns:d,orEmpty:f}=r,p=null!=s?s:l;let h="";null==s&&(h=t().onTranslationMissing(r));let v=null!=p?p:f?"":h;const m=e(),y=o||!(null===(a=g.observer)||void 0===a?void 0:a.outputNotFormattable),b=e=>g.observer&&!c?g.observer.wrap({key:i,translation:e,defaultValue:l,params:u,ns:d}):e;v=b(v);try{if(p&&m&&y)for(const e of g.formatters)v=e.format({translation:v,language:m,params:u});g.finalFormatter&&p&&m&&y&&(v=g.finalFormatter.format({translation:v,language:m,params:u}))}catch(e){console.error(e);const n=("string"==typeof(E=e)?E:"string"==typeof(null==E?void 0:E.message)?E.message:void 0)||A,a=t().onFormatError,o=typeof a;v="string"===o?a:"function"===o?a(n,r):A,v=b(v)}var E;return v}});return x}const R=(e,t,n)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=t();a!==e&&n(e),a=e}})};const x=(e,...t)=>{let n,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof t[0]?(a.defaultValue=t[0],n=t[1]):"object"==typeof t[0]&&(n=t[0])),n&&(a=Object.assign(Object.assign({},function(e){var{ns:t,noWrap:n,orEmpty:a,params:o,language:r}=e,i=O(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:t,noWrap:n,orEmpty:a,language:r};return Object.assign(Object.assign({},s),{params:Object.assign({},i)})}(n)),a)),a};function C({options:e}){const t=function(e,t){let n=!0;function a(){return n}const o=Object.freeze({onPendingLanguageChange:p(a),onLanguageChange:p(a),onLoadingChange:p(a),onFetchingChange:p(a),onInitialLoaded:p(a),onRunningChange:p(a),onCacheChange:p(a),onUpdate:h(a,e,t),onPermanentChange:p(a),onError:p(a),setEmitterActive(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return o.onPendingLanguageChange.listen(t);case"language":return o.onLanguageChange.listen(t);case"loading":return o.onLoadingChange.listen(t);case"fetching":return o.onFetchingChange.listen(t);case"initialLoad":return o.onInitialLoaded.listen(t);case"running":return o.onRunningChange.listen(t);case"cache":return o.onCacheChange.listen(t);case"update":return o.onUpdate.listen(t);case"permanentChange":return o.onPermanentChange.listen(t);case"error":return o.onError.listen(t)}}});return o.onInitialLoaded.listen((()=>o.onUpdate.emit())),o.onLanguageChange.listen((()=>o.onUpdate.emit())),o.onCacheChange.listen((({value:e})=>o.onUpdate.emit([e.namespace],!0))),o}(m,y),n=R(!1,(()=>f.isFetching()),t.onFetchingChange.emit),r=R(!1,(()=>D.isLoading()),t.onLoadingChange.emit),s=function(e,t,n){let a,o=N();const r=Object.freeze({init(e){o=N(e,o)},isRunning:()=>o.isRunning,setRunning(e){o.isRunning!==e&&(o.isRunning=e,n.emit(e))},isInitialLoading:()=>o.isInitialLoading,setInitialLoading(e){o.isInitialLoading=e},getLanguage:()=>o.language||o.initialOptions.language,setLanguage(t){o.language!==t&&(o.language=t,e.emit(t))},getPendingLanguage:()=>o.pendingLanguage||r.getLanguage(),setPendingLanguage(e){o.pendingLanguage!==e&&(o.pendingLanguage=e,t.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},o.initialOptions),a),addActiveNs(e){l(e).forEach((e=>{const t=o.activeNamespaces.get(e);void 0!==t?o.activeNamespaces.set(e,t+1):o.activeNamespaces.set(e,1)}))},removeActiveNs(e){l(e).forEach((e=>{const t=o.activeNamespaces.get(e);void 0!==t&&t>1?o.activeNamespaces.set(e,t-1):o.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>u([...o.initialOptions.ns||[o.initialOptions.defaultNs],...l(o.initialOptions.fallbackNs),...o.activeNamespaces.keys()]),getFallbackLangs(e){const t=e||r.getLanguage();return t?u([t,...c(t,o.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>l(o.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?o.initialOptions.defaultNs:e,getAvailableLanguages(){if(o.initialOptions.availableLanguages)return o.initialOptions.availableLanguages;if(o.initialOptions.staticData){const e=Object.keys(o.initialOptions.staticData).map((e=>E(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?r.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:g(e.apiUrl)}):void 0}});return r}(t.onLanguageChange,t.onPendingLanguageChange,t.onRunningChange),d=j(s.getLanguage,s.getInitialOptions,s.getAvailableLanguages,b,C,P,O,t),f=w(t,d.getBackendRecord,d.getBackendDevRecord,s.withDefaultNs,s.isInitialLoading,n,r);let v;function m(){return s.getFallbackNs()}function y(e){return s.getDefaultNs(e)}function b(e){return[...l(y(e)),...m()]}function L(e){return[...l(null!=e?e:y()),...s.getRequiredNamespaces()]}function O(e,t,n){const a=s.withDefaultNs(e),o=f.getTranslation(a,t);return f.changeTranslation(a,t,n),{revert(){f.changeTranslation(a,t,o)}}}function A(e){s.init(e),f.addStaticData(s.getInitialOptions().staticData)}function T(e,t){const n=s.getFallbackLangs(e),a=L(t),o=[];return n.forEach((e=>{a.forEach((t=>{f.exists({language:e,namespace:t},!0)||o.push({language:e,namespace:t})}))})),o}function k(e,t){const n=T(e,t);if(n.length)return o(D.loadRecords(n),(()=>{}))}function C({key:e,ns:t}){const n=s.getFallbackLangs(),a=b(null!=t?t:void 0);return f.getTranslationNs(a,n,e)}function P({key:e,ns:t,language:n}){const a=b(null!=t?t:void 0),o=s.getFallbackLangs(n);return f.getTranslationFallback(a,o,e)}function S(){const e=o(function(){if(s.getLanguage())return;return o(d.getInitialLanguage(),(e=>{const t=e||s.getInitialOptions().defaultLanguage;t&&s.setLanguage(t)}))}(),(()=>k()));if(a(e))return s.setInitialLoading(!0),n.notify(),r.notify(),Promise.resolve(e).then((()=>{s.setInitialLoading(!1),n.notify(),r.notify(),t.onInitialLoaded.emit()}));t.onInitialLoaded.emit()}e&&A(e),t.onUpdate.listen((()=>{s.isRunning()&&d.retranslate()}));const D=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),s),d),f),{init:A,getTranslation:P,changeTranslation:O,getTranslationNs:C,getDefaultAndFallbackNs:b,findPositions:d.findPositions,getRequiredRecords:T,async changeLanguage(e){s.getPendingLanguage()===e&&s.getLanguage()===e||(s.setPendingLanguage(e),s.isRunning()&&await k(e),e===s.getPendingLanguage()&&(s.setLanguage(e),await d.setStoredLanguage(e)))},async addActiveNs(e,t){t||s.addActiveNs(e),s.isRunning()&&await k(void 0,e)},loadRecords:e=>f.loadRecords(e,D.isDev()),loadRecord:async e=>(await D.loadRecords([e]))[0],isLoading:e=>f.isLoading(s.getLanguage(),e),isLoaded(e){const t=s.getLanguage();if(!t)return!1;const n=s.getFallbackLangs(t),a=L(e),o=[];return n.forEach((e=>{a.forEach((t=>{f.exists({language:e,namespace:t})||o.push({language:e,namespace:t})}))})),0===o.length},t:(...e)=>{const t=x(...e),n=P(t);return d.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:()=>Boolean(s.getInitialOptions().apiKey&&s.getInitialOptions().apiUrl),run:()=>(function(){if((d.getLanguageDetector()||d.getLanguageStorage())&&!s.getAvailableLanguages())throw new Error(i("availableLanguages"));if(!s.getLanguage()&&!s.getInitialOptions().defaultLanguage)throw new Error(i(["defaultLanguage","language"]))}(),s.isRunning()||(s.setRunning(!0),d.run(),v=S()),Promise.resolve(v)),stop(){s.isRunning()&&(d.stop(),s.setRunning(!1))}}));return D}const P=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=k(e.options,n),t),init(t){const n=function(e){const t=C({options:e});function n(e){const n=t.isRunning();n&&t.stop(),e(),t.isDev()&&t.invalidate(),n&&t.run()}t.isDev()&&t.invalidate();const a=Object.freeze({on:t.on,onNsUpdate:t.onUpdate.listenSome,setEmitterActive:t.setEmitterActive,getLanguage:t.getLanguage,getPendingLanguage:t.getPendingLanguage,changeLanguage:t.changeLanguage,changeTranslation:t.changeTranslation,addActiveNs:t.addActiveNs,removeActiveNs:t.removeActiveNs,loadRecords:t.loadRecords,loadRecord:t.loadRecord,addStaticData:t.addStaticData,getRecord:t.getRecord,getAllRecords:t.getAllRecords,isLoaded:t.isLoaded,getRequiredRecords:t.getRequiredRecords,isInitialLoading:t.isInitialLoading,isLoading:t.isLoading,isFetching:t.isFetching,isRunning:t.isRunning,run:t.run,stop:t.stop,t:t.t,highlight:t.highlight,findPositions:t.findPositions,getInitialOptions:t.getInitialOptions,isDev:t.isDev,wrap:t.wrap,unwrap:t.unwrap,overrideCredentials(e){n((()=>t.overrideCredentials(e)))},addPlugin(e){e&&n((()=>t.addPlugin(a,e)))},updateOptions(e){e&&n((()=>t.init(e)))}});return a}(k(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},S=0,D=1,_=2;class I extends Error{constructor(e,t,n){let a;a=e===S?"Empty parameter":e===D?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${t} in "${n}"`),this.code=e,this.index=t}}function F(e){return/\s/.test(e)}const U=0,$=1,M=2,B=3,K=4,V=new Set([M,$,U]),z="'",W=new Set(["{","}",z]),G=e=>/[0-9a-zA-Z_]/.test(e);function Y(e,t){const[n,a]=function(e){let t=U,n="",a="",o="";const r=[],i=[];let s=0;function l(t){throw new I(t,s,e)}const c=()=>{r.push(n),n=""},u=()=>{""===a&&l(S),i.push(a),a=""};for(s=0;s<e.length;s++)switch(o=e[s],t){case U:o===z?(n+=o,t=$):"{"===o?(c(),t=B):(n+=o,t=U);break;case $:W.has(o)?(n=n.slice(0,-1)+o,t=M):(n+=o,t=U);break;case M:o===z?t=U:(n+=o,t=M);break;case B:"}"===o?(u(),t=U):F(o)?""!==a&&(u(),t=K):(G(o)||l(D),a+=o,t=B);break;case K:"}"==o?t=U:F(o)?t=K:l(D)}return V.has(t)||l(_),c(),[r,i]}(e),o=[n[0]];for(let r=1;r<n.length;r++){const i=null==t?void 0:t[a[r-1]];if(void 0===i)throw new Error(`Missing parameter "${a[r-1]}" in "${e}"`);o.push(String(i)),o.push(n[r])}return o.join("")}const H="__tolgee_dev_tools",X="data-tolgee-key-only",q="data-tolgee-restricted",J="_tolgee",Z="_tolgee-highlighter";function Q(){var e,t;return void 0===(null==(t=null==(e=globalThis.window)?void 0:e.document)?void 0:t.createElement)}function ee(e){if(Q())throw new Error(`${e}: Can't run on the server`)}function te(e,t){return{oldTextContent:e,keys:t}}function ne(e){return e.textContent}function ae(e,t){e.textContent=t}function oe(e,t){var n;const a=void 0===e.key||void 0===t.key||t.key===e.key,o=void 0===e.ns||void 0===t.ns||-1!==(null==(n=e.ns)?void 0:n.findIndex((e=>{var n;return null==(n=t.ns)?void 0:n.includes(e)})));return a&&o}const re={position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"};function ie({highlightColor:e,highlightWidth:t}){return Object.freeze({initHighlighter(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;const o=function(e){for(;e;){if(null!==e.getAttribute("disabled"))return!1;e=e.parentElement}return!0}(n);let r=a.highlightEl;r||(r=document.createElement("div"),r.classList.add(Z),Object.entries(re).forEach((([e,t])=>{r.style[e]=t})),r.style.borderColor=e,a.highlightEl=r,document.body.appendChild(r));const i=n.getBoundingClientRect();r.style.pointerEvents=o?"none":"auto",r.style.borderWidth=t+"px",r.style.top=i.top-t+"px",r.style.left=i.left-t+"px",r.style.width=i.width+"px",r.style.height=i.height+"px"}}(n,a),function(e,t){t.unhighlight=()=>{var e;null==(e=t.highlightEl)||e.remove(),t.highlightEl=void 0}}(0,a)}})}const se={capture:!0},le={capture:!0,passive:!0},ce=new Map([["Control","ctrlKey"],["Alt","altKey"],["Meta","metaKey"],["Shift","shiftKey"]]);function ue({highlightKeys:e,elementStore:t,onClick:n,options:a}){var o,r;const i=new Set;let s,l,c=[];const u=(null==(o=a.targetElement)?void 0:o.getRootNode())||document,g=(null==(r=a.targetElement)?void 0:r.ownerDocument)||document;function d(){var e;const n=t.get(s);n&&(n.preventClean=!1,null==(e=n.unhighlight)||e.call(n),s=void 0)}function f(){const e=l;let n;if(e&&A()){n=function(e){for(const n of e){const e=O(n,(e=>t.get(e)));if(void 0!==e)return e||void 0}}(u.elementsFromPoint(e.x,e.y)||[])}!function(e){var n;if(s!==e){d();const a=t.get(e);a&&(a.preventClean=!0,null==(n=a.highlight)||n.call(a),s=e)}}(n)}function p(e){l=e,f()}function h(e){for(const[t,n]of ce.entries())i.has(t)&&!e[n]?i.delete(t):!i.has(t)&&e[n]&&i.add(t)}function v(e){var t;h(e),A()&&(t=e.target,!Boolean(O(t,(e=>e.id===H))))&&(e.stopPropagation(),e.preventDefault())}function m(e){h(e),p({x:e.clientX,y:e.clientY})}function y(e){h(e),f()}function b(e){h(e),f()}function E(){var e;const n=t.get(s);null==(e=null==n?void 0:n.highlight)||e.call(n)}function L(e){v(e),h(e),p({x:e.clientX,y:e.clientY}),A()&&s&&(n(s),d())}function w(e,t,n){g.addEventListener(e,t,n),c.push([e,t,n])}function O(e,t){return e.id===H?null:t(e)?e:(null==e?void 0:e.parentElement)?O(e.parentElement,t):void 0}function A(){for(const t of e)if(!i.has(t))return!1;return!0}return Object.freeze({stop(){!function(){for(const e of c)g.removeEventListener(...e);c=[]}()},run(){w("keydown",y,se),w("keyup",b,se),w("mousemove",m,le),w("scroll",E,le),w("click",L,se),w("mouseenter",v,se),w("mouseover",v,se),w("mouseout",v,se),w("mouseleave",v,se),w("mousedown",v,se),w("mouseup",v,se)}})}function ge(e,t,n){const a=ie({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),o=ue({highlightKeys:e.highlightKeys,elementStore:t,onClick(e){const a=t.get(e);n({target:e,keysAndDefaults:l(a)})},options:e});function r(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${q}]`)}function i(e,n){var a;n.highlightEl&&(null==(a=n.unhighlight)||a.call(n)),e.removeAttribute(J),t.remove(e)}function l(e){return function(e){return Array.from(e.nodes.values()).reduce(((e,t)=>[...e,...t.keys.map((e=>({key:e.key,defaultValue:e.defaultValue,ns:e.ns})))]),[])}(e)}return Object.freeze({isRestricted:r,register(e,n,o){if(r(e))return;const i=e;let s=t.get(i);s||(s=function(e){return{element:e,nodes:new Map}}(i),t.set(i,s),i.setAttribute(J,"true")),s.nodes.set(n,o),a.initHighlighter(i,s)},forEachElement:t.forEachElement,cleanupLingeringKeyAttributes(){t.forEachElement(((e,t)=>{if(!t.preventClean){for(const[e]of t.nodes)if(e.nodeType===Node.ATTRIBUTE_NODE){const n=e;n.name===X&&null===n.ownerElement&&t.nodes.delete(n)}0===t.nodes.size&&i(e,t)}}))},cleanupRemovedNodes(e){t.forEachElement(((t,n)=>{n.preventClean||(e.has(t)||function(e,t){for(const[n]of e.nodes)t.has(n)&&e.nodes.delete(n)}(n,e),(e.has(t)||0===n.nodes.size)&&i(t,n))}))},findAll(e,n){const a=[];return t.forEachElement(((t,o)=>{for(const t of o.nodes.values()){if(t.keys.find((t=>oe({key:e,ns:s(n)},{key:t.key,ns:s(t.ns)})))){a.push(o);break}}})),a},run(e){e&&o.run()},stop(){o.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null==(n=t.unhighlight)||n.call(t))}))}})}function de(){let e,t=!1;const n=function(){const e=new Map;return Object.freeze({set(t,n){e.set(t,n)},get:t=>t&&e.get(t),remove:t=>e.delete(t),forEachElement(t){e.forEach(((e,n)=>t(n,e)))}})}();function a({mouseHighlight:e,options:a,wrapper:o,onClick:r}){if(Q())return{stop(){t=!1},wrapper:o};const i=function(e){const t=Object.freeze({getSuitableParent(n){const a=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(n);if(void 0===a)throw console.error(n),new Error("No suitable parent found for node above.");if(!e.passToParent)return a;if(Array.isArray(e.passToParent)){const t=e=>a.tagName.toLowerCase()===e.toLowerCase();if(-1===e.passToParent.findIndex(t))return a}return"function"!=typeof e.passToParent||e.passToParent(a)?t.getSuitableParent(a):a}});return t}(a),s=function(e,t){const n=Object.freeze({handleAttributes(n,a=!0){const o=[],r=Object.fromEntries(Object.entries(e.tagAttributes).map((([e,t])=>[e.toUpperCase(),t])));if(n.nodeType===Node.ELEMENT_NODE){const e=n;let a=r[e.tagName.toUpperCase()]??[];"*"in r&&(a=a.concat(r["*"])),o.push(...a.filter((t=>e.hasAttribute(t))).map((t=>e.getAttributeNode(t))).filter((e=>t.testAttribute(e))))}if(a){const e=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,(e=>{var t,n;return(null==(t=r[e.tagName.toUpperCase()])?void 0:t.some((t=>e.hasAttribute(t))))||(null==(n=r["*"])?void 0:n.some((t=>e.hasAttribute(t))))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}));for(;e.nextNode();){const n=e.currentNode;let a=r[n.tagName.toUpperCase()]??[];"*"in r&&(a=a.concat(r["*"])),o.push(...a.filter((e=>n.hasAttribute(e))).map((e=>n.getAttributeNode(e))).filter((e=>t.testAttribute(e))))}}return o},handleChildList(e){const t=[];return t.push(...e.flatMap((e=>n.handleAttributes(e,!0)))),t.push(...e.flatMap((e=>n.handleText(e)))),t},handleText(e){if(e.nodeType===Node.TEXT_NODE)return t.testTextNode(e)?[e]:[];const n=[],a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,(e=>t.testTextNode(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;a.nextNode();)n.push(a.currentNode);return n}});return n}(a,o),l=ge(a,n,r);function c(e){for(const t of e){const e=t.parentElement;if(e&&l.isRestricted(e))continue;const n=ne(t),a=n?o.unwrap(n):null;if(a){const{text:e,keys:o}=a;ae(t,e);const r=te(n,o),s=i.getSuitableParent(t);l.register(s,t,r)}}}function u(e){const t=i.getSuitableParent(e);l.register(t,e,{oldTextContent:"",keys:[{key:ne(e)}],keyAttributeOnly:!0})}function g(e,t){if(e.nodeType===Node.ATTRIBUTE_NODE){const t=e;if(t.name===X)return void u(t)}if(e.nodeType===Node.ELEMENT_NODE){const t=e.getAttributeNode(X);t&&u(t)}if(!t)return;const n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,(e=>e.hasAttribute(X)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;n.nextNode();){u(n.currentNode.getAttributeNode(X))}}const d=new MutationObserver((e=>{if(!t)return;const n=e.filter((e=>"childList"===e.type)).flatMap((e=>Array.from(e.removedNodes))),a=new Set(n);for(const e of n){if(e.nodeType===Node.ELEMENT_NODE)for(let t=0;t<e.attributes.length;t++)a.add(e.attributes[t]);const t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(;t.nextNode();){const e=t.currentNode;if(e.nodeType===Node.ELEMENT_NODE){const t=e;for(let e=0;e<t.attributes.length;e++)a.add(t.attributes[e])}a.add(e)}}a.size>0&&l.cleanupRemovedNodes(a),e.some((e=>"attributes"===e.type&&e.attributeName===X))&&l.cleanupLingeringKeyAttributes();const o=new Set;for(const t of e)switch(t.type){case"characterData":s.handleText(t.target).forEach((e=>o.add(e)));break;case"childList":g(t.target,!0),t.addedNodes.length>0&&s.handleChildList(Array.from(t.addedNodes)).forEach((e=>o.add(e))),t.removedNodes.length>0&&s.handleChildList(Array.from(t.removedNodes)).forEach((e=>o.delete(e)));break;case"attributes":t.attributeName===X&&g(t.target,!1),s.handleAttributes(t.target,!1).forEach((e=>o.add(e)))}c([...o])})),f=a.targetElement||document.body;t=!0,l.run(e),g(f,!0),c(s.handleChildList([f]));const p=new Set;return p.add(X),Object.values(a.tagAttributes).forEach((e=>e.forEach((e=>p.add(e.toLowerCase()))))),d.observe(f,{attributes:!0,attributeFilter:[...p],childList:!0,subtree:!0,characterData:!0}),{stop(){t=!1,l.stop(),d.disconnect()},elementRegistry:l,wrapper:o}}return Object.freeze({run(t){e=a(t)},stop(){null==e||e.stop()},forEachElement(t){var n,a;null==(a=null==(n=null==e?void 0:e.elementRegistry)?void 0:n.forEachElement)||a.call(n,t)},highlight(t,n){var a;const o=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[];return o.forEach((e=>{var t;return null==(t=e.highlight)?void 0:t.call(e)})),{unhighlight(){o.forEach((e=>{var t;return null==(t=e.unhighlight)?void 0:t.call(e)}))}}},findPositions(t,n){var a;const o=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[],r=[];return o.sort(((e,t)=>e.element.compareDocumentPosition(t.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)),o.forEach((e=>{const a=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{oe({key:t,ns:s(n)},{key:e.key,ns:s(e.ns)})&&r.push({position:{x:a.x,y:a.y,width:a.width,height:a.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),r},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})}var fe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},pe={};!function(e){function t(e){for(var t=0,n=Math.min(65536,e.length+1),a=new Uint16Array(n),o=[],r=0;;){var i=t<e.length;if(!i||r>=n-1){var s=a.subarray(0,r);if(o.push(String.fromCharCode.apply(null,s)),!i)return o.join("");e=e.subarray(t),t=0,r=0}var l=e[t++];if(0==(128&l))a[r++]=l;else if(192==(224&l)){var c=63&e[t++];a[r++]=(31&l)<<6|c}else if(224==(240&l)){c=63&e[t++];var u=63&e[t++];a[r++]=(31&l)<<12|c<<6|u}else if(240==(248&l)){var g=(7&l)<<18|(c=63&e[t++])<<12|(u=63&e[t++])<<6|63&e[t++];g>65535&&(g-=65536,a[r++]=g>>>10&1023|55296,g=56320|1023&g),a[r++]=g}}}var n="Failed to ",a=function(e,t,a){if(e)throw new Error("".concat(n).concat(t,": the '").concat(a,"' option is unsupported."))},o="function"==typeof Buffer&&Buffer.from,r=o?function(e){return Buffer.from(e)}:function(e){for(var t=0,n=e.length,a=0,o=Math.max(32,n+(n>>>1)+7),r=new Uint8Array(o>>>3<<3);t<n;){var i=e.charCodeAt(t++);if(i>=55296&&i<=56319){if(t<n){var s=e.charCodeAt(t);56320==(64512&s)&&(++t,i=((1023&i)<<10)+(1023&s)+65536)}if(i>=55296&&i<=56319)continue}if(a+4>r.length){o+=8,o=(o*=1+t/e.length*2)>>>3<<3;var l=new Uint8Array(o);l.set(r),r=l}if(0!=(4294967168&i)){if(0==(4294965248&i))r[a++]=i>>>6&31|192;else if(0==(4294901760&i))r[a++]=i>>>12&15|224,r[a++]=i>>>6&63|128;else{if(0!=(4292870144&i))continue;r[a++]=i>>>18&7|240,r[a++]=i>>>12&63|128,r[a++]=i>>>6&63|128}r[a++]=63&i|128}else r[a++]=i}return r.slice?r.slice(0,a):r.subarray(0,a)};function i(){this.encoding="utf-8"}i.prototype.encode=function(e,t){return a(t&&t.stream,"encode","stream"),r(e)};var s=!o&&"function"==typeof Blob&&"function"==typeof URL&&"function"==typeof URL.createObjectURL,l=["utf-8","utf8","unicode-1-1-utf-8"],c=t;o?c=function(e,t){return(e instanceof Buffer?e:Buffer.from(e.buffer,e.byteOffset,e.byteLength)).toString(t)}:s&&(c=function(e){try{return function(e){var t;try{var n=new Blob([e],{type:"text/plain;charset=UTF-8"});t=URL.createObjectURL(n);var a=new XMLHttpRequest;return a.open("GET",t,!1),a.send(),a.responseText}finally{t&&URL.revokeObjectURL(t)}}(e)}catch(n){return t(e)}});var u="construct 'TextDecoder'",g="".concat(n," ").concat(u,": the ");function d(e,t){if(a(t&&t.fatal,u,"fatal"),e=e||"utf-8",!(o?Buffer.isEncoding(e):-1!==l.indexOf(e.toLowerCase())))throw new RangeError("".concat(g," encoding label provided ('").concat(e,"') is invalid."));this.encoding=e,this.fatal=!1,this.ignoreBOM=!1}d.prototype.decode=function(e,t){var n;return a(t&&t.stream,"decode","stream"),n=e instanceof Uint8Array?e:e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer):new Uint8Array(e),c(n,this.encoding)},e.TextEncoder=e.TextEncoder||i,e.TextDecoder=e.TextDecoder||d}("undefined"!=typeof window?window:fe);const he=n({__proto__:null,default:pe},[pe]);null==(t=console.assert)||t.call(console,he);const ve=["",""],me=RegExp(`([${ve.join("")}]{9})+`,"gu");function ye(e){const t=function(e){return Array.from((new TextEncoder).encode(e))}(e).map(Number),n=t.map((e=>function(e){const t=8-e.length;return"0".repeat(t)+e}(e.toString(2))+"0")).join("");return Array.from(n).map((e=>ve[Number(e)])).join("")}function be(e){const t=Array.from(e).map((e=>ve.indexOf(e))).map(String).join("").match(/(.{9})/g),n=Uint8Array.from((null==t?void 0:t.map((e=>parseInt(e.slice(0,8),2))))||[]);return a=n,(new TextDecoder).decode(new Uint8Array(a));var a}function Ee({fullKeyEncode:e}){const t=function(){const e=[];return Object.freeze({valueToNumber(t){let n=e.indexOf(t);return-1===n&&(n=e.length,e.push(t)),n},numberToValue:t=>e[t]})}();function n(e){const t={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(t)}return Object.freeze({unwrap(e){const n=[],a=function(e){var t;const n=null==(t=e.match(me))?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(be))||[]}(e);a.forEach((e=>{const a=function(e){if(e.length<=4){const[n]=function(e){const t=[];for(const n of e)t.push(n.codePointAt(0));return t}(e);return t.numberToValue(n)}return e}(e),o=function(e){try{return JSON.parse(e||"{}")}catch(e){return void console.error(e)}}(a);if(o){const{k:e,d:t,n:a}=o;n.push({key:e,defaultValue:t,ns:a})}}));const o=function(e){return e.replace(me,"")}(e);return{text:o,keys:n}},wrap({key:a,defaultValue:o,translation:r,ns:i}){let s;if(e){s=ye(n({key:a,ns:i}))}else{const e=n({key:a,ns:i,defaultValue:o}),r=t.valueToNumber(e);s=ye(String.fromCodePoint(r))}const l=r||"";return"string"==typeof l?l+s:l},testTextNode(e){var t,n;return((null==(t=e.textContent)?void 0:t.includes(`${ve[0]}${ve[0]}`))||(null==(n=e.textContent)?void 0:n.includes(`${ve[1]}${ve[0]}`)))??!1},testAttribute:e=>e.value.includes(`${ve[0]}${ve[0]}`)||e.value.includes(`${ve[1]}${ve[0]}`)})}function Le(e,t){let n=0;for(;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}function we({inputPrefix:e,inputSuffix:t,translate:n}){function a(e){const{key:t,params:a,defaultValue:o,ns:r}=function(e){let t=!1,n="",a="",o="KEY";const r={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{r.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==o||","!==s?"KEY"!==o||"|"!==s?"NAMESPACE"!==o||","!==s?"KEY"!==o||":"!==s?"DEFAULT_VALUE"!==o||":"!==s?"PARAM_NAME"!==o||":"!==s?"PARAM_VALUE"!==o||","!==s?n+=s:(o="PARAM_NAME",r.params[a]=n,n=""):(o="PARAM_VALUE",a=n,n=""):(o="PARAM_NAME",r.defaultValue=n,n=""):(o="PARAM_NAME",r.key=n,n=""):(o="DEFAULT_VALUE",i(n),n=""):(o="NAMESPACE",r.key=n,n=""):(o="DEFAULT_VALUE",r.key=n,n=""):t=!0;return"KEY"===o&&(r.key=n),"DEFAULT_VALUE"===o&&(r.defaultValue=n),"PARAM_VALUE"===o&&(r.params[a]=n),"NAMESPACE"===o&&i(n),r}(e);return{translated:n({key:t,params:a,defaultValue:o,ns:r,noWrap:!0}),key:t,params:a,defaultValue:o,ns:r}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r(e){return"string"==typeof e?e.replace(/[,:|\\]/gs,"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn(`Parameters of type "${typeof e}" are not supported in "text" wrapper mode.`),e)}return Object.freeze({wrap({key:n,params:a,defaultValue:o,ns:i}){let s=Object.entries(a||{}).map((([e,t])=>`${r(e)}:${r(t)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==o?`,${r(o)}`:"",c="string"==typeof i?[i]:i,u=(null==c?void 0:c.length)?`|${c.map((e=>r(e))).join("|")}`:"";return`${e}${r(n)}${u}${l}${s}${t}`},unwrap(n){const r=new RegExp(`(\\\\?)(${o(e)}(.*?)${o(t)})`,"gs"),i=[];let s,l=!1,c=0,u="";for(;null!==(s=r.exec(n));){let e=s[1];const[t,o,r,g]=s,{index:d,input:f}=s;if(u+=f.substr(c,d-c),c=d+t.length,"\\"===e){if(!Le(d,n)){u+=r;continue}e=""}const p=a(g);i.push({key:p.key,params:p.params,defaultValue:p.defaultValue,ns:p.ns}),l=!0,u+=e+p.translated}return u+=n.substring(c),l?{text:u,keys:i}:{text:n,keys:[]}},testTextNode(n){var a,o;return((null==(a=n.textContent)?void 0:a.includes(e))&&(null==(o=n.textContent)?void 0:o.includes(t)))??!1},testAttribute:n=>n.value.includes(e)&&n.value.includes(t)})}const Oe="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function Ae(e){const t=Oe.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function Te(e){const t=(e=e.toUpperCase()).length;let n=0,a=0,o=0;const r=new Uint8Array(5*t/8|0);for(let i=0;i<t;i++)a=a<<5|Ae(e[i]),n+=5,n>=8&&(r[o++]=a>>>n-8&255,n-=8);return function(e){const t=new Uint8Array(e),n=t.length;let a="",o=Math.pow(2,16)-1;for(let e=0;e<n;e+=o)e+o>n&&(o=n-e),a+=String.fromCharCode.apply(null,t.subarray(e,e+o));return a}(r.buffer)}function ke(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=Te(n).split("_");return Number(e)}}catch{console.warn("Tolgee: Api key can't be parsed")}}function Ne({message:e,recievingMessage:t,data:n,attempts:a=1,timeout:o=300}){let r=!1;const i=()=>new Promise(((a,r)=>{const i=function(e,t){const n=n=>{var a,o;e.includes(null==(a=n.data)?void 0:a.type)&&t(null==(o=n.data)?void 0:o.data)};return window.addEventListener("message",n,!1),{unsubscribe(){window.removeEventListener("message",n)}}}(t,(function(e){clearTimeout(s),l(),a(e)}));window.postMessage({type:e,data:n},window.origin);const s=setTimeout((function(){l(),r()}),o);function l(){i.unsubscribe()}}));return{cancel(){r=!0},promise:(async()=>{for(let e=0;e<a;e++){if(r)return new Promise((()=>{}));try{return await i()}catch(e){continue}}if(!r)throw`Didn't recieve ${t.join(" or ")} in time.`;return new Promise((()=>{}))})()}}let je=null;function Re(e){var t;return je||(je=(t=`https://cdn.jsdelivr.net/npm/@tolgee/web@${e}/dist/tolgee-in-context-tools.umd.min.js`,new Promise(((e,n)=>{const a=document.createElement("script");a.src=t,a.addEventListener("load",(()=>e())),a.addEventListener("error",(e=>n(e.error))),document.head.appendChild(a)}))).then((()=>window["@tolgee/in-context-tools"].InContextTools))),je}const xe="__tolgee_apiKey",Ce="__tolgee_apiUrl";function Pe(){const e=sessionStorage.getItem(xe)||void 0,t=sessionStorage.getItem(Ce)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function Se(){sessionStorage.removeItem(xe),sessionStorage.removeItem(Ce)}e.BrowserExtensionPlugin=()=>e=>e;(()=>{if("undefined"==typeof window)return!1;try{return"undefined"!=typeof sessionStorage&&sessionStorage}catch(e){return console.error("sessionStorage not available",e),!1}})()&&(e.BrowserExtensionPlugin=()=>e=>{const t=function(){let e;return{update:async function(t){null==e||e();const{cancel:n,promise:a}=Ne({message:"TOLGEE_READY",recievingMessage:["TOLGEE_PLUGIN_READY","TOLGEE_PLUGIN_UPDATED"],data:t,attempts:4});return e=n,a}}}();e.on("running",(({value:n})=>{var a;n&&(a=()=>{t.update({uiPresent:!0,uiVersion:void 0,mode:e.isDev()?"development":"production",config:{apiUrl:e.getInitialOptions().apiUrl||"",apiKey:e.getInitialOptions().apiKey||""}}).catch(Se)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Pe()&&(async()=>{const e=await Re("5.28.2-prerelease.2842344b.0");return t=>{const n=Pe();return t.addPlugin(e({credentials:n})),t}})().then((t=>{e.addPlugin(t)})).catch((e=>{console.error("Tolgee: Failed to load in-context tools"),console.error(e)})),e});const De="__tolgee_currentLanguage";function _e(e){return e.endsWith("/")?e.slice(0,-1):e}const Ie={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${_e(n)}/${e}/${t}.json`:`${_e(n)}/${t}.json`,getData:function(e){return e.json()},headers:{Accept:"application/json"}};e.BackendFetch=e=>(t,n)=>(n.addBackend(function(e){const{prefix:t,getPath:n,getData:a,headers:o,...r}={...Ie,...e,headers:{...Ie.headers,...null==e?void 0:e.headers}};return{getRecord:({namespace:e,language:i,fetch:s})=>s(n({namespace:e,language:i,prefix:t}),{headers:o,...r}).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return a(e)}))}}(e)),t),e.DEVTOOLS_ID=H,e.DevBackend=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:o,fetch:r}){const i=ke(t)??o;let s=void 0!==i?`${e}/v2/projects/${i}/translations/${n}`:`${e}/v2/projects/translations/${n}`;if(a&&(s+=`?ns=${a}`),"tgpat"===function(e){if(!e)return;const[t]=e.split("_");return"tgpak"===t?"tgpak":"tgpat"===t?"tgpat":"legacy"}(t)&&void 0===o)throw new Error("You need to specify 'projectId' when using PAT key");return r(s,{headers:{"X-API-Key":t||"","Content-Type":"application/json"}}).then((e=>{if(e.ok)return e.json().then((e=>e[n]));throw new Error(e.statusText)}))}}),e),e.DevTools=()=>e=>e,e.FormatSimple=()=>(e,t)=>(t.setFinalFormatter({format:({translation:e,params:t})=>Y(e,t)}),e),e.LanguageDetector=()=>(e,t)=>(t.setLanguageDetector({getLanguage({availableLanguages:e}){ee("LanguageDetector");const t=window.navigator.language,n=e.find((e=>e===t));if(n)return n;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),o=a(window.navigator.language);return e.find((e=>a(e)===o))||void 0}}),e),e.LanguageDetectorError=m,e.LanguageStorage=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(ee("LanguageStorage"),localStorage.getItem(De)||void 0),setLanguage(e){ee("LanguageStorage"),localStorage.setItem(De,e)}}),e),e.LanguageStorageError=y,e.ObserverPlugin=()=>(e,t)=>("text"===e.getInitialOptions().observerType?t.setObserver((()=>{const e=de();return Object.freeze({...e,run(t){const n=we({inputPrefix:t.options.inputPrefix,inputSuffix:t.options.inputSuffix,translate:t.translate});e.run({...t,wrapper:n})},retranslate(){e.forEachElement(((t,n)=>{for(const[t,a]of n.nodes.entries()){if(a.keyAttributeOnly)return;const n=e.unwrap(a.oldTextContent);n&&ae(t,n.text)}}))},outputNotFormattable:!0})})):t.setObserver((()=>{const e=de();return Object.freeze({...e,run(t){const n=Ee({fullKeyEncode:t.options.fullKeyEncode});e.run({...t,wrapper:n})},retranslate(){},outputNotFormattable:!1})})),e),e.PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY="__tolgee_preferredLanguages",e.RecordFetchError=v,e.TOLGEE_ATTRIBUTE_NAME=J,e.TOLGEE_RESTRICT_ATTRIBUTE=q,e.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=X,e.Tolgee=function(){return P().use(e.BrowserExtensionPlugin())},e.TolgeeCore=P,e.createFetchFunction=f,e.getFallback=s,e.getFallbackArray=l,e.getProjectIdFromApiKey=ke,e.getTranslateProps=x,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})})); | ||
//# sourceMappingURL=tolgee-web.production.umd.min.js.map |
{ | ||
"name": "@tolgee/web", | ||
"version": "5.28.1", | ||
"version": "5.28.2-prerelease.2842344b.0", | ||
"description": "Tolgee for web", | ||
@@ -48,3 +48,3 @@ "declaration": true, | ||
"dependencies": { | ||
"@tolgee/core": "5.28.1" | ||
"@tolgee/core": "5.28.2-prerelease.2842344b.0" | ||
}, | ||
@@ -100,3 +100,3 @@ "devDependencies": { | ||
"homepage": "https://github.com/tolgee/tolgee-js#readme", | ||
"gitHead": "ff331bee57abcd8d4d9383fc8995925cb9b352ea", | ||
"gitHead": "49fcd211758c6bb53df3e606af29a29dfbce3d55", | ||
"publishConfig": { | ||
@@ -103,0 +103,0 @@ "access": "public" |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44733686
1
+ Added@tolgee/core@5.28.2-prerelease.2842344b.0(transitive)
- Removed@tolgee/core@5.28.1(transitive)