(()=>{"use strict";function t(t){return"function"==typeof t}function e(e){return function(n){if(function(e){return t(null==e?void 0:e.lift)}(n))return n.lift((function(t){try{return e(t,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)};function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function o(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function c(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,n=this,r=n.hasError,o=n.isStopped,i=n.observers;return r||o?d:(this.currentObservers=null,i.push(t),new h((function(){e.currentObservers=null,f(i,t)})))},e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e.thrownError,o=e.isStopped;n?t.error(r):o&&t.complete()},e.prototype.asObservable=function(){var t=new L;return t.source=this,t},e.create=function(t,e){return new F(t,e)},e}(L),F=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return r(e,t),e.prototype.next=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===n||n.call(e,t)},e.prototype.error=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===n||n.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,n;return null!==(n=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==n?n:d},e}(z),V=function(t){function e(e,n){return t.call(this)||this}return r(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(h),G={setInterval:function(t,e){for(var n=[],r=2;r=0?K(e,d,c,p,!0):o=!0,c();var a=k(e,(function(t){var e,n,o=r.slice();try{for(var c=i(o),a=c.next();!a.done;a=c.next()){var s=a.value,l=s.buffer;l.push(t),v<=l.length&&u(s)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=c.return)&&n.call(c)}finally{if(e)throw e.error}}}),(function(){for(;null==r?void 0:r.length;)e.next(r.shift().buffer);null==a||a.unsubscribe(),e.complete(),e.unsubscribe()}),void 0,(function(){return r=null}));t.subscribe(a)}))}var Q=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t},X="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Z(e){if(e instanceof L)return e;if(null!=e){if(function(e){return t(e[R])}(e))return s=e,new L((function(e){var n=s[R]();if(t(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(Q(e))return c=e,new L((function(t){for(var e=0;e1||c(t,e)}))},e&&(r[t]=e(r[t])))}function c(t,e){try{(n=o[t](e)).value instanceof a?Promise.resolve(n.value.v).then(s,l):f(i[0][2],n)}catch(t){f(i[0][3],t)}var n}function s(t){c("next",t)}function l(t){c("throw",t)}function f(t,e){t(e),i.shift(),i.length&&c(i[0][0],i[0][1])}}(this,arguments,(function(){var e,n,r;return o(this,(function(o){switch(o.label){case 0:e=t.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,a(e.read())];case 3:return n=o.sent(),r=n.value,n.done?[4,a(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,a(r)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}}))}))}(e))}var n,r,u,c,s;throw function(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}(e)}function tt(t){return new L((function(e){(function(t,e){var n,r,u,c,a,s,l,f;return a=this,s=void 0,f=function(){var a,s;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,5,6,11]),n=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=i(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,o){!function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)}(r,o,(e=t[n](e)).done,e.value)}))}}}(t),o.label=1;case 1:return[4,n.next()];case 2:if((r=o.sent()).done)return[3,4];if(a=r.value,e.next(a),e.closed)return[2];o.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=o.sent(),u={error:s},[3,11];case 6:return o.trys.push([6,,9,10]),r&&!r.done&&(c=n.return)?[4,c.call(n)]:[3,8];case 7:o.sent(),o.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}}))},new((l=void 0)||(l=Promise))((function(t,e){function n(t){try{o(f.next(t))}catch(t){e(t)}}function r(t){try{o(f.throw(t))}catch(t){e(t)}}function o(e){var o;e.done?t(e.value):(o=e.value,o instanceof l?o:new l((function(t){t(o)}))).then(n,r)}o((f=f.apply(a,s||[])).next())}))})(t,e).catch((function(t){return e.error(t)}))}))}function et(n,r,o){return void 0===o&&(o=1/0),t(r)?et((function(t,e){return P((function(n,o){return r(t,n,e,o)}))(Z(n(t,e)))}),o):("number"==typeof r&&(o=r),e((function(t,e){return function(t,e,n,r,o,i,u,c){var a=[],s=0,l=0,f=!1,h=function(){!f||a.length||s||e.complete()},d=function(t){return s0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]0&&ct.includes(n.nodeName)};n=i(n,t),t.childNodes.forEach((function(t){r(t),n=i(n,t)}))}};return t.forEach((function(t){return r(t)})),e}var lt=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]").concat(t.textContent,"")})).join("")}(t),0===e.trim().length?[2]:[4,mt.getTranslatedText(e)];case 1:return n=r.sent(),function(t,e){gt(this,void 0,void 0,(function(){var n;return wt(this,(function(r){switch(r.label){case 0:return(n=vt(t))&&St.add(n),function(t,e){if(1===t.length)t[0].textContent=e;else if(t.length>1){var n=vt(t);if(!n)return;var r=function(t){var e=document.createElement("div");if(e.innerHTML=t,e.firstChild)return Array.from(e.childNodes);throw"element cannot be created"}(e.replace(/> <")),o=[];r.forEach((function(e,n){var r,i;if(3===e.nodeType){var u=document.createElement("font"),c=document.createTextNode(null!==(r=e.nodeValue)&&void 0!==r?r:"");u.appendChild(c),o.push({translationIndex:n,originalNode:void 0,translatedNode:u})}else{var a=e.getAttribute("i");if(!a||Number.isNaN(a))throw"index not matching";var s=t[Number.parseInt(a)],l=(u=s.cloneNode(!0),null!==(i=s.textContent)&&void 0!==i?i:""),f=l.match(/^\s*/),h=f?f[0]:"",d=l.match(/\s*$/),p=d?d[0]:"",v=h+e.textContent+p;u.textContent=v,o.push({translationIndex:n,originalNode:s,translatedNode:u})}}));var i=bt(t[0],n);o.forEach((function(t){var e,r,o;if("#text"!==n.nodeName)if(t.originalNode){var u=bt(t.originalNode,n);-1===u?(n.insertBefore(t.translatedNode,Array.from(n.childNodes)[t.translationIndex]),t.originalNode.replaceWith(t.translatedNode)):(n.insertBefore(Array.from(n.childNodes)[u],Array.from(n.childNodes)[i+t.translationIndex]),t.originalNode.replaceWith(t.translatedNode))}else n.insertBefore(t.translatedNode,Array.from(n.childNodes)[t.translationIndex]);else n.nodeValue=null!==(o=null!==(e=t.translatedNode.nodeValue)&&void 0!==e?e:null===(r=t.translatedNode.childNodes[0])||void 0===r?void 0:r.nodeValue)&&void 0!==o?o:""}))}}(t,e),[4,new Promise((function(t){return setTimeout(t,0)}))];case 1:return r.sent(),n&&St.delete(n),[2]}}))}))}(t,n),[2]}}))}))}function Tt(t,e){return gt(this,void 0,void 0,(function(){var n,r;return wt(this,(function(o){return n=t.get(),r=t.node.getAttribute(Et),n===r||(t.node.setAttribute(Et,e),t.set(e),t.node.parentNode&&t.node.parentNode.classList.add("translated-text")),[2]}))}))}function It(t,e){return gt(this,void 0,void 0,(function(){var n,r;return wt(this,(function(o){return n=t.get(),r=t.node.getAttribute(At),n===r||(t.node.setAttribute(At,e),t.set(e)),[2]}))}))}globalThis.translate=function(){return gt(this,arguments,void 0,(function(t,e,n){var r,o,i,u=this;return void 0===t&&(t="test"),void 0===e&&(e=document.body),wt(this,(function(c){switch(c.label){case 0:return[4,yt()];case 1:return c.sent(),xt?[3,3]:[4,_t(t,n)];case 2:c.sent(),c.label=3;case 3:return st([e]).forEach((function(t){return gt(u,void 0,void 0,(function(){return wt(this,(function(e){return Nt(t),[2]}))}))})),r=(a=e,function(t){return pt(t,{attributes:!1,childList:!0,characterData:!0,subtree:!0}).pipe(et((function(t){return t.map((function(t){return"characterData"===t.type&&"#text"===t.target.nodeName?[[t.target]]:st(Array.from(t.addedNodes))}))})),B((function(t){return t.length>0})))}(a).pipe(P((function(t){return t.filter((function(t){var e=vt(t);if(!e)return!1;if("#text"===(null==e?void 0:e.nodeName)&&null===e.parentElement)return!1;for(var n=e,r=!1;n;){if(St.has(n)){r=!0;break}n=n.parentElement}return!r}))})),B((function(t){return t.length>0})))).subscribe((function(t){t.forEach((function(t){return gt(u,void 0,void 0,(function(){return wt(this,(function(e){return Nt(t),[2]}))}))}))})),ft([e]).forEach((function(t){return gt(u,void 0,void 0,(function(){var e;return wt(this,(function(n){switch(n.label){case 0:return[4,mt.getTranslatedText(t.get())];case 1:return e=n.sent(),Tt(t,e),[2]}}))}))})),o=function(t){return function(t){return pt(t,{attributes:!0,childList:!0,characterData:!0,subtree:!0}).pipe(et((function(t){return t.map((function(t){return ft(Array.from(t.addedNodes))}))})),B((function(t){return t.length>0})))}(t).pipe(P((function(t){return t.filter((function(t){var e=t.node.getAttribute(Et);return t.get()!==e}))})),B((function(t){return t.length>0})))}(e).subscribe((function(t){t.forEach((function(t){return gt(u,void 0,void 0,(function(){var e;return wt(this,(function(n){switch(n.label){case 0:return[4,mt.getTranslatedText(t.get())];case 1:return e=n.sent(),Tt(t,e),[2]}}))}))}))})),ht([e]).forEach((function(t){return gt(u,void 0,void 0,(function(){var e;return wt(this,(function(n){switch(n.label){case 0:return[4,mt.getReplacedSource(t.get())];case 1:return e=n.sent(),It(t,e),[2]}}))}))})),i=function(t){return function(t){return pt(t,{attributes:!0,childList:!0,characterData:!0,subtree:!0}).pipe(et((function(t){return t.map((function(t){return ht("src"===t.attributeName?[t.target]:Array.from(t.addedNodes))}))})),B((function(t){return t.length>0})))}(t).pipe(P((function(t){return t.filter((function(t){var e=t.node.getAttribute(At);return t.get()!==e}))})),B((function(t){return t.length>0})))}(e).subscribe((function(t){t.forEach((function(t){return gt(u,void 0,void 0,(function(){var e;return wt(this,(function(n){switch(n.label){case 0:return[4,mt.getReplacedSource(t.get())];case 1:return e=n.sent(),It(t,e),[2]}}))}))}))})),[2,function(){r.unsubscribe(),o.unsubscribe(),i.unsubscribe()}]}var a}))}))},globalThis.dictionaryCache=mt})();