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

@tolgee/web

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tolgee/web - npm Package Compare versions

Comparing version 4.10.0-rc.578d1d0.0 to 4.10.0-rc.72ff5c5.0

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)};function t(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function n(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function o(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function i(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function a(e,t){return{oldTextContent:e,keys:t}}var u={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"},l=function(e){var t=e.highlightColor,n=e.highlightWidth;return Object.freeze({initHighlighter:function(e,o){!function(e,o){o.highlight=function(){if(e.isConnected){var i=o.highlightEl;i||((i=document.createElement("div")).classList.add("_tolgee-highlighter"),Object.entries(u).forEach((function(e){var t=r(e,2),n=t[0],o=t[1];i.style[n]=o})),i.style.borderColor=t,o.highlightEl=i,document.body.appendChild(i));var a=e.getBoundingClientRect();i.style.borderWidth=n+"px",i.style.top=a.top-n+"px",i.style.left=a.left-n+"px",i.style.width=a.width+"px",i.style.height=a.height+"px"}}}(e,o),function(e,t){t.unhighlight=function(){var e;null===(e=t.highlightEl)||void 0===e||e.remove(),t.highlightEl=void 0}}(0,o)}})};function c(e,t){for(var n,r,o=null===document||void 0===document?void 0:document.evaluate(e,t,void 0,XPathResult.ANY_TYPE),i=[];r=null===(n=null==o?void 0:o.iterateNext)||void 0===n?void 0:n.call(o);)i.push(r);return i}function f(e){return e.textContent}function s(e,t){e.textContent=t}var d,v=function(e,t){var n,r=void 0===e.key||void 0===t.key||t.key===e.key,o=void 0===e.ns||void 0===t.ns||-1!==(null===(n=e.ns)||void 0===n?void 0:n.findIndex((function(e){var n;return null===(n=t.ns)||void 0===n?void 0:n.includes(e)})));return r&&o};!function(e){e[e.Alt=0]="Alt",e[e.Control=1]="Control",e[e.Shift=2]="Shift",e[e.Meta=3]="Meta"}(d||(d={}));var h={capture:!0},g={capture:!0,passive:!0},y=function(e){var t,r,o=e.highlightKeys,i=e.elementStore,a=e.onClick,u=new Set,l=function(){var e,n=i.get(t);n&&(n.preventClean=!1,null===(e=n.unhighlight)||void 0===e||e.call(n),t=void 0)};function c(){var e,n=r;if(n&&x()){var o=document.elementFromPoint(n.x,n.y);o&&(e=b(o))}!function(e){var n;if(t!==e){l();var r=i.get(e);r&&(r.preventClean=!0,null===(n=r.highlight)||void 0===n||n.call(r),t=e)}}(e)}var f=function(e){var t;x()&&(t=e.target,!Boolean(E(t,(function(e){return"__tolgee_dev_tools"===e.id}))))&&(e.stopPropagation(),e.preventDefault())},s=function(e){var t;t={x:e.clientX,y:e.clientY},r=t,c()},v=function(){u=new Set,c()},y=function(e){var t=d[e.key];void 0!==t&&u.add(t),c()},p=function(e){u.delete(d[e.key]),c()},m=function(){var e,n=i.get(t);null===(e=null==n?void 0:n.highlight)||void 0===e||e.call(n)},w=function(e){if(f(e),x()){var n=b(e.target);n&&n===t&&(a(e,n),l())}};function b(e){return E(e,(function(e){return i.get(e)}))}function E(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?E(e.parentElement,t):void 0}function x(){var e,t;try{for(var r=n(o),i=r.next();!i.done;i=r.next()){var a=i.value;if(!u.has(a))return!1}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return!0}return Object.freeze({run:function(){window.addEventListener("blur",v,h),window.addEventListener("keydown",y,h),window.addEventListener("keyup",p,h),window.addEventListener("mousemove",s,g),window.addEventListener("scroll",m,g),window.addEventListener("click",w,h),window.addEventListener("mouseenter",f,h),window.addEventListener("mouseover",f,h),window.addEventListener("mouseout",f,h),window.addEventListener("mouseleave",f,h),window.addEventListener("mousedown",f,h),window.addEventListener("mouseup",f,h)},stop:function(){window.removeEventListener("blur",v,h),window.removeEventListener("keydown",y,h),window.removeEventListener("keyup",p,h),window.removeEventListener("mousemove",s,g),window.removeEventListener("scroll",m,g),window.removeEventListener("click",w,h),window.removeEventListener("mouseenter",f,h),window.removeEventListener("mouseover",f,h),window.removeEventListener("mouseout",f,h),window.removeEventListener("mouseleave",f,h),window.removeEventListener("mousedown",f,h),window.removeEventListener("mouseup",f,h)}})},p=function(e,a){var u,c=(u=new Map,Object.freeze({set:function(e,t){u.set(e,t)},get:function(e){return e&&u.get(e)},remove:function(e){return u.delete(e)},forEachElement:function(e){u.forEach((function(t,n){return e(n,t)}))}})),f=l({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),s=y({highlightKeys:e.highlightKeys,elementStore:c,onClick:function(e,t){var n=c.get(t);a(e,{el:t,meta:n,keysAndDefaults:d(n)})}});function d(e){return function(e){return Array.from(e.nodes.values()).reduce((function(e,t){return o(o([],r(e),!1),r(t.keys.map((function(e){return{key:e.key,defaultValue:e.defaultValue,ns:e.ns}}))),!1)}),[])}(e)}return Object.freeze({register:function(t,n,r){if(!function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest("[".concat("data-tolgee-restricted","]"))}(t)){var o=t,i=c.get(o);i||(i={nodes:new Map},c.set(o,i),o.setAttribute("_tolgee","true")),i.nodes.set(n,r),f.initHighlighter(o,i)}},forEachElement:c.forEachElement,findAll:function(e,t){var r=[];return c.forEachElement((function(o,a){var u,l;try{for(var c=n(a.nodes.values()),f=c.next();!f.done;f=c.next()){if(f.value.keys.find((function(n){return v({key:e,ns:i(t)},{key:n.key,ns:i(n.ns)})}))){r.push(a);break}}}catch(e){u={error:e}}finally{try{f&&!f.done&&(l=c.return)&&l.call(c)}finally{if(u)throw u.error}}})),r},refreshAll:function(){c.forEachElement((function(o,i){i.preventClean||(function(o){o.nodes=new Map(function(o){var i,a,u,l,c,f,s,d;return t(this,(function(t){switch(t.label){case 0:t.trys.push([0,5,6,7]),i=n(o.nodes.entries()),a=i.next(),t.label=1;case 1:return a.done?[3,4]:(u=r(a.value,2),l=u[0],c=u[1],function(e,t){if(e.contains(t))return!0;if(t instanceof Attr){var n=t.ownerElement&&Object.values(t.ownerElement.attributes).indexOf(t)>-1;if(e.contains(t.ownerElement)&&n)return!0}return!1}(e.targetElement||document.body,l)?[4,[l,c]]:[3,3]);case 2:t.sent(),t.label=3;case 3:return a=i.next(),[3,1];case 4:return[3,7];case 5:return f=t.sent(),s={error:f},[3,7];case 6:try{a&&!a.done&&(d=i.return)&&d.call(i)}finally{if(s)throw s.error}return[7];case 7:return[2]}}))}(o))}(i),0===i.nodes.size&&function(e,t){var n;t.highlightEl&&(null===(n=t.unhighlight)||void 0===n||n.call(t));e.removeAttribute("_tolgee"),c.remove(e)}(o,i))}))},run:function(e){e&&s.run()},stop:function(){s.stop()}})},m=function(e,t,i){var u=!1,l=function(e){return Object.freeze({getSuitableParent:function t(n){var r=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(n);if(void 0===r)throw console.error(n),new Error("No suitable parent found for node above.");return e.passToParent?Array.isArray(e.passToParent)&&-1===e.passToParent.findIndex((function(e){return r.tagName.toLowerCase()===e.toLowerCase()}))?r:"function"!=typeof e.passToParent||e.passToParent(r)?t(r):r:r}})}(t),d=function(e,t){var i=function(e){return c(t.getTextXPath(),e)},a=function(i){var a,u,l,f,s=[];try{for(var d=n(Object.entries(e.tagAttributes)),v=d.next();!v.done;v=d.next()){var h=r(v.value,2),g=h[0],y=h[1];try{for(var p=(l=void 0,n(y)),m=p.next();!m.done;m=p.next()){var w=m.value,b=c(t.getAttributeXPath({tag:g,attribute:w}),i);s=o(o([],r(s),!1),r(b),!1)}}catch(e){l={error:e}}finally{try{m&&!m.done&&(f=p.return)&&f.call(p)}finally{if(l)throw l.error}}}}catch(e){a={error:e}}finally{try{v&&!v.done&&(u=d.return)&&u.call(d)}finally{if(a)throw a.error}}return s};return Object.freeze({handleAttributes:a,handleChildList:function(e){var t=[];return(t=t.concat(a(e))).concat(i(e))},handleText:i})}(t,e),v=p(t,i);function h(t){var r,o;try{for(var i=n(t),u=i.next();!u.done;u=i.next()){var c=u.value,d=f(c),h=d?e.unwrap(d):null;if(h){var g=h.text,y=h.keys;s(c,g);var p=a(d,y),m=l.getSuitableParent(c);v.register(m,c,p)}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}var g,y=function(e){c("./descendant-or-self::*[@".concat("data-tolgee-key-only","]"),e).forEach((function(e){var t=e.getAttributeNode("data-tolgee-key-only"),n=l.getSuitableParent(t);v.register(n,t,{oldTextContent:"",keys:[{key:f(t)}],keyAttributeOnly:!0})}))};return Object.freeze({run:function(e){var r=e.mouseHighlight;g||(g=new MutationObserver((function(e){var t,r;if(u)try{for(var o=n(e),i=o.next();!i.done;i=o.next()){var a=i.value,l=[];switch(a.type){case"characterData":l=d.handleText(a.target);break;case"childList":y(a.target),l=d.handleChildList(a.target);break;case"attributes":y(a.target),l=d.handleAttributes(a.target)}h(l),v.refreshAll()}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}})));var o=t.targetElement||document.body;u=!0,v.run(r),y(o),h(d.handleChildList(o)),g.observe(t.targetElement||document.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0})},stop:function(){u=!1,v.stop(),g.disconnect()},wrap:e.wrap,unwrap:e.unwrap,forEachElement:v.forEachElement,highlight:function(e,t){var n=v.findAll(e,t);return n.forEach((function(e){var t;return null===(t=e.highlight)||void 0===t?void 0:t.call(e)})),{unhighlight:function(){n.forEach((function(e){var t;return null===(t=e.unhighlight)||void 0===t?void 0:t.call(e)}))}}}})},w={tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:[d.Alt],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"]};function b(){}function E(){}b.prototype.encode=function(e){for(var t=[],n=e.length,r=0;r<n;){var o=e.codePointAt(r),i=0,a=0;for(o<=127?(i=0,a=0):o<=2047?(i=6,a=192):o<=65535?(i=12,a=224):o<=2097151&&(i=18,a=240),t.push(a|o>>i),i-=6;i>=0;)t.push(128|o>>i&63),i-=6;r+=o>=65536?2:1}return t},E.prototype.decode=function(e){for(var t="",n=0;n<e.length;){var r=e[n],o=0,i=0;if(r<=127?(o=0,i=255&r):r<=223?(o=1,i=31&r):r<=239?(o=2,i=15&r):r<=244&&(o=3,i=7&r),e.length-n-o>0)for(var a=0;a<o;)i=i<<6|63&(r=e[n+a+1]),a+=1;else i=65533,o=e.length-n;t+=String.fromCodePoint(i),n+=o+1}return t};var x="undefined"==typeof TextEncoder?b:TextEncoder,k="undefined"==typeof TextDecoder?E:TextDecoder,A=["‌","‍"],L=RegExp("([".concat(A.join(""),"]{9})+"),"gu"),C=function(e){var t=function(e){return Array.from((new x).encode(e))}(e).map(Number),n=t.map((function(e){return function(e){var t=8-e.length;return"0".repeat(t)+e}(e.toString(2))+"0"})).join("");return Array.from(n).map((function(e){return A[Number(e)]})).join("")},O=function(e){var t,n=Array.from(e).map((function(e){return A.indexOf(e)})).map(String).join("").match(/(.{9})/g),r=Uint8Array.from((null==n?void 0:n.map((function(e){return parseInt(e.slice(0,8),2)})))||[]);return t=r,(new k).decode(new Uint8Array(t))},S=function(){var e,t=(e=[],Object.freeze({valueToNumber:function(t){var n=e.indexOf(t);return-1===n&&(n=e.length,e.push(t)),n},numberToValue:function(t){return e[t]}})),o=function(e){return JSON.parse(e)};return Object.freeze({unwrap:function(e){var i=[],a=function(e){var t,n=null===(t=e.match(L))||void 0===t?void 0:t.filter((function(e){return e.length>8}));return(null==n?void 0:n.map(O))||[]}(e);a.forEach((function(e){var a=r(function(e){var t,r,o=[];try{for(var i=n(e),a=i.next();!a.done;a=i.next()){var u=a.value;o.push(u.codePointAt(0))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return o}(e),1),u=a[0],l=t.numberToValue(u),c=o(l),f=c.k,s=c.d,d=c.n;i.push({key:f,defaultValue:s,ns:d})}));var u=function(e){return e.replace(L,"")}(e);return{text:u,keys:i}},wrap:function(e){var n=e.key,r=e.defaultValue,o=e.translation,i=function(e){var t={k:e.key,n:e.ns,d:e.defaultValue};return JSON.stringify(t)}({key:n,ns:e.ns,defaultValue:r}),a=t.valueToNumber(i),u=o||"",l=C(String.fromCodePoint(a));return"string"==typeof u?u+l:u},getTextXPath:function(){return"./descendant-or-self::text()[contains(., '".concat(A[0]).concat(A[0],"') or contains(., '").concat(A[1]).concat(A[0],"')]")},getAttributeXPath:function(e){var t=e.tag,n=e.attribute;return"descendant-or-self::".concat(t,"/@").concat(n,"[contains(., '").concat(A[0]).concat(A[0],"') or contains(., '").concat(A[1]).concat(A[0],"')]")}})},P=function(t){return function(n){var r=n.onClick,o=function(t){return e(e({},w),t)}(t),i=S(),a=m(i,o,r);return e(e({},a),{retranslate:function(){},outputNotFormattable:!1})}};exports.InvisibleObserver=function(e){return function(t,n){return n.setObserver(P(e)),t}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)};function t(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function n(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function o(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function i(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function a(e,t){return{oldTextContent:e,keys:t}}var u={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"},l=function(e){var t=e.highlightColor,n=e.highlightWidth;return Object.freeze({initHighlighter:function(e,o){!function(e,o){o.highlight=function(){if(e.isConnected){var i=o.highlightEl;i||((i=document.createElement("div")).classList.add("_tolgee-highlighter"),Object.entries(u).forEach((function(e){var t=r(e,2),n=t[0],o=t[1];i.style[n]=o})),i.style.borderColor=t,o.highlightEl=i,document.body.appendChild(i));var a=e.getBoundingClientRect();i.style.borderWidth=n+"px",i.style.top=a.top-n+"px",i.style.left=a.left-n+"px",i.style.width=a.width+"px",i.style.height=a.height+"px"}}}(e,o),function(e,t){t.unhighlight=function(){var e;null===(e=t.highlightEl)||void 0===e||e.remove(),t.highlightEl=void 0}}(0,o)}})};function c(e,t){for(var n,r,o=null===document||void 0===document?void 0:document.evaluate(e,t,void 0,XPathResult.ANY_TYPE),i=[];r=null===(n=null==o?void 0:o.iterateNext)||void 0===n?void 0:n.call(o);)i.push(r);return i}function f(e){return e.textContent}function s(e,t){e.textContent=t}var d=function(e,t){var n,r=void 0===e.key||void 0===t.key||t.key===e.key,o=void 0===e.ns||void 0===t.ns||-1!==(null===(n=e.ns)||void 0===n?void 0:n.findIndex((function(e){var n;return null===(n=t.ns)||void 0===n?void 0:n.includes(e)})));return r&&o},v={capture:!0},h={capture:!0,passive:!0},y=function(e){var t,r,o=e.highlightKeys,i=e.elementStore,a=e.onClick,u=new Set,l=function(){var e,n=i.get(t);n&&(n.preventClean=!1,null===(e=n.unhighlight)||void 0===e||e.call(n),t=void 0)};function c(){var e,n=r;if(n&&E()){var o=document.elementFromPoint(n.x,n.y);o&&(e=w(o))}!function(e){var n;if(t!==e){l();var r=i.get(e);r&&(r.preventClean=!0,null===(n=r.highlight)||void 0===n||n.call(r),t=e)}}(e)}var f=function(e){var t;E()&&(t=e.target,!Boolean(b(t,(function(e){return"__tolgee_dev_tools"===e.id}))))&&(e.stopPropagation(),e.preventDefault())},s=function(e){var t;t={x:e.clientX,y:e.clientY},r=t,c()},d=function(){u=new Set,c()},y=function(e){var t=e.key;void 0!==t&&u.add(t),c()},g=function(e){u.delete(e.key),c()},p=function(){var e,n=i.get(t);null===(e=null==n?void 0:n.highlight)||void 0===e||e.call(n)},m=function(e){if(f(e),E()){var n=w(e.target);n&&n===t&&(a(e,n),l())}};function w(e){return b(e,(function(e){return i.get(e)}))}function b(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?b(e.parentElement,t):void 0}function E(){var e,t;try{for(var r=n(o),i=r.next();!i.done;i=r.next()){var a=i.value;if(!u.has(a))return!1}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return!0}return Object.freeze({run:function(){window.addEventListener("blur",d,v),window.addEventListener("keydown",y,v),window.addEventListener("keyup",g,v),window.addEventListener("mousemove",s,h),window.addEventListener("scroll",p,h),window.addEventListener("click",m,v),window.addEventListener("mouseenter",f,v),window.addEventListener("mouseover",f,v),window.addEventListener("mouseout",f,v),window.addEventListener("mouseleave",f,v),window.addEventListener("mousedown",f,v),window.addEventListener("mouseup",f,v)},stop:function(){window.removeEventListener("blur",d,v),window.removeEventListener("keydown",y,v),window.removeEventListener("keyup",g,v),window.removeEventListener("mousemove",s,h),window.removeEventListener("scroll",p,h),window.removeEventListener("click",m,v),window.removeEventListener("mouseenter",f,v),window.removeEventListener("mouseover",f,v),window.removeEventListener("mouseout",f,v),window.removeEventListener("mouseleave",f,v),window.removeEventListener("mousedown",f,v),window.removeEventListener("mouseup",f,v)}})},g=function(e,a){var u,c=(u=new Map,Object.freeze({set:function(e,t){u.set(e,t)},get:function(e){return e&&u.get(e)},remove:function(e){return u.delete(e)},forEachElement:function(e){u.forEach((function(t,n){return e(n,t)}))}})),f=l({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),s=y({highlightKeys:e.highlightKeys,elementStore:c,onClick:function(e,t){var n=c.get(t);a(e,{el:t,meta:n,keysAndDefaults:v(n)})}});function v(e){return function(e){return Array.from(e.nodes.values()).reduce((function(e,t){return o(o([],r(e),!1),r(t.keys.map((function(e){return{key:e.key,defaultValue:e.defaultValue,ns:e.ns}}))),!1)}),[])}(e)}return Object.freeze({register:function(t,n,r){if(!function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest("[".concat("data-tolgee-restricted","]"))}(t)){var o=t,i=c.get(o);i||(i={nodes:new Map},c.set(o,i),o.setAttribute("_tolgee","true")),i.nodes.set(n,r),f.initHighlighter(o,i)}},forEachElement:c.forEachElement,findAll:function(e,t){var r=[];return c.forEachElement((function(o,a){var u,l;try{for(var c=n(a.nodes.values()),f=c.next();!f.done;f=c.next()){if(f.value.keys.find((function(n){return d({key:e,ns:i(t)},{key:n.key,ns:i(n.ns)})}))){r.push(a);break}}}catch(e){u={error:e}}finally{try{f&&!f.done&&(l=c.return)&&l.call(c)}finally{if(u)throw u.error}}})),r},refreshAll:function(){c.forEachElement((function(o,i){i.preventClean||(function(o){o.nodes=new Map(function(o){var i,a,u,l,c,f,s,d;return t(this,(function(t){switch(t.label){case 0:t.trys.push([0,5,6,7]),i=n(o.nodes.entries()),a=i.next(),t.label=1;case 1:return a.done?[3,4]:(u=r(a.value,2),l=u[0],c=u[1],function(e,t){if(e.contains(t))return!0;if(t instanceof Attr){var n=t.ownerElement&&Object.values(t.ownerElement.attributes).indexOf(t)>-1;if(e.contains(t.ownerElement)&&n)return!0}return!1}(e.targetElement||document.body,l)?[4,[l,c]]:[3,3]);case 2:t.sent(),t.label=3;case 3:return a=i.next(),[3,1];case 4:return[3,7];case 5:return f=t.sent(),s={error:f},[3,7];case 6:try{a&&!a.done&&(d=i.return)&&d.call(i)}finally{if(s)throw s.error}return[7];case 7:return[2]}}))}(o))}(i),0===i.nodes.size&&function(e,t){var n;t.highlightEl&&(null===(n=t.unhighlight)||void 0===n||n.call(t));e.removeAttribute("_tolgee"),c.remove(e)}(o,i))}))},run:function(e){e&&s.run()},stop:function(){s.stop()}})},p=function(e,t,i){var u=!1,l=function(e){return Object.freeze({getSuitableParent:function t(n){var r=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(n);if(void 0===r)throw console.error(n),new Error("No suitable parent found for node above.");return e.passToParent?Array.isArray(e.passToParent)&&-1===e.passToParent.findIndex((function(e){return r.tagName.toLowerCase()===e.toLowerCase()}))?r:"function"!=typeof e.passToParent||e.passToParent(r)?t(r):r:r}})}(t),d=function(e,t){var i=function(e){return c(t.getTextXPath(),e)},a=function(i){var a,u,l,f,s=[];try{for(var d=n(Object.entries(e.tagAttributes)),v=d.next();!v.done;v=d.next()){var h=r(v.value,2),y=h[0],g=h[1];try{for(var p=(l=void 0,n(g)),m=p.next();!m.done;m=p.next()){var w=m.value,b=c(t.getAttributeXPath({tag:y,attribute:w}),i);s=o(o([],r(s),!1),r(b),!1)}}catch(e){l={error:e}}finally{try{m&&!m.done&&(f=p.return)&&f.call(p)}finally{if(l)throw l.error}}}}catch(e){a={error:e}}finally{try{v&&!v.done&&(u=d.return)&&u.call(d)}finally{if(a)throw a.error}}return s};return Object.freeze({handleAttributes:a,handleChildList:function(e){var t=[];return(t=t.concat(a(e))).concat(i(e))},handleText:i})}(t,e),v=g(t,i);function h(t){var r,o;try{for(var i=n(t),u=i.next();!u.done;u=i.next()){var c=u.value,d=f(c),h=d?e.unwrap(d):null;if(h){var y=h.text,g=h.keys;s(c,y);var p=a(d,g),m=l.getSuitableParent(c);v.register(m,c,p)}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}var y,p=function(e){c("./descendant-or-self::*[@".concat("data-tolgee-key-only","]"),e).forEach((function(e){var t=e.getAttributeNode("data-tolgee-key-only"),n=l.getSuitableParent(t);v.register(n,t,{oldTextContent:"",keys:[{key:f(t)}],keyAttributeOnly:!0})}))};return Object.freeze({run:function(e){var r=e.mouseHighlight;y||(y=new MutationObserver((function(e){var t,r;if(u)try{for(var o=n(e),i=o.next();!i.done;i=o.next()){var a=i.value,l=[];switch(a.type){case"characterData":l=d.handleText(a.target);break;case"childList":p(a.target),l=d.handleChildList(a.target);break;case"attributes":p(a.target),l=d.handleAttributes(a.target)}h(l),v.refreshAll()}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}})));var o=t.targetElement||document.body;u=!0,v.run(r),p(o),h(d.handleChildList(o)),y.observe(t.targetElement||document.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0})},stop:function(){u=!1,v.stop(),y.disconnect()},wrap:e.wrap,unwrap:e.unwrap,forEachElement:v.forEachElement,highlight:function(e,t){var n=v.findAll(e,t);return n.forEach((function(e){var t;return null===(t=e.highlight)||void 0===t?void 0:t.call(e)})),{unhighlight:function(){n.forEach((function(e){var t;return null===(t=e.unhighlight)||void 0===t?void 0:t.call(e)}))}}}})};function m(){}function w(){}m.prototype.encode=function(e){for(var t=[],n=e.length,r=0;r<n;){var o=e.codePointAt(r),i=0,a=0;for(o<=127?(i=0,a=0):o<=2047?(i=6,a=192):o<=65535?(i=12,a=224):o<=2097151&&(i=18,a=240),t.push(a|o>>i),i-=6;i>=0;)t.push(128|o>>i&63),i-=6;r+=o>=65536?2:1}return t},w.prototype.decode=function(e){for(var t="",n=0;n<e.length;){var r=e[n],o=0,i=0;if(r<=127?(o=0,i=255&r):r<=223?(o=1,i=31&r):r<=239?(o=2,i=15&r):r<=244&&(o=3,i=7&r),e.length-n-o>0)for(var a=0;a<o;)i=i<<6|63&(r=e[n+a+1]),a+=1;else i=65533,o=e.length-n;t+=String.fromCodePoint(i),n+=o+1}return t};var b="undefined"==typeof TextEncoder?m:TextEncoder,E="undefined"==typeof TextDecoder?w:TextDecoder,x=["‌","‍"],k=RegExp("([".concat(x.join(""),"]{9})+"),"gu"),L=function(e){var t=function(e){return Array.from((new b).encode(e))}(e).map(Number),n=t.map((function(e){return function(e){var t=8-e.length;return"0".repeat(t)+e}(e.toString(2))+"0"})).join("");return Array.from(n).map((function(e){return x[Number(e)]})).join("")},A=function(e){var t,n=Array.from(e).map((function(e){return x.indexOf(e)})).map(String).join("").match(/(.{9})/g),r=Uint8Array.from((null==n?void 0:n.map((function(e){return parseInt(e.slice(0,8),2)})))||[]);return t=r,(new E).decode(new Uint8Array(t))},O=function(){var e,t=(e=[],Object.freeze({valueToNumber:function(t){var n=e.indexOf(t);return-1===n&&(n=e.length,e.push(t)),n},numberToValue:function(t){return e[t]}})),o=function(e){return JSON.parse(e)};return Object.freeze({unwrap:function(e){var i=[],a=function(e){var t,n=null===(t=e.match(k))||void 0===t?void 0:t.filter((function(e){return e.length>8}));return(null==n?void 0:n.map(A))||[]}(e);a.forEach((function(e){var a=r(function(e){var t,r,o=[];try{for(var i=n(e),a=i.next();!a.done;a=i.next()){var u=a.value;o.push(u.codePointAt(0))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return o}(e),1),u=a[0],l=t.numberToValue(u),c=o(l),f=c.k,s=c.d,d=c.n;i.push({key:f,defaultValue:s,ns:d})}));var u=function(e){return e.replace(k,"")}(e);return{text:u,keys:i}},wrap:function(e){var n=e.key,r=e.defaultValue,o=e.translation,i=function(e){var t={k:e.key,n:e.ns,d:e.defaultValue};return JSON.stringify(t)}({key:n,ns:e.ns,defaultValue:r}),a=t.valueToNumber(i),u=o||"",l=L(String.fromCodePoint(a));return"string"==typeof u?u+l:u},getTextXPath:function(){return"./descendant-or-self::text()[contains(., '".concat(x[0]).concat(x[0],"') or contains(., '").concat(x[1]).concat(x[0],"')]")},getAttributeXPath:function(e){var t=e.tag,n=e.attribute;return"descendant-or-self::".concat(t,"/@").concat(n,"[contains(., '").concat(x[0]).concat(x[0],"') or contains(., '").concat(x[1]).concat(x[0],"')]")}})};exports.InvisibleObserver=function(){return function(t,n){return n.setObserver((function(t){var n=t.onClick,r=t.options,o=O(),i=p(o,r,n);return e(e({},i),{retranslate:function(){},outputNotFormattable:!1})})),t}};
//# sourceMappingURL=tolgee-invisible-observer.cjs.min.js.map

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/invisible-observer"]={})}(this,(function(e){"use strict";var t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)};function n(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function r(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function i(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function a(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}const u="data-tolgee-restricted",l="_tolgee",c="data-tolgee-key-only",f="__tolgee_dev_tools";function s(e,t){return{oldTextContent:e,keys:t}}var d={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"},v=function(e){var t=e.highlightColor,n=e.highlightWidth;return Object.freeze({initHighlighter:function(e,r){!function(e,r){r.highlight=function(){if(e.isConnected){var i=r.highlightEl;i||((i=document.createElement("div")).classList.add("_tolgee-highlighter"),Object.entries(d).forEach((function(e){var t=o(e,2),n=t[0],r=t[1];i.style[n]=r})),i.style.borderColor=t,r.highlightEl=i,document.body.appendChild(i));var a=e.getBoundingClientRect();i.style.borderWidth=n+"px",i.style.top=a.top-n+"px",i.style.left=a.left-n+"px",i.style.width=a.width+"px",i.style.height=a.height+"px"}}}(e,r),function(e,t){t.unhighlight=function(){var e;null===(e=t.highlightEl)||void 0===e||e.remove(),t.highlightEl=void 0}}(0,r)}})};function h(e,t){for(var n,r,o=null===document||void 0===document?void 0:document.evaluate(e,t,void 0,XPathResult.ANY_TYPE),i=[];r=null===(n=null==o?void 0:o.iterateNext)||void 0===n?void 0:n.call(o);)i.push(r);return i}function g(e){return e.textContent}function y(e,t){e.textContent=t}var p,m=function(e,t){var n,r=void 0===e.key||void 0===t.key||t.key===e.key,o=void 0===e.ns||void 0===t.ns||-1!==(null===(n=e.ns)||void 0===n?void 0:n.findIndex((function(e){var n;return null===(n=t.ns)||void 0===n?void 0:n.includes(e)})));return r&&o};!function(e){e[e.Alt=0]="Alt",e[e.Control=1]="Control",e[e.Shift=2]="Shift",e[e.Meta=3]="Meta"}(p||(p={}));var w={capture:!0},b={capture:!0,passive:!0},E=function(e){var t,n,o=e.highlightKeys,i=e.elementStore,a=e.onClick,u=new Set,l=function(){var e,n=i.get(t);n&&(n.preventClean=!1,null===(e=n.unhighlight)||void 0===e||e.call(n),t=void 0)};function c(){var e,r=n;if(r&&k()){var o=document.elementFromPoint(r.x,r.y);o&&(e=E(o))}!function(e){var n;if(t!==e){l();var r=i.get(e);r&&(r.preventClean=!0,null===(n=r.highlight)||void 0===n||n.call(r),t=e)}}(e)}var s=function(e){var t;k()&&(t=e.target,!Boolean(x(t,(function(e){return e.id===f}))))&&(e.stopPropagation(),e.preventDefault())},d=function(e){var t;t={x:e.clientX,y:e.clientY},n=t,c()},v=function(){u=new Set,c()},h=function(e){var t=p[e.key];void 0!==t&&u.add(t),c()},g=function(e){u.delete(p[e.key]),c()},y=function(){var e,n=i.get(t);null===(e=null==n?void 0:n.highlight)||void 0===e||e.call(n)},m=function(e){if(s(e),k()){var n=E(e.target);n&&n===t&&(a(e,n),l())}};function E(e){return x(e,(function(e){return i.get(e)}))}function x(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?x(e.parentElement,t):void 0}function k(){var e,t;try{for(var n=r(o),i=n.next();!i.done;i=n.next()){var a=i.value;if(!u.has(a))return!1}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return!0}return Object.freeze({run:function(){window.addEventListener("blur",v,w),window.addEventListener("keydown",h,w),window.addEventListener("keyup",g,w),window.addEventListener("mousemove",d,b),window.addEventListener("scroll",y,b),window.addEventListener("click",m,w),window.addEventListener("mouseenter",s,w),window.addEventListener("mouseover",s,w),window.addEventListener("mouseout",s,w),window.addEventListener("mouseleave",s,w),window.addEventListener("mousedown",s,w),window.addEventListener("mouseup",s,w)},stop:function(){window.removeEventListener("blur",v,w),window.removeEventListener("keydown",h,w),window.removeEventListener("keyup",g,w),window.removeEventListener("mousemove",d,b),window.removeEventListener("scroll",y,b),window.removeEventListener("click",m,w),window.removeEventListener("mouseenter",s,w),window.removeEventListener("mouseover",s,w),window.removeEventListener("mouseout",s,w),window.removeEventListener("mouseleave",s,w),window.removeEventListener("mousedown",s,w),window.removeEventListener("mouseup",s,w)}})},x=function(e,t){var c,f=(c=new Map,Object.freeze({set:function(e,t){c.set(e,t)},get:function(e){return e&&c.get(e)},remove:function(e){return c.delete(e)},forEachElement:function(e){c.forEach((function(t,n){return e(n,t)}))}})),s=v({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),d=E({highlightKeys:e.highlightKeys,elementStore:f,onClick:function(e,n){var r=f.get(n);t(e,{el:n,meta:r,keysAndDefaults:h(r)})}});function h(e){return function(e){return Array.from(e.nodes.values()).reduce((function(e,t){return i(i([],o(e),!1),o(t.keys.map((function(e){return{key:e.key,defaultValue:e.defaultValue,ns:e.ns}}))),!1)}),[])}(e)}return Object.freeze({register:function(t,n,r){if(!function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest("[".concat(u,"]"))}(t)){var o=t,i=f.get(o);i||(i={nodes:new Map},f.set(o,i),o.setAttribute(l,"true")),i.nodes.set(n,r),s.initHighlighter(o,i)}},forEachElement:f.forEachElement,findAll:function(e,t){var n=[];return f.forEachElement((function(o,i){var u,l;try{for(var c=r(i.nodes.values()),f=c.next();!f.done;f=c.next()){if(f.value.keys.find((function(n){return m({key:e,ns:a(t)},{key:n.key,ns:a(n.ns)})}))){n.push(i);break}}}catch(e){u={error:e}}finally{try{f&&!f.done&&(l=c.return)&&l.call(c)}finally{if(u)throw u.error}}})),n},refreshAll:function(){f.forEachElement((function(t,i){i.preventClean||(function(t){t.nodes=new Map(function(t){var i,a,u,l,c,f,s,d;return n(this,(function(n){switch(n.label){case 0:n.trys.push([0,5,6,7]),i=r(t.nodes.entries()),a=i.next(),n.label=1;case 1:return a.done?[3,4]:(u=o(a.value,2),l=u[0],c=u[1],function(e,t){if(e.contains(t))return!0;if(t instanceof Attr){var n=t.ownerElement&&Object.values(t.ownerElement.attributes).indexOf(t)>-1;if(e.contains(t.ownerElement)&&n)return!0}return!1}(e.targetElement||document.body,l)?[4,[l,c]]:[3,3]);case 2:n.sent(),n.label=3;case 3:return a=i.next(),[3,1];case 4:return[3,7];case 5:return f=n.sent(),s={error:f},[3,7];case 6:try{a&&!a.done&&(d=i.return)&&d.call(i)}finally{if(s)throw s.error}return[7];case 7:return[2]}}))}(t))}(i),0===i.nodes.size&&function(e,t){var n;t.highlightEl&&(null===(n=t.unhighlight)||void 0===n||n.call(t));e.removeAttribute(l),f.remove(e)}(t,i))}))},run:function(e){e&&d.run()},stop:function(){d.stop()}})},k=function(e,t,n){var a=!1,u=function(e){return Object.freeze({getSuitableParent:function t(n){var r=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(n);if(void 0===r)throw console.error(n),new Error("No suitable parent found for node above.");return e.passToParent?Array.isArray(e.passToParent)&&-1===e.passToParent.findIndex((function(e){return r.tagName.toLowerCase()===e.toLowerCase()}))?r:"function"!=typeof e.passToParent||e.passToParent(r)?t(r):r:r}})}(t),l=function(e,t){var n=function(e){return h(t.getTextXPath(),e)},a=function(n){var a,u,l,c,f=[];try{for(var s=r(Object.entries(e.tagAttributes)),d=s.next();!d.done;d=s.next()){var v=o(d.value,2),g=v[0],y=v[1];try{for(var p=(l=void 0,r(y)),m=p.next();!m.done;m=p.next()){var w=m.value,b=h(t.getAttributeXPath({tag:g,attribute:w}),n);f=i(i([],o(f),!1),o(b),!1)}}catch(e){l={error:e}}finally{try{m&&!m.done&&(c=p.return)&&c.call(p)}finally{if(l)throw l.error}}}}catch(e){a={error:e}}finally{try{d&&!d.done&&(u=s.return)&&u.call(s)}finally{if(a)throw a.error}}return f};return Object.freeze({handleAttributes:a,handleChildList:function(e){var t=[];return(t=t.concat(a(e))).concat(n(e))},handleText:n})}(t,e),f=x(t,n);function d(t){var n,o;try{for(var i=r(t),a=i.next();!a.done;a=i.next()){var l=a.value,c=g(l),d=c?e.unwrap(c):null;if(d){var v=d.text,h=d.keys;y(l,v);var p=s(c,h),m=u.getSuitableParent(l);f.register(m,l,p)}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}}var v,p=function(e){h("./descendant-or-self::*[@".concat(c,"]"),e).forEach((function(e){var t=e.getAttributeNode(c),n=u.getSuitableParent(t);f.register(n,t,{oldTextContent:"",keys:[{key:g(t)}],keyAttributeOnly:!0})}))};return Object.freeze({run:function(e){var n=e.mouseHighlight;v||(v=new MutationObserver((function(e){var t,n;if(a)try{for(var o=r(e),i=o.next();!i.done;i=o.next()){var u=i.value,c=[];switch(u.type){case"characterData":c=l.handleText(u.target);break;case"childList":p(u.target),c=l.handleChildList(u.target);break;case"attributes":p(u.target),c=l.handleAttributes(u.target)}d(c),f.refreshAll()}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}})));var o=t.targetElement||document.body;a=!0,f.run(n),p(o),d(l.handleChildList(o)),v.observe(t.targetElement||document.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0})},stop:function(){a=!1,f.stop(),v.disconnect()},wrap:e.wrap,unwrap:e.unwrap,forEachElement:f.forEachElement,highlight:function(e,t){var n=f.findAll(e,t);return n.forEach((function(e){var t;return null===(t=e.highlight)||void 0===t?void 0:t.call(e)})),{unhighlight:function(){n.forEach((function(e){var t;return null===(t=e.unhighlight)||void 0===t?void 0:t.call(e)}))}}}})},A={tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:[p.Alt],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"]};function L(){}function C(){}L.prototype.encode=function(e){for(var t=[],n=e.length,r=0;r<n;){var o=e.codePointAt(r),i=0,a=0;for(o<=127?(i=0,a=0):o<=2047?(i=6,a=192):o<=65535?(i=12,a=224):o<=2097151&&(i=18,a=240),t.push(a|o>>i),i-=6;i>=0;)t.push(128|o>>i&63),i-=6;r+=o>=65536?2:1}return t},C.prototype.decode=function(e){for(var t="",n=0;n<e.length;){var r=e[n],o=0,i=0;if(r<=127?(o=0,i=255&r):r<=223?(o=1,i=31&r):r<=239?(o=2,i=15&r):r<=244&&(o=3,i=7&r),e.length-n-o>0)for(var a=0;a<o;)i=i<<6|63&(r=e[n+a+1]),a+=1;else i=65533,o=e.length-n;t+=String.fromCodePoint(i),n+=o+1}return t};var O="undefined"==typeof TextEncoder?L:TextEncoder,S="undefined"==typeof TextDecoder?C:TextDecoder,T=["‌","‍"],P=RegExp("([".concat(T.join(""),"]{9})+"),"gu"),j=function(e){var t=function(e){return Array.from((new O).encode(e))}(e).map(Number),n=t.map((function(e){return function(e){var t=8-e.length;return"0".repeat(t)+e}(e.toString(2))+"0"})).join("");return Array.from(n).map((function(e){return T[Number(e)]})).join("")},N=function(e){var t,n=Array.from(e).map((function(e){return T.indexOf(e)})).map(String).join("").match(/(.{9})/g),r=Uint8Array.from((null==n?void 0:n.map((function(e){return parseInt(e.slice(0,8),2)})))||[]);return t=r,(new S).decode(new Uint8Array(t))},z=function(){var e,t=(e=[],Object.freeze({valueToNumber:function(t){var n=e.indexOf(t);return-1===n&&(n=e.length,e.push(t)),n},numberToValue:function(t){return e[t]}})),n=function(e){return JSON.parse(e)};return Object.freeze({unwrap:function(e){var i=[],a=function(e){var t,n=null===(t=e.match(P))||void 0===t?void 0:t.filter((function(e){return e.length>8}));return(null==n?void 0:n.map(N))||[]}(e);a.forEach((function(e){var a=o(function(e){var t,n,o=[];try{for(var i=r(e),a=i.next();!a.done;a=i.next()){var u=a.value;o.push(u.codePointAt(0))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}(e),1),u=a[0],l=t.numberToValue(u),c=n(l),f=c.k,s=c.d,d=c.n;i.push({key:f,defaultValue:s,ns:d})}));var u=function(e){return e.replace(P,"")}(e);return{text:u,keys:i}},wrap:function(e){var n=e.key,r=e.defaultValue,o=e.translation,i=function(e){var t={k:e.key,n:e.ns,d:e.defaultValue};return JSON.stringify(t)}({key:n,ns:e.ns,defaultValue:r}),a=t.valueToNumber(i),u=o||"",l=j(String.fromCodePoint(a));return"string"==typeof u?u+l:u},getTextXPath:function(){return"./descendant-or-self::text()[contains(., '".concat(T[0]).concat(T[0],"') or contains(., '").concat(T[1]).concat(T[0],"')]")},getAttributeXPath:function(e){var t=e.tag,n=e.attribute;return"descendant-or-self::".concat(t,"/@").concat(n,"[contains(., '").concat(T[0]).concat(T[0],"') or contains(., '").concat(T[1]).concat(T[0],"')]")}})},_=function(e){return function(n){var r=n.onClick,o=function(e){return t(t({},A),e)}(e),i=z(),a=k(i,o,r);return t(t({},a),{retranslate:function(){},outputNotFormattable:!1})}};e.InvisibleObserver=function(e){return function(t,n){return n.setObserver(_(e)),t}},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/invisible-observer"]={})}(this,(function(e){"use strict";var t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)};function n(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function r(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function i(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function a(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}const u="data-tolgee-restricted",l="_tolgee",c="data-tolgee-key-only",f="__tolgee_dev_tools";function s(e,t){return{oldTextContent:e,keys:t}}var d={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"},v=function(e){var t=e.highlightColor,n=e.highlightWidth;return Object.freeze({initHighlighter:function(e,r){!function(e,r){r.highlight=function(){if(e.isConnected){var i=r.highlightEl;i||((i=document.createElement("div")).classList.add("_tolgee-highlighter"),Object.entries(d).forEach((function(e){var t=o(e,2),n=t[0],r=t[1];i.style[n]=r})),i.style.borderColor=t,r.highlightEl=i,document.body.appendChild(i));var a=e.getBoundingClientRect();i.style.borderWidth=n+"px",i.style.top=a.top-n+"px",i.style.left=a.left-n+"px",i.style.width=a.width+"px",i.style.height=a.height+"px"}}}(e,r),function(e,t){t.unhighlight=function(){var e;null===(e=t.highlightEl)||void 0===e||e.remove(),t.highlightEl=void 0}}(0,r)}})};function h(e,t){for(var n,r,o=null===document||void 0===document?void 0:document.evaluate(e,t,void 0,XPathResult.ANY_TYPE),i=[];r=null===(n=null==o?void 0:o.iterateNext)||void 0===n?void 0:n.call(o);)i.push(r);return i}function y(e){return e.textContent}function g(e,t){e.textContent=t}var p=function(e,t){var n,r=void 0===e.key||void 0===t.key||t.key===e.key,o=void 0===e.ns||void 0===t.ns||-1!==(null===(n=e.ns)||void 0===n?void 0:n.findIndex((function(e){var n;return null===(n=t.ns)||void 0===n?void 0:n.includes(e)})));return r&&o},m={capture:!0},w={capture:!0,passive:!0},b=function(e){var t,n,o=e.highlightKeys,i=e.elementStore,a=e.onClick,u=new Set,l=function(){var e,n=i.get(t);n&&(n.preventClean=!1,null===(e=n.unhighlight)||void 0===e||e.call(n),t=void 0)};function c(){var e,r=n;if(r&&x()){var o=document.elementFromPoint(r.x,r.y);o&&(e=b(o))}!function(e){var n;if(t!==e){l();var r=i.get(e);r&&(r.preventClean=!0,null===(n=r.highlight)||void 0===n||n.call(r),t=e)}}(e)}var s=function(e){var t;x()&&(t=e.target,!Boolean(E(t,(function(e){return e.id===f}))))&&(e.stopPropagation(),e.preventDefault())},d=function(e){var t;t={x:e.clientX,y:e.clientY},n=t,c()},v=function(){u=new Set,c()},h=function(e){var t=e.key;void 0!==t&&u.add(t),c()},y=function(e){u.delete(e.key),c()},g=function(){var e,n=i.get(t);null===(e=null==n?void 0:n.highlight)||void 0===e||e.call(n)},p=function(e){if(s(e),x()){var n=b(e.target);n&&n===t&&(a(e,n),l())}};function b(e){return E(e,(function(e){return i.get(e)}))}function E(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?E(e.parentElement,t):void 0}function x(){var e,t;try{for(var n=r(o),i=n.next();!i.done;i=n.next()){var a=i.value;if(!u.has(a))return!1}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return!0}return Object.freeze({run:function(){window.addEventListener("blur",v,m),window.addEventListener("keydown",h,m),window.addEventListener("keyup",y,m),window.addEventListener("mousemove",d,w),window.addEventListener("scroll",g,w),window.addEventListener("click",p,m),window.addEventListener("mouseenter",s,m),window.addEventListener("mouseover",s,m),window.addEventListener("mouseout",s,m),window.addEventListener("mouseleave",s,m),window.addEventListener("mousedown",s,m),window.addEventListener("mouseup",s,m)},stop:function(){window.removeEventListener("blur",v,m),window.removeEventListener("keydown",h,m),window.removeEventListener("keyup",y,m),window.removeEventListener("mousemove",d,w),window.removeEventListener("scroll",g,w),window.removeEventListener("click",p,m),window.removeEventListener("mouseenter",s,m),window.removeEventListener("mouseover",s,m),window.removeEventListener("mouseout",s,m),window.removeEventListener("mouseleave",s,m),window.removeEventListener("mousedown",s,m),window.removeEventListener("mouseup",s,m)}})},E=function(e,t){var c,f=(c=new Map,Object.freeze({set:function(e,t){c.set(e,t)},get:function(e){return e&&c.get(e)},remove:function(e){return c.delete(e)},forEachElement:function(e){c.forEach((function(t,n){return e(n,t)}))}})),s=v({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),d=b({highlightKeys:e.highlightKeys,elementStore:f,onClick:function(e,n){var r=f.get(n);t(e,{el:n,meta:r,keysAndDefaults:h(r)})}});function h(e){return function(e){return Array.from(e.nodes.values()).reduce((function(e,t){return i(i([],o(e),!1),o(t.keys.map((function(e){return{key:e.key,defaultValue:e.defaultValue,ns:e.ns}}))),!1)}),[])}(e)}return Object.freeze({register:function(t,n,r){if(!function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest("[".concat(u,"]"))}(t)){var o=t,i=f.get(o);i||(i={nodes:new Map},f.set(o,i),o.setAttribute(l,"true")),i.nodes.set(n,r),s.initHighlighter(o,i)}},forEachElement:f.forEachElement,findAll:function(e,t){var n=[];return f.forEachElement((function(o,i){var u,l;try{for(var c=r(i.nodes.values()),f=c.next();!f.done;f=c.next()){if(f.value.keys.find((function(n){return p({key:e,ns:a(t)},{key:n.key,ns:a(n.ns)})}))){n.push(i);break}}}catch(e){u={error:e}}finally{try{f&&!f.done&&(l=c.return)&&l.call(c)}finally{if(u)throw u.error}}})),n},refreshAll:function(){f.forEachElement((function(t,i){i.preventClean||(function(t){t.nodes=new Map(function(t){var i,a,u,l,c,f,s,d;return n(this,(function(n){switch(n.label){case 0:n.trys.push([0,5,6,7]),i=r(t.nodes.entries()),a=i.next(),n.label=1;case 1:return a.done?[3,4]:(u=o(a.value,2),l=u[0],c=u[1],function(e,t){if(e.contains(t))return!0;if(t instanceof Attr){var n=t.ownerElement&&Object.values(t.ownerElement.attributes).indexOf(t)>-1;if(e.contains(t.ownerElement)&&n)return!0}return!1}(e.targetElement||document.body,l)?[4,[l,c]]:[3,3]);case 2:n.sent(),n.label=3;case 3:return a=i.next(),[3,1];case 4:return[3,7];case 5:return f=n.sent(),s={error:f},[3,7];case 6:try{a&&!a.done&&(d=i.return)&&d.call(i)}finally{if(s)throw s.error}return[7];case 7:return[2]}}))}(t))}(i),0===i.nodes.size&&function(e,t){var n;t.highlightEl&&(null===(n=t.unhighlight)||void 0===n||n.call(t));e.removeAttribute(l),f.remove(e)}(t,i))}))},run:function(e){e&&d.run()},stop:function(){d.stop()}})},x=function(e,t,n){var a=!1,u=function(e){return Object.freeze({getSuitableParent:function t(n){var r=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(n);if(void 0===r)throw console.error(n),new Error("No suitable parent found for node above.");return e.passToParent?Array.isArray(e.passToParent)&&-1===e.passToParent.findIndex((function(e){return r.tagName.toLowerCase()===e.toLowerCase()}))?r:"function"!=typeof e.passToParent||e.passToParent(r)?t(r):r:r}})}(t),l=function(e,t){var n=function(e){return h(t.getTextXPath(),e)},a=function(n){var a,u,l,c,f=[];try{for(var s=r(Object.entries(e.tagAttributes)),d=s.next();!d.done;d=s.next()){var v=o(d.value,2),y=v[0],g=v[1];try{for(var p=(l=void 0,r(g)),m=p.next();!m.done;m=p.next()){var w=m.value,b=h(t.getAttributeXPath({tag:y,attribute:w}),n);f=i(i([],o(f),!1),o(b),!1)}}catch(e){l={error:e}}finally{try{m&&!m.done&&(c=p.return)&&c.call(p)}finally{if(l)throw l.error}}}}catch(e){a={error:e}}finally{try{d&&!d.done&&(u=s.return)&&u.call(s)}finally{if(a)throw a.error}}return f};return Object.freeze({handleAttributes:a,handleChildList:function(e){var t=[];return(t=t.concat(a(e))).concat(n(e))},handleText:n})}(t,e),f=E(t,n);function d(t){var n,o;try{for(var i=r(t),a=i.next();!a.done;a=i.next()){var l=a.value,c=y(l),d=c?e.unwrap(c):null;if(d){var v=d.text,h=d.keys;g(l,v);var p=s(c,h),m=u.getSuitableParent(l);f.register(m,l,p)}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}}var v,p=function(e){h("./descendant-or-self::*[@".concat(c,"]"),e).forEach((function(e){var t=e.getAttributeNode(c),n=u.getSuitableParent(t);f.register(n,t,{oldTextContent:"",keys:[{key:y(t)}],keyAttributeOnly:!0})}))};return Object.freeze({run:function(e){var n=e.mouseHighlight;v||(v=new MutationObserver((function(e){var t,n;if(a)try{for(var o=r(e),i=o.next();!i.done;i=o.next()){var u=i.value,c=[];switch(u.type){case"characterData":c=l.handleText(u.target);break;case"childList":p(u.target),c=l.handleChildList(u.target);break;case"attributes":p(u.target),c=l.handleAttributes(u.target)}d(c),f.refreshAll()}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}})));var o=t.targetElement||document.body;a=!0,f.run(n),p(o),d(l.handleChildList(o)),v.observe(t.targetElement||document.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0})},stop:function(){a=!1,f.stop(),v.disconnect()},wrap:e.wrap,unwrap:e.unwrap,forEachElement:f.forEachElement,highlight:function(e,t){var n=f.findAll(e,t);return n.forEach((function(e){var t;return null===(t=e.highlight)||void 0===t?void 0:t.call(e)})),{unhighlight:function(){n.forEach((function(e){var t;return null===(t=e.unhighlight)||void 0===t?void 0:t.call(e)}))}}}})};function k(){}function L(){}k.prototype.encode=function(e){for(var t=[],n=e.length,r=0;r<n;){var o=e.codePointAt(r),i=0,a=0;for(o<=127?(i=0,a=0):o<=2047?(i=6,a=192):o<=65535?(i=12,a=224):o<=2097151&&(i=18,a=240),t.push(a|o>>i),i-=6;i>=0;)t.push(128|o>>i&63),i-=6;r+=o>=65536?2:1}return t},L.prototype.decode=function(e){for(var t="",n=0;n<e.length;){var r=e[n],o=0,i=0;if(r<=127?(o=0,i=255&r):r<=223?(o=1,i=31&r):r<=239?(o=2,i=15&r):r<=244&&(o=3,i=7&r),e.length-n-o>0)for(var a=0;a<o;)i=i<<6|63&(r=e[n+a+1]),a+=1;else i=65533,o=e.length-n;t+=String.fromCodePoint(i),n+=o+1}return t};var A="undefined"==typeof TextEncoder?k:TextEncoder,O="undefined"==typeof TextDecoder?L:TextDecoder,C=["‌","‍"],T=RegExp("([".concat(C.join(""),"]{9})+"),"gu"),S=function(e){var t=function(e){return Array.from((new A).encode(e))}(e).map(Number),n=t.map((function(e){return function(e){var t=8-e.length;return"0".repeat(t)+e}(e.toString(2))+"0"})).join("");return Array.from(n).map((function(e){return C[Number(e)]})).join("")},P=function(e){var t,n=Array.from(e).map((function(e){return C.indexOf(e)})).map(String).join("").match(/(.{9})/g),r=Uint8Array.from((null==n?void 0:n.map((function(e){return parseInt(e.slice(0,8),2)})))||[]);return t=r,(new O).decode(new Uint8Array(t))},j=function(){var e,t=(e=[],Object.freeze({valueToNumber:function(t){var n=e.indexOf(t);return-1===n&&(n=e.length,e.push(t)),n},numberToValue:function(t){return e[t]}})),n=function(e){return JSON.parse(e)};return Object.freeze({unwrap:function(e){var i=[],a=function(e){var t,n=null===(t=e.match(T))||void 0===t?void 0:t.filter((function(e){return e.length>8}));return(null==n?void 0:n.map(P))||[]}(e);a.forEach((function(e){var a=o(function(e){var t,n,o=[];try{for(var i=r(e),a=i.next();!a.done;a=i.next()){var u=a.value;o.push(u.codePointAt(0))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}(e),1),u=a[0],l=t.numberToValue(u),c=n(l),f=c.k,s=c.d,d=c.n;i.push({key:f,defaultValue:s,ns:d})}));var u=function(e){return e.replace(T,"")}(e);return{text:u,keys:i}},wrap:function(e){var n=e.key,r=e.defaultValue,o=e.translation,i=function(e){var t={k:e.key,n:e.ns,d:e.defaultValue};return JSON.stringify(t)}({key:n,ns:e.ns,defaultValue:r}),a=t.valueToNumber(i),u=o||"",l=S(String.fromCodePoint(a));return"string"==typeof u?u+l:u},getTextXPath:function(){return"./descendant-or-self::text()[contains(., '".concat(C[0]).concat(C[0],"') or contains(., '").concat(C[1]).concat(C[0],"')]")},getAttributeXPath:function(e){var t=e.tag,n=e.attribute;return"descendant-or-self::".concat(t,"/@").concat(n,"[contains(., '").concat(C[0]).concat(C[0],"') or contains(., '").concat(C[1]).concat(C[0],"')]")}})};e.InvisibleObserver=function(){return function(e,n){return n.setObserver((function(e){var n=e.onClick,r=e.options,o=j(),i=x(o,r,n);return t(t({},i),{retranslate:function(){},outputNotFormattable:!1})})),e}},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=tolgee-invisible-observer.umd.min.js.map

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)};function t(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function n(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function o(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function i(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function a(e,t){return{oldTextContent:e,keys:t}}var l={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"},u=function(e){var t=e.highlightColor,n=e.highlightWidth;return Object.freeze({initHighlighter:function(e,o){!function(e,o){o.highlight=function(){if(e.isConnected){var i=o.highlightEl;i||((i=document.createElement("div")).classList.add("_tolgee-highlighter"),Object.entries(l).forEach((function(e){var t=r(e,2),n=t[0],o=t[1];i.style[n]=o})),i.style.borderColor=t,o.highlightEl=i,document.body.appendChild(i));var a=e.getBoundingClientRect();i.style.borderWidth=n+"px",i.style.top=a.top-n+"px",i.style.left=a.left-n+"px",i.style.width=a.width+"px",i.style.height=a.height+"px"}}}(e,o),function(e,t){t.unhighlight=function(){var e;null===(e=t.highlightEl)||void 0===e||e.remove(),t.highlightEl=void 0}}(0,o)}})};function c(e,t){for(var n,r,o=null===document||void 0===document?void 0:document.evaluate(e,t,void 0,XPathResult.ANY_TYPE),i=[];r=null===(n=null==o?void 0:o.iterateNext)||void 0===n?void 0:n.call(o);)i.push(r);return i}function f(e){return e.textContent}function s(e,t){e.textContent=t}var d,v=function(e,t){var n,r=void 0===e.key||void 0===t.key||t.key===e.key,o=void 0===e.ns||void 0===t.ns||-1!==(null===(n=e.ns)||void 0===n?void 0:n.findIndex((function(e){var n;return null===(n=t.ns)||void 0===n?void 0:n.includes(e)})));return r&&o};!function(e){e[e.Alt=0]="Alt",e[e.Control=1]="Control",e[e.Shift=2]="Shift",e[e.Meta=3]="Meta"}(d||(d={}));var h={capture:!0},y={capture:!0,passive:!0},p=function(e){var t,r,o=e.highlightKeys,i=e.elementStore,a=e.onClick,l=new Set,u=function(){var e,n=i.get(t);n&&(n.preventClean=!1,null===(e=n.unhighlight)||void 0===e||e.call(n),t=void 0)};function c(){var e,n=r;if(n&&x()){var o=document.elementFromPoint(n.x,n.y);o&&(e=m(o))}!function(e){var n;if(t!==e){u();var r=i.get(e);r&&(r.preventClean=!0,null===(n=r.highlight)||void 0===n||n.call(r),t=e)}}(e)}var f=function(e){var t;x()&&(t=e.target,!Boolean(b(t,(function(e){return"__tolgee_dev_tools"===e.id}))))&&(e.stopPropagation(),e.preventDefault())},s=function(e){var t;t={x:e.clientX,y:e.clientY},r=t,c()},v=function(){l=new Set,c()},p=function(e){var t=d[e.key];void 0!==t&&l.add(t),c()},g=function(e){l.delete(d[e.key]),c()},w=function(){var e,n=i.get(t);null===(e=null==n?void 0:n.highlight)||void 0===e||e.call(n)},E=function(e){if(f(e),x()){var n=m(e.target);n&&n===t&&(a(e,n),u())}};function m(e){return b(e,(function(e){return i.get(e)}))}function b(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?b(e.parentElement,t):void 0}function x(){var e,t;try{for(var r=n(o),i=r.next();!i.done;i=r.next()){var a=i.value;if(!l.has(a))return!1}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return!0}return Object.freeze({run:function(){window.addEventListener("blur",v,h),window.addEventListener("keydown",p,h),window.addEventListener("keyup",g,h),window.addEventListener("mousemove",s,y),window.addEventListener("scroll",w,y),window.addEventListener("click",E,h),window.addEventListener("mouseenter",f,h),window.addEventListener("mouseover",f,h),window.addEventListener("mouseout",f,h),window.addEventListener("mouseleave",f,h),window.addEventListener("mousedown",f,h),window.addEventListener("mouseup",f,h)},stop:function(){window.removeEventListener("blur",v,h),window.removeEventListener("keydown",p,h),window.removeEventListener("keyup",g,h),window.removeEventListener("mousemove",s,y),window.removeEventListener("scroll",w,y),window.removeEventListener("click",E,h),window.removeEventListener("mouseenter",f,h),window.removeEventListener("mouseover",f,h),window.removeEventListener("mouseout",f,h),window.removeEventListener("mouseleave",f,h),window.removeEventListener("mousedown",f,h),window.removeEventListener("mouseup",f,h)}})},g=function(e,a){var l,c=(l=new Map,Object.freeze({set:function(e,t){l.set(e,t)},get:function(e){return e&&l.get(e)},remove:function(e){return l.delete(e)},forEachElement:function(e){l.forEach((function(t,n){return e(n,t)}))}})),f=u({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),s=p({highlightKeys:e.highlightKeys,elementStore:c,onClick:function(e,t){var n=c.get(t);a(e,{el:t,meta:n,keysAndDefaults:d(n)})}});function d(e){return function(e){return Array.from(e.nodes.values()).reduce((function(e,t){return o(o([],r(e),!1),r(t.keys.map((function(e){return{key:e.key,defaultValue:e.defaultValue,ns:e.ns}}))),!1)}),[])}(e)}return Object.freeze({register:function(t,n,r){if(!function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest("[".concat("data-tolgee-restricted","]"))}(t)){var o=t,i=c.get(o);i||(i={nodes:new Map},c.set(o,i),o.setAttribute("_tolgee","true")),i.nodes.set(n,r),f.initHighlighter(o,i)}},forEachElement:c.forEachElement,findAll:function(e,t){var r=[];return c.forEachElement((function(o,a){var l,u;try{for(var c=n(a.nodes.values()),f=c.next();!f.done;f=c.next()){if(f.value.keys.find((function(n){return v({key:e,ns:i(t)},{key:n.key,ns:i(n.ns)})}))){r.push(a);break}}}catch(e){l={error:e}}finally{try{f&&!f.done&&(u=c.return)&&u.call(c)}finally{if(l)throw l.error}}})),r},refreshAll:function(){c.forEachElement((function(o,i){i.preventClean||(function(o){o.nodes=new Map(function(o){var i,a,l,u,c,f,s,d;return t(this,(function(t){switch(t.label){case 0:t.trys.push([0,5,6,7]),i=n(o.nodes.entries()),a=i.next(),t.label=1;case 1:return a.done?[3,4]:(l=r(a.value,2),u=l[0],c=l[1],function(e,t){if(e.contains(t))return!0;if(t instanceof Attr){var n=t.ownerElement&&Object.values(t.ownerElement.attributes).indexOf(t)>-1;if(e.contains(t.ownerElement)&&n)return!0}return!1}(e.targetElement||document.body,u)?[4,[u,c]]:[3,3]);case 2:t.sent(),t.label=3;case 3:return a=i.next(),[3,1];case 4:return[3,7];case 5:return f=t.sent(),s={error:f},[3,7];case 6:try{a&&!a.done&&(d=i.return)&&d.call(i)}finally{if(s)throw s.error}return[7];case 7:return[2]}}))}(o))}(i),0===i.nodes.size&&function(e,t){var n;t.highlightEl&&(null===(n=t.unhighlight)||void 0===n||n.call(t));e.removeAttribute("_tolgee"),c.remove(e)}(o,i))}))},run:function(e){e&&s.run()},stop:function(){s.stop()}})},w=function(e,t,i){var l=!1,u=function(e){return Object.freeze({getSuitableParent:function t(n){var r=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(n);if(void 0===r)throw console.error(n),new Error("No suitable parent found for node above.");return e.passToParent?Array.isArray(e.passToParent)&&-1===e.passToParent.findIndex((function(e){return r.tagName.toLowerCase()===e.toLowerCase()}))?r:"function"!=typeof e.passToParent||e.passToParent(r)?t(r):r:r}})}(t),d=function(e,t){var i=function(e){return c(t.getTextXPath(),e)},a=function(i){var a,l,u,f,s=[];try{for(var d=n(Object.entries(e.tagAttributes)),v=d.next();!v.done;v=d.next()){var h=r(v.value,2),y=h[0],p=h[1];try{for(var g=(u=void 0,n(p)),w=g.next();!w.done;w=g.next()){var E=w.value,m=c(t.getAttributeXPath({tag:y,attribute:E}),i);s=o(o([],r(s),!1),r(m),!1)}}catch(e){u={error:e}}finally{try{w&&!w.done&&(f=g.return)&&f.call(g)}finally{if(u)throw u.error}}}}catch(e){a={error:e}}finally{try{v&&!v.done&&(l=d.return)&&l.call(d)}finally{if(a)throw a.error}}return s};return Object.freeze({handleAttributes:a,handleChildList:function(e){var t=[];return(t=t.concat(a(e))).concat(i(e))},handleText:i})}(t,e),v=g(t,i);function h(t){var r,o;try{for(var i=n(t),l=i.next();!l.done;l=i.next()){var c=l.value,d=f(c),h=d?e.unwrap(d):null;if(h){var y=h.text,p=h.keys;s(c,y);var g=a(d,p),w=u.getSuitableParent(c);v.register(w,c,g)}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}var y,p=function(e){c("./descendant-or-self::*[@".concat("data-tolgee-key-only","]"),e).forEach((function(e){var t=e.getAttributeNode("data-tolgee-key-only"),n=u.getSuitableParent(t);v.register(n,t,{oldTextContent:"",keys:[{key:f(t)}],keyAttributeOnly:!0})}))};return Object.freeze({run:function(e){var r=e.mouseHighlight;y||(y=new MutationObserver((function(e){var t,r;if(l)try{for(var o=n(e),i=o.next();!i.done;i=o.next()){var a=i.value,u=[];switch(a.type){case"characterData":u=d.handleText(a.target);break;case"childList":p(a.target),u=d.handleChildList(a.target);break;case"attributes":p(a.target),u=d.handleAttributes(a.target)}h(u),v.refreshAll()}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}})));var o=t.targetElement||document.body;l=!0,v.run(r),p(o),h(d.handleChildList(o)),y.observe(t.targetElement||document.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0})},stop:function(){l=!1,v.stop(),y.disconnect()},wrap:e.wrap,unwrap:e.unwrap,forEachElement:v.forEachElement,highlight:function(e,t){var n=v.findAll(e,t);return n.forEach((function(e){var t;return null===(t=e.highlight)||void 0===t?void 0:t.call(e)})),{unhighlight:function(){n.forEach((function(e){var t;return null===(t=e.unhighlight)||void 0===t?void 0:t.call(e)}))}}}})},E={tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:[d.Alt],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"]};function m(e,t){for(var n=0;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}var b=function(e){var t=e.inputPrefix,o=e.inputSuffix,i=e.translate;function a(e){var t=function(e){var t,r,o=!1,i="",a="",l="KEY",u={key:"",ns:void 0,params:{},defaultValue:void 0},c=function(e){u.ns||(u.ns=[]),u.ns.push(e)};try{for(var f=n(e),s=f.next();!s.done;s=f.next()){var d=s.value;"\\"!==d||o?o?(o=!1,i+=d):"KEY"!==l||","!==d?"KEY"!==l||"|"!==d?"NAMESPACE"!==l||"|"!==d?"NAMESPACE"!==l||","!==d?"KEY"!==l||":"!==d?"DEFAULT_VALUE"!==l||":"!==d?"PARAM_NAME"!==l||":"!==d?"PARAM_VALUE"!==l||","!==d?i+=d:(l="PARAM_NAME",u.params[a]=i,i=""):(l="PARAM_VALUE",a=i,i=""):(l="PARAM_NAME",u.defaultValue=i,i=""):(l="PARAM_NAME",u.key=i,i=""):(l="DEFAULT_VALUE",c(i),i=""):(l="NAMESPACE",c(i),i=""):(l="NAMESPACE",u.key=i,i=""):(l="DEFAULT_VALUE",u.key=i,i=""):o=!0}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=f.return)&&r.call(f)}finally{if(t)throw t.error}}return"KEY"===l&&(u.key=i),"DEFAULT_VALUE"===l&&(u.defaultValue=i),"PARAM_VALUE"===l&&(u.params[a]=i),"NAMESPACE"===l&&c(i),u}(e),r=t.key,o=t.params,a=t.defaultValue,l=t.ns;return{translated:i({key:r,params:o,defaultValue:a,ns:l,noWrap:!0}),key:r,params:o,defaultValue:a}}var l=function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},u=function(e){return"string"==typeof e?e.replace(/[,:|\\]/gs,"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn('Parameters of type "'.concat(typeof e,'" are not supported in "text" wrapper mode.')),e)};return Object.freeze({wrap:function(e){var n=e.key,i=e.params,a=e.defaultValue,l=e.ns,c=Object.entries(i||{}).map((function(e){var t=r(e,2),n=t[0],o=t[1];return"".concat(u(n),":").concat(u(o))})).join(",");c=c.length?":".concat(c):"";var f=void 0!==a?",".concat(u(a)):"",s="string"==typeof l?[l]:l,d=(null==s?void 0:s.length)?"|".concat(s.map((function(e){return u(e)})).join("|")):"";return"".concat(t).concat(u(n)).concat(d).concat(f).concat(c).concat(o)},unwrap:function(e){for(var n,i,u,c=new RegExp((n=l(t),i=l(o),"(\\\\?)(".concat(n,"(.*?)").concat(i,")")),"gs"),f=[],s=!1,d=0,v="";null!==(u=c.exec(e));){var h=u[1],y=r(u,4),p=y[0];y[1];var g=y[2],w=y[3],E=u.index;if(v+=u.input.substr(d,E-d),d=E+p.length,"\\"===h){if(!m(E,e)){v+=g;continue}h=""}var b=a(w);f.push({key:b.key,params:b.params,defaultValue:b.defaultValue}),s=!0,v+=h+b.translated}return v+=e.substring(d),s?{text:v,keys:f}:{text:e,keys:[]}},getTextXPath:function(){return"./descendant-or-self::text()[contains(., '".concat(t,"') and contains(., '").concat(o,"')]")},getAttributeXPath:function(e){var n=e.tag,r=e.attribute;return"descendant-or-self::".concat(n,"/@").concat(r,"[contains(., '").concat(t,"') and contains(., '").concat(o,"')]")}})},x=function(t){return function(o){var i=o.translate,a=o.onClick,l=function(t){return e(e({},E),t)}(t),u=b({inputPrefix:l.inputPrefix,inputSuffix:l.inputSuffix,translate:i}),c=w(u,l,a),f=c.wrap,d=c.unwrap,v=c.stop,h=c.forEachElement,y=c.highlight;return{wrap:f,unwrap:d,stop:v,run:c.run,retranslate:function(){h((function(e,t){var o,i;try{for(var a=n(t.nodes.entries()),l=a.next();!l.done;l=a.next()){var c=r(l.value,2),f=c[0],d=c[1];if(d.keyAttributeOnly)return;var v=u.unwrap(d.oldTextContent);v&&s(f,v.text)}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}}))},highlight:y,outputNotFormattable:!0}}};exports.TextObserver=function(e){return function(t,n){return n.setObserver(x(e)),t}};
"use strict";function e(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function t(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function n(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function r(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function o(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}Object.defineProperty(exports,"__esModule",{value:!0});function i(e,t){return{oldTextContent:e,keys:t}}var a={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"},u=function(e){var t=e.highlightColor,r=e.highlightWidth;return Object.freeze({initHighlighter:function(e,o){!function(e,o){o.highlight=function(){if(e.isConnected){var i=o.highlightEl;i||((i=document.createElement("div")).classList.add("_tolgee-highlighter"),Object.entries(a).forEach((function(e){var t=n(e,2),r=t[0],o=t[1];i.style[r]=o})),i.style.borderColor=t,o.highlightEl=i,document.body.appendChild(i));var u=e.getBoundingClientRect();i.style.borderWidth=r+"px",i.style.top=u.top-r+"px",i.style.left=u.left-r+"px",i.style.width=u.width+"px",i.style.height=u.height+"px"}}}(e,o),function(e,t){t.unhighlight=function(){var e;null===(e=t.highlightEl)||void 0===e||e.remove(),t.highlightEl=void 0}}(0,o)}})};function l(e,t){for(var n,r,o=null===document||void 0===document?void 0:document.evaluate(e,t,void 0,XPathResult.ANY_TYPE),i=[];r=null===(n=null==o?void 0:o.iterateNext)||void 0===n?void 0:n.call(o);)i.push(r);return i}function c(e){return e.textContent}function f(e,t){e.textContent=t}var s=function(e,t){var n,r=void 0===e.key||void 0===t.key||t.key===e.key,o=void 0===e.ns||void 0===t.ns||-1!==(null===(n=e.ns)||void 0===n?void 0:n.findIndex((function(e){var n;return null===(n=t.ns)||void 0===n?void 0:n.includes(e)})));return r&&o},d={capture:!0},v={capture:!0,passive:!0},h=function(e){var n,r,o=e.highlightKeys,i=e.elementStore,a=e.onClick,u=new Set,l=function(){var e,t=i.get(n);t&&(t.preventClean=!1,null===(e=t.unhighlight)||void 0===e||e.call(t),n=void 0)};function c(){var e,t=r;if(t&&b()){var o=document.elementFromPoint(t.x,t.y);o&&(e=E(o))}!function(e){var t;if(n!==e){l();var r=i.get(e);r&&(r.preventClean=!0,null===(t=r.highlight)||void 0===t||t.call(r),n=e)}}(e)}var f=function(e){var t;b()&&(t=e.target,!Boolean(m(t,(function(e){return"__tolgee_dev_tools"===e.id}))))&&(e.stopPropagation(),e.preventDefault())},s=function(e){var t;t={x:e.clientX,y:e.clientY},r=t,c()},h=function(){u=new Set,c()},y=function(e){var t=e.key;void 0!==t&&u.add(t),c()},g=function(e){u.delete(e.key),c()},p=function(){var e,t=i.get(n);null===(e=null==t?void 0:t.highlight)||void 0===e||e.call(t)},w=function(e){if(f(e),b()){var t=E(e.target);t&&t===n&&(a(e,t),l())}};function E(e){return m(e,(function(e){return i.get(e)}))}function m(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?m(e.parentElement,t):void 0}function b(){var e,n;try{for(var r=t(o),i=r.next();!i.done;i=r.next()){var a=i.value;if(!u.has(a))return!1}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return!0}return Object.freeze({run:function(){window.addEventListener("blur",h,d),window.addEventListener("keydown",y,d),window.addEventListener("keyup",g,d),window.addEventListener("mousemove",s,v),window.addEventListener("scroll",p,v),window.addEventListener("click",w,d),window.addEventListener("mouseenter",f,d),window.addEventListener("mouseover",f,d),window.addEventListener("mouseout",f,d),window.addEventListener("mouseleave",f,d),window.addEventListener("mousedown",f,d),window.addEventListener("mouseup",f,d)},stop:function(){window.removeEventListener("blur",h,d),window.removeEventListener("keydown",y,d),window.removeEventListener("keyup",g,d),window.removeEventListener("mousemove",s,v),window.removeEventListener("scroll",p,v),window.removeEventListener("click",w,d),window.removeEventListener("mouseenter",f,d),window.removeEventListener("mouseover",f,d),window.removeEventListener("mouseout",f,d),window.removeEventListener("mouseleave",f,d),window.removeEventListener("mousedown",f,d),window.removeEventListener("mouseup",f,d)}})},y=function(i,a){var l,c=(l=new Map,Object.freeze({set:function(e,t){l.set(e,t)},get:function(e){return e&&l.get(e)},remove:function(e){return l.delete(e)},forEachElement:function(e){l.forEach((function(t,n){return e(n,t)}))}})),f=u({highlightColor:i.highlightColor,highlightWidth:i.highlightWidth}),d=h({highlightKeys:i.highlightKeys,elementStore:c,onClick:function(e,t){var n=c.get(t);a(e,{el:t,meta:n,keysAndDefaults:v(n)})}});function v(e){return function(e){return Array.from(e.nodes.values()).reduce((function(e,t){return r(r([],n(e),!1),n(t.keys.map((function(e){return{key:e.key,defaultValue:e.defaultValue,ns:e.ns}}))),!1)}),[])}(e)}return Object.freeze({register:function(e,t,n){if(!function(e){return-1!==i.restrictedElements.indexOf(e.tagName.toLowerCase())||null!==e.closest("[".concat("data-tolgee-restricted","]"))}(e)){var r=e,o=c.get(r);o||(o={nodes:new Map},c.set(r,o),r.setAttribute("_tolgee","true")),o.nodes.set(t,n),f.initHighlighter(r,o)}},forEachElement:c.forEachElement,findAll:function(e,n){var r=[];return c.forEachElement((function(i,a){var u,l;try{for(var c=t(a.nodes.values()),f=c.next();!f.done;f=c.next()){if(f.value.keys.find((function(t){return s({key:e,ns:o(n)},{key:t.key,ns:o(t.ns)})}))){r.push(a);break}}}catch(e){u={error:e}}finally{try{f&&!f.done&&(l=c.return)&&l.call(c)}finally{if(u)throw u.error}}})),r},refreshAll:function(){c.forEachElement((function(r,o){o.preventClean||(function(r){r.nodes=new Map(function(r){var o,a,u,l,c,f,s,d;return e(this,(function(e){switch(e.label){case 0:e.trys.push([0,5,6,7]),o=t(r.nodes.entries()),a=o.next(),e.label=1;case 1:return a.done?[3,4]:(u=n(a.value,2),l=u[0],c=u[1],function(e,t){if(e.contains(t))return!0;if(t instanceof Attr){var n=t.ownerElement&&Object.values(t.ownerElement.attributes).indexOf(t)>-1;if(e.contains(t.ownerElement)&&n)return!0}return!1}(i.targetElement||document.body,l)?[4,[l,c]]:[3,3]);case 2:e.sent(),e.label=3;case 3:return a=o.next(),[3,1];case 4:return[3,7];case 5:return f=e.sent(),s={error:f},[3,7];case 6:try{a&&!a.done&&(d=o.return)&&d.call(o)}finally{if(s)throw s.error}return[7];case 7:return[2]}}))}(r))}(o),0===o.nodes.size&&function(e,t){var n;t.highlightEl&&(null===(n=t.unhighlight)||void 0===n||n.call(t));e.removeAttribute("_tolgee"),c.remove(e)}(r,o))}))},run:function(e){e&&d.run()},stop:function(){d.stop()}})},g=function(e,o,a){var u=!1,s=function(e){return Object.freeze({getSuitableParent:function t(n){var r=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(n);if(void 0===r)throw console.error(n),new Error("No suitable parent found for node above.");return e.passToParent?Array.isArray(e.passToParent)&&-1===e.passToParent.findIndex((function(e){return r.tagName.toLowerCase()===e.toLowerCase()}))?r:"function"!=typeof e.passToParent||e.passToParent(r)?t(r):r:r}})}(o),d=function(e,o){var i=function(e){return l(o.getTextXPath(),e)},a=function(i){var a,u,c,f,s=[];try{for(var d=t(Object.entries(e.tagAttributes)),v=d.next();!v.done;v=d.next()){var h=n(v.value,2),y=h[0],g=h[1];try{for(var p=(c=void 0,t(g)),w=p.next();!w.done;w=p.next()){var E=w.value,m=l(o.getAttributeXPath({tag:y,attribute:E}),i);s=r(r([],n(s),!1),n(m),!1)}}catch(e){c={error:e}}finally{try{w&&!w.done&&(f=p.return)&&f.call(p)}finally{if(c)throw c.error}}}}catch(e){a={error:e}}finally{try{v&&!v.done&&(u=d.return)&&u.call(d)}finally{if(a)throw a.error}}return s};return Object.freeze({handleAttributes:a,handleChildList:function(e){var t=[];return(t=t.concat(a(e))).concat(i(e))},handleText:i})}(o,e),v=y(o,a);function h(n){var r,o;try{for(var a=t(n),u=a.next();!u.done;u=a.next()){var l=u.value,d=c(l),h=d?e.unwrap(d):null;if(h){var y=h.text,g=h.keys;f(l,y);var p=i(d,g),w=s.getSuitableParent(l);v.register(w,l,p)}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}}var g,p=function(e){l("./descendant-or-self::*[@".concat("data-tolgee-key-only","]"),e).forEach((function(e){var t=e.getAttributeNode("data-tolgee-key-only"),n=s.getSuitableParent(t);v.register(n,t,{oldTextContent:"",keys:[{key:c(t)}],keyAttributeOnly:!0})}))};return Object.freeze({run:function(e){var n=e.mouseHighlight;g||(g=new MutationObserver((function(e){var n,r;if(u)try{for(var o=t(e),i=o.next();!i.done;i=o.next()){var a=i.value,l=[];switch(a.type){case"characterData":l=d.handleText(a.target);break;case"childList":p(a.target),l=d.handleChildList(a.target);break;case"attributes":p(a.target),l=d.handleAttributes(a.target)}h(l),v.refreshAll()}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}})));var r=o.targetElement||document.body;u=!0,v.run(n),p(r),h(d.handleChildList(r)),g.observe(o.targetElement||document.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0})},stop:function(){u=!1,v.stop(),g.disconnect()},wrap:e.wrap,unwrap:e.unwrap,forEachElement:v.forEachElement,highlight:function(e,t){var n=v.findAll(e,t);return n.forEach((function(e){var t;return null===(t=e.highlight)||void 0===t?void 0:t.call(e)})),{unhighlight:function(){n.forEach((function(e){var t;return null===(t=e.unhighlight)||void 0===t?void 0:t.call(e)}))}}}})};function p(e,t){for(var n=0;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}var w=function(e){var r=e.inputPrefix,o=e.inputSuffix,i=e.translate;function a(e){var n=function(e){var n,r,o=!1,i="",a="",u="KEY",l={key:"",ns:void 0,params:{},defaultValue:void 0},c=function(e){l.ns||(l.ns=[]),l.ns.push(e)};try{for(var f=t(e),s=f.next();!s.done;s=f.next()){var d=s.value;"\\"!==d||o?o?(o=!1,i+=d):"KEY"!==u||","!==d?"KEY"!==u||"|"!==d?"NAMESPACE"!==u||"|"!==d?"NAMESPACE"!==u||","!==d?"KEY"!==u||":"!==d?"DEFAULT_VALUE"!==u||":"!==d?"PARAM_NAME"!==u||":"!==d?"PARAM_VALUE"!==u||","!==d?i+=d:(u="PARAM_NAME",l.params[a]=i,i=""):(u="PARAM_VALUE",a=i,i=""):(u="PARAM_NAME",l.defaultValue=i,i=""):(u="PARAM_NAME",l.key=i,i=""):(u="DEFAULT_VALUE",c(i),i=""):(u="NAMESPACE",c(i),i=""):(u="NAMESPACE",l.key=i,i=""):(u="DEFAULT_VALUE",l.key=i,i=""):o=!0}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}return"KEY"===u&&(l.key=i),"DEFAULT_VALUE"===u&&(l.defaultValue=i),"PARAM_VALUE"===u&&(l.params[a]=i),"NAMESPACE"===u&&c(i),l}(e),r=n.key,o=n.params,a=n.defaultValue,u=n.ns;return{translated:i({key:r,params:o,defaultValue:a,ns:u,noWrap:!0}),key:r,params:o,defaultValue:a}}var u=function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},l=function(e){return"string"==typeof e?e.replace(/[,:|\\]/gs,"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn('Parameters of type "'.concat(typeof e,'" are not supported in "text" wrapper mode.')),e)};return Object.freeze({wrap:function(e){var t=e.key,i=e.params,a=e.defaultValue,u=e.ns,c=Object.entries(i||{}).map((function(e){var t=n(e,2),r=t[0],o=t[1];return"".concat(l(r),":").concat(l(o))})).join(",");c=c.length?":".concat(c):"";var f=void 0!==a?",".concat(l(a)):"",s="string"==typeof u?[u]:u,d=(null==s?void 0:s.length)?"|".concat(s.map((function(e){return l(e)})).join("|")):"";return"".concat(r).concat(l(t)).concat(d).concat(f).concat(c).concat(o)},unwrap:function(e){for(var t,i,l,c=new RegExp((t=u(r),i=u(o),"(\\\\?)(".concat(t,"(.*?)").concat(i,")")),"gs"),f=[],s=!1,d=0,v="";null!==(l=c.exec(e));){var h=l[1],y=n(l,4),g=y[0];y[1];var w=y[2],E=y[3],m=l.index;if(v+=l.input.substr(d,m-d),d=m+g.length,"\\"===h){if(!p(m,e)){v+=w;continue}h=""}var b=a(E);f.push({key:b.key,params:b.params,defaultValue:b.defaultValue}),s=!0,v+=h+b.translated}return v+=e.substring(d),s?{text:v,keys:f}:{text:e,keys:[]}},getTextXPath:function(){return"./descendant-or-self::text()[contains(., '".concat(r,"') and contains(., '").concat(o,"')]")},getAttributeXPath:function(e){var t=e.tag,n=e.attribute;return"descendant-or-self::".concat(t,"/@").concat(n,"[contains(., '").concat(r,"') and contains(., '").concat(o,"')]")}})};exports.TextObserver=function(){return function(e,r){return r.setObserver((function(e){var r=e.translate,o=e.onClick,i=e.options,a=w({inputPrefix:i.inputPrefix,inputSuffix:i.inputSuffix,translate:r}),u=g(a,i,o),l=u.wrap,c=u.unwrap,s=u.stop,d=u.forEachElement,v=u.highlight;return{wrap:l,unwrap:c,stop:s,run:u.run,retranslate:function(){d((function(e,r){var o,i;try{for(var u=t(r.nodes.entries()),l=u.next();!l.done;l=u.next()){var c=n(l.value,2),s=c[0],d=c[1];if(d.keyAttributeOnly)return;var v=a.unwrap(d.oldTextContent);v&&f(s,v.text)}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(o)throw o.error}}}))},highlight:v,outputNotFormattable:!0}})),e}};
//# sourceMappingURL=tolgee-text-observer.cjs.min.js.map

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/text-observer"]={})}(this,(function(e){"use strict";var t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)};function n(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function r(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function i(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function a(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}const l="data-tolgee-restricted",u="_tolgee",c="data-tolgee-key-only",f="__tolgee_dev_tools";function s(e,t){return{oldTextContent:e,keys:t}}var d={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"},v=function(e){var t=e.highlightColor,n=e.highlightWidth;return Object.freeze({initHighlighter:function(e,r){!function(e,r){r.highlight=function(){if(e.isConnected){var i=r.highlightEl;i||((i=document.createElement("div")).classList.add("_tolgee-highlighter"),Object.entries(d).forEach((function(e){var t=o(e,2),n=t[0],r=t[1];i.style[n]=r})),i.style.borderColor=t,r.highlightEl=i,document.body.appendChild(i));var a=e.getBoundingClientRect();i.style.borderWidth=n+"px",i.style.top=a.top-n+"px",i.style.left=a.left-n+"px",i.style.width=a.width+"px",i.style.height=a.height+"px"}}}(e,r),function(e,t){t.unhighlight=function(){var e;null===(e=t.highlightEl)||void 0===e||e.remove(),t.highlightEl=void 0}}(0,r)}})};function h(e,t){for(var n,r,o=null===document||void 0===document?void 0:document.evaluate(e,t,void 0,XPathResult.ANY_TYPE),i=[];r=null===(n=null==o?void 0:o.iterateNext)||void 0===n?void 0:n.call(o);)i.push(r);return i}function p(e){return e.textContent}function y(e,t){e.textContent=t}var g,w=function(e,t){var n,r=void 0===e.key||void 0===t.key||t.key===e.key,o=void 0===e.ns||void 0===t.ns||-1!==(null===(n=e.ns)||void 0===n?void 0:n.findIndex((function(e){var n;return null===(n=t.ns)||void 0===n?void 0:n.includes(e)})));return r&&o};!function(e){e[e.Alt=0]="Alt",e[e.Control=1]="Control",e[e.Shift=2]="Shift",e[e.Meta=3]="Meta"}(g||(g={}));var E={capture:!0},m={capture:!0,passive:!0},b=function(e){var t,n,o=e.highlightKeys,i=e.elementStore,a=e.onClick,l=new Set,u=function(){var e,n=i.get(t);n&&(n.preventClean=!1,null===(e=n.unhighlight)||void 0===e||e.call(n),t=void 0)};function c(){var e,r=n;if(r&&A()){var o=document.elementFromPoint(r.x,r.y);o&&(e=b(o))}!function(e){var n;if(t!==e){u();var r=i.get(e);r&&(r.preventClean=!0,null===(n=r.highlight)||void 0===n||n.call(r),t=e)}}(e)}var s=function(e){var t;A()&&(t=e.target,!Boolean(x(t,(function(e){return e.id===f}))))&&(e.stopPropagation(),e.preventDefault())},d=function(e){var t;t={x:e.clientX,y:e.clientY},n=t,c()},v=function(){l=new Set,c()},h=function(e){var t=g[e.key];void 0!==t&&l.add(t),c()},p=function(e){l.delete(g[e.key]),c()},y=function(){var e,n=i.get(t);null===(e=null==n?void 0:n.highlight)||void 0===e||e.call(n)},w=function(e){if(s(e),A()){var n=b(e.target);n&&n===t&&(a(e,n),u())}};function b(e){return x(e,(function(e){return i.get(e)}))}function x(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?x(e.parentElement,t):void 0}function A(){var e,t;try{for(var n=r(o),i=n.next();!i.done;i=n.next()){var a=i.value;if(!l.has(a))return!1}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return!0}return Object.freeze({run:function(){window.addEventListener("blur",v,E),window.addEventListener("keydown",h,E),window.addEventListener("keyup",p,E),window.addEventListener("mousemove",d,m),window.addEventListener("scroll",y,m),window.addEventListener("click",w,E),window.addEventListener("mouseenter",s,E),window.addEventListener("mouseover",s,E),window.addEventListener("mouseout",s,E),window.addEventListener("mouseleave",s,E),window.addEventListener("mousedown",s,E),window.addEventListener("mouseup",s,E)},stop:function(){window.removeEventListener("blur",v,E),window.removeEventListener("keydown",h,E),window.removeEventListener("keyup",p,E),window.removeEventListener("mousemove",d,m),window.removeEventListener("scroll",y,m),window.removeEventListener("click",w,E),window.removeEventListener("mouseenter",s,E),window.removeEventListener("mouseover",s,E),window.removeEventListener("mouseout",s,E),window.removeEventListener("mouseleave",s,E),window.removeEventListener("mousedown",s,E),window.removeEventListener("mouseup",s,E)}})},x=function(e,t){var c,f=(c=new Map,Object.freeze({set:function(e,t){c.set(e,t)},get:function(e){return e&&c.get(e)},remove:function(e){return c.delete(e)},forEachElement:function(e){c.forEach((function(t,n){return e(n,t)}))}})),s=v({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),d=b({highlightKeys:e.highlightKeys,elementStore:f,onClick:function(e,n){var r=f.get(n);t(e,{el:n,meta:r,keysAndDefaults:h(r)})}});function h(e){return function(e){return Array.from(e.nodes.values()).reduce((function(e,t){return i(i([],o(e),!1),o(t.keys.map((function(e){return{key:e.key,defaultValue:e.defaultValue,ns:e.ns}}))),!1)}),[])}(e)}return Object.freeze({register:function(t,n,r){if(!function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest("[".concat(l,"]"))}(t)){var o=t,i=f.get(o);i||(i={nodes:new Map},f.set(o,i),o.setAttribute(u,"true")),i.nodes.set(n,r),s.initHighlighter(o,i)}},forEachElement:f.forEachElement,findAll:function(e,t){var n=[];return f.forEachElement((function(o,i){var l,u;try{for(var c=r(i.nodes.values()),f=c.next();!f.done;f=c.next()){if(f.value.keys.find((function(n){return w({key:e,ns:a(t)},{key:n.key,ns:a(n.ns)})}))){n.push(i);break}}}catch(e){l={error:e}}finally{try{f&&!f.done&&(u=c.return)&&u.call(c)}finally{if(l)throw l.error}}})),n},refreshAll:function(){f.forEachElement((function(t,i){i.preventClean||(function(t){t.nodes=new Map(function(t){var i,a,l,u,c,f,s,d;return n(this,(function(n){switch(n.label){case 0:n.trys.push([0,5,6,7]),i=r(t.nodes.entries()),a=i.next(),n.label=1;case 1:return a.done?[3,4]:(l=o(a.value,2),u=l[0],c=l[1],function(e,t){if(e.contains(t))return!0;if(t instanceof Attr){var n=t.ownerElement&&Object.values(t.ownerElement.attributes).indexOf(t)>-1;if(e.contains(t.ownerElement)&&n)return!0}return!1}(e.targetElement||document.body,u)?[4,[u,c]]:[3,3]);case 2:n.sent(),n.label=3;case 3:return a=i.next(),[3,1];case 4:return[3,7];case 5:return f=n.sent(),s={error:f},[3,7];case 6:try{a&&!a.done&&(d=i.return)&&d.call(i)}finally{if(s)throw s.error}return[7];case 7:return[2]}}))}(t))}(i),0===i.nodes.size&&function(e,t){var n;t.highlightEl&&(null===(n=t.unhighlight)||void 0===n||n.call(t));e.removeAttribute(u),f.remove(e)}(t,i))}))},run:function(e){e&&d.run()},stop:function(){d.stop()}})},A=function(e,t,n){var a=!1,l=function(e){return Object.freeze({getSuitableParent:function t(n){var r=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(n);if(void 0===r)throw console.error(n),new Error("No suitable parent found for node above.");return e.passToParent?Array.isArray(e.passToParent)&&-1===e.passToParent.findIndex((function(e){return r.tagName.toLowerCase()===e.toLowerCase()}))?r:"function"!=typeof e.passToParent||e.passToParent(r)?t(r):r:r}})}(t),u=function(e,t){var n=function(e){return h(t.getTextXPath(),e)},a=function(n){var a,l,u,c,f=[];try{for(var s=r(Object.entries(e.tagAttributes)),d=s.next();!d.done;d=s.next()){var v=o(d.value,2),p=v[0],y=v[1];try{for(var g=(u=void 0,r(y)),w=g.next();!w.done;w=g.next()){var E=w.value,m=h(t.getAttributeXPath({tag:p,attribute:E}),n);f=i(i([],o(f),!1),o(m),!1)}}catch(e){u={error:e}}finally{try{w&&!w.done&&(c=g.return)&&c.call(g)}finally{if(u)throw u.error}}}}catch(e){a={error:e}}finally{try{d&&!d.done&&(l=s.return)&&l.call(s)}finally{if(a)throw a.error}}return f};return Object.freeze({handleAttributes:a,handleChildList:function(e){var t=[];return(t=t.concat(a(e))).concat(n(e))},handleText:n})}(t,e),f=x(t,n);function d(t){var n,o;try{for(var i=r(t),a=i.next();!a.done;a=i.next()){var u=a.value,c=p(u),d=c?e.unwrap(c):null;if(d){var v=d.text,h=d.keys;y(u,v);var g=s(c,h),w=l.getSuitableParent(u);f.register(w,u,g)}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}}var v,g=function(e){h("./descendant-or-self::*[@".concat(c,"]"),e).forEach((function(e){var t=e.getAttributeNode(c),n=l.getSuitableParent(t);f.register(n,t,{oldTextContent:"",keys:[{key:p(t)}],keyAttributeOnly:!0})}))};return Object.freeze({run:function(e){var n=e.mouseHighlight;v||(v=new MutationObserver((function(e){var t,n;if(a)try{for(var o=r(e),i=o.next();!i.done;i=o.next()){var l=i.value,c=[];switch(l.type){case"characterData":c=u.handleText(l.target);break;case"childList":g(l.target),c=u.handleChildList(l.target);break;case"attributes":g(l.target),c=u.handleAttributes(l.target)}d(c),f.refreshAll()}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}})));var o=t.targetElement||document.body;a=!0,f.run(n),g(o),d(u.handleChildList(o)),v.observe(t.targetElement||document.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0})},stop:function(){a=!1,f.stop(),v.disconnect()},wrap:e.wrap,unwrap:e.unwrap,forEachElement:f.forEachElement,highlight:function(e,t){var n=f.findAll(e,t);return n.forEach((function(e){var t;return null===(t=e.highlight)||void 0===t?void 0:t.call(e)})),{unhighlight:function(){n.forEach((function(e){var t;return null===(t=e.unhighlight)||void 0===t?void 0:t.call(e)}))}}}})},k={tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:[g.Alt],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"]};function L(e,t){for(var n=0;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}var P=function(e){var t=e.inputPrefix,n=e.inputSuffix,i=e.translate;function a(e){var t=function(e){var t,n,o=!1,i="",a="",l="KEY",u={key:"",ns:void 0,params:{},defaultValue:void 0},c=function(e){u.ns||(u.ns=[]),u.ns.push(e)};try{for(var f=r(e),s=f.next();!s.done;s=f.next()){var d=s.value;"\\"!==d||o?o?(o=!1,i+=d):"KEY"!==l||","!==d?"KEY"!==l||"|"!==d?"NAMESPACE"!==l||"|"!==d?"NAMESPACE"!==l||","!==d?"KEY"!==l||":"!==d?"DEFAULT_VALUE"!==l||":"!==d?"PARAM_NAME"!==l||":"!==d?"PARAM_VALUE"!==l||","!==d?i+=d:(l="PARAM_NAME",u.params[a]=i,i=""):(l="PARAM_VALUE",a=i,i=""):(l="PARAM_NAME",u.defaultValue=i,i=""):(l="PARAM_NAME",u.key=i,i=""):(l="DEFAULT_VALUE",c(i),i=""):(l="NAMESPACE",c(i),i=""):(l="NAMESPACE",u.key=i,i=""):(l="DEFAULT_VALUE",u.key=i,i=""):o=!0}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}return"KEY"===l&&(u.key=i),"DEFAULT_VALUE"===l&&(u.defaultValue=i),"PARAM_VALUE"===l&&(u.params[a]=i),"NAMESPACE"===l&&c(i),u}(e),n=t.key,o=t.params,a=t.defaultValue,l=t.ns;return{translated:i({key:n,params:o,defaultValue:a,ns:l,noWrap:!0}),key:n,params:o,defaultValue:a}}var l=function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},u=function(e){return"string"==typeof e?e.replace(/[,:|\\]/gs,"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn('Parameters of type "'.concat(typeof e,'" are not supported in "text" wrapper mode.')),e)};return Object.freeze({wrap:function(e){var r=e.key,i=e.params,a=e.defaultValue,l=e.ns,c=Object.entries(i||{}).map((function(e){var t=o(e,2),n=t[0],r=t[1];return"".concat(u(n),":").concat(u(r))})).join(",");c=c.length?":".concat(c):"";var f=void 0!==a?",".concat(u(a)):"",s="string"==typeof l?[l]:l,d=(null==s?void 0:s.length)?"|".concat(s.map((function(e){return u(e)})).join("|")):"";return"".concat(t).concat(u(r)).concat(d).concat(f).concat(c).concat(n)},unwrap:function(e){for(var r,i,u,c=new RegExp((r=l(t),i=l(n),"(\\\\?)(".concat(r,"(.*?)").concat(i,")")),"gs"),f=[],s=!1,d=0,v="";null!==(u=c.exec(e));){var h=u[1],p=o(u,4),y=p[0];p[1];var g=p[2],w=p[3],E=u.index;if(v+=u.input.substr(d,E-d),d=E+y.length,"\\"===h){if(!L(E,e)){v+=g;continue}h=""}var m=a(w);f.push({key:m.key,params:m.params,defaultValue:m.defaultValue}),s=!0,v+=h+m.translated}return v+=e.substring(d),s?{text:v,keys:f}:{text:e,keys:[]}},getTextXPath:function(){return"./descendant-or-self::text()[contains(., '".concat(t,"') and contains(., '").concat(n,"')]")},getAttributeXPath:function(e){var r=e.tag,o=e.attribute;return"descendant-or-self::".concat(r,"/@").concat(o,"[contains(., '").concat(t,"') and contains(., '").concat(n,"')]")}})},C=function(e){return function(n){var i=n.translate,a=n.onClick,l=function(e){return t(t({},k),e)}(e),u=P({inputPrefix:l.inputPrefix,inputSuffix:l.inputSuffix,translate:i}),c=A(u,l,a),f=c.wrap,s=c.unwrap,d=c.stop,v=c.forEachElement,h=c.highlight;return{wrap:f,unwrap:s,stop:d,run:c.run,retranslate:function(){v((function(e,t){var n,i;try{for(var a=r(t.nodes.entries()),l=a.next();!l.done;l=a.next()){var c=o(l.value,2),f=c[0],s=c[1];if(s.keyAttributeOnly)return;var d=u.unwrap(s.oldTextContent);d&&y(f,d.text)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}}))},highlight:h,outputNotFormattable:!0}}};e.TextObserver=function(e){return function(t,n){return n.setObserver(C(e)),t}},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/text-observer"]={})}(this,(function(e){"use strict";function t(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function n(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function o(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function i(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}const a="data-tolgee-restricted",u="_tolgee",l="data-tolgee-key-only",c="__tolgee_dev_tools";function f(e,t){return{oldTextContent:e,keys:t}}var s={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"},d=function(e){var t=e.highlightColor,n=e.highlightWidth;return Object.freeze({initHighlighter:function(e,o){!function(e,o){o.highlight=function(){if(e.isConnected){var i=o.highlightEl;i||((i=document.createElement("div")).classList.add("_tolgee-highlighter"),Object.entries(s).forEach((function(e){var t=r(e,2),n=t[0],o=t[1];i.style[n]=o})),i.style.borderColor=t,o.highlightEl=i,document.body.appendChild(i));var a=e.getBoundingClientRect();i.style.borderWidth=n+"px",i.style.top=a.top-n+"px",i.style.left=a.left-n+"px",i.style.width=a.width+"px",i.style.height=a.height+"px"}}}(e,o),function(e,t){t.unhighlight=function(){var e;null===(e=t.highlightEl)||void 0===e||e.remove(),t.highlightEl=void 0}}(0,o)}})};function v(e,t){for(var n,r,o=null===document||void 0===document?void 0:document.evaluate(e,t,void 0,XPathResult.ANY_TYPE),i=[];r=null===(n=null==o?void 0:o.iterateNext)||void 0===n?void 0:n.call(o);)i.push(r);return i}function h(e){return e.textContent}function y(e,t){e.textContent=t}var p=function(e,t){var n,r=void 0===e.key||void 0===t.key||t.key===e.key,o=void 0===e.ns||void 0===t.ns||-1!==(null===(n=e.ns)||void 0===n?void 0:n.findIndex((function(e){var n;return null===(n=t.ns)||void 0===n?void 0:n.includes(e)})));return r&&o},g={capture:!0},w={capture:!0,passive:!0},E=function(e){var t,r,o=e.highlightKeys,i=e.elementStore,a=e.onClick,u=new Set,l=function(){var e,n=i.get(t);n&&(n.preventClean=!1,null===(e=n.unhighlight)||void 0===e||e.call(n),t=void 0)};function f(){var e,n=r;if(n&&x()){var o=document.elementFromPoint(n.x,n.y);o&&(e=m(o))}!function(e){var n;if(t!==e){l();var r=i.get(e);r&&(r.preventClean=!0,null===(n=r.highlight)||void 0===n||n.call(r),t=e)}}(e)}var s=function(e){var t;x()&&(t=e.target,!Boolean(b(t,(function(e){return e.id===c}))))&&(e.stopPropagation(),e.preventDefault())},d=function(e){var t;t={x:e.clientX,y:e.clientY},r=t,f()},v=function(){u=new Set,f()},h=function(e){var t=e.key;void 0!==t&&u.add(t),f()},y=function(e){u.delete(e.key),f()},p=function(){var e,n=i.get(t);null===(e=null==n?void 0:n.highlight)||void 0===e||e.call(n)},E=function(e){if(s(e),x()){var n=m(e.target);n&&n===t&&(a(e,n),l())}};function m(e){return b(e,(function(e){return i.get(e)}))}function b(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?b(e.parentElement,t):void 0}function x(){var e,t;try{for(var r=n(o),i=r.next();!i.done;i=r.next()){var a=i.value;if(!u.has(a))return!1}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return!0}return Object.freeze({run:function(){window.addEventListener("blur",v,g),window.addEventListener("keydown",h,g),window.addEventListener("keyup",y,g),window.addEventListener("mousemove",d,w),window.addEventListener("scroll",p,w),window.addEventListener("click",E,g),window.addEventListener("mouseenter",s,g),window.addEventListener("mouseover",s,g),window.addEventListener("mouseout",s,g),window.addEventListener("mouseleave",s,g),window.addEventListener("mousedown",s,g),window.addEventListener("mouseup",s,g)},stop:function(){window.removeEventListener("blur",v,g),window.removeEventListener("keydown",h,g),window.removeEventListener("keyup",y,g),window.removeEventListener("mousemove",d,w),window.removeEventListener("scroll",p,w),window.removeEventListener("click",E,g),window.removeEventListener("mouseenter",s,g),window.removeEventListener("mouseover",s,g),window.removeEventListener("mouseout",s,g),window.removeEventListener("mouseleave",s,g),window.removeEventListener("mousedown",s,g),window.removeEventListener("mouseup",s,g)}})},m=function(e,l){var c,f=(c=new Map,Object.freeze({set:function(e,t){c.set(e,t)},get:function(e){return e&&c.get(e)},remove:function(e){return c.delete(e)},forEachElement:function(e){c.forEach((function(t,n){return e(n,t)}))}})),s=d({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),v=E({highlightKeys:e.highlightKeys,elementStore:f,onClick:function(e,t){var n=f.get(t);l(e,{el:t,meta:n,keysAndDefaults:h(n)})}});function h(e){return function(e){return Array.from(e.nodes.values()).reduce((function(e,t){return o(o([],r(e),!1),r(t.keys.map((function(e){return{key:e.key,defaultValue:e.defaultValue,ns:e.ns}}))),!1)}),[])}(e)}return Object.freeze({register:function(t,n,r){if(!function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest("[".concat(a,"]"))}(t)){var o=t,i=f.get(o);i||(i={nodes:new Map},f.set(o,i),o.setAttribute(u,"true")),i.nodes.set(n,r),s.initHighlighter(o,i)}},forEachElement:f.forEachElement,findAll:function(e,t){var r=[];return f.forEachElement((function(o,a){var u,l;try{for(var c=n(a.nodes.values()),f=c.next();!f.done;f=c.next()){if(f.value.keys.find((function(n){return p({key:e,ns:i(t)},{key:n.key,ns:i(n.ns)})}))){r.push(a);break}}}catch(e){u={error:e}}finally{try{f&&!f.done&&(l=c.return)&&l.call(c)}finally{if(u)throw u.error}}})),r},refreshAll:function(){f.forEachElement((function(o,i){i.preventClean||(function(o){o.nodes=new Map(function(o){var i,a,u,l,c,f,s,d;return t(this,(function(t){switch(t.label){case 0:t.trys.push([0,5,6,7]),i=n(o.nodes.entries()),a=i.next(),t.label=1;case 1:return a.done?[3,4]:(u=r(a.value,2),l=u[0],c=u[1],function(e,t){if(e.contains(t))return!0;if(t instanceof Attr){var n=t.ownerElement&&Object.values(t.ownerElement.attributes).indexOf(t)>-1;if(e.contains(t.ownerElement)&&n)return!0}return!1}(e.targetElement||document.body,l)?[4,[l,c]]:[3,3]);case 2:t.sent(),t.label=3;case 3:return a=i.next(),[3,1];case 4:return[3,7];case 5:return f=t.sent(),s={error:f},[3,7];case 6:try{a&&!a.done&&(d=i.return)&&d.call(i)}finally{if(s)throw s.error}return[7];case 7:return[2]}}))}(o))}(i),0===i.nodes.size&&function(e,t){var n;t.highlightEl&&(null===(n=t.unhighlight)||void 0===n||n.call(t));e.removeAttribute(u),f.remove(e)}(o,i))}))},run:function(e){e&&v.run()},stop:function(){v.stop()}})},b=function(e,t,i){var a=!1,u=function(e){return Object.freeze({getSuitableParent:function t(n){var r=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(n);if(void 0===r)throw console.error(n),new Error("No suitable parent found for node above.");return e.passToParent?Array.isArray(e.passToParent)&&-1===e.passToParent.findIndex((function(e){return r.tagName.toLowerCase()===e.toLowerCase()}))?r:"function"!=typeof e.passToParent||e.passToParent(r)?t(r):r:r}})}(t),c=function(e,t){var i=function(e){return v(t.getTextXPath(),e)},a=function(i){var a,u,l,c,f=[];try{for(var s=n(Object.entries(e.tagAttributes)),d=s.next();!d.done;d=s.next()){var h=r(d.value,2),y=h[0],p=h[1];try{for(var g=(l=void 0,n(p)),w=g.next();!w.done;w=g.next()){var E=w.value,m=v(t.getAttributeXPath({tag:y,attribute:E}),i);f=o(o([],r(f),!1),r(m),!1)}}catch(e){l={error:e}}finally{try{w&&!w.done&&(c=g.return)&&c.call(g)}finally{if(l)throw l.error}}}}catch(e){a={error:e}}finally{try{d&&!d.done&&(u=s.return)&&u.call(s)}finally{if(a)throw a.error}}return f};return Object.freeze({handleAttributes:a,handleChildList:function(e){var t=[];return(t=t.concat(a(e))).concat(i(e))},handleText:i})}(t,e),s=m(t,i);function d(t){var r,o;try{for(var i=n(t),a=i.next();!a.done;a=i.next()){var l=a.value,c=h(l),d=c?e.unwrap(c):null;if(d){var v=d.text,p=d.keys;y(l,v);var g=f(c,p),w=u.getSuitableParent(l);s.register(w,l,g)}}}catch(e){r={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}var p,g=function(e){v("./descendant-or-self::*[@".concat(l,"]"),e).forEach((function(e){var t=e.getAttributeNode(l),n=u.getSuitableParent(t);s.register(n,t,{oldTextContent:"",keys:[{key:h(t)}],keyAttributeOnly:!0})}))};return Object.freeze({run:function(e){var r=e.mouseHighlight;p||(p=new MutationObserver((function(e){var t,r;if(a)try{for(var o=n(e),i=o.next();!i.done;i=o.next()){var u=i.value,l=[];switch(u.type){case"characterData":l=c.handleText(u.target);break;case"childList":g(u.target),l=c.handleChildList(u.target);break;case"attributes":g(u.target),l=c.handleAttributes(u.target)}d(l),s.refreshAll()}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}})));var o=t.targetElement||document.body;a=!0,s.run(r),g(o),d(c.handleChildList(o)),p.observe(t.targetElement||document.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0})},stop:function(){a=!1,s.stop(),p.disconnect()},wrap:e.wrap,unwrap:e.unwrap,forEachElement:s.forEachElement,highlight:function(e,t){var n=s.findAll(e,t);return n.forEach((function(e){var t;return null===(t=e.highlight)||void 0===t?void 0:t.call(e)})),{unhighlight:function(){n.forEach((function(e){var t;return null===(t=e.unhighlight)||void 0===t?void 0:t.call(e)}))}}}})};function x(e,t){for(var n=0;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}var A=function(e){var t=e.inputPrefix,o=e.inputSuffix,i=e.translate;function a(e){var t=function(e){var t,r,o=!1,i="",a="",u="KEY",l={key:"",ns:void 0,params:{},defaultValue:void 0},c=function(e){l.ns||(l.ns=[]),l.ns.push(e)};try{for(var f=n(e),s=f.next();!s.done;s=f.next()){var d=s.value;"\\"!==d||o?o?(o=!1,i+=d):"KEY"!==u||","!==d?"KEY"!==u||"|"!==d?"NAMESPACE"!==u||"|"!==d?"NAMESPACE"!==u||","!==d?"KEY"!==u||":"!==d?"DEFAULT_VALUE"!==u||":"!==d?"PARAM_NAME"!==u||":"!==d?"PARAM_VALUE"!==u||","!==d?i+=d:(u="PARAM_NAME",l.params[a]=i,i=""):(u="PARAM_VALUE",a=i,i=""):(u="PARAM_NAME",l.defaultValue=i,i=""):(u="PARAM_NAME",l.key=i,i=""):(u="DEFAULT_VALUE",c(i),i=""):(u="NAMESPACE",c(i),i=""):(u="NAMESPACE",l.key=i,i=""):(u="DEFAULT_VALUE",l.key=i,i=""):o=!0}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=f.return)&&r.call(f)}finally{if(t)throw t.error}}return"KEY"===u&&(l.key=i),"DEFAULT_VALUE"===u&&(l.defaultValue=i),"PARAM_VALUE"===u&&(l.params[a]=i),"NAMESPACE"===u&&c(i),l}(e),r=t.key,o=t.params,a=t.defaultValue,u=t.ns;return{translated:i({key:r,params:o,defaultValue:a,ns:u,noWrap:!0}),key:r,params:o,defaultValue:a}}var u=function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},l=function(e){return"string"==typeof e?e.replace(/[,:|\\]/gs,"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn('Parameters of type "'.concat(typeof e,'" are not supported in "text" wrapper mode.')),e)};return Object.freeze({wrap:function(e){var n=e.key,i=e.params,a=e.defaultValue,u=e.ns,c=Object.entries(i||{}).map((function(e){var t=r(e,2),n=t[0],o=t[1];return"".concat(l(n),":").concat(l(o))})).join(",");c=c.length?":".concat(c):"";var f=void 0!==a?",".concat(l(a)):"",s="string"==typeof u?[u]:u,d=(null==s?void 0:s.length)?"|".concat(s.map((function(e){return l(e)})).join("|")):"";return"".concat(t).concat(l(n)).concat(d).concat(f).concat(c).concat(o)},unwrap:function(e){for(var n,i,l,c=new RegExp((n=u(t),i=u(o),"(\\\\?)(".concat(n,"(.*?)").concat(i,")")),"gs"),f=[],s=!1,d=0,v="";null!==(l=c.exec(e));){var h=l[1],y=r(l,4),p=y[0];y[1];var g=y[2],w=y[3],E=l.index;if(v+=l.input.substr(d,E-d),d=E+p.length,"\\"===h){if(!x(E,e)){v+=g;continue}h=""}var m=a(w);f.push({key:m.key,params:m.params,defaultValue:m.defaultValue}),s=!0,v+=h+m.translated}return v+=e.substring(d),s?{text:v,keys:f}:{text:e,keys:[]}},getTextXPath:function(){return"./descendant-or-self::text()[contains(., '".concat(t,"') and contains(., '").concat(o,"')]")},getAttributeXPath:function(e){var n=e.tag,r=e.attribute;return"descendant-or-self::".concat(n,"/@").concat(r,"[contains(., '").concat(t,"') and contains(., '").concat(o,"')]")}})};e.TextObserver=function(){return function(e,t){return t.setObserver((function(e){var t=e.translate,o=e.onClick,i=e.options,a=A({inputPrefix:i.inputPrefix,inputSuffix:i.inputSuffix,translate:t}),u=b(a,i,o),l=u.wrap,c=u.unwrap,f=u.stop,s=u.forEachElement,d=u.highlight;return{wrap:l,unwrap:c,stop:f,run:u.run,retranslate:function(){s((function(e,t){var o,i;try{for(var u=n(t.nodes.entries()),l=u.next();!l.done;l=u.next()){var c=r(l.value,2),f=c[0],s=c[1];if(s.keyAttributeOnly)return;var d=a.unwrap(s.oldTextContent);d&&y(f,d.text)}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(o)throw o.error}}}))},highlight:d,outputNotFormattable:!0}})),e}},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=tolgee-text-observer.umd.min.js.map

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=()=>{let e=[];return Object.freeze({listen:n=>{const t=e=>{n(e)};return e.push(t),{unsubscribe:()=>{e=e.filter((e=>t!==e))}}},emit:n=>{e.forEach((e=>e({value:n})))}})};function n(e){return function(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}(e)||[]}function t(e,t){return"object"!=typeof(a=t)||Array.isArray(a)||null===a?n(t):n(null==t?void 0:t[e]);var a}function a(e){return Array.from(new Set(e))}function i(e,n){const t=e.get(n)||0;e.set(n,t+1)}function o(e,n){let t=e.get(n)||1;t-=1,t<=0?e.delete(n):e.set(n,t)}const r=e=>{const t=new Set,a=new Set,r=n=>{if(n.has(void 0)){const t=new Set(n.keys());return t.delete(void 0),e().forEach((e=>t.add(e))),t}return n};let s=[];const c=()=>{if(0===s.length)return;t.forEach((e=>{e({value:void 0})}));const e=new Set;let n=new Set;s.forEach((t=>{void 0===(null==t?void 0:t.ns)?e.add(void 0):t.ns.forEach((n=>e.add(n))),void 0===(null==t?void 0:t.key)?n=void 0:void 0!==n&&n.add(t.key)}));const i=Array.from(r(e).keys());(n||[void 0]).forEach((e=>{((e,n)=>{a.forEach((t=>{const a=r(t.namespaces),i=void 0===n||-1!==(null==n?void 0:n.findIndex((e=>a.has(e)))),o=void 0===e||t.keys.has(e)||0===t.keys.size;i&&o&&t.fn({value:void 0})}))})(e,i)})),s=[]};return Object.freeze({listenSome:e=>{const t={fn:n=>{e(n)},keys:new Map,namespaces:new Map};a.add(t);const r={unsubscribe:()=>{a.delete(t)},subscribeNs:e=>(n(e).forEach((e=>i(t.namespaces,e))),r),unsubscribeNs:e=>(n(e).forEach((e=>o(t.namespaces,e))),r),subscribeKey:e=>{const{key:a,ns:o}=e;return i(t.keys,a),n(o).forEach((e=>i(t.namespaces,e))),void 0===o&&i(t.namespaces,void 0),r},unsubscribeKey:e=>{const{key:a,ns:i}=e;return o(t.keys,a),n(i).forEach((e=>o(t.namespaces,e))),void 0===i&&o(t.namespaces,void 0),r}};return r},listen:e=>{t.add(e);return{unsubscribe:()=>{t.delete(e)}}},emit:(e,n)=>{s.push(e),n?Promise.resolve().then((()=>{c()})):c()}})},s=e=>{const n=new Map;return Object.entries(e).forEach((([e,t])=>{null!=t&&("object"!=typeof t?n.set(e,t):s(t).forEach(((t,a)=>{n.set(e+"."+a,t)})))})),n},c=e=>{const[n,t]=e.split(":");return{language:n,namespace:t||""}},u=({language:e,namespace:n})=>n?`${e}:${n}`:e,g=(e,t,a,i,o,r,g)=>{const l=new Map,d=new Map;let f={},v=0;function p(n,t,a){const i=u(n);d.set(i,{data:s(t),version:a}),e.emit(n)}function m(e,n){p(e,n,v)}function b(e,n=!1){const t=d.get(u(e));return t&&n?t.version===v:Boolean(t)}function h(e){var n;return null===(n=d.get(u(i(e))))||void 0===n?void 0:n.data}function y(e){let n;if(!n){const t=f[u(e)];"function"==typeof t&&(n=t())}return n||(n=t(e)),n||(n=Promise.resolve({})),n}return Object.freeze({addStaticData:function(e){e&&(f=Object.assign(Object.assign({},f),e),Object.entries(e).forEach((([e,n])=>{if("function"!=typeof n){const t=c(e),a=d.get(e);a&&0!==a.version||p(t,n,0)}})))},invalidate:function(){l.clear(),v+=1},addRecord:m,exists:b,getRecord:h,getTranslation:function(e,n){var t;return null===(t=d.get(u(e)))||void 0===t?void 0:t.data.get(n)},getTranslationNs:function(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=d.get(u({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return i}return Array.from(new Set(e))},getTranslationFallback:function(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=d.get(u({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return n}},changeTranslation:function(n,t,a){var i;const o=null===(i=d.get(u(n)))||void 0===i?void 0:i.data;null==o||o.set(t,a),e.emit(Object.assign(Object.assign({},n),{key:t}))},isFetching:function(e){if(o())return!0;if(void 0===e)return l.size>0;const t=n(e);return Boolean(Array.from(l.keys()).find((e=>t.includes(c(e).namespace))))},isLoading:function(e,t){const a=n(t);return Boolean(o()||Array.from(l.keys()).find((n=>{const t=c(n);return(!a.length||a.includes(t.namespace))&&!b({namespace:t.namespace,language:e})})))},loadRecords:async function(e,n){const t=e.map((e=>{const t=i(e),o=u(t),r=l.get(o);if(r)return{new:!1,promise:r,keyObject:t,cacheKey:o};const s=function(e,n){var t;let i;return n&&(i=null===(t=a(e))||void 0===t?void 0:t.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),y(e))))),i||(i=y(e)),i}(t,n);return l.set(o,s),{new:!0,promise:s,keyObject:t,cacheKey:o}}));r.notify(),g.notify();const o=await Promise.all(t.map((e=>e.promise)));return t.forEach(((e,n)=>{const t=l.get(e.cacheKey)!==e.promise;if(e.new&&!t){l.delete(e.cacheKey);const t=o[n];t&&m(e.keyObject,t)}})),r.notify(),g.notify(),t.map((e=>h(e.keyObject)))},getAllRecords:function(){return Array.from(d.entries()).map((([e,n])=>Object.assign(Object.assign({},c(e)),{data:n.data})))}})};function l(e){return Boolean(e&&"function"==typeof e.then)}const d=(e,n)=>l(e)?Promise.resolve(e).then(n):n(e),f=e=>`Tolgee: You need to specify '${e}' option`,v=(e,t,a,i,o,r)=>{const s={ui:void 0},c={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},u=async(e,{keysAndDefaults:t})=>{var a;const r=t.map((({key:e,ns:t,defaultValue:a})=>({key:e,defaultValue:a,ns:n(i({key:e,ns:t,defaultValue:a})),translation:o({key:e,ns:t})})));null===(a=c.ui)||void 0===a||a.handleElementClick(e,r)},g=(e,n)=>{var t,a;return(null===(a=null===(t=c.observer)||void 0===t?void 0:t.highlight)||void 0===a?void 0:a.call(t,e,n))||{unhighlight(){}}},f=e=>{const n=o(e);return v(Object.assign(Object.assign({},e),{translation:n,formatEnabled:!0}))},v=({key:n,translation:t,defaultValue:a,noWrap:i,params:o,orEmpty:r,ns:s,formatEnabled:u})=>{var g;const l=t||a;let d=l||(r?"":n);c.observer&&!i&&(d=c.observer.wrap({key:n,translation:d,defaultValue:a,params:o,ns:s}));const f=e(),v=u||!(null===(g=c.observer)||void 0===g?void 0:g.outputNotFormattable);if(l&&f&&v)for(const e of c.formatters)d=e.format({translation:d,language:f,params:o});return c.finalFormatter&&l&&f&&v&&(d=c.finalFormatter.format({translation:d,language:f,params:o})),d};return Object.freeze({setFinalFormatter:e=>{c.finalFormatter=e},addFormatter:e=>{e&&c.formatters.push(e)},formatTranslation:v,setObserver:e=>{c.observer=null==e?void 0:e({translate:f,onClick:u})},getObserver:()=>c.observer,setUi:e=>{s.ui=(null==e?void 0:e.UI)||e},getUi:()=>s.ui,addBackend:e=>{e&&c.backends.push(e)},setDevBackend:e=>{c.devBackend=e},getDevBackend:()=>c.devBackend,getBackendRecord:({language:e,namespace:n})=>{for(const t of c.backends){const a=t.getRecord({language:e,namespace:n});if(l(a))return null==a?void 0:a.catch((e=>(console.error(e),{})));if(void 0!==a)return a}},getBackendDevRecord:({language:e,namespace:n})=>{var a;return null===(a=c.devBackend)||void 0===a?void 0:a.getRecord({apiKey:t().apiKey,apiUrl:t().apiUrl,language:e,namespace:n})},setLanguageDetector:e=>{c.languageDetector=e},getLanguageDetector:()=>c.languageDetector,setLanguageStorage:e=>{c.languageStorage=e},getLanguageStorage:()=>c.languageStorage,getInitialLanguage:()=>{var e;const n=a(),t=null===(e=c.languageStorage)||void 0===e?void 0:e.getLanguage();return d(t,(e=>n&&!n.includes(e)||!e?(()=>{if(!c.languageDetector)return;const e=a();return c.languageDetector.getLanguage({availableLanguages:e})})():e))},setStoredLanguage:e=>{var n;null===(n=c.languageStorage)||void 0===n||n.setLanguage(e)},run:e=>{var n;c.ui=s.ui&&new s.ui({apiKey:t().apiKey,apiUrl:t().apiUrl,highlight:g,changeTranslation:r}),null===(n=c.observer)||void 0===n||n.run({mouseHighlight:e})},stop:()=>{var e;c.ui=void 0,null===(e=c.observer)||void 0===e||e.stop()},retranslate:()=>{var e;null===(e=c.observer)||void 0===e||e.retranslate()},highlight:g,wrap:e=>{var n;return c.observer?null===(n=c.observer)||void 0===n?void 0:n.wrap(e):e.translation},unwrap:e=>{var n;return c.observer?null===(n=c.observer)||void 0===n?void 0:n.unwrap(e):{text:e,keys:[]}}})},p=(e,n,t)=>{let a=e;return Object.freeze({init:function(e){a=e},notify:function(){const e=n();a!==e&&t(e),a=e}})},m={defaultNs:"",filesUrlPrefix:"i18n/"},b=(e,n)=>{const t=Object.assign(Object.assign(Object.assign({},m),null==n?void 0:n.initialOptions),e),a=t.apiUrl;return t.apiUrl=a?a.replace(/\/+$/,""):a,{initialOptions:t,activeNamespaces:(null==n?void 0:n.activeNamespaces)||new Map,language:null==n?void 0:n.language,pendingLanguage:null==n?void 0:n.language,isInitialLoading:!1,isRunning:!1}};function h(e){var{ns:n,noWrap:t,orEmpty:a,params:i}=e,o=function(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)n.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(t[a[i]]=e[a[i]])}return t}(e,["ns","noWrap","orEmpty","params"]);return{ns:n,noWrap:t,orEmpty:a,params:Object.assign(Object.assign({},o),i)}}const y=({options:i})=>{const o=(n=>{const t=e(),a=e(),i=e(),o=e(),s=e(),c=e(),u=r(n),g=e(),l=e();return c.listen((()=>u.emit())),a.listen((()=>u.emit())),g.listen((({value:e})=>{u.emit({ns:[e.namespace],key:e.key},!0)})),Object.freeze({onPendingLanguageChange:t,onLanguageChange:a,onKeyChange:i,onKeyUpdate:u,onLoadingChange:o,onFetchingChange:s,onInitialLoaded:c,onRunningChange:l,onCacheChange:g,on:(e,n)=>{switch(e){case"pendingLanguage":return t.listen(n);case"language":return a.listen(n);case"loading":return o.listen(n);case"fetching":return s.listen(n);case"initialLoad":return c.listen(n);case"running":return l.listen(n);case"cache":return g.listen(n);case"keyUpdate":return u.listen(n)}}})})((function(){return m.getFallbackNamespaces()})),s=p(!1,(()=>L.isFetching()),o.onFetchingChange.emit),u=p(!1,(()=>k()),o.onLoadingChange.emit),m=((e,i,o)=>{let r=b(),s={};function u(){return r.language||r.initialOptions.language}function g(){return Object.assign(Object.assign({},r.initialOptions),s)}return Object.freeze({init:function(e){r=b(e,r)},isRunning:function(){return r.isRunning},setRunning:function(e){r.isRunning!==e&&(r.isRunning=e,o.emit(e))},isInitialLoading:function(){return r.isInitialLoading},setInitialLoading:function(e){r.isInitialLoading=e},getLanguage:u,setLanguage:function(n){r.language!==n&&(r.language=n,e.emit(n))},getPendingLanguage:function(){return r.pendingLanguage||u()},setPendingLanguage:function(e){r.pendingLanguage!==e&&(r.pendingLanguage=e,i.emit(e))},getInitialOptions:g,addActiveNs:function(e){n(e).forEach((e=>{const n=r.activeNamespaces.get(e);void 0!==n?r.activeNamespaces.set(e,n+1):r.activeNamespaces.set(e,1)}))},removeActiveNs:function(e){n(e).forEach((e=>{const n=r.activeNamespaces.get(e);void 0!==n&&n>1?r.activeNamespaces.set(e,n-1):r.activeNamespaces.delete(e)}))},getRequiredNamespaces:function(){return a([...r.initialOptions.ns||[r.initialOptions.defaultNs],...r.activeNamespaces.keys()])},getFallbackLangs:function(e){const n=e||u();return n?a([n,...t(n,r.initialOptions.fallbackLanguage)]):[]},getFallbackNamespaces:function(){const e=r.initialOptions.defaultNs;return a([..."string"==typeof e?[e]:[],...n(r.initialOptions.fallbackNs)])},getAvailableLanguages:function(){if(r.initialOptions.availableLanguages)return r.initialOptions.availableLanguages;if(r.initialOptions.staticData){const e=Object.keys(r.initialOptions.staticData).map((e=>c(e).language));return Array.from(new Set(e))}},withDefaultNs:function(e){return{namespace:void 0===e.namespace?g().defaultNs:e.namespace,language:e.language}},overrideCredentials:function(e){s=e}})})(o.onLanguageChange,o.onPendingLanguageChange,o.onRunningChange),y=v(m.getLanguage,m.getInitialOptions,m.getAvailableLanguages,(function({key:e,ns:t}){const a=void 0!==t?n(t):m.getFallbackNamespaces(),i=m.getFallbackLangs();return L.getTranslationNs(a,i,e)}),R,O),L=g(o.onCacheChange,y.getBackendRecord,y.getBackendDevRecord,m.withDefaultNs,m.isInitialLoading,s,u);function O(e,n,t){const a=m.withDefaultNs(e),i=L.getTranslation(a,n);return L.changeTranslation(a,n,t),{revert:()=>{L.changeTranslation(a,n,i)}}}function w(e){m.init(e),L.addStaticData(m.getInitialOptions().staticData)}function k(e){return L.isLoading(m.getLanguage(),e)}function j(){return Boolean(m.getInitialOptions().apiKey&&m.getInitialOptions().apiUrl&&y.getDevBackend())}function E(e,t){const a=function(e,t){const a=m.getFallbackLangs(e),i=void 0!==t?n(t):m.getRequiredNamespaces(),o=[];return a.forEach((e=>{i.forEach((n=>{L.exists({language:e,namespace:n},!0)||o.push({language:e,namespace:n})}))})),o}(e,t);if(a.length)return d(D(a),(()=>{}))}function R({key:e,ns:t}){const a=void 0!==t?n(t):m.getFallbackNamespaces(),i=m.getFallbackLangs();return L.getTranslationFallback(a,i,e)}function N(){const e=d(function(){if(m.getLanguage())return;if(!m.getInitialOptions().defaultLanguage)throw new Error(f("defaultLanguage"));const e=y.getInitialLanguage();return d(e,(e=>{const n=e||m.getInitialOptions().defaultLanguage;n&&m.setLanguage(n)}))}(),(()=>E()));if(l(e))return m.setInitialLoading(!0),s.notify(),u.notify(),Promise.resolve(e).then((()=>{m.setInitialLoading(!1),s.notify(),u.notify(),o.onInitialLoaded.emit()}));o.onInitialLoaded.emit()}function D(e){return L.loadRecords(e,j())}i&&w(i),o.onKeyUpdate.listen((()=>{m.isRunning()&&y.retranslate()}));return Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},o),m),y),L),{init:w,changeLanguage:async function(e){m.getPendingLanguage()===e&&m.getLanguage()===e||(m.setPendingLanguage(e),m.isRunning()&&await E(e),e===m.getPendingLanguage()&&(m.setLanguage(e),y.setStoredLanguage(e)))},getTranslation:R,changeTranslation:O,addActiveNs:async function(e,n){n||m.addActiveNs(e),m.isRunning()&&await E(void 0,e)},loadRequiredRecords:E,loadRecords:D,loadRecord:async function(e){return(await D([e]))[0]},isLoading:k,isLoaded:function(e){const t=m.getLanguage();if(!t)return!1;const a=m.getFallbackLangs(t),i=void 0!==e?n(e):m.getRequiredNamespaces(),o=[];return a.forEach((e=>{i.forEach((n=>{L.exists({language:e,namespace:n})||o.push({language:e,namespace:n})}))})),0===o.length},t:(...e)=>{const n=((e,...n)=>{let t,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof n[0]?(a.defaultValue=n[0],t=n[1]):"object"==typeof n[0]&&(t=n[0])),t&&(a=Object.assign(Object.assign({},h(t)),a)),a})(...e),t=R(n);return y.formatTranslation(Object.assign(Object.assign({},n),{translation:t}))},isDev:j,run:function(){let e;return(()=>{const e=y.getLanguageDetector();if(e&&!m.getAvailableLanguages())throw new Error(f("availableLanguages"));if(!m.getLanguage()&&!m.getInitialOptions().defaultLanguage)throw e?new Error(f("defaultLanguage")):new Error(f("language"))})(),m.isRunning()||(j()&&L.invalidate(),m.setRunning(!0),y.run(j()),e=N()),Promise.resolve(e)},stop:function(){m.isRunning()&&(y.stop(),m.setRunning(!1))}}))},L=e=>{const n=y({options:e}),t=Object.freeze({setFinalFormatter:n.setFinalFormatter,addFormatter:n.addFormatter,setObserver:n.setObserver,getObserver:n.getObserver,setUi:n.setUi,getUi:n.getUi,setDevBackend:n.setDevBackend,addBackend:n.addBackend,setLanguageDetector:n.setLanguageDetector,setLanguageStorage:n.setLanguageStorage,overrideCredentials:n.overrideCredentials}),a=e=>{const t=n.isRunning();t&&n.stop(),e(),t&&n.run()},i=Object.freeze({on:n.on,onKeyUpdate:n.onKeyUpdate.listenSome,getLanguage:n.getLanguage,getPendingLanguage:n.getPendingLanguage,changeLanguage:n.changeLanguage,changeTranslation:n.changeTranslation,addActiveNs:n.addActiveNs,removeActiveNs:n.removeActiveNs,loadRecords:n.loadRecords,loadRecord:n.loadRecord,addStaticData:n.addStaticData,getRecord:n.getRecord,getAllRecords:n.getAllRecords,isLoaded:n.isLoaded,isInitialLoading:n.isInitialLoading,isLoading:n.isLoading,isFetching:n.isFetching,isRunning:n.isRunning,run:n.run,stop:n.stop,t:n.t,highlight:n.highlight,getInitialOptions:n.getInitialOptions,isDev:n.isDev,wrap:n.wrap,unwrap:n.unwrap,use:e=>(e&&a((()=>e(i,t))),i),init:e=>(a((()=>n.init(e))),i)});return i};function O(e,n,t,a){return new(t||(t=Promise))((function(i,o){function r(e){try{c(a.next(e))}catch(e){o(e)}}function s(e){try{c(a.throw(e))}catch(e){o(e)}}function c(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(r,s)}c((a=a.apply(e,n||[])).next())}))}function w(e,n){var t,a,i,o,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(t)throw new TypeError("Generator is already executing.");for(;r;)try{if(t=1,a&&(i=2&o[0]?a.return:o[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,o[1])).done)return i;switch(a=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,a=o[1],o=[0];continue;case 7:o=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){r=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){r.label=o[1];break}if(6===o[0]&&r.label<i[1]){r.label=i[1],i=o;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(o);break}i[2]&&r.ops.pop(),r.trys.pop();continue}o=n.call(e,r)}catch(e){o=[6,e],a=0}finally{t=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function k(e){var n=e.message,t=e.recievingMessage,a=e.data;return new Promise((function(e,i){var o=function(e,n){var t=function(t){var a,i;(null===(a=t.data)||void 0===a?void 0:a.type)===e&&n(null===(i=t.data)||void 0===i?void 0:i.data)};return window.addEventListener("message",t,!1),{unsubscribe:function(){window.removeEventListener("message",t)}}}(t,(function(n){clearTimeout(r),s(),e(n)}));window.postMessage({type:n,data:a},window.origin);var r=setTimeout((function(){s(),i(new Error("Didn't recieve ".concat(t," in time.")))}),300);function s(){o.unsubscribe()}}))}var j=null;function E(e){var n;return j||(n="https://unpkg.com/@tolgee/devtools-web@".concat(e||"latest","/dist/tolgee-in-context-production.umd.min.js"),j=new Promise((function(e,t){var a=document.createElement("script");a.src=n,a.addEventListener("load",(function(){return e()})),a.addEventListener("error",(function(e){return t(e.error)})),document.body.appendChild(a)}))),j}function R(){var e=sessionStorage.getItem("__tolgee_apiKey")||void 0,n=sessionStorage.getItem("__tolgee_apiUrl")||void 0;if(e&&n)return{apiKey:e,apiUrl:n}}function N(){sessionStorage.removeItem("__tolgee_apiKey"),sessionStorage.removeItem("__tolgee_apiUrl")}var D=function(){return function(e){return e}};"undefined"!=typeof window&&(D=function(){return function(e){return e.on("running",(function(n){var t;n.value&&(t=function(){(function(e){return O(this,void 0,void 0,(function(){var n;return w(this,(function(t){switch(t.label){case 0:n=0,t.label=1;case 1:if(!(n<4))return[3,6];t.label=2;case 2:return t.trys.push([2,4,,5]),[4,k({message:"TOLGEE_READY",recievingMessage:"TOLGEE_PLUGIN_READY",data:e})];case 3:return t.sent(),[2,!0];case 4:return t.sent(),[3,5];case 5:return n++,[3,1];case 6:throw new Error("Tolgee extension not present")}}))}))})({uiPresent:!0,uiVersion:void 0,mode:e.isDev()?"development":"production",config:{apiUrl:e.getInitialOptions().apiUrl||"",apiKey:e.getInitialOptions().apiKey||""}}).catch(N)},"loading"!==document.readyState?Promise.resolve().then((function(){t()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",t))})),R()&&O(void 0,void 0,void 0,(function(){return w(this,(function(e){switch(e.label){case 0:return[4,E("rc")];case 1:return e.sent(),[2,function(e,n){var t=R(),a=window["@tolgee/tolgee-in-context-production"].InContextProduction;return e.use(a()),n.overrideCredentials(t),e}]}}))})).then((function(n){e.use(n)})),e}});exports.Tolgee=function(e){return L(e).use(D())},exports.TolgeeCore=L;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=()=>{let e=[];return Object.freeze({listen:n=>{const t=e=>{n(e)};return e.push(t),{unsubscribe:()=>{e=e.filter((e=>t!==e))}}},emit:n=>{e.forEach((e=>e({value:n})))}})};function n(e){return function(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}(e)||[]}function t(e,t){return"object"!=typeof(a=t)||Array.isArray(a)||null===a?n(t):n(null==t?void 0:t[e]);var a}function a(e){return Array.from(new Set(e))}function i(e,n){const t=e.get(n)||0;e.set(n,t+1)}function r(e,n){let t=e.get(n)||1;t-=1,t<=0?e.delete(n):e.set(n,t)}const o=e=>{const t=new Set,a=new Set,o=n=>{if(n.has(void 0)){const t=new Set(n.keys());return t.delete(void 0),e().forEach((e=>t.add(e))),t}return n};let s=[];const c=()=>{if(0===s.length)return;t.forEach((e=>{e({value:void 0})}));const e=new Set;let n=new Set;s.forEach((t=>{void 0===(null==t?void 0:t.ns)?e.add(void 0):t.ns.forEach((n=>e.add(n))),void 0===(null==t?void 0:t.key)?n=void 0:void 0!==n&&n.add(t.key)}));const i=Array.from(o(e).keys());(n||[void 0]).forEach((e=>{((e,n)=>{a.forEach((t=>{const a=o(t.namespaces),i=void 0===n||-1!==(null==n?void 0:n.findIndex((e=>a.has(e)))),r=void 0===e||t.keys.has(e)||0===t.keys.size;i&&r&&t.fn({value:void 0})}))})(e,i)})),s=[]};return Object.freeze({listenSome:e=>{const t={fn:n=>{e(n)},keys:new Map,namespaces:new Map};a.add(t);const o={unsubscribe:()=>{a.delete(t)},subscribeNs:e=>(n(e).forEach((e=>i(t.namespaces,e))),o),unsubscribeNs:e=>(n(e).forEach((e=>r(t.namespaces,e))),o),subscribeKey:e=>{const{key:a,ns:r}=e;return i(t.keys,a),n(r).forEach((e=>i(t.namespaces,e))),void 0===r&&i(t.namespaces,void 0),o},unsubscribeKey:e=>{const{key:a,ns:i}=e;return r(t.keys,a),n(i).forEach((e=>r(t.namespaces,e))),void 0===i&&r(t.namespaces,void 0),o}};return o},listen:e=>{t.add(e);return{unsubscribe:()=>{t.delete(e)}}},emit:(e,n)=>{s.push(e),n?Promise.resolve().then((()=>{c()})):c()}})},s=e=>{const n=new Map;return Object.entries(e).forEach((([e,t])=>{null!=t&&("object"!=typeof t?n.set(e,t):s(t).forEach(((t,a)=>{n.set(e+"."+a,t)})))})),n},c=e=>{const[n,t]=e.split(":");return{language:n,namespace:t||""}},u=({language:e,namespace:n})=>n?`${e}:${n}`:e,g=(e,t,a,i,r,o,g)=>{const l=new Map,d=new Map;let f={},v=0;function p(n,t,a){const i=u(n);d.set(i,{data:s(t),version:a}),e.emit(n)}function m(e,n){p(e,n,v)}function h(e,n=!1){const t=d.get(u(e));return t&&n?t.version===v:Boolean(t)}function b(e){var n;return null===(n=d.get(u(i(e))))||void 0===n?void 0:n.data}function y(e){let n;if(!n){const t=f[u(e)];"function"==typeof t&&(n=t())}return n||(n=t(e)),n||(n=Promise.resolve({})),n}return Object.freeze({addStaticData:function(e){e&&(f=Object.assign(Object.assign({},f),e),Object.entries(e).forEach((([e,n])=>{if("function"!=typeof n){const t=c(e),a=d.get(e);a&&0!==a.version||p(t,n,0)}})))},invalidate:function(){l.clear(),v+=1},addRecord:m,exists:h,getRecord:b,getTranslation:function(e,n){var t;return null===(t=d.get(u(e)))||void 0===t?void 0:t.data.get(n)},getTranslationNs:function(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=d.get(u({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return i}return Array.from(new Set(e))},getTranslationFallback:function(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=d.get(u({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return n}},changeTranslation:function(n,t,a){var i;const r=null===(i=d.get(u(n)))||void 0===i?void 0:i.data;null==r||r.set(t,a),e.emit(Object.assign(Object.assign({},n),{key:t}))},isFetching:function(e){if(r())return!0;if(void 0===e)return l.size>0;const t=n(e);return Boolean(Array.from(l.keys()).find((e=>t.includes(c(e).namespace))))},isLoading:function(e,t){const a=n(t);return Boolean(r()||Array.from(l.keys()).find((n=>{const t=c(n);return(!a.length||a.includes(t.namespace))&&!h({namespace:t.namespace,language:e})})))},loadRecords:async function(e,n){const t=e.map((e=>{const t=i(e),r=u(t),o=l.get(r);if(o)return{new:!1,promise:o,keyObject:t,cacheKey:r};const s=function(e,n){var t;let i;return n&&(i=null===(t=a(e))||void 0===t?void 0:t.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),y(e))))),i||(i=y(e)),i}(t,n);return l.set(r,s),{new:!0,promise:s,keyObject:t,cacheKey:r}}));o.notify(),g.notify();const r=await Promise.all(t.map((e=>e.promise)));return t.forEach(((e,n)=>{const t=l.get(e.cacheKey)!==e.promise;if(e.new&&!t){l.delete(e.cacheKey);const t=r[n];t&&m(e.keyObject,t)}})),o.notify(),g.notify(),t.map((e=>b(e.keyObject)))},getAllRecords:function(){return Array.from(d.entries()).map((([e,n])=>Object.assign(Object.assign({},c(e)),{data:n.data})))}})};function l(e){return Boolean(e&&"function"==typeof e.then)}const d=(e,n)=>l(e)?Promise.resolve(e).then(n):n(e),f=e=>`Tolgee: You need to specify '${e}' option`,v=(e,t,a,i,r,o,s)=>{const c={ui:void 0,observer:void 0},u={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},g=async(e,{keysAndDefaults:t})=>{var a;const i=t.map((({key:e,ns:t,defaultValue:a})=>({key:e,defaultValue:a,ns:n(r({key:e,ns:t,defaultValue:a})),translation:o({key:e,ns:t})})));null===(a=u.ui)||void 0===a||a.handleElementClick(e,i)},f=(e,n)=>{var t,a;return(null===(a=null===(t=u.observer)||void 0===t?void 0:t.highlight)||void 0===a?void 0:a.call(t,e,n))||{unhighlight(){}}},v=e=>{const n=o(e);return p(Object.assign(Object.assign({},e),{translation:n,formatEnabled:!0}))},p=({key:n,translation:t,defaultValue:a,noWrap:i,params:r,orEmpty:o,ns:s,formatEnabled:c})=>{var g;const l=t||a;let d=l||(o?"":n);u.observer&&!i&&(d=u.observer.wrap({key:n,translation:d,defaultValue:a,params:r,ns:s}));const f=e(),v=c||!(null===(g=u.observer)||void 0===g?void 0:g.outputNotFormattable);if(l&&f&&v)for(const e of u.formatters)d=e.format({translation:d,language:f,params:r});return u.finalFormatter&&l&&f&&v&&(d=u.finalFormatter.format({translation:d,language:f,params:r})),d};return Object.freeze({setFinalFormatter:e=>{u.finalFormatter=e},addFormatter:e=>{e&&u.formatters.push(e)},formatTranslation:p,setObserver:e=>{c.observer=e},hasObserver:()=>Boolean(c.observer),setUi:e=>{c.ui=(null==e?void 0:e.UI)||e},hasUi:()=>Boolean(c.ui),addBackend:e=>{e&&u.backends.push(e)},setDevBackend:e=>{u.devBackend=e},getDevBackend:()=>u.devBackend,getBackendRecord:({language:e,namespace:n})=>{for(const t of u.backends){const a=t.getRecord({language:e,namespace:n});if(l(a))return null==a?void 0:a.catch((e=>(console.error(e),{})));if(void 0!==a)return a}},getBackendDevRecord:({language:e,namespace:n})=>{var a;return null===(a=u.devBackend)||void 0===a?void 0:a.getRecord({apiKey:t().apiKey,apiUrl:t().apiUrl,language:e,namespace:n})},setLanguageDetector:e=>{u.languageDetector=e},getLanguageDetector:()=>u.languageDetector,setLanguageStorage:e=>{u.languageStorage=e},getLanguageStorage:()=>u.languageStorage,getInitialLanguage:()=>{var e;const n=i(),t=null===(e=u.languageStorage)||void 0===e?void 0:e.getLanguage();return d(t,(e=>n&&!n.includes(e)||!e?(()=>{if(!u.languageDetector)return;const e=i();return u.languageDetector.getLanguage({availableLanguages:e})})():e))},setStoredLanguage:e=>{var n;null===(n=u.languageStorage)||void 0===n||n.setLanguage(e)},run:e=>{var n,i;u.ui=c.ui&&new c.ui({apiKey:t().apiKey,apiUrl:t().apiUrl,highlight:f,changeTranslation:s}),u.observer||(u.observer=null===(n=c.observer)||void 0===n?void 0:n.call(c,{translate:v,onClick:g,options:a()})),null===(i=u.observer)||void 0===i||i.run({mouseHighlight:e})},stop:()=>{var e;u.ui=void 0,null===(e=u.observer)||void 0===e||e.stop()},retranslate:()=>{var e;null===(e=u.observer)||void 0===e||e.retranslate()},highlight:f,wrap:e=>{var n;return u.observer?null===(n=u.observer)||void 0===n?void 0:n.wrap(e):e.translation},unwrap:e=>{var n;return u.observer?null===(n=u.observer)||void 0===n?void 0:n.unwrap(e):{text:e,keys:[]}}})},p=(e,n,t)=>{let a=e;return Object.freeze({init:function(e){a=e},notify:function(){const e=n();a!==e&&t(e),a=e}})},m={tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:["Alt"],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"]},h=e=>Object.assign(Object.assign({},m),e),b={defaultNs:"",filesUrlPrefix:"i18n/"},y=(e,n)=>{const t=Object.assign(Object.assign(Object.assign({},b),null==n?void 0:n.initialOptions),e),a=t.apiUrl;return t.apiUrl=a?a.replace(/\/+$/,""):a,{initialOptions:t,activeNamespaces:(null==n?void 0:n.activeNamespaces)||new Map,language:null==n?void 0:n.language,pendingLanguage:null==n?void 0:n.language,isInitialLoading:!1,isRunning:!1}};function L(e){var{ns:n,noWrap:t,orEmpty:a,params:i}=e,r=function(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)n.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(t[a[i]]=e[a[i]])}return t}(e,["ns","noWrap","orEmpty","params"]);return{ns:n,noWrap:t,orEmpty:a,params:Object.assign(Object.assign({},r),i)}}const O=({options:i})=>{const r=(n=>{const t=e(),a=e(),i=e(),r=e(),s=e(),c=e(),u=o(n),g=e(),l=e();return c.listen((()=>u.emit())),a.listen((()=>u.emit())),g.listen((({value:e})=>{u.emit({ns:[e.namespace],key:e.key},!0)})),Object.freeze({onPendingLanguageChange:t,onLanguageChange:a,onKeyChange:i,onKeyUpdate:u,onLoadingChange:r,onFetchingChange:s,onInitialLoaded:c,onRunningChange:l,onCacheChange:g,on:(e,n)=>{switch(e){case"pendingLanguage":return t.listen(n);case"language":return a.listen(n);case"loading":return r.listen(n);case"fetching":return s.listen(n);case"initialLoad":return c.listen(n);case"running":return l.listen(n);case"cache":return g.listen(n);case"keyUpdate":return u.listen(n)}}})})((function(){return m.getFallbackNamespaces()})),s=p(!1,(()=>O.isFetching()),r.onFetchingChange.emit),u=p(!1,(()=>j()),r.onLoadingChange.emit),m=((e,i,r)=>{let o=y(),s=h(),u={};function g(){return o.language||o.initialOptions.language}function l(){return Object.assign(Object.assign({},o.initialOptions),u)}return Object.freeze({init:function(e){o=y(e,o)},isRunning:function(){return o.isRunning},setRunning:function(e){o.isRunning!==e&&(o.isRunning=e,r.emit(e))},isInitialLoading:function(){return o.isInitialLoading},setInitialLoading:function(e){o.isInitialLoading=e},getLanguage:g,setLanguage:function(n){o.language!==n&&(o.language=n,e.emit(n))},getPendingLanguage:function(){return o.pendingLanguage||g()},setPendingLanguage:function(e){o.pendingLanguage!==e&&(o.pendingLanguage=e,i.emit(e))},getInitialOptions:l,addActiveNs:function(e){n(e).forEach((e=>{const n=o.activeNamespaces.get(e);void 0!==n?o.activeNamespaces.set(e,n+1):o.activeNamespaces.set(e,1)}))},removeActiveNs:function(e){n(e).forEach((e=>{const n=o.activeNamespaces.get(e);void 0!==n&&n>1?o.activeNamespaces.set(e,n-1):o.activeNamespaces.delete(e)}))},getRequiredNamespaces:function(){return a([...o.initialOptions.ns||[o.initialOptions.defaultNs],...o.activeNamespaces.keys()])},getFallbackLangs:function(e){const n=e||g();return n?a([n,...t(n,o.initialOptions.fallbackLanguage)]):[]},getFallbackNamespaces:function(){const e=o.initialOptions.defaultNs;return a([..."string"==typeof e?[e]:[],...n(o.initialOptions.fallbackNs)])},getAvailableLanguages:function(){if(o.initialOptions.availableLanguages)return o.initialOptions.availableLanguages;if(o.initialOptions.staticData){const e=Object.keys(o.initialOptions.staticData).map((e=>c(e).language));return Array.from(new Set(e))}},withDefaultNs:function(e){return{namespace:void 0===e.namespace?l().defaultNs:e.namespace,language:e.language}},overrideCredentials:function(e){u=e},setObserverOptions:function(e){s=h(e)},getObserverOptions:function(){return s}})})(r.onLanguageChange,r.onPendingLanguageChange,r.onRunningChange),b=v(m.getLanguage,m.getInitialOptions,m.getObserverOptions,m.getAvailableLanguages,(function({key:e,ns:t}){const a=void 0!==t?n(t):m.getFallbackNamespaces(),i=m.getFallbackLangs();return O.getTranslationNs(a,i,e)}),N,w),O=g(r.onCacheChange,b.getBackendRecord,b.getBackendDevRecord,m.withDefaultNs,m.isInitialLoading,s,u);function w(e,n,t){const a=m.withDefaultNs(e),i=O.getTranslation(a,n);return O.changeTranslation(a,n,t),{revert:()=>{O.changeTranslation(a,n,i)}}}function k(e){m.init(e),O.addStaticData(m.getInitialOptions().staticData)}function j(e){return O.isLoading(m.getLanguage(),e)}function E(){return Boolean(m.getInitialOptions().apiKey&&m.getInitialOptions().apiUrl&&b.getDevBackend())}function R(e,t){const a=function(e,t){const a=m.getFallbackLangs(e),i=void 0!==t?n(t):m.getRequiredNamespaces(),r=[];return a.forEach((e=>{i.forEach((n=>{O.exists({language:e,namespace:n},!0)||r.push({language:e,namespace:n})}))})),r}(e,t);if(a.length)return d(I(a),(()=>{}))}function N({key:e,ns:t}){const a=void 0!==t?n(t):m.getFallbackNamespaces(),i=m.getFallbackLangs();return O.getTranslationFallback(a,i,e)}function D(){const e=d(function(){if(m.getLanguage())return;if(!m.getInitialOptions().defaultLanguage)throw new Error(f("defaultLanguage"));const e=b.getInitialLanguage();return d(e,(e=>{const n=e||m.getInitialOptions().defaultLanguage;n&&m.setLanguage(n)}))}(),(()=>R()));if(l(e))return m.setInitialLoading(!0),s.notify(),u.notify(),Promise.resolve(e).then((()=>{m.setInitialLoading(!1),s.notify(),u.notify(),r.onInitialLoaded.emit()}));r.onInitialLoaded.emit()}function I(e){return O.loadRecords(e,E())}i&&k(i),r.onKeyUpdate.listen((()=>{m.isRunning()&&b.retranslate()}));return Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},r),m),b),O),{init:k,changeLanguage:async function(e){m.getPendingLanguage()===e&&m.getLanguage()===e||(m.setPendingLanguage(e),m.isRunning()&&await R(e),e===m.getPendingLanguage()&&(m.setLanguage(e),b.setStoredLanguage(e)))},getTranslation:N,changeTranslation:w,addActiveNs:async function(e,n){n||m.addActiveNs(e),m.isRunning()&&await R(void 0,e)},loadRequiredRecords:R,loadRecords:I,loadRecord:async function(e){return(await I([e]))[0]},isLoading:j,isLoaded:function(e){const t=m.getLanguage();if(!t)return!1;const a=m.getFallbackLangs(t),i=void 0!==e?n(e):m.getRequiredNamespaces(),r=[];return a.forEach((e=>{i.forEach((n=>{O.exists({language:e,namespace:n})||r.push({language:e,namespace:n})}))})),0===r.length},t:(...e)=>{const n=((e,...n)=>{let t,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof n[0]?(a.defaultValue=n[0],t=n[1]):"object"==typeof n[0]&&(t=n[0])),t&&(a=Object.assign(Object.assign({},L(t)),a)),a})(...e),t=N(n);return b.formatTranslation(Object.assign(Object.assign({},n),{translation:t}))},isDev:E,run:function(){let e;return(()=>{const e=b.getLanguageDetector();if(e&&!m.getAvailableLanguages())throw new Error(f("availableLanguages"));if(!m.getLanguage()&&!m.getInitialOptions().defaultLanguage)throw e?new Error(f("defaultLanguage")):new Error(f("language"))})(),m.isRunning()||(E()&&O.invalidate(),m.setRunning(!0),b.run(E()),e=D()),Promise.resolve(e)},stop:function(){m.isRunning()&&(b.stop(),m.setRunning(!1))}}))},w=e=>{const n=O({options:e}),t=Object.freeze({setFinalFormatter:n.setFinalFormatter,addFormatter:n.addFormatter,setObserver:n.setObserver,hasObserver:n.hasObserver,setUi:n.setUi,hasUi:n.hasUi,setDevBackend:n.setDevBackend,addBackend:n.addBackend,setLanguageDetector:n.setLanguageDetector,setLanguageStorage:n.setLanguageStorage,overrideCredentials:n.overrideCredentials}),a=e=>{const t=n.isRunning();t&&n.stop(),e(),t&&n.run()},i=Object.freeze({on:n.on,onKeyUpdate:n.onKeyUpdate.listenSome,getLanguage:n.getLanguage,getPendingLanguage:n.getPendingLanguage,changeLanguage:n.changeLanguage,changeTranslation:n.changeTranslation,addActiveNs:n.addActiveNs,removeActiveNs:n.removeActiveNs,loadRecords:n.loadRecords,loadRecord:n.loadRecord,addStaticData:n.addStaticData,getRecord:n.getRecord,getAllRecords:n.getAllRecords,isLoaded:n.isLoaded,isInitialLoading:n.isInitialLoading,isLoading:n.isLoading,isFetching:n.isFetching,isRunning:n.isRunning,run:n.run,stop:n.stop,t:n.t,highlight:n.highlight,getInitialOptions:n.getInitialOptions,isDev:n.isDev,wrap:n.wrap,unwrap:n.unwrap,setObserverOptions:e=>(n.setObserverOptions(e),i),use:e=>(e&&a((()=>e(i,t))),i),init:e=>(a((()=>n.init(e))),i)});return i};function k(e,n,t,a){return new(t||(t=Promise))((function(i,r){function o(e){try{c(a.next(e))}catch(e){r(e)}}function s(e){try{c(a.throw(e))}catch(e){r(e)}}function c(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,s)}c((a=a.apply(e,n||[])).next())}))}function j(e,n){var t,a,i,r,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(t)throw new TypeError("Generator is already executing.");for(;o;)try{if(t=1,a&&(i=2&r[0]?a.return:r[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,r[1])).done)return i;switch(a=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,a=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){o.label=r[1];break}if(6===r[0]&&o.label<i[1]){o.label=i[1],i=r;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(r);break}i[2]&&o.ops.pop(),o.trys.pop();continue}r=n.call(e,o)}catch(e){r=[6,e],a=0}finally{t=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}function E(e){var n=e.message,t=e.recievingMessage,a=e.data;return new Promise((function(e,i){var r=function(e,n){var t=function(t){var a,i;(null===(a=t.data)||void 0===a?void 0:a.type)===e&&n(null===(i=t.data)||void 0===i?void 0:i.data)};return window.addEventListener("message",t,!1),{unsubscribe:function(){window.removeEventListener("message",t)}}}(t,(function(n){clearTimeout(o),s(),e(n)}));window.postMessage({type:n,data:a},window.origin);var o=setTimeout((function(){s(),i(new Error("Didn't recieve ".concat(t," in time.")))}),300);function s(){r.unsubscribe()}}))}var R=null;function N(e){var n;return R||(R=(n="https://unpkg.com/@tolgee/web@".concat(e||"latest","/dist/").concat("tolgee-in-context-tools.umd.min.js"),new Promise((function(e,t){var a=document.createElement("script");a.src=n,a.addEventListener("load",(function(){return e()})),a.addEventListener("error",(function(e){return t(e.error)})),document.body.appendChild(a)}))).then((function(){return window["@tolgee/in-context-tools"].InContextTools}))),R}function D(){var e=sessionStorage.getItem("__tolgee_apiKey")||void 0,n=sessionStorage.getItem("__tolgee_apiUrl")||void 0;if(e&&n)return{apiKey:e,apiUrl:n}}function I(){sessionStorage.removeItem("__tolgee_apiKey"),sessionStorage.removeItem("__tolgee_apiUrl")}var S=function(){return function(e){return e}};"undefined"!=typeof window&&(S=function(){return function(e){return e.on("running",(function(n){var t;n.value&&(t=function(){(function(e){return k(this,void 0,void 0,(function(){var n;return j(this,(function(t){switch(t.label){case 0:n=0,t.label=1;case 1:if(!(n<4))return[3,6];t.label=2;case 2:return t.trys.push([2,4,,5]),[4,E({message:"TOLGEE_READY",recievingMessage:"TOLGEE_PLUGIN_READY",data:e})];case 3:return t.sent(),[2,!0];case 4:return t.sent(),[3,5];case 5:return n++,[3,1];case 6:throw new Error("Tolgee extension not present")}}))}))})({uiPresent:!0,uiVersion:void 0,mode:e.isDev()?"development":"production",config:{apiUrl:e.getInitialOptions().apiUrl||"",apiKey:e.getInitialOptions().apiKey||""}}).catch(I)},"loading"!==document.readyState?Promise.resolve().then((function(){t()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",t))})),D()&&k(void 0,void 0,void 0,(function(){var e;return j(this,(function(n){switch(n.label){case 0:return[4,N("rc")];case 1:return e=n.sent(),[2,function(n){var t=D();return n.use(e(t)),n}]}}))})).then((function(n){e.use(n)})),e}});exports.Tolgee=function(e){return w(e).use(S())},exports.TolgeeCore=w;
//# sourceMappingURL=tolgee-web-tolgee.cjs.min.js.map

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/web-tolgee"]={})}(this,(function(e){"use strict";const n=()=>{let e=[];return Object.freeze({listen:n=>{const t=e=>{n(e)};return e.push(t),{unsubscribe:()=>{e=e.filter((e=>t!==e))}}},emit:n=>{e.forEach((e=>e({value:n})))}})};function t(e){return function(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}(e)||[]}function a(e,n){return"object"!=typeof(a=n)||Array.isArray(a)||null===a?t(n):t(null==n?void 0:n[e]);var a}function i(e){return Array.from(new Set(e))}function o(e,n){const t=e.get(n)||0;e.set(n,t+1)}function r(e,n){let t=e.get(n)||1;t-=1,t<=0?e.delete(n):e.set(n,t)}const s=e=>{const n=new Set,a=new Set,i=n=>{if(n.has(void 0)){const t=new Set(n.keys());return t.delete(void 0),e().forEach((e=>t.add(e))),t}return n};let s=[];const c=()=>{if(0===s.length)return;n.forEach((e=>{e({value:void 0})}));const e=new Set;let t=new Set;s.forEach((n=>{void 0===(null==n?void 0:n.ns)?e.add(void 0):n.ns.forEach((n=>e.add(n))),void 0===(null==n?void 0:n.key)?t=void 0:void 0!==t&&t.add(n.key)}));const o=Array.from(i(e).keys());(t||[void 0]).forEach((e=>{((e,n)=>{a.forEach((t=>{const a=i(t.namespaces),o=void 0===n||-1!==(null==n?void 0:n.findIndex((e=>a.has(e)))),r=void 0===e||t.keys.has(e)||0===t.keys.size;o&&r&&t.fn({value:void 0})}))})(e,o)})),s=[]};return Object.freeze({listenSome:e=>{const n={fn:n=>{e(n)},keys:new Map,namespaces:new Map};a.add(n);const i={unsubscribe:()=>{a.delete(n)},subscribeNs:e=>(t(e).forEach((e=>o(n.namespaces,e))),i),unsubscribeNs:e=>(t(e).forEach((e=>r(n.namespaces,e))),i),subscribeKey:e=>{const{key:a,ns:r}=e;return o(n.keys,a),t(r).forEach((e=>o(n.namespaces,e))),void 0===r&&o(n.namespaces,void 0),i},unsubscribeKey:e=>{const{key:a,ns:o}=e;return r(n.keys,a),t(o).forEach((e=>r(n.namespaces,e))),void 0===o&&r(n.namespaces,void 0),i}};return i},listen:e=>{n.add(e);return{unsubscribe:()=>{n.delete(e)}}},emit:(e,n)=>{s.push(e),n?Promise.resolve().then((()=>{c()})):c()}})},c=e=>{const n=new Map;return Object.entries(e).forEach((([e,t])=>{null!=t&&("object"!=typeof t?n.set(e,t):c(t).forEach(((t,a)=>{n.set(e+"."+a,t)})))})),n},u=e=>{const[n,t]=e.split(":");return{language:n,namespace:t||""}},g=({language:e,namespace:n})=>n?`${e}:${n}`:e,l=(e,n,a,i,o,r,s)=>{const l=new Map,d=new Map;let f={},v=0;function p(n,t,a){const i=g(n);d.set(i,{data:c(t),version:a}),e.emit(n)}function m(e,n){p(e,n,v)}function b(e,n=!1){const t=d.get(g(e));return t&&n?t.version===v:Boolean(t)}function h(e){var n;return null===(n=d.get(g(i(e))))||void 0===n?void 0:n.data}function y(e){let t;if(!t){const n=f[g(e)];"function"==typeof n&&(t=n())}return t||(t=n(e)),t||(t=Promise.resolve({})),t}return Object.freeze({addStaticData:function(e){e&&(f=Object.assign(Object.assign({},f),e),Object.entries(e).forEach((([e,n])=>{if("function"!=typeof n){const t=u(e),a=d.get(e);a&&0!==a.version||p(t,n,0)}})))},invalidate:function(){l.clear(),v+=1},addRecord:m,exists:b,getRecord:h,getTranslation:function(e,n){var t;return null===(t=d.get(g(e)))||void 0===t?void 0:t.data.get(n)},getTranslationNs:function(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=d.get(g({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return i}return Array.from(new Set(e))},getTranslationFallback:function(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=d.get(g({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return n}},changeTranslation:function(n,t,a){var i;const o=null===(i=d.get(g(n)))||void 0===i?void 0:i.data;null==o||o.set(t,a),e.emit(Object.assign(Object.assign({},n),{key:t}))},isFetching:function(e){if(o())return!0;if(void 0===e)return l.size>0;const n=t(e);return Boolean(Array.from(l.keys()).find((e=>n.includes(u(e).namespace))))},isLoading:function(e,n){const a=t(n);return Boolean(o()||Array.from(l.keys()).find((n=>{const t=u(n);return(!a.length||a.includes(t.namespace))&&!b({namespace:t.namespace,language:e})})))},loadRecords:async function(e,n){const t=e.map((e=>{const t=i(e),o=g(t),r=l.get(o);if(r)return{new:!1,promise:r,keyObject:t,cacheKey:o};const s=function(e,n){var t;let i;return n&&(i=null===(t=a(e))||void 0===t?void 0:t.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),y(e))))),i||(i=y(e)),i}(t,n);return l.set(o,s),{new:!0,promise:s,keyObject:t,cacheKey:o}}));r.notify(),s.notify();const o=await Promise.all(t.map((e=>e.promise)));return t.forEach(((e,n)=>{const t=l.get(e.cacheKey)!==e.promise;if(e.new&&!t){l.delete(e.cacheKey);const t=o[n];t&&m(e.keyObject,t)}})),r.notify(),s.notify(),t.map((e=>h(e.keyObject)))},getAllRecords:function(){return Array.from(d.entries()).map((([e,n])=>Object.assign(Object.assign({},u(e)),{data:n.data})))}})};function d(e){return Boolean(e&&"function"==typeof e.then)}const f=(e,n)=>d(e)?Promise.resolve(e).then(n):n(e),v=e=>`Tolgee: You need to specify '${e}' option`,p=(e,n,a,i,o,r)=>{const s={ui:void 0},c={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},u=async(e,{keysAndDefaults:n})=>{var a;const r=n.map((({key:e,ns:n,defaultValue:a})=>({key:e,defaultValue:a,ns:t(i({key:e,ns:n,defaultValue:a})),translation:o({key:e,ns:n})})));null===(a=c.ui)||void 0===a||a.handleElementClick(e,r)},g=(e,n)=>{var t,a;return(null===(a=null===(t=c.observer)||void 0===t?void 0:t.highlight)||void 0===a?void 0:a.call(t,e,n))||{unhighlight(){}}},l=e=>{const n=o(e);return v(Object.assign(Object.assign({},e),{translation:n,formatEnabled:!0}))},v=({key:n,translation:t,defaultValue:a,noWrap:i,params:o,orEmpty:r,ns:s,formatEnabled:u})=>{var g;const l=t||a;let d=l||(r?"":n);c.observer&&!i&&(d=c.observer.wrap({key:n,translation:d,defaultValue:a,params:o,ns:s}));const f=e(),v=u||!(null===(g=c.observer)||void 0===g?void 0:g.outputNotFormattable);if(l&&f&&v)for(const e of c.formatters)d=e.format({translation:d,language:f,params:o});return c.finalFormatter&&l&&f&&v&&(d=c.finalFormatter.format({translation:d,language:f,params:o})),d};return Object.freeze({setFinalFormatter:e=>{c.finalFormatter=e},addFormatter:e=>{e&&c.formatters.push(e)},formatTranslation:v,setObserver:e=>{c.observer=null==e?void 0:e({translate:l,onClick:u})},getObserver:()=>c.observer,setUi:e=>{s.ui=(null==e?void 0:e.UI)||e},getUi:()=>s.ui,addBackend:e=>{e&&c.backends.push(e)},setDevBackend:e=>{c.devBackend=e},getDevBackend:()=>c.devBackend,getBackendRecord:({language:e,namespace:n})=>{for(const t of c.backends){const a=t.getRecord({language:e,namespace:n});if(d(a))return null==a?void 0:a.catch((e=>(console.error(e),{})));if(void 0!==a)return a}},getBackendDevRecord:({language:e,namespace:t})=>{var a;return null===(a=c.devBackend)||void 0===a?void 0:a.getRecord({apiKey:n().apiKey,apiUrl:n().apiUrl,language:e,namespace:t})},setLanguageDetector:e=>{c.languageDetector=e},getLanguageDetector:()=>c.languageDetector,setLanguageStorage:e=>{c.languageStorage=e},getLanguageStorage:()=>c.languageStorage,getInitialLanguage:()=>{var e;const n=a(),t=null===(e=c.languageStorage)||void 0===e?void 0:e.getLanguage();return f(t,(e=>n&&!n.includes(e)||!e?(()=>{if(!c.languageDetector)return;const e=a();return c.languageDetector.getLanguage({availableLanguages:e})})():e))},setStoredLanguage:e=>{var n;null===(n=c.languageStorage)||void 0===n||n.setLanguage(e)},run:e=>{var t;c.ui=s.ui&&new s.ui({apiKey:n().apiKey,apiUrl:n().apiUrl,highlight:g,changeTranslation:r}),null===(t=c.observer)||void 0===t||t.run({mouseHighlight:e})},stop:()=>{var e;c.ui=void 0,null===(e=c.observer)||void 0===e||e.stop()},retranslate:()=>{var e;null===(e=c.observer)||void 0===e||e.retranslate()},highlight:g,wrap:e=>{var n;return c.observer?null===(n=c.observer)||void 0===n?void 0:n.wrap(e):e.translation},unwrap:e=>{var n;return c.observer?null===(n=c.observer)||void 0===n?void 0:n.unwrap(e):{text:e,keys:[]}}})},m=(e,n,t)=>{let a=e;return Object.freeze({init:function(e){a=e},notify:function(){const e=n();a!==e&&t(e),a=e}})},b={defaultNs:"",filesUrlPrefix:"i18n/"},h=(e,n)=>{const t=Object.assign(Object.assign(Object.assign({},b),null==n?void 0:n.initialOptions),e),a=t.apiUrl;return t.apiUrl=a?a.replace(/\/+$/,""):a,{initialOptions:t,activeNamespaces:(null==n?void 0:n.activeNamespaces)||new Map,language:null==n?void 0:n.language,pendingLanguage:null==n?void 0:n.language,isInitialLoading:!1,isRunning:!1}};function y(e){var{ns:n,noWrap:t,orEmpty:a,params:i}=e,o=function(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)n.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(t[a[i]]=e[a[i]])}return t}(e,["ns","noWrap","orEmpty","params"]);return{ns:n,noWrap:t,orEmpty:a,params:Object.assign(Object.assign({},o),i)}}const L=({options:e})=>{const o=(e=>{const t=n(),a=n(),i=n(),o=n(),r=n(),c=n(),u=s(e),g=n(),l=n();return c.listen((()=>u.emit())),a.listen((()=>u.emit())),g.listen((({value:e})=>{u.emit({ns:[e.namespace],key:e.key},!0)})),Object.freeze({onPendingLanguageChange:t,onLanguageChange:a,onKeyChange:i,onKeyUpdate:u,onLoadingChange:o,onFetchingChange:r,onInitialLoaded:c,onRunningChange:l,onCacheChange:g,on:(e,n)=>{switch(e){case"pendingLanguage":return t.listen(n);case"language":return a.listen(n);case"loading":return o.listen(n);case"fetching":return r.listen(n);case"initialLoad":return c.listen(n);case"running":return l.listen(n);case"cache":return g.listen(n);case"keyUpdate":return u.listen(n)}}})})((function(){return g.getFallbackNamespaces()})),r=m(!1,(()=>L.isFetching()),o.onFetchingChange.emit),c=m(!1,(()=>k()),o.onLoadingChange.emit),g=((e,n,o)=>{let r=h(),s={};function c(){return r.language||r.initialOptions.language}function g(){return Object.assign(Object.assign({},r.initialOptions),s)}return Object.freeze({init:function(e){r=h(e,r)},isRunning:function(){return r.isRunning},setRunning:function(e){r.isRunning!==e&&(r.isRunning=e,o.emit(e))},isInitialLoading:function(){return r.isInitialLoading},setInitialLoading:function(e){r.isInitialLoading=e},getLanguage:c,setLanguage:function(n){r.language!==n&&(r.language=n,e.emit(n))},getPendingLanguage:function(){return r.pendingLanguage||c()},setPendingLanguage:function(e){r.pendingLanguage!==e&&(r.pendingLanguage=e,n.emit(e))},getInitialOptions:g,addActiveNs:function(e){t(e).forEach((e=>{const n=r.activeNamespaces.get(e);void 0!==n?r.activeNamespaces.set(e,n+1):r.activeNamespaces.set(e,1)}))},removeActiveNs:function(e){t(e).forEach((e=>{const n=r.activeNamespaces.get(e);void 0!==n&&n>1?r.activeNamespaces.set(e,n-1):r.activeNamespaces.delete(e)}))},getRequiredNamespaces:function(){return i([...r.initialOptions.ns||[r.initialOptions.defaultNs],...r.activeNamespaces.keys()])},getFallbackLangs:function(e){const n=e||c();return n?i([n,...a(n,r.initialOptions.fallbackLanguage)]):[]},getFallbackNamespaces:function(){const e=r.initialOptions.defaultNs;return i([..."string"==typeof e?[e]:[],...t(r.initialOptions.fallbackNs)])},getAvailableLanguages:function(){if(r.initialOptions.availableLanguages)return r.initialOptions.availableLanguages;if(r.initialOptions.staticData){const e=Object.keys(r.initialOptions.staticData).map((e=>u(e).language));return Array.from(new Set(e))}},withDefaultNs:function(e){return{namespace:void 0===e.namespace?g().defaultNs:e.namespace,language:e.language}},overrideCredentials:function(e){s=e}})})(o.onLanguageChange,o.onPendingLanguageChange,o.onRunningChange),b=p(g.getLanguage,g.getInitialOptions,g.getAvailableLanguages,(function({key:e,ns:n}){const a=void 0!==n?t(n):g.getFallbackNamespaces(),i=g.getFallbackLangs();return L.getTranslationNs(a,i,e)}),R,O),L=l(o.onCacheChange,b.getBackendRecord,b.getBackendDevRecord,g.withDefaultNs,g.isInitialLoading,r,c);function O(e,n,t){const a=g.withDefaultNs(e),i=L.getTranslation(a,n);return L.changeTranslation(a,n,t),{revert:()=>{L.changeTranslation(a,n,i)}}}function w(e){g.init(e),L.addStaticData(g.getInitialOptions().staticData)}function k(e){return L.isLoading(g.getLanguage(),e)}function j(){return Boolean(g.getInitialOptions().apiKey&&g.getInitialOptions().apiUrl&&b.getDevBackend())}function E(e,n){const a=function(e,n){const a=g.getFallbackLangs(e),i=void 0!==n?t(n):g.getRequiredNamespaces(),o=[];return a.forEach((e=>{i.forEach((n=>{L.exists({language:e,namespace:n},!0)||o.push({language:e,namespace:n})}))})),o}(e,n);if(a.length)return f(D(a),(()=>{}))}function R({key:e,ns:n}){const a=void 0!==n?t(n):g.getFallbackNamespaces(),i=g.getFallbackLangs();return L.getTranslationFallback(a,i,e)}function N(){const e=f(function(){if(g.getLanguage())return;if(!g.getInitialOptions().defaultLanguage)throw new Error(v("defaultLanguage"));const e=b.getInitialLanguage();return f(e,(e=>{const n=e||g.getInitialOptions().defaultLanguage;n&&g.setLanguage(n)}))}(),(()=>E()));if(d(e))return g.setInitialLoading(!0),r.notify(),c.notify(),Promise.resolve(e).then((()=>{g.setInitialLoading(!1),r.notify(),c.notify(),o.onInitialLoaded.emit()}));o.onInitialLoaded.emit()}function D(e){return L.loadRecords(e,j())}e&&w(e),o.onKeyUpdate.listen((()=>{g.isRunning()&&b.retranslate()}));return Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},o),g),b),L),{init:w,changeLanguage:async function(e){g.getPendingLanguage()===e&&g.getLanguage()===e||(g.setPendingLanguage(e),g.isRunning()&&await E(e),e===g.getPendingLanguage()&&(g.setLanguage(e),b.setStoredLanguage(e)))},getTranslation:R,changeTranslation:O,addActiveNs:async function(e,n){n||g.addActiveNs(e),g.isRunning()&&await E(void 0,e)},loadRequiredRecords:E,loadRecords:D,loadRecord:async function(e){return(await D([e]))[0]},isLoading:k,isLoaded:function(e){const n=g.getLanguage();if(!n)return!1;const a=g.getFallbackLangs(n),i=void 0!==e?t(e):g.getRequiredNamespaces(),o=[];return a.forEach((e=>{i.forEach((n=>{L.exists({language:e,namespace:n})||o.push({language:e,namespace:n})}))})),0===o.length},t:(...e)=>{const n=((e,...n)=>{let t,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof n[0]?(a.defaultValue=n[0],t=n[1]):"object"==typeof n[0]&&(t=n[0])),t&&(a=Object.assign(Object.assign({},y(t)),a)),a})(...e),t=R(n);return b.formatTranslation(Object.assign(Object.assign({},n),{translation:t}))},isDev:j,run:function(){let e;return(()=>{const e=b.getLanguageDetector();if(e&&!g.getAvailableLanguages())throw new Error(v("availableLanguages"));if(!g.getLanguage()&&!g.getInitialOptions().defaultLanguage)throw e?new Error(v("defaultLanguage")):new Error(v("language"))})(),g.isRunning()||(j()&&L.invalidate(),g.setRunning(!0),b.run(j()),e=N()),Promise.resolve(e)},stop:function(){g.isRunning()&&(b.stop(),g.setRunning(!1))}}))},O=e=>{const n=L({options:e}),t=Object.freeze({setFinalFormatter:n.setFinalFormatter,addFormatter:n.addFormatter,setObserver:n.setObserver,getObserver:n.getObserver,setUi:n.setUi,getUi:n.getUi,setDevBackend:n.setDevBackend,addBackend:n.addBackend,setLanguageDetector:n.setLanguageDetector,setLanguageStorage:n.setLanguageStorage,overrideCredentials:n.overrideCredentials}),a=e=>{const t=n.isRunning();t&&n.stop(),e(),t&&n.run()},i=Object.freeze({on:n.on,onKeyUpdate:n.onKeyUpdate.listenSome,getLanguage:n.getLanguage,getPendingLanguage:n.getPendingLanguage,changeLanguage:n.changeLanguage,changeTranslation:n.changeTranslation,addActiveNs:n.addActiveNs,removeActiveNs:n.removeActiveNs,loadRecords:n.loadRecords,loadRecord:n.loadRecord,addStaticData:n.addStaticData,getRecord:n.getRecord,getAllRecords:n.getAllRecords,isLoaded:n.isLoaded,isInitialLoading:n.isInitialLoading,isLoading:n.isLoading,isFetching:n.isFetching,isRunning:n.isRunning,run:n.run,stop:n.stop,t:n.t,highlight:n.highlight,getInitialOptions:n.getInitialOptions,isDev:n.isDev,wrap:n.wrap,unwrap:n.unwrap,use:e=>(e&&a((()=>e(i,t))),i),init:e=>(a((()=>n.init(e))),i)});return i};function w(e,n,t,a){return new(t||(t=Promise))((function(i,o){function r(e){try{c(a.next(e))}catch(e){o(e)}}function s(e){try{c(a.throw(e))}catch(e){o(e)}}function c(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(r,s)}c((a=a.apply(e,n||[])).next())}))}function k(e,n){var t,a,i,o,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(t)throw new TypeError("Generator is already executing.");for(;r;)try{if(t=1,a&&(i=2&o[0]?a.return:o[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,o[1])).done)return i;switch(a=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,a=o[1],o=[0];continue;case 7:o=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){r=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){r.label=o[1];break}if(6===o[0]&&r.label<i[1]){r.label=i[1],i=o;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(o);break}i[2]&&r.ops.pop(),r.trys.pop();continue}o=n.call(e,r)}catch(e){o=[6,e],a=0}finally{t=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function j(e){var n=e.message,t=e.recievingMessage,a=e.data;return new Promise((function(e,i){var o=function(e,n){var t=function(t){var a,i;(null===(a=t.data)||void 0===a?void 0:a.type)===e&&n(null===(i=t.data)||void 0===i?void 0:i.data)};return window.addEventListener("message",t,!1),{unsubscribe:function(){window.removeEventListener("message",t)}}}(t,(function(n){clearTimeout(r),s(),e(n)}));window.postMessage({type:n,data:a},window.origin);var r=setTimeout((function(){s(),i(new Error("Didn't recieve ".concat(t," in time.")))}),300);function s(){o.unsubscribe()}}))}var E=null;function R(e){var n;return E||(n="https://unpkg.com/@tolgee/devtools-web@".concat(e||"latest","/dist/tolgee-in-context-production.umd.min.js"),E=new Promise((function(e,t){var a=document.createElement("script");a.src=n,a.addEventListener("load",(function(){return e()})),a.addEventListener("error",(function(e){return t(e.error)})),document.body.appendChild(a)}))),E}var N="__tolgee_apiKey",D="__tolgee_apiUrl";function I(){var e=sessionStorage.getItem(N)||void 0,n=sessionStorage.getItem(D)||void 0;if(e&&n)return{apiKey:e,apiUrl:n}}function S(){sessionStorage.removeItem(N),sessionStorage.removeItem(D)}var F=function(){return function(e){return e}};"undefined"!=typeof window&&(F=function(){return function(e){return e.on("running",(function(n){var t;n.value&&(t=function(){(function(e){return w(this,void 0,void 0,(function(){var n;return k(this,(function(t){switch(t.label){case 0:n=0,t.label=1;case 1:if(!(n<4))return[3,6];t.label=2;case 2:return t.trys.push([2,4,,5]),[4,j({message:"TOLGEE_READY",recievingMessage:"TOLGEE_PLUGIN_READY",data:e})];case 3:return t.sent(),[2,!0];case 4:return t.sent(),[3,5];case 5:return n++,[3,1];case 6:throw new Error("Tolgee extension not present")}}))}))})({uiPresent:!0,uiVersion:void 0,mode:e.isDev()?"development":"production",config:{apiUrl:e.getInitialOptions().apiUrl||"",apiKey:e.getInitialOptions().apiKey||""}}).catch(S)},"loading"!==document.readyState?Promise.resolve().then((function(){t()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",t))})),I()&&w(void 0,void 0,void 0,(function(){return k(this,(function(e){switch(e.label){case 0:return[4,R("rc")];case 1:return e.sent(),[2,function(e,n){var t=I(),a=window["@tolgee/tolgee-in-context-production"].InContextProduction;return e.use(a()),n.overrideCredentials(t),e}]}}))})).then((function(n){e.use(n)})),e}});e.Tolgee=function(e){return O(e).use(F())},e.TolgeeCore=O,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/web-tolgee"]={})}(this,(function(e){"use strict";const n=()=>{let e=[];return Object.freeze({listen:n=>{const t=e=>{n(e)};return e.push(t),{unsubscribe:()=>{e=e.filter((e=>t!==e))}}},emit:n=>{e.forEach((e=>e({value:n})))}})};function t(e){return function(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}(e)||[]}function a(e,n){return"object"!=typeof(a=n)||Array.isArray(a)||null===a?t(n):t(null==n?void 0:n[e]);var a}function i(e){return Array.from(new Set(e))}function o(e,n){const t=e.get(n)||0;e.set(n,t+1)}function r(e,n){let t=e.get(n)||1;t-=1,t<=0?e.delete(n):e.set(n,t)}const s=e=>{const n=new Set,a=new Set,i=n=>{if(n.has(void 0)){const t=new Set(n.keys());return t.delete(void 0),e().forEach((e=>t.add(e))),t}return n};let s=[];const c=()=>{if(0===s.length)return;n.forEach((e=>{e({value:void 0})}));const e=new Set;let t=new Set;s.forEach((n=>{void 0===(null==n?void 0:n.ns)?e.add(void 0):n.ns.forEach((n=>e.add(n))),void 0===(null==n?void 0:n.key)?t=void 0:void 0!==t&&t.add(n.key)}));const o=Array.from(i(e).keys());(t||[void 0]).forEach((e=>{((e,n)=>{a.forEach((t=>{const a=i(t.namespaces),o=void 0===n||-1!==(null==n?void 0:n.findIndex((e=>a.has(e)))),r=void 0===e||t.keys.has(e)||0===t.keys.size;o&&r&&t.fn({value:void 0})}))})(e,o)})),s=[]};return Object.freeze({listenSome:e=>{const n={fn:n=>{e(n)},keys:new Map,namespaces:new Map};a.add(n);const i={unsubscribe:()=>{a.delete(n)},subscribeNs:e=>(t(e).forEach((e=>o(n.namespaces,e))),i),unsubscribeNs:e=>(t(e).forEach((e=>r(n.namespaces,e))),i),subscribeKey:e=>{const{key:a,ns:r}=e;return o(n.keys,a),t(r).forEach((e=>o(n.namespaces,e))),void 0===r&&o(n.namespaces,void 0),i},unsubscribeKey:e=>{const{key:a,ns:o}=e;return r(n.keys,a),t(o).forEach((e=>r(n.namespaces,e))),void 0===o&&r(n.namespaces,void 0),i}};return i},listen:e=>{n.add(e);return{unsubscribe:()=>{n.delete(e)}}},emit:(e,n)=>{s.push(e),n?Promise.resolve().then((()=>{c()})):c()}})},c=e=>{const n=new Map;return Object.entries(e).forEach((([e,t])=>{null!=t&&("object"!=typeof t?n.set(e,t):c(t).forEach(((t,a)=>{n.set(e+"."+a,t)})))})),n},u=e=>{const[n,t]=e.split(":");return{language:n,namespace:t||""}},g=({language:e,namespace:n})=>n?`${e}:${n}`:e,l=(e,n,a,i,o,r,s)=>{const l=new Map,d=new Map;let f={},v=0;function p(n,t,a){const i=g(n);d.set(i,{data:c(t),version:a}),e.emit(n)}function m(e,n){p(e,n,v)}function h(e,n=!1){const t=d.get(g(e));return t&&n?t.version===v:Boolean(t)}function b(e){var n;return null===(n=d.get(g(i(e))))||void 0===n?void 0:n.data}function y(e){let t;if(!t){const n=f[g(e)];"function"==typeof n&&(t=n())}return t||(t=n(e)),t||(t=Promise.resolve({})),t}return Object.freeze({addStaticData:function(e){e&&(f=Object.assign(Object.assign({},f),e),Object.entries(e).forEach((([e,n])=>{if("function"!=typeof n){const t=u(e),a=d.get(e);a&&0!==a.version||p(t,n,0)}})))},invalidate:function(){l.clear(),v+=1},addRecord:m,exists:h,getRecord:b,getTranslation:function(e,n){var t;return null===(t=d.get(g(e)))||void 0===t?void 0:t.data.get(n)},getTranslationNs:function(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=d.get(g({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return i}return Array.from(new Set(e))},getTranslationFallback:function(e,n,t){var a;for(const i of e)for(const e of n){const n=null===(a=d.get(g({language:e,namespace:i})))||void 0===a?void 0:a.data.get(t);if(null!=n)return n}},changeTranslation:function(n,t,a){var i;const o=null===(i=d.get(g(n)))||void 0===i?void 0:i.data;null==o||o.set(t,a),e.emit(Object.assign(Object.assign({},n),{key:t}))},isFetching:function(e){if(o())return!0;if(void 0===e)return l.size>0;const n=t(e);return Boolean(Array.from(l.keys()).find((e=>n.includes(u(e).namespace))))},isLoading:function(e,n){const a=t(n);return Boolean(o()||Array.from(l.keys()).find((n=>{const t=u(n);return(!a.length||a.includes(t.namespace))&&!h({namespace:t.namespace,language:e})})))},loadRecords:async function(e,n){const t=e.map((e=>{const t=i(e),o=g(t),r=l.get(o);if(r)return{new:!1,promise:r,keyObject:t,cacheKey:o};const s=function(e,n){var t;let i;return n&&(i=null===(t=a(e))||void 0===t?void 0:t.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),y(e))))),i||(i=y(e)),i}(t,n);return l.set(o,s),{new:!0,promise:s,keyObject:t,cacheKey:o}}));r.notify(),s.notify();const o=await Promise.all(t.map((e=>e.promise)));return t.forEach(((e,n)=>{const t=l.get(e.cacheKey)!==e.promise;if(e.new&&!t){l.delete(e.cacheKey);const t=o[n];t&&m(e.keyObject,t)}})),r.notify(),s.notify(),t.map((e=>b(e.keyObject)))},getAllRecords:function(){return Array.from(d.entries()).map((([e,n])=>Object.assign(Object.assign({},u(e)),{data:n.data})))}})};function d(e){return Boolean(e&&"function"==typeof e.then)}const f=(e,n)=>d(e)?Promise.resolve(e).then(n):n(e),v=e=>`Tolgee: You need to specify '${e}' option`,p=(e,n,a,i,o,r,s)=>{const c={ui:void 0,observer:void 0},u={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},g=async(e,{keysAndDefaults:n})=>{var a;const i=n.map((({key:e,ns:n,defaultValue:a})=>({key:e,defaultValue:a,ns:t(o({key:e,ns:n,defaultValue:a})),translation:r({key:e,ns:n})})));null===(a=u.ui)||void 0===a||a.handleElementClick(e,i)},l=(e,n)=>{var t,a;return(null===(a=null===(t=u.observer)||void 0===t?void 0:t.highlight)||void 0===a?void 0:a.call(t,e,n))||{unhighlight(){}}},v=e=>{const n=r(e);return p(Object.assign(Object.assign({},e),{translation:n,formatEnabled:!0}))},p=({key:n,translation:t,defaultValue:a,noWrap:i,params:o,orEmpty:r,ns:s,formatEnabled:c})=>{var g;const l=t||a;let d=l||(r?"":n);u.observer&&!i&&(d=u.observer.wrap({key:n,translation:d,defaultValue:a,params:o,ns:s}));const f=e(),v=c||!(null===(g=u.observer)||void 0===g?void 0:g.outputNotFormattable);if(l&&f&&v)for(const e of u.formatters)d=e.format({translation:d,language:f,params:o});return u.finalFormatter&&l&&f&&v&&(d=u.finalFormatter.format({translation:d,language:f,params:o})),d};return Object.freeze({setFinalFormatter:e=>{u.finalFormatter=e},addFormatter:e=>{e&&u.formatters.push(e)},formatTranslation:p,setObserver:e=>{c.observer=e},hasObserver:()=>Boolean(c.observer),setUi:e=>{c.ui=(null==e?void 0:e.UI)||e},hasUi:()=>Boolean(c.ui),addBackend:e=>{e&&u.backends.push(e)},setDevBackend:e=>{u.devBackend=e},getDevBackend:()=>u.devBackend,getBackendRecord:({language:e,namespace:n})=>{for(const t of u.backends){const a=t.getRecord({language:e,namespace:n});if(d(a))return null==a?void 0:a.catch((e=>(console.error(e),{})));if(void 0!==a)return a}},getBackendDevRecord:({language:e,namespace:t})=>{var a;return null===(a=u.devBackend)||void 0===a?void 0:a.getRecord({apiKey:n().apiKey,apiUrl:n().apiUrl,language:e,namespace:t})},setLanguageDetector:e=>{u.languageDetector=e},getLanguageDetector:()=>u.languageDetector,setLanguageStorage:e=>{u.languageStorage=e},getLanguageStorage:()=>u.languageStorage,getInitialLanguage:()=>{var e;const n=i(),t=null===(e=u.languageStorage)||void 0===e?void 0:e.getLanguage();return f(t,(e=>n&&!n.includes(e)||!e?(()=>{if(!u.languageDetector)return;const e=i();return u.languageDetector.getLanguage({availableLanguages:e})})():e))},setStoredLanguage:e=>{var n;null===(n=u.languageStorage)||void 0===n||n.setLanguage(e)},run:e=>{var t,i;u.ui=c.ui&&new c.ui({apiKey:n().apiKey,apiUrl:n().apiUrl,highlight:l,changeTranslation:s}),u.observer||(u.observer=null===(t=c.observer)||void 0===t?void 0:t.call(c,{translate:v,onClick:g,options:a()})),null===(i=u.observer)||void 0===i||i.run({mouseHighlight:e})},stop:()=>{var e;u.ui=void 0,null===(e=u.observer)||void 0===e||e.stop()},retranslate:()=>{var e;null===(e=u.observer)||void 0===e||e.retranslate()},highlight:l,wrap:e=>{var n;return u.observer?null===(n=u.observer)||void 0===n?void 0:n.wrap(e):e.translation},unwrap:e=>{var n;return u.observer?null===(n=u.observer)||void 0===n?void 0:n.unwrap(e):{text:e,keys:[]}}})},m=(e,n,t)=>{let a=e;return Object.freeze({init:function(e){a=e},notify:function(){const e=n();a!==e&&t(e),a=e}})},h={tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:["Alt"],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"]},b=e=>Object.assign(Object.assign({},h),e),y={defaultNs:"",filesUrlPrefix:"i18n/"},L=(e,n)=>{const t=Object.assign(Object.assign(Object.assign({},y),null==n?void 0:n.initialOptions),e),a=t.apiUrl;return t.apiUrl=a?a.replace(/\/+$/,""):a,{initialOptions:t,activeNamespaces:(null==n?void 0:n.activeNamespaces)||new Map,language:null==n?void 0:n.language,pendingLanguage:null==n?void 0:n.language,isInitialLoading:!1,isRunning:!1}};function O(e){var{ns:n,noWrap:t,orEmpty:a,params:i}=e,o=function(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)n.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(t[a[i]]=e[a[i]])}return t}(e,["ns","noWrap","orEmpty","params"]);return{ns:n,noWrap:t,orEmpty:a,params:Object.assign(Object.assign({},o),i)}}const w=({options:e})=>{const o=(e=>{const t=n(),a=n(),i=n(),o=n(),r=n(),c=n(),u=s(e),g=n(),l=n();return c.listen((()=>u.emit())),a.listen((()=>u.emit())),g.listen((({value:e})=>{u.emit({ns:[e.namespace],key:e.key},!0)})),Object.freeze({onPendingLanguageChange:t,onLanguageChange:a,onKeyChange:i,onKeyUpdate:u,onLoadingChange:o,onFetchingChange:r,onInitialLoaded:c,onRunningChange:l,onCacheChange:g,on:(e,n)=>{switch(e){case"pendingLanguage":return t.listen(n);case"language":return a.listen(n);case"loading":return o.listen(n);case"fetching":return r.listen(n);case"initialLoad":return c.listen(n);case"running":return l.listen(n);case"cache":return g.listen(n);case"keyUpdate":return u.listen(n)}}})})((function(){return g.getFallbackNamespaces()})),r=m(!1,(()=>y.isFetching()),o.onFetchingChange.emit),c=m(!1,(()=>j()),o.onLoadingChange.emit),g=((e,n,o)=>{let r=L(),s=b(),c={};function g(){return r.language||r.initialOptions.language}function l(){return Object.assign(Object.assign({},r.initialOptions),c)}return Object.freeze({init:function(e){r=L(e,r)},isRunning:function(){return r.isRunning},setRunning:function(e){r.isRunning!==e&&(r.isRunning=e,o.emit(e))},isInitialLoading:function(){return r.isInitialLoading},setInitialLoading:function(e){r.isInitialLoading=e},getLanguage:g,setLanguage:function(n){r.language!==n&&(r.language=n,e.emit(n))},getPendingLanguage:function(){return r.pendingLanguage||g()},setPendingLanguage:function(e){r.pendingLanguage!==e&&(r.pendingLanguage=e,n.emit(e))},getInitialOptions:l,addActiveNs:function(e){t(e).forEach((e=>{const n=r.activeNamespaces.get(e);void 0!==n?r.activeNamespaces.set(e,n+1):r.activeNamespaces.set(e,1)}))},removeActiveNs:function(e){t(e).forEach((e=>{const n=r.activeNamespaces.get(e);void 0!==n&&n>1?r.activeNamespaces.set(e,n-1):r.activeNamespaces.delete(e)}))},getRequiredNamespaces:function(){return i([...r.initialOptions.ns||[r.initialOptions.defaultNs],...r.activeNamespaces.keys()])},getFallbackLangs:function(e){const n=e||g();return n?i([n,...a(n,r.initialOptions.fallbackLanguage)]):[]},getFallbackNamespaces:function(){const e=r.initialOptions.defaultNs;return i([..."string"==typeof e?[e]:[],...t(r.initialOptions.fallbackNs)])},getAvailableLanguages:function(){if(r.initialOptions.availableLanguages)return r.initialOptions.availableLanguages;if(r.initialOptions.staticData){const e=Object.keys(r.initialOptions.staticData).map((e=>u(e).language));return Array.from(new Set(e))}},withDefaultNs:function(e){return{namespace:void 0===e.namespace?l().defaultNs:e.namespace,language:e.language}},overrideCredentials:function(e){c=e},setObserverOptions:function(e){s=b(e)},getObserverOptions:function(){return s}})})(o.onLanguageChange,o.onPendingLanguageChange,o.onRunningChange),h=p(g.getLanguage,g.getInitialOptions,g.getObserverOptions,g.getAvailableLanguages,(function({key:e,ns:n}){const a=void 0!==n?t(n):g.getFallbackNamespaces(),i=g.getFallbackLangs();return y.getTranslationNs(a,i,e)}),N,w),y=l(o.onCacheChange,h.getBackendRecord,h.getBackendDevRecord,g.withDefaultNs,g.isInitialLoading,r,c);function w(e,n,t){const a=g.withDefaultNs(e),i=y.getTranslation(a,n);return y.changeTranslation(a,n,t),{revert:()=>{y.changeTranslation(a,n,i)}}}function k(e){g.init(e),y.addStaticData(g.getInitialOptions().staticData)}function j(e){return y.isLoading(g.getLanguage(),e)}function E(){return Boolean(g.getInitialOptions().apiKey&&g.getInitialOptions().apiUrl&&h.getDevBackend())}function R(e,n){const a=function(e,n){const a=g.getFallbackLangs(e),i=void 0!==n?t(n):g.getRequiredNamespaces(),o=[];return a.forEach((e=>{i.forEach((n=>{y.exists({language:e,namespace:n},!0)||o.push({language:e,namespace:n})}))})),o}(e,n);if(a.length)return f(I(a),(()=>{}))}function N({key:e,ns:n}){const a=void 0!==n?t(n):g.getFallbackNamespaces(),i=g.getFallbackLangs();return y.getTranslationFallback(a,i,e)}function D(){const e=f(function(){if(g.getLanguage())return;if(!g.getInitialOptions().defaultLanguage)throw new Error(v("defaultLanguage"));const e=h.getInitialLanguage();return f(e,(e=>{const n=e||g.getInitialOptions().defaultLanguage;n&&g.setLanguage(n)}))}(),(()=>R()));if(d(e))return g.setInitialLoading(!0),r.notify(),c.notify(),Promise.resolve(e).then((()=>{g.setInitialLoading(!1),r.notify(),c.notify(),o.onInitialLoaded.emit()}));o.onInitialLoaded.emit()}function I(e){return y.loadRecords(e,E())}e&&k(e),o.onKeyUpdate.listen((()=>{g.isRunning()&&h.retranslate()}));return Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},o),g),h),y),{init:k,changeLanguage:async function(e){g.getPendingLanguage()===e&&g.getLanguage()===e||(g.setPendingLanguage(e),g.isRunning()&&await R(e),e===g.getPendingLanguage()&&(g.setLanguage(e),h.setStoredLanguage(e)))},getTranslation:N,changeTranslation:w,addActiveNs:async function(e,n){n||g.addActiveNs(e),g.isRunning()&&await R(void 0,e)},loadRequiredRecords:R,loadRecords:I,loadRecord:async function(e){return(await I([e]))[0]},isLoading:j,isLoaded:function(e){const n=g.getLanguage();if(!n)return!1;const a=g.getFallbackLangs(n),i=void 0!==e?t(e):g.getRequiredNamespaces(),o=[];return a.forEach((e=>{i.forEach((n=>{y.exists({language:e,namespace:n})||o.push({language:e,namespace:n})}))})),0===o.length},t:(...e)=>{const n=((e,...n)=>{let t,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof n[0]?(a.defaultValue=n[0],t=n[1]):"object"==typeof n[0]&&(t=n[0])),t&&(a=Object.assign(Object.assign({},O(t)),a)),a})(...e),t=N(n);return h.formatTranslation(Object.assign(Object.assign({},n),{translation:t}))},isDev:E,run:function(){let e;return(()=>{const e=h.getLanguageDetector();if(e&&!g.getAvailableLanguages())throw new Error(v("availableLanguages"));if(!g.getLanguage()&&!g.getInitialOptions().defaultLanguage)throw e?new Error(v("defaultLanguage")):new Error(v("language"))})(),g.isRunning()||(E()&&y.invalidate(),g.setRunning(!0),h.run(E()),e=D()),Promise.resolve(e)},stop:function(){g.isRunning()&&(h.stop(),g.setRunning(!1))}}))},k=e=>{const n=w({options:e}),t=Object.freeze({setFinalFormatter:n.setFinalFormatter,addFormatter:n.addFormatter,setObserver:n.setObserver,hasObserver:n.hasObserver,setUi:n.setUi,hasUi:n.hasUi,setDevBackend:n.setDevBackend,addBackend:n.addBackend,setLanguageDetector:n.setLanguageDetector,setLanguageStorage:n.setLanguageStorage,overrideCredentials:n.overrideCredentials}),a=e=>{const t=n.isRunning();t&&n.stop(),e(),t&&n.run()},i=Object.freeze({on:n.on,onKeyUpdate:n.onKeyUpdate.listenSome,getLanguage:n.getLanguage,getPendingLanguage:n.getPendingLanguage,changeLanguage:n.changeLanguage,changeTranslation:n.changeTranslation,addActiveNs:n.addActiveNs,removeActiveNs:n.removeActiveNs,loadRecords:n.loadRecords,loadRecord:n.loadRecord,addStaticData:n.addStaticData,getRecord:n.getRecord,getAllRecords:n.getAllRecords,isLoaded:n.isLoaded,isInitialLoading:n.isInitialLoading,isLoading:n.isLoading,isFetching:n.isFetching,isRunning:n.isRunning,run:n.run,stop:n.stop,t:n.t,highlight:n.highlight,getInitialOptions:n.getInitialOptions,isDev:n.isDev,wrap:n.wrap,unwrap:n.unwrap,setObserverOptions:e=>(n.setObserverOptions(e),i),use:e=>(e&&a((()=>e(i,t))),i),init:e=>(a((()=>n.init(e))),i)});return i};function j(e,n,t,a){return new(t||(t=Promise))((function(i,o){function r(e){try{c(a.next(e))}catch(e){o(e)}}function s(e){try{c(a.throw(e))}catch(e){o(e)}}function c(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(r,s)}c((a=a.apply(e,n||[])).next())}))}function E(e,n){var t,a,i,o,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(t)throw new TypeError("Generator is already executing.");for(;r;)try{if(t=1,a&&(i=2&o[0]?a.return:o[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,o[1])).done)return i;switch(a=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,a=o[1],o=[0];continue;case 7:o=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){r=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){r.label=o[1];break}if(6===o[0]&&r.label<i[1]){r.label=i[1],i=o;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(o);break}i[2]&&r.ops.pop(),r.trys.pop();continue}o=n.call(e,r)}catch(e){o=[6,e],a=0}finally{t=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function R(e){var n=e.message,t=e.recievingMessage,a=e.data;return new Promise((function(e,i){var o=function(e,n){var t=function(t){var a,i;(null===(a=t.data)||void 0===a?void 0:a.type)===e&&n(null===(i=t.data)||void 0===i?void 0:i.data)};return window.addEventListener("message",t,!1),{unsubscribe:function(){window.removeEventListener("message",t)}}}(t,(function(n){clearTimeout(r),s(),e(n)}));window.postMessage({type:n,data:a},window.origin);var r=setTimeout((function(){s(),i(new Error("Didn't recieve ".concat(t," in time.")))}),300);function s(){o.unsubscribe()}}))}var N=null;function D(e){var n;return N||(N=(n="https://unpkg.com/@tolgee/web@".concat(e||"latest","/dist/").concat("tolgee-in-context-tools.umd.min.js"),new Promise((function(e,t){var a=document.createElement("script");a.src=n,a.addEventListener("load",(function(){return e()})),a.addEventListener("error",(function(e){return t(e.error)})),document.body.appendChild(a)}))).then((function(){return window["@tolgee/in-context-tools"].InContextTools}))),N}var I="__tolgee_apiKey",S="__tolgee_apiUrl";function F(){var e=sessionStorage.getItem(I)||void 0,n=sessionStorage.getItem(S)||void 0;if(e&&n)return{apiKey:e,apiUrl:n}}function A(){sessionStorage.removeItem(I),sessionStorage.removeItem(S)}var T=function(){return function(e){return e}};"undefined"!=typeof window&&(T=function(){return function(e){return e.on("running",(function(n){var t;n.value&&(t=function(){(function(e){return j(this,void 0,void 0,(function(){var n;return E(this,(function(t){switch(t.label){case 0:n=0,t.label=1;case 1:if(!(n<4))return[3,6];t.label=2;case 2:return t.trys.push([2,4,,5]),[4,R({message:"TOLGEE_READY",recievingMessage:"TOLGEE_PLUGIN_READY",data:e})];case 3:return t.sent(),[2,!0];case 4:return t.sent(),[3,5];case 5:return n++,[3,1];case 6:throw new Error("Tolgee extension not present")}}))}))})({uiPresent:!0,uiVersion:void 0,mode:e.isDev()?"development":"production",config:{apiUrl:e.getInitialOptions().apiUrl||"",apiKey:e.getInitialOptions().apiKey||""}}).catch(A)},"loading"!==document.readyState?Promise.resolve().then((function(){t()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",t))})),F()&&j(void 0,void 0,void 0,(function(){var e;return E(this,(function(n){switch(n.label){case 0:return[4,D("rc")];case 1:return e=n.sent(),[2,function(n){var t=F();return n.use(e(t)),n}]}}))})).then((function(n){e.use(n)})),e}});e.Tolgee=function(e){return k(e).use(T())},e.TolgeeCore=k,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=tolgee-web-tolgee.umd.min.js.map

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

import type { ObserverOptions } from './types';
import type { Options, TolgeePlugin } from '@tolgee/core';
declare type Props = {
tolgee?: Partial<Options>;
observer?: Partial<ObserverOptions>;
};
export declare const InContextTools: (props?: Props) => TolgeePlugin;
export {};
import type { DevCredentials, TolgeePlugin } from '@tolgee/core';
export declare const InContextTools: (overrideCredentials?: DevCredentials) => TolgeePlugin;

@@ -5,2 +5,1 @@ export * from './ContextUi';

export * from './typedIndex';
export * from './InContextProduction';
import type { TolgeePlugin } from '@tolgee/core';
import type { ObserverOptions } from './types';
export declare const InvisibleObserver: (options?: Partial<ObserverOptions>) => TolgeePlugin;
export declare const InvisibleObserver: () => TolgeePlugin;

@@ -1,4 +0,4 @@

import { ObserverOptions } from '../../types';
import { ObserverOptions } from '@tolgee/core';
export declare const DomHelper: (options: ObserverOptions) => Readonly<{
getSuitableParent: (node: Node) => Element;
}>;
import { FallbackNSTranslation } from '@tolgee/core';
import { ElementMeta, NodeMeta, TranslationOnClick } from '@tolgee/core';
import { ElementMeta, NodeMeta, TranslationOnClick, ObserverOptions } from '@tolgee/core';
import { TolgeeElement } from '../../types';
import { ObserverOptions } from '../../types';
export declare const ElementRegistry: (options: ObserverOptions, onClick: TranslationOnClick) => Readonly<{

@@ -6,0 +5,0 @@ register: (element: Element, node: Node, nodeMeta: NodeMeta) => void;

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

import { FallbackNSTranslation, TranslationOnClick, WrapperInterface, ObserverRunProps } from '@tolgee/core';
import { ObserverOptions } from '../../types';
import { FallbackNSTranslation, TranslationOnClick, WrapperInterface, ObserverRunProps, ObserverOptions } from '@tolgee/core';
export declare const GeneralObserver: (wrapper: WrapperInterface, options: ObserverOptions, onClick: TranslationOnClick) => Readonly<{

@@ -8,3 +7,3 @@ run: ({ mouseHighlight }: ObserverRunProps) => void;

unwrap: import("@tolgee/core").WrapperUnwrapFunction;
forEachElement: (callback: (el: import("../../types").TolgeeElement, meta: import("@tolgee/core").ElementMeta) => void) => void;
forEachElement: (callback: (el: import("../..").TolgeeElement, meta: import("@tolgee/core").ElementMeta) => void) => void;
highlight: (key?: string, ns?: FallbackNSTranslation) => {

@@ -11,0 +10,0 @@ unhighlight(): void;

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

import { ModifierKey, TolgeeElement } from '../../types';
import { TolgeeElement } from '../../types';
import { ModifierKey } from '@tolgee/core';
import { ElementStoreType } from './ElementStore';

@@ -3,0 +4,0 @@ declare type Props = {

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

import { WrapperInterface } from '@tolgee/core';
import { ObserverOptions } from '../../types';
import { WrapperInterface, ObserverOptions } from '@tolgee/core';
export declare const NodeHandler: (options: ObserverOptions, wrapper: WrapperInterface) => Readonly<{

@@ -4,0 +3,0 @@ handleAttributes: (node: Node) => Attr[];

import type { TolgeePlugin } from '@tolgee/core';
import type { ObserverOptions } from './types';
export declare const TextObserver: (options?: Partial<ObserverOptions>) => TolgeePlugin;
export declare const TextObserver: () => TolgeePlugin;

@@ -1,18 +0,1 @@

export declare type ObserverOptions = {
tagAttributes: Record<string, string[]>;
highlightKeys: ModifierKey[];
highlightColor: string;
highlightWidth: number;
targetElement?: HTMLElement;
restrictedElements: string[];
inputPrefix: string;
inputSuffix: string;
passToParent: (keyof HTMLElementTagNameMap)[] | ((node: Element) => boolean);
};
export declare enum ModifierKey {
Alt = 0,
Control = 1,
Shift = 2,
Meta = 3
}
export declare type NodeLock = {

@@ -19,0 +2,0 @@ locked?: boolean;

{
"name": "@tolgee/web",
"version": "4.10.0-rc.578d1d0.0",
"version": "4.10.0-rc.72ff5c5.0",
"description": "Tolgee for web",

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

"@testing-library/jest-dom": "^5.11.4",
"@tolgee/core": "^4.10.0-rc.578d1d0.0",
"@tolgee/core": "^4.10.0-rc.72ff5c5.0",
"@types/jest": "^27.0.2",

@@ -86,3 +86,3 @@ "@types/node": "^17.0.8",

"homepage": "https://github.com/tolgee/tolgee-js#readme",
"gitHead": "ada3bcfc1390b09eda73497b29a439ad5f42a405",
"gitHead": "5cb6f72646bce5c96d4f692731668fdbb746cc9d",
"publishConfig": {

@@ -89,0 +89,0 @@ "access": "public"

import type { TolgeePlugin } from '@tolgee/core';
import { handshakeWithExtension } from '../tools/plugin';
import { injectUiLib } from './injectUiLib';
import { loadInContextLib } from './loadInContextLib';

@@ -50,5 +50,8 @@ export const API_KEY_LOCAL_STORAGE = '__tolgee_apiKey';

({
// prevent extension downloading ui library
uiPresent: true,
uiVersion: undefined,
// tolgee mode
mode: tolgee.isDev() ? 'development' : 'production',
// pass credentials
config: {

@@ -61,10 +64,8 @@ apiUrl: tolgee.getInitialOptions().apiUrl || '',

const getTolgeePlugin = async (): Promise<TolgeePlugin> => {
await injectUiLib(process.env.TOLGEE_UI_VERSION || 'rc');
return (tolgee, tools) => {
const InContextTools = await loadInContextLib(
process.env.TOLGEE_UI_VERSION || 'rc'
);
return (tolgee) => {
const credentials = getCredentials()!;
const InContextProduction =
// @ts-ignore
window['@tolgee/tolgee-in-context-production'].InContextProduction;
tolgee.use(InContextProduction());
tools.overrideCredentials(credentials);
tolgee.use(InContextTools(credentials));
return tolgee;

@@ -71,0 +72,0 @@ };

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

import type { ObserverOptions } from './types';
import type { Options, TolgeePlugin } from '@tolgee/core';
import type { DevCredentials, TolgeePlugin } from '@tolgee/core';
import { InvisibleObserver } from './InvisibleObserver';

@@ -7,16 +6,16 @@ import { DevBackend } from './DevBackend';

type Props = {
tolgee?: Partial<Options>;
observer?: Partial<ObserverOptions>;
};
export const InContextTools: (props?: Props) => TolgeePlugin =
(props) => (tolgee) => {
tolgee.use(InvisibleObserver(props?.observer));
export const InContextTools =
(overrideCredentials?: DevCredentials): TolgeePlugin =>
(tolgee, tools) => {
tolgee.use(DevBackend());
tolgee.use(ContextUi());
if (props?.tolgee) {
tolgee.init(props.tolgee);
if (!tools.hasObserver()) {
tolgee.use(InvisibleObserver());
}
if (!tools.hasUi()) {
tolgee.use(ContextUi());
}
if (overrideCredentials) {
tools.overrideCredentials(overrideCredentials);
}
return tolgee;
};

@@ -5,2 +5,1 @@ export * from './ContextUi';

export * from './typedIndex';
export * from './InContextProduction';
import type { ObserverInterface, TolgeePlugin } from '@tolgee/core';
import type { ObserverOptions } from './types';
import { GeneralObserver } from './observers/general/GeneralObserver';
import { initOptions } from './observers/general/initOptions';
import { InvisibleWrapper } from './observers/invisible/InvisibleWrapper';
const InvisibleObserverCreator =
(options?: Partial<ObserverOptions>): ObserverInterface =>
({ onClick }) => {
const observerOptions = initOptions(options);
(): ObserverInterface =>
({ onClick, options }) => {
const wrapper = InvisibleWrapper();
const observer = GeneralObserver(wrapper, observerOptions, onClick);
const observer = GeneralObserver(wrapper, options, onClick);
return { ...observer, retranslate: () => {}, outputNotFormattable: false };
};
export const InvisibleObserver =
(options?: Partial<ObserverOptions>): TolgeePlugin =>
(tolgee, tools) => {
tools.setObserver(InvisibleObserverCreator(options));
return tolgee;
};
export const InvisibleObserver = (): TolgeePlugin => (tolgee, tools) => {
tools.setObserver(InvisibleObserverCreator());
return tolgee;
};

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

import { ObserverOptions } from '../../types';
import { ObserverOptions } from '@tolgee/core';

@@ -3,0 +3,0 @@ export const DomHelper = (options: ObserverOptions) => {

@@ -12,6 +12,6 @@ import {

TranslationOnClick,
ObserverOptions,
} from '@tolgee/core';
import { TolgeeElement } from '../../types';
import { ObserverOptions } from '../../types';
import { ElementHighlighter } from './ElementHighlighter';

@@ -18,0 +18,0 @@ import { initElementMeta } from './ElementMeta';

@@ -7,4 +7,4 @@ import {

ObserverRunProps,
ObserverOptions,
} from '@tolgee/core';
import { ObserverOptions } from '../../types';

@@ -11,0 +11,0 @@ import { DomHelper } from './DomHelper';

@@ -1,3 +0,3 @@

import { ModifierKey, TolgeeElement } from '../../types';
import { DEVTOOLS_ID } from '@tolgee/core';
import { TolgeeElement } from '../../types';
import { DEVTOOLS_ID, ModifierKey } from '@tolgee/core';
import { ElementStoreType } from './ElementStore';

@@ -93,4 +93,3 @@

const onKeyDown = (e: KeyboardEvent) => {
// @ts-ignore
const modifierKey = ModifierKey[e.key];
const modifierKey = e.key as unknown as ModifierKey;
if (modifierKey !== undefined) {

@@ -103,4 +102,3 @@ keysDown.add(modifierKey);

const onKeyUp = (e: KeyboardEvent) => {
// @ts-ignore
keysDown.delete(ModifierKey[e.key]);
keysDown.delete(e.key as unknown as ModifierKey);
// keysChanged.emit(areKeysDown());

@@ -107,0 +105,0 @@ updateHighlight();

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

import { WrapperInterface } from '@tolgee/core';
import { ObserverOptions } from '../../types';
import { WrapperInterface, ObserverOptions } from '@tolgee/core';
import { xPathEvaluate } from './helpers';

@@ -4,0 +3,0 @@

import type { ObserverInterface, TolgeePlugin } from '@tolgee/core';
import type { ObserverOptions } from './types';
import { GeneralObserver } from './observers/general/GeneralObserver';
import { setNodeText } from './observers/general/helpers';
import { initOptions } from './observers/general/initOptions';
import { TextWrapper } from './observers/text/TextWrapper';
const TextObserverCreator =
(options?: Partial<ObserverOptions>): ObserverInterface =>
({ translate, onClick }) => {
const observerOptions = initOptions(options);
(): ObserverInterface =>
({ translate, onClick, options }) => {
const wrapper = TextWrapper({
inputPrefix: observerOptions.inputPrefix,
inputSuffix: observerOptions.inputSuffix,
inputPrefix: options.inputPrefix,
inputSuffix: options.inputSuffix,
translate,
});
const { wrap, unwrap, stop, forEachElement, highlight, run } =
GeneralObserver(wrapper, observerOptions, onClick);
GeneralObserver(wrapper, options, onClick);

@@ -45,7 +42,5 @@ const retranslate = () => {

export const TextObserver =
(options?: Partial<ObserverOptions>): TolgeePlugin =>
(tolgee, tools) => {
tools.setObserver(TextObserverCreator(options));
return tolgee;
};
export const TextObserver = (): TolgeePlugin => (tolgee, tools) => {
tools.setObserver(TextObserverCreator());
return tolgee;
};

@@ -1,20 +0,1 @@

export type ObserverOptions = {
tagAttributes: Record<string, string[]>;
highlightKeys: ModifierKey[];
highlightColor: string;
highlightWidth: number;
targetElement?: HTMLElement;
restrictedElements: string[];
inputPrefix: string;
inputSuffix: string;
passToParent: (keyof HTMLElementTagNameMap)[] | ((node: Element) => boolean);
};
export enum ModifierKey {
Alt,
Control,
Shift,
Meta,
}
export type NodeLock = {

@@ -21,0 +2,0 @@ locked?: boolean;

@@ -1,12 +0,9 @@

import type { Options, TolgeePlugin } from '@tolgee/core';
import { ObserverOptions } from '../lib/types';
import type { TolgeePlugin, DevCredentials } from '@tolgee/core';
export declare const ContextUi: () => TolgeePlugin;
export declare const InContextProduction: () => TolgeePlugin;
export declare const InContextTools: (options?: {
observer?: Partial<ObserverOptions>;
tolgee?: Partial<Options>;
}) => TolgeePlugin;
export declare const InContextTools: (
overrideCredentials?: DevCredentials
) => TolgeePlugin;
export declare const DevTools: typeof InContextTools;
export * from '../lib/typedIndex';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet