@picovoice/koala-web
Version:
Koala Noise Suppression engine for web browsers (via WebAssembly)
1 lines • 629 kB
JavaScript
var KoalaWeb=function(A){"use strict";function I(A,I,g,C,B,Q,E){try{var i=A[Q](E),G=i.value}catch(A){return void g(A)}i.done?I(G):Promise.resolve(G).then(C,B)}function g(A){return function(){var g=this,C=arguments;return new Promise((function(B,Q){var E=A.apply(g,C);function i(A){I(E,B,Q,i,G,"next",A)}function G(A){I(E,B,Q,i,G,"throw",A)}i(void 0)}))}}function C(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}function B(A){return B="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},B(A)}function Q(A){var I=function(A,I){if("object"!==B(A)||null===A)return A;var g=A[Symbol.toPrimitive];if(void 0!==g){var C=g.call(A,I||"default");if("object"!==B(C))return C;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===I?String:Number)(A)}(A,"string");return"symbol"===B(I)?I:String(I)}function E(A,I){for(var g=0;g<I.length;g++){var C=I[g];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(A,Q(C.key),C)}}function i(A,I,g){return I&&E(A.prototype,I),g&&E(A,g),Object.defineProperty(A,"prototype",{writable:!1}),A}function G(A,I,g){return(I=Q(I))in A?Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}):A[I]=g,A}var R={},c={get exports(){return R},set exports(A){R=A}},o={};!function(A){function I(g){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(g)}A.exports=I,A.exports.__esModule=!0,A.exports.default=A.exports}({get exports(){return o},set exports(A){o=A}}),function(A){var I=o.default;function g(){A.exports=g=function(){return C},A.exports.__esModule=!0,A.exports.default=A.exports;var C={},B=Object.prototype,Q=B.hasOwnProperty,E=Object.defineProperty||function(A,I,g){A[I]=g.value},i="function"==typeof Symbol?Symbol:{},G=i.iterator||"@@iterator",R=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function o(A,I,g){return Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{o({},"")}catch(A){o=function(A,I,g){return A[I]=g}}function w(A,I,g,C){var B=I&&I.prototype instanceof y?I:y,Q=Object.create(B.prototype),i=new n(C||[]);return E(Q,"_invoke",{value:U(A,g,i)}),Q}function F(A,I,g){try{return{type:"normal",arg:A.call(I,g)}}catch(A){return{type:"throw",arg:A}}}C.wrap=w;var s={};function y(){}function Z(){}function h(){}var l={};o(l,G,(function(){return this}));var D=Object.getPrototypeOf,d=D&&D(D(t([])));d&&d!==B&&Q.call(d,G)&&(l=d);var b=h.prototype=y.prototype=Object.create(l);function N(A){["next","throw","return"].forEach((function(I){o(A,I,(function(A){return this._invoke(I,A)}))}))}function a(A,g){function C(B,E,i,G){var R=F(A[B],A,E);if("throw"!==R.type){var c=R.arg,o=c.value;return o&&"object"==I(o)&&Q.call(o,"__await")?g.resolve(o.__await).then((function(A){C("next",A,i,G)}),(function(A){C("throw",A,i,G)})):g.resolve(o).then((function(A){c.value=A,i(c)}),(function(A){return C("throw",A,i,G)}))}G(R.arg)}var B;E(this,"_invoke",{value:function(A,I){function Q(){return new g((function(g,B){C(A,I,g,B)}))}return B=B?B.then(Q,Q):Q()}})}function U(A,I,g){var C="suspendedStart";return function(B,Q){if("executing"===C)throw new Error("Generator is already running");if("completed"===C){if("throw"===B)throw Q;return H()}for(g.method=B,g.arg=Q;;){var E=g.delegate;if(E){var i=Y(E,g);if(i){if(i===s)continue;return i}}if("next"===g.method)g.sent=g._sent=g.arg;else if("throw"===g.method){if("suspendedStart"===C)throw C="completed",g.arg;g.dispatchException(g.arg)}else"return"===g.method&&g.abrupt("return",g.arg);C="executing";var G=F(A,I,g);if("normal"===G.type){if(C=g.done?"completed":"suspendedYield",G.arg===s)continue;return{value:G.arg,done:g.done}}"throw"===G.type&&(C="completed",g.method="throw",g.arg=G.arg)}}}function Y(A,I){var g=I.method,C=A.iterator[g];if(void 0===C)return I.delegate=null,"throw"===g&&A.iterator.return&&(I.method="return",I.arg=void 0,Y(A,I),"throw"===I.method)||"return"!==g&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+g+"' method")),s;var B=F(C,A.iterator,I.arg);if("throw"===B.type)return I.method="throw",I.arg=B.arg,I.delegate=null,s;var Q=B.arg;return Q?Q.done?(I[A.resultName]=Q.value,I.next=A.nextLoc,"return"!==I.method&&(I.method="next",I.arg=void 0),I.delegate=null,s):Q:(I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,s)}function S(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 V(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function n(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(S,this),this.reset(!0)}function t(A){if(A){var I=A[G];if(I)return I.call(A);if("function"==typeof A.next)return A;if(!isNaN(A.length)){var g=-1,C=function I(){for(;++g<A.length;)if(Q.call(A,g))return I.value=A[g],I.done=!1,I;return I.value=void 0,I.done=!0,I};return C.next=C}}return{next:H}}function H(){return{value:void 0,done:!0}}return Z.prototype=h,E(b,"constructor",{value:h,configurable:!0}),E(h,"constructor",{value:Z,configurable:!0}),Z.displayName=o(h,c,"GeneratorFunction"),C.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===Z||"GeneratorFunction"===(I.displayName||I.name))},C.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,h):(A.__proto__=h,o(A,c,"GeneratorFunction")),A.prototype=Object.create(b),A},C.awrap=function(A){return{__await:A}},N(a.prototype),o(a.prototype,R,(function(){return this})),C.AsyncIterator=a,C.async=function(A,I,g,B,Q){void 0===Q&&(Q=Promise);var E=new a(w(A,I,g,B),Q);return C.isGeneratorFunction(I)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},N(b),o(b,c,"Generator"),o(b,G,(function(){return this})),o(b,"toString",(function(){return"[object Generator]"})),C.keys=function(A){var I=Object(A),g=[];for(var C in I)g.push(C);return g.reverse(),function A(){for(;g.length;){var C=g.pop();if(C in I)return A.value=C,A.done=!1,A}return A.done=!0,A}},C.values=t,n.prototype={constructor:n,reset:function(A){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(V),!A)for(var I in this)"t"===I.charAt(0)&&Q.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=void 0)},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 g(g,C){return E.type="throw",E.arg=A,I.next=g,C&&(I.method="next",I.arg=void 0),!!C}for(var C=this.tryEntries.length-1;C>=0;--C){var B=this.tryEntries[C],E=B.completion;if("root"===B.tryLoc)return g("end");if(B.tryLoc<=this.prev){var i=Q.call(B,"catchLoc"),G=Q.call(B,"finallyLoc");if(i&&G){if(this.prev<B.catchLoc)return g(B.catchLoc,!0);if(this.prev<B.finallyLoc)return g(B.finallyLoc)}else if(i){if(this.prev<B.catchLoc)return g(B.catchLoc,!0)}else{if(!G)throw new Error("try statement without catch or finally");if(this.prev<B.finallyLoc)return g(B.finallyLoc)}}}},abrupt:function(A,I){for(var g=this.tryEntries.length-1;g>=0;--g){var C=this.tryEntries[g];if(C.tryLoc<=this.prev&&Q.call(C,"finallyLoc")&&this.prev<C.finallyLoc){var B=C;break}}B&&("break"===A||"continue"===A)&&B.tryLoc<=I&&I<=B.finallyLoc&&(B=null);var E=B?B.completion:{};return E.type=A,E.arg=I,B?(this.method="next",this.next=B.finallyLoc,s):this.complete(E)},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),s},finish:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var g=this.tryEntries[I];if(g.finallyLoc===A)return this.complete(g.completion,g.afterLoc),V(g),s}},catch:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var g=this.tryEntries[I];if(g.tryLoc===A){var C=g.completion;if("throw"===C.type){var B=C.arg;V(g)}return B}}throw new Error("illegal catch attempt")},delegateYield:function(A,I,g){return this.delegate={iterator:t(A),resultName:I,nextLoc:g},"next"===this.method&&(this.arg=void 0),s}},C}A.exports=g,A.exports.__esModule=!0,A.exports.default=A.exports}(c);var w=R(),F=w;try{regeneratorRuntime=w}catch(A){"object"==typeof globalThis?globalThis.regeneratorRuntime=w:Function("r","regeneratorRuntime = r")(w)}const s=new Error("request for lock canceled");var y=function(A,I,g,C){return new(g||(g=Promise))((function(B,Q){function E(A){try{G(C.next(A))}catch(A){Q(A)}}function i(A){try{G(C.throw(A))}catch(A){Q(A)}}function G(A){var I;A.done?B(A.value):(I=A.value,I instanceof g?I:new g((function(A){A(I)}))).then(E,i)}G((C=C.apply(A,I||[])).next())}))};class Z{constructor(A,I=s){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,g)=>{this._weightedQueues[A-1]||(this._weightedQueues[A-1]=[]),this._weightedQueues[A-1].push({resolve:I,reject:g}),this._dispatch()}))}runExclusive(A,I=1){return y(this,void 0,void 0,(function*(){const[g,C]=yield this.acquire(I);try{return yield A(g)}finally{C()}}))}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 g=null===(A=this._weightedQueues[I-1])||void 0===A?void 0:A.shift();if(!g)continue;const C=this._value,B=I;this._value-=I,I=this._value+1,g.resolve([C,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,g,C){return new(g||(g=Promise))((function(B,Q){function E(A){try{G(C.next(A))}catch(A){Q(A)}}function i(A){try{G(C.throw(A))}catch(A){Q(A)}}function G(A){var I;A.done?B(A.value):(I=A.value,I instanceof g?I:new g((function(A){A(I)}))).then(E,i)}G((C=C.apply(A,I||[])).next())}))};class l{constructor(A){this._semaphore=new Z(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()}}function D(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var d={exports:{}},b={exports:{}};!function(A){function I(g){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(g)}A.exports=I,A.exports.__esModule=!0,A.exports.default=A.exports}(b);var N=b.exports;!function(A){var I=N.default;function g(){A.exports=g=function(){return B},A.exports.__esModule=!0,A.exports.default=A.exports;var C,B={},Q=Object.prototype,E=Q.hasOwnProperty,i=Object.defineProperty||function(A,I,g){A[I]=g.value},G="function"==typeof Symbol?Symbol:{},R=G.iterator||"@@iterator",c=G.asyncIterator||"@@asyncIterator",o=G.toStringTag||"@@toStringTag";function w(A,I,g){return Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{w({},"")}catch(C){w=function(A,I,g){return A[I]=g}}function F(A,I,g,C){var B=I&&I.prototype instanceof d?I:d,Q=Object.create(B.prototype),E=new M(C||[]);return i(Q,"_invoke",{value:t(A,g,E)}),Q}function s(A,I,g){try{return{type:"normal",arg:A.call(I,g)}}catch(A){return{type:"throw",arg:A}}}B.wrap=F;var y="suspendedStart",Z="suspendedYield",h="executing",l="completed",D={};function d(){}function b(){}function N(){}var a={};w(a,R,(function(){return this}));var U=Object.getPrototypeOf,Y=U&&U(U(k([])));Y&&Y!==Q&&E.call(Y,R)&&(a=Y);var S=N.prototype=d.prototype=Object.create(a);function V(A){["next","throw","return"].forEach((function(I){w(A,I,(function(A){return this._invoke(I,A)}))}))}function n(A,g){function C(B,Q,i,G){var R=s(A[B],A,Q);if("throw"!==R.type){var c=R.arg,o=c.value;return o&&"object"==I(o)&&E.call(o,"__await")?g.resolve(o.__await).then((function(A){C("next",A,i,G)}),(function(A){C("throw",A,i,G)})):g.resolve(o).then((function(A){c.value=A,i(c)}),(function(A){return C("throw",A,i,G)}))}G(R.arg)}var B;i(this,"_invoke",{value:function(A,I){function Q(){return new g((function(g,B){C(A,I,g,B)}))}return B=B?B.then(Q,Q):Q()}})}function t(A,I,g){var B=y;return function(Q,E){if(B===h)throw new Error("Generator is already running");if(B===l){if("throw"===Q)throw E;return{value:C,done:!0}}for(g.method=Q,g.arg=E;;){var i=g.delegate;if(i){var G=H(i,g);if(G){if(G===D)continue;return G}}if("next"===g.method)g.sent=g._sent=g.arg;else if("throw"===g.method){if(B===y)throw B=l,g.arg;g.dispatchException(g.arg)}else"return"===g.method&&g.abrupt("return",g.arg);B=h;var R=s(A,I,g);if("normal"===R.type){if(B=g.done?l:Z,R.arg===D)continue;return{value:R.arg,done:g.done}}"throw"===R.type&&(B=l,g.method="throw",g.arg=R.arg)}}}function H(A,I){var g=I.method,B=A.iterator[g];if(B===C)return I.delegate=null,"throw"===g&&A.iterator.return&&(I.method="return",I.arg=C,H(A,I),"throw"===I.method)||"return"!==g&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+g+"' method")),D;var Q=s(B,A.iterator,I.arg);if("throw"===Q.type)return I.method="throw",I.arg=Q.arg,I.delegate=null,D;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=C),I.delegate=null,D):E:(I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,D)}function m(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 J(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function M(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(m,this),this.reset(!0)}function k(A){if(A||""===A){var g=A[R];if(g)return g.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=C,I.done=!0,I};return Q.next=Q}}throw new TypeError(I(A)+" is not iterable")}return b.prototype=N,i(S,"constructor",{value:N,configurable:!0}),i(N,"constructor",{value:b,configurable:!0}),b.displayName=w(N,o,"GeneratorFunction"),B.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===b||"GeneratorFunction"===(I.displayName||I.name))},B.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,N):(A.__proto__=N,w(A,o,"GeneratorFunction")),A.prototype=Object.create(S),A},B.awrap=function(A){return{__await:A}},V(n.prototype),w(n.prototype,c,(function(){return this})),B.AsyncIterator=n,B.async=function(A,I,g,C,Q){void 0===Q&&(Q=Promise);var E=new n(F(A,I,g,C),Q);return B.isGeneratorFunction(I)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},V(S),w(S,o,"Generator"),w(S,R,(function(){return this})),w(S,"toString",(function(){return"[object Generator]"})),B.keys=function(A){var I=Object(A),g=[];for(var C in I)g.push(C);return g.reverse(),function A(){for(;g.length;){var C=g.pop();if(C in I)return A.value=C,A.done=!1,A}return A.done=!0,A}},B.values=k,M.prototype={constructor:M,reset:function(A){if(this.prev=0,this.next=0,this.sent=this._sent=C,this.done=!1,this.delegate=null,this.method="next",this.arg=C,this.tryEntries.forEach(J),!A)for(var I in this)"t"===I.charAt(0)&&E.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=C)},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 g(g,B){return i.type="throw",i.arg=A,I.next=g,B&&(I.method="next",I.arg=C),!!B}for(var B=this.tryEntries.length-1;B>=0;--B){var Q=this.tryEntries[B],i=Q.completion;if("root"===Q.tryLoc)return g("end");if(Q.tryLoc<=this.prev){var G=E.call(Q,"catchLoc"),R=E.call(Q,"finallyLoc");if(G&&R){if(this.prev<Q.catchLoc)return g(Q.catchLoc,!0);if(this.prev<Q.finallyLoc)return g(Q.finallyLoc)}else if(G){if(this.prev<Q.catchLoc)return g(Q.catchLoc,!0)}else{if(!R)throw new Error("try statement without catch or finally");if(this.prev<Q.finallyLoc)return g(Q.finallyLoc)}}}},abrupt:function(A,I){for(var g=this.tryEntries.length-1;g>=0;--g){var C=this.tryEntries[g];if(C.tryLoc<=this.prev&&E.call(C,"finallyLoc")&&this.prev<C.finallyLoc){var B=C;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,D):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),D},finish:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var g=this.tryEntries[I];if(g.finallyLoc===A)return this.complete(g.completion,g.afterLoc),J(g),D}},catch:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var g=this.tryEntries[I];if(g.tryLoc===A){var C=g.completion;if("throw"===C.type){var B=C.arg;J(g)}return B}}throw new Error("illegal catch attempt")},delegateYield:function(A,I,g){return this.delegate={iterator:k(A),resultName:I,nextLoc:g},"next"===this.method&&(this.arg=C),D}},B}A.exports=g,A.exports.__esModule=!0,A.exports.default=A.exports}(d);var a=(0,d.exports)(),U=a;try{regeneratorRuntime=a}catch(A){"object"==typeof globalThis?globalThis.regeneratorRuntime=a:Function("r","regeneratorRuntime = r")(a)}var Y=D(U);function S(A,I,g,C){return new(g||(g=Promise))((function(B,Q){function E(A){try{G(C.next(A))}catch(A){Q(A)}}function i(A){try{G(C.throw(A))}catch(A){Q(A)}}function G(A){var I;A.done?B(A.value):(I=A.value,I instanceof g?I:new g((function(A){A(I)}))).then(E,i)}G((C=C.apply(A,I||[])).next())}))}const V=new WeakMap;function n(A,I){return new Proxy(A,{get:(A,g)=>I(A[g])})}class t{constructor(){this.value=void 0,this.exports=null}getState(){return this.exports.asyncify_get_state()}assertNoneState(){let A=this.getState();if(0!==A)throw new Error(`Invalid async state ${A}, expected 0.`)}wrapImportFn(A){return(...I)=>{if(2===this.getState())return this.exports.asyncify_stop_rewind(),this.value;this.assertNoneState();let g=A(...I);if(!(C=g)||"object"!=typeof C&&"function"!=typeof C||"function"!=typeof C.then)return g;var C;this.exports.asyncify_start_unwind(16),this.value=g}}wrapModuleImports(A){return n(A,(A=>"function"==typeof A?this.wrapImportFn(A):A))}wrapImports(A){if(void 0!==A)return n(A,((A=Object.create(null))=>this.wrapModuleImports(A)))}wrapExportFn(A){let I=V.get(A);return void 0!==I||(I=async(...I)=>{this.assertNoneState();let g=A(...I);for(;1===this.getState();)this.exports.asyncify_stop_unwind(),this.value=await this.value,this.assertNoneState(),this.exports.asyncify_start_rewind(16),g=A();return this.assertNoneState(),g},V.set(A,I)),I}wrapExports(A){let I=Object.create(null);for(let g in A){let C=A[g];"function"!=typeof C||g.startsWith("asyncify_")||(C=this.wrapExportFn(C)),Object.defineProperty(I,g,{enumerable:!0,value:C})}return V.set(A,I),I}init(A,I){const{exports:g}=A,C=g.memory||I.env&&I.env.memory;new Int32Array(C.buffer,16).set([24,1024]),this.exports=this.wrapExports(g),Object.setPrototypeOf(A,H.prototype)}}class H extends WebAssembly.Instance{constructor(A,I){let g=new t;super(A,g.wrapImports(I)),g.init(this,I)}get exports(){return V.get(super.exports)}}async function m(A,I){let g=new t,C=await WebAssembly.instantiate(A,g.wrapImports(I));return g.init(C instanceof WebAssembly.Instance?C:C.instance,I),C}async function J(A,I){let g=new t,C=await WebAssembly.instantiateStreaming(A,g.wrapImports(I));return g.init(C.instance,I),C}function M(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}function k(A){return k="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},k(A)}function e(A){var I=function(A,I){if("object"!==k(A)||null===A)return A;var g=A[Symbol.toPrimitive];if(void 0!==g){var C=g.call(A,I||"default");if("object"!==k(C))return C;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===I?String:Number)(A)}(A,"string");return"symbol"===k(I)?I:String(I)}function X(A,I){for(var g=0;g<I.length;g++){var C=I[g];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(A,e(C.key),C)}}function K(A,I,g){return I&&X(A.prototype,I),g&&X(A,g),Object.defineProperty(A,"prototype",{writable:!1}),A}function W(A,I){return W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(A,I){return A.__proto__=I,A},W(A,I)}function r(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&&W(A,I)}function L(A,I){if(I&&("object"===k(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 u(A){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(A){return A.__proto__||Object.getPrototypeOf(A)},u(A)}Object.defineProperty(H.prototype,"exports",{enumerable:!0});var j=function(){function A(){M(this,A),this._path=""}return K(A,[{key:"meta",get:function(){if(void 0!==this._meta)return Object.assign({version:0},this._meta)}}],[{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,g){A._filePtrs.set(I,g)}},{key:"removePtr",value:function(I){A._filePtrs.delete(I)}}]),A}();function p(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 g,C=u(A);if(I){var B=u(this).constructor;g=Reflect.construct(C,arguments,B)}else g=C.apply(this,arguments);return L(this,g)}}j._filePtrs=new Map;var f="pv_db",v="pv_file",z=3;var T=function(A){r(g,A);var I=p(g);function g(A,C,B,Q){var E;return M(this,g),(E=I.call(this))._pageSize=65536,E._pagePtr=0,E._pageOffset=0,E._path=A,E._meta=C,E._db=B,E._mode=Q,E}return K(g,[{key:"close",value:function(){return S(this,void 0,void 0,Y.mark((function A(){return Y.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 S(this,void 0,void 0,Y.mark((function C(){var B=this;return Y.wrap((function(C){for(;;)switch(C.prev=C.next){case 0:return C.abrupt("return",new Promise((function(C,Q){if(B.exists()){if(B._isEOF){var E=new Error("EOF");return E.name="EndOfFile",void Q(E)}var i=0,G=Math.min(A*I,B._meta.size),R=G-G%A,c=new Uint8Array(R),o=IDBKeyRange.bound("".concat(B._path,"-").concat(g.createPage(B._pagePtr)),"".concat(B._path,"-").concat(g.createPage(B._meta.numPages))),w=B._store,F=w.openCursor(o);F.onsuccess=function(){var A=F.result;if(A&&!B._isEOF){var I=Math.min(R-i,A.value.length-B._pageOffset);c.set(A.value.slice(B._pageOffset,B._pageOffset+I),i),i+=I,B._pageOffset+=I,B._pageOffset===B._pageSize&&(B._pagePtr+=1,B._pageOffset=0),i<R&&A.continue()}},w.transaction.onerror=function(){Q(w.transaction.error)},w.transaction.oncomplete=function(){C(c.slice(0,i))}}else Q(new Error("'".concat(B._path,"' doesn't exist.")))})));case 1:case"end":return C.stop()}}),C)})))}},{key:"write",value:function(A){var I=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return S(this,void 0,void 0,Y.mark((function C(){var B=this;return Y.wrap((function(C){for(;;)switch(C.prev=C.next){case 0:return C.abrupt("return",new Promise((function(C,Q){return S(B,void 0,void 0,Y.mark((function B(){var E,i,G,R,c,o,w,F,s,y=this;return Y.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 E=this._store,i=function(){return new Promise((function(A){var I=E.get("".concat(y._path,"-").concat(g.createPage(y._pagePtr)));I.onsuccess=function(){void 0!==I.result?A(I.result.slice(0,y._pageOffset)):A(new Uint8Array(0))}}))},B.next=10,i();case 10:for(G=B.sent,(R=new Uint8Array(G.length+A.length)).set(G),R.set(A,G.length),c=this._pagePtr*this._pageSize+R.length,o={size:c,numPages:Math.ceil(c/this._pageSize),version:I},E.put(o,this._path),w=Math.ceil(R.length/this._pageSize),F=0;F<w;F++)E.put(R.slice(F*this._pageSize,(F+1)*this._pageSize),"".concat(this._path,"-").concat(g.createPage(this._pagePtr+F)));this.exists()&&o.numPages<this._meta.numPages&&(s=IDBKeyRange.bound("".concat(this._path,"-").concat(g.createPage(o.numPages)),"".concat(this._path,"-").concat(g.createPage(this._meta.numPages)),!0),E.delete(s)),E.transaction.onerror=function(){Q(E.transaction.error)},E.transaction.oncomplete=function(){y._meta=o,y.seek(0,2),C()};case 22:case"end":return B.stop()}}),B,this)})))})));case 1:case"end":return C.stop()}}),C)})))}},{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 g=new Error("EOF");throw g.name="EndOfFile",g}var C;if(0===I)C=Math.min(A,this._meta.size);else if(1===I){var B=this._pageSize*this._pagePtr+this._pageOffset;C=Math.min(B+A,this._meta.size)}else{if(2!==I)throw new Error("Invalid operation: ".concat(I,"."));C=Math.min(this._meta.size+A,this._meta.size)}this._pageOffset=C%this._pageSize,this._pagePtr=Math.floor(C/this._pageSize)}},{key:"tell",value:function(){return this.exists()?this._pagePtr*this._pageSize+this._pageOffset:-1}},{key:"remove",value:function(){return S(this,void 0,void 0,Y.mark((function A(){var I=this;return Y.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.abrupt("return",new Promise((function(A,C){return S(I,void 0,void 0,Y.mark((function I(){var B,Q,E,i,G=this;return Y.wrap((function(I){for(;;)switch(I.prev=I.next){case 0:if(this.exists()){I.next=3;break}return C(new Error("ENOENT")),I.abrupt("return");case 3:B=this._meta.numPages,Q=IDBKeyRange.bound(this._path,"".concat(this._path,"-").concat(g.createPage(B))),E=this._store,(i=E.delete(Q)).onerror=function(){C(i.error)},i.onsuccess=function(){G._meta=void 0,G._pageOffset=0,G._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(v,this._mode).objectStore(v)}}],[{key:"open",value:function(A,I){var C=this;if(!self.indexedDB){var B=new Error("IndexedDB is not supported");throw B.name="IndexedDBNotSupported",B}return new Promise((function(B,Q){return S(C,void 0,void 0,Y.mark((function C(){var E,i,G;return Y.wrap((function(C){for(;;)switch(C.prev=C.next){case 0:return C.prev=0,C.next=3,new Promise((function(A,I){var g=self.indexedDB.open(f,z);g.onerror=function(){I(g.error)},g.onsuccess=function(){A(g.result)},g.onupgradeneeded=function(){g.result.objectStoreNames.contains(v)||g.result.createObjectStore(v)}}));case 3:E=C.sent,(i=E.transaction(v,"readwrite").objectStore(v).get(A)).onerror=function(){Q(i.error)},i.onsuccess=function(){var C=i.result,G=I.includes("r")?"readonly":"readwrite";if(void 0===C&&"readonly"===G){var R=new Error("'".concat(A,"' doesn't exist."));return R.name="FileNotExists",void Q(R)}var c=new g(A,C,E,G);I.includes("a")&&c.seek(0,2),B(c)},C.next=12;break;case 9:C.prev=9,C.t0=C.catch(0),"InvalidStateError"===C.t0.name?((G=new Error("IndexedDB is not supported")).name="IndexedDBNotSupported",Q(G)):Q(C.t0);case 12:case"end":return C.stop()}}),C,null,[[0,9]])})))}))}},{key:"createPage",value:function(A){return("000"+A).slice(-4)}}]),g}(j);function x(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 g,C=u(A);if(I){var B=u(this).constructor;g=Reflect.construct(C,arguments,B)}else g=C.apply(this,arguments);return L(this,g)}}var P=function(A){r(g,A);var I=x(g);function g(A,C,B,Q){var E;return M(this,g),(E=I.call(this))._pos=0,E._path=A,E._meta=C,E._mode=Q,E}return K(g,[{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 g=new Error("EOF");throw g.name="EndOfFile",g}var C=Math.min(A*I,this._file.length-this._pos),B=C-C%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 g=new Error("EOF");throw g.name="EndOfFile",g}var C;if(0===I)C=Math.min(A,this._file.length);else if(1===I)C=Math.min(this._pos+A,this._file.length);else{if(2!==I)throw new Error("Invalid operation: ".concat(I,"."));C=Math.min(this._file.length+A,this._file.length)}this._pos=C}},{key:"tell",value:function(){return this.exists()?this._pos:-1}},{key:"remove",value:function(){return S(this,void 0,void 0,Y.mark((function A(){return Y.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:if(this.exists()){A.next=2;break}throw new Error("ENOENT");case 2:g._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 g._memFiles.get(this._path)},set:function(A){g._memFiles.set(this._path,A)}}],[{key:"open",value:function(A,I){var C=g._memFiles.get(A),B=I.includes("r")?"readonly":"readwrite";if(void 0===C&&"readonly"===B){var Q=new Error("'".concat(A,"' doesn't exist."));throw Q.name="FileNotExists",Q}var E=new g(A,void 0,void 0,B);return I.includes("a")&&E.seek(0,2),E}}]),g}(j);function O(A,I){var g="undefined"!=typeof Symbol&&A[Symbol.iterator]||A["@@iterator"];if(!g){if(Array.isArray(A)||(g=function(A,I){if(!A)return;if("string"==typeof A)return q(A,I);var g=Object.prototype.toString.call(A).slice(8,-1);"Object"===g&&A.constructor&&(g=A.constructor.name);if("Map"===g||"Set"===g)return Array.from(A);if("Arguments"===g||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g))return q(A,I)}(A))||I&&A&&"number"==typeof A.length){g&&(A=g);var C=0,B=function(){};return{s:B,n:function(){return C>=A.length?{done:!0}:{done:!1,value:A[C++]}},e:function(A){throw A},f:B}}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 Q,E=!0,i=!1;return{s:function(){g=g.call(A)},n:function(){var A=g.next();return E=A.done,A},e:function(A){i=!0,Q=A},f:function(){try{E||null==g.return||g.return()}finally{if(i)throw Q}}}}function q(A,I){(null==I||I>A.length)&&(I=A.length);for(var g=0,C=new Array(I);g<I;g++)C[g]=A[g];return C}function _(A,I){for(var g=I;0!==A[g];)g++;return new TextDecoder("utf-8").decode(A.subarray(I,g))}function $(A){for(var I=atob(A),g=new Uint8Array(I.length),C=0;C<I.length;C++)g[C]=I.charCodeAt(C);return g}function AA(A){var I,g={},C=O(A.split("\r\n"));try{for(C.s();!(I=C.n()).done;){var B=I.value.split(": ");""!==B[0]&&(g[B[0]]=B[1])}}catch(A){C.e(A)}finally{C.f()}return g}function IA(A){var I=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3;return S(this,void 0,void 0,Y.mark((function C(){var B,Q,E,i;return Y.wrap((function(C){for(;;)switch(C.prev=C.next){case 0:return B=new AbortController,Q=Object.assign(Object.assign({},I),{signal:B.signal}),E=setTimeout((function(){B.abort()}),g),C.next=5,fetch(A,Q);case 5:return i=C.sent,clearTimeout(E),C.abrupt("return",i);case 8:case"end":return C.stop()}}),C)})))}function gA(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 CA(A,I){return S(this,void 0,void 0,Y.mark((function g(){var C;return Y.wrap((function(g){for(;;)switch(g.prev=g.next){case 0:return g.prev=0,g.next=3,T.open(A,I);case 3:return g.abrupt("return",g.sent);case 6:if(g.prev=6,g.t0=g.catch(0),"IndexedDBNotSupported"===g.t0.name?console.warn("IndexedDB is not supported. Fallback to in-memory storage."):"FileNotExists"!==g.t0.name&&console.warn("Unable to access IndexedDB (".concat(g.t0.toString(),"). Fallback to in-memory storage.")),!("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope)){g.next=16;break}if("FileNotExists"!==g.t0.name){g.next=12;break}throw g.t0;case 12:throw console.error("In-memory storage cannot be used inside a worker."),(C=new Error("Failed to start PvFile: ".concat(g.t0.toString()))).name="PvFileNotSupported",C;case 16:return g.abrupt("return",P.open(A,I));case 17:case"end":return g.stop()}}),g,null,[[0,6]])})))}function BA(A,I,g,C){return S(this,void 0,void 0,Y.mark((function B(){var Q;return Y.wrap((function(B){for(;;)switch(B.prev=B.next){case 0:return B.next=2,CA(A,"w");case 2:if(Q=B.sent,!(g||void 0===Q.meta||C>Q.meta.version)){B.next=6;break}return B.next=6,Q.write($(I),C);case 6:case"end":return B.stop()}}),B)})))}P._memFiles=new Map;var QA=5e3,EA=2;function iA(A,I,g,C,B){return S(this,void 0,void 0,Y.mark((function Q(){var E,i,G,R,c,o,w,F;return Y.wrap((function(Q){for(;;)switch(Q.prev=Q.next){case 0:return Q.next=2,CA(A,"w");case 2:if(E=Q.sent,!(g||void 0===E.meta||C>E.meta.version)){Q.next=43;break}if(!(B<0)){Q.next=6;break}throw Error("numFetchRetries must be a positive number");case 6:i=EA,G=function(A){return new Promise((function(I){setTimeout(I,A)}))},R=B+1,c=null;case 10:if(!(R>0)){Q.next=38;break}return c=null,Q.prev=12,Q.next=15,fetch(I,{cache:"no-cache"});case 15:if(!(o=Q.sent).ok){Q.next=23;break}return Q.next=19,o.arrayBuffer();case 19:return w=Q.sent,Q.next=22,E.write(new Uint8Array(w),C);case 22:return Q.abrupt("return");case 23:return Q.next=25,o.text();case 25:F=Q.sent,c=new Error("Error response returned while fetching model from '".concat(I,"': ").concat(F)),Q.next=32;break;case 29:Q.prev=29,Q.t0=Q.catch(12),c=new Error("Failed to fetch model from '".concat(I,"': ").concat(Q.t0.message));case 32:return R--,Q.next=35,G(i);case 35:i=Math.min(QA,i*EA),Q.next=10;break;case 38:if(null===c){Q.next=42;break}throw c;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 GA(A){return S(this,void 0,void 0,Y.mark((function I(){var g,C,B,Q,E,i,G,R,c;return Y.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(g=A.base64,C=A.publicPath,B=A.customWritePath,Q=A.forceWrite,E=void 0!==Q&&Q,i=A.version,G=void 0===i?1:i,R=A.numFetchRetries,c=void 0===R?0:R,null!=B){I.next=5;break}throw new Error("The customWritePath of the provided model is undefined / empty");case 5:if(null==g){I.next=10;break}return I.next=8,BA(B,g,E,G);case 8:case 13:I.next=16;break;case 10:if(null==C){I.next=15;break}return I.next=13,iA(B,C,E,G,c);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)})))}var RA={args_get:function(A){return 0},args_sizes_get:function(A){return 0},environ_get:function(A){return 0},environ_sizes_get:function(A){return 0},clock_res_get:function(A){return 0},clock_time_get:function(A){return 0},fd_advise:function(A){return 0},fd_allocate:function(A){return 0},fd_close:function(A){return 0},fd_datasync:function(A){return 0},fd_fdstat_get:function(A){return 0},fd_fdstat_set_flags:function(A){return 0},fd_fdstat_set_rights:function(A){return 0},fd_filestat_get:function(A){return 0},fd_filestat_set_size:function(A){return 0},fd_filestat_set_times:function(A){return 0},fd_pread:function(A){return 0},fd_prestat_get:function(A){return 0},fd_prestat_dir_name:function(A){return 0},fd_pwrite:function(A){return 0},fd_read:function(A){return 0},fd_readdir:function(A){return 0},fd_renumber:function(A){return 0},fd_seek:function(A){return 0},fd_sync:function(A){return 0},fd_tell:function(A){return 0},fd_write:function(A){return 0},path_create_directory:function(A){return 0},path_filestat_get:function(A){return 0},path_filestat_set_times:function(A){return 0},path_link:function(A){return 0},path_open:function(A){return 0},path_readlink:function(A){return 0},path_remove_directory:function(A){return 0},path_rename:function(A){return 0},path_symlink:function(A){return 0},path_unlink_file:function(A){return 0},poll_oneoff:function(A){return 0},proc_exit:function(A){return 0},proc_raise:function(A){return 0},sched_yield:function(A){return 0},random_get:function(A){return 0},sock_recv:function(A){return 0},sock_send:function(A){return 0},sock_shutdown:function(A){return 0}};function cA(A,I,g){return S(this,void 0,void 0,Y.mark((function C(){var B,Q,E,i,G,R,c,o,w,F,s;return Y.wrap((function(C){for(;;)switch(C.prev=C.next){case 0:if(B=new Uint8Array(A.buffer),Q=new Int32Array(A.buffer),E=function(A,I,C,E,i,G,R,c,o){return S(this,void 0,void 0,Y.mark((function w(){var F,y,Z,h,l,D,d,b,N,a,U,S;return Y.wrap((function(w){for(;;)switch(w.prev=w.next){case 0:return F=_(B,A),y=_(B,I),Z=_(B,C),h=_(B,E),l=_(B,i),D=AA(h),d={method:F},l.length>0&&(d.body=l),Object.keys(D).length>0&&(d.headers=D),w.prev=9,w.next=12,IA("https://"+y+Z,d,G);case 12:b=w.sent,a=b.status,w.next=20;break;case 16:return w.prev=16,w.t0=w.catch(9),null==g||g.addError("pvHttpsRequestWasm","Failed to fetch: ".concat(w.t0)),w.abrupt("return");case 20:return w.prev=20,w.next=23,b.text();case 23:N=w.sent,w.next=30;break;case 26:return w.prev=26,w.t1=w.catch(20),null==g||g.addError("pvHttpsRequestWasm","Failed to get response text: ".concat(w.t1)),w.abrupt("return");case 30:return w.next=32,s(Int8Array.BYTES_PER_ELEMENT,(N.length+1)*Int8Array.BYTES_PER_ELEMENT);case 32:if(0!==(U=w.sent)){w.next=37;break}return null==g||g.addError("pvMallocError","pvHttpsRequestWasm: cannot allocate memory for response"),Q[R/Int32Array.BYTES_PER_ELEMENT]=0,w.abrupt("return");case 37:for(Q[c/Int32Array.BYTES_PER_ELEMENT]=N.length+1,Q[R/Int32Array.BYTES_PER_ELEMENT]=U,S=0;S<N.length;S++)B[U+S]=N.charCodeAt(S);B[U+N.length]=0,Q[o/Int32Array.BYTES_PER_ELEMENT]=a;case 42:case"end":return w.stop()}}),w,null,[[9,16],[20,26]])})))},i=function(A,I,C,B){try{j.getPtr(A).seek(I,C),Q[B/Int32Array.BYTES_PER_ELEMENT]=0}catch(A){null==g||g.addError("pvFileSeekWasm",A),Q[B/Int32Array.BYTES_PER_ELEMENT]=-1}},G=function(A,I){try{var C=j.getPtr(A);Q[I/Int32Array.BYTES_PER_ELEMENT]=C.tell()}catch(A){null==g||g.addError("pvFileTellWasm",A),Q[I/Int32Array.BYTES_PER_ELEMENT]=-1}},R={wasi_snapshot_preview1:RA,env:{memory:A,pv_console_log_wasm:function(A){console.log(_(B,A))},pv_assert_wasm:function(A,I,g){if(0===A){var C=_(B,g);throw new Error("assertion failed at line ".concat(I,' in "').concat(C,'"'))}},pv_time_wasm:function(){return Date.now()/1e3},pv_https_request_wasm:E,pv_get_browser_info:function(A){return S(this,void 0,void 0,Y.mark((function I(){var C,E,i;return Y.wrap((function(I){for(;;)switch(I.prev=I.next){case 0:return C=void 0!==navigator.userAgent?navigator.userAgent:"unknown",I.next=3,s(Uint8Array.BYTES_PER_ELEMENT,(C.length+1)*Uint8Array.BYTES_PER_ELEMENT);case 3:if(0!==(E=I.sent)){I.next=8;break}return null==g||g.addError("pvMallocError","pvGetBrowserInfo: cannot allocate memory for browser info"),Q[A/Int32Array.BYTES_PER_ELEMENT]=0,I.abrupt("return");case 8:for(Q[A/Int32Array.BYTES_PER_ELEMENT]=E,i=0;i<C.length;i++)B[E+i]=C.charCodeAt(i);B[E+C.length]=0;case 11:case"end":return I.stop()}}),I)})))},pv_get_origin_info:function(A){var I;return S(this,void 0,void 0,Y.mark((function C(){var E,i,G,R;return Y.wrap((function(C){for(;;)switch(C.prev=C.next){case 0:return E=null!==(I=self.origin)&&void 0!==I?I:self.location.origin,i=new URL(E).hostname,C.next=4,s(Uint8Array.BYTES_PER_ELEMENT,(i.length+1)*Uint8Array.BYTES_PER_ELEMENT);case 4:if(0!==(G=C.sent)){C.next=9;break}return null==g||g.addError("pvMallocError","pvGetOriginInfo: cannot allocate memory for origin info"),Q[A/Int32Array.BYTES_PER_ELEMENT]=0,C.abrupt("return");case 9:for(Q[A/Int32Array.BYTES_PER_ELEMENT]=G,R=0;R<i.length;R++)B[G+R]=i.charCodeAt(R);B[G+i.length]=0;case 12:case"end":return C.stop()}}),C)})))},pv_file_open_wasm:function(A,I,C,E){return S(this,void 0,void 0,Y.mark((function i(){var G,R,c;return Y.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return G=_(B,I),R=_(B,C),i.prev=2,i.next=5,CA(G,R);case 5:c=i.sent,j.setPtr(A,c),Q[E/Int32Array.BYTES_PER_ELEMENT]=0,i.next=14;break;case 10:i.prev=10,i.t0=i.catch(2),"FileNotExists"!==i.t0.name&&(null==g||g.addError("pvFileOpenWasm",i.t0)),Q[E/Int32Array.BYTES_PER_ELEMENT]=-1;case 14:case"end":return i.stop()}}),i,null,[[2,10]])})))},pv_file_close_wasm:function(A,I){return S(this,void 0,void 0,Y.mark((function C(){var B;return Y.wrap((function(C){for(;;)switch(C.prev=C.next){case 0:return C.prev=0,C.next=3,j.getPtr(A);case 3:return B=C.sent,C.next=6,B.close();case 6:Q[I/Int32Array.BYTES_PER_ELEMENT]=0,C.next=13;break;case 9:C.prev=9,C.t0=C.catch(0),null==g||g.addError("pvFileCloseWasm",C.t0),Q[I/Int32Array.BYTES_PER_ELEMENT]=-1;case 13:case"end":return C.stop()}}),C,null,[[0,9]])})))},pv_file_read_wasm:function(A,I,C,E,i){return S(this,void 0,void 0,Y.mark((function G(){var R,c;return Y.wrap((function(G){for(;;)switch(G.prev=G.next){case 0:return G.prev=0,G.next=3,j.getPtr(A);case 3:return R=G.sent,G.next=6,R.read(C,E);case 6:c=G.sent,B.set(c,I),Q[i/Int32Array.BYTES_PER_ELEMENT]=c.length/C,G.next=15;break;case 11:G.prev=11,G.t0=G.catch(0),null==g||g.addError("pvFileReadWasm",G.t0),Q[i/Int32Array.BYTES_PER_ELEMENT]=-1;case 15:case"end":return G.stop()}}),G,null,[[0,11]])})))},pv_file_write_wasm:function(A,I,C,E,i){return S(this,void 0,void 0,Y.mark((function G(){var R,c;return Y.wrap((function(G){for(;;)switch(G.prev=G.next){case 0:return G.prev=0,G.next=3,j.getPtr(A);case 3:return R=G.sent,(c=new Uint8Array(C*E)).set(B.slice(I,I+C*E),0),G.next=8,R.write(c);case 8:Q[i/Int32Array.BYTES_PER_ELEMENT]=c.length/C,G.next=15;break;case 11:G.prev=11,G.t0=G.catch(0),null==g||g.addError("pvFileWriteWasm",G.t0),Q[i/Int32Array.BYTES_PER_ELEMENT]=1;case 15:case"end":return G.stop()}}),G,null,[[0,11]])})))},pv_file_seek_wasm:i,pv_file_tell_wasm:G,pv_file_remove_wasm:function(A,I){return S(this,void 0,void 0,Y.mark((function C(){var E,i;return Y.wrap((function(C){for(;;)switch(C.prev=C.next){case 0:return E=_(B,A),C.prev=1,C.next=4,CA(E,"w");case 4:return i=C.sent,C.next=7,i.remove();case 7:Q[I/Int32Array.BYTES_PER_ELEMENT]=0,C.next=14;break;case 10:C.prev=10,C.t0=C.catch(1),null==g||g.addError("pvFileRemoveWasm",C.t0),Q[I/Int32Array.BYTES_PER_ELEMENT]=-1;case 14:case"end":return C.stop()}}),C,null,[[1,10]])})))}}},!(I instanceof Promise)){C.next=34;break}if(!J){C.next=23;break}return C.next=20,J(I,R);case 20:c=C.sent.instance,C.next=32;break;case 23:return C.next=25,I;case 25:return o=C.sent,C.next=28,o.arrayBuffer();case 28:return w=C.sent,C.next=31,m(new Uint8Array(w),R);case 31:c=C.sent.instance;case 32:C.next=38;break;case 34:return F=$(I),C.next=37,m(F,R);case 37:c=C.sent.instance;case 38:return s=c.exports.aligned_alloc,C.abrupt("return",c.exports);case 40:case"end":return C.stop()}}),C)})))}function oA(A,I){(null==I||I>A.length)&&(I=A.length);for(var g=0,C=new Array(I);g<I;g++)C[g]=A[g];return C}function wA(A){return function(A){if(Array.isArray(A))return oA(A)}(A)||function(A){if("undefined"!=typeof Symbol&&null!=A[Symbol.iterator]||null!=A["@@iterator"])return Array.from(A)}(A)||function(A,I){if(A){if("string"==typeof A)return oA(A,I);var g=Object.prototype.toString.call(A).slice(8,-1);return"Object"===g&&A.constructor&&(g=A.constructor.name),"Map"===g||"Set"===g?Array.from(A):"Arguments"===g||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g)?oA(A,I):void 0}}(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 FA=function(){function A(){M(this,A),this._maxNumErrors=10,this._errors=[],this._lastError=new Error("null")}return K(A,[{key:"addError",value:function(A,I){this._lastError=I instanceof Error?I:new Error(I),this._errors.length>=this._maxNumErrors&&this._errors.shift(),I instanceof Error?this._errors.push({key:A,message:I.toString()}):this._errors.push({key:A,message:JSON.stringify(I)})}},{key:"getErrors",value:function(){var A=wA(this._errors);return this._errors=[],A}},{key:"getErrorString",value:function(){return this.getErrors().map((function(A){var I=A.key,g=A.message;return"'".concat(I,"' failed with: ").concat(g,".")})).join("\n")}},{key:"getLastError",value:function(){return this._lastError}},{key:"setMaxErrorNum",value:function(A){this._maxNumErrors=A}}]),A}();const sA=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]));var yA;function ZA(A){if(void 0===A)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A}function hA(A,I){return hA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(A,I){return A.__proto__=I,A},hA(A,I)}function lA(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&&hA(A,I)}function DA(A){return DA=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(A){return A.__proto__||Object.getPrototypeOf(A)},DA(A)}function dA(A,I,g){return dA=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}}()?Reflect.construct.bind():function(A,I,g){var C=[null];C.push.apply(C,I);var B=new(Function.bind.apply(A,C));return g&&hA(B,g.prototype),B},dA.apply(null,arguments)}function bA(A){var I="function"==typeof Map?new Map:void 0;return bA=function(A){if(null===A||(g=A,-1===Function.toString.call(g).indexOf("[native code]")))return A;var g;if("function"!=typeof A)throw new TypeError("Super expression must either be null or a function");if(void 0!==I){if(I.has(A))return I.get(A);I.set(A,C)}function C(){return dA(A,arguments,DA(this).constructor)}return C.prototype=Object.create(A.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),hA(C,A)},bA(A)}function NA(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 g,C=DA(A);if(I){var Q=DA(this).constructor;g=Reflect.construct(C,arguments,Q)}else g=C.apply(this,arguments);return function(A,I){if(I&&("object"===B(I)||"function"==typeof I))return I;if(void 0!==I)throw new TypeError("Derived constructors may only return object or undefined");return ZA(A)}(this,g)}}!function(A){A[A.SUCCESS=1e4]="SUCCESS",A[A.OUT_OF_MEMORY=10001]="OUT_OF_MEMORY",A[A.IO_ERROR=10002]="IO_ERROR",A[A.INVALID_ARGUMENT=10003]="INVALID_ARGUMENT",A[A.STOP_ITERATION=10004]="STOP_ITERATION",A[A.KEY_ERROR=10005]="KEY_ERROR",A[A.INVALID_STATE=10006]="INVALID_STATE",A[A.RUNTIME_ERROR=10007]="RUNTIME_ERROR",A[A.ACTIVATION_ERROR=10008]="ACTIVATION_ERROR",A[A.ACTIVATION_LIMIT_REACHED=1000