trtc-cloud-js-sdk 1.0.13 → 2.0.0
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.
- package/.eslintrc.js +88 -0
- package/.prettierrc +5 -0
- package/CHANGELOG.md +58 -0
- package/build/jsdoc/clean-doc.js +12 -0
- package/build/jsdoc/fix-doc.js +141 -0
- package/build/jsdoc/jsdoc.json +42 -0
- package/build/package-bundle.js +29 -0
- package/build/rollup.config.dev.js +88 -0
- package/build/rollup.config.prod.js +93 -0
- package/build/rollup.js +359 -0
- package/build/template/npm-package/package.json +24 -0
- package/coverage/Chrome 103.0.5060 (Mac OS X 10.15.7)/base.css +213 -0
- package/coverage/Chrome 103.0.5060 (Mac OS X 10.15.7)/index.html +80 -0
- package/coverage/Chrome 103.0.5060 (Mac OS X 10.15.7)/prettify.css +1 -0
- package/coverage/Chrome 103.0.5060 (Mac OS X 10.15.7)/prettify.js +1 -0
- package/coverage/Chrome 103.0.5060 (Mac OS X 10.15.7)/sort-arrow-sprite.png +0 -0
- package/coverage/Chrome 103.0.5060 (Mac OS X 10.15.7)/sorter.js +158 -0
- package/examples/apiExample/.env +2 -0
- package/examples/apiExample/README.md +70 -0
- package/examples/apiExample/package-lock.json +30915 -0
- package/examples/apiExample/package.json +51 -0
- package/examples/apiExample/public/audio.js +195 -0
- package/examples/apiExample/public/audio.js.map +7 -0
- package/examples/apiExample/public/av_processing.js +1 -0
- package/examples/apiExample/public/basic/av_processing.wasm +0 -0
- package/examples/apiExample/public/basic/worker.js +10434 -0
- package/examples/apiExample/public/favicon.ico +0 -0
- package/examples/apiExample/public/index.html +47 -0
- package/examples/apiExample/public/logo192.png +0 -0
- package/examples/apiExample/public/logo512.png +0 -0
- package/examples/apiExample/public/manifest.json +25 -0
- package/examples/apiExample/public/robots.txt +3 -0
- package/examples/apiExample/src/App.css +37 -0
- package/examples/apiExample/src/App.js +25 -0
- package/examples/apiExample/src/api/http.js +127 -0
- package/examples/apiExample/src/api/nav.js +44 -0
- package/examples/apiExample/src/components/BasicInfoComponent.css +16 -0
- package/examples/apiExample/src/components/BasicInfoComponent.js +27 -0
- package/examples/apiExample/src/config/gen-test-user-sig.js +64 -0
- package/examples/apiExample/src/config/lib-generate-test-usersig.min.js +7052 -0
- package/examples/apiExample/src/config/nav.js +136 -0
- package/examples/apiExample/src/home.js +16 -0
- package/examples/apiExample/src/index.css +21 -0
- package/examples/apiExample/src/index.js +12 -0
- package/examples/apiExample/src/logo.svg +1 -0
- package/examples/apiExample/src/page/basic/screen-share/index.css +52 -0
- package/examples/apiExample/src/page/basic/screen-share/index.js +223 -0
- package/examples/apiExample/src/page/basic/setDevice/index.js +262 -0
- package/examples/apiExample/src/page/basic/setDevice/index.scss +93 -0
- package/examples/apiExample/src/page/basic/video-call/index.js +521 -0
- package/examples/apiExample/src/page/basic/video-call/index.scss +93 -0
- package/examples/apiExample/src/page/basic/video-call-init/index.js +382 -0
- package/examples/apiExample/src/page/basic/video-call-init/index.scss +93 -0
- package/examples/apiExample/src/page/basic/video-live/index.css +37 -0
- package/examples/apiExample/src/page/basic/video-live/index.js +188 -0
- package/examples/apiExample/src/page/layout.js +22 -0
- package/examples/apiExample/src/page/layout.scss +76 -0
- package/examples/apiExample/src/utils/utils.js +35 -0
- package/examples/jsExample/assets/css/bootstrap-material-design.css +12169 -0
- package/examples/jsExample/assets/css/bootstrap-material-design.min.css +8 -0
- package/examples/jsExample/assets/css/common.css +48 -0
- package/examples/jsExample/assets/icon/iconfont.js +1 -0
- package/examples/jsExample/assets/js/bootstrap-material-design.js +6939 -0
- package/examples/jsExample/assets/js/bootstrap-material-design.js.map +1 -0
- package/examples/jsExample/assets/js/bootstrap-material-design.min.js +1 -0
- package/examples/jsExample/assets/js/graph.js +695 -0
- package/examples/jsExample/assets/js/jquery-3.2.1.min.js +4 -0
- package/examples/jsExample/assets/js/jquery-3.2.1.slim.min.js +4 -0
- package/examples/jsExample/assets/js/lib-generate-test-usersig.min.js +2 -0
- package/examples/jsExample/assets/js/popper.js +2442 -0
- package/examples/jsExample/index.html +57 -0
- package/examples/jsExample/rtc/css/common.css +82 -0
- package/examples/jsExample/rtc/index.html +107 -0
- package/examples/jsExample/rtc/js/index.js +142 -0
- package/examples/vueDemo/LICENSE +21 -0
- package/examples/vueDemo/README.md +144 -0
- package/examples/vueDemo/README_EN.md +136 -0
- package/examples/vueDemo/av_processing.wasm +0 -0
- package/examples/vueDemo/index.html +23 -0
- package/examples/vueDemo/package-lock.json +1375 -0
- package/examples/vueDemo/package.json +36 -0
- package/examples/vueDemo/src/App.vue +12 -0
- package/examples/vueDemo/src/api/index.js +59 -0
- package/examples/vueDemo/src/assets/css/color-dark.css +28 -0
- package/examples/vueDemo/src/assets/css/icon.css +4 -0
- package/examples/vueDemo/src/assets/css/main.css +177 -0
- package/examples/vueDemo/src/assets/img/img.jpg +0 -0
- package/examples/vueDemo/src/assets/img/login-bg.jpg +0 -0
- package/examples/vueDemo/src/components/Header.vue +172 -0
- package/examples/vueDemo/src/components/Sidebar.vue +117 -0
- package/examples/vueDemo/src/components/Tags.vue +174 -0
- package/examples/vueDemo/src/components/tendency.vue +206 -0
- package/examples/vueDemo/src/components/trtc/main-menu.vue +50 -0
- package/examples/vueDemo/src/components/trtc/nav-bar.vue +53 -0
- package/examples/vueDemo/src/components/trtc/show-screen-capture.vue +118 -0
- package/examples/vueDemo/src/components/trtc/trtc-state-check.vue +117 -0
- package/examples/vueDemo/src/config/gen-test-user-sig.js +67 -0
- package/examples/vueDemo/src/config/lib-generate-test-usersig.min.js +7052 -0
- package/examples/vueDemo/src/main.js +11 -0
- package/examples/vueDemo/src/plugins/element.js +17 -0
- package/examples/vueDemo/src/router/index.js +73 -0
- package/examples/vueDemo/src/store/sidebar.js +17 -0
- package/examples/vueDemo/src/store/tags.js +48 -0
- package/examples/vueDemo/src/utils/i18n.js +24 -0
- package/examples/vueDemo/src/utils/request.js +34 -0
- package/examples/vueDemo/src/utils/utils.js +35 -0
- package/examples/vueDemo/src/views/Home.vue +46 -0
- package/examples/vueDemo/src/views/I18n.vue +40 -0
- package/examples/vueDemo/src/views/Icon.vue +229 -0
- package/examples/vueDemo/src/views/basic/trtc.vue +194 -0
- package/examples/vueDemo/src/views/feature/index.vue +259 -0
- package/examples/vueDemo/src/views/github/index.vue +243 -0
- package/examples/vueDemo/src/views/improve/live-index.vue +256 -0
- package/examples/vueDemo/src/views/improve/live-room-anchor.vue +689 -0
- package/examples/vueDemo/src/views/improve/live-room-audience.vue +383 -0
- package/examples/vueDemo/src/views/sdkAppId/index.vue +284 -0
- package/examples/vueDemo/vite.config.js +18 -0
- package/examples/vueDemo/worker.js +22 -0
- package/karma.conf.js +99 -0
- package/package.json +57 -7
- package/scripts/publish.js +86 -0
- package/src/Camera.ts +80 -0
- package/src/Mic.ts +145 -0
- package/src/common/IError.ts +6 -0
- package/src/common/ITRTCCloud.ts +68 -0
- package/src/common/constants.ts +116 -0
- package/src/common/trtc-code.ts +43 -0
- package/src/common/trtc-define.ts +1007 -0
- package/src/common/trtc-event.ts +29 -0
- package/src/index.ts +1672 -0
- package/src/utils/environment.js +297 -0
- package/src/utils/raf.js +131 -0
- package/src/utils/time.js +22 -0
- package/src/utils/utils.ts +71 -0
- package/src/utils/uuid.js +12 -0
- package/test/unit/env.test.js +25 -0
- package/test/unit/get-user-media.test.js +40 -0
- package/test/unit/ice-parser.test.js +23 -0
- package/test/unit/sdp.test.js +45 -0
- package/test/unit/signal.test.js +78 -0
- package/tsconfig.json +32 -0
- package/trtc-cloud-js-sdk.js +0 -1
- /package/{README.md → build/template/npm-package/README.md} +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var I_=Object.create;var Bt=Object.defineProperty;var Fi=Object.getOwnPropertyDescriptor;var O_=Object.getOwnPropertyNames,Bi=Object.getOwnPropertySymbols,w_=Object.getPrototypeOf,qi=Object.prototype.hasOwnProperty,C_=Object.prototype.propertyIsEnumerable;var sn=(n,e,t)=>e in n?Bt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ot=(n,e)=>{for(var t in e||(e={}))qi.call(e,t)&&sn(n,t,e[t]);if(Bi)for(var t of Bi(e))C_.call(e,t)&&sn(n,t,e[t]);return n};var N_=n=>Bt(n,"__esModule",{value:!0});var _e=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var D_=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of O_(e))!qi.call(n,c)&&(t||c!=="default")&&Bt(n,c,{get:()=>e[c],enumerable:!(s=Fi(e,c))||s.enumerable});return n},ft=(n,e)=>D_(N_(Bt(n!=null?I_(w_(n)):{},"default",!e&&n&&n.__esModule?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var ge=(n,e,t,s)=>{for(var c=s>1?void 0:s?Fi(e,t):e,_=n.length-1,m;_>=0;_--)(m=n[_])&&(c=(s?m(e,t,c):m(c))||c);return s&&c&&Bt(e,t,c),c};var v=(n,e,t)=>(sn(n,typeof e!="symbol"?e+"":e,t),t);var Sn=_e((ep,hs)=>{"use strict";hs.exports=function(e,t){return function(){for(var c=new Array(arguments.length),_=0;_<c.length;_++)c[_]=arguments[_];return e.apply(t,c)}}});var Pe=_e((tp,vs)=>{"use strict";var J_=Sn(),wt=Object.prototype.toString;function Es(n){return wt.call(n)==="[object Array]"}function yn(n){return typeof n=="undefined"}function Z_(n){return n!==null&&!yn(n)&&n.constructor!==null&&!yn(n.constructor)&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function el(n){return wt.call(n)==="[object ArrayBuffer]"}function tl(n){return typeof FormData!="undefined"&&n instanceof FormData}function rl(n){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&n.buffer instanceof ArrayBuffer,e}function nl(n){return typeof n=="string"}function il(n){return typeof n=="number"}function Rs(n){return n!==null&&typeof n=="object"}function ol(n){return wt.call(n)==="[object Date]"}function sl(n){return wt.call(n)==="[object File]"}function al(n){return wt.call(n)==="[object Blob]"}function Ts(n){return wt.call(n)==="[object Function]"}function ul(n){return Rs(n)&&Ts(n.pipe)}function cl(n){return typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams}function _l(n){return n.replace(/^\s*/,"").replace(/\s*$/,"")}function ll(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function gr(n,e){if(!(n===null||typeof n=="undefined"))if(typeof n!="object"&&(n=[n]),Es(n))for(var t=0,s=n.length;t<s;t++)e.call(null,n[t],t,n);else for(var c in n)Object.prototype.hasOwnProperty.call(n,c)&&e.call(null,n[c],c,n)}function gs(){var n={};function e(c,_){typeof n[_]=="object"&&typeof c=="object"?n[_]=gs(n[_],c):n[_]=c}for(var t=0,s=arguments.length;t<s;t++)gr(arguments[t],e);return n}function bn(){var n={};function e(c,_){typeof n[_]=="object"&&typeof c=="object"?n[_]=bn(n[_],c):typeof c=="object"?n[_]=bn({},c):n[_]=c}for(var t=0,s=arguments.length;t<s;t++)gr(arguments[t],e);return n}function dl(n,e,t){return gr(e,function(c,_){t&&typeof c=="function"?n[_]=J_(c,t):n[_]=c}),n}vs.exports={isArray:Es,isArrayBuffer:el,isBuffer:Z_,isFormData:tl,isArrayBufferView:rl,isString:nl,isNumber:il,isObject:Rs,isUndefined:yn,isDate:ol,isFile:sl,isBlob:al,isFunction:Ts,isStream:ul,isURLSearchParams:cl,isStandardBrowserEnv:ll,forEach:gr,merge:gs,deepMerge:bn,extend:dl,trim:_l}});var An=_e((rp,ys)=>{"use strict";var Ct=Pe();function Ss(n){return encodeURIComponent(n).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}ys.exports=function(e,t,s){if(!t)return e;var c;if(s)c=s(t);else if(Ct.isURLSearchParams(t))c=t.toString();else{var _=[];Ct.forEach(t,function(E,g){E===null||typeof E=="undefined"||(Ct.isArray(E)?g=g+"[]":E=[E],Ct.forEach(E,function(y){Ct.isDate(y)?y=y.toISOString():Ct.isObject(y)&&(y=JSON.stringify(y)),_.push(Ss(g)+"="+Ss(y))}))}),c=_.join("&")}if(c){var m=e.indexOf("#");m!==-1&&(e=e.slice(0,m)),e+=(e.indexOf("?")===-1?"?":"&")+c}return e}});var As=_e((np,bs)=>{"use strict";var fl=Pe();function vr(){this.handlers=[]}vr.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1};vr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};vr.prototype.forEach=function(e){fl.forEach(this.handlers,function(s){s!==null&&e(s)})};bs.exports=vr});var Os=_e((ip,Is)=>{"use strict";var pl=Pe();Is.exports=function(e,t,s){return pl.forEach(s,function(_){e=_(e,t)}),e}});var In=_e((op,ws)=>{"use strict";ws.exports=function(e){return!!(e&&e.__CANCEL__)}});var Ns=_e((sp,Cs)=>{"use strict";var ml=Pe();Cs.exports=function(e,t){ml.forEach(e,function(c,_){_!==t&&_.toUpperCase()===t.toUpperCase()&&(e[t]=c,delete e[_])})}});var Ps=_e((ap,Ds)=>{"use strict";Ds.exports=function(e,t,s,c,_){return e.config=t,s&&(e.code=s),e.request=c,e.response=_,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}});var On=_e((up,Us)=>{"use strict";var hl=Ps();Us.exports=function(e,t,s,c,_){var m=new Error(e);return hl(m,t,s,c,_)}});var xs=_e((cp,Ms)=>{"use strict";var El=On();Ms.exports=function(e,t,s){var c=s.config.validateStatus;!c||c(s.status)?e(s):t(El("Request failed with status code "+s.status,s.config,null,s.request,s))}});var ks=_e((_p,Ls)=>{"use strict";Ls.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Fs=_e((lp,Vs)=>{"use strict";Vs.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}});var qs=_e((dp,Bs)=>{"use strict";var Rl=ks(),Tl=Fs();Bs.exports=function(e,t){return e&&!Rl(t)?Tl(e,t):t}});var Gs=_e((fp,Hs)=>{"use strict";var wn=Pe(),gl=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];Hs.exports=function(e){var t={},s,c,_;return e&&wn.forEach(e.split(`
|
|
2
|
+
`),function(p){if(_=p.indexOf(":"),s=wn.trim(p.substr(0,_)).toLowerCase(),c=wn.trim(p.substr(_+1)),s){if(t[s]&&gl.indexOf(s)>=0)return;s==="set-cookie"?t[s]=(t[s]?t[s]:[]).concat([c]):t[s]=t[s]?t[s]+", "+c:c}}),t}});var Ks=_e((pp,js)=>{"use strict";var Ws=Pe();js.exports=Ws.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),s;function c(_){var m=_;return e&&(t.setAttribute("href",m),m=t.href),t.setAttribute("href",m),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return s=c(window.location.href),function(m){var p=Ws.isString(m)?c(m):m;return p.protocol===s.protocol&&p.host===s.host}}():function(){return function(){return!0}}()});var zs=_e((mp,Ys)=>{"use strict";var Sr=Pe();Ys.exports=Sr.isStandardBrowserEnv()?function(){return{write:function(t,s,c,_,m,p){var E=[];E.push(t+"="+encodeURIComponent(s)),Sr.isNumber(c)&&E.push("expires="+new Date(c).toGMTString()),Sr.isString(_)&&E.push("path="+_),Sr.isString(m)&&E.push("domain="+m),p===!0&&E.push("secure"),document.cookie=E.join("; ")},read:function(t){var s=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return s?decodeURIComponent(s[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var Nn=_e((hp,$s)=>{"use strict";var yr=Pe(),vl=xs(),Sl=An(),yl=qs(),bl=Gs(),Al=Ks(),Cn=On();$s.exports=function(e){return new Promise(function(s,c){var _=e.data,m=e.headers;yr.isFormData(_)&&delete m["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var E=e.auth.username||"",g=e.auth.password||"";m.Authorization="Basic "+btoa(E+":"+g)}var S=yl(e.baseURL,e.url);if(p.open(e.method.toUpperCase(),Sl(S,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,p.onreadystatechange=function(){if(!(!p||p.readyState!==4)&&!(p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0))){var O="getAllResponseHeaders"in p?bl(p.getAllResponseHeaders()):null,V=!e.responseType||e.responseType==="text"?p.responseText:p.response,Y={data:V,status:p.status,statusText:p.statusText,headers:O,config:e,request:p};vl(s,c,Y),p=null}},p.onabort=function(){!p||(c(Cn("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){c(Cn("Network Error",e,null,p)),p=null},p.ontimeout=function(){var O="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(O=e.timeoutErrorMessage),c(Cn(O,e,"ECONNABORTED",p)),p=null},yr.isStandardBrowserEnv()){var y=zs(),w=(e.withCredentials||Al(S))&&e.xsrfCookieName?y.read(e.xsrfCookieName):void 0;w&&(m[e.xsrfHeaderName]=w)}if("setRequestHeader"in p&&yr.forEach(m,function(O,V){typeof _=="undefined"&&V.toLowerCase()==="content-type"?delete m[V]:p.setRequestHeader(V,O)}),yr.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),e.responseType)try{p.responseType=e.responseType}catch(F){if(e.responseType!=="json")throw F}typeof e.onDownloadProgress=="function"&&p.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(O){!p||(p.abort(),c(O),p=null)}),_===void 0&&(_=null),p.send(_)})}});var Dn=_e((Ep,Js)=>{"use strict";var Ue=Pe(),Qs=Ns(),Il={"Content-Type":"application/x-www-form-urlencoded"};function Xs(n,e){!Ue.isUndefined(n)&&Ue.isUndefined(n["Content-Type"])&&(n["Content-Type"]=e)}function Ol(){var n;return typeof XMLHttpRequest!="undefined"?n=Nn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(n=Nn()),n}var br={adapter:Ol(),transformRequest:[function(e,t){return Qs(t,"Accept"),Qs(t,"Content-Type"),Ue.isFormData(e)||Ue.isArrayBuffer(e)||Ue.isBuffer(e)||Ue.isStream(e)||Ue.isFile(e)||Ue.isBlob(e)?e:Ue.isArrayBufferView(e)?e.buffer:Ue.isURLSearchParams(e)?(Xs(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Ue.isObject(e)?(Xs(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(t){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};br.headers={common:{Accept:"application/json, text/plain, */*"}};Ue.forEach(["delete","get","head"],function(e){br.headers[e]={}});Ue.forEach(["post","put","patch"],function(e){br.headers[e]=Ue.merge(Il)});Js.exports=br});var ta=_e((Rp,ea)=>{"use strict";var Zs=Pe(),Pn=Os(),wl=In(),Cl=Dn();function Un(n){n.cancelToken&&n.cancelToken.throwIfRequested()}ea.exports=function(e){Un(e),e.headers=e.headers||{},e.data=Pn(e.data,e.headers,e.transformRequest),e.headers=Zs.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Zs.forEach(["delete","get","head","post","put","patch","common"],function(c){delete e.headers[c]});var t=e.adapter||Cl.adapter;return t(e).then(function(c){return Un(e),c.data=Pn(c.data,c.headers,e.transformResponse),c},function(c){return wl(c)||(Un(e),c&&c.response&&(c.response.data=Pn(c.response.data,c.response.headers,e.transformResponse))),Promise.reject(c)})}});var Mn=_e((Tp,ra)=>{"use strict";var ut=Pe();ra.exports=function(e,t){t=t||{};var s={},c=["url","method","params","data"],_=["headers","auth","proxy"],m=["baseURL","url","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"];ut.forEach(c,function(S){typeof t[S]!="undefined"&&(s[S]=t[S])}),ut.forEach(_,function(S){ut.isObject(t[S])?s[S]=ut.deepMerge(e[S],t[S]):typeof t[S]!="undefined"?s[S]=t[S]:ut.isObject(e[S])?s[S]=ut.deepMerge(e[S]):typeof e[S]!="undefined"&&(s[S]=e[S])}),ut.forEach(m,function(S){typeof t[S]!="undefined"?s[S]=t[S]:typeof e[S]!="undefined"&&(s[S]=e[S])});var p=c.concat(_).concat(m),E=Object.keys(t).filter(function(S){return p.indexOf(S)===-1});return ut.forEach(E,function(S){typeof t[S]!="undefined"?s[S]=t[S]:typeof e[S]!="undefined"&&(s[S]=e[S])}),s}});var sa=_e((gp,oa)=>{"use strict";var Ar=Pe(),Nl=An(),na=As(),Dl=ta(),ia=Mn();function Yt(n){this.defaults=n,this.interceptors={request:new na,response:new na}}Yt.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=ia(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[Dl,void 0],s=Promise.resolve(e);for(this.interceptors.request.forEach(function(_){t.unshift(_.fulfilled,_.rejected)}),this.interceptors.response.forEach(function(_){t.push(_.fulfilled,_.rejected)});t.length;)s=s.then(t.shift(),t.shift());return s};Yt.prototype.getUri=function(e){return e=ia(this.defaults,e),Nl(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};Ar.forEach(["delete","get","head","options"],function(e){Yt.prototype[e]=function(t,s){return this.request(Ar.merge(s||{},{method:e,url:t}))}});Ar.forEach(["post","put","patch"],function(e){Yt.prototype[e]=function(t,s,c){return this.request(Ar.merge(c||{},{method:e,url:t,data:s}))}});oa.exports=Yt});var Ln=_e((vp,aa)=>{"use strict";function xn(n){this.message=n}xn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};xn.prototype.__CANCEL__=!0;aa.exports=xn});var ca=_e((Sp,ua)=>{"use strict";var Pl=Ln();function Ir(n){if(typeof n!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(c){e=c});var t=this;n(function(c){t.reason||(t.reason=new Pl(c),e(t.reason))})}Ir.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};Ir.source=function(){var e,t=new Ir(function(c){e=c});return{token:t,cancel:e}};ua.exports=Ir});var la=_e((yp,_a)=>{"use strict";_a.exports=function(e){return function(s){return e.apply(null,s)}}});var pa=_e((bp,kn)=>{"use strict";var da=Pe(),Ul=Sn(),Or=sa(),Ml=Mn(),xl=Dn();function fa(n){var e=new Or(n),t=Ul(Or.prototype.request,e);return da.extend(t,Or.prototype,e),da.extend(t,e),t}var je=fa(xl);je.Axios=Or;je.create=function(e){return fa(Ml(je.defaults,e))};je.Cancel=Ln();je.CancelToken=ca();je.isCancel=In();je.all=function(e){return Promise.all(e)};je.spread=la();kn.exports=je;kn.exports.default=je});var zt=_e((Ap,ma)=>{ma.exports=pa()});var Yn=_e((Sm,Kn)=>{"use strict";var ed=Object.prototype.hasOwnProperty,we="~";function Jt(){}Object.create&&(Jt.prototype=Object.create(null),new Jt().__proto__||(we=!1));function td(n,e,t){this.fn=n,this.context=e,this.once=t||!1}function Za(n,e,t,s,c){if(typeof t!="function")throw new TypeError("The listener must be a function");var _=new td(t,s||n,c),m=we?we+e:e;return n._events[m]?n._events[m].fn?n._events[m]=[n._events[m],_]:n._events[m].push(_):(n._events[m]=_,n._eventsCount++),n}function Mr(n,e){--n._eventsCount===0?n._events=new Jt:delete n._events[e]}function Ae(){this._events=new Jt,this._eventsCount=0}Ae.prototype.eventNames=function(){var e=[],t,s;if(this._eventsCount===0)return e;for(s in t=this._events)ed.call(t,s)&&e.push(we?s.slice(1):s);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};Ae.prototype.listeners=function(e){var t=we?we+e:e,s=this._events[t];if(!s)return[];if(s.fn)return[s.fn];for(var c=0,_=s.length,m=new Array(_);c<_;c++)m[c]=s[c].fn;return m};Ae.prototype.listenerCount=function(e){var t=we?we+e:e,s=this._events[t];return s?s.fn?1:s.length:0};Ae.prototype.emit=function(e,t,s,c,_,m){var p=we?we+e:e;if(!this._events[p])return!1;var E=this._events[p],g=arguments.length,S,y;if(E.fn){switch(E.once&&this.removeListener(e,E.fn,void 0,!0),g){case 1:return E.fn.call(E.context),!0;case 2:return E.fn.call(E.context,t),!0;case 3:return E.fn.call(E.context,t,s),!0;case 4:return E.fn.call(E.context,t,s,c),!0;case 5:return E.fn.call(E.context,t,s,c,_),!0;case 6:return E.fn.call(E.context,t,s,c,_,m),!0}for(y=1,S=new Array(g-1);y<g;y++)S[y-1]=arguments[y];E.fn.apply(E.context,S)}else{var w=E.length,F;for(y=0;y<w;y++)switch(E[y].once&&this.removeListener(e,E[y].fn,void 0,!0),g){case 1:E[y].fn.call(E[y].context);break;case 2:E[y].fn.call(E[y].context,t);break;case 3:E[y].fn.call(E[y].context,t,s);break;case 4:E[y].fn.call(E[y].context,t,s,c);break;default:if(!S)for(F=1,S=new Array(g-1);F<g;F++)S[F-1]=arguments[F];E[y].fn.apply(E[y].context,S)}}return!0};Ae.prototype.on=function(e,t,s){return Za(this,e,t,s,!1)};Ae.prototype.once=function(e,t,s){return Za(this,e,t,s,!0)};Ae.prototype.removeListener=function(e,t,s,c){var _=we?we+e:e;if(!this._events[_])return this;if(!t)return Mr(this,_),this;var m=this._events[_];if(m.fn)m.fn===t&&(!c||m.once)&&(!s||m.context===s)&&Mr(this,_);else{for(var p=0,E=[],g=m.length;p<g;p++)(m[p].fn!==t||c&&!m[p].once||s&&m[p].context!==s)&&E.push(m[p]);E.length?this._events[_]=E.length===1?E[0]:E:Mr(this,_)}return this};Ae.prototype.removeAllListeners=function(e){var t;return e?(t=we?we+e:e,this._events[t]&&Mr(this,t)):(this._events=new Jt,this._eventsCount=0),this};Ae.prototype.off=Ae.prototype.removeListener;Ae.prototype.addListener=Ae.prototype.on;Ae.prefixed=we;Ae.EventEmitter=Ae;typeof Kn!="undefined"&&(Kn.exports=Ae)});var pu=_e((fu,Fr)=>{(function(n){"use strict";function e(R,k){var A=(R&65535)+(k&65535),ee=(R>>16)+(k>>16)+(A>>16);return ee<<16|A&65535}function t(R,k){return R<<k|R>>>32-k}function s(R,k,A,ee,ae,de){return e(t(e(e(k,R),e(ee,de)),ae),A)}function c(R,k,A,ee,ae,de,Ie){return s(k&A|~k&ee,R,k,ae,de,Ie)}function _(R,k,A,ee,ae,de,Ie){return s(k&ee|A&~ee,R,k,ae,de,Ie)}function m(R,k,A,ee,ae,de,Ie){return s(k^A^ee,R,k,ae,de,Ie)}function p(R,k,A,ee,ae,de,Ie){return s(A^(k|~ee),R,k,ae,de,Ie)}function E(R,k){R[k>>5]|=128<<k%32,R[(k+64>>>9<<4)+14]=k;var A,ee,ae,de,Ie,N=1732584193,D=-271733879,P=-1732584194,C=271733878;for(A=0;A<R.length;A+=16)ee=N,ae=D,de=P,Ie=C,N=c(N,D,P,C,R[A],7,-680876936),C=c(C,N,D,P,R[A+1],12,-389564586),P=c(P,C,N,D,R[A+2],17,606105819),D=c(D,P,C,N,R[A+3],22,-1044525330),N=c(N,D,P,C,R[A+4],7,-176418897),C=c(C,N,D,P,R[A+5],12,1200080426),P=c(P,C,N,D,R[A+6],17,-1473231341),D=c(D,P,C,N,R[A+7],22,-45705983),N=c(N,D,P,C,R[A+8],7,1770035416),C=c(C,N,D,P,R[A+9],12,-1958414417),P=c(P,C,N,D,R[A+10],17,-42063),D=c(D,P,C,N,R[A+11],22,-1990404162),N=c(N,D,P,C,R[A+12],7,1804603682),C=c(C,N,D,P,R[A+13],12,-40341101),P=c(P,C,N,D,R[A+14],17,-1502002290),D=c(D,P,C,N,R[A+15],22,1236535329),N=_(N,D,P,C,R[A+1],5,-165796510),C=_(C,N,D,P,R[A+6],9,-1069501632),P=_(P,C,N,D,R[A+11],14,643717713),D=_(D,P,C,N,R[A],20,-373897302),N=_(N,D,P,C,R[A+5],5,-701558691),C=_(C,N,D,P,R[A+10],9,38016083),P=_(P,C,N,D,R[A+15],14,-660478335),D=_(D,P,C,N,R[A+4],20,-405537848),N=_(N,D,P,C,R[A+9],5,568446438),C=_(C,N,D,P,R[A+14],9,-1019803690),P=_(P,C,N,D,R[A+3],14,-187363961),D=_(D,P,C,N,R[A+8],20,1163531501),N=_(N,D,P,C,R[A+13],5,-1444681467),C=_(C,N,D,P,R[A+2],9,-51403784),P=_(P,C,N,D,R[A+7],14,1735328473),D=_(D,P,C,N,R[A+12],20,-1926607734),N=m(N,D,P,C,R[A+5],4,-378558),C=m(C,N,D,P,R[A+8],11,-2022574463),P=m(P,C,N,D,R[A+11],16,1839030562),D=m(D,P,C,N,R[A+14],23,-35309556),N=m(N,D,P,C,R[A+1],4,-1530992060),C=m(C,N,D,P,R[A+4],11,1272893353),P=m(P,C,N,D,R[A+7],16,-155497632),D=m(D,P,C,N,R[A+10],23,-1094730640),N=m(N,D,P,C,R[A+13],4,681279174),C=m(C,N,D,P,R[A],11,-358537222),P=m(P,C,N,D,R[A+3],16,-722521979),D=m(D,P,C,N,R[A+6],23,76029189),N=m(N,D,P,C,R[A+9],4,-640364487),C=m(C,N,D,P,R[A+12],11,-421815835),P=m(P,C,N,D,R[A+15],16,530742520),D=m(D,P,C,N,R[A+2],23,-995338651),N=p(N,D,P,C,R[A],6,-198630844),C=p(C,N,D,P,R[A+7],10,1126891415),P=p(P,C,N,D,R[A+14],15,-1416354905),D=p(D,P,C,N,R[A+5],21,-57434055),N=p(N,D,P,C,R[A+12],6,1700485571),C=p(C,N,D,P,R[A+3],10,-1894986606),P=p(P,C,N,D,R[A+10],15,-1051523),D=p(D,P,C,N,R[A+1],21,-2054922799),N=p(N,D,P,C,R[A+8],6,1873313359),C=p(C,N,D,P,R[A+15],10,-30611744),P=p(P,C,N,D,R[A+6],15,-1560198380),D=p(D,P,C,N,R[A+13],21,1309151649),N=p(N,D,P,C,R[A+4],6,-145523070),C=p(C,N,D,P,R[A+11],10,-1120210379),P=p(P,C,N,D,R[A+2],15,718787259),D=p(D,P,C,N,R[A+9],21,-343485551),N=e(N,ee),D=e(D,ae),P=e(P,de),C=e(C,Ie);return[N,D,P,C]}function g(R){var k,A="",ee=R.length*32;for(k=0;k<ee;k+=8)A+=String.fromCharCode(R[k>>5]>>>k%32&255);return A}function S(R){var k,A=[];for(A[(R.length>>2)-1]=void 0,k=0;k<A.length;k+=1)A[k]=0;var ee=R.length*8;for(k=0;k<ee;k+=8)A[k>>5]|=(R.charCodeAt(k/8)&255)<<k%32;return A}function y(R){return g(E(S(R),R.length*8))}function w(R,k){var A,ee=S(R),ae=[],de=[],Ie;for(ae[15]=de[15]=void 0,ee.length>16&&(ee=E(ee,R.length*8)),A=0;A<16;A+=1)ae[A]=ee[A]^909522486,de[A]=ee[A]^1549556828;return Ie=E(ae.concat(S(k)),512+k.length*8),g(E(de.concat(Ie),512+128))}function F(R){var k="0123456789abcdef",A="",ee,ae;for(ae=0;ae<R.length;ae+=1)ee=R.charCodeAt(ae),A+=k.charAt(ee>>>4&15)+k.charAt(ee&15);return A}function O(R){return unescape(encodeURIComponent(R))}function V(R){return y(O(R))}function Y(R){return F(V(R))}function te(R,k){return w(O(R),O(k))}function he(R,k){return F(te(R,k))}function ce(R,k,A){return k?A?te(k,R):he(k,R):A?V(R):Y(R)}typeof define=="function"&&define.amd?define(function(){return ce}):typeof Fr=="object"&&Fr.exports?Fr.exports=ce:n.md5=ce})(fu)});function oe(...n){}var P_=n=>n(),Hi=n=>n;function an(){this.dispose()}var U_=()=>typeof __FASTRX_DEVTOOLS__!="undefined",M_=1,Qe=class extends Function{toString(){return`${this.name}(${this.args.length?[...this.args].join(", "):""})`}subscribe(e){let t=new Gi(e,this,this.streamId++);return Re.subscribe({id:this.id,end:!1},{nodeId:t.sourceId,streamId:t.id}),this(t),t}},qt=class{constructor(){this.defers=new Set,this.disposed=!1}next(e){}complete(){this.dispose()}error(e){this.dispose()}get bindDispose(){return()=>this.dispose()}dispose(){this.disposed=!0,this.complete=oe,this.error=oe,this.next=oe,this.dispose=oe,this.subscribe=oe,this.doDefer()}subscribe(e){return e instanceof Qe?e.subscribe(this):e(this),this}get bindSubscribe(){return e=>this.subscribe(e)}doDefer(){this.defers.forEach(P_),this.defers.clear()}defer(e){this.defers.add(e)}removeDefer(e){this.defers.delete(e)}reset(){this.disposed=!1,delete this.complete,delete this.next,delete this.dispose,delete this.next,delete this.subscribe}resetNext(){delete this.next}resetComplete(){delete this.complete}resetError(){delete this.error}},K=class extends qt{constructor(e){super();this.sink=e,e.defer(this.bindDispose)}next(e){this.sink.next(e)}complete(){this.sink.complete()}error(e){this.sink.error(e)}},mr=class extends qt{constructor(e,t=oe,s=oe,c=oe){super();if(this._next=t,this._error=s,this._complete=c,this.then=oe,e instanceof Qe){let _={toString:()=>"subscribe",id:0,source:e};this.defer(()=>{Re.defer(_,0)}),Re.create(_),Re.pipe(_),this.sourceId=_.id,this.subscribe(e),Re.subscribe({id:_.id,end:!0}),t==oe?this._next=m=>Re.next(_,0,m):this.next=m=>{Re.next(_,0,m),t(m)},c==oe?this._complete=()=>Re.complete(_,0):this.complete=()=>{this.dispose(),Re.complete(_,0),c()},s==oe?this._error=m=>Re.complete(_,0,m):this.error=m=>{this.dispose(),Re.complete(_,0,m),s()}}else this.subscribe(e)}next(e){this._next(e)}complete(){this.dispose(),this._complete()}error(e){this.dispose(),this._error(e)}};function X(n,...e){return e.reduce((t,s)=>s(t),n)}function Oe(n,e,t){if(U_()){let s=Object.defineProperties(Object.setPrototypeOf(n,Qe.prototype),{streamId:{value:0,writable:!0,configurable:!0},name:{value:e,writable:!0,configurable:!0},args:{value:t,writable:!0,configurable:!0},id:{value:0,writable:!0,configurable:!0}});Re.create(s);for(let c=0;c<t.length;c++){let _=t[c];typeof _=="function"&&_ instanceof Qe&&Re.addSource(s,_)}return s}return n}function z(n,e){return function(...t){return s=>{if(s instanceof Qe){let c=Oe(_=>{let m=new n(_,...t);m.sourceId=c.id,m.subscribe(s)},e,arguments);return c.source=s,Re.pipe(c),c}else return c=>s(new n(c,...t))}}}function st(n,e){window.postMessage({source:"fastrx-devtools-backend",payload:{event:n,payload:e}})}var Gi=class extends K{constructor(e,t,s){super(e);this.source=t,this.id=s,this.sourceId=e.sourceId,this.defer(()=>{Re.defer(this.source,this.id)})}next(e){Re.next(this.source,this.id,e),this.sink.next(e)}complete(){Re.complete(this.source,this.id),this.sink.complete()}error(e){Re.complete(this.source,this.id,e),this.sink.error(e)}},Re={addSource(n,e){st("addSource",{id:n.id,name:n.toString(),source:{id:e.id,name:e.toString()}})},next(n,e,t){st("next",{id:n.id,streamId:e,data:t&&t.toString()})},subscribe({id:n,end:e},t){st("subscribe",{id:n,end:e,sink:{nodeId:t&&t.nodeId,streamId:t&&t.streamId}})},complete(n,e,t){st("complete",{id:n.id,streamId:e,err:t?t.toString():null})},defer(n,e){st("defer",{id:n.id,streamId:e})},pipe(n){st("pipe",{name:n.toString(),id:n.id,source:{id:n.source.id,name:n.source.toString()}})},update(n){st("update",{id:n.id,name:n.toString()})},create(n){n.id||(n.id=M_++),st("create",{name:n.toString(),id:n.id})}},un=class extends Error{constructor(e){super(`timeout after ${e}ms`);this.timeout=e}};var Wi=class extends qt{constructor(e){super();this.source=e,this.sinks=new Set}add(e){e.defer(()=>this.remove(e)),this.sinks.add(e).size===1&&(this.reset(),this.subscribe(this.source))}remove(e){this.sinks.delete(e),this.sinks.size===0&&this.dispose()}next(e){this.sinks.forEach(t=>t.next(e))}complete(){this.sinks.forEach(e=>e.complete()),this.sinks.clear()}error(e){this.sinks.forEach(t=>t.error(e)),this.sinks.clear()}};function at(){return n=>{let e=new Wi(n);if(n instanceof Qe){let t=Oe(s=>{e.add(s)},"share",arguments);return e.sourceId=t.id,t.source=n,Re.pipe(t),t}return Oe(e.add.bind(e),"share",arguments)}}function ji(...n){return Oe(e=>{let t=new K(e),s=n.length;t.complete=()=>{--s===0&&e.complete()},n.forEach(t.bindSubscribe)},"merge",arguments)}function x_(...n){return Oe(e=>{let t=n.length,s=t,c=t,_=new Array(t),m=()=>{--c===0&&e.complete()},p=(E,g)=>{let S=new K(e);S.next=y=>{--s===0?(S.next=w=>{_[g]=w,e.next(_)},S.next(y)):_[g]=y},S.complete=m,S.subscribe(E)};n.forEach(p)},"combineLatest",arguments)}var Ki=class extends K{constructor(e,...t){super(e);let s=new K(this.sink);s.next=c=>this.buffer=c,s.complete=oe,s.subscribe(x_(...t))}next(e){this.buffer&&this.sink.next([e,...this.buffer])}},yd=z(Ki,"withLatestFrom"),Yi=class extends K{constructor(e,t,s){super(e);this.bufferSize=t,this.startBufferEvery=s,this.buffer=[],this.count=0,this.startBufferEvery&&(this.buffers=[[]])}next(e){this.startBufferEvery?(this.count++===this.startBufferEvery&&(this.buffers.push([]),this.count=1),this.buffers.forEach(t=>{t.push(e)}),this.buffers[0].length===this.bufferSize&&this.sink.next(this.buffers.shift())):(this.buffer.push(e),this.buffer.length===this.bufferSize&&(this.sink.next(this.buffer),this.buffer=[]))}complete(){this.buffer.length?this.sink.next(this.buffer):this.buffers.length&&this.buffers.forEach(e=>this.sink.next(e)),super.complete()}},bd=z(Yi,"bufferCount"),zi=class extends K{constructor(e,t){super(e);this.buffer=[];let s=new K(e);s.next=c=>{e.next(this.buffer),this.buffer=[]},s.complete=oe,s.subscribe(t)}next(e){this.buffer.push(e)}complete(){this.buffer.length&&this.sink.next(this.buffer),super.complete()}},Ad=z(zi,"buffer");function bt(n){let e=arguments,t=at()(Oe(s=>{t.next=c=>s.next(c),t.complete=()=>s.complete(),t.error=c=>s.error(c),n&&s.subscribe(n)},"subject",e));return t.next=oe,t.complete=oe,t.error=oe,t}function At(n){return Oe(e=>{let t=0,s=setInterval(()=>e.next(t++),n);return e.defer(()=>{clearInterval(s)}),"interval"},"interval",arguments)}function $i(n,e){return Oe(t=>{let s=0,c=setTimeout(()=>{if(t.removeDefer(_),t.next(s++),e){let m=setInterval(()=>t.next(s++),e);t.defer(()=>{clearInterval(m)})}else t.complete()},n),_=()=>{clearTimeout(c)};t.defer(_)},"timer",arguments)}function cn(n,e){return t=>{let s=c=>t.next(c);t.defer(()=>e(s)),n(s)}}function Le(n,e){if("on"in n)return Oe(cn(t=>n.on(e,t),t=>n.off(e,t)),"fromEvent",arguments);if("addListener"in n)return Oe(cn(t=>n.addListener(e,t),t=>n.removeListener(e,t)),"fromEvent",arguments);if("addEventListener"in n)return Oe(cn(t=>n.addEventListener(e,t),t=>n.removeEventListener(e,t)),"fromEvent",arguments);throw"target is not a EventDispachter"}function Qi(n,e){return Oe((t,s=n,c=e+n)=>{for(;s<c&&!t.disposed;)t.next(s++);return t.complete(),"range"},"range",arguments)}var Xi=class extends K{constructor(e,t,s){super(e);this.f=t;let c=()=>{this.sink.next(this.acc),this.sink.complete()};typeof s=="undefined"?this.next=_=>{this.acc=_,this.complete=c,this.resetNext()}:(this.acc=s,this.complete=c)}next(e){this.acc=this.f(this.acc,e)}},L_=z(Xi,"reduce");var Ji=class extends K{constructor(e,t,s){super(e);this.filter=t,this.thisArg=s}next(e){this.filter.call(this.thisArg,e)&&this.sink.next(e)}},Xe=z(Ji,"filter"),Zi=class extends K{next(e){}},xd=z(Zi,"ignoreElements"),eo=class extends K{constructor(e,t){super(e);this.count=t}next(e){this.sink.next(e),--this.count===0&&this.complete()}},to=z(eo,"take"),ro=class extends K{constructor(e,t){super(e);let s=new K(e);s.next=()=>e.complete(),s.complete=an,s.subscribe(t)}},De=z(ro,"takeUntil"),no=class extends K{constructor(e,t){super(e);this.f=t}next(e){this.f(e)?this.sink.next(e):this.complete()}},io=z(no,"takeWhile");var oo=class extends K{constructor(e,t){super(e);this.count=t}next(e){--this.count===0&&(this.next=super.next)}},Ld=z(oo,"skip"),so=class extends K{constructor(e,t){super(e);e.next=oe;let s=new K(e);s.next=()=>{s.dispose(),e.resetNext()},s.complete=an,s.subscribe(t)}},kd=z(so,"skipUntil"),ao=class extends K{constructor(e,t){super(e);this.f=t}next(e){this.f(e)||(this.next=super.next,this.next(e))}},uo=z(ao,"skipWhile"),k_={leading:!0,trailing:!1},co=class extends K{constructor(e,t,s){super(e);this.durationSelector=t,this.trailing=s}cacheValue(e){this.last=e,this.disposed&&this.throttle(e)}send(e){this.sink.next(e),this.throttle(e)}throttle(e){this.reset(),this.subscribe(this.durationSelector(e))}next(){this.complete()}complete(){this.dispose(),this.trailing&&this.send(this.last)}},_o=class extends K{constructor(e,t,s=k_){super(e);this.durationSelector=t,this.config=s,this._throttle=new co(this.sink,this.durationSelector,this.config.trailing),this._throttle.dispose()}next(e){this._throttle.disposed&&this.config.leading?this._throttle.send(e):this._throttle.cacheValue(e)}complete(){this._throttle.throttle=oe,this._throttle.complete(),super.complete()}},hr=z(_o,"throttle");var lo=class extends K{next(){this.complete()}complete(){this.dispose(),this.sink.next(this.last)}},_n=class extends K{constructor(e,t){super(e);this.durationSelector=t,this._debounce=new lo(this.sink),this._debounce.dispose()}next(e){this._debounce.dispose(),this._debounce.reset(),this._debounce.last=e,this._debounce.subscribe(this.durationSelector(e))}complete(){this._debounce.complete(),super.complete()}},Vd=z(_n,"debounce"),fo=n=>z(_n,"debounceTime")(e=>$i(n)),po=class extends K{constructor(e,t,s){super(e);this.count=t,this.defaultValue=s}next(e){this.count--===0&&(this.defaultValue=e,this.complete())}complete(){if(this.defaultValue===void 0){this.error(new Error("not enough elements in sequence"));return}else this.sink.next(this.defaultValue);super.complete()}},Fd=z(po,"elementAt");var mo=class extends K{constructor(e,t){super(e);this.f=t,this.i=0}next(e){this.f(e)?(this.sink.next(this.i++),this.complete()):++this.i}},Bd=z(mo,"findIndex"),ho=class extends K{constructor(e,t,s){super(e);this.f=t,this.defaultValue=s,this.index=0}next(e){(!this.f||this.f(e,this.index++))&&(this.defaultValue=e,this.complete())}complete(){if(this.defaultValue===void 0){this.error(new Error("no elements in sequence"));return}else this.sink.next(this.defaultValue);super.complete()}},qd=z(ho,"first"),Eo=class extends K{constructor(e,t,s){super(e);this.f=t,this.defaultValue=s,this.index=0}next(e){(!this.f||this.f(e,this.index++))&&(this.defaultValue=e)}complete(){if(this.defaultValue===void 0){this.error(new Error("no elements in sequence"));return}else this.sink.next(this.defaultValue);super.complete()}},Hd=z(Eo,"last"),Ro=class extends K{constructor(e,t){super(e);this.predicate=t,this.index=0}next(e){this.predicate(e,this.index++)?this.result=!0:(this.result=!1,this.complete())}complete(){if(this.result===void 0){this.error(new Error("no elements in sequence"));return}else this.sink.next(this.result);super.complete()}},Gd=z(Ro,"every");var To=class extends K{constructor(e,t,s){super(e);this.f=t,typeof s=="undefined"?this.next=c=>{this.acc=c,this.resetNext(),this.sink.next(this.acc)}:this.acc=s}next(e){this.sink.next(this.acc=this.f(this.acc,e))}},Yd=z(To,"scan"),go=class extends K{constructor(){super(...arguments);this.hasLast=!1}next(e){this.hasLast?this.sink.next([this.last,e]):this.hasLast=!0,this.last=e}},zd=z(go,"pairwise"),ln=class extends K{constructor(e,t,s){super(e);this.mapper=t,this.thisArg=s}next(e){super.next(this.mapper.call(this.thisArg,e))}},Be=z(ln,"map"),dn=n=>z(ln,"mapTo")(e=>n),Ht=class extends K{constructor(e,t,s){super(e);this.data=t,this.context=s}next(e){let t=this.context.combineResults;t?this.sink.next(t(this.data,e)):this.sink.next(e)}tryComplete(){this.context.resetComplete(),this.dispose()}},Gt=class extends K{constructor(e,t,s){super(e);this.makeSource=t,this.combineResults=s,this.index=0}subInner(e,t){let s=this.currentSink=new t(this.sink,e,this);this.complete=this.tryComplete,s.complete=s.tryComplete,s.subscribe(this.makeSource(e,this.index++))}tryComplete(){this.currentSink.resetComplete(),this.dispose()}},fn=class extends Ht{},pn=class extends Gt{next(e){this.subInner(e,fn),this.next=t=>{this.currentSink.dispose(),this.subInner(t,fn)}}},Er=z(pn,"switchMap");function Rr(n){return(e,t)=>n(()=>e,t)}var Wt=Rr(z(pn,"switchMapTo")),vo=class extends Ht{tryComplete(){this.dispose(),this.context.sources.length?this.context.subNext():(this.context.resetNext(),this.context.resetComplete())}},mn=class extends Gt{constructor(){super(...arguments);this.sources=[],this.next2=this.sources.push.bind(this.sources)}next(e){this.next2(e),this.subNext()}subNext(){this.next=this.next2,this.subInner(this.sources.shift(),vo),this.disposed&&this.sources.length===0&&this.currentSink.resetComplete()}tryComplete(){this.sources.length===0&&this.currentSink.resetComplete(),this.dispose()}},So=z(mn,"concatMap"),$d=Rr(z(mn,"concatMapTo")),yo=class extends Ht{tryComplete(){this.context.inners.delete(this),super.dispose(),this.context.inners.size===0&&this.context.resetComplete()}},hn=class extends Gt{constructor(){super(...arguments);this.inners=new Set}next(e){this.subInner(e,yo),this.inners.add(this.currentSink)}tryComplete(){this.inners.size===1?this.inners.forEach(e=>e.resetComplete()):this.dispose()}},Qd=z(hn,"mergeMap"),Xd=Rr(z(hn,"mergeMapTo")),bo=class extends Ht{dispose(){this.context.resetNext(),super.dispose()}},En=class extends Gt{next(e){this.next=oe,this.subInner(e,bo)}},Jd=z(En,"exhaustMap"),Zd=Rr(z(En,"exhaustMapTo")),Ao=class extends K{constructor(e,t){super(e);this.f=t,this.groups=new Map}next(e){let t=this.f(e),s=this.groups.get(t);typeof s=="undefined"&&(s=bt(),s.key=t,this.groups.set(t,s),super.next(s)),s.next(e)}complete(){this.groups.forEach(e=>e.complete()),super.complete()}error(e){this.groups.forEach(t=>t.error(e)),super.error(e)}},ef=z(Ao,"groupBy"),Io=class extends K{constructor(){super(...arguments);this.start=new Date}next(e){this.sink.next({value:e,interval:Number(new Date)-Number(this.start)}),this.start=new Date}},tf=z(Io,"timeInterval"),Oo=class extends K{constructor(e,t){super(e);this.miniseconds=t,this.buffer=[],this.id=setInterval(()=>{this.sink.next(this.buffer.concat()),this.buffer.length=0},this.miniseconds)}next(e){this.buffer.push(e)}complete(){this.sink.next(this.buffer),super.complete()}dispose(){clearInterval(this.id),super.dispose()}},rf=z(Oo,"bufferTime"),wo=class extends K{constructor(e,t){super(e);this.buffer=[],this.delayTime=t}dispose(){clearTimeout(this.timeoutId),super.dispose()}delay(e){this.timeoutId=setTimeout(()=>{let t=this.buffer.shift();if(t){let{time:s,data:c}=t;super.next(c),this.buffer.length&&this.delay(Number(this.buffer[0].time)-Number(s))}},e)}next(e){this.buffer.length||this.delay(this.delayTime),this.buffer.push({time:new Date,data:e})}complete(){this.timeoutId=setTimeout(()=>super.complete(),this.delayTime)}},nf=z(wo,"delay"),Co=class extends K{constructor(e,t){super(e);this.selector=t}error(e){this.dispose(),this.selector(e)(this.sink)}},of=z(Co,"catchError");var No=()=>n=>new Promise((e,t)=>{let s;new mr(n,c=>s=c,t,()=>e(s))});var se=(n=oe,e=oe,t=oe)=>s=>new mr(s,n,e,t),Do=class extends K{constructor(e,t){super(e);t instanceof Function?this.next=s=>{t(s),e.next(s)}:(t.next&&(this.next=s=>{t.next(s),e.next(s)}),t.complete&&(this.complete=()=>{t.complete(),e.complete()}),t.error&&(this.error=s=>{t.error(s),e.error(s)}))}},It=z(Do,"tap"),Po=class extends K{constructor(e,t){super(e);this.timeout=t,this.id=setTimeout(()=>this.error(new un(this.timeout)),this.timeout)}next(e){super.next(e),clearTimeout(this.id),this.next=super.next}dispose(){clearTimeout(this.id),super.dispose()}},uf=z(Po,"timeout");var V_=(()=>{var n=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return function(t){t=t||{};var t=typeof t!="undefined"?t:{},s,c;t.ready=new Promise(function(r,i){s=r,c=i});var _=Object.assign({},t),m=[],p="./this.program",E=(r,i)=>{throw i},g=typeof window=="object",S=typeof importScripts=="function",y=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",w="";function F(r){return t.locateFile?t.locateFile(r,w):w+r}var O,V,Y,te;(g||S)&&(S?w=self.location.href:typeof document!="undefined"&&document.currentScript&&(w=document.currentScript.src),n&&(w=n),w.indexOf("blob:")!==0?w=w.substr(0,w.replace(/[?#].*/,"").lastIndexOf("/")+1):w="",O=r=>{var i=new XMLHttpRequest;return i.open("GET",r,!1),i.send(null),i.responseText},S&&(Y=r=>{var i=new XMLHttpRequest;return i.open("GET",r,!1),i.responseType="arraybuffer",i.send(null),new Uint8Array(i.response)}),V=(r,i,o)=>{var u=new XMLHttpRequest;u.open("GET",r,!0),u.responseType="arraybuffer",u.onload=()=>{if(u.status==200||u.status==0&&u.response){i(u.response);return}o()},u.onerror=o,u.send(null)},te=r=>document.title=r);var he=t.print||console.log.bind(console),ce=t.printErr||console.warn.bind(console);Object.assign(t,_),_=null,t.arguments&&(m=t.arguments),t.thisProgram&&(p=t.thisProgram),t.quit&&(E=t.quit);function R(r){R.shown||(R.shown={}),R.shown[r]||(R.shown[r]=1,ce(r))}function k(r){return r<128?[r]:[r%128|128,r>>7]}function A(r){for(var i={i:"i32",j:"i64",f:"f32",d:"f64",p:"i32"},o={parameters:[],results:r[0]=="v"?[]:[i[r[0]]]},u=1;u<r.length;++u)o.parameters.push(i[r[u]]);return o}function ee(r,i){if(typeof WebAssembly.Function=="function")return new WebAssembly.Function(A(i),r);var o=[1,96],u=i.slice(0,1),l=i.slice(1),d={i:127,p:127,j:126,f:125,d:124};o=o.concat(k(l.length));for(var f=0;f<l.length;++f)o.push(d[l[f]]);u=="v"?o.push(0):o=o.concat([1,d[u]]),o=[1].concat(k(o.length),o);var h=new Uint8Array([0,97,115,109,1,0,0,0].concat(o,[2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0])),T=new WebAssembly.Module(h),I=new WebAssembly.Instance(T,{e:{f:r}}),q=I.exports.f;return q}var ae=[],de;function Ie(){if(ae.length)return ae.pop();try{vt.grow(1)}catch(r){throw r instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":r}return vt.length-1}function N(r,i){for(var o=r;o<r+i;o++){var u=ar(o);u&&de.set(u,o)}}function D(r,i){if(de||(de=new WeakMap,N(0,vt.length)),de.has(r))return de.get(r);var o=Ie();try{Ti(o,r)}catch(l){if(!(l instanceof TypeError))throw l;var u=ee(r,i);Ti(o,u)}return de.set(r,o),o}function P(r){de.delete(ar(r)),ae.push(r)}var C;t.wasmBinary&&(C=t.wasmBinary);var hd=t.noExitRuntime||!1;typeof WebAssembly!="object"&&dt("no native wasm support detected");var nr,si=!1,Ru;function Tu(r,i){r||dt(i)}function ai(r){var i=t["_"+r];return i}function x(r,i,o,u,l){var d={string:function(B){var ne=0;if(B!=null&&B!==0){var Q=(B.length<<2)+1;ne=rn(Q),ci(B,ne,Q)}return ne},array:function(B){var ne=rn(B.length);return li(B,ne),ne}};function f(B){return i==="string"?Pt(B):i==="boolean"?Boolean(B):B}var h=ai(r),T=[],I=0;if(u)for(var q=0;q<u.length;q++){var H=d[o[q]];H?(I===0&&(I=Mi()),T[q]=H(u[q])):T[q]=u[q]}var U=h.apply(null,T);function L(B){return I!==0&&xi(I),f(B)}return U=L(U),U}function gu(r,i,o,u){o=o||[];var l=o.every(function(f){return f==="number"}),d=i!=="string";return d&&l&&!u?ai(r):function(){return x(r,i,o,arguments,u)}}var ui=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0;function _t(r,i,o){for(var u=i+o,l=i;r[l]&&!(l>=u);)++l;if(l-i>16&&r.buffer&&ui)return ui.decode(r.subarray(i,l));for(var d="";i<l;){var f=r[i++];if(!(f&128)){d+=String.fromCharCode(f);continue}var h=r[i++]&63;if((f&224)==192){d+=String.fromCharCode((f&31)<<6|h);continue}var T=r[i++]&63;if((f&240)==224?f=(f&15)<<12|h<<6|T:f=(f&7)<<18|h<<12|T<<6|r[i++]&63,f<65536)d+=String.fromCharCode(f);else{var I=f-65536;d+=String.fromCharCode(55296|I>>10,56320|I&1023)}}return d}function Pt(r,i){return r?_t(ye,r,i):""}function jr(r,i,o,u){if(!(u>0))return 0;for(var l=o,d=o+u-1,f=0;f<r.length;++f){var h=r.charCodeAt(f);if(h>=55296&&h<=57343){var T=r.charCodeAt(++f);h=65536+((h&1023)<<10)|T&1023}if(h<=127){if(o>=d)break;i[o++]=h}else if(h<=2047){if(o+1>=d)break;i[o++]=192|h>>6,i[o++]=128|h&63}else if(h<=65535){if(o+2>=d)break;i[o++]=224|h>>12,i[o++]=128|h>>6&63,i[o++]=128|h&63}else{if(o+3>=d)break;i[o++]=240|h>>18,i[o++]=128|h>>12&63,i[o++]=128|h>>6&63,i[o++]=128|h&63}}return i[o]=0,o-l}function ci(r,i,o){return jr(r,ye,i,o)}function Kr(r){for(var i=0,o=0;o<r.length;++o){var u=r.charCodeAt(o);u>=55296&&u<=57343&&(u=65536+((u&1023)<<10)|r.charCodeAt(++o)&1023),u<=127?++i:u<=2047?i+=2:u<=65535?i+=3:i+=4}return i}var _i=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):void 0;function vu(r,i){for(var o=r,u=o>>1,l=u+i/2;!(u>=l)&&or[u];)++u;if(o=u<<1,o-r>32&&_i)return _i.decode(ye.subarray(r,o));for(var d="",f=0;!(f>=i/2);++f){var h=gt[r+f*2>>1];if(h==0)break;d+=String.fromCharCode(h)}return d}function Su(r,i,o){if(o===void 0&&(o=2147483647),o<2)return 0;o-=2;for(var u=i,l=o<r.length*2?o/2:r.length,d=0;d<l;++d){var f=r.charCodeAt(d);gt[i>>1]=f,i+=2}return gt[i>>1]=0,i-u}function yu(r){return r.length*2}function bu(r,i){for(var o=0,u="";!(o>=i/4);){var l=j[r+o*4>>2];if(l==0)break;if(++o,l>=65536){var d=l-65536;u+=String.fromCharCode(55296|d>>10,56320|d&1023)}else u+=String.fromCharCode(l)}return u}function Au(r,i,o){if(o===void 0&&(o=2147483647),o<4)return 0;for(var u=i,l=u+o-4,d=0;d<r.length;++d){var f=r.charCodeAt(d);if(f>=55296&&f<=57343){var h=r.charCodeAt(++d);f=65536+((f&1023)<<10)|h&1023}if(j[i>>2]=f,i+=4,i+4>l)break}return j[i>>2]=0,i-u}function Iu(r){for(var i=0,o=0;o<r.length;++o){var u=r.charCodeAt(o);u>=55296&&u<=57343&&++o,i+=4}return i}function li(r,i){le.set(r,i)}function Ou(r,i,o){for(var u=0;u<r.length;++u)le[i++>>0]=r.charCodeAt(u);o||(le[i>>0]=0)}var ir,le,ye,gt,or,j,Ee,di,Yr;function fi(r){ir=r,t.HEAP8=le=new Int8Array(r),t.HEAP16=gt=new Int16Array(r),t.HEAP32=j=new Int32Array(r),t.HEAPU8=ye=new Uint8Array(r),t.HEAPU16=or=new Uint16Array(r),t.HEAPU32=Ee=new Uint32Array(r),t.HEAPF32=di=new Float32Array(r),t.HEAPF64=Yr=new Float64Array(r)}var Ed=t.INITIAL_MEMORY||402653184,vt,pi=[],mi=[],hi=[],wu=!1;function Cu(){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)Pu(t.preRun.shift());$r(pi)}function Nu(){wu=!0,!t.noFSInit&&!a.init.initialized&&a.init(),a.ignorePermissions=!1,nt.init(),$r(mi)}function Du(){if(t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;)Mu(t.postRun.shift());$r(hi)}function Pu(r){pi.unshift(r)}function Uu(r){mi.unshift(r)}function Mu(r){hi.unshift(r)}var lt=0,zr=null,Ut=null;function Rd(r){return r}function sr(r){lt++,t.monitorRunDependencies&&t.monitorRunDependencies(lt)}function Mt(r){if(lt--,t.monitorRunDependencies&&t.monitorRunDependencies(lt),lt==0&&(zr!==null&&(clearInterval(zr),zr=null),Ut)){var i=Ut;Ut=null,i()}}function dt(r){t.onAbort&&t.onAbort(r),r="Aborted("+r+")",ce(r),si=!0,Ru=1,r+=". Build with -sASSERTIONS for more info.";var i=new WebAssembly.RuntimeError(r);throw c(i),i}var xu="data:application/octet-stream;base64,";function Ei(r){return r.startsWith(xu)}var Ve;Ve="av_processing.wasm",Ei(Ve)||(Ve=F(Ve));function Ri(r){try{if(r==Ve&&C)return new Uint8Array(C);if(Y)return Y(r);throw"both async and sync fetching of the wasm failed"}catch(i){dt(i)}}function Lu(){return!C&&(g||S)&&typeof fetch=="function"?fetch(Ve,{credentials:"same-origin"}).then(function(r){if(!r.ok)throw"failed to load wasm binary file at '"+Ve+"'";return r.arrayBuffer()}).catch(function(){return Ri(Ve)}):Promise.resolve().then(function(){return Ri(Ve)})}function ku(){var r={a:qc};function i(f,h){var T=f.exports;t.asm=T,nr=t.asm.z,fi(nr.buffer),vt=t.asm.ga,Uu(t.asm.A),Mt("wasm-instantiate")}sr("wasm-instantiate");function o(f){i(f.instance)}function u(f){return Lu().then(function(h){return WebAssembly.instantiate(h,r)}).then(function(h){return h}).then(f,function(h){ce("failed to asynchronously prepare wasm: "+h),dt(h)})}function l(){return!C&&typeof WebAssembly.instantiateStreaming=="function"&&!Ei(Ve)&&typeof fetch=="function"?fetch(Ve,{credentials:"same-origin"}).then(function(f){var h=WebAssembly.instantiateStreaming(f,r);return h.then(o,function(T){return ce("wasm streaming compile failed: "+T),ce("falling back to ArrayBuffer instantiation"),u(o)})}):u(o)}if(t.instantiateWasm)try{var d=t.instantiateWasm(r,i);return d}catch(f){return ce("Module.instantiateWasm callback failed with error: "+f),!1}return l().catch(c),{}}var Te,Ye;function $r(r){for(;r.length>0;){var i=r.shift();if(typeof i=="function"){i(t);continue}var o=i.func;typeof o=="number"?i.arg===void 0?ar(o)():ar(o)(i.arg):o(i.arg===void 0?null:i.arg)}}function ar(r){return vt.get(r)}function Vu(){var r=new Error;if(!r.stack){try{throw new Error}catch(i){r=i}if(!r.stack)return"(no stack trace available)"}return r.stack.toString()}function Ti(r,i){vt.set(r,i)}function Fu(r){return dr(r+24)+24}function Bu(r){this.excPtr=r,this.ptr=r-24,this.set_type=function(i){Ee[this.ptr+4>>2]=i},this.get_type=function(){return Ee[this.ptr+4>>2]},this.set_destructor=function(i){Ee[this.ptr+8>>2]=i},this.get_destructor=function(){return Ee[this.ptr+8>>2]},this.set_refcount=function(i){j[this.ptr>>2]=i},this.set_caught=function(i){i=i?1:0,le[this.ptr+12>>0]=i},this.get_caught=function(){return le[this.ptr+12>>0]!=0},this.set_rethrown=function(i){i=i?1:0,le[this.ptr+13>>0]=i},this.get_rethrown=function(){return le[this.ptr+13>>0]!=0},this.init=function(i,o){this.set_adjusted_ptr(0),this.set_type(i),this.set_destructor(o),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var i=j[this.ptr>>2];j[this.ptr>>2]=i+1},this.release_ref=function(){var i=j[this.ptr>>2];return j[this.ptr>>2]=i-1,i===1},this.set_adjusted_ptr=function(i){Ee[this.ptr+16>>2]=i},this.get_adjusted_ptr=function(){return Ee[this.ptr+16>>2]},this.get_exception_ptr=function(){var i=Li(this.get_type());if(i)return Ee[this.excPtr>>2];var o=this.get_adjusted_ptr();return o!==0?o:this.excPtr}}var qu=0,Hu=0;function Gu(r,i,o){var u=new Bu(r);throw u.init(i,o),qu=r,Hu++,r}function Wu(r,i,o,u,l){}function Qr(r){switch(r){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+r)}}function ju(){for(var r=new Array(256),i=0;i<256;++i)r[i]=String.fromCharCode(i);gi=r}var gi=void 0;function tt(r){for(var i="",o=r;ye[o];)i+=gi[ye[o++]];return i}var Xr={},vi={},Ku={},Yu=48,zu=57;function $u(r){if(r===void 0)return"_unknown";r=r.replace(/[^a-zA-Z0-9_]/g,"$");var i=r.charCodeAt(0);return i>=Yu&&i<=zu?"_"+r:r}function Qu(r,i){return r=$u(r),new Function("body","return function "+r+`() {
|
|
3
|
+
"use strict"; return body.apply(this, arguments);
|
|
4
|
+
};
|
|
5
|
+
`)(i)}function Si(r,i){var o=Qu(i,function(u){this.name=i,this.message=u;var l=new Error(u).stack;l!==void 0&&(this.stack=this.toString()+`
|
|
6
|
+
`+l.replace(/^Error(:[^\n]*)?\n/,""))});return o.prototype=Object.create(r.prototype),o.prototype.constructor=o,o.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},o}var yi=void 0;function St(r){throw new yi(r)}var Xu=void 0;function rt(r,i,o={}){if(!("argPackAdvance"in i))throw new TypeError("registerType registeredInstance requires argPackAdvance");var u=i.name;if(r||St('type "'+u+'" must have a positive integer typeid pointer'),vi.hasOwnProperty(r)){if(o.ignoreDuplicateRegistrations)return;St("Cannot register type '"+u+"' twice")}if(vi[r]=i,delete Ku[r],Xr.hasOwnProperty(r)){var l=Xr[r];delete Xr[r],l.forEach(d=>d())}}function Ju(r,i,o,u,l){var d=Qr(o);i=tt(i),rt(r,{name:i,fromWireType:function(f){return!!f},toWireType:function(f,h){return h?u:l},argPackAdvance:8,readValueFromPointer:function(f){var h;if(o===1)h=le;else if(o===2)h=gt;else if(o===4)h=j;else throw new TypeError("Unknown boolean type size: "+i);return this.fromWireType(h[f>>d])},destructorFunction:null})}var Jr=[],qe=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Zu(r){r>4&&--qe[r].refcount===0&&(qe[r]=void 0,Jr.push(r))}function ec(){for(var r=0,i=5;i<qe.length;++i)qe[i]!==void 0&&++r;return r}function tc(){for(var r=5;r<qe.length;++r)if(qe[r]!==void 0)return qe[r];return null}function rc(){t.count_emval_handles=ec,t.get_first_emval=tc}var bi={toValue:r=>(r||St("Cannot use deleted val. handle = "+r),qe[r].value),toHandle:r=>{switch(r){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var i=Jr.length?Jr.pop():qe.length;return qe[i]={refcount:1,value:r},i}}}};function Zr(r){return this.fromWireType(Ee[r>>2])}function nc(r,i){i=tt(i),rt(r,{name:i,fromWireType:function(o){var u=bi.toValue(o);return Zu(o),u},toWireType:function(o,u){return bi.toHandle(u)},argPackAdvance:8,readValueFromPointer:Zr,destructorFunction:null})}function ic(r,i){switch(i){case 2:return function(o){return this.fromWireType(di[o>>2])};case 3:return function(o){return this.fromWireType(Yr[o>>3])};default:throw new TypeError("Unknown float type: "+r)}}function oc(r,i,o){var u=Qr(o);i=tt(i),rt(r,{name:i,fromWireType:function(l){return l},toWireType:function(l,d){return d},argPackAdvance:8,readValueFromPointer:ic(i,u),destructorFunction:null})}function sc(r,i,o){switch(i){case 0:return o?function(l){return le[l]}:function(l){return ye[l]};case 1:return o?function(l){return gt[l>>1]}:function(l){return or[l>>1]};case 2:return o?function(l){return j[l>>2]}:function(l){return Ee[l>>2]};default:throw new TypeError("Unknown integer type: "+r)}}function ac(r,i,o,u,l){i=tt(i),l===-1&&(l=4294967295);var d=Qr(o),f=H=>H;if(u===0){var h=32-8*o;f=H=>H<<h>>>h}var T=i.includes("unsigned"),I=(H,U)=>{},q;T?q=function(H,U){return I(U,this.name),U>>>0}:q=function(H,U){return I(U,this.name),U},rt(r,{name:i,fromWireType:f,toWireType:q,argPackAdvance:8,readValueFromPointer:sc(i,d,u!==0),destructorFunction:null})}function uc(r,i,o){var u=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],l=u[i];function d(f){f=f>>2;var h=Ee,T=h[f],I=h[f+1];return new l(ir,I,T)}o=tt(o),rt(r,{name:o,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{ignoreDuplicateRegistrations:!0})}function cc(r,i){i=tt(i);var o=i==="std::string";rt(r,{name:i,fromWireType:function(u){var l=Ee[u>>2],d;if(o)for(var f=u+4,h=0;h<=l;++h){var T=u+4+h;if(h==l||ye[T]==0){var I=T-f,q=Pt(f,I);d===void 0?d=q:(d+=String.fromCharCode(0),d+=q),f=T+1}}else{for(var H=new Array(l),h=0;h<l;++h)H[h]=String.fromCharCode(ye[u+4+h]);d=H.join("")}return it(u),d},toWireType:function(u,l){l instanceof ArrayBuffer&&(l=new Uint8Array(l));var d,f=typeof l=="string";f||l instanceof Uint8Array||l instanceof Uint8ClampedArray||l instanceof Int8Array||St("Cannot pass non-string to std::string"),o&&f?d=()=>Kr(l):d=()=>l.length;var h=d(),T=dr(4+h+1);if(Ee[T>>2]=h,o&&f)ci(l,T+4,h+1);else if(f)for(var I=0;I<h;++I){var q=l.charCodeAt(I);q>255&&(it(T),St("String has UTF-16 code units that do not fit in 8 bits")),ye[T+4+I]=q}else for(var I=0;I<h;++I)ye[T+4+I]=l[I];return u!==null&&u.push(it,T),T},argPackAdvance:8,readValueFromPointer:Zr,destructorFunction:function(u){it(u)}})}function _c(r,i,o){o=tt(o);var u,l,d,f,h;i===2?(u=vu,l=Su,f=yu,d=()=>or,h=1):i===4&&(u=bu,l=Au,f=Iu,d=()=>Ee,h=2),rt(r,{name:o,fromWireType:function(T){for(var I=Ee[T>>2],q=d(),H,U=T+4,L=0;L<=I;++L){var B=T+4+L*i;if(L==I||q[B>>h]==0){var ne=B-U,Q=u(U,ne);H===void 0?H=Q:(H+=String.fromCharCode(0),H+=Q),U=B+i}}return it(T),H},toWireType:function(T,I){typeof I!="string"&&St("Cannot pass non-string to C++ string type "+o);var q=f(I),H=dr(4+q+i);return Ee[H>>2]=q>>h,l(I,H+4,q+i),T!==null&&T.push(it,H),H},argPackAdvance:8,readValueFromPointer:Zr,destructorFunction:function(T){it(T)}})}function lc(r,i){i=tt(i),rt(r,{isVoid:!0,name:i,argPackAdvance:0,fromWireType:function(){},toWireType:function(o,u){}})}function dc(){return Date.now()}var fc=!0;function pc(){return fc}function mc(){dt("")}var Ai;Ai=()=>performance.now();function hc(r){return r<0||r===0&&1/r===-1/0}function Ec(r,i){return(r>>>0)+i*4294967296}function Rc(r,i){return(r>>>0)+(i>>>0)*4294967296}function Ii(r,i){if(r<=0)return r;var o=i<=32?Math.abs(1<<i-1):Math.pow(2,i-1);return r>=o&&(i<=32||r>o)&&(r=-2*o+r),r}function Oi(r,i){return r>=0?r:i<=32?2*Math.abs(1<<i-1)+r:Math.pow(2,i)+r}function Tc(r){for(var i=r;ye[i];)++i;return i-r}function gc(r,i){var o=r,u=i;function l(Ge,$e){return($e==="double"||$e==="i64")&&Ge&7&&(Ge+=4),Ge}function d(Ge){var $e;return u=l(u,Ge),Ge==="double"?($e=Number(Yr[u>>3]),u+=8):Ge=="i64"?($e=[j[u>>2],j[u+4>>2]],u+=8):(Ge="i32",$e=j[u>>2],u+=4),$e}for(var f=[],h,T,I;;){var q=o;if(h=le[o>>0],h===0)break;if(T=le[o+1>>0],h==37){var H=!1,U=!1,L=!1,B=!1,ne=!1;e:for(;;){switch(T){case 43:H=!0;break;case 45:U=!0;break;case 35:L=!0;break;case 48:if(B)break e;B=!0;break;case 32:ne=!0;break;default:break e}o++,T=le[o+1>>0]}var Q=0;if(T==42)Q=d("i32"),o++,T=le[o+1>>0];else for(;T>=48&&T<=57;)Q=Q*10+(T-48),o++,T=le[o+1>>0];var fe=!1,b=-1;if(T==46){if(b=0,fe=!0,o++,T=le[o+1>>0],T==42)b=d("i32"),o++;else for(;;){var W=le[o+1>>0];if(W<48||W>57)break;b=b*10+(W-48),o++}T=le[o+1>>0]}b<0&&(b=6,fe=!1);var re;switch(String.fromCharCode(T)){case"h":var ue=le[o+2>>0];ue==104?(o++,re=1):re=2;break;case"l":var ue=le[o+2>>0];ue==108?(o++,re=8):re=4;break;case"L":case"q":case"j":re=8;break;case"z":case"t":case"I":re=4;break;default:re=null}switch(re&&o++,T=le[o+1>>0],String.fromCharCode(T)){case"d":case"i":case"u":case"o":case"x":case"X":case"p":{var Me=T==100||T==105;re=re||4,I=d("i"+re*8);var M;if(re==8&&(I=T==117?Rc(I[0],I[1]):Ec(I[0],I[1])),re<=4){var b_=Math.pow(256,re)-1;I=(Me?Ii:Oi)(I&b_,re*8)}var Vt=Math.abs(I),Ne="";if(T==100||T==105)M=Ii(I,8*re).toString(10);else if(T==117)M=Oi(I,8*re).toString(10),I=Math.abs(I);else if(T==111)M=(L?"0":"")+Vt.toString(8);else if(T==120||T==88){if(Ne=L&&I!=0?"0x":"",I<0){I=-I,M=(Vt-1).toString(16);for(var ki=[],He=0;He<M.length;He++)ki.push((15-parseInt(M[He],16)).toString(16));for(M=ki.join("");M.length<re*2;)M="f"+M}else M=Vt.toString(16);T==88&&(Ne=Ne.toUpperCase(),M=M.toUpperCase())}else T==112&&(Vt===0?M="(nil)":(Ne="0x",M=Vt.toString(16)));if(fe)for(;M.length<b;)M="0"+M;for(I>=0&&(H?Ne="+"+Ne:ne&&(Ne=" "+Ne)),M.charAt(0)=="-"&&(Ne="-"+Ne,M=M.substr(1));Ne.length+M.length<Q;)U?M+=" ":B?M="0"+M:Ne=" "+Ne;M=Ne+M,M.split("").forEach(function(Ge){f.push(Ge.charCodeAt(0))});break}case"f":case"F":case"e":case"E":case"g":case"G":{I=d("double");var M;if(isNaN(I))M="nan",B=!1;else if(!isFinite(I))M=(I<0?"-":"")+"inf",B=!1;else{var Vi=!1,Ft=Math.min(b,20);if(T==103||T==71){Vi=!0,b=b||1;var on=parseInt(I.toExponential(Ft).split("e")[1],10);b>on&&on>=-4?(T=(T==103?"f":"F").charCodeAt(0),b-=on+1):(T=(T==103?"e":"E").charCodeAt(0),b--),Ft=Math.min(b,20)}T==101||T==69?(M=I.toExponential(Ft),/[eE][-+]\d$/.test(M)&&(M=M.slice(0,-1)+"0"+M.slice(-1))):(T==102||T==70)&&(M=I.toFixed(Ft),I===0&&hc(I)&&(M="-"+M));var Fe=M.split("e");if(Vi&&!L)for(;Fe[0].length>1&&Fe[0].includes(".")&&(Fe[0].slice(-1)=="0"||Fe[0].slice(-1)==".");)Fe[0]=Fe[0].slice(0,-1);else for(L&&M.indexOf(".")==-1&&(Fe[0]+=".");b>Ft++;)Fe[0]+="0";M=Fe[0]+(Fe.length>1?"e"+Fe[1]:""),T==69&&(M=M.toUpperCase()),I>=0&&(H?M="+"+M:ne&&(M=" "+M))}for(;M.length<Q;)U?M+=" ":B&&(M[0]=="-"||M[0]=="+")?M=M[0]+"0"+M.slice(1):M=(B?"0":" ")+M;T<97&&(M=M.toUpperCase()),M.split("").forEach(function($e){f.push($e.charCodeAt(0))});break}case"s":{var pr=d("i8*"),yt=pr?Tc(pr):"(null)".length;if(fe&&(yt=Math.min(yt,b)),!U)for(;yt<Q--;)f.push(32);if(pr)for(var He=0;He<yt;He++)f.push(ye[pr++>>0]);else f=f.concat(kt("(null)".substr(0,yt),!0));if(U)for(;yt<Q--;)f.push(32);break}case"c":{for(U&&f.push(d("i8"));--Q>0;)f.push(32);U||f.push(d("i8"));break}case"n":{var A_=d("i32*");j[A_>>2]=f.length;break}case"%":{f.push(h);break}default:for(var He=q;He<o+2;He++)f.push(le[He>>0])}o+=2}else f.push(h),o+=1}return f}function en(r){if(!r||!r.callee||!r.callee.name)return[null,"",""];var i=r.callee.toString(),o=r.callee.name,u="(",l=!0;for(var d in r){var f=r[d];l||(u+=", "),l=!1,typeof f=="number"||typeof f=="string"?u+=f:u+="("+typeof f+")"}u+=")";var h=r.callee.caller;return r=h?h.arguments:[],l&&(u=""),[r,o,u]}function vc(r){var i=Vu(),o=i.lastIndexOf("_emscripten_log"),u=i.lastIndexOf("_emscripten_get_callstack"),l=i.indexOf(`
|
|
7
|
+
`,Math.max(o,u))+1;i=i.slice(l),r&32&&R("EM_LOG_DEMANGLE is deprecated; ignoring"),r&8&&typeof emscripten_source_map=="undefined"&&(R('Source map information is not available, emscripten_log with EM_LOG_C_STACK will be ignored. Build with "--pre-js $EMSCRIPTEN/src/emscripten-source-map.min.js" linker flag to add source map loading to code.'),r^=8,r|=16);var d=null;if(r&128)for(d=en(arguments);d[1].includes("_emscripten_");)d=en(d[0]);var f=i.split(`
|
|
8
|
+
`);i="";var h=new RegExp("\\s*(.*?)@(.*?):([0-9]+):([0-9]+)"),T=new RegExp("\\s*(.*?)@(.*):(.*)(:(.*))?"),I=new RegExp("\\s*at (.*?) \\((.*):(.*):(.*)\\)");for(var q in f){var H=f[q],U="",L="",B=0,ne=0,Q=I.exec(H);if(Q&&Q.length==5)U=Q[1],L=Q[2],B=Q[3],ne=Q[4];else if(Q=h.exec(H),Q||(Q=T.exec(H)),Q&&Q.length>=4)U=Q[1],L=Q[2],B=Q[3],ne=Q[4]|0;else{i+=H+`
|
|
9
|
+
`;continue}var fe=!1;if(r&8){var b=emscripten_source_map.originalPositionFor({line:B,column:ne});fe=b&&b.source,fe&&(r&64&&(b.source=b.source.substring(b.source.replace(/\\/g,"/").lastIndexOf("/")+1)),i+=" at "+U+" ("+b.source+":"+b.line+":"+b.column+`)
|
|
10
|
+
`)}(r&16||!fe)&&(r&64&&(L=L.substring(L.replace(/\\/g,"/").lastIndexOf("/")+1)),i+=(fe?" = "+U:" at "+U)+" ("+L+":"+B+":"+ne+`)
|
|
11
|
+
`),r&128&&d[0]&&(d[1]==U&&d[2].length>0&&(i=i.replace(/\s+$/,""),i+=" with values: "+d[1]+d[2]+`
|
|
12
|
+
`),d=en(d[0]))}return i=i.replace(/\s+$/,""),i}function Sc(r,i){r&24&&(i=i.replace(/\s+$/,""),i+=(i.length>0?`
|
|
13
|
+
`:"")+vc(r)),r&1?r&4?console.error(i):r&2?console.warn(i):r&512?console.info(i):r&256?console.debug(i):console.log(i):r&6?ce(i):he(i)}function yc(r,i,o){var u=gc(i,o),l=_t(u,0);Sc(r,l)}function bc(r,i,o){ye.copyWithin(r,i,i+o)}function Ac(){return 2147483648}function Ic(r){try{return nr.grow(r-ir.byteLength+65535>>>16),fi(nr.buffer),1}catch(i){}}function Oc(r){var i=ye.length;r=r>>>0;var o=Ac();if(r>o)return!1;let u=(T,I)=>T+(I-T%I)%I;for(var l=1;l<=4;l*=2){var d=i*(1+.2/l);d=Math.min(d,r+100663296);var f=Math.min(o,u(Math.max(r,d),65536)),h=Ic(f);if(h)return!0}return!1}var tn={};function wc(){return p||"./this.program"}function xt(){if(!xt.strings){var r=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",i={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:r,_:wc()};for(var o in tn)tn[o]===void 0?delete i[o]:i[o]=tn[o];var u=[];for(var o in i)u.push(o+"="+i[o]);xt.strings=u}return xt.strings}var ie={isAbs:r=>r.charAt(0)==="/",splitPath:r=>{var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return i.exec(r).slice(1)},normalizeArray:(r,i)=>{for(var o=0,u=r.length-1;u>=0;u--){var l=r[u];l==="."?r.splice(u,1):l===".."?(r.splice(u,1),o++):o&&(r.splice(u,1),o--)}if(i)for(;o;o--)r.unshift("..");return r},normalize:r=>{var i=ie.isAbs(r),o=r.substr(-1)==="/";return r=ie.normalizeArray(r.split("/").filter(u=>!!u),!i).join("/"),!r&&!i&&(r="."),r&&o&&(r+="/"),(i?"/":"")+r},dirname:r=>{var i=ie.splitPath(r),o=i[0],u=i[1];return!o&&!u?".":(u&&(u=u.substr(0,u.length-1)),o+u)},basename:r=>{if(r==="/")return"/";r=ie.normalize(r),r=r.replace(/\/$/,"");var i=r.lastIndexOf("/");return i===-1?r:r.substr(i+1)},join:function(){var r=Array.prototype.slice.call(arguments,0);return ie.normalize(r.join("/"))},join2:(r,i)=>ie.normalize(r+"/"+i)};function wi(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var r=new Uint8Array(1);return function(){return crypto.getRandomValues(r),r[0]}}else return function(){dt("randomDevice")}}var ze={resolve:function(){for(var r="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var u=o>=0?arguments[o]:a.cwd();if(typeof u!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!u)return"";r=u+"/"+r,i=ie.isAbs(u)}return r=ie.normalizeArray(r.split("/").filter(l=>!!l),!i).join("/"),(i?"/":"")+r||"."},relative:(r,i)=>{r=ze.resolve(r).substr(1),i=ze.resolve(i).substr(1);function o(I){for(var q=0;q<I.length&&I[q]==="";q++);for(var H=I.length-1;H>=0&&I[H]==="";H--);return q>H?[]:I.slice(q,H-q+1)}for(var u=o(r.split("/")),l=o(i.split("/")),d=Math.min(u.length,l.length),f=d,h=0;h<d;h++)if(u[h]!==l[h]){f=h;break}for(var T=[],h=f;h<u.length;h++)T.push("..");return T=T.concat(l.slice(f)),T.join("/")}},nt={ttys:[],init:function(){},shutdown:function(){},register:function(r,i){nt.ttys[r]={input:[],output:[],ops:i},a.registerDevice(r,nt.stream_ops)},stream_ops:{open:function(r){var i=nt.ttys[r.node.rdev];if(!i)throw new a.ErrnoError(43);r.tty=i,r.seekable=!1},close:function(r){r.tty.ops.flush(r.tty)},flush:function(r){r.tty.ops.flush(r.tty)},read:function(r,i,o,u,l){if(!r.tty||!r.tty.ops.get_char)throw new a.ErrnoError(60);for(var d=0,f=0;f<u;f++){var h;try{h=r.tty.ops.get_char(r.tty)}catch(T){throw new a.ErrnoError(29)}if(h===void 0&&d===0)throw new a.ErrnoError(6);if(h==null)break;d++,i[o+f]=h}return d&&(r.node.timestamp=Date.now()),d},write:function(r,i,o,u,l){if(!r.tty||!r.tty.ops.put_char)throw new a.ErrnoError(60);try{for(var d=0;d<u;d++)r.tty.ops.put_char(r.tty,i[o+d])}catch(f){throw new a.ErrnoError(29)}return u&&(r.node.timestamp=Date.now()),d}},default_tty_ops:{get_char:function(r){if(!r.input.length){var i=null;if(typeof window!="undefined"&&typeof window.prompt=="function"?(i=window.prompt("Input: "),i!==null&&(i+=`
|
|
14
|
+
`)):typeof readline=="function"&&(i=readline(),i!==null&&(i+=`
|
|
15
|
+
`)),!i)return null;r.input=kt(i,!0)}return r.input.shift()},put_char:function(r,i){i===null||i===10?(he(_t(r.output,0)),r.output=[]):i!=0&&r.output.push(i)},flush:function(r){r.output&&r.output.length>0&&(he(_t(r.output,0)),r.output=[])}},default_tty1_ops:{put_char:function(r,i){i===null||i===10?(ce(_t(r.output,0)),r.output=[]):i!=0&&r.output.push(i)},flush:function(r){r.output&&r.output.length>0&&(ce(_t(r.output,0)),r.output=[])}}};function Ci(r){dt()}var Z={ops_table:null,mount:function(r){return Z.createNode(null,"/",16384|511,0)},createNode:function(r,i,o,u){if(a.isBlkdev(o)||a.isFIFO(o))throw new a.ErrnoError(63);Z.ops_table||(Z.ops_table={dir:{node:{getattr:Z.node_ops.getattr,setattr:Z.node_ops.setattr,lookup:Z.node_ops.lookup,mknod:Z.node_ops.mknod,rename:Z.node_ops.rename,unlink:Z.node_ops.unlink,rmdir:Z.node_ops.rmdir,readdir:Z.node_ops.readdir,symlink:Z.node_ops.symlink},stream:{llseek:Z.stream_ops.llseek}},file:{node:{getattr:Z.node_ops.getattr,setattr:Z.node_ops.setattr},stream:{llseek:Z.stream_ops.llseek,read:Z.stream_ops.read,write:Z.stream_ops.write,allocate:Z.stream_ops.allocate,mmap:Z.stream_ops.mmap,msync:Z.stream_ops.msync}},link:{node:{getattr:Z.node_ops.getattr,setattr:Z.node_ops.setattr,readlink:Z.node_ops.readlink},stream:{}},chrdev:{node:{getattr:Z.node_ops.getattr,setattr:Z.node_ops.setattr},stream:a.chrdev_stream_ops}});var l=a.createNode(r,i,o,u);return a.isDir(l.mode)?(l.node_ops=Z.ops_table.dir.node,l.stream_ops=Z.ops_table.dir.stream,l.contents={}):a.isFile(l.mode)?(l.node_ops=Z.ops_table.file.node,l.stream_ops=Z.ops_table.file.stream,l.usedBytes=0,l.contents=null):a.isLink(l.mode)?(l.node_ops=Z.ops_table.link.node,l.stream_ops=Z.ops_table.link.stream):a.isChrdev(l.mode)&&(l.node_ops=Z.ops_table.chrdev.node,l.stream_ops=Z.ops_table.chrdev.stream),l.timestamp=Date.now(),r&&(r.contents[i]=l,r.timestamp=l.timestamp),l},getFileDataAsTypedArray:function(r){return r.contents?r.contents.subarray?r.contents.subarray(0,r.usedBytes):new Uint8Array(r.contents):new Uint8Array(0)},expandFileStorage:function(r,i){var o=r.contents?r.contents.length:0;if(!(o>=i)){var u=1024*1024;i=Math.max(i,o*(o<u?2:1.125)>>>0),o!=0&&(i=Math.max(i,256));var l=r.contents;r.contents=new Uint8Array(i),r.usedBytes>0&&r.contents.set(l.subarray(0,r.usedBytes),0)}},resizeFileStorage:function(r,i){if(r.usedBytes!=i)if(i==0)r.contents=null,r.usedBytes=0;else{var o=r.contents;r.contents=new Uint8Array(i),o&&r.contents.set(o.subarray(0,Math.min(i,r.usedBytes))),r.usedBytes=i}},node_ops:{getattr:function(r){var i={};return i.dev=a.isChrdev(r.mode)?r.id:1,i.ino=r.id,i.mode=r.mode,i.nlink=1,i.uid=0,i.gid=0,i.rdev=r.rdev,a.isDir(r.mode)?i.size=4096:a.isFile(r.mode)?i.size=r.usedBytes:a.isLink(r.mode)?i.size=r.link.length:i.size=0,i.atime=new Date(r.timestamp),i.mtime=new Date(r.timestamp),i.ctime=new Date(r.timestamp),i.blksize=4096,i.blocks=Math.ceil(i.size/i.blksize),i},setattr:function(r,i){i.mode!==void 0&&(r.mode=i.mode),i.timestamp!==void 0&&(r.timestamp=i.timestamp),i.size!==void 0&&Z.resizeFileStorage(r,i.size)},lookup:function(r,i){throw a.genericErrors[44]},mknod:function(r,i,o,u){return Z.createNode(r,i,o,u)},rename:function(r,i,o){if(a.isDir(r.mode)){var u;try{u=a.lookupNode(i,o)}catch(d){}if(u)for(var l in u.contents)throw new a.ErrnoError(55)}delete r.parent.contents[r.name],r.parent.timestamp=Date.now(),r.name=o,i.contents[o]=r,i.timestamp=r.parent.timestamp,r.parent=i},unlink:function(r,i){delete r.contents[i],r.timestamp=Date.now()},rmdir:function(r,i){var o=a.lookupNode(r,i);for(var u in o.contents)throw new a.ErrnoError(55);delete r.contents[i],r.timestamp=Date.now()},readdir:function(r){var i=[".",".."];for(var o in r.contents)!r.contents.hasOwnProperty(o)||i.push(o);return i},symlink:function(r,i,o){var u=Z.createNode(r,i,511|40960,0);return u.link=o,u},readlink:function(r){if(!a.isLink(r.mode))throw new a.ErrnoError(28);return r.link}},stream_ops:{read:function(r,i,o,u,l){var d=r.node.contents;if(l>=r.node.usedBytes)return 0;var f=Math.min(r.node.usedBytes-l,u);if(f>8&&d.subarray)i.set(d.subarray(l,l+f),o);else for(var h=0;h<f;h++)i[o+h]=d[l+h];return f},write:function(r,i,o,u,l,d){if(i.buffer===le.buffer&&(d=!1),!u)return 0;var f=r.node;if(f.timestamp=Date.now(),i.subarray&&(!f.contents||f.contents.subarray)){if(d)return f.contents=i.subarray(o,o+u),f.usedBytes=u,u;if(f.usedBytes===0&&l===0)return f.contents=i.slice(o,o+u),f.usedBytes=u,u;if(l+u<=f.usedBytes)return f.contents.set(i.subarray(o,o+u),l),u}if(Z.expandFileStorage(f,l+u),f.contents.subarray&&i.subarray)f.contents.set(i.subarray(o,o+u),l);else for(var h=0;h<u;h++)f.contents[l+h]=i[o+h];return f.usedBytes=Math.max(f.usedBytes,l+u),u},llseek:function(r,i,o){var u=i;if(o===1?u+=r.position:o===2&&a.isFile(r.node.mode)&&(u+=r.node.usedBytes),u<0)throw new a.ErrnoError(28);return u},allocate:function(r,i,o){Z.expandFileStorage(r.node,i+o),r.node.usedBytes=Math.max(r.node.usedBytes,i+o)},mmap:function(r,i,o,u,l){if(!a.isFile(r.node.mode))throw new a.ErrnoError(43);var d,f,h=r.node.contents;if(!(l&2)&&h.buffer===ir)f=!1,d=h.byteOffset;else{if((o>0||o+i<h.length)&&(h.subarray?h=h.subarray(o,o+i):h=Array.prototype.slice.call(h,o,o+i)),f=!0,d=Ci(i),!d)throw new a.ErrnoError(48);le.set(h,d)}return{ptr:d,allocated:f}},msync:function(r,i,o,u,l){if(!a.isFile(r.node.mode))throw new a.ErrnoError(43);if(l&2)return 0;var d=Z.stream_ops.write(r,i,0,u,o,!1);return 0}}};function Cc(r,i,o,u){var l=u?"":"al "+r;V(r,function(d){Tu(d,'Loading data file "'+r+'" failed (no arrayBuffer).'),i(new Uint8Array(d)),l&&Mt(l)},function(d){if(o)o();else throw'Loading data file "'+r+'" failed.'}),l&&sr(l)}var a={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(r,i={})=>{if(r=ze.resolve(a.cwd(),r),!r)return{path:"",node:null};var o={follow_mount:!0,recurse_count:0};if(i=Object.assign(o,i),i.recurse_count>8)throw new a.ErrnoError(32);for(var u=ie.normalizeArray(r.split("/").filter(H=>!!H),!1),l=a.root,d="/",f=0;f<u.length;f++){var h=f===u.length-1;if(h&&i.parent)break;if(l=a.lookupNode(l,u[f]),d=ie.join2(d,u[f]),a.isMountpoint(l)&&(!h||h&&i.follow_mount)&&(l=l.mounted.root),!h||i.follow)for(var T=0;a.isLink(l.mode);){var I=a.readlink(d);d=ze.resolve(ie.dirname(d),I);var q=a.lookupPath(d,{recurse_count:i.recurse_count+1});if(l=q.node,T++>40)throw new a.ErrnoError(32)}}return{path:d,node:l}},getPath:r=>{for(var i;;){if(a.isRoot(r)){var o=r.mount.mountpoint;return i?o[o.length-1]!=="/"?o+"/"+i:o+i:o}i=i?r.name+"/"+i:r.name,r=r.parent}},hashName:(r,i)=>{for(var o=0,u=0;u<i.length;u++)o=(o<<5)-o+i.charCodeAt(u)|0;return(r+o>>>0)%a.nameTable.length},hashAddNode:r=>{var i=a.hashName(r.parent.id,r.name);r.name_next=a.nameTable[i],a.nameTable[i]=r},hashRemoveNode:r=>{var i=a.hashName(r.parent.id,r.name);if(a.nameTable[i]===r)a.nameTable[i]=r.name_next;else for(var o=a.nameTable[i];o;){if(o.name_next===r){o.name_next=r.name_next;break}o=o.name_next}},lookupNode:(r,i)=>{var o=a.mayLookup(r);if(o)throw new a.ErrnoError(o,r);for(var u=a.hashName(r.id,i),l=a.nameTable[u];l;l=l.name_next){var d=l.name;if(l.parent.id===r.id&&d===i)return l}return a.lookup(r,i)},createNode:(r,i,o,u)=>{var l=new a.FSNode(r,i,o,u);return a.hashAddNode(l),l},destroyNode:r=>{a.hashRemoveNode(r)},isRoot:r=>r===r.parent,isMountpoint:r=>!!r.mounted,isFile:r=>(r&61440)===32768,isDir:r=>(r&61440)===16384,isLink:r=>(r&61440)===40960,isChrdev:r=>(r&61440)===8192,isBlkdev:r=>(r&61440)===24576,isFIFO:r=>(r&61440)===4096,isSocket:r=>(r&49152)===49152,flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:r=>{var i=a.flagModes[r];if(typeof i=="undefined")throw new Error("Unknown file open mode: "+r);return i},flagsToPermissionString:r=>{var i=["r","w","rw"][r&3];return r&512&&(i+="w"),i},nodePermissions:(r,i)=>a.ignorePermissions?0:i.includes("r")&&!(r.mode&292)||i.includes("w")&&!(r.mode&146)||i.includes("x")&&!(r.mode&73)?2:0,mayLookup:r=>{var i=a.nodePermissions(r,"x");return i||(r.node_ops.lookup?0:2)},mayCreate:(r,i)=>{try{var o=a.lookupNode(r,i);return 20}catch(u){}return a.nodePermissions(r,"wx")},mayDelete:(r,i,o)=>{var u;try{u=a.lookupNode(r,i)}catch(d){return d.errno}var l=a.nodePermissions(r,"wx");if(l)return l;if(o){if(!a.isDir(u.mode))return 54;if(a.isRoot(u)||a.getPath(u)===a.cwd())return 10}else if(a.isDir(u.mode))return 31;return 0},mayOpen:(r,i)=>r?a.isLink(r.mode)?32:a.isDir(r.mode)&&(a.flagsToPermissionString(i)!=="r"||i&512)?31:a.nodePermissions(r,a.flagsToPermissionString(i)):44,MAX_OPEN_FDS:4096,nextfd:(r=0,i=a.MAX_OPEN_FDS)=>{for(var o=r;o<=i;o++)if(!a.streams[o])return o;throw new a.ErrnoError(33)},getStream:r=>a.streams[r],createStream:(r,i,o)=>{a.FSStream||(a.FSStream=function(){this.shared={}},a.FSStream.prototype={object:{get:function(){return this.node},set:function(l){this.node=l}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(l){this.shared.flags=l}},position:{get function(){return this.shared.position},set:function(l){this.shared.position=l}}}),r=Object.assign(new a.FSStream,r);var u=a.nextfd(i,o);return r.fd=u,a.streams[u]=r,r},closeStream:r=>{a.streams[r]=null},chrdev_stream_ops:{open:r=>{var i=a.getDevice(r.node.rdev);r.stream_ops=i.stream_ops,r.stream_ops.open&&r.stream_ops.open(r)},llseek:()=>{throw new a.ErrnoError(70)}},major:r=>r>>8,minor:r=>r&255,makedev:(r,i)=>r<<8|i,registerDevice:(r,i)=>{a.devices[r]={stream_ops:i}},getDevice:r=>a.devices[r],getMounts:r=>{for(var i=[],o=[r];o.length;){var u=o.pop();i.push(u),o.push.apply(o,u.mounts)}return i},syncfs:(r,i)=>{typeof r=="function"&&(i=r,r=!1),a.syncFSRequests++,a.syncFSRequests>1&&ce("warning: "+a.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var o=a.getMounts(a.root.mount),u=0;function l(f){return a.syncFSRequests--,i(f)}function d(f){if(f)return d.errored?void 0:(d.errored=!0,l(f));++u>=o.length&&l(null)}o.forEach(f=>{if(!f.type.syncfs)return d(null);f.type.syncfs(f,r,d)})},mount:(r,i,o)=>{var u=o==="/",l=!o,d;if(u&&a.root)throw new a.ErrnoError(10);if(!u&&!l){var f=a.lookupPath(o,{follow_mount:!1});if(o=f.path,d=f.node,a.isMountpoint(d))throw new a.ErrnoError(10);if(!a.isDir(d.mode))throw new a.ErrnoError(54)}var h={type:r,opts:i,mountpoint:o,mounts:[]},T=r.mount(h);return T.mount=h,h.root=T,u?a.root=T:d&&(d.mounted=h,d.mount&&d.mount.mounts.push(h)),T},unmount:r=>{var i=a.lookupPath(r,{follow_mount:!1});if(!a.isMountpoint(i.node))throw new a.ErrnoError(28);var o=i.node,u=o.mounted,l=a.getMounts(u);Object.keys(a.nameTable).forEach(f=>{for(var h=a.nameTable[f];h;){var T=h.name_next;l.includes(h.mount)&&a.destroyNode(h),h=T}}),o.mounted=null;var d=o.mount.mounts.indexOf(u);o.mount.mounts.splice(d,1)},lookup:(r,i)=>r.node_ops.lookup(r,i),mknod:(r,i,o)=>{var u=a.lookupPath(r,{parent:!0}),l=u.node,d=ie.basename(r);if(!d||d==="."||d==="..")throw new a.ErrnoError(28);var f=a.mayCreate(l,d);if(f)throw new a.ErrnoError(f);if(!l.node_ops.mknod)throw new a.ErrnoError(63);return l.node_ops.mknod(l,d,i,o)},create:(r,i)=>(i=i!==void 0?i:438,i&=4095,i|=32768,a.mknod(r,i,0)),mkdir:(r,i)=>(i=i!==void 0?i:511,i&=511|512,i|=16384,a.mknod(r,i,0)),mkdirTree:(r,i)=>{for(var o=r.split("/"),u="",l=0;l<o.length;++l)if(!!o[l]){u+="/"+o[l];try{a.mkdir(u,i)}catch(d){if(d.errno!=20)throw d}}},mkdev:(r,i,o)=>(typeof o=="undefined"&&(o=i,i=438),i|=8192,a.mknod(r,i,o)),symlink:(r,i)=>{if(!ze.resolve(r))throw new a.ErrnoError(44);var o=a.lookupPath(i,{parent:!0}),u=o.node;if(!u)throw new a.ErrnoError(44);var l=ie.basename(i),d=a.mayCreate(u,l);if(d)throw new a.ErrnoError(d);if(!u.node_ops.symlink)throw new a.ErrnoError(63);return u.node_ops.symlink(u,l,r)},rename:(r,i)=>{var o=ie.dirname(r),u=ie.dirname(i),l=ie.basename(r),d=ie.basename(i),f,h,T;if(f=a.lookupPath(r,{parent:!0}),h=f.node,f=a.lookupPath(i,{parent:!0}),T=f.node,!h||!T)throw new a.ErrnoError(44);if(h.mount!==T.mount)throw new a.ErrnoError(75);var I=a.lookupNode(h,l),q=ze.relative(r,u);if(q.charAt(0)!==".")throw new a.ErrnoError(28);if(q=ze.relative(i,o),q.charAt(0)!==".")throw new a.ErrnoError(55);var H;try{H=a.lookupNode(T,d)}catch(B){}if(I!==H){var U=a.isDir(I.mode),L=a.mayDelete(h,l,U);if(L)throw new a.ErrnoError(L);if(L=H?a.mayDelete(T,d,U):a.mayCreate(T,d),L)throw new a.ErrnoError(L);if(!h.node_ops.rename)throw new a.ErrnoError(63);if(a.isMountpoint(I)||H&&a.isMountpoint(H))throw new a.ErrnoError(10);if(T!==h&&(L=a.nodePermissions(h,"w"),L))throw new a.ErrnoError(L);a.hashRemoveNode(I);try{h.node_ops.rename(I,T,d)}catch(B){throw B}finally{a.hashAddNode(I)}}},rmdir:r=>{var i=a.lookupPath(r,{parent:!0}),o=i.node,u=ie.basename(r),l=a.lookupNode(o,u),d=a.mayDelete(o,u,!0);if(d)throw new a.ErrnoError(d);if(!o.node_ops.rmdir)throw new a.ErrnoError(63);if(a.isMountpoint(l))throw new a.ErrnoError(10);o.node_ops.rmdir(o,u),a.destroyNode(l)},readdir:r=>{var i=a.lookupPath(r,{follow:!0}),o=i.node;if(!o.node_ops.readdir)throw new a.ErrnoError(54);return o.node_ops.readdir(o)},unlink:r=>{var i=a.lookupPath(r,{parent:!0}),o=i.node;if(!o)throw new a.ErrnoError(44);var u=ie.basename(r),l=a.lookupNode(o,u),d=a.mayDelete(o,u,!1);if(d)throw new a.ErrnoError(d);if(!o.node_ops.unlink)throw new a.ErrnoError(63);if(a.isMountpoint(l))throw new a.ErrnoError(10);o.node_ops.unlink(o,u),a.destroyNode(l)},readlink:r=>{var i=a.lookupPath(r),o=i.node;if(!o)throw new a.ErrnoError(44);if(!o.node_ops.readlink)throw new a.ErrnoError(28);return ze.resolve(a.getPath(o.parent),o.node_ops.readlink(o))},stat:(r,i)=>{var o=a.lookupPath(r,{follow:!i}),u=o.node;if(!u)throw new a.ErrnoError(44);if(!u.node_ops.getattr)throw new a.ErrnoError(63);return u.node_ops.getattr(u)},lstat:r=>a.stat(r,!0),chmod:(r,i,o)=>{var u;if(typeof r=="string"){var l=a.lookupPath(r,{follow:!o});u=l.node}else u=r;if(!u.node_ops.setattr)throw new a.ErrnoError(63);u.node_ops.setattr(u,{mode:i&4095|u.mode&~4095,timestamp:Date.now()})},lchmod:(r,i)=>{a.chmod(r,i,!0)},fchmod:(r,i)=>{var o=a.getStream(r);if(!o)throw new a.ErrnoError(8);a.chmod(o.node,i)},chown:(r,i,o,u)=>{var l;if(typeof r=="string"){var d=a.lookupPath(r,{follow:!u});l=d.node}else l=r;if(!l.node_ops.setattr)throw new a.ErrnoError(63);l.node_ops.setattr(l,{timestamp:Date.now()})},lchown:(r,i,o)=>{a.chown(r,i,o,!0)},fchown:(r,i,o)=>{var u=a.getStream(r);if(!u)throw new a.ErrnoError(8);a.chown(u.node,i,o)},truncate:(r,i)=>{if(i<0)throw new a.ErrnoError(28);var o;if(typeof r=="string"){var u=a.lookupPath(r,{follow:!0});o=u.node}else o=r;if(!o.node_ops.setattr)throw new a.ErrnoError(63);if(a.isDir(o.mode))throw new a.ErrnoError(31);if(!a.isFile(o.mode))throw new a.ErrnoError(28);var l=a.nodePermissions(o,"w");if(l)throw new a.ErrnoError(l);o.node_ops.setattr(o,{size:i,timestamp:Date.now()})},ftruncate:(r,i)=>{var o=a.getStream(r);if(!o)throw new a.ErrnoError(8);if((o.flags&2097155)===0)throw new a.ErrnoError(28);a.truncate(o.node,i)},utime:(r,i,o)=>{var u=a.lookupPath(r,{follow:!0}),l=u.node;l.node_ops.setattr(l,{timestamp:Math.max(i,o)})},open:(r,i,o)=>{if(r==="")throw new a.ErrnoError(44);i=typeof i=="string"?a.modeStringToFlags(i):i,o=typeof o=="undefined"?438:o,i&64?o=o&4095|32768:o=0;var u;if(typeof r=="object")u=r;else{r=ie.normalize(r);try{var l=a.lookupPath(r,{follow:!(i&131072)});u=l.node}catch(T){}}var d=!1;if(i&64)if(u){if(i&128)throw new a.ErrnoError(20)}else u=a.mknod(r,o,0),d=!0;if(!u)throw new a.ErrnoError(44);if(a.isChrdev(u.mode)&&(i&=~512),i&65536&&!a.isDir(u.mode))throw new a.ErrnoError(54);if(!d){var f=a.mayOpen(u,i);if(f)throw new a.ErrnoError(f)}i&512&&!d&&a.truncate(u,0),i&=~(128|512|131072);var h=a.createStream({node:u,path:a.getPath(u),flags:i,seekable:!0,position:0,stream_ops:u.stream_ops,ungotten:[],error:!1});return h.stream_ops.open&&h.stream_ops.open(h),t.logReadFiles&&!(i&1)&&(a.readFiles||(a.readFiles={}),r in a.readFiles||(a.readFiles[r]=1)),h},close:r=>{if(a.isClosed(r))throw new a.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(i){throw i}finally{a.closeStream(r.fd)}r.fd=null},isClosed:r=>r.fd===null,llseek:(r,i,o)=>{if(a.isClosed(r))throw new a.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new a.ErrnoError(70);if(o!=0&&o!=1&&o!=2)throw new a.ErrnoError(28);return r.position=r.stream_ops.llseek(r,i,o),r.ungotten=[],r.position},read:(r,i,o,u,l)=>{if(u<0||l<0)throw new a.ErrnoError(28);if(a.isClosed(r))throw new a.ErrnoError(8);if((r.flags&2097155)===1)throw new a.ErrnoError(8);if(a.isDir(r.node.mode))throw new a.ErrnoError(31);if(!r.stream_ops.read)throw new a.ErrnoError(28);var d=typeof l!="undefined";if(!d)l=r.position;else if(!r.seekable)throw new a.ErrnoError(70);var f=r.stream_ops.read(r,i,o,u,l);return d||(r.position+=f),f},write:(r,i,o,u,l,d)=>{if(u<0||l<0)throw new a.ErrnoError(28);if(a.isClosed(r))throw new a.ErrnoError(8);if((r.flags&2097155)===0)throw new a.ErrnoError(8);if(a.isDir(r.node.mode))throw new a.ErrnoError(31);if(!r.stream_ops.write)throw new a.ErrnoError(28);r.seekable&&r.flags&1024&&a.llseek(r,0,2);var f=typeof l!="undefined";if(!f)l=r.position;else if(!r.seekable)throw new a.ErrnoError(70);var h=r.stream_ops.write(r,i,o,u,l,d);return f||(r.position+=h),h},allocate:(r,i,o)=>{if(a.isClosed(r))throw new a.ErrnoError(8);if(i<0||o<=0)throw new a.ErrnoError(28);if((r.flags&2097155)===0)throw new a.ErrnoError(8);if(!a.isFile(r.node.mode)&&!a.isDir(r.node.mode))throw new a.ErrnoError(43);if(!r.stream_ops.allocate)throw new a.ErrnoError(138);r.stream_ops.allocate(r,i,o)},mmap:(r,i,o,u,l)=>{if((u&2)!==0&&(l&2)===0&&(r.flags&2097155)!==2)throw new a.ErrnoError(2);if((r.flags&2097155)===1)throw new a.ErrnoError(2);if(!r.stream_ops.mmap)throw new a.ErrnoError(43);return r.stream_ops.mmap(r,i,o,u,l)},msync:(r,i,o,u,l)=>!r||!r.stream_ops.msync?0:r.stream_ops.msync(r,i,o,u,l),munmap:r=>0,ioctl:(r,i,o)=>{if(!r.stream_ops.ioctl)throw new a.ErrnoError(59);return r.stream_ops.ioctl(r,i,o)},readFile:(r,i={})=>{if(i.flags=i.flags||0,i.encoding=i.encoding||"binary",i.encoding!=="utf8"&&i.encoding!=="binary")throw new Error('Invalid encoding type "'+i.encoding+'"');var o,u=a.open(r,i.flags),l=a.stat(r),d=l.size,f=new Uint8Array(d);return a.read(u,f,0,d,0),i.encoding==="utf8"?o=_t(f,0):i.encoding==="binary"&&(o=f),a.close(u),o},writeFile:(r,i,o={})=>{o.flags=o.flags||577;var u=a.open(r,o.flags,o.mode);if(typeof i=="string"){var l=new Uint8Array(Kr(i)+1),d=jr(i,l,0,l.length);a.write(u,l,0,d,void 0,o.canOwn)}else if(ArrayBuffer.isView(i))a.write(u,i,0,i.byteLength,void 0,o.canOwn);else throw new Error("Unsupported data type");a.close(u)},cwd:()=>a.currentPath,chdir:r=>{var i=a.lookupPath(r,{follow:!0});if(i.node===null)throw new a.ErrnoError(44);if(!a.isDir(i.node.mode))throw new a.ErrnoError(54);var o=a.nodePermissions(i.node,"x");if(o)throw new a.ErrnoError(o);a.currentPath=i.path},createDefaultDirectories:()=>{a.mkdir("/tmp"),a.mkdir("/home"),a.mkdir("/home/web_user")},createDefaultDevices:()=>{a.mkdir("/dev"),a.registerDevice(a.makedev(1,3),{read:()=>0,write:(i,o,u,l,d)=>l}),a.mkdev("/dev/null",a.makedev(1,3)),nt.register(a.makedev(5,0),nt.default_tty_ops),nt.register(a.makedev(6,0),nt.default_tty1_ops),a.mkdev("/dev/tty",a.makedev(5,0)),a.mkdev("/dev/tty1",a.makedev(6,0));var r=wi();a.createDevice("/dev","random",r),a.createDevice("/dev","urandom",r),a.mkdir("/dev/shm"),a.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{a.mkdir("/proc");var r=a.mkdir("/proc/self");a.mkdir("/proc/self/fd"),a.mount({mount:()=>{var i=a.createNode(r,"fd",16384|511,73);return i.node_ops={lookup:(o,u)=>{var l=+u,d=a.getStream(l);if(!d)throw new a.ErrnoError(8);var f={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>d.path}};return f.parent=f,f}},i}},{},"/proc/self/fd")},createStandardStreams:()=>{t.stdin?a.createDevice("/dev","stdin",t.stdin):a.symlink("/dev/tty","/dev/stdin"),t.stdout?a.createDevice("/dev","stdout",null,t.stdout):a.symlink("/dev/tty","/dev/stdout"),t.stderr?a.createDevice("/dev","stderr",null,t.stderr):a.symlink("/dev/tty1","/dev/stderr");var r=a.open("/dev/stdin",0),i=a.open("/dev/stdout",1),o=a.open("/dev/stderr",1)},ensureErrnoError:()=>{a.ErrnoError||(a.ErrnoError=function(i,o){this.node=o,this.setErrno=function(u){this.errno=u},this.setErrno(i),this.message="FS error"},a.ErrnoError.prototype=new Error,a.ErrnoError.prototype.constructor=a.ErrnoError,[44].forEach(r=>{a.genericErrors[r]=new a.ErrnoError(r),a.genericErrors[r].stack="<generic error, no stack>"}))},staticInit:()=>{a.ensureErrnoError(),a.nameTable=new Array(4096),a.mount(Z,{},"/"),a.createDefaultDirectories(),a.createDefaultDevices(),a.createSpecialDirectories(),a.filesystems={MEMFS:Z}},init:(r,i,o)=>{a.init.initialized=!0,a.ensureErrnoError(),t.stdin=r||t.stdin,t.stdout=i||t.stdout,t.stderr=o||t.stderr,a.createStandardStreams()},quit:()=>{a.init.initialized=!1,Ui(0);for(var r=0;r<a.streams.length;r++){var i=a.streams[r];!i||a.close(i)}},getMode:(r,i)=>{var o=0;return r&&(o|=292|73),i&&(o|=146),o},findObject:(r,i)=>{var o=a.analyzePath(r,i);return o.exists?o.object:null},analyzePath:(r,i)=>{try{var o=a.lookupPath(r,{follow:!i});r=o.path}catch(l){}var u={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var o=a.lookupPath(r,{parent:!0});u.parentExists=!0,u.parentPath=o.path,u.parentObject=o.node,u.name=ie.basename(r),o=a.lookupPath(r,{follow:!i}),u.exists=!0,u.path=o.path,u.object=o.node,u.name=o.node.name,u.isRoot=o.path==="/"}catch(l){u.error=l.errno}return u},createPath:(r,i,o,u)=>{r=typeof r=="string"?r:a.getPath(r);for(var l=i.split("/").reverse();l.length;){var d=l.pop();if(!!d){var f=ie.join2(r,d);try{a.mkdir(f)}catch(h){}r=f}}return f},createFile:(r,i,o,u,l)=>{var d=ie.join2(typeof r=="string"?r:a.getPath(r),i),f=a.getMode(u,l);return a.create(d,f)},createDataFile:(r,i,o,u,l,d)=>{var f=i;r&&(r=typeof r=="string"?r:a.getPath(r),f=i?ie.join2(r,i):r);var h=a.getMode(u,l),T=a.create(f,h);if(o){if(typeof o=="string"){for(var I=new Array(o.length),q=0,H=o.length;q<H;++q)I[q]=o.charCodeAt(q);o=I}a.chmod(T,h|146);var U=a.open(T,577);a.write(U,o,0,o.length,0,d),a.close(U),a.chmod(T,h)}return T},createDevice:(r,i,o,u)=>{var l=ie.join2(typeof r=="string"?r:a.getPath(r),i),d=a.getMode(!!o,!!u);a.createDevice.major||(a.createDevice.major=64);var f=a.makedev(a.createDevice.major++,0);return a.registerDevice(f,{open:h=>{h.seekable=!1},close:h=>{u&&u.buffer&&u.buffer.length&&u(10)},read:(h,T,I,q,H)=>{for(var U=0,L=0;L<q;L++){var B;try{B=o()}catch(ne){throw new a.ErrnoError(29)}if(B===void 0&&U===0)throw new a.ErrnoError(6);if(B==null)break;U++,T[I+L]=B}return U&&(h.node.timestamp=Date.now()),U},write:(h,T,I,q,H)=>{for(var U=0;U<q;U++)try{u(T[I+U])}catch(L){throw new a.ErrnoError(29)}return q&&(h.node.timestamp=Date.now()),U}}),a.mkdev(l,d,f)},forceLoadFile:r=>{if(r.isDevice||r.isFolder||r.link||r.contents)return!0;if(typeof XMLHttpRequest!="undefined")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(O)try{r.contents=kt(O(r.url),!0),r.usedBytes=r.contents.length}catch(i){throw new a.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile:(r,i,o,u,l)=>{function d(){this.lengthKnown=!1,this.chunks=[]}if(d.prototype.get=function(L){if(!(L>this.length-1||L<0)){var B=L%this.chunkSize,ne=L/this.chunkSize|0;return this.getter(ne)[B]}},d.prototype.setDataGetter=function(L){this.getter=L},d.prototype.cacheLength=function(){var L=new XMLHttpRequest;if(L.open("HEAD",o,!1),L.send(null),!(L.status>=200&&L.status<300||L.status===304))throw new Error("Couldn't load "+o+". Status: "+L.status);var B=Number(L.getResponseHeader("Content-length")),ne,Q=(ne=L.getResponseHeader("Accept-Ranges"))&&ne==="bytes",fe=(ne=L.getResponseHeader("Content-Encoding"))&&ne==="gzip",b=1024*1024;Q||(b=B);var W=(ue,Me)=>{if(ue>Me)throw new Error("invalid range ("+ue+", "+Me+") or no bytes requested!");if(Me>B-1)throw new Error("only "+B+" bytes available! programmer error!");var M=new XMLHttpRequest;if(M.open("GET",o,!1),B!==b&&M.setRequestHeader("Range","bytes="+ue+"-"+Me),M.responseType="arraybuffer",M.overrideMimeType&&M.overrideMimeType("text/plain; charset=x-user-defined"),M.send(null),!(M.status>=200&&M.status<300||M.status===304))throw new Error("Couldn't load "+o+". Status: "+M.status);return M.response!==void 0?new Uint8Array(M.response||[]):kt(M.responseText||"",!0)},re=this;re.setDataGetter(ue=>{var Me=ue*b,M=(ue+1)*b-1;if(M=Math.min(M,B-1),typeof re.chunks[ue]=="undefined"&&(re.chunks[ue]=W(Me,M)),typeof re.chunks[ue]=="undefined")throw new Error("doXHR failed!");return re.chunks[ue]}),(fe||!B)&&(b=B=1,B=this.getter(0).length,b=B,he("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=B,this._chunkSize=b,this.lengthKnown=!0},typeof XMLHttpRequest!="undefined"){if(!S)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var f=new d;Object.defineProperties(f,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var h={isDevice:!1,contents:f}}else var h={isDevice:!1,url:o};var T=a.createFile(r,i,h,u,l);h.contents?T.contents=h.contents:h.url&&(T.contents=null,T.url=h.url),Object.defineProperties(T,{usedBytes:{get:function(){return this.contents.length}}});var I={},q=Object.keys(T.stream_ops);q.forEach(U=>{var L=T.stream_ops[U];I[U]=function(){return a.forceLoadFile(T),L.apply(null,arguments)}});function H(U,L,B,ne,Q){var fe=U.node.contents;if(Q>=fe.length)return 0;var b=Math.min(fe.length-Q,ne);if(fe.slice)for(var W=0;W<b;W++)L[B+W]=fe[Q+W];else for(var W=0;W<b;W++)L[B+W]=fe.get(Q+W);return b}return I.read=(U,L,B,ne,Q)=>(a.forceLoadFile(T),H(U,L,B,ne,Q)),I.mmap=(U,L,B,ne,Q)=>{a.forceLoadFile(T);var fe=Ci(L);if(!fe)throw new a.ErrnoError(48);return H(U,le,fe,L,B),{ptr:fe,allocated:!0}},T.stream_ops=I,T},createPreloadedFile:(r,i,o,u,l,d,f,h,T,I)=>{var q=i?ze.resolve(ie.join2(r,i)):r,H="cp "+q;function U(L){function B(ne){I&&I(),h||a.createDataFile(r,i,ne,u,l,T),d&&d(),Mt(H)}Browser.handledByPreloadPlugin(L,q,B,()=>{f&&f(),Mt(H)})||B(L)}sr(H),typeof o=="string"?Cc(o,L=>U(L),f):U(o)},indexedDB:()=>window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,DB_NAME:()=>"EM_FS_"+window.location.pathname,DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(r,i,o)=>{i=i||(()=>{}),o=o||(()=>{});var u=a.indexedDB();try{var l=u.open(a.DB_NAME(),a.DB_VERSION)}catch(d){return o(d)}l.onupgradeneeded=()=>{he("creating db");var d=l.result;d.createObjectStore(a.DB_STORE_NAME)},l.onsuccess=()=>{var d=l.result,f=d.transaction([a.DB_STORE_NAME],"readwrite"),h=f.objectStore(a.DB_STORE_NAME),T=0,I=0,q=r.length;function H(){I==0?i():o()}r.forEach(U=>{var L=h.put(a.analyzePath(U).object.contents,U);L.onsuccess=()=>{T++,T+I==q&&H()},L.onerror=()=>{I++,T+I==q&&H()}}),f.onerror=o},l.onerror=o},loadFilesFromDB:(r,i,o)=>{i=i||(()=>{}),o=o||(()=>{});var u=a.indexedDB();try{var l=u.open(a.DB_NAME(),a.DB_VERSION)}catch(d){return o(d)}l.onupgradeneeded=o,l.onsuccess=()=>{var d=l.result;try{var f=d.transaction([a.DB_STORE_NAME],"readonly")}catch(U){o(U);return}var h=f.objectStore(a.DB_STORE_NAME),T=0,I=0,q=r.length;function H(){I==0?i():o()}r.forEach(U=>{var L=h.get(U);L.onsuccess=()=>{a.analyzePath(U).exists&&a.unlink(U),a.createDataFile(ie.dirname(U),ie.basename(U),L.result,!0,!0,!0),T++,T+I==q&&H()},L.onerror=()=>{I++,T+I==q&&H()}}),f.onerror=o},l.onerror=o}},Lt={DEFAULT_POLLMASK:5,calculateAt:function(r,i,o){if(ie.isAbs(i))return i;var u;if(r===-100)u=a.cwd();else{var l=a.getStream(r);if(!l)throw new a.ErrnoError(8);u=l.path}if(i.length==0){if(!o)throw new a.ErrnoError(44);return u}return ie.join2(u,i)},doStat:function(r,i,o){try{var u=r(i)}catch(l){if(l&&l.node&&ie.normalize(i)!==ie.normalize(a.getPath(l.node)))return-54;throw l}return j[o>>2]=u.dev,j[o+4>>2]=0,j[o+8>>2]=u.ino,j[o+12>>2]=u.mode,j[o+16>>2]=u.nlink,j[o+20>>2]=u.uid,j[o+24>>2]=u.gid,j[o+28>>2]=u.rdev,j[o+32>>2]=0,Ye=[u.size>>>0,(Te=u.size,+Math.abs(Te)>=1?Te>0?(Math.min(+Math.floor(Te/4294967296),4294967295)|0)>>>0:~~+Math.ceil((Te-+(~~Te>>>0))/4294967296)>>>0:0)],j[o+40>>2]=Ye[0],j[o+44>>2]=Ye[1],j[o+48>>2]=4096,j[o+52>>2]=u.blocks,j[o+56>>2]=u.atime.getTime()/1e3|0,j[o+60>>2]=0,j[o+64>>2]=u.mtime.getTime()/1e3|0,j[o+68>>2]=0,j[o+72>>2]=u.ctime.getTime()/1e3|0,j[o+76>>2]=0,Ye=[u.ino>>>0,(Te=u.ino,+Math.abs(Te)>=1?Te>0?(Math.min(+Math.floor(Te/4294967296),4294967295)|0)>>>0:~~+Math.ceil((Te-+(~~Te>>>0))/4294967296)>>>0:0)],j[o+80>>2]=Ye[0],j[o+84>>2]=Ye[1],0},doMsync:function(r,i,o,u,l){var d=ye.slice(r,r+o);a.msync(i,d,l,o,u)},varargs:void 0,get:function(){Lt.varargs+=4;var r=j[Lt.varargs-4>>2];return r},getStr:function(r){var i=Pt(r);return i},getStreamFromFD:function(r){var i=a.getStream(r);if(!i)throw new a.ErrnoError(8);return i}};function Nc(r,i){var o=0;return xt().forEach(function(u,l){var d=i+o;Ee[r+l*4>>2]=d,Ou(u,d),o+=u.length+1}),0}function Dc(r,i){var o=xt();Ee[r>>2]=o.length;var u=0;return o.forEach(function(l){u+=l.length+1}),Ee[i>>2]=u,0}function Pc(r){try{var i=Lt.getStreamFromFD(r);return a.close(i),0}catch(o){if(typeof a=="undefined"||!(o instanceof a.ErrnoError))throw o;return o.errno}}function Uc(r,i){return i+2097152>>>0<4194305-!!r?(r>>>0)+i*4294967296:NaN}function Mc(r,i,o,u,l){try{var d=Uc(i,o);if(isNaN(d))return 61;var f=Lt.getStreamFromFD(r);return a.llseek(f,d,u),Ye=[f.position>>>0,(Te=f.position,+Math.abs(Te)>=1?Te>0?(Math.min(+Math.floor(Te/4294967296),4294967295)|0)>>>0:~~+Math.ceil((Te-+(~~Te>>>0))/4294967296)>>>0:0)],j[l>>2]=Ye[0],j[l+4>>2]=Ye[1],f.getdents&&d===0&&u===0&&(f.getdents=null),0}catch(h){if(typeof a=="undefined"||!(h instanceof a.ErrnoError))throw h;return h.errno}}function xc(r,i,o,u){for(var l=0,d=0;d<o;d++){var f=Ee[i>>2],h=Ee[i+4>>2];i+=8;var T=a.write(r,le,f,h,u);if(T<0)return-1;l+=T}return l}function Lc(r,i,o,u){try{var l=Lt.getStreamFromFD(r),d=xc(l,i,o);return Ee[u>>2]=d,0}catch(f){if(typeof a=="undefined"||!(f instanceof a.ErrnoError))throw f;return f.errno}}function ur(r,i){ur.randomDevice||(ur.randomDevice=wi());for(var o=0;o<i;o++)le[r+o>>0]=ur.randomDevice();return 0}function cr(r){return r%4===0&&(r%100!==0||r%400===0)}function kc(r,i){for(var o=0,u=0;u<=i;o+=r[u++]);return o}var Ni=[31,29,31,30,31,30,31,31,30,31,30,31],Di=[31,28,31,30,31,30,31,31,30,31,30,31];function Vc(r,i){for(var o=new Date(r.getTime());i>0;){var u=cr(o.getFullYear()),l=o.getMonth(),d=(u?Ni:Di)[l];if(i>d-o.getDate())i-=d-o.getDate()+1,o.setDate(1),l<11?o.setMonth(l+1):(o.setMonth(0),o.setFullYear(o.getFullYear()+1));else return o.setDate(o.getDate()+i),o}return o}function Fc(r,i,o,u){var l=j[u+40>>2],d={tm_sec:j[u>>2],tm_min:j[u+4>>2],tm_hour:j[u+8>>2],tm_mday:j[u+12>>2],tm_mon:j[u+16>>2],tm_year:j[u+20>>2],tm_wday:j[u+24>>2],tm_yday:j[u+28>>2],tm_isdst:j[u+32>>2],tm_gmtoff:j[u+36>>2],tm_zone:l?Pt(l):""},f=Pt(o),h={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var T in h)f=f.replace(new RegExp(T,"g"),h[T]);var I=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],q=["January","February","March","April","May","June","July","August","September","October","November","December"];function H(b,W,re){for(var ue=typeof b=="number"?b.toString():b||"";ue.length<W;)ue=re[0]+ue;return ue}function U(b,W){return H(b,W,"0")}function L(b,W){function re(Me){return Me<0?-1:Me>0?1:0}var ue;return(ue=re(b.getFullYear()-W.getFullYear()))===0&&(ue=re(b.getMonth()-W.getMonth()))===0&&(ue=re(b.getDate()-W.getDate())),ue}function B(b){switch(b.getDay()){case 0:return new Date(b.getFullYear()-1,11,29);case 1:return b;case 2:return new Date(b.getFullYear(),0,3);case 3:return new Date(b.getFullYear(),0,2);case 4:return new Date(b.getFullYear(),0,1);case 5:return new Date(b.getFullYear()-1,11,31);case 6:return new Date(b.getFullYear()-1,11,30)}}function ne(b){var W=Vc(new Date(b.tm_year+1900,0,1),b.tm_yday),re=new Date(W.getFullYear(),0,4),ue=new Date(W.getFullYear()+1,0,4),Me=B(re),M=B(ue);return L(Me,W)<=0?L(M,W)<=0?W.getFullYear()+1:W.getFullYear():W.getFullYear()-1}var Q={"%a":function(b){return I[b.tm_wday].substring(0,3)},"%A":function(b){return I[b.tm_wday]},"%b":function(b){return q[b.tm_mon].substring(0,3)},"%B":function(b){return q[b.tm_mon]},"%C":function(b){var W=b.tm_year+1900;return U(W/100|0,2)},"%d":function(b){return U(b.tm_mday,2)},"%e":function(b){return H(b.tm_mday,2," ")},"%g":function(b){return ne(b).toString().substring(2)},"%G":function(b){return ne(b)},"%H":function(b){return U(b.tm_hour,2)},"%I":function(b){var W=b.tm_hour;return W==0?W=12:W>12&&(W-=12),U(W,2)},"%j":function(b){return U(b.tm_mday+kc(cr(b.tm_year+1900)?Ni:Di,b.tm_mon-1),3)},"%m":function(b){return U(b.tm_mon+1,2)},"%M":function(b){return U(b.tm_min,2)},"%n":function(){return`
|
|
16
|
+
`},"%p":function(b){return b.tm_hour>=0&&b.tm_hour<12?"AM":"PM"},"%S":function(b){return U(b.tm_sec,2)},"%t":function(){return" "},"%u":function(b){return b.tm_wday||7},"%U":function(b){var W=b.tm_yday+7-b.tm_wday;return U(Math.floor(W/7),2)},"%V":function(b){var W=Math.floor((b.tm_yday+7-(b.tm_wday+6)%7)/7);if((b.tm_wday+371-b.tm_yday-2)%7<=2&&W++,W){if(W==53){var ue=(b.tm_wday+371-b.tm_yday)%7;ue!=4&&(ue!=3||!cr(b.tm_year))&&(W=1)}}else{W=52;var re=(b.tm_wday+7-b.tm_yday-1)%7;(re==4||re==5&&cr(b.tm_year%400-1))&&W++}return U(W,2)},"%w":function(b){return b.tm_wday},"%W":function(b){var W=b.tm_yday+7-(b.tm_wday+6)%7;return U(Math.floor(W/7),2)},"%y":function(b){return(b.tm_year+1900).toString().substring(2)},"%Y":function(b){return b.tm_year+1900},"%z":function(b){var W=b.tm_gmtoff,re=W>=0;return W=Math.abs(W)/60,W=W/60*100+W%60,(re?"+":"-")+String("0000"+W).slice(-4)},"%Z":function(b){return b.tm_zone},"%%":function(){return"%"}};f=f.replace(/%%/g,"\0\0");for(var T in Q)f.includes(T)&&(f=f.replace(new RegExp(T,"g"),Q[T](d)));f=f.replace(/\0\0/g,"%");var fe=kt(f,!1);return fe.length>i?0:(li(fe,r),fe.length-1)}function Bc(r,i,o,u){return Fc(r,i,o,u)}ju(),yi=t.BindingError=Si(Error,"BindingError"),Xu=t.InternalError=Si(Error,"InternalError"),rc();var Pi=function(r,i,o,u){r||(r=this),this.parent=r,this.mount=r.mount,this.mounted=null,this.id=a.nextInode++,this.name=i,this.mode=o,this.node_ops={},this.stream_ops={},this.rdev=u},_r=292|73,lr=146;Object.defineProperties(Pi.prototype,{read:{get:function(){return(this.mode&_r)===_r},set:function(r){r?this.mode|=_r:this.mode&=~_r}},write:{get:function(){return(this.mode&lr)===lr},set:function(r){r?this.mode|=lr:this.mode&=~lr}},isFolder:{get:function(){return a.isDir(this.mode)}},isDevice:{get:function(){return a.isChrdev(this.mode)}}}),a.FSNode=Pi,a.staticInit(),t.FS_createPath=a.createPath,t.FS_createDataFile=a.createDataFile,t.FS_createPreloadedFile=a.createPreloadedFile,t.FS_unlink=a.unlink,t.FS_createLazyFile=a.createLazyFile,t.FS_createDevice=a.createDevice;function kt(r,i,o){var u=o>0?o:Kr(r)+1,l=new Array(u),d=jr(r,l,0,l.length);return i&&(l.length=d),l}var qc={f:Fu,e:Gu,o:Wu,l:Ju,y:nc,i:oc,c:ac,b:uc,h:cc,g:_c,m:lc,k:dc,w:pc,d:mc,v:Ai,a:yc,x:bc,t:Oc,r:Nc,s:Dc,u:Pc,n:Mc,j:Lc,p:ur,q:Bc},Td=ku(),Hc=t.___wasm_call_ctors=function(){return(Hc=t.___wasm_call_ctors=t.asm.A).apply(null,arguments)},Gc=t._CreateMediaProcessing=function(){return(Gc=t._CreateMediaProcessing=t.asm.B).apply(null,arguments)},Wc=t._ReleaseMediaProcessing=function(){return(Wc=t._ReleaseMediaProcessing=t.asm.C).apply(null,arguments)},jc=t._AddAudioChannel=function(){return(jc=t._AddAudioChannel=t.asm.D).apply(null,arguments)},Kc=t._DelAudioChannel=function(){return(Kc=t._DelAudioChannel=t.asm.E).apply(null,arguments)},Yc=t._AddVideoChannel=function(){return(Yc=t._AddVideoChannel=t.asm.F).apply(null,arguments)},zc=t._DelVideoChannel=function(){return(zc=t._DelVideoChannel=t.asm.G).apply(null,arguments)},$c=t._ReceivedRawAudioPacket=function(){return($c=t._ReceivedRawAudioPacket=t.asm.H).apply(null,arguments)},Qc=t._ReceivedAudioUdtPacket=function(){return(Qc=t._ReceivedAudioUdtPacket=t.asm.I).apply(null,arguments)},Ui=t._fflush=function(){return(Ui=t._fflush=t.asm.J).apply(null,arguments)},Xc=t._ParseUdtAudioPacket=function(){return(Xc=t._ParseUdtAudioPacket=t.asm.K).apply(null,arguments)},Jc=t._ReceivedVideoPacket=function(){return(Jc=t._ReceivedVideoPacket=t.asm.L).apply(null,arguments)},Zc=t._SetAudioBuffer10Ms=function(){return(Zc=t._SetAudioBuffer10Ms=t.asm.M).apply(null,arguments)},e_=t._GetAudioFrame=function(){return(e_=t._GetAudioFrame=t.asm.N).apply(null,arguments)},t_=t._GetAudioFrameFloat=function(){return(t_=t._GetAudioFrameFloat=t.asm.O).apply(null,arguments)},r_=t._GetAudioMixedFloat=function(){return(r_=t._GetAudioMixedFloat=t.asm.P).apply(null,arguments)},n_=t._GetAudioEnergy=function(){return(n_=t._GetAudioEnergy=t.asm.Q).apply(null,arguments)},i_=t._SetAudioFrameFormat=function(){return(i_=t._SetAudioFrameFormat=t.asm.R).apply(null,arguments)},o_=t._SetAudioOutStreamFormat=function(){return(o_=t._SetAudioOutStreamFormat=t.asm.S).apply(null,arguments)},s_=t._AudioProcess=function(){return(s_=t._AudioProcess=t.asm.T).apply(null,arguments)},a_=t._AudioProcessFloat=function(){return(a_=t._AudioProcessFloat=t.asm.U).apply(null,arguments)},u_=t._AudioReverseProcessFloat=function(){return(u_=t._AudioReverseProcessFloat=t.asm.V).apply(null,arguments)},c_=t._InitOpusEncoder=function(){return(c_=t._InitOpusEncoder=t.asm.W).apply(null,arguments)},__=t._SetOpusEncBitrate=function(){return(__=t._SetOpusEncBitrate=t.asm.X).apply(null,arguments)},l_=t._OpusEncode=function(){return(l_=t._OpusEncode=t.asm.Y).apply(null,arguments)},d_=t._UpdateStreamSync=function(){return(d_=t._UpdateStreamSync=t.asm.Z).apply(null,arguments)},f_=t._GetEncodedFrame=function(){return(f_=t._GetEncodedFrame=t.asm._).apply(null,arguments)},p_=t._GetReceivedVideoStat=function(){return(p_=t._GetReceivedVideoStat=t.asm.$).apply(null,arguments)},m_=t._CreateUdtPacketizer=function(){return(m_=t._CreateUdtPacketizer=t.asm.aa).apply(null,arguments)},h_=t._PacketizeVideoUdt=function(){return(h_=t._PacketizeVideoUdt=t.asm.ba).apply(null,arguments)},E_=t._PacketizeAudioUdt=function(){return(E_=t._PacketizeAudioUdt=t.asm.ca).apply(null,arguments)},R_=t._GetRetransPacket=function(){return(R_=t._GetRetransPacket=t.asm.da).apply(null,arguments)},T_=t._CheckMissingPacket=function(){return(T_=t._CheckMissingPacket=t.asm.ea).apply(null,arguments)},g_=t._UseAINS=function(){return(g_=t._UseAINS=t.asm.fa).apply(null,arguments)},dr=t._malloc=function(){return(dr=t._malloc=t.asm.ha).apply(null,arguments)},it=t._free=function(){return(it=t._free=t.asm.ia).apply(null,arguments)},v_=t.___getTypeName=function(){return(v_=t.___getTypeName=t.asm.ja).apply(null,arguments)},S_=t.___embind_register_native_and_builtin_types=function(){return(S_=t.___embind_register_native_and_builtin_types=t.asm.ka).apply(null,arguments)},y_=t._emscripten_stack_init=function(){return(y_=t._emscripten_stack_init=t.asm.la).apply(null,arguments)},Mi=t.stackSave=function(){return(Mi=t.stackSave=t.asm.ma).apply(null,arguments)},xi=t.stackRestore=function(){return(xi=t.stackRestore=t.asm.na).apply(null,arguments)},rn=t.stackAlloc=function(){return(rn=t.stackAlloc=t.asm.oa).apply(null,arguments)},Li=t.___cxa_is_pointer_type=function(){return(Li=t.___cxa_is_pointer_type=t.asm.pa).apply(null,arguments)};t.ccall=x,t.cwrap=gu,t.addRunDependency=sr,t.removeRunDependency=Mt,t.FS_createPath=a.createPath,t.FS_createDataFile=a.createDataFile,t.FS_createPreloadedFile=a.createPreloadedFile,t.FS_createLazyFile=a.createLazyFile,t.FS_createDevice=a.createDevice,t.FS_unlink=a.unlink,t.addFunction=D,t.removeFunction=P;var fr;Ut=function r(){fr||nn(),fr||(Ut=r)};function nn(r){if(r=r||m,lt>0||(Cu(),lt>0))return;function i(){fr||(fr=!0,t.calledRun=!0,!si&&(Nu(),s(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),Du()))}t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),i()},1)):i()}if(t.run=nn,t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return nn(),t.ready}})(),Uo=V_;var G=navigator&&navigator.userAgent||"",Mo=/AppleWebKit\/([\d.]+)/i.exec(G),F_=Mo?parseFloat(Mo.pop()):null,Rn=/iPad/i.test(G),xo=/iPhone/i.test(G)&&!Rn,B_=/iPod/i.test(G),Lo=xo||Rn||B_,Tf=Lo&&function(){let n=G.match(/OS (\d+)_/i);return n&&n[1]?n[1]:null}(),jt=/Android/i.test(G),ko=jt&&function(){let n=G.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!n)return null;let e=n[1]&&parseFloat(n[1]),t=n[2]&&parseFloat(n[2]);return e&&t?parseFloat(n[1]+"."+n[2]):e||null}(),gf=jt&&/webkit/i.test(G)&&ko<2.3,vf=jt&&ko<5&&F_<537,q_=/Firefox/i.test(G),Sf=q_&&function(){let n=G.match(/Firefox\/(\d+)/);return n&&n[1]?parseFloat(n[1]):null}(),Vo=/Edge\//i.test(G),yf=Vo&&function(){var n=G.match(/Edge\/(\d+)/i);if(n&&n[1])return n[1]}(),Fo=/Edg\//i.test(G),bf=Fo&&function(){let n=G.match(/Edg\/(\d+)/);return n&&n[1]?parseFloat(n[1]):null}(),Bo=/SogouMobileBrowser\//i.test(G),Af=Bo&&function(){let n=G.match(/SogouMobileBrowser\/(\d+)/);return n&&n[1]?parseFloat(n[1]):null}(),qo=/MetaSr\s/i.test(G),If=qo&&function(){let n=G.match(/MetaSr(\s\d+(\.\d+)+)/);return n&&n[1]?parseFloat(n[1]):null}(),pt=/TBS\/\d+/i.test(G),Of=pt&&function(){var n=G.match(/TBS\/(\d+)/i);if(n&&n[1])return n[1]}(),Ho=/XWEB\/\d+/i.test(G),wf=Ho&&function(){var n=G.match(/XWEB\/(\d+)/i);if(n&&n[1])return n[1]}(),Cf=/MSIE\s8\.0/.test(G),H_=/MSIE\/\d+/i.test(G),Nf=H_&&function(){let n=/MSIE\s(\d+)\.\d/.exec(G),e=n&&parseFloat(n[1]);return!e&&/Trident\/7.0/i.test(G)&&/rv:11.0/.test(G)&&(e=11),e}(),G_=/(micromessenger|webbrowser)/i.test(G),Df=G_&&function(){var n=G.match(/MicroMessenger\/(\d+)/i);if(n&&n[1])return n[1]}(),Go=!pt&&/MQQBrowser\/\d+/i.test(G)&&/COVC\/\d+/i.test(G),Wo=!pt&&/MQQBrowser\/\d+/i.test(G)&&!/COVC\/\d+/i.test(G),Pf=(Wo||Go)&&function(){let n=G.match(/ MQQBrowser\/([\d.]+)/);return n&&n[1]?n[1]:null}(),jo=!pt&&/ QQBrowser\/\d+/i.test(G),Uf=jo&&function(){let n=G.match(/ QQBrowser\/([\d.]+)/);return n&&n[1]?n[1]:null}(),Ko=!pt&&/QQBrowserLite\/\d+/i.test(G),Mf=Ko&&function(){let n=G.match(/QQBrowserLite\/([\d.]+)/);return n&&n[1]?n[1]:null}(),Yo=!pt&&/MQBHD\/\d+/i.test(G),xf=Yo&&function(){let n=G.match(/MQBHD\/([\d.]+)/);return n&&n[1]?n[1]:null}(),W_=/Windows/i.test(G),j_=!Lo&&/MAC OS X/i.test(G),K_=!jt&&/Linux/i.test(G),Lf=/MicroMessenger/i.test(G),kf=/UCBrowser/i.test(G),Vf=/Electron/i.test(G),zo=/MiuiBrowser/i.test(G),Ff=zo&&function(){let n=G.match(/MiuiBrowser\/([\d.]+)/);return n&&n[1]?n[1]:null}(),$o=/HuaweiBrowser/i.test(G),Bf=/Huawei/i.test(G),qf=$o&&function(){let n=G.match(/HuaweiBrowser\/([\d.]+)/);return n&&n[1]?n[1]:null}(),Qo=/SamsungBrowser/i.test(G),Hf=Qo&&function(){let n=G.match(/SamsungBrowser\/([\d.]+)/);return n&&n[1]?n[1]:null}(),Xo=/HeyTapBrowser/i.test(G),Gf=Xo&&function(){let n=G.match(/HeyTapBrowser\/([\d.]+)/);return n&&n[1]?n[1]:null}(),Jo=/VivoBrowser/i.test(G),Wf=Jo&&function(){let n=G.match(/VivoBrowser\/([\d.]+)/);return n&&n[1]?n[1]:null}(),Y_=/Chrome/i.test(G),Tn=!Vo&&!qo&&!Bo&&!pt&&!Ho&&!Fo&&!jo&&!zo&&!$o&&!Qo&&!Xo&&!Jo&&/Chrome/i.test(G),jf=Tn&&function(){let n=G.match(/Chrome\/(\d+)/);return n&&n[1]?parseFloat(n[1]):null}(),z_=Tn&&function(){let n=G.match(/Chrome\/([\d.]+)/);return n&&n[1]?n[1]:null}(),Zo=!Y_&&!Wo&&!Go&&!Ko&&!Yo&&/Safari/i.test(G);var $_=Zo&&function(){let n=G.match(/Version\/([\d.]+)/);return n&&n[1]?n[1]:null}(),Kf=Tn?"Chrome/"+z_:Zo?"Safari/"+$_:"NotSupportedBrowser",es=location.protocol==="file:"||location.hostname==="localhost"||/^\d+\.\d+\.\d+\.\d+$/.test(location.hostname),ts="",Tr="",rs=!0;var ns=void 0,We=(()=>{let n;return()=>n||(n=typeof window!="undefined"&&window.localStorage!==null)})();var gn=console.debug;ns||(console.debug=()=>{});function X_(n,e,t){return`${n}.${Math.min(15,e)}.${Math.min(15,t)}.${e.toString().padStart(2,"0")}${t.toString().padStart(2,"0")}`}var is=X_(1,2,23),zf=(()=>{let[n,e,t,s]=is.split(".");return`${n}.${parseInt(s.substring(0,2),10)}.${parseInt(s.substring(2),10)}`})(),Ot={useWt:rs,hardwareAcceleration:"prefer-hardware"},os=!1;var ss=Tr||ts||"",$f=ss+"worker.js",as=ss+"av_processing.wasm";var vn="",us="https://yun.tim.qq.com",cs="https://videoapi-sgp.im.qcloud.com",Kt={LOG:"jssdk_log",EVENT:"jssdk_event",KEY_POINT:"jssdk_new_endreport"};var _s="main",ls="auxiliary";var ds=30;var fs=12e3;var ps=7*24*3600*1e3;var Bl=ft(zt());var Fl=ft(zt());var Ip=new Date().getTime(),Ll=0;var $t=function(){return new Date().getTime()+Ll},wr=function(){let n=new Date;return n.setTime($t()),n.toLocaleString()};function ha(n,e=1,t=1){return n<=1?t:ha(n-1,t,e+t)}function Ea(n){let e=Math.round(n/2)+1;return e>6?13*1e3:ha(e)*1e3}var Cr=n=>typeof n=="function";var mt=n=>typeof n=="string",Ra=n=>typeof n=="number";function Vn(n,e="big"){if(!mt(n))return 0;let t=n.split(".");return e==="big"?(Number(t[0])<<24|Number(t[1])<<16|Number(t[2])<<8|Number(t[3]))>>>0:(Number(t[3])<<24|Number(t[2])<<16|Number(t[1])<<8|Number(t[0]))>>>0}var kl={IS_LOCAL:location.protocol==="file:"||location.hostname==="localhost"||/^\d+\.\d+\.\d+\.\d+$/.test(location.hostname)};var ql=n=>Number(n)<14e8,Qt=function(n,e){let t;vn?t=vn:t=ql(n)?cs:us;let s=Math.floor(Math.random()*2**31);return`${t}/v5/AVQualityReportSvc/C2S?random=${s}&sdkappid=${n}&cmdtype=${e}`};function Ta(n,e=48e3){return Hl(n/4,e)}function Hl(n,e=48e3){return n*1e3/e}var Yp=typeof window!="undefined"&&typeof window.glog=="function"?window.glog:()=>{};var Gl=function(){var n=function(){},e="undefined",t=["trace","debug","info","warn","error"];function s(y,w){var F=y[w];if(Cr(F.bind))return F.bind(y);try{return Function.prototype.bind.call(F,y)}catch(O){return function(){return Function.prototype.apply.apply(F,[y,arguments])}}}function c(y){return y==="debug"&&(y="log"),typeof console===e?!1:console[y]!==void 0?s(console,y):console.log!==void 0?s(console,"log"):n}function _(y,w){for(var F=0;F<t.length;F++){var O=t[F];this[O]=this.methodFactory(O,y,w)}this.log=this.debug}function m(y,w,F){return function(){typeof console!==e&&(_.call(this,w,F),this[y].apply(this,arguments))}}function p(y,w,F){return c(y)||m.apply(this,arguments)}function E(y,w,F){var O=this,V,Y="loglevel";y&&(Y+=":"+y);function te(R){var k=(t[R]||"silent").toUpperCase();if(typeof window!==e)try{We()&&(window.localStorage[Y]=k);return}catch(A){}}function he(){var R;if(typeof window!==e){try{We()&&(R=window.localStorage[Y])}catch(k){}return O.levels[R]===void 0&&(R=void 0),R}}O.name=y,O.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},O.methodFactory=F||p,O.getLevel=function(){return V},O.setLevel=function(R,k){if(mt(R)&&O.levels[R.toUpperCase()]!==void 0&&(R=O.levels[R.toUpperCase()]),Ra(R)&&R>=0&&R<=O.levels.SILENT){if(V=R,k!==!1&&te(R),_.call(O,R,y),typeof console===e&&R<O.levels.SILENT)return"No console available for logging"}else throw"log.setLevel() called with invalid level: "+R},O.setDefaultLevel=function(R){he()||O.setLevel(R,!1)},O.enableAll=function(R){O.setLevel(O.levels.TRACE,R)},O.disableAll=function(R){O.setLevel(O.levels.SILENT,R)};var ce=he();ce==null&&(ce=w==null?"WARN":w),O.setLevel(ce,!1)}var g=new E,S={};return g.getLogger=function(w){if(!mt(w)||w==="")throw new TypeError("You must supply a name when creating a logger.");var F=S[w];return F||(F=S[w]=new E(w,g.getLevel(),g.methodFactory)),F},g.noConflict=function(){return g},g.getLoggers=function(){return S},g}(),be=Gl;var ya=ft(zt());var ga=X(At(250),Be(()=>performance.now()),at()),xe=n=>e=>{let t=0,s=performance.now();X(ga,Be(c=>(c-s)/n>>0),Xe(c=>c!=t?(t=c,!0):!1))(e)},Je=n=>e=>{let t=performance.now();X(ga,uo(s=>s-t<n),to(1))(e)};function Fn(n,e=!1){let t=Object.assign(bt(),{postMessage:n.postMessage.bind(n),get port(){return n}});return n.onmessage=s=>{s.data?s.ports.length||e?t.next(s):t.next(s.data):(t.complete(),n.close())},n.onmessageerror=s=>{t.error(s),n.close()},t}var va=class extends K{constructor(e,...t){super(e);v(this,"videoEncoder",[]);v(this,"encoderConfig",[]);v(this,"insertKeyFrame",[!0,!0]);let s=(_,m)=>{let p=[m,null];this.videoEncoder[m]=new VideoEncoder({output(E){p[1]=E,e.next(p)},error(E){console.error(E,_),setTimeout(()=>s(_,m),100)}}),this.videoEncoder[m].configure(_)},c=t.map((_,m)=>X(_,se(p=>{typeof p=="boolean"?p&&(this.insertKeyFrame[m]=p):(this.encoderConfig[m]=p,this.videoEncoder[m]?this.videoEncoder[m].configure(p):s(p,m))})));this.defer(()=>c.forEach(_=>_.dispose()))}next(e){this.videoEncoder.forEach((t,s)=>{let c=this.insertKeyFrame[s];if(t.state=="configured"){if(s){let _=e.clone();t.encode(_,{keyFrame:c}),_.close()}else(e.displayWidth!=this.encoderConfig[s].width||e.displayHeight!=this.encoderConfig[s].height)&&(this.encoderConfig[s].width=e.displayWidth,this.encoderConfig[s].height=e.displayHeight,t.configure(this.encoderConfig[s])),t.encode(e,{keyFrame:c});this.insertKeyFrame[s]=!1}}),e.close()}complete(){this.videoEncoder.forEach(e=>e.close()),super.complete()}error(e){this.videoEncoder.forEach(t=>t.close()),super.error(e)}},Sa=class extends K{constructor(e,t){super(e);let s=new K(e);s.next=oe,t(s)}},ht=z(Sa,"takeUntilComplete"),nm=z(va,"videoEncoder");var Bn;function ba(n){try{return JSON.stringify(n)}catch(e){if(!Bn)try{let t={};t.a=t,JSON.stringify(t)}catch(t){Bn=t.message}if(e.message===Bn)return"[Circular]";throw e}}function Wl(n){if(!Object.getOwnPropertyDescriptor||!Object.getPrototypeOf)return Object.prototype.toString.call(n).slice(8,-1);for(;n;){let e=Object.getOwnPropertyDescriptor(n,"constructor");if(e!==void 0&&Cr(e.value)&&e.value.name!=="")return e.value.name;n=Object.getPrototypeOf(n)}return""}function jl(n){let e="",t=0;return n.length>1&&mt(n[0])&&(e=n[0].replace(/(%?)(%([sdjo]))/g,(s,c,_,m)=>{if(!c){t+=1;let p=n[t],E="";switch(m){case"s":E+=p;break;case"d":E+=+p;break;case"j":E=ba(p);break;case"o":{let g=ba(p);g[0]!=="{"&&g[0]!=="["&&(g=`<${g}>`),E=Wl(p)+g;break}}return E}return s}),e=e.replace(/%{2,2}/g,"%"),t+=1),n.length>t&&(e&&(e+=" "),e+=n.slice(t).join(" ")),e}var{hasOwnProperty:Kl}=Object.prototype;function Aa(...n){let e={};for(let t=0;t<arguments.length;t+=1){let s=Object(arguments[t]);for(let c in s)Kl.call(s,c)&&(e[c]=typeof s[c]=="object"&&!Array.isArray(s[c])?Aa(e[c],s[c]):s[c])}return e}function Ia(){try{throw new Error}catch(n){return n.stack}}function Yl(n){let e=[],t=[];this.length=()=>e.length,this.sent=()=>t.length,this.push=s=>{e.push(s),e.length>n&&e.shift()},this.send=()=>(t.length||(t=e,e=[]),t),this.confirm=()=>{t=[],this.content=""},this.fail=()=>{e=t.concat(e),this.confirm();let s=1+e.length+t.length-n;s>0&&(t.splice(0,s),e=t.concat(e),this.confirm())}}var zl=!!Ia(),Ke,qn,Hn;function Oa(n){return`[${n.timestamp}] <${n.level.label.toUpperCase()}>${n.logger?` (${n.logger})`:""}: ${n.message}${n.stacktrace?`
|
|
17
|
+
${n.stacktrace}`:""}`}function $l(n){return n.level=n.level.label,n}var Ql=500,Xl={interval:1e3,level:"trace",capacity:0,stacktrace:{levels:["trace","warn","error"],depth:3,excess:0},timestamp:()=>new Date().toISOString(),format:Oa},wa,Nr=!1,Gn="",Ca="",Na="",Jl={plain:Oa,json:$l,setConfig(n){Nr||(Gn=`${n.sdkAppId}`,Ca=`${n.userId}`,Na=`${n.version}`,Nr=!0)},apply(n,e){if(!n||!n.getLogger)throw new TypeError("Argument is not a root loglevel object");if(Ke)throw new Error("You can assign a plugin only one time");Ke=n;let t=Aa(Xl,e);t.capacity=t.capacity||Ql;let{interval:s}=t,c,_,m=new Yl(t.capacity);function p(E){if(!Nr)return;let g=JSON.stringify({timestamp:wr(),sdkAppId:Gn,userId:Ca,version:Na,log:E});ya.default.post(Qt(Gn,Kt.LOG),g,{timeout:5e3}).then(function(){m.confirm()}).catch(function(){m.fail()})}return wa=X(xe(s),se(()=>{if(!!Nr&&!m.sent()){if(!m.length())return;let E=m.send();m.content=_?`{"logs":[${E.join(",")}]}`:E.join(`
|
|
18
|
+
`),p(m.content)}})),qn=n.methodFactory,Hn=function(g,S,y){let w=qn(g,S,y),F=zl&&t.stacktrace.levels.some(V=>V===g),O=Ke.levels[g.toUpperCase()];return(...V)=>{let Y=jl(V),te=O>=S,he=!0;if(te){let ce=new Date;ce.setTime($t());let R=ce.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1")+`:${ce.getMilliseconds()}`,k="["+R+"] <"+g.toUpperCase()+"> "+Y;w.apply(void 0,[k])}if(he){let ce=wr(),R=F?Ia():"";if(R){let ee=R.split(`
|
|
19
|
+
`);ee.splice(0,t.stacktrace.excess+3);let{depth:ae}=t.stacktrace;ae&&ee.length!==ae+1?(R=ee.splice(0,ae).join(`
|
|
20
|
+
`),ee.length&&(R+=`
|
|
21
|
+
and ${ee.length} more`)):R=ee.join(`
|
|
22
|
+
`)}let k=t.format({message:Y,level:{label:g,value:O},logger:y||"",timestamp:ce,stacktrace:R});_===void 0&&(_=!mt(k),c=_?"application/json":"text/plain");let A="";if(_)try{A+=JSON.stringify(k)}catch(ee){w(...V),Ke.getLogger("logger").error(ee);return}else A+=k;m.push(A)}}},n.methodFactory=Hn,n.setLevel(n.getLevel()),n},disable(){if(!Ke)throw new Error("You can't disable a not appled plugin");if(Hn!==Ke.methodFactory)throw new Error("You can't disable a plugin after appling another plugin");Ke.methodFactory=qn,Ke.setLevel(Ke.getLevel()),Ke=void 0,wa.dispose()}},Dr=Jl;var Pr=!1;be.setLevel("INFO");var Zl=Object.assign(be,{setConfig(n){Dr.setConfig(n)},setLogLevel(n){console.info("TRTC LogLevel was set to: "+n,be),be.setLevel(n)},getLogLevel(){return be.getLevel()},enableUploadLog(){Pr||(be.info("enable upload log"),Dr.apply(be),Pr=!0)},disableUploadLog(){Pr&&(be.warn("disable upload log! Without log we are difficult to help you triage the issue you might run into!"),Dr.disable(),Pr=!1)}}),Ze=Zl;var Da;(function(n){n[n.TRTCVideoResolution_120_120=1]="TRTCVideoResolution_120_120",n[n.TRTCVideoResolution_160_160=3]="TRTCVideoResolution_160_160",n[n.TRTCVideoResolution_270_270=5]="TRTCVideoResolution_270_270",n[n.TRTCVideoResolution_480_480=7]="TRTCVideoResolution_480_480",n[n.TRTCVideoResolution_160_120=50]="TRTCVideoResolution_160_120",n[n.TRTCVideoResolution_240_180=52]="TRTCVideoResolution_240_180",n[n.TRTCVideoResolution_280_210=54]="TRTCVideoResolution_280_210",n[n.TRTCVideoResolution_320_240=56]="TRTCVideoResolution_320_240",n[n.TRTCVideoResolution_400_300=58]="TRTCVideoResolution_400_300",n[n.TRTCVideoResolution_480_360=60]="TRTCVideoResolution_480_360",n[n.TRTCVideoResolution_640_480=62]="TRTCVideoResolution_640_480",n[n.TRTCVideoResolution_960_720=64]="TRTCVideoResolution_960_720",n[n.TRTCVideoResolution_160_90=100]="TRTCVideoResolution_160_90",n[n.TRTCVideoResolution_256_144=102]="TRTCVideoResolution_256_144",n[n.TRTCVideoResolution_320_180=104]="TRTCVideoResolution_320_180",n[n.TRTCVideoResolution_480_270=106]="TRTCVideoResolution_480_270",n[n.TRTCVideoResolution_640_360=108]="TRTCVideoResolution_640_360",n[n.TRTCVideoResolution_960_540=110]="TRTCVideoResolution_960_540",n[n.TRTCVideoResolution_1280_720=112]="TRTCVideoResolution_1280_720",n[n.TRTCVideoResolution_1920_1080=114]="TRTCVideoResolution_1920_1080"})(Da||(Da={}));var Pa;(function(n){n[n.TRTCVideoResolutionModeLandscape=0]="TRTCVideoResolutionModeLandscape",n[n.TRTCVideoResolutionModePortrait=1]="TRTCVideoResolutionModePortrait"})(Pa||(Pa={}));var Ua;(function(n){n[n.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",n[n.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",n[n.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub"})(Ua||(Ua={}));var Ma;(function(n){n[n.TRTCQuality_Unknown=0]="TRTCQuality_Unknown",n[n.TRTCQuality_Excellent=1]="TRTCQuality_Excellent",n[n.TRTCQuality_Good=2]="TRTCQuality_Good",n[n.TRTCQuality_Poor=3]="TRTCQuality_Poor",n[n.TRTCQuality_Bad=4]="TRTCQuality_Bad",n[n.TRTCQuality_Vbad=5]="TRTCQuality_Vbad",n[n.TRTCQuality_Down=6]="TRTCQuality_Down"})(Ma||(Ma={}));var xa;(function(n){n[n.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",n[n.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit"})(xa||(xa={}));var La;(function(n){n[n.TRTCVideoRotation0=0]="TRTCVideoRotation0",n[n.TRTCVideoRotation90=1]="TRTCVideoRotation90",n[n.TRTCVideoRotation180=2]="TRTCVideoRotation180",n[n.TRTCVideoRotation270=3]="TRTCVideoRotation270"})(La||(La={}));var ka;(function(n){n[n.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",n[n.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature"})(ka||(ka={}));var Va;(function(n){n[n.TRTCVideoPixelFormat_Unknown=0]="TRTCVideoPixelFormat_Unknown",n[n.TRTCVideoPixelFormat_I420=1]="TRTCVideoPixelFormat_I420",n[n.TRTCVideoPixelFormat_BGRA32=3]="TRTCVideoPixelFormat_BGRA32"})(Va||(Va={}));var Fa;(function(n){n[n.TRTCVideoBufferType_Unknown=0]="TRTCVideoBufferType_Unknown",n[n.TRTCVideoBufferType_Buffer=1]="TRTCVideoBufferType_Buffer"})(Fa||(Fa={}));var Ba;(function(n){n[n.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",n[n.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",n[n.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable"})(Ba||(Ba={}));var qa;(function(n){n[n.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",n[n.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",n[n.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",n[n.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom"})(qa||(qa={}));var Ha;(function(n){n[n.TRTCRoleAnchor=20]="TRTCRoleAnchor",n[n.TRTCRoleAudience=21]="TRTCRoleAudience"})(Ha||(Ha={}));var Ga;(function(n){n[n.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",n[n.TRTCQosControlModeServer=1]="TRTCQosControlModeServer"})(Ga||(Ga={}));var Wa;(function(n){n[n.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",n[n.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear"})(Wa||(Wa={}));var ja;(function(n){n[n.TRTCAudioFrameFormatNone=0]="TRTCAudioFrameFormatNone",n[n.TRTCAudioFrameFormatPCM=1]="TRTCAudioFrameFormatPCM"})(ja||(ja={}));var Ka;(function(n){n[n.TRTCScreenCaptureSourceTypeUnknown=-1]="TRTCScreenCaptureSourceTypeUnknown",n[n.TRTCScreenCaptureSourceTypeWindow=0]="TRTCScreenCaptureSourceTypeWindow",n[n.TRTCScreenCaptureSourceTypeScreen=1]="TRTCScreenCaptureSourceTypeScreen",n[n.TRTCScreenCaptureSourceTypeCustom=2]="TRTCScreenCaptureSourceTypeCustom"})(Ka||(Ka={}));var Ya;(function(n){n[n.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",n[n.TRTCAudioQualityDefault=2]="TRTCAudioQualityDefault",n[n.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic"})(Ya||(Ya={}));var za;(function(n){n[n.TRTCLogLevelNone=0]="TRTCLogLevelNone",n[n.TRTCLogLevelVerbose=1]="TRTCLogLevelVerbose",n[n.TRTCLogLevelDebug=2]="TRTCLogLevelDebug",n[n.TRTCLogLevelInfo=3]="TRTCLogLevelInfo",n[n.TRTCLogLevelWarn=4]="TRTCLogLevelWarn",n[n.TRTCLogLevelError=5]="TRTCLogLevelError",n[n.TRTCLogLevelFatal=6]="TRTCLogLevelFatal"})(za||(za={}));var $a;(function(n){n[n.TRTCDeviceStateAdd=0]="TRTCDeviceStateAdd",n[n.TRTCDeviceStateRemove=1]="TRTCDeviceStateRemove",n[n.TRTCDeviceStateActive=2]="TRTCDeviceStateActive"})($a||($a={}));var Qa;(function(n){n[n.TRTCDeviceTypeUnknow=-1]="TRTCDeviceTypeUnknow",n[n.TRTCDeviceTypeMic=0]="TRTCDeviceTypeMic",n[n.TRTCDeviceTypeSpeaker=1]="TRTCDeviceTypeSpeaker",n[n.TRTCDeviceTypeCamera=2]="TRTCDeviceTypeCamera"})(Qa||(Qa={}));var Xa;(function(n){n[n.TRTCWaterMarkSrcTypeFile=0]="TRTCWaterMarkSrcTypeFile",n[n.TRTCWaterMarkSrcTypeBGRA32=1]="TRTCWaterMarkSrcTypeBGRA32",n[n.TRTCWaterMarkSrcTypeRGBA32=2]="TRTCWaterMarkSrcTypeRGBA32"})(Xa||(Xa={}));var Wn=class{constructor(e="",t=0){this.userId=e,this.volume=t}};var Ja;(function(n){n[n.TRTCTranscodingConfigMode_Unknown=0]="TRTCTranscodingConfigMode_Unknown",n[n.TRTCTranscodingConfigMode_Manual=1]="TRTCTranscodingConfigMode_Manual",n[n.TRTCTranscodingConfigMode_Template_PureAudio=2]="TRTCTranscodingConfigMode_Template_PureAudio",n[n.TRTCTranscodingConfigMode_Template_PresetLayout=3]="TRTCTranscodingConfigMode_Template_PresetLayout",n[n.TRTCTranscodingConfigMode_Template_ScreenSharing=4]="TRTCTranscodingConfigMode_Template_ScreenSharing",n[n.TRTC_TranscodingConfigMode_Unknown=5]="TRTC_TranscodingConfigMode_Unknown",n[n.TRTC_TranscodingConfigMode_Manual=6]="TRTC_TranscodingConfigMode_Manual",n[n.TRTC_TranscodingConfigMode_Template_PureAudio=7]="TRTC_TranscodingConfigMode_Template_PureAudio",n[n.TRTC_TranscodingConfigMode_Template_PresetLayout=8]="TRTC_TranscodingConfigMode_Template_PresetLayout",n[n.TRTC_TranscodingConfigMode_Template_ScreenSharing=9]="TRTC_TranscodingConfigMode_Template_ScreenSharing"})(Ja||(Ja={}));var Se=(x=>(x[x.JOIN_ROOM=0]="JOIN_ROOM",x[x.LEAVE_ROOM=1]="LEAVE_ROOM",x[x.PUBLISH=2]="PUBLISH",x[x.UNPUBLISH=3]="UNPUBLISH",x[x.SUBSCRIBE=4]="SUBSCRIBE",x[x.UNSUBSCRIBE=5]="UNSUBSCRIBE",x[x.GET_WHOLE_LIST=6]="GET_WHOLE_LIST",x[x.QUALITY_REPORT=7]="QUALITY_REPORT",x[x.MUTE=8]="MUTE",x[x.UNMUTE=9]="UNMUTE",x[x.CONFIG=10]="CONFIG",x[x.REQUEST_PLI=11]="REQUEST_PLI",x[x.HEARTBEAT=12]="HEARTBEAT",x[x.START_PUSH_CDN=13]="START_PUSH_CDN",x[x.STOP_PUSH_CDN=14]="STOP_PUSH_CDN",x[x.START_MCU_MIX=15]="START_MCU_MIX",x[x.STOP_MCU_MIX=16]="STOP_MCU_MIX",x[x.UDPATE_TRACK=17]="UDPATE_TRACK",x[x.START_PUSHING=18]="START_PUSHING",x[x.STOP_PUSHING=19]="STOP_PUSHING",x[x.REBUILD_SESSION=20]="REBUILD_SESSION",x[x.WHOLE_LIST_UPDATE=255]="WHOLE_LIST_UPDATE",x[x.PEER_JOINED=256]="PEER_JOINED",x[x.PEER_LEFT=257]="PEER_LEFT",x[x.PEER_UDPATED_TRACK=258]="PEER_UDPATED_TRACK",x[x.SELECT_ABILITY=259]="SELECT_ABILITY",x[x.PEER_REQUEST_PLI=260]="PEER_REQUEST_PLI",x[x.AUDIO_DATA=4095]="AUDIO_DATA",x[x.VIDEO_DATA=4096]="VIDEO_DATA",x[x.SCREEN_DATA=4097]="SCREEN_DATA",x[x.NACK=4098]="NACK",x[x.ACK=4099]="ACK",x[x.REQUEST_RTT=4100]="REQUEST_RTT",x[x.RESPONSE_RTT=4101]="RESPONSE_RTT",x[x.PIP_DATA=4102]="PIP_DATA",x[x.LAYER_DATA=4103]="LAYER_DATA",x[x.MAX_FORCE=65535]="MAX_FORCE",x))(Se||{});function jn(n,e,t){let s=e>65535?1:0,c=0;return t.setUint8(0,c<<4|s),t.setUint16(1,n),s?t.setUint32(3,e):t.setUint16(3,e),s?7:5}function Xt(n,e){let t=n>=255&&n<4095;t&&(e+=4);let c=(e>65535?1:0)?7:5,_=new DataView(new ArrayBuffer(c+e));jn(n,e,_),t&&(_.setUint32(c,0),c+=4),_=new DataView(_.buffer,c),c=0;let m=w=>{_.setUint8(c,w),c++},p=w=>{_.setUint16(c,w),c+=2},E=(w,F=!1)=>{_.setUint32(c,w,F),c+=4},g=w=>{_.setBigUint64(c,w),c+=8},S=w=>{let F=new Uint8Array(_.buffer,_.byteOffset+c,w);return c+=w,F};return{write8:m,write32:E,write16:p,write64:g,writeData:w=>S(w.length).set(w),dv:_,next:S}}function Ur(n,e,t){let s=JSON.stringify(e),{writeData:c,dv:_}=Xt(n,s.length+16);switch(c(t.split("").map(m=>m.charCodeAt(0))),c(s.split("").map(m=>m.charCodeAt(0))),n){case 11:case 12:case 7:case 6:console.debug("send",Se[n],t,e,_.buffer);break;default:n<255&&console.log("send",Se[n],t,e,_.buffer)}return _.buffer}var eu=ft(Yn()),ke=class extends eu.EventEmitter{constructor(e){super();this.io=e}get statReportReq(){return this.io.statReportReq.stat}get qualityReport(){return this.io.qualityReportReq.report}get keyPointReport(){return this.io.keyPointReport}addEvent(e,t,s={}){this.io.addEvent(e,t,s)}get appId(){return this.io.joinReq.sdkAppID}get roomId(){return this.io.joinReq.roomid}get userId(){return this.io.joinRes.openid}get tinyId(){return this.io.joinRes.tinyid}get userMap_(){return this.io.userMap}send(e,t){return this.io.sendReq(e,t)}postMessage(e,t){this.io.postMessage({cmd:e,payload:t})}createResposeOb(e){return Le(this.io,Se[e])}};console.time(self.name+"Worker");var me={udtver:3,print(...n){console.debug(...n)},postRun:[]};Tr&&(me.locateFile=function(n,e){return as});var $=class{constructor(e,t){this.size=e;v(this,"point");this.point=me._malloc(e),t&&this.set(t)}set(e){e.length>this.size&&this.grow(e.length),me.HEAPU8.set(e,this.point)}setUint32(e,t){new DataView(me.HEAPU8.buffer).setUint32(this.point+e,t)}setBigUint64(e,t){new DataView(me.HEAPU8.buffer).setBigUint64(this.point+e,t)}getUint32(e){return me.HEAPU8[this.point+e]|me.HEAPU8[this.point+e+1]<<8|me.HEAPU8[this.point+e+2]<<16|me.HEAPU8[this.point+e+3]<<24}getInt8(e){return me.HEAPU8[this.point+e]}uint8Array(e=NaN){return new Uint8Array(me.HEAPU8.buffer,this.point,e>=0?e:this.size)}uint8Slice(e=NaN){return me.HEAPU8.slice(this.point,this.point+(e>=0?e:this.size))}free(){me._free(this.point)}grow(e){e>this.size&&(this.free(),this.size=e,this.point=me._malloc(e))}};v($,"global"),v($,"ready");$.ready=new Promise(n=>{self.name=="main"?me.postRun=()=>{$.global=new $(1920*1080*3>>1),me._CreateMediaProcessing(0,1,0,!1),console.timeEnd(self.name+"Worker"),me._UseAINS(!0),n(me)}:me.postRun=()=>{$.global=new $(1920*10),me._CreateMediaProcessing(0,1,0,!1),console.timeEnd(self.name+"Worker"),me._UseAINS(!0),n(me)}});var J=me;var rd=1200;var nd=1+2+4+2+8+4+4+4+2,id=4+1+1,od=1+1+1+1+1+1,Hm=1+1+1+1+12;var Gm={[4]:_s,[2]:ls},tu={[1]:1,["audio"]:1,["video"]:4,[2]:4,["auxVideo"]:2,[7]:2,[3]:8};var Wm=Date.now(),jm=nd+id+6+od+rd+1;var zn=class{constructor(e){v(this,"lastReceiveTime",-1);v(this,"blocking",!1);v(this,"blockCnt",0);v(this,"blockTime",0);v(this,"received",bt());let t=Je(e);X(this.received,Er(s=>(this.blockDone(),this.lastReceiveTime=Date.now(),t)),se(()=>{this.blocking=!0},oe,()=>{this.blockDone()}))}blockDone(){this.blocking&&(this.blockCnt++,this.blockTime+=Date.now()-this.lastReceiveTime,this.blocking=!1)}clear(){this.blockCnt=0,this.blockTime=0}},Xn=class{constructor(e=2){v(this,"videoStatus",{uint32_video_stream_type:2,uint32_video_codec_fps:0,uint32_video_capture_fps:0,uint32_video_receive_fps:0,uint32_video_width:0,uint32_video_height:0,uint32_video_codec_type:0,uint32_video_gop:0,uint32_video_rps_open:0,uint32_video_rps_interval:0,uint32_video_codec_bitrate:0,uint32_video_total_bitrate:0,uint32_video_fec_ratio:0,uint32_video_fec_recover:0,uint32_video_arq_request:0,uint32_video_arq_recover:0,uint32_video_arq_packets:0,uint32_video_receive:0,uint32_video_origin_lost:0,uint32_video_final_lost:0,uint32_video_block_cnt:0,uint32_video_cache_ms:0,uint32_video_total_frame:0,uint32_video_decode_frame:0,uint32_video_block_time:0,uint32_video_quality:0,uint32_video_jitter_fps:0});v(this,"videoPort");v(this,"control");v(this,"lastReceiveTime",-1);v(this,"vBlock",new zn(500));v(this,"ssrc",Xn.g_ssrc++);this.videoStatus.uint32_video_stream_type=e}getVideoStatus(){let e=ot({},this.videoStatus);return e.uint32_video_block_cnt=this.vBlock.blockCnt,e.uint32_video_block_time=this.vBlock.blockTime,e.uint32_video_codec_bitrate>>=1,e.uint32_video_total_bitrate>>=1,this.videoStatus.uint32_video_codec_bitrate=0,this.videoStatus.uint32_video_total_bitrate=0,this.videoStatus.uint32_video_receive_fps=0,this.videoStatus.uint32_video_capture_fps=0,this.videoStatus.uint32_video_codec_fps=0,this.vBlock.clear(),e}demuxPacket(e){let t=e.length,{ssrc:s,videoStatus:c,vBlock:_}=this;c.uint32_video_receive++;let m=Date.now();c.uint32_video_total_bitrate+=t<<3,$.global.set(e);let p=J._ReceivedVideoPacket($.global.point,t,m/1e3,m%1e3,s);p==0&&(this.lastReceiveTime>0&&m-this.lastReceiveTime>500&&console.debug("demuxPacket",m-this.lastReceiveTime),this.lastReceiveTime=m),_.received.next(p)}},xr=Xn;v(xr,"g_ssrc",1);var $n=class{constructor(e,t){this.port=e;v(this,"buffer",new $(960));v(this,"timestamp",0);J._SetAudioBuffer10Ms(this.buffer.point,t)}feed(){this.port.postMessage(new AudioData({format:"s16",numberOfChannels:1,numberOfFrames:480,sampleRate:48e3,timestamp:this.timestamp+=1e5,data:this.buffer.uint8Array()}))}close(){this.port.postMessage(null),this.buffer.free()}},Qn=class{constructor(e,t){this.io=t;v(this,"userId");v(this,"tinyId");v(this,"role");v(this,"muteState");v(this,"flag");v(this,"terminalType");v(this,"lastCapNtpMs",-1);v(this,"startTimestamp",Date.now());v(this,"alastReceivedTimestamp",-1);v(this,"lengthPoint",new $(4));v(this,"audioPuller");v(this,"mainPuller",new xr(2));v(this,"screenPuller",new xr(7));v(this,"aBlock",new zn(250));v(this,"events",[]);v(this,"msg_audio_status",{uint32_audio_format:0,uint32_audio_sample_rate:0,uint32_audio_codec_bitrate:0,uint32_audio_total_bitrate:0,uint32_audio_aec:0,uint32_audio_fec_ratio:0,uint32_audio_fec_recover:0,uint32_audio_arq_request:0,uint32_audio_arq_recover:0,uint32_audio_arq_packets:0,uint32_audio_receive:0,uint32_audio_origin_lost:0,uint32_audio_final_lost:0,uint32_audio_cache_ms:0,uint32_audio_capture_state:0,uint32_audio_filtered_max_cache_ms:0,uint32_audio_filtered_avg_cache_ms:0,uint32_audio_target_max_cache_ms:0,uint32_audio_target_avg_cache_ms:0,uint32_audio_delay_peak_count:0,uint32_audio_speed_percent:0,uint32_audio_quality:0,uint32_audio_block_time:0,uint32_audio_block_cnt:0,uint32_audio_level:0,uint32_audio_energy:0,uint32_audio_capture_energy:0,uint32_audio_play_energy:0});v(this,"subscribe");v(this,"removing");Object.assign(this,e)}remove(){var e;this.lengthPoint.free(),(e=this.audioPuller)==null||e.close()}toDownStreamInfo(e){let t=[this.mainPuller.getVideoStatus()];this.screenPuller.videoPort&&t.push(this.screenPuller.getVideoStatus());let s=ot({},this.msg_audio_status);return s.uint32_audio_codec_bitrate>>=1,s.uint32_audio_total_bitrate>>=1,s.uint32_audio_block_cnt=this.aBlock.blockCnt,s.uint32_audio_block_time=this.aBlock.blockTime,this.msg_audio_status.uint32_audio_total_bitrate=0,this.msg_audio_status.uint32_audio_codec_bitrate=0,this.aBlock.clear(),{msg_user_info:{str_identifier:e.userId,uint64_tinyid:Number(e.tinyId)},msg_audio_status:s,msg_video_status:t,msg_network_status:{uint32_bitrate:0,uint32_rtt:0,uint32_lost:0,uint32_jitter:0}}}getNextVideoFrame(e){var m;this.lengthPoint.setUint32(0,$.global.size);let t=J._GetEncodedFrame($.global.point,this.lengthPoint.point,!1,e.ssrc),s=this.lengthPoint.getUint32(0);if(t==-1||s==0)return 10;let c=$.global.uint8Array(s);e.videoStatus.uint32_video_total_frame||console.timeEnd(`${this.userId}${e==this.mainPuller?"big":"aux"}`),e.videoStatus.uint32_video_total_frame++,e.videoStatus.uint32_video_codec_bitrate+=s<<3,e.videoStatus.uint32_video_receive_fps++,e.videoStatus.uint32_video_capture_fps++;let _=c.slice();return(m=e.videoPort)==null||m.postMessage(_,[_.buffer]),e.videoStatus.uint32_video_decode_frame++,t}startPull(e,t,s){console.log("\u5F00\u59CB\u62C9\u6D41\uFF1A",e,Date.now());let _=e===this.mainPuller?[2,1]:[7];e.videoPort=t,X(t,se(({width:E,height:g})=>{e.videoStatus.uint32_video_width=E,e.videoStatus.uint32_video_height=g}));let m=E=>{e.videoPort=null,E?console.error("\u62C9\u6D41\u7ED3\u675F\uFF1A",E):console.log("\u62C9\u6D41\u7ED3\u675F\uFF1A",e),J._DelVideoChannel(e.ssrc),e.vBlock.received.complete(),s.mediaType&1&&(this.aBlock.received.complete(),J._DelAudioChannel(e.ssrc)),this.subscribe&=~s.mediaType};J._AddVideoChannel(e.ssrc,e.ssrc),s.mediaType&1&&J._AddAudioChannel(e.ssrc,e.ssrc);let p=0;X(this.io.wh.interval10ms,Xe(E=>(p<=0&&(p=this.getNextVideoFrame(e),p>500&&(p=20)),p-=10,Ot.useWt&&(E&1)==0&&!_.every(g=>{let S=J._CheckMissingPacket($.global.point,$.global.size,g,e.ssrc,this.io.rtt);return S>0&&($.global.setBigUint64(5,BigInt(this.tinyId)),this.io.send($.global.uint8Array(S))),S>=0}))),hr(()=>Je(2e3)),ht(t),se(()=>{this.io.sendReq(11,s)},m,m))}};var Lr=class extends ke{constructor(){super(...arguments);v(this,"audioReceivedBuff",new $(2048));v(this,"levelsMap",new Map);v(this,"energys",new $(500));v(this,"timestampBuff",new $(12))}["decodeAudio"](e,t){X(this.createResposeOb(4095),ht(t),se(({data:s})=>{let _=new DataView(s.buffer,s.byteOffset,s.byteLength).getBigUint64(9).toString();this.userMap_.has(_)&&(this.statReportReq.msg_net_stat_report.uint32_down_real_pkg++,this.statReportReq.msg_net_stat_report.uint32_down_recv_br+=s.byteLength,this.demuxPacket(s,this.userMap_.get(_),e&&t))})),e&&X(t,se(({timestamp:s,rtpTimestamp:c,seqNum:_,ssrc:m,data:p})=>{this.audioReceivedBuff.set(p),J._ReceivedRawAudioPacket(this.audioReceivedBuff.point,p.byteLength,s,c,_,m)}))}["getAudioTrack"]({tinyId:e},t){let s=this.userMap_.get(e);s&&(s.audioPuller=new $n(t,s.mainPuller.ssrc))}["getAudioEnergy"](e,t){J._GetAudioEnergy(this.energys.point,100),X(xe(e),De(t),se(()=>{let s=this.energys.getInt8(0);if(this.userMap_.size>0){let c=[...this.userMap_.values()];for(let _=1;_<5*s;_+=5)this.levelsMap.set(this.energys.getUint32(_),this.energys.getInt8(_+4));t.postMessage(c.map(_=>{let m=this.levelsMap.get(_.mainPuller.ssrc)||0;return _.msg_audio_status.uint32_audio_level=m,_.msg_audio_status.uint32_audio_energy=m,new Wn(_.userId,m)}))}else t.postMessage([])}))}demuxPacket(e,t,s){let{aBlock:c,msg_audio_status:_}=t;c.received.next(!0),_.uint32_audio_total_bitrate+=e.byteLength<<3,_.uint32_audio_codec_bitrate=_.uint32_audio_total_bitrate-31,this.audioReceivedBuff.set(e);let m=Date.now(),p=m/1e3,E=m%1e3;if(s){let g=J._ParseUdtAudioPacket(this.audioReceivedBuff.point,e.length,this.timestampBuff.point,this.timestampBuff.point+4,this.timestampBuff.point+8,this.audioReceivedBuff.point,t.mainPuller.ssrc);if(g>0){let S=this.audioReceivedBuff.getUint32(0),y=J.HEAPU8.slice(S,S+g);s.postMessage({timestamp:this.timestampBuff.getUint32(0),rtpTimestamp:this.timestampBuff.getUint32(4),seqNum:this.timestampBuff.getUint32(8),data:y,ssrc:t.mainPuller.ssrc},[y.buffer])}}else J._ReceivedAudioUdtPacket(this.audioReceivedBuff.point,e.length,p,E,t.mainPuller.ssrc)}};var sd=function(n,e,t,s){function c(_){return _ instanceof t?_:new t(function(m){m(_)})}return new(t||(t=Promise))(function(_,m){function p(S){try{g(s.next(S))}catch(y){m(y)}}function E(S){try{g(s.throw(S))}catch(y){m(y)}}function g(S){S.done?_(S.value):c(S.value).then(p,E)}g((s=s.apply(n,e||[])).next())})},ad=[[Uint8Array,Int8Array],[Uint16Array,Int16Array],[Uint32Array,Int32Array,Float32Array],[Float64Array]],Jn=Symbol(32),Zn=Symbol(16),ei=Symbol(8),ti=new Map;ad.forEach((n,e)=>n.forEach(t=>ti.set(t,e)));var et=class{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}fillFromReader(e){return sd(this,void 0,void 0,function*(){let{done:t,value:s}=yield e.read();if(t){this.close();return}else return this.write(s),this.fillFromReader(e)})}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return new Promise((t,s)=>{if(this.resolve)return s("last read not complete yet");this.resolve=c=>{delete this.resolve,delete this.need,t(c)},this.demand(e,!0)})}readU32(){return this.read(Jn)}readU16(){return this.read(Zn)}readU8(){return this.read(ei)}close(){this.g&&this.g.return()}flush(){if(!this.buffer||!this.need)return;let e=null,t=this.buffer.subarray(this.consumed),s=0,c=_=>t.length<(s=_);if(typeof this.need=="number"){if(c(this.need))return;e=t.subarray(0,s)}else if(this.need instanceof ArrayBuffer){if(c(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,s)),e=this.need}else if(this.need===Jn){if(c(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Zn){if(c(2))return;e=t[0]<<8|t[1]}else if(this.need===ei){if(c(1))return;e=t[0]}else if(ti.has(this.need.constructor)){if(c(this.need.length<<ti.get(this.need.constructor)))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,s)),e=this.need}else if(this.g){this.g.throw(new Error("Unsupported type"));return}return this.consumed+=s,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){e instanceof ArrayBuffer?this.malloc(e.byteLength).set(new Uint8Array(e)):this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),(this.g||this.resolve)&&this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,e&255]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,e&255]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){let t=this.buffer.length,s=t+e;if(s<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,s);else{let c=new Uint8Array(s);c.set(this.buffer),this.buffer=c}return this.buffer.subarray(t,s)}else return this.buffer=new Uint8Array(e),this.buffer}};et.U32=Jn;et.U16=Zn;et.U8=ei;function nu(n,e,t,s){let{sampleRate:c,numberOfChannels:_}=n,m=e?t:s,p=!0,E=0,g=c/100,S=g<<1;console.log("InitOpusEncoder",c,_),J._SetAudioFrameFormat(c,_),J._InitOpusEncoder(c,_,1);let y=new $(S<<2),w=y.point,F=new et;return F.buffer=y.uint8Array(0),O=>{if(!O){y.free();return}for(E==0&&(E=O.timestamp),O.copyTo(F.malloc(O.numberOfFrames<<2),{planeIndex:0}),O.close();;){let V=F.demand(g<<2);if(!V)return;let Y=J._AudioProcessFloat(V.byteOffset,g,this.delay);if(t.postMessage(Y),s.postMessage({volume:Y}),!p){let te=J._OpusEncode(w,S,w),he=y.uint8Array(te).slice();m.postMessage({data:he,timestamp:E},[he.buffer]),E=0,F.consume()}p=!p}}}var iu=ft(Yn(),1),ou=Symbol("instance"),er=Symbol("abortCtrl"),Nt=Symbol("cacheResult"),su=class{constructor(e,t,s){v(this,"oldState");v(this,"newState");v(this,"action");v(this,"error");this.oldState=e,this.newState=t,this.action=s}toString(){return`${this.action}ing`}},kr=class extends Error{constructor(e,t,s){super(t);v(this,"state");v(this,"message");v(this,"cause");this.state=e,this.message=t,this.cause=s}},tr=new Map,ud=Object.getPrototypeOf((async()=>{})()).constructor;function ve(n,e){return(t,s,c)=>{let _=s;tr.has(t)||(tr.set(t,[]),Object.defineProperty(t,"stateDiagram",{configurable:!0,get(){let p=new Set,E=[],g=[],S=tr.get(t),y=new Set;Object.defineProperty(t,"allStates",{value:y});let w=Object.getPrototypeOf(t);tr.has(w)&&(w.stateDiagram.forEach(O=>p.add(O)),w.allStates.forEach(O=>y.add(O))),S.forEach(({from:O,to:V,action:Y})=>{typeof O=="string"?E.push({from:O,to:V,action:Y}):O.length?O.forEach(te=>{E.push({from:te,to:V,action:Y})}):g.push({to:V,action:Y})}),E.forEach(({from:O,to:V,action:Y})=>{y.add(O),y.add(V),y.add(Y+"ing"),p.add(`${O} --> ${Y}ing : ${Y}`),p.add(`${Y}ing --> ${V} : ${Y} \u{1F7E2}`),p.add(`${Y}ing --> ${O} : ${Y} \u{1F534}`)}),g.forEach(({to:O,action:V})=>{p.add(`${V}ing --> ${O} : ${V} \u{1F7E2}`),y.forEach(Y=>{Y!==O&&p.add(`${Y} --> ${V}ing : ${V}`)})});let F=[...p];return Object.defineProperty(t,"stateDiagram",{value:F}),F}})),tr.get(t).push({from:n,to:e,action:_});let m=c.value;c.value=async function(...p){if(this.state===e)return this[Nt];if(Array.isArray(n)){if(n.length==0)this[er]&&(this[er].aborted=!0);else if(typeof this.state!="string"||!n.includes(this.state))throw new kr(this._state,`${this.name} ${_} to ${e} failed: current state ${this._state} not in from config`)}else if(n!==this.state)throw new kr(this._state,`${this.name} ${_} to ${e} failed: current state ${this._state} not from ${n}`);let E=this.state;ri.call(this,new su(E,e,_));let g={aborted:!1};this[er]=g;try{let S=m.apply(this,p);return S instanceof ud?this[Nt]=await S:this[Nt]=S,g.aborted?this[Nt]:(this[er]=void 0,ri.call(this,e),this[Nt])}catch(S){let y=S instanceof Error?S.message:String(S);throw ri.call(this,E,y),new kr(this._state,`action '${_}' failed :${y}`,S instanceof Error?S:new Error(y))}}}}var cd=(()=>typeof window!="undefined"&&window.__AFSM__?(t,s)=>{window.dispatchEvent(new CustomEvent(t,{detail:s}))}:typeof importScripts!="undefined"?(t,s)=>{postMessage({type:t,payload:s})}:()=>{})();function ri(n,e){let t=this._state;this._state=n;let s=n.toString();n&&this.emit(s,t),this.emit(pe.STATECHANGED,n,t,e),this.updateDevTools({value:n,old:t,err:e})}var bh,Ah,Vr=class extends iu.default{constructor(e,t){super();v(this,"name");v(this,"groupName");v(this,"_state",Vr.INIT);v(this,bh);v(this,Ah);this.name=e,this.groupName=t,e||(e=Date.now().toString(36));let s=Object.getPrototypeOf(this);t||(this.groupName=this.constructor.name);let c=s[ou];c?this.name=c.name+"-"+c.count++:s[ou]={name:this.name,count:0},this.updateDevTools({diagram:this.stateDiagram})}get stateDiagram(){return[]}updateDevTools(e={}){cd(Vr.UPDATEAFSM,ot({name:this.name,group:this.groupName},e))}get state(){return this._state}},pe=Vr;bh=Nt,Ah=er,v(pe,"STATECHANGED","stateChanged"),v(pe,"UPDATEAFSM","updateAFSM"),v(pe,"INIT","[*]"),v(pe,"ON","on"),v(pe,"OFF","off");var _u=ft(zt());var Rt={STREAM_ADDED:"stream-added",STREAM_REMOVED:"stream-removed",STREAM_UPDATED:"stream-updated",STREAM_SUBSCRIBED:"stream-subscribed",CONNECTION_STATE_CHANGED:"connection-state-changed",PEER_JOIN:"peer-join",PEER_LEAVE:"peer-leave",MUTE_AUDIO:"mute-audio",MUTE_VIDEO:"mute-video",UNMUTE_AUDIO:"unmute-audio",UNMUTE_VIDEO:"unmute-video",CLIENT_BANNED:"client-banned",NETWORK_QUALITY:"network-quality",AUDIO_VOLUME:"audio-volume",ERROR:"error"};var au=class{constructor(){v(this,"prefix_","TRTC");v(this,"queue_",new Map);v(this,"intervalId_",setInterval(this.doFlush.bind(this),2e4));this.checkStorage()}getRealKey(e){return`${this.prefix_}_${e}`}checkStorage(){if(!We())return;Object.keys(localStorage).filter(s=>{if(s.startsWith(this.prefix_)){let c=JSON.parse(localStorage.getItem(s));if(c&&c.expiresIn<Date.now())return!0}return!1}).forEach(s=>localStorage.removeItem(s))}doFlush(){if(!!We())try{for(let[e,t]of this.queue_)localStorage.setItem(e,JSON.stringify(t))}catch(e){be.warn(e)}}getItem(e){if(!We())return null;try{let t=JSON.parse(localStorage.getItem(this.getRealKey(e)));return t&&t.expiresIn>=Date.now()?t.value:null}catch(t){be.warn(t)}}setItem(e,t){if(!!We())try{let s={expiresIn:Date.now()+ps,value:t};this.queue_.set(this.getRealKey(e),s)}catch(s){be.warn(s)}}deleteItem(e){if(!We())return!1;try{return e=this.getRealKey(e),this.queue_.delete(e),localStorage.removeItem(e),!0}catch(t){return be.warn(t),!1}}clear(){if(!!We())try{localStorage.clear()}catch(e){be.warn(e)}}},ni=new au;var ct=class extends pe{constructor(e){super(e.joinReq.roomid,"WebSocket");this.connectFSM=e;v(this,"ws")}connect(){console.log("connect to",this.connectFSM.backupUrlWithParam);let e=new WebSocket(this.connectFSM.backupUrlWithParam);return e.binaryType="arraybuffer",new Promise((t,s)=>{e.onerror=s,e.onclose=c=>{this.disconnect(c.code,c.reason).catch(()=>{})},e.onmessage=c=>{try{let _=JSON.parse(String(c.data));console.log(_),this.connectFSM.verify(_.verify,_.rebuild),this.ws=e,t();let m=this.connectFSM.createOputReceiver("w");e.onmessage=p=>m.write(p.data)}catch(_){s(_)}}})}async disconnect(e=0,t=""){return console.warn("websocket disconnected :",e,t),this.connectFSM.disconnect(t)}close(){this.ws.close(1e3,"close")}sendReq(e,t,s){this.send(Ur(e,t,s||this.connectFSM.generateUUID()))}send(e){var t;this.state=="connected"&&((t=this.ws)==null||t.send(e))}};ge([ve(["disconnected",pe.INIT],"connected")],ct.prototype,"connect",1),ge([ve("connected","disconnected")],ct.prototype,"disconnect",1),ge([ve([],pe.INIT)],ct.prototype,"close",1);var Kh=new Uint32Array([Date.now()]),_d=X(At(20),Be(()=>performance.now()),at()),uu=class{constructor(e){this.wt=e;v(this,"chunk",new Map);v(this,"timestamp",performance.now());v(this,"groupId");v(this,"resentCount",0);this.groupId=e.groupid,e.groupid=e.groupid+1&127,e.sentCache.has(this.groupId)&&e.sentCache.get(this.groupId).chunk.clear(),e.sentCache.set(this.groupId,this),X(_d,io(()=>this.chunk.size>0&&this.resentCount<20),De(Le(e,"disconnected")),se(t=>{t-this.timestamp>2*e.connectFSM.rtt+10&&(this.chunk.forEach((s,c)=>this.wt.send(s.buffer)),console.debug("resent",this.groupId,this.chunk.size,"after",t-this.timestamp,"ms",++this.resentCount),this.timestamp=t)},console.error,()=>{this.wt.sentCache.delete(this.groupId)}))}ack(e){this.chunk.delete(e)}},Dt=class extends pe{constructor(e){super(e.joinReq.roomid,"WebTransport");this.connectFSM=e;v(this,"wt");v(this,"writer");v(this,"dw");v(this,"sentCache",new Map);v(this,"groupid",0);v(this,"mtu",1e3)}async connect(){console.log("connect to",this.connectFSM.urlWithParam);let e=new WebTransport(this.connectFSM.urlWithParam);await e.ready;let t=await e.createBidirectionalStream(),s=t.readable.getReader();this.writer=t.writable.getWriter(),this.dw=e.datagrams.writable.getWriter();let{value:c,done:_}=await s.read();s.releaseLock();let m=JSON.parse(String.fromCharCode(...c));console.log("WebTransport connect result:",m),this.connectFSM.verify(m.verify,m.rebuild),this.wt=e;let p=async E=>{try{await this.disconnect(E)}catch(g){}};X(Le(this.connectFSM,Se[4099]),De(Le(this,"disconnected")),se(({data:E})=>{let g=E[0]&127,S=this.sentCache.get(g);!S||S.ack(E[1])})),Promise.race([e.datagrams.readable.pipeTo(new WritableStream(this.connectFSM.createOputReceiver("d"))),t.readable.pipeTo(new WritableStream(this.connectFSM.createOputReceiver("s"))),e.closed]).then(p,p)}disconnect(e=""){return this.connectFSM.disconnect(e)}close(){var e;return(e=this.wt)==null?void 0:e.close()}async sendReq(e,t,s){if(s||(s=this.connectFSM.generateUUID()),!this.wt)return;if(!os){let w=Ur(e,t,s);this.writer.write(w).catch(this.catchError);return}let c=e>=255&&e<4095,_=JSON.stringify(t),m=0,p=_.length+(c?20:16),g=(p>65535?1:0)?7:5,S=Math.ceil(p/this.mtu),y=new uu(this);console.debug("WebTransport send:",c?"ack":"",Se[e],s,"chunks:",S,y.groupId);for(let w=0;w<S;w++){let F=p-w*this.mtu,O=Math.min(this.mtu,F),V=new Uint8Array(g+4+O),Y=jn(e,V.length-g,new DataView(V.buffer));if(V[0]|=2,V.set([1,2,(w==S-1?1<<7:0)|y.groupId,w],Y),Y+=4,w==0){c&&(V.set([0,0,0,0],Y),Y+=4);for(let te=0;te<16;te++)V[Y++]=s.charCodeAt(te)}for(let te=0;Y<V.length;te++)V[Y++]=_.charCodeAt(m++);y.chunk.set(w,V),this.send(V.buffer)}}async send(e){if(!(!this.wt||!this.dw)){if(e instanceof ArrayBuffer){if(!e.byteLength)throw cu}else{if(!e.length)throw cu;e=e.slice(0)}return this.dw.write(e).catch(this.catchError)}}catchError(e){}};ge([ve(["disconnected",pe.INIT],"connected")],Dt.prototype,"connect",1),ge([ve("connected","disconnected")],Dt.prototype,"disconnect",1),ge([ve([],pe.INIT)],Dt.prototype,"close",1);var cu=new Error("WebTransport send empty datagram");var lu=class{constructor(e){this.connect=e;v(this,"publishReq");v(this,"recovering",!1);v(this,"pingCount",0)}recoverLocal(){this.recovering=!0,this.publishReq&&(console.log("\u91CD\u65B0\u53D1\u5E03"),this.connect._sendReq(2,this.publishReq).then(e=>{}))}recoverRemote(e){this.recovering=!1,e.forEach((t,s)=>{if(t.subscribe==0)return;let c={mediaType:t.subscribe,mediaDescription:{audioParam:{mediaType:1,payloadFmtps:[{fmtp:"minptime=10;useinbandfec=1",payloadType:111}]},videoParam:[{mediaType:t.subscribe&2?2:4,payloadFmtps:[{fmtp:"packetization-mode=1;profile-level-id=42e01f",payloadType:100}]}]},userId:t.userId,srctinyid:s};this.connect._sendReq(4,c)})}onSendReq(e,t){switch(e){case 2:this.publishReq=t;break;case 3:this.publishReq=null;break;case 8:this.publishReq&&(this.publishReq.mediaType&=~t.mediaType);break;case 9:this.publishReq&&(this.publishReq.mediaType|=t.mediaType);break;case 12:this.connect.updateDevTools({note:"ping"+this.pingCount++});break}}},Tt=class extends pe{constructor(e,t,s){super(s.joinReq.roomid,"Connection");this.wh=e;this.port=t;v(this,"delay");v(this,"signalInfo_");v(this,"reqUser_");v(this,"urlWithParam");v(this,"backupUrlWithParam");v(this,"joinReq");v(this,"frameWorkType");v(this,"userMap");v(this,"durationMap_");v(this,"joinRes");v(this,"statReportReq");v(this,"qualityReportReq");v(this,"keyPointReport");v(this,"wFSM");v(this,"rtt",50);v(this,"recovery",new lu(this));v(this,"reqPromise",new Map);v(this,"rebuild");v(this,"osName");v(this,"browserInfo");console.log(this),Object.assign(this,s),this.urlWithParam.startsWith("ws")?(Ot.useWt=!1,this.wFSM=new ct(this)):Ot.useWt?this.wFSM=new Dt(this):this.wFSM=new ct(this),this.keyPointReport={msg_path_recv_video:[],msg_path_recv_audio:[],msg_quality_statistics:[],error_code:[],str_room_name:this.joinReq.roomid,uint32_seq:Math.floor(Math.random()*2**31),uint32_sdk_app_id:Number(this.joinReq.sdkAppID),msg_user_info:{uint32_role:this.joinReq.trtcrole},msg_basic_info:{uint32_networkType:this.joinReq.AbilityOption.GeneralLimit.uint32_net_type}},this.resetKeyPointReport(),this.userMap=new Map,this.statReportReq={tinyid:"",stat:{msg_audio_stat_report:{msg_audio_enc_stat:{uint32_audio_enc_br:0,uint32_audio_frame_interval:0},msg_audio_send_stat:{uint32_audio_send_br:0,uint32_audio_fec_br:0,uint32_audio_arq_br:0}},rpt_msg_video_stat_report:[{uint32_video_type:2,msg_video_enc_stat:{uint32_video_enc_fps:0,uint32_video_enc_br:0,uint32_video_encrd:1},msg_video_send_stat:{uint32_video_send_br:0,uint32_video_fec_br:0,uint32_video_arq_br:0}}],msg_net_stat_report:{uint32_total_send_br:0,uint32_rtt:0,uint32_down_expect_pkg:0,uint32_down_real_pkg:0,uint32_down_recv_br:0},msg_rtt_info_req:{uint64_last_server_timestamp_ms:0,uint32_delay_since_last_server_timestamp_ms:0,uint64_client_timestamp_ms:0},msg_system_load_report:{uint32_total_cpu_rate:0},msg_down_bandwidth_est:{uint32_bandwidth_br:0,uint32_avg_bandwidth_br:0,uint32_jitter:0,uint32_jitter_in_frm:0},msg_play_report:{uint32_video_jitter_receive_fps_ratio:0}}},this.qualityReportReq={tinyid:"",report:{str_sdk_version:this.joinReq.jsSdkVersion,uint32_groupid:0,uint64_datetime:Date.now(),msg_user_info:{str_identifier:"",uint64_tinyid:0},msg_device_info:{uint32_terminal_type:this.joinReq.AbilityOption.GeneralLimit.uint32_terminal_type,str_device_name:this.browserInfo.browserName,str_os_version:this.osName,uint32_net_type:this.joinReq.AbilityOption.GeneralLimit.uint32_net_type,uint32_app_cpu:0,uint32_system_cpu:0,uint32_app_memory:0,uint32_background:0,uint32_headset:0},msg_up_stream_info:{msg_audio_status:{uint32_audio_format:11,uint32_audio_sample_rate:48e3,uint32_audio_codec_bitrate:0,uint32_audio_receive:0},msg_video_status:[{uint32_video_stream_type:2,uint32_video_decode_frame:0,uint32_video_total_frame:0,uint32_video_capture_fps:0,uint32_video_codec_fps:0,uint32_video_codec_bitrate:0,uint32_video_total_bitrate:0}],msg_network_status:{uint32_bitrate:0,uint32_rtt:0,uint32_lost:0,uint32_jitter:0},msg_qos:[]},msg_down_stream_info:[],msg_event_msg:[],str_acc_ip:"",str_client_ip:"",str_groupid:""}}}async connect(){this.keyPointReport.msg_path_enter_room.uint64_start_time=Date.now();let e=this.wFSM.connect();return Ot.useWt&&(e=e.catch(t=>(console.error(t),this.wFSM=new ct(this),this.wFSM.connect()))),e}async joinRoom(){this.keyPointReport.msg_path_enter_room.uint64_send_request_enter_room_cmd_start_time=Date.now();let{dataport:e,stunport:t,relayip:s,socketid:c,checkSigSeq:_}=this.signalInfo_,m=await this.sendReq(0,Object.assign(this.joinReq,{dataport:e,stunport:t,relayip:s,socketid:c,checkSigSeq:_}));if(this.keyPointReport.msg_path_enter_room.uint64_send_request_enter_room_cmd_end_time=Date.now(),this.keyPointReport.msg_path_enter_room.uint64_end_time=Date.now(),this.keyPointReport.msg_path_enter_room.int32_send_request_enter_room_cmd_ret=m.err,m.err===0)this.setJoinRes(m.data),this.addEvent(32788);else throw m.err;return X(xe(2e4),De(Le(this,Tt.CLOSED)),se(()=>this.setStorage())),m}async leaveRoom(){this.keyPointReport.msg_path_exit_room.uint64_start_time=Date.now(),this.addEvent(32789),this.sendReq(1,{}),this.keyPointReport.msg_path_exit_room.uint64_end_time=Date.now(),this.keyPointReport.msg_path_enter_room.int32_send_request_enter_room_cmd_ret==0&&(this.keyPointReport.msg_basic_info.uint32_joining_duration=this.keyPointReport.msg_path_exit_room.uint64_start_time-this.keyPointReport.msg_path_enter_room.uint64_end_time),this.close()}async rejoinRoom(){if(!this.rebuild){let e=await this.sendReq(0,this.joinReq);e.err===0?this.setJoinRes(e.data):this.close()}this.recovery.recoverLocal()}async reconnect(){return this.postMessage("onTryToReconnect"),this.wFSM.connect()}async disconnect(e){console.warn("connection lost:",e),this.postMessage("onConnectionLost"),X(Qi(0,ds),Be(Ea),So(t=>Je(t),Hi),It({next:()=>{this.reconnect().then(()=>{this.postMessage("onConnectionRecovery"),this.rejoinRoom()},()=>{})},complete:()=>{this.close()}}),De(Le(this,"reconnected")),se())}async close(){this.wh.isLocal||this.reportKeyPoint(),this.userMap.clear(),this.port.postMessage(null),this.port.close(),this.wFSM.close()}postMessage(e,t){this.port.postMessage(e,t)}verify(e,t){this.signalInfo_=e,this.rebuild=t,this.reqUser_={openid:e.openid,tinyid:e.tinyid}}async _sendReq(e,t,s=this.generateUUID()){return t.hasOwnProperty("tinyid")||(t.reqUser=this.reqUser_),await this.wFSM.sendReq(e,t,s),new Promise((c,_)=>this.reqPromise.set(s,{resolve:c,reject:_}))}async sendReq(e,t){return this.recovery.onSendReq(e,t),this._sendReq(e,t)}send(e){return this.wFSM.send(e)}setJoinRes(e){this.joinRes=e,this.keyPointReport.msg_user_info.str_identifier=e.openid,this.keyPointReport.msg_user_info.uint64_tinyid=Number(e.tinyid),this.statReportReq.tinyid=e.tinyid,this.qualityReportReq.tinyid=e.tinyid,this.qualityReportReq.report.str_acc_ip=e.relayip,this.keyPointReport.uint32_acc_ip=Vn(e.relayip),this.keyPointReport.uint32_info_client_ip=this.keyPointReport.uint32_client_ip=Vn(e.clientip,"small"),this.qualityReportReq.report.str_client_ip=e.clientip,this.qualityReportReq.report.msg_user_info.str_identifier=e.openid,this.qualityReportReq.report.msg_user_info.uint64_tinyid=Number(e.tinyid)}resetKeyPointReport(){this.keyPointReport.msg_basic_info={string_sdk_version:this.joinReq.jsSdkVersion,uint32_os_type:15,string_device_name:"",string_http_user_agent:navigator.userAgent,string_os_version:"",uint32_avg_rtt:0,uint32_avg_up_loss:0,uint32_scene:this.joinReq.trtcscene,uint32_joining_duration:0,uint32_framework:this.frameWorkType||12},this.keyPointReport.msg_path_enter_room={uint64_start_time:0,uint64_init_audio_start_time:0,uint64_init_audio_end_time:0,uint64_init_camera_start_time:0,uint64_init_camera_end_time:0,uint64_send_request_enter_room_cmd_start_time:0,uint64_send_request_enter_room_cmd_end_time:0,uint64_send_first_video_frame_time:0,uint64_recv_userlist_time:0,uint64_end_time:0,int32_init_audio_ret:0,int32_init_camera_ret:0,int32_send_request_enter_room_cmd_ret:0,int32_end_ret:0},this.keyPointReport.msg_path_exit_room={uint64_start_time:0,uint64_send_request_exit_room_cmd_start_time:0,uint64_send_request_exit_room_cmd_end_time:0,uint64_end_time:0,int32_send_request_exit_room_cmd_ret:0,int32_end_ret:0},this.keyPointReport.msg_local_statistics={totalVideoBitrate:0,totalVideoFPS:0,totalVideoHeight:0,totalVideoWidth:0,totalAudioLevel:0,videoCount:0,audioLevelCount:0,publishStartTime:0,statsToReport:{uint32_audio_capture_db:0,uint32_video_big_capture_fps:0,uint32_video_big_bitrate:0,uint32_video_big_resolution:0}}}get storageKey_(){return`key_point_${this.joinRes.openid}`}async reportKeyPoint(){try{this.keyPointReport.uint64_timestamp=Date.now(),await this.upload(),ni.deleteItem(this.storageKey_),this.resetKeyPointReport()}catch(e){}}setStorage(){ni.setItem(this.storageKey_,JSON.stringify(this.keyPointReport))}async upload(){if(es||this.keyPointReport.msg_path_enter_room.uint64_start_time===0)return;let e=Number(this.keyPointReport.uint32_sdk_app_id),t=await _u.default.post(Qt(e,Kt.KEY_POINT),JSON.stringify(this.keyPointReport));if(t.data!=="ok")throw`key point upload failed: ${t.data}`}addEvent(e,t,s={}){this.qualityReportReq.report.msg_event_msg.push(ot({uint32_event_id:e,uint64_date:$t(),str_userid:t},s))}createUser({userid:e,srctinyid:t,role:s,flag:c}){let _=!!(c&1),m=!!(c&8),p=!!(c&2),E=!!(c&64),g=!!(c&16),S=!!(c&4),y={flag:c,userId:e,tinyId:t,role:s===20?"anchor":"audience",muteState:{userId:e,hasAudio:m,hasVideo:_,hasSmall:p,hasScreen:S,audioMuted:E,videoMuted:g},subscribe:0,removing:!1};return this.userMap.set(t,Object.assign(new Qn(y,this))),console.log("create user",y),this.postMessage({cmd:Rt.PEER_JOIN,payload:y}),y}removeUser(e){e.removing?(console.log("remove user",e),this.userMap.delete(e.tinyId),this.postMessage({cmd:Rt.PEER_LEAVE,payload:{userId:e.userId,tinyId:e.tinyId}})):e.removing=!0}onReceive(e,t,s){let c,_=0,m;t<255&&(m=new DataView(s.buffer,s.byteOffset),_=m.getUint32(0),s=s.subarray(4)),t<4095&&(c=String.fromCharCode(...s.subarray(0,16)),s=s.subarray(16));let p=s;if(!c)m=new DataView(s.buffer,s.byteOffset,s.byteLength);else{let S=String.fromCharCode(...s);if(_)p=S;else try{p=JSON.parse(S)}catch(y){p=S}}let E=Se[t];switch(t){case 259:this.joinRes&&this.sendReq(t,{tinyid:this.joinRes.tinyid}),console.debug(e,"receive:",E,c,p);break;case 256:case 257:console.log(e,"receive:",E,c,p),this.sendReq(t,{count:this.userMap.size});break;case 255:this.sendReq(t,{count:this.userMap.size});{this.keyPointReport.msg_path_enter_room.uint64_recv_userlist_time||(this.keyPointReport.msg_path_enter_room.uint64_recv_userlist_time=Date.now());let w=p.userlist.filter(O=>this.joinRes&&O.srctinyid!==this.joinRes.tinyid&&O.userid);this.userMap.forEach(O=>{w.findIndex(({srctinyid:V})=>V===O.tinyId)<0?this.removeUser(O):O.removing=!1});let F=0;w.forEach(O=>{let{flag:V,srctinyid:Y}=O,te;this.userMap.has(Y)?(te=this.userMap.get(Y),V!=te.flag&&(te.flag=V,te.muteState.hasVideo=!!(V&1),te.muteState.hasAudio=!!(V&8),te.muteState.hasSmall=!!(V&2),te.muteState.hasScreen=!!(V&4),te.muteState.audioMuted=!!(V&64),te.muteState.videoMuted=!!(V&16),this.postMessage({cmd:"syncUserList",payload:te.muteState}))):te=this.createUser(O),te.muteState.hasAudio&&!te.muteState.audioMuted&&F++}),this.wh.downlinkAudioCount=F,this.recovery.recovering&&this.recovery.recoverRemote(this.userMap)}console.debug(e,"receive:",E,c,p);break;case 4100:this.rtt=m.getUint32(4),console.debug(e,"receive:",E,c,p,this.rtt);let{dv:S,writeData:y}=Xt(4101,8);y(s.subarray(0,4)),this.send(S.buffer);break;case 12:self.postMessage({type:"glog",payload:{heartbeatReceive:1}});case 11:case 260:console.debug(e,"receive:",E,c,p);case 7:case 4095:break;case 4096:case 4097:{let w=s.length;this.statReportReq.stat.msg_net_stat_report.uint32_down_real_pkg++,this.statReportReq.stat.msg_net_stat_report.uint32_down_recv_br+=w<<3;let F=m.getBigUint64(9).toString();if(this.userMap.has(F)){let O=this.userMap.get(F);t===4096?(O.mainPuller.videoStatus.uint32_video_receive||console.timeLog(O.userId+"big","first video data"),O.mainPuller.demuxPacket(s)):(O.screenPuller.videoStatus.uint32_video_receive||console.timeLog(O.userId+"aux","first video data"),O.screenPuller.demuxPacket(s))}else console.warn(e,"receive:",E,c,p,"user not found")}break;case 4102:case 4103:case 4099:break;case 4098:{let w=m.getUint8(8);for(var g=9;g<s.length;g+=6){let F=m.getUint32(g),O=m.getUint16(g+4);for(let V=0;V<=16;V++){if(V>0&&(O>>16-V&1)==0)continue;let Y=J._GetRetransPacket(w,F+V,$.global.point),te=$.global.getUint32(0),he=J.HEAPU8.subarray(te,te+Y);Y>0&&this.send(he)}}}break;case 1:switch(console.log(e,"receive:",E,c,p),Number(p)){case 2:case 4:case 8:this.postMessage({cmd:Rt.CLIENT_BANNED,payload:1}),this.close();break;case 5:this.postMessage({cmd:Rt.CLIENT_BANNED,payload:2}),this.close()}break;case 258:console.log(e,"receive:",E,c||"",p);break;default:console.log(e,"receive:",E||t,c||"",p)}this.reqPromise.has(c)&&(_&&console.warn(_,p,c),this.reqPromise.get(c).resolve({err:_,data:p,uuid:c}),this.reqPromise.delete(c)),this.emit(E,c?{uuid:c,err:_,data:p}:{data:p})}createOputReceiver(e){return new et(this.unMarshal(e))}*unMarshal(e){let t,s=new Map;for(;;){let c=0,_=0;try{t=yield 1;let m=t[0]>>4,p=t[0]&2,E=t[0]&1;t=yield 4+E*2;let g=new DataView(t.buffer,t.byteOffset);if(_=g.getUint16(0),c=E==1?g.getUint32(2):g.getUint16(2),t=yield c,p){let S=t[0]&63,y=t[1],w=t.subarray(2,2+y);switch(S){case 1:let F=w[0]>>7,O=w[0]&127,V=w[1],{dv:Y,write8:te}=Xt(4099,2);te(O),te(V),this.send(Y.buffer);let he=O%64;for(let R=0;R<64;R++){let k=O-R;k<0&&(k+=64);let A=he-R;A<0&&(A+=64),s.has(A)&&s.get(A).groupId!=k&&s.delete(A)}let ce=s.get(he);if(ce||s.set(he,ce=new du(O)),t=ce.push(V,t.slice(2+y),F!=0),t)s.delete(he);else continue}}this.onReceive(e,_,t)}catch(m){console.error(e,m,c,_,t)}}}generateUUID(){return"xxxxxxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=Math.random()*16|0,s=e=="x"?t:t&3|8;return s.toString(16)})}},Ce=Tt;v(Ce,"JOINED","joined"),v(Ce,"CLOSED","closed"),ge([ve(pe.INIT,"connected")],Ce.prototype,"connect",1),ge([ve("connected",Tt.JOINED)],Ce.prototype,"joinRoom",1),ge([ve("reconnected",Tt.JOINED)],Ce.prototype,"rejoinRoom",1),ge([ve("disconnected","reconnected")],Ce.prototype,"reconnect",1),ge([ve(["connected",Tt.JOINED],"disconnected")],Ce.prototype,"disconnect",1),ge([ve([],Tt.CLOSED)],Ce.prototype,"close",1);var du=class{constructor(e){this.groupId=e;v(this,"chunks",[]);v(this,"totalLen",0);v(this,"marker")}push(e,t,s){if(this.chunks[e])return null;if(this.chunks[e]=t,this.totalLen+=t.length,s&&(this.chunks.length=e+1,this.marker=!0),this.marker){for(let _=0;_<this.chunks.length;_++)if(!this.chunks[_])return null;let c=new Uint8Array(this.totalLen);for(;this.chunks.length;){let _=this.chunks.pop();c.set(_,this.totalLen-=_.length)}return c}return null}};var mu=ft(pu());var Br=class extends ke{["publishTx"]({streamId:e,type:t},s){e=e||`${this.appId}_${this.roomId}_${this.userId}_main`;let c=(0,mu.default)(`${this.roomId}_${this.userId}_main`),_={roomid:this.roomId,sdkAppID:this.appId,socketid:this.io.joinRes.socketid,request_time:Date.now(),sessionId:c,streamId:e,streamType:t};return Ze.info("startPublishTXCDN: "+JSON.stringify(_)),this.send(18,_).then(m=>{s.postMessage(m),this["stopPublishTx"]=function(p){return delete this["stopPublishTx"],Ze.info("stopPublishTXCDN: "+JSON.stringify(_)),this.fetchRes(19,_).then(p.postMessage)}})}["stopPublishTx"](e){return Promise.reject("stopPublishTXCDN before startPublishTXCDN")}["publishCdn"](e,t){let s={roomid:this.roomId,sdkAppID:this.appId,socketid:this.io.joinRes.socketid,pushRequestTime:Date.now(),pushAppid:e.appId,pushBizId:e.bizId,pushCdnUrl:e.url,pushStreamType:"main"};return Ze.info("startPublishCDN: "+JSON.stringify(s)),this.send(13,s).then(c=>{delete this["stopPublishCdn"],t.postMessage(c),this["stopPublishCdn"]=function(_){return Ze.info("stopPublishCDN: "+JSON.stringify(s)),this.fetchRes(13,s).then(_.postMessage)}})}["stopPublishCdn"](e){return Promise.reject("stopPublishCDN before startPublishCDN")}};var qr=class extends pe{constructor(){super(...arguments);v(this,"deviceId");v(this,"pushFSM");v(this,"room");v(this,"mediaType");v(this,"small");v(this,"track")}publish(e){this.pushFSM=e,e.children.push(this),this.room=e.room}async getUserMedia(e){Ze.info("getUserMedia with constraints: "+JSON.stringify(e));let t=3,s;return await new ReadableStream({pull(c){return t--<0&&c.error(),navigator.mediaDevices.getUserMedia(e).then(_=>{s=_,c.close()}).catch(_=>{if(_.name==="NotReadableError")c.enqueue(_);else throw _})}}).pipeTo(new WritableStream({write(c){return new Promise((_,m)=>setTimeout(_,500,c))}})),s}async push(e){if(!e)throw new Error("push track is null");if(this.pushFSM.state!=pe.ON)throw new Error("push track before stream publish");let t=!this.track;this.track=e,t&&await X(this.room.fromWorker("publish",this.mediaType),No())}tryPush(e){this.push(e).catch(console.debug)}stop(){}async changeTrack(e){this.track=e,this.emit(qr.CHANGETRACK,e)}setMute(e){if(!this.track)return!1;if(this.track.enabled=!e,this.state==pe.ON){let t=e?"mute":"unmute";this.room.postMessage(t,{mediaType:this.mediaType,srctinyid:this.room.tinyid,userId:this.room.openid}),this.small&&this.room.postMessage(t,{mediaType:8,srctinyid:this.room.tinyid,userId:this.room.openid})}return!0}},rr=qr;v(rr,"PUBLISH","publish"),v(rr,"CHANGETRACK","changeTrack"),ge([ve(pe.INIT,qr.PUBLISH)],rr.prototype,"publish",1),ge([ve([],pe.INIT)],rr.prototype,"stop",1);var Hr=class extends ke{constructor(){super(...arguments);v(this,"videoEncBuffer_",new $(1920*1080*3>>1));v(this,"tinyId_",new $(32));v(this,"videoStats",{bytesSent:0,packetsSent:0,framesEncoded:0,framesSent:0,frameWidth:0,frameHeight:0});v(this,"audioStats",{bytesSent:0,packetsSent:0});v(this,"videoTypeIndexMap",new Map([[2,0]]));v(this,"requestTypeMap",new Map([[0,4096]]))}["getLocalVideoStats"](e){e.postMessage({[this.io.joinRes.openid]:this.videoStats})}["getLocalAudioStats"](e){e.postMessage({[this.io.joinRes.openid]:this.audioStats})}["pushAudio"]({sampleRate:e,channelCount:t},s,c){let _=this.io.wh.addAudioEncoderPort(s);this.tinyId_.set([...this.io.joinRes.tinyid].map(g=>g.charCodeAt(0)).concat(0)),this.addEvent(32769),J._CreateUdtPacketizer(this.io.joinRes.roomid,this.tinyId_.point,this.io.joinRes.locationid,1,J.udtver);let m=new $(e*t*2),p=g=>{if("volume"in g){this.qualityReport.msg_up_stream_info.msg_audio_status.uint32_audio_capture_energy=g.volume;return}let S=g.data,y=S.length;m.set(S),this.statReportReq.msg_audio_stat_report.msg_audio_enc_stat.uint32_audio_enc_br+=y<<3,this.statReportReq.msg_audio_stat_report.msg_audio_enc_stat.uint32_audio_frame_interval++,this.audioStats.packetsSent++;let w=J._PacketizeAudioUdt(m.point,y,Date.now(),e,t,$.global.point,$.global.size);if(w<=0){console.warn("audio pack len is 0");return}this.io.send($.global.uint8Array(w)),this.audioStats.bytesSent+=w,this.statReportReq.msg_audio_stat_report.msg_audio_send_stat.uint32_audio_send_br+=w<<3,this.qualityReport.msg_up_stream_info.msg_audio_status.uint32_audio_receive++},E=g=>{m.free(),this.send(3,{mediaType:1}),this.addEvent(32771)};X(c||_,se(p,E,E))}createSelectAbilityOb(e,t){return X(this.createResposeOb(259),hr(()=>Je(2e3)),Be(s=>{var c;return(c=s.data.ability.rpt_msg_video_control_info)==null?void 0:c.find(_=>_.uint32_video_type===e)}),Xe(s=>{if(!s)return!1;s.uint32_video_enc_br=s.uint32_video_enc_br*Math.pow(1-this.qualityReport.msg_up_stream_info.msg_network_status.uint32_lost/100,2);let c=!1;return((m,p)=>{s[p]&&s[p]!==t[m]&&(c=!0,t[m]=s[p])})("bitrate","uint32_video_enc_br"),c}),dn(t))}["pushVideo"]({profile:{width:e,height:t,frameRate:s,bitrate:c},type:_,trackType:m},p){this.videoStats.frameWidth=e,this.videoStats.frameHeight=t;let E=0,g=tu[_];this.videoTypeIndexMap.has(_)?E=this.videoTypeIndexMap.get(_):(E=this.statReportReq.rpt_msg_video_stat_report.length,this.requestTypeMap.set(E,_===7?4097:4096),this.videoTypeIndexMap.set(_,E),this.statReportReq.rpt_msg_video_stat_report.push({uint32_video_type:_,msg_video_enc_stat:{uint32_video_enc_fps:0,uint32_video_enc_br:0,uint32_video_encrd:1},msg_video_send_stat:{uint32_video_send_br:0,uint32_video_fec_br:0,uint32_video_arq_br:0}}),this.qualityReport.msg_up_stream_info.msg_video_status.push({uint32_video_codec_bitrate:0,uint32_video_total_bitrate:0,uint32_video_capture_fps:0,uint32_video_codec_fps:0,uint32_video_stream_type:_,uint32_video_codec_type:0,uint32_video_decode_frame:0,uint32_video_total_frame:0,uint32_video_width:e,uint32_video_height:t}));let S={width:e,height:t,bitrate:c*1e3,framerate:s};this.addEvent(32768),Object.assign(this.qualityReport.msg_up_stream_info.msg_video_status[E],{uint32_video_width:e,uint32_video_height:t}),this.tinyId_.set([...this.io.joinRes.tinyid].map(V=>V.charCodeAt(0)).concat(0)),J._CreateUdtPacketizer(this.io.joinRes.roomid,this.tinyId_.point,this.io.joinRes.locationid,_,J.udtver);let y=0,w=!1,F=V=>{this.send(3,{mediaType:g}),this.addEvent(32770)};X(this.createSelectAbilityOb(_,S),se(()=>{p.postMessage(S)}));let O=p;m!="camera"&&(console.log(`push ${m} track`),O=ji(p,X(p,fo(2e3),Er(V=>(console.warn("start push last video frame"),X(xe(2e3),dn(V),De(p),It({complete(){console.warn("stop push last video frame")}})))),ht(p)))),X(O,se(V=>{this.qualityReport.msg_up_stream_info.msg_video_status[E].uint32_video_total_frame++,y++,this.videoStats.framesSent++,this.qualityReport.msg_up_stream_info.msg_video_status[E].uint32_video_capture_fps++,y%30==0&&p.postMessage(260),this.handleVideoEncoded(V,_)},F,F)),X(this.createResposeOb(260),ht(p),se(()=>p.postMessage(260)))}handleVideoEncoded(e,t){this.videoStats.framesEncoded++;let s=this.videoTypeIndexMap.get(t);this.qualityReport.msg_up_stream_info.msg_video_status[s].uint32_video_decode_frame++,this.qualityReport.msg_up_stream_info.msg_video_status[s].uint32_video_codec_fps++,this.statReportReq.rpt_msg_video_stat_report[s].msg_video_enc_stat.uint32_video_enc_fps++;let c="byteLength"in e?e.byteLength:e.data.length;if(this.statReportReq.rpt_msg_video_stat_report[s].msg_video_enc_stat.uint32_video_enc_br+=c<<3,c>this.videoEncBuffer_.size){console.log("buffer too small!");return}"byteLength"in e?e.copyTo(this.videoEncBuffer_.uint8Array(c)):this.videoEncBuffer_.set(e.data);let _=J._PacketizeVideoUdt(this.videoEncBuffer_.point,c,Date.now(),e.type=="key"?1:0,t,$.global.point);this.sendUdtv3Video(_,s)}sendUdtv3Video(e,t){let s=0,c=$.global.uint8Array();for(let _=0;_<e;_++){let m=$.global.getUint32(s);if(m<=0){console.warn("sendUdtv3Video pktSize is ",m);continue}this.io.send(c.subarray(s+=4,s+=m)),this.statReportReq.rpt_msg_video_stat_report[t].msg_video_send_stat.uint32_video_send_br+=m<<3,this.io.keyPointReport.msg_path_enter_room.uint64_send_first_video_frame_time||(this.io.keyPointReport.msg_path_enter_room.uint64_send_first_video_frame_time=Date.now()),this.videoStats.bytesSent+=m,this.videoStats.packetsSent++}}["mute"](e){if(e.remove=!1,this.send(8,e),e.userId==this.io.joinRes.openid)this.addEvent(e.mediaType===1?32772:32773);else{let t=this.userMap_.get(e.srctinyid);t&&(t.subscribe&=~e.mediaType),this.addEvent(e.mediaType===1?32785:32784,e.userId)}}["unmute"](e){if(e.add=!1,this.send(9,e),e.userId==this.io.joinRes.openid)this.addEvent(e.mediaType===1?32774:32775);else{let t=this.userMap_.get(e.srctinyid);t&&(t.subscribe|=e.mediaType),this.addEvent(e.mediaType===1?32787:32786,e.userId)}}["waitKeyFrame"](e){this.send(11,e)}["publish"](e,t){this.audioStats.bytesSent=0,this.audioStats.packetsSent=0,this.videoStats.framesSent=0,this.videoStats.bytesSent=0,this.videoStats.packetsSent=0,this.videoStats.framesEncoded=0;let s={mediaType:e,mediaDescription:{audioParam:e&1?{mediaType:1,payloadFmtps:[{payloadType:111,fmtp:"minptime=10;useinbandfec=1"}]}:null,videoParam:[4,8,2].filter(c=>e&c).map(c=>({mediaType:c,payloadFmtps:[{payloadType:100,fmtp:"packetization-mode=1;profile-level-id=42e01f"}]}))}};this.send(2,s).then(c=>{t.postMessage(c),t.postMessage(null)})}};var pd=2,Gr=class extends ke{["addEventMsg"](e){typeof e=="object"?this.addEvent(e.eventId,e.userId):this.addEvent(e)}constructor(e){super(e);let t,s=Le(e,Ce.JOINED),c=Le(e,Ce.CLOSED);X(s,Wt(xe(1e3)),Be(()=>Date.now()),De(c),se(p=>{this.statReportReq.msg_down_bandwidth_est.uint32_avg_bandwidth_br=this.statReportReq.msg_down_bandwidth_est.uint32_bandwidth_br=this.statReportReq.msg_net_stat_report.uint32_down_recv_br,this.statReportReq.msg_rtt_info_req.uint64_client_timestamp_ms=p,this.statReportReq.msg_rtt_info_req.uint32_delay_since_last_server_timestamp_ms=t&&p-t||0,this.statReportReq.msg_net_stat_report.uint32_down_expect_pkg=this.statReportReq.msg_net_stat_report.uint32_down_real_pkg,this.statReportReq.msg_net_stat_report.uint32_total_send_br=this.statReportReq.msg_audio_stat_report.msg_audio_send_stat.uint32_audio_send_br+this.statReportReq.rpt_msg_video_stat_report.reduce((E,g)=>E+g.msg_video_send_stat.uint32_video_send_br,0),this.qualityReport.msg_up_stream_info.msg_video_status.forEach((E,g)=>{E.uint32_video_total_bitrate=this.statReportReq.rpt_msg_video_stat_report[g].msg_video_send_stat.uint32_video_send_br,E.uint32_video_codec_bitrate=this.statReportReq.rpt_msg_video_stat_report[g].msg_video_enc_stat.uint32_video_enc_br}),this.qualityReport.msg_up_stream_info.msg_audio_status.uint32_audio_total_bitrate=this.statReportReq.msg_audio_stat_report.msg_audio_send_stat.uint32_audio_send_br,this.qualityReport.msg_up_stream_info.msg_audio_status.uint32_audio_codec_bitrate=this.statReportReq.msg_audio_stat_report.msg_audio_enc_stat.uint32_audio_enc_br,this.send(12,this.io.statReportReq),self.postMessage({type:"glog",payload:{heartbeatSend:1}}),this.statReportReq.msg_audio_stat_report.msg_audio_enc_stat.uint32_audio_frame_interval=0,this.statReportReq.msg_audio_stat_report.msg_audio_send_stat.uint32_audio_send_br=0,this.statReportReq.msg_audio_stat_report.msg_audio_enc_stat.uint32_audio_enc_br=0,this.statReportReq.rpt_msg_video_stat_report.forEach(E=>{E.msg_video_send_stat.uint32_video_send_br=0,E.msg_video_enc_stat.uint32_video_enc_br=0,E.msg_video_enc_stat.uint32_video_enc_fps=0}),this.statReportReq.msg_net_stat_report.uint32_down_recv_br=0}));let _=X(this.createResposeOb(12),It(p=>{p.err||!p.data||(this.statReportReq.msg_rtt_info_req.uint64_last_server_timestamp_ms=p.data.msg_rtt_info_res.uint64_server_timestamp_ms,t=Date.now(),this.statReportReq.msg_net_stat_report.uint32_rtt=t-p.data.msg_rtt_info_res.uint64_last_client_timestamp_ms-p.data.msg_rtt_info_res.uint32_delay_since_last_client_timestamp_ms,this.statReportReq.msg_net_stat_report.uint32_rtt<0&&(this.statReportReq.msg_net_stat_report.uint32_rtt=30),this.qualityReport.msg_up_stream_info.msg_network_status.uint32_lost=Math.max(0,(p.data.uint32_up_expect_pkg-p.data.uint32_up_real_pkg)*100/p.data.uint32_up_expect_pkg>>0))}));X(s,Wt(_),Wt(Je(fs)),De(c),se(()=>{console.log("ping timeout,lastrecv:",t,"now:",Date.now()),this.io.state==Ce.JOINED&&this.io.wFSM.disconnect()}));let m=new $(13<<2);X(s,Wt(xe(pd*1e3)),De(c),se(()=>{let p=[...this.userMap_.values()];this.qualityReport.uint64_datetime=Date.now(),this.qualityReport.msg_up_stream_info.msg_network_status.uint32_bitrate=this.statReportReq.msg_net_stat_report.uint32_total_send_br,this.qualityReport.msg_up_stream_info.msg_network_status.uint32_rtt=this.statReportReq.msg_net_stat_report.uint32_rtt,this.qualityReport.msg_down_stream_info=p.map(y=>y.toDownStreamInfo(y)),this.qualityReport.msg_up_stream_info.msg_audio_status.uint32_audio_total_bitrate>>=1,this.qualityReport.msg_up_stream_info.msg_audio_status.uint32_audio_codec_bitrate>>=1;let E=md(this.qualityReport.msg_down_stream_info.map(y=>({rtt:y.msg_network_status.uint32_rtt,loss:y.msg_network_status.uint32_lost}))),g=this.qualityReport.msg_up_stream_info.msg_network_status.uint32_rtt,S=this.qualityReport.msg_up_stream_info.msg_network_status.uint32_lost;this.keyPointReport.msg_basic_info.uint32_avg_rtt?this.keyPointReport.msg_basic_info.uint32_avg_rtt=(this.keyPointReport.msg_basic_info.uint32_avg_rtt+g)/2:this.keyPointReport.msg_basic_info.uint32_avg_rtt=g,this.postMessage(Rt.NETWORK_QUALITY,{uplinkNetworkQuality:this.io.state!="disconnected"?oi(S,g):6,downlinkNetworkQuality:oi(E.loss,E.rtt),remoteQuality:this.qualityReport.msg_down_stream_info.map(y=>({userId:y.msg_user_info.str_identifier,quality:oi(y.msg_network_status.uint32_lost,y.msg_network_status.uint32_rtt),rtt:y.msg_network_status.uint32_rtt,videoStatus:y.msg_video_status,audioStatus:y.msg_audio_status})),uplinkInfo:this.qualityReport.msg_up_stream_info,uplinkRTT:g,uplinkLoss:S,downlinkRTT:E.rtt,downlinkLoss:E.loss}),this.send(7,this.io.qualityReportReq),this.qualityReport.msg_event_msg=[],this.qualityReport.msg_up_stream_info.msg_video_status.forEach(y=>{y.uint32_video_capture_fps=0,y.uint32_video_codec_fps=0})},p=>{},()=>{this.qualityReport.msg_down_stream_info=[...this.userMap_.values()].map(p=>p.toDownStreamInfo(p)),this.send(7,this.io.qualityReportReq),m.free()}))}};function md(n){let e={rtt:0,loss:0};return Array.isArray(n)&&n.length>0&&(n.forEach(t=>{e.rtt+=t.rtt,e.loss+=t.loss}),Object.keys(e).forEach(t=>{e[t]=Math.round(e[t]/n.length)})),e}function oi(n,e){return n>50||e>500?5:n>30||e>350?4:n>20||e>200?3:n>10||e>100?2:n>=0||e>=0?1:0}var Wr=class extends ke{async["subscribe"](e,t){let{mediaType:s,srctinyid:c}=e,_=this.userMap_.get(c);_&&(_.subscribe|=e.mediaType,e.mediaType=_.subscribe,console.time(`${_.userId}${s&2?"aux":"big"}`),t?t.postMessage(await this.send(4,e)):this.send(4,e),s&4||s&8?_.mainPuller.videoPort||_.startPull(_.mainPuller,t,{mediaType:s,srctinyid:c}):s&2&&(_.screenPuller.videoPort||_.startPull(_.screenPuller,t,{mediaType:s,srctinyid:c})))}["changetype"](e){let{mediaType:t,srctinyid:s}=e,c=this.userMap_.get(s);if(c){let _=c.subscribe;t==8?(c.subscribe|=8,c.subscribe&=~4):t==4&&(c.subscribe|=4,c.subscribe&=~8),_!=c.subscribe&&(e.mediaType=c.subscribe,this.send(4,e))}}};var hu=class{constructor(){v(this,"audioEncoderWorkerPorts",[]);v(this,"playPort");v(this,"delay");v(this,"downlinkAudioCount");v(this,"isLocal");v(this,"interval10ms",X(At(10),at()));v(this,"ios",new Set)}async connectWorkers(e){switch(e.data.wasm&&(J.locateFile=function(t,s){return"data:application/octet-stream;base64,"+e.data.wasm}),this.isLocal=e.data.IS_LOCAL,Uo(J),await $.ready,self.name){case"main":e.ports[0].onmessage=_=>{switch(console.log(..._.data),this.audioEncoderWorkerPorts.forEach(m=>m.postMessage({cmd:_.data[0],payload:_.data[1]})),_.data[0]){case"useAINS":J._UseAINS(_.data[1]);break;case"enableDebug":console.debug=_.data[1]?gn:()=>{};break;case"useV2":J.udtver=_.data[1]?2:3;break}},X(xe(1e3),se(J._UpdateStreamSync)),J._SetAudioOutStreamFormat(48e3,1);let t=J._malloc(3*4),s=new $(480<<2),c=_=>{let m=s.uint8Slice();_.postMessage(m,[m.buffer])};X(this.interval10ms,Xe(()=>this.downlinkAudioCount>0),se(_=>{J._GetAudioMixedFloat(s.point,48e3,t)>=0&&(this.audioEncoderWorkerPorts.length?this.audioEncoderWorkerPorts.forEach(c):this.playPort&&c(this.playPort),this.ios.forEach(p=>p.userMap.forEach(E=>{var g;return(g=E.audioPuller)==null?void 0:g.feed()})))})),self.onmessage=this.joinRoom.bind(this);break;default:self.onmessage=this.pushAudio.bind(this)}self.postMessage({type:"ready"})}async joinRoom(e){this.isLocal||Ze.enableUploadLog();let{data:{id:t,payload:s},ports:c}=e,_=new Ce(this,c[0],s),m=[new Hr(_),new Wr(_),new Lr(_),new Gr(_),new Br(_)],p=()=>{_.leaveRoom(),this.ios.delete(_)};try{await _.connect(),postMessage({id:t,payload:await _.joinRoom()}),this.ios.add(_),X(Fn(_.port,!0),se(({data:{cmd:E,payload:g},ports:S})=>{switch(E){case"setAudioWorkletPort":this.choosePlay(S[0]);break;case"getRemoteVideoStats":let y=_.userMap.get(g.tinyId);if(!y)return;let w=g.mediaType==4?y.mainPuller:y.screenPuller;w.videoStatus.uint32_video_width=g.width,w.videoStatus.uint32_video_height=g.height,w.videoStatus.uint32_video_decode_frame++,w.videoStatus.uint32_video_codec_fps++;break;default:console.log(self.name,"received message",E);let F=S.map(Fn);typeof g!="undefined"&&F.unshift(g),m.forEach(O=>{O[E]&&O[E].call(O,...F)})}},p,p))}catch(E){console.warn(E),_.close()}}pushAudio(e){switch(console.log(self.name,"receive",e.data.cmd),e.data.cmd){case"pushAudio":let[t,s]=e.ports;t.onmessage=g=>{switch(g.data.cmd){case"setAudioWorkletPort":this.playPort=g.ports[0],this.playPort.onmessage=S=>{this.delay=Ta(S.data)+60};break;case"useAINS":J._UseAINS(g.data.payload);break;case"enableDebug":console.debug=g.data.payload?gn:()=>{};break;case"useV2":J.udtver=g.data.payload?2:3;break;default:$.global.set(g.data),J._AudioReverseProcessFloat($.global.point,480),this.playPort&&(g.data.set($.global.uint8Array(g.data.length)),this.playPort.postMessage(g.data,[g.data.buffer]))}};let{payload:{sampleRate:c,channelCount:_,bitrate:m},encrypt:p}=e.data,E=g=>{E=nu.call(this,g,p,s,t),J._SetOpusEncBitrate(m*1e3),E(g)};s.onmessage=g=>{g.data||(this.playPort&&(t.postMessage("setAudioWorkletPort",[this.playPort]),this.playPort=null),t.postMessage(null)),E(g.data)}}}choosePlay(e){console.log("choose play port from",this.audioEncoderWorkerPorts),this.audioEncoderWorkerPorts.length?(this.audioEncoderWorkerPorts[0].postMessage({cmd:"setAudioWorkletPort"},[e]),this.playPort=null):this.playPort=e}addAudioEncoderPort(e){return this.audioEncoderWorkerPorts.push(e),this.playPort&&this.choosePlay(this.playPort),X(e,Xe(t=>t instanceof MessageEvent?(this.audioEncoderWorkerPorts.splice(this.audioEncoderWorkerPorts.indexOf(e),1),t.ports.length&&this.choosePlay(t.ports[0]),!1):!0))}},Eu=new hu;self.onmessage=Eu.connectWorkers.bind(Eu);
|
package/karma.conf.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Karma configuration
|
|
2
|
+
// Generated on Tue May 14 2019 14:39:28 GMT+0800 (中国标准时间)
|
|
3
|
+
const babel = require('rollup-plugin-babel');
|
|
4
|
+
const resolve = require('rollup-plugin-node-resolve');
|
|
5
|
+
const commonjs = require('rollup-plugin-commonjs');
|
|
6
|
+
const builtins = require('rollup-plugin-node-builtins');
|
|
7
|
+
const globals = require('rollup-plugin-node-globals');
|
|
8
|
+
const json = require('rollup-plugin-json');
|
|
9
|
+
const istanbul = require('rollup-plugin-istanbul');
|
|
10
|
+
|
|
11
|
+
module.exports = function(config) {
|
|
12
|
+
config.set({
|
|
13
|
+
// base path that will be used to resolve all patterns (eg. files, exclude)
|
|
14
|
+
basePath: '',
|
|
15
|
+
|
|
16
|
+
// frameworks to use
|
|
17
|
+
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
|
18
|
+
frameworks: ['jasmine'],
|
|
19
|
+
|
|
20
|
+
// list of files / patterns to load in the browser
|
|
21
|
+
files: ['test/**/*.test.js'],
|
|
22
|
+
|
|
23
|
+
// list of files / patterns to exclude
|
|
24
|
+
exclude: [],
|
|
25
|
+
|
|
26
|
+
// preprocess matching files before serving them to the browser
|
|
27
|
+
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
|
28
|
+
preprocessors: {
|
|
29
|
+
'test/**/*.test.js': ['rollup']
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
// test results reporter to use
|
|
33
|
+
// possible values: 'dots', 'progress'
|
|
34
|
+
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
|
35
|
+
reporters: ['progress', 'coverage'],
|
|
36
|
+
|
|
37
|
+
coverageReporter: {
|
|
38
|
+
type: 'html',
|
|
39
|
+
dir: 'coverage/'
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
// web server port
|
|
43
|
+
port: 9876,
|
|
44
|
+
|
|
45
|
+
// enable / disable colors in the output (reporters and logs)
|
|
46
|
+
colors: true,
|
|
47
|
+
|
|
48
|
+
// level of logging
|
|
49
|
+
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
|
50
|
+
logLevel: config.LOG_INFO,
|
|
51
|
+
|
|
52
|
+
// enable / disable watching file and executing tests whenever any file changes
|
|
53
|
+
autoWatch: true,
|
|
54
|
+
|
|
55
|
+
// start these browsers
|
|
56
|
+
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
|
57
|
+
browsers: ['Chrome'],
|
|
58
|
+
|
|
59
|
+
// Continuous Integration mode
|
|
60
|
+
// if true, Karma captures browsers, runs the tests and exits
|
|
61
|
+
singleRun: false,
|
|
62
|
+
|
|
63
|
+
// Concurrency level
|
|
64
|
+
// how many browser should be started simultaneous
|
|
65
|
+
concurrency: Infinity,
|
|
66
|
+
|
|
67
|
+
rollupPreprocessor: {
|
|
68
|
+
output: {
|
|
69
|
+
format: 'umd', // Helps prevent naming collisions.
|
|
70
|
+
name: 'app', // Required for 'iife' format.
|
|
71
|
+
sourcemap: 'inline' // Sensible for testing.
|
|
72
|
+
},
|
|
73
|
+
plugins: [
|
|
74
|
+
commonjs({
|
|
75
|
+
include: ['node_modules/**'] // Default: undefined
|
|
76
|
+
}),
|
|
77
|
+
globals(),
|
|
78
|
+
builtins(),
|
|
79
|
+
resolve(),
|
|
80
|
+
json(),
|
|
81
|
+
istanbul({
|
|
82
|
+
// exclude: ['test/**/*.js']
|
|
83
|
+
}),
|
|
84
|
+
babel({
|
|
85
|
+
exclude: 'node_modules/**',
|
|
86
|
+
babelrc: false,
|
|
87
|
+
presets: [
|
|
88
|
+
[
|
|
89
|
+
'@babel/preset-env',
|
|
90
|
+
{
|
|
91
|
+
modules: 'false' //设置false 否则 Babel 会在 Rollup 做处理之前,将我们的模块转成 CommonJS,导致 Rollup 的一些处理失败
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
]
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
};
|