trtc-sdk-v5 5.10.0-wasm.2 → 5.10.0-wasm.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).VideoDecoderPlugin=e()}(this,(function(){"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function e(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function r(t){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=t.apply(r,n);function s(t){e(a,o,i,s,c,"next",t)}function c(t){e(a,o,i,s,c,"throw",t)}s(void 0)}))}}function n(t,e,r){return e=u(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,l()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,v(n.key),n)}}function a(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=y(t))||e){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}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 i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function c(t,e,r){return(e=v(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function f(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e)}function l(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(l=function(){return!!t})()}function d(){d=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=e&&e.prototype instanceof g?e:g,a=Object.create(i.prototype),s=new O(n||[]);return o(a,"_invoke",{value:A(t,r,s)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var p="suspendedStart",h="suspendedYield",v="executing",m="completed",y={};function g(){}function w(){}function b(){}var E={};u(E,a,(function(){return this}));var k=Object.getPrototypeOf,_=k&&k(k(F([])));_&&_!==r&&n.call(_,a)&&(E=_);var P=b.prototype=g.prototype=Object.create(E);function T(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function C(t,e){function r(o,i,a,s){var c=l(t[o],t,i);if("throw"!==c.type){var u=c.arg,f=u.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(f).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,s)}))}s(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function A(e,r,n){var o=p;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var c=$(s,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var u=l(e,r,n);if("normal"===u.type){if(o=n.done?m:h,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=m,n.method="throw",n.arg=u.arg)}}}function $(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,$(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=l(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function D(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function F(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=b,o(P,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:w,configurable:!0}),w.displayName=u(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,c,"GeneratorFunction")),t.prototype=Object.create(P),t},e.awrap=function(t){return{__await:t}},T(C.prototype),u(C.prototype,s,(function(){return this})),e.AsyncIterator=C,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new C(f(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},T(P),u(P,c,"Generator"),u(P,a,(function(){return this})),u(P,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=F,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(D),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),D(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;D(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:F(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}function h(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}function m(t){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},m(t)}function y(e,r){if(e){if("string"==typeof e)return t(e,r);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}function g(t){var e="function"==typeof Map?new Map:void 0;return g=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return function(t,e,r){if(l())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&p(o,r.prototype),o}(t,arguments,u(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),p(r,t)},g(t)}var w,b,E=Object.create,k=Object.defineProperty,_=Object.defineProperties,P=Object.getOwnPropertyDescriptor,T=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertyNames,A=Object.getOwnPropertySymbols,$=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable,O=function(t,e,r){return e in t?k(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r},F=function(t,e){for(var r in e||(e={}))S.call(e,r)&&O(t,r,e[r]);if(A){var n,o=s(A(e));try{for(o.s();!(n=o.n()).done;){r=n.value;D.call(e,r)&&O(t,r,e[r])}}catch(t){o.e(t)}finally{o.f()}}return t},j=function(t,e){return _(t,T(e))},x=function(t,e,r,n){for(var o,i=P(e,r),a=t.length-1;a>=0;a--)(o=t[a])&&(i=o(e,r,i)||i);return i&&k(e,r,i),i},M=function(t,e,r){return O(t,"symbol"!==m(e)?e+"":e,r)},R=(w={"../node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.js":function(t,e){var r=Object.prototype.hasOwnProperty,n="~";function o(){}function i(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function a(t,e,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||t,a),c=n?n+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],s]:t._events[c].push(s):(t._events[c]=s,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new o:delete t._events[e]}function c(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),c.prototype.eventNames=function(){var t,e,o=[];if(0===this._eventsCount)return o;for(e in t=this._events)r.call(t,e)&&o.push(n?e.slice(1):e);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},c.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,a=new Array(i);o<i;o++)a[o]=r[o].fn;return a},c.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},c.prototype.emit=function(t,e,r,o,i,a){var s=n?n+t:t;if(!this._events[s])return!1;var c,u,f=this._events[s],l=arguments.length;if(f.fn){switch(f.once&&this.removeListener(t,f.fn,void 0,!0),l){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,e),!0;case 3:return f.fn.call(f.context,e,r),!0;case 4:return f.fn.call(f.context,e,r,o),!0;case 5:return f.fn.call(f.context,e,r,o,i),!0;case 6:return f.fn.call(f.context,e,r,o,i,a),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];f.fn.apply(f.context,c)}else{var d,p=f.length;for(u=0;u<p;u++)switch(f[u].once&&this.removeListener(t,f[u].fn,void 0,!0),l){case 1:f[u].fn.call(f[u].context);break;case 2:f[u].fn.call(f[u].context,e);break;case 3:f[u].fn.call(f[u].context,e,r);break;case 4:f[u].fn.call(f[u].context,e,r,o);break;default:if(!c)for(d=1,c=new Array(l-1);d<l;d++)c[d-1]=arguments[d];f[u].fn.apply(f[u].context,c)}}return!0},c.prototype.on=function(t,e,r){return a(this,t,e,r,!1)},c.prototype.once=function(t,e,r){return a(this,t,e,r,!0)},c.prototype.removeListener=function(t,e,r,o){var i=n?n+t:t;if(!this._events[i])return this;if(!e)return s(this,i),this;var a=this._events[i];if(a.fn)a.fn!==e||o&&!a.once||r&&a.context!==r||s(this,i);else{for(var c=0,u=[],f=a.length;c<f;c++)(a[c].fn!==e||o&&!a[c].once||r&&a[c].context!==r)&&u.push(a[c]);u.length?this._events[i]=1===u.length?u[0]:u:s(this,i)}return this},c.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&s(this,e)):(this._events=new o,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=n,c.EventEmitter=c,void 0!==e&&(e.exports=c)}},function(){return b||(0,w[C(w)[0]])((b={exports:{}}).exports,b),b.exports}),W=function(t,e,r){return r=null!=t?E($(t)):{},function(t,e,r,n){if(e&&"object"===m(e)||"function"==typeof e){var o,i=s(C(e));try{var a=function(){var i=o.value;S.call(t,i)||i===r||k(t,i,{get:function(){return e[i]},enumerable:!(n=P(e,i))||n.enumerable})};for(i.s();!(o=i.n()).done;)a()}catch(t){i.e(t)}finally{i.f()}}return t}(k(r,"default",{value:t,enumerable:!0}),t)}(R()),I=Symbol("instance"),z=Symbol("cacheResult"),L=function(){return a((function t(e,r,n){o(this,t),this.oldState=e,this.newState=r,this.action=n,this.aborted=!1}),[{key:"abort",value:function(t){this.aborted=!0,q.call(t,this.oldState,new Error("action '".concat(this.action,"' aborted")))}},{key:"toString",value:function(){return"".concat(this.action,"ing")}}])}(),U=function(t){function e(t,r,i){var a;return o(this,e),(a=n(this,e,[r])).state=t,a.message=r,a.cause=i,a}return f(e,t),a(e)}(g(Error));var N=new Map;function B(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(n,o,i){var a=r.action||o;if(!r.context){var s=N.get(n)||[];N.has(n)||N.set(n,s),s.push({from:t,to:e,action:a})}var c=i.value;i.value=function(){for(var n,o=this,i=this,s=arguments.length,u=new Array(s),f=0;f<s;f++)u[f]=arguments[f];r.context&&(i=X.get("function"==typeof r.context?(n=r.context).call.apply(n,[this].concat(u)):r.context));if(i.state===e)return r.sync?i[z]:Promise.resolve(i[z]);i.state instanceof L&&i.state.action==r.abortAction&&i.state.abort(i);var l=null;Array.isArray(t)?0==t.length?i.state instanceof L&&i.state.abort(i):"string"==typeof i.state&&t.includes(i.state)||(l=new U(i._state,"".concat(i.name," ").concat(a," to ").concat(e," failed: current state ").concat(i._state," not from ").concat(t.join("|")))):t!==i.state&&(l=new U(i._state,"".concat(i.name," ").concat(a," to ").concat(e," failed: current state ").concat(i._state," not from ").concat(t)));var d=function(t){if(r.fail&&r.fail.call(o,t),r.sync){if(r.ignoreError)return t;throw t}return r.ignoreError?Promise.resolve(t):Promise.reject(t)};if(l)return d(l);var p=i.state,h=new L(p,e,a);q.call(i,h);var v,y=function(t){var n;return i[z]=t,h.aborted||(q.call(i,e),null===(n=r.success)||void 0===n||n.call(o,i[z])),t},g=function(t){return q.call(i,p,t),d(t)};try{var w=c.apply(this,u);return"object"===m(v=w)&&v&&"then"in v?w.then(y).catch(g):r.sync?y(w):Promise.resolve(y(w))}catch(r){return g(new U(i._state,"".concat(i.name," ").concat(a," from ").concat(t," to ").concat(e," failed: ").concat(r),r instanceof Error?r:new Error(String(r))))}}}}var H,V,G=(H="undefined"!=typeof window&&window.__AFSM__,V="undefined"!=typeof importScripts,H?function(t,e){window.dispatchEvent(new CustomEvent(t,{detail:e}))}:V?function(t,e){postMessage({type:t,payload:e})}:function(){});function q(t,e){var r=this._state;this._state=t;var n=t.toString();t&&this.emit(n,r),this.emit(X.STATECHANGED,t,r,e),this.updateDevTools({value:t,old:r,err:e instanceof Error?e.message:String(e)})}var X=function(t){function e(t,r,i){var a;o(this,e),(a=n(this,e)).name=t,a.groupName=r,a._state=e.INIT,t||(t=Date.now().toString(36)),i?Object.setPrototypeOf(a,i):i=Object.getPrototypeOf(a),r||(a.groupName=a.constructor.name);var s=i[I];return s?a.name=s.name+"-"+s.count++:i[I]={name:a.name,count:0},a.updateDevTools({diagram:a.stateDiagram}),a}return f(e,t),a(e,[{key:"stateDiagram",get:function(){var t=Object.getPrototypeOf(this),e=N.get(t)||[],r=new Set,n=[],o=[],i=new Set,a=Object.getPrototypeOf(t);N.has(a)&&(a.stateDiagram.forEach((function(t){return r.add(t)})),a.allStates.forEach((function(t){return i.add(t)}))),e.forEach((function(t){var e=t.from,r=t.to,i=t.action;"string"==typeof e?n.push({from:e,to:r,action:i}):e.length?e.forEach((function(t){n.push({from:t,to:r,action:i})})):o.push({to:r,action:i})})),n.forEach((function(t){var e=t.from,n=t.to,o=t.action;i.add(e),i.add(n),i.add(o+"ing"),r.add("".concat(e," --\x3e ").concat(o,"ing : ").concat(o)),r.add("".concat(o,"ing --\x3e ").concat(n," : ").concat(o," 🟢")),r.add("".concat(o,"ing --\x3e ").concat(e," : ").concat(o," 🔴"))})),o.forEach((function(t){var e=t.to,n=t.action;r.add("".concat(n,"ing --\x3e ").concat(e," : ").concat(n," 🟢")),i.forEach((function(t){t!==e&&r.add("".concat(t," --\x3e ").concat(n,"ing : ").concat(n))}))}));var s=h(r);return Object.defineProperties(t,{stateDiagram:{value:s},allStates:{value:i}}),s}},{key:"updateDevTools",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};G(e.UPDATEAFSM,Object.assign({name:this.name,group:this.groupName},t))}},{key:"state",get:function(){return this._state},set:function(t){q.call(this,t)}}],[{key:"get",value:function(t){var r;return"string"==typeof t?(r=e.instances.get(t))||e.instances.set(t,r=new e(t,void 0,Object.create(e.prototype))):(r=e.instances2.get(t))||e.instances2.set(t,r=new e(t.constructor.name,void 0,Object.create(e.prototype))),r}},{key:"getState",value:function(t){var r;return null===(r=e.get(t))||void 0===r?void 0:r.state}}])}(W.default);X.STATECHANGED="stateChanged",X.UPDATEAFSM="updateAFSM",X.INIT="[*]",X.ON="on",X.OFF="off",X.instances=new Map,X.instances2=new WeakMap;var K=function(t){function e(){var t;return o(this,e),t=n(this,e,arguments),M(t,"decoder"),M(t,"config"),t}return f(e,t),a(e,[{key:"initialize",value:(i=r(d().mark((function t(){var e=this;return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.decoder=new VideoDecoder({output:function(t){e.emit("videoFrame",t)},error:function(t){e.close(),e.emit("error",t)}});case 1:case"end":return t.stop()}}),t,this)}))),function(){return i.apply(this,arguments)})},{key:"configure",value:function(t){this.config=t,this.decoder.configure(j(F({},t),{codec:this.getCodec(t)}))}},{key:"getCodec",value:function(t){switch(t.codec){case"hevc":return"hvc1.1.6.L0.12.34.56.78.9A.BC";case"av1":return"av01.0.05M.08";case"avc":return"avc1.420028";default:return t.codec}}},{key:"decode",value:function(t){"configured"===this.decoder.state&&this.decoder.decode(new EncodedVideoChunk(t))}},{key:"flush",value:function(){this.decoder.flush()}},{key:"reset",value:function(){this.decoder.reset()}},{key:"close",value:function(){"closed"!==this.decoder.state&&this.decoder.close()}}]);var i}(X);function J(){var t;self.onmessage=function(e){if("init"===e.data.type){var r=e.data,n=r.canvas,o=r.wasmScript,i=r.wasmBinary,a=null==n?void 0:n.getContext("2d"),s=0,c=0,u={wasmBinary:i,postRun:function(){t=new u.VideoDecoder({videoInfo:function(t,e){s=t,c=e,console.log("video info",t,e)},yuvData:function(t,e){var r=s*c,o=r>>2,i=u.HEAPU32[t>>2],f=u.HEAPU32[1+(t>>2)],l=u.HEAPU32[2+(t>>2)],d=u.HEAPU8.subarray(i,i+r),p=u.HEAPU8.subarray(f,f+o),h=u.HEAPU8.subarray(l,l+o),v=new Uint8Array(r+o+o);v.set(d),v.set(p,r),v.set(h,r+o);var m=new VideoFrame(v,{codedWidth:s,codedHeight:c,format:"I420",timestamp:e});n?(null==a||a.drawImage(m,0,0,n.width,n.height),null==a||a.commit()):self.postMessage({type:"yuvData",videoFrame:m},[m])}}),self.postMessage({type:"ready"})}};Function("var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;return "+o)()(u)}else if("decode"===e.data.type){var f=e.data.packet;null==t||t.decode(f.data,"key"==f.type,f.timestamp)}else if("setCodec"===e.data.type){var l=e.data,d=l.codec,p=l.format,h=l.description;null==t||t.setCodec(d,p,null!=h?h:"")}}}x([B([X.INIT,"closed"],"initialized")],K.prototype,"initialize"),x([B("initialized","configured",{sync:!0})],K.prototype,"configure"),x([function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(t,r,n){var o=n.value,i=r;n.value=function(){if(!e.includes(this.state.toString()))throw new U(this.state,"".concat(this.name," ").concat(i," failed: current state ").concat(this.state," not in ").concat(e));for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return o.apply(this,r)}}}("configured")],K.prototype,"decode"),x([B([],X.INIT)],K.prototype,"reset"),x([B([],"closed",{ignoreError:!0,sync:!0})],K.prototype,"close");var Y=function(t){function e(t,r){var i,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0,c=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return o(this,e),(i=n(this,e)).createModule=t,i.wasmBinary=r,i.workerMode=a,i.canvas=s,i.yuvMode=c,M(i,"worker"),M(i,"decoder"),M(i,"config"),M(i,"module",{}),M(i,"width",0),M(i,"height",0),i}return f(e,t),a(e,[{key:"initialize",value:(i=r(d().mark((function t(e){var r,n,o,i,a,s=this;return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.workerMode){t.next=10;break}return n=new RegExp("\\{(.+)\\}","s").exec(J.toString())[1],this.worker=new Worker(URL.createObjectURL(new Blob([n],{type:"text/javascript"}))),o=null==(r=this.canvas)?void 0:r.transferControlToOffscreen(),t.next=6,this.wasmBinary;case 6:return i=t.sent,console.warn("worker mode",i),this.worker.postMessage({type:"init",canvas:o,wasmScript:this.createModule.toString(),wasmBinary:i},o?[o,i]:[i]),t.abrupt("return",new Promise((function(t){s.worker.onmessage=function(e){if("ready"===e.data.type)delete s.wasmBinary,t(),console.warn("worker mode initialize success");else if("yuvData"===e.data.type){var r=e.data.videoFrame;s.emit("videoFrame",r)}}})));case 10:if(a=this.module,!this.wasmBinary){t.next=15;break}return t.next=14,this.wasmBinary;case 14:a.wasmBinary=t.sent;case 15:return a.print=function(t){return console.log(t)},a.printErr=function(t){return console.log("[JS] ERROR: ".concat(t))},a.onAbort=function(){return console.log("[JS] FATAL: WASM ABORTED")},t.abrupt("return",new Promise((function(t){a.postRun=function(e){s.decoder=new s.module.VideoDecoder(s),console.log("video soft decoder initialize success"),t()},e&&Object.assign(a,e),s.createModule(a)})));case 19:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"configure",value:function(t){var e,r,n;this.config=t,null==(r=this.decoder)||r.setCodec(this.config.codec,this.config.description?"avcc":"annexb",null!=(e=this.config.description)?e:""),null==(n=this.worker)||n.postMessage({type:"setCodec",codec:this.config.codec,format:this.config.description?"avcc":"annexb",description:this.config.description})}},{key:"decode",value:function(t){var e,r;null==(e=this.decoder)||e.decode(t.data,"key"==t.type,t.timestamp),"configured"===this.state&&(null==(r=this.worker)||r.postMessage({type:"decode",packet:t}))}},{key:"flush",value:function(){}},{key:"reset",value:function(){this.config=void 0,this.decoder&&this.decoder.clear()}},{key:"close",value:function(){this.removeAllListeners(),this.decoder&&(this.decoder.clear(),this.decoder.delete())}},{key:"videoInfo",value:function(t,e){this.width=t,this.height=e;var r={width:t,height:e};this.emit("videoCodecInfo",r)}},{key:"yuvData",value:function(t,e){if(this.module){var r=this.width*this.height,n=r>>2,o=this.module.HEAPU32[t>>2],i=this.module.HEAPU32[1+(t>>2)],a=this.module.HEAPU32[2+(t>>2)],s=this.module.HEAPU8.subarray(o,o+r),c=this.module.HEAPU8.subarray(i,i+n),u=this.module.HEAPU8.subarray(a,a+n);if(this.yuvMode)this.emit("videoFrame",[s,c,u]);else{var f=new Uint8Array(r+n+n);f.set(s),f.set(c,r),f.set(u,r+n),this.emit("videoFrame",new VideoFrame(f,{codedWidth:this.width,codedHeight:this.height,format:"I420",timestamp:e}))}}}},{key:"errorInfo",value:function(t){var e={errMsg:t};this.emit("error",e)}}]);var i}(X);x([B([X.INIT,"closed"],"initialized")],Y.prototype,"initialize"),x([B("initialized","configured")],Y.prototype,"configure"),x([B([],X.INIT)],Y.prototype,"reset"),x([B([],"closed")],Y.prototype,"close");var Z,Q=(Z="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(){var t,e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=r;i.ready=new Promise((function(r,n){t=r,e=n}));var s=Object.assign({},i),u="./this.program",l="object"==("undefined"==typeof window?"undefined":m(window)),d="function"==typeof importScripts;"object"==("undefined"==typeof process?"undefined":m(process))&&"object"==m(process.versions)&&process.versions.node;var p,h,v,y="";(l||d)&&(d?y=self.location.href:"undefined"!=typeof document&&document.currentScript&&(y=document.currentScript.src),Z&&(y=Z),y=0!==y.indexOf("blob:")?y.substr(0,y.replace(/[?#].*/,"").lastIndexOf("/")+1):"",p=function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},d&&(v=function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),h=function(t,e,r){var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?e(n.response):r()},n.onerror=r,n.send(null)});var w,b,E,k=i.print||console.log.bind(console),_=i.printErr||console.error.bind(console);Object.assign(i,s),s=null,i.arguments&&i.arguments,i.thisProgram&&(u=i.thisProgram),i.quit&&i.quit,i.wasmBinary&&(w=i.wasmBinary),i.noExitRuntime,"object"!=("undefined"==typeof WebAssembly?"undefined":m(WebAssembly))&&B("no native wasm support detected");var P,T,C,A,$,S,D,O,F,j=!1,x=[],M=[],R=[];function W(t){x.unshift(t)}function I(t){R.unshift(t)}var z=0,L=null;function U(t){z++,i.monitorRunDependencies&&i.monitorRunDependencies(z)}function N(t){if(z--,i.monitorRunDependencies&&i.monitorRunDependencies(z),0==z&&L){var e=L;L=null,e()}}function B(t){i.onAbort&&i.onAbort(t),_(t="Aborted("+t+")"),j=!0,t+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(t);throw e(r),r}var H,V,G,q,X="data:application/octet-stream;base64,";function K(t){return t.startsWith(X)}function J(t){if(t==H&&w)return new Uint8Array(w);if(v)return v(t);throw"both async and sync fetching of the wasm failed"}function Y(t,e,r){return function(t){return w||!l&&!d||"function"!=typeof fetch?Promise.resolve().then((function(){return J(t)})):fetch(t,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+t+"'";return e.arrayBuffer()})).catch((function(){return J(t)}))}(t).then((function(t){return WebAssembly.instantiate(t,e)})).then((function(t){return t})).then(r,(function(t){_("failed to asynchronously prepare wasm: "+t),B(t)}))}K(H="videodec.wasm")||(V=H,H=i.locateFile?i.locateFile(V,y):y+V);var Q=function(t){for(;t.length>0;)t.shift()(i)};function tt(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){S[this.ptr+4>>2]=t},this.get_type=function(){return S[this.ptr+4>>2]},this.set_destructor=function(t){S[this.ptr+8>>2]=t},this.get_destructor=function(){return S[this.ptr+8>>2]},this.set_caught=function(t){t=t?1:0,P[this.ptr+12|0]=t},this.get_caught=function(){return 0!=P[this.ptr+12|0]},this.set_rethrown=function(t){t=t?1:0,P[this.ptr+13|0]=t},this.get_rethrown=function(){return 0!=P[this.ptr+13|0]},this.init=function(t,e){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(e)},this.set_adjusted_ptr=function(t){S[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return S[this.ptr+16>>2]},this.get_exception_ptr=function(){if(ir(this.get_type()))return S[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}var et={isAbs:function(t){return"/"===t.charAt(0)},splitPath:function(t){return/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(t).slice(1)},normalizeArray:function(t,e){for(var r=0,n=t.length-1;n>=0;n--){var o=t[n];"."===o?t.splice(n,1):".."===o?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r;r--)t.unshift("..");return t},normalize:function(t){var e=et.isAbs(t),r="/"===t.substr(-1);return(t=et.normalizeArray(t.split("/").filter((function(t){return!!t})),!e).join("/"))||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t},dirname:function(t){var e=et.splitPath(t),r=e[0],n=e[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},basename:function(t){if("/"===t)return"/";var e=(t=(t=et.normalize(t)).replace(/\/$/,"")).lastIndexOf("/");return-1===e?t:t.substr(e+1)},join:function(){var t=Array.prototype.slice.call(arguments);return et.normalize(t.join("/"))},join2:function(t,e){return et.normalize(t+"/"+e)}},rt=function(t){return(rt=function(){if("object"==("undefined"==typeof crypto?"undefined":m(crypto))&&"function"==typeof crypto.getRandomValues)return function(t){return crypto.getRandomValues(t)};B("initRandomDevice")}())(t)},nt={resolve:function(){for(var t="",e=!1,r=arguments.length-1;r>=-1&&!e;r--){var n=r>=0?arguments[r]:mt.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";t=n+"/"+t,e=et.isAbs(n)}return(e?"/":"")+(t=et.normalizeArray(t.split("/").filter((function(t){return!!t})),!e).join("/"))||"."},relative:function(t,e){function r(t){for(var e=0;e<t.length&&""===t[e];e++);for(var r=t.length-1;r>=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=nt.resolve(t).substr(1),e=nt.resolve(e).substr(1);for(var n=r(t.split("/")),o=r(e.split("/")),i=Math.min(n.length,o.length),a=i,s=0;s<i;s++)if(n[s]!==o[s]){a=s;break}var c=[];for(s=a;s<n.length;s++)c.push("..");return(c=c.concat(o.slice(a))).join("/")}},ot="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,it=function(t,e,r){for(var n=e+r,o=e;t[o]&&!(o>=n);)++o;if(o-e>16&&t.buffer&&ot)return ot.decode(t.subarray(e,o));for(var i="";e<o;){var a=t[e++];if(128&a){var s=63&t[e++];if(192!=(224&a)){var c=63&t[e++];if((a=224==(240&a)?(15&a)<<12|s<<6|c:(7&a)<<18|s<<12|c<<6|63&t[e++])<65536)i+=String.fromCharCode(a);else{var u=a-65536;i+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else i+=String.fromCharCode((31&a)<<6|s)}else i+=String.fromCharCode(a)}return i},at=[],st=function(t){for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);n<=127?e++:n<=2047?e+=2:n>=55296&&n<=57343?(e+=4,++r):e+=3}return e},ct=function(t,e,r,n){if(!(n>0))return 0;for(var o=r,i=r+n-1,a=0;a<t.length;++a){var s=t.charCodeAt(a);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&t.charCodeAt(++a)),s<=127){if(r>=i)break;e[r++]=s}else if(s<=2047){if(r+1>=i)break;e[r++]=192|s>>6,e[r++]=128|63&s}else if(s<=65535){if(r+2>=i)break;e[r++]=224|s>>12,e[r++]=128|s>>6&63,e[r++]=128|63&s}else{if(r+3>=i)break;e[r++]=240|s>>18,e[r++]=128|s>>12&63,e[r++]=128|s>>6&63,e[r++]=128|63&s}}return e[r]=0,r-o};function ut(t,e,r){var n=st(t)+1,o=new Array(n),i=ct(t,o,0,o.length);return o.length=i,o}var ft={ttys:[],init:function(){},shutdown:function(){},register:function(t,e){ft.ttys[t]={input:[],output:[],ops:e},mt.registerDevice(t,ft.stream_ops)},stream_ops:{open:function(t){var e=ft.ttys[t.node.rdev];if(!e)throw new mt.ErrnoError(43);t.tty=e,t.seekable=!1},close:function(t){t.tty.ops.fsync(t.tty)},fsync:function(t){t.tty.ops.fsync(t.tty)},read:function(t,e,r,n,o){if(!t.tty||!t.tty.ops.get_char)throw new mt.ErrnoError(60);for(var i=0,a=0;a<n;a++){var s;try{s=t.tty.ops.get_char(t.tty)}catch(t){throw new mt.ErrnoError(29)}if(void 0===s&&0===i)throw new mt.ErrnoError(6);if(null==s)break;i++,e[r+a]=s}return i&&(t.node.timestamp=Date.now()),i},write:function(t,e,r,n,o){if(!t.tty||!t.tty.ops.put_char)throw new mt.ErrnoError(60);try{for(var i=0;i<n;i++)t.tty.ops.put_char(t.tty,e[r+i])}catch(t){throw new mt.ErrnoError(29)}return n&&(t.node.timestamp=Date.now()),i}},default_tty_ops:{get_char:function(t){return function(){if(!at.length){var t=null;if("undefined"!=typeof window&&"function"==typeof window.prompt?null!==(t=window.prompt("Input: "))&&(t+="\n"):"function"==typeof readline&&null!==(t=readline())&&(t+="\n"),!t)return null;at=ut(t)}return at.shift()}()},put_char:function(t,e){null===e||10===e?(k(it(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},fsync:function(t){t.output&&t.output.length>0&&(k(it(t.output,0)),t.output=[])},ioctl_tcgets:function(t){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets:function(t,e,r){return 0},ioctl_tiocgwinsz:function(t){return[24,80]}},default_tty1_ops:{put_char:function(t,e){null===e||10===e?(_(it(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},fsync:function(t){t.output&&t.output.length>0&&(_(it(t.output,0)),t.output=[])}}},lt=function(t){B()},dt={ops_table:null,mount:function(t){return dt.createNode(null,"/",16895,0)},createNode:function(t,e,r,n){if(mt.isBlkdev(r)||mt.isFIFO(r))throw new mt.ErrnoError(63);dt.ops_table||(dt.ops_table={dir:{node:{getattr:dt.node_ops.getattr,setattr:dt.node_ops.setattr,lookup:dt.node_ops.lookup,mknod:dt.node_ops.mknod,rename:dt.node_ops.rename,unlink:dt.node_ops.unlink,rmdir:dt.node_ops.rmdir,readdir:dt.node_ops.readdir,symlink:dt.node_ops.symlink},stream:{llseek:dt.stream_ops.llseek}},file:{node:{getattr:dt.node_ops.getattr,setattr:dt.node_ops.setattr},stream:{llseek:dt.stream_ops.llseek,read:dt.stream_ops.read,write:dt.stream_ops.write,allocate:dt.stream_ops.allocate,mmap:dt.stream_ops.mmap,msync:dt.stream_ops.msync}},link:{node:{getattr:dt.node_ops.getattr,setattr:dt.node_ops.setattr,readlink:dt.node_ops.readlink},stream:{}},chrdev:{node:{getattr:dt.node_ops.getattr,setattr:dt.node_ops.setattr},stream:mt.chrdev_stream_ops}});var o=mt.createNode(t,e,r,n);return mt.isDir(o.mode)?(o.node_ops=dt.ops_table.dir.node,o.stream_ops=dt.ops_table.dir.stream,o.contents={}):mt.isFile(o.mode)?(o.node_ops=dt.ops_table.file.node,o.stream_ops=dt.ops_table.file.stream,o.usedBytes=0,o.contents=null):mt.isLink(o.mode)?(o.node_ops=dt.ops_table.link.node,o.stream_ops=dt.ops_table.link.stream):mt.isChrdev(o.mode)&&(o.node_ops=dt.ops_table.chrdev.node,o.stream_ops=dt.ops_table.chrdev.stream),o.timestamp=Date.now(),t&&(t.contents[e]=o,t.timestamp=o.timestamp),o},getFileDataAsTypedArray:function(t){return t.contents?t.contents.subarray?t.contents.subarray(0,t.usedBytes):new Uint8Array(t.contents):new Uint8Array(0)},expandFileStorage:function(t,e){var r=t.contents?t.contents.length:0;if(!(r>=e)){e=Math.max(e,r*(r<1048576?2:1.125)>>>0),0!=r&&(e=Math.max(e,256));var n=t.contents;t.contents=new Uint8Array(e),t.usedBytes>0&&t.contents.set(n.subarray(0,t.usedBytes),0)}},resizeFileStorage:function(t,e){if(t.usedBytes!=e)if(0==e)t.contents=null,t.usedBytes=0;else{var r=t.contents;t.contents=new Uint8Array(e),r&&t.contents.set(r.subarray(0,Math.min(e,t.usedBytes))),t.usedBytes=e}},node_ops:{getattr:function(t){var e={};return e.dev=mt.isChrdev(t.mode)?t.id:1,e.ino=t.id,e.mode=t.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=t.rdev,mt.isDir(t.mode)?e.size=4096:mt.isFile(t.mode)?e.size=t.usedBytes:mt.isLink(t.mode)?e.size=t.link.length:e.size=0,e.atime=new Date(t.timestamp),e.mtime=new Date(t.timestamp),e.ctime=new Date(t.timestamp),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr:function(t,e){void 0!==e.mode&&(t.mode=e.mode),void 0!==e.timestamp&&(t.timestamp=e.timestamp),void 0!==e.size&&dt.resizeFileStorage(t,e.size)},lookup:function(t,e){throw mt.genericErrors[44]},mknod:function(t,e,r,n){return dt.createNode(t,e,r,n)},rename:function(t,e,r){if(mt.isDir(t.mode)){var n;try{n=mt.lookupNode(e,r)}catch(t){}if(n)for(var o in n.contents)throw new mt.ErrnoError(55)}delete t.parent.contents[t.name],t.parent.timestamp=Date.now(),t.name=r,e.contents[r]=t,e.timestamp=t.parent.timestamp,t.parent=e},unlink:function(t,e){delete t.contents[e],t.timestamp=Date.now()},rmdir:function(t,e){var r=mt.lookupNode(t,e);for(var n in r.contents)throw new mt.ErrnoError(55);delete t.contents[e],t.timestamp=Date.now()},readdir:function(t){var e=[".",".."];for(var r in t.contents)t.contents.hasOwnProperty(r)&&e.push(r);return e},symlink:function(t,e,r){var n=dt.createNode(t,e,41471,0);return n.link=r,n},readlink:function(t){if(!mt.isLink(t.mode))throw new mt.ErrnoError(28);return t.link}},stream_ops:{read:function(t,e,r,n,o){var i=t.node.contents;if(o>=t.node.usedBytes)return 0;var a=Math.min(t.node.usedBytes-o,n);if(a>8&&i.subarray)e.set(i.subarray(o,o+a),r);else for(var s=0;s<a;s++)e[r+s]=i[o+s];return a},write:function(t,e,r,n,o,i){if(!n)return 0;var a=t.node;if(a.timestamp=Date.now(),e.subarray&&(!a.contents||a.contents.subarray)){if(i)return a.contents=e.subarray(r,r+n),a.usedBytes=n,n;if(0===a.usedBytes&&0===o)return a.contents=e.slice(r,r+n),a.usedBytes=n,n;if(o+n<=a.usedBytes)return a.contents.set(e.subarray(r,r+n),o),n}if(dt.expandFileStorage(a,o+n),a.contents.subarray&&e.subarray)a.contents.set(e.subarray(r,r+n),o);else for(var s=0;s<n;s++)a.contents[o+s]=e[r+s];return a.usedBytes=Math.max(a.usedBytes,o+n),n},llseek:function(t,e,r){var n=e;if(1===r?n+=t.position:2===r&&mt.isFile(t.node.mode)&&(n+=t.node.usedBytes),n<0)throw new mt.ErrnoError(28);return n},allocate:function(t,e,r){dt.expandFileStorage(t.node,e+r),t.node.usedBytes=Math.max(t.node.usedBytes,e+r)},mmap:function(t,e,r,n,o){if(!mt.isFile(t.node.mode))throw new mt.ErrnoError(43);var i,a,s=t.node.contents;if(2&o||s.buffer!==P.buffer){if((r>0||r+e<s.length)&&(s=s.subarray?s.subarray(r,r+e):Array.prototype.slice.call(s,r,r+e)),a=!0,!(i=lt()))throw new mt.ErrnoError(48);P.set(s,i)}else a=!1,i=s.byteOffset;return{ptr:i,allocated:a}},msync:function(t,e,r,n,o){return dt.stream_ops.write(t,e,0,n,r,!1),0}}},pt=function(t,e,r,n){var o="al ".concat(t);h(t,(function(r){var n,i;n=r,i='Loading data file "'.concat(t,'" failed (no arrayBuffer).'),n||B(i),e(new Uint8Array(r)),o&&N()}),(function(e){if(!r)throw'Loading data file "'.concat(t,'" failed.');r()})),o&&U()},ht=i.preloadPlugins||[];function vt(t,e){var r=0;return t&&(r|=365),e&&(r|=146),r}var mt={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(t=nt.resolve(t)))return{path:"",node:null};if((e=Object.assign({follow_mount:!0,recurse_count:0},e)).recurse_count>8)throw new mt.ErrnoError(32);for(var r=t.split("/").filter((function(t){return!!t})),n=mt.root,o="/",i=0;i<r.length;i++){var a=i===r.length-1;if(a&&e.parent)break;if(n=mt.lookupNode(n,r[i]),o=et.join2(o,r[i]),mt.isMountpoint(n)&&(!a||a&&e.follow_mount)&&(n=n.mounted.root),!a||e.follow)for(var s=0;mt.isLink(n.mode);){var c=mt.readlink(o);if(o=nt.resolve(et.dirname(o),c),n=mt.lookupPath(o,{recurse_count:e.recurse_count+1}).node,s++>40)throw new mt.ErrnoError(32)}}return{path:o,node:n}},getPath:function(t){for(var e;;){if(mt.isRoot(t)){var r=t.mount.mountpoint;return e?"/"!==r[r.length-1]?"".concat(r,"/").concat(e):r+e:r}e=e?"".concat(t.name,"/").concat(e):t.name,t=t.parent}},hashName:function(t,e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n)|0;return(t+r>>>0)%mt.nameTable.length},hashAddNode:function(t){var e=mt.hashName(t.parent.id,t.name);t.name_next=mt.nameTable[e],mt.nameTable[e]=t},hashRemoveNode:function(t){var e=mt.hashName(t.parent.id,t.name);if(mt.nameTable[e]===t)mt.nameTable[e]=t.name_next;else for(var r=mt.nameTable[e];r;){if(r.name_next===t){r.name_next=t.name_next;break}r=r.name_next}},lookupNode:function(t,e){var r=mt.mayLookup(t);if(r)throw new mt.ErrnoError(r,t);for(var n=mt.hashName(t.id,e),o=mt.nameTable[n];o;o=o.name_next){var i=o.name;if(o.parent.id===t.id&&i===e)return o}return mt.lookup(t,e)},createNode:function(t,e,r,n){var o=new mt.FSNode(t,e,r,n);return mt.hashAddNode(o),o},destroyNode:function(t){mt.hashRemoveNode(t)},isRoot:function(t){return t===t.parent},isMountpoint:function(t){return!!t.mounted},isFile:function(t){return 32768==(61440&t)},isDir:function(t){return 16384==(61440&t)},isLink:function(t){return 40960==(61440&t)},isChrdev:function(t){return 8192==(61440&t)},isBlkdev:function(t){return 24576==(61440&t)},isFIFO:function(t){return 4096==(61440&t)},isSocket:function(t){return!(49152&~t)},flagsToPermissionString:function(t){var e=["r","w","rw"][3&t];return 512&t&&(e+="w"),e},nodePermissions:function(t,e){return mt.ignorePermissions||(!e.includes("r")||292&t.mode)&&(!e.includes("w")||146&t.mode)&&(!e.includes("x")||73&t.mode)?0:2},mayLookup:function(t){var e=mt.nodePermissions(t,"x");return e||(t.node_ops.lookup?0:2)},mayCreate:function(t,e){try{return mt.lookupNode(t,e),20}catch(t){}return mt.nodePermissions(t,"wx")},mayDelete:function(t,e,r){var n;try{n=mt.lookupNode(t,e)}catch(t){return t.errno}var o=mt.nodePermissions(t,"wx");if(o)return o;if(r){if(!mt.isDir(n.mode))return 54;if(mt.isRoot(n)||mt.getPath(n)===mt.cwd())return 10}else if(mt.isDir(n.mode))return 31;return 0},mayOpen:function(t,e){return t?mt.isLink(t.mode)?32:mt.isDir(t.mode)&&("r"!==mt.flagsToPermissionString(e)||512&e)?31:mt.nodePermissions(t,mt.flagsToPermissionString(e)):44},MAX_OPEN_FDS:4096,nextfd:function(){for(var t=0;t<=mt.MAX_OPEN_FDS;t++)if(!mt.streams[t])return t;throw new mt.ErrnoError(33)},getStreamChecked:function(t){var e=mt.getStream(t);if(!e)throw new mt.ErrnoError(8);return e},getStream:function(t){return mt.streams[t]},createStream:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return mt.FSStream||(mt.FSStream=function(){this.shared={}},mt.FSStream.prototype={},Object.defineProperties(mt.FSStream.prototype,{object:{get:function(){return this.node},set:function(t){this.node=t}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return!!(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}},flags:{get:function(){return this.shared.flags},set:function(t){this.shared.flags=t}},position:{get:function(){return this.shared.position},set:function(t){this.shared.position=t}}})),t=Object.assign(new mt.FSStream,t),-1==e&&(e=mt.nextfd()),t.fd=e,mt.streams[e]=t,t},closeStream:function(t){mt.streams[t]=null},chrdev_stream_ops:{open:function(t){var e=mt.getDevice(t.node.rdev);t.stream_ops=e.stream_ops,t.stream_ops.open&&t.stream_ops.open(t)},llseek:function(){throw new mt.ErrnoError(70)}},major:function(t){return t>>8},minor:function(t){return 255&t},makedev:function(t,e){return t<<8|e},registerDevice:function(t,e){mt.devices[t]={stream_ops:e}},getDevice:function(t){return mt.devices[t]},getMounts:function(t){for(var e=[],r=[t];r.length;){var n=r.pop();e.push(n),r.push.apply(r,n.mounts)}return e},syncfs:function(t,e){"function"==typeof t&&(e=t,t=!1),mt.syncFSRequests++,mt.syncFSRequests>1&&_("warning: ".concat(mt.syncFSRequests," FS.syncfs operations in flight at once, probably just doing extra work"));var r=mt.getMounts(mt.root.mount),n=0;function o(t){return mt.syncFSRequests--,e(t)}function i(t){if(t)return i.errored?void 0:(i.errored=!0,o(t));++n>=r.length&&o(null)}r.forEach((function(e){if(!e.type.syncfs)return i(null);e.type.syncfs(e,t,i)}))},mount:function(t,e,r){var n,o="/"===r,i=!r;if(o&&mt.root)throw new mt.ErrnoError(10);if(!o&&!i){var a=mt.lookupPath(r,{follow_mount:!1});if(r=a.path,n=a.node,mt.isMountpoint(n))throw new mt.ErrnoError(10);if(!mt.isDir(n.mode))throw new mt.ErrnoError(54)}var s={type:t,opts:e,mountpoint:r,mounts:[]},c=t.mount(s);return c.mount=s,s.root=c,o?mt.root=c:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),c},unmount:function(t){var e=mt.lookupPath(t,{follow_mount:!1});if(!mt.isMountpoint(e.node))throw new mt.ErrnoError(28);var r=e.node,n=r.mounted,o=mt.getMounts(n);Object.keys(mt.nameTable).forEach((function(t){for(var e=mt.nameTable[t];e;){var r=e.name_next;o.includes(e.mount)&&mt.destroyNode(e),e=r}})),r.mounted=null;var i=r.mount.mounts.indexOf(n);r.mount.mounts.splice(i,1)},lookup:function(t,e){return t.node_ops.lookup(t,e)},mknod:function(t,e,r){var n=mt.lookupPath(t,{parent:!0}).node,o=et.basename(t);if(!o||"."===o||".."===o)throw new mt.ErrnoError(28);var i=mt.mayCreate(n,o);if(i)throw new mt.ErrnoError(i);if(!n.node_ops.mknod)throw new mt.ErrnoError(63);return n.node_ops.mknod(n,o,e,r)},create:function(t,e){return e=void 0!==e?e:438,e&=4095,e|=32768,mt.mknod(t,e,0)},mkdir:function(t,e){return e=void 0!==e?e:511,e&=1023,e|=16384,mt.mknod(t,e,0)},mkdirTree:function(t,e){for(var r=t.split("/"),n="",o=0;o<r.length;++o)if(r[o]){n+="/"+r[o];try{mt.mkdir(n,e)}catch(t){if(20!=t.errno)throw t}}},mkdev:function(t,e,r){return void 0===r&&(r=e,e=438),e|=8192,mt.mknod(t,e,r)},symlink:function(t,e){if(!nt.resolve(t))throw new mt.ErrnoError(44);var r=mt.lookupPath(e,{parent:!0}).node;if(!r)throw new mt.ErrnoError(44);var n=et.basename(e),o=mt.mayCreate(r,n);if(o)throw new mt.ErrnoError(o);if(!r.node_ops.symlink)throw new mt.ErrnoError(63);return r.node_ops.symlink(r,n,t)},rename:function(t,e){var r,n,o=et.dirname(t),i=et.dirname(e),a=et.basename(t),s=et.basename(e);if(r=mt.lookupPath(t,{parent:!0}).node,n=mt.lookupPath(e,{parent:!0}).node,!r||!n)throw new mt.ErrnoError(44);if(r.mount!==n.mount)throw new mt.ErrnoError(75);var c,u=mt.lookupNode(r,a),f=nt.relative(t,i);if("."!==f.charAt(0))throw new mt.ErrnoError(28);if("."!==(f=nt.relative(e,o)).charAt(0))throw new mt.ErrnoError(55);try{c=mt.lookupNode(n,s)}catch(t){}if(u!==c){var l=mt.isDir(u.mode),d=mt.mayDelete(r,a,l);if(d)throw new mt.ErrnoError(d);if(d=c?mt.mayDelete(n,s,l):mt.mayCreate(n,s))throw new mt.ErrnoError(d);if(!r.node_ops.rename)throw new mt.ErrnoError(63);if(mt.isMountpoint(u)||c&&mt.isMountpoint(c))throw new mt.ErrnoError(10);if(n!==r&&(d=mt.nodePermissions(r,"w")))throw new mt.ErrnoError(d);mt.hashRemoveNode(u);try{r.node_ops.rename(u,n,s)}catch(t){throw t}finally{mt.hashAddNode(u)}}},rmdir:function(t){var e=mt.lookupPath(t,{parent:!0}).node,r=et.basename(t),n=mt.lookupNode(e,r),o=mt.mayDelete(e,r,!0);if(o)throw new mt.ErrnoError(o);if(!e.node_ops.rmdir)throw new mt.ErrnoError(63);if(mt.isMountpoint(n))throw new mt.ErrnoError(10);e.node_ops.rmdir(e,r),mt.destroyNode(n)},readdir:function(t){var e=mt.lookupPath(t,{follow:!0}).node;if(!e.node_ops.readdir)throw new mt.ErrnoError(54);return e.node_ops.readdir(e)},unlink:function(t){var e=mt.lookupPath(t,{parent:!0}).node;if(!e)throw new mt.ErrnoError(44);var r=et.basename(t),n=mt.lookupNode(e,r),o=mt.mayDelete(e,r,!1);if(o)throw new mt.ErrnoError(o);if(!e.node_ops.unlink)throw new mt.ErrnoError(63);if(mt.isMountpoint(n))throw new mt.ErrnoError(10);e.node_ops.unlink(e,r),mt.destroyNode(n)},readlink:function(t){var e=mt.lookupPath(t).node;if(!e)throw new mt.ErrnoError(44);if(!e.node_ops.readlink)throw new mt.ErrnoError(28);return nt.resolve(mt.getPath(e.parent),e.node_ops.readlink(e))},stat:function(t,e){var r=mt.lookupPath(t,{follow:!e}).node;if(!r)throw new mt.ErrnoError(44);if(!r.node_ops.getattr)throw new mt.ErrnoError(63);return r.node_ops.getattr(r)},lstat:function(t){return mt.stat(t,!0)},chmod:function(t,e,r){var n;if(!(n="string"==typeof t?mt.lookupPath(t,{follow:!r}).node:t).node_ops.setattr)throw new mt.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&e|-4096&n.mode,timestamp:Date.now()})},lchmod:function(t,e){mt.chmod(t,e,!0)},fchmod:function(t,e){var r=mt.getStreamChecked(t);mt.chmod(r.node,e)},chown:function(t,e,r,n){var o;if(!(o="string"==typeof t?mt.lookupPath(t,{follow:!n}).node:t).node_ops.setattr)throw new mt.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown:function(t,e,r){mt.chown(t,e,r,!0)},fchown:function(t,e,r){var n=mt.getStreamChecked(t);mt.chown(n.node,e,r)},truncate:function(t,e){if(e<0)throw new mt.ErrnoError(28);var r;if(!(r="string"==typeof t?mt.lookupPath(t,{follow:!0}).node:t).node_ops.setattr)throw new mt.ErrnoError(63);if(mt.isDir(r.mode))throw new mt.ErrnoError(31);if(!mt.isFile(r.mode))throw new mt.ErrnoError(28);var n=mt.nodePermissions(r,"w");if(n)throw new mt.ErrnoError(n);r.node_ops.setattr(r,{size:e,timestamp:Date.now()})},ftruncate:function(t,e){var r=mt.getStreamChecked(t);if(!(2097155&r.flags))throw new mt.ErrnoError(28);mt.truncate(r.node,e)},utime:function(t,e,r){var n=mt.lookupPath(t,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(e,r)})},open:function(t,e,r){if(""===t)throw new mt.ErrnoError(44);var n;if(r=void 0===r?438:r,r=64&(e="string"==typeof e?function(t){var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[t];if(void 0===e)throw new Error("Unknown file open mode: ".concat(t));return e}(e):e)?4095&r|32768:0,"object"==m(t))n=t;else{t=et.normalize(t);try{n=mt.lookupPath(t,{follow:!(131072&e)}).node}catch(t){}}var o=!1;if(64&e)if(n){if(128&e)throw new mt.ErrnoError(20)}else n=mt.mknod(t,r,0),o=!0;if(!n)throw new mt.ErrnoError(44);if(mt.isChrdev(n.mode)&&(e&=-513),65536&e&&!mt.isDir(n.mode))throw new mt.ErrnoError(54);if(!o){var a=mt.mayOpen(n,e);if(a)throw new mt.ErrnoError(a)}512&e&&!o&&mt.truncate(n,0),e&=-131713;var s=mt.createStream({node:n,path:mt.getPath(n),flags:e,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return s.stream_ops.open&&s.stream_ops.open(s),!i.logReadFiles||1&e||(mt.readFiles||(mt.readFiles={}),t in mt.readFiles||(mt.readFiles[t]=1)),s},close:function(t){if(mt.isClosed(t))throw new mt.ErrnoError(8);t.getdents&&(t.getdents=null);try{t.stream_ops.close&&t.stream_ops.close(t)}catch(t){throw t}finally{mt.closeStream(t.fd)}t.fd=null},isClosed:function(t){return null===t.fd},llseek:function(t,e,r){if(mt.isClosed(t))throw new mt.ErrnoError(8);if(!t.seekable||!t.stream_ops.llseek)throw new mt.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new mt.ErrnoError(28);return t.position=t.stream_ops.llseek(t,e,r),t.ungotten=[],t.position},read:function(t,e,r,n,o){if(n<0||o<0)throw new mt.ErrnoError(28);if(mt.isClosed(t))throw new mt.ErrnoError(8);if(1==(2097155&t.flags))throw new mt.ErrnoError(8);if(mt.isDir(t.node.mode))throw new mt.ErrnoError(31);if(!t.stream_ops.read)throw new mt.ErrnoError(28);var i=void 0!==o;if(i){if(!t.seekable)throw new mt.ErrnoError(70)}else o=t.position;var a=t.stream_ops.read(t,e,r,n,o);return i||(t.position+=a),a},write:function(t,e,r,n,o,i){if(n<0||o<0)throw new mt.ErrnoError(28);if(mt.isClosed(t))throw new mt.ErrnoError(8);if(!(2097155&t.flags))throw new mt.ErrnoError(8);if(mt.isDir(t.node.mode))throw new mt.ErrnoError(31);if(!t.stream_ops.write)throw new mt.ErrnoError(28);t.seekable&&1024&t.flags&&mt.llseek(t,0,2);var a=void 0!==o;if(a){if(!t.seekable)throw new mt.ErrnoError(70)}else o=t.position;var s=t.stream_ops.write(t,e,r,n,o,i);return a||(t.position+=s),s},allocate:function(t,e,r){if(mt.isClosed(t))throw new mt.ErrnoError(8);if(e<0||r<=0)throw new mt.ErrnoError(28);if(!(2097155&t.flags))throw new mt.ErrnoError(8);if(!mt.isFile(t.node.mode)&&!mt.isDir(t.node.mode))throw new mt.ErrnoError(43);if(!t.stream_ops.allocate)throw new mt.ErrnoError(138);t.stream_ops.allocate(t,e,r)},mmap:function(t,e,r,n,o){if(2&n&&!(2&o)&&2!=(2097155&t.flags))throw new mt.ErrnoError(2);if(1==(2097155&t.flags))throw new mt.ErrnoError(2);if(!t.stream_ops.mmap)throw new mt.ErrnoError(43);return t.stream_ops.mmap(t,e,r,n,o)},msync:function(t,e,r,n,o){return t.stream_ops.msync?t.stream_ops.msync(t,e,r,n,o):0},munmap:function(t){return 0},ioctl:function(t,e,r){if(!t.stream_ops.ioctl)throw new mt.ErrnoError(59);return t.stream_ops.ioctl(t,e,r)},readFile:function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r.flags=r.flags||0,r.encoding=r.encoding||"binary","utf8"!==r.encoding&&"binary"!==r.encoding)throw new Error('Invalid encoding type "'.concat(r.encoding,'"'));var n=mt.open(t,r.flags),o=mt.stat(t).size,i=new Uint8Array(o);return mt.read(n,i,0,o,0),"utf8"===r.encoding?e=it(i,0):"binary"===r.encoding&&(e=i),mt.close(n),e},writeFile:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var n=mt.open(t,r.flags,r.mode);if("string"==typeof e){var o=new Uint8Array(st(e)+1),i=ct(e,o,0,o.length);mt.write(n,o,0,i,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(e))throw new Error("Unsupported data type");mt.write(n,e,0,e.byteLength,void 0,r.canOwn)}mt.close(n)},cwd:function(){return mt.currentPath},chdir:function(t){var e=mt.lookupPath(t,{follow:!0});if(null===e.node)throw new mt.ErrnoError(44);if(!mt.isDir(e.node.mode))throw new mt.ErrnoError(54);var r=mt.nodePermissions(e.node,"x");if(r)throw new mt.ErrnoError(r);mt.currentPath=e.path},createDefaultDirectories:function(){mt.mkdir("/tmp"),mt.mkdir("/home"),mt.mkdir("/home/web_user")},createDefaultDevices:function(){mt.mkdir("/dev"),mt.registerDevice(mt.makedev(1,3),{read:function(){return 0},write:function(t,e,r,n,o){return n}}),mt.mkdev("/dev/null",mt.makedev(1,3)),ft.register(mt.makedev(5,0),ft.default_tty_ops),ft.register(mt.makedev(6,0),ft.default_tty1_ops),mt.mkdev("/dev/tty",mt.makedev(5,0)),mt.mkdev("/dev/tty1",mt.makedev(6,0));var t=new Uint8Array(1024),e=0,r=function(){return 0===e&&(e=rt(t).byteLength),t[--e]};mt.createDevice("/dev","random",r),mt.createDevice("/dev","urandom",r),mt.mkdir("/dev/shm"),mt.mkdir("/dev/shm/tmp")},createSpecialDirectories:function(){mt.mkdir("/proc");var t=mt.mkdir("/proc/self");mt.mkdir("/proc/self/fd"),mt.mount({mount:function(){var e=mt.createNode(t,"fd",16895,73);return e.node_ops={lookup:function(t,e){var r=+e,n=mt.getStreamChecked(r),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:function(){return n.path}}};return o.parent=o,o}},e}},{},"/proc/self/fd")},createStandardStreams:function(){i.stdin?mt.createDevice("/dev","stdin",i.stdin):mt.symlink("/dev/tty","/dev/stdin"),i.stdout?mt.createDevice("/dev","stdout",null,i.stdout):mt.symlink("/dev/tty","/dev/stdout"),i.stderr?mt.createDevice("/dev","stderr",null,i.stderr):mt.symlink("/dev/tty1","/dev/stderr"),mt.open("/dev/stdin",0),mt.open("/dev/stdout",1),mt.open("/dev/stderr",1)},ensureErrnoError:function(){mt.ErrnoError||(mt.ErrnoError=function(t,e){this.name="ErrnoError",this.node=e,this.setErrno=function(t){this.errno=t},this.setErrno(t),this.message="FS error"},mt.ErrnoError.prototype=new Error,mt.ErrnoError.prototype.constructor=mt.ErrnoError,[44].forEach((function(t){mt.genericErrors[t]=new mt.ErrnoError(t),mt.genericErrors[t].stack="<generic error, no stack>"})))},staticInit:function(){mt.ensureErrnoError(),mt.nameTable=new Array(4096),mt.mount(dt,{},"/"),mt.createDefaultDirectories(),mt.createDefaultDevices(),mt.createSpecialDirectories(),mt.filesystems={MEMFS:dt}},init:function(t,e,r){mt.init.initialized=!0,mt.ensureErrnoError(),i.stdin=t||i.stdin,i.stdout=e||i.stdout,i.stderr=r||i.stderr,mt.createStandardStreams()},quit:function(){mt.init.initialized=!1;for(var t=0;t<mt.streams.length;t++){var e=mt.streams[t];e&&mt.close(e)}},findObject:function(t,e){var r=mt.analyzePath(t,e);return r.exists?r.object:null},analyzePath:function(t,e){try{t=(n=mt.lookupPath(t,{follow:!e})).path}catch(t){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=mt.lookupPath(t,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=et.basename(t),n=mt.lookupPath(t,{follow:!e}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot="/"===n.path}catch(t){r.error=t.errno}return r},createPath:function(t,e,r,n){t="string"==typeof t?t:mt.getPath(t);for(var o=e.split("/").reverse();o.length;){var i=o.pop();if(i){var a=et.join2(t,i);try{mt.mkdir(a)}catch(t){}t=a}}return a},createFile:function(t,e,r,n,o){var i=et.join2("string"==typeof t?t:mt.getPath(t),e),a=vt(n,o);return mt.create(i,a)},createDataFile:function(t,e,r,n,o,i){var a=e;t&&(t="string"==typeof t?t:mt.getPath(t),a=e?et.join2(t,e):t);var s=vt(n,o),c=mt.create(a,s);if(r){if("string"==typeof r){for(var u=new Array(r.length),f=0,l=r.length;f<l;++f)u[f]=r.charCodeAt(f);r=u}mt.chmod(c,146|s);var d=mt.open(c,577);mt.write(d,r,0,r.length,0,i),mt.close(d),mt.chmod(c,s)}return c},createDevice:function(t,e,r,n){var o=et.join2("string"==typeof t?t:mt.getPath(t),e),i=vt(!!r,!!n);mt.createDevice.major||(mt.createDevice.major=64);var a=mt.makedev(mt.createDevice.major++,0);return mt.registerDevice(a,{open:function(t){t.seekable=!1},close:function(t){n&&n.buffer&&n.buffer.length&&n(10)},read:function(t,e,n,o,i){for(var a=0,s=0;s<o;s++){var c;try{c=r()}catch(t){throw new mt.ErrnoError(29)}if(void 0===c&&0===a)throw new mt.ErrnoError(6);if(null==c)break;a++,e[n+s]=c}return a&&(t.node.timestamp=Date.now()),a},write:function(t,e,r,o,i){for(var a=0;a<o;a++)try{n(e[r+a])}catch(t){throw new mt.ErrnoError(29)}return o&&(t.node.timestamp=Date.now()),a}}),mt.mkdev(o,i,a)},forceLoadFile:function(t){if(t.isDevice||t.isFolder||t.link||t.contents)return!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!p)throw new Error("Cannot load without read() or XMLHttpRequest.");try{t.contents=ut(p(t.url)),t.usedBytes=t.contents.length}catch(t){throw new mt.ErrnoError(29)}},createLazyFile:function(t,e,r,n,o){function i(){this.lengthKnown=!1,this.chunks=[]}if(i.prototype.get=function(t){if(!(t>this.length-1||t<0)){var e=t%this.chunkSize,r=t/this.chunkSize|0;return this.getter(r)[e]}},i.prototype.setDataGetter=function(t){this.getter=t},i.prototype.cacheLength=function(){var t=new XMLHttpRequest;if(t.open("HEAD",r,!1),t.send(null),!(t.status>=200&&t.status<300||304===t.status))throw new Error("Couldn't load "+r+". Status: "+t.status);var e,n=Number(t.getResponseHeader("Content-length")),o=(e=t.getResponseHeader("Accept-Ranges"))&&"bytes"===e,i=(e=t.getResponseHeader("Content-Encoding"))&&"gzip"===e,a=1048576;o||(a=n);var s=this;s.setDataGetter((function(t){var e=t*a,o=(t+1)*a-1;if(o=Math.min(o,n-1),void 0===s.chunks[t]&&(s.chunks[t]=function(t,e){if(t>e)throw new Error("invalid range ("+t+", "+e+") or no bytes requested!");if(e>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",r,!1),n!==a&&o.setRequestHeader("Range","bytes="+t+"-"+e),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn't load "+r+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):ut(o.responseText||"")}(e,o)),void 0===s.chunks[t])throw new Error("doXHR failed!");return s.chunks[t]})),!i&&n||(a=n=1,n=this.getter(0).length,a=n,k("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!d)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new i;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var s={isDevice:!1,contents:a}}else s={isDevice:!1,url:r};var c=mt.createFile(t,e,s,n,o);s.contents?c.contents=s.contents:s.url&&(c.contents=null,c.url=s.url),Object.defineProperties(c,{usedBytes:{get:function(){return this.contents.length}}});var u={};function f(t,e,r,n,o){var i=t.node.contents;if(o>=i.length)return 0;var a=Math.min(i.length-o,n);if(i.slice)for(var s=0;s<a;s++)e[r+s]=i[o+s];else for(s=0;s<a;s++)e[r+s]=i.get(o+s);return a}return Object.keys(c.stream_ops).forEach((function(t){var e=c.stream_ops[t];u[t]=function(){return mt.forceLoadFile(c),e.apply(null,arguments)}})),u.read=function(t,e,r,n,o){return mt.forceLoadFile(c),f(t,e,r,n,o)},u.mmap=function(t,e,r,n,o){mt.forceLoadFile(c);var i=lt();if(!i)throw new mt.ErrnoError(48);return f(t,P,i,e,r),{ptr:i,allocated:!0}},c.stream_ops=u,c}},yt=function(t,e){return t?it(T,t,e):""},gt={DEFAULT_POLLMASK:5,calculateAt:function(t,e,r){if(et.isAbs(e))return e;var n;if(n=-100===t?mt.cwd():gt.getStreamFromFD(t).path,0==e.length){if(!r)throw new mt.ErrnoError(44);return n}return et.join2(n,e)},doStat:function(t,e,r){try{var n=t(e)}catch(t){if(t&&t.node&&et.normalize(e)!==et.normalize(mt.getPath(t.node)))return-54;throw t}$[r>>2]=n.dev,$[r+4>>2]=n.mode,S[r+8>>2]=n.nlink,$[r+12>>2]=n.uid,$[r+16>>2]=n.gid,$[r+20>>2]=n.rdev,q=[n.size>>>0,(G=n.size,+Math.abs(G)>=1?G>0?+Math.floor(G/4294967296)>>>0:~~+Math.ceil((G-+(~~G>>>0))/4294967296)>>>0:0)],$[r+24>>2]=q[0],$[r+28>>2]=q[1],$[r+32>>2]=4096,$[r+36>>2]=n.blocks;var o=n.atime.getTime(),i=n.mtime.getTime(),a=n.ctime.getTime();return q=[Math.floor(o/1e3)>>>0,(G=Math.floor(o/1e3),+Math.abs(G)>=1?G>0?+Math.floor(G/4294967296)>>>0:~~+Math.ceil((G-+(~~G>>>0))/4294967296)>>>0:0)],$[r+40>>2]=q[0],$[r+44>>2]=q[1],S[r+48>>2]=o%1e3*1e3,q=[Math.floor(i/1e3)>>>0,(G=Math.floor(i/1e3),+Math.abs(G)>=1?G>0?+Math.floor(G/4294967296)>>>0:~~+Math.ceil((G-+(~~G>>>0))/4294967296)>>>0:0)],$[r+56>>2]=q[0],$[r+60>>2]=q[1],S[r+64>>2]=i%1e3*1e3,q=[Math.floor(a/1e3)>>>0,(G=Math.floor(a/1e3),+Math.abs(G)>=1?G>0?+Math.floor(G/4294967296)>>>0:~~+Math.ceil((G-+(~~G>>>0))/4294967296)>>>0:0)],$[r+72>>2]=q[0],$[r+76>>2]=q[1],S[r+80>>2]=a%1e3*1e3,q=[n.ino>>>0,(G=n.ino,+Math.abs(G)>=1?G>0?+Math.floor(G/4294967296)>>>0:~~+Math.ceil((G-+(~~G>>>0))/4294967296)>>>0:0)],$[r+88>>2]=q[0],$[r+92>>2]=q[1],0},doMsync:function(t,e,r,n,o){if(!mt.isFile(e.node.mode))throw new mt.ErrnoError(43);if(2&n)return 0;var i=T.slice(t,t+r);mt.msync(e,i,o,r,n)},varargs:void 0,get:function(){return gt.varargs+=4,$[gt.varargs-4>>2]},getStr:function(t){return yt(t)},getStreamFromFD:function(t){return mt.getStreamChecked(t)}};function wt(t){switch(t){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: ".concat(t))}}var bt=void 0;function Et(t){for(var e="",r=t;T[r];)e+=bt[T[r++]];return e}var kt={},_t={},Pt={},Tt=void 0;function Ct(t){throw new Tt(t)}var At=void 0;function $t(t){throw new At(t)}function St(t,e,r){function n(e){var n=r(e);n.length!==t.length&&$t("Mismatched type converter count");for(var o=0;o<t.length;++o)Dt(t[o],n[o])}t.forEach((function(t){Pt[t]=e}));var o=new Array(e.length),i=[],a=0;e.forEach((function(t,e){_t.hasOwnProperty(t)?o[e]=_t[t]:(i.push(t),kt.hasOwnProperty(t)||(kt[t]=[]),kt[t].push((function(){o[e]=_t[t],++a===i.length&&n(o)})))})),0===i.length&&n(o)}function Dt(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=e.name;if(t||Ct('type "'.concat(n,'" must have a positive integer typeid pointer')),_t.hasOwnProperty(t)){if(r.ignoreDuplicateRegistrations)return;Ct("Cannot register type '".concat(n,"' twice"))}if(_t[t]=e,delete Pt[t],kt.hasOwnProperty(t)){var o=kt[t];delete kt[t],o.forEach((function(t){return t()}))}}(t,e,r)}function Ot(t){if(!(this instanceof Qt))return!1;if(!(t instanceof Qt))return!1;for(var e=this.$$.ptrType.registeredClass,r=this.$$.ptr,n=t.$$.ptrType.registeredClass,o=t.$$.ptr;e.baseClass;)r=e.upcast(r),e=e.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return e===n&&r===o}function Ft(t){Ct(t.$$.ptrType.registeredClass.name+" instance already deleted")}var jt=!1;function xt(t){}function Mt(t){t.count.value-=1,0===t.count.value&&function(t){t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)}(t)}function Rt(t,e,r){if(e===r)return t;if(void 0===r.baseClass)return null;var n=Rt(t,e,r.baseClass);return null===n?null:r.downcast(n)}var Wt={};function It(){return Object.keys(Ht).length}function zt(){var t=[];for(var e in Ht)Ht.hasOwnProperty(e)&&t.push(Ht[e]);return t}var Lt=[];function Ut(){for(;Lt.length;){var t=Lt.pop();t.$$.deleteScheduled=!1,t.delete()}}var Nt=void 0;function Bt(t){Nt=t,Lt.length&&Nt&&Nt(Ut)}var Ht={};function Vt(t,e){return e=function(t,e){for(void 0===e&&Ct("ptr should not be undefined");t.baseClass;)e=t.upcast(e),t=t.baseClass;return e}(t,e),Ht[e]}function Gt(t,e){return e.ptrType&&e.ptr||$t("makeClassHandle requires ptr and ptrType"),!!e.smartPtrType!=!!e.smartPtr&&$t("Both smartPtrType and smartPtr must be specified"),e.count={value:1},Xt(Object.create(t,{$$:{value:e}}))}function qt(t){var e=this.getPointee(t);if(!e)return this.destructor(t),null;var r=Vt(this.registeredClass,e);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=e,r.$$.smartPtr=t,r.clone();var n=r.clone();return this.destructor(t),n}function o(){return this.isSmartPointer?Gt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:e,smartPtrType:this,smartPtr:t}):Gt(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var i,a=this.registeredClass.getActualType(e),s=Wt[a];if(!s)return o.call(this);i=this.isConst?s.constPointerType:s.pointerType;var c=Rt(e,this.registeredClass,i.registeredClass);return null===c?o.call(this):this.isSmartPointer?Gt(i.registeredClass.instancePrototype,{ptrType:i,ptr:c,smartPtrType:this,smartPtr:t}):Gt(i.registeredClass.instancePrototype,{ptrType:i,ptr:c})}var Xt=function(t){return"undefined"==typeof FinalizationRegistry?(Xt=function(t){return t},t):(jt=new FinalizationRegistry((function(t){Mt(t.$$)})),xt=function(t){return jt.unregister(t)},(Xt=function(t){var e=t.$$;if(e.smartPtr){var r={$$:e};jt.register(t,r,t)}return t})(t))};function Kt(){if(this.$$.ptr||Ft(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t,e=Xt(Object.create(Object.getPrototypeOf(this),{$$:{value:(t=this.$$,{count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType})}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function Jt(){this.$$.ptr||Ft(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ct("Object already scheduled for deletion"),xt(this),Mt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Yt(){return!this.$$.ptr}function Zt(){return this.$$.ptr||Ft(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ct("Object already scheduled for deletion"),Lt.push(this),1===Lt.length&&Nt&&Nt(Ut),this.$$.deleteScheduled=!0,this}function Qt(){}var te=48,ee=57;function re(t){if(void 0===t)return"_unknown";var e=(t=t.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return e>=te&&e<=ee?"_".concat(t):t}function ne(t,e){return c({},t=re(t),(function(){return e.apply(this,arguments)}))[t]}function oe(t,e,r){if(void 0===t[e].overloadTable){var n=t[e];t[e]=function(){return t[e].overloadTable.hasOwnProperty(arguments.length)||Ct("Function '".concat(r,"' called with an invalid number of arguments (").concat(arguments.length,") - expects one of (").concat(t[e].overloadTable,")!")),t[e].overloadTable[arguments.length].apply(this,arguments)},t[e].overloadTable=[],t[e].overloadTable[n.argCount]=n}}function ie(t,e,r,n,o,i,a,s){this.name=t,this.constructor=e,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=o,this.getActualType=i,this.upcast=a,this.downcast=s,this.pureVirtualFunctions=[]}function ae(t,e,r){for(;e!==r;)e.upcast||Ct("Expected null or instance of ".concat(r.name,", got an instance of ").concat(e.name)),t=e.upcast(t),e=e.baseClass;return t}function se(t,e){if(null===e)return this.isReference&&Ct("null is not a valid ".concat(this.name)),0;e.$$||Ct('Cannot pass "'.concat(Fe(e),'" as a ').concat(this.name)),e.$$.ptr||Ct("Cannot pass deleted object as a pointer of type ".concat(this.name));var r=e.$$.ptrType.registeredClass;return ae(e.$$.ptr,r,this.registeredClass)}function ce(t,e){var r;if(null===e)return this.isReference&&Ct("null is not a valid ".concat(this.name)),this.isSmartPointer?(r=this.rawConstructor(),null!==t&&t.push(this.rawDestructor,r),r):0;e.$$||Ct('Cannot pass "'.concat(Fe(e),'" as a ').concat(this.name)),e.$$.ptr||Ct("Cannot pass deleted object as a pointer of type ".concat(this.name)),!this.isConst&&e.$$.ptrType.isConst&&Ct("Cannot convert argument of type ".concat(e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name," to parameter type ").concat(this.name));var n=e.$$.ptrType.registeredClass;if(r=ae(e.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===e.$$.smartPtr&&Ct("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:e.$$.smartPtrType===this?r=e.$$.smartPtr:Ct("Cannot convert argument of type ".concat(e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name," to parameter type ").concat(this.name));break;case 1:r=e.$$.smartPtr;break;case 2:if(e.$$.smartPtrType===this)r=e.$$.smartPtr;else{var o=e.clone();r=this.rawShare(r,Oe.toHandle((function(){o.delete()}))),null!==t&&t.push(this.rawDestructor,r)}break;default:Ct("Unsupporting sharing policy")}return r}function ue(t,e){if(null===e)return this.isReference&&Ct("null is not a valid ".concat(this.name)),0;e.$$||Ct('Cannot pass "'.concat(Fe(e),'" as a ').concat(this.name)),e.$$.ptr||Ct("Cannot pass deleted object as a pointer of type ".concat(this.name)),e.$$.ptrType.isConst&&Ct("Cannot convert argument of type ".concat(e.$$.ptrType.name," to parameter type ").concat(this.name));var r=e.$$.ptrType.registeredClass;return ae(e.$$.ptr,r,this.registeredClass)}function fe(t){return this.fromWireType($[t>>2])}function le(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t}function de(t){this.rawDestructor&&this.rawDestructor(t)}function pe(t){null!==t&&t.delete()}function he(t,e,r,n,o,i,a,s,c,u,f){this.name=t,this.registeredClass=e,this.isReference=r,this.isConst=n,this.isSmartPointer=o,this.pointeeType=i,this.sharingPolicy=a,this.rawGetPointee=s,this.rawConstructor=c,this.rawShare=u,this.rawDestructor=f,o||void 0!==e.baseClass?this.toWireType=ce:n?(this.toWireType=se,this.destructorFunction=null):(this.toWireType=ue,this.destructorFunction=null)}var ve=[],me=function(t){var e=ve[t];return e||(t>=ve.length&&(ve.length=t+1),ve[t]=e=F.get(t)),e},ye=function(t,e,r){return t.includes("j")?function(t,e,r){var n=i["dynCall_"+t];return r&&r.length?n.apply(null,[e].concat(r)):n.call(null,e)}(t,e,r):me(e).apply(null,r)},ge=function(t,e){var r=[];return function(){return r.length=0,Object.assign(r,arguments),ye(t,e,r)}};function we(t,e){var r=(t=Et(t)).includes("j")?ge(t,e):me(e);return"function"!=typeof r&&Ct("unknown function pointer with signature ".concat(t,": ").concat(e)),r}var be=void 0;function Ee(t){var e=nr(t),r=Et(e);return er(e),r}function ke(t,e){var r=[],n={};throw e.forEach((function t(e){n[e]||_t[e]||(Pt[e]?Pt[e].forEach(t):(r.push(e),n[e]=!0))})),new be("".concat(t,": ")+r.map(Ee).join([", "]))}function _e(t,e){for(var r=[],n=0;n<t;n++)r.push(S[e+4*n>>2]);return r}function Pe(t){for(;t.length;){var e=t.pop();t.pop()(e)}}function Te(t,e){if(!(t instanceof Function))throw new TypeError("new_ called with constructor type ".concat(m(t)," which is not a function"));var r=ne(t.name||"unknownFunctionName",(function(){}));r.prototype=t.prototype;var n=new r,o=t.apply(n,e);return o instanceof Object?o:n}function Ce(t,e,r,n,o,i){var a=e.length;a<2&&Ct("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var s=null!==e[1]&&null!==r,c=!1,u=1;u<e.length;++u)if(null!==e[u]&&void 0===e[u].destructorFunction){c=!0;break}var f="void"!==e[0].name,l="",d="";for(u=0;u<a-2;++u)l+=(0!==u?", ":"")+"arg"+u,d+=(0!==u?", ":"")+"arg"+u+"Wired";var p="\n return function ".concat(re(t),"(").concat(l,") {\n if (arguments.length !== ").concat(a-2,") {\n throwBindingError('function ").concat(t," called with ").concat(arguments.length," arguments, expected ").concat(a-2," args!');\n }");c&&(p+="var destructors = [];\n");var h=c?"destructors":"null",v=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],m=[Ct,n,o,Pe,e[0],e[1]];for(s&&(p+="var thisWired = classParam.toWireType("+h+", this);\n"),u=0;u<a-2;++u)p+="var arg"+u+"Wired = argType"+u+".toWireType("+h+", arg"+u+"); // "+e[u+2].name+"\n",v.push("argType"+u),m.push(e[u+2]);if(s&&(d="thisWired"+(d.length>0?", ":"")+d),p+=(f||i?"var rv = ":"")+"invoker(fn"+(d.length>0?", ":"")+d+");\n",c)p+="runDestructors(destructors);\n";else for(u=s?1:2;u<e.length;++u){var y=1===u?"thisWired":"arg"+(u-2)+"Wired";null!==e[u].destructorFunction&&(p+=y+"_dtor("+y+"); // "+e[u].name+"\n",v.push(y+"_dtor"),m.push(e[u].destructorFunction))}return f&&(p+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),p+="}\n",v.push(p),Te(Function,v).apply(null,m)}function Ae(){this.allocated=[void 0],this.freelist=[]}var $e=new Ae;function Se(t){t>=$e.reserved&&0==--$e.get(t).refcount&&$e.free(t)}function De(){for(var t=0,e=$e.reserved;e<$e.allocated.length;++e)void 0!==$e.allocated[e]&&++t;return t}var Oe={toValue:function(t){return t||Ct("Cannot use deleted val. handle = "+t),$e.get(t).value},toHandle:function(t){switch(t){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return $e.allocate({refcount:1,value:t})}}};function Fe(t){if(null===t)return"null";var e=m(t);return"object"===e||"array"===e||"function"===e?t.toString():""+t}function je(t,e){switch(e){case 2:return function(t){return this.fromWireType(D[t>>2])};case 3:return function(t){return this.fromWireType(O[t>>3])};default:throw new TypeError("Unknown float type: "+t)}}function xe(t,e,r){switch(e){case 0:return r?function(t){return P[t]}:function(t){return T[t]};case 1:return r?function(t){return C[t>>1]}:function(t){return A[t>>1]};case 2:return r?function(t){return $[t>>2]}:function(t){return S[t>>2]};default:throw new TypeError("Unknown integer type: "+t)}}var Me,Re,We,Ie="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,ze=function(t,e){for(var r=t,n=r>>1,o=n+e/2;!(n>=o)&&A[n];)++n;if((r=n<<1)-t>32&&Ie)return Ie.decode(T.subarray(t,r));for(var i="",a=0;!(a>=e/2);++a){var s=C[t+2*a>>1];if(0==s)break;i+=String.fromCharCode(s)}return i},Le=function(t,e,r){if(void 0===r&&(r=2147483647),r<2)return 0;for(var n=e,o=(r-=2)<2*t.length?r/2:t.length,i=0;i<o;++i){var a=t.charCodeAt(i);C[e>>1]=a,e+=2}return C[e>>1]=0,e-n},Ue=function(t){return 2*t.length},Ne=function(t,e){for(var r=0,n="";!(r>=e/4);){var o=$[t+4*r>>2];if(0==o)break;if(++r,o>=65536){var i=o-65536;n+=String.fromCharCode(55296|i>>10,56320|1023&i)}else n+=String.fromCharCode(o)}return n},Be=function(t,e,r){if(void 0===r&&(r=2147483647),r<4)return 0;for(var n=e,o=n+r-4,i=0;i<t.length;++i){var a=t.charCodeAt(i);if(a>=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&t.charCodeAt(++i)),$[e>>2]=a,(e+=4)+4>o)break}return $[e>>2]=0,e-n},He=function(t){for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);n>=55296&&n<=57343&&++r,e+=4}return e},Ve={},Ge=[],qe=[],Xe={},Ke=function(){if(!Ke.strings){var t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==("undefined"==typeof navigator?"undefined":m(navigator))&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:u||"./this.program"};for(var e in Xe)void 0===Xe[e]?delete t[e]:t[e]=Xe[e];var r=[];for(var e in t)r.push("".concat(e,"=").concat(t[e]));Ke.strings=r}return Ke.strings},Je=function(t,e,r,n){t||(t=this),this.parent=t,this.mount=t.mount,this.mounted=null,this.id=mt.nextInode++,this.name=e,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=n},Ye=365,Ze=146;Object.defineProperties(Je.prototype,{read:{get:function(){return(this.mode&Ye)===Ye},set:function(t){t?this.mode|=Ye:this.mode&=-366}},write:{get:function(){return(this.mode&Ze)===Ze},set:function(t){t?this.mode|=Ze:this.mode&=-147}},isFolder:{get:function(){return mt.isDir(this.mode)}},isDevice:{get:function(){return mt.isChrdev(this.mode)}}}),mt.FSNode=Je,mt.createPreloadedFile=function(t,e,r,n,o,i,a,s,c,u){var f=e?nt.resolve(et.join2(t,e)):t;function l(r){function l(r){u&&u(),s||mt.createDataFile(t,e,r,n,o,c),i&&i(),N()}(function(t,e,r,n){"undefined"!=typeof Browser&&Browser.init();var o=!1;return ht.forEach((function(i){o||i.canHandle(e)&&(i.handle(t,e,r,n),o=!0)})),o})(r,f,l,(function(){a&&a(),N()}))||l(r)}U(),"string"==typeof r?pt(r,(function(t){return l(t)}),a):l(r)},mt.staticInit(),function(){for(var t=new Array(256),e=0;e<256;++e)t[e]=String.fromCharCode(e);bt=t}(),Tt=i.BindingError=function(t){function e(t){var r;return o(this,e),(r=n(this,e,[t])).name="BindingError",r}return f(e,t),a(e)}(g(Error)),At=i.InternalError=function(t){function e(t){var r;return o(this,e),(r=n(this,e,[t])).name="InternalError",r}return f(e,t),a(e)}(g(Error)),Qt.prototype.isAliasOf=Ot,Qt.prototype.clone=Kt,Qt.prototype.delete=Jt,Qt.prototype.isDeleted=Yt,Qt.prototype.deleteLater=Zt,i.getInheritedInstanceCount=It,i.getLiveInheritedInstances=zt,i.flushPendingDeletes=Ut,i.setDelayFunction=Bt,he.prototype.getPointee=le,he.prototype.destructor=de,he.prototype.argPackAdvance=8,he.prototype.readValueFromPointer=fe,he.prototype.deleteObject=pe,he.prototype.fromWireType=qt,be=i.UnboundTypeError=(Me=Error,(We=ne(Re="UnboundTypeError",(function(t){this.name=Re,this.message=t;var e=new Error(t).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))}))).prototype=Object.create(Me.prototype),We.prototype.constructor=We,We.prototype.toString=function(){return void 0===this.message?this.name:"".concat(this.name,": ").concat(this.message)},We),Object.assign(Ae.prototype,{get:function(t){return this.allocated[t]},has:function(t){return void 0!==this.allocated[t]},allocate:function(t){var e=this.freelist.pop()||this.allocated.length;return this.allocated[e]=t,e},free:function(t){this.allocated[t]=void 0,this.freelist.push(t)}}),$e.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),$e.reserved=$e.allocated.length,i.count_emval_handles=De;var Qe={p:function(t,e,r){throw new tt(t).init(e,r),t},C:function(t,e,r){gt.varargs=r;try{var n=gt.getStreamFromFD(t);switch(e){case 0:return(o=gt.get())<0?-28:mt.createStream(n,o).fd;case 1:case 2:case 6:case 7:return 0;case 3:return n.flags;case 4:var o=gt.get();return n.flags|=o,0;case 5:return o=gt.get(),C[o+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return i=28,$[rr()>>2]=i,-1}}catch(t){if(void 0===mt||"ErrnoError"!==t.name)throw t;return-t.errno}var i},w:function(t,e,r,n){gt.varargs=n;try{e=gt.getStr(e),e=gt.calculateAt(t,e);var o=n?gt.get():0;return mt.open(e,r,o).fd}catch(t){if(void 0===mt||"ErrnoError"!==t.name)throw t;return-t.errno}},t:function(t,e,r,n,o){},n:function(t,e,r,n,o){var i=wt(r);Dt(t,{name:e=Et(e),fromWireType:function(t){return!!t},toWireType:function(t,e){return e?n:o},argPackAdvance:8,readValueFromPointer:function(t){var n;if(1===r)n=P;else if(2===r)n=C;else{if(4!==r)throw new TypeError("Unknown boolean type size: "+e);n=$}return this.fromWireType(n[t>>i])},destructorFunction:null})},r:function(t,e,r,n,o,a,s,c,u,f,l,d,p){l=Et(l),a=we(o,a),c&&(c=we(s,c)),f&&(f=we(u,f)),p=we(d,p);var h=re(l);!function(t,e,r){i.hasOwnProperty(t)?(Ct("Cannot register public name '".concat(t,"' twice")),oe(i,t,t),i.hasOwnProperty(r)&&Ct("Cannot register multiple overloads of a function with the same number of arguments (".concat(r,")!")),i[t].overloadTable[r]=e):i[t]=e}(h,(function(){ke("Cannot construct ".concat(l," due to unbound types"),[n])})),St([t,e,r],n?[n]:[],(function(e){var r,o;e=e[0],o=n?(r=e.registeredClass).instancePrototype:Qt.prototype;var s=ne(h,(function(){if(Object.getPrototypeOf(this)!==u)throw new Tt("Use 'new' to construct "+l);if(void 0===d.constructor_body)throw new Tt(l+" has no accessible constructor");var t=d.constructor_body[arguments.length];if(void 0===t)throw new Tt("Tried to invoke ctor of ".concat(l," with invalid number of parameters (").concat(arguments.length,") - expected (").concat(Object.keys(d.constructor_body).toString(),") parameters instead!"));return t.apply(this,arguments)})),u=Object.create(o,{constructor:{value:s}});s.prototype=u;var d=new ie(l,s,u,p,r,a,c,f);d.baseClass&&(void 0===d.baseClass.__derivedClasses&&(d.baseClass.__derivedClasses=[]),d.baseClass.__derivedClasses.push(d));var v=new he(l,d,!0,!1,!1),m=new he(l+"*",d,!1,!1,!1),y=new he(l+" const*",d,!1,!0,!1);return Wt[t]={pointerType:m,constPointerType:y},function(t,e,r){i.hasOwnProperty(t)||$t("Replacing nonexistant public symbol"),void 0!==i[t].overloadTable&&void 0!==r?i[t].overloadTable[r]=e:(i[t]=e,i[t].argCount=r)}(h,s),[v,m,y]}))},q:function(t,e,r,n,o,i){var a=_e(e,r);o=we(n,o),St([],[t],(function(t){t=t[0];var r="constructor ".concat(t.name);if(void 0===t.registeredClass.constructor_body&&(t.registeredClass.constructor_body=[]),void 0!==t.registeredClass.constructor_body[e-1])throw new Tt("Cannot register multiple constructors with identical number of parameters (".concat(e-1,") for class '").concat(t.name,"'! Overload resolution is currently only performed using the parameter count, not actual type info!"));return t.registeredClass.constructor_body[e-1]=function(){ke("Cannot construct ".concat(t.name," due to unbound types"),a)},St([],a,(function(n){return n.splice(1,0,null),t.registeredClass.constructor_body[e-1]=Ce(r,n,null,o,i),[]})),[]}))},d:function(t,e,r,n,o,i,a,s,c){var u=_e(r,n);e=Et(e),i=we(o,i),St([],[t],(function(t){t=t[0];var n="".concat(t.name,".").concat(e);function o(){ke("Cannot call ".concat(n," due to unbound types"),u)}e.startsWith("@@")&&(e=Symbol[e.substring(2)]),s&&t.registeredClass.pureVirtualFunctions.push(e);var f=t.registeredClass.instancePrototype,l=f[e];return void 0===l||void 0===l.overloadTable&&l.className!==t.name&&l.argCount===r-2?(o.argCount=r-2,o.className=t.name,f[e]=o):(oe(f,e,n),f[e].overloadTable[r-2]=o),St([],u,(function(o){var s=Ce(n,o,t,i,a,c);return void 0===f[e].overloadTable?(s.argCount=r-2,f[e]=s):f[e].overloadTable[r-2]=s,[]})),[]}))},D:function(t,e){Dt(t,{name:e=Et(e),fromWireType:function(t){var e=Oe.toValue(t);return Se(t),e},toWireType:function(t,e){return Oe.toHandle(e)},argPackAdvance:8,readValueFromPointer:fe,destructorFunction:null})},k:function(t,e,r){var n=wt(r);Dt(t,{name:e=Et(e),fromWireType:function(t){return t},toWireType:function(t,e){return e},argPackAdvance:8,readValueFromPointer:je(e,n),destructorFunction:null})},c:function(t,e,r,n,o){e=Et(e);var i=wt(r),a=function(t){return t};if(0===n){var s=32-8*r;a=function(t){return t<<s>>>s}}var c=e.includes("unsigned");Dt(t,{name:e,fromWireType:a,toWireType:c?function(t,e){return this.name,e>>>0}:function(t,e){return this.name,e},argPackAdvance:8,readValueFromPointer:xe(e,i,0!==n),destructorFunction:null})},b:function(t,e,r){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][e];function o(t){var e=S,r=e[t>>=2],o=e[t+1];return new n(e.buffer,o,r)}Dt(t,{name:r=Et(r),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},j:function(t,e){var r="std::string"===(e=Et(e));Dt(t,{name:e,fromWireType:function(t){var e,n=S[t>>2],o=t+4;if(r)for(var i=o,a=0;a<=n;++a){var s=o+a;if(a==n||0==T[s]){var c=yt(i,s-i);void 0===e?e=c:(e+=String.fromCharCode(0),e+=c),i=s+1}}else{var u=new Array(n);for(a=0;a<n;++a)u[a]=String.fromCharCode(T[o+a]);e=u.join("")}return er(t),e},toWireType:function(t,e){var n;e instanceof ArrayBuffer&&(e=new Uint8Array(e));var o="string"==typeof e;o||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||Ct("Cannot pass non-string to std::string"),n=r&&o?st(e):e.length;var i=tr(4+n+1),a=i+4;if(S[i>>2]=n,r&&o)ct(e,T,a,n+1);else if(o)for(var s=0;s<n;++s){var c=e.charCodeAt(s);c>255&&(er(a),Ct("String has UTF-16 code units that do not fit in 8 bits")),T[a+s]=c}else for(s=0;s<n;++s)T[a+s]=e[s];return null!==t&&t.push(er,i),i},argPackAdvance:8,readValueFromPointer:fe,destructorFunction:function(t){er(t)}})},f:function(t,e,r){var n,o,i,a,s;r=Et(r),2===e?(n=ze,o=Le,a=Ue,i=function(){return A},s=1):4===e&&(n=Ne,o=Be,a=He,i=function(){return S},s=2),Dt(t,{name:r,fromWireType:function(t){for(var r,o=S[t>>2],a=i(),c=t+4,u=0;u<=o;++u){var f=t+4+u*e;if(u==o||0==a[f>>s]){var l=n(c,f-c);void 0===r?r=l:(r+=String.fromCharCode(0),r+=l),c=f+e}}return er(t),r},toWireType:function(t,n){"string"!=typeof n&&Ct("Cannot pass non-string to C++ string type ".concat(r));var i=a(n),c=tr(4+i+e);return S[c>>2]=i>>s,o(n,c+4,i+e),null!==t&&t.push(er,c),c},argPackAdvance:8,readValueFromPointer:fe,destructorFunction:function(t){er(t)}})},o:function(t,e){Dt(t,{isVoid:!0,name:e=Et(e),argPackAdvance:0,fromWireType:function(){},toWireType:function(t,e){}})},g:function(t,e,r,n){var o,i;(t=Ge[t])(e=Oe.toValue(e),r=void 0===(i=Ve[o=r])?Et(o):i,null,n)},m:Se,l:function(t,e){var r=function(t,e){for(var r,n,o,i=new Array(t),a=0;a<t;++a)i[a]=(r=S[e+4*a>>2],n="parameter "+a,o=void 0,void 0===(o=_t[r])&&Ct(n+" has unknown type "+Ee(r)),o);return i}(t,e),n=r[0],o=n.name+"_$"+r.slice(1).map((function(t){return t.name})).join("_")+"$",i=qe[o];if(void 0!==i)return i;for(var a=["retType"],s=[n],c="",u=0;u<t-1;++u)c+=(0!==u?", ":"")+"arg"+u,a.push("argType"+u),s.push(r[1+u]);var f="return function "+re("methodCaller_"+o)+"(handle, name, destructors, args) {\n",l=0;for(u=0;u<t-1;++u)f+=" var arg"+u+" = argType"+u+".readValueFromPointer(args"+(l?"+"+l:"")+");\n",l+=r[u+1].argPackAdvance;for(f+=" var rv = handle[name]("+c+");\n",u=0;u<t-1;++u)r[u+1].deleteObject&&(f+=" argType"+u+".deleteObject(arg"+u+");\n");n.isVoid||(f+=" return retType.toWireType(destructors, rv);\n"),f+="};\n",a.push(f);var d,p,h=Te(Function,a).apply(null,s);return d=h,p=Ge.length,Ge.push(d),i=p,qe[o]=i,i},a:function(){B("")},e:function(){return Date.now()},v:function(){return T.length},A:function(t,e,r){return T.copyWithin(t,e,e+r)},u:function(t){T.length,B("OOM")},y:function(t,e){var r=0;return Ke().forEach((function(n,o){var i=e+r;S[t+4*o>>2]=i,function(t,e){for(var r=0;r<t.length;++r)P[0|e++]=t.charCodeAt(r);P[0|e]=0}(n,i),r+=n.length+1})),0},z:function(t,e){var r=Ke();S[t>>2]=r.length;var n=0;return r.forEach((function(t){n+=t.length+1})),S[e>>2]=n,0},i:function(t){try{var e=gt.getStreamFromFD(t);return mt.close(e),0}catch(t){if(void 0===mt||"ErrnoError"!==t.name)throw t;return t.errno}},x:function(t,e){try{var r=gt.getStreamFromFD(t),n=r.tty?2:mt.isDir(r.mode)?3:mt.isLink(r.mode)?7:4;return P[0|e]=n,C[e+2>>1]=0,q=[0,(G=0,+Math.abs(G)>=1?G>0?+Math.floor(G/4294967296)>>>0:~~+Math.ceil((G-+(~~G>>>0))/4294967296)>>>0:0)],$[e+8>>2]=q[0],$[e+12>>2]=q[1],q=[0,(G=0,+Math.abs(G)>=1?G>0?+Math.floor(G/4294967296)>>>0:~~+Math.ceil((G-+(~~G>>>0))/4294967296)>>>0:0)],$[e+16>>2]=q[0],$[e+20>>2]=q[1],0}catch(t){if(void 0===mt||"ErrnoError"!==t.name)throw t;return t.errno}},B:function(t,e,r,n){try{var o=function(t,e,r,n){for(var o=0,i=0;i<r;i++){var a=S[e>>2],s=S[e+4>>2];e+=8;var c=mt.read(t,P,a,s,n);if(c<0)return-1;if(o+=c,c<s)break}return o}(gt.getStreamFromFD(t),e,r);return S[n>>2]=o,0}catch(t){if(void 0===mt||"ErrnoError"!==t.name)throw t;return t.errno}},s:function(t,e,r,n,o){var i,a,s=(a=r)+2097152>>>0<4194305-!!(i=e)?(i>>>0)+4294967296*a:NaN;try{if(isNaN(s))return 61;var c=gt.getStreamFromFD(t);return mt.llseek(c,s,n),q=[c.position>>>0,(G=c.position,+Math.abs(G)>=1?G>0?+Math.floor(G/4294967296)>>>0:~~+Math.ceil((G-+(~~G>>>0))/4294967296)>>>0:0)],$[o>>2]=q[0],$[o+4>>2]=q[1],c.getdents&&0===s&&0===n&&(c.getdents=null),0}catch(t){if(void 0===mt||"ErrnoError"!==t.name)throw t;return t.errno}},h:function(t,e,r,n){try{var o=function(t,e,r,n){for(var o=0,i=0;i<r;i++){var a=S[e>>2],s=S[e+4>>2];e+=8;var c=mt.write(t,P,a,s,n);if(c<0)return-1;o+=c}return o}(gt.getStreamFromFD(t),e,r);return S[n>>2]=o,0}catch(t){if(void 0===mt||"ErrnoError"!==t.name)throw t;return t.errno}}};!function(){var t,r,n,o,a={a:Qe};function s(t,e){var r,n=t.exports;return b=(E=n).E,r=b.buffer,i.HEAP8=P=new Int8Array(r),i.HEAP16=C=new Int16Array(r),i.HEAP32=$=new Int32Array(r),i.HEAPU8=T=new Uint8Array(r),i.HEAPU16=A=new Uint16Array(r),i.HEAPU32=S=new Uint32Array(r),i.HEAPF32=D=new Float32Array(r),i.HEAPF64=O=new Float64Array(r),F=E.H,function(t){M.unshift(t)}(E.F),N(),n}if(U(),i.instantiateWasm)try{return i.instantiateWasm(a,s)}catch(t){_("Module.instantiateWasm callback failed with error: "+t),e(t)}(t=w,r=H,n=a,o=function(t){s(t.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||K(r)||"function"!=typeof fetch?Y(r,n,o):fetch(r,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,n).then(o,(function(t){return _("wasm streaming compile failed: "+t),_("falling back to ArrayBuffer instantiation"),Y(r,n,o)}))}))).catch(e)}();var tr=function(t){return(tr=E.G)(t)},er=function(t){return(er=E.I)(t)},rr=function(){return(rr=E.J)()},nr=function(t){return(nr=E.K)(t)};i.__embind_initialize_bindings=function(){return(i.__embind_initialize_bindings=E.L)()};var or,ir=function(t){return(ir=E.M)(t)};function ar(){function e(){or||(or=!0,i.calledRun=!0,j||(i.noFSInit||mt.init.initialized||mt.init(),mt.ignorePermissions=!1,Q(M),t(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),function(){if(i.postRun)for("function"==typeof i.postRun&&(i.postRun=[i.postRun]);i.postRun.length;)I(i.postRun.shift());Q(R)}()))}z>0||(function(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)W(i.preRun.shift());Q(x)}(),z>0||(i.setStatus?(i.setStatus("Running..."),setTimeout((function(){setTimeout((function(){i.setStatus("")}),1),e()}),1)):e()))}if(i.dynCall_jiji=function(t,e,r,n,o){return(i.dynCall_jiji=E.N)(t,e,r,n,o)},i._ff_h264_cabac_tables=67061,L=function t(){or||ar(),or||(L=t)},i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return ar(),r.ready}),tt=Q,et=function(t){function e(t){return o(this,e),n(this,e,[tt,(null==t?void 0:t.wasmPath)?fetch(null==t?void 0:t.wasmPath).then((function(t){return t.arrayBuffer()})):void 0,null==t?void 0:t.workerMode,null==t?void 0:t.canvas,null==t?void 0:t.yuvMode])}return f(e,t),a(e)}(Y),rt=function(){var t="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0;return function(){var e,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=i;s.ready=new Promise((function(t,n){e=t,r=n}));var u=Object.assign({},s),l="object"==("undefined"==typeof window?"undefined":m(window)),d="function"==typeof importScripts;"object"==("undefined"==typeof process?"undefined":m(process))&&"object"==m(process.versions)&&process.versions.node;var p,h="";(l||d)&&(d?h=self.location.href:"undefined"!=typeof document&&document.currentScript&&(h=document.currentScript.src),t&&(h=t),h=0!==h.indexOf("blob:")?h.substr(0,h.replace(/[?#].*/,"").lastIndexOf("/")+1):"",d&&(p=function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}));var v,y,w,b=s.print||console.log.bind(console),E=s.printErr||console.error.bind(console);Object.assign(s,u),u=null,s.arguments&&s.arguments,s.thisProgram&&s.thisProgram,s.quit&&s.quit,s.wasmBinary&&(v=s.wasmBinary),s.noExitRuntime,"object"!=("undefined"==typeof WebAssembly?"undefined":m(WebAssembly))&&z("no native wasm support detected");var k,_,P,T,C,A,$,S,D,O=!1;var F=[],j=[],x=[];function M(t){F.unshift(t)}function R(t){x.unshift(t)}var W=0,I=null;function z(t){s.onAbort&&s.onAbort(t),E(t="Aborted("+t+")"),O=!0,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw r(e),e}var L,U,N="data:application/octet-stream;base64,";function B(t){return t.startsWith(N)}function H(t){if(t==L&&v)return new Uint8Array(v);if(p)return p(t);throw"both async and sync fetching of the wasm failed"}function V(t,e,r){return function(t){return v||!l&&!d||"function"!=typeof fetch?Promise.resolve().then((function(){return H(t)})):fetch(t,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+t+"'";return e.arrayBuffer()})).catch((function(){return H(t)}))}(t).then((function(t){return WebAssembly.instantiate(t,e)})).then((function(t){return t})).then(r,(function(t){E("failed to asynchronously prepare wasm: "+t),z(t)}))}B(L="videodec_simd.wasm")||(U=L,L=s.locateFile?s.locateFile(U,h):h+U);var G=function(t){for(;t.length>0;)t.shift()(s)};function q(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){A[this.ptr+4>>2]=t},this.get_type=function(){return A[this.ptr+4>>2]},this.set_destructor=function(t){A[this.ptr+8>>2]=t},this.get_destructor=function(){return A[this.ptr+8>>2]},this.set_caught=function(t){t=t?1:0,k[this.ptr+12|0]=t},this.get_caught=function(){return 0!=k[this.ptr+12|0]},this.set_rethrown=function(t){t=t?1:0,k[this.ptr+13|0]=t},this.get_rethrown=function(){return 0!=k[this.ptr+13|0]},this.init=function(t,e){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(e)},this.set_adjusted_ptr=function(t){A[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return A[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Fe(this.get_type()))return A[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}function X(t){switch(t){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: ".concat(t))}}var K=void 0;function J(t){for(var e="",r=t;_[r];)e+=K[_[r++]];return e}var Y={},Z={},Q={},tt=void 0;function et(t){throw new tt(t)}var rt=void 0;function nt(t){throw new rt(t)}function ot(t,e,r){function n(e){var n=r(e);n.length!==t.length&&nt("Mismatched type converter count");for(var o=0;o<t.length;++o)it(t[o],n[o])}t.forEach((function(t){Q[t]=e}));var o=new Array(e.length),i=[],a=0;e.forEach((function(t,e){Z.hasOwnProperty(t)?o[e]=Z[t]:(i.push(t),Y.hasOwnProperty(t)||(Y[t]=[]),Y[t].push((function(){o[e]=Z[t],++a===i.length&&n(o)})))})),0===i.length&&n(o)}function it(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=e.name;if(t||et('type "'.concat(n,'" must have a positive integer typeid pointer')),Z.hasOwnProperty(t)){if(r.ignoreDuplicateRegistrations)return;et("Cannot register type '".concat(n,"' twice"))}if(Z[t]=e,delete Q[t],Y.hasOwnProperty(t)){var o=Y[t];delete Y[t],o.forEach((function(t){return t()}))}}(t,e,r)}function at(t){if(!(this instanceof $t))return!1;if(!(t instanceof $t))return!1;for(var e=this.$$.ptrType.registeredClass,r=this.$$.ptr,n=t.$$.ptrType.registeredClass,o=t.$$.ptr;e.baseClass;)r=e.upcast(r),e=e.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return e===n&&r===o}function st(t){et(t.$$.ptrType.registeredClass.name+" instance already deleted")}var ct=!1;function ut(t){}function ft(t){t.count.value-=1,0===t.count.value&&function(t){t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)}(t)}function lt(t,e,r){if(e===r)return t;if(void 0===r.baseClass)return null;var n=lt(t,e,r.baseClass);return null===n?null:r.downcast(n)}var dt={};function pt(){return Object.keys(wt).length}function ht(){var t=[];for(var e in wt)wt.hasOwnProperty(e)&&t.push(wt[e]);return t}var vt=[];function mt(){for(;vt.length;){var t=vt.pop();t.$$.deleteScheduled=!1,t.delete()}}var yt=void 0;function gt(t){yt=t,vt.length&&yt&&yt(mt)}var wt={};function bt(t,e){return e=function(t,e){for(void 0===e&&et("ptr should not be undefined");t.baseClass;)e=t.upcast(e),t=t.baseClass;return e}(t,e),wt[e]}function Et(t,e){return e.ptrType&&e.ptr||nt("makeClassHandle requires ptr and ptrType"),!!e.smartPtrType!==!!e.smartPtr&&nt("Both smartPtrType and smartPtr must be specified"),e.count={value:1},_t(Object.create(t,{$$:{value:e}}))}function kt(t){var e=this.getPointee(t);if(!e)return this.destructor(t),null;var r=bt(this.registeredClass,e);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=e,r.$$.smartPtr=t,r.clone();var n=r.clone();return this.destructor(t),n}function o(){return this.isSmartPointer?Et(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:e,smartPtrType:this,smartPtr:t}):Et(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var i,a=this.registeredClass.getActualType(e),s=dt[a];if(!s)return o.call(this);i=this.isConst?s.constPointerType:s.pointerType;var c=lt(e,this.registeredClass,i.registeredClass);return null===c?o.call(this):this.isSmartPointer?Et(i.registeredClass.instancePrototype,{ptrType:i,ptr:c,smartPtrType:this,smartPtr:t}):Et(i.registeredClass.instancePrototype,{ptrType:i,ptr:c})}var _t=function(t){return"undefined"==typeof FinalizationRegistry?(_t=function(t){return t},t):(ct=new FinalizationRegistry((function(t){ft(t.$$)})),ut=function(t){return ct.unregister(t)},(_t=function(t){var e=t.$$;if(!!e.smartPtr){var r={$$:e};ct.register(t,r,t)}return t})(t))};function Pt(){if(this.$$.ptr||st(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t,e=_t(Object.create(Object.getPrototypeOf(this),{$$:{value:(t=this.$$,{count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType})}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function Tt(){this.$$.ptr||st(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&et("Object already scheduled for deletion"),ut(this),ft(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Ct(){return!this.$$.ptr}function At(){return this.$$.ptr||st(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&et("Object already scheduled for deletion"),vt.push(this),1===vt.length&&yt&&yt(mt),this.$$.deleteScheduled=!0,this}function $t(){}var St=48,Dt=57;function Ot(t){if(void 0===t)return"_unknown";var e=(t=t.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return e>=St&&e<=Dt?"_".concat(t):t}function Ft(t,e){return c({},t=Ot(t),(function(){return e.apply(this,arguments)}))[t]}function jt(t,e,r){if(void 0===t[e].overloadTable){var n=t[e];t[e]=function(){return t[e].overloadTable.hasOwnProperty(arguments.length)||et("Function '".concat(r,"' called with an invalid number of arguments (").concat(arguments.length,") - expects one of (").concat(t[e].overloadTable,")!")),t[e].overloadTable[arguments.length].apply(this,arguments)},t[e].overloadTable=[],t[e].overloadTable[n.argCount]=n}}function xt(t,e,r,n,o,i,a,s){this.name=t,this.constructor=e,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=o,this.getActualType=i,this.upcast=a,this.downcast=s,this.pureVirtualFunctions=[]}function Mt(t,e,r){for(;e!==r;)e.upcast||et("Expected null or instance of ".concat(r.name,", got an instance of ").concat(e.name)),t=e.upcast(t),e=e.baseClass;return t}function Rt(t,e){if(null===e)return this.isReference&&et("null is not a valid ".concat(this.name)),0;e.$$||et('Cannot pass "'.concat(se(e),'" as a ').concat(this.name)),e.$$.ptr||et("Cannot pass deleted object as a pointer of type ".concat(this.name));var r=e.$$.ptrType.registeredClass;return Mt(e.$$.ptr,r,this.registeredClass)}function Wt(t,e){var r;if(null===e)return this.isReference&&et("null is not a valid ".concat(this.name)),this.isSmartPointer?(r=this.rawConstructor(),null!==t&&t.push(this.rawDestructor,r),r):0;e.$$||et('Cannot pass "'.concat(se(e),'" as a ').concat(this.name)),e.$$.ptr||et("Cannot pass deleted object as a pointer of type ".concat(this.name)),!this.isConst&&e.$$.ptrType.isConst&&et("Cannot convert argument of type ".concat(e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name," to parameter type ").concat(this.name));var n=e.$$.ptrType.registeredClass;if(r=Mt(e.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===e.$$.smartPtr&&et("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:e.$$.smartPtrType===this?r=e.$$.smartPtr:et("Cannot convert argument of type ".concat(e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name," to parameter type ").concat(this.name));break;case 1:r=e.$$.smartPtr;break;case 2:if(e.$$.smartPtrType===this)r=e.$$.smartPtr;else{var o=e.clone();r=this.rawShare(r,ae.toHandle((function(){o.delete()}))),null!==t&&t.push(this.rawDestructor,r)}break;default:et("Unsupporting sharing policy")}return r}function It(t,e){if(null===e)return this.isReference&&et("null is not a valid ".concat(this.name)),0;e.$$||et('Cannot pass "'.concat(se(e),'" as a ').concat(this.name)),e.$$.ptr||et("Cannot pass deleted object as a pointer of type ".concat(this.name)),e.$$.ptrType.isConst&&et("Cannot convert argument of type ".concat(e.$$.ptrType.name," to parameter type ").concat(this.name));var r=e.$$.ptrType.registeredClass;return Mt(e.$$.ptr,r,this.registeredClass)}function zt(t){return this.fromWireType(C[t>>2])}function Lt(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t}function Ut(t){this.rawDestructor&&this.rawDestructor(t)}function Nt(t){null!==t&&t.delete()}function Bt(t,e,r,n,o,i,a,s,c,u,f){this.name=t,this.registeredClass=e,this.isReference=r,this.isConst=n,this.isSmartPointer=o,this.pointeeType=i,this.sharingPolicy=a,this.rawGetPointee=s,this.rawConstructor=c,this.rawShare=u,this.rawDestructor=f,o||void 0!==e.baseClass?this.toWireType=Wt:n?(this.toWireType=Rt,this.destructorFunction=null):(this.toWireType=It,this.destructorFunction=null)}var Ht=[],Vt=function(t){var e=Ht[t];return e||(t>=Ht.length&&(Ht.length=t+1),Ht[t]=e=D.get(t)),e},Gt=function(t,e,r){return t.includes("j")?function(t,e,r){var n=s["dynCall_"+t];return r&&r.length?n.apply(null,[e].concat(r)):n.call(null,e)}(t,e,r):Vt(e).apply(null,r)},qt=function(t,e){var r=[];return function(){return r.length=0,Object.assign(r,arguments),Gt(t,e,r)}};function Xt(t,e){var r=(t=J(t)).includes("j")?qt(t,e):Vt(e);return"function"!=typeof r&&et("unknown function pointer with signature ".concat(t,": ").concat(e)),r}var Kt=void 0;function Jt(t){var e=De(t),r=J(e);return $e(e),r}function Yt(t,e){var r=[],n={};throw e.forEach((function t(e){n[e]||Z[e]||(Q[e]?Q[e].forEach(t):(r.push(e),n[e]=!0))})),new Kt("".concat(t,": ")+r.map(Jt).join([", "]))}function Zt(t,e){for(var r=[],n=0;n<t;n++)r.push(A[e+4*n>>2]);return r}function Qt(t){for(;t.length;){var e=t.pop();t.pop()(e)}}function te(t,e){if(!(t instanceof Function))throw new TypeError("new_ called with constructor type ".concat(m(t)," which is not a function"));var r=Ft(t.name||"unknownFunctionName",(function(){}));r.prototype=t.prototype;var n=new r,o=t.apply(n,e);return o instanceof Object?o:n}function ee(t,e,r,n,o,i){var a=e.length;a<2&&et("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var s=null!==e[1]&&null!==r,c=!1,u=1;u<e.length;++u)if(null!==e[u]&&void 0===e[u].destructorFunction){c=!0;break}var f="void"!==e[0].name,l="",d="";for(u=0;u<a-2;++u)l+=(0!==u?", ":"")+"arg"+u,d+=(0!==u?", ":"")+"arg"+u+"Wired";var p="\n return function ".concat(Ot(t),"(").concat(l,") {\n if (arguments.length !== ").concat(a-2,") {\n throwBindingError('function ").concat(t," called with ").concat(arguments.length," arguments, expected ").concat(a-2," args!');\n }");c&&(p+="var destructors = [];\n");var h=c?"destructors":"null",v=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],m=[et,n,o,Qt,e[0],e[1]];s&&(p+="var thisWired = classParam.toWireType("+h+", this);\n");for(u=0;u<a-2;++u)p+="var arg"+u+"Wired = argType"+u+".toWireType("+h+", arg"+u+"); // "+e[u+2].name+"\n",v.push("argType"+u),m.push(e[u+2]);if(s&&(d="thisWired"+(d.length>0?", ":"")+d),p+=(f||i?"var rv = ":"")+"invoker(fn"+(d.length>0?", ":"")+d+");\n",c)p+="runDestructors(destructors);\n";else for(u=s?1:2;u<e.length;++u){var y=1===u?"thisWired":"arg"+(u-2)+"Wired";null!==e[u].destructorFunction&&(p+=y+"_dtor("+y+"); // "+e[u].name+"\n",v.push(y+"_dtor"),m.push(e[u].destructorFunction))}return f&&(p+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),p+="}\n",v.push(p),te(Function,v).apply(null,m)}function re(){this.allocated=[void 0],this.freelist=[]}var ne=new re;function oe(t){t>=ne.reserved&&0==--ne.get(t).refcount&&ne.free(t)}function ie(){for(var t=0,e=ne.reserved;e<ne.allocated.length;++e)void 0!==ne.allocated[e]&&++t;return t}var ae={toValue:function(t){return t||et("Cannot use deleted val. handle = "+t),ne.get(t).value},toHandle:function(t){switch(t){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return ne.allocate({refcount:1,value:t})}}};function se(t){if(null===t)return"null";var e=m(t);return"object"===e||"array"===e||"function"===e?t.toString():""+t}function ce(t,e){switch(e){case 2:return function(t){return this.fromWireType($[t>>2])};case 3:return function(t){return this.fromWireType(S[t>>3])};default:throw new TypeError("Unknown float type: "+t)}}function ue(t,e,r){switch(e){case 0:return r?function(t){return k[t]}:function(t){return _[t]};case 1:return r?function(t){return P[t>>1]}:function(t){return T[t>>1]};case 2:return r?function(t){return C[t>>2]}:function(t){return A[t>>2]};default:throw new TypeError("Unknown integer type: "+t)}}var fe="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,le=function(t,e,r){for(var n=e+r,o=e;t[o]&&!(o>=n);)++o;if(o-e>16&&t.buffer&&fe)return fe.decode(t.subarray(e,o));for(var i="";e<o;){var a=t[e++];if(128&a){var s=63&t[e++];if(192!=(224&a)){var c=63&t[e++];if((a=224==(240&a)?(15&a)<<12|s<<6|c:(7&a)<<18|s<<12|c<<6|63&t[e++])<65536)i+=String.fromCharCode(a);else{var u=a-65536;i+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else i+=String.fromCharCode((31&a)<<6|s)}else i+=String.fromCharCode(a)}return i};var de="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,pe=function(t,e){for(var r=t,n=r>>1,o=n+e/2;!(n>=o)&&T[n];)++n;if((r=n<<1)-t>32&&de)return de.decode(_.subarray(t,r));for(var i="",a=0;!(a>=e/2);++a){var s=P[t+2*a>>1];if(0==s)break;i+=String.fromCharCode(s)}return i},he=function(t,e,r){if(void 0===r&&(r=2147483647),r<2)return 0;for(var n=e,o=(r-=2)<2*t.length?r/2:t.length,i=0;i<o;++i){var a=t.charCodeAt(i);P[e>>1]=a,e+=2}return P[e>>1]=0,e-n},ve=function(t){return 2*t.length},me=function(t,e){for(var r=0,n="";!(r>=e/4);){var o=C[t+4*r>>2];if(0==o)break;if(++r,o>=65536){var i=o-65536;n+=String.fromCharCode(55296|i>>10,56320|1023&i)}else n+=String.fromCharCode(o)}return n},ye=function(t,e,r){if(void 0===r&&(r=2147483647),r<4)return 0;for(var n=e,o=n+r-4,i=0;i<t.length;++i){var a=t.charCodeAt(i);if(a>=55296&&a<=57343)a=65536+((1023&a)<<10)|1023&t.charCodeAt(++i);if(C[e>>2]=a,(e+=4)+4>o)break}return C[e>>2]=0,e-n},ge=function(t){for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);n>=55296&&n<=57343&&++r,e+=4}return e};var we={};var be=[];var Ee=[];var ke;ke=function(){return performance.now()};var _e,Pe,Te,Ce=[null,[],[]];!function(){for(var t=new Array(256),e=0;e<256;++e)t[e]=String.fromCharCode(e);K=t}(),tt=s.BindingError=function(t){function e(t){var r;return o(this,e),(r=n(this,e,[t])).name="BindingError",r}return f(e,t),a(e)}(g(Error)),rt=s.InternalError=function(t){function e(t){var r;return o(this,e),(r=n(this,e,[t])).name="InternalError",r}return f(e,t),a(e)}(g(Error)),$t.prototype.isAliasOf=at,$t.prototype.clone=Pt,$t.prototype.delete=Tt,$t.prototype.isDeleted=Ct,$t.prototype.deleteLater=At,s.getInheritedInstanceCount=pt,s.getLiveInheritedInstances=ht,s.flushPendingDeletes=mt,s.setDelayFunction=gt,Bt.prototype.getPointee=Lt,Bt.prototype.destructor=Ut,Bt.prototype.argPackAdvance=8,Bt.prototype.readValueFromPointer=zt,Bt.prototype.deleteObject=Nt,Bt.prototype.fromWireType=kt,Kt=s.UnboundTypeError=(_e=Error,(Te=Ft(Pe="UnboundTypeError",(function(t){this.name=Pe,this.message=t;var e=new Error(t).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))}))).prototype=Object.create(_e.prototype),Te.prototype.constructor=Te,Te.prototype.toString=function(){return void 0===this.message?this.name:"".concat(this.name,": ").concat(this.message)},Te),Object.assign(re.prototype,{get:function(t){return this.allocated[t]},has:function(t){return void 0!==this.allocated[t]},allocate:function(t){var e=this.freelist.pop()||this.allocated.length;return this.allocated[e]=t,e},free:function(t){this.allocated[t]=void 0,this.freelist.push(t)}}),ne.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),ne.reserved=ne.allocated.length,s.count_emval_handles=ie;var Ae={o:function(t,e,r){throw new q(t).init(e,r),t},r:function(t,e,r,n,o){},m:function(t,e,r,n,o){var i=X(r);it(t,{name:e=J(e),fromWireType:function(t){return!!t},toWireType:function(t,e){return e?n:o},argPackAdvance:8,readValueFromPointer:function(t){var n;if(1===r)n=k;else if(2===r)n=P;else{if(4!==r)throw new TypeError("Unknown boolean type size: "+e);n=C}return this.fromWireType(n[t>>i])},destructorFunction:null})},q:function(t,e,r,n,o,i,a,c,u,f,l,d,p){l=J(l),i=Xt(o,i),c&&(c=Xt(a,c)),f&&(f=Xt(u,f)),p=Xt(d,p);var h=Ot(l);!function(t,e,r){s.hasOwnProperty(t)?(et("Cannot register public name '".concat(t,"' twice")),jt(s,t,t),s.hasOwnProperty(r)&&et("Cannot register multiple overloads of a function with the same number of arguments (".concat(r,")!")),s[t].overloadTable[r]=e):s[t]=e}(h,(function(){Yt("Cannot construct ".concat(l," due to unbound types"),[n])})),ot([t,e,r],n?[n]:[],(function(e){var r,o;e=e[0],o=n?(r=e.registeredClass).instancePrototype:$t.prototype;var a=Ft(h,(function(){if(Object.getPrototypeOf(this)!==u)throw new tt("Use 'new' to construct "+l);if(void 0===d.constructor_body)throw new tt(l+" has no accessible constructor");var t=d.constructor_body[arguments.length];if(void 0===t)throw new tt("Tried to invoke ctor of ".concat(l," with invalid number of parameters (").concat(arguments.length,") - expected (").concat(Object.keys(d.constructor_body).toString(),") parameters instead!"));return t.apply(this,arguments)})),u=Object.create(o,{constructor:{value:a}});a.prototype=u;var d=new xt(l,a,u,p,r,i,c,f);d.baseClass&&(void 0===d.baseClass.__derivedClasses&&(d.baseClass.__derivedClasses=[]),d.baseClass.__derivedClasses.push(d));var v=new Bt(l,d,!0,!1,!1),m=new Bt(l+"*",d,!1,!1,!1),y=new Bt(l+" const*",d,!1,!0,!1);return dt[t]={pointerType:m,constPointerType:y},function(t,e,r){s.hasOwnProperty(t)||nt("Replacing nonexistant public symbol"),void 0!==s[t].overloadTable&&void 0!==r?s[t].overloadTable[r]=e:(s[t]=e,s[t].argCount=r)}(h,a),[v,m,y]}))},p:function(t,e,r,n,o,i){var a=Zt(e,r);o=Xt(n,o),ot([],[t],(function(t){t=t[0];var r="constructor ".concat(t.name);if(void 0===t.registeredClass.constructor_body&&(t.registeredClass.constructor_body=[]),void 0!==t.registeredClass.constructor_body[e-1])throw new tt("Cannot register multiple constructors with identical number of parameters (".concat(e-1,") for class '").concat(t.name,"'! Overload resolution is currently only performed using the parameter count, not actual type info!"));return t.registeredClass.constructor_body[e-1]=function(){Yt("Cannot construct ".concat(t.name," due to unbound types"),a)},ot([],a,(function(n){return n.splice(1,0,null),t.registeredClass.constructor_body[e-1]=ee(r,n,null,o,i),[]})),[]}))},d:function(t,e,r,n,o,i,a,s,c){var u=Zt(r,n);e=J(e),i=Xt(o,i),ot([],[t],(function(t){t=t[0];var n="".concat(t.name,".").concat(e);function o(){Yt("Cannot call ".concat(n," due to unbound types"),u)}e.startsWith("@@")&&(e=Symbol[e.substring(2)]),s&&t.registeredClass.pureVirtualFunctions.push(e);var f=t.registeredClass.instancePrototype,l=f[e];return void 0===l||void 0===l.overloadTable&&l.className!==t.name&&l.argCount===r-2?(o.argCount=r-2,o.className=t.name,f[e]=o):(jt(f,e,n),f[e].overloadTable[r-2]=o),ot([],u,(function(o){var s=ee(n,o,t,i,a,c);return void 0===f[e].overloadTable?(s.argCount=r-2,f[e]=s):f[e].overloadTable[r-2]=s,[]})),[]}))},u:function(t,e){it(t,{name:e=J(e),fromWireType:function(t){var e=ae.toValue(t);return oe(t),e},toWireType:function(t,e){return ae.toHandle(e)},argPackAdvance:8,readValueFromPointer:zt,destructorFunction:null})},k:function(t,e,r){var n=X(r);it(t,{name:e=J(e),fromWireType:function(t){return t},toWireType:function(t,e){return e},argPackAdvance:8,readValueFromPointer:ce(e,n),destructorFunction:null})},b:function(t,e,r,n,o){e=J(e);var i=X(r),a=function(t){return t};if(0===n){var s=32-8*r;a=function(t){return t<<s>>>s}}var c=e.includes("unsigned");it(t,{name:e,fromWireType:a,toWireType:c?function(t,e){return this.name,e>>>0}:function(t,e){return this.name,e},argPackAdvance:8,readValueFromPointer:ue(e,i,0!==n),destructorFunction:null})},a:function(t,e,r){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][e];function o(t){var e=A,r=e[t>>=2],o=e[t+1];return new n(e.buffer,o,r)}it(t,{name:r=J(r),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},j:function(t,e){var r="std::string"===(e=J(e));it(t,{name:e,fromWireType:function(t){var e,n,o,i=A[t>>2],a=t+4;if(r)for(var s=a,c=0;c<=i;++c){var u=a+c;if(c==i||0==_[u]){var f=(o=u-s,(n=s)?le(_,n,o):"");void 0===e?e=f:(e+=String.fromCharCode(0),e+=f),s=u+1}}else{var l=new Array(i);for(c=0;c<i;++c)l[c]=String.fromCharCode(_[a+c]);e=l.join("")}return $e(t),e},toWireType:function(t,e){var n;e instanceof ArrayBuffer&&(e=new Uint8Array(e));var o="string"==typeof e;o||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||et("Cannot pass non-string to std::string"),n=r&&o?function(t){for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);n<=127?e++:n<=2047?e+=2:n>=55296&&n<=57343?(e+=4,++r):e+=3}return e}(e):e.length;var i=Se(4+n+1),a=i+4;if(A[i>>2]=n,r&&o)(function(t,e,r,n){if(!(n>0))return 0;for(var o=r,i=r+n-1,a=0;a<t.length;++a){var s=t.charCodeAt(a);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&t.charCodeAt(++a)),s<=127){if(r>=i)break;e[r++]=s}else if(s<=2047){if(r+1>=i)break;e[r++]=192|s>>6,e[r++]=128|63&s}else if(s<=65535){if(r+2>=i)break;e[r++]=224|s>>12,e[r++]=128|s>>6&63,e[r++]=128|63&s}else{if(r+3>=i)break;e[r++]=240|s>>18,e[r++]=128|s>>12&63,e[r++]=128|s>>6&63,e[r++]=128|63&s}}e[r]=0})(e,_,a,n+1);else if(o)for(var s=0;s<n;++s){var c=e.charCodeAt(s);c>255&&($e(a),et("String has UTF-16 code units that do not fit in 8 bits")),_[a+s]=c}else for(s=0;s<n;++s)_[a+s]=e[s];return null!==t&&t.push($e,i),i},argPackAdvance:8,readValueFromPointer:zt,destructorFunction:function(t){$e(t)}})},g:function(t,e,r){var n,o,i,a,s;r=J(r),2===e?(n=pe,o=he,a=ve,i=function(){return T},s=1):4===e&&(n=me,o=ye,a=ge,i=function(){return A},s=2),it(t,{name:r,fromWireType:function(t){for(var r,o=A[t>>2],a=i(),c=t+4,u=0;u<=o;++u){var f=t+4+u*e;if(u==o||0==a[f>>s]){var l=n(c,f-c);void 0===r?r=l:(r+=String.fromCharCode(0),r+=l),c=f+e}}return $e(t),r},toWireType:function(t,n){"string"!=typeof n&&et("Cannot pass non-string to C++ string type ".concat(r));var i=a(n),c=Se(4+i+e);return A[c>>2]=i>>s,o(n,c+4,i+e),null!==t&&t.push($e,c),c},argPackAdvance:8,readValueFromPointer:zt,destructorFunction:function(t){$e(t)}})},n:function(t,e){it(t,{isVoid:!0,name:e=J(e),argPackAdvance:0,fromWireType:function(){},toWireType:function(t,e){}})},e:function(t,e,r,n){var o,i;(t=be[t])(e=ae.toValue(e),r=void 0===(i=we[o=r])?J(o):i,null,n)},l:oe,h:function(t,e){var r=function(t,e){for(var r,n,o,i=new Array(t),a=0;a<t;++a)i[a]=(r=A[e+4*a>>2],n="parameter "+a,o=void 0,void 0===(o=Z[r])&&et(n+" has unknown type "+Jt(r)),o);return i}(t,e),n=r[0],o=n.name+"_$"+r.slice(1).map((function(t){return t.name})).join("_")+"$",i=Ee[o];if(void 0!==i)return i;for(var a=["retType"],s=[n],c="",u=0;u<t-1;++u)c+=(0!==u?", ":"")+"arg"+u,a.push("argType"+u),s.push(r[1+u]);var f="return function "+Ot("methodCaller_"+o)+"(handle, name, destructors, args) {\n",l=0;for(u=0;u<t-1;++u)f+=" var arg"+u+" = argType"+u+".readValueFromPointer(args"+(l?"+"+l:"")+");\n",l+=r[u+1].argPackAdvance;for(f+=" var rv = handle[name]("+c+");\n",u=0;u<t-1;++u)r[u+1].deleteObject&&(f+=" argType"+u+".deleteObject(arg"+u+");\n");n.isVoid||(f+=" return retType.toWireType(destructors, rv);\n"),f+="};\n",a.push(f);var d,p,h=te(Function,a).apply(null,s);return d=h,p=be.length,be.push(d),i=p,Ee[o]=i,i},f:function(){z("")},c:ke,t:function(t,e,r){return _.copyWithin(t,e,e+r)},s:function(t){_.length,z("OOM")},i:function(t,e,r,n){for(var o,i,a,s=0,c=0;c<r;c++){var u=A[e>>2],f=A[e+4>>2];e+=8;for(var l=0;l<f;l++)o=t,i=_[u+l],a=void 0,a=Ce[o],0===i||10===i?((1===o?b:E)(le(a,0)),a.length=0):a.push(i);s+=f}return A[n>>2]=s,0}};!function(){var t,e,n,o,i={a:Ae};function a(t,e){var r,n=t.exports;return y=(w=n).v,r=y.buffer,s.HEAP8=k=new Int8Array(r),s.HEAP16=P=new Int16Array(r),s.HEAP32=C=new Int32Array(r),s.HEAPU8=_=new Uint8Array(r),s.HEAPU16=T=new Uint16Array(r),s.HEAPU32=A=new Uint32Array(r),s.HEAPF32=$=new Float32Array(r),s.HEAPF64=S=new Float64Array(r),D=w.z,function(t){j.unshift(t)}(w.w),function(){if(W--,s.monitorRunDependencies&&s.monitorRunDependencies(W),0==W&&I){var t=I;I=null,t()}}(),n}if(W++,s.monitorRunDependencies&&s.monitorRunDependencies(W),s.instantiateWasm)try{return s.instantiateWasm(i,a)}catch(t){E("Module.instantiateWasm callback failed with error: "+t),r(t)}(t=v,e=L,n=i,o=function(t){a(t.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||B(e)||"function"!=typeof fetch?V(e,n,o):fetch(e,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,n).then(o,(function(t){return E("wasm streaming compile failed: "+t),E("falling back to ArrayBuffer instantiation"),V(e,n,o)}))}))).catch(r)}();var $e=function(t){return($e=w.x)(t)},Se=function(t){return(Se=w.y)(t)},De=function(t){return(De=w.A)(t)};s.__embind_initialize_bindings=function(){return(s.__embind_initialize_bindings=w.B)()};var Oe,Fe=function(t){return(Fe=w.C)(t)};function je(){function t(){Oe||(Oe=!0,s.calledRun=!0,O||(G(j),e(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),function(){if(s.postRun)for("function"==typeof s.postRun&&(s.postRun=[s.postRun]);s.postRun.length;)R(s.postRun.shift());G(x)}()))}W>0||(!function(){if(s.preRun)for("function"==typeof s.preRun&&(s.preRun=[s.preRun]);s.preRun.length;)M(s.preRun.shift());G(F)}(),W>0||(s.setStatus?(s.setStatus("Running..."),setTimeout((function(){setTimeout((function(){s.setStatus("")}),1),t()}),1)):t()))}if(s.dynCall_jiji=function(t,e,r,n,o){return(s.dynCall_jiji=w.D)(t,e,r,n,o)},I=function t(){Oe||je(),Oe||(I=t)},s.preInit)for("function"==typeof s.preInit&&(s.preInit=[s.preInit]);s.preInit.length>0;)s.preInit.pop()();return je(),i.ready}}(),nt=rt,ot=function(t){function e(t){return o(this,e),n(this,e,[nt,(null==t?void 0:t.wasmPath)?fetch(t.wasmPath).then((function(t){return t.arrayBuffer()})):void 0,null==t?void 0:t.workerMode,null==t?void 0:t.canvas,null==t?void 0:t.yuvMode])}return f(e,t),a(e)}(Y);function it(){return performance&&performance.now?Math.floor(performance.now()):Date.now()}var at=function(){function t(e){o(this,t),this.core=e,M(this,"contextMap",new Map),M(this,"decodeProcessorMap",new WeakMap),this.addKVReportBeforeExitRoom=this.addKVReportBeforeExitRoom.bind(this),this.createDecoder=this.createDecoder.bind(this),this.core.innerEmitter.on("51",this.addKVReportBeforeExitRoom)}return a(t,[{key:"getAlias",value:function(){return"videoDecoder"}},{key:"getGroup",value:function(t){return(null==t?void 0:t.track)?"".concat(t.track.userId).concat(t.track.streamType):"*"}},{key:"getName",value:function(){return t.Name}},{key:"getValidateRule",value:function(t){return{type:this.core.enums.BASIC_TYPE.Object}}},{key:"createDecoder",value:function(t,e){switch(t){case"wasm":return this.core.rtcDectection.isSIMDSupported()?new ot(j(F({},e),{wasmPath:"".concat(this.core.assetsPath||".","/videodec_simd.wasm")})):new et(j(F({},e),{wasmPath:"".concat(this.core.assetsPath||".","/videodec.wasm")}));case"webCodecs":return new K;case"mse":throw new Error("mse decoder not supported yet");default:throw new Error("Unsupported decoder type")}}},{key:"start",value:function(t){var e=this;this.decodeProcessorMap.set(t.track,this.decode(t)),this.core.room.videoManager.addDecodeProcessor({processor:function(t){var r,n=t.frame,o=t.track;return(null==(r=e.decodeProcessorMap.get(o))?void 0:r({frame:n,track:o}))||n},type:3})}},{key:"decode",value:function(t){var e=this,r=this.core.rx,n=r.pipe,o=r.take,i=r.subscribe;return function(r){var a=r.frame,s=r.track;if(s!==t.track||"empty"===a.type)return a;if(e.contextMap.has(s))return e.contextMap.get(s).decode(a);var c=e.core.room.videoManager.createDecodeContext(j(F({},t),{createDecoder:e.createDecoder}));return n(c.trackDoneOB,o(1),i((function(){e.core.clearStarted(e,e.getGroup(t)),e.stop({track:s})}))),e.contextMap.set(s,c),c.decode(a)}}},{key:"stop",value:function(t){var e=this;if(null==t?void 0:t.track){var r=this.contextMap.get(t.track);r&&(r.close("stop"),this.report(r,t.track),this.contextMap.delete(t.track))}else this.contextMap.forEach((function(t,r){t.close("stop"),e.contextMap.delete(r)}));0===this.contextMap.size&&this.core.room.videoManager.removeDecodeProcessor({type:3})}},{key:"report",value:function(t,e){if(!t.isReported){t.isReported=!0;var r=it()-t.startPerformanceTime,n=this.getRemoteTrackFreezeDuration(e,t),o=n.renderFreezeTotal,i=n.dataFreezeTotal;r&&this.core.kvStatManager.addNumber({key:514850,value:Math.floor(o/r*100),split:1}),r&&this.core.kvStatManager.addNumber({key:514851,value:Math.floor(i/r*100),split:1}),t.inputFrameCount&&this.core.kvStatManager.addNumber({key:514852,value:Math.floor(t.decodedFrameCount/t.inputFrameCount*100),split:1})}}},{key:"addKVReportBeforeExitRoom",value:function(t){var e=this;t.room===this.core.room&&this.contextMap.forEach((function(t,r){e.report(t,r)}))}},{key:"update",value:function(t){var e=this.contextMap.get(t.track);e&&("mock"!==t.type?(e.close("update"),this.contextMap.set(t.track,this.core.room.videoManager.createDecodeContext(j(F({},t),{createDecoder:this.createDecoder})))):e.mock(this.core.enums.DECODE_FAILED_ERROR_CODE.TEST))}},{key:"getRemoteTrackFreezeDuration",value:function(t,e){var r=this.core.room.badCaseDetector.getRenderFreezeMap().get("".concat(t.userId,"_").concat(t.streamType)),n=this.core.room.badCaseDetector.getDataFreezeMap().get("".concat(t.userId,"_").concat(t.streamType)),o=0;r&&r.freezeTimeline.forEach((function(t){var r=t.startTime,n=t.endTime;r>e.startPerformanceTime&&(o+=0===n?it()-r:n-r)}));var i=0;return n&&n.durationItemList.forEach((function(t){t.startTime>e.startPerformanceTime&&(i+=t.getDuration())})),{renderFreezeTotal:o,dataFreezeTotal:i}}},{key:"destroy",value:function(){this.core.innerEmitter.off("51",this.addKVReportBeforeExitRoom)}}])}();return M(at,"Name","VideoDecoderPlugin"),at}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).TRTCVideoDecoder=e()}(this,(function(){"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function e(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function r(t){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=t.apply(r,n);function s(t){e(a,o,i,s,c,"next",t)}function c(t){e(a,o,i,s,c,"throw",t)}s(void 0)}))}}function n(t,e,r){return e=u(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,l()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,v(n.key),n)}}function a(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=y(t))||e){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}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 i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function c(t,e,r){return(e=v(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function f(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}function l(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(l=function(){return!!t})()}function d(){d=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=e&&e.prototype instanceof g?e:g,a=Object.create(i.prototype),s=new F(n||[]);return o(a,"_invoke",{value:S(t,r,s)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var h="suspendedStart",p="suspendedYield",v="executing",m="completed",y={};function g(){}function w(){}function b(){}var E={};u(E,a,(function(){return this}));var k=Object.getPrototypeOf,_=k&&k(k(O([])));_&&_!==r&&n.call(_,a)&&(E=_);var P=b.prototype=g.prototype=Object.create(E);function T(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function C(t,e){function r(o,i,a,s){var c=l(t[o],t,i);if("throw"!==c.type){var u=c.arg,f=u.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(f).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,s)}))}s(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function S(e,r,n){var o=h;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var c=A(s,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var u=l(e,r,n);if("normal"===u.type){if(o=n.done?m:p,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=m,n.method="throw",n.arg=u.arg)}}}function A(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,A(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=l(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function F(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function O(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=b,o(P,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:w,configurable:!0}),w.displayName=u(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,c,"GeneratorFunction")),t.prototype=Object.create(P),t},e.awrap=function(t){return{__await:t}},T(C.prototype),u(C.prototype,s,(function(){return this})),e.AsyncIterator=C,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new C(f(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},T(P),u(P,c,"Generator"),u(P,a,(function(){return this})),u(P,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=O,F.prototype={constructor:F,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(x),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:O(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}function p(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}function m(t){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},m(t)}function y(e,r){if(e){if("string"==typeof e)return t(e,r);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}function g(t){var e="function"==typeof Map?new Map:void 0;return g=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return function(t,e,r){if(l())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&h(o,r.prototype),o}(t,arguments,u(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),h(r,t)},g(t)}var w,b,E=Object.create,k=Object.defineProperty,_=Object.defineProperties,P=Object.getOwnPropertyDescriptor,T=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertyNames,S=Object.getOwnPropertySymbols,A=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable,F=function(t,e,r){return e in t?k(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r},O=function(t,e){for(var r in e||(e={}))D.call(e,r)&&F(t,r,e[r]);if(S){var n,o=s(S(e));try{for(o.s();!(n=o.n()).done;){r=n.value;x.call(e,r)&&F(t,r,e[r])}}catch(t){o.e(t)}finally{o.f()}}return t},j=function(t,e){return _(t,T(e))},M=function(t,e,r,n){for(var o,i=P(e,r),a=t.length-1;a>=0;a--)(o=t[a])&&(i=o(e,r,i)||i);return i&&k(e,r,i),i},$=function(t,e,r){return F(t,"symbol"!==m(e)?e+"":e,r)},R=(w={"../node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.js":function(t,e){var r=Object.prototype.hasOwnProperty,n="~";function o(){}function i(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function a(t,e,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||t,a),c=n?n+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],s]:t._events[c].push(s):(t._events[c]=s,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new o:delete t._events[e]}function c(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),c.prototype.eventNames=function(){var t,e,o=[];if(0===this._eventsCount)return o;for(e in t=this._events)r.call(t,e)&&o.push(n?e.slice(1):e);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},c.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,a=new Array(i);o<i;o++)a[o]=r[o].fn;return a},c.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},c.prototype.emit=function(t,e,r,o,i,a){var s=n?n+t:t;if(!this._events[s])return!1;var c,u,f=this._events[s],l=arguments.length;if(f.fn){switch(f.once&&this.removeListener(t,f.fn,void 0,!0),l){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,e),!0;case 3:return f.fn.call(f.context,e,r),!0;case 4:return f.fn.call(f.context,e,r,o),!0;case 5:return f.fn.call(f.context,e,r,o,i),!0;case 6:return f.fn.call(f.context,e,r,o,i,a),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];f.fn.apply(f.context,c)}else{var d,h=f.length;for(u=0;u<h;u++)switch(f[u].once&&this.removeListener(t,f[u].fn,void 0,!0),l){case 1:f[u].fn.call(f[u].context);break;case 2:f[u].fn.call(f[u].context,e);break;case 3:f[u].fn.call(f[u].context,e,r);break;case 4:f[u].fn.call(f[u].context,e,r,o);break;default:if(!c)for(d=1,c=new Array(l-1);d<l;d++)c[d-1]=arguments[d];f[u].fn.apply(f[u].context,c)}}return!0},c.prototype.on=function(t,e,r){return a(this,t,e,r,!1)},c.prototype.once=function(t,e,r){return a(this,t,e,r,!0)},c.prototype.removeListener=function(t,e,r,o){var i=n?n+t:t;if(!this._events[i])return this;if(!e)return s(this,i),this;var a=this._events[i];if(a.fn)a.fn!==e||o&&!a.once||r&&a.context!==r||s(this,i);else{for(var c=0,u=[],f=a.length;c<f;c++)(a[c].fn!==e||o&&!a[c].once||r&&a[c].context!==r)&&u.push(a[c]);u.length?this._events[i]=1===u.length?u[0]:u:s(this,i)}return this},c.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&s(this,e)):(this._events=new o,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=n,c.EventEmitter=c,void 0!==e&&(e.exports=c)}},function(){return b||(0,w[C(w)[0]])((b={exports:{}}).exports,b),b.exports}),L=function(t,e,r){return r=null!=t?E(A(t)):{},function(t,e,r,n){if(e&&"object"===m(e)||"function"==typeof e){var o,i=s(C(e));try{var a=function(){var i=o.value;D.call(t,i)||i===r||k(t,i,{get:function(){return e[i]},enumerable:!(n=P(e,i))||n.enumerable})};for(i.s();!(o=i.n()).done;)a()}catch(t){i.e(t)}finally{i.f()}}return t}(k(r,"default",{value:t,enumerable:!0}),t)}(R()),z=Symbol("instance"),N=Symbol("cacheResult"),I=function(){return a((function t(e,r,n){o(this,t),this.oldState=e,this.newState=r,this.action=n,this.aborted=!1}),[{key:"abort",value:function(t){this.aborted=!0,q.call(t,this.oldState,new Error("action '".concat(this.action,"' aborted")))}},{key:"toString",value:function(){return"".concat(this.action,"ing")}}])}(),B=function(t){function e(t,r,i){var a;return o(this,e),(a=n(this,e,[r])).state=t,a.message=r,a.cause=i,a}return f(e,t),a(e)}(g(Error));var U=new Map;function W(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(n,o,i){var a=r.action||o;if(!r.context){var s=U.get(n)||[];U.has(n)||U.set(n,s),s.push({from:t,to:e,action:a})}var c=i.value;i.value=function(){for(var n,o=this,i=this,s=arguments.length,u=new Array(s),f=0;f<s;f++)u[f]=arguments[f];r.context&&(i=X.get("function"==typeof r.context?(n=r.context).call.apply(n,[this].concat(u)):r.context));if(i.state===e)return r.sync?i[N]:Promise.resolve(i[N]);i.state instanceof I&&i.state.action==r.abortAction&&i.state.abort(i);var l=null;Array.isArray(t)?0==t.length?i.state instanceof I&&i.state.abort(i):"string"==typeof i.state&&t.includes(i.state)||(l=new B(i._state,"".concat(i.name," ").concat(a," to ").concat(e," failed: current state ").concat(i._state," not from ").concat(t.join("|")))):t!==i.state&&(l=new B(i._state,"".concat(i.name," ").concat(a," to ").concat(e," failed: current state ").concat(i._state," not from ").concat(t)));var d=function(t){if(r.fail&&r.fail.call(o,t),r.sync){if(r.ignoreError)return t;throw t}return r.ignoreError?Promise.resolve(t):Promise.reject(t)};if(l)return d(l);var h=i.state,p=new I(h,e,a);q.call(i,p);var v,y=function(t){var n;return i[N]=t,p.aborted||(q.call(i,e),null===(n=r.success)||void 0===n||n.call(o,i[N])),t},g=function(t){return q.call(i,h,t),d(t)};try{var w=c.apply(this,u);return"object"===m(v=w)&&v&&"then"in v?w.then(y).catch(g):r.sync?y(w):Promise.resolve(y(w))}catch(r){return g(new B(i._state,"".concat(i.name," ").concat(a," from ").concat(t," to ").concat(e," failed: ").concat(r),r instanceof Error?r:new Error(String(r))))}}}}var H,V,G=(H="undefined"!=typeof window&&window.__AFSM__,V="undefined"!=typeof importScripts,H?function(t,e){window.dispatchEvent(new CustomEvent(t,{detail:e}))}:V?function(t,e){postMessage({type:t,payload:e})}:function(){});function q(t,e){var r=this._state;this._state=t;var n=t.toString();t&&this.emit(n,r),this.emit(X.STATECHANGED,t,r,e),this.updateDevTools({value:t,old:r,err:e instanceof Error?e.message:String(e)})}var X=function(t){function e(t,r,i){var a;o(this,e),(a=n(this,e)).name=t,a.groupName=r,a._state=e.INIT,t||(t=Date.now().toString(36)),i?Object.setPrototypeOf(a,i):i=Object.getPrototypeOf(a),r||(a.groupName=a.constructor.name);var s=i[z];return s?a.name=s.name+"-"+s.count++:i[z]={name:a.name,count:0},a.updateDevTools({diagram:a.stateDiagram}),a}return f(e,t),a(e,[{key:"stateDiagram",get:function(){var t=Object.getPrototypeOf(this),e=U.get(t)||[],r=new Set,n=[],o=[],i=new Set,a=Object.getPrototypeOf(t);U.has(a)&&(a.stateDiagram.forEach((function(t){return r.add(t)})),a.allStates.forEach((function(t){return i.add(t)}))),e.forEach((function(t){var e=t.from,r=t.to,i=t.action;"string"==typeof e?n.push({from:e,to:r,action:i}):e.length?e.forEach((function(t){n.push({from:t,to:r,action:i})})):o.push({to:r,action:i})})),n.forEach((function(t){var e=t.from,n=t.to,o=t.action;i.add(e),i.add(n),i.add(o+"ing"),r.add("".concat(e," --\x3e ").concat(o,"ing : ").concat(o)),r.add("".concat(o,"ing --\x3e ").concat(n," : ").concat(o," 🟢")),r.add("".concat(o,"ing --\x3e ").concat(e," : ").concat(o," 🔴"))})),o.forEach((function(t){var e=t.to,n=t.action;r.add("".concat(n,"ing --\x3e ").concat(e," : ").concat(n," 🟢")),i.forEach((function(t){t!==e&&r.add("".concat(t," --\x3e ").concat(n,"ing : ").concat(n))}))}));var s=p(r);return Object.defineProperties(t,{stateDiagram:{value:s},allStates:{value:i}}),s}},{key:"updateDevTools",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};G(e.UPDATEAFSM,Object.assign({name:this.name,group:this.groupName},t))}},{key:"state",get:function(){return this._state},set:function(t){q.call(this,t)}}],[{key:"get",value:function(t){var r;return"string"==typeof t?(r=e.instances.get(t))||e.instances.set(t,r=new e(t,void 0,Object.create(e.prototype))):(r=e.instances2.get(t))||e.instances2.set(t,r=new e(t.constructor.name,void 0,Object.create(e.prototype))),r}},{key:"getState",value:function(t){var r;return null===(r=e.get(t))||void 0===r?void 0:r.state}}])}(L.default);X.STATECHANGED="stateChanged",X.UPDATEAFSM="updateAFSM",X.INIT="[*]",X.ON="on",X.OFF="off",X.instances=new Map,X.instances2=new WeakMap;var K=function(t){function e(){var t;return o(this,e),t=n(this,e,arguments),$(t,"decoder"),$(t,"config"),t}return f(e,t),a(e,[{key:"initialize",value:(i=r(d().mark((function t(){var e=this;return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.decoder=new VideoDecoder({output:function(t){e.emit("videoFrame",t)},error:function(t){e.close(),e.emit("error",t)}});case 1:case"end":return t.stop()}}),t,this)}))),function(){return i.apply(this,arguments)})},{key:"configure",value:function(t){this.config=t,this.decoder.configure(j(O({},t),{codec:this.getCodec(t)}))}},{key:"getCodec",value:function(t){switch(t.codec){case"hevc":return"hvc1.1.6.L0.12.34.56.78.9A.BC";case"av1":return"av01.0.05M.08";case"avc":return"avc1.420028";default:return t.codec}}},{key:"decode",value:function(t){"configured"===this.decoder.state&&this.decoder.decode(new EncodedVideoChunk(t))}},{key:"flush",value:function(){this.decoder.flush()}},{key:"reset",value:function(){this.decoder.reset()}},{key:"close",value:function(){"closed"!==this.decoder.state&&this.decoder.close()}}]);var i}(X);function J(){var t;self.onmessage=function(e){if("init"===e.data.type){var r=e.data,n=r.canvas,o=r.wasmScript,i=r.wasmBinary,a=null==n?void 0:n.getContext("2d"),s=0,c=0,u={wasmBinary:i,postRun:function(){t=new u.VideoDecoder({videoInfo:function(t,e){s=t,c=e,console.log("video info",t,e)},yuvData:function(t,e){var r=s*c,o=r>>2,i=u.HEAPU32[t>>2],f=u.HEAPU32[1+(t>>2)],l=u.HEAPU32[2+(t>>2)],d=u.HEAPU8.subarray(i,i+r),h=u.HEAPU8.subarray(f,f+o),p=u.HEAPU8.subarray(l,l+o),v=new Uint8Array(r+o+o);v.set(d),v.set(h,r),v.set(p,r+o);var m=new VideoFrame(v,{codedWidth:s,codedHeight:c,format:"I420",timestamp:e});n?(null==a||a.drawImage(m,0,0,n.width,n.height),null==a||a.commit()):self.postMessage({type:"yuvData",videoFrame:m},[m])}}),self.postMessage({type:"ready"})}};Function("var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;return "+o)()(u)}else if("decode"===e.data.type){var f=e.data.packet;null==t||t.decode(f.data,"key"==f.type,f.timestamp)}else if("setCodec"===e.data.type){var l=e.data,d=l.codec,h=l.format,p=l.description;null==t||t.setCodec(d,h,null!=p?p:"")}}}M([W([X.INIT,"closed"],"initialized")],K.prototype,"initialize"),M([W("initialized","configured",{sync:!0})],K.prototype,"configure"),M([function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(t,r,n){var o=n.value,i=r;n.value=function(){if(!e.includes(this.state.toString()))throw new B(this.state,"".concat(this.name," ").concat(i," failed: current state ").concat(this.state," not in ").concat(e));for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return o.apply(this,r)}}}("configured")],K.prototype,"decode"),M([W([],X.INIT,{sync:!0})],K.prototype,"reset"),M([W([],"closed",{ignoreError:!0,sync:!0})],K.prototype,"close");var Y=function(t){function e(t,r){var i,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0,c=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return o(this,e),(i=n(this,e)).createModule=t,i.wasmBinary=r,i.workerMode=a,i.canvas=s,i.yuvMode=c,$(i,"worker"),$(i,"decoder"),$(i,"config"),$(i,"module",{}),$(i,"width",0),$(i,"height",0),i}return f(e,t),a(e,[{key:"initialize",value:(i=r(d().mark((function t(e){var r,n,o,i,a,s=this;return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.workerMode){t.next=10;break}return n=new RegExp("\\{(.+)\\}","s").exec(J.toString())[1],this.worker=new Worker(URL.createObjectURL(new Blob([n],{type:"text/javascript"}))),o=null==(r=this.canvas)?void 0:r.transferControlToOffscreen(),t.next=6,this.wasmBinary;case 6:return i=t.sent,console.warn("worker mode",i),this.worker.postMessage({type:"init",canvas:o,wasmScript:this.createModule.toString(),wasmBinary:i},o?[o,i]:[i]),t.abrupt("return",new Promise((function(t){s.worker.onmessage=function(e){if("ready"===e.data.type)delete s.wasmBinary,t(),console.warn("worker mode initialize success");else if("yuvData"===e.data.type){var r=e.data.videoFrame;s.emit("videoFrame",r)}}})));case 10:if(a=this.module,!this.wasmBinary){t.next=15;break}return t.next=14,this.wasmBinary;case 14:a.wasmBinary=t.sent;case 15:return a.print=function(t){return console.log(t)},a.printErr=function(t){return console.log("[JS] ERROR: ".concat(t))},a.onAbort=function(){return console.log("[JS] FATAL: WASM ABORTED")},t.abrupt("return",new Promise((function(t){a.postRun=function(e){s.decoder=new s.module.VideoDecoder(s),console.log("video soft decoder initialize success"),t()},e&&Object.assign(a,e),s.createModule(a)})));case 19:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"configure",value:function(t){var e,r,n;this.config=t;var o=this.config.codec.startsWith("avc")?"avc":"hevc",i=this.config.description?"avc"==o?"avcc":"hvcc":"annexb";null==(r=this.decoder)||r.setCodec(o,i,null!=(e=this.config.description)?e:""),null==(n=this.worker)||n.postMessage({type:"setCodec",codec:o,format:i,description:this.config.description})}},{key:"decode",value:function(t){var e,r;null==(e=this.decoder)||e.decode(t.data,"key"==t.type,t.timestamp),"configured"===this.state&&(null==(r=this.worker)||r.postMessage({type:"decode",packet:t}))}},{key:"flush",value:function(){}},{key:"reset",value:function(){this.config=void 0,this.decoder&&this.decoder.clear()}},{key:"close",value:function(){this.removeAllListeners(),this.decoder&&(this.decoder.clear(),this.decoder.delete())}},{key:"videoInfo",value:function(t,e){this.width=t,this.height=e;var r={width:t,height:e};this.emit("videoCodecInfo",r)}},{key:"yuvData",value:function(t,e){if(this.module){var r=this.width*this.height,n=r>>2,o=this.module.HEAPU32[t>>2],i=this.module.HEAPU32[1+(t>>2)],a=this.module.HEAPU32[2+(t>>2)],s=this.module.HEAPU8.subarray(o,o+r),c=this.module.HEAPU8.subarray(i,i+n),u=this.module.HEAPU8.subarray(a,a+n);if(this.yuvMode)this.emit("videoFrame",{y:s,u:c,v:u,timestamp:e});else{var f=new Uint8Array(r+n+n);f.set(s),f.set(c,r),f.set(u,r+n),this.emit("videoFrame",new VideoFrame(f,{codedWidth:this.width,codedHeight:this.height,format:"I420",timestamp:e}))}}}},{key:"errorInfo",value:function(t){var e={errMsg:t};this.emit("error",e)}}]);var i}(X);M([W([X.INIT,"closed"],"initialized")],Y.prototype,"initialize"),M([W("initialized","configured",{sync:!0})],Y.prototype,"configure"),M([W([],X.INIT,{sync:!0})],Y.prototype,"reset"),M([W([],"closed",{sync:!0})],Y.prototype,"close");var Z,Q=(Z="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(){var t,e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=r;i.ready=new Promise((function(r,n){t=r,e=n}));var s=Object.assign({},i),u="./this.program",l="object"==("undefined"==typeof window?"undefined":m(window)),d="function"==typeof importScripts;"object"==("undefined"==typeof process?"undefined":m(process))&&"object"==m(process.versions)&&process.versions.node;var h,p,v,y="";(l||d)&&(d?y=self.location.href:"undefined"!=typeof document&&document.currentScript&&(y=document.currentScript.src),Z&&(y=Z),y=0!==y.indexOf("blob:")?y.substr(0,y.replace(/[?#].*/,"").lastIndexOf("/")+1):"",h=function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},d&&(v=function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),p=function(t,e,r){var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?e(n.response):r()},n.onerror=r,n.send(null)});var w,b,E,k=i.print||console.log.bind(console),_=i.printErr||console.error.bind(console);Object.assign(i,s),s=null,i.arguments&&i.arguments,i.thisProgram&&(u=i.thisProgram),i.quit&&i.quit,i.wasmBinary&&(w=i.wasmBinary),i.noExitRuntime,"object"!=("undefined"==typeof WebAssembly?"undefined":m(WebAssembly))&&W("no native wasm support detected");var P,T,C,S,A,D,x,F,O,j=!1,M=[],$=[],R=[];function L(t){M.unshift(t)}function z(t){R.unshift(t)}var N=0,I=null;function B(t){N++,i.monitorRunDependencies&&i.monitorRunDependencies(N)}function U(t){if(N--,i.monitorRunDependencies&&i.monitorRunDependencies(N),0==N&&I){var e=I;I=null,e()}}function W(t){i.onAbort&&i.onAbort(t),_(t="Aborted("+t+")"),j=!0,t+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(t);throw e(r),r}var H,V,G,q,X="data:application/octet-stream;base64,";function K(t){return t.startsWith(X)}function J(t){if(t==H&&w)return new Uint8Array(w);if(v)return v(t);throw"both async and sync fetching of the wasm failed"}function Y(t,e,r){return function(t){return w||!l&&!d||"function"!=typeof fetch?Promise.resolve().then((function(){return J(t)})):fetch(t,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+t+"'";return e.arrayBuffer()})).catch((function(){return J(t)}))}(t).then((function(t){return WebAssembly.instantiate(t,e)})).then((function(t){return t})).then(r,(function(t){_("failed to asynchronously prepare wasm: "+t),W(t)}))}K(H="videodec.wasm")||(V=H,H=i.locateFile?i.locateFile(V,y):y+V);var Q=function(t){for(;t.length>0;)t.shift()(i)};function tt(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){D[this.ptr+4>>2]=t},this.get_type=function(){return D[this.ptr+4>>2]},this.set_destructor=function(t){D[this.ptr+8>>2]=t},this.get_destructor=function(){return D[this.ptr+8>>2]},this.set_caught=function(t){t=t?1:0,P[this.ptr+12|0]=t},this.get_caught=function(){return 0!=P[this.ptr+12|0]},this.set_rethrown=function(t){t=t?1:0,P[this.ptr+13|0]=t},this.get_rethrown=function(){return 0!=P[this.ptr+13|0]},this.init=function(t,e){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(e)},this.set_adjusted_ptr=function(t){D[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return D[this.ptr+16>>2]},this.get_exception_ptr=function(){if(ir(this.get_type()))return D[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}var et={isAbs:function(t){return"/"===t.charAt(0)},splitPath:function(t){return/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(t).slice(1)},normalizeArray:function(t,e){for(var r=0,n=t.length-1;n>=0;n--){var o=t[n];"."===o?t.splice(n,1):".."===o?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r;r--)t.unshift("..");return t},normalize:function(t){var e=et.isAbs(t),r="/"===t.substr(-1);return(t=et.normalizeArray(t.split("/").filter((function(t){return!!t})),!e).join("/"))||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t},dirname:function(t){var e=et.splitPath(t),r=e[0],n=e[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},basename:function(t){if("/"===t)return"/";var e=(t=(t=et.normalize(t)).replace(/\/$/,"")).lastIndexOf("/");return-1===e?t:t.substr(e+1)},join:function(){var t=Array.prototype.slice.call(arguments);return et.normalize(t.join("/"))},join2:function(t,e){return et.normalize(t+"/"+e)}},rt=function(t){return(rt=function(){if("object"==("undefined"==typeof crypto?"undefined":m(crypto))&&"function"==typeof crypto.getRandomValues)return function(t){return crypto.getRandomValues(t)};W("initRandomDevice")}())(t)},nt={resolve:function(){for(var t="",e=!1,r=arguments.length-1;r>=-1&&!e;r--){var n=r>=0?arguments[r]:mt.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";t=n+"/"+t,e=et.isAbs(n)}return(e?"/":"")+(t=et.normalizeArray(t.split("/").filter((function(t){return!!t})),!e).join("/"))||"."},relative:function(t,e){function r(t){for(var e=0;e<t.length&&""===t[e];e++);for(var r=t.length-1;r>=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=nt.resolve(t).substr(1),e=nt.resolve(e).substr(1);for(var n=r(t.split("/")),o=r(e.split("/")),i=Math.min(n.length,o.length),a=i,s=0;s<i;s++)if(n[s]!==o[s]){a=s;break}var c=[];for(s=a;s<n.length;s++)c.push("..");return(c=c.concat(o.slice(a))).join("/")}},ot="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,it=function(t,e,r){for(var n=e+r,o=e;t[o]&&!(o>=n);)++o;if(o-e>16&&t.buffer&&ot)return ot.decode(t.subarray(e,o));for(var i="";e<o;){var a=t[e++];if(128&a){var s=63&t[e++];if(192!=(224&a)){var c=63&t[e++];if((a=224==(240&a)?(15&a)<<12|s<<6|c:(7&a)<<18|s<<12|c<<6|63&t[e++])<65536)i+=String.fromCharCode(a);else{var u=a-65536;i+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else i+=String.fromCharCode((31&a)<<6|s)}else i+=String.fromCharCode(a)}return i},at=[],st=function(t){for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);n<=127?e++:n<=2047?e+=2:n>=55296&&n<=57343?(e+=4,++r):e+=3}return e},ct=function(t,e,r,n){if(!(n>0))return 0;for(var o=r,i=r+n-1,a=0;a<t.length;++a){var s=t.charCodeAt(a);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&t.charCodeAt(++a)),s<=127){if(r>=i)break;e[r++]=s}else if(s<=2047){if(r+1>=i)break;e[r++]=192|s>>6,e[r++]=128|63&s}else if(s<=65535){if(r+2>=i)break;e[r++]=224|s>>12,e[r++]=128|s>>6&63,e[r++]=128|63&s}else{if(r+3>=i)break;e[r++]=240|s>>18,e[r++]=128|s>>12&63,e[r++]=128|s>>6&63,e[r++]=128|63&s}}return e[r]=0,r-o};function ut(t,e,r){var n=st(t)+1,o=new Array(n),i=ct(t,o,0,o.length);return o.length=i,o}var ft={ttys:[],init:function(){},shutdown:function(){},register:function(t,e){ft.ttys[t]={input:[],output:[],ops:e},mt.registerDevice(t,ft.stream_ops)},stream_ops:{open:function(t){var e=ft.ttys[t.node.rdev];if(!e)throw new mt.ErrnoError(43);t.tty=e,t.seekable=!1},close:function(t){t.tty.ops.fsync(t.tty)},fsync:function(t){t.tty.ops.fsync(t.tty)},read:function(t,e,r,n,o){if(!t.tty||!t.tty.ops.get_char)throw new mt.ErrnoError(60);for(var i=0,a=0;a<n;a++){var s;try{s=t.tty.ops.get_char(t.tty)}catch(t){throw new mt.ErrnoError(29)}if(void 0===s&&0===i)throw new mt.ErrnoError(6);if(null==s)break;i++,e[r+a]=s}return i&&(t.node.timestamp=Date.now()),i},write:function(t,e,r,n,o){if(!t.tty||!t.tty.ops.put_char)throw new mt.ErrnoError(60);try{for(var i=0;i<n;i++)t.tty.ops.put_char(t.tty,e[r+i])}catch(t){throw new mt.ErrnoError(29)}return n&&(t.node.timestamp=Date.now()),i}},default_tty_ops:{get_char:function(t){return function(){if(!at.length){var t=null;if("undefined"!=typeof window&&"function"==typeof window.prompt?null!==(t=window.prompt("Input: "))&&(t+="\n"):"function"==typeof readline&&null!==(t=readline())&&(t+="\n"),!t)return null;at=ut(t)}return at.shift()}()},put_char:function(t,e){null===e||10===e?(k(it(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},fsync:function(t){t.output&&t.output.length>0&&(k(it(t.output,0)),t.output=[])},ioctl_tcgets:function(t){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets:function(t,e,r){return 0},ioctl_tiocgwinsz:function(t){return[24,80]}},default_tty1_ops:{put_char:function(t,e){null===e||10===e?(_(it(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},fsync:function(t){t.output&&t.output.length>0&&(_(it(t.output,0)),t.output=[])}}},lt=function(t){W()},dt={ops_table:null,mount:function(t){return dt.createNode(null,"/",16895,0)},createNode:function(t,e,r,n){if(mt.isBlkdev(r)||mt.isFIFO(r))throw new mt.ErrnoError(63);dt.ops_table||(dt.ops_table={dir:{node:{getattr:dt.node_ops.getattr,setattr:dt.node_ops.setattr,lookup:dt.node_ops.lookup,mknod:dt.node_ops.mknod,rename:dt.node_ops.rename,unlink:dt.node_ops.unlink,rmdir:dt.node_ops.rmdir,readdir:dt.node_ops.readdir,symlink:dt.node_ops.symlink},stream:{llseek:dt.stream_ops.llseek}},file:{node:{getattr:dt.node_ops.getattr,setattr:dt.node_ops.setattr},stream:{llseek:dt.stream_ops.llseek,read:dt.stream_ops.read,write:dt.stream_ops.write,allocate:dt.stream_ops.allocate,mmap:dt.stream_ops.mmap,msync:dt.stream_ops.msync}},link:{node:{getattr:dt.node_ops.getattr,setattr:dt.node_ops.setattr,readlink:dt.node_ops.readlink},stream:{}},chrdev:{node:{getattr:dt.node_ops.getattr,setattr:dt.node_ops.setattr},stream:mt.chrdev_stream_ops}});var o=mt.createNode(t,e,r,n);return mt.isDir(o.mode)?(o.node_ops=dt.ops_table.dir.node,o.stream_ops=dt.ops_table.dir.stream,o.contents={}):mt.isFile(o.mode)?(o.node_ops=dt.ops_table.file.node,o.stream_ops=dt.ops_table.file.stream,o.usedBytes=0,o.contents=null):mt.isLink(o.mode)?(o.node_ops=dt.ops_table.link.node,o.stream_ops=dt.ops_table.link.stream):mt.isChrdev(o.mode)&&(o.node_ops=dt.ops_table.chrdev.node,o.stream_ops=dt.ops_table.chrdev.stream),o.timestamp=Date.now(),t&&(t.contents[e]=o,t.timestamp=o.timestamp),o},getFileDataAsTypedArray:function(t){return t.contents?t.contents.subarray?t.contents.subarray(0,t.usedBytes):new Uint8Array(t.contents):new Uint8Array(0)},expandFileStorage:function(t,e){var r=t.contents?t.contents.length:0;if(!(r>=e)){e=Math.max(e,r*(r<1048576?2:1.125)>>>0),0!=r&&(e=Math.max(e,256));var n=t.contents;t.contents=new Uint8Array(e),t.usedBytes>0&&t.contents.set(n.subarray(0,t.usedBytes),0)}},resizeFileStorage:function(t,e){if(t.usedBytes!=e)if(0==e)t.contents=null,t.usedBytes=0;else{var r=t.contents;t.contents=new Uint8Array(e),r&&t.contents.set(r.subarray(0,Math.min(e,t.usedBytes))),t.usedBytes=e}},node_ops:{getattr:function(t){var e={};return e.dev=mt.isChrdev(t.mode)?t.id:1,e.ino=t.id,e.mode=t.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=t.rdev,mt.isDir(t.mode)?e.size=4096:mt.isFile(t.mode)?e.size=t.usedBytes:mt.isLink(t.mode)?e.size=t.link.length:e.size=0,e.atime=new Date(t.timestamp),e.mtime=new Date(t.timestamp),e.ctime=new Date(t.timestamp),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr:function(t,e){void 0!==e.mode&&(t.mode=e.mode),void 0!==e.timestamp&&(t.timestamp=e.timestamp),void 0!==e.size&&dt.resizeFileStorage(t,e.size)},lookup:function(t,e){throw mt.genericErrors[44]},mknod:function(t,e,r,n){return dt.createNode(t,e,r,n)},rename:function(t,e,r){if(mt.isDir(t.mode)){var n;try{n=mt.lookupNode(e,r)}catch(t){}if(n)for(var o in n.contents)throw new mt.ErrnoError(55)}delete t.parent.contents[t.name],t.parent.timestamp=Date.now(),t.name=r,e.contents[r]=t,e.timestamp=t.parent.timestamp,t.parent=e},unlink:function(t,e){delete t.contents[e],t.timestamp=Date.now()},rmdir:function(t,e){var r=mt.lookupNode(t,e);for(var n in r.contents)throw new mt.ErrnoError(55);delete t.contents[e],t.timestamp=Date.now()},readdir:function(t){var e=[".",".."];for(var r in t.contents)t.contents.hasOwnProperty(r)&&e.push(r);return e},symlink:function(t,e,r){var n=dt.createNode(t,e,41471,0);return n.link=r,n},readlink:function(t){if(!mt.isLink(t.mode))throw new mt.ErrnoError(28);return t.link}},stream_ops:{read:function(t,e,r,n,o){var i=t.node.contents;if(o>=t.node.usedBytes)return 0;var a=Math.min(t.node.usedBytes-o,n);if(a>8&&i.subarray)e.set(i.subarray(o,o+a),r);else for(var s=0;s<a;s++)e[r+s]=i[o+s];return a},write:function(t,e,r,n,o,i){if(!n)return 0;var a=t.node;if(a.timestamp=Date.now(),e.subarray&&(!a.contents||a.contents.subarray)){if(i)return a.contents=e.subarray(r,r+n),a.usedBytes=n,n;if(0===a.usedBytes&&0===o)return a.contents=e.slice(r,r+n),a.usedBytes=n,n;if(o+n<=a.usedBytes)return a.contents.set(e.subarray(r,r+n),o),n}if(dt.expandFileStorage(a,o+n),a.contents.subarray&&e.subarray)a.contents.set(e.subarray(r,r+n),o);else for(var s=0;s<n;s++)a.contents[o+s]=e[r+s];return a.usedBytes=Math.max(a.usedBytes,o+n),n},llseek:function(t,e,r){var n=e;if(1===r?n+=t.position:2===r&&mt.isFile(t.node.mode)&&(n+=t.node.usedBytes),n<0)throw new mt.ErrnoError(28);return n},allocate:function(t,e,r){dt.expandFileStorage(t.node,e+r),t.node.usedBytes=Math.max(t.node.usedBytes,e+r)},mmap:function(t,e,r,n,o){if(!mt.isFile(t.node.mode))throw new mt.ErrnoError(43);var i,a,s=t.node.contents;if(2&o||s.buffer!==P.buffer){if((r>0||r+e<s.length)&&(s=s.subarray?s.subarray(r,r+e):Array.prototype.slice.call(s,r,r+e)),a=!0,!(i=lt()))throw new mt.ErrnoError(48);P.set(s,i)}else a=!1,i=s.byteOffset;return{ptr:i,allocated:a}},msync:function(t,e,r,n,o){return dt.stream_ops.write(t,e,0,n,r,!1),0}}},ht=function(t,e,r,n){var o="al ".concat(t);p(t,(function(r){var n,i;n=r,i='Loading data file "'.concat(t,'" failed (no arrayBuffer).'),n||W(i),e(new Uint8Array(r)),o&&U()}),(function(e){if(!r)throw'Loading data file "'.concat(t,'" failed.');r()})),o&&B()},pt=i.preloadPlugins||[];function vt(t,e){var r=0;return t&&(r|=365),e&&(r|=146),r}var mt={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(t=nt.resolve(t)))return{path:"",node:null};if((e=Object.assign({follow_mount:!0,recurse_count:0},e)).recurse_count>8)throw new mt.ErrnoError(32);for(var r=t.split("/").filter((function(t){return!!t})),n=mt.root,o="/",i=0;i<r.length;i++){var a=i===r.length-1;if(a&&e.parent)break;if(n=mt.lookupNode(n,r[i]),o=et.join2(o,r[i]),mt.isMountpoint(n)&&(!a||a&&e.follow_mount)&&(n=n.mounted.root),!a||e.follow)for(var s=0;mt.isLink(n.mode);){var c=mt.readlink(o);if(o=nt.resolve(et.dirname(o),c),n=mt.lookupPath(o,{recurse_count:e.recurse_count+1}).node,s++>40)throw new mt.ErrnoError(32)}}return{path:o,node:n}},getPath:function(t){for(var e;;){if(mt.isRoot(t)){var r=t.mount.mountpoint;return e?"/"!==r[r.length-1]?"".concat(r,"/").concat(e):r+e:r}e=e?"".concat(t.name,"/").concat(e):t.name,t=t.parent}},hashName:function(t,e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n)|0;return(t+r>>>0)%mt.nameTable.length},hashAddNode:function(t){var e=mt.hashName(t.parent.id,t.name);t.name_next=mt.nameTable[e],mt.nameTable[e]=t},hashRemoveNode:function(t){var e=mt.hashName(t.parent.id,t.name);if(mt.nameTable[e]===t)mt.nameTable[e]=t.name_next;else for(var r=mt.nameTable[e];r;){if(r.name_next===t){r.name_next=t.name_next;break}r=r.name_next}},lookupNode:function(t,e){var r=mt.mayLookup(t);if(r)throw new mt.ErrnoError(r,t);for(var n=mt.hashName(t.id,e),o=mt.nameTable[n];o;o=o.name_next){var i=o.name;if(o.parent.id===t.id&&i===e)return o}return mt.lookup(t,e)},createNode:function(t,e,r,n){var o=new mt.FSNode(t,e,r,n);return mt.hashAddNode(o),o},destroyNode:function(t){mt.hashRemoveNode(t)},isRoot:function(t){return t===t.parent},isMountpoint:function(t){return!!t.mounted},isFile:function(t){return 32768==(61440&t)},isDir:function(t){return 16384==(61440&t)},isLink:function(t){return 40960==(61440&t)},isChrdev:function(t){return 8192==(61440&t)},isBlkdev:function(t){return 24576==(61440&t)},isFIFO:function(t){return 4096==(61440&t)},isSocket:function(t){return!(49152&~t)},flagsToPermissionString:function(t){var e=["r","w","rw"][3&t];return 512&t&&(e+="w"),e},nodePermissions:function(t,e){return mt.ignorePermissions||(!e.includes("r")||292&t.mode)&&(!e.includes("w")||146&t.mode)&&(!e.includes("x")||73&t.mode)?0:2},mayLookup:function(t){var e=mt.nodePermissions(t,"x");return e||(t.node_ops.lookup?0:2)},mayCreate:function(t,e){try{return mt.lookupNode(t,e),20}catch(t){}return mt.nodePermissions(t,"wx")},mayDelete:function(t,e,r){var n;try{n=mt.lookupNode(t,e)}catch(t){return t.errno}var o=mt.nodePermissions(t,"wx");if(o)return o;if(r){if(!mt.isDir(n.mode))return 54;if(mt.isRoot(n)||mt.getPath(n)===mt.cwd())return 10}else if(mt.isDir(n.mode))return 31;return 0},mayOpen:function(t,e){return t?mt.isLink(t.mode)?32:mt.isDir(t.mode)&&("r"!==mt.flagsToPermissionString(e)||512&e)?31:mt.nodePermissions(t,mt.flagsToPermissionString(e)):44},MAX_OPEN_FDS:4096,nextfd:function(){for(var t=0;t<=mt.MAX_OPEN_FDS;t++)if(!mt.streams[t])return t;throw new mt.ErrnoError(33)},getStreamChecked:function(t){var e=mt.getStream(t);if(!e)throw new mt.ErrnoError(8);return e},getStream:function(t){return mt.streams[t]},createStream:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return mt.FSStream||(mt.FSStream=function(){this.shared={}},mt.FSStream.prototype={},Object.defineProperties(mt.FSStream.prototype,{object:{get:function(){return this.node},set:function(t){this.node=t}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return!!(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}},flags:{get:function(){return this.shared.flags},set:function(t){this.shared.flags=t}},position:{get:function(){return this.shared.position},set:function(t){this.shared.position=t}}})),t=Object.assign(new mt.FSStream,t),-1==e&&(e=mt.nextfd()),t.fd=e,mt.streams[e]=t,t},closeStream:function(t){mt.streams[t]=null},chrdev_stream_ops:{open:function(t){var e=mt.getDevice(t.node.rdev);t.stream_ops=e.stream_ops,t.stream_ops.open&&t.stream_ops.open(t)},llseek:function(){throw new mt.ErrnoError(70)}},major:function(t){return t>>8},minor:function(t){return 255&t},makedev:function(t,e){return t<<8|e},registerDevice:function(t,e){mt.devices[t]={stream_ops:e}},getDevice:function(t){return mt.devices[t]},getMounts:function(t){for(var e=[],r=[t];r.length;){var n=r.pop();e.push(n),r.push.apply(r,n.mounts)}return e},syncfs:function(t,e){"function"==typeof t&&(e=t,t=!1),mt.syncFSRequests++,mt.syncFSRequests>1&&_("warning: ".concat(mt.syncFSRequests," FS.syncfs operations in flight at once, probably just doing extra work"));var r=mt.getMounts(mt.root.mount),n=0;function o(t){return mt.syncFSRequests--,e(t)}function i(t){if(t)return i.errored?void 0:(i.errored=!0,o(t));++n>=r.length&&o(null)}r.forEach((function(e){if(!e.type.syncfs)return i(null);e.type.syncfs(e,t,i)}))},mount:function(t,e,r){var n,o="/"===r,i=!r;if(o&&mt.root)throw new mt.ErrnoError(10);if(!o&&!i){var a=mt.lookupPath(r,{follow_mount:!1});if(r=a.path,n=a.node,mt.isMountpoint(n))throw new mt.ErrnoError(10);if(!mt.isDir(n.mode))throw new mt.ErrnoError(54)}var s={type:t,opts:e,mountpoint:r,mounts:[]},c=t.mount(s);return c.mount=s,s.root=c,o?mt.root=c:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),c},unmount:function(t){var e=mt.lookupPath(t,{follow_mount:!1});if(!mt.isMountpoint(e.node))throw new mt.ErrnoError(28);var r=e.node,n=r.mounted,o=mt.getMounts(n);Object.keys(mt.nameTable).forEach((function(t){for(var e=mt.nameTable[t];e;){var r=e.name_next;o.includes(e.mount)&&mt.destroyNode(e),e=r}})),r.mounted=null;var i=r.mount.mounts.indexOf(n);r.mount.mounts.splice(i,1)},lookup:function(t,e){return t.node_ops.lookup(t,e)},mknod:function(t,e,r){var n=mt.lookupPath(t,{parent:!0}).node,o=et.basename(t);if(!o||"."===o||".."===o)throw new mt.ErrnoError(28);var i=mt.mayCreate(n,o);if(i)throw new mt.ErrnoError(i);if(!n.node_ops.mknod)throw new mt.ErrnoError(63);return n.node_ops.mknod(n,o,e,r)},create:function(t,e){return e=void 0!==e?e:438,e&=4095,e|=32768,mt.mknod(t,e,0)},mkdir:function(t,e){return e=void 0!==e?e:511,e&=1023,e|=16384,mt.mknod(t,e,0)},mkdirTree:function(t,e){for(var r=t.split("/"),n="",o=0;o<r.length;++o)if(r[o]){n+="/"+r[o];try{mt.mkdir(n,e)}catch(t){if(20!=t.errno)throw t}}},mkdev:function(t,e,r){return void 0===r&&(r=e,e=438),e|=8192,mt.mknod(t,e,r)},symlink:function(t,e){if(!nt.resolve(t))throw new mt.ErrnoError(44);var r=mt.lookupPath(e,{parent:!0}).node;if(!r)throw new mt.ErrnoError(44);var n=et.basename(e),o=mt.mayCreate(r,n);if(o)throw new mt.ErrnoError(o);if(!r.node_ops.symlink)throw new mt.ErrnoError(63);return r.node_ops.symlink(r,n,t)},rename:function(t,e){var r,n,o=et.dirname(t),i=et.dirname(e),a=et.basename(t),s=et.basename(e);if(r=mt.lookupPath(t,{parent:!0}).node,n=mt.lookupPath(e,{parent:!0}).node,!r||!n)throw new mt.ErrnoError(44);if(r.mount!==n.mount)throw new mt.ErrnoError(75);var c,u=mt.lookupNode(r,a),f=nt.relative(t,i);if("."!==f.charAt(0))throw new mt.ErrnoError(28);if("."!==(f=nt.relative(e,o)).charAt(0))throw new mt.ErrnoError(55);try{c=mt.lookupNode(n,s)}catch(t){}if(u!==c){var l=mt.isDir(u.mode),d=mt.mayDelete(r,a,l);if(d)throw new mt.ErrnoError(d);if(d=c?mt.mayDelete(n,s,l):mt.mayCreate(n,s))throw new mt.ErrnoError(d);if(!r.node_ops.rename)throw new mt.ErrnoError(63);if(mt.isMountpoint(u)||c&&mt.isMountpoint(c))throw new mt.ErrnoError(10);if(n!==r&&(d=mt.nodePermissions(r,"w")))throw new mt.ErrnoError(d);mt.hashRemoveNode(u);try{r.node_ops.rename(u,n,s)}catch(t){throw t}finally{mt.hashAddNode(u)}}},rmdir:function(t){var e=mt.lookupPath(t,{parent:!0}).node,r=et.basename(t),n=mt.lookupNode(e,r),o=mt.mayDelete(e,r,!0);if(o)throw new mt.ErrnoError(o);if(!e.node_ops.rmdir)throw new mt.ErrnoError(63);if(mt.isMountpoint(n))throw new mt.ErrnoError(10);e.node_ops.rmdir(e,r),mt.destroyNode(n)},readdir:function(t){var e=mt.lookupPath(t,{follow:!0}).node;if(!e.node_ops.readdir)throw new mt.ErrnoError(54);return e.node_ops.readdir(e)},unlink:function(t){var e=mt.lookupPath(t,{parent:!0}).node;if(!e)throw new mt.ErrnoError(44);var r=et.basename(t),n=mt.lookupNode(e,r),o=mt.mayDelete(e,r,!1);if(o)throw new mt.ErrnoError(o);if(!e.node_ops.unlink)throw new mt.ErrnoError(63);if(mt.isMountpoint(n))throw new mt.ErrnoError(10);e.node_ops.unlink(e,r),mt.destroyNode(n)},readlink:function(t){var e=mt.lookupPath(t).node;if(!e)throw new mt.ErrnoError(44);if(!e.node_ops.readlink)throw new mt.ErrnoError(28);return nt.resolve(mt.getPath(e.parent),e.node_ops.readlink(e))},stat:function(t,e){var r=mt.lookupPath(t,{follow:!e}).node;if(!r)throw new mt.ErrnoError(44);if(!r.node_ops.getattr)throw new mt.ErrnoError(63);return r.node_ops.getattr(r)},lstat:function(t){return mt.stat(t,!0)},chmod:function(t,e,r){var n;if(!(n="string"==typeof t?mt.lookupPath(t,{follow:!r}).node:t).node_ops.setattr)throw new mt.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&e|-4096&n.mode,timestamp:Date.now()})},lchmod:function(t,e){mt.chmod(t,e,!0)},fchmod:function(t,e){var r=mt.getStreamChecked(t);mt.chmod(r.node,e)},chown:function(t,e,r,n){var o;if(!(o="string"==typeof t?mt.lookupPath(t,{follow:!n}).node:t).node_ops.setattr)throw new mt.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown:function(t,e,r){mt.chown(t,e,r,!0)},fchown:function(t,e,r){var n=mt.getStreamChecked(t);mt.chown(n.node,e,r)},truncate:function(t,e){if(e<0)throw new mt.ErrnoError(28);var r;if(!(r="string"==typeof t?mt.lookupPath(t,{follow:!0}).node:t).node_ops.setattr)throw new mt.ErrnoError(63);if(mt.isDir(r.mode))throw new mt.ErrnoError(31);if(!mt.isFile(r.mode))throw new mt.ErrnoError(28);var n=mt.nodePermissions(r,"w");if(n)throw new mt.ErrnoError(n);r.node_ops.setattr(r,{size:e,timestamp:Date.now()})},ftruncate:function(t,e){var r=mt.getStreamChecked(t);if(!(2097155&r.flags))throw new mt.ErrnoError(28);mt.truncate(r.node,e)},utime:function(t,e,r){var n=mt.lookupPath(t,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(e,r)})},open:function(t,e,r){if(""===t)throw new mt.ErrnoError(44);var n;if(r=void 0===r?438:r,r=64&(e="string"==typeof e?function(t){var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[t];if(void 0===e)throw new Error("Unknown file open mode: ".concat(t));return e}(e):e)?4095&r|32768:0,"object"==m(t))n=t;else{t=et.normalize(t);try{n=mt.lookupPath(t,{follow:!(131072&e)}).node}catch(t){}}var o=!1;if(64&e)if(n){if(128&e)throw new mt.ErrnoError(20)}else n=mt.mknod(t,r,0),o=!0;if(!n)throw new mt.ErrnoError(44);if(mt.isChrdev(n.mode)&&(e&=-513),65536&e&&!mt.isDir(n.mode))throw new mt.ErrnoError(54);if(!o){var a=mt.mayOpen(n,e);if(a)throw new mt.ErrnoError(a)}512&e&&!o&&mt.truncate(n,0),e&=-131713;var s=mt.createStream({node:n,path:mt.getPath(n),flags:e,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return s.stream_ops.open&&s.stream_ops.open(s),!i.logReadFiles||1&e||(mt.readFiles||(mt.readFiles={}),t in mt.readFiles||(mt.readFiles[t]=1)),s},close:function(t){if(mt.isClosed(t))throw new mt.ErrnoError(8);t.getdents&&(t.getdents=null);try{t.stream_ops.close&&t.stream_ops.close(t)}catch(t){throw t}finally{mt.closeStream(t.fd)}t.fd=null},isClosed:function(t){return null===t.fd},llseek:function(t,e,r){if(mt.isClosed(t))throw new mt.ErrnoError(8);if(!t.seekable||!t.stream_ops.llseek)throw new mt.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new mt.ErrnoError(28);return t.position=t.stream_ops.llseek(t,e,r),t.ungotten=[],t.position},read:function(t,e,r,n,o){if(n<0||o<0)throw new mt.ErrnoError(28);if(mt.isClosed(t))throw new mt.ErrnoError(8);if(1==(2097155&t.flags))throw new mt.ErrnoError(8);if(mt.isDir(t.node.mode))throw new mt.ErrnoError(31);if(!t.stream_ops.read)throw new mt.ErrnoError(28);var i=void 0!==o;if(i){if(!t.seekable)throw new mt.ErrnoError(70)}else o=t.position;var a=t.stream_ops.read(t,e,r,n,o);return i||(t.position+=a),a},write:function(t,e,r,n,o,i){if(n<0||o<0)throw new mt.ErrnoError(28);if(mt.isClosed(t))throw new mt.ErrnoError(8);if(!(2097155&t.flags))throw new mt.ErrnoError(8);if(mt.isDir(t.node.mode))throw new mt.ErrnoError(31);if(!t.stream_ops.write)throw new mt.ErrnoError(28);t.seekable&&1024&t.flags&&mt.llseek(t,0,2);var a=void 0!==o;if(a){if(!t.seekable)throw new mt.ErrnoError(70)}else o=t.position;var s=t.stream_ops.write(t,e,r,n,o,i);return a||(t.position+=s),s},allocate:function(t,e,r){if(mt.isClosed(t))throw new mt.ErrnoError(8);if(e<0||r<=0)throw new mt.ErrnoError(28);if(!(2097155&t.flags))throw new mt.ErrnoError(8);if(!mt.isFile(t.node.mode)&&!mt.isDir(t.node.mode))throw new mt.ErrnoError(43);if(!t.stream_ops.allocate)throw new mt.ErrnoError(138);t.stream_ops.allocate(t,e,r)},mmap:function(t,e,r,n,o){if(2&n&&!(2&o)&&2!=(2097155&t.flags))throw new mt.ErrnoError(2);if(1==(2097155&t.flags))throw new mt.ErrnoError(2);if(!t.stream_ops.mmap)throw new mt.ErrnoError(43);return t.stream_ops.mmap(t,e,r,n,o)},msync:function(t,e,r,n,o){return t.stream_ops.msync?t.stream_ops.msync(t,e,r,n,o):0},munmap:function(t){return 0},ioctl:function(t,e,r){if(!t.stream_ops.ioctl)throw new mt.ErrnoError(59);return t.stream_ops.ioctl(t,e,r)},readFile:function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r.flags=r.flags||0,r.encoding=r.encoding||"binary","utf8"!==r.encoding&&"binary"!==r.encoding)throw new Error('Invalid encoding type "'.concat(r.encoding,'"'));var n=mt.open(t,r.flags),o=mt.stat(t).size,i=new Uint8Array(o);return mt.read(n,i,0,o,0),"utf8"===r.encoding?e=it(i,0):"binary"===r.encoding&&(e=i),mt.close(n),e},writeFile:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var n=mt.open(t,r.flags,r.mode);if("string"==typeof e){var o=new Uint8Array(st(e)+1),i=ct(e,o,0,o.length);mt.write(n,o,0,i,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(e))throw new Error("Unsupported data type");mt.write(n,e,0,e.byteLength,void 0,r.canOwn)}mt.close(n)},cwd:function(){return mt.currentPath},chdir:function(t){var e=mt.lookupPath(t,{follow:!0});if(null===e.node)throw new mt.ErrnoError(44);if(!mt.isDir(e.node.mode))throw new mt.ErrnoError(54);var r=mt.nodePermissions(e.node,"x");if(r)throw new mt.ErrnoError(r);mt.currentPath=e.path},createDefaultDirectories:function(){mt.mkdir("/tmp"),mt.mkdir("/home"),mt.mkdir("/home/web_user")},createDefaultDevices:function(){mt.mkdir("/dev"),mt.registerDevice(mt.makedev(1,3),{read:function(){return 0},write:function(t,e,r,n,o){return n}}),mt.mkdev("/dev/null",mt.makedev(1,3)),ft.register(mt.makedev(5,0),ft.default_tty_ops),ft.register(mt.makedev(6,0),ft.default_tty1_ops),mt.mkdev("/dev/tty",mt.makedev(5,0)),mt.mkdev("/dev/tty1",mt.makedev(6,0));var t=new Uint8Array(1024),e=0,r=function(){return 0===e&&(e=rt(t).byteLength),t[--e]};mt.createDevice("/dev","random",r),mt.createDevice("/dev","urandom",r),mt.mkdir("/dev/shm"),mt.mkdir("/dev/shm/tmp")},createSpecialDirectories:function(){mt.mkdir("/proc");var t=mt.mkdir("/proc/self");mt.mkdir("/proc/self/fd"),mt.mount({mount:function(){var e=mt.createNode(t,"fd",16895,73);return e.node_ops={lookup:function(t,e){var r=+e,n=mt.getStreamChecked(r),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:function(){return n.path}}};return o.parent=o,o}},e}},{},"/proc/self/fd")},createStandardStreams:function(){i.stdin?mt.createDevice("/dev","stdin",i.stdin):mt.symlink("/dev/tty","/dev/stdin"),i.stdout?mt.createDevice("/dev","stdout",null,i.stdout):mt.symlink("/dev/tty","/dev/stdout"),i.stderr?mt.createDevice("/dev","stderr",null,i.stderr):mt.symlink("/dev/tty1","/dev/stderr"),mt.open("/dev/stdin",0),mt.open("/dev/stdout",1),mt.open("/dev/stderr",1)},ensureErrnoError:function(){mt.ErrnoError||(mt.ErrnoError=function(t,e){this.name="ErrnoError",this.node=e,this.setErrno=function(t){this.errno=t},this.setErrno(t),this.message="FS error"},mt.ErrnoError.prototype=new Error,mt.ErrnoError.prototype.constructor=mt.ErrnoError,[44].forEach((function(t){mt.genericErrors[t]=new mt.ErrnoError(t),mt.genericErrors[t].stack="<generic error, no stack>"})))},staticInit:function(){mt.ensureErrnoError(),mt.nameTable=new Array(4096),mt.mount(dt,{},"/"),mt.createDefaultDirectories(),mt.createDefaultDevices(),mt.createSpecialDirectories(),mt.filesystems={MEMFS:dt}},init:function(t,e,r){mt.init.initialized=!0,mt.ensureErrnoError(),i.stdin=t||i.stdin,i.stdout=e||i.stdout,i.stderr=r||i.stderr,mt.createStandardStreams()},quit:function(){mt.init.initialized=!1;for(var t=0;t<mt.streams.length;t++){var e=mt.streams[t];e&&mt.close(e)}},findObject:function(t,e){var r=mt.analyzePath(t,e);return r.exists?r.object:null},analyzePath:function(t,e){try{t=(n=mt.lookupPath(t,{follow:!e})).path}catch(t){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=mt.lookupPath(t,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=et.basename(t),n=mt.lookupPath(t,{follow:!e}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot="/"===n.path}catch(t){r.error=t.errno}return r},createPath:function(t,e,r,n){t="string"==typeof t?t:mt.getPath(t);for(var o=e.split("/").reverse();o.length;){var i=o.pop();if(i){var a=et.join2(t,i);try{mt.mkdir(a)}catch(t){}t=a}}return a},createFile:function(t,e,r,n,o){var i=et.join2("string"==typeof t?t:mt.getPath(t),e),a=vt(n,o);return mt.create(i,a)},createDataFile:function(t,e,r,n,o,i){var a=e;t&&(t="string"==typeof t?t:mt.getPath(t),a=e?et.join2(t,e):t);var s=vt(n,o),c=mt.create(a,s);if(r){if("string"==typeof r){for(var u=new Array(r.length),f=0,l=r.length;f<l;++f)u[f]=r.charCodeAt(f);r=u}mt.chmod(c,146|s);var d=mt.open(c,577);mt.write(d,r,0,r.length,0,i),mt.close(d),mt.chmod(c,s)}return c},createDevice:function(t,e,r,n){var o=et.join2("string"==typeof t?t:mt.getPath(t),e),i=vt(!!r,!!n);mt.createDevice.major||(mt.createDevice.major=64);var a=mt.makedev(mt.createDevice.major++,0);return mt.registerDevice(a,{open:function(t){t.seekable=!1},close:function(t){n&&n.buffer&&n.buffer.length&&n(10)},read:function(t,e,n,o,i){for(var a=0,s=0;s<o;s++){var c;try{c=r()}catch(t){throw new mt.ErrnoError(29)}if(void 0===c&&0===a)throw new mt.ErrnoError(6);if(null==c)break;a++,e[n+s]=c}return a&&(t.node.timestamp=Date.now()),a},write:function(t,e,r,o,i){for(var a=0;a<o;a++)try{n(e[r+a])}catch(t){throw new mt.ErrnoError(29)}return o&&(t.node.timestamp=Date.now()),a}}),mt.mkdev(o,i,a)},forceLoadFile:function(t){if(t.isDevice||t.isFolder||t.link||t.contents)return!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!h)throw new Error("Cannot load without read() or XMLHttpRequest.");try{t.contents=ut(h(t.url)),t.usedBytes=t.contents.length}catch(t){throw new mt.ErrnoError(29)}},createLazyFile:function(t,e,r,n,o){function i(){this.lengthKnown=!1,this.chunks=[]}if(i.prototype.get=function(t){if(!(t>this.length-1||t<0)){var e=t%this.chunkSize,r=t/this.chunkSize|0;return this.getter(r)[e]}},i.prototype.setDataGetter=function(t){this.getter=t},i.prototype.cacheLength=function(){var t=new XMLHttpRequest;if(t.open("HEAD",r,!1),t.send(null),!(t.status>=200&&t.status<300||304===t.status))throw new Error("Couldn't load "+r+". Status: "+t.status);var e,n=Number(t.getResponseHeader("Content-length")),o=(e=t.getResponseHeader("Accept-Ranges"))&&"bytes"===e,i=(e=t.getResponseHeader("Content-Encoding"))&&"gzip"===e,a=1048576;o||(a=n);var s=this;s.setDataGetter((function(t){var e=t*a,o=(t+1)*a-1;if(o=Math.min(o,n-1),void 0===s.chunks[t]&&(s.chunks[t]=function(t,e){if(t>e)throw new Error("invalid range ("+t+", "+e+") or no bytes requested!");if(e>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",r,!1),n!==a&&o.setRequestHeader("Range","bytes="+t+"-"+e),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn't load "+r+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):ut(o.responseText||"")}(e,o)),void 0===s.chunks[t])throw new Error("doXHR failed!");return s.chunks[t]})),!i&&n||(a=n=1,n=this.getter(0).length,a=n,k("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!d)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new i;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var s={isDevice:!1,contents:a}}else s={isDevice:!1,url:r};var c=mt.createFile(t,e,s,n,o);s.contents?c.contents=s.contents:s.url&&(c.contents=null,c.url=s.url),Object.defineProperties(c,{usedBytes:{get:function(){return this.contents.length}}});var u={};function f(t,e,r,n,o){var i=t.node.contents;if(o>=i.length)return 0;var a=Math.min(i.length-o,n);if(i.slice)for(var s=0;s<a;s++)e[r+s]=i[o+s];else for(s=0;s<a;s++)e[r+s]=i.get(o+s);return a}return Object.keys(c.stream_ops).forEach((function(t){var e=c.stream_ops[t];u[t]=function(){return mt.forceLoadFile(c),e.apply(null,arguments)}})),u.read=function(t,e,r,n,o){return mt.forceLoadFile(c),f(t,e,r,n,o)},u.mmap=function(t,e,r,n,o){mt.forceLoadFile(c);var i=lt();if(!i)throw new mt.ErrnoError(48);return f(t,P,i,e,r),{ptr:i,allocated:!0}},c.stream_ops=u,c}},yt=function(t,e){return t?it(T,t,e):""},gt={DEFAULT_POLLMASK:5,calculateAt:function(t,e,r){if(et.isAbs(e))return e;var n;if(n=-100===t?mt.cwd():gt.getStreamFromFD(t).path,0==e.length){if(!r)throw new mt.ErrnoError(44);return n}return et.join2(n,e)},doStat:function(t,e,r){try{var n=t(e)}catch(t){if(t&&t.node&&et.normalize(e)!==et.normalize(mt.getPath(t.node)))return-54;throw t}A[r>>2]=n.dev,A[r+4>>2]=n.mode,D[r+8>>2]=n.nlink,A[r+12>>2]=n.uid,A[r+16>>2]=n.gid,A[r+20>>2]=n.rdev,q=[n.size>>>0,(G=n.size,+Math.abs(G)>=1?G>0?+Math.floor(G/4294967296)>>>0:~~+Math.ceil((G-+(~~G>>>0))/4294967296)>>>0:0)],A[r+24>>2]=q[0],A[r+28>>2]=q[1],A[r+32>>2]=4096,A[r+36>>2]=n.blocks;var o=n.atime.getTime(),i=n.mtime.getTime(),a=n.ctime.getTime();return q=[Math.floor(o/1e3)>>>0,(G=Math.floor(o/1e3),+Math.abs(G)>=1?G>0?+Math.floor(G/4294967296)>>>0:~~+Math.ceil((G-+(~~G>>>0))/4294967296)>>>0:0)],A[r+40>>2]=q[0],A[r+44>>2]=q[1],D[r+48>>2]=o%1e3*1e3,q=[Math.floor(i/1e3)>>>0,(G=Math.floor(i/1e3),+Math.abs(G)>=1?G>0?+Math.floor(G/4294967296)>>>0:~~+Math.ceil((G-+(~~G>>>0))/4294967296)>>>0:0)],A[r+56>>2]=q[0],A[r+60>>2]=q[1],D[r+64>>2]=i%1e3*1e3,q=[Math.floor(a/1e3)>>>0,(G=Math.floor(a/1e3),+Math.abs(G)>=1?G>0?+Math.floor(G/4294967296)>>>0:~~+Math.ceil((G-+(~~G>>>0))/4294967296)>>>0:0)],A[r+72>>2]=q[0],A[r+76>>2]=q[1],D[r+80>>2]=a%1e3*1e3,q=[n.ino>>>0,(G=n.ino,+Math.abs(G)>=1?G>0?+Math.floor(G/4294967296)>>>0:~~+Math.ceil((G-+(~~G>>>0))/4294967296)>>>0:0)],A[r+88>>2]=q[0],A[r+92>>2]=q[1],0},doMsync:function(t,e,r,n,o){if(!mt.isFile(e.node.mode))throw new mt.ErrnoError(43);if(2&n)return 0;var i=T.slice(t,t+r);mt.msync(e,i,o,r,n)},varargs:void 0,get:function(){return gt.varargs+=4,A[gt.varargs-4>>2]},getStr:function(t){return yt(t)},getStreamFromFD:function(t){return mt.getStreamChecked(t)}};function wt(t){switch(t){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: ".concat(t))}}var bt=void 0;function Et(t){for(var e="",r=t;T[r];)e+=bt[T[r++]];return e}var kt={},_t={},Pt={},Tt=void 0;function Ct(t){throw new Tt(t)}var St=void 0;function At(t){throw new St(t)}function Dt(t,e,r){function n(e){var n=r(e);n.length!==t.length&&At("Mismatched type converter count");for(var o=0;o<t.length;++o)xt(t[o],n[o])}t.forEach((function(t){Pt[t]=e}));var o=new Array(e.length),i=[],a=0;e.forEach((function(t,e){_t.hasOwnProperty(t)?o[e]=_t[t]:(i.push(t),kt.hasOwnProperty(t)||(kt[t]=[]),kt[t].push((function(){o[e]=_t[t],++a===i.length&&n(o)})))})),0===i.length&&n(o)}function xt(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=e.name;if(t||Ct('type "'.concat(n,'" must have a positive integer typeid pointer')),_t.hasOwnProperty(t)){if(r.ignoreDuplicateRegistrations)return;Ct("Cannot register type '".concat(n,"' twice"))}if(_t[t]=e,delete Pt[t],kt.hasOwnProperty(t)){var o=kt[t];delete kt[t],o.forEach((function(t){return t()}))}}(t,e,r)}function Ft(t){if(!(this instanceof Qt))return!1;if(!(t instanceof Qt))return!1;for(var e=this.$$.ptrType.registeredClass,r=this.$$.ptr,n=t.$$.ptrType.registeredClass,o=t.$$.ptr;e.baseClass;)r=e.upcast(r),e=e.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return e===n&&r===o}function Ot(t){Ct(t.$$.ptrType.registeredClass.name+" instance already deleted")}var jt=!1;function Mt(t){}function $t(t){t.count.value-=1,0===t.count.value&&function(t){t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)}(t)}function Rt(t,e,r){if(e===r)return t;if(void 0===r.baseClass)return null;var n=Rt(t,e,r.baseClass);return null===n?null:r.downcast(n)}var Lt={};function zt(){return Object.keys(Ht).length}function Nt(){var t=[];for(var e in Ht)Ht.hasOwnProperty(e)&&t.push(Ht[e]);return t}var It=[];function Bt(){for(;It.length;){var t=It.pop();t.$$.deleteScheduled=!1,t.delete()}}var Ut=void 0;function Wt(t){Ut=t,It.length&&Ut&&Ut(Bt)}var Ht={};function Vt(t,e){return e=function(t,e){for(void 0===e&&Ct("ptr should not be undefined");t.baseClass;)e=t.upcast(e),t=t.baseClass;return e}(t,e),Ht[e]}function Gt(t,e){return e.ptrType&&e.ptr||At("makeClassHandle requires ptr and ptrType"),!!e.smartPtrType!=!!e.smartPtr&&At("Both smartPtrType and smartPtr must be specified"),e.count={value:1},Xt(Object.create(t,{$$:{value:e}}))}function qt(t){var e=this.getPointee(t);if(!e)return this.destructor(t),null;var r=Vt(this.registeredClass,e);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=e,r.$$.smartPtr=t,r.clone();var n=r.clone();return this.destructor(t),n}function o(){return this.isSmartPointer?Gt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:e,smartPtrType:this,smartPtr:t}):Gt(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var i,a=this.registeredClass.getActualType(e),s=Lt[a];if(!s)return o.call(this);i=this.isConst?s.constPointerType:s.pointerType;var c=Rt(e,this.registeredClass,i.registeredClass);return null===c?o.call(this):this.isSmartPointer?Gt(i.registeredClass.instancePrototype,{ptrType:i,ptr:c,smartPtrType:this,smartPtr:t}):Gt(i.registeredClass.instancePrototype,{ptrType:i,ptr:c})}var Xt=function(t){return"undefined"==typeof FinalizationRegistry?(Xt=function(t){return t},t):(jt=new FinalizationRegistry((function(t){$t(t.$$)})),Mt=function(t){return jt.unregister(t)},(Xt=function(t){var e=t.$$;if(e.smartPtr){var r={$$:e};jt.register(t,r,t)}return t})(t))};function Kt(){if(this.$$.ptr||Ot(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t,e=Xt(Object.create(Object.getPrototypeOf(this),{$$:{value:(t=this.$$,{count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType})}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function Jt(){this.$$.ptr||Ot(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ct("Object already scheduled for deletion"),Mt(this),$t(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Yt(){return!this.$$.ptr}function Zt(){return this.$$.ptr||Ot(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ct("Object already scheduled for deletion"),It.push(this),1===It.length&&Ut&&Ut(Bt),this.$$.deleteScheduled=!0,this}function Qt(){}var te=48,ee=57;function re(t){if(void 0===t)return"_unknown";var e=(t=t.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return e>=te&&e<=ee?"_".concat(t):t}function ne(t,e){return c({},t=re(t),(function(){return e.apply(this,arguments)}))[t]}function oe(t,e,r){if(void 0===t[e].overloadTable){var n=t[e];t[e]=function(){return t[e].overloadTable.hasOwnProperty(arguments.length)||Ct("Function '".concat(r,"' called with an invalid number of arguments (").concat(arguments.length,") - expects one of (").concat(t[e].overloadTable,")!")),t[e].overloadTable[arguments.length].apply(this,arguments)},t[e].overloadTable=[],t[e].overloadTable[n.argCount]=n}}function ie(t,e,r,n,o,i,a,s){this.name=t,this.constructor=e,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=o,this.getActualType=i,this.upcast=a,this.downcast=s,this.pureVirtualFunctions=[]}function ae(t,e,r){for(;e!==r;)e.upcast||Ct("Expected null or instance of ".concat(r.name,", got an instance of ").concat(e.name)),t=e.upcast(t),e=e.baseClass;return t}function se(t,e){if(null===e)return this.isReference&&Ct("null is not a valid ".concat(this.name)),0;e.$$||Ct('Cannot pass "'.concat(Oe(e),'" as a ').concat(this.name)),e.$$.ptr||Ct("Cannot pass deleted object as a pointer of type ".concat(this.name));var r=e.$$.ptrType.registeredClass;return ae(e.$$.ptr,r,this.registeredClass)}function ce(t,e){var r;if(null===e)return this.isReference&&Ct("null is not a valid ".concat(this.name)),this.isSmartPointer?(r=this.rawConstructor(),null!==t&&t.push(this.rawDestructor,r),r):0;e.$$||Ct('Cannot pass "'.concat(Oe(e),'" as a ').concat(this.name)),e.$$.ptr||Ct("Cannot pass deleted object as a pointer of type ".concat(this.name)),!this.isConst&&e.$$.ptrType.isConst&&Ct("Cannot convert argument of type ".concat(e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name," to parameter type ").concat(this.name));var n=e.$$.ptrType.registeredClass;if(r=ae(e.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===e.$$.smartPtr&&Ct("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:e.$$.smartPtrType===this?r=e.$$.smartPtr:Ct("Cannot convert argument of type ".concat(e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name," to parameter type ").concat(this.name));break;case 1:r=e.$$.smartPtr;break;case 2:if(e.$$.smartPtrType===this)r=e.$$.smartPtr;else{var o=e.clone();r=this.rawShare(r,Fe.toHandle((function(){o.delete()}))),null!==t&&t.push(this.rawDestructor,r)}break;default:Ct("Unsupporting sharing policy")}return r}function ue(t,e){if(null===e)return this.isReference&&Ct("null is not a valid ".concat(this.name)),0;e.$$||Ct('Cannot pass "'.concat(Oe(e),'" as a ').concat(this.name)),e.$$.ptr||Ct("Cannot pass deleted object as a pointer of type ".concat(this.name)),e.$$.ptrType.isConst&&Ct("Cannot convert argument of type ".concat(e.$$.ptrType.name," to parameter type ").concat(this.name));var r=e.$$.ptrType.registeredClass;return ae(e.$$.ptr,r,this.registeredClass)}function fe(t){return this.fromWireType(A[t>>2])}function le(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t}function de(t){this.rawDestructor&&this.rawDestructor(t)}function he(t){null!==t&&t.delete()}function pe(t,e,r,n,o,i,a,s,c,u,f){this.name=t,this.registeredClass=e,this.isReference=r,this.isConst=n,this.isSmartPointer=o,this.pointeeType=i,this.sharingPolicy=a,this.rawGetPointee=s,this.rawConstructor=c,this.rawShare=u,this.rawDestructor=f,o||void 0!==e.baseClass?this.toWireType=ce:n?(this.toWireType=se,this.destructorFunction=null):(this.toWireType=ue,this.destructorFunction=null)}var ve=[],me=function(t){var e=ve[t];return e||(t>=ve.length&&(ve.length=t+1),ve[t]=e=O.get(t)),e},ye=function(t,e,r){return t.includes("j")?function(t,e,r){var n=i["dynCall_"+t];return r&&r.length?n.apply(null,[e].concat(r)):n.call(null,e)}(t,e,r):me(e).apply(null,r)},ge=function(t,e){var r=[];return function(){return r.length=0,Object.assign(r,arguments),ye(t,e,r)}};function we(t,e){var r=(t=Et(t)).includes("j")?ge(t,e):me(e);return"function"!=typeof r&&Ct("unknown function pointer with signature ".concat(t,": ").concat(e)),r}var be=void 0;function Ee(t){var e=nr(t),r=Et(e);return er(e),r}function ke(t,e){var r=[],n={};throw e.forEach((function t(e){n[e]||_t[e]||(Pt[e]?Pt[e].forEach(t):(r.push(e),n[e]=!0))})),new be("".concat(t,": ")+r.map(Ee).join([", "]))}function _e(t,e){for(var r=[],n=0;n<t;n++)r.push(D[e+4*n>>2]);return r}function Pe(t){for(;t.length;){var e=t.pop();t.pop()(e)}}function Te(t,e){if(!(t instanceof Function))throw new TypeError("new_ called with constructor type ".concat(m(t)," which is not a function"));var r=ne(t.name||"unknownFunctionName",(function(){}));r.prototype=t.prototype;var n=new r,o=t.apply(n,e);return o instanceof Object?o:n}function Ce(t,e,r,n,o,i){var a=e.length;a<2&&Ct("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var s=null!==e[1]&&null!==r,c=!1,u=1;u<e.length;++u)if(null!==e[u]&&void 0===e[u].destructorFunction){c=!0;break}var f="void"!==e[0].name,l="",d="";for(u=0;u<a-2;++u)l+=(0!==u?", ":"")+"arg"+u,d+=(0!==u?", ":"")+"arg"+u+"Wired";var h="\n return function ".concat(re(t),"(").concat(l,") {\n if (arguments.length !== ").concat(a-2,") {\n throwBindingError('function ").concat(t," called with ").concat(arguments.length," arguments, expected ").concat(a-2," args!');\n }");c&&(h+="var destructors = [];\n");var p=c?"destructors":"null",v=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],m=[Ct,n,o,Pe,e[0],e[1]];for(s&&(h+="var thisWired = classParam.toWireType("+p+", this);\n"),u=0;u<a-2;++u)h+="var arg"+u+"Wired = argType"+u+".toWireType("+p+", arg"+u+"); // "+e[u+2].name+"\n",v.push("argType"+u),m.push(e[u+2]);if(s&&(d="thisWired"+(d.length>0?", ":"")+d),h+=(f||i?"var rv = ":"")+"invoker(fn"+(d.length>0?", ":"")+d+");\n",c)h+="runDestructors(destructors);\n";else for(u=s?1:2;u<e.length;++u){var y=1===u?"thisWired":"arg"+(u-2)+"Wired";null!==e[u].destructorFunction&&(h+=y+"_dtor("+y+"); // "+e[u].name+"\n",v.push(y+"_dtor"),m.push(e[u].destructorFunction))}return f&&(h+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),h+="}\n",v.push(h),Te(Function,v).apply(null,m)}function Se(){this.allocated=[void 0],this.freelist=[]}var Ae=new Se;function De(t){t>=Ae.reserved&&0==--Ae.get(t).refcount&&Ae.free(t)}function xe(){for(var t=0,e=Ae.reserved;e<Ae.allocated.length;++e)void 0!==Ae.allocated[e]&&++t;return t}var Fe={toValue:function(t){return t||Ct("Cannot use deleted val. handle = "+t),Ae.get(t).value},toHandle:function(t){switch(t){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return Ae.allocate({refcount:1,value:t})}}};function Oe(t){if(null===t)return"null";var e=m(t);return"object"===e||"array"===e||"function"===e?t.toString():""+t}function je(t,e){switch(e){case 2:return function(t){return this.fromWireType(x[t>>2])};case 3:return function(t){return this.fromWireType(F[t>>3])};default:throw new TypeError("Unknown float type: "+t)}}function Me(t,e,r){switch(e){case 0:return r?function(t){return P[t]}:function(t){return T[t]};case 1:return r?function(t){return C[t>>1]}:function(t){return S[t>>1]};case 2:return r?function(t){return A[t>>2]}:function(t){return D[t>>2]};default:throw new TypeError("Unknown integer type: "+t)}}var $e,Re,Le,ze="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,Ne=function(t,e){for(var r=t,n=r>>1,o=n+e/2;!(n>=o)&&S[n];)++n;if((r=n<<1)-t>32&&ze)return ze.decode(T.subarray(t,r));for(var i="",a=0;!(a>=e/2);++a){var s=C[t+2*a>>1];if(0==s)break;i+=String.fromCharCode(s)}return i},Ie=function(t,e,r){if(void 0===r&&(r=2147483647),r<2)return 0;for(var n=e,o=(r-=2)<2*t.length?r/2:t.length,i=0;i<o;++i){var a=t.charCodeAt(i);C[e>>1]=a,e+=2}return C[e>>1]=0,e-n},Be=function(t){return 2*t.length},Ue=function(t,e){for(var r=0,n="";!(r>=e/4);){var o=A[t+4*r>>2];if(0==o)break;if(++r,o>=65536){var i=o-65536;n+=String.fromCharCode(55296|i>>10,56320|1023&i)}else n+=String.fromCharCode(o)}return n},We=function(t,e,r){if(void 0===r&&(r=2147483647),r<4)return 0;for(var n=e,o=n+r-4,i=0;i<t.length;++i){var a=t.charCodeAt(i);if(a>=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&t.charCodeAt(++i)),A[e>>2]=a,(e+=4)+4>o)break}return A[e>>2]=0,e-n},He=function(t){for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);n>=55296&&n<=57343&&++r,e+=4}return e},Ve={},Ge=[],qe=[],Xe={},Ke=function(){if(!Ke.strings){var t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==("undefined"==typeof navigator?"undefined":m(navigator))&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:u||"./this.program"};for(var e in Xe)void 0===Xe[e]?delete t[e]:t[e]=Xe[e];var r=[];for(var e in t)r.push("".concat(e,"=").concat(t[e]));Ke.strings=r}return Ke.strings},Je=function(t,e,r,n){t||(t=this),this.parent=t,this.mount=t.mount,this.mounted=null,this.id=mt.nextInode++,this.name=e,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=n},Ye=365,Ze=146;Object.defineProperties(Je.prototype,{read:{get:function(){return(this.mode&Ye)===Ye},set:function(t){t?this.mode|=Ye:this.mode&=-366}},write:{get:function(){return(this.mode&Ze)===Ze},set:function(t){t?this.mode|=Ze:this.mode&=-147}},isFolder:{get:function(){return mt.isDir(this.mode)}},isDevice:{get:function(){return mt.isChrdev(this.mode)}}}),mt.FSNode=Je,mt.createPreloadedFile=function(t,e,r,n,o,i,a,s,c,u){var f=e?nt.resolve(et.join2(t,e)):t;function l(r){function l(r){u&&u(),s||mt.createDataFile(t,e,r,n,o,c),i&&i(),U()}(function(t,e,r,n){"undefined"!=typeof Browser&&Browser.init();var o=!1;return pt.forEach((function(i){o||i.canHandle(e)&&(i.handle(t,e,r,n),o=!0)})),o})(r,f,l,(function(){a&&a(),U()}))||l(r)}B(),"string"==typeof r?ht(r,(function(t){return l(t)}),a):l(r)},mt.staticInit(),function(){for(var t=new Array(256),e=0;e<256;++e)t[e]=String.fromCharCode(e);bt=t}(),Tt=i.BindingError=function(t){function e(t){var r;return o(this,e),(r=n(this,e,[t])).name="BindingError",r}return f(e,t),a(e)}(g(Error)),St=i.InternalError=function(t){function e(t){var r;return o(this,e),(r=n(this,e,[t])).name="InternalError",r}return f(e,t),a(e)}(g(Error)),Qt.prototype.isAliasOf=Ft,Qt.prototype.clone=Kt,Qt.prototype.delete=Jt,Qt.prototype.isDeleted=Yt,Qt.prototype.deleteLater=Zt,i.getInheritedInstanceCount=zt,i.getLiveInheritedInstances=Nt,i.flushPendingDeletes=Bt,i.setDelayFunction=Wt,pe.prototype.getPointee=le,pe.prototype.destructor=de,pe.prototype.argPackAdvance=8,pe.prototype.readValueFromPointer=fe,pe.prototype.deleteObject=he,pe.prototype.fromWireType=qt,be=i.UnboundTypeError=($e=Error,(Le=ne(Re="UnboundTypeError",(function(t){this.name=Re,this.message=t;var e=new Error(t).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))}))).prototype=Object.create($e.prototype),Le.prototype.constructor=Le,Le.prototype.toString=function(){return void 0===this.message?this.name:"".concat(this.name,": ").concat(this.message)},Le),Object.assign(Se.prototype,{get:function(t){return this.allocated[t]},has:function(t){return void 0!==this.allocated[t]},allocate:function(t){var e=this.freelist.pop()||this.allocated.length;return this.allocated[e]=t,e},free:function(t){this.allocated[t]=void 0,this.freelist.push(t)}}),Ae.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),Ae.reserved=Ae.allocated.length,i.count_emval_handles=xe;var Qe={p:function(t,e,r){throw new tt(t).init(e,r),t},C:function(t,e,r){gt.varargs=r;try{var n=gt.getStreamFromFD(t);switch(e){case 0:return(o=gt.get())<0?-28:mt.createStream(n,o).fd;case 1:case 2:case 6:case 7:return 0;case 3:return n.flags;case 4:var o=gt.get();return n.flags|=o,0;case 5:return o=gt.get(),C[o+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return i=28,A[rr()>>2]=i,-1}}catch(t){if(void 0===mt||"ErrnoError"!==t.name)throw t;return-t.errno}var i},w:function(t,e,r,n){gt.varargs=n;try{e=gt.getStr(e),e=gt.calculateAt(t,e);var o=n?gt.get():0;return mt.open(e,r,o).fd}catch(t){if(void 0===mt||"ErrnoError"!==t.name)throw t;return-t.errno}},t:function(t,e,r,n,o){},n:function(t,e,r,n,o){var i=wt(r);xt(t,{name:e=Et(e),fromWireType:function(t){return!!t},toWireType:function(t,e){return e?n:o},argPackAdvance:8,readValueFromPointer:function(t){var n;if(1===r)n=P;else if(2===r)n=C;else{if(4!==r)throw new TypeError("Unknown boolean type size: "+e);n=A}return this.fromWireType(n[t>>i])},destructorFunction:null})},r:function(t,e,r,n,o,a,s,c,u,f,l,d,h){l=Et(l),a=we(o,a),c&&(c=we(s,c)),f&&(f=we(u,f)),h=we(d,h);var p=re(l);!function(t,e,r){i.hasOwnProperty(t)?(Ct("Cannot register public name '".concat(t,"' twice")),oe(i,t,t),i.hasOwnProperty(r)&&Ct("Cannot register multiple overloads of a function with the same number of arguments (".concat(r,")!")),i[t].overloadTable[r]=e):i[t]=e}(p,(function(){ke("Cannot construct ".concat(l," due to unbound types"),[n])})),Dt([t,e,r],n?[n]:[],(function(e){var r,o;e=e[0],o=n?(r=e.registeredClass).instancePrototype:Qt.prototype;var s=ne(p,(function(){if(Object.getPrototypeOf(this)!==u)throw new Tt("Use 'new' to construct "+l);if(void 0===d.constructor_body)throw new Tt(l+" has no accessible constructor");var t=d.constructor_body[arguments.length];if(void 0===t)throw new Tt("Tried to invoke ctor of ".concat(l," with invalid number of parameters (").concat(arguments.length,") - expected (").concat(Object.keys(d.constructor_body).toString(),") parameters instead!"));return t.apply(this,arguments)})),u=Object.create(o,{constructor:{value:s}});s.prototype=u;var d=new ie(l,s,u,h,r,a,c,f);d.baseClass&&(void 0===d.baseClass.__derivedClasses&&(d.baseClass.__derivedClasses=[]),d.baseClass.__derivedClasses.push(d));var v=new pe(l,d,!0,!1,!1),m=new pe(l+"*",d,!1,!1,!1),y=new pe(l+" const*",d,!1,!0,!1);return Lt[t]={pointerType:m,constPointerType:y},function(t,e,r){i.hasOwnProperty(t)||At("Replacing nonexistant public symbol"),void 0!==i[t].overloadTable&&void 0!==r?i[t].overloadTable[r]=e:(i[t]=e,i[t].argCount=r)}(p,s),[v,m,y]}))},q:function(t,e,r,n,o,i){var a=_e(e,r);o=we(n,o),Dt([],[t],(function(t){t=t[0];var r="constructor ".concat(t.name);if(void 0===t.registeredClass.constructor_body&&(t.registeredClass.constructor_body=[]),void 0!==t.registeredClass.constructor_body[e-1])throw new Tt("Cannot register multiple constructors with identical number of parameters (".concat(e-1,") for class '").concat(t.name,"'! Overload resolution is currently only performed using the parameter count, not actual type info!"));return t.registeredClass.constructor_body[e-1]=function(){ke("Cannot construct ".concat(t.name," due to unbound types"),a)},Dt([],a,(function(n){return n.splice(1,0,null),t.registeredClass.constructor_body[e-1]=Ce(r,n,null,o,i),[]})),[]}))},d:function(t,e,r,n,o,i,a,s,c){var u=_e(r,n);e=Et(e),i=we(o,i),Dt([],[t],(function(t){t=t[0];var n="".concat(t.name,".").concat(e);function o(){ke("Cannot call ".concat(n," due to unbound types"),u)}e.startsWith("@@")&&(e=Symbol[e.substring(2)]),s&&t.registeredClass.pureVirtualFunctions.push(e);var f=t.registeredClass.instancePrototype,l=f[e];return void 0===l||void 0===l.overloadTable&&l.className!==t.name&&l.argCount===r-2?(o.argCount=r-2,o.className=t.name,f[e]=o):(oe(f,e,n),f[e].overloadTable[r-2]=o),Dt([],u,(function(o){var s=Ce(n,o,t,i,a,c);return void 0===f[e].overloadTable?(s.argCount=r-2,f[e]=s):f[e].overloadTable[r-2]=s,[]})),[]}))},D:function(t,e){xt(t,{name:e=Et(e),fromWireType:function(t){var e=Fe.toValue(t);return De(t),e},toWireType:function(t,e){return Fe.toHandle(e)},argPackAdvance:8,readValueFromPointer:fe,destructorFunction:null})},k:function(t,e,r){var n=wt(r);xt(t,{name:e=Et(e),fromWireType:function(t){return t},toWireType:function(t,e){return e},argPackAdvance:8,readValueFromPointer:je(e,n),destructorFunction:null})},c:function(t,e,r,n,o){e=Et(e);var i=wt(r),a=function(t){return t};if(0===n){var s=32-8*r;a=function(t){return t<<s>>>s}}var c=e.includes("unsigned");xt(t,{name:e,fromWireType:a,toWireType:c?function(t,e){return this.name,e>>>0}:function(t,e){return this.name,e},argPackAdvance:8,readValueFromPointer:Me(e,i,0!==n),destructorFunction:null})},b:function(t,e,r){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][e];function o(t){var e=D,r=e[t>>=2],o=e[t+1];return new n(e.buffer,o,r)}xt(t,{name:r=Et(r),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},j:function(t,e){var r="std::string"===(e=Et(e));xt(t,{name:e,fromWireType:function(t){var e,n=D[t>>2],o=t+4;if(r)for(var i=o,a=0;a<=n;++a){var s=o+a;if(a==n||0==T[s]){var c=yt(i,s-i);void 0===e?e=c:(e+=String.fromCharCode(0),e+=c),i=s+1}}else{var u=new Array(n);for(a=0;a<n;++a)u[a]=String.fromCharCode(T[o+a]);e=u.join("")}return er(t),e},toWireType:function(t,e){var n;e instanceof ArrayBuffer&&(e=new Uint8Array(e));var o="string"==typeof e;o||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||Ct("Cannot pass non-string to std::string"),n=r&&o?st(e):e.length;var i=tr(4+n+1),a=i+4;if(D[i>>2]=n,r&&o)ct(e,T,a,n+1);else if(o)for(var s=0;s<n;++s){var c=e.charCodeAt(s);c>255&&(er(a),Ct("String has UTF-16 code units that do not fit in 8 bits")),T[a+s]=c}else for(s=0;s<n;++s)T[a+s]=e[s];return null!==t&&t.push(er,i),i},argPackAdvance:8,readValueFromPointer:fe,destructorFunction:function(t){er(t)}})},f:function(t,e,r){var n,o,i,a,s;r=Et(r),2===e?(n=Ne,o=Ie,a=Be,i=function(){return S},s=1):4===e&&(n=Ue,o=We,a=He,i=function(){return D},s=2),xt(t,{name:r,fromWireType:function(t){for(var r,o=D[t>>2],a=i(),c=t+4,u=0;u<=o;++u){var f=t+4+u*e;if(u==o||0==a[f>>s]){var l=n(c,f-c);void 0===r?r=l:(r+=String.fromCharCode(0),r+=l),c=f+e}}return er(t),r},toWireType:function(t,n){"string"!=typeof n&&Ct("Cannot pass non-string to C++ string type ".concat(r));var i=a(n),c=tr(4+i+e);return D[c>>2]=i>>s,o(n,c+4,i+e),null!==t&&t.push(er,c),c},argPackAdvance:8,readValueFromPointer:fe,destructorFunction:function(t){er(t)}})},o:function(t,e){xt(t,{isVoid:!0,name:e=Et(e),argPackAdvance:0,fromWireType:function(){},toWireType:function(t,e){}})},g:function(t,e,r,n){var o,i;(t=Ge[t])(e=Fe.toValue(e),r=void 0===(i=Ve[o=r])?Et(o):i,null,n)},m:De,l:function(t,e){var r=function(t,e){for(var r,n,o,i=new Array(t),a=0;a<t;++a)i[a]=(r=D[e+4*a>>2],n="parameter "+a,o=void 0,void 0===(o=_t[r])&&Ct(n+" has unknown type "+Ee(r)),o);return i}(t,e),n=r[0],o=n.name+"_$"+r.slice(1).map((function(t){return t.name})).join("_")+"$",i=qe[o];if(void 0!==i)return i;for(var a=["retType"],s=[n],c="",u=0;u<t-1;++u)c+=(0!==u?", ":"")+"arg"+u,a.push("argType"+u),s.push(r[1+u]);var f="return function "+re("methodCaller_"+o)+"(handle, name, destructors, args) {\n",l=0;for(u=0;u<t-1;++u)f+=" var arg"+u+" = argType"+u+".readValueFromPointer(args"+(l?"+"+l:"")+");\n",l+=r[u+1].argPackAdvance;for(f+=" var rv = handle[name]("+c+");\n",u=0;u<t-1;++u)r[u+1].deleteObject&&(f+=" argType"+u+".deleteObject(arg"+u+");\n");n.isVoid||(f+=" return retType.toWireType(destructors, rv);\n"),f+="};\n",a.push(f);var d,h,p=Te(Function,a).apply(null,s);return d=p,h=Ge.length,Ge.push(d),i=h,qe[o]=i,i},a:function(){W("")},e:function(){return Date.now()},v:function(){return T.length},A:function(t,e,r){return T.copyWithin(t,e,e+r)},u:function(t){T.length,W("OOM")},y:function(t,e){var r=0;return Ke().forEach((function(n,o){var i=e+r;D[t+4*o>>2]=i,function(t,e){for(var r=0;r<t.length;++r)P[0|e++]=t.charCodeAt(r);P[0|e]=0}(n,i),r+=n.length+1})),0},z:function(t,e){var r=Ke();D[t>>2]=r.length;var n=0;return r.forEach((function(t){n+=t.length+1})),D[e>>2]=n,0},i:function(t){try{var e=gt.getStreamFromFD(t);return mt.close(e),0}catch(t){if(void 0===mt||"ErrnoError"!==t.name)throw t;return t.errno}},x:function(t,e){try{var r=gt.getStreamFromFD(t),n=r.tty?2:mt.isDir(r.mode)?3:mt.isLink(r.mode)?7:4;return P[0|e]=n,C[e+2>>1]=0,q=[0,(G=0,+Math.abs(G)>=1?G>0?+Math.floor(G/4294967296)>>>0:~~+Math.ceil((G-+(~~G>>>0))/4294967296)>>>0:0)],A[e+8>>2]=q[0],A[e+12>>2]=q[1],q=[0,(G=0,+Math.abs(G)>=1?G>0?+Math.floor(G/4294967296)>>>0:~~+Math.ceil((G-+(~~G>>>0))/4294967296)>>>0:0)],A[e+16>>2]=q[0],A[e+20>>2]=q[1],0}catch(t){if(void 0===mt||"ErrnoError"!==t.name)throw t;return t.errno}},B:function(t,e,r,n){try{var o=function(t,e,r,n){for(var o=0,i=0;i<r;i++){var a=D[e>>2],s=D[e+4>>2];e+=8;var c=mt.read(t,P,a,s,n);if(c<0)return-1;if(o+=c,c<s)break}return o}(gt.getStreamFromFD(t),e,r);return D[n>>2]=o,0}catch(t){if(void 0===mt||"ErrnoError"!==t.name)throw t;return t.errno}},s:function(t,e,r,n,o){var i,a,s=(a=r)+2097152>>>0<4194305-!!(i=e)?(i>>>0)+4294967296*a:NaN;try{if(isNaN(s))return 61;var c=gt.getStreamFromFD(t);return mt.llseek(c,s,n),q=[c.position>>>0,(G=c.position,+Math.abs(G)>=1?G>0?+Math.floor(G/4294967296)>>>0:~~+Math.ceil((G-+(~~G>>>0))/4294967296)>>>0:0)],A[o>>2]=q[0],A[o+4>>2]=q[1],c.getdents&&0===s&&0===n&&(c.getdents=null),0}catch(t){if(void 0===mt||"ErrnoError"!==t.name)throw t;return t.errno}},h:function(t,e,r,n){try{var o=function(t,e,r,n){for(var o=0,i=0;i<r;i++){var a=D[e>>2],s=D[e+4>>2];e+=8;var c=mt.write(t,P,a,s,n);if(c<0)return-1;o+=c}return o}(gt.getStreamFromFD(t),e,r);return D[n>>2]=o,0}catch(t){if(void 0===mt||"ErrnoError"!==t.name)throw t;return t.errno}}};!function(){var t,r,n,o,a={a:Qe};function s(t,e){var r,n=t.exports;return b=(E=n).E,r=b.buffer,i.HEAP8=P=new Int8Array(r),i.HEAP16=C=new Int16Array(r),i.HEAP32=A=new Int32Array(r),i.HEAPU8=T=new Uint8Array(r),i.HEAPU16=S=new Uint16Array(r),i.HEAPU32=D=new Uint32Array(r),i.HEAPF32=x=new Float32Array(r),i.HEAPF64=F=new Float64Array(r),O=E.H,function(t){$.unshift(t)}(E.F),U(),n}if(B(),i.instantiateWasm)try{return i.instantiateWasm(a,s)}catch(t){_("Module.instantiateWasm callback failed with error: "+t),e(t)}(t=w,r=H,n=a,o=function(t){s(t.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||K(r)||"function"!=typeof fetch?Y(r,n,o):fetch(r,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,n).then(o,(function(t){return _("wasm streaming compile failed: "+t),_("falling back to ArrayBuffer instantiation"),Y(r,n,o)}))}))).catch(e)}();var tr=function(t){return(tr=E.G)(t)},er=function(t){return(er=E.I)(t)},rr=function(){return(rr=E.J)()},nr=function(t){return(nr=E.K)(t)};i.__embind_initialize_bindings=function(){return(i.__embind_initialize_bindings=E.L)()};var or,ir=function(t){return(ir=E.M)(t)};function ar(){function e(){or||(or=!0,i.calledRun=!0,j||(i.noFSInit||mt.init.initialized||mt.init(),mt.ignorePermissions=!1,Q($),t(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),function(){if(i.postRun)for("function"==typeof i.postRun&&(i.postRun=[i.postRun]);i.postRun.length;)z(i.postRun.shift());Q(R)}()))}N>0||(function(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)L(i.preRun.shift());Q(M)}(),N>0||(i.setStatus?(i.setStatus("Running..."),setTimeout((function(){setTimeout((function(){i.setStatus("")}),1),e()}),1)):e()))}if(i.dynCall_jiji=function(t,e,r,n,o){return(i.dynCall_jiji=E.N)(t,e,r,n,o)},i._ff_h264_cabac_tables=67061,I=function t(){or||ar(),or||(I=t)},i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return ar(),r.ready}),tt=Q,et=function(t){function e(t){return o(this,e),n(this,e,[tt,(null==t?void 0:t.wasmPath)?fetch(null==t?void 0:t.wasmPath).then((function(t){return t.arrayBuffer()})):void 0,null==t?void 0:t.workerMode,null==t?void 0:t.canvas,null==t?void 0:t.yuvMode])}return f(e,t),a(e)}(Y);!function(){var t="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0}();function rt(){return performance&&performance.now?Math.floor(performance.now()):Date.now()}var nt=function(){function t(e){o(this,t),this.core=e,$(this,"contextMap",new Map),$(this,"decodeProcessorMap",new WeakMap),this.addKVReportBeforeExitRoom=this.addKVReportBeforeExitRoom.bind(this),this.createDecoder=this.createDecoder.bind(this),this.core.innerEmitter.on("51",this.addKVReportBeforeExitRoom)}return a(t,[{key:"getAlias",value:function(){return"videoDecoder"}},{key:"getGroup",value:function(t){return(null==t?void 0:t.track)?"".concat(t.track.userId).concat(t.track.streamType):"*"}},{key:"getName",value:function(){return t.Name}},{key:"getValidateRule",value:function(t){return{type:this.core.enums.BASIC_TYPE.Object}}},{key:"createDecoder",value:function(t,e){switch(t){case"wasm":return new et(j(O({},e),{wasmPath:"".concat(this.core.assetsPath||".","/videodec.wasm")}));case"webCodecs":return new K;case"mse":throw new Error("mse decoder not supported yet");default:throw new Error("Unsupported decoder type")}}},{key:"start",value:function(t){var e=this;this.decodeProcessorMap.set(t.track,this.decode(t)),this.core.room.videoManager.addDecodeProcessor({processor:function(t){var r,n=t.frame,o=t.track;return(null==(r=e.decodeProcessorMap.get(o))?void 0:r({frame:n,track:o}))||n},type:3})}},{key:"decode",value:function(t){var e=this,r=this.core.rx,n=r.pipe,o=r.take,i=r.subscribe;return function(r){var a=r.frame,s=r.track;if(s!==t.track||"empty"===a.type)return a;if(e.contextMap.has(s))return e.contextMap.get(s).decode(a);var c=e.core.room.videoManager.createDecodeContext(j(O({},t),{createDecoder:e.createDecoder}));return n(c.trackDoneOB,o(1),i((function(){e.core.clearStarted(e,e.getGroup(t)),e.stop({track:s})}))),e.contextMap.set(s,c),c.decode(a)}}},{key:"stop",value:function(t){var e=this;if(null==t?void 0:t.track){var r=this.contextMap.get(t.track);r&&(r.close("stop"),this.report(r,t.track),this.contextMap.delete(t.track))}else this.contextMap.forEach((function(t,r){t.close("stop"),e.contextMap.delete(r)}));0===this.contextMap.size&&this.core.room.videoManager.removeDecodeProcessor({type:3})}},{key:"report",value:function(t,e){if(!t.isReported){t.isReported=!0;var r=rt()-t.startPerformanceTime,n=this.getRemoteTrackFreezeDuration(e,t),o=n.renderFreezeTotal,i=n.dataFreezeTotal;r&&this.core.kvStatManager.addNumber({key:514850,value:Math.floor(o/r*100),split:1}),r&&this.core.kvStatManager.addNumber({key:514851,value:Math.floor(i/r*100),split:1}),t.inputFrameCount&&this.core.kvStatManager.addNumber({key:514852,value:Math.floor(t.decodedFrameCount/t.inputFrameCount*100),split:1})}}},{key:"addKVReportBeforeExitRoom",value:function(t){var e=this;t.room===this.core.room&&this.contextMap.forEach((function(t,r){e.report(t,r)}))}},{key:"update",value:function(t){var e=this.contextMap.get(t.track);e&&("mock"!==t.type?(e.close("update"),this.contextMap.set(t.track,this.core.room.videoManager.createDecodeContext(j(O({},t),{createDecoder:this.createDecoder})))):e.mock(this.core.enums.DECODE_FAILED_ERROR_CODE.TEST))}},{key:"getRemoteTrackFreezeDuration",value:function(t,e){var r=this.core.room.badCaseDetector.getRenderFreezeMap().get("".concat(t.userId,"_").concat(t.streamType)),n=this.core.room.badCaseDetector.getDataFreezeMap().get("".concat(t.userId,"_").concat(t.streamType)),o=0;r&&r.freezeTimeline.forEach((function(t){var r=t.startTime,n=t.endTime;r>e.startPerformanceTime&&(o+=0===n?rt()-r:n-r)}));var i=0;return n&&n.durationItemList.forEach((function(t){t.startTime>e.startPerformanceTime&&(i+=t.getDuration())})),{renderFreezeTotal:o,dataFreezeTotal:i}}},{key:"destroy",value:function(){this.core.innerEmitter.off("51",this.addKVReportBeforeExitRoom)}}])}();return $(nt,"Name","TRTCVideoDecoder"),nt}));
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/basic-beauty",
3
- "version": "5.10.0-wasm.2",
3
+ "version": "5.10.0-wasm.4",
4
4
  "description": "TRTC Web SDK 5.x basic-beauty plugin",
5
5
  "main": "./basic-beauty.esm.js",
6
6
  "module": "./basic-beauty.esm.js",