@zoom/videosdk
Version:
Zoom Web Video SDK
1 lines • 99.3 kB
JavaScript
(()=>{var e={2601:(e,t,r)=>{e.exports=r(4444)},3565:(e,t,r)=>{"use strict";var n=r(1960);e.exports=n},2671:(e,t,r)=>{"use strict";r(2344),e.exports=r(5951)},4444:(e,t,r)=>{"use strict";e.exports=r(214)},214:(e,t,r)=>{"use strict";r(397);var n=r(3565);e.exports=n},2159:(e,t,r)=>{"use strict";var n=r(2250),o=r(4640),i=TypeError;e.exports=function(e){if(n(e))return e;throw new i(o(e)+" is not a function")}},6624:(e,t,r)=>{"use strict";var n=r(6285),o=String,i=TypeError;e.exports=function(e){if(n(e))return e;throw new i(o(e)+" is not an object")}},5807:(e,t,r)=>{"use strict";var n=r(1907),o=n({}.toString),i=n("".slice);e.exports=function(e){return i(o(e),8,-1)}},1626:(e,t,r)=>{"use strict";var n=r(9447),o=r(4284),i=r(5817);e.exports=n?function(e,t,r){return o.f(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}},5817:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},2532:(e,t,r)=>{"use strict";var n=r(5951),o=Object.defineProperty;e.exports=function(e,t){try{o(n,e,{value:t,configurable:!0,writable:!0})}catch(r){n[e]=t}return t}},9447:(e,t,r)=>{"use strict";var n=r(8828);e.exports=!n((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},9552:(e,t,r)=>{"use strict";var n=r(5951),o=r(6285),i=n.document,a=o(i)&&o(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},6794:(e,t,r)=>{"use strict";var n=r(5951).navigator,o=n&&n.userAgent;e.exports=o?String(o):""},798:(e,t,r)=>{"use strict";var n,o,i=r(5951),a=r(6794),s=i.process,u=i.Deno,l=s&&s.versions||u&&u.version,c=l&&l.v8;c&&(o=(n=c.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!o&&a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/))&&(o=+n[1]),e.exports=o},1091:(e,t,r)=>{"use strict";var n=r(5951),o=r(6024),i=r(2361),a=r(2250),s=r(3846).f,u=r(7463),l=r(2046),c=r(8311),f=r(1626),_=r(9724);r(6128);var d=function(e){var t=function(r,n,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,i)}return o(e,this,arguments)};return t.prototype=e.prototype,t};e.exports=function(e,t){var r,o,p,h,m,g,y,v,w,E=e.target,b=e.global,S=e.stat,k=e.proto,M=b?n:S?n[E]:n[E]&&n[E].prototype,A=b?l:l[E]||f(l,E,{})[E],C=A.prototype;for(h in t)o=!(r=u(b?h:E+(S?".":"#")+h,e.forced))&&M&&_(M,h),g=A[h],o&&(y=e.dontCallGetSet?(w=s(M,h))&&w.value:M[h]),m=o&&y?y:t[h],(r||k||typeof g!=typeof m)&&(v=e.bind&&o?c(m,n):e.wrap&&o?d(m):k&&a(m)?i(m):m,(e.sham||m&&m.sham||g&&g.sham)&&f(v,"sham",!0),f(A,h,v),k&&(_(l,p=E+"Prototype")||f(l,p,{}),f(l[p],h,m),e.real&&C&&(r||!C[h])&&f(C,h,m)))}},8828:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},6024:(e,t,r)=>{"use strict";var n=r(1505),o=Function.prototype,i=o.apply,a=o.call;e.exports="object"==typeof Reflect&&Reflect.apply||(n?a.bind(i):function(){return a.apply(i,arguments)})},8311:(e,t,r)=>{"use strict";var n=r(2361),o=r(2159),i=r(1505),a=n(n.bind);e.exports=function(e,t){return o(e),void 0===t?e:i?a(e,t):function(){return e.apply(t,arguments)}}},1505:(e,t,r)=>{"use strict";var n=r(8828);e.exports=!n((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},3930:(e,t,r)=>{"use strict";var n=r(1505),o=Function.prototype.call;e.exports=n?o.bind(o):function(){return o.apply(o,arguments)}},2361:(e,t,r)=>{"use strict";var n=r(5807),o=r(1907);e.exports=function(e){if("Function"===n(e))return o(e)}},1907:(e,t,r)=>{"use strict";var n=r(1505),o=Function.prototype,i=o.call,a=n&&o.bind.bind(i,i);e.exports=n?a:function(e){return function(){return i.apply(e,arguments)}}},5582:(e,t,r)=>{"use strict";var n=r(2046),o=r(5951),i=r(2250),a=function(e){return i(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?a(n[e])||a(o[e]):n[e]&&n[e][t]||o[e]&&o[e][t]}},9367:(e,t,r)=>{"use strict";var n=r(2159),o=r(7136);e.exports=function(e,t){var r=e[t];return o(r)?void 0:n(r)}},5951:function(e,t,r){"use strict";var n=function(e){return e&&e.Math===Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof r.g&&r.g)||n("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9724:(e,t,r)=>{"use strict";var n=r(1907),o=r(9298),i=n({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return i(o(e),t)}},3648:(e,t,r)=>{"use strict";var n=r(9447),o=r(8828),i=r(9552);e.exports=!n&&!o((function(){return 7!==Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},6946:(e,t,r)=>{"use strict";var n=r(1907),o=r(8828),i=r(5807),a=Object,s=n("".split);e.exports=o((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"===i(e)?s(e,""):a(e)}:a},2250:e=>{"use strict";var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},7463:(e,t,r)=>{"use strict";var n=r(8828),o=r(2250),i=/#|\.prototype\./,a=function(e,t){var r=u[s(e)];return r===c||r!==l&&(o(t)?n(t):!!t)},s=a.normalize=function(e){return String(e).replace(i,".").toLowerCase()},u=a.data={},l=a.NATIVE="N",c=a.POLYFILL="P";e.exports=a},7136:e=>{"use strict";e.exports=function(e){return null==e}},6285:(e,t,r)=>{"use strict";var n=r(2250);e.exports=function(e){return"object"==typeof e?null!==e:n(e)}},7376:e=>{"use strict";e.exports=!0},5594:(e,t,r)=>{"use strict";var n=r(5582),o=r(2250),i=r(8280),a=r(1175),s=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=n("Symbol");return o(t)&&i(t.prototype,s(e))}},4284:(e,t,r)=>{"use strict";var n=r(9447),o=r(3648),i=r(8661),a=r(6624),s=r(470),u=TypeError,l=Object.defineProperty,c=Object.getOwnPropertyDescriptor,f="enumerable",_="configurable",d="writable";t.f=n?i?function(e,t,r){if(a(e),t=s(t),a(r),"function"==typeof e&&"prototype"===t&&"value"in r&&d in r&&!r[d]){var n=c(e,t);n&&n[d]&&(e[t]=r.value,r={configurable:_ in r?r[_]:n[_],enumerable:f in r?r[f]:n[f],writable:!1})}return l(e,t,r)}:l:function(e,t,r){if(a(e),t=s(t),a(r),o)try{return l(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new u("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},3846:(e,t,r)=>{"use strict";var n=r(9447),o=r(3930),i=r(2574),a=r(5817),s=r(7374),u=r(470),l=r(9724),c=r(3648),f=Object.getOwnPropertyDescriptor;t.f=n?f:function(e,t){if(e=s(e),t=u(t),c)try{return f(e,t)}catch(e){}if(l(e,t))return a(!o(i.f,e,t),e[t])}},8280:(e,t,r)=>{"use strict";var n=r(1907);e.exports=n({}.isPrototypeOf)},2574:(e,t)=>{"use strict";var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,o=n&&!r.call({1:2},1);t.f=o?function(e){var t=n(this,e);return!!t&&t.enumerable}:r},581:(e,t,r)=>{"use strict";var n=r(3930),o=r(2250),i=r(6285),a=TypeError;e.exports=function(e,t){var r,s;if("string"===t&&o(r=e.toString)&&!i(s=n(r,e)))return s;if(o(r=e.valueOf)&&!i(s=n(r,e)))return s;if("string"!==t&&o(r=e.toString)&&!i(s=n(r,e)))return s;throw new a("Can't convert object to primitive value")}},2046:e=>{"use strict";e.exports={}},4239:(e,t,r)=>{"use strict";var n=r(7136),o=TypeError;e.exports=function(e){if(n(e))throw new o("Can't call method on "+e);return e}},6128:(e,t,r)=>{"use strict";var n=r(7376),o=r(5951),i=r(2532),a="__core-js_shared__",s=e.exports=o[a]||i(a,{});(s.versions||(s.versions=[])).push({version:"3.46.0",mode:n?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru), 2025 CoreJS Company (core-js.io)",license:"https://github.com/zloirock/core-js/blob/v3.46.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5816:(e,t,r)=>{"use strict";var n=r(6128);e.exports=function(e,t){return n[e]||(n[e]=t||{})}},9846:(e,t,r)=>{"use strict";var n=r(798),o=r(8828),i=r(5951).String;e.exports=!!Object.getOwnPropertySymbols&&!o((function(){var e=Symbol("symbol detection");return!i(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},7374:(e,t,r)=>{"use strict";var n=r(6946),o=r(4239);e.exports=function(e){return n(o(e))}},9298:(e,t,r)=>{"use strict";var n=r(4239),o=Object;e.exports=function(e){return o(n(e))}},6028:(e,t,r)=>{"use strict";var n=r(3930),o=r(6285),i=r(5594),a=r(9367),s=r(581),u=r(6264),l=TypeError,c=u("toPrimitive");e.exports=function(e,t){if(!o(e)||i(e))return e;var r,u=a(e,c);if(u){if(void 0===t&&(t="default"),r=n(u,e,t),!o(r)||i(r))return r;throw new l("Can't convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},470:(e,t,r)=>{"use strict";var n=r(6028),o=r(5594);e.exports=function(e){var t=n(e,"string");return o(t)?t:t+""}},4640:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},6499:(e,t,r)=>{"use strict";var n=r(1907),o=0,i=Math.random(),a=n(1.1.toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++o+i,36)}},1175:(e,t,r)=>{"use strict";var n=r(9846);e.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8661:(e,t,r)=>{"use strict";var n=r(9447),o=r(8828);e.exports=n&&o((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},6264:(e,t,r)=>{"use strict";var n=r(5951),o=r(5816),i=r(9724),a=r(6499),s=r(9846),u=r(1175),l=n.Symbol,c=o("wks"),f=u?l.for||l:l&&l.withoutSetter||a;e.exports=function(e){return i(c,e)||(c[e]=s&&i(l,e)?l[e]:f("Symbol."+e)),c[e]}},2344:(e,t,r)=>{"use strict";var n=r(1091),o=r(5951);n({global:!0,forced:o.globalThis!==o},{globalThis:o})},397:(e,t,r)=>{"use strict";r(2344)},1960:(e,t,r)=>{"use strict";var n=r(2671);e.exports=n}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e=r(2601),t=r.n(e);const n="MEDIASDK_CACHE_INFO";new class{constructor(){this._highFrequencyLogs={},this.fixVersion="",this.cacheLogStack=[],this.isFlushing=!1}setInstance(e,t){this._instance=e,this.fixVersion=t}getMessageFromErrorOrEvent(e,t){let r=e;return t instanceof ErrorEvent?(t.filename&&(r+=` File: ${t.filename}`),(t.lineno||t.colno)&&(r+=` Line: ${t.lineno}:${t.colno}`),t.message&&(r+=` Message: ${t.message}`),t.error&&(r+=`\nStack: ${t.error.stack}`)):t instanceof Error?(t.message&&(r+=` Message: ${t.message}`),t.stack&&(r+=` Stack: ${t.stack}`),t.name&&(r+=` Name: ${t.name}`),t.constraint&&(r+=` Constraint: ${t.constraint}`)):t instanceof CloseEvent?(t.code&&(r+=` Code: ${t.code}`),t.reason&&(r+=` Reason: ${t.reason}`),r+=` wasClean: ${t.wasClean}`):t instanceof DOMException?(t.message&&(r+=` Message: ${t.message}`),t.name&&(r+=` Name: ${t.name}`)):r+=t?t.toString():"",r}_addCacheLog(e,t){this.cacheLogStack.length<100&&this.cacheLogStack.push({type:e,message:t})}flushCacheLog(){if(this._instance&&this.cacheLogStack.length>0&&!this.isFlushing){this.isFlushing=!0;let e="";this.cacheLogStack.forEach((t=>{let{type:r,message:{message:o="",tags:i=[]}}=t;const a=o?`${i.join("|")}:${o}|----|`:"";switch(r){case"log":this._log(o,[...i,n]);break;case"warn":case"error":case"severityerror":case"directReport":e+=a}})),e&&this._directReport(e,[n]),this.cacheLogStack=[],this.isFlushing=!1}}log(e,t=[]){this._instance?(this.flushCacheLog(),this._log(e,t)):this._addCacheLog("log",{message:e,tags:t})}warn(e,t=null,r=[]){e=this.getMessageFromErrorOrEvent(e,t),this._instance?(this.flushCacheLog(),this._warn(e,r)):this._addCacheLog("warn",{message:e,tags:r})}error(e,t=null,r=[]){var n;e=this.getMessageFromErrorOrEvent(e,t),this._highFrequencyLogs[e]?this._highFrequencyLogs[e]+=1:this._highFrequencyLogs[e]=1,!((n=this._highFrequencyLogs[e])&n-1)&&(this._instance?(this.flushCacheLog(),this._error(e,r)):this._addCacheLog("error",{message:e,tags:r}))}severityerror(e,t=[]){this._instance?(this.flushCacheLog(),this._severityerror(JSON.stringify(e),t)):this._addCacheLog("severityerror",{message:JSON.stringify(e),tags:t})}directReport(e,t=["MEDIASDK_INFO"]){var r;this._instance?(this.flushCacheLog(),null===(r=this._directReport)||void 0===r||r.call(this,e,t)):this._addCacheLog("directReport",{message:e,tags:t})}_log(e,t=[]){this._instance&&this._instance.log(e,t)}_warn(e,t=[]){this._instance&&this._instance.warn(e,t)}_error(e,t=[]){this._instance&&this._instance.error(e,[this.fixVersion,...t])}_severityerror(e,t=[]){this._instance&&this._instance.error(e,t)}_directReport(e,t=[]){var r,n;this._instance&&(null===(n=(r=this._instance).directReport)||void 0===n||n.call(r,{msg:e},t))}clearHighFrequencyLogs(){this._highFrequencyLogs={}}};const o=[0,1,2,3,4,4,5,5,5,5,6,6,6,6,6,7,7,7,7,8,8,8,9,9,9,9,9,9,9,9,9,9,9];function i(e,t){let r=0,n=0;for(let o=0;o<e.length;o+=t){n+=e[o]*e[o];let t=Math.abs(e[o]);t>r&&(r=t)}return r=r>1?1:r,{sumRms:n/e.length/t,absMax:r}}function a(e){let t=0;return t=e>.1995?15:e>.0794?14:e>.0316?13:e>.0126?12:e>.005?11:e>.002?10:e>79433e-8?9:e>31623e-8?8:e>12589e-8?7:e>50119e-9?6:e>19953e-9?5:e>79433e-10?4:e>31623e-10?3:e>12589e-10?2:e>5.0119e-7?1:0,t}function s(e){postMessage({status:35,data:e})}function u(e,t=null){var r,n;if(t instanceof Error||t instanceof ErrorEvent){const o=t;e+=" Code: "+(null==o?void 0:o.code)+" Message: "+(null==t?void 0:t.message)+" Stack: "+(null!==(n=null===(r=null==o?void 0:o.error)||void 0===r?void 0:r.stack)&&void 0!==n?n:null==o?void 0:o.stack),t=null}postMessage({status:61,errorMessage:e,errorEvent:t})}function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t)return t.postMessage({status:48,data:e});postMessage({status:48,data:e})}new Error,new Map,new Map,new class{constructor(){this.ssrcInfoMap=new Map,this.timer=null}updateSSRCInfo(e,t){this.ssrcInfoMap.has(e)||this.ssrcInfoMap.set(e,{firstTime:0,lastTime:0,frames:0,fps:0}),this._calculateFPS(e,t),this._removeZeroFPS()}_calculateFPS(e,t){const r=this.ssrcInfoMap.get(e);if(0===r.frames?r.firstTime=t:r.lastTime=t,r.frames+=1,r.frames>2&&r.frames%5==0&&r.lastTime-r.firstTime>=1e3){const t=Math.floor(1e3/((r.lastTime-r.firstTime)/(r.frames-1)));r.fps!==t&&(this._notifyFPS(e,t),r.fps=t),r.firstTime=r.lastTime,r.frames=1}}_removeZeroFPS(){let e=Date.now();this.ssrcInfoMap.forEach(((t,r)=>{const n=this.ssrcInfoMap.get(r);n&&n.lastTime&&e-n.lastTime>2e3&&(this.ssrcInfoMap.delete(r),this._notifyFPS(r,0))}))}_notifyFPS(e,t){postMessage({status:66.6,data:{ssrc:e,fps:t}})}_checkIfNewFrameComing(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout((()=>{this._removeZeroFPS(),this.timer=null}),2500)}},new class{constructor(){this.ssrcInfoMap=new Map,this.timer=null}updateSSRCInfo(e,t){this.ssrcInfoMap.has(e)||this.ssrcInfoMap.set(e,{timeList:[],lastTime:0,fps:0}),this._calculateFPS(e,t),this._removeZeroFPS(),this._checkIfNewFrameComing()}_calculateFPS(e,t){const r=this.ssrcInfoMap.get(e);if(r.timeList.push(t),r.lastTime=t,r.timeList.length>2){const t=r.timeList[0],n=r.timeList[r.timeList.length-1];if(n-t>=1e3){const o=Math.floor(1e3/((n-t)/(r.timeList.length-1)));r.fps!==o&&(this._notifyFPS(e,o),r.fps=o),r.timeList=[]}}r.timeList.length>30&&(r.timeList=r.timeList.slice(r.timeList.length-30))}_removeZeroFPS(){this.ssrcInfoMap.forEach(((e,t)=>{const r=this.ssrcInfoMap.get(t);r&&Date.now()-r.lastTime>2e3&&(this.ssrcInfoMap.delete(t),this._notifyFPS(t,0))}))}_notifyFPS(e,t){postMessage({status:66.6,data:{ssrc:e,fps:t}})}_checkIfNewFrameComing(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout((()=>{this._removeZeroFPS(),this.timer=null}),2500)}};const c=(new Map([["useinbandfec",1],["maxaveragebitrate",48e3],["maxplaybackrate",24e3],["sprop-maxcapturerate",24e3],["sprop-stereo",null],["stereo",null]]),new Map([["useinbandfec",null],["maxaveragebitrate",96e3],["maxplaybackrate",48e3],["sprop-maxcapturerate",48e3],["sprop-stereo",1],["stereo",1]]),new Map([["useinbandfec",null],["maxaveragebitrate",96e3],["maxplaybackrate",48e3],["sprop-maxcapturerate",48e3],["sprop-stereo",1],["stereo",1]]),new Map([["useinbandfec",null],["maxaveragebitrate",128e3],["maxplaybackrate",48e3],["sprop-maxcapturerate",48e3],["sprop-stereo",1],["stereo",1]]),new Map([["useinbandfec",null],["maxaveragebitrate",128e3],["maxplaybackrate",48e3],["sprop-maxcapturerate",48e3],["sprop-stereo",1],["stereo",1]]),new Map([["useinbandfec",null],["maxaveragebitrate",96e3],["maxplaybackrate",48e3],["sprop-maxcapturerate",48e3]]),new Map([["useinbandfec",1],["maxaveragebitrate",64e3],["maxplaybackrate",24e3],["sprop-maxcapturerate",24e3],["sprop-stereo",null],["stereo",null]]),new Map([["stereo",1]]),0),f={ENCODE:1,DECODE:2,DECRPT:3,DECRPT_DECODE:4,WORKLET_APM_ONLY:5},_={MUTE:0,UNMUTE:1,LEAVED:2,MUTE_APM_ONLY:3,UNMUTE_APM_ONLY:4};let d,p,h=0;const m=new Map,g=[64,128,256];let y,v,w,E,b,S,k,M,A,C=null,D=!0;function T(e){if(C=e,!d)return;if(!e)return;const{update:t,remove:r}=e;t&&t.length>0&&t.forEach((e=>{const{userId:t,muted:r,bShareOn:n}=e;t&&(null!=n?n||A(d,t+1|512,!1,!0):A(d,t+1,!!r,!1))})),r&&r.length>0&&r.forEach((e=>{const{userId:t,muted:r}=e;t&&A(d,t+1,!!r,!0)}))}var P=0,F=!1,R=null,x=!1;const O={WASMTYPE:f,AUDIO_STATE:_,onWasmModuleReady:function(e){if(!e)return console.warn("[AudioWASMAdapter] Module undefined");y=e.cwrap("_Heartbeat","number",["number"]),v=e.cwrap("_MuteUnmuteState","number",["number","number"]),w=e.cwrap("_Switch_Original_Sound","number",["number","boolean","boolean","boolean","boolean"]),E=e.cwrap("_Deliver_Recorded_Data","number",["number","number","number","number","number","number"]),b=e.cwrap("_Switch_Denoise","number",["number","boolean","number","boolean","boolean"]),S=e.cwrap("_Audio_Init","number",["number","string","string","number","number","boolean","boolean","boolean","number","boolean"]),k=e.cwrap("_Switch_High_Bitrate","number",["number","number"]),M=e.cwrap("_Set_All_Speech_Volume_Level","number",["number"]),A=e.cwrap("_Update_Remote_User_Send_Status","number",["number","number","boolean","boolean"])},setAudioInstanceAndType:function(e,t,r){d=e,t&&(h=t),r&&(p=r),h!==f.DECODE&&h!==f.DECRPT_DECODE||T(C)},muteUnmuteState:function(e){if(null!=Object.values(_).find((t=>t==e)))return d?void(h!=f.WORKLET_APM_ONLY&&(v(d,e),s("muteUnmuteState: "+e))):s("muteUnmuteState: -1")},switchOriginalSound:function(e,t,r,n){d&&w(d,e,t,r,n)},deliverRecordedData:function(e,t,r,n){d&&E(d,e,t,0,r,n)},switchDenoise:function(e,t,r=c,n=!1){d&&(F=e,b(d,!!e,r,!!t,n))},audioInit:function(e,t,r,n,o,i,a,s,u,l){return S(e,t,r,n,o,i,a,s,u,l)},setDecoder:function(e){R=e},needCalculateDenoiseOutput:function(){x=!0},switchHighBitrate:function(e){d&&k(d,e)},disableJitterLog:function(){D=!1},setAllSpeechVolume:function(e){d&&M(d,e)},updateAllRemoteUserSendStatus:T,writeViperExWASMtoFS:function(e){var t;let r=!1;try{FS.writeFile("/viperex.wasm",new Uint8Array(e),{canOwn:!0}),r=!0,s("VIPEREX_WRITE_SUCCESS:1")}catch(e){s(`VIPEREX_WRITE_SUCCESS:0-${h}-${e.message}`),u(`Write ViperExWASM to FS failed wasm type: ${h}, message: ${e.message}, error: `,e),r=!1}finally{return null===(t=null==p?void 0:p.port)||void 0===t||t.postMessage({status:"viperExACK"}),r}},onMonitorLogWASM:function(e,t){if(t<=0)return;const r=Module.HEAPU8.subarray(e,e+t),n=String.fromCharCode.apply(null,r);n&&(!D&&n.includes("JITTER")||n.includes("WCL_MCM_AUDIO_RECEIVE")&&h!=f.DECRPT&&h!=f.DECRPT_DECODE||n.includes("WCL_MCM_AUDIO,")&&h==f.DECRPT||(h==f.ENCODE||h==f.DECRPT||h==f.DECRPT_DECODE?l(n):h==f.DECODE?p&&p.port&&l(n,p.port):h==f.WORKLET_APM_ONLY&&p.port&&p.port.postMessage({status:"SPEECH_LOG",data:{log:n}})))},onGlobalTracingLogWASM:function(e,t,r,n){if(t<=0)return;const o=Module.HEAPU8.subarray(e,e+t);let i=String.fromCharCode.apply(null,o);if(i){if(1==n){const e=`${n}_${r}_${i.substring(0,100)}`,t=(m.get(e)||0)+1;if(m.set(e,t),!g.includes(t)&&(t<256||t%256!=0))return;i=`${i} [Count: ${t}] `}switch(r){case 0:case 2:break;case 1:postMessage({status:61,errorMessage:"[WASM audio] "+i,level:"low"});break;case 3:u("[WASM audio] "+i)}}},onMuteSpeechWarningWASM:function(){postMessage({status:121})},onAudioLevelWASM:function(e,t,r){h!=f.ENCODE&&h!=f.WORKLET_APM_ONLY||1==e&&(0===t&&0===P||(P=t,h===f.ENCODE?postMessage({status:38,value:t}):(null==p?void 0:p.port)&&p.port.postMessage({status:38,data:t})))},onAPMProcessedPCMWASM:function(e,t,r,n){if(!F)return;let o=Module.HEAPF32.subarray(e/4,e/4+t);if(R){if(x){x=!1;let{sumRms:e}=i(o,2),t=a(e);p.port&&p.port.postMessage({status:"AUDIO_LEVEL_R16_DENOISE",level:t})}R.push([o])}},onSenderStatsLogWASM:function(e,t,r,n,o,i){t=Date.now(),h===f.ENCODE&&postMessage({status:206,data:{ssrc:e,timestamp:t,roundTripTime:r,jitter:n,packetsLost:o,packetsSent:i,kind:"audio"}})},onReceiverStatsLogWASM:function(e,t,r,n,o,i){}};class j{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.rframes=e,this.wframes=t,this.writeChannelNumb=r,this.cap=this.lcm(e,t),this.buffer=new Float32Array(this.cap),this.remain=0,this.woffset=0,this.roffset=0}gcd(e,t){return 0===t?e:this.gcd(t,e%t)}lcm(e,t){return e/this.gcd(e,t)*t}push(e){if(null==e[0]||e[0].length*this.writeChannelNumb==this.wframes){for(let t=0;t<this.writeChannelNumb;t++)for(let r=0;r<e[0].length;r++)this.buffer[(this.woffset+r*this.writeChannelNumb+t)%this.cap]=e[t]?e[t][r]:e[0][r];this.woffset+=this.wframes,this.remain+=this.wframes,this.woffset>=this.cap&&(this.woffset=this.woffset%this.cap)}else{var t;console.error("[Audio] critical error in AudioWorklet: data.length:",e.length,"this.woffset:",this.woffset,"this.cap:",this.cap),_workletPrinter&&_workletPrinter.error("critical error in AudioWorklet: ".concat(null===(t=e[0])||void 0===t?void 0:t.length," ").concat(his.writeChannelNumb," ").concat(this.wframes))}}read(){if(!this.hasData())return null;let e=this.buffer.subarray(this.roffset,this.roffset+this.rframes);return this.remain-=this.rframes,this.roffset+=this.rframes,this.roffset>=this.cap&&(this.roffset=this.roffset%this.cap),e}hasData(){return this.remain>=this.rframes}clear(){this.buffer.fill(0),this.remain=0,this.woffset=0,this.roffset=0}}var L=!1,I=null,U=null,N=!1,B=!1,W=null,H=!1,z=0,V=0,G=0,Y=!1,q=0;t()._workletPrinter=new class{constructor(e){this.messageQueue=[],this.auidoNodePort,this.userAgent="",this.isSafari=!1,this.debug=this.debug.bind(this),this.log=this.log.bind(this),this.warn=this.warn.bind(this),this.error=this.error.bind(this),this.print_=this.print_.bind(this),this.messageHeader=e}setUserAgent(e){this.userAgent=e,this.userAgent.match(/AppleWebKit\/(\d+)\./)&&(this.isSafari=!0)}setAuidoNodePort(e){this.auidoNodePort=e}debug(e){e=this.messageHeader+e;for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];this.print_({level:"debug",message:e,data:r})}log(e){e=this.messageHeader+e;for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];this.print_({level:"log",message:e,data:r})}warn(e){e=this.messageHeader+e;for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];this.print_({level:"warn",message:e,data:r})}error(e){e=this.messageHeader+e;for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];this.print_({level:"error",message:e,data:r})}print_(e){if(this.messageQueue.push(e),this.auidoNodePort)for(;this.messageQueue.length;){let e=this.messageQueue.shift();this._postToWorkerPrint(e)}}_postToWorkerPrint(e){this.auidoNodePort&&this.auidoNodePort.postMessage({status:"workletMessage",data:{level:e.level,message:e.message,data:e.data}})}}("[Audio][Worklet][WebRTC]"),t().AudioWasmAdapter=O,t().onWasmModuleReady=function(){_workletPrinter.log("worklet init wasm success");try{O.onWasmModuleReady(Module)}catch(e){_workletPrinter.error("error when cwarp"+JSON.stringify(e))}try{I=O.audioInit(0,"","",0,0,!0,!0,!0,1,!0)}catch(e){_workletPrinter.error("error when audio init"+JSON.stringify(e))}I?O.setAudioInstanceAndType(I,O.WASMTYPE.WORKLET_APM_ONLY,W):_workletPrinter.error("audio handle not initialized"),W.port.postMessage({status:"WASM_INIT_SUCCESS",data:{audio_handle:0!==I}})};class K extends AudioWorkletProcessor{constructor(e){var r,n,o;super(),W=this,this.port.onmessage=this.handleMessage.bind(this),this.encodeCount=0,this.underrunCount=0,this.denoiseModel=c,this.lastRecordTime=0,this.wasmModule=null==e||null===(r=e.processorOptions)||void 0===r?void 0:r.wasmModule,this.inputAudioChannel=(null==e||null===(n=e.processorOptions)||void 0===n?void 0:n.inputAudioChannel)||1,this.initRingBuffer(),null!=e&&null!==(o=e.processorOptions)&&void 0!==o&&o.userAgent&&_workletPrinter.setUserAgent(e.processorOptions.userAgent),_workletPrinter.setAuidoNodePort(this.port),_workletPrinter.log("webrtc worklet init successfully"),t().fsHandler&&t().fsHandler.setPort(this.port)}initRingBuffer(){this.encoder=new j(sampleRate/100*this.inputAudioChannel,128*this.inputAudioChannel,this.inputAudioChannel),this.decoder=new j(128*this.inputAudioChannel,sampleRate/100*this.inputAudioChannel),O.setDecoder(this.decoder)}handleMessage(e){const{status:r,data:n}=e.data;switch(r){case"stopWorklet":L=!0;break;case"audiowasm":try{this.wasmModule&&initWasm(Module,this.wasmModule)}catch(e){_workletPrinter.error("init WASM failed, error message:"+e.message+e.stack)}break;case"audio_denoise_switch":_workletPrinter.log("change denoise"+n.enable+n.isHeadSet),N=n.enable,this.denoiseModel=n.model,this.encoder.clear(),this.decoder.clear(),n.viperexWASM&&O.writeViperExWASMtoFS(n.viperexWASM),O.switchDenoise(n.enable,n.isHeadSet,n.model,n.micChanged);break;case"clearBuffer":this.encoder&&this.encoder.clear(),this.decoder&&this.decoder.clear();break;case"checkProcess":z===V?H&&(Y=!0,this.checkAudioProcess(!1),_workletPrinter.error("denoise stopped because the worklet is unhealthy"),t().monitorLOG("DENOISE_STOPPED_BY_UNHEALTHY_WORKLET")):Y&&H&&(Y=!1,_workletPrinter.error("denoise resumed because the worklet is healthy"),t().monitorLOG("DENOISE_RESUMED_BY_HEALTHY_WORKLET")),++G%5==0&&(t().monitorLOG("PCC"+z),z=0),V=z;break;case"clearProcess":z=0}}process(e,t){if(z++,L)return!1;if(!(e[0]&&e[0][0]&&this.encoder))return!0;let r=null,n=null;try{r=e[0],n=t[0],this.encoder.push(r)}catch(e){return _workletPrinter.error("error when set input and output",e),!0}if(N&&!B&&I)try{this.inputData(),this.outputData(n),this.checkAudioProcess(!0)}catch(e){return _workletPrinter.error("Error occurred when do denoise in WebRTC worklet",e),B=!0,!0}else{let e=this.encoder.read();if(null!=e){this.encodeCount++;let{sumRms:t,absMax:r}=i(e,this.inputAudioChannel);if(this.encodeCount%10==0){let e=function(e){if("number"!=typeof e||e<0||e>1)return-1;let t=Math.floor(32768*e/1e3);return 0==t&&e>250&&(t=1),o[t]}(r);0===e&&0===q||(q=e,this.port.postMessage({status:38,data:e}))}if(this.encodeCount%100==0){let e=a(t);this.port.postMessage({status:"AUDIO_LEVEL_R16",level:e})}this.encodeCount%1200==0&&this.port.postMessage({status:"SPEECH_LOG",data:{log:"WCL_MCM_AUDIO,,,,{[SPEECHINPUT_R16]},,,,,{[SEND]},,,{[DENOISE]},0,0,0,0,{[CAPTURE]},,{[AEC]},,,{[END]}"}})}this.checkAudioProcess(!1)}return!0}inputData(){let e=this.encoder.read();if(null!==e){const t=Date.now();if(this.encodeCount++,this.encodeCount%100==0){let{sumRms:t}=i(e,this.inputAudioChannel),r=a(t);this.port.postMessage({status:"AUDIO_LEVEL_R16",level:r}),O.needCalculateDenoiseOutput()}U||(U=Module._malloc(this.inputAudioChannel*(4*sampleRate)/100)),Module.HEAPF32.subarray(U/4,U/4+sampleRate/100*this.inputAudioChannel).set(e),O.deliverRecordedData(U,sampleRate/100,sampleRate,this.inputAudioChannel);const r=Date.now()-t;this.checkInputAudioProcessUnderrun(r)}}outputData(e){let t=this.decoder.read();if(null===t)return _workletPrinter.log("output is null"),!0;if(1===this.inputAudioChannel)for(let r=0;r<e.length;r++)e[r].set(t);else for(let r=0;r<e.length;r++)for(let n=0;e[r]&&n<e[r].length;n++)e[r][n]=t[n*e.length+r]}checkAudioProcess(e){H!=e&&(this.port.postMessage({status:"audio_process_changed",data:!H}),H=e)}checkInputAudioProcessUnderrun(e){e>10&&this.underrunCount++,this.underrunCount>50&&(this.denoiseModel==c||2==this.denoiseModel)?(this.port.postMessage({status:"audio_process_underrun",data:{level:1}}),this.underrunCount=0):this.underrunCount>100&&(this.port.postMessage({status:"audio_process_underrun",data:{level:2}}),this.underrunCount=0),this.encodeCount%500==0&&(this.underrunCount=0)}}t().LOG_OUT=function(){},t().fsHandler?(t().LOG_OUT_WEBRTC=t().fsHandler.handleFile,t().Get_ExternalRecord=t().fsHandler.handleViperPrint):(t().LOG_OUT_WEBRTC=function(){},t().Get_ExternalRecord=function(){}),t().Viper_NetworkTrace=function(e,r){t().fsHandler&&t().fsHandler.handleViperNetworkTrace(e,r)},t().monitorLOG=function(e){e&&W.port.postMessage({status:"MONITOR_LOG",data:e})},t().wcl_trace_log=function(e,r){t().fsHandler&&t().fsHandler.handleAudioSDKUtilPrint(e,r)},t().getLogData=function(e,t,r){},t().audio_encode_frame_callback=function(){},registerProcessor("webRTCWorklet",K)})()})();var wasmModule,Module=Module||{};function initWasm(e,t){let r=()=>Date.now();wasmModule=t;var n,o,i,a=void 0!==(a=e)?a:{},s=Object.assign({},a),u=[],l="./this.program",c="object"==typeof window,f="function"==typeof importScripts,_=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(c||f)&&(f?_=self.location.href:"undefined"!=typeof document&&document.currentScript&&(_=document.currentScript.src),_=0!==_.indexOf("blob:")?_.substr(0,_.replace(/[?#].*/,"").lastIndexOf("/")+1):"",n=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},f&&(i=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),o=(e,t,r)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)});var d,p,h=a.print||console.log.bind(console),m=a.printErr||console.warn.bind(console);Object.assign(a,s),s=null,a.arguments&&(u=a.arguments),a.thisProgram&&(l=a.thisProgram),a.quit&&a.quit,a.wasmBinary&&(d=a.wasmBinary),a.noExitRuntime,"object"!=typeof WebAssembly&&q("no native wasm support detected");var g=!1;function y(e,t){e||q(t)}var v,w,E,b,S,k,M,A="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function C(e,t,r){for(var n=t+r,o=t;e[o]&&!(o>=n);)++o;if(o-t>16&&e.buffer&&A)return A.decode(e.subarray(t,o));for(var i="";t<o;){var a=e[t++];if(128&a){var s=63&e[t++];if(192!=(224&a)){var u=63&e[t++];if((a=224==(240&a)?(15&a)<<12|s<<6|u:(7&a)<<18|s<<12|u<<6|63&e[t++])<65536)i+=String.fromCharCode(a);else{var l=a-65536;i+=String.fromCharCode(55296|l>>10,56320|1023&l)}}else i+=String.fromCharCode((31&a)<<6|s)}else i+=String.fromCharCode(a)}return i}function D(e,t){return e?C(E,e,t):""}function T(e,t,r,n){if(!(n>0))return 0;for(var o=r,i=r+n-1,a=0;a<e.length;++a){var s=e.charCodeAt(a);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a)),s<=127){if(r>=i)break;t[r++]=s}else if(s<=2047){if(r+1>=i)break;t[r++]=192|s>>6,t[r++]=128|63&s}else if(s<=65535){if(r+2>=i)break;t[r++]=224|s>>12,t[r++]=128|s>>6&63,t[r++]=128|63&s}else{if(r+3>=i)break;t[r++]=240|s>>18,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s}}return t[r]=0,r-o}function P(e,t,r){return T(e,E,t,r)}function F(e){for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t}function R(e){v=e,a.HEAP8=w=new Int8Array(e),a.HEAP16=b=new Int16Array(e),a.HEAP32=S=new Int32Array(e),a.HEAPU8=E=new Uint8Array(e),a.HEAPU16=new Uint16Array(e),a.HEAPU32=k=new Uint32Array(e),a.HEAPF32=new Float32Array(e),a.HEAPF64=M=new Float64Array(e)}var x,O=a.INITIAL_MEMORY||20971520;(p=a.wasmMemory?a.wasmMemory:new WebAssembly.Memory({initial:O/65536,maximum:2048}))&&(v=p.buffer),O=v.byteLength,R(v);var j,L,I,U,N=[],B=[],W=[],H=0,z=null,V=null;function G(e){H++,a.monitorRunDependencies&&a.monitorRunDependencies(H)}function Y(e){if(H--,a.monitorRunDependencies&&a.monitorRunDependencies(H),0==H&&(null!==z&&(clearInterval(z),z=null),V)){var t=V;V=null,t()}}function q(e){throw a.onAbort&&a.onAbort(e),m(e="Aborted("+e+")"),g=!0,e+=". Build with -sASSERTIONS for more info.",new WebAssembly.RuntimeError(e)}function K(e){return e.startsWith("data:application/octet-stream;base64,")}function $(e){return e.startsWith("file://")}function Z(e){try{if(e==j&&d)return new Uint8Array(d);if(i)return i(e);throw"both async and sync fetching of the wasm failed"}catch(e){q(e)}}K(j="audio.simd.wasm")||(L=j,j=a.locateFile?a.locateFile(L,_):_+L);var X={2126844:e=>{console.log("Audio Version: ",e)},2126881:(e,t)=>{send_data(e,t)},2126904:(e,t)=>{SAVE_IV(e,t)},2126922:(e,t,r,n)=>{audio_encode_frame_callback(e,t,r,n)},2126971:(e,t,r)=>{Get_ExternalRecord(e,t,r)},2127007:()=>Date.now(),2127030:(e,t)=>{update_play_time(e,t)},2127060:()=>{AudioWasmAdapter.onMuteSpeechWarningWASM()},2127107:(e,t)=>{AudioWasmAdapter.onMonitorLogWASM(e,t)},2127150:(e,t,r,n)=>{AudioWasmAdapter.onGlobalTracingLogWASM(e,t,r,n)},2127205:(e,t,r,n,o,i)=>{AudioWasmAdapter.onSenderStatsLogWASM(e,t,r,n,o,i)},2127269:(e,t,r,n,o,i)=>{AudioWasmAdapter.onReceiverStatsLogWASM(e,t,r,n,o,i)},2127335:(e,t)=>{AudioWasmAdapter.onAudioLevelWASM(e,t)},2127378:(e,t,r,n,o)=>{mesh_recv_audio_data(e,t,r,n,o)},2127424:(e,t,r)=>{network_quality_callback(e,t,r)},2127464:(e,t,r,n)=>{AudioWasmAdapter.onAPMProcessedPCMWASM(e,t,r,n)},2127524:(e,t,r,n)=>{pump_rtp_data(e,t,r,n)},2127559:(e,t,r,n)=>{pump_rtp_data(e,t,r,n)},2127594:(e,t,r,n,o,i,a,s)=>{responseAudioQosData(e,t,r,n,o,i,a,s)},2127649:(e,t,r,n,o)=>{sampleRateLog(e,t,r,n,o)},2127686:(e,t,r,n,o)=>{sampleRateLog(e,t,r,n,o)},2127723:(e,t,r,n,o,i,a,s)=>{frame_callback(e,t,r,n,o,i,a,s)},2127775:(e,t)=>{get_edition(e,t)},2127800:(e,t)=>{SAVE_IV(e,t)},2127818:()=>getNTPBaseTime(),2127847:()=>r(),2127877:(e,t)=>{reportSenderNTPTime(e,t)},2127910:(e,t)=>{COMMIT_PRINT(e,t)},2127932:()=>a.getRandomValue(),2127968:()=>{if(void 0===a.getRandomValue)try{var e="object"==typeof window?window:self,t=void 0!==e.crypto?e.crypto:e.msCrypto,r=function(){var e=new Uint32Array(1);return t.getRandomValues(e),e[0]>>>0};r(),a.getRandomValue=r}catch(e){try{var n=require("crypto"),o=function(){var e=n.randomBytes(4);return(e[0]<<24|e[1]<<16|e[2]<<8|e[3])>>>0};o(),a.getRandomValue=o}catch(e){throw"No secure random number generator found"}}},2128690:(e,t,r,n)=>{LOG_OUT_WEBRTC(e,t,r,n)},2128726:(e,t,r,n)=>{LOG_OUT_WEBRTC(e,t,r,n)},2128762:(e,t,r,n)=>{LOG_OUT_WEBRTC(e,t,r,n)},2128798:(e,t,r,n)=>{LOG_OUT_WEBRTC(e,t,r,n)},2128834:(e,t)=>{LOG_OUT(e,t)},2128855:(e,t)=>{wcl_trace_log(e,t)}};function Q(e){for(;e.length>0;)e.shift()(a)}var J=[],ee=0;function te(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){k[this.ptr+4>>2]=e},this.get_type=function(){return k[this.ptr+4>>2]},this.set_destructor=function(e){k[this.ptr+8>>2]=e},this.get_destructor=function(){return k[this.ptr+8>>2]},this.set_refcount=function(e){S[this.ptr>>2]=e},this.set_caught=function(e){e=e?1:0,w[this.ptr+12|0]=e},this.get_caught=function(){return 0!=w[this.ptr+12|0]},this.set_rethrown=function(e){e=e?1:0,w[this.ptr+13|0]=e},this.get_rethrown=function(){return 0!=w[this.ptr+13|0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var e=S[this.ptr>>2];S[this.ptr>>2]=e+1},this.release_ref=function(){var e=S[this.ptr>>2];return S[this.ptr>>2]=e-1,1===e},this.set_adjusted_ptr=function(e){k[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return k[this.ptr+16>>2]},this.get_exception_ptr=function(){if(ze(this.get_type()))return k[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}function re(e){return je(new te(e).ptr)}var ne=[];function oe(e){var t=ne[e];return t||(e>=ne.length&&(ne.length=e+1),ne[e]=t=x.get(e)),t}var ie={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,n=e.length-1;n>=0;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=ie.isAbs(e),r="/"===e.substr(-1);return(e=ie.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=ie.splitPath(e),r=t[0],n=t[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=ie.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return ie.normalize(e.join("/"))},join2:(e,t)=>ie.normalize(e+"/"+t)},ae={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var n=r>=0?arguments[r]:fe.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,t=ie.isAbs(n)}return(t?"/":"")+(e=ie.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=ae.resolve(e).substr(1),t=ae.resolve(t).substr(1);for(var n=r(e.split("/")),o=r(t.split("/")),i=Math.min(n.length,o.length),a=i,s=0;s<i;s++)if(n[s]!==o[s]){a=s;break}var u=[];for(s=a;s<n.length;s++)u.push("..");return(u=u.concat(o.slice(a))).join("/")}};function se(e,t,r){var n=r>0?r:F(e)+1,o=new Array(n),i=T(e,o,0,o.length);return t&&(o.length=i),o}var ue={ttys:[],init:function(){},shutdown:function(){},register:function(e,t){ue.ttys[e]={input:[],output:[],ops:t},fe.registerDevice(e,ue.stream_ops)},stream_ops:{open:function(e){var t=ue.ttys[e.node.rdev];if(!t)throw new fe.ErrnoError(43);e.tty=t,e.seekable=!1},close:function(e){e.tty.ops.fsync(e.tty)},fsync:function(e){e.tty.ops.fsync(e.tty)},read:function(e,t,r,n,o){if(!e.tty||!e.tty.ops.get_char)throw new fe.ErrnoError(60);for(var i=0,a=0;a<n;a++){var s;try{s=e.tty.ops.get_char(e.tty)}catch(e){throw new fe.ErrnoError(29)}if(void 0===s&&0===i)throw new fe.ErrnoError(6);if(null==s)break;i++,t[r+a]=s}return i&&(e.node.timestamp=Date.now()),i},write:function(e,t,r,n,o){if(!e.tty||!e.tty.ops.put_char)throw new fe.ErrnoError(60);try{for(var i=0;i<n;i++)e.tty.ops.put_char(e.tty,t[r+i])}catch(e){throw new fe.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),i}},default_tty_ops:{get_char:function(e){if(!e.input.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;e.input=se(t,!0)}return e.input.shift()},put_char:function(e,t){null===t||10===t?(h(C(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync:function(e){e.output&&e.output.length>0&&(h(C(e.output,0)),e.output=[])}},default_tty1_ops:{put_char:function(e,t){null===t||10===t?(m(C(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync:function(e){e.output&&e.output.length>0&&(m(C(e.output,0)),e.output=[])}}};function le(e){e=function(e){return 65536*Math.ceil(e/65536)}(e);var t=Le(65536,e);return t?function(e,t){return E.fill(0,e,e+t),e}(t,e):0}var ce={ops_table:null,mount:function(e){return ce.createNode(null,"/",16895,0)},createNode:function(e,t,r,n){if(fe.isBlkdev(r)||fe.isFIFO(r))throw new fe.ErrnoError(63);ce.ops_table||(ce.ops_table={dir:{node:{getattr:ce.node_ops.getattr,setattr:ce.node_ops.setattr,lookup:ce.node_ops.lookup,mknod:ce.node_ops.mknod,rename:ce.node_ops.rename,unlink:ce.node_ops.unlink,rmdir:ce.node_ops.rmdir,readdir:ce.node_ops.readdir,symlink:ce.node_ops.symlink},stream:{llseek:ce.stream_ops.llseek}},file:{node:{getattr:ce.node_ops.getattr,setattr:ce.node_ops.setattr},stream:{llseek:ce.stream_ops.llseek,read:ce.stream_ops.read,write:ce.stream_ops.write,allocate:ce.stream_ops.allocate,mmap:ce.stream_ops.mmap,msync:ce.stream_ops.msync}},link:{node:{getattr:ce.node_ops.getattr,setattr:ce.node_ops.setattr,readlink:ce.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ce.node_ops.getattr,setattr:ce.node_ops.setattr},stream:fe.chrdev_stream_ops}});var o=fe.createNode(e,t,r,n);return fe.isDir(o.mode)?(o.node_ops=ce.ops_table.dir.node,o.stream_ops=ce.ops_table.dir.stream,o.contents={}):fe.isFile(o.mode)?(o.node_ops=ce.ops_table.file.node,o.stream_ops=ce.ops_table.file.stream,o.usedBytes=0,o.contents=null):fe.isLink(o.mode)?(o.node_ops=ce.ops_table.link.node,o.stream_ops=ce.ops_table.link.stream):fe.isChrdev(o.mode)&&(o.node_ops=ce.ops_table.chrdev.node,o.stream_ops=ce.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[t]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray:function(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage:function(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var n=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(n.subarray(0,e.usedBytes),0)}},resizeFileStorage:function(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr:function(e){var t={};return t.dev=fe.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,fe.isDir(e.mode)?t.size=4096:fe.isFile(e.mode)?t.size=e.usedBytes:fe.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr:function(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&ce.resizeFileStorage(e,t.size)},lookup:function(e,t){throw fe.genericErrors[44]},mknod:function(e,t,r,n){return ce.createNode(e,t,r,n)},rename:function(e,t,r){if(fe.isDir(e.mode)){var n;try{n=fe.lookupNode(t,r)}catch(e){}if(n)for(var o in n.contents)throw new fe.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink:function(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir:function(e,t){var r=fe.lookupNode(e,t);for(var n in r.contents)throw new fe.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir:function(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink:function(e,t,r){var n=ce.createNode(e,t,41471,0);return n.link=r,n},readlink:function(e){if(!fe.isLink(e.mode))throw new fe.ErrnoError(28);return e.link}},stream_ops:{read:function(e,t,r,n,o){var i=e.node.contents;if(o>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-o,n);if(a>8&&i.subarray)t.set(i.subarray(o,o+a),r);else for(var s=0;s<a;s++)t[r+s]=i[o+s];return a},write:function(e,t,r,n,o,i){if(t.buffer===w.buffer&&(i=!1),!n)return 0;var a=e.node;if(a.timestamp=Date.now(),t.subarray&&(!a.contents||a.contents.subarray)){if(i)return a.contents=t.subarray(r,r+n),a.usedBytes=n,n;if(0===a.usedBytes&&0===o)return a.contents=t.slice(r,r+n),a.usedBytes=n,n;if(o+n<=a.usedBytes)return a.contents.set(t.subarray(r,r+n),o),n}if(ce.expandFileStorage(a,o+n),a.contents.subarray&&t.subarray)a.contents.set(t.subarray(r,r+n),o);else for(var s=0;s<n;s++)a.contents[o+s]=t[r+s];return a.usedBytes=Math.max(a.usedBytes,o+n),n},llseek:function(e,t,r){var n=t;if(1===r?n+=e.position:2===r&&fe.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new fe.ErrnoError(28);return n},allocate:function(e,t,r){ce.expandFileStorage(e.node,t+r),e.node.usedBytes=Math.max(e.node.usedBytes,t+r)},mmap:function(e,t,r,n,o){if(!fe.isFile(e.node.mode))throw new fe.ErrnoError(43);var i,a,s=e.node.contents;if(2&o||s.buffer!==v){if((r>0||r+t<s.length)&&(s=s.subarray?s.subarray(r,r+t):Array.prototype.slice.call(s,r,r+t)),a=!0,!(i=le(t)))throw new fe.ErrnoError(48);w.set(s,i)}else a=!1,i=s.byteOffset;return{ptr:i,allocated:a}},msync:function(e,t,r,n,o){return ce.stream_ops.write(e,t,0,n,r,!1),0}}},fe={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(e,t={})=>{if(!(e=ae.resolve(e)))return{path:"",node:null};if((t=Object.assign({follow_mount:!0,recurse_count:0},t)).recurse_count>8)throw new fe.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),n=fe.root,o="/",i=0;i<r.length;i++){var a=i===r.length-1;if(a&&t.parent)break;if(n=fe.lookupNode(n,r[i]),o=ie.join2(o,r[i]),fe.isMountpoint(n)&&(!a||a&&t.follow_mount)&&(n=n.mounted.root),!a||t.follow)for(var s=0;fe.isLink(n.mode);){var u=fe.readlink(o);if(o=ae.resolve(ie.dirname(o),u),n=fe.lookupPath(o,{recurse_count:t.recurse_count+1}).node,s++>40)throw new fe.ErrnoError(32)}}return{path:o,node:n}},getPath:e=>{for(var t;;){if(fe.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?r+"/"+t:r+t:r}t=t?e.name+"/"+t:e.name,e=e.parent}},hashName:(e,t)=>{for(var r=0,n=0;n<t.length;n++)r=(r<<5)-r+t.charCodeAt(n)|0;return(e+r>>>0)%fe.nameTable.length},hashAddNode:e=>{var t=fe.hashName(e.parent.id,e.name);e.name_next=fe.nameTable[t],fe.nameTable[t]=e},hashRemoveNode:e=>{var t=fe.hashName(e.parent.id,e.name);if(fe.nameTable[t]===e)fe.nameTable[t]=e.name_next;else for(var r=fe.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode:(e,t)=>{var r=fe.mayLookup(e);if(r)throw new fe.ErrnoError(r,e);for(var n=fe.hashName(e.id,t),o=fe.nameTable[n];o;o=o.name_next){var i=o.name;if(o.parent.id===e.id&&i===t)return o}return fe.lookup(e,t)},createNode:(e,t,r,n)=>{var o=new fe.FSNode(e,t,r,n);return fe.hashAddNode(o),o},destroyNode:e=>{fe.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>!(49152&~e),flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:e=>{var t=fe.flagModes[e];if(void 0===t)throw new Error("Unknown file open mode: "+e);return t},flagsToPermissionString:e=>{var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>fe.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup:e=>fe.nodePermissions(e,"x")||(e.node_ops.lookup?0:2),mayCreate:(e,t)=>{try{return fe.lookupNode(e,t),20}catch(e){}return fe.nodePermissions(e,"wx")},mayDelete:(e,t,r)=>{var n;try{n=fe.lookupNode(e,t)}catch(e){return e.errno}var o=fe.nodePermissions(e,"wx");if(o)return o;if(r){if(!fe.isDir(n.mode))return 54;if(fe.isRoot(n)||fe.getPath(n)===fe.cwd())return 10}else if(fe.isDir(n.mode))return 31;return 0},mayOpen:(e,t)=>e?fe.isLink(e.mode)?32:fe.isDir(e.mode)&&("r"!==fe.flagsToPermissionString(t)||512&t)?31:fe.nodePermissions(e,fe.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd:(e=0,t=fe.MAX_OPEN_FDS)=>{for(var r=e;r<=t;r++)if(!fe.streams[r])return r;throw new fe.ErrnoError(33)},getStream:e=>fe.streams[e],createStream:(e,t,r)=>{fe.FSStream||(fe.FSStream=function(){this.shared={}},fe.FSStream.prototype={},Object.defineProperties(fe.FSStream.prototype,{object:{get:function(){return this.node},set:function(e){this.node=e}},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(e){this.shared.flags=e}},position:{get:function(){return this.shared.position},set:function(e){this.shared.position=e}}})),e=Object.assign(new fe.FSStream,e);var n=fe.nextfd(t,r);return e.fd=n,fe.streams[n]=e,e},closeStream:e=>{fe.streams[e]=null},chrdev_stream_ops:{open:e=>{var t=fe.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:()=>{throw new fe.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice:(e,t)=>{fe.devices[e]={stream_ops:t}},getDevice:e=>fe.devices[e],getMounts:e=>{for(var t=[],r=[e];r.length;){var n=r.pop();t.push(n),r.push.apply(r,n.mounts)}return t},syncfs:(e,t)=>{"function"==typeof e&&(t=e,e=!1),fe.syncFSRequests++,fe.syncFSRequests>1&&m("warning: "+fe.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var r=fe.getMounts(fe.root.mount),n=0;function o(e){return fe.syncFSRequests--,t(e)}function i(e){if(e)return i.errored?void 0:(i.errored=!0,o(e));++n>=r.length&&o(null)}r.forEach((t=>{if(!t.type.syncfs)return i(null);t.type.syncfs(t,e,i)}))},mount:(e,t,r)=>{var n,o="/"===r,i=!r;if(o&&fe.root)throw new fe.ErrnoError(10);if(!o&&!i){var a=fe.lookupPath(r,{follow_mount:!1});if(r=a.path,n=a.node,fe.isMountpoint(n))throw new fe.ErrnoError(10);if(!fe.isDir(n.mode))throw new fe.ErrnoError(54)}var s={type:e,opts:t,mountpoint:r,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,o?fe.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount:e=>{var t=fe.lookupPath(e,{follow_mount:!1});if(!fe.isMountpoint(t.node))throw new fe.ErrnoError(28);var r=t.node,n=r.mounted,o=fe.getMounts(n);Object.keys(fe.nameTable).forEach((e=>{for(var t=fe.nameTable[e];t;){var r=t.name_next;o.includes(t.mount)&&fe.destroyNode(t),t=r}})),r.mounted=null;var i=r.mount.mounts.indexOf(n);r.mount.mounts.splice(i,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod:(e,t,r)=>{var n=fe.lookupPath(e,{parent:!0}).node,o=ie.basename(e);if(!o||"."===o||".."===o)throw new fe.ErrnoError(28);var i=fe.mayCreate(n,o);if(i)throw new fe.ErrnoError(i);if(!n.node_ops.mknod)throw new fe.ErrnoError(63);return n.node_ops.mknod(n,o,t,r)},