@internetarchive/bookreader 5.0.0-98 → 5.0.0-99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,137 @@
1
1
  /*! For license information please see plugin.translate.js.LICENSE.txt */
2
- "use strict";(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[444],{1041:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function o(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,"string");if("object"!=n(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}r.d(t,{S:function(){return i}}),r(2675),r(9463),r(2259),r(5700),r(3792),r(9572),r(8130),r(9085),r(6099),r(7764),r(2953);var i=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.br=t,this.options},(t=[{key:"setup",value:function(e){this.options=Object.assign({},this.options,e)}},{key:"init",value:function(){}},{key:"_configurePageContainer",value:function(e){}},{key:"_configureToolbar",value:function(e){}},{key:"_bindNavigationHandlers",value:function(){}},{key:"extendNavBar",value:function(e){}}])&&a(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()},6735:function(e,t,r){r(2675),r(9463),r(6412),r(2259),r(8125),r(4490),r(4782),r(4554),r(4731),r(479),r(9085),r(2811),r(3851),r(875),r(825),r(888),r(8781),r(5700),r(8706),r(2008),r(113),r(3418),r(3792),r(2062),r(9572),r(2010),r(8130),r(6099),r(8459),r(8940),r(3362),r(7495),r(7764),r(5440),r(3500),r(2953);var n=r(420),a=r(1041),o=r(9696),i=(r(739),r(6034),r(4565));"undefined"!=typeof window&&window.Worker||(globalThis.Worker=class{#e;constructor(e){this.#e=new Promise((async t=>{const{Worker:r}=await import("node:worker_threads");t(new r(e))}))}addEventListener(e,t){this.#e.then((r=>r.on(e,(e=>t({data:e})))))}postMessage(e){this.#e.then((t=>t.postMessage(e)))}terminate(){this.#e.then((e=>e.terminate()))}});class s extends Error{}class l{constructor(e){this.options=e||{},this.registryUrl=this.options.registryUrl||"https://bergamot.s3.amazonaws.com/models/index.json",this.downloadTimeout="downloadTimeout"in this.options?parseInt(this.options.downloadTimeout):6e4,this.registry=this.loadModelRegistery(),this.buffers=new Map,this.pivotLanguage="pivotLanguage"in this.options?e.pivotLanguage:"en",this.models=new Map,this.onerror=this.options.onerror||(e=>console.error("WASM Translation Worker error:",e))}async loadWorker(){const e=this.options.workerUrl?new Worker(this.options.workerUrl):new Worker(new URL(r.p+r.u(474),r.b));let t=0;const n=new Map,a=(r,...a)=>new Promise(((o,i)=>{const s=++t;n.set(s,{accept:o,reject:i,callsite:{message:`${r}(${a.map((e=>String(e))).join(", ")})`,stack:(new Error).stack}}),e.postMessage({id:s,name:r,args:a})}));return e.addEventListener("message",(function({data:{id:e,result:t,error:r}}){if(!n.has(e))throw console.debug("Received message with unknown id:",arguments[0]),new Error(`BergamotTranslator received response from worker to unknown call '${e}'`);const{accept:a,reject:o,callsite:i}=n.get(e);n.delete(e),void 0!==r?o(Object.assign(new Error,r,{message:r.message+` (response to ${i.message})`,stack:r.stack?`${r.stack}\n${i.stack}`:i.stack})):a(t)})),e.addEventListener("error",this.onerror.bind(this)),await a("initialize",this.options),{worker:e,exports:new Proxy({},{get(e,t,r){if("then"!==t)return(...e)=>a(t,...e)}})}}async loadModelRegistery(){const e=await fetch(this.registryUrl,{credentials:"omit"}),t=await e.json();return Array.from(Object.entries(t),(([e,t])=>{const r=e.match(/^([a-z]{2}(-[a-z]+)?)([a-z]{2}(-[a-z]+)?)/i);return{from:r[1],to:r[3],files:t}}))}getTranslationModel({from:e,to:t},r){const n=JSON.stringify({from:e,to:t});if(!this.buffers.has(n)){const a=this.loadTranslationModel({from:e,to:t},r);this.buffers.set(n,a),a.catch((e=>this.buffers.delete(n)))}return this.buffers.get(n)}async loadTranslationModel({from:e,to:t},r){performance.mark(`loadTranslationModule.${JSON.stringify({from:e,to:t})}`);const n=(await this.registry).filter((r=>r.from==e&&r.to==t));if(!n)throw new Error(`No model for '${e}' -> '${t}'`);const a=n[0].files,o=()=>reject(new s("abort signal")),i=new Promise(((e,t)=>{r?.signal&&r.signal.addEventListener("abort",o)})),l=Object.fromEntries(await Promise.race([Promise.all(Object.entries(a).map((async([n,a])=>{if(void 0===a||void 0===a.name)return[n,null];try{return[n,await this.fetch(a.name,a.expectedSha256Hash,r)]}catch(r){throw new Error(`Could not fetch ${a.name} for ${e}->${t} model`,{cause:r})}}))),i]));r?.signal&&r.signal.removeEventListener("abort",o),performance.measure("loadTranslationModel",`loadTranslationModule.${JSON.stringify({from:e,to:t})}`);let c=[];if(l.vocab)c=[l.vocab];else{if(!l.trgvocab||!l.srcvocab)throw new Error(`Could not identify vocab files for ${e}->${t} model among: ${Array.from(Object.keys(a)).join(" ")}`);c=[l.srcvocab,l.trgvocab]}let u={};return a.model.name.endsWith("intgemm8.bin")&&(u["gemm-precision"]="int8shiftAll"),a.qualityModel&&(u["skip-cost"]=!1),a.config&&Object.assign(u,a.config),{model:l.model,shortlist:l.lex,vocabs:c,qualityModel:l.qualityModel,config:u}}async fetch(e,t,r){const n=new AbortController,a=()=>n.abort(),o=this.downloadTimeout?setTimeout(a,this.downloadTimeout):null;try{r?.signal&&r.signal.addEventListener("abort",a);const o={credentials:"omit",signal:n.signal};t&&(o.integrity=`sha256-${this.hexToBase64(t)}`),"undefined"==typeof window&&delete o.integrity;const i=await fetch(e,o);return await i.arrayBuffer()}finally{o&&clearTimeout(o),r?.signal&&r.signal.removeEventListener("abort",a)}}hexToBase64(e){return btoa(e.match(/\w{2}/g).map((function(e){return String.fromCharCode(parseInt(e,16))})).join(""))}getModels({from:e,to:t}){const r=JSON.stringify({from:e,to:t});return this.models.has(r)||this.models.set(r,this.findModels(e,t)),this.models.get(r)}async findModels(e,t){const r=await this.registry;let n=[],a=[],o=[];if(r.forEach((r=>{r.from===e&&r.to===t?n.push(r):r.from===e&&r.to===this.pivotLanguage?a.push(r):r.to===t&&r.from===this.pivotLanguage&&o.push(r)})),n.length)return[n[0]];if(a.length&&o.length)return[a[0],o[0]];throw new Error(`No model available to translate from '${e}' to '${t}'`)}}class c{constructor(e,t){t||(t=new l(e)),this.backing=t,this.workers=[],this.workerLimit=Math.max(e?.workers||0,1),this.queue=[],this.batchSerial=0,this.batchSize=Math.max(e?.batchSize||8,1),this.onerror=e?.onerror||(e=>console.error("WASM Translation Worker error:",e))}async delete(){this.remove((()=>!0)),this.workers.forEach((({worker:e})=>e.terminate()))}notify(){setTimeout((async()=>{if(!this.queue.length)return;let e=this.workers.find((e=>e.idle));if(!e&&this.workers.length<this.workerLimit)try{const t={idle:!1};this.workers.push(t),Object.assign(t,await this.backing.loadWorker()),e=t}catch(e){this.onerror(new Error(`Could not initialise translation worker: ${e.message}`))}if(!e)return;const t=this.queue.shift();e.idle=!1;try{await this.consumeBatch(t,e.exports)}catch(e){t.requests.forEach((({reject:t})=>t(e)))}e.idle=!0,this.queue.length&&this.notify()}))}translate(e){const{from:t,to:r,priority:n}=e;return new Promise((async(a,o)=>{try{const i=JSON.stringify({from:t,to:r}),s=await this.backing.getModels(e);this.enqueue({key:i,models:s,request:e,resolve:a,reject:o,priority:n}),this.notify()}catch(e){o(e)}}))}remove(e){const t=this.queue;this.queue=[],t.forEach((t=>{t.requests.forEach((({request:r,resolve:n,reject:a})=>{e(r)?a(Object.assign(new s("removed by filter"),{request:r})):this.enqueue({key:t.key,priority:t.priority,models:t.models,request:r,resolve:n,reject:a})}))}))}enqueue({key:e,models:t,request:r,resolve:n,reject:a,priority:o}){void 0===o&&(o=0);let i=this.queue.find((t=>t.key===e&&t.priority===o&&t.requests.length<this.batchSize));i||(i={id:++this.batchSerial,key:e,priority:o,models:t,requests:[]},this.queue.push(i),this.queue.sort(((e,t)=>e.priority-t.priority))),i.requests.push({request:r,resolve:n,reject:a})}async consumeBatch(e,t){performance.mark("BergamotBatchTranslator.start"),await Promise.all(e.models.map((async({from:e,to:r})=>{if(!await t.hasTranslationModel({from:e,to:r})){const n=await this.backing.getTranslationModel({from:e,to:r});await t.loadTranslationModel({from:e,to:r},n)}})));const r=await t.translate({models:e.models.map((({from:e,to:t})=>({from:e,to:t}))),texts:e.requests.map((({request:{text:e,html:t,qualityScores:r}})=>({text:e.toString(),html:!!t,qualityScores:!!r})))});e.requests.forEach((({request:e,resolve:t,reject:n},a)=>{t({request:e,...r[a]})})),performance.measure("BergamotBatchTranslator","BergamotBatchTranslator.start")}}var u=r(4160);function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function f(){f=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,i=Object.create(o.prototype),s=new z(n||[]);return a(i,"_invoke",{value:P(e,r,s)}),i}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",g="suspendedYield",m="executing",y="completed",v={};function b(){}function w(){}function k(){}var L={};c(L,i,(function(){return this}));var E=Object.getPrototypeOf,T=E&&E(E(_([])));T&&T!==r&&n.call(T,i)&&(L=T);var x=k.prototype=b.prototype=Object.create(L);function S(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function j(e,t){function r(a,o,i,s){var l=d(e[a],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==h(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,s)}),(function(e){r("throw",e,i,s)})):t.resolve(u).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,s)}))}s(l.arg)}var o;a(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,a){r(e,n,t,a)}))}return o=o?o.then(a,a):a()}})}function P(t,r,n){var a=p;return function(o,i){if(a===m)throw Error("Generator is already running");if(a===y){if("throw"===o)throw i;return{value:e,done:!0}}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var l=C(s,n);if(l){if(l===v)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===p)throw a=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=m;var c=d(t,r,n);if("normal"===c.type){if(a=n.done?y:g,c.arg===v)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(a=y,n.method="throw",n.arg=c.arg)}}}function C(t,r){var n=r.method,a=t.iterator[n];if(a===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,C(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var o=d(a,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function z(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function r(){for(;++a<t.length;)if(n.call(t,a))return r.value=t[a],r.done=!1,r;return r.value=e,r.done=!0,r};return o.next=o}}throw new TypeError(h(t)+" is not iterable")}return w.prototype=k,a(x,"constructor",{value:k,configurable:!0}),a(k,"constructor",{value:w,configurable:!0}),w.displayName=c(k,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,k):(e.__proto__=k,c(e,l,"GeneratorFunction")),e.prototype=Object.create(x),e},t.awrap=function(e){return{__await:e}},S(j.prototype),c(j.prototype,s,(function(){return this})),t.AsyncIterator=j,t.async=function(e,r,n,a,o){void 0===o&&(o=Promise);var i=new j(u(e,r,n,a),o);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},S(x),c(x,l,"Generator"),c(x,i,(function(){return this})),c(x,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,z.prototype={constructor:z,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(A),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function a(n,a){return s.type="throw",s.arg=t,r.next=n,a&&(r.method="next",r.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;A(r)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}function d(e,t,r,n,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,a)}function p(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){d(o,n,a,i,s,"next",e)}function s(e){d(o,n,a,i,s,"throw",e)}i(void 0)}))}}function g(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,y(n.key),n)}}function m(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e){var t=function(e,t){if("object"!=h(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==h(t)?t:t+""}var v,b,w,k,L,E={bg:"Bulgarian",ca:"Catalan",cs:"Czech",nl:"Dutch",en:"English",et:"Estonian",de:"German",fr:"French",is:"Icelandic",it:"Italian",nb:"Norwegian Bokmål",nn:"Norwegian Nynorsk",fa:"Persian",pl:"Polish",pt:"Portuguese",ru:"Russian",es:"Spanish",uk:"Ukrainian"},T=function(){return e=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),m(this,"alreadyTranslated",new i.l(100)),m(this,"modelRegistry",{}),m(this,"currentlyTranslating",{}),m(this,"fromLanguages",[]),m(this,"toLanguages",[]),m(this,"active",!1),m(this,"publicPath",""),m(this,"getTranslation",function(){var e=p(f().mark((function e(r,n,a,o,i,s){var l,c,u,h,d;return f().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.active=!0,r!=n&&r&&n){e.next=3;break}return e.abrupt("return");case 3:if(l="".concat(r).concat(n,"-").concat(a,":").concat(o),!(c=t.alreadyTranslated.entries.find((function(e){return e.index==l})))){e.next=7;break}return e.abrupt("return",c.response);case 7:if(!(l in t.currentlyTranslating)){e.next=9;break}return e.abrupt("return",t.currentlyTranslating[l].promise);case 9:if(u=null,h=null,d=new Promise((function(e,t){u=e,h=t})),t.currentlyTranslating[l]={promise:d,resolve:u,reject:h},i){e.next=16;break}return t.currentlyTranslating[l].reject("No text was provided"),e.abrupt("return",d);case 16:return t.translator.translate({to:n,from:r,text:i,html:!1,priority:s}).then((function(e){var r=e;t.currentlyTranslating[l].resolve(r.target.text),t.alreadyTranslated.add({index:l,response:r.target.text}),delete t.currentlyTranslating[l]})),e.abrupt("return",d);case 18:case"end":return e.stop()}}),e)})));return function(t,r,n,a,o,i){return e.apply(this,arguments)}}());var r={code:"en",name:"English",type:"prod"};this.fromLanguages.push(r),this.toLanguages.push(r)},t=[{key:"initWorker",value:(r=p(f().mark((function e(){var t,r,n,a,o,i,s,l,h,d,p,g,m,y,v,b,w=this;return f().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.initPromise){e.next=2;break}return e.abrupt("return",this.initPromise);case 2:return this.initPromise=new Promise((function(e,t){w._initResolve=e,w._initReject=t})),t="https://cors.archive.org/cors/mozilla-translate-models/firefox_models/",e.next=6,fetch(t+"registry.json").then((function(e){return e.json()}));case 6:for(r=e.sent,n=0,a=Object.values(r);n<a.length;n++)for(o=a[n],i=0,s=Object.values(o);i<s.length;i++)(l=s[i]).name=t+l.name;return this.translator=new c({registryUrl:"data:application/json,".concat(encodeURIComponent(JSON.stringify(r))),workers:2,batchSize:4,workerUrl:this.publicPath+"/translator-worker.js"}),e.next=11,this.translator.backing.registry;case 11:for(h=e.sent,d={},p=0,g=Object.values(h);p<g.length;p++)m=g[p],y=m.from,v=m.to,b=m.files,d["".concat(y).concat(v)]=b,"en"!==y&&this.fromLanguages.push({code:y,name:(0,u.YH)(y,!0),type:"prod"}),"en"!==v&&this.toLanguages.push({code:v,name:(0,u.YH)(v,!0),type:"prod"});return this._initResolve([this.modelRegistry]),e.abrupt("return",this.initPromise);case 16:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})}],t&&g(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}(),x=r(8004),S=r(1669);function j(e){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j(e)}function P(e){return function(e){if(Array.isArray(e))return I(e)}(e)||B(e)||F(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(){C=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(n){t.forEach((function(t){var a=t.placement;if(t.kind===n&&("static"===a||"prototype"===a)){var o="static"===a?e:r;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var n=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===n?void 0:n.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],n=[],a={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,a)}),this),e.forEach((function(e){if(!z(e))return r.push(e);var t=this.decorateElement(e,a);r.push(t.element),r.push.apply(r,t.extras),n.push.apply(n,t.finishers)}),this),!t)return{elements:r,finishers:n};var o=this.decorateConstructor(r,t);return n.push.apply(n,o.finishers),o.finishers=n,o},addElementPlacement:function(e,t,r){var n=t[e.placement];if(!r&&-1!==n.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");n.push(e.key)},decorateElement:function(e,t){for(var r=[],n=[],a=e.decorators,o=a.length-1;o>=0;o--){var i=t[e.placement];i.splice(i.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,a[o])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&n.push(l.finisher);var c=l.extras;if(c){for(var u=0;u<c.length;u++)this.addElementPlacement(c[u],t);r.push.apply(r,c)}}return{element:e,finishers:n,extras:r}},decorateConstructor:function(e,t){for(var r=[],n=t.length-1;n>=0;n--){var a=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[n])(a)||a);if(void 0!==o.finisher&&r.push(o.finisher),void 0!==o.elements){e=o.elements;for(var i=0;i<e.length-1;i++)for(var s=i+1;s<e.length;s++)if(e[i].key===e[s].key&&e[i].placement===e[s].placement)throw new TypeError("Duplicated element ("+e[i].key+")")}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t},toElementDescriptors:function(e){if(void 0!==e)return(t=e,function(e){if(Array.isArray(e))return e}(t)||B(t)||F(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this);var t},toElementDescriptor:function(e){var t=e.kind+"";if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var r=Q(e.key),n=e.placement+"";if("static"!==n&&"prototype"!==n&&"own"!==n)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+n+'"');var a=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:n,descriptor:Object.assign({},a)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(a,"get","The property descriptor of a field descriptor"),this.disallowProperty(a,"set","The property descriptor of a field descriptor"),this.disallowProperty(a,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:M(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t},toClassDescriptor:function(e){var t=e.kind+"";if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');this.disallowProperty(e,"key","A class descriptor"),this.disallowProperty(e,"placement","A class descriptor"),this.disallowProperty(e,"descriptor","A class descriptor"),this.disallowProperty(e,"initializer","A class descriptor"),this.disallowProperty(e,"extras","A class descriptor");var r=M(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var n=(0,t[r])(e);if(void 0!==n){if("function"!=typeof n)throw new TypeError("Finishers must return a constructor.");e=n}}return e},disallowProperty:function(e,t,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}};return e}function O(e){var t,r=Q(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var n={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(n.decorators=e.decorators),"field"===e.kind&&(n.initializer=e.value),n}function A(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function z(e){return e.decorators&&e.decorators.length}function _(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function M(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}function B(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function N(){return N="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Y(e)););return e}(e,t);if(n){var a=Object.getOwnPropertyDescriptor(n,t);return a.get?a.get.call(arguments.length<3?e:r):a.value}},N.apply(null,arguments)}function R(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function q(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=F(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}function F(e,t){if(e){if("string"==typeof e)return I(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?I(e,t):void 0}}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function D(){D=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=t&&t.prototype instanceof y?t:y,i=Object.create(o.prototype),s=new A(n||[]);return a(i,"_invoke",{value:S(e,r,s)}),i}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",d="suspendedYield",p="executing",g="completed",m={};function y(){}function v(){}function b(){}var w={};c(w,i,(function(){return this}));var k=Object.getPrototypeOf,L=k&&k(k(z([])));L&&L!==r&&n.call(L,i)&&(w=L);var E=b.prototype=y.prototype=Object.create(w);function T(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(a,o,i,s){var l=h(e[a],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==j(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,s)}),(function(e){r("throw",e,i,s)})):t.resolve(u).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,s)}))}s(l.arg)}var o;a(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,a){r(e,n,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,r,n){var a=f;return function(o,i){if(a===p)throw Error("Generator is already running");if(a===g){if("throw"===o)throw i;return{value:e,done:!0}}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var l=P(s,n);if(l){if(l===m)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===f)throw a=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=p;var c=h(t,r,n);if("normal"===c.type){if(a=n.done?g:d,c.arg===m)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(a=g,n.method="throw",n.arg=c.arg)}}}function P(t,r){var n=r.method,a=t.iterator[n];if(a===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,P(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var o=h(a,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,m;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function z(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function r(){for(;++a<t.length;)if(n.call(t,a))return r.value=t[a],r.done=!1,r;return r.value=e,r.done=!0,r};return o.next=o}}throw new TypeError(j(t)+" is not iterable")}return v.prototype=b,a(E,"constructor",{value:b,configurable:!0}),a(b,"constructor",{value:v,configurable:!0}),v.displayName=c(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,l,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},T(x.prototype),c(x.prototype,s,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,a,o){void 0===o&&(o=Promise);var i=new x(u(e,r,n,a),o);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(E),c(E,l,"Generator"),c(E,i,(function(){return this})),c(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=z,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function a(n,a){return s.type="throw",s.arg=t,r.next=n,a&&(r.method="next",r.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),O(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;O(r)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:z(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},t}function G(e,t,r,n,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,a)}function K(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){G(o,n,a,i,s,"next",e)}function s(e){G(o,n,a,i,s,"throw",e)}i(void 0)}))}}function W(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Q(n.key),n)}}function H(e,t,r){return t&&$(e.prototype,t),r&&$(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function U(e,t,r){return t=Y(t),function(e,t){if(t&&("object"==j(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,V()?Reflect.construct(t,r||[],Y(e).constructor):t.apply(e,r))}function V(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(V=function(){return!!e})()}function Y(e){return Y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Y(e)}function Z(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&J(e,t)}function J(e,t){return J=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},J(e,t)}function X(e,t,r){return(t=Q(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Q(e){var t=function(e,t){if("object"!=j(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=j(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==j(t)?t:t+""}var ee,te,re,ne,ae,oe,ie,se=window.BookReader,le=function(e){function t(){var e;W(this,t);for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return X(e=U(this,t,[].concat(n)),"options",{enabled:!0,panelDisclaimerText:"Translations are in alpha"}),X(e,"translationManager",new T),X(e,"worker",void 0),X(e,"toLanguages",[]),X(e,"langFromCode",void 0),X(e,"langToCode",void 0),X(e,"_panel",void 0),X(e,"userToggleTranslate",void 0),X(e,"getParagraphsOnPage",(function(e){return e?Array.from(e.querySelectorAll(".BRtextLayer > .BRparagraphElement")):[]})),X(e,"handleFromLangChange",function(){var t=K(D().mark((function t(r){var n;return D().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.clearAllTranslations(),n=r.detail.value,e.langFromCode=n,e.translationManager.toLanguages.some((function(e){return e.code===n}))||e.translationManager.toLanguages.push({code:n,name:E[n]}),e._panel.toLanguages=e.translationManager.toLanguages,console.log(e.langFromCode,e.langToCode),e.langFromCode!==e.langToCode&&e.translateActivePageContainerElements();case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),X(e,"handleToLangChange",function(){var t=K(D().mark((function t(r){return D().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.clearAllTranslations(),e.langToCode=r.detail.value,e.translateActivePageContainerElements();case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),X(e,"handleToggleTranslation",K(D().mark((function t(){return D().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.userToggleTranslate=!e.userToggleTranslate,e.translationManager.active=e.userToggleTranslate,e.userToggleTranslate?(e.br.trigger("translationEnabled",{}),e.translateActivePageContainerElements()):(e.clearAllTranslations(),e.br.trigger("translationDisabled",{}));case 3:case"end":return t.stop()}}),t)})))),e}return Z(t,e),H(t,[{key:"init",value:(o=K(D().mark((function e(){var t,r=this;return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=(0,u.YH)(this.br.options.bookLanguage.replace(/[.,/#!$%^&*;:{}=\-_`~()]/g,"")),this.langFromCode=null!=t?t:"en",this.options.enabled){e.next=4;break}return e.abrupt("return");case 4:return this.translationManager.publicPath=this.br.options.imagesBaseURL.replace(/\/+$/,"")+"/..",this.br.on("textLayerRendered",function(){var e=K(D().mark((function e(t,n){var a,o;return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.pageIndex,a=n.pageContainer,r.translationManager){e.next=3;break}return e.abrupt("return");case 3:r.translationManager.active&&(o=a.$container[0],r.translateRenderedLayer(o));case 4:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),this.br.on("pageVisible",(function(e,t){var n=t.pageContainerEl;if(r.translationManager.active){var a,o=q(n.querySelectorAll(".BRtranslateLayer > .BRparagraphElement"));try{for(o.s();!(a=o.n()).done;){var i=a.value;i.textContent&&r.fitVisiblePage(i)}}catch(e){o.e(e)}finally{o.f()}}})),e.next=9,this.translationManager.initWorker();case 9:this.langToCode=this.translationManager.toLanguages[0].code,this._render();case 11:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"translateActivePageContainerElements",value:function(){var e,t=this.br.getActivePageContainerElements(),r=t.filter((function(e){return e.classList.contains("BRpage-visible")})),n=t.filter((function(e){return!e.classList.contains("BRpage-visible")})),a=q(r);try{for(a.s();!(e=a.n()).done;){var o=e.value;this.translateRenderedLayer(o,0)}}catch(e){a.e(e)}finally{a.f()}var i,s=q(n);try{for(s.s();!(i=s.n()).done;){var l=i.value;this.translateRenderedLayer(l,1e3)}}catch(e){s.e(e)}finally{s.f()}}},{key:"translateRenderedLayer",value:(a=K(D().mark((function e(t,r){var n,a,o,i,s,l=this;return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.br.mode!=this.br.constModeThumb&&this.userToggleTranslate&&this.langFromCode!=this.langToCode){e.next=2;break}return e.abrupt("return");case 2:return n=t.dataset.index,t.querySelector(".BRPageLayer.BRtranslateLayer")?a=t.querySelector(".BRPageLayer.BRtranslateLayer"):((a=document.createElement("div")).classList.add("BRPageLayer","BRtranslateLayer","BRtranslateLayerLoading"),a.setAttribute("lang","".concat(this.langToCode)),t.prepend(a)),(o=t.querySelector(".BRtextLayer")).classList.add("showingTranslation"),S(a).css({width:S(o).css("width"),height:S(o).css("height"),transform:S(o).css("transform"),"pointer-events":S(o).css("pointer-events"),"z-index":3}),i=this.getParagraphsOnPage(t),s=i.map(function(){var e=K(D().mark((function e(o,s){var c,u,h,f,d,p,g,m,y;return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((c=t.querySelector("[data-translate-index='".concat(n,"-").concat(s,"']")))||((c=document.createElement("p")).setAttribute("data-translate-index","".concat(n,"-").concat(s)),c.className="BRparagraphElement",u=i[s],o.classList.contains("ocr-role-header-footer")&&(c.ariaHidden="true",c.classList.add("ocr-role-header-footer")),h="".concat(parseInt(S(u).css("font-size")),"px"),S(c).css({"margin-left":S(u).css("margin-left"),"margin-top":S(u).css("margin-top"),top:S(u).css("top"),height:S(u).css("height"),width:S(u).css("width"),"font-size":h}),c.addEventListener("mousedown",(function(e){e.stopPropagation(),e.stopImmediatePropagation()})),c.addEventListener("mouseup",(function(e){e.stopPropagation(),e.stopImmediatePropagation()})),c.addEventListener("dragstart",(function(e){e.preventDefault()})),a.append(c)),0===o.textContent.length){e.next=15;break}return p=parseFloat(n)+r+s,e.next=6,l.translationManager.getTranslation(l.langFromCode,l.langToCode,n,s,o.textContent,p);case 6:g=e.sent,null===(f=c.firstElementChild)||void 0===f||f.remove(),m=null===(d=i[s])||void 0===d||null===(d=d.firstChild)||void 0===d?void 0:d.firstChild,(y=document.createElement("span")).className="BRlineElement",y.textContent=g,c.appendChild(y),S(y).css({"text-indent":S(m).css("padding-left")}),t.classList.contains("BRpage-visible")&&l.fitVisiblePage(c);case 15:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),e.next=11,Promise.all(s);case 11:this.br.trigger("translateLayerRendered",{leafIndex:n,translateLayer:a});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"getTranslateLayers",value:(r=K(D().mark((function e(t){var r,n,a=this;return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.br.getActivePageContainerElementsForIndex(t),!(n=S(r).filter("[data-index='".concat(t,"']")).find(".BRtranslateLayer")).length){e.next=4;break}return e.abrupt("return",n.toArray());case 4:return e.abrupt("return",new Promise((function(e,r){var n=function(){var r=K(D().mark((function r(o,i){return D().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:i.leafIndex==t&&(a.br.off("translateLayerRendered",n),e([i.translateLayer]));case 1:case"end":return r.stop()}}),r)})));return function(e,t){return r.apply(this,arguments)}}();a.br.on("translateLayerRendered",n)})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"clearAllTranslations",value:function(){document.querySelectorAll(".BRtranslateLayer").forEach((function(e){return e.remove()}))}},{key:"fitVisiblePage",value:function(e){var t=e.parentElement;if("none"==S(t).css("transform")){var r=e.getAttribute("data-translate-index").split("-")[0],n=document.querySelector("[data-index='".concat(r,"'] .BRtextLayer"));S(t).css({transform:n.style.transform})}for(var a=parseInt(S(e).css("font-size"));e.clientHeight<e.scrollHeight&&a>0;)a--,S(e).css({"font-size":"".concat(a,"px")});var o=e.firstElementChild.clientHeight,i=e.scrollHeight;if(o<i){var s=i/(o/a);S(e).css({"line-height":"".concat(s,"px"),overflow:"visible"})}}},{key:"_render",value:function(){var e=this;this.br.shell.menuProviders.translate={id:"translate",icon:(0,n.qy)(v||(v=R(["<img src='",'/translate.svg\' width="26"/>'])),this.br.options.imagesBaseURL),label:"Translate",component:(0,n.qy)(b||(b=R(['<br-translate-panel\n @connected="','"\n @langFromChanged="','"\n @langToChanged="','"\n @toggleTranslation="','"\n .fromLanguages="','"\n .toLanguages="','"\n .disclaimerMessage="','"\n .userTranslationActive=',"\n .detectedFromLang=","\n .detectedToLang=",'\n class="translate-panel"\n />'])),(function(t){e._panel=t.target,e._panel.fromLanguages=e.translationManager.fromLanguages,e._panel.toLanguages=e.translationManager.toLanguages}),this.handleFromLangChange,this.handleToLangChange,this.handleToggleTranslation,this.translationManager.fromLanguages,this.translationManager.toLanguages,this.options.panelDisclaimerText,!1,this.langFromCode,this.langToCode)},this.br.shell.updateMenuContents()}}]);var r,a,o}(a.S);null==se||se.registerPlugin("translate",le),ee=[(0,o.EM)("br-translate-panel")],te=n.WF,ae=C(),re=function(e){ae.initializeInstanceElements(e,ie.elements)},ne=function(e){function t(){var e;W(this,t);for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return e=U(this,t,[].concat(n)),re(e),e}return Z(t,e),H(t)}(te),oe={F:ne,d:[{kind:"field",decorators:[(0,o.MZ)({type:Array})],key:"fromLanguages",value:function(){return[]}},{kind:"field",decorators:[(0,o.MZ)({type:Array})],key:"toLanguages",value:function(){return[]}},{kind:"field",decorators:[(0,o.MZ)({type:String})],key:"prevSelectedLang",value:function(){return""}},{kind:"field",decorators:[(0,o.MZ)({type:String})],key:"disclaimerMessage",value:function(){return""}},{kind:"field",decorators:[(0,o.MZ)({type:Boolean})],key:"userTranslationActive",value:function(){return!1}},{kind:"field",decorators:[(0,o.MZ)({type:String})],key:"detectedFromLang",value:function(){return""}},{kind:"field",decorators:[(0,o.MZ)({type:String})],key:"detectedToLang",value:function(){return""}},{kind:"method",key:"createRenderRoot",value:function(){return this}},{kind:"method",key:"connectedCallback",value:function(){var e,t,r,n,a;(e=ne,t="connectedCallback",r=this,a=N(Y(1&(n=3)?e.prototype:e),t,r),2&n&&"function"==typeof a?function(e){return a.apply(r,e)}:a)([]),this.dispatchEvent(new CustomEvent("connected"))}},{kind:"method",key:"render",value:function(){var e=this;return(0,n.qy)(w||(w=R(['<div class="app" style="margin-top: 5%;padding-right: 5px;">\n <div\n class="disclaimer"\n id="disclaimerMessage"\n style="background-color: rgba(255,255,255,0.1);padding: 10px;border-radius: 8px;font-size: 12px;margin-bottom: 10px;color: rgba(255,255,255, 0.9);"\n >','</div>\n\n <div class="panel panel--to" style="padding: 0 10px;">\n <label>\n <span style="font-size: 12px;color: #ccc;">Translate To</span>\n <select id="lang-to" name="to" class="lang-select" style="display:block; width:100%;" @change="','">\n ','\n </select>\n </label>\n </div>\n\n <div class="panel panel--start" style="text-align: right;padding: 0 10px;/*! font-size: 18px; */margin-top: 10px;">\n <button class="start-translation-brn" @click="','">\n ','\n </button>\n </div>\n\n <div class="panel panel--from" style="font-size: 12px;color: #ccc;text-align: center;padding: 8px 10px;">\n <details style="display: contents">\n <summary style="text-decoration: underline white; cursor:pointer; display:inline-block"> \n <i>\n Source: '," ",' \n </i> Change \n </summary>\n <select id="lang-from" name="from" class="lang-select" value=',' @change="','" style="width:65%; margin-top: 3%; margin-bottom: 3%">\n ','\n </select>\n </details>\n <div class="footer" id="status" style="margin-top:5%">\n ',"\n </div>\n </div>"])),this.disclaimerMessage,this._onLangToChange,(0,x.sortBy)(this.toLanguages,(function(e){return e.name.toLowerCase()})).map((function(t){return(0,n.qy)(k||(k=R(['<option value="','" \n ?selected=',"\n > "," </option>"])),t.code,t.code==e.detectedToLang,t.name?t.name:t.code)})),this._toggleTranslation,this.userTranslationActive?"Stop Translating":"Translate",this._getLangName(this.detectedFromLang),this.prevSelectedLang?"":"(detected)",this.detectedFromLang,this._onLangFromChange,(0,x.sortBy)(this.fromLanguages,(function(e){return e.name.toLowerCase()})).map((function(t){return(0,n.qy)(L||(L=R(['<option value="','"\n ?selected=',"\n >"," </option>"])),t.code,t.code==e.detectedFromLang,t.name?t.name:t.code)})),this._statusWarning())}},{kind:"method",key:"_onLangFromChange",value:function(e){var t=new CustomEvent("langFromChanged",{detail:{value:e.target.value},bubbles:!0,composed:!0});this.dispatchEvent(t),this._getSelectedLang("to")!==this._getSelectedLang("from")&&(this.prevSelectedLang=this._getSelectedLang("from")),this.detectedFromLang=e.target.value}},{kind:"method",key:"_onLangToChange",value:function(e){var t=new CustomEvent("langToChanged",{detail:{value:e.target.value},bubbles:!0,composed:!0});this.dispatchEvent(t),this._getSelectedLang("from")!==e.target.value&&(this.prevSelectedLang=this._getSelectedLang("from")),this.detectedToLang=e.target.value}},{kind:"method",key:"_getSelectedLang",value:function(e){var t=this.querySelector("#lang-".concat(e));return t?t.value:""}},{kind:"method",key:"_getLangName",value:function(e){var t=[].concat(P(this.fromLanguages),P(this.toLanguages)).find((function(t){return t.code===e}));return t?t.name:""}},{kind:"method",key:"_toggleTranslation",value:function(e){var t=new CustomEvent("toggleTranslation",{detail:{value:e.target.value},bubbles:!0,composed:!0});this.userTranslationActive=!this.userTranslationActive,this.dispatchEvent(t)}},{kind:"method",key:"_statusWarning",value:function(){return this.detectedFromLang==this.detectedToLang?"Translate To language is the same as the Source language":""}}]},ie=ae.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},n=0;n<e.length;n++){var a,o=e[n];if("method"===o.kind&&(a=t.find(r)))if(_(o.descriptor)||_(a.descriptor)){if(z(o)||z(a))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");a.descriptor=o.descriptor}else{if(z(o)){if(z(a))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");a.decorators=o.decorators}A(o,a)}else t.push(o)}return t}(oe.d.map(O)),ee),ae.initializeClassElements(oe.F,ie.elements),ae.runClassFinishers(oe.F,ie.finishers)},4160:function(e,t,r){r.d(t,{$x:function(){return m},EF:function(){return u},ND:function(){return g},m0:function(){return h},YH:function(){return d}}),r(2675),r(9463),r(6412),r(2259),r(8125),r(8706),r(3418),r(3792),r(2062),r(4490),r(4782),r(2010),r(4731),r(479),r(875),r(6099),r(3362),r(7495),r(8781),r(7764),r(1761),r(3500),r(2953);var n=[],a={},o={},i={};[["Serbian","српски језик","sr","srp","srp"],["Romanian, Moldavian, Moldovan","Română","ro","ron","rum"],["Sichuan Yi, Nuosu","ꆈꌠ꒿ Nuosuhxop","ii","iii","iii"],["Tahitian","Reo Tahiti","ty","tah","tah"],["Tagalog","Wikang Tagalog","tl","tgl","tgl"],["Yiddish","ייִדיש","yi","yid","yid"],["Akan","Akan","ak","aka","aka"],["Malay","Bahasa Melayu, بهاس ملايو","ms","msa","may"],["Arabic","العربية","ar","ara","ara"],["Norwegian","Norsk","no","nor","nor"],["Ojibwa","ᐊᓂᔑᓈᐯᒧᐎᓐ","oj","oji","oji"],["Fulah","Fulfulde, Pulaar, Pular","ff","ful","ful"],["Persian","فارسی","fa","fas","per"],["Albanian","Shqip","sq","sqi","alb"],["Aymara","aymar aru","ay","aym","aym"],["Azerbaijani","azərbaycan dili","az","aze","aze"],["Chinese","中文 (Zhōngwén), 汉语, 漢語","zh","zho","chi"],["Cree","ᓀᐦᐃᔭᐍᐏᐣ","cr","cre","cre"],["Estonian","eesti, eesti keel","et","est","est"],["Guaraní","Avañe'ẽ","gn","grn","grn"],["Inupiaq","Iñupiaq, Iñupiatun","ik","ipk","ipk"],["Inuktitut","ᐃᓄᒃᑎᑐᑦ","iu","iku","iku"],["Kanuri","Kanuri","kr","kau","kau"],["Komi","коми кыв","kv","kom","kom"],["Kongo","Kikongo","kg","kon","kon"],["Kurdish","Kurdî, أۇزبېك","ku","kur","kur"],["Latvian","latviešu valoda","lv","lav","lav"],["Malagasy","fiteny malagasy","mg","mlg","mlg"],["Mongolian","Монгол хэл","mn","mon","mon"],["Oromo","Afaan Oromoo","om","orm","orm"],["Pashto, Pushto","پښتو","ps","pus","pus"],["Quechua","Runa Simi, Kichwa","qu","que","que"],["Sardinian","sardu","sc","srd","srd"],["Swahili","Kiswahili","sw","swa","swa"],["Uzbek","Oʻzbek, Ўзбек, ","uz","uzb","uzb"],["Zhuang, Chuang","Saɯ cueŋƅ, Saw cuengh","za","zha","zha"],["Bislama","Bislama","bi","bis","bis"],["Norwegian Bokmål","Norsk Bokmål","nb","nob","nob"],["Norwegian Nynorsk","Norsk Nynorsk","nn","nno","nno"],["Indonesian","Bahasa Indonesia","id","ind","ind"],["Twi","Twi","tw","twi","twi"],["Esperanto","Esperanto","eo","epo","epo"],["Interlingua","Interlingua","ia","ina","ina"],["Interlingue","Originally called Occidental; then Interlingue after WWII","ie","ile","ile"],["Ido","Ido","io","ido","ido"],["Volapük","Volapük","vo","vol","vol"],["Bihari languages","भोजपुरी","bh","bih","bih"],["Hebrew (modern)","עברית","he","heb","heb"],["Sanskrit","संस्कृतम्","sa","san","san"],["Church Slavic, Church Slavonic, Old Church Slavonic, Old Slavonic, Old Bulgarian","ѩзыкъ словѣньскъ","cu","chu","chu"],["Pali","पाऴि","pi","pli","pli"],["Avestan","avesta","ae","ave","ave"],["Latin","latine, lingua latina","la","lat","lat"],["Armenian","Հայերեն","hy","hye","arm"],["Swati","SiSwati","ss","ssw","ssw"],["Tibetan","བོད་ཡིག","bo","bod","tib"],["South Ndebele","isiNdebele","nr","nbl","nbl"],["Slovene","Slovenski Jezik, Slovenščina","sl","slv","slv"],["Oriya","ଓଡ଼ିଆ","or","ori","ori"],["North Ndebele","isiNdebele","nd","nde","nde"],["Nauru","Dorerin Naoero","na","nau","nau"],["Maori","te reo Māori","mi","mri","mao"],["Marathi","मराठी","mr","mar","mar"],["Luba-Katanga","Kiluba","lu","lub","lub"],["Rundi","Ikirundi","rn","run","run"],["Central Khmer","ខ្មែរ, ខេមរភាសា, ភាសាខ្មែរ","km","khm","khm"],["Western Frisian","Frysk","fy","fry","fry"],["Bengali","বাংলা","bn","ben","ben"],["Avaric","авар мацӀ, магӀарул мацӀ","av","ava","ava"],["Abkhazian","аҧсуа бызшәа, аҧсшәа","ab","abk","abk"],["Afar","Afaraf","aa","aar","aar"],["Afrikaans","Afrikaans","af","afr","afr"],["Amharic","አማርኛ","am","amh","amh"],["Aragonese","aragonés","an","arg","arg"],["Assamese","অসমীয়া","as","asm","asm"],["Bambara","bamanankan","bm","bam","bam"],["Bashkir","башҡорт теле","ba","bak","bak"],["Basque","euskara, euskera","eu","eus","baq"],["Belarusian","беларуская мова","be","bel","bel"],["Bosnian","bosanski jezik","bs","bos","bos"],["Breton","brezhoneg","br","bre","bre"],["Bulgarian","български език","bg","bul","bul"],["Burmese","ဗမာစာ","my","mya","bur"],["Catalan, Valencian","català, valencià","ca","cat","cat"],["Chamorro","Chamoru","ch","cha","cha"],["Chechen","нохчийн мотт","ce","che","che"],["Chichewa, Chewa, Nyanja","chiCheŵa, chinyanja","ny","nya","nya"],["Chuvash","чӑваш чӗлхи","cv","chv","chv"],["Cornish","Kernewek","kw","cor","cor"],["Corsican","corsu, lingua corsa","co","cos","cos"],["Croatian","hrvatski jezik","hr","hrv","hrv"],["Czech","čeština, český jazyk","cs","ces","cze"],["Danish","dansk","da","dan","dan"],["Divehi, Dhivehi, Maldivian","ދިވެހި","dv","div","div"],["Dutch, Flemish","Nederlands, Vlaams","nl","nld","dut"],["Dzongkha","རྫོང་ཁ","dz","dzo","dzo"],["English","English","en","eng","eng"],["Ewe","Eʋegbe","ee","ewe","ewe"],["Faroese","føroyskt","fo","fao","fao"],["Fijian","vosa Vakaviti","fj","fij","fij"],["Finnish","suomi, suomen kieli","fi","fin","fin"],["French","français, langue française","fr","fra","fre"],["Galician","Galego","gl","glg","glg"],["Georgian","ქართული","ka","kat","geo"],["German","Deutsch","de","deu","ger"],["Greek (modern)","ελληνικά","el","ell","gre"],["Gujarati","ગુજરાતી","gu","guj","guj"],["Haitian, Haitian Creole","Kreyòl ayisyen","ht","hat","hat"],["Hausa","(Hausa) هَوُسَ","ha","hau","hau"],["Herero","Otjiherero","hz","her","her"],["Hindi","हिन्दी, हिंदी","hi","hin","hin"],["Hiri Motu","Hiri Motu","ho","hmo","hmo"],["Hungarian","magyar","hu","hun","hun"],["Irish","Gaeilge","ga","gle","gle"],["Igbo","Asụsụ Igbo","ig","ibo","ibo"],["Icelandic","Íslenska","is","isl","ice"],["Italian","Italiano","it","ita","ita"],["Japanese","日本語 (にほんご)","ja","jpn","jpn"],["Javanese","ꦧꦱꦗꦮ, Basa Jawa","jv","jav","jav"],["Kalaallisut, Greenlandic","kalaallisut, kalaallit oqaasii","kl","kal","kal"],["Kannada","ಕನ್ನಡ","kn","kan","kan"],["Kashmiri","कश्मीरी, كشميري","ks","kas","kas"],["Kazakh","қазақ тілі","kk","kaz","kaz"],["Kikuyu, Gikuyu","Gĩkũyũ","ki","kik","kik"],["Kinyarwanda","Ikinyarwanda","rw","kin","kin"],["Kirghiz, Kyrgyz","Кыргызча, Кыргыз тили","ky","kir","kir"],["Korean","한국어","ko","kor","kor"],["Kuanyama, Kwanyama","Kuanyama","kj","kua","kua"],["Luxembourgish, Letzeburgesch","Lëtzebuergesch","lb","ltz","ltz"],["Ganda","Luganda","lg","lug","lug"],["Limburgan, Limburger, Limburgish","Limburgs","li","lim","lim"],["Lingala","Lingála","ln","lin","lin"],["Lao","ພາສາລາວ","lo","lao","lao"],["Lithuanian","lietuvių kalba","lt","lit","lit"],["Manx","Gaelg, Gailck","gv","glv","glv"],["Macedonian","македонски јазик","mk","mkd","mac"],["Malayalam","മലയാളം","ml","mal","mal"],["Maltese","Malti","mt","mlt","mlt"],["Marshallese","Kajin M̧ajeļ","mh","mah","mah"],["Navajo, Navaho","Diné bizaad","nv","nav","nav"],["Nepali","नेपाली","ne","nep","nep"],["Ndonga","Owambo","ng","ndo","ndo"],["Occitan","occitan, lenga d'òc","oc","oci","oci"],["Ossetian, Ossetic","ирон æвзаг","os","oss","oss"],["Panjabi, Punjabi","ਪੰਜਾਬੀ","pa","pan","pan"],["Polish","język polski, polszczyzna","pl","pol","pol"],["Portuguese","Português","pt","por","por"],["Romansh","Rumantsch Grischun","rm","roh","roh"],["Russian","русский","ru","rus","rus"],["Sindhi","सिन्धी, سنڌي، سندھی","sd","snd","snd"],["Northern Sami","Davvisámegiella","se","sme","sme"],["Samoan","gagana fa'a Samoa","sm","smo","smo"],["Sango","yângâ tî sängö","sg","sag","sag"],["Gaelic, Scottish Gaelic","Gàidhlig","gd","gla","gla"],["Shona","chiShona","sn","sna","sna"],["Sinhala, Sinhalese","සිංහල","si","sin","sin"],["Slovak","Slovenčina, Slovenský Jazyk","sk","slk","slo"],["Somali","Soomaaliga, af Soomaali","so","som","som"],["Southern Sotho","Sesotho","st","sot","sot"],["Spanish, Castilian","Español","es","spa","spa"],["Sundanese","Basa Sunda","su","sun","sun"],["Swedish","Svenska","sv","swe","swe"],["Tamil","தமிழ்","ta","tam","tam"],["Telugu","తెలుగు","te","tel","tel"],["Tajik","тоҷикӣ, toçikī, تاجیکی","tg","tgk","tgk"],["Thai","ไทย","th","tha","tha"],["Tigrinya","ትግርኛ","ti","tir","tir"],["Turkmen","Türkmen, Түркмен","tk","tuk","tuk"],["Tswana","Setswana","tn","tsn","tsn"],["Tongan (Tonga Islands)","Faka Tonga","to","ton","ton"],["Turkish","Türkçe","tr","tur","tur"],["Tsonga","Xitsonga","ts","tso","tso"],["Tatar","татар теле, tatar tele","tt","tat","tat"],["Uighur, Uyghur","ئۇيغۇرچە, Uyghurche","ug","uig","uig"],["Ukrainian","Українська","uk","ukr","ukr"],["Urdu","اردو","ur","urd","urd"],["Venda","Tshivenḓa","ve","ven","ven"],["Vietnamese","Tiếng Việt","vi","vie","vie"],["Walloon","Walon","wa","wln","wln"],["Welsh","Cymraeg","cy","cym","wel"],["Wolof","Wollof","wo","wol","wol"],["Xhosa","isiXhosa","xh","xho","xho"],["Yoruba","Yorùbá","yo","yor","yor"],["Zulu","isiZulu","zu","zul","zul"]].forEach((e=>{var t={name:e[0],nativeName:e[1],iso639_1:e[2],iso639_2T:e[3],iso639_2B:e[4]};a[e[2]]=o[e[3]]=i[e[4]]=t,n.push(t)}));var s=n;function l(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return c(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function u(e){var t=e.match(/\S+/g);return t?t.length:0}function h(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:navigator.userAgent;return/android/i.test(e)}var f={"zh-hans":"中文 (Zhōngwén)"};function d(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?p(e=e.toLowerCase(),["iso639_1"],t)||p(e,["iso639_2T"],t)||p(e,["iso639_2B","nativeName","name"],t):null}function p(e,t,r){var n,a=l(s);try{for(a.s();!(n=a.n()).done;){var o,i=n.value,c=l(t);try{for(c.s();!(o=c.n()).done;)if(-1!=i[o.value].split(", ").map((function(e){return e.toLowerCase()})).indexOf(e))return r?"".concat(i.nativeName.split(", ")[0]," (").concat(i.iso639_1,")"):i.iso639_1}catch(e){c.e(e)}finally{c.f()}}}catch(e){a.e(e)}finally{a.f()}return f[e]?"".concat(f[e]," (").concat(e,")"):null}function g(){try{return!!window.localStorage}catch(e){return!1}}var m=-1!=location.toString().indexOf("_debugReadAloud=true")},4565:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function o(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,"string");if("object"!=n(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}r.d(t,{l:function(){return i}}),r(2675),r(9463),r(2259),r(5700),r(3792),r(9572),r(8130),r(6099),r(7764),r(2953);var i=function(){return e=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.maxSize=t,this.entries=[]},(t=[{key:"add",value:function(e){this.entries.length>=this.maxSize&&this.entries.shift(),this.entries.push(e)}}])&&a(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()}},function(e){e(e.s=6735)}]);
2
+ "use strict";(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[444],{4360:function(e,t,r){var n=r(420);const a=Object.freeze({processing:"processing",complete:"complete"});class o extends n.WF{static get properties(){return{mode:{type:String}}}constructor(){super(),this.mode=a.processing}render(){return n.qy`
3
+ <div class="${this.mode}">
4
+ <svg
5
+ viewBox="0 0 120 120"
6
+ preserveAspectRatio="none"
7
+ version="1.1"
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ xmlns:xlink="http://www.w3.org/1999/xlink"
10
+ aria-labelledby="indicatorTitle indicatorDescription"
11
+ >
12
+ <title id="indicatorTitle">Activity Indicator</title>
13
+ <desc id="indicatorDescription">
14
+ A rotating activity indicator with three dots in the middle.
15
+ </desc>
16
+ <g
17
+ id="icons/check-ring---squared"
18
+ stroke="none"
19
+ stroke-width="1"
20
+ fill="none"
21
+ fill-rule="evenodd"
22
+ >
23
+ <path
24
+ id="completed-ring"
25
+ class="loaded-indicator"
26
+ d="M60,10 C70.5816709,10 80.3955961,13.2871104 88.4763646,18.8959201 L78.3502633,29.0214223 C72.9767592,25.8315427 66.7022695,24 60,24 C40.117749,24 24,40.117749 24,60 C24,79.882251 40.117749,96 60,96 C79.882251,96 96,79.882251 96,60 L95.995,59.46 L108.327675,47.128668 C109.350926,50.9806166 109.925886,55.015198 109.993301,59.1731586 L110,60 C110,87.6142375 87.6142375,110 60,110 C32.3857625,110 10,87.6142375 10,60 C10,32.3857625 32.3857625,10 60,10 Z"
27
+ ></path>
28
+ <polygon
29
+ id="check"
30
+ class="loaded-indicator"
31
+ transform="translate(75.000000, 41.500000) rotate(44.000000) translate(-75.000000, -41.500000) "
32
+ points="96 85 54 85 54 65 76 64.999 76 -2 96 -2"
33
+ ></polygon>
34
+ <path
35
+ id="activity-ring"
36
+ class="activity-indicator"
37
+ d="M60,10 C69.8019971,10 78.9452178,12.8205573 86.6623125,17.6943223 L76.4086287,27.9484118 C71.4880919,25.4243078 65.9103784,24 60,24 C40.117749,24 24,40.117749 24,60 C24,79.882251 40.117749,96 60,96 C79.882251,96 96,79.882251 96,60 C96,53.3014663 94.1704984,47.0302355 90.9839104,41.6587228 L101.110332,31.5326452 C106.715332,39.6116982 110,49.4222615 110,60 C110,87.6142375 87.6142375,110 60,110 C32.3857625,110 10,87.6142375 10,60 C10,32.3857625 32.3857625,10 60,10 Z"
38
+ ></path>
39
+ <g
40
+ id="activity-dots"
41
+ class="activity-indicator"
42
+ transform="translate(40.000000, 55.000000)"
43
+ >
44
+ <circle id="left-dot" cx="5" cy="5" r="5"></circle>
45
+ <circle id="middle-dot" cx="20" cy="5" r="5"></circle>
46
+ <circle id="right-dot" cx="35" cy="5" r="5"></circle>
47
+ </g>
48
+ </g>
49
+ </svg>
50
+ </div>
51
+ `}static get styles(){const e=n.AH`var(--activityIndicatorCheckmarkColor, #31A481)`,t=n.AH`var(--activityIndicatorCompletedRingColor, #31A481)`,r=n.AH`var(--activityIndicatorLoadingRingColor, #333333)`,a=n.AH`var(--activityIndicatorLoadingDotColor, #333333)`;return n.AH`
52
+ #completed-ring {
53
+ fill: ${t};
54
+ }
55
+
56
+ #check {
57
+ fill: ${e};
58
+ }
59
+
60
+ #activity-ring {
61
+ fill: ${r};
62
+ }
63
+
64
+ #activity-dots {
65
+ fill: ${a};
66
+ }
67
+
68
+ .activity-indicator {
69
+ opacity: 0;
70
+ transition: opacity 0.25s ease-out;
71
+ }
72
+
73
+ .processing .activity-indicator {
74
+ opacity: 1;
75
+ }
76
+
77
+ .loaded-indicator {
78
+ opacity: 1;
79
+ transition: opacity 0.25s ease-out;
80
+ }
81
+
82
+ .processing .loaded-indicator {
83
+ opacity: 0;
84
+ }
85
+
86
+ .image {
87
+ border: 1px solid red;
88
+ display: inline-block;
89
+ }
90
+
91
+ .processing #activity-ring {
92
+ animation: rotate 1.3s infinite linear;
93
+ transform-origin: 50px 50px;
94
+ transform-box: fill-box;
95
+ }
96
+
97
+ .processing #left-dot {
98
+ opacity: 0;
99
+ animation: dot 1.3s infinite;
100
+ animation-delay: 0.2s;
101
+ }
102
+
103
+ .processing #middle-dot {
104
+ opacity: 0;
105
+ animation: dot 1.3s infinite;
106
+ animation-delay: 0.4s;
107
+ }
108
+
109
+ .processing #right-dot {
110
+ opacity: 0;
111
+ animation: dot 1.3s infinite;
112
+ animation-delay: 0.6s;
113
+ }
114
+
115
+ @keyframes rotate {
116
+ 0% {
117
+ transform: rotate(-360deg);
118
+ }
119
+ 100% {
120
+ /* This frame is supposed to be inferred, but Safari doesn't rotate it unless we're explicit */
121
+ transform: rotate(0deg);
122
+ }
123
+ }
124
+
125
+ @keyframes dot {
126
+ 0% {
127
+ opacity: 0;
128
+ }
129
+ 25% {
130
+ opacity: 1;
131
+ }
132
+ 100% {
133
+ opacity: 0;
134
+ }
135
+ }
136
+ `}}window.customElements.define("ia-activity-indicator",o)},1041:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function o(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,"string");if("object"!=n(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}r.d(t,{S:function(){return i}}),r(2675),r(9463),r(2259),r(5700),r(3792),r(9572),r(8130),r(9085),r(6099),r(7764),r(2953);var i=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.br=t,this.options},(t=[{key:"setup",value:function(e){this.options=Object.assign({},this.options,e)}},{key:"init",value:function(){}},{key:"_configurePageContainer",value:function(e){}},{key:"_configureToolbar",value:function(e){}},{key:"_bindNavigationHandlers",value:function(){}},{key:"extendNavBar",value:function(e){}}])&&a(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()},6735:function(e,t,r){r(2675),r(9463),r(6412),r(2259),r(8125),r(4490),r(4782),r(4554),r(4731),r(479),r(9085),r(2811),r(3851),r(875),r(825),r(888),r(8781),r(5700),r(8706),r(2008),r(113),r(3418),r(3792),r(2062),r(9572),r(2010),r(8130),r(6099),r(8459),r(8940),r(3362),r(7495),r(7764),r(5440),r(3500),r(2953);var n=r(420),a=r(1041),o=r(9696),i=(r(739),r(6034),r(4565));"undefined"!=typeof window&&window.Worker||(globalThis.Worker=class{#e;constructor(e){this.#e=new Promise((async t=>{const{Worker:r}=await import("node:worker_threads");t(new r(e))}))}addEventListener(e,t){this.#e.then((r=>r.on(e,(e=>t({data:e})))))}postMessage(e){this.#e.then((t=>t.postMessage(e)))}terminate(){this.#e.then((e=>e.terminate()))}});class s extends Error{}class l{constructor(e){this.options=e||{},this.registryUrl=this.options.registryUrl||"https://bergamot.s3.amazonaws.com/models/index.json",this.downloadTimeout="downloadTimeout"in this.options?parseInt(this.options.downloadTimeout):6e4,this.registry=this.loadModelRegistery(),this.buffers=new Map,this.pivotLanguage="pivotLanguage"in this.options?e.pivotLanguage:"en",this.models=new Map,this.onerror=this.options.onerror||(e=>console.error("WASM Translation Worker error:",e))}async loadWorker(){const e=this.options.workerUrl?new Worker(this.options.workerUrl):new Worker(new URL(r.p+r.u(474),r.b));let t=0;const n=new Map,a=(r,...a)=>new Promise(((o,i)=>{const s=++t;n.set(s,{accept:o,reject:i,callsite:{message:`${r}(${a.map((e=>String(e))).join(", ")})`,stack:(new Error).stack}}),e.postMessage({id:s,name:r,args:a})}));return e.addEventListener("message",(function({data:{id:e,result:t,error:r}}){if(!n.has(e))throw console.debug("Received message with unknown id:",arguments[0]),new Error(`BergamotTranslator received response from worker to unknown call '${e}'`);const{accept:a,reject:o,callsite:i}=n.get(e);n.delete(e),void 0!==r?o(Object.assign(new Error,r,{message:r.message+` (response to ${i.message})`,stack:r.stack?`${r.stack}\n${i.stack}`:i.stack})):a(t)})),e.addEventListener("error",this.onerror.bind(this)),await a("initialize",this.options),{worker:e,exports:new Proxy({},{get(e,t,r){if("then"!==t)return(...e)=>a(t,...e)}})}}async loadModelRegistery(){const e=await fetch(this.registryUrl,{credentials:"omit"}),t=await e.json();return Array.from(Object.entries(t),(([e,t])=>{const r=e.match(/^([a-z]{2}(-[a-z]+)?)([a-z]{2}(-[a-z]+)?)/i);return{from:r[1],to:r[3],files:t}}))}getTranslationModel({from:e,to:t},r){const n=JSON.stringify({from:e,to:t});if(!this.buffers.has(n)){const a=this.loadTranslationModel({from:e,to:t},r);this.buffers.set(n,a),a.catch((e=>this.buffers.delete(n)))}return this.buffers.get(n)}async loadTranslationModel({from:e,to:t},r){performance.mark(`loadTranslationModule.${JSON.stringify({from:e,to:t})}`);const n=(await this.registry).filter((r=>r.from==e&&r.to==t));if(!n)throw new Error(`No model for '${e}' -> '${t}'`);const a=n[0].files,o=()=>reject(new s("abort signal")),i=new Promise(((e,t)=>{r?.signal&&r.signal.addEventListener("abort",o)})),l=Object.fromEntries(await Promise.race([Promise.all(Object.entries(a).map((async([n,a])=>{if(void 0===a||void 0===a.name)return[n,null];try{return[n,await this.fetch(a.name,a.expectedSha256Hash,r)]}catch(r){throw new Error(`Could not fetch ${a.name} for ${e}->${t} model`,{cause:r})}}))),i]));r?.signal&&r.signal.removeEventListener("abort",o),performance.measure("loadTranslationModel",`loadTranslationModule.${JSON.stringify({from:e,to:t})}`);let c=[];if(l.vocab)c=[l.vocab];else{if(!l.trgvocab||!l.srcvocab)throw new Error(`Could not identify vocab files for ${e}->${t} model among: ${Array.from(Object.keys(a)).join(" ")}`);c=[l.srcvocab,l.trgvocab]}let u={};return a.model.name.endsWith("intgemm8.bin")&&(u["gemm-precision"]="int8shiftAll"),a.qualityModel&&(u["skip-cost"]=!1),a.config&&Object.assign(u,a.config),{model:l.model,shortlist:l.lex,vocabs:c,qualityModel:l.qualityModel,config:u}}async fetch(e,t,r){const n=new AbortController,a=()=>n.abort(),o=this.downloadTimeout?setTimeout(a,this.downloadTimeout):null;try{r?.signal&&r.signal.addEventListener("abort",a);const o={credentials:"omit",signal:n.signal};t&&(o.integrity=`sha256-${this.hexToBase64(t)}`),"undefined"==typeof window&&delete o.integrity;const i=await fetch(e,o);return await i.arrayBuffer()}finally{o&&clearTimeout(o),r?.signal&&r.signal.removeEventListener("abort",a)}}hexToBase64(e){return btoa(e.match(/\w{2}/g).map((function(e){return String.fromCharCode(parseInt(e,16))})).join(""))}getModels({from:e,to:t}){const r=JSON.stringify({from:e,to:t});return this.models.has(r)||this.models.set(r,this.findModels(e,t)),this.models.get(r)}async findModels(e,t){const r=await this.registry;let n=[],a=[],o=[];if(r.forEach((r=>{r.from===e&&r.to===t?n.push(r):r.from===e&&r.to===this.pivotLanguage?a.push(r):r.to===t&&r.from===this.pivotLanguage&&o.push(r)})),n.length)return[n[0]];if(a.length&&o.length)return[a[0],o[0]];throw new Error(`No model available to translate from '${e}' to '${t}'`)}}class c{constructor(e,t){t||(t=new l(e)),this.backing=t,this.workers=[],this.workerLimit=Math.max(e?.workers||0,1),this.queue=[],this.batchSerial=0,this.batchSize=Math.max(e?.batchSize||8,1),this.onerror=e?.onerror||(e=>console.error("WASM Translation Worker error:",e))}async delete(){this.remove((()=>!0)),this.workers.forEach((({worker:e})=>e.terminate()))}notify(){setTimeout((async()=>{if(!this.queue.length)return;let e=this.workers.find((e=>e.idle));if(!e&&this.workers.length<this.workerLimit)try{const t={idle:!1};this.workers.push(t),Object.assign(t,await this.backing.loadWorker()),e=t}catch(e){this.onerror(new Error(`Could not initialise translation worker: ${e.message}`))}if(!e)return;const t=this.queue.shift();e.idle=!1;try{await this.consumeBatch(t,e.exports)}catch(e){t.requests.forEach((({reject:t})=>t(e)))}e.idle=!0,this.queue.length&&this.notify()}))}translate(e){const{from:t,to:r,priority:n}=e;return new Promise((async(a,o)=>{try{const i=JSON.stringify({from:t,to:r}),s=await this.backing.getModels(e);this.enqueue({key:i,models:s,request:e,resolve:a,reject:o,priority:n}),this.notify()}catch(e){o(e)}}))}remove(e){const t=this.queue;this.queue=[],t.forEach((t=>{t.requests.forEach((({request:r,resolve:n,reject:a})=>{e(r)?a(Object.assign(new s("removed by filter"),{request:r})):this.enqueue({key:t.key,priority:t.priority,models:t.models,request:r,resolve:n,reject:a})}))}))}enqueue({key:e,models:t,request:r,resolve:n,reject:a,priority:o}){void 0===o&&(o=0);let i=this.queue.find((t=>t.key===e&&t.priority===o&&t.requests.length<this.batchSize));i||(i={id:++this.batchSerial,key:e,priority:o,models:t,requests:[]},this.queue.push(i),this.queue.sort(((e,t)=>e.priority-t.priority))),i.requests.push({request:r,resolve:n,reject:a})}async consumeBatch(e,t){performance.mark("BergamotBatchTranslator.start"),await Promise.all(e.models.map((async({from:e,to:r})=>{if(!await t.hasTranslationModel({from:e,to:r})){const n=await this.backing.getTranslationModel({from:e,to:r});await t.loadTranslationModel({from:e,to:r},n)}})));const r=await t.translate({models:e.models.map((({from:e,to:t})=>({from:e,to:t}))),texts:e.requests.map((({request:{text:e,html:t,qualityScores:r}})=>({text:e.toString(),html:!!t,qualityScores:!!r})))});e.requests.forEach((({request:e,resolve:t,reject:n},a)=>{t({request:e,...r[a]})})),performance.measure("BergamotBatchTranslator","BergamotBatchTranslator.start")}}var u=r(4160);function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function h(){h=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,i=Object.create(o.prototype),s=new A(n||[]);return a(i,"_invoke",{value:j(e,r,s)}),i}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",g="suspendedYield",m="executing",y="completed",v={};function b(){}function w(){}function k(){}var x={};c(x,i,(function(){return this}));var L=Object.getPrototypeOf,S=L&&L(L(M([])));S&&S!==r&&n.call(S,i)&&(x=S);var E=k.prototype=b.prototype=Object.create(x);function T(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function r(a,o,i,s){var l=d(e[a],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==f(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,s)}),(function(e){r("throw",e,i,s)})):t.resolve(u).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,s)}))}s(l.arg)}var o;a(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,a){r(e,n,t,a)}))}return o=o?o.then(a,a):a()}})}function j(t,r,n){var a=p;return function(o,i){if(a===m)throw Error("Generator is already running");if(a===y){if("throw"===o)throw i;return{value:e,done:!0}}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var l=P(s,n);if(l){if(l===v)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===p)throw a=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=m;var c=d(t,r,n);if("normal"===c.type){if(a=n.done?y:g,c.arg===v)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(a=y,n.method="throw",n.arg=c.arg)}}}function P(t,r){var n=r.method,a=t.iterator[n];if(a===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,P(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var o=d(a,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function M(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function r(){for(;++a<t.length;)if(n.call(t,a))return r.value=t[a],r.done=!1,r;return r.value=e,r.done=!0,r};return o.next=o}}throw new TypeError(f(t)+" is not iterable")}return w.prototype=k,a(E,"constructor",{value:k,configurable:!0}),a(k,"constructor",{value:w,configurable:!0}),w.displayName=c(k,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,k):(e.__proto__=k,c(e,l,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},T(C.prototype),c(C.prototype,s,(function(){return this})),t.AsyncIterator=C,t.async=function(e,r,n,a,o){void 0===o&&(o=Promise);var i=new C(u(e,r,n,a),o);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(E),c(E,l,"Generator"),c(E,i,(function(){return this})),c(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=M,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(_),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function a(n,a){return s.type="throw",s.arg=t,r.next=n,a&&(r.method="next",r.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),_(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;_(r)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:M(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}function d(e,t,r,n,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,a)}function p(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){d(o,n,a,i,s,"next",e)}function s(e){d(o,n,a,i,s,"throw",e)}i(void 0)}))}}function g(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,y(n.key),n)}}function m(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e){var t=function(e,t){if("object"!=f(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=f(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==f(t)?t:t+""}var v,b,w,k,x,L,S,E=function(){return e=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),m(this,"alreadyTranslated",new i.l(100)),m(this,"modelRegistry",{}),m(this,"currentlyTranslating",{}),m(this,"fromLanguages",[]),m(this,"toLanguages",[]),m(this,"active",!1),m(this,"publicPath",""),m(this,"getTranslation",function(){var e=p(h().mark((function e(r,n,a,o,i,s){var l,c,u,f,d;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.active=!0,r!=n&&r&&n){e.next=3;break}return e.abrupt("return");case 3:if(l="".concat(r).concat(n,"-").concat(a,":").concat(o),!(c=t.alreadyTranslated.entries.find((function(e){return e.index==l})))){e.next=7;break}return e.abrupt("return",c.response);case 7:if(!(l in t.currentlyTranslating)){e.next=9;break}return e.abrupt("return",t.currentlyTranslating[l].promise);case 9:if(u=null,f=null,d=new Promise((function(e,t){u=e,f=t})),t.currentlyTranslating[l]={promise:d,resolve:u,reject:f},i){e.next=16;break}return t.currentlyTranslating[l].reject("No text was provided"),e.abrupt("return",d);case 16:return t.translator.translate({to:n,from:r,text:i,html:!1,priority:s}).then((function(e){var r=e;t.currentlyTranslating[l].resolve(r.target.text),t.alreadyTranslated.add({index:l,response:r.target.text}),delete t.currentlyTranslating[l]})),e.abrupt("return",d);case 18:case"end":return e.stop()}}),e)})));return function(t,r,n,a,o,i){return e.apply(this,arguments)}}()),m(this,"getTranslationModel",function(){var e=p(h().mark((function e(r,n){return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t.translator.backing.getTranslationModel({from:r,to:n}).catch((function(e){console.error("An error occurred while trying to retreive the ".concat(r,"-").concat(n," model"))})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}());var r={code:"en",name:"English",type:"prod"};this.fromLanguages.push(r),this.toLanguages.push(r)},t=[{key:"initWorker",value:(r=p(h().mark((function e(){var t,r,n,a,o,i,s,l,f,d,p,g,m,y,v,b,w=this;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.initPromise){e.next=2;break}return e.abrupt("return",this.initPromise);case 2:return this.initPromise=new Promise((function(e,t){w._initResolve=e,w._initReject=t})),t="https://cors.archive.org/cors/mozilla-translate-models/firefox_models/",e.next=6,fetch(t+"registry.json").then((function(e){return e.json()}));case 6:for(r=e.sent,n=0,a=Object.values(r);n<a.length;n++)for(o=a[n],i=0,s=Object.values(o);i<s.length;i++)(l=s[i]).name=t+l.name;return this.translator=new c({registryUrl:"data:application/json,".concat(encodeURIComponent(JSON.stringify(r))),workers:2,batchSize:4,workerUrl:this.publicPath+"/translator-worker.js"}),e.next=11,this.translator.backing.registry;case 11:for(f=e.sent,d={},p=0,g=Object.values(f);p<g.length;p++)m=g[p],y=m.from,v=m.to,b=m.files,d["".concat(y).concat(v)]=b,"en"!==y&&this.fromLanguages.push({code:y,name:(0,u.YH)(y,!0),type:"prod"}),"en"!==v&&this.toLanguages.push({code:v,name:(0,u.YH)(v,!0),type:"prod"});return this._initResolve([this.modelRegistry]),e.abrupt("return",this.initPromise);case 16:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})}],t&&g(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}(),T=r(8004),C=r(593),j=(r(4360),r(1669));function P(e){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P(e)}function O(e){return function(e){if(Array.isArray(e))return G(e)}(e)||N(e)||D(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(){_=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(n){t.forEach((function(t){var a=t.placement;if(t.kind===n&&("static"===a||"prototype"===a)){var o="static"===a?e:r;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var n=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===n?void 0:n.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],n=[],a={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,a)}),this),e.forEach((function(e){if(!z(e))return r.push(e);var t=this.decorateElement(e,a);r.push(t.element),r.push.apply(r,t.extras),n.push.apply(n,t.finishers)}),this),!t)return{elements:r,finishers:n};var o=this.decorateConstructor(r,t);return n.push.apply(n,o.finishers),o.finishers=n,o},addElementPlacement:function(e,t,r){var n=t[e.placement];if(!r&&-1!==n.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");n.push(e.key)},decorateElement:function(e,t){for(var r=[],n=[],a=e.decorators,o=a.length-1;o>=0;o--){var i=t[e.placement];i.splice(i.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,a[o])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&n.push(l.finisher);var c=l.extras;if(c){for(var u=0;u<c.length;u++)this.addElementPlacement(c[u],t);r.push.apply(r,c)}}return{element:e,finishers:n,extras:r}},decorateConstructor:function(e,t){for(var r=[],n=t.length-1;n>=0;n--){var a=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[n])(a)||a);if(void 0!==o.finisher&&r.push(o.finisher),void 0!==o.elements){e=o.elements;for(var i=0;i<e.length-1;i++)for(var s=i+1;s<e.length;s++)if(e[i].key===e[s].key&&e[i].placement===e[s].placement)throw new TypeError("Duplicated element ("+e[i].key+")")}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t},toElementDescriptors:function(e){if(void 0!==e)return(t=e,function(e){if(Array.isArray(e))return e}(t)||N(t)||D(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this);var t},toElementDescriptor:function(e){var t=e.kind+"";if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var r=te(e.key),n=e.placement+"";if("static"!==n&&"prototype"!==n&&"own"!==n)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+n+'"');var a=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:n,descriptor:Object.assign({},a)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(a,"get","The property descriptor of a field descriptor"),this.disallowProperty(a,"set","The property descriptor of a field descriptor"),this.disallowProperty(a,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:B(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t},toClassDescriptor:function(e){var t=e.kind+"";if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');this.disallowProperty(e,"key","A class descriptor"),this.disallowProperty(e,"placement","A class descriptor"),this.disallowProperty(e,"descriptor","A class descriptor"),this.disallowProperty(e,"initializer","A class descriptor"),this.disallowProperty(e,"extras","A class descriptor");var r=B(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var n=(0,t[r])(e);if(void 0!==n){if("function"!=typeof n)throw new TypeError("Finishers must return a constructor.");e=n}}return e},disallowProperty:function(e,t,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}};return e}function A(e){var t,r=te(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var n={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(n.decorators=e.decorators),"field"===e.kind&&(n.initializer=e.value),n}function M(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function z(e){return e.decorators&&e.decorators.length}function R(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function B(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}function N(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function I(){return I="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=J(e)););return e}(e,t);if(n){var a=Object.getOwnPropertyDescriptor(n,t);return a.get?a.get.call(arguments.length<3?e:r):a.value}},I.apply(null,arguments)}function q(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function F(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=D(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}function D(e,t){if(e){if("string"==typeof e)return G(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?G(e,t):void 0}}function G(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function $(){$=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=t&&t.prototype instanceof y?t:y,i=Object.create(o.prototype),s=new _(n||[]);return a(i,"_invoke",{value:T(e,r,s)}),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var h="suspendedStart",d="suspendedYield",p="executing",g="completed",m={};function y(){}function v(){}function b(){}var w={};c(w,i,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(A([])));x&&x!==r&&n.call(x,i)&&(w=x);var L=b.prototype=y.prototype=Object.create(w);function S(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function r(a,o,i,s){var l=f(e[a],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==P(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,s)}),(function(e){r("throw",e,i,s)})):t.resolve(u).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,s)}))}s(l.arg)}var o;a(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,a){r(e,n,t,a)}))}return o=o?o.then(a,a):a()}})}function T(t,r,n){var a=h;return function(o,i){if(a===p)throw Error("Generator is already running");if(a===g){if("throw"===o)throw i;return{value:e,done:!0}}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var l=C(s,n);if(l){if(l===m)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===h)throw a=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=p;var c=f(t,r,n);if("normal"===c.type){if(a=n.done?g:d,c.arg===m)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(a=g,n.method="throw",n.arg=c.arg)}}}function C(t,r){var n=r.method,a=t.iterator[n];if(a===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,C(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var o=f(a,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,m;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function A(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function r(){for(;++a<t.length;)if(n.call(t,a))return r.value=t[a],r.done=!1,r;return r.value=e,r.done=!0,r};return o.next=o}}throw new TypeError(P(t)+" is not iterable")}return v.prototype=b,a(L,"constructor",{value:b,configurable:!0}),a(b,"constructor",{value:v,configurable:!0}),v.displayName=c(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,l,"GeneratorFunction")),e.prototype=Object.create(L),e},t.awrap=function(e){return{__await:e}},S(E.prototype),c(E.prototype,s,(function(){return this})),t.AsyncIterator=E,t.async=function(e,r,n,a,o){void 0===o&&(o=Promise);var i=new E(u(e,r,n,a),o);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},S(L),c(L,l,"Generator"),c(L,i,(function(){return this})),c(L,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=A,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function a(n,a){return s.type="throw",s.arg=t,r.next=n,a&&(r.method="next",r.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),O(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;O(r)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:A(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},t}function H(e,t,r,n,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,a)}function W(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){H(o,n,a,i,s,"next",e)}function s(e){H(o,n,a,i,s,"throw",e)}i(void 0)}))}}function K(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function U(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,te(n.key),n)}}function Y(e,t,r){return t&&U(e.prototype,t),r&&U(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Z(e,t,r){return t=J(t),function(e,t){if(t&&("object"==P(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,V()?Reflect.construct(t,r||[],J(e).constructor):t.apply(e,r))}function V(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(V=function(){return!!e})()}function J(e){return J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},J(e)}function X(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Q(e,t)}function Q(e,t){return Q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Q(e,t)}function ee(e,t,r){return(t=te(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function te(e){var t=function(e,t){if("object"!=P(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=P(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==P(t)?t:t+""}var re,ne,ae,oe,ie,se,le,ce=window.BookReader,ue=function(e){function t(){var e;K(this,t);for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return ee(e=Z(this,t,[].concat(n)),"options",{enabled:!0,panelDisclaimerText:"Translations are in alpha"}),ee(e,"translationManager",new E),ee(e,"worker",void 0),ee(e,"toLanguages",[]),ee(e,"langFromCode",void 0),ee(e,"langToCode",void 0),ee(e,"_panel",void 0),ee(e,"userToggleTranslate",void 0),ee(e,"loadingModel",!0),ee(e,"getParagraphsOnPage",(function(e){return e?Array.from(e.querySelectorAll(".BRtextLayer > .BRparagraphElement")):[]})),ee(e,"handleFromLangChange",function(){var t=W($().mark((function t(r){var n;return $().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.clearAllTranslations(),n=r.detail.value,e.langFromCode=n,e._panel.requestUpdate(),e.translationManager.toLanguages.some((function(e){return e.code===n}))||e.translationManager.toLanguages.push({code:n,name:e.translationManager.fromLanguages.find((function(e){return e.code==n})).name}),e._panel.toLanguages=e.translationManager.toLanguages,console.log(e.langFromCode,e.langToCode),e._render(),e.langFromCode!==e.langToCode&&e.translateActivePageContainerElements();case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),ee(e,"handleToLangChange",function(){var t=W($().mark((function t(r){return $().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.clearAllTranslations(),e.langToCode=r.detail.value,e._render(),e.translateActivePageContainerElements();case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),ee(e,"handleToggleTranslation",W($().mark((function t(){return $().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.userToggleTranslate=!e.userToggleTranslate,e.translationManager.active=e.userToggleTranslate,e.textSelectionManager||(e.textSelectionManager=new C.bg(".BRtranslateLayer",e.br,{selectionElement:[".BRlineElement"]},1),e.textSelectionManager.init()),e._render(),e.userToggleTranslate?(e.br.trigger("translationEnabled",{}),e.translateActivePageContainerElements(),e.textSelectionManager.attach()):(e.clearAllTranslations(),e.br.trigger("translationDisabled",{}),e.textSelectionManager.detach());case 5:case"end":return t.stop()}}),t)})))),e}return X(t,e),Y(t,[{key:"init",value:(o=W($().mark((function e(){var t,r=this;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=(0,u.YH)(this.br.options.bookLanguage.replace(/[.,/#!$%^&*;:{}=\-_`~()]/g,"")),this.langFromCode=null!=t?t:"en",this.options.enabled){e.next=4;break}return e.abrupt("return");case 4:return this.translationManager.publicPath=this.br.options.imagesBaseURL.replace(/\/+$/,"")+"/..",this.br.on("textLayerRendered",function(){var e=W($().mark((function e(t,n){var a,o;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.pageIndex,a=n.pageContainer,r.translationManager){e.next=3;break}return e.abrupt("return");case 3:r.translationManager.active&&(o=a.$container[0],r.translateRenderedLayer(o));case 4:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),this.br.on("pageVisible",(function(e,t){var n=t.pageContainerEl;if(r.translationManager.active){var a,o=F(n.querySelectorAll(".BRtranslateLayer > .BRparagraphElement"));try{for(o.s();!(a=o.n()).done;){var i=a.value;i.textContent&&r.fitVisiblePage(i)}}catch(e){o.e(e)}finally{o.f()}}})),e.next=9,this.translationManager.initWorker();case 9:this.langToCode=this.translationManager.toLanguages[0].code,this._render();case 11:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"translateActivePageContainerElements",value:function(){var e,t=this.br.getActivePageContainerElements(),r=t.filter((function(e){return e.classList.contains("BRpage-visible")})),n=t.filter((function(e){return!e.classList.contains("BRpage-visible")})),a=F(r);try{for(a.s();!(e=a.n()).done;){var o=e.value;this.translateRenderedLayer(o,0)}}catch(e){a.e(e)}finally{a.f()}var i,s=F(n);try{for(s.s();!(i=s.n()).done;){var l=i.value;this.translateRenderedLayer(l,1e3)}}catch(e){s.e(e)}finally{s.f()}}},{key:"translateRenderedLayer",value:(a=W($().mark((function e(t,r){var n,a,o,i,s,l,c=this;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.br.mode!=this.br.constModeThumb&&this.userToggleTranslate&&this.langFromCode!=this.langToCode){e.next=2;break}return e.abrupt("return");case 2:return a=t.dataset.index,t.querySelector(".BRPageLayer.BRtranslateLayer")?o=t.querySelector(".BRPageLayer.BRtranslateLayer"):((o=document.createElement("div")).classList.add("BRPageLayer","BRtranslateLayer","BRtranslateLayerLoading"),o.setAttribute("lang","".concat(this.langToCode)),t.prepend(o)),(i=t.querySelector(".BRtextLayer")).classList.add("showingTranslation"),j(o).css({width:j(i).css("width"),height:j(i).css("height"),transform:j(i).css("transform"),"pointer-events":j(i).css("pointer-events"),"z-index":3}),s=this.getParagraphsOnPage(t),l=s.map(function(){var e=W($().mark((function e(n,i){var l,u,f,h,d,p,g,m,y;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((l=t.querySelector("[data-translate-index='".concat(a,"-").concat(i,"']")))||((l=document.createElement("p")).setAttribute("data-translate-index","".concat(a,"-").concat(i)),l.className="BRparagraphElement",u=s[i],n.classList.contains("ocr-role-header-footer")&&(l.ariaHidden="true",l.classList.add("ocr-role-header-footer")),f="".concat(parseInt(j(u).css("font-size")),"px"),j(l).css({"margin-left":j(u).css("margin-left"),"margin-top":j(u).css("margin-top"),top:j(u).css("top"),height:j(u).css("height"),width:j(u).css("width"),"font-size":f}),o.append(l)),0===n.textContent.length){e.next=16;break}return p=parseFloat(a)+r+i,c.translationManager.getTranslationModel(c.langFromCode,c.langToCode).then((function(){c._panel.loadingModel=!1,c.loadingModel=!1})),e.next=7,c.translationManager.getTranslation(c.langFromCode,c.langToCode,a,i,n.textContent,p);case 7:g=e.sent,null===(h=l.firstElementChild)||void 0===h||h.remove(),m=null===(d=s[i])||void 0===d||null===(d=d.firstChild)||void 0===d?void 0:d.firstChild,(y=document.createElement("span")).className="BRlineElement",y.textContent=g,l.appendChild(y),j(y).css({"text-indent":j(m).css("padding-left")}),t.classList.contains("BRpage-visible")&&c.fitVisiblePage(l);case 16:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),null===(n=this.textSelectionManager)||void 0===n||n.stopPageFlip(this.br.refs.$brContainer),e.next=12,Promise.all(l);case 12:this.br.trigger("translateLayerRendered",{leafIndex:a,translateLayer:o});case 13:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"getTranslateLayers",value:(r=W($().mark((function e(t){var r,n,a=this;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.br.getActivePageContainerElementsForIndex(t),!(n=j(r).filter("[data-index='".concat(t,"']")).find(".BRtranslateLayer")).length){e.next=4;break}return e.abrupt("return",n.toArray());case 4:return e.abrupt("return",new Promise((function(e,r){var n=function(){var r=W($().mark((function r(o,i){return $().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:i.leafIndex==t&&(a.br.off("translateLayerRendered",n),e([i.translateLayer]));case 1:case"end":return r.stop()}}),r)})));return function(e,t){return r.apply(this,arguments)}}();a.br.on("translateLayerRendered",n)})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"clearAllTranslations",value:function(){document.querySelectorAll(".BRtranslateLayer").forEach((function(e){return e.remove()})),document.querySelectorAll(".showingTranslation").forEach((function(e){return e.classList.remove("showingTranslation")}))}},{key:"fitVisiblePage",value:function(e){var t=e.parentElement;if("none"==j(t).css("transform")){var r=e.getAttribute("data-translate-index").split("-")[0],n=document.querySelector("[data-index='".concat(r,"'] .BRtextLayer"));j(t).css({transform:n.style.transform})}for(var a=parseInt(j(e).css("font-size"));e.clientHeight<e.scrollHeight&&a>0;)a--,j(e).css({"font-size":"".concat(a,"px")});var o=e.firstElementChild.clientHeight,i=e.scrollHeight;if(o<i){var s=i/(o/a);j(e).css({"line-height":"".concat(s,"px"),overflow:"visible"})}}},{key:"_render",value:function(){var e=this;this.br.shell.menuProviders.translate={id:"translate",icon:(0,n.qy)(v||(v=q(["<img src='",'/translate.svg\' width="26"/>'])),this.br.options.imagesBaseURL),label:"Translate",component:(0,n.qy)(b||(b=q(['<br-translate-panel\n @connected="','"\n @langFromChanged="','"\n @langToChanged="','"\n @toggleTranslation="','"\n .fromLanguages="','"\n .toLanguages="','"\n .disclaimerMessage="','"\n .userTranslationActive=',"\n .detectedFromLang=","\n .detectedToLang=","\n .loadingModel=",'\n class="translate-panel"\n />'])),(function(t){e._panel=t.target,e._panel.fromLanguages=e.translationManager.fromLanguages,e._panel.toLanguages=e.translationManager.toLanguages,e._panel.userTranslationActive=e.userToggleTranslate,e._panel.detectedToLang=e.langToCode,e._panel.detectedFromLang=e.langFromCode,e._panel.loadingModel=e.loadingModel}),this.handleFromLangChange,this.handleToLangChange,this.handleToggleTranslation,this.translationManager.fromLanguages,this.translationManager.toLanguages,this.options.panelDisclaimerText,this.userToggleTranslate,this.langFromCode,this.langToCode,this.loadingModel)},this.br.shell.updateMenuContents()}}]);var r,a,o}(a.S);null==ce||ce.registerPlugin("translate",ue),re=[(0,o.EM)("br-translate-panel")],ne=n.WF,ie=_(),ae=function(e){ie.initializeInstanceElements(e,le.elements)},oe=function(e){function t(){var e;K(this,t);for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return e=Z(this,t,[].concat(n)),ae(e),e}return X(t,e),Y(t)}(ne),se={F:oe,d:[{kind:"field",decorators:[(0,o.MZ)({type:Array})],key:"fromLanguages",value:function(){return[]}},{kind:"field",decorators:[(0,o.MZ)({type:Array})],key:"toLanguages",value:function(){return[]}},{kind:"field",decorators:[(0,o.MZ)({type:String})],key:"prevSelectedLang",value:function(){return""}},{kind:"field",decorators:[(0,o.MZ)({type:String})],key:"disclaimerMessage",value:function(){return""}},{kind:"field",decorators:[(0,o.MZ)({type:Boolean})],key:"userTranslationActive",value:function(){return!1}},{kind:"field",decorators:[(0,o.MZ)({type:String})],key:"detectedFromLang",value:function(){return""}},{kind:"field",decorators:[(0,o.MZ)({type:String})],key:"detectedToLang",value:function(){return""}},{kind:"field",decorators:[(0,o.MZ)({type:Boolean})],key:"loadingModel",value:void 0},{kind:"method",key:"createRenderRoot",value:function(){return this}},{kind:"method",key:"connectedCallback",value:function(){var e,t,r,n,a;(e=oe,t="connectedCallback",r=this,a=I(J(1&(n=3)?e.prototype:e),t,r),2&n&&"function"==typeof a?function(e){return a.apply(r,e)}:a)([]),this.dispatchEvent(new CustomEvent("connected"))}},{kind:"method",key:"render",value:function(){var e=this;return(0,n.qy)(w||(w=q(['<div class="app" style="margin-top: 5%;padding-right: 5px;">\n <div\n class="disclaimer"\n id="disclaimerMessage"\n style="background-color: rgba(255,255,255,0.1);padding: 10px;border-radius: 8px;font-size: 12px;margin-bottom: 10px;color: rgba(255,255,255, 0.9);"\n >','</div>\n\n <div class="panel panel--to" style="padding: 0 10px;">\n <label>\n <span style="font-size: 12px;color: #ccc;">Translate To</span>\n <select id="lang-to" name="to" class="lang-select" style="display:block; width:100%;" @change="','">\n ','\n </select>\n </label>\n </div>\n\n <div class="panel panel--start" style="text-align: right;padding: 0 10px;/*! font-size: 18px; */margin-top: 10px;">\n <button class="start-translation-brn" @click="','">\n ','\n </button>\n </div>\n\n <div class="panel panel--from" style="font-size: 12px;color: #ccc;text-align: center;padding: 8px 10px;">\n <details style="display: contents">\n <summary style="text-decoration: underline white; cursor:pointer; display:inline-block"> \n <i>\n Source: '," ",' \n </i> Change \n </summary>\n <select id="lang-from" name="from" class="lang-select" value=',' @change="','" style="width:65%; margin-top: 3%; margin-bottom: 3%">\n ','\n </select>\n </details>\n <div class="footer" id="status" style="margin-top:5%">\n ','\n </div>\n\n <div class="lang-models-loading"> \n ',"\n </div>\n </div>"])),this.disclaimerMessage,this._onLangToChange,(0,T.sortBy)(this.toLanguages,(function(e){return e.name.toLowerCase()})).map((function(t){return(0,n.qy)(k||(k=q(['<option value="','" \n ?selected=',"\n > "," </option>"])),t.code,t.code==e.detectedToLang,t.name?t.name:t.code)})),this._toggleTranslation,this.userTranslationActive?"Stop Translating":"Translate",this._getLangName(this.detectedFromLang),this.prevSelectedLang?"":"(detected)",this.detectedFromLang,this._onLangFromChange,(0,T.sortBy)(this.fromLanguages,(function(e){return e.name.toLowerCase()})).map((function(t){return(0,n.qy)(x||(x=q(['<option value="','"\n ?selected=',"\n >"," </option>"])),t.code,t.code==e.detectedFromLang,t.name?t.name:t.code)})),this._statusWarning(),this._languageModelStatus())}},{kind:"method",key:"_onLangFromChange",value:function(e){var t=new CustomEvent("langFromChanged",{detail:{value:e.target.value},bubbles:!0,composed:!0});this.dispatchEvent(t),this._getSelectedLang("to")!==this._getSelectedLang("from")&&(this.prevSelectedLang=this._getSelectedLang("from")),this.loadingModel=!0,this.detectedFromLang=e.target.value}},{kind:"method",key:"_onLangToChange",value:function(e){var t=new CustomEvent("langToChanged",{detail:{value:e.target.value},bubbles:!0,composed:!0});this.dispatchEvent(t),this._getSelectedLang("from")!==e.target.value&&(this.prevSelectedLang=this._getSelectedLang("from")),this.loadingModel=!0,this.detectedToLang=e.target.value}},{kind:"method",key:"_getSelectedLang",value:function(e){var t=this.querySelector("#lang-".concat(e));return t?t.value:""}},{kind:"method",key:"_getLangName",value:function(e){var t=[].concat(O(this.fromLanguages),O(this.toLanguages)).find((function(t){return t.code===e}));return t?t.name:""}},{kind:"method",key:"_toggleTranslation",value:function(e){var t=new CustomEvent("toggleTranslation",{detail:{value:e.target.value},bubbles:!0,composed:!0});this.userTranslationActive=!this.userTranslationActive,this.dispatchEvent(t)}},{kind:"method",key:"_statusWarning",value:function(){return this.detectedFromLang==this.detectedToLang?"Translate To language is the same as the Source language":""}},{kind:"method",key:"_languageModelStatus",value:function(){return this.userTranslationActive?this.loadingModel?(0,n.qy)(L||(L=q(['\n <ia-activity-indicator mode="processing" style="display:block; width: 40px; height: 40px; margin: 0 auto;"></ia-activity-indicator>\n <p>Downloading language model</p>\n ']))):(0,n.qy)(S||(S=q(["<p>Language model loaded</p>"]))):""}}]},le=ie.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},n=0;n<e.length;n++){var a,o=e[n];if("method"===o.kind&&(a=t.find(r)))if(R(o.descriptor)||R(a.descriptor)){if(z(o)||z(a))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");a.descriptor=o.descriptor}else{if(z(o)){if(z(a))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");a.decorators=o.decorators}M(o,a)}else t.push(o)}return t}(se.d.map(A)),re),ie.initializeClassElements(se.F,le.elements),ie.runClassFinishers(se.F,le.finishers)},4160:function(e,t,r){r.d(t,{$x:function(){return m},EF:function(){return u},ND:function(){return g},m0:function(){return f},YH:function(){return d}}),r(2675),r(9463),r(6412),r(2259),r(8125),r(8706),r(3418),r(3792),r(2062),r(4490),r(4782),r(2010),r(4731),r(479),r(875),r(6099),r(3362),r(7495),r(8781),r(7764),r(1761),r(3500),r(2953);var n=[],a={},o={},i={};[["Serbian","српски језик","sr","srp","srp"],["Romanian, Moldavian, Moldovan","Română","ro","ron","rum"],["Sichuan Yi, Nuosu","ꆈꌠ꒿ Nuosuhxop","ii","iii","iii"],["Tahitian","Reo Tahiti","ty","tah","tah"],["Tagalog","Wikang Tagalog","tl","tgl","tgl"],["Yiddish","ייִדיש","yi","yid","yid"],["Akan","Akan","ak","aka","aka"],["Malay","Bahasa Melayu, بهاس ملايو","ms","msa","may"],["Arabic","العربية","ar","ara","ara"],["Norwegian","Norsk","no","nor","nor"],["Ojibwa","ᐊᓂᔑᓈᐯᒧᐎᓐ","oj","oji","oji"],["Fulah","Fulfulde, Pulaar, Pular","ff","ful","ful"],["Persian","فارسی","fa","fas","per"],["Albanian","Shqip","sq","sqi","alb"],["Aymara","aymar aru","ay","aym","aym"],["Azerbaijani","azərbaycan dili","az","aze","aze"],["Chinese","中文 (Zhōngwén), 汉语, 漢語","zh","zho","chi"],["Cree","ᓀᐦᐃᔭᐍᐏᐣ","cr","cre","cre"],["Estonian","eesti, eesti keel","et","est","est"],["Guaraní","Avañe'ẽ","gn","grn","grn"],["Inupiaq","Iñupiaq, Iñupiatun","ik","ipk","ipk"],["Inuktitut","ᐃᓄᒃᑎᑐᑦ","iu","iku","iku"],["Kanuri","Kanuri","kr","kau","kau"],["Komi","коми кыв","kv","kom","kom"],["Kongo","Kikongo","kg","kon","kon"],["Kurdish","Kurdî, أۇزبېك","ku","kur","kur"],["Latvian","latviešu valoda","lv","lav","lav"],["Malagasy","fiteny malagasy","mg","mlg","mlg"],["Mongolian","Монгол хэл","mn","mon","mon"],["Oromo","Afaan Oromoo","om","orm","orm"],["Pashto, Pushto","پښتو","ps","pus","pus"],["Quechua","Runa Simi, Kichwa","qu","que","que"],["Sardinian","sardu","sc","srd","srd"],["Swahili","Kiswahili","sw","swa","swa"],["Uzbek","Oʻzbek, Ўзбек, ","uz","uzb","uzb"],["Zhuang, Chuang","Saɯ cueŋƅ, Saw cuengh","za","zha","zha"],["Bislama","Bislama","bi","bis","bis"],["Norwegian Bokmål","Norsk Bokmål","nb","nob","nob"],["Norwegian Nynorsk","Norsk Nynorsk","nn","nno","nno"],["Indonesian","Bahasa Indonesia","id","ind","ind"],["Twi","Twi","tw","twi","twi"],["Esperanto","Esperanto","eo","epo","epo"],["Interlingua","Interlingua","ia","ina","ina"],["Interlingue","Originally called Occidental; then Interlingue after WWII","ie","ile","ile"],["Ido","Ido","io","ido","ido"],["Volapük","Volapük","vo","vol","vol"],["Bihari languages","भोजपुरी","bh","bih","bih"],["Hebrew (modern)","עברית","he","heb","heb"],["Sanskrit","संस्कृतम्","sa","san","san"],["Church Slavic, Church Slavonic, Old Church Slavonic, Old Slavonic, Old Bulgarian","ѩзыкъ словѣньскъ","cu","chu","chu"],["Pali","पाऴि","pi","pli","pli"],["Avestan","avesta","ae","ave","ave"],["Latin","latine, lingua latina","la","lat","lat"],["Armenian","Հայերեն","hy","hye","arm"],["Swati","SiSwati","ss","ssw","ssw"],["Tibetan","བོད་ཡིག","bo","bod","tib"],["South Ndebele","isiNdebele","nr","nbl","nbl"],["Slovene","Slovenski Jezik, Slovenščina","sl","slv","slv"],["Oriya","ଓଡ଼ିଆ","or","ori","ori"],["North Ndebele","isiNdebele","nd","nde","nde"],["Nauru","Dorerin Naoero","na","nau","nau"],["Maori","te reo Māori","mi","mri","mao"],["Marathi","मराठी","mr","mar","mar"],["Luba-Katanga","Kiluba","lu","lub","lub"],["Rundi","Ikirundi","rn","run","run"],["Central Khmer","ខ្មែរ, ខេមរភាសា, ភាសាខ្មែរ","km","khm","khm"],["Western Frisian","Frysk","fy","fry","fry"],["Bengali","বাংলা","bn","ben","ben"],["Avaric","авар мацӀ, магӀарул мацӀ","av","ava","ava"],["Abkhazian","аҧсуа бызшәа, аҧсшәа","ab","abk","abk"],["Afar","Afaraf","aa","aar","aar"],["Afrikaans","Afrikaans","af","afr","afr"],["Amharic","አማርኛ","am","amh","amh"],["Aragonese","aragonés","an","arg","arg"],["Assamese","অসমীয়া","as","asm","asm"],["Bambara","bamanankan","bm","bam","bam"],["Bashkir","башҡорт теле","ba","bak","bak"],["Basque","euskara, euskera","eu","eus","baq"],["Belarusian","беларуская мова","be","bel","bel"],["Bosnian","bosanski jezik","bs","bos","bos"],["Breton","brezhoneg","br","bre","bre"],["Bulgarian","български език","bg","bul","bul"],["Burmese","ဗမာစာ","my","mya","bur"],["Catalan, Valencian","català, valencià","ca","cat","cat"],["Chamorro","Chamoru","ch","cha","cha"],["Chechen","нохчийн мотт","ce","che","che"],["Chichewa, Chewa, Nyanja","chiCheŵa, chinyanja","ny","nya","nya"],["Chuvash","чӑваш чӗлхи","cv","chv","chv"],["Cornish","Kernewek","kw","cor","cor"],["Corsican","corsu, lingua corsa","co","cos","cos"],["Croatian","hrvatski jezik","hr","hrv","hrv"],["Czech","čeština, český jazyk","cs","ces","cze"],["Danish","dansk","da","dan","dan"],["Divehi, Dhivehi, Maldivian","ދިވެހި","dv","div","div"],["Dutch, Flemish","Nederlands, Vlaams","nl","nld","dut"],["Dzongkha","རྫོང་ཁ","dz","dzo","dzo"],["English","English","en","eng","eng"],["Ewe","Eʋegbe","ee","ewe","ewe"],["Faroese","føroyskt","fo","fao","fao"],["Fijian","vosa Vakaviti","fj","fij","fij"],["Finnish","suomi, suomen kieli","fi","fin","fin"],["French","français, langue française","fr","fra","fre"],["Galician","Galego","gl","glg","glg"],["Georgian","ქართული","ka","kat","geo"],["German","Deutsch","de","deu","ger"],["Greek (modern)","ελληνικά","el","ell","gre"],["Gujarati","ગુજરાતી","gu","guj","guj"],["Haitian, Haitian Creole","Kreyòl ayisyen","ht","hat","hat"],["Hausa","(Hausa) هَوُسَ","ha","hau","hau"],["Herero","Otjiherero","hz","her","her"],["Hindi","हिन्दी, हिंदी","hi","hin","hin"],["Hiri Motu","Hiri Motu","ho","hmo","hmo"],["Hungarian","magyar","hu","hun","hun"],["Irish","Gaeilge","ga","gle","gle"],["Igbo","Asụsụ Igbo","ig","ibo","ibo"],["Icelandic","Íslenska","is","isl","ice"],["Italian","Italiano","it","ita","ita"],["Japanese","日本語 (にほんご)","ja","jpn","jpn"],["Javanese","ꦧꦱꦗꦮ, Basa Jawa","jv","jav","jav"],["Kalaallisut, Greenlandic","kalaallisut, kalaallit oqaasii","kl","kal","kal"],["Kannada","ಕನ್ನಡ","kn","kan","kan"],["Kashmiri","कश्मीरी, كشميري","ks","kas","kas"],["Kazakh","қазақ тілі","kk","kaz","kaz"],["Kikuyu, Gikuyu","Gĩkũyũ","ki","kik","kik"],["Kinyarwanda","Ikinyarwanda","rw","kin","kin"],["Kirghiz, Kyrgyz","Кыргызча, Кыргыз тили","ky","kir","kir"],["Korean","한국어","ko","kor","kor"],["Kuanyama, Kwanyama","Kuanyama","kj","kua","kua"],["Luxembourgish, Letzeburgesch","Lëtzebuergesch","lb","ltz","ltz"],["Ganda","Luganda","lg","lug","lug"],["Limburgan, Limburger, Limburgish","Limburgs","li","lim","lim"],["Lingala","Lingála","ln","lin","lin"],["Lao","ພາສາລາວ","lo","lao","lao"],["Lithuanian","lietuvių kalba","lt","lit","lit"],["Manx","Gaelg, Gailck","gv","glv","glv"],["Macedonian","македонски јазик","mk","mkd","mac"],["Malayalam","മലയാളം","ml","mal","mal"],["Maltese","Malti","mt","mlt","mlt"],["Marshallese","Kajin M̧ajeļ","mh","mah","mah"],["Navajo, Navaho","Diné bizaad","nv","nav","nav"],["Nepali","नेपाली","ne","nep","nep"],["Ndonga","Owambo","ng","ndo","ndo"],["Occitan","occitan, lenga d'òc","oc","oci","oci"],["Ossetian, Ossetic","ирон æвзаг","os","oss","oss"],["Panjabi, Punjabi","ਪੰਜਾਬੀ","pa","pan","pan"],["Polish","język polski, polszczyzna","pl","pol","pol"],["Portuguese","Português","pt","por","por"],["Romansh","Rumantsch Grischun","rm","roh","roh"],["Russian","русский","ru","rus","rus"],["Sindhi","सिन्धी, سنڌي، سندھی","sd","snd","snd"],["Northern Sami","Davvisámegiella","se","sme","sme"],["Samoan","gagana fa'a Samoa","sm","smo","smo"],["Sango","yângâ tî sängö","sg","sag","sag"],["Gaelic, Scottish Gaelic","Gàidhlig","gd","gla","gla"],["Shona","chiShona","sn","sna","sna"],["Sinhala, Sinhalese","සිංහල","si","sin","sin"],["Slovak","Slovenčina, Slovenský Jazyk","sk","slk","slo"],["Somali","Soomaaliga, af Soomaali","so","som","som"],["Southern Sotho","Sesotho","st","sot","sot"],["Spanish, Castilian","Español","es","spa","spa"],["Sundanese","Basa Sunda","su","sun","sun"],["Swedish","Svenska","sv","swe","swe"],["Tamil","தமிழ்","ta","tam","tam"],["Telugu","తెలుగు","te","tel","tel"],["Tajik","тоҷикӣ, toçikī, تاجیکی","tg","tgk","tgk"],["Thai","ไทย","th","tha","tha"],["Tigrinya","ትግርኛ","ti","tir","tir"],["Turkmen","Türkmen, Түркмен","tk","tuk","tuk"],["Tswana","Setswana","tn","tsn","tsn"],["Tongan (Tonga Islands)","Faka Tonga","to","ton","ton"],["Turkish","Türkçe","tr","tur","tur"],["Tsonga","Xitsonga","ts","tso","tso"],["Tatar","татар теле, tatar tele","tt","tat","tat"],["Uighur, Uyghur","ئۇيغۇرچە, Uyghurche","ug","uig","uig"],["Ukrainian","Українська","uk","ukr","ukr"],["Urdu","اردو","ur","urd","urd"],["Venda","Tshivenḓa","ve","ven","ven"],["Vietnamese","Tiếng Việt","vi","vie","vie"],["Walloon","Walon","wa","wln","wln"],["Welsh","Cymraeg","cy","cym","wel"],["Wolof","Wollof","wo","wol","wol"],["Xhosa","isiXhosa","xh","xho","xho"],["Yoruba","Yorùbá","yo","yor","yor"],["Zulu","isiZulu","zu","zul","zul"]].forEach((e=>{var t={name:e[0],nativeName:e[1],iso639_1:e[2],iso639_2T:e[3],iso639_2B:e[4]};a[e[2]]=o[e[3]]=i[e[4]]=t,n.push(t)}));var s=n;function l(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return c(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function u(e){var t=e.match(/\S+/g);return t?t.length:0}function f(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:navigator.userAgent;return/android/i.test(e)}var h={"zh-hans":"中文 (Zhōngwén)"};function d(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?p(e=e.toLowerCase(),["iso639_1"],t)||p(e,["iso639_2T"],t)||p(e,["iso639_2B","nativeName","name"],t):null}function p(e,t,r){var n,a=l(s);try{for(a.s();!(n=a.n()).done;){var o,i=n.value,c=l(t);try{for(c.s();!(o=c.n()).done;)if(-1!=i[o.value].split(", ").map((function(e){return e.toLowerCase()})).indexOf(e))return r?"".concat(i.nativeName.split(", ")[0]," (").concat(i.iso639_1,")"):i.iso639_1}catch(e){c.e(e)}finally{c.f()}}}catch(e){a.e(e)}finally{a.f()}return h[e]?"".concat(h[e]," (").concat(e,")"):null}function g(){try{return!!window.localStorage}catch(e){return!1}}var m=-1!=location.toString().indexOf("_debugReadAloud=true")},593:function(e,t,r){r.d(t,{bg:function(){return b}}),r(2675),r(9463),r(6412),r(2259),r(5700),r(8125),r(113),r(3418),r(3792),r(8598),r(4490),r(4782),r(9572),r(2010),r(4731),r(479),r(8130),r(875),r(6099),r(3362),r(7495),r(8781),r(7764),r(5440),r(3500),r(2953);var n=r(1669);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}function i(e,t,r){return(t=s(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e){var t=function(e,t){if("object"!=a(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}var l=function(){return e=function e(t,r){var a=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"selecting",!1),i(this,"startedInSelector",!1),i(this,"target",null),i(this,"_onSelectionChange",(function(){var e=window.getSelection();if(!a.selecting&&e.toString()){var t=n(e.anchorNode).closest(a.selector)[0];if(!t)return;a.target=t,a.selecting=!0,a.handler("started",a.target)}!a.selecting||!e.isCollapsed&&e.toString()&&n(e.anchorNode).closest(a.selector)[0]||(a.selecting=!1,a.handler("cleared",a.target))})),this.selector=t,this.handler=r},(t=[{key:"attach",value:function(){document.addEventListener("selectionchange",this._onSelectionChange)}},{key:"detach",value:function(){document.removeEventListener("selectionchange",this._onSelectionChange)}}])&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),c=r(1669);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(){f=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,i=Object.create(o.prototype),s=new A(n||[]);return a(i,"_invoke",{value:j(e,r,s)}),i}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var p="suspendedStart",g="suspendedYield",m="executing",y="completed",v={};function b(){}function w(){}function k(){}var x={};c(x,i,(function(){return this}));var L=Object.getPrototypeOf,S=L&&L(L(M([])));S&&S!==r&&n.call(S,i)&&(x=S);var E=k.prototype=b.prototype=Object.create(x);function T(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function r(a,o,i,s){var l=d(e[a],e,o);if("throw"!==l.type){var c=l.arg,f=c.value;return f&&"object"==u(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,i,s)}),(function(e){r("throw",e,i,s)})):t.resolve(f).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,s)}))}s(l.arg)}var o;a(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,a){r(e,n,t,a)}))}return o=o?o.then(a,a):a()}})}function j(t,r,n){var a=p;return function(o,i){if(a===m)throw Error("Generator is already running");if(a===y){if("throw"===o)throw i;return{value:e,done:!0}}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var l=P(s,n);if(l){if(l===v)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===p)throw a=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=m;var c=d(t,r,n);if("normal"===c.type){if(a=n.done?y:g,c.arg===v)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(a=y,n.method="throw",n.arg=c.arg)}}}function P(t,r){var n=r.method,a=t.iterator[n];if(a===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,P(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var o=d(a,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function M(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function r(){for(;++a<t.length;)if(n.call(t,a))return r.value=t[a],r.done=!1,r;return r.value=e,r.done=!0,r};return o.next=o}}throw new TypeError(u(t)+" is not iterable")}return w.prototype=k,a(E,"constructor",{value:k,configurable:!0}),a(k,"constructor",{value:w,configurable:!0}),w.displayName=c(k,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,k):(e.__proto__=k,c(e,l,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},T(C.prototype),c(C.prototype,s,(function(){return this})),t.AsyncIterator=C,t.async=function(e,r,n,a,o){void 0===o&&(o=Promise);var i=new C(h(e,r,n,a),o);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(E),c(E,l,"Generator"),c(E,i,(function(){return this})),c(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=M,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(_),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function a(n,a){return s.type="throw",s.arg=t,r.next=n,a&&(r.method="next",r.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),_(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;_(r)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:M(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}var h=f().mark(w),d=f().mark(k);function p(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return g(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function m(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,v(n.key),n)}}function y(e,t,r){return(t=v(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=u(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==u(t)?t:t+""}var b=function(){return e=function e(t,r,n,a){var o=this,i=n.selectionElement;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),y(this,"options",{maxProtectedWords:200}),y(this,"_onSelectionChange",(function(e,t){if("started"===e)o.textSelectingMode(t);else{if("cleared"!==e)throw new Error("Unknown type ".concat(e));o.defaultMode(t)}})),y(this,"_limitSelection",(function(){var e=window.getSelection();if(e.rangeCount){var t=e.getRangeAt(0),r=!!t.startContainer.parentElement.closest(".BRcontainer"),n=!!t.endContainer.parentElement.closest(".BRcontainer");if(r||n)if(r&&n){var a=function(e,t){var r,n=0,a=p(e);try{for(a.s();!(r=a.n()).done;){var o=r.value;if(n==t)return o;n++}}catch(e){a.e(e)}finally{a.f()}}(w(k(t.startContainer,t.endContainer),(function(e){var t;return null===(t=e.classList)||void 0===t?void 0:t.contains(o.selectionElement[0].replace(".",""))})),o.options.maxProtectedWords-1);if(a&&t.endContainer.parentNode!=a){var i=document.createRange();i.setStart(t.startContainer,t.startOffset),i.setEnd(a.firstChild,a.textContent.length),e.removeAllRanges(),e.addRange(i)}}else e.removeAllRanges()}})),this.layer=t,this.br=r,this.selectionElement=i,this.selectionObserver=new l(this.layer,this._onSelectionChange),this.options.maxProtectedWords=a||200},t=[{key:"init",value:function(){var e=this;this.attach(),new l(this.layer,(function(t){var r;"started"==t&&(null===(r=e.br.plugins.archiveAnalytics)||void 0===r||r.sendEvent("BookReader","SelectStart"),e.br.refs.$br.find(".BRpagecontainer--hasSelection").removeClass("BRpagecontainer--hasSelection"),c(window.getSelection().anchorNode).closest(".BRpagecontainer").addClass("BRpagecontainer--hasSelection"))})).attach()}},{key:"attach",value:function(){var e=this;this.selectionObserver.attach(),this.br.protected&&(document.addEventListener("selectionchange",this._limitSelection),c(document.body).on("contextmenu dragstart copy",(function(t){var r=document.getSelection();if(null!=r&&r.toString()&&c(e.layer).toArray().some((function(e){return r.containsNode(e,!0)})))return t.preventDefault(),!1})))}},{key:"detach",value:function(){this.selectionObserver.detach(),this.br.protected&&document.removeEventListener("selectionchange",this._limitSelection)}},{key:"interceptCopy",value:function(e){e[0].addEventListener("copy",(function(e){var t=document.getSelection();e.clipboardData.setData("text/plain",t.toString()),e.preventDefault()}))}},{key:"stopPageFlip",value:function(e){var t=this,r=e.find(this.layer);r.length&&(r.each((function(e,r){return t.defaultMode(r)})),this.br.protected||this.interceptCopy(e))}},{key:"defaultMode",value:function(e){var t=this,r=c(e).closest(".BRpagecontainer");e.style.pointerEvents="none",r.find("img").css("pointer-events","auto"),c(e).off(".textSelectPluginHandler");var n=this.mouseIsDown,a=this.mouseIsDown;n&&(e.style.pointerEvents="auto"),c(e).on("mousedown.textSelectPluginHandler",(function(e){t.mouseIsDown=!0,c(e.target).is(t.selectionElement.join(", "))&&e.stopPropagation()})),c(e).on("mouseup.textSelectPluginHandler",(function(r){t.mouseIsDown=!1,e.style.pointerEvents="none",a&&(a=!1,r.stopPropagation())}))}},{key:"textSelectingMode",value:function(e){var t=this,r=c(e).closest(".BRpagecontainer");e.style.pointerEvents="all",r.find("img").css("pointer-events","none"),c(e).off(".textSelectPluginHandler"),c(e).on("mousedown.textSelectPluginHandler",(function(e){t.mouseIsDown=!0,e.stopPropagation()})),c(e).on("mouseup.textSelectPluginHandler",(function(e){t.mouseIsDown=!1,e.stopPropagation()}))}}],t&&m(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function w(e,t){var r,n,a;return f().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:r=p(e),o.prev=1,r.s();case 3:if((n=r.n()).done){o.next=10;break}if(a=n.value,!t(a)){o.next=8;break}return o.next=8,a;case 8:o.next=3;break;case 10:o.next=15;break;case 12:o.prev=12,o.t0=o.catch(1),r.e(o.t0);case 15:return o.prev=15,r.f(),o.finish(15);case 18:case"end":return o.stop()}}),h,null,[[1,12,15,18]])}function k(e,t){var r,n;return f().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return n=function(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=a.children,i=void 0===o||o,s=a.parents,l=void 0===s||s,c=a.siblings,u=void 0===c||c;return f().mark((function a(){var o;return f().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(e!==t){a.next=5;break}return r=!0,a.next=4,e;case 4:return a.abrupt("return");case 5:return a.next=7,e;case 7:if(!i||!e.firstChild){a.next=11;break}return a.delegateYield(n(e.firstChild,{children:!0,parents:!1,siblings:!0}),"t0",9);case 9:if(!r){a.next=11;break}return a.abrupt("return");case 11:if(!u){a.next=20;break}o=e.nextSibling;case 13:if(!o){a.next=20;break}return a.delegateYield(n(o,{children:!0,parents:!1,siblings:!1}),"t1",15);case 15:if(!r){a.next=17;break}return a.abrupt("return");case 17:o=o.nextSibling,a.next=13;break;case 20:if(!l||!e.parentNode){a.next=24;break}return a.delegateYield(n(e.parentNode,{children:!1,parents:!0,siblings:!0}),"t2",22);case 22:if(!r){a.next=24;break}return a.abrupt("return");case 24:case"end":return a.stop()}}),a)}))()},r=!1,a.delegateYield(n(e),"t0",3);case 3:case"end":return a.stop()}}),d)}},4565:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function o(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,"string");if("object"!=n(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}r.d(t,{l:function(){return i}}),r(2675),r(9463),r(2259),r(5700),r(3792),r(9572),r(8130),r(6099),r(7764),r(2953);var i=function(){return e=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.maxSize=t,this.entries=[]},(t=[{key:"add",value:function(e){this.entries.length>=this.maxSize&&this.entries.shift(),this.entries.push(e)}}])&&a(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()}},function(e){e(e.s=6735)}]);
3
137
  //# sourceMappingURL=plugin.translate.js.map