Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tolgee/core

Package Overview
Dependencies
Maintainers
2
Versions
354
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tolgee/core - npm Package Compare versions

Comparing version 5.11.5 to 5.11.6-prerelease.a415c070.0

6

./dist/tolgee.cjs.js

@@ -968,2 +968,3 @@ 'use strict';

}
let runPromise;
events.onUpdate.listen(() => {

@@ -1144,3 +1145,2 @@ if (state.isRunning()) {

run() {
let result = undefined;
checkCorrectConfiguration();

@@ -1150,5 +1150,5 @@ if (!state.isRunning()) {

pluginService.run();
result = loadInitial();
runPromise = loadInitial();
}
return Promise.resolve(result);
return Promise.resolve(runPromise);
},

@@ -1155,0 +1155,0 @@ stop() {

@@ -968,2 +968,3 @@ 'use strict';

}
let runPromise;
events.onUpdate.listen(() => {

@@ -1144,3 +1145,2 @@ if (state.isRunning()) {

run() {
let result = undefined;
checkCorrectConfiguration();

@@ -1150,5 +1150,5 @@ if (!state.isRunning()) {

pluginService.run();
result = loadInitial();
runPromise = loadInitial();
}
return Promise.resolve(result);
return Promise.resolve(runPromise);
},

@@ -1155,0 +1155,0 @@ stop() {

@@ -1,2 +0,2 @@

"use strict";function e(e){return Boolean(e&&"function"==typeof e.then)}function n(n,t){return e(n)?Promise.resolve(n).then(t):t(n)}function t(e){const n=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),t=n.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...n.slice(0,-2),t].join(", ")} option`}function a(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function i(e){return a(e)||[]}function o(e,n){return"object"!=typeof(t=n)||Array.isArray(t)||null===t?i(n):i(null==n?void 0:n[e]);var t}function r(e){return Array.from(new Set(e))}function s(e){return e?e.replace(/\/+$/,""):e}Object.defineProperty(exports,"__esModule",{value:!0});const g=(e,n)=>fetch(e,n),c=(e=g)=>(n,t)=>e(n,Object.assign(Object.assign({},t),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":process.env.TOLGEE_UI_VERSION||"prerelease"},null==t?void 0:t.headers)}));function l(e){let n=[];return Object.freeze({listen(e){const t=n=>{e(n)};return n.push(t),{unsubscribe(){n=n.filter((e=>t!==e))}}},emit(t){e()&&n.forEach((e=>e({value:t})))}})}function u(e,n,t){const a=new Set,o=new Set;let r=[];function s(){if(0===r.length)return;const e=r;r=[],a.forEach((e=>{e({value:void 0})}));let t=new Set;e.forEach((e=>{void 0===e?t=void 0:void 0!==t&&e.forEach((e=>t.add(e)))}));!function(e){const t=new Set(n());o.forEach((n=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>t.has(e)||n.namespaces.has(e)))))&&n.fn({value:void 0})}))}(t?Array.from(t.keys()):void 0)}return Object.freeze({emit(n,t){e()&&(r.push(n),t?setTimeout(s,0):s())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const n={fn:n=>{e(n)},namespaces:new Set};o.add(n);const a={unsubscribe:()=>{o.delete(n)},subscribeNs:e=>(i(e).forEach((e=>n.namespaces.add(e))),void 0===e&&n.namespaces.add(t()),a)};return a}})}const d=e=>{const n=new Map;return Object.entries(e).forEach((([e,t])=>{null!=t&&("object"!=typeof t?n.set(e,t):d(t).forEach(((t,a)=>{n.set(e+"."+a,t)})))})),n},p=e=>{const[n,...t]=e.split(":");return{language:n,namespace:t.join(":")||""}},f=({language:e,namespace:n})=>n?`${e}:${n}`:e;function v(e,n,t,a,o,s,g){const c=new Map,l=new Map;let u={},v=0;function h(n,t,a){const i=f(n);l.set(i,{data:d(t),version:a}),e.emit(n)}function m(e){let t;if(!t){const n=u[f(e)];"function"==typeof n&&(t=n())}return t||(t=n(e)),t}const b=Object.freeze({addStaticData(e){e&&(u=Object.assign(Object.assign({},u),e),Object.entries(e).forEach((([e,n])=>{if("function"!=typeof n){const t=p(e),a=l.get(e);a&&0!==a.version||h(t,n,0)}})))},invalidate(){c.clear(),v+=1},addRecord(e,n){h(e,n,v)},exists(e,n=!1){const t=l.get(f(e));return t&&n?t.version===v:Boolean(t)},getRecord(e){var n;return null===(n=l.get(f(a(e))))||void 0===n?void 0:n.data},getTranslation(e,n){var t;return null===(t=l.get(f(e)))||void 0===t?void 0:t.data.get(n)},getTranslationNs(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=l.get(f({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return[i]}return r(e)},getTranslationFallback(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=l.get(f({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return n}},changeTranslation(n,t,a){var i;const o=null===(i=l.get(f(n)))||void 0===i?void 0:i.data;null==o||o.set(t,a),e.emit(Object.assign(Object.assign({},n),{key:t}))},isFetching(e){if(o())return!0;if(void 0===e)return c.size>0;const n=i(e);return Boolean(Array.from(c.keys()).find((e=>n.includes(p(e).namespace))))},isLoading(e,n){const t=i(n);return Boolean(o()||Array.from(c.keys()).find((n=>{const a=p(n);return(!t.length||t.includes(a.namespace))&&!b.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,n){const i=e.map((e=>{const i=a(e),o=f(i),r=c.get(o);if(r)return{new:!1,promise:r,keyObject:i,cacheKey:o};const s=function(e,n){var a;let i;return n&&(i=null===(a=t(e))||void 0===a?void 0:a.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),m(e))))),i||(i=m(e)),i}(i,n)||Promise.resolve(void 0);return c.set(o,s),{new:!0,promise:s,keyObject:i,cacheKey:o}}));s.notify(),g.notify();const o=await Promise.all(i.map((e=>e.promise)));return i.forEach(((e,n)=>{const t=c.get(e.cacheKey)!==e.promise;if(e.new&&!t){c.delete(e.cacheKey);const t=o[n];t?b.addRecord(e.keyObject,t):b.getRecord(e.keyObject)||b.addRecord(e.keyObject,{})}})),s.notify(),g.notify(),i.map((e=>b.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(l.entries()).map((([e,n])=>Object.assign(Object.assign({},p(e)),{data:n.data})))});return b}function h(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)n.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(t[a[i]]=e[a[i]])}return t}const m="invalid",b={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:m,apiUrl:"https://app.tolgee.io",fetch:c()},O=(...e)=>{let n={};return e.forEach((e=>{n=Object.assign(Object.assign(Object.assign({},n),e),{observerOptions:Object.assign(Object.assign({},n.observerOptions),null==e?void 0:e.observerOptions)})})),n};function y(e,n){const t=O(b,null==n?void 0:n.initialOptions,e);return t.apiUrl=s(t.apiUrl),(null==e?void 0:e.fetch)&&(t.fetch=c(e.fetch)),{initialOptions:t,activeNamespaces:(null==n?void 0:n.activeNamespaces)||new Map,language:null==n?void 0:n.language,pendingLanguage:null==n?void 0:n.language,isInitialLoading:!1,isRunning:!1}}function L(t,a,i,o,r,s,g){const c={ui:void 0},l={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},u=async({keysAndDefaults:e,event:n})=>{var t;const a=e.map((({key:e,ns:n,defaultValue:t})=>({key:e,defaultValue:t,ns:o({key:e,ns:n}),translation:r({key:e,ns:n})})));null===(t=l.ui)||void 0===t||t.handleElementClick(a,n)},d=(e,n)=>{var t;return(null===(t=l.observer)||void 0===t?void 0:t.findPositions(e,n))||[]};function p(e){const n=r({key:e.key,ns:e.ns});return N.formatTranslation(Object.assign(Object.assign({},e),{translation:n,formatEnabled:!0}))}function f(){return{fetch:a().fetch}}function v(e){l.observer=null==e?void 0:e()}function b(){return Boolean(l.observer)}function O(e){e&&l.formatters.push(e)}function y(e){l.finalFormatter=e}function L(e){c.ui=e}function j(){return Boolean(c.ui)}function k(e){l.languageStorage=e}function R(e){l.languageDetector=e}function w(e){e&&l.backends.push(e)}function E(e){l.devBackend=e}const N=Object.freeze({addPlugin:function(e,n){n(e,Object.freeze({setFinalFormatter:y,addFormatter:O,setObserver:v,hasObserver:b,setUi:L,hasUi:j,setDevBackend:E,addBackend:w,setLanguageDetector:R,setLanguageStorage:k}))},run(){var e,n;const{apiKey:t,apiUrl:i,projectId:o,observerOptions:r}=a();l.ui=null===(e=c.ui)||void 0===e?void 0:e.call(c,{apiKey:t,apiUrl:i,projectId:o,highlight:N.highlight,changeTranslation:s,findPositions:d,onPermanentChange:g}),null===(n=l.observer)||void 0===n||n.run({mouseHighlight:!0,options:r,translate:p,onClick:u})},stop(){var e;l.ui=void 0,null===(e=l.observer)||void 0===e||e.stop()},getLanguageStorage:()=>l.languageStorage,getInitialLanguage(){var e;const t=i();return n(null===(e=l.languageStorage)||void 0===e?void 0:e.getLanguage(f()),(e=>t&&!t.includes(e)||!e?function(){if(!l.languageDetector)return;const e=i();return l.languageDetector.getLanguage(Object.assign({availableLanguages:e},f()))}():e))},setStoredLanguage(e){var n;null===(n=l.languageStorage)||void 0===n||n.setLanguage(e,f())},getDevBackend:()=>l.devBackend,getBackendRecord:({language:n,namespace:t})=>{for(const a of l.backends){const i=a.getRecord(Object.assign({language:n,namespace:t},f()));if(e(i))return null==i?void 0:i.catch((e=>(console.error(e),{})));if(void 0!==i)return i}},getBackendDevRecord:({language:e,namespace:n})=>{var t;const{apiKey:i,apiUrl:o,projectId:r}=a();return null===(t=l.devBackend)||void 0===t?void 0:t.getRecord(Object.assign({apiKey:i,apiUrl:o,projectId:r,language:e,namespace:n},f()))},getLanguageDetector:()=>l.languageDetector,retranslate(){var e;null===(e=l.observer)||void 0===e||e.retranslate()},highlight:(e,n)=>{var t,a;return(null===(a=null===(t=l.observer)||void 0===t?void 0:t.highlight)||void 0===a?void 0:a.call(t,e,n))||{unhighlight(){}}},unwrap(e){var n;return l.observer?null===(n=l.observer)||void 0===n?void 0:n.unwrap(e):{text:e,keys:[]}},wrap(e){var n;return l.observer?null===(n=l.observer)||void 0===n?void 0:n.wrap(e):e.translation},hasDevBackend:()=>Boolean(N.getDevBackend()),formatTranslation(e){var n,{formatEnabled:i}=e,o=h(e,["formatEnabled"]);const{key:r,translation:s,defaultValue:g,noWrap:c,params:u,orEmpty:d,ns:p}=o,f=s||g;let v=f||(d?"":r);const b=t(),O=i||!(null===(n=l.observer)||void 0===n?void 0:n.outputNotFormattable),y=e=>l.observer&&!c?l.observer.wrap({key:r,translation:e,defaultValue:g,params:u,ns:p}):e;v=y(v);try{if(f&&b&&O)for(const e of l.formatters)v=e.format({translation:v,language:b,params:u});l.finalFormatter&&f&&b&&O&&(v=l.finalFormatter.format({translation:v,language:b,params:u}))}catch(e){console.error(e);const n=("string"==typeof(L=e)?L:"string"==typeof(null==L?void 0:L.message)?L.message:void 0)||m,t=a().onFormatError,i=typeof t;v="string"===i?t:"function"===i?t(n,o):m,v=y(v)}var L;return v}});return N}const j=(e,n,t)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=n();a!==e&&t(e),a=e}})};const k=(e,...n)=>{let t,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof n[0]?(a.defaultValue=n[0],t=n[1]):"object"==typeof n[0]&&(t=n[0])),t&&(a=Object.assign(Object.assign({},function(e){var{ns:n,noWrap:t,orEmpty:a,params:i,language:o}=e,r=h(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:n,noWrap:t,orEmpty:a,language:o};return Object.assign(Object.assign({},s),{params:Object.assign({},r)})}(t)),a)),a};function R({options:a}){const g=function(e,n){let t=!0;function a(){return t}const i=Object.freeze({onPendingLanguageChange:l(a),onLanguageChange:l(a),onLoadingChange:l(a),onFetchingChange:l(a),onInitialLoaded:l(a),onRunningChange:l(a),onCacheChange:l(a),onUpdate:u(a,e,n),onPermanentChange:l(a),setEmitterActive(e){t=e},on:(e,n)=>{switch(e){case"pendingLanguage":return i.onPendingLanguageChange.listen(n);case"language":return i.onLanguageChange.listen(n);case"loading":return i.onLoadingChange.listen(n);case"fetching":return i.onFetchingChange.listen(n);case"initialLoad":return i.onInitialLoaded.listen(n);case"running":return i.onRunningChange.listen(n);case"cache":return i.onCacheChange.listen(n);case"update":return i.onUpdate.listen(n);case"permanentChange":return i.onPermanentChange.listen(n)}}});return i.onInitialLoaded.listen((()=>i.onUpdate.emit())),i.onLanguageChange.listen((()=>i.onUpdate.emit())),i.onCacheChange.listen((({value:e})=>i.onUpdate.emit([e.namespace],!0))),i}(b,O),c=j(!1,(()=>m.isFetching()),g.onFetchingChange.emit),d=j(!1,(()=>A.isLoading()),g.onLoadingChange.emit),f=function(e,n,t){let a,g=y();const c=Object.freeze({init(e){g=y(e,g)},isRunning:()=>g.isRunning,setRunning(e){g.isRunning!==e&&(g.isRunning=e,t.emit(e))},isInitialLoading:()=>g.isInitialLoading,setInitialLoading(e){g.isInitialLoading=e},getLanguage:()=>g.language||g.initialOptions.language,setLanguage(n){g.language!==n&&(g.language=n,e.emit(n))},getPendingLanguage:()=>g.pendingLanguage||c.getLanguage(),setPendingLanguage(e){g.pendingLanguage!==e&&(g.pendingLanguage=e,n.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},g.initialOptions),a),addActiveNs(e){i(e).forEach((e=>{const n=g.activeNamespaces.get(e);void 0!==n?g.activeNamespaces.set(e,n+1):g.activeNamespaces.set(e,1)}))},removeActiveNs(e){i(e).forEach((e=>{const n=g.activeNamespaces.get(e);void 0!==n&&n>1?g.activeNamespaces.set(e,n-1):g.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>r([...g.initialOptions.ns||[g.initialOptions.defaultNs],...i(g.initialOptions.fallbackNs),...g.activeNamespaces.keys()]),getFallbackLangs(e){const n=e||c.getLanguage();return n?r([n,...o(n,g.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>i(g.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?g.initialOptions.defaultNs:e,getAvailableLanguages(){if(g.initialOptions.availableLanguages)return g.initialOptions.availableLanguages;if(g.initialOptions.staticData){const e=Object.keys(g.initialOptions.staticData).map((e=>p(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?c.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:s(e.apiUrl)}):void 0}});return c}(g.onLanguageChange,g.onPendingLanguageChange,g.onRunningChange),h=L(f.getLanguage,f.getInitialOptions,f.getAvailableLanguages,(function({key:e,ns:n}){const t=f.getFallbackLangs(),a=R(n||void 0);return m.getTranslationNs(a,t,e)}),D,E,(function(e){g.onPermanentChange.emit({key:e.key,namespace:e.namespace})})),m=v(g.onCacheChange,h.getBackendRecord,h.getBackendDevRecord,f.withDefaultNs,f.isInitialLoading,c,d);function b(){return f.getFallbackNs()}function O(e){return f.getDefaultNs(e)}function R(e){return[...i(O(e)),...b()]}function w(e){return[...i(e||O()),...f.getRequiredNamespaces()]}function E(e,n,t){const a=f.withDefaultNs(e),i=m.getTranslation(a,n);return m.changeTranslation(a,n,t),{revert(){m.changeTranslation(a,n,i)}}}function N(e){f.init(e),m.addStaticData(f.getInitialOptions().staticData)}function C(e,t){const a=function(e,n){const t=f.getFallbackLangs(e),a=w(n),i=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n},!0)||i.push({language:e,namespace:n})}))})),i}(e,t);if(a.length)return n(A.loadRecords(a),(()=>{}))}function D({key:e,ns:n,language:t}){const a=R(n||void 0),i=f.getFallbackLangs(t);return m.getTranslationFallback(a,i,e)}function I(){const t=n(function(){if(f.getLanguage())return;return n(h.getInitialLanguage(),(e=>{const n=e||f.getInitialOptions().defaultLanguage;n&&f.setLanguage(n)}))}(),(()=>C()));if(e(t))return f.setInitialLoading(!0),c.notify(),d.notify(),Promise.resolve(t).then((()=>{f.setInitialLoading(!1),c.notify(),d.notify(),g.onInitialLoaded.emit()}));g.onInitialLoaded.emit()}a&&N(a),g.onUpdate.listen((()=>{f.isRunning()&&h.retranslate()}));const A=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},g),f),h),m),{init:N,getTranslation:D,changeTranslation:E,async changeLanguage(e){f.getPendingLanguage()===e&&f.getLanguage()===e||(f.setPendingLanguage(e),f.isRunning()&&await C(e),e===f.getPendingLanguage()&&(f.setLanguage(e),h.setStoredLanguage(e)))},async addActiveNs(e,n){n||f.addActiveNs(e),f.isRunning()&&await C(void 0,e)},loadRecords:e=>m.loadRecords(e,A.isDev()),loadRecord:async e=>(await A.loadRecords([e]))[0],isLoading:e=>m.isLoading(f.getLanguage(),e),isLoaded(e){const n=f.getLanguage();if(!n)return!1;const t=f.getFallbackLangs(n),a=w(e),i=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n})||i.push({language:e,namespace:n})}))})),0===i.length},t:(...e)=>{const n=k(...e),t=D(n);return h.formatTranslation(Object.assign(Object.assign({},n),{translation:t}))},isDev:()=>Boolean(f.getInitialOptions().apiKey&&f.getInitialOptions().apiUrl),run(){let e;return function(){if((h.getLanguageDetector()||h.getLanguageStorage())&&!f.getAvailableLanguages())throw new Error(t("availableLanguages"));if(!f.getLanguage()&&!f.getInitialOptions().defaultLanguage)throw new Error(t(["defaultLanguage","language"]))}(),f.isRunning()||(f.setRunning(!0),h.run(),e=I()),Promise.resolve(e)},stop(){f.isRunning()&&(h.stop(),f.setRunning(!1))}}));return A}const w=0,E=1,N=2;class C extends Error{constructor(e,n,t){let a;a=e===w?"Empty parameter":e===E?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${n} in "${t}"`),this.code=e,this.index=n}}function D(e){return/\s/.test(e)}const I=0,A=1,F=2,S=3,P=4,T=new Set([F,A,I]),U="'",x=new Set(["{","}",U]),B=e=>/[0-9a-zA-Z_]/.test(e);function z(e,n){const[t,a]=function(e){let n=I,t="",a="",i="";const o=[],r=[];let s=0;function g(n){throw new C(n,s,e)}const c=()=>{o.push(t),t=""},l=()=>{""===a&&g(w),r.push(a),a=""};for(s=0;s<e.length;s++)switch(i=e[s],n){case I:i===U?(t+=i,n=A):"{"===i?(c(),n=S):(t+=i,n=I);break;case A:x.has(i)?(t=t.slice(0,-1)+i,n=F):(t+=i,n=I);break;case F:i===U?n=I:(t+=i,n=F);break;case S:"}"===i?(l(),n=I):D(i)?""!==a&&(l(),n=P):(B(i)||g(E),a+=i,n=S);break;case P:"}"==i?n=I:D(i)?n=P:g(E)}return T.has(n)||g(N),c(),[o,r]}(e),i=[t[0]];for(let o=1;o<t.length;o++){const r=null==n?void 0:n[a[o-1]];if(void 0===r)throw new Error(`Missing parameter "${a[o-1]}" in "${e}"`);i.push(String(r)),i.push(t[o])}return i.join("")}exports.FormatSimple=()=>(e,n)=>(n.setFinalFormatter({format:({translation:e,params:n})=>z(e,n)}),e),exports.TolgeeCore=()=>{const e={plugins:[],options:{}},n=Object.freeze({use:t=>(e.plugins.push(t),n),updateDefaults:t=>(e.options=O(e.options,t),n),init(n){const t=function(e){const n=R({options:e});function t(e){const t=n.isRunning();t&&n.stop(),e(),n.isDev()&&n.invalidate(),t&&n.run()}n.isDev()&&n.invalidate();const a=Object.freeze({on:n.on,onNsUpdate:n.onUpdate.listenSome,setEmitterActive:n.setEmitterActive,getLanguage:n.getLanguage,getPendingLanguage:n.getPendingLanguage,changeLanguage:n.changeLanguage,changeTranslation:n.changeTranslation,addActiveNs:n.addActiveNs,removeActiveNs:n.removeActiveNs,loadRecords:n.loadRecords,loadRecord:n.loadRecord,addStaticData:n.addStaticData,getRecord:n.getRecord,getAllRecords:n.getAllRecords,isLoaded:n.isLoaded,isInitialLoading:n.isInitialLoading,isLoading:n.isLoading,isFetching:n.isFetching,isRunning:n.isRunning,run:n.run,stop:n.stop,t:n.t,highlight:n.highlight,getInitialOptions:n.getInitialOptions,isDev:n.isDev,wrap:n.wrap,unwrap:n.unwrap,overrideCredentials(e){t((()=>n.overrideCredentials(e)))},addPlugin(e){e&&t((()=>n.addPlugin(a,e)))},updateOptions(e){e&&t((()=>n.init(e)))}});return a}(O(e.options,n));return e.plugins.forEach(t.addPlugin),t}});return n},exports.createFetchFunction=c,exports.getFallback=a,exports.getFallbackArray=i,exports.getTranslateProps=k;
"use strict";function e(e){return Boolean(e&&"function"==typeof e.then)}function n(n,t){return e(n)?Promise.resolve(n).then(t):t(n)}function t(e){const n=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),t=n.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...n.slice(0,-2),t].join(", ")} option`}function a(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function i(e){return a(e)||[]}function o(e,n){return"object"!=typeof(t=n)||Array.isArray(t)||null===t?i(n):i(null==n?void 0:n[e]);var t}function s(e){return Array.from(new Set(e))}function r(e){return e?e.replace(/\/+$/,""):e}Object.defineProperty(exports,"__esModule",{value:!0});const g=(e,n)=>fetch(e,n),c=(e=g)=>(n,t)=>e(n,Object.assign(Object.assign({},t),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":process.env.TOLGEE_UI_VERSION||"prerelease"},null==t?void 0:t.headers)}));function l(e){let n=[];return Object.freeze({listen(e){const t=n=>{e(n)};return n.push(t),{unsubscribe(){n=n.filter((e=>t!==e))}}},emit(t){e()&&n.forEach((e=>e({value:t})))}})}function u(e,n,t){const a=new Set,o=new Set;let s=[];function r(){if(0===s.length)return;const e=s;s=[],a.forEach((e=>{e({value:void 0})}));let t=new Set;e.forEach((e=>{void 0===e?t=void 0:void 0!==t&&e.forEach((e=>t.add(e)))}));!function(e){const t=new Set(n());o.forEach((n=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>t.has(e)||n.namespaces.has(e)))))&&n.fn({value:void 0})}))}(t?Array.from(t.keys()):void 0)}return Object.freeze({emit(n,t){e()&&(s.push(n),t?setTimeout(r,0):r())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const n={fn:n=>{e(n)},namespaces:new Set};o.add(n);const a={unsubscribe:()=>{o.delete(n)},subscribeNs:e=>(i(e).forEach((e=>n.namespaces.add(e))),void 0===e&&n.namespaces.add(t()),a)};return a}})}const d=e=>{const n=new Map;return Object.entries(e).forEach((([e,t])=>{null!=t&&("object"!=typeof t?n.set(e,t):d(t).forEach(((t,a)=>{n.set(e+"."+a,t)})))})),n},p=e=>{const[n,...t]=e.split(":");return{language:n,namespace:t.join(":")||""}},f=({language:e,namespace:n})=>n?`${e}:${n}`:e;function v(e,n,t,a,o,r,g){const c=new Map,l=new Map;let u={},v=0;function h(n,t,a){const i=f(n);l.set(i,{data:d(t),version:a}),e.emit(n)}function m(e){let t;if(!t){const n=u[f(e)];"function"==typeof n&&(t=n())}return t||(t=n(e)),t}const b=Object.freeze({addStaticData(e){e&&(u=Object.assign(Object.assign({},u),e),Object.entries(e).forEach((([e,n])=>{if("function"!=typeof n){const t=p(e),a=l.get(e);a&&0!==a.version||h(t,n,0)}})))},invalidate(){c.clear(),v+=1},addRecord(e,n){h(e,n,v)},exists(e,n=!1){const t=l.get(f(e));return t&&n?t.version===v:Boolean(t)},getRecord(e){var n;return null===(n=l.get(f(a(e))))||void 0===n?void 0:n.data},getTranslation(e,n){var t;return null===(t=l.get(f(e)))||void 0===t?void 0:t.data.get(n)},getTranslationNs(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=l.get(f({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return[i]}return s(e)},getTranslationFallback(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=l.get(f({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return n}},changeTranslation(n,t,a){var i;const o=null===(i=l.get(f(n)))||void 0===i?void 0:i.data;null==o||o.set(t,a),e.emit(Object.assign(Object.assign({},n),{key:t}))},isFetching(e){if(o())return!0;if(void 0===e)return c.size>0;const n=i(e);return Boolean(Array.from(c.keys()).find((e=>n.includes(p(e).namespace))))},isLoading(e,n){const t=i(n);return Boolean(o()||Array.from(c.keys()).find((n=>{const a=p(n);return(!t.length||t.includes(a.namespace))&&!b.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,n){const i=e.map((e=>{const i=a(e),o=f(i),s=c.get(o);if(s)return{new:!1,promise:s,keyObject:i,cacheKey:o};const r=function(e,n){var a;let i;return n&&(i=null===(a=t(e))||void 0===a?void 0:a.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),m(e))))),i||(i=m(e)),i}(i,n)||Promise.resolve(void 0);return c.set(o,r),{new:!0,promise:r,keyObject:i,cacheKey:o}}));r.notify(),g.notify();const o=await Promise.all(i.map((e=>e.promise)));return i.forEach(((e,n)=>{const t=c.get(e.cacheKey)!==e.promise;if(e.new&&!t){c.delete(e.cacheKey);const t=o[n];t?b.addRecord(e.keyObject,t):b.getRecord(e.keyObject)||b.addRecord(e.keyObject,{})}})),r.notify(),g.notify(),i.map((e=>b.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(l.entries()).map((([e,n])=>Object.assign(Object.assign({},p(e)),{data:n.data})))});return b}function h(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)n.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(t[a[i]]=e[a[i]])}return t}const m="invalid",b={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:m,apiUrl:"https://app.tolgee.io",fetch:c()},O=(...e)=>{let n={};return e.forEach((e=>{n=Object.assign(Object.assign(Object.assign({},n),e),{observerOptions:Object.assign(Object.assign({},n.observerOptions),null==e?void 0:e.observerOptions)})})),n};function y(e,n){const t=O(b,null==n?void 0:n.initialOptions,e);return t.apiUrl=r(t.apiUrl),(null==e?void 0:e.fetch)&&(t.fetch=c(e.fetch)),{initialOptions:t,activeNamespaces:(null==n?void 0:n.activeNamespaces)||new Map,language:null==n?void 0:n.language,pendingLanguage:null==n?void 0:n.language,isInitialLoading:!1,isRunning:!1}}function L(t,a,i,o,s,r,g){const c={ui:void 0},l={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},u=async({keysAndDefaults:e,event:n})=>{var t;const a=e.map((({key:e,ns:n,defaultValue:t})=>({key:e,defaultValue:t,ns:o({key:e,ns:n}),translation:s({key:e,ns:n})})));null===(t=l.ui)||void 0===t||t.handleElementClick(a,n)},d=(e,n)=>{var t;return(null===(t=l.observer)||void 0===t?void 0:t.findPositions(e,n))||[]};function p(e){const n=s({key:e.key,ns:e.ns});return N.formatTranslation(Object.assign(Object.assign({},e),{translation:n,formatEnabled:!0}))}function f(){return{fetch:a().fetch}}function v(e){l.observer=null==e?void 0:e()}function b(){return Boolean(l.observer)}function O(e){e&&l.formatters.push(e)}function y(e){l.finalFormatter=e}function L(e){c.ui=e}function j(){return Boolean(c.ui)}function k(e){l.languageStorage=e}function R(e){l.languageDetector=e}function w(e){e&&l.backends.push(e)}function E(e){l.devBackend=e}const N=Object.freeze({addPlugin:function(e,n){n(e,Object.freeze({setFinalFormatter:y,addFormatter:O,setObserver:v,hasObserver:b,setUi:L,hasUi:j,setDevBackend:E,addBackend:w,setLanguageDetector:R,setLanguageStorage:k}))},run(){var e,n;const{apiKey:t,apiUrl:i,projectId:o,observerOptions:s}=a();l.ui=null===(e=c.ui)||void 0===e?void 0:e.call(c,{apiKey:t,apiUrl:i,projectId:o,highlight:N.highlight,changeTranslation:r,findPositions:d,onPermanentChange:g}),null===(n=l.observer)||void 0===n||n.run({mouseHighlight:!0,options:s,translate:p,onClick:u})},stop(){var e;l.ui=void 0,null===(e=l.observer)||void 0===e||e.stop()},getLanguageStorage:()=>l.languageStorage,getInitialLanguage(){var e;const t=i();return n(null===(e=l.languageStorage)||void 0===e?void 0:e.getLanguage(f()),(e=>t&&!t.includes(e)||!e?function(){if(!l.languageDetector)return;const e=i();return l.languageDetector.getLanguage(Object.assign({availableLanguages:e},f()))}():e))},setStoredLanguage(e){var n;null===(n=l.languageStorage)||void 0===n||n.setLanguage(e,f())},getDevBackend:()=>l.devBackend,getBackendRecord:({language:n,namespace:t})=>{for(const a of l.backends){const i=a.getRecord(Object.assign({language:n,namespace:t},f()));if(e(i))return null==i?void 0:i.catch((e=>(console.error(e),{})));if(void 0!==i)return i}},getBackendDevRecord:({language:e,namespace:n})=>{var t;const{apiKey:i,apiUrl:o,projectId:s}=a();return null===(t=l.devBackend)||void 0===t?void 0:t.getRecord(Object.assign({apiKey:i,apiUrl:o,projectId:s,language:e,namespace:n},f()))},getLanguageDetector:()=>l.languageDetector,retranslate(){var e;null===(e=l.observer)||void 0===e||e.retranslate()},highlight:(e,n)=>{var t,a;return(null===(a=null===(t=l.observer)||void 0===t?void 0:t.highlight)||void 0===a?void 0:a.call(t,e,n))||{unhighlight(){}}},unwrap(e){var n;return l.observer?null===(n=l.observer)||void 0===n?void 0:n.unwrap(e):{text:e,keys:[]}},wrap(e){var n;return l.observer?null===(n=l.observer)||void 0===n?void 0:n.wrap(e):e.translation},hasDevBackend:()=>Boolean(N.getDevBackend()),formatTranslation(e){var n,{formatEnabled:i}=e,o=h(e,["formatEnabled"]);const{key:s,translation:r,defaultValue:g,noWrap:c,params:u,orEmpty:d,ns:p}=o,f=r||g;let v=f||(d?"":s);const b=t(),O=i||!(null===(n=l.observer)||void 0===n?void 0:n.outputNotFormattable),y=e=>l.observer&&!c?l.observer.wrap({key:s,translation:e,defaultValue:g,params:u,ns:p}):e;v=y(v);try{if(f&&b&&O)for(const e of l.formatters)v=e.format({translation:v,language:b,params:u});l.finalFormatter&&f&&b&&O&&(v=l.finalFormatter.format({translation:v,language:b,params:u}))}catch(e){console.error(e);const n=("string"==typeof(L=e)?L:"string"==typeof(null==L?void 0:L.message)?L.message:void 0)||m,t=a().onFormatError,i=typeof t;v="string"===i?t:"function"===i?t(n,o):m,v=y(v)}var L;return v}});return N}const j=(e,n,t)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=n();a!==e&&t(e),a=e}})};const k=(e,...n)=>{let t,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof n[0]?(a.defaultValue=n[0],t=n[1]):"object"==typeof n[0]&&(t=n[0])),t&&(a=Object.assign(Object.assign({},function(e){var{ns:n,noWrap:t,orEmpty:a,params:i,language:o}=e,s=h(e,["ns","noWrap","orEmpty","params","language"]);const r={ns:n,noWrap:t,orEmpty:a,language:o};return Object.assign(Object.assign({},r),{params:Object.assign({},s)})}(t)),a)),a};function R({options:a}){const g=function(e,n){let t=!0;function a(){return t}const i=Object.freeze({onPendingLanguageChange:l(a),onLanguageChange:l(a),onLoadingChange:l(a),onFetchingChange:l(a),onInitialLoaded:l(a),onRunningChange:l(a),onCacheChange:l(a),onUpdate:u(a,e,n),onPermanentChange:l(a),setEmitterActive(e){t=e},on:(e,n)=>{switch(e){case"pendingLanguage":return i.onPendingLanguageChange.listen(n);case"language":return i.onLanguageChange.listen(n);case"loading":return i.onLoadingChange.listen(n);case"fetching":return i.onFetchingChange.listen(n);case"initialLoad":return i.onInitialLoaded.listen(n);case"running":return i.onRunningChange.listen(n);case"cache":return i.onCacheChange.listen(n);case"update":return i.onUpdate.listen(n);case"permanentChange":return i.onPermanentChange.listen(n)}}});return i.onInitialLoaded.listen((()=>i.onUpdate.emit())),i.onLanguageChange.listen((()=>i.onUpdate.emit())),i.onCacheChange.listen((({value:e})=>i.onUpdate.emit([e.namespace],!0))),i}(O,R),c=j(!1,(()=>m.isFetching()),g.onFetchingChange.emit),d=j(!1,(()=>F.isLoading()),g.onLoadingChange.emit),f=function(e,n,t){let a,g=y();const c=Object.freeze({init(e){g=y(e,g)},isRunning:()=>g.isRunning,setRunning(e){g.isRunning!==e&&(g.isRunning=e,t.emit(e))},isInitialLoading:()=>g.isInitialLoading,setInitialLoading(e){g.isInitialLoading=e},getLanguage:()=>g.language||g.initialOptions.language,setLanguage(n){g.language!==n&&(g.language=n,e.emit(n))},getPendingLanguage:()=>g.pendingLanguage||c.getLanguage(),setPendingLanguage(e){g.pendingLanguage!==e&&(g.pendingLanguage=e,n.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},g.initialOptions),a),addActiveNs(e){i(e).forEach((e=>{const n=g.activeNamespaces.get(e);void 0!==n?g.activeNamespaces.set(e,n+1):g.activeNamespaces.set(e,1)}))},removeActiveNs(e){i(e).forEach((e=>{const n=g.activeNamespaces.get(e);void 0!==n&&n>1?g.activeNamespaces.set(e,n-1):g.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>s([...g.initialOptions.ns||[g.initialOptions.defaultNs],...i(g.initialOptions.fallbackNs),...g.activeNamespaces.keys()]),getFallbackLangs(e){const n=e||c.getLanguage();return n?s([n,...o(n,g.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>i(g.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?g.initialOptions.defaultNs:e,getAvailableLanguages(){if(g.initialOptions.availableLanguages)return g.initialOptions.availableLanguages;if(g.initialOptions.staticData){const e=Object.keys(g.initialOptions.staticData).map((e=>p(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?c.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:r(e.apiUrl)}):void 0}});return c}(g.onLanguageChange,g.onPendingLanguageChange,g.onRunningChange),h=L(f.getLanguage,f.getInitialOptions,f.getAvailableLanguages,(function({key:e,ns:n}){const t=f.getFallbackLangs(),a=w(n||void 0);return m.getTranslationNs(a,t,e)}),I,N,(function(e){g.onPermanentChange.emit({key:e.key,namespace:e.namespace})})),m=v(g.onCacheChange,h.getBackendRecord,h.getBackendDevRecord,f.withDefaultNs,f.isInitialLoading,c,d);let b;function O(){return f.getFallbackNs()}function R(e){return f.getDefaultNs(e)}function w(e){return[...i(R(e)),...O()]}function E(e){return[...i(e||R()),...f.getRequiredNamespaces()]}function N(e,n,t){const a=f.withDefaultNs(e),i=m.getTranslation(a,n);return m.changeTranslation(a,n,t),{revert(){m.changeTranslation(a,n,i)}}}function C(e){f.init(e),m.addStaticData(f.getInitialOptions().staticData)}function D(e,t){const a=function(e,n){const t=f.getFallbackLangs(e),a=E(n),i=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n},!0)||i.push({language:e,namespace:n})}))})),i}(e,t);if(a.length)return n(F.loadRecords(a),(()=>{}))}function I({key:e,ns:n,language:t}){const a=w(n||void 0),i=f.getFallbackLangs(t);return m.getTranslationFallback(a,i,e)}function A(){const t=n(function(){if(f.getLanguage())return;return n(h.getInitialLanguage(),(e=>{const n=e||f.getInitialOptions().defaultLanguage;n&&f.setLanguage(n)}))}(),(()=>D()));if(e(t))return f.setInitialLoading(!0),c.notify(),d.notify(),Promise.resolve(t).then((()=>{f.setInitialLoading(!1),c.notify(),d.notify(),g.onInitialLoaded.emit()}));g.onInitialLoaded.emit()}a&&C(a),g.onUpdate.listen((()=>{f.isRunning()&&h.retranslate()}));const F=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},g),f),h),m),{init:C,getTranslation:I,changeTranslation:N,async changeLanguage(e){f.getPendingLanguage()===e&&f.getLanguage()===e||(f.setPendingLanguage(e),f.isRunning()&&await D(e),e===f.getPendingLanguage()&&(f.setLanguage(e),h.setStoredLanguage(e)))},async addActiveNs(e,n){n||f.addActiveNs(e),f.isRunning()&&await D(void 0,e)},loadRecords:e=>m.loadRecords(e,F.isDev()),loadRecord:async e=>(await F.loadRecords([e]))[0],isLoading:e=>m.isLoading(f.getLanguage(),e),isLoaded(e){const n=f.getLanguage();if(!n)return!1;const t=f.getFallbackLangs(n),a=E(e),i=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n})||i.push({language:e,namespace:n})}))})),0===i.length},t:(...e)=>{const n=k(...e),t=I(n);return h.formatTranslation(Object.assign(Object.assign({},n),{translation:t}))},isDev:()=>Boolean(f.getInitialOptions().apiKey&&f.getInitialOptions().apiUrl),run:()=>(function(){if((h.getLanguageDetector()||h.getLanguageStorage())&&!f.getAvailableLanguages())throw new Error(t("availableLanguages"));if(!f.getLanguage()&&!f.getInitialOptions().defaultLanguage)throw new Error(t(["defaultLanguage","language"]))}(),f.isRunning()||(f.setRunning(!0),h.run(),b=A()),Promise.resolve(b)),stop(){f.isRunning()&&(h.stop(),f.setRunning(!1))}}));return F}const w=0,E=1,N=2;class C extends Error{constructor(e,n,t){let a;a=e===w?"Empty parameter":e===E?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${n} in "${t}"`),this.code=e,this.index=n}}function D(e){return/\s/.test(e)}const I=0,A=1,F=2,S=3,P=4,T=new Set([F,A,I]),U="'",x=new Set(["{","}",U]),B=e=>/[0-9a-zA-Z_]/.test(e);function z(e,n){const[t,a]=function(e){let n=I,t="",a="",i="";const o=[],s=[];let r=0;function g(n){throw new C(n,r,e)}const c=()=>{o.push(t),t=""},l=()=>{""===a&&g(w),s.push(a),a=""};for(r=0;r<e.length;r++)switch(i=e[r],n){case I:i===U?(t+=i,n=A):"{"===i?(c(),n=S):(t+=i,n=I);break;case A:x.has(i)?(t=t.slice(0,-1)+i,n=F):(t+=i,n=I);break;case F:i===U?n=I:(t+=i,n=F);break;case S:"}"===i?(l(),n=I):D(i)?""!==a&&(l(),n=P):(B(i)||g(E),a+=i,n=S);break;case P:"}"==i?n=I:D(i)?n=P:g(E)}return T.has(n)||g(N),c(),[o,s]}(e),i=[t[0]];for(let o=1;o<t.length;o++){const s=null==n?void 0:n[a[o-1]];if(void 0===s)throw new Error(`Missing parameter "${a[o-1]}" in "${e}"`);i.push(String(s)),i.push(t[o])}return i.join("")}exports.FormatSimple=()=>(e,n)=>(n.setFinalFormatter({format:({translation:e,params:n})=>z(e,n)}),e),exports.TolgeeCore=()=>{const e={plugins:[],options:{}},n=Object.freeze({use:t=>(e.plugins.push(t),n),updateDefaults:t=>(e.options=O(e.options,t),n),init(n){const t=function(e){const n=R({options:e});function t(e){const t=n.isRunning();t&&n.stop(),e(),n.isDev()&&n.invalidate(),t&&n.run()}n.isDev()&&n.invalidate();const a=Object.freeze({on:n.on,onNsUpdate:n.onUpdate.listenSome,setEmitterActive:n.setEmitterActive,getLanguage:n.getLanguage,getPendingLanguage:n.getPendingLanguage,changeLanguage:n.changeLanguage,changeTranslation:n.changeTranslation,addActiveNs:n.addActiveNs,removeActiveNs:n.removeActiveNs,loadRecords:n.loadRecords,loadRecord:n.loadRecord,addStaticData:n.addStaticData,getRecord:n.getRecord,getAllRecords:n.getAllRecords,isLoaded:n.isLoaded,isInitialLoading:n.isInitialLoading,isLoading:n.isLoading,isFetching:n.isFetching,isRunning:n.isRunning,run:n.run,stop:n.stop,t:n.t,highlight:n.highlight,getInitialOptions:n.getInitialOptions,isDev:n.isDev,wrap:n.wrap,unwrap:n.unwrap,overrideCredentials(e){t((()=>n.overrideCredentials(e)))},addPlugin(e){e&&t((()=>n.addPlugin(a,e)))},updateOptions(e){e&&t((()=>n.init(e)))}});return a}(O(e.options,n));return e.plugins.forEach(t.addPlugin),t}});return n},exports.createFetchFunction=c,exports.getFallback=a,exports.getFallbackArray=i,exports.getTranslateProps=k;
//# sourceMappingURL=tolgee.cjs.min.js.map

@@ -964,2 +964,3 @@ function isPromise(value) {

}
let runPromise;
events.onUpdate.listen(() => {

@@ -1140,3 +1141,2 @@ if (state.isRunning()) {

run() {
let result = undefined;
checkCorrectConfiguration();

@@ -1146,5 +1146,5 @@ if (!state.isRunning()) {

pluginService.run();
result = loadInitial();
runPromise = loadInitial();
}
return Promise.resolve(result);
return Promise.resolve(runPromise);
},

@@ -1151,0 +1151,0 @@ stop() {

@@ -1,2 +0,2 @@

function e(e){return Boolean(e&&"function"==typeof e.then)}function n(n,t){return e(n)?Promise.resolve(n).then(t):t(n)}function t(e){const n=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),t=n.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...n.slice(0,-2),t].join(", ")} option`}function a(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function i(e){return a(e)||[]}function o(e,n){return"object"!=typeof(t=n)||Array.isArray(t)||null===t?i(n):i(null==n?void 0:n[e]);var t}function s(e){return Array.from(new Set(e))}function r(e){return e?e.replace(/\/+$/,""):e}const g=(e,n)=>fetch(e,n),c=(e=g)=>(n,t)=>e(n,Object.assign(Object.assign({},t),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":process.env.TOLGEE_UI_VERSION||"prerelease"},null==t?void 0:t.headers)}));function l(e){let n=[];return Object.freeze({listen(e){const t=n=>{e(n)};return n.push(t),{unsubscribe(){n=n.filter((e=>t!==e))}}},emit(t){e()&&n.forEach((e=>e({value:t})))}})}function u(e,n,t){const a=new Set,o=new Set;let s=[];function r(){if(0===s.length)return;const e=s;s=[],a.forEach((e=>{e({value:void 0})}));let t=new Set;e.forEach((e=>{void 0===e?t=void 0:void 0!==t&&e.forEach((e=>t.add(e)))}));!function(e){const t=new Set(n());o.forEach((n=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>t.has(e)||n.namespaces.has(e)))))&&n.fn({value:void 0})}))}(t?Array.from(t.keys()):void 0)}return Object.freeze({emit(n,t){e()&&(s.push(n),t?setTimeout(r,0):r())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const n={fn:n=>{e(n)},namespaces:new Set};o.add(n);const a={unsubscribe:()=>{o.delete(n)},subscribeNs:e=>(i(e).forEach((e=>n.namespaces.add(e))),void 0===e&&n.namespaces.add(t()),a)};return a}})}const d=e=>{const n=new Map;return Object.entries(e).forEach((([e,t])=>{null!=t&&("object"!=typeof t?n.set(e,t):d(t).forEach(((t,a)=>{n.set(e+"."+a,t)})))})),n},p=e=>{const[n,...t]=e.split(":");return{language:n,namespace:t.join(":")||""}},f=({language:e,namespace:n})=>n?`${e}:${n}`:e;function v(e,n,t,a,o,r,g){const c=new Map,l=new Map;let u={},v=0;function h(n,t,a){const i=f(n);l.set(i,{data:d(t),version:a}),e.emit(n)}function m(e){let t;if(!t){const n=u[f(e)];"function"==typeof n&&(t=n())}return t||(t=n(e)),t}const b=Object.freeze({addStaticData(e){e&&(u=Object.assign(Object.assign({},u),e),Object.entries(e).forEach((([e,n])=>{if("function"!=typeof n){const t=p(e),a=l.get(e);a&&0!==a.version||h(t,n,0)}})))},invalidate(){c.clear(),v+=1},addRecord(e,n){h(e,n,v)},exists(e,n=!1){const t=l.get(f(e));return t&&n?t.version===v:Boolean(t)},getRecord(e){var n;return null===(n=l.get(f(a(e))))||void 0===n?void 0:n.data},getTranslation(e,n){var t;return null===(t=l.get(f(e)))||void 0===t?void 0:t.data.get(n)},getTranslationNs(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=l.get(f({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return[i]}return s(e)},getTranslationFallback(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=l.get(f({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return n}},changeTranslation(n,t,a){var i;const o=null===(i=l.get(f(n)))||void 0===i?void 0:i.data;null==o||o.set(t,a),e.emit(Object.assign(Object.assign({},n),{key:t}))},isFetching(e){if(o())return!0;if(void 0===e)return c.size>0;const n=i(e);return Boolean(Array.from(c.keys()).find((e=>n.includes(p(e).namespace))))},isLoading(e,n){const t=i(n);return Boolean(o()||Array.from(c.keys()).find((n=>{const a=p(n);return(!t.length||t.includes(a.namespace))&&!b.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,n){const i=e.map((e=>{const i=a(e),o=f(i),s=c.get(o);if(s)return{new:!1,promise:s,keyObject:i,cacheKey:o};const r=function(e,n){var a;let i;return n&&(i=null===(a=t(e))||void 0===a?void 0:a.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),m(e))))),i||(i=m(e)),i}(i,n)||Promise.resolve(void 0);return c.set(o,r),{new:!0,promise:r,keyObject:i,cacheKey:o}}));r.notify(),g.notify();const o=await Promise.all(i.map((e=>e.promise)));return i.forEach(((e,n)=>{const t=c.get(e.cacheKey)!==e.promise;if(e.new&&!t){c.delete(e.cacheKey);const t=o[n];t?b.addRecord(e.keyObject,t):b.getRecord(e.keyObject)||b.addRecord(e.keyObject,{})}})),r.notify(),g.notify(),i.map((e=>b.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(l.entries()).map((([e,n])=>Object.assign(Object.assign({},p(e)),{data:n.data})))});return b}function h(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)n.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(t[a[i]]=e[a[i]])}return t}const m="invalid",b={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:m,apiUrl:"https://app.tolgee.io",fetch:c()},O=(...e)=>{let n={};return e.forEach((e=>{n=Object.assign(Object.assign(Object.assign({},n),e),{observerOptions:Object.assign(Object.assign({},n.observerOptions),null==e?void 0:e.observerOptions)})})),n};function y(e,n){const t=O(b,null==n?void 0:n.initialOptions,e);return t.apiUrl=r(t.apiUrl),(null==e?void 0:e.fetch)&&(t.fetch=c(e.fetch)),{initialOptions:t,activeNamespaces:(null==n?void 0:n.activeNamespaces)||new Map,language:null==n?void 0:n.language,pendingLanguage:null==n?void 0:n.language,isInitialLoading:!1,isRunning:!1}}function L(t,a,i,o,s,r,g){const c={ui:void 0},l={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},u=async({keysAndDefaults:e,event:n})=>{var t;const a=e.map((({key:e,ns:n,defaultValue:t})=>({key:e,defaultValue:t,ns:o({key:e,ns:n}),translation:s({key:e,ns:n})})));null===(t=l.ui)||void 0===t||t.handleElementClick(a,n)},d=(e,n)=>{var t;return(null===(t=l.observer)||void 0===t?void 0:t.findPositions(e,n))||[]};function p(e){const n=s({key:e.key,ns:e.ns});return N.formatTranslation(Object.assign(Object.assign({},e),{translation:n,formatEnabled:!0}))}function f(){return{fetch:a().fetch}}function v(e){l.observer=null==e?void 0:e()}function b(){return Boolean(l.observer)}function O(e){e&&l.formatters.push(e)}function y(e){l.finalFormatter=e}function L(e){c.ui=e}function j(){return Boolean(c.ui)}function k(e){l.languageStorage=e}function R(e){l.languageDetector=e}function w(e){e&&l.backends.push(e)}function E(e){l.devBackend=e}const N=Object.freeze({addPlugin:function(e,n){n(e,Object.freeze({setFinalFormatter:y,addFormatter:O,setObserver:v,hasObserver:b,setUi:L,hasUi:j,setDevBackend:E,addBackend:w,setLanguageDetector:R,setLanguageStorage:k}))},run(){var e,n;const{apiKey:t,apiUrl:i,projectId:o,observerOptions:s}=a();l.ui=null===(e=c.ui)||void 0===e?void 0:e.call(c,{apiKey:t,apiUrl:i,projectId:o,highlight:N.highlight,changeTranslation:r,findPositions:d,onPermanentChange:g}),null===(n=l.observer)||void 0===n||n.run({mouseHighlight:!0,options:s,translate:p,onClick:u})},stop(){var e;l.ui=void 0,null===(e=l.observer)||void 0===e||e.stop()},getLanguageStorage:()=>l.languageStorage,getInitialLanguage(){var e;const t=i();return n(null===(e=l.languageStorage)||void 0===e?void 0:e.getLanguage(f()),(e=>t&&!t.includes(e)||!e?function(){if(!l.languageDetector)return;const e=i();return l.languageDetector.getLanguage(Object.assign({availableLanguages:e},f()))}():e))},setStoredLanguage(e){var n;null===(n=l.languageStorage)||void 0===n||n.setLanguage(e,f())},getDevBackend:()=>l.devBackend,getBackendRecord:({language:n,namespace:t})=>{for(const a of l.backends){const i=a.getRecord(Object.assign({language:n,namespace:t},f()));if(e(i))return null==i?void 0:i.catch((e=>(console.error(e),{})));if(void 0!==i)return i}},getBackendDevRecord:({language:e,namespace:n})=>{var t;const{apiKey:i,apiUrl:o,projectId:s}=a();return null===(t=l.devBackend)||void 0===t?void 0:t.getRecord(Object.assign({apiKey:i,apiUrl:o,projectId:s,language:e,namespace:n},f()))},getLanguageDetector:()=>l.languageDetector,retranslate(){var e;null===(e=l.observer)||void 0===e||e.retranslate()},highlight:(e,n)=>{var t,a;return(null===(a=null===(t=l.observer)||void 0===t?void 0:t.highlight)||void 0===a?void 0:a.call(t,e,n))||{unhighlight(){}}},unwrap(e){var n;return l.observer?null===(n=l.observer)||void 0===n?void 0:n.unwrap(e):{text:e,keys:[]}},wrap(e){var n;return l.observer?null===(n=l.observer)||void 0===n?void 0:n.wrap(e):e.translation},hasDevBackend:()=>Boolean(N.getDevBackend()),formatTranslation(e){var n,{formatEnabled:i}=e,o=h(e,["formatEnabled"]);const{key:s,translation:r,defaultValue:g,noWrap:c,params:u,orEmpty:d,ns:p}=o,f=r||g;let v=f||(d?"":s);const b=t(),O=i||!(null===(n=l.observer)||void 0===n?void 0:n.outputNotFormattable),y=e=>l.observer&&!c?l.observer.wrap({key:s,translation:e,defaultValue:g,params:u,ns:p}):e;v=y(v);try{if(f&&b&&O)for(const e of l.formatters)v=e.format({translation:v,language:b,params:u});l.finalFormatter&&f&&b&&O&&(v=l.finalFormatter.format({translation:v,language:b,params:u}))}catch(e){console.error(e);const n=("string"==typeof(L=e)?L:"string"==typeof(null==L?void 0:L.message)?L.message:void 0)||m,t=a().onFormatError,i=typeof t;v="string"===i?t:"function"===i?t(n,o):m,v=y(v)}var L;return v}});return N}const j=(e,n,t)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=n();a!==e&&t(e),a=e}})};const k=(e,...n)=>{let t,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof n[0]?(a.defaultValue=n[0],t=n[1]):"object"==typeof n[0]&&(t=n[0])),t&&(a=Object.assign(Object.assign({},function(e){var{ns:n,noWrap:t,orEmpty:a,params:i,language:o}=e,s=h(e,["ns","noWrap","orEmpty","params","language"]);const r={ns:n,noWrap:t,orEmpty:a,language:o};return Object.assign(Object.assign({},r),{params:Object.assign({},s)})}(t)),a)),a};function R({options:a}){const g=function(e,n){let t=!0;function a(){return t}const i=Object.freeze({onPendingLanguageChange:l(a),onLanguageChange:l(a),onLoadingChange:l(a),onFetchingChange:l(a),onInitialLoaded:l(a),onRunningChange:l(a),onCacheChange:l(a),onUpdate:u(a,e,n),onPermanentChange:l(a),setEmitterActive(e){t=e},on:(e,n)=>{switch(e){case"pendingLanguage":return i.onPendingLanguageChange.listen(n);case"language":return i.onLanguageChange.listen(n);case"loading":return i.onLoadingChange.listen(n);case"fetching":return i.onFetchingChange.listen(n);case"initialLoad":return i.onInitialLoaded.listen(n);case"running":return i.onRunningChange.listen(n);case"cache":return i.onCacheChange.listen(n);case"update":return i.onUpdate.listen(n);case"permanentChange":return i.onPermanentChange.listen(n)}}});return i.onInitialLoaded.listen((()=>i.onUpdate.emit())),i.onLanguageChange.listen((()=>i.onUpdate.emit())),i.onCacheChange.listen((({value:e})=>i.onUpdate.emit([e.namespace],!0))),i}(b,O),c=j(!1,(()=>m.isFetching()),g.onFetchingChange.emit),d=j(!1,(()=>A.isLoading()),g.onLoadingChange.emit),f=function(e,n,t){let a,g=y();const c=Object.freeze({init(e){g=y(e,g)},isRunning:()=>g.isRunning,setRunning(e){g.isRunning!==e&&(g.isRunning=e,t.emit(e))},isInitialLoading:()=>g.isInitialLoading,setInitialLoading(e){g.isInitialLoading=e},getLanguage:()=>g.language||g.initialOptions.language,setLanguage(n){g.language!==n&&(g.language=n,e.emit(n))},getPendingLanguage:()=>g.pendingLanguage||c.getLanguage(),setPendingLanguage(e){g.pendingLanguage!==e&&(g.pendingLanguage=e,n.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},g.initialOptions),a),addActiveNs(e){i(e).forEach((e=>{const n=g.activeNamespaces.get(e);void 0!==n?g.activeNamespaces.set(e,n+1):g.activeNamespaces.set(e,1)}))},removeActiveNs(e){i(e).forEach((e=>{const n=g.activeNamespaces.get(e);void 0!==n&&n>1?g.activeNamespaces.set(e,n-1):g.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>s([...g.initialOptions.ns||[g.initialOptions.defaultNs],...i(g.initialOptions.fallbackNs),...g.activeNamespaces.keys()]),getFallbackLangs(e){const n=e||c.getLanguage();return n?s([n,...o(n,g.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>i(g.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?g.initialOptions.defaultNs:e,getAvailableLanguages(){if(g.initialOptions.availableLanguages)return g.initialOptions.availableLanguages;if(g.initialOptions.staticData){const e=Object.keys(g.initialOptions.staticData).map((e=>p(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?c.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:r(e.apiUrl)}):void 0}});return c}(g.onLanguageChange,g.onPendingLanguageChange,g.onRunningChange),h=L(f.getLanguage,f.getInitialOptions,f.getAvailableLanguages,(function({key:e,ns:n}){const t=f.getFallbackLangs(),a=R(n||void 0);return m.getTranslationNs(a,t,e)}),C,E,(function(e){g.onPermanentChange.emit({key:e.key,namespace:e.namespace})})),m=v(g.onCacheChange,h.getBackendRecord,h.getBackendDevRecord,f.withDefaultNs,f.isInitialLoading,c,d);function b(){return f.getFallbackNs()}function O(e){return f.getDefaultNs(e)}function R(e){return[...i(O(e)),...b()]}function w(e){return[...i(e||O()),...f.getRequiredNamespaces()]}function E(e,n,t){const a=f.withDefaultNs(e),i=m.getTranslation(a,n);return m.changeTranslation(a,n,t),{revert(){m.changeTranslation(a,n,i)}}}function N(e){f.init(e),m.addStaticData(f.getInitialOptions().staticData)}function D(e,t){const a=function(e,n){const t=f.getFallbackLangs(e),a=w(n),i=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n},!0)||i.push({language:e,namespace:n})}))})),i}(e,t);if(a.length)return n(A.loadRecords(a),(()=>{}))}function C({key:e,ns:n,language:t}){const a=R(n||void 0),i=f.getFallbackLangs(t);return m.getTranslationFallback(a,i,e)}function I(){const t=n(function(){if(f.getLanguage())return;return n(h.getInitialLanguage(),(e=>{const n=e||f.getInitialOptions().defaultLanguage;n&&f.setLanguage(n)}))}(),(()=>D()));if(e(t))return f.setInitialLoading(!0),c.notify(),d.notify(),Promise.resolve(t).then((()=>{f.setInitialLoading(!1),c.notify(),d.notify(),g.onInitialLoaded.emit()}));g.onInitialLoaded.emit()}a&&N(a),g.onUpdate.listen((()=>{f.isRunning()&&h.retranslate()}));const A=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},g),f),h),m),{init:N,getTranslation:C,changeTranslation:E,async changeLanguage(e){f.getPendingLanguage()===e&&f.getLanguage()===e||(f.setPendingLanguage(e),f.isRunning()&&await D(e),e===f.getPendingLanguage()&&(f.setLanguage(e),h.setStoredLanguage(e)))},async addActiveNs(e,n){n||f.addActiveNs(e),f.isRunning()&&await D(void 0,e)},loadRecords:e=>m.loadRecords(e,A.isDev()),loadRecord:async e=>(await A.loadRecords([e]))[0],isLoading:e=>m.isLoading(f.getLanguage(),e),isLoaded(e){const n=f.getLanguage();if(!n)return!1;const t=f.getFallbackLangs(n),a=w(e),i=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n})||i.push({language:e,namespace:n})}))})),0===i.length},t:(...e)=>{const n=k(...e),t=C(n);return h.formatTranslation(Object.assign(Object.assign({},n),{translation:t}))},isDev:()=>Boolean(f.getInitialOptions().apiKey&&f.getInitialOptions().apiUrl),run(){let e;return function(){if((h.getLanguageDetector()||h.getLanguageStorage())&&!f.getAvailableLanguages())throw new Error(t("availableLanguages"));if(!f.getLanguage()&&!f.getInitialOptions().defaultLanguage)throw new Error(t(["defaultLanguage","language"]))}(),f.isRunning()||(f.setRunning(!0),h.run(),e=I()),Promise.resolve(e)},stop(){f.isRunning()&&(h.stop(),f.setRunning(!1))}}));return A}const w=()=>{const e={plugins:[],options:{}},n=Object.freeze({use:t=>(e.plugins.push(t),n),updateDefaults:t=>(e.options=O(e.options,t),n),init(n){const t=function(e){const n=R({options:e});function t(e){const t=n.isRunning();t&&n.stop(),e(),n.isDev()&&n.invalidate(),t&&n.run()}n.isDev()&&n.invalidate();const a=Object.freeze({on:n.on,onNsUpdate:n.onUpdate.listenSome,setEmitterActive:n.setEmitterActive,getLanguage:n.getLanguage,getPendingLanguage:n.getPendingLanguage,changeLanguage:n.changeLanguage,changeTranslation:n.changeTranslation,addActiveNs:n.addActiveNs,removeActiveNs:n.removeActiveNs,loadRecords:n.loadRecords,loadRecord:n.loadRecord,addStaticData:n.addStaticData,getRecord:n.getRecord,getAllRecords:n.getAllRecords,isLoaded:n.isLoaded,isInitialLoading:n.isInitialLoading,isLoading:n.isLoading,isFetching:n.isFetching,isRunning:n.isRunning,run:n.run,stop:n.stop,t:n.t,highlight:n.highlight,getInitialOptions:n.getInitialOptions,isDev:n.isDev,wrap:n.wrap,unwrap:n.unwrap,overrideCredentials(e){t((()=>n.overrideCredentials(e)))},addPlugin(e){e&&t((()=>n.addPlugin(a,e)))},updateOptions(e){e&&t((()=>n.init(e)))}});return a}(O(e.options,n));return e.plugins.forEach(t.addPlugin),t}});return n},E=0,N=1,D=2;class C extends Error{constructor(e,n,t){let a;a=e===E?"Empty parameter":e===N?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${n} in "${t}"`),this.code=e,this.index=n}}function I(e){return/\s/.test(e)}const A=0,S=1,P=2,F=3,T=4,U=new Set([P,S,A]),B="'",x=new Set(["{","}",B]),z=e=>/[0-9a-zA-Z_]/.test(e);function K(e,n){const[t,a]=function(e){let n=A,t="",a="",i="";const o=[],s=[];let r=0;function g(n){throw new C(n,r,e)}const c=()=>{o.push(t),t=""},l=()=>{""===a&&g(E),s.push(a),a=""};for(r=0;r<e.length;r++)switch(i=e[r],n){case A:i===B?(t+=i,n=S):"{"===i?(c(),n=F):(t+=i,n=A);break;case S:x.has(i)?(t=t.slice(0,-1)+i,n=P):(t+=i,n=A);break;case P:i===B?n=A:(t+=i,n=P);break;case F:"}"===i?(l(),n=A):I(i)?""!==a&&(l(),n=T):(z(i)||g(N),a+=i,n=F);break;case T:"}"==i?n=A:I(i)?n=T:g(N)}return U.has(n)||g(D),c(),[o,s]}(e),i=[t[0]];for(let o=1;o<t.length;o++){const s=null==n?void 0:n[a[o-1]];if(void 0===s)throw new Error(`Missing parameter "${a[o-1]}" in "${e}"`);i.push(String(s)),i.push(t[o])}return i.join("")}const $=()=>(e,n)=>(n.setFinalFormatter({format:({translation:e,params:n})=>K(e,n)}),e);export{$ as FormatSimple,w as TolgeeCore,c as createFetchFunction,a as getFallback,i as getFallbackArray,k as getTranslateProps};
function e(e){return Boolean(e&&"function"==typeof e.then)}function n(n,t){return e(n)?Promise.resolve(n).then(t):t(n)}function t(e){const n=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),t=n.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...n.slice(0,-2),t].join(", ")} option`}function a(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function i(e){return a(e)||[]}function o(e,n){return"object"!=typeof(t=n)||Array.isArray(t)||null===t?i(n):i(null==n?void 0:n[e]);var t}function s(e){return Array.from(new Set(e))}function r(e){return e?e.replace(/\/+$/,""):e}const g=(e,n)=>fetch(e,n),c=(e=g)=>(n,t)=>e(n,Object.assign(Object.assign({},t),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":process.env.TOLGEE_UI_VERSION||"prerelease"},null==t?void 0:t.headers)}));function l(e){let n=[];return Object.freeze({listen(e){const t=n=>{e(n)};return n.push(t),{unsubscribe(){n=n.filter((e=>t!==e))}}},emit(t){e()&&n.forEach((e=>e({value:t})))}})}function u(e,n,t){const a=new Set,o=new Set;let s=[];function r(){if(0===s.length)return;const e=s;s=[],a.forEach((e=>{e({value:void 0})}));let t=new Set;e.forEach((e=>{void 0===e?t=void 0:void 0!==t&&e.forEach((e=>t.add(e)))}));!function(e){const t=new Set(n());o.forEach((n=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>t.has(e)||n.namespaces.has(e)))))&&n.fn({value:void 0})}))}(t?Array.from(t.keys()):void 0)}return Object.freeze({emit(n,t){e()&&(s.push(n),t?setTimeout(r,0):r())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const n={fn:n=>{e(n)},namespaces:new Set};o.add(n);const a={unsubscribe:()=>{o.delete(n)},subscribeNs:e=>(i(e).forEach((e=>n.namespaces.add(e))),void 0===e&&n.namespaces.add(t()),a)};return a}})}const d=e=>{const n=new Map;return Object.entries(e).forEach((([e,t])=>{null!=t&&("object"!=typeof t?n.set(e,t):d(t).forEach(((t,a)=>{n.set(e+"."+a,t)})))})),n},p=e=>{const[n,...t]=e.split(":");return{language:n,namespace:t.join(":")||""}},f=({language:e,namespace:n})=>n?`${e}:${n}`:e;function v(e,n,t,a,o,r,g){const c=new Map,l=new Map;let u={},v=0;function h(n,t,a){const i=f(n);l.set(i,{data:d(t),version:a}),e.emit(n)}function m(e){let t;if(!t){const n=u[f(e)];"function"==typeof n&&(t=n())}return t||(t=n(e)),t}const b=Object.freeze({addStaticData(e){e&&(u=Object.assign(Object.assign({},u),e),Object.entries(e).forEach((([e,n])=>{if("function"!=typeof n){const t=p(e),a=l.get(e);a&&0!==a.version||h(t,n,0)}})))},invalidate(){c.clear(),v+=1},addRecord(e,n){h(e,n,v)},exists(e,n=!1){const t=l.get(f(e));return t&&n?t.version===v:Boolean(t)},getRecord(e){var n;return null===(n=l.get(f(a(e))))||void 0===n?void 0:n.data},getTranslation(e,n){var t;return null===(t=l.get(f(e)))||void 0===t?void 0:t.data.get(n)},getTranslationNs(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=l.get(f({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return[i]}return s(e)},getTranslationFallback(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=l.get(f({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return n}},changeTranslation(n,t,a){var i;const o=null===(i=l.get(f(n)))||void 0===i?void 0:i.data;null==o||o.set(t,a),e.emit(Object.assign(Object.assign({},n),{key:t}))},isFetching(e){if(o())return!0;if(void 0===e)return c.size>0;const n=i(e);return Boolean(Array.from(c.keys()).find((e=>n.includes(p(e).namespace))))},isLoading(e,n){const t=i(n);return Boolean(o()||Array.from(c.keys()).find((n=>{const a=p(n);return(!t.length||t.includes(a.namespace))&&!b.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,n){const i=e.map((e=>{const i=a(e),o=f(i),s=c.get(o);if(s)return{new:!1,promise:s,keyObject:i,cacheKey:o};const r=function(e,n){var a;let i;return n&&(i=null===(a=t(e))||void 0===a?void 0:a.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),m(e))))),i||(i=m(e)),i}(i,n)||Promise.resolve(void 0);return c.set(o,r),{new:!0,promise:r,keyObject:i,cacheKey:o}}));r.notify(),g.notify();const o=await Promise.all(i.map((e=>e.promise)));return i.forEach(((e,n)=>{const t=c.get(e.cacheKey)!==e.promise;if(e.new&&!t){c.delete(e.cacheKey);const t=o[n];t?b.addRecord(e.keyObject,t):b.getRecord(e.keyObject)||b.addRecord(e.keyObject,{})}})),r.notify(),g.notify(),i.map((e=>b.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(l.entries()).map((([e,n])=>Object.assign(Object.assign({},p(e)),{data:n.data})))});return b}function h(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)n.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(t[a[i]]=e[a[i]])}return t}const m="invalid",b={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:m,apiUrl:"https://app.tolgee.io",fetch:c()},O=(...e)=>{let n={};return e.forEach((e=>{n=Object.assign(Object.assign(Object.assign({},n),e),{observerOptions:Object.assign(Object.assign({},n.observerOptions),null==e?void 0:e.observerOptions)})})),n};function y(e,n){const t=O(b,null==n?void 0:n.initialOptions,e);return t.apiUrl=r(t.apiUrl),(null==e?void 0:e.fetch)&&(t.fetch=c(e.fetch)),{initialOptions:t,activeNamespaces:(null==n?void 0:n.activeNamespaces)||new Map,language:null==n?void 0:n.language,pendingLanguage:null==n?void 0:n.language,isInitialLoading:!1,isRunning:!1}}function L(t,a,i,o,s,r,g){const c={ui:void 0},l={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},u=async({keysAndDefaults:e,event:n})=>{var t;const a=e.map((({key:e,ns:n,defaultValue:t})=>({key:e,defaultValue:t,ns:o({key:e,ns:n}),translation:s({key:e,ns:n})})));null===(t=l.ui)||void 0===t||t.handleElementClick(a,n)},d=(e,n)=>{var t;return(null===(t=l.observer)||void 0===t?void 0:t.findPositions(e,n))||[]};function p(e){const n=s({key:e.key,ns:e.ns});return N.formatTranslation(Object.assign(Object.assign({},e),{translation:n,formatEnabled:!0}))}function f(){return{fetch:a().fetch}}function v(e){l.observer=null==e?void 0:e()}function b(){return Boolean(l.observer)}function O(e){e&&l.formatters.push(e)}function y(e){l.finalFormatter=e}function L(e){c.ui=e}function j(){return Boolean(c.ui)}function k(e){l.languageStorage=e}function R(e){l.languageDetector=e}function w(e){e&&l.backends.push(e)}function E(e){l.devBackend=e}const N=Object.freeze({addPlugin:function(e,n){n(e,Object.freeze({setFinalFormatter:y,addFormatter:O,setObserver:v,hasObserver:b,setUi:L,hasUi:j,setDevBackend:E,addBackend:w,setLanguageDetector:R,setLanguageStorage:k}))},run(){var e,n;const{apiKey:t,apiUrl:i,projectId:o,observerOptions:s}=a();l.ui=null===(e=c.ui)||void 0===e?void 0:e.call(c,{apiKey:t,apiUrl:i,projectId:o,highlight:N.highlight,changeTranslation:r,findPositions:d,onPermanentChange:g}),null===(n=l.observer)||void 0===n||n.run({mouseHighlight:!0,options:s,translate:p,onClick:u})},stop(){var e;l.ui=void 0,null===(e=l.observer)||void 0===e||e.stop()},getLanguageStorage:()=>l.languageStorage,getInitialLanguage(){var e;const t=i();return n(null===(e=l.languageStorage)||void 0===e?void 0:e.getLanguage(f()),(e=>t&&!t.includes(e)||!e?function(){if(!l.languageDetector)return;const e=i();return l.languageDetector.getLanguage(Object.assign({availableLanguages:e},f()))}():e))},setStoredLanguage(e){var n;null===(n=l.languageStorage)||void 0===n||n.setLanguage(e,f())},getDevBackend:()=>l.devBackend,getBackendRecord:({language:n,namespace:t})=>{for(const a of l.backends){const i=a.getRecord(Object.assign({language:n,namespace:t},f()));if(e(i))return null==i?void 0:i.catch((e=>(console.error(e),{})));if(void 0!==i)return i}},getBackendDevRecord:({language:e,namespace:n})=>{var t;const{apiKey:i,apiUrl:o,projectId:s}=a();return null===(t=l.devBackend)||void 0===t?void 0:t.getRecord(Object.assign({apiKey:i,apiUrl:o,projectId:s,language:e,namespace:n},f()))},getLanguageDetector:()=>l.languageDetector,retranslate(){var e;null===(e=l.observer)||void 0===e||e.retranslate()},highlight:(e,n)=>{var t,a;return(null===(a=null===(t=l.observer)||void 0===t?void 0:t.highlight)||void 0===a?void 0:a.call(t,e,n))||{unhighlight(){}}},unwrap(e){var n;return l.observer?null===(n=l.observer)||void 0===n?void 0:n.unwrap(e):{text:e,keys:[]}},wrap(e){var n;return l.observer?null===(n=l.observer)||void 0===n?void 0:n.wrap(e):e.translation},hasDevBackend:()=>Boolean(N.getDevBackend()),formatTranslation(e){var n,{formatEnabled:i}=e,o=h(e,["formatEnabled"]);const{key:s,translation:r,defaultValue:g,noWrap:c,params:u,orEmpty:d,ns:p}=o,f=r||g;let v=f||(d?"":s);const b=t(),O=i||!(null===(n=l.observer)||void 0===n?void 0:n.outputNotFormattable),y=e=>l.observer&&!c?l.observer.wrap({key:s,translation:e,defaultValue:g,params:u,ns:p}):e;v=y(v);try{if(f&&b&&O)for(const e of l.formatters)v=e.format({translation:v,language:b,params:u});l.finalFormatter&&f&&b&&O&&(v=l.finalFormatter.format({translation:v,language:b,params:u}))}catch(e){console.error(e);const n=("string"==typeof(L=e)?L:"string"==typeof(null==L?void 0:L.message)?L.message:void 0)||m,t=a().onFormatError,i=typeof t;v="string"===i?t:"function"===i?t(n,o):m,v=y(v)}var L;return v}});return N}const j=(e,n,t)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=n();a!==e&&t(e),a=e}})};const k=(e,...n)=>{let t,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof n[0]?(a.defaultValue=n[0],t=n[1]):"object"==typeof n[0]&&(t=n[0])),t&&(a=Object.assign(Object.assign({},function(e){var{ns:n,noWrap:t,orEmpty:a,params:i,language:o}=e,s=h(e,["ns","noWrap","orEmpty","params","language"]);const r={ns:n,noWrap:t,orEmpty:a,language:o};return Object.assign(Object.assign({},r),{params:Object.assign({},s)})}(t)),a)),a};function R({options:a}){const g=function(e,n){let t=!0;function a(){return t}const i=Object.freeze({onPendingLanguageChange:l(a),onLanguageChange:l(a),onLoadingChange:l(a),onFetchingChange:l(a),onInitialLoaded:l(a),onRunningChange:l(a),onCacheChange:l(a),onUpdate:u(a,e,n),onPermanentChange:l(a),setEmitterActive(e){t=e},on:(e,n)=>{switch(e){case"pendingLanguage":return i.onPendingLanguageChange.listen(n);case"language":return i.onLanguageChange.listen(n);case"loading":return i.onLoadingChange.listen(n);case"fetching":return i.onFetchingChange.listen(n);case"initialLoad":return i.onInitialLoaded.listen(n);case"running":return i.onRunningChange.listen(n);case"cache":return i.onCacheChange.listen(n);case"update":return i.onUpdate.listen(n);case"permanentChange":return i.onPermanentChange.listen(n)}}});return i.onInitialLoaded.listen((()=>i.onUpdate.emit())),i.onLanguageChange.listen((()=>i.onUpdate.emit())),i.onCacheChange.listen((({value:e})=>i.onUpdate.emit([e.namespace],!0))),i}(O,R),c=j(!1,(()=>m.isFetching()),g.onFetchingChange.emit),d=j(!1,(()=>S.isLoading()),g.onLoadingChange.emit),f=function(e,n,t){let a,g=y();const c=Object.freeze({init(e){g=y(e,g)},isRunning:()=>g.isRunning,setRunning(e){g.isRunning!==e&&(g.isRunning=e,t.emit(e))},isInitialLoading:()=>g.isInitialLoading,setInitialLoading(e){g.isInitialLoading=e},getLanguage:()=>g.language||g.initialOptions.language,setLanguage(n){g.language!==n&&(g.language=n,e.emit(n))},getPendingLanguage:()=>g.pendingLanguage||c.getLanguage(),setPendingLanguage(e){g.pendingLanguage!==e&&(g.pendingLanguage=e,n.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},g.initialOptions),a),addActiveNs(e){i(e).forEach((e=>{const n=g.activeNamespaces.get(e);void 0!==n?g.activeNamespaces.set(e,n+1):g.activeNamespaces.set(e,1)}))},removeActiveNs(e){i(e).forEach((e=>{const n=g.activeNamespaces.get(e);void 0!==n&&n>1?g.activeNamespaces.set(e,n-1):g.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>s([...g.initialOptions.ns||[g.initialOptions.defaultNs],...i(g.initialOptions.fallbackNs),...g.activeNamespaces.keys()]),getFallbackLangs(e){const n=e||c.getLanguage();return n?s([n,...o(n,g.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>i(g.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?g.initialOptions.defaultNs:e,getAvailableLanguages(){if(g.initialOptions.availableLanguages)return g.initialOptions.availableLanguages;if(g.initialOptions.staticData){const e=Object.keys(g.initialOptions.staticData).map((e=>p(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?c.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:r(e.apiUrl)}):void 0}});return c}(g.onLanguageChange,g.onPendingLanguageChange,g.onRunningChange),h=L(f.getLanguage,f.getInitialOptions,f.getAvailableLanguages,(function({key:e,ns:n}){const t=f.getFallbackLangs(),a=w(n||void 0);return m.getTranslationNs(a,t,e)}),I,N,(function(e){g.onPermanentChange.emit({key:e.key,namespace:e.namespace})})),m=v(g.onCacheChange,h.getBackendRecord,h.getBackendDevRecord,f.withDefaultNs,f.isInitialLoading,c,d);let b;function O(){return f.getFallbackNs()}function R(e){return f.getDefaultNs(e)}function w(e){return[...i(R(e)),...O()]}function E(e){return[...i(e||R()),...f.getRequiredNamespaces()]}function N(e,n,t){const a=f.withDefaultNs(e),i=m.getTranslation(a,n);return m.changeTranslation(a,n,t),{revert(){m.changeTranslation(a,n,i)}}}function D(e){f.init(e),m.addStaticData(f.getInitialOptions().staticData)}function C(e,t){const a=function(e,n){const t=f.getFallbackLangs(e),a=E(n),i=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n},!0)||i.push({language:e,namespace:n})}))})),i}(e,t);if(a.length)return n(S.loadRecords(a),(()=>{}))}function I({key:e,ns:n,language:t}){const a=w(n||void 0),i=f.getFallbackLangs(t);return m.getTranslationFallback(a,i,e)}function A(){const t=n(function(){if(f.getLanguage())return;return n(h.getInitialLanguage(),(e=>{const n=e||f.getInitialOptions().defaultLanguage;n&&f.setLanguage(n)}))}(),(()=>C()));if(e(t))return f.setInitialLoading(!0),c.notify(),d.notify(),Promise.resolve(t).then((()=>{f.setInitialLoading(!1),c.notify(),d.notify(),g.onInitialLoaded.emit()}));g.onInitialLoaded.emit()}a&&D(a),g.onUpdate.listen((()=>{f.isRunning()&&h.retranslate()}));const S=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},g),f),h),m),{init:D,getTranslation:I,changeTranslation:N,async changeLanguage(e){f.getPendingLanguage()===e&&f.getLanguage()===e||(f.setPendingLanguage(e),f.isRunning()&&await C(e),e===f.getPendingLanguage()&&(f.setLanguage(e),h.setStoredLanguage(e)))},async addActiveNs(e,n){n||f.addActiveNs(e),f.isRunning()&&await C(void 0,e)},loadRecords:e=>m.loadRecords(e,S.isDev()),loadRecord:async e=>(await S.loadRecords([e]))[0],isLoading:e=>m.isLoading(f.getLanguage(),e),isLoaded(e){const n=f.getLanguage();if(!n)return!1;const t=f.getFallbackLangs(n),a=E(e),i=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n})||i.push({language:e,namespace:n})}))})),0===i.length},t:(...e)=>{const n=k(...e),t=I(n);return h.formatTranslation(Object.assign(Object.assign({},n),{translation:t}))},isDev:()=>Boolean(f.getInitialOptions().apiKey&&f.getInitialOptions().apiUrl),run:()=>(function(){if((h.getLanguageDetector()||h.getLanguageStorage())&&!f.getAvailableLanguages())throw new Error(t("availableLanguages"));if(!f.getLanguage()&&!f.getInitialOptions().defaultLanguage)throw new Error(t(["defaultLanguage","language"]))}(),f.isRunning()||(f.setRunning(!0),h.run(),b=A()),Promise.resolve(b)),stop(){f.isRunning()&&(h.stop(),f.setRunning(!1))}}));return S}const w=()=>{const e={plugins:[],options:{}},n=Object.freeze({use:t=>(e.plugins.push(t),n),updateDefaults:t=>(e.options=O(e.options,t),n),init(n){const t=function(e){const n=R({options:e});function t(e){const t=n.isRunning();t&&n.stop(),e(),n.isDev()&&n.invalidate(),t&&n.run()}n.isDev()&&n.invalidate();const a=Object.freeze({on:n.on,onNsUpdate:n.onUpdate.listenSome,setEmitterActive:n.setEmitterActive,getLanguage:n.getLanguage,getPendingLanguage:n.getPendingLanguage,changeLanguage:n.changeLanguage,changeTranslation:n.changeTranslation,addActiveNs:n.addActiveNs,removeActiveNs:n.removeActiveNs,loadRecords:n.loadRecords,loadRecord:n.loadRecord,addStaticData:n.addStaticData,getRecord:n.getRecord,getAllRecords:n.getAllRecords,isLoaded:n.isLoaded,isInitialLoading:n.isInitialLoading,isLoading:n.isLoading,isFetching:n.isFetching,isRunning:n.isRunning,run:n.run,stop:n.stop,t:n.t,highlight:n.highlight,getInitialOptions:n.getInitialOptions,isDev:n.isDev,wrap:n.wrap,unwrap:n.unwrap,overrideCredentials(e){t((()=>n.overrideCredentials(e)))},addPlugin(e){e&&t((()=>n.addPlugin(a,e)))},updateOptions(e){e&&t((()=>n.init(e)))}});return a}(O(e.options,n));return e.plugins.forEach(t.addPlugin),t}});return n},E=0,N=1,D=2;class C extends Error{constructor(e,n,t){let a;a=e===E?"Empty parameter":e===N?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${n} in "${t}"`),this.code=e,this.index=n}}function I(e){return/\s/.test(e)}const A=0,S=1,P=2,F=3,T=4,U=new Set([P,S,A]),B="'",x=new Set(["{","}",B]),z=e=>/[0-9a-zA-Z_]/.test(e);function K(e,n){const[t,a]=function(e){let n=A,t="",a="",i="";const o=[],s=[];let r=0;function g(n){throw new C(n,r,e)}const c=()=>{o.push(t),t=""},l=()=>{""===a&&g(E),s.push(a),a=""};for(r=0;r<e.length;r++)switch(i=e[r],n){case A:i===B?(t+=i,n=S):"{"===i?(c(),n=F):(t+=i,n=A);break;case S:x.has(i)?(t=t.slice(0,-1)+i,n=P):(t+=i,n=A);break;case P:i===B?n=A:(t+=i,n=P);break;case F:"}"===i?(l(),n=A):I(i)?""!==a&&(l(),n=T):(z(i)||g(N),a+=i,n=F);break;case T:"}"==i?n=A:I(i)?n=T:g(N)}return U.has(n)||g(D),c(),[o,s]}(e),i=[t[0]];for(let o=1;o<t.length;o++){const s=null==n?void 0:n[a[o-1]];if(void 0===s)throw new Error(`Missing parameter "${a[o-1]}" in "${e}"`);i.push(String(s)),i.push(t[o])}return i.join("")}const $=()=>(e,n)=>(n.setFinalFormatter({format:({translation:e,params:n})=>K(e,n)}),e);export{$ as FormatSimple,w as TolgeeCore,c as createFetchFunction,a as getFallback,i as getFallbackArray,k as getTranslateProps};
//# sourceMappingURL=tolgee.esm.min.js.map

@@ -970,2 +970,3 @@ (function (global, factory) {

}
let runPromise;
events.onUpdate.listen(() => {

@@ -1146,3 +1147,2 @@ if (state.isRunning()) {

run() {
let result = undefined;
checkCorrectConfiguration();

@@ -1152,5 +1152,5 @@ if (!state.isRunning()) {

pluginService.run();
result = loadInitial();
runPromise = loadInitial();
}
return Promise.resolve(result);
return Promise.resolve(runPromise);
},

@@ -1157,0 +1157,0 @@ stop() {

@@ -1,2 +0,2 @@

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/core"]={})}(this,(function(e){"use strict";function n(e){return Boolean(e&&"function"==typeof e.then)}function t(e,t){return n(e)?Promise.resolve(e).then(t):t(e)}function a(e){const n=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),t=n.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...n.slice(0,-2),t].join(", ")} option`}function i(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function o(e){return i(e)||[]}function s(e,n){return"object"!=typeof(t=n)||Array.isArray(t)||null===t?o(n):o(null==n?void 0:n[e]);var t}function r(e){return Array.from(new Set(e))}function g(e){return e?e.replace(/\/+$/,""):e}const c=(e,n)=>fetch(e,n),l=(e=c)=>(n,t)=>e(n,Object.assign(Object.assign({},t),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":process.env.TOLGEE_UI_VERSION||"prerelease"},null==t?void 0:t.headers)}));function u(e){let n=[];return Object.freeze({listen(e){const t=n=>{e(n)};return n.push(t),{unsubscribe(){n=n.filter((e=>t!==e))}}},emit(t){e()&&n.forEach((e=>e({value:t})))}})}function d(e,n,t){const a=new Set,i=new Set;let s=[];function r(){if(0===s.length)return;const e=s;s=[],a.forEach((e=>{e({value:void 0})}));let t=new Set;e.forEach((e=>{void 0===e?t=void 0:void 0!==t&&e.forEach((e=>t.add(e)))}));!function(e){const t=new Set(n());i.forEach((n=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>t.has(e)||n.namespaces.has(e)))))&&n.fn({value:void 0})}))}(t?Array.from(t.keys()):void 0)}return Object.freeze({emit(n,t){e()&&(s.push(n),t?setTimeout(r,0):r())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const n={fn:n=>{e(n)},namespaces:new Set};i.add(n);const a={unsubscribe:()=>{i.delete(n)},subscribeNs:e=>(o(e).forEach((e=>n.namespaces.add(e))),void 0===e&&n.namespaces.add(t()),a)};return a}})}const f=e=>{const n=new Map;return Object.entries(e).forEach((([e,t])=>{null!=t&&("object"!=typeof t?n.set(e,t):f(t).forEach(((t,a)=>{n.set(e+"."+a,t)})))})),n},p=e=>{const[n,...t]=e.split(":");return{language:n,namespace:t.join(":")||""}},v=({language:e,namespace:n})=>n?`${e}:${n}`:e;function h(e,n,t,a,i,s,g){const c=new Map,l=new Map;let u={},d=0;function h(n,t,a){const i=v(n);l.set(i,{data:f(t),version:a}),e.emit(n)}function m(e){let t;if(!t){const n=u[v(e)];"function"==typeof n&&(t=n())}return t||(t=n(e)),t}const b=Object.freeze({addStaticData(e){e&&(u=Object.assign(Object.assign({},u),e),Object.entries(e).forEach((([e,n])=>{if("function"!=typeof n){const t=p(e),a=l.get(e);a&&0!==a.version||h(t,n,0)}})))},invalidate(){c.clear(),d+=1},addRecord(e,n){h(e,n,d)},exists(e,n=!1){const t=l.get(v(e));return t&&n?t.version===d:Boolean(t)},getRecord(e){var n;return null===(n=l.get(v(a(e))))||void 0===n?void 0:n.data},getTranslation(e,n){var t;return null===(t=l.get(v(e)))||void 0===t?void 0:t.data.get(n)},getTranslationNs(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=l.get(v({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return[i]}return r(e)},getTranslationFallback(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=l.get(v({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return n}},changeTranslation(n,t,a){var i;const o=null===(i=l.get(v(n)))||void 0===i?void 0:i.data;null==o||o.set(t,a),e.emit(Object.assign(Object.assign({},n),{key:t}))},isFetching(e){if(i())return!0;if(void 0===e)return c.size>0;const n=o(e);return Boolean(Array.from(c.keys()).find((e=>n.includes(p(e).namespace))))},isLoading(e,n){const t=o(n);return Boolean(i()||Array.from(c.keys()).find((n=>{const a=p(n);return(!t.length||t.includes(a.namespace))&&!b.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,n){const i=e.map((e=>{const i=a(e),o=v(i),s=c.get(o);if(s)return{new:!1,promise:s,keyObject:i,cacheKey:o};const r=function(e,n){var a;let i;return n&&(i=null===(a=t(e))||void 0===a?void 0:a.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),m(e))))),i||(i=m(e)),i}(i,n)||Promise.resolve(void 0);return c.set(o,r),{new:!0,promise:r,keyObject:i,cacheKey:o}}));s.notify(),g.notify();const o=await Promise.all(i.map((e=>e.promise)));return i.forEach(((e,n)=>{const t=c.get(e.cacheKey)!==e.promise;if(e.new&&!t){c.delete(e.cacheKey);const t=o[n];t?b.addRecord(e.keyObject,t):b.getRecord(e.keyObject)||b.addRecord(e.keyObject,{})}})),s.notify(),g.notify(),i.map((e=>b.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(l.entries()).map((([e,n])=>Object.assign(Object.assign({},p(e)),{data:n.data})))});return b}function m(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)n.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(t[a[i]]=e[a[i]])}return t}const b="invalid",y={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:b,apiUrl:"https://app.tolgee.io",fetch:l()},O=(...e)=>{let n={};return e.forEach((e=>{n=Object.assign(Object.assign(Object.assign({},n),e),{observerOptions:Object.assign(Object.assign({},n.observerOptions),null==e?void 0:e.observerOptions)})})),n};function L(e,n){const t=O(y,null==n?void 0:n.initialOptions,e);return t.apiUrl=g(t.apiUrl),(null==e?void 0:e.fetch)&&(t.fetch=l(e.fetch)),{initialOptions:t,activeNamespaces:(null==n?void 0:n.activeNamespaces)||new Map,language:null==n?void 0:n.language,pendingLanguage:null==n?void 0:n.language,isInitialLoading:!1,isRunning:!1}}function j(e,a,i,o,s,r,g){const c={ui:void 0},l={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},u=async({keysAndDefaults:e,event:n})=>{var t;const a=e.map((({key:e,ns:n,defaultValue:t})=>({key:e,defaultValue:t,ns:o({key:e,ns:n}),translation:s({key:e,ns:n})})));null===(t=l.ui)||void 0===t||t.handleElementClick(a,n)},d=(e,n)=>{var t;return(null===(t=l.observer)||void 0===t?void 0:t.findPositions(e,n))||[]};function f(e){const n=s({key:e.key,ns:e.ns});return N.formatTranslation(Object.assign(Object.assign({},e),{translation:n,formatEnabled:!0}))}function p(){return{fetch:a().fetch}}function v(e){l.observer=null==e?void 0:e()}function h(){return Boolean(l.observer)}function y(e){e&&l.formatters.push(e)}function O(e){l.finalFormatter=e}function L(e){c.ui=e}function j(){return Boolean(c.ui)}function k(e){l.languageStorage=e}function R(e){l.languageDetector=e}function w(e){e&&l.backends.push(e)}function E(e){l.devBackend=e}const N=Object.freeze({addPlugin:function(e,n){n(e,Object.freeze({setFinalFormatter:O,addFormatter:y,setObserver:v,hasObserver:h,setUi:L,hasUi:j,setDevBackend:E,addBackend:w,setLanguageDetector:R,setLanguageStorage:k}))},run(){var e,n;const{apiKey:t,apiUrl:i,projectId:o,observerOptions:s}=a();l.ui=null===(e=c.ui)||void 0===e?void 0:e.call(c,{apiKey:t,apiUrl:i,projectId:o,highlight:N.highlight,changeTranslation:r,findPositions:d,onPermanentChange:g}),null===(n=l.observer)||void 0===n||n.run({mouseHighlight:!0,options:s,translate:f,onClick:u})},stop(){var e;l.ui=void 0,null===(e=l.observer)||void 0===e||e.stop()},getLanguageStorage:()=>l.languageStorage,getInitialLanguage(){var e;const n=i();return t(null===(e=l.languageStorage)||void 0===e?void 0:e.getLanguage(p()),(e=>n&&!n.includes(e)||!e?function(){if(!l.languageDetector)return;const e=i();return l.languageDetector.getLanguage(Object.assign({availableLanguages:e},p()))}():e))},setStoredLanguage(e){var n;null===(n=l.languageStorage)||void 0===n||n.setLanguage(e,p())},getDevBackend:()=>l.devBackend,getBackendRecord:({language:e,namespace:t})=>{for(const a of l.backends){const i=a.getRecord(Object.assign({language:e,namespace:t},p()));if(n(i))return null==i?void 0:i.catch((e=>(console.error(e),{})));if(void 0!==i)return i}},getBackendDevRecord:({language:e,namespace:n})=>{var t;const{apiKey:i,apiUrl:o,projectId:s}=a();return null===(t=l.devBackend)||void 0===t?void 0:t.getRecord(Object.assign({apiKey:i,apiUrl:o,projectId:s,language:e,namespace:n},p()))},getLanguageDetector:()=>l.languageDetector,retranslate(){var e;null===(e=l.observer)||void 0===e||e.retranslate()},highlight:(e,n)=>{var t,a;return(null===(a=null===(t=l.observer)||void 0===t?void 0:t.highlight)||void 0===a?void 0:a.call(t,e,n))||{unhighlight(){}}},unwrap(e){var n;return l.observer?null===(n=l.observer)||void 0===n?void 0:n.unwrap(e):{text:e,keys:[]}},wrap(e){var n;return l.observer?null===(n=l.observer)||void 0===n?void 0:n.wrap(e):e.translation},hasDevBackend:()=>Boolean(N.getDevBackend()),formatTranslation(n){var t,{formatEnabled:i}=n,o=m(n,["formatEnabled"]);const{key:s,translation:r,defaultValue:g,noWrap:c,params:u,orEmpty:d,ns:f}=o,p=r||g;let v=p||(d?"":s);const h=e(),y=i||!(null===(t=l.observer)||void 0===t?void 0:t.outputNotFormattable),O=e=>l.observer&&!c?l.observer.wrap({key:s,translation:e,defaultValue:g,params:u,ns:f}):e;v=O(v);try{if(p&&h&&y)for(const e of l.formatters)v=e.format({translation:v,language:h,params:u});l.finalFormatter&&p&&h&&y&&(v=l.finalFormatter.format({translation:v,language:h,params:u}))}catch(e){console.error(e);const n=("string"==typeof(L=e)?L:"string"==typeof(null==L?void 0:L.message)?L.message:void 0)||b,t=a().onFormatError,i=typeof t;v="string"===i?t:"function"===i?t(n,o):b,v=O(v)}var L;return v}});return N}const k=(e,n,t)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=n();a!==e&&t(e),a=e}})};const R=(e,...n)=>{let t,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof n[0]?(a.defaultValue=n[0],t=n[1]):"object"==typeof n[0]&&(t=n[0])),t&&(a=Object.assign(Object.assign({},function(e){var{ns:n,noWrap:t,orEmpty:a,params:i,language:o}=e,s=m(e,["ns","noWrap","orEmpty","params","language"]);const r={ns:n,noWrap:t,orEmpty:a,language:o};return Object.assign(Object.assign({},r),{params:Object.assign({},s)})}(t)),a)),a};function w({options:e}){const i=function(e,n){let t=!0;function a(){return t}const i=Object.freeze({onPendingLanguageChange:u(a),onLanguageChange:u(a),onLoadingChange:u(a),onFetchingChange:u(a),onInitialLoaded:u(a),onRunningChange:u(a),onCacheChange:u(a),onUpdate:d(a,e,n),onPermanentChange:u(a),setEmitterActive(e){t=e},on:(e,n)=>{switch(e){case"pendingLanguage":return i.onPendingLanguageChange.listen(n);case"language":return i.onLanguageChange.listen(n);case"loading":return i.onLoadingChange.listen(n);case"fetching":return i.onFetchingChange.listen(n);case"initialLoad":return i.onInitialLoaded.listen(n);case"running":return i.onRunningChange.listen(n);case"cache":return i.onCacheChange.listen(n);case"update":return i.onUpdate.listen(n);case"permanentChange":return i.onPermanentChange.listen(n)}}});return i.onInitialLoaded.listen((()=>i.onUpdate.emit())),i.onLanguageChange.listen((()=>i.onUpdate.emit())),i.onCacheChange.listen((({value:e})=>i.onUpdate.emit([e.namespace],!0))),i}(b,y),c=k(!1,(()=>m.isFetching()),i.onFetchingChange.emit),l=k(!1,(()=>A.isLoading()),i.onLoadingChange.emit),f=function(e,n,t){let a,i=L();const c=Object.freeze({init(e){i=L(e,i)},isRunning:()=>i.isRunning,setRunning(e){i.isRunning!==e&&(i.isRunning=e,t.emit(e))},isInitialLoading:()=>i.isInitialLoading,setInitialLoading(e){i.isInitialLoading=e},getLanguage:()=>i.language||i.initialOptions.language,setLanguage(n){i.language!==n&&(i.language=n,e.emit(n))},getPendingLanguage:()=>i.pendingLanguage||c.getLanguage(),setPendingLanguage(e){i.pendingLanguage!==e&&(i.pendingLanguage=e,n.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},i.initialOptions),a),addActiveNs(e){o(e).forEach((e=>{const n=i.activeNamespaces.get(e);void 0!==n?i.activeNamespaces.set(e,n+1):i.activeNamespaces.set(e,1)}))},removeActiveNs(e){o(e).forEach((e=>{const n=i.activeNamespaces.get(e);void 0!==n&&n>1?i.activeNamespaces.set(e,n-1):i.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>r([...i.initialOptions.ns||[i.initialOptions.defaultNs],...o(i.initialOptions.fallbackNs),...i.activeNamespaces.keys()]),getFallbackLangs(e){const n=e||c.getLanguage();return n?r([n,...s(n,i.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>o(i.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?i.initialOptions.defaultNs:e,getAvailableLanguages(){if(i.initialOptions.availableLanguages)return i.initialOptions.availableLanguages;if(i.initialOptions.staticData){const e=Object.keys(i.initialOptions.staticData).map((e=>p(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?c.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:g(e.apiUrl)}):void 0}});return c}(i.onLanguageChange,i.onPendingLanguageChange,i.onRunningChange),v=j(f.getLanguage,f.getInitialOptions,f.getAvailableLanguages,(function({key:e,ns:n}){const t=f.getFallbackLangs(),a=O(n||void 0);return m.getTranslationNs(a,t,e)}),D,E,(function(e){i.onPermanentChange.emit({key:e.key,namespace:e.namespace})})),m=h(i.onCacheChange,v.getBackendRecord,v.getBackendDevRecord,f.withDefaultNs,f.isInitialLoading,c,l);function b(){return f.getFallbackNs()}function y(e){return f.getDefaultNs(e)}function O(e){return[...o(y(e)),...b()]}function w(e){return[...o(e||y()),...f.getRequiredNamespaces()]}function E(e,n,t){const a=f.withDefaultNs(e),i=m.getTranslation(a,n);return m.changeTranslation(a,n,t),{revert(){m.changeTranslation(a,n,i)}}}function N(e){f.init(e),m.addStaticData(f.getInitialOptions().staticData)}function C(e,n){const a=function(e,n){const t=f.getFallbackLangs(e),a=w(n),i=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n},!0)||i.push({language:e,namespace:n})}))})),i}(e,n);if(a.length)return t(A.loadRecords(a),(()=>{}))}function D({key:e,ns:n,language:t}){const a=O(n||void 0),i=f.getFallbackLangs(t);return m.getTranslationFallback(a,i,e)}function I(){const e=t(function(){if(f.getLanguage())return;return t(v.getInitialLanguage(),(e=>{const n=e||f.getInitialOptions().defaultLanguage;n&&f.setLanguage(n)}))}(),(()=>C()));if(n(e))return f.setInitialLoading(!0),c.notify(),l.notify(),Promise.resolve(e).then((()=>{f.setInitialLoading(!1),c.notify(),l.notify(),i.onInitialLoaded.emit()}));i.onInitialLoaded.emit()}e&&N(e),i.onUpdate.listen((()=>{f.isRunning()&&v.retranslate()}));const A=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},i),f),v),m),{init:N,getTranslation:D,changeTranslation:E,async changeLanguage(e){f.getPendingLanguage()===e&&f.getLanguage()===e||(f.setPendingLanguage(e),f.isRunning()&&await C(e),e===f.getPendingLanguage()&&(f.setLanguage(e),v.setStoredLanguage(e)))},async addActiveNs(e,n){n||f.addActiveNs(e),f.isRunning()&&await C(void 0,e)},loadRecords:e=>m.loadRecords(e,A.isDev()),loadRecord:async e=>(await A.loadRecords([e]))[0],isLoading:e=>m.isLoading(f.getLanguage(),e),isLoaded(e){const n=f.getLanguage();if(!n)return!1;const t=f.getFallbackLangs(n),a=w(e),i=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n})||i.push({language:e,namespace:n})}))})),0===i.length},t:(...e)=>{const n=R(...e),t=D(n);return v.formatTranslation(Object.assign(Object.assign({},n),{translation:t}))},isDev:()=>Boolean(f.getInitialOptions().apiKey&&f.getInitialOptions().apiUrl),run(){let e;return function(){if((v.getLanguageDetector()||v.getLanguageStorage())&&!f.getAvailableLanguages())throw new Error(a("availableLanguages"));if(!f.getLanguage()&&!f.getInitialOptions().defaultLanguage)throw new Error(a(["defaultLanguage","language"]))}(),f.isRunning()||(f.setRunning(!0),v.run(),e=I()),Promise.resolve(e)},stop(){f.isRunning()&&(v.stop(),f.setRunning(!1))}}));return A}const E=0,N=1,C=2;class D extends Error{constructor(e,n,t){let a;a=e===E?"Empty parameter":e===N?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${n} in "${t}"`),this.code=e,this.index=n}}function I(e){return/\s/.test(e)}const A=0,F=1,S=2,P=3,T=4,U=new Set([S,F,A]),B="'",x=new Set(["{","}",B]),z=e=>/[0-9a-zA-Z_]/.test(e);function K(e,n){const[t,a]=function(e){let n=A,t="",a="",i="";const o=[],s=[];let r=0;function g(n){throw new D(n,r,e)}const c=()=>{o.push(t),t=""},l=()=>{""===a&&g(E),s.push(a),a=""};for(r=0;r<e.length;r++)switch(i=e[r],n){case A:i===B?(t+=i,n=F):"{"===i?(c(),n=P):(t+=i,n=A);break;case F:x.has(i)?(t=t.slice(0,-1)+i,n=S):(t+=i,n=A);break;case S:i===B?n=A:(t+=i,n=S);break;case P:"}"===i?(l(),n=A):I(i)?""!==a&&(l(),n=T):(z(i)||g(N),a+=i,n=P);break;case T:"}"==i?n=A:I(i)?n=T:g(N)}return U.has(n)||g(C),c(),[o,s]}(e),i=[t[0]];for(let o=1;o<t.length;o++){const s=null==n?void 0:n[a[o-1]];if(void 0===s)throw new Error(`Missing parameter "${a[o-1]}" in "${e}"`);i.push(String(s)),i.push(t[o])}return i.join("")}e.FormatSimple=()=>(e,n)=>(n.setFinalFormatter({format:({translation:e,params:n})=>K(e,n)}),e),e.TolgeeCore=()=>{const e={plugins:[],options:{}},n=Object.freeze({use:t=>(e.plugins.push(t),n),updateDefaults:t=>(e.options=O(e.options,t),n),init(n){const t=function(e){const n=w({options:e});function t(e){const t=n.isRunning();t&&n.stop(),e(),n.isDev()&&n.invalidate(),t&&n.run()}n.isDev()&&n.invalidate();const a=Object.freeze({on:n.on,onNsUpdate:n.onUpdate.listenSome,setEmitterActive:n.setEmitterActive,getLanguage:n.getLanguage,getPendingLanguage:n.getPendingLanguage,changeLanguage:n.changeLanguage,changeTranslation:n.changeTranslation,addActiveNs:n.addActiveNs,removeActiveNs:n.removeActiveNs,loadRecords:n.loadRecords,loadRecord:n.loadRecord,addStaticData:n.addStaticData,getRecord:n.getRecord,getAllRecords:n.getAllRecords,isLoaded:n.isLoaded,isInitialLoading:n.isInitialLoading,isLoading:n.isLoading,isFetching:n.isFetching,isRunning:n.isRunning,run:n.run,stop:n.stop,t:n.t,highlight:n.highlight,getInitialOptions:n.getInitialOptions,isDev:n.isDev,wrap:n.wrap,unwrap:n.unwrap,overrideCredentials(e){t((()=>n.overrideCredentials(e)))},addPlugin(e){e&&t((()=>n.addPlugin(a,e)))},updateOptions(e){e&&t((()=>n.init(e)))}});return a}(O(e.options,n));return e.plugins.forEach(t.addPlugin),t}});return n},e.createFetchFunction=l,e.getFallback=i,e.getFallbackArray=o,e.getTranslateProps=R,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/core"]={})}(this,(function(e){"use strict";function n(e){return Boolean(e&&"function"==typeof e.then)}function t(e,t){return n(e)?Promise.resolve(e).then(t):t(e)}function a(e){const n=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),t=n.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...n.slice(0,-2),t].join(", ")} option`}function i(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function o(e){return i(e)||[]}function s(e,n){return"object"!=typeof(t=n)||Array.isArray(t)||null===t?o(n):o(null==n?void 0:n[e]);var t}function r(e){return Array.from(new Set(e))}function g(e){return e?e.replace(/\/+$/,""):e}const c=(e,n)=>fetch(e,n),l=(e=c)=>(n,t)=>e(n,Object.assign(Object.assign({},t),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":process.env.TOLGEE_UI_VERSION||"prerelease"},null==t?void 0:t.headers)}));function u(e){let n=[];return Object.freeze({listen(e){const t=n=>{e(n)};return n.push(t),{unsubscribe(){n=n.filter((e=>t!==e))}}},emit(t){e()&&n.forEach((e=>e({value:t})))}})}function d(e,n,t){const a=new Set,i=new Set;let s=[];function r(){if(0===s.length)return;const e=s;s=[],a.forEach((e=>{e({value:void 0})}));let t=new Set;e.forEach((e=>{void 0===e?t=void 0:void 0!==t&&e.forEach((e=>t.add(e)))}));!function(e){const t=new Set(n());i.forEach((n=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>t.has(e)||n.namespaces.has(e)))))&&n.fn({value:void 0})}))}(t?Array.from(t.keys()):void 0)}return Object.freeze({emit(n,t){e()&&(s.push(n),t?setTimeout(r,0):r())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const n={fn:n=>{e(n)},namespaces:new Set};i.add(n);const a={unsubscribe:()=>{i.delete(n)},subscribeNs:e=>(o(e).forEach((e=>n.namespaces.add(e))),void 0===e&&n.namespaces.add(t()),a)};return a}})}const f=e=>{const n=new Map;return Object.entries(e).forEach((([e,t])=>{null!=t&&("object"!=typeof t?n.set(e,t):f(t).forEach(((t,a)=>{n.set(e+"."+a,t)})))})),n},p=e=>{const[n,...t]=e.split(":");return{language:n,namespace:t.join(":")||""}},v=({language:e,namespace:n})=>n?`${e}:${n}`:e;function h(e,n,t,a,i,s,g){const c=new Map,l=new Map;let u={},d=0;function h(n,t,a){const i=v(n);l.set(i,{data:f(t),version:a}),e.emit(n)}function m(e){let t;if(!t){const n=u[v(e)];"function"==typeof n&&(t=n())}return t||(t=n(e)),t}const b=Object.freeze({addStaticData(e){e&&(u=Object.assign(Object.assign({},u),e),Object.entries(e).forEach((([e,n])=>{if("function"!=typeof n){const t=p(e),a=l.get(e);a&&0!==a.version||h(t,n,0)}})))},invalidate(){c.clear(),d+=1},addRecord(e,n){h(e,n,d)},exists(e,n=!1){const t=l.get(v(e));return t&&n?t.version===d:Boolean(t)},getRecord(e){var n;return null===(n=l.get(v(a(e))))||void 0===n?void 0:n.data},getTranslation(e,n){var t;return null===(t=l.get(v(e)))||void 0===t?void 0:t.data.get(n)},getTranslationNs(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=l.get(v({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return[i]}return r(e)},getTranslationFallback(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=l.get(v({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return n}},changeTranslation(n,t,a){var i;const o=null===(i=l.get(v(n)))||void 0===i?void 0:i.data;null==o||o.set(t,a),e.emit(Object.assign(Object.assign({},n),{key:t}))},isFetching(e){if(i())return!0;if(void 0===e)return c.size>0;const n=o(e);return Boolean(Array.from(c.keys()).find((e=>n.includes(p(e).namespace))))},isLoading(e,n){const t=o(n);return Boolean(i()||Array.from(c.keys()).find((n=>{const a=p(n);return(!t.length||t.includes(a.namespace))&&!b.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,n){const i=e.map((e=>{const i=a(e),o=v(i),s=c.get(o);if(s)return{new:!1,promise:s,keyObject:i,cacheKey:o};const r=function(e,n){var a;let i;return n&&(i=null===(a=t(e))||void 0===a?void 0:a.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),m(e))))),i||(i=m(e)),i}(i,n)||Promise.resolve(void 0);return c.set(o,r),{new:!0,promise:r,keyObject:i,cacheKey:o}}));s.notify(),g.notify();const o=await Promise.all(i.map((e=>e.promise)));return i.forEach(((e,n)=>{const t=c.get(e.cacheKey)!==e.promise;if(e.new&&!t){c.delete(e.cacheKey);const t=o[n];t?b.addRecord(e.keyObject,t):b.getRecord(e.keyObject)||b.addRecord(e.keyObject,{})}})),s.notify(),g.notify(),i.map((e=>b.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(l.entries()).map((([e,n])=>Object.assign(Object.assign({},p(e)),{data:n.data})))});return b}function m(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)n.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(t[a[i]]=e[a[i]])}return t}const b="invalid",y={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:b,apiUrl:"https://app.tolgee.io",fetch:l()},O=(...e)=>{let n={};return e.forEach((e=>{n=Object.assign(Object.assign(Object.assign({},n),e),{observerOptions:Object.assign(Object.assign({},n.observerOptions),null==e?void 0:e.observerOptions)})})),n};function L(e,n){const t=O(y,null==n?void 0:n.initialOptions,e);return t.apiUrl=g(t.apiUrl),(null==e?void 0:e.fetch)&&(t.fetch=l(e.fetch)),{initialOptions:t,activeNamespaces:(null==n?void 0:n.activeNamespaces)||new Map,language:null==n?void 0:n.language,pendingLanguage:null==n?void 0:n.language,isInitialLoading:!1,isRunning:!1}}function j(e,a,i,o,s,r,g){const c={ui:void 0},l={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},u=async({keysAndDefaults:e,event:n})=>{var t;const a=e.map((({key:e,ns:n,defaultValue:t})=>({key:e,defaultValue:t,ns:o({key:e,ns:n}),translation:s({key:e,ns:n})})));null===(t=l.ui)||void 0===t||t.handleElementClick(a,n)},d=(e,n)=>{var t;return(null===(t=l.observer)||void 0===t?void 0:t.findPositions(e,n))||[]};function f(e){const n=s({key:e.key,ns:e.ns});return N.formatTranslation(Object.assign(Object.assign({},e),{translation:n,formatEnabled:!0}))}function p(){return{fetch:a().fetch}}function v(e){l.observer=null==e?void 0:e()}function h(){return Boolean(l.observer)}function y(e){e&&l.formatters.push(e)}function O(e){l.finalFormatter=e}function L(e){c.ui=e}function j(){return Boolean(c.ui)}function k(e){l.languageStorage=e}function R(e){l.languageDetector=e}function w(e){e&&l.backends.push(e)}function E(e){l.devBackend=e}const N=Object.freeze({addPlugin:function(e,n){n(e,Object.freeze({setFinalFormatter:O,addFormatter:y,setObserver:v,hasObserver:h,setUi:L,hasUi:j,setDevBackend:E,addBackend:w,setLanguageDetector:R,setLanguageStorage:k}))},run(){var e,n;const{apiKey:t,apiUrl:i,projectId:o,observerOptions:s}=a();l.ui=null===(e=c.ui)||void 0===e?void 0:e.call(c,{apiKey:t,apiUrl:i,projectId:o,highlight:N.highlight,changeTranslation:r,findPositions:d,onPermanentChange:g}),null===(n=l.observer)||void 0===n||n.run({mouseHighlight:!0,options:s,translate:f,onClick:u})},stop(){var e;l.ui=void 0,null===(e=l.observer)||void 0===e||e.stop()},getLanguageStorage:()=>l.languageStorage,getInitialLanguage(){var e;const n=i();return t(null===(e=l.languageStorage)||void 0===e?void 0:e.getLanguage(p()),(e=>n&&!n.includes(e)||!e?function(){if(!l.languageDetector)return;const e=i();return l.languageDetector.getLanguage(Object.assign({availableLanguages:e},p()))}():e))},setStoredLanguage(e){var n;null===(n=l.languageStorage)||void 0===n||n.setLanguage(e,p())},getDevBackend:()=>l.devBackend,getBackendRecord:({language:e,namespace:t})=>{for(const a of l.backends){const i=a.getRecord(Object.assign({language:e,namespace:t},p()));if(n(i))return null==i?void 0:i.catch((e=>(console.error(e),{})));if(void 0!==i)return i}},getBackendDevRecord:({language:e,namespace:n})=>{var t;const{apiKey:i,apiUrl:o,projectId:s}=a();return null===(t=l.devBackend)||void 0===t?void 0:t.getRecord(Object.assign({apiKey:i,apiUrl:o,projectId:s,language:e,namespace:n},p()))},getLanguageDetector:()=>l.languageDetector,retranslate(){var e;null===(e=l.observer)||void 0===e||e.retranslate()},highlight:(e,n)=>{var t,a;return(null===(a=null===(t=l.observer)||void 0===t?void 0:t.highlight)||void 0===a?void 0:a.call(t,e,n))||{unhighlight(){}}},unwrap(e){var n;return l.observer?null===(n=l.observer)||void 0===n?void 0:n.unwrap(e):{text:e,keys:[]}},wrap(e){var n;return l.observer?null===(n=l.observer)||void 0===n?void 0:n.wrap(e):e.translation},hasDevBackend:()=>Boolean(N.getDevBackend()),formatTranslation(n){var t,{formatEnabled:i}=n,o=m(n,["formatEnabled"]);const{key:s,translation:r,defaultValue:g,noWrap:c,params:u,orEmpty:d,ns:f}=o,p=r||g;let v=p||(d?"":s);const h=e(),y=i||!(null===(t=l.observer)||void 0===t?void 0:t.outputNotFormattable),O=e=>l.observer&&!c?l.observer.wrap({key:s,translation:e,defaultValue:g,params:u,ns:f}):e;v=O(v);try{if(p&&h&&y)for(const e of l.formatters)v=e.format({translation:v,language:h,params:u});l.finalFormatter&&p&&h&&y&&(v=l.finalFormatter.format({translation:v,language:h,params:u}))}catch(e){console.error(e);const n=("string"==typeof(L=e)?L:"string"==typeof(null==L?void 0:L.message)?L.message:void 0)||b,t=a().onFormatError,i=typeof t;v="string"===i?t:"function"===i?t(n,o):b,v=O(v)}var L;return v}});return N}const k=(e,n,t)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=n();a!==e&&t(e),a=e}})};const R=(e,...n)=>{let t,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof n[0]?(a.defaultValue=n[0],t=n[1]):"object"==typeof n[0]&&(t=n[0])),t&&(a=Object.assign(Object.assign({},function(e){var{ns:n,noWrap:t,orEmpty:a,params:i,language:o}=e,s=m(e,["ns","noWrap","orEmpty","params","language"]);const r={ns:n,noWrap:t,orEmpty:a,language:o};return Object.assign(Object.assign({},r),{params:Object.assign({},s)})}(t)),a)),a};function w({options:e}){const i=function(e,n){let t=!0;function a(){return t}const i=Object.freeze({onPendingLanguageChange:u(a),onLanguageChange:u(a),onLoadingChange:u(a),onFetchingChange:u(a),onInitialLoaded:u(a),onRunningChange:u(a),onCacheChange:u(a),onUpdate:d(a,e,n),onPermanentChange:u(a),setEmitterActive(e){t=e},on:(e,n)=>{switch(e){case"pendingLanguage":return i.onPendingLanguageChange.listen(n);case"language":return i.onLanguageChange.listen(n);case"loading":return i.onLoadingChange.listen(n);case"fetching":return i.onFetchingChange.listen(n);case"initialLoad":return i.onInitialLoaded.listen(n);case"running":return i.onRunningChange.listen(n);case"cache":return i.onCacheChange.listen(n);case"update":return i.onUpdate.listen(n);case"permanentChange":return i.onPermanentChange.listen(n)}}});return i.onInitialLoaded.listen((()=>i.onUpdate.emit())),i.onLanguageChange.listen((()=>i.onUpdate.emit())),i.onCacheChange.listen((({value:e})=>i.onUpdate.emit([e.namespace],!0))),i}(y,O),c=k(!1,(()=>m.isFetching()),i.onFetchingChange.emit),l=k(!1,(()=>F.isLoading()),i.onLoadingChange.emit),f=function(e,n,t){let a,i=L();const c=Object.freeze({init(e){i=L(e,i)},isRunning:()=>i.isRunning,setRunning(e){i.isRunning!==e&&(i.isRunning=e,t.emit(e))},isInitialLoading:()=>i.isInitialLoading,setInitialLoading(e){i.isInitialLoading=e},getLanguage:()=>i.language||i.initialOptions.language,setLanguage(n){i.language!==n&&(i.language=n,e.emit(n))},getPendingLanguage:()=>i.pendingLanguage||c.getLanguage(),setPendingLanguage(e){i.pendingLanguage!==e&&(i.pendingLanguage=e,n.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},i.initialOptions),a),addActiveNs(e){o(e).forEach((e=>{const n=i.activeNamespaces.get(e);void 0!==n?i.activeNamespaces.set(e,n+1):i.activeNamespaces.set(e,1)}))},removeActiveNs(e){o(e).forEach((e=>{const n=i.activeNamespaces.get(e);void 0!==n&&n>1?i.activeNamespaces.set(e,n-1):i.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>r([...i.initialOptions.ns||[i.initialOptions.defaultNs],...o(i.initialOptions.fallbackNs),...i.activeNamespaces.keys()]),getFallbackLangs(e){const n=e||c.getLanguage();return n?r([n,...s(n,i.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>o(i.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?i.initialOptions.defaultNs:e,getAvailableLanguages(){if(i.initialOptions.availableLanguages)return i.initialOptions.availableLanguages;if(i.initialOptions.staticData){const e=Object.keys(i.initialOptions.staticData).map((e=>p(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?c.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:g(e.apiUrl)}):void 0}});return c}(i.onLanguageChange,i.onPendingLanguageChange,i.onRunningChange),v=j(f.getLanguage,f.getInitialOptions,f.getAvailableLanguages,(function({key:e,ns:n}){const t=f.getFallbackLangs(),a=w(n||void 0);return m.getTranslationNs(a,t,e)}),I,N,(function(e){i.onPermanentChange.emit({key:e.key,namespace:e.namespace})})),m=h(i.onCacheChange,v.getBackendRecord,v.getBackendDevRecord,f.withDefaultNs,f.isInitialLoading,c,l);let b;function y(){return f.getFallbackNs()}function O(e){return f.getDefaultNs(e)}function w(e){return[...o(O(e)),...y()]}function E(e){return[...o(e||O()),...f.getRequiredNamespaces()]}function N(e,n,t){const a=f.withDefaultNs(e),i=m.getTranslation(a,n);return m.changeTranslation(a,n,t),{revert(){m.changeTranslation(a,n,i)}}}function C(e){f.init(e),m.addStaticData(f.getInitialOptions().staticData)}function D(e,n){const a=function(e,n){const t=f.getFallbackLangs(e),a=E(n),i=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n},!0)||i.push({language:e,namespace:n})}))})),i}(e,n);if(a.length)return t(F.loadRecords(a),(()=>{}))}function I({key:e,ns:n,language:t}){const a=w(n||void 0),i=f.getFallbackLangs(t);return m.getTranslationFallback(a,i,e)}function A(){const e=t(function(){if(f.getLanguage())return;return t(v.getInitialLanguage(),(e=>{const n=e||f.getInitialOptions().defaultLanguage;n&&f.setLanguage(n)}))}(),(()=>D()));if(n(e))return f.setInitialLoading(!0),c.notify(),l.notify(),Promise.resolve(e).then((()=>{f.setInitialLoading(!1),c.notify(),l.notify(),i.onInitialLoaded.emit()}));i.onInitialLoaded.emit()}e&&C(e),i.onUpdate.listen((()=>{f.isRunning()&&v.retranslate()}));const F=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},i),f),v),m),{init:C,getTranslation:I,changeTranslation:N,async changeLanguage(e){f.getPendingLanguage()===e&&f.getLanguage()===e||(f.setPendingLanguage(e),f.isRunning()&&await D(e),e===f.getPendingLanguage()&&(f.setLanguage(e),v.setStoredLanguage(e)))},async addActiveNs(e,n){n||f.addActiveNs(e),f.isRunning()&&await D(void 0,e)},loadRecords:e=>m.loadRecords(e,F.isDev()),loadRecord:async e=>(await F.loadRecords([e]))[0],isLoading:e=>m.isLoading(f.getLanguage(),e),isLoaded(e){const n=f.getLanguage();if(!n)return!1;const t=f.getFallbackLangs(n),a=E(e),i=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n})||i.push({language:e,namespace:n})}))})),0===i.length},t:(...e)=>{const n=R(...e),t=I(n);return v.formatTranslation(Object.assign(Object.assign({},n),{translation:t}))},isDev:()=>Boolean(f.getInitialOptions().apiKey&&f.getInitialOptions().apiUrl),run:()=>(function(){if((v.getLanguageDetector()||v.getLanguageStorage())&&!f.getAvailableLanguages())throw new Error(a("availableLanguages"));if(!f.getLanguage()&&!f.getInitialOptions().defaultLanguage)throw new Error(a(["defaultLanguage","language"]))}(),f.isRunning()||(f.setRunning(!0),v.run(),b=A()),Promise.resolve(b)),stop(){f.isRunning()&&(v.stop(),f.setRunning(!1))}}));return F}const E=0,N=1,C=2;class D extends Error{constructor(e,n,t){let a;a=e===E?"Empty parameter":e===N?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${n} in "${t}"`),this.code=e,this.index=n}}function I(e){return/\s/.test(e)}const A=0,F=1,S=2,P=3,T=4,U=new Set([S,F,A]),B="'",x=new Set(["{","}",B]),z=e=>/[0-9a-zA-Z_]/.test(e);function K(e,n){const[t,a]=function(e){let n=A,t="",a="",i="";const o=[],s=[];let r=0;function g(n){throw new D(n,r,e)}const c=()=>{o.push(t),t=""},l=()=>{""===a&&g(E),s.push(a),a=""};for(r=0;r<e.length;r++)switch(i=e[r],n){case A:i===B?(t+=i,n=F):"{"===i?(c(),n=P):(t+=i,n=A);break;case F:x.has(i)?(t=t.slice(0,-1)+i,n=S):(t+=i,n=A);break;case S:i===B?n=A:(t+=i,n=S);break;case P:"}"===i?(l(),n=A):I(i)?""!==a&&(l(),n=T):(z(i)||g(N),a+=i,n=P);break;case T:"}"==i?n=A:I(i)?n=T:g(N)}return U.has(n)||g(C),c(),[o,s]}(e),i=[t[0]];for(let o=1;o<t.length;o++){const s=null==n?void 0:n[a[o-1]];if(void 0===s)throw new Error(`Missing parameter "${a[o-1]}" in "${e}"`);i.push(String(s)),i.push(t[o])}return i.join("")}e.FormatSimple=()=>(e,n)=>(n.setFinalFormatter({format:({translation:e,params:n})=>K(e,n)}),e),e.TolgeeCore=()=>{const e={plugins:[],options:{}},n=Object.freeze({use:t=>(e.plugins.push(t),n),updateDefaults:t=>(e.options=O(e.options,t),n),init(n){const t=function(e){const n=w({options:e});function t(e){const t=n.isRunning();t&&n.stop(),e(),n.isDev()&&n.invalidate(),t&&n.run()}n.isDev()&&n.invalidate();const a=Object.freeze({on:n.on,onNsUpdate:n.onUpdate.listenSome,setEmitterActive:n.setEmitterActive,getLanguage:n.getLanguage,getPendingLanguage:n.getPendingLanguage,changeLanguage:n.changeLanguage,changeTranslation:n.changeTranslation,addActiveNs:n.addActiveNs,removeActiveNs:n.removeActiveNs,loadRecords:n.loadRecords,loadRecord:n.loadRecord,addStaticData:n.addStaticData,getRecord:n.getRecord,getAllRecords:n.getAllRecords,isLoaded:n.isLoaded,isInitialLoading:n.isInitialLoading,isLoading:n.isLoading,isFetching:n.isFetching,isRunning:n.isRunning,run:n.run,stop:n.stop,t:n.t,highlight:n.highlight,getInitialOptions:n.getInitialOptions,isDev:n.isDev,wrap:n.wrap,unwrap:n.unwrap,overrideCredentials(e){t((()=>n.overrideCredentials(e)))},addPlugin(e){e&&t((()=>n.addPlugin(a,e)))},updateOptions(e){e&&t((()=>n.init(e)))}});return a}(O(e.options,n));return e.plugins.forEach(t.addPlugin),t}});return n},e.createFetchFunction=l,e.getFallback=i,e.getFallbackArray=o,e.getTranslateProps=R,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=tolgee.umd.min.js.map

@@ -19,3 +19,3 @@ import { CacheDescriptor, NsFallback, TolgeeOptions, TFnType, KeyAndNamespacesInternal, TranslationDescriptor } from '../types';

isDev(): boolean;
run(): Promise<void | undefined>;
run(): Promise<any>;
stop(): void;

@@ -22,0 +22,0 @@ addStaticData: (data: import("./State/initState").TolgeeStaticData | undefined) => void;

@@ -113,3 +113,3 @@ import { TolgeeOptions, TolgeePlugin, DevCredentials, TFnType, DefaultParamType, TranslationKey } from './types';

*/
run: () => Promise<void | undefined>;
run: () => Promise<any>;
/**

@@ -116,0 +116,0 @@ * Changes internal state to running: false and stops runnable plugins.

{
"name": "@tolgee/core",
"version": "5.11.5",
"version": "5.11.6-prerelease.a415c070.0",
"description": "Library providing ability to translate messages directly in context of developed application.",

@@ -73,3 +73,3 @@ "main": "./dist/tolgee.cjs.js",

"sideEffects": false,
"gitHead": "eb529f1b927f1a3fed84e3f85fc4abf06eac6f9c"
"gitHead": "5564190ac7e0445493807df704ca18b46c8fcb91"
}

@@ -66,2 +66,4 @@ import { Events } from './Events/Events';

let runPromise: Promise<any> | undefined;
events.onUpdate.listen(() => {

@@ -287,3 +289,2 @@ if (state.isRunning()) {

run() {
let result: Promise<void> | undefined = undefined;
checkCorrectConfiguration();

@@ -293,5 +294,5 @@ if (!state.isRunning()) {

pluginService.run();
result = loadInitial();
runPromise = loadInitial();
}
return Promise.resolve(result);
return Promise.resolve(runPromise);
},

@@ -298,0 +299,0 @@

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc