@tolgee/core 2.8.0 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,5 +12,5 @@
12
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,r)};function r(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n=function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function i(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))}function o(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function s(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function u(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}var c,l="_tolgee",h="_tolgee-target",p="data-tolgee-key-only",f=function(){function e(){}return e.evaluateGenerator=function(e,t){var r,n;return o(this,(function(i){switch(i.label){case 0:n=document.evaluate(e,t,void 0,XPathResult.ANY_TYPE),i.label=1;case 1:return null===(r=n.iterateNext())?[3,3]:[4,r];case 2:return i.sent(),[3,1];case 3:return[2]}}))},e.evaluate=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Array.from(this.evaluateGenerator.apply(this,u([],a(e),!1)))},e.evaluateToSingle=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.evaluate.apply(this,u([],a(e),!1));if(1===r.length)return r[0];if(r.length<1)throw new Error("No element found");throw new Error("Multiple elements found")},e.closestElement=function(e){return e instanceof Text?e.parentElement:e},e.getParentElement=function(e){return e.parentElement?e.parentElement:e.ownerElement?e.ownerElement:void 0},e.isElementTargetElement=function(e){return e.hasAttribute(h)},e.markElementAsTargetElement=function(e){e.setAttribute(h,"")},e.unmarkElementAsTargetElement=function(e){e.removeAttribute(h)},e.nodeContains=function(e,t){if(e.contains(t))return!0;if(t instanceof Attr){var r=Object.values(t.ownerElement.attributes).indexOf(t)>-1;if(e.contains(t.ownerElement)&&r)return!0}return!1},e}();e.ModifierKey=void 0,(c=e.ModifierKey||(e.ModifierKey={}))[c.Alt=0]="Alt",c[c.Control=1]="Control",c[c.Shift=2]="Shift",c[c.Meta=3]="Meta";var d,g,v,y=function(){if("undefined"!=typeof document)return document.body},m=function(t){this.apiUrl="https://app.tolgee.io",this.inputPrefix="%-%tolgee:",this.inputSuffix="%-%",this.defaultLanguage="en",this.filesUrlPrefix="i18n/",this.tagAttributes={textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},this.highlightKeys=[e.ModifierKey.Alt],this.passToParent=["option","optgroup"],this.restrictedElements=["script","style"],this.highlightColor="rgb(224 240 255)",this.preloadFallback=!1,Object.defineProperty(this,"targetElement",{set:function(e){if(void 0!==this.targetElement)throw new Error("Target element is already defined!");if(void 0===e&&(this._targetElement=y()),f.isElementTargetElement(e))throw console.error("Target element: ",this._targetElement),new Error("An tolgee instance is inited with provided target element");this._targetElement=e,f.markElementAsTargetElement(this._targetElement)},get:function(){return this._targetElement}}),Object.assign(this,t||{}),void 0===this._targetElement&&(this._targetElement=y()),this.mode=this.mode||(this.apiKey?"development":"production"),this.fallbackLanguage=this.fallbackLanguage||this.defaultLanguage,void 0===this.watch&&(this.watch="development"===this.mode)},E="__tolgee_preferredLanguages",b="__tolgee_currentLanguage",_=function(){function e(){}return Object.defineProperty(e.prototype,"currentLanguage",{get:function(){var e;if(this.config.forceLanguage)return this.config.forceLanguage;"undefined"!=typeof localStorage?(e=localStorage.getItem(b),this.config.availableLanguages&&(this.config.availableLanguages.indexOf(e)>-1||(e=void 0))):e=this._currentLanguage;return e||(e=this.getLanguageByNavigator(),this.currentLanguage=e),e},set:function(e){"undefined"!=typeof localStorage?localStorage.setItem(b,e):this._currentLanguage=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"preferredLanguages",{get:function(){return new Set(JSON.parse(localStorage.getItem(E)))},set:function(e){localStorage.setItem(E,JSON.stringify(Array.from(e)))},enumerable:!1,configurable:!0}),e.prototype.getLanguageByNavigator=function(){if("undefined"!=typeof window&&this.config.availableLanguages){var e=window.navigator.language,t=this.config.availableLanguages.find((function(t){return t===e}));if(t)return t;var r=function(e){return e.replace(/^(.+?)(-.*)?$/,"$1")},n=r(window.navigator.language),i=this.config.availableLanguages.find((function(e){return r(e)===n}));if(i)return i}return this.config.defaultLanguage},e}(),T=function(){function e(e){this.onUnsubscribe=e}return e.prototype.unsubscribe=function(){this.onUnsubscribe()},e}(),w=function(){function e(){this.idCounter=0,this._subscriptions=new Map}return Object.defineProperty(e.prototype,"subscriptions",{get:function(){return this._subscriptions},enumerable:!1,configurable:!0}),e.prototype.emit=function(e){var t,r,n=[];try{for(var i=s(this.subscriptions.values()),o=i.next();!o.done;o=i.next()){var a=(0,o.value)(e);"function"==typeof(null==a?void 0:a.then)&&n.push(a)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}if(0!==n.length)return new Promise((function(e){return Promise.all(n).then((function(){return e()}))}))},e.prototype.subscribe=function(e){var t=this,r=this.idCounter++,n=new T((function(){return t.unsubscribe(r)}));return this.subscriptions.set(r,e),n},e.prototype.unsubscribe=function(e){this._subscriptions.delete(e)||console.warn("Event to unsubscribe was not found")},e}(),S=function(){this.TRANSLATION_CHANGED=new w,this.LANGUAGE_CHANGED=new w,this.LANGUAGE_LOADED=new w,this.ELEMENT_REGISTERED=new w},A=function(e){function t(r,n){var i=e.call(this,"Api http error")||this;return i.response=r,i.code=n,Object.setPrototypeOf(i,t.prototype),i}return r(t,e),t}(Error),L=function(){function e(e){this.properties=e}return e.handleErrors=function(e){return i(this,void 0,void 0,(function(){var t,r;return o(this,(function(n){switch(n.label){case 0:if(!(e.status>=400))return[3,5];t=new A(e),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,e.json()];case 2:return r=n.sent(),t.code=r.code,[3,4];case 3:return n.sent(),console.warn("Tolgee server responded with invalid status code."),[3,4];case 4:throw t;case 5:return[2,e]}}))}))},e.prototype.fetch=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return i(this,void 0,void 0,(function(){var r,i,s;return o(this,(function(o){return"object"==typeof t[0]?[2,fetch(n(n({},t[0]),{url:this.getUrl(t[0].url)})).then((function(t){return e.handleErrors(t)}))]:(r=a(t),i=r[0],s=r.slice(1),[2,fetch.apply(void 0,u([this.getUrl(i)],a(s),!1)).then((function(t){return e.handleErrors(t)}))])}))}))},e.prototype.fetchJson=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.fetch.apply(this,u([],a(e),!1)).then((function(e){return e.json()}))]}))}))},e.prototype.post=function(e,t,r){void 0===r&&(r={});for(var s=[],c=3;c<arguments.length;c++)s[c-3]=arguments[c];return i(this,void 0,void 0,(function(){return o(this,(function(i){return[2,this.fetch.apply(this,u([e,n({body:JSON.stringify(t),method:"POST",headers:{"Content-Type":"application/json"}},r)],a(s),!1))]}))}))},e.prototype.postJson=function(e,t,r){void 0===r&&(r={});for(var n=[],s=3;s<arguments.length;s++)n[s-3]=arguments[s];return i(this,void 0,void 0,(function(){return o(this,(function(i){return[2,this.post.apply(this,u([e,t,r],a(n),!1)).then((function(e){return e.json()}))]}))}))},e.prototype.getUrl=function(e){var t=e.indexOf("?")<0?"?":"&";return this.properties.config.apiUrl+"/"+e+t+"ak="+this.properties.config.apiKey},e}(),P=function(e,t,r){this.key=e,this.translations=t,this.id=r},O=function(){function e(e,t,r,s){var c=this;this.properties=e,this.coreService=t,this.apiHttpService=r,this.eventService=s,this.translationsCache=new Map,this.fetchPromises={},this.updateTranslationInCache=function(e){return i(c,void 0,void 0,(function(){var t,r=this;return o(this,(function(n){switch(n.label){case 0:return t={},Object.entries(e.translations).forEach((function(n){var i=a(n,2),o=i[0],s=i[1],u=r.translationsCache.get(o);u&&(u[e.name]=s.text),t[o]=s.text})),[4,this.eventService.TRANSLATION_CHANGED.emit(new P(e.name,t,e.id))];case 1:return n.sent(),[2]}}))}))},this.getTranslationsOfKey=function(e,t){return void 0===t&&(t=new Set([c.properties.currentLanguage])),i(c,void 0,void 0,(function(){var r,i,s,c,l,h,p,f,d,g,v;return o(this,(function(o){switch(o.label){case 0:this.coreService.checkScope("translations.view"),o.label=1;case 1:return o.trys.push([1,3,,7]),r=u([],a(t),!1),i=r.map((function(e){return"languages="+e})).join("&"),[4,this.apiHttpService.fetchJson("v2/projects/translations?"+i+"&filterKeyName="+encodeURIComponent(e))];case 2:return s=o.sent(),c=r.reduce((function(e,t){var r;return n(n({},e),((r={})[t]="",r))}),{}),(null==(l=null===(g=null===(d=s._embedded)||void 0===d?void 0:d.keys)||void 0===g?void 0:g[0])?void 0:l.translations)&&Object.entries(l.translations).forEach((function(e){var t=a(e,2),r=t[0],n=t[1];return c[r]=n.text})),h=null===(v=s.selectedLanguages)||void 0===v?void 0:v.map((function(e){return e.tag})),[2,[l,h]];case 3:return(p=o.sent())instanceof A&&404===p.response.status&&"language_not_found"===p.code?(f=this.properties,[4,this.coreService.getLanguages()]):[3,5];case 4:return f.preferredLanguages=o.sent(),console.error("Requested language not found, refreshing the page!"),location.reload(),[3,6];case 5:throw p;case 6:return[3,7];case 7:return[2]}}))}))}}return e.translationByValue=function(e,t,r,n){return e||(n||(r?"":t))},e.prototype.initStatic=function(){var e,t=this;"production"===this.properties.config.mode&&"object"==typeof(null===(e=this.properties.config)||void 0===e?void 0:e.staticData)&&Object.entries(this.properties.config.staticData).forEach((function(e){var r=a(e,2),n=r[0],i=r[1];"function"!=typeof i&&t.setLanguageData(n,i)}))},e.prototype.loadTranslations=function(e){return void 0===e&&(e=this.properties.currentLanguage),i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return null!=this.translationsCache.get(e)?[3,2]:(this.fetchPromises[e]instanceof Promise||(this.fetchPromises[e]=this.fetchTranslations(e)),[4,this.fetchPromises[e]]);case 1:t.sent(),this.eventService.LANGUAGE_LOADED.emit(e),t.label=2;case 2:return this.fetchPromises[e]=void 0,[2]}}))}))},e.prototype.getTranslation=function(t,r,n,s){return void 0===r&&(r=this.properties.currentLanguage),void 0===n&&(n=!1),i(this,void 0,void 0,(function(){var i;return o(this,(function(o){switch(o.label){case 0:return(i=this.getFromCache(t,r))?[3,3]:[4,this.loadTranslations(r)];case 1:return o.sent(),(i=this.getFromCache(t,r))?[3,3]:(i=this.getFromCache(t,this.properties.config.fallbackLanguage))?[3,3]:[4,this.loadTranslations(this.properties.config.fallbackLanguage)];case 2:o.sent(),i=this.getFromCache(t,this.properties.config.fallbackLanguage),o.label=3;case 3:return[2,e.translationByValue(i,t,n,s)]}}))}))},e.prototype.updateKeyComplex=function(e,t){var r,s;return i(this,void 0,void 0,(function(){var i;return o(this,(function(o){switch(o.label){case 0:return this.coreService.checkScope("translations.edit"),[4,this.apiHttpService.postJson("v2/projects/keys/"+e+"/complex-update",n(n({},t),{screenshotUploadedImageIds:(null===(r=t.screenshotUploadedImageIds)||void 0===r?void 0:r.length)?t.screenshotUploadedImageIds:void 0,screenshotIdsToDelete:(null===(s=t.screenshotIdsToDelete)||void 0===s?void 0:s.length)?t.screenshotIdsToDelete:void 0}),{method:"put"})];case 1:return i=o.sent(),[4,this.updateTranslationInCache(i)];case 2:return o.sent(),[2,i]}}))}))},e.prototype.createKey=function(e){var t;return i(this,void 0,void 0,(function(){var r;return o(this,(function(i){switch(i.label){case 0:return this.coreService.checkScope("keys.edit"),[4,this.apiHttpService.postJson("v2/projects/keys/create",n(n({},e),{screenshotUploadedImageIds:(null===(t=e.screenshotUploadedImageIds)||void 0===t?void 0:t.length)?e.screenshotUploadedImageIds:void 0}))];case 1:return r=i.sent(),[4,this.updateTranslationInCache(r)];case 2:return i.sent(),[2,r]}}))}))},e.prototype.setTranslations=function(e){return i(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return this.coreService.checkScope("translations.edit"),[4,this.apiHttpService.postJson("v2/projects/translations",e)];case 1:return t=r.sent(),[4,this.updateTranslationInCache({id:t.keyId,name:t.keyName,translations:t.translations})];case 2:return r.sent(),[2,t]}}))}))},e.prototype.changeTranslations=function(e){var t=e.key,r=e.translations;return i(this,void 0,void 0,(function(){var e,n=this;return o(this,(function(s){switch(s.label){case 0:return e={},Object.entries(r).forEach((function(r){var i=a(r,2),o=i[0],s=i[1],u=n.translationsCache.get(o);u&&(e[o]=u[t],u[t]=s)})),[4,this.eventService.TRANSLATION_CHANGED.emit({key:t,translations:r})];case 1:return s.sent(),[2,function(){return i(n,void 0,void 0,(function(){var r=this;return o(this,(function(n){switch(n.label){case 0:return Object.entries(e).forEach((function(e){var n=a(e,2),i=n[0],o=n[1],s=r.translationsCache.get(i);s&&(s[t]=o)})),[4,this.eventService.TRANSLATION_CHANGED.emit({key:t,translations:e})];case 1:return n.sent(),[2]}}))}))}]}}))}))},e.prototype.getFromCacheOrFallback=function(t,r,n,i){void 0===r&&(r=this.properties.currentLanguage),void 0===n&&(n=!1);var o=this.getFromCache(t,r)||this.getFromCache(t,this.properties.config.fallbackLanguage);return e.translationByValue(o,t,n,i)},e.prototype.fetchTranslations=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return"development"!==this.properties.config.mode?[3,2]:[4,this.fetchTranslationsDevelopment(e)];case 1:return[2,t.sent()];case 2:return[4,this.fetchTranslationsProduction(e)];case 3:return[2,t.sent()]}}))}))},e.prototype.fetchTranslationsProduction=function(e){var t,r;return i(this,void 0,void 0,(function(){var n,i,s,a;return o(this,(function(o){switch(o.label){case 0:return"function"!=typeof(n=null===(r=null===(t=this.properties.config)||void 0===t?void 0:t.staticData)||void 0===r?void 0:r[e])?[3,2]:[4,n()];case 1:return a=o.sent(),this.setLanguageData(e,a),[2];case 2:if(void 0!==n)return this.setLanguageData(e,n),[2];o.label=3;case 3:i=""+(this.properties.config.filesUrlPrefix||"/")+e+".json",o.label=4;case 4:return o.trys.push([4,10,,11]),[4,fetch(i)];case 5:if((s=o.sent()).status>=400)return console.error("Server responded with error status while loading localization data."),this.setLanguageData(e,{}),[2];o.label=6;case 6:return o.trys.push([6,8,,9]),[4,s.json()];case 7:return a=o.sent(),this.setLanguageData(e,a),[3,9];case 8:return o.sent(),console.error("Error parsing json retrieved from "+i+"."),this.setEmptyLanguageData(e),[3,9];case 9:return[3,11];case 10:return o.sent(),console.error("Error fetching localization data from "+i+"."),this.setEmptyLanguageData(e),[3,11];case 11:return[2]}}))}))},e.prototype.fetchTranslationsDevelopment=function(e){return i(this,void 0,void 0,(function(){var t,r;return o(this,(function(n){switch(n.label){case 0:this.coreService.checkScope("translations.view"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.apiHttpService.fetchJson("v2/projects/translations/"+e)];case 2:return t=n.sent(),this.setLanguageData(e,t[e]||{}),[3,4];case 3:return r=n.sent(),console.error("Error while fetching localization data from API.",r),this.setEmptyLanguageData(e),[2];case 4:return[2]}}))}))},e.prototype.setEmptyLanguageData=function(e){this.translationsCache.set(e,{})},e.prototype.setLanguageData=function(e,t){var r=function(e){var t={};return Object.entries(e).forEach((function(e){var n=a(e,2),i=n[0],o=n[1];o&&("object"!=typeof o?t[i]=o:Object.entries(r(o)).forEach((function(e){var r=a(e,2),n=r[0],o=r[1];t[i+"."+n]=o})))})),t};this.translationsCache.set(e,r(t))},e.prototype.getFromCache=function(e,t){void 0===t&&(t=this.properties.currentLanguage);var r=this.translationsCache.get(t);if(void 0!==r)return r[e]},e}(),N=function(){function e(){}return e.splitOnNonEscapedDelimiter=function(e,t){for(var r=[],n="",i=!1,o=0;o<e.length;o++){var s=e[o];"\\"!==s||i?i?(i=!1,n+=s):s!==t?n+=s:(r.push(n),n=""):i=!0}return r.push(n),r},e.isCharEscaped=function(e,t){for(var r=0;e>-1&&"\\"===t[e-1];)r++,e--;return r%2==1},e.removeEscapes=function(e){for(var t="",r=!1,n=0;n<e.length;n++){var i=e[n];"\\"!==i||r?r?(r=!1,t+=i):t+=i:r=!0}return t},e}();function C(e){return e.type===g.literal}function R(e){return e.type===g.argument}function I(e){return e.type===g.number}function k(e){return e.type===g.date}function D(e){return e.type===g.time}function U(e){return e.type===g.select}function M(e){return e.type===g.plural}function x(e){return e.type===g.pound}function G(e){return e.type===g.tag}function F(e){return!(!e||"object"!=typeof e||e.type!==v.number)}function H(e){return!(!e||"object"!=typeof e||e.type!==v.dateTime)}!function(e){e[e.EXPECT_ARGUMENT_CLOSING_BRACE=1]="EXPECT_ARGUMENT_CLOSING_BRACE",e[e.EMPTY_ARGUMENT=2]="EMPTY_ARGUMENT",e[e.MALFORMED_ARGUMENT=3]="MALFORMED_ARGUMENT",e[e.EXPECT_ARGUMENT_TYPE=4]="EXPECT_ARGUMENT_TYPE",e[e.INVALID_ARGUMENT_TYPE=5]="INVALID_ARGUMENT_TYPE",e[e.EXPECT_ARGUMENT_STYLE=6]="EXPECT_ARGUMENT_STYLE",e[e.INVALID_NUMBER_SKELETON=7]="INVALID_NUMBER_SKELETON",e[e.INVALID_DATE_TIME_SKELETON=8]="INVALID_DATE_TIME_SKELETON",e[e.EXPECT_NUMBER_SKELETON=9]="EXPECT_NUMBER_SKELETON",e[e.EXPECT_DATE_TIME_SKELETON=10]="EXPECT_DATE_TIME_SKELETON",e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]="UNCLOSED_QUOTE_IN_ARGUMENT_STYLE",e[e.EXPECT_SELECT_ARGUMENT_OPTIONS=12]="EXPECT_SELECT_ARGUMENT_OPTIONS",e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]="EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]="INVALID_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR=15]="EXPECT_SELECT_ARGUMENT_SELECTOR",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]="EXPECT_PLURAL_ARGUMENT_SELECTOR",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]="EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]="EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT",e[e.INVALID_PLURAL_ARGUMENT_SELECTOR=19]="INVALID_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]="DUPLICATE_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]="DUPLICATE_SELECT_ARGUMENT_SELECTOR",e[e.MISSING_OTHER_CLAUSE=22]="MISSING_OTHER_CLAUSE",e[e.INVALID_TAG=23]="INVALID_TAG",e[e.INVALID_TAG_NAME=25]="INVALID_TAG_NAME",e[e.UNMATCHED_CLOSING_TAG=26]="UNMATCHED_CLOSING_TAG",e[e.UNCLOSED_TAG=27]="UNCLOSED_TAG"}(d||(d={})),function(e){e[e.literal=0]="literal",e[e.argument=1]="argument",e[e.number=2]="number",e[e.date=3]="date",e[e.time=4]="time",e[e.select=5]="select",e[e.plural=6]="plural",e[e.pound=7]="pound",e[e.tag=8]="tag"}(g||(g={})),function(e){e[e.number=0]="number",e[e.dateTime=1]="dateTime"}(v||(v={}));var j=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,V=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function K(e){var t={};return e.replace(V,(function(e){var r=e.length;switch(e[0]){case"G":t.era=4===r?"long":5===r?"narrow":"short";break;case"y":t.year=2===r?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":t.month=["numeric","2-digit","short","long","narrow"][r-1];break;case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":t.day=["numeric","2-digit"][r-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":t.weekday=4===r?"short":5===r?"narrow":"short";break;case"e":if(r<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][r-4];break;case"c":if(r<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][r-4];break;case"a":t.hour12=!0;break;case"b":case"B":throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":t.hourCycle="h12",t.hour=["numeric","2-digit"][r-1];break;case"H":t.hourCycle="h23",t.hour=["numeric","2-digit"][r-1];break;case"K":t.hourCycle="h11",t.hour=["numeric","2-digit"][r-1];break;case"k":t.hourCycle="h24",t.hour=["numeric","2-digit"][r-1];break;case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":t.minute=["numeric","2-digit"][r-1];break;case"s":t.second=["numeric","2-digit"][r-1];break;case"S":case"A":throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");case"z":t.timeZoneName=r<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return""})),t}var X=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;var B,Y=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,z=/^(@+)?(\+|#+)?[rs]?$/g,W=/(\*)(0+)|(#+)(0+)|(0+)/g,J=/^(0+)$/;function q(e){var t={};return"r"===e[e.length-1]?t.roundingPriority="morePrecision":"s"===e[e.length-1]&&(t.roundingPriority="lessPrecision"),e.replace(z,(function(e,r,n){return"string"!=typeof n?(t.minimumSignificantDigits=r.length,t.maximumSignificantDigits=r.length):"+"===n?t.minimumSignificantDigits=r.length:"#"===r[0]?t.maximumSignificantDigits=r.length:(t.minimumSignificantDigits=r.length,t.maximumSignificantDigits=r.length+("string"==typeof n?n.length:0)),""})),t}function Z(e){switch(e){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":case"()":return{currencySign:"accounting"};case"sign-always":case"+!":return{signDisplay:"always"};case"sign-accounting-always":case"()!":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":case"+?":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":case"()?":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":case"+_":return{signDisplay:"never"}}}function $(e){var t;if("E"===e[0]&&"E"===e[1]?(t={notation:"engineering"},e=e.slice(2)):"E"===e[0]&&(t={notation:"scientific"},e=e.slice(1)),t){var r=e.slice(0,2);if("+!"===r?(t.signDisplay="always",e=e.slice(2)):"+?"===r&&(t.signDisplay="exceptZero",e=e.slice(2)),!J.test(e))throw new Error("Malformed concise eng/scientific notation");t.minimumIntegerDigits=e.length}return t}function Q(e){var t=Z(e);return t||{}}function ee(e){for(var t={},r=0,i=e;r<i.length;r++){var o=i[r];switch(o.stem){case"percent":case"%":t.style="percent";continue;case"%x100":t.style="percent",t.scale=100;continue;case"currency":t.style="currency",t.currency=o.options[0];continue;case"group-off":case",_":t.useGrouping=!1;continue;case"precision-integer":case".":t.maximumFractionDigits=0;continue;case"measure-unit":case"unit":t.style="unit",t.unit=o.options[0].replace(/^(.*?)-/,"");continue;case"compact-short":case"K":t.notation="compact",t.compactDisplay="short";continue;case"compact-long":case"KK":t.notation="compact",t.compactDisplay="long";continue;case"scientific":t=n(n(n({},t),{notation:"scientific"}),o.options.reduce((function(e,t){return n(n({},e),Q(t))}),{}));continue;case"engineering":t=n(n(n({},t),{notation:"engineering"}),o.options.reduce((function(e,t){return n(n({},e),Q(t))}),{}));continue;case"notation-simple":t.notation="standard";continue;case"unit-width-narrow":t.currencyDisplay="narrowSymbol",t.unitDisplay="narrow";continue;case"unit-width-short":t.currencyDisplay="code",t.unitDisplay="short";continue;case"unit-width-full-name":t.currencyDisplay="name",t.unitDisplay="long";continue;case"unit-width-iso-code":t.currencyDisplay="symbol";continue;case"scale":t.scale=parseFloat(o.options[0]);continue;case"integer-width":if(o.options.length>1)throw new RangeError("integer-width stems only accept a single optional option");o.options[0].replace(W,(function(e,r,n,i,o,s){if(r)t.minimumIntegerDigits=n.length;else{if(i&&o)throw new Error("We currently do not support maximum integer digits");if(s)throw new Error("We currently do not support exact integer digits")}return""}));continue}if(J.test(o.stem))t.minimumIntegerDigits=o.stem.length;else if(Y.test(o.stem)){if(o.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");o.stem.replace(Y,(function(e,r,n,i,o,s){return"*"===n?t.minimumFractionDigits=r.length:i&&"#"===i[0]?t.maximumFractionDigits=i.length:o&&s?(t.minimumFractionDigits=o.length,t.maximumFractionDigits=o.length+s.length):(t.minimumFractionDigits=r.length,t.maximumFractionDigits=r.length),""}));var s=o.options[0];"w"===s?t=n(n({},t),{trailingZeroDisplay:"stripIfInteger"}):s&&(t=n(n({},t),q(s)))}else if(z.test(o.stem))t=n(n({},t),q(o.stem));else{var a=Z(o.stem);a&&(t=n(n({},t),a));var u=$(o.stem);u&&(t=n(n({},t),u))}}return t}var te=new RegExp("^"+j.source+"*"),re=new RegExp(j.source+"*$");function ne(e,t){return{start:e,end:t}}var ie=!!String.prototype.startsWith,oe=!!String.fromCodePoint,se=!!Object.fromEntries,ae=!!String.prototype.codePointAt,ue=!!String.prototype.trimStart,ce=!!String.prototype.trimEnd,le=!!Number.isSafeInteger?Number.isSafeInteger:function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},he=!0;try{he="a"===(null===(B=Ee("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu").exec("a"))||void 0===B?void 0:B[0])}catch(e){he=!1}var pe,fe=ie?function(e,t,r){return e.startsWith(t,r)}:function(e,t,r){return e.slice(r,r+t.length)===t},de=oe?String.fromCodePoint:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r,n="",i=e.length,o=0;i>o;){if((r=e[o++])>1114111)throw RangeError(r+" is not a valid code point");n+=r<65536?String.fromCharCode(r):String.fromCharCode(55296+((r-=65536)>>10),r%1024+56320)}return n},ge=se?Object.fromEntries:function(e){for(var t={},r=0,n=e;r<n.length;r++){var i=n[r],o=i[0],s=i[1];t[o]=s}return t},ve=ae?function(e,t){return e.codePointAt(t)}:function(e,t){var r=e.length;if(!(t<0||t>=r)){var n,i=e.charCodeAt(t);return i<55296||i>56319||t+1===r||(n=e.charCodeAt(t+1))<56320||n>57343?i:n-56320+(i-55296<<10)+65536}},ye=ue?function(e){return e.trimStart()}:function(e){return e.replace(te,"")},me=ce?function(e){return e.trimEnd()}:function(e){return e.replace(re,"")};function Ee(e,t){return new RegExp(e,t)}if(he){var be=Ee("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");pe=function(e,t){var r;return be.lastIndex=t,null!==(r=be.exec(e)[1])&&void 0!==r?r:""}}else pe=function(e,t){for(var r=[];;){var n=ve(e,t);if(void 0===n||we(n)||Se(n))break;r.push(n),t+=n>=65536?2:1}return de.apply(void 0,r)};var _e=function(){function e(e,t){void 0===t&&(t={}),this.message=e,this.position={offset:0,line:1,column:1},this.ignoreTag=!!t.ignoreTag,this.requiresOtherClause=!!t.requiresOtherClause,this.shouldParseSkeletons=!!t.shouldParseSkeletons}return e.prototype.parse=function(){if(0!==this.offset())throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(e,t,r){for(var n=[];!this.isEOF();){var i=this.char();if(123===i){if((o=this.parseArgument(e,r)).err)return o;n.push(o.val)}else{if(125===i&&e>0)break;if(35!==i||"plural"!==t&&"selectordinal"!==t){if(60===i&&!this.ignoreTag&&47===this.peek()){if(r)break;return this.error(d.UNMATCHED_CLOSING_TAG,ne(this.clonePosition(),this.clonePosition()))}if(60===i&&!this.ignoreTag&&Te(this.peek()||0)){if((o=this.parseTag(e,t)).err)return o;n.push(o.val)}else{var o;if((o=this.parseLiteral(e,t)).err)return o;n.push(o.val)}}else{var s=this.clonePosition();this.bump(),n.push({type:g.pound,location:ne(s,this.clonePosition())})}}}return{val:n,err:null}},e.prototype.parseTag=function(e,t){var r=this.clonePosition();this.bump();var n=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:g.literal,value:"<"+n+"/>",location:ne(r,this.clonePosition())},err:null};if(this.bumpIf(">")){var i=this.parseMessage(e+1,t,!0);if(i.err)return i;var o=i.val,s=this.clonePosition();if(this.bumpIf("</")){if(this.isEOF()||!Te(this.char()))return this.error(d.INVALID_TAG,ne(s,this.clonePosition()));var a=this.clonePosition();return n!==this.parseTagName()?this.error(d.UNMATCHED_CLOSING_TAG,ne(a,this.clonePosition())):(this.bumpSpace(),this.bumpIf(">")?{val:{type:g.tag,value:n,children:o,location:ne(r,this.clonePosition())},err:null}:this.error(d.INVALID_TAG,ne(s,this.clonePosition())))}return this.error(d.UNCLOSED_TAG,ne(r,this.clonePosition()))}return this.error(d.INVALID_TAG,ne(r,this.clonePosition()))},e.prototype.parseTagName=function(){var e,t=this.offset();for(this.bump();!this.isEOF()&&(45===(e=this.char())||46===e||e>=48&&e<=57||95===e||e>=97&&e<=122||e>=65&&e<=90||183==e||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039);)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(e,t){for(var r=this.clonePosition(),n="";;){var i=this.tryParseQuote(t);if(i)n+=i;else{var o=this.tryParseUnquoted(e,t);if(o)n+=o;else{var s=this.tryParseLeftAngleBracket();if(!s)break;n+=s}}}var a=ne(r,this.clonePosition());return{val:{type:g.literal,value:n,location:a},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return this.isEOF()||60!==this.char()||!this.ignoreTag&&(Te(e=this.peek()||0)||47===e)?null:(this.bump(),"<");var e},e.prototype.tryParseQuote=function(e){if(this.isEOF()||39!==this.char())return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if("plural"===e||"selectordinal"===e)break;return null;default:return null}this.bump();var t=[this.char()];for(this.bump();!this.isEOF();){var r=this.char();if(39===r){if(39!==this.peek()){this.bump();break}t.push(39),this.bump()}else t.push(r);this.bump()}return de.apply(void 0,t)},e.prototype.tryParseUnquoted=function(e,t){if(this.isEOF())return null;var r=this.char();return 60===r||123===r||35===r&&("plural"===t||"selectordinal"===t)||125===r&&e>0?null:(this.bump(),de(r))},e.prototype.parseArgument=function(e,t){var r=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,ne(r,this.clonePosition()));if(125===this.char())return this.bump(),this.error(d.EMPTY_ARGUMENT,ne(r,this.clonePosition()));var n=this.parseIdentifierIfPossible().value;if(!n)return this.error(d.MALFORMED_ARGUMENT,ne(r,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,ne(r,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:g.argument,value:n,location:ne(r,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,ne(r,this.clonePosition())):this.parseArgumentOptions(e,t,n,r);default:return this.error(d.MALFORMED_ARGUMENT,ne(r,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var e=this.clonePosition(),t=this.offset(),r=pe(this.message,t),n=t+r.length;return this.bumpTo(n),{value:r,location:ne(e,this.clonePosition())}},e.prototype.parseArgumentOptions=function(e,t,r,i){var o,s=this.clonePosition(),a=this.parseIdentifierIfPossible().value,u=this.clonePosition();switch(a){case"":return this.error(d.EXPECT_ARGUMENT_TYPE,ne(s,u));case"number":case"date":case"time":this.bumpSpace();var c=null;if(this.bumpIf(",")){this.bumpSpace();var l=this.clonePosition();if((b=this.parseSimpleArgStyleIfPossible()).err)return b;if(0===(f=me(b.val)).length)return this.error(d.EXPECT_ARGUMENT_STYLE,ne(this.clonePosition(),this.clonePosition()));c={style:f,styleLocation:ne(l,this.clonePosition())}}if((_=this.tryParseArgumentClose(i)).err)return _;var h=ne(i,this.clonePosition());if(c&&fe(null==c?void 0:c.style,"::",0)){var p=ye(c.style.slice(2));if("number"===a)return(b=this.parseNumberSkeletonFromString(p,c.styleLocation)).err?b:{val:{type:g.number,value:r,location:h,style:b.val},err:null};if(0===p.length)return this.error(d.EXPECT_DATE_TIME_SKELETON,h);var f={type:v.dateTime,pattern:p,location:c.styleLocation,parsedOptions:this.shouldParseSkeletons?K(p):{}};return{val:{type:"date"===a?g.date:g.time,value:r,location:h,style:f},err:null}}return{val:{type:"number"===a?g.number:"date"===a?g.date:g.time,value:r,location:h,style:null!==(o=null==c?void 0:c.style)&&void 0!==o?o:null},err:null};case"plural":case"selectordinal":case"select":var y=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(d.EXPECT_SELECT_ARGUMENT_OPTIONS,ne(y,n({},y)));this.bumpSpace();var m=this.parseIdentifierIfPossible(),E=0;if("select"!==a&&"offset"===m.value){if(!this.bumpIf(":"))return this.error(d.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,ne(this.clonePosition(),this.clonePosition()));var b;if(this.bumpSpace(),(b=this.tryParseDecimalInteger(d.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,d.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE)).err)return b;this.bumpSpace(),m=this.parseIdentifierIfPossible(),E=b.val}var _,T=this.tryParsePluralOrSelectOptions(e,a,t,m);if(T.err)return T;if((_=this.tryParseArgumentClose(i)).err)return _;var w=ne(i,this.clonePosition());return"select"===a?{val:{type:g.select,value:r,options:ge(T.val),location:w},err:null}:{val:{type:g.plural,value:r,options:ge(T.val),offset:E,pluralType:"plural"===a?"cardinal":"ordinal",location:w},err:null};default:return this.error(d.INVALID_ARGUMENT_TYPE,ne(s,u))}},e.prototype.tryParseArgumentClose=function(e){return this.isEOF()||125!==this.char()?this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,ne(e,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var e=0,t=this.clonePosition();!this.isEOF();){switch(this.char()){case 39:this.bump();var r=this.clonePosition();if(!this.bumpUntil("'"))return this.error(d.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,ne(r,this.clonePosition()));this.bump();break;case 123:e+=1,this.bump();break;case 125:if(!(e>0))return{val:this.message.slice(t.offset,this.offset()),err:null};e-=1;break;default:this.bump()}}return{val:this.message.slice(t.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(e,t){var r=[];try{r=function(e){if(0===e.length)throw new Error("Number skeleton cannot be empty");for(var t=[],r=0,n=e.split(X).filter((function(e){return e.length>0}));r<n.length;r++){var i=n[r].split("/");if(0===i.length)throw new Error("Invalid number skeleton");for(var o=i[0],s=i.slice(1),a=0,u=s;a<u.length;a++)if(0===u[a].length)throw new Error("Invalid number skeleton");t.push({stem:o,options:s})}return t}(e)}catch(e){return this.error(d.INVALID_NUMBER_SKELETON,t)}return{val:{type:v.number,tokens:r,location:t,parsedOptions:this.shouldParseSkeletons?ee(r):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(e,t,r,n){for(var i,o=!1,s=[],a=new Set,u=n.value,c=n.location;;){if(0===u.length){var l=this.clonePosition();if("select"===t||!this.bumpIf("="))break;var h=this.tryParseDecimalInteger(d.EXPECT_PLURAL_ARGUMENT_SELECTOR,d.INVALID_PLURAL_ARGUMENT_SELECTOR);if(h.err)return h;c=ne(l,this.clonePosition()),u=this.message.slice(l.offset,this.offset())}if(a.has(u))return this.error("select"===t?d.DUPLICATE_SELECT_ARGUMENT_SELECTOR:d.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,c);"other"===u&&(o=!0),this.bumpSpace();var p=this.clonePosition();if(!this.bumpIf("{"))return this.error("select"===t?d.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:d.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,ne(this.clonePosition(),this.clonePosition()));var f=this.parseMessage(e+1,t,r);if(f.err)return f;var g=this.tryParseArgumentClose(p);if(g.err)return g;s.push([u,{value:f.val,location:ne(p,this.clonePosition())}]),a.add(u),this.bumpSpace(),u=(i=this.parseIdentifierIfPossible()).value,c=i.location}return 0===s.length?this.error("select"===t?d.EXPECT_SELECT_ARGUMENT_SELECTOR:d.EXPECT_PLURAL_ARGUMENT_SELECTOR,ne(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!o?this.error(d.MISSING_OTHER_CLAUSE,ne(this.clonePosition(),this.clonePosition())):{val:s,err:null}},e.prototype.tryParseDecimalInteger=function(e,t){var r=1,n=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(r=-1);for(var i=!1,o=0;!this.isEOF();){var s=this.char();if(!(s>=48&&s<=57))break;i=!0,o=10*o+(s-48),this.bump()}var a=ne(n,this.clonePosition());return i?le(o*=r)?{val:o,err:null}:this.error(t,a):this.error(e,a)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var e=this.position.offset;if(e>=this.message.length)throw Error("out of bound");var t=ve(this.message,e);if(void 0===t)throw Error("Offset "+e+" is at invalid UTF-16 code unit boundary");return t},e.prototype.error=function(e,t){return{val:null,err:{kind:e,message:this.message,location:t}}},e.prototype.bump=function(){if(!this.isEOF()){var e=this.char();10===e?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=e<65536?1:2)}},e.prototype.bumpIf=function(e){if(fe(this.message,e,this.offset())){for(var t=0;t<e.length;t++)this.bump();return!0}return!1},e.prototype.bumpUntil=function(e){var t=this.offset(),r=this.message.indexOf(e,t);return r>=0?(this.bumpTo(r),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(e){if(this.offset()>e)throw Error("targetOffset "+e+" must be greater than or equal to the current offset "+this.offset());for(e=Math.min(e,this.message.length);;){var t=this.offset();if(t===e)break;if(t>e)throw Error("targetOffset "+e+" is at invalid UTF-16 code unit boundary");if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&we(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var e=this.char(),t=this.offset(),r=this.message.charCodeAt(t+(e>=65536?2:1));return null!=r?r:null},e}();function Te(e){return e>=97&&e<=122||e>=65&&e<=90}function we(e){return e>=9&&e<=13||32===e||133===e||e>=8206&&e<=8207||8232===e||8233===e}function Se(e){return e>=33&&e<=35||36===e||e>=37&&e<=39||40===e||41===e||42===e||43===e||44===e||45===e||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||91===e||92===e||93===e||94===e||96===e||123===e||124===e||125===e||126===e||161===e||e>=162&&e<=165||166===e||167===e||169===e||171===e||172===e||174===e||176===e||177===e||182===e||187===e||191===e||215===e||247===e||e>=8208&&e<=8213||e>=8214&&e<=8215||8216===e||8217===e||8218===e||e>=8219&&e<=8220||8221===e||8222===e||8223===e||e>=8224&&e<=8231||e>=8240&&e<=8248||8249===e||8250===e||e>=8251&&e<=8254||e>=8257&&e<=8259||8260===e||8261===e||8262===e||e>=8263&&e<=8273||8274===e||8275===e||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||8608===e||e>=8609&&e<=8610||8611===e||e>=8612&&e<=8613||8614===e||e>=8615&&e<=8621||8622===e||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||8658===e||8659===e||8660===e||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||8968===e||8969===e||8970===e||8971===e||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||9001===e||9002===e||e>=9003&&e<=9083||9084===e||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||9655===e||e>=9656&&e<=9664||9665===e||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||9839===e||e>=9840&&e<=10087||10088===e||10089===e||10090===e||10091===e||10092===e||10093===e||10094===e||10095===e||10096===e||10097===e||10098===e||10099===e||10100===e||10101===e||e>=10132&&e<=10175||e>=10176&&e<=10180||10181===e||10182===e||e>=10183&&e<=10213||10214===e||10215===e||10216===e||10217===e||10218===e||10219===e||10220===e||10221===e||10222===e||10223===e||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||10627===e||10628===e||10629===e||10630===e||10631===e||10632===e||10633===e||10634===e||10635===e||10636===e||10637===e||10638===e||10639===e||10640===e||10641===e||10642===e||10643===e||10644===e||10645===e||10646===e||10647===e||10648===e||e>=10649&&e<=10711||10712===e||10713===e||10714===e||10715===e||e>=10716&&e<=10747||10748===e||10749===e||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||11158===e||e>=11159&&e<=11263||e>=11776&&e<=11777||11778===e||11779===e||11780===e||11781===e||e>=11782&&e<=11784||11785===e||11786===e||11787===e||11788===e||11789===e||e>=11790&&e<=11798||11799===e||e>=11800&&e<=11801||11802===e||11803===e||11804===e||11805===e||e>=11806&&e<=11807||11808===e||11809===e||11810===e||11811===e||11812===e||11813===e||11814===e||11815===e||11816===e||11817===e||e>=11818&&e<=11822||11823===e||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||11840===e||11841===e||11842===e||e>=11843&&e<=11855||e>=11856&&e<=11857||11858===e||e>=11859&&e<=11903||e>=12289&&e<=12291||12296===e||12297===e||12298===e||12299===e||12300===e||12301===e||12302===e||12303===e||12304===e||12305===e||e>=12306&&e<=12307||12308===e||12309===e||12310===e||12311===e||12312===e||12313===e||12314===e||12315===e||12316===e||12317===e||e>=12318&&e<=12319||12320===e||12336===e||64830===e||64831===e||e>=65093&&e<=65094}function Ae(e){e.forEach((function(e){if(delete e.location,U(e)||M(e))for(var t in e.options)delete e.options[t].location,Ae(e.options[t].value);else I(e)&&F(e.style)||(k(e)||D(e))&&H(e.style)?delete e.style.location:G(e)&&Ae(e.children)}))}function Le(e,t){void 0===t&&(t={}),t=n({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var r=new _e(e,t).parse();if(r.err){var i=SyntaxError(d[r.err.kind]);throw i.location=r.err.location,i.originalMessage=r.err.message,i}return(null==t?void 0:t.captureLocation)||Ae(r.val),r.val}function Pe(e,t){var r=t&&t.cache?t.cache:Ue,n=t&&t.serializer?t.serializer:Ie;return(t&&t.strategy?t.strategy:Re)(e,{cache:r,serializer:n})}function Oe(e,t,r,n){var i,o=null==(i=n)||"number"==typeof i||"boolean"==typeof i?n:r(n),s=t.get(o);return void 0===s&&(s=e.call(this,n),t.set(o,s)),s}function Ne(e,t,r){var n=Array.prototype.slice.call(arguments,3),i=r(n),o=t.get(i);return void 0===o&&(o=e.apply(this,n),t.set(i,o)),o}function Ce(e,t,r,n,i){return r.bind(t,e,n,i)}function Re(e,t){return Ce(e,this,1===e.length?Oe:Ne,t.cache.create(),t.serializer)}var Ie=function(){return JSON.stringify(arguments)};function ke(){this.cache=Object.create(null)}ke.prototype.get=function(e){return this.cache[e]},ke.prototype.set=function(e,t){this.cache[e]=t};var De,Ue={create:function(){return new ke}},Me={variadic:function(e,t){return Ce(e,this,Ne,t.cache.create(),t.serializer)},monadic:function(e,t){return Ce(e,this,Oe,t.cache.create(),t.serializer)}};!function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"}(De||(De={}));var xe,Ge=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.code=r,i.originalMessage=n,i}return r(t,e),t.prototype.toString=function(){return"[formatjs Error: "+this.code+"] "+this.message},t}(Error),Fe=function(e){function t(t,r,n,i){return e.call(this,'Invalid values for "'+t+'": "'+r+'". Options are "'+Object.keys(n).join('", "')+'"',De.INVALID_VALUE,i)||this}return r(t,e),t}(Ge),He=function(e){function t(t,r,n){return e.call(this,'Value for "'+t+'" must be of type '+r,De.INVALID_VALUE,n)||this}return r(t,e),t}(Ge),je=function(e){function t(t,r){return e.call(this,'The intl string context variable "'+t+'" was not provided to the string "'+r+'"',De.MISSING_VALUE,r)||this}return r(t,e),t}(Ge);function Ve(e){return"function"==typeof e}function Ke(e,t,r,n,i,o,s){if(1===e.length&&C(e[0]))return[{type:xe.literal,value:e[0].value}];for(var a=[],u=0,c=e;u<c.length;u++){var l=c[u];if(C(l))a.push({type:xe.literal,value:l.value});else if(x(l))"number"==typeof o&&a.push({type:xe.literal,value:r.getNumberFormat(t).format(o)});else{var h=l.value;if(!i||!(h in i))throw new je(h,s);var p=i[h];if(R(l))p&&"string"!=typeof p&&"number"!=typeof p||(p="string"==typeof p||"number"==typeof p?String(p):""),a.push({type:"string"==typeof p?xe.literal:xe.object,value:p});else if(k(l)){var f="string"==typeof l.style?n.date[l.style]:H(l.style)?l.style.parsedOptions:void 0;a.push({type:xe.literal,value:r.getDateTimeFormat(t,f).format(p)})}else if(D(l)){f="string"==typeof l.style?n.time[l.style]:H(l.style)?l.style.parsedOptions:void 0;a.push({type:xe.literal,value:r.getDateTimeFormat(t,f).format(p)})}else if(I(l)){(f="string"==typeof l.style?n.number[l.style]:F(l.style)?l.style.parsedOptions:void 0)&&f.scale&&(p*=f.scale||1),a.push({type:xe.literal,value:r.getNumberFormat(t,f).format(p)})}else{if(G(l)){var d=l.children,g=l.value,v=i[g];if(!Ve(v))throw new He(g,"function",s);var y=v(Ke(d,t,r,n,i,o).map((function(e){return e.value})));Array.isArray(y)||(y=[y]),a.push.apply(a,y.map((function(e){return{type:"string"==typeof e?xe.literal:xe.object,value:e}})))}if(U(l)){if(!(m=l.options[p]||l.options.other))throw new Fe(l.value,p,Object.keys(l.options),s);a.push.apply(a,Ke(m.value,t,r,n,i))}else if(M(l)){var m;if(!(m=l.options["="+p])){if(!Intl.PluralRules)throw new Ge('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n',De.MISSING_INTL_API,s);var E=r.getPluralRules(t,{type:l.pluralType}).select(p-(l.offset||0));m=l.options[E]||l.options.other}if(!m)throw new Fe(l.value,p,Object.keys(l.options),s);a.push.apply(a,Ke(m.value,t,r,n,i,p-(l.offset||0)))}else;}}}return function(e){return e.length<2?e:e.reduce((function(e,t){var r=e[e.length-1];return r&&r.type===xe.literal&&t.type===xe.literal?r.value+=t.value:e.push(t),e}),[])}(a)}function Xe(e,t){return t?Object.keys(e).reduce((function(r,i){var o,s;return r[i]=(o=e[i],(s=t[i])?n(n(n({},o||{}),s||{}),Object.keys(o).reduce((function(e,t){return e[t]=n(n({},o[t]),s[t]||{}),e}),{})):o),r}),n({},e)):e}function Be(e){return{create:function(){return{get:function(t){return e[t]},set:function(t,r){e[t]=r}}}}}!function(e){e[e.literal=0]="literal",e[e.object=1]="object"}(xe||(xe={}));var Ye=function(){function e(t,r,n,i){var o,s=this;if(void 0===r&&(r=e.defaultLocale),this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(e){var t=s.formatToParts(e);if(1===t.length)return t[0].value;var r=t.reduce((function(e,t){return e.length&&t.type===xe.literal&&"string"==typeof e[e.length-1]?e[e.length-1]+=t.value:e.push(t.value),e}),[]);return r.length<=1?r[0]||"":r},this.formatToParts=function(e){return Ke(s.ast,s.locales,s.formatters,s.formats,e,void 0,s.message)},this.resolvedOptions=function(){return{locale:Intl.NumberFormat.supportedLocalesOf(s.locales)[0]}},this.getAst=function(){return s.ast},"string"==typeof t){if(this.message=t,!e.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");this.ast=e.__parse(t,{ignoreTag:null==i?void 0:i.ignoreTag})}else this.ast=t;if(!Array.isArray(this.ast))throw new TypeError("A message must be provided as a String or AST.");this.formats=Xe(e.formats,n),this.locales=r,this.formatters=i&&i.formatters||(void 0===(o=this.formatterCache)&&(o={number:{},dateTime:{},pluralRules:{}}),{getNumberFormat:Pe((function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new((e=Intl.NumberFormat).bind.apply(e,u([void 0],t,!1)))}),{cache:Be(o.number),strategy:Me.variadic}),getDateTimeFormat:Pe((function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new((e=Intl.DateTimeFormat).bind.apply(e,u([void 0],t,!1)))}),{cache:Be(o.dateTime),strategy:Me.variadic}),getPluralRules:Pe((function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new((e=Intl.PluralRules).bind.apply(e,u([void 0],t,!1)))}),{cache:Be(o.pluralRules),strategy:Me.variadic})})}return Object.defineProperty(e,"defaultLocale",{get:function(){return e.memoizedDefaultLocale||(e.memoizedDefaultLocale=(new Intl.NumberFormat).resolvedOptions().locale),e.memoizedDefaultLocale},enumerable:!1,configurable:!0}),e.memoizedDefaultLocale=null,e.__parse=Le,e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}(),ze=function(){function e(e,t){var r=this;this.properties=e,this.translationService=t,this.format=function(e,t){try{return new Ye(e,r.properties.currentLanguage).format(t)}catch(e){console.error(e)}},this.escapeForRegExp=function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},this.escapeParam=function(e){return"string"==typeof e?e.replace(/[,:\\]/gs,"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn(e),console.warn("Unsupported value type of above param. Consider converting to string."),e)}}return Object.defineProperty(e.prototype,"rawUnWrapRegex",{get:function(){return"(\\\\?)("+this.escapeForRegExp(this.properties.config.inputPrefix)+"(.*?)"+this.escapeForRegExp(this.properties.config.inputSuffix)+")"},enumerable:!1,configurable:!0}),e.parseUnwrapped=function(e){var t,r,n=!1,i="",o="",a="KEY",u={key:"",params:{},defaultValue:void 0};try{for(var c=s(e),l=c.next();!l.done;l=c.next()){var h=l.value;"\\"!==h||n?n?(n=!1,i+=h):"KEY"!==a||","!==h?"KEY"!==a||":"!==h?"DEFAULT_VALUE"!==a||":"!==h?"PARAM_NAME"!==a||":"!==h?"PARAM_VALUE"!==a||","!==h?i+=h:(a="PARAM_NAME",u.params[o]=i,i=""):(a="PARAM_VALUE",o=i,i=""):(a="PARAM_NAME",u.defaultValue=i,i=""):(a="PARAM_NAME",u.key=i,i=""):(a="DEFAULT_VALUE",u.key=i,i=""):n=!0}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}return"KEY"===a&&(u.key=i),"DEFAULT_VALUE"===a&&(u.defaultValue=i),"PARAM_VALUE"===a&&(u.params[o]=i),u},e.prototype.translate=function(e,t,r,n,s){return void 0===r&&(r=this.properties.currentLanguage),i(this,void 0,void 0,(function(){var i,a;return o(this,(function(o){switch(o.label){case 0:return a=this.format,[4,this.translationService.getTranslation(e,r,n,s)];case 1:return void 0!==(i=a.apply(this,[o.sent(),t]))?[2,i]:[2,e]}}))}))},e.prototype.instant=function(e,t,r,n,i){void 0===r&&(r=this.properties.currentLanguage);var o=this.format(this.translationService.getFromCacheOrFallback(e,r,n,i),t);return void 0!==o?o:e},e.prototype.replace=function(e){return i(this,void 0,void 0,(function(){var t,r,n,i,s,u,c,l,h,p,f,d,g,v;return o(this,(function(o){switch(o.label){case 0:t=new RegExp(this.rawUnWrapRegex,"gs"),r=[],n=!1,s=0,u="",o.label=1;case 1:if(null===(i=t.exec(e)))return[3,3];if(c=i[1],l=a(i,4),h=l[0],p=l[2],f=l[3],d=i.index,g=i.input,u+=g.substr(s,d-s),s=d+h.length,"\\"===c){if(!N.isCharEscaped(d,e))return u+=p,[3,1];c=""}return[4,this.getTranslatedWithMetadata(f)];case 2:return v=o.sent(),r.push({key:v.key,params:v.params,defaultValue:v.defaultValue}),n=!0,u+=c+v.translated,[3,1];case 3:return u+=e.substring(s),n?[2,{text:u,keys:r}]:[2,void 0]}}))}))},e.prototype.wrap=function(e,t,r){var n=this;void 0===t&&(t={}),void 0===r&&(r=void 0);var i=Object.entries(t).map((function(e){var t=a(e,2),r=t[0],i=t[1];return n.escapeParam(r)+":"+n.escapeParam(i)})).join(",");i=i.length?":"+i:"";var o=void 0!==r?","+this.escapeParam(r):"";return""+this.properties.config.inputPrefix+this.escapeParam(e)+o+i+this.properties.config.inputSuffix},e.prototype.getTranslatedWithMetadata=function(t){return i(this,void 0,void 0,(function(){var r,n,i,s;return o(this,(function(o){switch(o.label){case 0:return r=e.parseUnwrapped(t),n=r.key,i=r.params,s=r.defaultValue,[4,this.translate(n,i,void 0,!1,s)];case 1:return[2,{translated:o.sent(),key:n,params:i,defaultValue:s}]}}))}))},e}(),We=function(){function t(e){this.properties=e,this.keysDown=new Set,this.mouseOn=new Set,this.mouseOnChanged=new w,this.keysChanged=new w,"undefined"==typeof window||this.initKeyListener()}return t.prototype.handle=function(e,t){var r=this;e._tolgee.listeningForHighlighting?console.error("Element is already listening mouse events! This is probably bug in tolgee"):(e._tolgee.listeningForHighlighting=!0,this.initEventListeners(e,t),this.mouseOnChanged.subscribe((function(){r.highlighted!==r.getMouseOn()&&r.onConditionsChanged()})),this.keysChanged.subscribe((function(){r.onConditionsChanged()})))},t.prototype.initEventListeners=function(e,t){var r=this,n=function(){return r.onMouseOver(e)},i=function(){return r.onMouseOut(e)},o=function(e){r.areKeysDown()&&(e.stopPropagation(),e.preventDefault(),t(e))};e.addEventListener("mouseover",n),e.addEventListener("click",o,{capture:!0});var s=function(e){r.areKeysDown()&&(e.stopPropagation(),e.preventDefault())};e.addEventListener("mousedown",s),e.addEventListener("mouseup",s),e.addEventListener("mouseout",i),e._tolgee.removeAllEventListeners=function(){e.removeEventListener("mousedown",s),e.removeEventListener("mouseup",s),e.removeEventListener("mouseover",n),e.removeEventListener("click",o,{capture:!0}),e.removeEventListener("mouseout",i)}},t.prototype.onConditionsChanged=function(){this.unhighlight(),this.areKeysDown()&&this.getMouseOn()&&this.highlight()},t.prototype.highlight=function(){this.getMouseOn()._tolgee.highlight(),this.highlighted=this.getMouseOn()},t.prototype.unhighlight=function(){this.highlighted&&(this.highlighted._tolgee.unhighlight(),this.highlighted=null)},t.prototype.onMouseOut=function(e){this.mouseOn.delete(e),this.mouseOnChanged.emit(this.getMouseOn())},t.prototype.onMouseOver=function(e){this.filterMouseOn(),this.mouseOn.delete(e),this.mouseOn.add(e),this.mouseOnChanged.emit(this.getMouseOn())},t.prototype.getMouseOn=function(){var e=Array.from(this.mouseOn);return e.length?e[0]:void 0},t.prototype.initKeyListener=function(){var t=this;window.addEventListener("blur",(function(){t.keysDown=new Set,t.keysChanged.emit(t.areKeysDown())})),window.addEventListener("keydown",(function(r){var n=e.ModifierKey[r.key];void 0!==n&&(t.keysDown.add(n),t.keysChanged.emit(t.areKeysDown()))})),window.addEventListener("keyup",(function(r){t.keysDown.delete(e.ModifierKey[r.key]),t.keysChanged.emit(t.areKeysDown())}))},t.prototype.filterMouseOn=function(){var e=this;this.mouseOn.forEach((function(t){document.contains(t)||e.mouseOn.delete(t)}))},t.prototype.areKeysDown=function(){var e,t;try{for(var r=s(this.properties.config.highlightKeys),n=r.next();!n.done;n=r.next()){var i=n.value;if(!this.keysDown.has(i))return!1}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return!0},t}(),Je=function(){function e(e){var t=this;this.dependencies=e,this.translationEdit=function(e,r){return i(t,void 0,void 0,(function(){var t,n;return o(this,(function(i){switch(i.label){case 0:return[4,this.getRenderer()];case 1:return"object"!=typeof(t=i.sent())?[3,3]:[4,this.getKeyAndDefault(e,r)];case 2:return(n=i.sent())?(t.renderViewer(n.key,n.defaultValue),[2]):[2];case 3:return[2]}}))}))}}return e.getKeyOptions=function(e){return Array.from(e._tolgee.nodes).reduce((function(e,t){return u(u([],a(e),!1),a(t._tolgee.keys.map((function(e){return{key:e.key,defaultValue:e.defaultValue}}))),!1)}),[])},e.prototype.listen=function(e){var t=this;this.dependencies.highlightFunctionInitializer.initFunctions(e),this.dependencies.mouseEventHandler.handle(e,(function(r){return i(t,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.translationEdit(r,e)];case 1:return[2,t.sent()]}}))}))}))},e.prototype.getRenderer=function(){return i(this,void 0,void 0,(function(){var e,t,r,n,i,a,u,c;return o(this,(function(o){switch(o.label){case 0:if(void 0!==this._renderer)return[3,11];e=[this.dependencies.properties.config.ui,window["@tolgee/ui"]],o.label=1;case 1:o.trys.push([1,8,9,10]),t=s(e),r=t.next(),o.label=2;case 2:if(r.done)return[3,7];if("function"!=typeof(n=r.value))return[3,6];o.label=3;case 3:return o.trys.push([3,5,,6]),[4,n()];case 4:return i=o.sent(),this._renderer=new i(this.dependencies),[3,6];case 5:return o.sent(),i=n,this._renderer=new i(this.dependencies),[3,6];case 6:return r=t.next(),[3,2];case 7:return[3,10];case 8:return a=o.sent(),u={error:a},[3,10];case 9:try{r&&!r.done&&(c=t.return)&&c.call(t)}finally{if(u)throw u.error}return[7];case 10:void 0===this._renderer&&console.warn('Tolgee UI is not provided. To translate interactively provide tolgee ui constructor to "ui" configuration property. To disable highlighting use production mode.'),o.label=11;case 11:return[2,this._renderer]}}))}))},e.prototype.getKeyAndDefault=function(t,r){return i(this,void 0,void 0,(function(){var n,i,s,a;return o(this,(function(o){switch(o.label){case 0:return r._tolgee.wrappedWithElementOnlyKey?[2,{key:r._tolgee.wrappedWithElementOnlyKey,defaultValue:r._tolgee.wrappedWithElementOnlyDefaultHtml}]:(n=e.getKeyOptions(r),(i=new Set(n.map((function(e){return e.key})))).size>1?[4,this.getRenderer()]:[3,3]);case 1:return[4,o.sent().getKey({keys:i,openEvent:t})];case 2:if(s=o.sent(),a=n.find((function(e){return e.key===s})))return[2,a];o.label=3;case 3:return 1===i.size?[2,n[0]]:(console.error("No key to translate. This seems like a bug in tolgee."),[2])}}))}))},e}(),qe=function(){function e(e,t,r){this.properties=e,this.translationHighlighter=t,this.eventService=r,this.registeredElements=new Set}return e.prototype.register=function(e){(void 0!==this.getActiveNodes(e).next().value||e._tolgee.wrappedWithElementOnlyKey)&&("development"!==this.properties.config.mode||this.registeredElements.has(e)||this.translationHighlighter.listen(e),this.registeredElements.add(e),this.eventService.ELEMENT_REGISTERED.emit(e))},e.prototype.refreshAll=function(){var e,t;try{for(var r=s(this.registeredElements),n=r.next();!n.done;n=r.next()){var i=n.value;this.cleanElementInactiveNodes(i),0!==i._tolgee.nodes.size||i._tolgee.wrappedWithElementOnlyKey||this.cleanElement(i)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},e.prototype.cleanAll=function(){var e,t;try{for(var r=s(this.registeredElements),n=r.next();!n.done;n=r.next()){var i=n.value;this.cleanElement(i)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},e.prototype.findAllByKey=function(e){var t,r,n,i,o=[];try{for(var a=s(this.registeredElements),u=a.next();!u.done;u=a.next()){var c=u.value;if(c._tolgee.wrappedWithElementOnlyKey!==e)try{for(var l=(n=void 0,s(c._tolgee.nodes)),h=l.next();!h.done;h=l.next()){if(h.value._tolgee.keys.findIndex((function(t){return t.key===e}))>-1){o.push(c);break}}}catch(e){n={error:e}}finally{try{h&&!h.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}else o.push(c)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return o},e.prototype.cleanElementInactiveNodes=function(e){this.isElementActive(e)&&(e._tolgee.nodes=new Set(this.getActiveNodes(e)))},e.prototype.cleanElement=function(e){"function"==typeof e._tolgee.removeAllEventListeners&&e._tolgee.removeAllEventListeners(),e.removeAttribute(l),delete e._tolgee,this.registeredElements.delete(e)},e.prototype.getActiveNodes=function(e){var t,r,n,i,a,u;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,5,6,7]),t=s(e._tolgee.nodes),r=t.next(),o.label=1;case 1:return r.done?[3,4]:(n=r.value,f.nodeContains(this.properties.config.targetElement,n)?[4,n]:[3,3]);case 2:o.sent(),o.label=3;case 3:return r=t.next(),[3,1];case 4:return[3,7];case 5:return i=o.sent(),a={error:i},[3,7];case 6:try{r&&!r.done&&(u=t.return)&&u.call(t)}finally{if(a)throw a.error}return[7];case 7:return[2]}}))},e.prototype.isElementActive=function(e){return this.properties.config.targetElement.contains(e)},e}(),Ze=function(){function e(e,t,r,n){this.properties=e,this.textService=t,this.elementRegistrar=r,this.translationHighlighter=n}return e.initParentElement=function(e){return void 0===e._tolgee&&(e._tolgee={nodes:new Set},e.setAttribute(l,"")),e},e.prototype.filterRestricted=function(e){var t=this.properties.config.restrictedElements;return e.filter((function(e){var r=f.closestElement(e);return-1===t.indexOf(r.tagName.toLowerCase())&&null===r.closest('[data-tolgee-restricted="true"]')}))},e.prototype.handleNodes=function(e){return i(this,void 0,void 0,(function(){var t,r,n,i,a,u,c,l,h,p,f,d;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,5,6,7]),t=s(e),r=t.next(),o.label=1;case 1:return r.done?[3,4]:(void 0===(n=r.value)._tolgee&&(n._tolgee={}),!0===(null==(i=n._tolgee)?void 0:i.locked)?[3,3]:(this.lockNode(n),[4,this.textService.replace(n.textContent)]));case 2:(a=o.sent())&&(u=a.text,c=a.keys,l=this.translateChildNode(n,u,c),(h=this.getParentElement(l))._tolgee.nodes.add(l),this.elementRegistrar.register(h)),this.unlockNode(n),o.label=3;case 3:return r=t.next(),[3,1];case 4:return[3,7];case 5:return p=o.sent(),f={error:p},[3,7];case 6:try{r&&!r.done&&(d=t.return)&&d.call(t)}finally{if(f)throw f.error}return[7];case 7:return[2]}}))}))},e.prototype.translateChildNode=function(e,t,r){return e._tolgee={oldTextContent:e.textContent,keys:r},e.textContent=t,e},e.prototype.lockNode=function(e){void 0===e._tolgee&&(e._tolgee={});var t=e._tolgee;return!0!==(null==t?void 0:t.locked)&&(t.locked=!0),e},e.prototype.unlockNode=function(e){e._tolgee&&(e._tolgee.locked=!1)},e.prototype.getParentElement=function(t){var r=this.getSuitableParent(t);return e.initParentElement(r)},e.prototype.getSuitableParent=function(e){var t=f.getParentElement(e);if(void 0===t)throw console.error(e),new Error("No suitable parent found for node above.");if(!this.properties.config.passToParent)return t;if(Array.isArray(this.properties.config.passToParent)){if(-1===this.properties.config.passToParent.findIndex((function(e){return t.tagName.toLowerCase()===e.toLowerCase()})))return t}return"function"!=typeof this.properties.config.passToParent||this.properties.config.passToParent(t)?this.getSuitableParent(t):t},e}(),$e=function(e){function t(t,r,n,i){var o=e.call(this,t,n,i,r)||this;return o.properties=t,o.translationHighlighter=r,o.textService=n,o.nodeRegistrar=i,o}return r(t,e),t.prototype.handle=function(e){return i(this,void 0,void 0,(function(){var t,r,n,i,s;return o(this,(function(o){switch(o.label){case 0:return t=this.properties.config.inputPrefix,r=this.properties.config.inputSuffix,n="./descendant-or-self::text()[contains(., '"+t+"') and contains(., '"+r+"')]",i=f.evaluate(n,e),s=this.filterRestricted(i),[4,this.handleNodes(s)];case 1:return o.sent(),[2]}}))}))},t}(Ze),Qe=function(e){function t(t,r,n,i){var o=e.call(this,t,r,n,i)||this;return o.properties=t,o.textService=r,o.elementRegistrar=n,o.translationHighlighter=i,o}return r(t,e),t.prototype.handle=function(e){return i(this,void 0,void 0,(function(){var t,r,n,i,u,c,l,h,p,d,g,v,y,m,E,b,_,T;return o(this,(function(o){switch(o.label){case 0:t=this.properties.config.inputPrefix,r=this.properties.config.inputSuffix,o.label=1;case 1:o.trys.push([1,12,13,14]),n=s(Object.entries(this.properties.config.tagAttributes)),i=n.next(),o.label=2;case 2:if(i.done)return[3,11];u=a(i.value,2),c=u[0],l=u[1],o.label=3;case 3:o.trys.push([3,8,9,10]),_=void 0,h=s(l),p=h.next(),o.label=4;case 4:return p.done?[3,7]:(d=p.value,g="descendant-or-self::"+c+"/@"+d+"[contains(., '"+t+"') and contains(., '"+r+"')]",v=f.evaluate(g,e),[4,this.handleNodes(v)]);case 5:o.sent(),o.label=6;case 6:return p=h.next(),[3,4];case 7:return[3,10];case 8:return y=o.sent(),_={error:y},[3,10];case 9:try{p&&!p.done&&(T=h.return)&&T.call(h)}finally{if(_)throw _.error}return[7];case 10:return i=n.next(),[3,2];case 11:return[3,14];case 12:return m=o.sent(),E={error:m},[3,14];case 13:try{i&&!i.done&&(b=n.return)&&b.call(n)}finally{if(E)throw E.error}return[7];case 14:return[2]}}))}))},t}(Ze),et=function(){function e(e,t,r,n,i,o,s){this.service=e,this.textHandler=t,this.eventService=r,this.properties=n,this.attributeHandler=i,this.textService=o,this.wrappedHandler=s,"undefined"!=typeof window&&(r.LANGUAGE_CHANGED.subscribe(this.refresh.bind(this)),r.TRANSLATION_CHANGED.subscribe(this.refresh.bind(this)))}return e.prototype.handleSubtree=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.attributeHandler.handle(e)];case 1:return t.sent(),[4,this.textHandler.handle(e)];case 2:return t.sent(),[4,this.wrappedHandler.handle(e)];case 3:return t.sent(),[2]}}))}))},e.prototype.refresh=function(){return i(this,void 0,void 0,(function(){var e,t,r,n,i,a,u,c,l,h,p,d,g,v;return o(this,(function(o){switch(o.label){case 0:e=f.evaluate("//*[@_tolgee]",this.properties.config.targetElement),o.label=1;case 1:o.trys.push([1,12,13,14]),t=s(e),r=t.next(),o.label=2;case 2:if(r.done)return[3,11];n=r.value,o.label=3;case 3:o.trys.push([3,8,9,10]),g=void 0,i=s(n._tolgee.nodes),a=i.next(),o.label=4;case 4:return a.done?[3,7]:(u=a.value,[4,this.textService.replace(u._tolgee.oldTextContent)]);case 5:(c=o.sent())&&(u.textContent=c.text),o.label=6;case 6:return a=i.next(),[3,4];case 7:return[3,10];case 8:return l=o.sent(),g={error:l},[3,10];case 9:try{a&&!a.done&&(v=i.return)&&v.call(i)}finally{if(g)throw g.error}return[7];case 10:return r=t.next(),[3,2];case 11:return[3,14];case 12:return h=o.sent(),p={error:h},[3,14];case 13:try{r&&!r.done&&(d=t.return)&&d.call(t)}finally{if(p)throw p.error}return[7];case 14:return[2]}}))}))},e}(),tt=function(){function e(e,t,r,n,i){this.properties=e,this.coreHandler=t,this.basicTextHandler=r,this.attributeHandler=n,this.nodeRegistrar=i,this._observer=void 0}return Object.defineProperty(e.prototype,"observer",{get:function(){var e=this;return this._observer||"undefined"==typeof window||(this._observer=new MutationObserver((function(t){return i(e,void 0,void 0,(function(){var e,r,n,i,a,u;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,9,10,11]),e=s(t),r=e.next(),o.label=1;case 1:return r.done?[3,8]:"characterData"!==(n=r.value).type?[3,3]:[4,this.basicTextHandler.handle(n.target)];case 2:return o.sent(),[3,7];case 3:return"childList"!==n.type?[3,5]:[4,this.coreHandler.handleSubtree(n.target)];case 4:return o.sent(),[3,7];case 5:return"attributes"!==n.type?[3,7]:[4,this.attributeHandler.handle(n.target)];case 6:o.sent(),o.label=7;case 7:return r=e.next(),[3,1];case 8:return[3,11];case 9:return i=o.sent(),a={error:i},[3,11];case 10:try{r&&!r.done&&(u=e.return)&&u.call(e)}finally{if(a)throw a.error}return[7];case 11:return this.nodeRegistrar.refreshAll(),[2]}}))}))}))),this._observer},enumerable:!1,configurable:!0}),e.prototype.observe=function(){this.observer&&this.observer.observe(this.properties.config.targetElement,{attributes:!0,childList:!0,subtree:!0,characterData:!0})},e.prototype.stopObserving=function(){this.observer&&this.observer.disconnect()},e}(),rt=function(){function e(e,t){this.properties=e,this.apiHttpService=t}return e.prototype.getLanguages=function(){return i(this,void 0,void 0,(function(){var e,t;return o(this,(function(r){switch(r.label){case 0:return this.languagePromise instanceof Promise||(this.languagePromise=this.apiHttpService.fetchJson("v2/projects/languages?size=1000")),t=Set.bind,[4,this.languagePromise];case 1:return e=new(t.apply(Set,[void 0,r.sent()._embedded.languages.map((function(e){return e.tag}))])),this.properties.preferredLanguages=new Set(Array.from(this.properties.preferredLanguages).filter((function(t){return e.has(t)}))),[2,e]}}))}))},e.prototype.getLanguagesFull=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.getLanguages(),[4,this.languagePromise];case 1:return[2,e.sent()._embedded.languages]}}))}))},e.prototype.getScopes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.apiHttpService.fetchJson("v2/api-keys/current")];case 1:return[2,t.sent().scopes];case 2:return e=t.sent(),console.error(e),console.error("Error getting scopes. Trying to switch to production mode!"),this.properties.config.mode="production",[3,3];case 3:return[2]}}))}))},e.prototype.isAuthorizedTo=function(e){return this.properties.scopes.indexOf(e)>-1},e.prototype.checkScope=function(e){if(!this.isAuthorizedTo(e))throw new Error("Api key not permitted to do this, please add 'translations.view' scope.")},e}(),nt=function(e){function t(t,r,n,i){var o=e.call(this,t,n,i,r)||this;return o.properties=t,o.translationHighlighter=r,o.textService=n,o.elementRegistrar=i,o}return r(t,e),t.prototype.handle=function(e){return i(this,void 0,void 0,(function(){var t,r=this;return o(this,(function(n){return"./descendant-or-self::*[@data-tolgee-key-only]",t=f.evaluate("./descendant-or-self::*[@data-tolgee-key-only]",e),this.filterRestricted(t).forEach((function(e){var t=Ze.initParentElement(e);t._tolgee.wrappedWithElementOnlyKey=e.getAttribute(p),t._tolgee.wrappedWithElementOnlyDefaultHtml=e.innerHTML,r.elementRegistrar.register(t)})),[2]}))}))},t}(Ze),it=function(){function e(e,t,r,s,a){var u=this;this.messages=e,this.properties=t,this.eventService=r,this.elementRegistrar=s,this.translationService=a,this.handshakeSucceed=!1,this.takeScreenshot=function(e){return new Promise((function(t,r){u.translationService.changeTranslations(e).then((function(n){return i(u,void 0,void 0,(function(){var i,s,a=this;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),this.highlightAllByKey(e.key),[4,(u=100,new Promise((function(e){return setTimeout(e,u)})))];case 1:return o.sent(),this.messages.send("TOLGEE_TAKE_SCREENSHOT"),i=this.messages.listen("TOLGEE_SCREENSHOT_TAKEN",(function(r){a.unhighlightAllByKey(e.key),t(r),n(),i()})),[3,3];case 2:return s=o.sent(),n(),r(s),[3,3];case 3:return[2]}var u}))}))})).catch((function(e){r(e)}))}))},this.handshake=function(){var e=n(n({},u.properties),{config:n(n({},u.properties.config),{staticData:void 0,targetElement:void 0,_targetElement:void 0,ui:void 0})}),t=null,r=function(){u.messages.send("TOLGEE_READY",e)},i=function(){clearInterval(t)};u.messages.listen("TOLGEE_PLUGIN_READY",(function(){u.handshakeSucceed=!0,u.messages.send("TOLGEE_READY",e),i()})),r();var o=0;t=setInterval((function(){!u.handshakeSucceed&&o<5?(r(),o+=1):i()}),200)}}return e.prototype.run=function(){try{this.messages.startListening(),this.handshake()}catch(e){console.warn(e),console.warn("Can not start communication with browser plugin. Check waning above.")}},e.prototype.stop=function(){this.messages.stopListening()},e.prototype.highlightAllByKey=function(e){this.elementRegistrar.findAllByKey(e).forEach((function(e){return e._tolgee.highlight()}))},e.prototype.unhighlightAllByKey=function(e){this.elementRegistrar.findAllByKey(e).forEach((function(e){return e._tolgee.unhighlight()}))},e}(),ot=function(){function e(){var e=this;this.listeners=[],this.startListening=function(){var t=function(t){t.source==window&&e.listeners.forEach((function(e){e.type==t.data.type&&e.callback(t.data.data)}))};window.addEventListener("message",t,!1),"function"==typeof e._stopListening&&e._stopListening(),e._stopListening=function(){window.removeEventListener("message",t,!1)}},this.listen=function(t,r){var n={type:t,callback:r};return e.listeners.push(n),function(){e.listeners.splice(e.listeners.indexOf(n),1)}},this.send=function(e,t){try{window.postMessage({type:e,data:t},window.origin)}catch(e){console.warn("Cannot send message.",e)}}}return e.prototype.stopListening=function(){this._stopListening()},e}(),st=function(){function e(e){this.properties=e}return e.prototype.initFunctions=function(e){this.initHighlightFunction(e),this.initUnhighlightFunction(e)},e.prototype.initHighlightFunction=function(e){var t=this;e._tolgee.highlight=function(){e._tolgee.initialBackgroundColor=e.style.backgroundColor,e.style.backgroundColor=t.properties.config.highlightColor}},e.prototype.initUnhighlightFunction=function(e){e._tolgee.unhighlight=function(){e.style.backgroundColor=e._tolgee.initialBackgroundColor}},e}(),at=function(){function e(e,t){this.coreService=e,this.apiHttpService=t}return e.prototype.uploadImage=function(e){return i(this,void 0,void 0,(function(){var t;return o(this,(function(r){return(t=new FormData).append("image",e),[2,this.apiHttpService.postJson("v2/image-upload",void 0,{headers:{},body:t})]}))}))},e.prototype.deleteImages=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.apiHttpService.post("v2/image-upload/"+e.join(","),void 0,{method:"delete"})]}))}))},e}(),ut=function(e){void 0===e&&(e=new m),this.properties=new _,this.eventService=new S,this.apiHttpService=new L(this.properties),this.mouseEventHandler=new We(this.properties),this.coreService=new rt(this.properties,this.apiHttpService),this.screenshotService=new at(this.coreService,this.apiHttpService),this.translationService=new O(this.properties,this.coreService,this.apiHttpService,this.eventService),this.textService=new ze(this.properties,this.translationService),this.highlightFunctionInitializer=new st(this.properties),this.translationHighlighter=new Je(this),this.elementRegistrar=new qe(this.properties,this.translationHighlighter,this.eventService),this.textHandler=new $e(this.properties,this.translationHighlighter,this.textService,this.elementRegistrar),this.attributeHandler=new Qe(this.properties,this.textService,this.elementRegistrar,this.translationHighlighter),this.wrappedHandler=new nt(this.properties,this.translationHighlighter,this.textService,this.elementRegistrar),this.coreHandler=new et(this.coreService,this.textHandler,this.eventService,this.properties,this.attributeHandler,this.textService,this.wrappedHandler),this.observer=new tt(this.properties,this.coreHandler,this.textHandler,this.attributeHandler,this.elementRegistrar),this.messages=new ot,this.pluginManager=new it(this.messages,this.properties,this.eventService,this.elementRegistrar,this.translationService),this.properties.config=e,this.translationService.initStatic(),this.translationHighlighter.pluginManager=this.pluginManager},ct=function(){function e(e){var t=this;this.stop=function(){t.dependencyStore.observer.stopObserving(),t.dependencyStore.elementRegistrar.cleanAll(),f.unmarkElementAsTargetElement(t.properties.config.targetElement)},this.dependencyStore=new ut(new m(e))}return Object.defineProperty(e.prototype,"properties",{get:function(){return this.dependencyStore.properties},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"translationService",{get:function(){return this.dependencyStore.translationService},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coreService",{get:function(){return this.dependencyStore.coreService},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lang",{get:function(){return this.properties.currentLanguage},set:function(e){this.properties.currentLanguage=e,this.dependencyStore.eventService.LANGUAGE_CHANGED.emit(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultLanguage",{get:function(){return this.properties.config.defaultLanguage},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLangChange",{get:function(){return this.dependencyStore.eventService.LANGUAGE_CHANGED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onTranslationChange",{get:function(){return this.dependencyStore.eventService.TRANSLATION_CHANGED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLangLoaded",{get:function(){return this.dependencyStore.eventService.LANGUAGE_LOADED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initialLoading",{get:function(){var e,t,r,n;if("production"!==(null===(t=null===(e=this.properties)||void 0===e?void 0:e.config)||void 0===t?void 0:t.mode))return!0;var i=this.properties.currentLanguage,o=this.properties.config.fallbackLanguage,s=this.properties.config.preloadFallback,a=function(e){return void 0!==e&&"function"!=typeof e};return!a(null===(r=this.properties.config.staticData)||void 0===r?void 0:r[i])||!!s&&!a(null===(n=this.properties.config.staticData)||void 0===n?void 0:n[o])},enumerable:!1,configurable:!0}),e.prototype.run=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return"development"!==this.properties.config.mode?[3,2]:[4,this.loadScopes()];case 1:e.sent(),e.label=2;case 2:return[4,this.translationService.loadTranslations()];case 3:return e.sent(),[4,this.dependencyStore.pluginManager.run()];case 4:return e.sent(),this.properties.config.preloadFallback?[4,this.translationService.loadTranslations(this.properties.config.fallbackLanguage)]:[3,6];case 5:e.sent(),e.label=6;case 6:return[4,this.refresh()];case 7:return e.sent(),this.properties.config.watch&&this.dependencyStore.observer.observe(),[2]}}))}))},e.prototype.refresh=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){return[2,this.dependencyStore.coreHandler.handleSubtree(this.properties.config.targetElement)]}))}))},e.prototype.translate=function(e,t,r,n){return void 0===t&&(t={}),void 0===r&&(r=!1),void 0===n&&(n=void 0),i(this,void 0,void 0,(function(){var i,s,a;return o(this,(function(o){switch(o.label){case 0:return i="string"==typeof e?e:e.key,s=void 0,"object"==typeof e&&(t=void 0!==(a=e).params?a.params:t,r=void 0!==a.noWrap?a.noWrap:r,n=void 0!==a.defaultValue?a.defaultValue:n,s=a.orEmpty),"development"!==this.properties.config.mode||r?[3,3]:[4,this.loadScopes()];case 1:return o.sent(),[4,this.translationService.loadTranslations()];case 2:return o.sent(),[2,this.dependencyStore.textService.wrap(i,t,n)];case 3:return[2,this.dependencyStore.textService.translate(i,t,void 0,s,n)]}}))}))},e.prototype.instant=function(e,t,r,n,i){void 0===t&&(t={}),void 0===r&&(r=!1);var o="string"==typeof e?e:e.key;if("object"==typeof e){var s=e;t=void 0!==s.params?s.params:t,r=void 0!==s.noWrap?s.noWrap:r,i=void 0!==s.defaultValue?s.defaultValue:i,n=void 0!==s.orEmpty?s.orEmpty:n}return"development"!==this.properties.config.mode||r?this.dependencyStore.textService.instant(o,t,void 0,n,i):this.dependencyStore.textService.wrap(o,t,i)},e.prototype.loadScopes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return void 0!==this.properties.scopes?[3,2]:(e=this.properties,[4,this.dependencyStore.coreService.getScopes()]);case 1:e.scopes=t.sent(),t.label=2;case 2:return[2]}}))}))},e}();e.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=p,e.Tolgee=ct,e.TolgeeConfig=m,e.TranslationData=P,Object.defineProperty(e,"__esModule",{value:!0})}));
15
+ ***************************************************************************** */var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,r)};function r(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n=function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function i(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))}function o(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function s(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function u(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}var c,l="_tolgee",h="_tolgee-target",p="data-tolgee-key-only",f=function(){function e(){}return e.evaluate=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Array.from(this.evaluateGenerator.apply(this,u([],a(e),!1)))},e.evaluateToSingle=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.evaluate.apply(this,u([],a(e),!1));if(1===r.length)return r[0];if(r.length<1)throw new Error("No element found");throw new Error("Multiple elements found")},e.closestElement=function(e){return e instanceof Text?e.parentElement:e},e.getParentElement=function(e){return e.parentElement?e.parentElement:e.ownerElement?e.ownerElement:void 0},e.isElementTargetElement=function(e){return e.hasAttribute(h)},e.markElementAsTargetElement=function(e){e.setAttribute(h,"")},e.unmarkElementAsTargetElement=function(e){e.removeAttribute(h)},e.nodeContains=function(e,t){if(e.contains(t))return!0;if(t instanceof Attr){var r=t.ownerElement&&Object.values(t.ownerElement.attributes).indexOf(t)>-1;if(e.contains(t.ownerElement)&&r)return!0}return!1},e.evaluateGenerator=function(e,t){var r,n;return o(this,(function(i){switch(i.label){case 0:n=document.evaluate(e,t,void 0,XPathResult.ANY_TYPE),i.label=1;case 1:return null===(r=n.iterateNext())?[3,3]:[4,r];case 2:return i.sent(),[3,1];case 3:return[2]}}))},e}();e.ModifierKey=void 0,(c=e.ModifierKey||(e.ModifierKey={}))[c.Alt=0]="Alt",c[c.Control=1]="Control",c[c.Shift=2]="Shift",c[c.Meta=3]="Meta";var d,g,v,y=function(){if("undefined"!=typeof document)return document.body},m=function(t){this.apiUrl="https://app.tolgee.io",this.inputPrefix="%-%tolgee:",this.inputSuffix="%-%",this.defaultLanguage="en",this.filesUrlPrefix="i18n/",this.tagAttributes={textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},this.highlightKeys=[e.ModifierKey.Alt],this.passToParent=["option","optgroup"],this.restrictedElements=["script","style"],this.highlightColor="rgb(224 240 255)",this.preloadFallback=!1,Object.defineProperty(this,"targetElement",{set:function(e){if(void 0!==this.targetElement)throw new Error("Target element is already defined!");if(void 0===e&&(this._targetElement=y()),f.isElementTargetElement(e))throw console.error("Target element: ",this._targetElement),new Error("An tolgee instance is inited with provided target element");this._targetElement=e,f.markElementAsTargetElement(this._targetElement)},get:function(){return this._targetElement}}),Object.assign(this,t||{}),void 0===this._targetElement&&(this._targetElement=y()),this.mode=this.mode||(this.apiKey?"development":"production"),this.fallbackLanguage=this.fallbackLanguage||this.defaultLanguage,void 0===this.watch&&(this.watch="development"===this.mode)},E="__tolgee_preferredLanguages",b="__tolgee_currentLanguage",_=function(){function e(){}return Object.defineProperty(e.prototype,"currentLanguage",{get:function(){var e;if(this.config.forceLanguage)return this.config.forceLanguage;"undefined"!=typeof localStorage?(e=localStorage.getItem(b),this.config.availableLanguages&&(this.config.availableLanguages.indexOf(e)>-1||(e=void 0))):e=this._currentLanguage;return e||(e=this.getLanguageByNavigator(),this.currentLanguage=e),e},set:function(e){"undefined"!=typeof localStorage?localStorage.setItem(b,e):this._currentLanguage=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"preferredLanguages",{get:function(){return new Set(JSON.parse(localStorage.getItem(E)))},set:function(e){localStorage.setItem(E,JSON.stringify(Array.from(e)))},enumerable:!1,configurable:!0}),e.prototype.getLanguageByNavigator=function(){if("undefined"!=typeof window&&this.config.availableLanguages){var e=window.navigator.language,t=this.config.availableLanguages.find((function(t){return t===e}));if(t)return t;var r=function(e){return e.replace(/^(.+?)(-.*)?$/,"$1")},n=r(window.navigator.language),i=this.config.availableLanguages.find((function(e){return r(e)===n}));if(i)return i}return this.config.defaultLanguage},e}(),T=function(){function e(e){this.onUnsubscribe=e}return e.prototype.unsubscribe=function(){this.onUnsubscribe()},e}(),w=function(){function e(){this.idCounter=0,this._subscriptions=new Map}return Object.defineProperty(e.prototype,"subscriptions",{get:function(){return this._subscriptions},enumerable:!1,configurable:!0}),e.prototype.emit=function(e){var t,r,n=[];try{for(var i=s(this.subscriptions.values()),o=i.next();!o.done;o=i.next()){var a=(0,o.value)(e);"function"==typeof(null==a?void 0:a.then)&&n.push(a)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}if(0!==n.length)return new Promise((function(e){return Promise.all(n).then((function(){return e()}))}))},e.prototype.subscribe=function(e){var t=this,r=this.idCounter++,n=new T((function(){return t.unsubscribe(r)}));return this.subscriptions.set(r,e),n},e.prototype.unsubscribe=function(e){this._subscriptions.delete(e)||console.warn("Event to unsubscribe was not found")},e}(),S=function(){this.TRANSLATION_CHANGED=new w,this.LANGUAGE_CHANGED=new w,this.LANGUAGE_LOADED=new w,this.ELEMENT_REGISTERED=new w},A=function(e){function t(r,n){var i=e.call(this,"Api http error")||this;return i.response=r,i.code=n,Object.setPrototypeOf(i,t.prototype),i}return r(t,e),t}(Error),L=function(){function e(e){this.properties=e}return e.handleErrors=function(e){return i(this,void 0,void 0,(function(){var t,r;return o(this,(function(n){switch(n.label){case 0:if(!(e.status>=400))return[3,5];t=new A(e),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,e.json()];case 2:return r=n.sent(),t.code=r.code,[3,4];case 3:return n.sent(),console.warn("Tolgee server responded with invalid status code."),[3,4];case 4:throw t;case 5:return[2,e]}}))}))},e.prototype.fetch=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return i(this,void 0,void 0,(function(){var r,i,s;return o(this,(function(o){return"object"==typeof t[0]?[2,fetch(n(n({},t[0]),{url:this.getUrl(t[0].url)})).then((function(t){return e.handleErrors(t)}))]:(r=a(t),i=r[0],s=r.slice(1),[2,fetch.apply(void 0,u([this.getUrl(i)],a(s),!1)).then((function(t){return e.handleErrors(t)}))])}))}))},e.prototype.fetchJson=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.fetch.apply(this,u([],a(e),!1)).then((function(e){return e.json()}))]}))}))},e.prototype.post=function(e,t,r){void 0===r&&(r={});for(var s=[],c=3;c<arguments.length;c++)s[c-3]=arguments[c];return i(this,void 0,void 0,(function(){return o(this,(function(i){return[2,this.fetch.apply(this,u([e,n({body:JSON.stringify(t),method:"POST",headers:{"Content-Type":"application/json"}},r)],a(s),!1))]}))}))},e.prototype.postJson=function(e,t,r){void 0===r&&(r={});for(var n=[],s=3;s<arguments.length;s++)n[s-3]=arguments[s];return i(this,void 0,void 0,(function(){return o(this,(function(i){return[2,this.post.apply(this,u([e,t,r],a(n),!1)).then((function(e){return e.json()}))]}))}))},e.prototype.getUrl=function(e){var t=e.indexOf("?")<0?"?":"&";return this.properties.config.apiUrl+"/"+e+t+"ak="+this.properties.config.apiKey},e}(),P=function(e,t,r){this.key=e,this.translations=t,this.id=r},O=function(){function e(e,t,r,s){var c=this;this.properties=e,this.coreService=t,this.apiHttpService=r,this.eventService=s,this.translationsCache=new Map,this.fetchPromises={},this.updateTranslationInCache=function(e){return i(c,void 0,void 0,(function(){var t,r=this;return o(this,(function(n){switch(n.label){case 0:return t={},Object.entries(e.translations).forEach((function(n){var i=a(n,2),o=i[0],s=i[1],u=r.translationsCache.get(o);u&&(u[e.name]=s.text),t[o]=s.text})),[4,this.eventService.TRANSLATION_CHANGED.emit(new P(e.name,t,e.id))];case 1:return n.sent(),[2]}}))}))},this.getTranslationsOfKey=function(e,t){return void 0===t&&(t=new Set([c.properties.currentLanguage])),i(c,void 0,void 0,(function(){var r,i,s,c,l,h,p,f,d,g,v;return o(this,(function(o){switch(o.label){case 0:this.coreService.checkScope("translations.view"),o.label=1;case 1:return o.trys.push([1,3,,7]),r=u([],a(t),!1),i=r.map((function(e){return"languages="+e})).join("&"),[4,this.apiHttpService.fetchJson("v2/projects/translations?"+i+"&filterKeyName="+encodeURIComponent(e))];case 2:return s=o.sent(),c=r.reduce((function(e,t){var r;return n(n({},e),((r={})[t]="",r))}),{}),(null==(l=null===(g=null===(d=s._embedded)||void 0===d?void 0:d.keys)||void 0===g?void 0:g[0])?void 0:l.translations)&&Object.entries(l.translations).forEach((function(e){var t=a(e,2),r=t[0],n=t[1];return c[r]=n.text})),h=null===(v=s.selectedLanguages)||void 0===v?void 0:v.map((function(e){return e.tag})),[2,[l,h]];case 3:return(p=o.sent())instanceof A&&404===p.response.status&&"language_not_found"===p.code?(f=this.properties,[4,this.coreService.getLanguages()]):[3,5];case 4:return f.preferredLanguages=o.sent(),console.error("Requested language not found, refreshing the page!"),location.reload(),[3,6];case 5:throw p;case 6:return[3,7];case 7:return[2]}}))}))}}return e.translationByValue=function(e,t,r,n){return e||(n||(r?"":t))},e.prototype.initStatic=function(){var e,t=this;"production"===this.properties.config.mode&&"object"==typeof(null===(e=this.properties.config)||void 0===e?void 0:e.staticData)&&Object.entries(this.properties.config.staticData).forEach((function(e){var r=a(e,2),n=r[0],i=r[1];"function"!=typeof i&&t.setLanguageData(n,i)}))},e.prototype.loadTranslations=function(e){return void 0===e&&(e=this.properties.currentLanguage),i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return null!=this.translationsCache.get(e)?[3,2]:(this.fetchPromises[e]instanceof Promise||(this.fetchPromises[e]=this.fetchTranslations(e)),[4,this.fetchPromises[e]]);case 1:t.sent(),this.eventService.LANGUAGE_LOADED.emit(e),t.label=2;case 2:return this.fetchPromises[e]=void 0,[2]}}))}))},e.prototype.getTranslation=function(t,r,n,s){return void 0===r&&(r=this.properties.currentLanguage),void 0===n&&(n=!1),i(this,void 0,void 0,(function(){var i;return o(this,(function(o){switch(o.label){case 0:return(i=this.getFromCache(t,r))?[3,3]:[4,this.loadTranslations(r)];case 1:return o.sent(),(i=this.getFromCache(t,r))?[3,3]:(i=this.getFromCache(t,this.properties.config.fallbackLanguage))?[3,3]:[4,this.loadTranslations(this.properties.config.fallbackLanguage)];case 2:o.sent(),i=this.getFromCache(t,this.properties.config.fallbackLanguage),o.label=3;case 3:return[2,e.translationByValue(i,t,n,s)]}}))}))},e.prototype.updateKeyComplex=function(e,t){var r,s;return i(this,void 0,void 0,(function(){var i;return o(this,(function(o){switch(o.label){case 0:return this.coreService.checkScope("translations.edit"),[4,this.apiHttpService.postJson("v2/projects/keys/"+e+"/complex-update",n(n({},t),{screenshotUploadedImageIds:(null===(r=t.screenshotUploadedImageIds)||void 0===r?void 0:r.length)?t.screenshotUploadedImageIds:void 0,screenshotIdsToDelete:(null===(s=t.screenshotIdsToDelete)||void 0===s?void 0:s.length)?t.screenshotIdsToDelete:void 0}),{method:"put"})];case 1:return i=o.sent(),[4,this.updateTranslationInCache(i)];case 2:return o.sent(),[2,i]}}))}))},e.prototype.createKey=function(e){var t;return i(this,void 0,void 0,(function(){var r;return o(this,(function(i){switch(i.label){case 0:return this.coreService.checkScope("keys.edit"),[4,this.apiHttpService.postJson("v2/projects/keys/create",n(n({},e),{screenshotUploadedImageIds:(null===(t=e.screenshotUploadedImageIds)||void 0===t?void 0:t.length)?e.screenshotUploadedImageIds:void 0}))];case 1:return r=i.sent(),[4,this.updateTranslationInCache(r)];case 2:return i.sent(),[2,r]}}))}))},e.prototype.setTranslations=function(e){return i(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return this.coreService.checkScope("translations.edit"),[4,this.apiHttpService.postJson("v2/projects/translations",e)];case 1:return t=r.sent(),[4,this.updateTranslationInCache({id:t.keyId,name:t.keyName,translations:t.translations})];case 2:return r.sent(),[2,t]}}))}))},e.prototype.changeTranslations=function(e){var t=e.key,r=e.translations;return i(this,void 0,void 0,(function(){var e,n=this;return o(this,(function(s){switch(s.label){case 0:return e={},Object.entries(r).forEach((function(r){var i=a(r,2),o=i[0],s=i[1],u=n.translationsCache.get(o);u&&(e[o]=u[t],u[t]=s)})),[4,this.eventService.TRANSLATION_CHANGED.emit({key:t,translations:r})];case 1:return s.sent(),[2,function(){return i(n,void 0,void 0,(function(){var r=this;return o(this,(function(n){switch(n.label){case 0:return Object.entries(e).forEach((function(e){var n=a(e,2),i=n[0],o=n[1],s=r.translationsCache.get(i);s&&(s[t]=o)})),[4,this.eventService.TRANSLATION_CHANGED.emit({key:t,translations:e})];case 1:return n.sent(),[2]}}))}))}]}}))}))},e.prototype.getFromCacheOrFallback=function(t,r,n,i){void 0===r&&(r=this.properties.currentLanguage),void 0===n&&(n=!1);var o=this.getFromCache(t,r)||this.getFromCache(t,this.properties.config.fallbackLanguage);return e.translationByValue(o,t,n,i)},e.prototype.fetchTranslations=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return"development"!==this.properties.config.mode?[3,2]:[4,this.fetchTranslationsDevelopment(e)];case 1:return[2,t.sent()];case 2:return[4,this.fetchTranslationsProduction(e)];case 3:return[2,t.sent()]}}))}))},e.prototype.fetchTranslationsProduction=function(e){var t,r;return i(this,void 0,void 0,(function(){var n,i,s,a;return o(this,(function(o){switch(o.label){case 0:return"function"!=typeof(n=null===(r=null===(t=this.properties.config)||void 0===t?void 0:t.staticData)||void 0===r?void 0:r[e])?[3,2]:[4,n()];case 1:return a=o.sent(),this.setLanguageData(e,a),[2];case 2:if(void 0!==n)return this.setLanguageData(e,n),[2];o.label=3;case 3:i=""+(this.properties.config.filesUrlPrefix||"/")+e+".json",o.label=4;case 4:return o.trys.push([4,10,,11]),[4,fetch(i)];case 5:if((s=o.sent()).status>=400)return console.error("Server responded with error status while loading localization data."),this.setLanguageData(e,{}),[2];o.label=6;case 6:return o.trys.push([6,8,,9]),[4,s.json()];case 7:return a=o.sent(),this.setLanguageData(e,a),[3,9];case 8:return o.sent(),console.error("Error parsing json retrieved from "+i+"."),this.setEmptyLanguageData(e),[3,9];case 9:return[3,11];case 10:return o.sent(),console.error("Error fetching localization data from "+i+"."),this.setEmptyLanguageData(e),[3,11];case 11:return[2]}}))}))},e.prototype.fetchTranslationsDevelopment=function(e){return i(this,void 0,void 0,(function(){var t,r;return o(this,(function(n){switch(n.label){case 0:this.coreService.checkScope("translations.view"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.apiHttpService.fetchJson("v2/projects/translations/"+e)];case 2:return t=n.sent(),this.setLanguageData(e,t[e]||{}),[3,4];case 3:return r=n.sent(),console.error("Error while fetching localization data from API.",r),this.setEmptyLanguageData(e),[2];case 4:return[2]}}))}))},e.prototype.setEmptyLanguageData=function(e){this.translationsCache.set(e,{})},e.prototype.setLanguageData=function(e,t){var r=function(e){var t={};return Object.entries(e).forEach((function(e){var n=a(e,2),i=n[0],o=n[1];o&&("object"!=typeof o?t[i]=o:Object.entries(r(o)).forEach((function(e){var r=a(e,2),n=r[0],o=r[1];t[i+"."+n]=o})))})),t};this.translationsCache.set(e,r(t))},e.prototype.getFromCache=function(e,t){void 0===t&&(t=this.properties.currentLanguage);var r=this.translationsCache.get(t);if(void 0!==r)return r[e]},e}(),N=function(){function e(){}return e.splitOnNonEscapedDelimiter=function(e,t){for(var r=[],n="",i=!1,o=0;o<e.length;o++){var s=e[o];"\\"!==s||i?i?(i=!1,n+=s):s!==t?n+=s:(r.push(n),n=""):i=!0}return r.push(n),r},e.isCharEscaped=function(e,t){for(var r=0;e>-1&&"\\"===t[e-1];)r++,e--;return r%2==1},e.removeEscapes=function(e){for(var t="",r=!1,n=0;n<e.length;n++){var i=e[n];"\\"!==i||r?r?(r=!1,t+=i):t+=i:r=!0}return t},e}();function C(e){return e.type===g.literal}function R(e){return e.type===g.argument}function I(e){return e.type===g.number}function k(e){return e.type===g.date}function D(e){return e.type===g.time}function U(e){return e.type===g.select}function M(e){return e.type===g.plural}function x(e){return e.type===g.pound}function G(e){return e.type===g.tag}function F(e){return!(!e||"object"!=typeof e||e.type!==v.number)}function H(e){return!(!e||"object"!=typeof e||e.type!==v.dateTime)}!function(e){e[e.EXPECT_ARGUMENT_CLOSING_BRACE=1]="EXPECT_ARGUMENT_CLOSING_BRACE",e[e.EMPTY_ARGUMENT=2]="EMPTY_ARGUMENT",e[e.MALFORMED_ARGUMENT=3]="MALFORMED_ARGUMENT",e[e.EXPECT_ARGUMENT_TYPE=4]="EXPECT_ARGUMENT_TYPE",e[e.INVALID_ARGUMENT_TYPE=5]="INVALID_ARGUMENT_TYPE",e[e.EXPECT_ARGUMENT_STYLE=6]="EXPECT_ARGUMENT_STYLE",e[e.INVALID_NUMBER_SKELETON=7]="INVALID_NUMBER_SKELETON",e[e.INVALID_DATE_TIME_SKELETON=8]="INVALID_DATE_TIME_SKELETON",e[e.EXPECT_NUMBER_SKELETON=9]="EXPECT_NUMBER_SKELETON",e[e.EXPECT_DATE_TIME_SKELETON=10]="EXPECT_DATE_TIME_SKELETON",e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]="UNCLOSED_QUOTE_IN_ARGUMENT_STYLE",e[e.EXPECT_SELECT_ARGUMENT_OPTIONS=12]="EXPECT_SELECT_ARGUMENT_OPTIONS",e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]="EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]="INVALID_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR=15]="EXPECT_SELECT_ARGUMENT_SELECTOR",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]="EXPECT_PLURAL_ARGUMENT_SELECTOR",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]="EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]="EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT",e[e.INVALID_PLURAL_ARGUMENT_SELECTOR=19]="INVALID_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]="DUPLICATE_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]="DUPLICATE_SELECT_ARGUMENT_SELECTOR",e[e.MISSING_OTHER_CLAUSE=22]="MISSING_OTHER_CLAUSE",e[e.INVALID_TAG=23]="INVALID_TAG",e[e.INVALID_TAG_NAME=25]="INVALID_TAG_NAME",e[e.UNMATCHED_CLOSING_TAG=26]="UNMATCHED_CLOSING_TAG",e[e.UNCLOSED_TAG=27]="UNCLOSED_TAG"}(d||(d={})),function(e){e[e.literal=0]="literal",e[e.argument=1]="argument",e[e.number=2]="number",e[e.date=3]="date",e[e.time=4]="time",e[e.select=5]="select",e[e.plural=6]="plural",e[e.pound=7]="pound",e[e.tag=8]="tag"}(g||(g={})),function(e){e[e.number=0]="number",e[e.dateTime=1]="dateTime"}(v||(v={}));var j=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,V=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function K(e){var t={};return e.replace(V,(function(e){var r=e.length;switch(e[0]){case"G":t.era=4===r?"long":5===r?"narrow":"short";break;case"y":t.year=2===r?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":t.month=["numeric","2-digit","short","long","narrow"][r-1];break;case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":t.day=["numeric","2-digit"][r-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":t.weekday=4===r?"short":5===r?"narrow":"short";break;case"e":if(r<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][r-4];break;case"c":if(r<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][r-4];break;case"a":t.hour12=!0;break;case"b":case"B":throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":t.hourCycle="h12",t.hour=["numeric","2-digit"][r-1];break;case"H":t.hourCycle="h23",t.hour=["numeric","2-digit"][r-1];break;case"K":t.hourCycle="h11",t.hour=["numeric","2-digit"][r-1];break;case"k":t.hourCycle="h24",t.hour=["numeric","2-digit"][r-1];break;case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":t.minute=["numeric","2-digit"][r-1];break;case"s":t.second=["numeric","2-digit"][r-1];break;case"S":case"A":throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");case"z":t.timeZoneName=r<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return""})),t}var X=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;var B,Y=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,z=/^(@+)?(\+|#+)?[rs]?$/g,W=/(\*)(0+)|(#+)(0+)|(0+)/g,J=/^(0+)$/;function q(e){var t={};return"r"===e[e.length-1]?t.roundingPriority="morePrecision":"s"===e[e.length-1]&&(t.roundingPriority="lessPrecision"),e.replace(z,(function(e,r,n){return"string"!=typeof n?(t.minimumSignificantDigits=r.length,t.maximumSignificantDigits=r.length):"+"===n?t.minimumSignificantDigits=r.length:"#"===r[0]?t.maximumSignificantDigits=r.length:(t.minimumSignificantDigits=r.length,t.maximumSignificantDigits=r.length+("string"==typeof n?n.length:0)),""})),t}function Z(e){switch(e){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":case"()":return{currencySign:"accounting"};case"sign-always":case"+!":return{signDisplay:"always"};case"sign-accounting-always":case"()!":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":case"+?":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":case"()?":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":case"+_":return{signDisplay:"never"}}}function $(e){var t;if("E"===e[0]&&"E"===e[1]?(t={notation:"engineering"},e=e.slice(2)):"E"===e[0]&&(t={notation:"scientific"},e=e.slice(1)),t){var r=e.slice(0,2);if("+!"===r?(t.signDisplay="always",e=e.slice(2)):"+?"===r&&(t.signDisplay="exceptZero",e=e.slice(2)),!J.test(e))throw new Error("Malformed concise eng/scientific notation");t.minimumIntegerDigits=e.length}return t}function Q(e){var t=Z(e);return t||{}}function ee(e){for(var t={},r=0,i=e;r<i.length;r++){var o=i[r];switch(o.stem){case"percent":case"%":t.style="percent";continue;case"%x100":t.style="percent",t.scale=100;continue;case"currency":t.style="currency",t.currency=o.options[0];continue;case"group-off":case",_":t.useGrouping=!1;continue;case"precision-integer":case".":t.maximumFractionDigits=0;continue;case"measure-unit":case"unit":t.style="unit",t.unit=o.options[0].replace(/^(.*?)-/,"");continue;case"compact-short":case"K":t.notation="compact",t.compactDisplay="short";continue;case"compact-long":case"KK":t.notation="compact",t.compactDisplay="long";continue;case"scientific":t=n(n(n({},t),{notation:"scientific"}),o.options.reduce((function(e,t){return n(n({},e),Q(t))}),{}));continue;case"engineering":t=n(n(n({},t),{notation:"engineering"}),o.options.reduce((function(e,t){return n(n({},e),Q(t))}),{}));continue;case"notation-simple":t.notation="standard";continue;case"unit-width-narrow":t.currencyDisplay="narrowSymbol",t.unitDisplay="narrow";continue;case"unit-width-short":t.currencyDisplay="code",t.unitDisplay="short";continue;case"unit-width-full-name":t.currencyDisplay="name",t.unitDisplay="long";continue;case"unit-width-iso-code":t.currencyDisplay="symbol";continue;case"scale":t.scale=parseFloat(o.options[0]);continue;case"integer-width":if(o.options.length>1)throw new RangeError("integer-width stems only accept a single optional option");o.options[0].replace(W,(function(e,r,n,i,o,s){if(r)t.minimumIntegerDigits=n.length;else{if(i&&o)throw new Error("We currently do not support maximum integer digits");if(s)throw new Error("We currently do not support exact integer digits")}return""}));continue}if(J.test(o.stem))t.minimumIntegerDigits=o.stem.length;else if(Y.test(o.stem)){if(o.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");o.stem.replace(Y,(function(e,r,n,i,o,s){return"*"===n?t.minimumFractionDigits=r.length:i&&"#"===i[0]?t.maximumFractionDigits=i.length:o&&s?(t.minimumFractionDigits=o.length,t.maximumFractionDigits=o.length+s.length):(t.minimumFractionDigits=r.length,t.maximumFractionDigits=r.length),""}));var s=o.options[0];"w"===s?t=n(n({},t),{trailingZeroDisplay:"stripIfInteger"}):s&&(t=n(n({},t),q(s)))}else if(z.test(o.stem))t=n(n({},t),q(o.stem));else{var a=Z(o.stem);a&&(t=n(n({},t),a));var u=$(o.stem);u&&(t=n(n({},t),u))}}return t}var te=new RegExp("^".concat(j.source,"*")),re=new RegExp("".concat(j.source,"*$"));function ne(e,t){return{start:e,end:t}}var ie=!!String.prototype.startsWith,oe=!!String.fromCodePoint,se=!!Object.fromEntries,ae=!!String.prototype.codePointAt,ue=!!String.prototype.trimStart,ce=!!String.prototype.trimEnd,le=!!Number.isSafeInteger?Number.isSafeInteger:function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},he=!0;try{he="a"===(null===(B=Ee("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu").exec("a"))||void 0===B?void 0:B[0])}catch(e){he=!1}var pe,fe=ie?function(e,t,r){return e.startsWith(t,r)}:function(e,t,r){return e.slice(r,r+t.length)===t},de=oe?String.fromCodePoint:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r,n="",i=e.length,o=0;i>o;){if((r=e[o++])>1114111)throw RangeError(r+" is not a valid code point");n+=r<65536?String.fromCharCode(r):String.fromCharCode(55296+((r-=65536)>>10),r%1024+56320)}return n},ge=se?Object.fromEntries:function(e){for(var t={},r=0,n=e;r<n.length;r++){var i=n[r],o=i[0],s=i[1];t[o]=s}return t},ve=ae?function(e,t){return e.codePointAt(t)}:function(e,t){var r=e.length;if(!(t<0||t>=r)){var n,i=e.charCodeAt(t);return i<55296||i>56319||t+1===r||(n=e.charCodeAt(t+1))<56320||n>57343?i:n-56320+(i-55296<<10)+65536}},ye=ue?function(e){return e.trimStart()}:function(e){return e.replace(te,"")},me=ce?function(e){return e.trimEnd()}:function(e){return e.replace(re,"")};function Ee(e,t){return new RegExp(e,t)}if(he){var be=Ee("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");pe=function(e,t){var r;return be.lastIndex=t,null!==(r=be.exec(e)[1])&&void 0!==r?r:""}}else pe=function(e,t){for(var r=[];;){var n=ve(e,t);if(void 0===n||we(n)||Se(n))break;r.push(n),t+=n>=65536?2:1}return de.apply(void 0,r)};var _e=function(){function e(e,t){void 0===t&&(t={}),this.message=e,this.position={offset:0,line:1,column:1},this.ignoreTag=!!t.ignoreTag,this.requiresOtherClause=!!t.requiresOtherClause,this.shouldParseSkeletons=!!t.shouldParseSkeletons}return e.prototype.parse=function(){if(0!==this.offset())throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(e,t,r){for(var n=[];!this.isEOF();){var i=this.char();if(123===i){if((o=this.parseArgument(e,r)).err)return o;n.push(o.val)}else{if(125===i&&e>0)break;if(35!==i||"plural"!==t&&"selectordinal"!==t){if(60===i&&!this.ignoreTag&&47===this.peek()){if(r)break;return this.error(d.UNMATCHED_CLOSING_TAG,ne(this.clonePosition(),this.clonePosition()))}if(60===i&&!this.ignoreTag&&Te(this.peek()||0)){if((o=this.parseTag(e,t)).err)return o;n.push(o.val)}else{var o;if((o=this.parseLiteral(e,t)).err)return o;n.push(o.val)}}else{var s=this.clonePosition();this.bump(),n.push({type:g.pound,location:ne(s,this.clonePosition())})}}}return{val:n,err:null}},e.prototype.parseTag=function(e,t){var r=this.clonePosition();this.bump();var n=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:g.literal,value:"<".concat(n,"/>"),location:ne(r,this.clonePosition())},err:null};if(this.bumpIf(">")){var i=this.parseMessage(e+1,t,!0);if(i.err)return i;var o=i.val,s=this.clonePosition();if(this.bumpIf("</")){if(this.isEOF()||!Te(this.char()))return this.error(d.INVALID_TAG,ne(s,this.clonePosition()));var a=this.clonePosition();return n!==this.parseTagName()?this.error(d.UNMATCHED_CLOSING_TAG,ne(a,this.clonePosition())):(this.bumpSpace(),this.bumpIf(">")?{val:{type:g.tag,value:n,children:o,location:ne(r,this.clonePosition())},err:null}:this.error(d.INVALID_TAG,ne(s,this.clonePosition())))}return this.error(d.UNCLOSED_TAG,ne(r,this.clonePosition()))}return this.error(d.INVALID_TAG,ne(r,this.clonePosition()))},e.prototype.parseTagName=function(){var e,t=this.offset();for(this.bump();!this.isEOF()&&(45===(e=this.char())||46===e||e>=48&&e<=57||95===e||e>=97&&e<=122||e>=65&&e<=90||183==e||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039);)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(e,t){for(var r=this.clonePosition(),n="";;){var i=this.tryParseQuote(t);if(i)n+=i;else{var o=this.tryParseUnquoted(e,t);if(o)n+=o;else{var s=this.tryParseLeftAngleBracket();if(!s)break;n+=s}}}var a=ne(r,this.clonePosition());return{val:{type:g.literal,value:n,location:a},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return this.isEOF()||60!==this.char()||!this.ignoreTag&&(Te(e=this.peek()||0)||47===e)?null:(this.bump(),"<");var e},e.prototype.tryParseQuote=function(e){if(this.isEOF()||39!==this.char())return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if("plural"===e||"selectordinal"===e)break;return null;default:return null}this.bump();var t=[this.char()];for(this.bump();!this.isEOF();){var r=this.char();if(39===r){if(39!==this.peek()){this.bump();break}t.push(39),this.bump()}else t.push(r);this.bump()}return de.apply(void 0,t)},e.prototype.tryParseUnquoted=function(e,t){if(this.isEOF())return null;var r=this.char();return 60===r||123===r||35===r&&("plural"===t||"selectordinal"===t)||125===r&&e>0?null:(this.bump(),de(r))},e.prototype.parseArgument=function(e,t){var r=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,ne(r,this.clonePosition()));if(125===this.char())return this.bump(),this.error(d.EMPTY_ARGUMENT,ne(r,this.clonePosition()));var n=this.parseIdentifierIfPossible().value;if(!n)return this.error(d.MALFORMED_ARGUMENT,ne(r,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,ne(r,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:g.argument,value:n,location:ne(r,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,ne(r,this.clonePosition())):this.parseArgumentOptions(e,t,n,r);default:return this.error(d.MALFORMED_ARGUMENT,ne(r,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var e=this.clonePosition(),t=this.offset(),r=pe(this.message,t),n=t+r.length;return this.bumpTo(n),{value:r,location:ne(e,this.clonePosition())}},e.prototype.parseArgumentOptions=function(e,t,r,i){var o,s=this.clonePosition(),a=this.parseIdentifierIfPossible().value,u=this.clonePosition();switch(a){case"":return this.error(d.EXPECT_ARGUMENT_TYPE,ne(s,u));case"number":case"date":case"time":this.bumpSpace();var c=null;if(this.bumpIf(",")){this.bumpSpace();var l=this.clonePosition();if((b=this.parseSimpleArgStyleIfPossible()).err)return b;if(0===(f=me(b.val)).length)return this.error(d.EXPECT_ARGUMENT_STYLE,ne(this.clonePosition(),this.clonePosition()));c={style:f,styleLocation:ne(l,this.clonePosition())}}if((_=this.tryParseArgumentClose(i)).err)return _;var h=ne(i,this.clonePosition());if(c&&fe(null==c?void 0:c.style,"::",0)){var p=ye(c.style.slice(2));if("number"===a)return(b=this.parseNumberSkeletonFromString(p,c.styleLocation)).err?b:{val:{type:g.number,value:r,location:h,style:b.val},err:null};if(0===p.length)return this.error(d.EXPECT_DATE_TIME_SKELETON,h);var f={type:v.dateTime,pattern:p,location:c.styleLocation,parsedOptions:this.shouldParseSkeletons?K(p):{}};return{val:{type:"date"===a?g.date:g.time,value:r,location:h,style:f},err:null}}return{val:{type:"number"===a?g.number:"date"===a?g.date:g.time,value:r,location:h,style:null!==(o=null==c?void 0:c.style)&&void 0!==o?o:null},err:null};case"plural":case"selectordinal":case"select":var y=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(d.EXPECT_SELECT_ARGUMENT_OPTIONS,ne(y,n({},y)));this.bumpSpace();var m=this.parseIdentifierIfPossible(),E=0;if("select"!==a&&"offset"===m.value){if(!this.bumpIf(":"))return this.error(d.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,ne(this.clonePosition(),this.clonePosition()));var b;if(this.bumpSpace(),(b=this.tryParseDecimalInteger(d.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,d.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE)).err)return b;this.bumpSpace(),m=this.parseIdentifierIfPossible(),E=b.val}var _,T=this.tryParsePluralOrSelectOptions(e,a,t,m);if(T.err)return T;if((_=this.tryParseArgumentClose(i)).err)return _;var w=ne(i,this.clonePosition());return"select"===a?{val:{type:g.select,value:r,options:ge(T.val),location:w},err:null}:{val:{type:g.plural,value:r,options:ge(T.val),offset:E,pluralType:"plural"===a?"cardinal":"ordinal",location:w},err:null};default:return this.error(d.INVALID_ARGUMENT_TYPE,ne(s,u))}},e.prototype.tryParseArgumentClose=function(e){return this.isEOF()||125!==this.char()?this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,ne(e,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var e=0,t=this.clonePosition();!this.isEOF();){switch(this.char()){case 39:this.bump();var r=this.clonePosition();if(!this.bumpUntil("'"))return this.error(d.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,ne(r,this.clonePosition()));this.bump();break;case 123:e+=1,this.bump();break;case 125:if(!(e>0))return{val:this.message.slice(t.offset,this.offset()),err:null};e-=1;break;default:this.bump()}}return{val:this.message.slice(t.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(e,t){var r=[];try{r=function(e){if(0===e.length)throw new Error("Number skeleton cannot be empty");for(var t=[],r=0,n=e.split(X).filter((function(e){return e.length>0}));r<n.length;r++){var i=n[r].split("/");if(0===i.length)throw new Error("Invalid number skeleton");for(var o=i[0],s=i.slice(1),a=0,u=s;a<u.length;a++)if(0===u[a].length)throw new Error("Invalid number skeleton");t.push({stem:o,options:s})}return t}(e)}catch(e){return this.error(d.INVALID_NUMBER_SKELETON,t)}return{val:{type:v.number,tokens:r,location:t,parsedOptions:this.shouldParseSkeletons?ee(r):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(e,t,r,n){for(var i,o=!1,s=[],a=new Set,u=n.value,c=n.location;;){if(0===u.length){var l=this.clonePosition();if("select"===t||!this.bumpIf("="))break;var h=this.tryParseDecimalInteger(d.EXPECT_PLURAL_ARGUMENT_SELECTOR,d.INVALID_PLURAL_ARGUMENT_SELECTOR);if(h.err)return h;c=ne(l,this.clonePosition()),u=this.message.slice(l.offset,this.offset())}if(a.has(u))return this.error("select"===t?d.DUPLICATE_SELECT_ARGUMENT_SELECTOR:d.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,c);"other"===u&&(o=!0),this.bumpSpace();var p=this.clonePosition();if(!this.bumpIf("{"))return this.error("select"===t?d.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:d.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,ne(this.clonePosition(),this.clonePosition()));var f=this.parseMessage(e+1,t,r);if(f.err)return f;var g=this.tryParseArgumentClose(p);if(g.err)return g;s.push([u,{value:f.val,location:ne(p,this.clonePosition())}]),a.add(u),this.bumpSpace(),u=(i=this.parseIdentifierIfPossible()).value,c=i.location}return 0===s.length?this.error("select"===t?d.EXPECT_SELECT_ARGUMENT_SELECTOR:d.EXPECT_PLURAL_ARGUMENT_SELECTOR,ne(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!o?this.error(d.MISSING_OTHER_CLAUSE,ne(this.clonePosition(),this.clonePosition())):{val:s,err:null}},e.prototype.tryParseDecimalInteger=function(e,t){var r=1,n=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(r=-1);for(var i=!1,o=0;!this.isEOF();){var s=this.char();if(!(s>=48&&s<=57))break;i=!0,o=10*o+(s-48),this.bump()}var a=ne(n,this.clonePosition());return i?le(o*=r)?{val:o,err:null}:this.error(t,a):this.error(e,a)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var e=this.position.offset;if(e>=this.message.length)throw Error("out of bound");var t=ve(this.message,e);if(void 0===t)throw Error("Offset ".concat(e," is at invalid UTF-16 code unit boundary"));return t},e.prototype.error=function(e,t){return{val:null,err:{kind:e,message:this.message,location:t}}},e.prototype.bump=function(){if(!this.isEOF()){var e=this.char();10===e?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=e<65536?1:2)}},e.prototype.bumpIf=function(e){if(fe(this.message,e,this.offset())){for(var t=0;t<e.length;t++)this.bump();return!0}return!1},e.prototype.bumpUntil=function(e){var t=this.offset(),r=this.message.indexOf(e,t);return r>=0?(this.bumpTo(r),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(e){if(this.offset()>e)throw Error("targetOffset ".concat(e," must be greater than or equal to the current offset ").concat(this.offset()));for(e=Math.min(e,this.message.length);;){var t=this.offset();if(t===e)break;if(t>e)throw Error("targetOffset ".concat(e," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&we(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var e=this.char(),t=this.offset(),r=this.message.charCodeAt(t+(e>=65536?2:1));return null!=r?r:null},e}();function Te(e){return e>=97&&e<=122||e>=65&&e<=90}function we(e){return e>=9&&e<=13||32===e||133===e||e>=8206&&e<=8207||8232===e||8233===e}function Se(e){return e>=33&&e<=35||36===e||e>=37&&e<=39||40===e||41===e||42===e||43===e||44===e||45===e||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||91===e||92===e||93===e||94===e||96===e||123===e||124===e||125===e||126===e||161===e||e>=162&&e<=165||166===e||167===e||169===e||171===e||172===e||174===e||176===e||177===e||182===e||187===e||191===e||215===e||247===e||e>=8208&&e<=8213||e>=8214&&e<=8215||8216===e||8217===e||8218===e||e>=8219&&e<=8220||8221===e||8222===e||8223===e||e>=8224&&e<=8231||e>=8240&&e<=8248||8249===e||8250===e||e>=8251&&e<=8254||e>=8257&&e<=8259||8260===e||8261===e||8262===e||e>=8263&&e<=8273||8274===e||8275===e||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||8608===e||e>=8609&&e<=8610||8611===e||e>=8612&&e<=8613||8614===e||e>=8615&&e<=8621||8622===e||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||8658===e||8659===e||8660===e||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||8968===e||8969===e||8970===e||8971===e||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||9001===e||9002===e||e>=9003&&e<=9083||9084===e||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||9655===e||e>=9656&&e<=9664||9665===e||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||9839===e||e>=9840&&e<=10087||10088===e||10089===e||10090===e||10091===e||10092===e||10093===e||10094===e||10095===e||10096===e||10097===e||10098===e||10099===e||10100===e||10101===e||e>=10132&&e<=10175||e>=10176&&e<=10180||10181===e||10182===e||e>=10183&&e<=10213||10214===e||10215===e||10216===e||10217===e||10218===e||10219===e||10220===e||10221===e||10222===e||10223===e||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||10627===e||10628===e||10629===e||10630===e||10631===e||10632===e||10633===e||10634===e||10635===e||10636===e||10637===e||10638===e||10639===e||10640===e||10641===e||10642===e||10643===e||10644===e||10645===e||10646===e||10647===e||10648===e||e>=10649&&e<=10711||10712===e||10713===e||10714===e||10715===e||e>=10716&&e<=10747||10748===e||10749===e||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||11158===e||e>=11159&&e<=11263||e>=11776&&e<=11777||11778===e||11779===e||11780===e||11781===e||e>=11782&&e<=11784||11785===e||11786===e||11787===e||11788===e||11789===e||e>=11790&&e<=11798||11799===e||e>=11800&&e<=11801||11802===e||11803===e||11804===e||11805===e||e>=11806&&e<=11807||11808===e||11809===e||11810===e||11811===e||11812===e||11813===e||11814===e||11815===e||11816===e||11817===e||e>=11818&&e<=11822||11823===e||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||11840===e||11841===e||11842===e||e>=11843&&e<=11855||e>=11856&&e<=11857||11858===e||e>=11859&&e<=11903||e>=12289&&e<=12291||12296===e||12297===e||12298===e||12299===e||12300===e||12301===e||12302===e||12303===e||12304===e||12305===e||e>=12306&&e<=12307||12308===e||12309===e||12310===e||12311===e||12312===e||12313===e||12314===e||12315===e||12316===e||12317===e||e>=12318&&e<=12319||12320===e||12336===e||64830===e||64831===e||e>=65093&&e<=65094}function Ae(e){e.forEach((function(e){if(delete e.location,U(e)||M(e))for(var t in e.options)delete e.options[t].location,Ae(e.options[t].value);else I(e)&&F(e.style)||(k(e)||D(e))&&H(e.style)?delete e.style.location:G(e)&&Ae(e.children)}))}function Le(e,t){void 0===t&&(t={}),t=n({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var r=new _e(e,t).parse();if(r.err){var i=SyntaxError(d[r.err.kind]);throw i.location=r.err.location,i.originalMessage=r.err.message,i}return(null==t?void 0:t.captureLocation)||Ae(r.val),r.val}function Pe(e,t){var r=t&&t.cache?t.cache:Ue,n=t&&t.serializer?t.serializer:Ie;return(t&&t.strategy?t.strategy:Re)(e,{cache:r,serializer:n})}function Oe(e,t,r,n){var i,o=null==(i=n)||"number"==typeof i||"boolean"==typeof i?n:r(n),s=t.get(o);return void 0===s&&(s=e.call(this,n),t.set(o,s)),s}function Ne(e,t,r){var n=Array.prototype.slice.call(arguments,3),i=r(n),o=t.get(i);return void 0===o&&(o=e.apply(this,n),t.set(i,o)),o}function Ce(e,t,r,n,i){return r.bind(t,e,n,i)}function Re(e,t){return Ce(e,this,1===e.length?Oe:Ne,t.cache.create(),t.serializer)}var Ie=function(){return JSON.stringify(arguments)};function ke(){this.cache=Object.create(null)}ke.prototype.get=function(e){return this.cache[e]},ke.prototype.set=function(e,t){this.cache[e]=t};var De,Ue={create:function(){return new ke}},Me={variadic:function(e,t){return Ce(e,this,Ne,t.cache.create(),t.serializer)},monadic:function(e,t){return Ce(e,this,Oe,t.cache.create(),t.serializer)}};!function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"}(De||(De={}));var xe,Ge=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.code=r,i.originalMessage=n,i}return r(t,e),t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t}(Error),Fe=function(e){function t(t,r,n,i){return e.call(this,'Invalid values for "'.concat(t,'": "').concat(r,'". Options are "').concat(Object.keys(n).join('", "'),'"'),De.INVALID_VALUE,i)||this}return r(t,e),t}(Ge),He=function(e){function t(t,r,n){return e.call(this,'Value for "'.concat(t,'" must be of type ').concat(r),De.INVALID_VALUE,n)||this}return r(t,e),t}(Ge),je=function(e){function t(t,r){return e.call(this,'The intl string context variable "'.concat(t,'" was not provided to the string "').concat(r,'"'),De.MISSING_VALUE,r)||this}return r(t,e),t}(Ge);function Ve(e){return"function"==typeof e}function Ke(e,t,r,n,i,o,s){if(1===e.length&&C(e[0]))return[{type:xe.literal,value:e[0].value}];for(var a=[],u=0,c=e;u<c.length;u++){var l=c[u];if(C(l))a.push({type:xe.literal,value:l.value});else if(x(l))"number"==typeof o&&a.push({type:xe.literal,value:r.getNumberFormat(t).format(o)});else{var h=l.value;if(!i||!(h in i))throw new je(h,s);var p=i[h];if(R(l))p&&"string"!=typeof p&&"number"!=typeof p||(p="string"==typeof p||"number"==typeof p?String(p):""),a.push({type:"string"==typeof p?xe.literal:xe.object,value:p});else if(k(l)){var f="string"==typeof l.style?n.date[l.style]:H(l.style)?l.style.parsedOptions:void 0;a.push({type:xe.literal,value:r.getDateTimeFormat(t,f).format(p)})}else if(D(l)){f="string"==typeof l.style?n.time[l.style]:H(l.style)?l.style.parsedOptions:void 0;a.push({type:xe.literal,value:r.getDateTimeFormat(t,f).format(p)})}else if(I(l)){(f="string"==typeof l.style?n.number[l.style]:F(l.style)?l.style.parsedOptions:void 0)&&f.scale&&(p*=f.scale||1),a.push({type:xe.literal,value:r.getNumberFormat(t,f).format(p)})}else{if(G(l)){var d=l.children,g=l.value,v=i[g];if(!Ve(v))throw new He(g,"function",s);var y=v(Ke(d,t,r,n,i,o).map((function(e){return e.value})));Array.isArray(y)||(y=[y]),a.push.apply(a,y.map((function(e){return{type:"string"==typeof e?xe.literal:xe.object,value:e}})))}if(U(l)){if(!(m=l.options[p]||l.options.other))throw new Fe(l.value,p,Object.keys(l.options),s);a.push.apply(a,Ke(m.value,t,r,n,i))}else if(M(l)){var m;if(!(m=l.options["=".concat(p)])){if(!Intl.PluralRules)throw new Ge('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n',De.MISSING_INTL_API,s);var E=r.getPluralRules(t,{type:l.pluralType}).select(p-(l.offset||0));m=l.options[E]||l.options.other}if(!m)throw new Fe(l.value,p,Object.keys(l.options),s);a.push.apply(a,Ke(m.value,t,r,n,i,p-(l.offset||0)))}else;}}}return function(e){return e.length<2?e:e.reduce((function(e,t){var r=e[e.length-1];return r&&r.type===xe.literal&&t.type===xe.literal?r.value+=t.value:e.push(t),e}),[])}(a)}function Xe(e,t){return t?Object.keys(e).reduce((function(r,i){var o,s;return r[i]=(o=e[i],(s=t[i])?n(n(n({},o||{}),s||{}),Object.keys(o).reduce((function(e,t){return e[t]=n(n({},o[t]),s[t]||{}),e}),{})):o),r}),n({},e)):e}function Be(e){return{create:function(){return{get:function(t){return e[t]},set:function(t,r){e[t]=r}}}}}!function(e){e[e.literal=0]="literal",e[e.object=1]="object"}(xe||(xe={}));var Ye=function(){function e(t,r,n,i){var o,s=this;if(void 0===r&&(r=e.defaultLocale),this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(e){var t=s.formatToParts(e);if(1===t.length)return t[0].value;var r=t.reduce((function(e,t){return e.length&&t.type===xe.literal&&"string"==typeof e[e.length-1]?e[e.length-1]+=t.value:e.push(t.value),e}),[]);return r.length<=1?r[0]||"":r},this.formatToParts=function(e){return Ke(s.ast,s.locales,s.formatters,s.formats,e,void 0,s.message)},this.resolvedOptions=function(){return{locale:Intl.NumberFormat.supportedLocalesOf(s.locales)[0]}},this.getAst=function(){return s.ast},"string"==typeof t){if(this.message=t,!e.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");this.ast=e.__parse(t,{ignoreTag:null==i?void 0:i.ignoreTag})}else this.ast=t;if(!Array.isArray(this.ast))throw new TypeError("A message must be provided as a String or AST.");this.formats=Xe(e.formats,n),this.locales=r,this.formatters=i&&i.formatters||(void 0===(o=this.formatterCache)&&(o={number:{},dateTime:{},pluralRules:{}}),{getNumberFormat:Pe((function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new((e=Intl.NumberFormat).bind.apply(e,u([void 0],t,!1)))}),{cache:Be(o.number),strategy:Me.variadic}),getDateTimeFormat:Pe((function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new((e=Intl.DateTimeFormat).bind.apply(e,u([void 0],t,!1)))}),{cache:Be(o.dateTime),strategy:Me.variadic}),getPluralRules:Pe((function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new((e=Intl.PluralRules).bind.apply(e,u([void 0],t,!1)))}),{cache:Be(o.pluralRules),strategy:Me.variadic})})}return Object.defineProperty(e,"defaultLocale",{get:function(){return e.memoizedDefaultLocale||(e.memoizedDefaultLocale=(new Intl.NumberFormat).resolvedOptions().locale),e.memoizedDefaultLocale},enumerable:!1,configurable:!0}),e.memoizedDefaultLocale=null,e.__parse=Le,e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}(),ze=function(){function e(e,t){var r=this;this.properties=e,this.translationService=t,this.format=function(e,t){try{return new Ye(e,r.properties.currentLanguage).format(t)}catch(e){console.error(e)}},this.escapeForRegExp=function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},this.escapeParam=function(e){return"string"==typeof e?e.replace(/[,:\\]/gs,"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn(e),console.warn("Unsupported value type of above param. Consider converting to string."),e)}}return Object.defineProperty(e.prototype,"rawUnWrapRegex",{get:function(){return"(\\\\?)("+this.escapeForRegExp(this.properties.config.inputPrefix)+"(.*?)"+this.escapeForRegExp(this.properties.config.inputSuffix)+")"},enumerable:!1,configurable:!0}),e.parseUnwrapped=function(e){var t,r,n=!1,i="",o="",a="KEY",u={key:"",params:{},defaultValue:void 0};try{for(var c=s(e),l=c.next();!l.done;l=c.next()){var h=l.value;"\\"!==h||n?n?(n=!1,i+=h):"KEY"!==a||","!==h?"KEY"!==a||":"!==h?"DEFAULT_VALUE"!==a||":"!==h?"PARAM_NAME"!==a||":"!==h?"PARAM_VALUE"!==a||","!==h?i+=h:(a="PARAM_NAME",u.params[o]=i,i=""):(a="PARAM_VALUE",o=i,i=""):(a="PARAM_NAME",u.defaultValue=i,i=""):(a="PARAM_NAME",u.key=i,i=""):(a="DEFAULT_VALUE",u.key=i,i=""):n=!0}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}return"KEY"===a&&(u.key=i),"DEFAULT_VALUE"===a&&(u.defaultValue=i),"PARAM_VALUE"===a&&(u.params[o]=i),u},e.prototype.translate=function(e,t,r,n,s){return void 0===r&&(r=this.properties.currentLanguage),i(this,void 0,void 0,(function(){var i,a;return o(this,(function(o){switch(o.label){case 0:return a=this.format,[4,this.translationService.getTranslation(e,r,n,s)];case 1:return void 0!==(i=a.apply(this,[o.sent(),t]))?[2,i]:[2,e]}}))}))},e.prototype.instant=function(e,t,r,n,i){void 0===r&&(r=this.properties.currentLanguage);var o=this.format(this.translationService.getFromCacheOrFallback(e,r,n,i),t);return void 0!==o?o:e},e.prototype.replace=function(e){return i(this,void 0,void 0,(function(){var t,r,n,i,s,u,c,l,h,p,f,d,g,v;return o(this,(function(o){switch(o.label){case 0:t=new RegExp(this.rawUnWrapRegex,"gs"),r=[],n=!1,s=0,u="",o.label=1;case 1:if(null===(i=t.exec(e)))return[3,3];if(c=i[1],l=a(i,4),h=l[0],p=l[2],f=l[3],d=i.index,g=i.input,u+=g.substr(s,d-s),s=d+h.length,"\\"===c){if(!N.isCharEscaped(d,e))return u+=p,[3,1];c=""}return[4,this.getTranslatedWithMetadata(f)];case 2:return v=o.sent(),r.push({key:v.key,params:v.params,defaultValue:v.defaultValue}),n=!0,u+=c+v.translated,[3,1];case 3:return u+=e.substring(s),n?[2,{text:u,keys:r}]:[2,void 0]}}))}))},e.prototype.wrap=function(e,t,r){var n=this;void 0===t&&(t={}),void 0===r&&(r=void 0);var i=Object.entries(t).map((function(e){var t=a(e,2),r=t[0],i=t[1];return n.escapeParam(r)+":"+n.escapeParam(i)})).join(",");i=i.length?":"+i:"";var o=void 0!==r?","+this.escapeParam(r):"";return""+this.properties.config.inputPrefix+this.escapeParam(e)+o+i+this.properties.config.inputSuffix},e.prototype.getTranslatedWithMetadata=function(t){return i(this,void 0,void 0,(function(){var r,n,i,s;return o(this,(function(o){switch(o.label){case 0:return r=e.parseUnwrapped(t),n=r.key,i=r.params,s=r.defaultValue,[4,this.translate(n,i,void 0,!1,s)];case 1:return[2,{translated:o.sent(),key:n,params:i,defaultValue:s}]}}))}))},e}(),We=function(){function t(e){this.properties=e,this.keysDown=new Set,this.mouseOn=new Set,this.mouseOnChanged=new w,this.keysChanged=new w,"undefined"==typeof window||this.initKeyListener()}return t.prototype.handle=function(e,t){var r=this;e._tolgee.listeningForHighlighting?console.error("Element is already listening mouse events! This is probably bug in tolgee"):(e._tolgee.listeningForHighlighting=!0,this.initEventListeners(e,t),this.mouseOnChanged.subscribe((function(){r.highlighted!==r.getMouseOn()&&r.onConditionsChanged()})),this.keysChanged.subscribe((function(){r.onConditionsChanged()})))},t.prototype.initEventListeners=function(e,t){var r=this,n=function(){return r.onMouseOver(e)},i=function(){return r.onMouseOut(e)},o=function(e){r.areKeysDown()&&(e.stopPropagation(),e.preventDefault(),t(e))};e.addEventListener("mouseover",n),e.addEventListener("click",o,{capture:!0});var s=function(e){r.areKeysDown()&&(e.stopPropagation(),e.preventDefault())};e.addEventListener("mousedown",s),e.addEventListener("mouseup",s),e.addEventListener("mouseout",i),e._tolgee.removeAllEventListeners=function(){e.removeEventListener("mousedown",s),e.removeEventListener("mouseup",s),e.removeEventListener("mouseover",n),e.removeEventListener("click",o,{capture:!0}),e.removeEventListener("mouseout",i)}},t.prototype.onConditionsChanged=function(){this.unhighlight(),this.areKeysDown()&&this.getMouseOn()&&this.highlight()},t.prototype.highlight=function(){this.getMouseOn()._tolgee.highlight(),this.highlighted=this.getMouseOn()},t.prototype.unhighlight=function(){this.highlighted&&(this.highlighted._tolgee.unhighlight(),this.highlighted=null)},t.prototype.onMouseOut=function(e){e._tolgee.preventClean=!1,this.mouseOn.delete(e),this.mouseOnChanged.emit(this.getMouseOn())},t.prototype.onMouseOver=function(e){this.filterMouseOn(),e._tolgee.preventClean=!0,this.mouseOn.delete(e),this.mouseOn.add(e),this.mouseOnChanged.emit(this.getMouseOn())},t.prototype.getMouseOn=function(){var e=Array.from(this.mouseOn);return e.length?e[0]:void 0},t.prototype.initKeyListener=function(){var t=this;window.addEventListener("blur",(function(){t.keysDown=new Set,t.keysChanged.emit(t.areKeysDown())})),window.addEventListener("keydown",(function(r){var n=e.ModifierKey[r.key];void 0!==n&&(t.keysDown.add(n),t.keysChanged.emit(t.areKeysDown()))})),window.addEventListener("keyup",(function(r){t.keysDown.delete(e.ModifierKey[r.key]),t.keysChanged.emit(t.areKeysDown())}))},t.prototype.filterMouseOn=function(){var e=this;this.mouseOn.forEach((function(t){document.contains(t)||e.mouseOn.delete(t)}))},t.prototype.areKeysDown=function(){var e,t;try{for(var r=s(this.properties.config.highlightKeys),n=r.next();!n.done;n=r.next()){var i=n.value;if(!this.keysDown.has(i))return!1}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return!0},t}(),Je=function(){function e(e){var t=this;this.dependencies=e,this.translationEdit=function(e,r){return i(t,void 0,void 0,(function(){var t,n;return o(this,(function(i){switch(i.label){case 0:return[4,this.getRenderer()];case 1:return"object"!=typeof(t=i.sent())?[3,3]:[4,this.getKeyAndDefault(e,r)];case 2:return(n=i.sent())?(t.renderViewer(n.key,n.defaultValue),[2]):[2];case 3:return[2]}}))}))}}return e.getKeyOptions=function(e){return Array.from(e._tolgee.nodes).reduce((function(e,t){return u(u([],a(e),!1),a(t._tolgee.keys.map((function(e){return{key:e.key,defaultValue:e.defaultValue}}))),!1)}),[])},e.prototype.listen=function(e){var t=this;this.dependencies.highlightFunctionInitializer.initFunctions(e),this.dependencies.mouseEventHandler.handle(e,(function(r){return i(t,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.translationEdit(r,e)];case 1:return[2,t.sent()]}}))}))}))},e.prototype.getRenderer=function(){return i(this,void 0,void 0,(function(){var e,t,r,n,i,a,u,c;return o(this,(function(o){switch(o.label){case 0:if(void 0!==this._renderer)return[3,11];e=[this.dependencies.properties.config.ui,window["@tolgee/ui"]],o.label=1;case 1:o.trys.push([1,8,9,10]),t=s(e),r=t.next(),o.label=2;case 2:if(r.done)return[3,7];if("function"!=typeof(n=r.value))return[3,6];o.label=3;case 3:return o.trys.push([3,5,,6]),[4,n()];case 4:return i=o.sent(),this._renderer=new i(this.dependencies),[3,6];case 5:return o.sent(),i=n,this._renderer=new i(this.dependencies),[3,6];case 6:return r=t.next(),[3,2];case 7:return[3,10];case 8:return a=o.sent(),u={error:a},[3,10];case 9:try{r&&!r.done&&(c=t.return)&&c.call(t)}finally{if(u)throw u.error}return[7];case 10:void 0===this._renderer&&console.warn('Tolgee UI is not provided. To translate interactively provide tolgee ui constructor to "ui" configuration property. To disable highlighting use production mode.'),o.label=11;case 11:return[2,this._renderer]}}))}))},e.prototype.getKeyAndDefault=function(t,r){return i(this,void 0,void 0,(function(){var n,i,s,a;return o(this,(function(o){switch(o.label){case 0:return r._tolgee.wrappedWithElementOnlyKey?[2,{key:r._tolgee.wrappedWithElementOnlyKey,defaultValue:r._tolgee.wrappedWithElementOnlyDefaultHtml}]:(n=e.getKeyOptions(r),(i=new Set(n.map((function(e){return e.key})))).size>1?[4,this.getRenderer()]:[3,3]);case 1:return[4,o.sent().getKey({keys:i,openEvent:t})];case 2:if(s=o.sent(),a=n.find((function(e){return e.key===s})))return[2,a];o.label=3;case 3:return 1===i.size?[2,n[0]]:(console.error("No key to translate. This seems like a bug in tolgee."),[2])}}))}))},e}(),qe=function(){function e(e,t,r){this.properties=e,this.translationHighlighter=t,this.eventService=r,this.registeredElements=new Set}return e.prototype.register=function(e){(void 0!==this.getActiveNodes(e).next().value||e._tolgee.wrappedWithElementOnlyKey)&&("development"!==this.properties.config.mode||this.registeredElements.has(e)||this.translationHighlighter.listen(e),this.registeredElements.add(e),this.eventService.ELEMENT_REGISTERED.emit(e))},e.prototype.refreshAll=function(){var e,t;try{for(var r=s(this.registeredElements),n=r.next();!n.done;n=r.next()){var i=n.value;i._tolgee.preventClean||(this.cleanElementInactiveNodes(i),0!==i._tolgee.nodes.size||i._tolgee.wrappedWithElementOnlyKey||this.cleanElement(i))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},e.prototype.cleanAll=function(){var e,t;try{for(var r=s(this.registeredElements),n=r.next();!n.done;n=r.next()){var i=n.value;this.cleanElement(i)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},e.prototype.findAllByKey=function(e){var t,r,n,i,o=[];try{for(var a=s(this.registeredElements),u=a.next();!u.done;u=a.next()){var c=u.value;if(c._tolgee.wrappedWithElementOnlyKey!==e)try{for(var l=(n=void 0,s(c._tolgee.nodes)),h=l.next();!h.done;h=l.next()){if(h.value._tolgee.keys.findIndex((function(t){return t.key===e}))>-1){o.push(c);break}}}catch(e){n={error:e}}finally{try{h&&!h.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}else o.push(c)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return o},e.prototype.cleanElementInactiveNodes=function(e){this.isElementActive(e)&&(e._tolgee.nodes=new Set(this.getActiveNodes(e)))},e.prototype.cleanElement=function(e){e._tolgee.preventClean||("function"==typeof e._tolgee.removeAllEventListeners&&e._tolgee.removeAllEventListeners(),e.removeAttribute(l),delete e._tolgee,this.registeredElements.delete(e))},e.prototype.getActiveNodes=function(e){var t,r,n,i,a,u;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,5,6,7]),t=s(e._tolgee.nodes),r=t.next(),o.label=1;case 1:return r.done?[3,4]:(n=r.value,f.nodeContains(this.properties.config.targetElement,n)?[4,n]:[3,3]);case 2:o.sent(),o.label=3;case 3:return r=t.next(),[3,1];case 4:return[3,7];case 5:return i=o.sent(),a={error:i},[3,7];case 6:try{r&&!r.done&&(u=t.return)&&u.call(t)}finally{if(a)throw a.error}return[7];case 7:return[2]}}))},e.prototype.isElementActive=function(e){return this.properties.config.targetElement.contains(e)},e}(),Ze=function(){function e(e,t,r,n){this.properties=e,this.textService=t,this.elementRegistrar=r,this.translationHighlighter=n}return e.initParentElement=function(e){return void 0===e._tolgee&&(e._tolgee={nodes:new Set},e.setAttribute(l,"")),e},e.prototype.filterRestricted=function(e){var t=this.properties.config.restrictedElements;return e.filter((function(e){var r=f.closestElement(e);return-1===t.indexOf(r.tagName.toLowerCase())&&null===r.closest('[data-tolgee-restricted="true"]')}))},e.prototype.handleNodes=function(e){return i(this,void 0,void 0,(function(){var t,r,n,i,a,u,c,l,h,p,f,d;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,5,6,7]),t=s(e),r=t.next(),o.label=1;case 1:return r.done?[3,4]:(void 0===(n=r.value)._tolgee&&(n._tolgee={}),!0===(null==(i=n._tolgee)?void 0:i.locked)?[3,3]:(this.lockNode(n),[4,this.textService.replace(n.textContent)]));case 2:(a=o.sent())&&(u=a.text,c=a.keys,l=this.translateChildNode(n,u,c),(h=this.getParentElement(l))._tolgee.nodes.add(l),this.elementRegistrar.register(h)),this.unlockNode(n),o.label=3;case 3:return r=t.next(),[3,1];case 4:return[3,7];case 5:return p=o.sent(),f={error:p},[3,7];case 6:try{r&&!r.done&&(d=t.return)&&d.call(t)}finally{if(f)throw f.error}return[7];case 7:return[2]}}))}))},e.prototype.translateChildNode=function(e,t,r){return e._tolgee={oldTextContent:e.textContent,keys:r},e.textContent=t,e},e.prototype.lockNode=function(e){void 0===e._tolgee&&(e._tolgee={});var t=e._tolgee;return!0!==(null==t?void 0:t.locked)&&(t.locked=!0),e},e.prototype.unlockNode=function(e){e._tolgee&&(e._tolgee.locked=!1)},e.prototype.getParentElement=function(t){var r=this.getSuitableParent(t);return e.initParentElement(r)},e.prototype.getSuitableParent=function(e){var t=f.getParentElement(e);if(void 0===t)throw console.error(e),new Error("No suitable parent found for node above.");if(!this.properties.config.passToParent)return t;if(Array.isArray(this.properties.config.passToParent)){if(-1===this.properties.config.passToParent.findIndex((function(e){return t.tagName.toLowerCase()===e.toLowerCase()})))return t}return"function"!=typeof this.properties.config.passToParent||this.properties.config.passToParent(t)?this.getSuitableParent(t):t},e}(),$e=function(e){function t(t,r,n,i){var o=e.call(this,t,n,i,r)||this;return o.properties=t,o.translationHighlighter=r,o.textService=n,o.nodeRegistrar=i,o}return r(t,e),t.prototype.handle=function(e){return i(this,void 0,void 0,(function(){var t,r,n,i,s;return o(this,(function(o){switch(o.label){case 0:return t=this.properties.config.inputPrefix,r=this.properties.config.inputSuffix,n="./descendant-or-self::text()[contains(., '"+t+"') and contains(., '"+r+"')]",i=f.evaluate(n,e),s=this.filterRestricted(i),[4,this.handleNodes(s)];case 1:return o.sent(),[2]}}))}))},t}(Ze),Qe=function(e){function t(t,r,n,i){var o=e.call(this,t,r,n,i)||this;return o.properties=t,o.textService=r,o.elementRegistrar=n,o.translationHighlighter=i,o}return r(t,e),t.prototype.handle=function(e){return i(this,void 0,void 0,(function(){var t,r,n,i,u,c,l,h,p,d,g,v,y,m,E,b,_,T;return o(this,(function(o){switch(o.label){case 0:t=this.properties.config.inputPrefix,r=this.properties.config.inputSuffix,o.label=1;case 1:o.trys.push([1,12,13,14]),n=s(Object.entries(this.properties.config.tagAttributes)),i=n.next(),o.label=2;case 2:if(i.done)return[3,11];u=a(i.value,2),c=u[0],l=u[1],o.label=3;case 3:o.trys.push([3,8,9,10]),_=void 0,h=s(l),p=h.next(),o.label=4;case 4:return p.done?[3,7]:(d=p.value,g="descendant-or-self::"+c+"/@"+d+"[contains(., '"+t+"') and contains(., '"+r+"')]",v=f.evaluate(g,e),[4,this.handleNodes(v)]);case 5:o.sent(),o.label=6;case 6:return p=h.next(),[3,4];case 7:return[3,10];case 8:return y=o.sent(),_={error:y},[3,10];case 9:try{p&&!p.done&&(T=h.return)&&T.call(h)}finally{if(_)throw _.error}return[7];case 10:return i=n.next(),[3,2];case 11:return[3,14];case 12:return m=o.sent(),E={error:m},[3,14];case 13:try{i&&!i.done&&(b=n.return)&&b.call(n)}finally{if(E)throw E.error}return[7];case 14:return[2]}}))}))},t}(Ze),et=function(){function e(e,t,r,n,i,o,s){this.service=e,this.textHandler=t,this.eventService=r,this.properties=n,this.attributeHandler=i,this.textService=o,this.wrappedHandler=s,"undefined"!=typeof window&&(r.LANGUAGE_CHANGED.subscribe(this.refresh.bind(this)),r.TRANSLATION_CHANGED.subscribe(this.refresh.bind(this)))}return e.prototype.handleSubtree=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.attributeHandler.handle(e)];case 1:return t.sent(),[4,this.textHandler.handle(e)];case 2:return t.sent(),[4,this.wrappedHandler.handle(e)];case 3:return t.sent(),[2]}}))}))},e.prototype.refresh=function(){return i(this,void 0,void 0,(function(){var e,t,r,n,i,a,u,c,l,h,p,d,g,v;return o(this,(function(o){switch(o.label){case 0:e=f.evaluate("//*[@_tolgee]",this.properties.config.targetElement),o.label=1;case 1:o.trys.push([1,12,13,14]),t=s(e),r=t.next(),o.label=2;case 2:if(r.done)return[3,11];n=r.value,o.label=3;case 3:o.trys.push([3,8,9,10]),g=void 0,i=s(n._tolgee.nodes),a=i.next(),o.label=4;case 4:return a.done?[3,7]:(u=a.value,[4,this.textService.replace(u._tolgee.oldTextContent)]);case 5:(c=o.sent())&&(u.textContent=c.text),o.label=6;case 6:return a=i.next(),[3,4];case 7:return[3,10];case 8:return l=o.sent(),g={error:l},[3,10];case 9:try{a&&!a.done&&(v=i.return)&&v.call(i)}finally{if(g)throw g.error}return[7];case 10:return r=t.next(),[3,2];case 11:return[3,14];case 12:return h=o.sent(),p={error:h},[3,14];case 13:try{r&&!r.done&&(d=t.return)&&d.call(t)}finally{if(p)throw p.error}return[7];case 14:return[2]}}))}))},e}(),tt=function(){function e(e,t,r,n,i){this.properties=e,this.coreHandler=t,this.basicTextHandler=r,this.attributeHandler=n,this.nodeRegistrar=i,this._observer=void 0}return Object.defineProperty(e.prototype,"observer",{get:function(){var e=this;return this._observer||"undefined"==typeof window||(this._observer=new MutationObserver((function(t){return i(e,void 0,void 0,(function(){var e,r,n,i,a,u;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,9,10,11]),e=s(t),r=e.next(),o.label=1;case 1:return r.done?[3,8]:"characterData"!==(n=r.value).type?[3,3]:[4,this.basicTextHandler.handle(n.target)];case 2:return o.sent(),[3,7];case 3:return"childList"!==n.type?[3,5]:[4,this.coreHandler.handleSubtree(n.target)];case 4:return o.sent(),[3,7];case 5:return"attributes"!==n.type?[3,7]:[4,this.attributeHandler.handle(n.target)];case 6:o.sent(),o.label=7;case 7:return r=e.next(),[3,1];case 8:return[3,11];case 9:return i=o.sent(),a={error:i},[3,11];case 10:try{r&&!r.done&&(u=e.return)&&u.call(e)}finally{if(a)throw a.error}return[7];case 11:return this.nodeRegistrar.refreshAll(),[2]}}))}))}))),this._observer},enumerable:!1,configurable:!0}),e.prototype.observe=function(){this.observer&&this.observer.observe(this.properties.config.targetElement,{attributes:!0,childList:!0,subtree:!0,characterData:!0})},e.prototype.stopObserving=function(){this.observer&&this.observer.disconnect()},e}(),rt=function(){function e(e,t){this.properties=e,this.apiHttpService=t}return e.prototype.getLanguages=function(){return i(this,void 0,void 0,(function(){var e,t;return o(this,(function(r){switch(r.label){case 0:return this.languagePromise instanceof Promise||(this.languagePromise=this.apiHttpService.fetchJson("v2/projects/languages?size=1000")),t=Set.bind,[4,this.languagePromise];case 1:return e=new(t.apply(Set,[void 0,r.sent()._embedded.languages.map((function(e){return e.tag}))])),this.properties.preferredLanguages=new Set(Array.from(this.properties.preferredLanguages).filter((function(t){return e.has(t)}))),[2,e]}}))}))},e.prototype.getLanguagesFull=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.getLanguages(),[4,this.languagePromise];case 1:return[2,e.sent()._embedded.languages]}}))}))},e.prototype.getScopes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.apiHttpService.fetchJson("v2/api-keys/current")];case 1:return[2,t.sent().scopes];case 2:return e=t.sent(),console.error(e),console.error("Error getting scopes. Trying to switch to production mode!"),this.properties.config.mode="production",[3,3];case 3:return[2]}}))}))},e.prototype.isAuthorizedTo=function(e){return this.properties.scopes.indexOf(e)>-1},e.prototype.checkScope=function(e){if(!this.isAuthorizedTo(e))throw new Error("Api key not permitted to do this, please add 'translations.view' scope.")},e}(),nt=function(e){function t(t,r,n,i){var o=e.call(this,t,n,i,r)||this;return o.properties=t,o.translationHighlighter=r,o.textService=n,o.elementRegistrar=i,o}return r(t,e),t.prototype.handle=function(e){return i(this,void 0,void 0,(function(){var t,r=this;return o(this,(function(n){return"./descendant-or-self::*[@data-tolgee-key-only]",t=f.evaluate("./descendant-or-self::*[@data-tolgee-key-only]",e),this.filterRestricted(t).forEach((function(e){var t=Ze.initParentElement(e);t._tolgee.wrappedWithElementOnlyKey=e.getAttribute(p),t._tolgee.wrappedWithElementOnlyDefaultHtml=e.innerHTML,r.elementRegistrar.register(t)})),[2]}))}))},t}(Ze),it=function(){function e(e,t,r,s,a){var u=this;this.messages=e,this.properties=t,this.eventService=r,this.elementRegistrar=s,this.translationService=a,this.handshakeSucceed=!1,this.takeScreenshot=function(e){return new Promise((function(t,r){u.translationService.changeTranslations(e).then((function(n){return i(u,void 0,void 0,(function(){var i,s,a=this;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),this.highlightAllByKey(e.key),[4,(u=100,new Promise((function(e){return setTimeout(e,u)})))];case 1:return o.sent(),this.messages.send("TOLGEE_TAKE_SCREENSHOT"),i=this.messages.listen("TOLGEE_SCREENSHOT_TAKEN",(function(r){a.unhighlightAllByKey(e.key),t(r),n(),i()})),[3,3];case 2:return s=o.sent(),n(),r(s),[3,3];case 3:return[2]}var u}))}))})).catch((function(e){r(e)}))}))},this.handshake=function(){var e=n(n({},u.properties),{config:n(n({},u.properties.config),{staticData:void 0,targetElement:void 0,_targetElement:void 0,ui:void 0})}),t=null,r=function(){u.messages.send("TOLGEE_READY",e)},i=function(){clearInterval(t)};u.messages.listen("TOLGEE_PLUGIN_READY",(function(){u.handshakeSucceed=!0,u.messages.send("TOLGEE_READY",e),i()})),r();var o=0;t=setInterval((function(){!u.handshakeSucceed&&o<5?(r(),o+=1):i()}),200)}}return e.prototype.run=function(){try{this.messages.startListening(),this.handshake()}catch(e){console.warn(e),console.warn("Can not start communication with browser plugin. Check waning above.")}},e.prototype.stop=function(){this.messages.stopListening()},e.prototype.highlightAllByKey=function(e){this.elementRegistrar.findAllByKey(e).forEach((function(e){return e._tolgee.highlight()}))},e.prototype.unhighlightAllByKey=function(e){this.elementRegistrar.findAllByKey(e).forEach((function(e){return e._tolgee.unhighlight()}))},e}(),ot=function(){function e(){var e=this;this.listeners=[],this.startListening=function(){var t=function(t){t.source==window&&e.listeners.forEach((function(e){e.type==t.data.type&&e.callback(t.data.data)}))};window.addEventListener("message",t,!1),"function"==typeof e._stopListening&&e._stopListening(),e._stopListening=function(){window.removeEventListener("message",t,!1)}},this.listen=function(t,r){var n={type:t,callback:r};return e.listeners.push(n),function(){e.listeners.splice(e.listeners.indexOf(n),1)}},this.send=function(e,t){try{window.postMessage({type:e,data:t},window.origin)}catch(e){console.warn("Cannot send message.",e)}}}return e.prototype.stopListening=function(){this._stopListening()},e}(),st=function(){function e(e){this.properties=e}return e.prototype.initFunctions=function(e){this.initHighlightFunction(e),this.initUnhighlightFunction(e)},e.prototype.initHighlightFunction=function(e){var t=this;e._tolgee.highlight=function(){e._tolgee.initialBackgroundColor=e.style.backgroundColor,e.style.backgroundColor=t.properties.config.highlightColor}},e.prototype.initUnhighlightFunction=function(e){e._tolgee.unhighlight=function(){e.style.backgroundColor=e._tolgee.initialBackgroundColor}},e}(),at=function(){function e(e,t){this.coreService=e,this.apiHttpService=t}return e.prototype.uploadImage=function(e){return i(this,void 0,void 0,(function(){var t;return o(this,(function(r){return(t=new FormData).append("image",e),[2,this.apiHttpService.postJson("v2/image-upload",void 0,{headers:{},body:t})]}))}))},e.prototype.deleteImages=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.apiHttpService.post("v2/image-upload/"+e.join(","),void 0,{method:"delete"})]}))}))},e}(),ut=function(e){void 0===e&&(e=new m),this.properties=new _,this.eventService=new S,this.apiHttpService=new L(this.properties),this.mouseEventHandler=new We(this.properties),this.coreService=new rt(this.properties,this.apiHttpService),this.screenshotService=new at(this.coreService,this.apiHttpService),this.translationService=new O(this.properties,this.coreService,this.apiHttpService,this.eventService),this.textService=new ze(this.properties,this.translationService),this.highlightFunctionInitializer=new st(this.properties),this.translationHighlighter=new Je(this),this.elementRegistrar=new qe(this.properties,this.translationHighlighter,this.eventService),this.textHandler=new $e(this.properties,this.translationHighlighter,this.textService,this.elementRegistrar),this.attributeHandler=new Qe(this.properties,this.textService,this.elementRegistrar,this.translationHighlighter),this.wrappedHandler=new nt(this.properties,this.translationHighlighter,this.textService,this.elementRegistrar),this.coreHandler=new et(this.coreService,this.textHandler,this.eventService,this.properties,this.attributeHandler,this.textService,this.wrappedHandler),this.observer=new tt(this.properties,this.coreHandler,this.textHandler,this.attributeHandler,this.elementRegistrar),this.messages=new ot,this.pluginManager=new it(this.messages,this.properties,this.eventService,this.elementRegistrar,this.translationService),this.properties.config=e,this.translationService.initStatic(),this.translationHighlighter.pluginManager=this.pluginManager},ct=function(){function e(e){var t=this;this.stop=function(){t.dependencyStore.observer.stopObserving(),t.dependencyStore.elementRegistrar.cleanAll(),f.unmarkElementAsTargetElement(t.properties.config.targetElement)},this.dependencyStore=new ut(new m(e))}return Object.defineProperty(e.prototype,"properties",{get:function(){return this.dependencyStore.properties},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"translationService",{get:function(){return this.dependencyStore.translationService},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coreService",{get:function(){return this.dependencyStore.coreService},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lang",{get:function(){return this.properties.currentLanguage},set:function(e){this.properties.currentLanguage=e,this.dependencyStore.eventService.LANGUAGE_CHANGED.emit(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultLanguage",{get:function(){return this.properties.config.defaultLanguage},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLangChange",{get:function(){return this.dependencyStore.eventService.LANGUAGE_CHANGED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onTranslationChange",{get:function(){return this.dependencyStore.eventService.TRANSLATION_CHANGED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLangLoaded",{get:function(){return this.dependencyStore.eventService.LANGUAGE_LOADED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initialLoading",{get:function(){var e,t,r,n;if("production"!==(null===(t=null===(e=this.properties)||void 0===e?void 0:e.config)||void 0===t?void 0:t.mode))return!0;var i=this.properties.currentLanguage,o=this.properties.config.fallbackLanguage,s=this.properties.config.preloadFallback,a=function(e){return void 0!==e&&"function"!=typeof e};return!a(null===(r=this.properties.config.staticData)||void 0===r?void 0:r[i])||!!s&&!a(null===(n=this.properties.config.staticData)||void 0===n?void 0:n[o])},enumerable:!1,configurable:!0}),e.prototype.run=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return"development"!==this.properties.config.mode?[3,2]:[4,this.loadScopes()];case 1:e.sent(),e.label=2;case 2:return[4,this.translationService.loadTranslations()];case 3:return e.sent(),[4,this.dependencyStore.pluginManager.run()];case 4:return e.sent(),this.properties.config.preloadFallback?[4,this.translationService.loadTranslations(this.properties.config.fallbackLanguage)]:[3,6];case 5:e.sent(),e.label=6;case 6:return[4,this.refresh()];case 7:return e.sent(),this.properties.config.watch&&this.dependencyStore.observer.observe(),[2]}}))}))},e.prototype.refresh=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){return[2,this.dependencyStore.coreHandler.handleSubtree(this.properties.config.targetElement)]}))}))},e.prototype.translate=function(e,t,r,n){return void 0===t&&(t={}),void 0===r&&(r=!1),void 0===n&&(n=void 0),i(this,void 0,void 0,(function(){var i,s,a;return o(this,(function(o){switch(o.label){case 0:return i="string"==typeof e?e:e.key,s=void 0,"object"==typeof e&&(t=void 0!==(a=e).params?a.params:t,r=void 0!==a.noWrap?a.noWrap:r,n=void 0!==a.defaultValue?a.defaultValue:n,s=a.orEmpty),"development"!==this.properties.config.mode||r?[3,3]:[4,this.loadScopes()];case 1:return o.sent(),[4,this.translationService.loadTranslations()];case 2:return o.sent(),[2,this.dependencyStore.textService.wrap(i,t,n)];case 3:return[2,this.dependencyStore.textService.translate(i,t,void 0,s,n)]}}))}))},e.prototype.instant=function(e,t,r,n,i){void 0===t&&(t={}),void 0===r&&(r=!1);var o="string"==typeof e?e:e.key;if("object"==typeof e){var s=e;t=void 0!==s.params?s.params:t,r=void 0!==s.noWrap?s.noWrap:r,i=void 0!==s.defaultValue?s.defaultValue:i,n=void 0!==s.orEmpty?s.orEmpty:n}return"development"!==this.properties.config.mode||r?this.dependencyStore.textService.instant(o,t,void 0,n,i):this.dependencyStore.textService.wrap(o,t,i)},e.prototype.loadScopes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return void 0!==this.properties.scopes?[3,2]:(e=this.properties,[4,this.dependencyStore.coreService.getScopes()]);case 1:e.scopes=t.sent(),t.label=2;case 2:return[2]}}))}))},e}();e.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=p,e.Tolgee=ct,e.TolgeeConfig=m,e.TranslationData=P,Object.defineProperty(e,"__esModule",{value:!0})}));
16
16
  //# sourceMappingURL=tolgee.umd.min.js.map