UNPKG

@picovoice/orca-web

Version:

Orca Text-to-Speech engine for web browsers (via WebAssembly)

1 lines 5.73 MB
function A(A,I,C,g,B,Q,E){try{var R=A[Q](E),U=R.value}catch(A){return void C(A)}R.done?I(U):Promise.resolve(U).then(g,B)}function I(I){return function(){var C=this,g=arguments;return new Promise((function(B,Q){var E=I.apply(C,g);function R(I){A(E,B,Q,R,U,"next",I)}function U(I){A(E,B,Q,R,U,"throw",I)}R(void 0)}))}}function C(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}function g(A){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},g(A)}function B(A){var I=function(A,I){if("object"!=g(A)||!A)return A;var C=A[Symbol.toPrimitive];if(void 0!==C){var B=C.call(A,I||"default");if("object"!=g(B))return B;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===I?String:Number)(A)}(A,"string");return"symbol"==g(I)?I:String(I)}function Q(A,I){for(var C=0;C<I.length;C++){var g=I[C];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(A,B(g.key),g)}}function E(A,I,C){return I&&Q(A.prototype,I),C&&Q(A,C),Object.defineProperty(A,"prototype",{writable:!1}),A}function R(A,I,C){return(I=B(I))in A?Object.defineProperty(A,I,{value:C,enumerable:!0,configurable:!0,writable:!0}):A[I]=C,A}function U(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var w={exports:{}},F={exports:{}};!function(A){function I(C){return A.exports=I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},A.exports.__esModule=!0,A.exports.default=A.exports,I(C)}A.exports=I,A.exports.__esModule=!0,A.exports.default=A.exports}(F);var G=F.exports;!function(A){var I=G.default;function C(){A.exports=C=function(){return B},A.exports.__esModule=!0,A.exports.default=A.exports;var g,B={},Q=Object.prototype,E=Q.hasOwnProperty,R=Object.defineProperty||function(A,I,C){A[I]=C.value},U="function"==typeof Symbol?Symbol:{},w=U.iterator||"@@iterator",F=U.asyncIterator||"@@asyncIterator",G=U.toStringTag||"@@toStringTag";function i(A,I,C){return Object.defineProperty(A,I,{value:C,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{i({},"")}catch(g){i=function(A,I,C){return A[I]=C}}function M(A,I,C,g){var B=I&&I.prototype instanceof c?I:c,Q=Object.create(B.prototype),E=new V(g||[]);return R(Q,"_invoke",{value:L(A,C,E)}),Q}function y(A,I,C){try{return{type:"normal",arg:A.call(I,C)}}catch(A){return{type:"throw",arg:A}}}B.wrap=M;var o="suspendedStart",D="suspendedYield",J="executing",h="completed",l={};function c(){}function s(){}function Y(){}var N={};i(N,w,(function(){return this}));var Z=Object.getPrototypeOf,j=Z&&Z(Z(b([])));j&&j!==Q&&E.call(j,w)&&(N=j);var K=Y.prototype=c.prototype=Object.create(N);function S(A){["next","throw","return"].forEach((function(I){i(A,I,(function(A){return this._invoke(I,A)}))}))}function k(A,C){function g(B,Q,R,U){var w=y(A[B],A,Q);if("throw"!==w.type){var F=w.arg,G=F.value;return G&&"object"==I(G)&&E.call(G,"__await")?C.resolve(G.__await).then((function(A){g("next",A,R,U)}),(function(A){g("throw",A,R,U)})):C.resolve(G).then((function(A){F.value=A,R(F)}),(function(A){return g("throw",A,R,U)}))}U(w.arg)}var B;R(this,"_invoke",{value:function(A,I){function Q(){return new C((function(C,B){g(A,I,C,B)}))}return B=B?B.then(Q,Q):Q()}})}function L(A,I,C){var B=o;return function(Q,E){if(B===J)throw new Error("Generator is already running");if(B===h){if("throw"===Q)throw E;return{value:g,done:!0}}for(C.method=Q,C.arg=E;;){var R=C.delegate;if(R){var U=a(R,C);if(U){if(U===l)continue;return U}}if("next"===C.method)C.sent=C._sent=C.arg;else if("throw"===C.method){if(B===o)throw B=h,C.arg;C.dispatchException(C.arg)}else"return"===C.method&&C.abrupt("return",C.arg);B=J;var w=y(A,I,C);if("normal"===w.type){if(B=C.done?h:D,w.arg===l)continue;return{value:w.arg,done:C.done}}"throw"===w.type&&(B=h,C.method="throw",C.arg=w.arg)}}}function a(A,I){var C=I.method,B=A.iterator[C];if(B===g)return I.delegate=null,"throw"===C&&A.iterator.return&&(I.method="return",I.arg=g,a(A,I),"throw"===I.method)||"return"!==C&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+C+"' method")),l;var Q=y(B,A.iterator,I.arg);if("throw"===Q.type)return I.method="throw",I.arg=Q.arg,I.delegate=null,l;var E=Q.arg;return E?E.done?(I[A.resultName]=E.value,I.next=A.nextLoc,"return"!==I.method&&(I.method="next",I.arg=g),I.delegate=null,l):E:(I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,l)}function d(A){var I={tryLoc:A[0]};1 in A&&(I.catchLoc=A[1]),2 in A&&(I.finallyLoc=A[2],I.afterLoc=A[3]),this.tryEntries.push(I)}function H(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function V(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(d,this),this.reset(!0)}function b(A){if(A||""===A){var C=A[w];if(C)return C.call(A);if("function"==typeof A.next)return A;if(!isNaN(A.length)){var B=-1,Q=function I(){for(;++B<A.length;)if(E.call(A,B))return I.value=A[B],I.done=!1,I;return I.value=g,I.done=!0,I};return Q.next=Q}}throw new TypeError(I(A)+" is not iterable")}return s.prototype=Y,R(K,"constructor",{value:Y,configurable:!0}),R(Y,"constructor",{value:s,configurable:!0}),s.displayName=i(Y,G,"GeneratorFunction"),B.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===s||"GeneratorFunction"===(I.displayName||I.name))},B.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,Y):(A.__proto__=Y,i(A,G,"GeneratorFunction")),A.prototype=Object.create(K),A},B.awrap=function(A){return{__await:A}},S(k.prototype),i(k.prototype,F,(function(){return this})),B.AsyncIterator=k,B.async=function(A,I,C,g,Q){void 0===Q&&(Q=Promise);var E=new k(M(A,I,C,g),Q);return B.isGeneratorFunction(I)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},S(K),i(K,G,"Generator"),i(K,w,(function(){return this})),i(K,"toString",(function(){return"[object Generator]"})),B.keys=function(A){var I=Object(A),C=[];for(var g in I)C.push(g);return C.reverse(),function A(){for(;C.length;){var g=C.pop();if(g in I)return A.value=g,A.done=!1,A}return A.done=!0,A}},B.values=b,V.prototype={constructor:V,reset:function(A){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(H),!A)for(var I in this)"t"===I.charAt(0)&&E.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=g)},stop:function(){this.done=!0;var A=this.tryEntries[0].completion;if("throw"===A.type)throw A.arg;return this.rval},dispatchException:function(A){if(this.done)throw A;var I=this;function C(C,B){return R.type="throw",R.arg=A,I.next=C,B&&(I.method="next",I.arg=g),!!B}for(var B=this.tryEntries.length-1;B>=0;--B){var Q=this.tryEntries[B],R=Q.completion;if("root"===Q.tryLoc)return C("end");if(Q.tryLoc<=this.prev){var U=E.call(Q,"catchLoc"),w=E.call(Q,"finallyLoc");if(U&&w){if(this.prev<Q.catchLoc)return C(Q.catchLoc,!0);if(this.prev<Q.finallyLoc)return C(Q.finallyLoc)}else if(U){if(this.prev<Q.catchLoc)return C(Q.catchLoc,!0)}else{if(!w)throw new Error("try statement without catch or finally");if(this.prev<Q.finallyLoc)return C(Q.finallyLoc)}}}},abrupt:function(A,I){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.tryLoc<=this.prev&&E.call(g,"finallyLoc")&&this.prev<g.finallyLoc){var B=g;break}}B&&("break"===A||"continue"===A)&&B.tryLoc<=I&&I<=B.finallyLoc&&(B=null);var Q=B?B.completion:{};return Q.type=A,Q.arg=I,B?(this.method="next",this.next=B.finallyLoc,l):this.complete(Q)},complete:function(A,I){if("throw"===A.type)throw A.arg;return"break"===A.type||"continue"===A.type?this.next=A.arg:"return"===A.type?(this.rval=this.arg=A.arg,this.method="return",this.next="end"):"normal"===A.type&&I&&(this.next=I),l},finish:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var C=this.tryEntries[I];if(C.finallyLoc===A)return this.complete(C.completion,C.afterLoc),H(C),l}},catch:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var C=this.tryEntries[I];if(C.tryLoc===A){var g=C.completion;if("throw"===g.type){var B=g.arg;H(C)}return B}}throw new Error("illegal catch attempt")},delegateYield:function(A,I,C){return this.delegate={iterator:b(A),resultName:I,nextLoc:C},"next"===this.method&&(this.arg=g),l}},B}A.exports=C,A.exports.__esModule=!0,A.exports.default=A.exports}(w);var i=(0,w.exports)(),M=i;try{regeneratorRuntime=i}catch(A){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}var y=U(M);const o=new Error("request for lock canceled");var D=function(A,I,C,g){return new(C||(C=Promise))((function(B,Q){function E(A){try{U(g.next(A))}catch(A){Q(A)}}function R(A){try{U(g.throw(A))}catch(A){Q(A)}}function U(A){var I;A.done?B(A.value):(I=A.value,I instanceof C?I:new C((function(A){A(I)}))).then(E,R)}U((g=g.apply(A,I||[])).next())}))};class J{constructor(A,I=o){this._value=A,this._cancelError=I,this._weightedQueues=[],this._weightedWaiters=[]}acquire(A=1){if(A<=0)throw new Error(`invalid weight ${A}: must be positive`);return new Promise(((I,C)=>{this._weightedQueues[A-1]||(this._weightedQueues[A-1]=[]),this._weightedQueues[A-1].push({resolve:I,reject:C}),this._dispatch()}))}runExclusive(A,I=1){return D(this,void 0,void 0,(function*(){const[C,g]=yield this.acquire(I);try{return yield A(C)}finally{g()}}))}waitForUnlock(A=1){if(A<=0)throw new Error(`invalid weight ${A}: must be positive`);return new Promise((I=>{this._weightedWaiters[A-1]||(this._weightedWaiters[A-1]=[]),this._weightedWaiters[A-1].push(I),this._dispatch()}))}isLocked(){return this._value<=0}getValue(){return this._value}setValue(A){this._value=A,this._dispatch()}release(A=1){if(A<=0)throw new Error(`invalid weight ${A}: must be positive`);this._value+=A,this._dispatch()}cancel(){this._weightedQueues.forEach((A=>A.forEach((A=>A.reject(this._cancelError))))),this._weightedQueues=[]}_dispatch(){var A;for(let I=this._value;I>0;I--){const C=null===(A=this._weightedQueues[I-1])||void 0===A?void 0:A.shift();if(!C)continue;const g=this._value,B=I;this._value-=I,I=this._value+1,C.resolve([g,this._newReleaser(B)])}this._drainUnlockWaiters()}_newReleaser(A){let I=!1;return()=>{I||(I=!0,this.release(A))}}_drainUnlockWaiters(){for(let A=this._value;A>0;A--)this._weightedWaiters[A-1]&&(this._weightedWaiters[A-1].forEach((A=>A())),this._weightedWaiters[A-1]=[])}}var h=function(A,I,C,g){return new(C||(C=Promise))((function(B,Q){function E(A){try{U(g.next(A))}catch(A){Q(A)}}function R(A){try{U(g.throw(A))}catch(A){Q(A)}}function U(A){var I;A.done?B(A.value):(I=A.value,I instanceof C?I:new C((function(A){A(I)}))).then(E,R)}U((g=g.apply(A,I||[])).next())}))};class l{constructor(A){this._semaphore=new J(1,A)}acquire(){return h(this,void 0,void 0,(function*(){const[,A]=yield this._semaphore.acquire();return A}))}runExclusive(A){return this._semaphore.runExclusive((()=>A()))}isLocked(){return this._semaphore.isLocked()}waitForUnlock(){return this._semaphore.waitForUnlock()}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}const c=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]));function s(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var Y={exports:{}},N={exports:{}};!function(A){function I(C){return A.exports=I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},A.exports.__esModule=!0,A.exports.default=A.exports,I(C)}A.exports=I,A.exports.__esModule=!0,A.exports.default=A.exports}(N);var Z=N.exports;!function(A){var I=Z.default;function C(){A.exports=C=function(){return B},A.exports.__esModule=!0,A.exports.default=A.exports;var g,B={},Q=Object.prototype,E=Q.hasOwnProperty,R=Object.defineProperty||function(A,I,C){A[I]=C.value},U="function"==typeof Symbol?Symbol:{},w=U.iterator||"@@iterator",F=U.asyncIterator||"@@asyncIterator",G=U.toStringTag||"@@toStringTag";function i(A,I,C){return Object.defineProperty(A,I,{value:C,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{i({},"")}catch(g){i=function(A,I,C){return A[I]=C}}function M(A,I,C,g){var B=I&&I.prototype instanceof c?I:c,Q=Object.create(B.prototype),E=new V(g||[]);return R(Q,"_invoke",{value:L(A,C,E)}),Q}function y(A,I,C){try{return{type:"normal",arg:A.call(I,C)}}catch(A){return{type:"throw",arg:A}}}B.wrap=M;var o="suspendedStart",D="suspendedYield",J="executing",h="completed",l={};function c(){}function s(){}function Y(){}var N={};i(N,w,(function(){return this}));var Z=Object.getPrototypeOf,j=Z&&Z(Z(b([])));j&&j!==Q&&E.call(j,w)&&(N=j);var K=Y.prototype=c.prototype=Object.create(N);function S(A){["next","throw","return"].forEach((function(I){i(A,I,(function(A){return this._invoke(I,A)}))}))}function k(A,C){function g(B,Q,R,U){var w=y(A[B],A,Q);if("throw"!==w.type){var F=w.arg,G=F.value;return G&&"object"==I(G)&&E.call(G,"__await")?C.resolve(G.__await).then((function(A){g("next",A,R,U)}),(function(A){g("throw",A,R,U)})):C.resolve(G).then((function(A){F.value=A,R(F)}),(function(A){return g("throw",A,R,U)}))}U(w.arg)}var B;R(this,"_invoke",{value:function(A,I){function Q(){return new C((function(C,B){g(A,I,C,B)}))}return B=B?B.then(Q,Q):Q()}})}function L(A,I,C){var B=o;return function(Q,E){if(B===J)throw new Error("Generator is already running");if(B===h){if("throw"===Q)throw E;return{value:g,done:!0}}for(C.method=Q,C.arg=E;;){var R=C.delegate;if(R){var U=a(R,C);if(U){if(U===l)continue;return U}}if("next"===C.method)C.sent=C._sent=C.arg;else if("throw"===C.method){if(B===o)throw B=h,C.arg;C.dispatchException(C.arg)}else"return"===C.method&&C.abrupt("return",C.arg);B=J;var w=y(A,I,C);if("normal"===w.type){if(B=C.done?h:D,w.arg===l)continue;return{value:w.arg,done:C.done}}"throw"===w.type&&(B=h,C.method="throw",C.arg=w.arg)}}}function a(A,I){var C=I.method,B=A.iterator[C];if(B===g)return I.delegate=null,"throw"===C&&A.iterator.return&&(I.method="return",I.arg=g,a(A,I),"throw"===I.method)||"return"!==C&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+C+"' method")),l;var Q=y(B,A.iterator,I.arg);if("throw"===Q.type)return I.method="throw",I.arg=Q.arg,I.delegate=null,l;var E=Q.arg;return E?E.done?(I[A.resultName]=E.value,I.next=A.nextLoc,"return"!==I.method&&(I.method="next",I.arg=g),I.delegate=null,l):E:(I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,l)}function d(A){var I={tryLoc:A[0]};1 in A&&(I.catchLoc=A[1]),2 in A&&(I.finallyLoc=A[2],I.afterLoc=A[3]),this.tryEntries.push(I)}function H(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function V(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(d,this),this.reset(!0)}function b(A){if(A||""===A){var C=A[w];if(C)return C.call(A);if("function"==typeof A.next)return A;if(!isNaN(A.length)){var B=-1,Q=function I(){for(;++B<A.length;)if(E.call(A,B))return I.value=A[B],I.done=!1,I;return I.value=g,I.done=!0,I};return Q.next=Q}}throw new TypeError(I(A)+" is not iterable")}return s.prototype=Y,R(K,"constructor",{value:Y,configurable:!0}),R(Y,"constructor",{value:s,configurable:!0}),s.displayName=i(Y,G,"GeneratorFunction"),B.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===s||"GeneratorFunction"===(I.displayName||I.name))},B.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,Y):(A.__proto__=Y,i(A,G,"GeneratorFunction")),A.prototype=Object.create(K),A},B.awrap=function(A){return{__await:A}},S(k.prototype),i(k.prototype,F,(function(){return this})),B.AsyncIterator=k,B.async=function(A,I,C,g,Q){void 0===Q&&(Q=Promise);var E=new k(M(A,I,C,g),Q);return B.isGeneratorFunction(I)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},S(K),i(K,G,"Generator"),i(K,w,(function(){return this})),i(K,"toString",(function(){return"[object Generator]"})),B.keys=function(A){var I=Object(A),C=[];for(var g in I)C.push(g);return C.reverse(),function A(){for(;C.length;){var g=C.pop();if(g in I)return A.value=g,A.done=!1,A}return A.done=!0,A}},B.values=b,V.prototype={constructor:V,reset:function(A){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(H),!A)for(var I in this)"t"===I.charAt(0)&&E.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=g)},stop:function(){this.done=!0;var A=this.tryEntries[0].completion;if("throw"===A.type)throw A.arg;return this.rval},dispatchException:function(A){if(this.done)throw A;var I=this;function C(C,B){return R.type="throw",R.arg=A,I.next=C,B&&(I.method="next",I.arg=g),!!B}for(var B=this.tryEntries.length-1;B>=0;--B){var Q=this.tryEntries[B],R=Q.completion;if("root"===Q.tryLoc)return C("end");if(Q.tryLoc<=this.prev){var U=E.call(Q,"catchLoc"),w=E.call(Q,"finallyLoc");if(U&&w){if(this.prev<Q.catchLoc)return C(Q.catchLoc,!0);if(this.prev<Q.finallyLoc)return C(Q.finallyLoc)}else if(U){if(this.prev<Q.catchLoc)return C(Q.catchLoc,!0)}else{if(!w)throw new Error("try statement without catch or finally");if(this.prev<Q.finallyLoc)return C(Q.finallyLoc)}}}},abrupt:function(A,I){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.tryLoc<=this.prev&&E.call(g,"finallyLoc")&&this.prev<g.finallyLoc){var B=g;break}}B&&("break"===A||"continue"===A)&&B.tryLoc<=I&&I<=B.finallyLoc&&(B=null);var Q=B?B.completion:{};return Q.type=A,Q.arg=I,B?(this.method="next",this.next=B.finallyLoc,l):this.complete(Q)},complete:function(A,I){if("throw"===A.type)throw A.arg;return"break"===A.type||"continue"===A.type?this.next=A.arg:"return"===A.type?(this.rval=this.arg=A.arg,this.method="return",this.next="end"):"normal"===A.type&&I&&(this.next=I),l},finish:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var C=this.tryEntries[I];if(C.finallyLoc===A)return this.complete(C.completion,C.afterLoc),H(C),l}},catch:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var C=this.tryEntries[I];if(C.tryLoc===A){var g=C.completion;if("throw"===g.type){var B=g.arg;H(C)}return B}}throw new Error("illegal catch attempt")},delegateYield:function(A,I,C){return this.delegate={iterator:b(A),resultName:I,nextLoc:C},"next"===this.method&&(this.arg=g),l}},B}A.exports=C,A.exports.__esModule=!0,A.exports.default=A.exports}(Y);var j=(0,Y.exports)(),K=j;try{regeneratorRuntime=j}catch(A){"object"==typeof globalThis?globalThis.regeneratorRuntime=j:Function("r","regeneratorRuntime = r")(j)}var S=s(K);function k(A,I,C,g){return new(C||(C=Promise))((function(B,Q){function E(A){try{U(g.next(A))}catch(A){Q(A)}}function R(A){try{U(g.throw(A))}catch(A){Q(A)}}function U(A){var I;A.done?B(A.value):(I=A.value,I instanceof C?I:new C((function(A){A(I)}))).then(E,R)}U((g=g.apply(A,I||[])).next())}))}function L(A,I){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(A,I){return A.__proto__=I,A},L(A,I)}function a(A,I){if("function"!=typeof I&&null!==I)throw new TypeError("Super expression must either be null or a function");A.prototype=Object.create(I&&I.prototype,{constructor:{value:A,writable:!0,configurable:!0}}),Object.defineProperty(A,"prototype",{writable:!1}),I&&L(A,I)}function d(A){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},d(A)}function H(A,I){if(I&&("object"===d(I)||"function"==typeof I))return I;if(void 0!==I)throw new TypeError("Derived constructors may only return object or undefined");return function(A){if(void 0===A)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A}(A)}function V(A){return V=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(A){return A.__proto__||Object.getPrototypeOf(A)},V(A)}function b(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}function X(A){var I=function(A,I){if("object"!==d(A)||null===A)return A;var C=A[Symbol.toPrimitive];if(void 0!==C){var g=C.call(A,I||"default");if("object"!==d(g))return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===I?String:Number)(A)}(A,"string");return"symbol"===d(I)?I:String(I)}function n(A,I){for(var C=0;C<I.length;C++){var g=I[C];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(A,X(g.key),g)}}function W(A,I,C){return I&&n(A.prototype,I),C&&n(A,C),Object.defineProperty(A,"prototype",{writable:!1}),A}var m=function(){function A(){b(this,A),this._path=""}return W(A,[{key:"meta",get:function(){if(void 0!==this._meta)return Object.assign({version:0},this._meta)}},{key:"pageSize",get:function(){}}],[{key:"getPtr",value:function(I){if(A._filePtrs.has(I))return A._filePtrs.get(I);throw new Error("File instance not found.")}},{key:"setPtr",value:function(I,C){A._filePtrs.set(I,C)}},{key:"removePtr",value:function(I){A._filePtrs.delete(I)}}]),A}();function t(A){var I=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(A){return!1}}();return function(){var C,g=V(A);if(I){var B=V(this).constructor;C=Reflect.construct(g,arguments,B)}else C=g.apply(this,arguments);return H(this,C)}}m._filePtrs=new Map;var T="pv_file";var p=function(){function A(){b(this,A),this._pos=0,this._data=new Uint8Array}return W(A,[{key:"get",value:function(A){if(!(this._pos>=this._data.length)){var I=this._data.slice(this._pos,this._pos+A);return this._pos+=A,I}}},{key:"set",value:function(A,I){this._pos=A,this._data=I}},{key:"clear",value:function(){this._pos=0,this._data=new Uint8Array}}]),A}(),u=function(A){a(C,m);var I=t(C);function C(A,g,B,Q){var E;return b(this,C),(E=I.call(this))._pageSize=524288,E._pagePtr=0,E._pageOffset=0,E._path=A,E._meta=g,E._db=B,E._mode=Q,E._cache=new p,E}return W(C,[{key:"pageSize",get:function(){return this._pageSize}},{key:"close",value:function(){return k(this,void 0,void 0,S.mark((function A(){return S.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:this._db.close();case 1:case"end":return A.stop()}}),A,this)})))}},{key:"read",value:function(A,I){return k(this,void 0,void 0,S.mark((function g(){var B=this;return S.wrap((function(g){for(;;)switch(g.prev=g.next){case 0:return g.abrupt("return",new Promise((function(g,Q){if(B.exists()){if(B._isEOF){var E=new Error("EOF");return E.name="EndOfFile",void Q(E)}var R=0,U=Math.min(A*I,B._meta.size),w=U-U%A,F=new Uint8Array(w),G=B._cache.get(w);if(G){if(R+=G.length,B._pageOffset+=G.length,B._pageOffset===B._pageSize&&(B._pagePtr+=1,B._pageOffset=0),w===R)return void g(G);F.set(G)}var i=IDBKeyRange.bound("".concat(B._path,"-").concat(C.createPage(B._pagePtr)),"".concat(B._path,"-").concat(C.createPage(B._pagePtr+Math.floor(w/B._pageSize)+1))),M=B._store,y=M.openCursor(i);y.onsuccess=function(){var A,I,C=y.result;if(C&&!B._isEOF){var g=Math.min(w-R,C.value.length-B._pageOffset);F.set(C.value.slice(B._pageOffset,B._pageOffset+g),R),R+=g,B._pageOffset+=g,B._pageOffset===B._pageSize&&(B._pagePtr+=1,B._pageOffset=0),R<w?C.continue():(0!==B._pageOffset?B._cache.set(B._pageOffset,C.value):B._cache.clear(),(null===(A=M.transaction)||void 0===A?void 0:A.commit)&&(null===(I=M.transaction)||void 0===I||I.commit()))}},M.transaction.onerror=function(){Q(M.transaction.error)},M.transaction.oncomplete=function(){g(F.slice(0,R))}}else Q(new Error("'".concat(B._path,"' doesn't exist.")))})));case 1:case"end":return g.stop()}}),g)})))}},{key:"write",value:function(A){var I=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return k(this,void 0,void 0,S.mark((function g(){var B=this;return S.wrap((function(g){for(;;)switch(g.prev=g.next){case 0:return g.abrupt("return",new Promise((function(g,Q){return k(B,void 0,void 0,S.mark((function B(){var E,R,U,w,F,G,i,M,y,o,D,J=this;return S.wrap((function(B){for(;;)switch(B.prev=B.next){case 0:if("readonly"!==this._mode){B.next=3;break}return Q(new Error("Instance is readonly mode only.")),B.abrupt("return");case 3:if(!("number"!=typeof I&&I<=0)){B.next=6;break}return Q(new Error("Version should be a positive number")),B.abrupt("return");case 6:return U=this._store,w=function(){return new Promise((function(A){var I=U.get("".concat(J._path,"-").concat(C.createPage(J._pagePtr)));I.onsuccess=function(){void 0!==I.result?A(I.result.slice(0,J._pageOffset)):A(new Uint8Array(0))}}))},B.next=10,w();case 10:for(F=B.sent,(G=new Uint8Array(F.length+A.length)).set(F),G.set(A,F.length),i=this._pagePtr*this._pageSize+G.length,M={size:i,numPages:Math.ceil(i/this._pageSize),version:I,pageSize:this._pageSize},U.put(M,this._path),y=Math.ceil(G.length/this._pageSize),o=0;o<y;o++)U.put(G.slice(o*this._pageSize,(o+1)*this._pageSize),"".concat(this._path,"-").concat(C.createPage(this._pagePtr+o)));this.exists()&&M.numPages<this._meta.numPages&&(D=IDBKeyRange.bound("".concat(this._path,"-").concat(C.createPage(M.numPages)),"".concat(this._path,"-").concat(C.createPage(this._meta.numPages)),!0),U.delete(D)),(null===(E=U.transaction)||void 0===E?void 0:E.commit)&&(null===(R=U.transaction)||void 0===R||R.commit()),U.transaction.onerror=function(){Q(U.transaction.error)},U.transaction.oncomplete=function(){J._meta=M,J.seek(0,2),g()};case 23:case"end":return B.stop()}}),B,this)})))})));case 1:case"end":return g.stop()}}),g)})))}},{key:"seek",value:function(A,I){if(!this.exists()&&"readonly"===this._mode)throw new Error("'".concat(this._path,"' doesn't exist."));if(!this.exists())throw new Error("'".concat(this._path,"' doesn't exist."));if(A<0){var C=new Error("EOF");throw C.name="EndOfFile",C}var g;if(0===I)g=Math.min(A,this._meta.size);else if(1===I){var B=this._pageSize*this._pagePtr+this._pageOffset;g=Math.min(B+A,this._meta.size)}else{if(2!==I)throw new Error("Invalid operation: ".concat(I,"."));g=Math.min(this._meta.size+A,this._meta.size)}this._pageOffset=g%this._pageSize,this._pagePtr=Math.floor(g/this._pageSize),this._cache.clear()}},{key:"tell",value:function(){return this.exists()?this._pagePtr*this._pageSize+this._pageOffset:-1}},{key:"remove",value:function(){return k(this,void 0,void 0,S.mark((function A(){var I=this;return S.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.abrupt("return",new Promise((function(A,g){return k(I,void 0,void 0,S.mark((function I(){var B,Q,E,R,U=this;return S.wrap((function(I){for(;;)switch(I.prev=I.next){case 0:if(this.exists()){I.next=3;break}return g(new Error("ENOENT")),I.abrupt("return");case 3:B=this._meta.numPages,Q=IDBKeyRange.bound(this._path,"".concat(this._path,"-").concat(C.createPage(B))),E=this._store,(R=E.delete(Q)).onerror=function(){g(R.error)},R.onsuccess=function(){U._meta=void 0,U._pageOffset=0,U._pagePtr=0,A()};case 9:case"end":return I.stop()}}),I,this)})))})));case 1:case"end":return A.stop()}}),A)})))}},{key:"exists",value:function(){return void 0!==this._meta}},{key:"_isEOF",get:function(){return this._pagePtr>=this._meta.numPages-1&&this._pageOffset>=this._meta.size%this._pageSize}},{key:"_store",get:function(){return this._db.transaction(T,this._mode).objectStore(T)}}],[{key:"open",value:function(A,I){var g=this;if(!self.indexedDB){var B=new Error("IndexedDB is not supported");throw B.name="IndexedDBNotSupported",B}return new Promise((function(B,Q){return k(g,void 0,void 0,S.mark((function g(){var E,R,U;return S.wrap((function(g){for(;;)switch(g.prev=g.next){case 0:return g.prev=0,g.next=3,new Promise((function(A,I){var C=self.indexedDB.open("pv_db",3);C.onerror=function(){I(C.error)},C.onsuccess=function(){A(C.result)},C.onupgradeneeded=function(){C.result.objectStoreNames.contains(T)||C.result.createObjectStore(T)}}));case 3:E=g.sent,(R=E.transaction(T,"readwrite").objectStore(T).get(A)).onerror=function(){Q(R.error)},R.onsuccess=function(){var g=R.result,U=I.includes("r")?"readonly":"readwrite";if(void 0===g&&"readonly"===U){var w=new Error("'".concat(A,"' doesn't exist."));return w.name="FileNotExists",void Q(w)}var F=new C(A,g,E,U);I.includes("a")&&F.seek(0,2),B(F)},g.next=12;break;case 9:g.prev=9,g.t0=g.catch(0),"InvalidStateError"===g.t0.name?((U=new Error("IndexedDB is not supported")).name="IndexedDBNotSupported",Q(U)):Q(g.t0);case 12:case"end":return g.stop()}}),g,null,[[0,9]])})))}))}},{key:"createPage",value:function(A){return("00000"+A).slice(-6)}}]),C}();function e(A){var I=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(A){return!1}}();return function(){var C,g=V(A);if(I){var B=V(this).constructor;C=Reflect.construct(g,arguments,B)}else C=g.apply(this,arguments);return H(this,C)}}var f=function(A){a(C,m);var I=e(C);function C(A,g,B,Q){var E;return b(this,C),(E=I.call(this))._pos=0,E._path=A,E._meta=g,E._mode=Q,E}return W(C,[{key:"close",value:function(){}},{key:"read",value:function(A,I){if(!this.exists())throw new Error("'".concat(this._path,"' doesn't exist."));if(this._isEOF){var C=new Error("EOF");throw C.name="EndOfFile",C}var g=Math.min(A*I,this._file.length-this._pos),B=g-g%A,Q=new Uint8Array(B);return Q.set(this._file.slice(this._pos,this._pos+B),0),this._pos+=B,Q}},{key:"write",value:function(A){var I=new Uint8Array(this._pos+A.length);void 0!==this._file?(I.set(this._file.slice(0,this._pos)),I.set(A,this._pos)):I.set(A),this._file=I,this._pos+=A.length}},{key:"seek",value:function(A,I){if(!this.exists()&&"readonly"===this._mode)throw new Error("'".concat(this._path,"' doesn't exist."));if(!this.exists())throw new Error("'".concat(this._path,"' doesn't exist."));if(A<0){var C=new Error("EOF");throw C.name="EndOfFile",C}var g;if(0===I)g=Math.min(A,this._file.length);else if(1===I)g=Math.min(this._pos+A,this._file.length);else{if(2!==I)throw new Error("Invalid operation: ".concat(I,"."));g=Math.min(this._file.length+A,this._file.length)}this._pos=g}},{key:"tell",value:function(){return this.exists()?this._pos:-1}},{key:"remove",value:function(){return k(this,void 0,void 0,S.mark((function A(){return S.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:if(this.exists()){A.next=2;break}throw new Error("ENOENT");case 2:C._memFiles.delete(this._path),this._pos=0;case 4:case"end":return A.stop()}}),A,this)})))}},{key:"exists",value:function(){return void 0!==this._file}},{key:"_isEOF",get:function(){return this._pos>=this._file.length}},{key:"_file",get:function(){return C._memFiles.get(this._path)},set:function(A){C._memFiles.set(this._path,A)}}],[{key:"open",value:function(A,I){var g=C._memFiles.get(A),B=I.includes("r")?"readonly":"readwrite";if(void 0===g&&"readonly"===B){var Q=new Error("'".concat(A,"' doesn't exist."));throw Q.name="FileNotExists",Q}var E=new C(A,void 0,void 0,B);return I.includes("a")&&E.seek(0,2),E}}]),C}();function O(A,I){for(var C=I;0!==A[C];)C++;return new TextDecoder("utf-8").decode(A.slice(I,C))}function r(A){for(var I=atob(A),C=new Uint8Array(I.length),g=0;g<I.length;g++)C[g]=I.charCodeAt(g);return C}function z(A){if("string"!=typeof A)return!1;var I=A.trim();if(""===I)return!1;try{return btoa(atob(I))===I}catch(A){return!1}}function x(A,I){return k(this,void 0,void 0,S.mark((function C(){var g;return S.wrap((function(C){for(;;)switch(C.prev=C.next){case 0:return C.prev=0,C.next=3,u.open(A,I);case 3:return C.abrupt("return",C.sent);case 6:if(C.prev=6,C.t0=C.catch(0),"IndexedDBNotSupported"===C.t0.name?console.warn("IndexedDB is not supported. Fallback to in-memory storage."):"FileNotExists"!==C.t0.name&&console.warn("Unable to access IndexedDB (".concat(C.t0.toString(),"). Fallback to in-memory storage.")),!("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope)){C.next=16;break}if("FileNotExists"!==C.t0.name){C.next=12;break}throw C.t0;case 12:throw console.error("In-memory storage cannot be used inside a worker."),(g=new Error("Failed to start PvFile: ".concat(C.t0.toString()))).name="PvFileNotSupported",g;case 16:return C.abrupt("return",f.open(A,I));case 17:case"end":return C.stop()}}),C,null,[[0,6]])})))}function v(A,I,C,g){return k(this,void 0,void 0,S.mark((function B(){var Q;return S.wrap((function(B){for(;;)switch(B.prev=B.next){case 0:return B.next=2,x(A,"w");case 2:if(Q=B.sent,!(C||void 0===Q.meta||g>Q.meta.version||Q.meta.pageSize!==Q.pageSize)){B.next=6;break}return B.next=6,Q.write(r(I),g);case 6:case"end":return B.stop()}}),B)})))}f._memFiles=new Map;var P=5e3,q=2;function _(A,I,C,g,B){return k(this,void 0,void 0,S.mark((function Q(){var E,R,U,w,F,G,i,M;return S.wrap((function(Q){for(;;)switch(Q.prev=Q.next){case 0:return Q.next=2,x(A,"w");case 2:if(E=Q.sent,!(C||void 0===E.meta||g>E.meta.version||E.meta.pageSize!==E.pageSize)){Q.next=43;break}if(!(B<0)){Q.next=6;break}throw Error("numFetchRetries must be a positive number");case 6:R=q,U=function(A){return new Promise((function(I){setTimeout(I,A)}))},w=B+1,F=null;case 10:if(!(w>0)){Q.next=38;break}return F=null,Q.prev=12,Q.next=15,fetch(I,{cache:"no-cache"});case 15:if(!(G=Q.sent).ok){Q.next=23;break}return Q.next=19,G.arrayBuffer();case 19:return i=Q.sent,Q.next=22,E.write(new Uint8Array(i),g);case 22:return Q.abrupt("return");case 23:return Q.next=25,G.text();case 25:M=Q.sent,F=new Error("Error response returned while fetching model from '".concat(I,"': ").concat(M)),Q.next=32;break;case 29:Q.prev=29,Q.t0=Q.catch(12),F=new Error("Failed to fetch model from '".concat(I,"': ").concat(Q.t0.message));case 32:return w--,Q.next=35,U(R);case 35:R=Math.min(P,R*q),Q.next=10;break;case 38:if(null===F){Q.next=42;break}throw F;case 42:throw new Error("Unexpected error encountered while fetching model from '".concat(I,"'"));case 43:case"end":return Q.stop()}}),Q,null,[[12,29]])})))}function $(A){return k(this,void 0,void 0,S.mark((function I(){var C,g,B,Q,E,R,U,w,F;return S.wrap((function(I){for(;;)switch(I.prev=I.next){case 0:if(null!=A){I.next=2;break}throw new Error("The model is undefined / empty");case 2:if(C=A.base64,g=A.publicPath,B=A.customWritePath,Q=A.forceWrite,E=void 0!==Q&&Q,R=A.version,U=void 0===R?1:R,w=A.numFetchRetries,F=void 0===w?0:w,null!=B){I.next=5;break}throw new Error("The customWritePath of the provided model is undefined / empty");case 5:if(null==C){I.next=10;break}return I.next=8,v(B,C,E,U);case 8:case 13:I.next=16;break;case 10:if(null==g){I.next=15;break}return I.next=13,_(B,g,E,U,F);case 15:throw new Error("The provided model doesn't contain a valid publicPath or base64 value");case 16:return I.abrupt("return",B);case 17:case"end":return I.stop()}}),I)})))}function AA(A,I){(null==I||I>A.length)&&(I=A.length);for(var C=0,g=new Array(I);C<I;C++)g[C]=A[C];return g}function IA(A,I){if(A){if("string"==typeof A)return AA(A,I);var C=Object.prototype.toString.call(A).slice(8,-1);return"Object"===C&&A.constructor&&(C=A.constructor.name),"Map"===C||"Set"===C?Array.from(A):"Arguments"===C||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?AA(A,I):void 0}}function CA(A,I){return function(A){if(Array.isArray(A))return A}(A)||function(A,I){var C=null==A?null:"undefined"!=typeof Symbol&&A[Symbol.iterator]||A["@@iterator"];if(null!=C){var g,B,Q,E,R=[],U=!0,w=!1;try{if(Q=(C=C.call(A)).next,0===I){if(Object(C)!==C)return;U=!1}else for(;!(U=(g=Q.call(C)).done)&&(R.push(g.value),R.length!==I);U=!0);}catch(A){w=!0,B=A}finally{try{if(!U&&null!=C.return&&(E=C.return(),Object(E)!==E))return}finally{if(w)throw B}}return R}}(A,I)||IA(A,I)||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.")}()}function gA(A){return function(A){if(Array.isArray(A))return AA(A)}(A)||function(A){if("undefined"!=typeof Symbol&&null!=A[Symbol.iterator]||null!=A["@@iterator"])return Array.from(A)}(A)||IA(A)||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.")}()}var BA,QA,EA,RA=(QA="undefined"!=typeof document?null===(BA=document.currentScript)||void 0===BA?void 0:BA.src:void 0,function(){var A,B,Q=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},R=new Promise((function(I,C){A=I,B=C})),U="object"==("undefined"==typeof window?"undefined":g(window)),w="function"==typeof importScripts;function F(A){return F="function"==typeof Symbol&&"symbol"==g(Symbol.iterator)?function(A){return g(A)}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":g(A)},F(A)}function G(A){var I=function(A,I){if("object"!=F(A)||!A)return A;var C=A[Symbol.toPrimitive];if(void 0!==C){var g=C.call(A,I||"default");if("object"!=F(g))return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===I?String:Number)(A)}(A,"string");return"symbol"==F(I)?I:I+""}function i(A,I,C){return(I=G(I))in A?Object.defineProperty(A,I,{value:C,enumerable:!0,configurable:!0,writable:!0}):A[I]=C,A}function M(A,I,C,g,B,Q,E){try{var R=A[Q](E),U=R.value}catch(A){return void C(A)}R.done?I(U):Promise.resolve(U).then(g,B)}function o(A){return function(){var I=this,C=arguments;return new Promise((function(g,B){var Q=A.apply(I,C);function E(A){M(Q,g,B,E,R,"next",A)}function R(A){M(Q,g,B,E,R,"throw",A)}E(void 0)}))}}function D(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}"object"==("undefined"==typeof process?"undefined":g(process))&&"object"==g(process.versions)&&process.versions.node;var J={exports:{}},h={exports:{}};!function(A){function I(C){return A.exports=I="function"==typeof Symbol&&"symbol"==g(Symbol.iterator)?function(A){return g(A)}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":g(A)},A.exports.__esModule=!0,A.exports.default=A.exports,I(C)}A.exports=I,A.exports.__esModule=!0,A.exports.default=A.exports}(h);var l=h.exports;D(l),function(A){var I=l.default;function C(){A.exports=C=function(){return B},A.exports.__esModule=!0,A.exports.default=A.exports;var g,B={},Q=Object.prototype,E=Q.hasOwnProperty,R=Object.defineProperty||function(A,I,C){A[I]=C.value},U="function"==typeof Symbol?Symbol:{},w=U.iterator||"@@iterator",F=U.asyncIterator||"@@asyncIterator",G=U.toStringTag||"@@toStringTag";function i(A,I,C){return Object.defineProperty(A,I,{value:C,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{i({},"")}catch(g){i=function(A,I,C){return A[I]=C}}function M(A,I,C,g){var B=I&&I.prototype instanceof c?I:c,Q=Object.create(B.prototype),E=new V(g||[]);return R(Q,"_invoke",{value:L(A,C,E)}),Q}function y(A,I,C){try{return{type:"normal",arg:A.call(I,C)}}catch(A){return{type:"throw",arg:A}}}B.wrap=M;var o="suspendedStart",D="suspendedYield",J="executing",h="completed",l={};function c(){}function s(){}function Y(){}var N={};i(N,w,(function(){return this}));var Z=Object.getPrototypeOf,j=Z&&Z(Z(b([])));j&&j!==Q&&E.call(j,w)&&(N=j);var K=Y.prototype=c.prototype=Object.create(N);function S(A){["next","throw","return"].forEach((function(I){i(A,I,(function(A){return this._invoke(I,A)}))}))}function k(A,C){function g(B,Q,R,U){var w=y(A[B],A,Q);if("throw"!==w.type){var F=w.arg,G=F.value;return G&&"object"==I(G)&&E.call(G,"__await")?C.resolve(G.__await).then((function(A){g("next",A,R,U)}),(function(A){g("throw",A,R,U)})):C.resolve(G).then((function(A){F.value=A,R(F)}),(function(A){return g("throw",A,R,U)}))}U(w.arg)}var B;R(this,"_invoke",{value:function(A,I){function Q(){return new C((function(C,B){g(A,I,C,B)}))}return B=B?B.then(Q,Q):Q()}})}function L(A,I,C){var B=o;return function(Q,E){if(B===J)throw Error("Generator is already running");if(B===h){if("throw"===Q)throw E;return{value:g,done:!0}}for(C.method=Q,C.arg=E;;){var R=C.delegate;if(R){var U=a(R,C);if(U){if(U===l)continue;return U}}if("next"===C.method)C.sent=C._sent=C.arg;else if("throw"===C.method){if(B===o)throw B=h,C.arg;C.dispatchException(C.arg)}else"return"===C.method&&C.abrupt("return",C.arg);B=J;var w=y(A,I,C);if("normal"===w.type){if(B=C.done?h:D,w.arg===l)continue;return{value:w.arg,done:C.done}}"throw"===w.type&&(B=h,C.method="throw",C.arg=w.arg)}}}function a(A,I){var C=I.method,B=A.iterator[C];if(B===g)return I.delegate=null,"throw"===C&&A.iterator.return&&(I.method="return",I.arg=g,a(A,I),"throw"===I.method)||"return"!==C&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+C+"' method")),l;var Q=y(B,A.iterator,I.arg);if("throw"===Q.type)return I.method="throw",I.arg=Q.arg,I.delegate=null,l;var E=Q.arg;return E?E.done?(I[A.resultName]=E.value,I.next=A.nextLoc,"return"!==I.method&&(I.method="next",I.arg=g),I.delegate=null,l):E:(I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,l)}function d(A){var I={tryLoc:A[0]};1 in A&&(I.catchLoc=A[1]),2 in A&&(I.finallyLoc=A[2],I.afterLoc=A[3]),this.tryEntries.push(I)}function H(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function V(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(d,this),this.reset(!0)}function b(A){if(A||""===A){var C=A[w];if(C)return C.call(A);if("function"==typeof A.next)return A;if(!isNaN(A.length)){var B=-1,Q=function I(){for(;++B<A.length;)if(E.call(A,B))return I.value=A[B],I.done=!1,I;return I.value=g,I.done=!0,I};return Q.next=Q}}throw new TypeError(I(A)+" is not iterable")}return s.prototype=Y,R(K,"constructor",{value:Y,configurable:!0}),R(Y,"constructor",{value:s,configurable:!0}),s.displayName=i(Y,G,"GeneratorFunction"),B.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===s||"GeneratorFunction"===(I.displayName||I.name))},B.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,Y):(A.__proto__=Y,i(A,G,"GeneratorFunction")),A.prototype=Object.create(K),A},B.awrap=function(A){return{__await:A}},S(k.prototype),i(k.prototype,F,(function(){return this})),B.AsyncIterator=k,B.async=function(A,I,C,g,Q){void 0===Q&&(Q=Promise);var E=new k(M(A,I,C,g),Q);return B.isGeneratorFunction(I)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},S(K),i(K,G,"Generator"),i(K,w,(function(){return this})),i(K,"toString",(function(){return"[object Generator]"})),B.keys=function(A){var I=Object(A),C=[];for(var g in I)C.push(g);return C.reverse(),function A(){for(;C.length;){var g=C.pop();if(g in I)return A.value=g,A.done=!1,A}return A.done=!0,A}},B.values=b,V.prototype={constructor:V,reset:function(A){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(H),!A)for(var I in this)"t"===I.charAt(0)&&E.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=g)},stop:function(){this.done=!0;var A=this.tryEntries[0].completion;if("throw"===A.type)throw A.arg;return this.rval},dispatchException:function(A){if(this.done)throw A;var I=this;function C(C,B){return R.type="throw",R.arg=A,I.next=C,B&&(I.method="next",I.arg=g),!!B}for(var B=this.tryEntries.length-1;B>=0;--B){var Q=this.tryEntries[B],R=Q.completion;if("root"===Q.tryLoc)return C("end");if(Q.tryLoc<=this.prev){var U=E.call(Q,"catchLoc"),w=E.call(Q,"finallyLoc");if(U&&w){if(this.prev<Q.catchLoc)return C(Q.catchLoc,!0);if(this.prev<Q.finallyLoc)return C(Q.finallyLoc)}else if(U){if(this.prev<Q.catchLoc)return C(Q.catchLoc,!0)}else{if(!w)throw Error("try statement without catch or finally");if(this.prev<Q.finallyLoc)return C(Q.finallyLoc)}}}},abrupt:function(A,I){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.tryLoc<=this.prev&&E.call(g,"finallyLoc")&&this.prev<g.finallyLoc){var B=g;break}}B&&("break"===A||"continue"===A)&&B.tryLoc<=I&&I<=B.finallyLoc&&(B=null);var Q=B?B.completion:{};return Q.type=A,Q.arg=I,B?(this.method="next",this.next=B.finallyLoc,l):this.complete(Q)},complete:function(A,I){if("throw"===A.type)throw A.arg;return"break"===A.type||"continue"===A.type?this.next=A.arg:"return"===A.type?(this.rval=this.arg=A.arg,this.method="return",this.next="end"):"normal"===A.type&&I&&(this.next=I),l},finish:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var C=this.tryEntries[I];if(C.finallyLoc===A)return this.complete(C.completion,C.afterLoc),H(C),l}},catch:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var C=this.tryEntries[I];if(C.tryLoc===A){var g=C.completion;if("throw"===g.type){var B=g.arg;H(C)}return B}}throw Error("illegal catch attempt")},delegateYield:function(A,I,C){return this.delegate={iterator:b(A),resultName:I,nextLoc:C},"next"===this.method&&(this.arg=g),l}},B}A.exports=C,A.exports.__esModule=!0,A.exports.default=A.exports}(J);var c=J.exports;D(c);var s=c(),Y=s;try{regeneratorRuntime=s}catch(A){"object"===("undefined"==typeof globalThis?"undefined":g(globalThis))?globalThis.regeneratorRuntime=s:Function("r","regeneratorRuntime = r")(s)}var N=D(Y);function Z(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}function j(A,I){for(var C=0;C<I.length;C++){var g=I[C];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(A,G(g.key),g)}}function K(A,I,C){return I&&j(A.prototype,I),C&&j(A,C),Object.defineProperty(A,"prototype",{writable:!1}),A}function S(A,I){var C=Object.keys(A);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(A);I&&(g=g.filter((function(I){return Object.getOwnPropertyDescriptor(A,I).enumerable}))),C.push.apply(C,g)}return C}var k=function(){function A(){Z(this,A),this._path=""}return K(A,[{key:"meta",get:function(){if(void 0!==this._meta)return function(A){for(var I=1;I<arguments.length;I++){var C=null!=arguments[I]?arguments[I]:{};I%2?S(Object(C),!0).forEach((function(I){i(A,I,C[I])})):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(C)):S(Object(C)).forEach((function(I){Object.defineProperty(A,I,Object.getOwnPropertyDescriptor(C,I))}))}return A}({version:0},this._meta)}},{key:"pageSize",get:function(){}}],[{key:"getPtr",value:function(I){if(A._filePtrs.has(I))return A._filePtrs.get(I);throw new Error("File instance not found.")}},{key:"setPtr",value:function(I,C){A._filePtrs.set(I,C)}},{key:"removePtr",value:function(I){A._filePtrs.delete(I)}}])}();function L(A,I){if(I&&("object"==F(I)||"function"==typeof I))return I;if(void 0!==I)throw new TypeError("Derived constructors may only return object or undefined");return function(A){if(void 0===A)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A}(A)}function a(A){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(A){return A.__proto__||Object.getPrototypeOf(A)},a(A)}function d(A,I){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(A,I){return A.__proto__=I,A},d(A,I)}function H(A,I){if("function"!=typeof I&&null!==I)throw new TypeError("Super expression must either be null or a function");A.prototype=Object.create(I&&I.prototype,{constructor:{value:A,writable:!0,configurable:!0}}),Object.defineProperty(A,"prototype",{writable:!1}),I&&d(A,I)}function V(A,I,C){return I=a(I),L(A,b()?Reflect.construct(I,C||[],a(A).constructor):I.apply(A,C))}function b(){try{var A=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(A){}return(b=function(){return!!A})()}k._filePtrs=new Map;var X="pv_file",n=K((function A(){Z(this,A),this._pos=0,this._data=new Uint8Array}),[{key:"get",value:function(A){if(!(this._pos>=this._data.length)){var I=this._data.slice(this._pos,this._pos+A);return this._pos+=A,I}}},{key:"set",value:function(A,I){this._pos=A,this._data=I}},{key:"clear",value:function(){this._pos=0,this._data=new Uint8Array}}]),W=function(A){function I(A,C,g,B){var Q;return Z(this,I),(Q=V(this,I))._pageSize=524288,Q._pagePtr=0,Q._pageOffset=0,Q._path=A,Q._meta=C,Q._db=g,Q._mode=B,Q._cache=new n,Q}return H(I,A),K(I,[{key:"pageSize",get:function(){return this._pageSize}},{key:"close",value:(Q=o(N.mark((function A(){return N.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:this._db.close();case 1:case"end":return A.stop()}}),A,this)}))),function(){return Q.apply(this,arguments)})},{key:"read",value:(B=o(N.mark((function A(C,g){var B=this;return N.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.abrupt("return",new Promise((function(A,Q){if(B.exists()){if(B._isEOF){var E=new Error("EOF");return E.name="EndOfFile",void Q(E)}var R=0,U=Math.min(C*g,B._meta.size),w=U-U%C,F=new Uint8Array(w),G=B._cache.get(w);if(G){if(R+=G.length,B._pageOffset+=G.length,B._pageOffset===B._pageSize&&(B._pagePtr+=1,B._pageOffset=0),w===R)return void A(G);F.set(G)}var i=IDBKeyRange.bound("".concat(B._path,"-").concat(I.createPage(B._pagePtr)),"".concat(B._path,"-").concat(I.createPage(B._pagePtr+Math.floor(w/B._pageSize)+1))),M=B._store,y=M.openCursor(i);y.onsuccess=function(){var A=y.result;if(A&&!B._isEOF){var I,C,g=Math.min(w-R,A.value.length-B._pageOffset);F.set(A.value.slice(B._pageOffset,B._pageOffset+g),R),R+=g,B._pageOffset+=g,B._pageOffset===B._pageSize&&(B._pagePtr+=1,B._pageOffset=0),R<w?A.continue():(0!==B._pageOffset?B._cache.set(B._pageOffset,A.value):B._cache.clear(),null!==(I=M.transaction)&&void 0!==I&&I.commit&&(null===(C=M.transaction)||void 0===C||C.commit()))}},M.transaction.onerror=function(){Q(M.transaction.error)},M.transaction.oncomplete=function(){A(F.slice(0,R))}}else Q(new Error("'".concat(B._path,"' doesn't exist.")))})));case 1:case"end":return A.stop()}}),A)}))),function(A,I){return B.apply(this,arguments)})},{key:"write",value:(g=o(N.mark((function A(C){var g,B=this,Q=arguments;return