@4players/odin-plugin-web 1.15.4 → 1.16.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var o=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var I=(x,F)=>{for(var A in F)o(x,A,{get:F[A],enumerable:!0})},R=(x,F,A,D)=>{if(F&&typeof F=="object"||typeof F=="function")for(let r of S(F))!K.call(x,r)&&r!==A&&o(x,r,{get:()=>F[r],enumerable:!(D=M(F,r))||D.enumerable});return x};var U=x=>R(o({},"__esModule",{value:!0}),x);var
|
|
1
|
+
"use strict";var o=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var I=(x,F)=>{for(var A in F)o(x,A,{get:F[A],enumerable:!0})},R=(x,F,A,D)=>{if(F&&typeof F=="object"||typeof F=="function")for(let r of S(F))!K.call(x,r)&&r!==A&&o(x,r,{get:()=>F[r],enumerable:!(D=M(F,r))||D.enumerable});return x};var U=x=>R(o({},"__esModule",{value:!0}),x);var qx={};I(qx,{createCaptureWorker:()=>dx,createPlaybackWorker:()=>cx});module.exports=U(qx);var P=require("@4players/odin-common");var f={};I(f,{AdditionalCaptureBlocks:()=>W,AdditionalPlaybackBlocks:()=>V,ClockJumpCheckInterval:()=>Ax,ClockJumpThreshold:()=>Fx,ConnectInterval:()=>bx,ConnectTimeout:()=>Cx,DefaultRefreshRate:()=>X,DefaultVideoCodec:()=>lx,HealthCheckTimeout:()=>xx,MainConnectionPingInterval:()=>Dx,MaxNumberOfDecoders:()=>Z,MaxReconnectDuration:()=>sx,MinDBFs:()=>a,MinTokenLifetime:()=>ex,MinTokenRefreshInterval:()=>fx,PlaybackPreload:()=>Q,RenderQuantumSize:()=>Y,VadPreload:()=>z,WebRtcAnswerTimeout:()=>vx,WebRtcIceTimeout:()=>jx,WebRtcMaxNegotiationAttempts:()=>tx,WebRtcRecoveryDelays:()=>Ex,WebRtcStatsSnapshotInterval:()=>rx,WebRtcTimeout:()=>Bx});var V=3,W=3,Q=3,X=250,z=3,Z=512,Y=128,a=-758.596,xx=1e4,Ax=1e3,Fx=1e4,Dx=3e3,rx=1e3,jx=3e3,Bx=1e4,vx=1e4,tx=3,Ex=[0,2e3,5e3],Cx=5e3,ex=6e4,fx=5e3,bx=[0,100,200,200,500],sx=12e4,lx="H264";function v(x,F,A){return x.postMessage(F,A)}function k(x,F){return new Promise(A=>{let D=r=>{let[j]=r.data;j===F&&(A(r.data[1]),x.removeEventListener("message",D))};x.addEventListener("message",D)})}function u(x,F){x.values[0]=F[0],x.values[1]=F[1]}function g(x,F){return x.values[2+F*5]}function y(x,F,A){let D=2+F*5+1;x.values[D+0]=A[0],x.values[D+1]=A[1]}function H(x){return x.values[0]!==0}function L(x){return x.values[1]}function N(x){return x.values[2]}function _(x,F){return x.values[3]=F}var E=require("@4players/odin-common"),O;function d(x,...F){let A=nx(F);O?O?.error(x,A):(0,E.error)(x,A)}function nx(...x){if(x.length===1&&typeof x[0]=="object"&&x[0]!==null)return{...x[0]};if(x.length>0)return{args:x}}var J={isSilent:!0,rmsDBFS:-758.596};function C(x){return x.connectionId*4294967296+x.mediaId}var b=[],e=[],l=class{constructor(F,A,D){this.audioContext=F;this.worklet=A;this.worker=D;this.availableIndexes=[];this.medias=new Map;D.addEventListener("message",this._OnMessages.bind(this))}connectOutput(F){this.worklet.disconnect(),this.worklet.connect(F)}receivePacket(F,A){v(this.worker,["playbackReceivePacket",{connectionId:F,packet:A}],[A.buffer])}addMedias(F,A,D=[1,1]){let r=[];for(let j of A){let B=this._GetFreeIndex();B!==void 0&&(this.medias.set(C({connectionId:F,mediaId:j}),{index:B}),r.push({connectionId:F,mediaId:j,index:B,volume:D}))}v(this.worker,["playbackUpdateMedias",{added:r,removed:[]}])}removeMedias(F,A){let D=[];for(let r of A){let j=C({connectionId:F,mediaId:r}),B=this.medias.get(j);B!==void 0&&(this.medias.delete(j),this.availableIndexes.push(B.index),D.push({connectionId:F,mediaId:r,index:B.index}))}v(this.worker,["playbackUpdateMedias",{added:[],removed:D}])}close(){v(this.worker,["close",void 0]),v(this.worklet.port,["close",void 0]);let F=b.indexOf(this.worker);F>=0&&b.splice(F,1);let A=e.indexOf(this.worklet);A>=0&&e.splice(A,1)}async dump(){return{playbackWorker:await i(this.worker),playbackWorklet:await i(this.worklet.port)}}_GetFreeIndex(){return this.availableIndexes.pop()}_OnMessages(F){}},n=class x{constructor(F,A,D,r,j){this.worklet=F;this.worker=A;this.sink=(B,t)=>{j.deref()!==void 0?D(B,t):(d("capture worker was left abandoned, aborting capture worker"),x.shutdown(F,A))},this.monitorSink=(B,t)=>{j.deref()!==void 0?r(B,t):(d("capture worker was left abandoned, aborting capture worker"),x.shutdown(F,A))},A.addEventListener("message",this._OnMessages.bind(this))}get context(){return this.worklet.context}setMedias(F){v(this.worker,["captureSetMedias",{connections:F}])}setVad(F){v(this.worker,["captureSetVad",F])}close(){x.shutdown(this.worklet,this.worker)}static shutdown(F,A){v(F.port,["close",void 0]),v(A,["close",void 0]);let D=b.indexOf(A);D>=0&&b.splice(D,1);let r=e.indexOf(F);r>=0&&e.splice(r,1)}async dump(){return{captureWorker:await i(this.worker),captureWorklet:await i(this.worklet.port)}}_OnMessages(F){let[A,D]=F.data;A==="sendPacket"&&(D.connectionId===0?this.monitorSink(D.connectionId,D.packet):this.sink(D.connectionId,D.packet))}};function q(x,F,A,D,r){return Promise.all([ix(x),ox(A,F,D,r)])}async function ix(x){let F=URL.createObjectURL(new Blob([x],{type:"text/javascript"})),A=new Worker(F,{type:"module",name:"odin worker"});return b.push(A),A}var c=new WeakMap;async function ox(x,F,A,D){try{let B=new AudioWorkletNode(x,A,D);return e.push(B),B}catch{}let r=c.get(x);if(r===void 0){let B=URL.createObjectURL(new Blob([F],{type:"text/javascript"}));r=x.audioWorklet.addModule(B),c.set(x,r),r.catch(()=>c.delete(x))}await r;let j=new AudioWorkletNode(x,A,D);return e.push(j),j}function i(x){let{port1:F,port2:A}=new MessageChannel,{promise:D,resolve:r}=Promise.withResolvers();return A.onmessage=j=>r(j.data),setTimeout(()=>r("timeout"),100),v(x,["dump",{result:F}],[F]),D}var G=`"use strict";(()=>{var fn=Object.create;var ar=Object.defineProperty;var qn=Object.getOwnPropertyDescriptor;var Gn=Object.getOwnPropertyNames;var pn=Object.getPrototypeOf,En=Object.prototype.hasOwnProperty;var mn=(e,A)=>()=>{try{return A||e((A={exports:{}}).exports,A),A.exports}catch(t){throw A=0,t}},hn=(e,A)=>{for(var t in A)ar(e,t,{get:A[t],enumerable:!0})},$n=(e,A,t,s)=>{if(A&&typeof A=="object"||typeof A=="function")for(let i of Gn(A))!En.call(e,i)&&i!==t&&ar(e,i,{get:()=>A[i],enumerable:!(s=qn(A,i))||s.enumerable});return e};var Fn=(e,A,t)=>(t=e!=null?fn(pn(e)):{},$n(A||!e||!e.__esModule?ar(t,"default",{value:e,enumerable:!0}):t,e));var vt=mn((Ft,MA)=>{"use strict";var SA=(()=>{var e=globalThis.document?.currentScript?.src;return async function(A={}){var t=A,s=!!globalThis.window,i=!!globalThis.WorkerGlobalScope,d=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer",C=i&&globalThis.name=="em-pthread",E=[],_="./this.program",D=(r,j)=>{throw j};i&&(e=self.location.href);var UA="",T,yt;if(s||i){try{UA=new URL(".",e).href}catch{}i&&(yt=r=>{var j=new XMLHttpRequest;return j.open("GET",r,!1),j.responseType="arraybuffer",j.send(null),new Uint8Array(j.response)}),T=async r=>{var j=await fetch(r,{credentials:"same-origin"});if(j.ok)return j.arrayBuffer();throw new Error(j.status+" : "+j.url)}}var KA=console.log.bind(console),J=console.error.bind(console),gt,nA,pA=!1,z;class Dt{}class xs extends Dt{}function xt(r){for(var j=0,n=r.length,l=new Uint8Array(n),o;j<n;++j)o=r.charCodeAt(j),l[j]=~o>>8&o;return l}var Hr;if(C){let r=function(j){try{var n=j.data,l=n.cmd;if(l==1){let o=[];self.onmessage=a=>o.push(a),Hr=()=>{postMessage({cmd:3});for(let a of o)r(a);self.onmessage=r};for(let a of n.handlers)(!t[a]||t[a].proxy)&&(t[a]=(...k)=>{postMessage({cmd:9,handler:a,args:k})},a=="print"&&(KA=t[a]),a=="printErr"&&(J=t[a]));iA=n.wasmMemory,yr(),nA=n.wasmModule,Br(),Bj(),Hr()}else if(l==2){Ut(n.pthread_ptr),ir(n.pthread_ptr,0,0,1,0,0),m.threadInitTLS(),er(n.pthread_ptr),RA||(mj(),RA=!0);try{Kt(n.start_routine,n.arg)}catch(o){if(o!="unwind")throw o}}else l==4?RA&&gA():l&&(J(\`worker: received unknown command \${l}\`),J(n))}catch(o){throw Lr&&$j(),o}};var Ns=r,RA=!1;self.onunhandledrejection=j=>{throw j.reason||j},self.onmessage=r}var Lr=!1;function yr(){var r=iA.buffer;R=new Int8Array(r),$A=new Int16Array(r),t.HEAPU8=x=new Uint8Array(r),oA=new Uint16Array(r),t.HEAP32=S=new Int32Array(r),t.HEAPU32=$=new Uint32Array(r),t.HEAPF32=aj=new Float32Array(r),mA=new Float64Array(r),K=new BigInt64Array(r),Vr=new BigUint64Array(r)}function Bt(){if(!C){{var r=16777216;iA=new WebAssembly.Memory({initial:r/65536,maximum:r/65536,shared:!0})}yr()}}function Nt(){var r=t.preRun;r&&(typeof r=="function"&&(r=[r]),Pr.push(...r)),Jr(Pr)}function gr(){Lr=!0,!C&&jA.F()}function bt(){var r=t.postRun;r&&(typeof r=="function"&&(r=[r]),Ur.push(...r)),Jr(Ur)}function EA(r){t.onAbort?.(r),r=\`Aborted(\${r})\`,J(r),pA=!0,r+=". Build with -sASSERTIONS for more info.";var j=new WebAssembly.RuntimeError(r);throw j}var Dr;function Ot(){return xt(\`\\0asm\\0\\0\\0\\xAC=\\\`\\x7F\\0\\\`\\x7F\\x7F\\\`\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\x7F\\\`\\0\\0\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\\`||\\\`\\0\\x7F\\\`\\x7F}\\\`}}\\\`\\x07\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\\`\\b\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F~\\x7F~\\\`\\x7F\\x7F}\\\`\\x7F}}\\\`\\x7F\\x7F}}\\0\\\`
|
|
2
2
|
\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`|}\\\`|\\x7F|\\\`\\x7F\\x7F}\\0\\\`\\x07\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\` \\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\f\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\b\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\\`\\x07\\x7F|\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\\`\\x7F\\x7F\\x7F|}\\\`\\x7F\\x7F\\x7F~~\\0\\\`\\x07\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F|\\\`\\0|\\\`\\r\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F~\\x7F\\x7F\\x7F\\\`\\x7F\\x7F|\\\`\\v\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F}\\x7F\\x7F\\x7F\\\`\\v\\x7F\\x7F\\x7F\\x7F\\x7F}}\\x7F\\x7F\\x7F\\x7F\\0\\\`~\\x7F\\x7F\\\` \\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F}\\x7F\\x7F\\\`||\\x7F|\\\`|||\\\`\\x7F\\x7F\\x7F|\\\`\\v\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\v\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\\`\\x07\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F}\\\`\\f\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\\`}\\x7F\\x7F\\\`|\\x7F\\x7F\\\`\\x7F\\x7F\\x7F}\\\`\\x7F}\\x7F\\0\\\`\\x7F\\x7F}\\x7F\\x7F\\x7F}\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F}\\x7F\\x7F\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F}}\\0\\\`\\x7F\\x7F\\x7F\\x7F\\x7F|\\\`\\x7F\\x7F|\\0\\xBFaa\\x80\\x80ab\\0ac\\0ad\\0ae\\0af\\0ag\\0ah\\0!ai\\0
|
|
3
3
|
aj\\0"ak\\0#al\\0am\\0 an\\0$ao\\0ap\\0aq\\0ar\\0\\0as\\0\\0at\\0au\\0av\\0%aw\\0ax\\0\\bay\\0\\0az\\0\\0aA\\0\\baB\\0\\0aC\\0\\baD\\0\\0aE\\0\\xFD\\xFB\\0\\x07\\f&\\0\\f\\x07\\f\\f\\0\\x07\\0'(
|
|
4
4
|
\\b\\v)*\\0\\f+,-\\x07\\v\\0\\0\\x07\\0\\b\\b\\x1B
|
|
@@ -3361,7 +3361,7 @@ K\\xE08\\xDF\\0}\\xBC\\x8A\\x1B\\f\\xE5\\xFF\\xCF\\xE8?\\x9F\\xFFFq\\0\\x88\\xB
|
|
|
3361
3361
|
|
|
3362
3362
|
|
|
3363
3363
|
\\x07\\0\\0 \\v\\0\\0 \\v\\0\\0\\v\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\v\\r\\0\\r\\0\\0\\0 \\0\\0\\0 \\0\\0\\0!\\f\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0 \\f\\0\\0\\0\\0\\0\\f\\0\\0\\f!\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0*\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0 !\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0\\xC0 \\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0\\0\\x000123456789ABCDEFp\\0\\xC8\\0NSt3__214__shared_countE\\0\\0\\0\\0\\xF4\\0\\xFC\\0\\0\\0\\0\\0\\0\\0\\0\\xC0\\0\\0\\0\\0\\0NSt3__219__shared_weak_countE\\0\\0\\0\\x98\\0(\\x008\\0N10__cxxabiv116__shim_type_infoE\\0\\0\\0\\0\\x98\\0X\\0\\0N10__cxxabiv117__class_type_infoE\\0\\0\\0\\x98\\0\\x88\\0\\0N10__cxxabiv117__pbase_type_infoE\\0\\0\\0\\x98\\0\\xB8\\0|\\0N10__cxxabiv119__pointer_type_infoE\\0\\x98\\0\\xE8\\0\\0N10__cxxabiv120__function_type_infoE\\0\\0\\0\\0\\x98\\0\\0|\\0N10__cxxabiv129__pointer_to_member_type_infoE\\0\\0\\0\\0\\0\\0\\0h\\0k\\0\\0\\0l\\0\\0\\0m\\0\\0\\0n\\0\\0\\0o\\0\\0\\0\\x98\\0t\\0\\0N10__cxxabiv123__fundamental_type_infoE\\0T\\0\\xA4\\0v\\0Dn\\0\\0\\0\\0T\\0\\xB4\\0b\\0\\0\\0T\\0\\xC0\\0c\\0\\0\\0T\\0\\xCC\\0h\\0\\0\\0T\\0\\xD8\\0a\\0\\0\\0T\\0\\xE4\\0s\\0\\0\\0T\\0\\xF0\\0t\\0\\0\\0T\\0\\xFC\\0i\\0\\0\\0T\\0\\b\\0j\\0\\0\\0T\\0\\0l\\0\\0\\0T\\0 \\0m\\0\\0\\0T\\0,\\0x\\0\\0\\0T\\x008\\0y\\0\\0\\0T\\0D\\0f\\0\\0\\0P\\0X\\0\\0\\0\\0\\0<\\0Pf\\0\\0T\\0d\\0d\\0\\0\\0\\0\\0\\0\\0L\\0k\\0\\0\\0p\\0\\0\\0m\\0\\0\\0n\\0\\0\\0q\\0\\0\\0r\\0\\0\\0s\\0\\0\\0t\\0\\0\\0\\0\\0\\0\\0\\xB8\\0k\\0\\0\\0u\\0\\0\\0m\\0\\0\\0n\\0\\0\\0q\\0\\0\\0v\\0\\0\\0w\\0\\0\\0x\\0\\0\\0\\x98\\0\\xC4\\0L\\0N10__cxxabiv120__si_class_type_infoE\\0\\0\\0\\0\\0\\0\\0\\0\\0k\\0\\0\\0y\\0\\0\\0m\\0\\0\\0n\\0\\0\\0q\\0\\0\\0z\\0\\0\\0{\\0\\0\\0|\\0\\0\\0\\x98\\0 \\0L\\0N10__cxxabiv121__vmi_class_type_infoE\\0\\0\\0\\0\\0\\0\\0\\xAC\\0k\\0\\0\\0}\\0\\0\\0m\\0\\0\\0n\\0\\0\\0~\\0\\0\\0\\0\\0\\0\\0\\xAC\\0C\\0\\0\\0\\x7F\\0\\0\\0\\x80\\0\\0\\0p\\0\\x80\\0St9exception\\0\\0\\0\\0\\x98\\0\\x9C\\0x\\0St9bad_alloc\\0\\0\\0\\0\\x98\\0\\xB8\\0\\x90\\0St20bad_array_new_length\\0\\0\\0\\0\\0\\0\\0\\0\\xE8\\0E\\0\\0\\0\\x81\\0\\0\\0\\x82\\0\\0\\0\\x98\\0\\xF4\\0x\\0St11logic_error\\0\\0\\0\\0\\0\\0E\\0\\0\\0\\x83\\0\\0\\0\\x82\\0\\0\\0\\x98\\0$\\0\\xE8\\0St12length_error\\0\\0\\0\\0p\\0@\\0St9type_info\\0\\\`P\\0P\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0c\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0d\\0\\0\\0e\\0\\0\\x000\\x1B\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFFY\\x90\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0f\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0d\\0\\0\\0g\\0\\0\\x008\\x1B\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\xFF\\xFF\\xFF\\xFF
|
|
3364
|
-
\\f(\\0p!\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\x94\\0\\0\\0\\0\\0\\0\\0\\0\\0\`)}function xs(r){return r}async function Jt(r){return r}async function Pt(r,j){try{var n=await Jt(r),l=await WebAssembly.instantiate(n,j);return l}catch(o){J(\`failed to asynchronously prepare wasm: \${o}\`),EA(o)}}async function wt(r,j,n){return Pt(j,n)}function xr(){dn();var r={a:xj};return r}async function Br(){function r(u,c){return jA=u.exports,Rt(jA.M),cn(jA),nA=c,jA}function j(u){return r(u.instance,u.module)}var n=xr(),l=t.instantiateWasm;if(l)return new Promise(u=>{l(n,(c,q)=>u(r(c,q)))});if(C){var o=new WebAssembly.Instance(nA,xr());return r(o,nA)}Dr??=Ot();var a=await wt(gt,Dr,n),k=j(a);return k}class Nr{name="ExitStatus";constructor(j){this.message=\`Program terminated with exit(\${j})\`,this.status=j}}var br=r=>{r.terminate(),r.onmessage=j=>{}},Or=r=>{var j=m.pthreads[r];m.returnWorkerToPool(j)},Jr=r=>{for(;r.length>0;)r.shift()(t)},Pr=[],Tt=r=>{var j=m.getNewWorker();if(!j)return 6;m.pthreads[r.pthread_ptr]=j,j.pthread_ptr=r.pthread_ptr;var n={cmd:2,start_routine:r.startRoutine,arg:r.arg,pthread_ptr:r.pthread_ptr};return j.postMessage(n,r.transferList),0},VA=0,QA=()=>zA||VA>0,wr=()=>gj(),WA=r=>Lj(r),St=r=>yj(r),mA,K,sA=(r,j,n,...l)=>{var o=8*l.length*2,a=wr(),k=St(o),u=k>>3;for(var c of l)typeof c=="bigint"?(K[u++]=1n,K[u++]=c):(K[u++]=0n,mA[u++]=c);var q=vj(r,j,o,k,n);return WA(a),q};function Tr(r){if(C)return sA(0,0,1,r);z=r,QA()||(m.terminateAllThreads(),t.onExit?.(r),pA=!0),D(r,new Nr(r))}function Sr(r){if(C)return sA(1,0,0,r);XA(r)}var Mt=(r,j)=>{if(z=r,C)throw Sr(r),"unwind";Tr(r)},XA=Mt,Mr=!Atomics.waitAsync||globalThis.navigator?.userAgent&&Number((navigator.userAgent.match(/Chrom(e|ium)\\/([0-9]+)\\./)||[])[2])<91,S,m={unusedWorkers:[],tlsInitFunctions:[],pthreads:{},init(){C||m.initMainThread()},initMainThread(){},terminateAllThreads:()=>{for(var r of Object.values(m.pthreads))br(r);for(var r of m.unusedWorkers)br(r);m.unusedWorkers=[],m.pthreads={}},clearMailboxAwait:r=>{Mr||Atomics.notify(S,r>>2)},terminateRuntime:()=>{m.terminateAllThreads();var r=kA();hj(0,0,0,1),m.clearMailboxAwait(r)},returnWorkerToPool:r=>{var j=r.pthread_ptr;delete m.pthreads[j],m.unusedWorkers.push(r),r.pthread_ptr=0,m.clearMailboxAwait(j),Ij(j)},threadInitTLS(){m.tlsInitFunctions.forEach(r=>r())},loadWasmModuleToWorker:r=>new Promise(j=>{r.onmessage=a=>{var k=a.data,u=k.cmd;if(k.targetThread&&k.targetThread!=kA()){var c=m.pthreads[k.targetThread];c?.postMessage(k);return}if(k==="setimmediate"||k==="_si"){r.postMessage(k);return}switch(u){case 4:gA();break;case 5:Tt(k);break;case 6:fj(()=>Or(k.thread));break;case 3:j(r);break;case 9:t[k.handler](...k.args);break;default:u&&J(\`worker sent an unknown command \${u}\`)}},r.onerror=a=>{var k="worker sent an error!";throw J(\`\${k} \${a.filename}:\${a.lineno}: \${a.message}\`),a};var n=[],l=["onExit","onAbort","print","printErr"];for(var o of l)t.propertyIsEnumerable(o)&&n.push(o);r.postMessage({cmd:1,handlers:n,wasmMemory:iA,wasmModule:nA})}),allocateUnusedWorker(){var r,j=e;return r=new Worker(j,{name:"em-pthread"}),m.unusedWorkers.push(r),r},getNewWorker(){if(m.unusedWorkers.length==0){var r=m.allocateUnusedWorker();m.loadWasmModuleToWorker(r)}return m.unusedWorkers.pop()}},Ur=[],$;function Ut(r){var j=$[r+48>>2],n=$[r+52>>2],l=j-n;Hj(j,l),WA(j)}var Kr=[],Rr=r=>{var j=Kr[r];return j||(Kr[r]=j=Dj.get(r)),j},Kt=(r,j)=>{VA=0,zA=0;var n=Rr(r)(j);function l(o){if(QA()){z=o;return}lr(o)}l(n)},zA=!0,Rt=r=>m.tlsInitFunctions.push(r),iA,R;class Vt{constructor(j){this.excPtr=j,this.ptr=j-24}set_type(j){$[this.ptr+4>>2]=j}get_type(){return $[this.ptr+4>>2]}set_destructor(j){$[this.ptr+8>>2]=j}get_destructor(){return $[this.ptr+8>>2]}set_caught(j){j=j?1:0,R[this.ptr+12]=j}get_caught(){return R[this.ptr+12]!=0}set_rethrown(j){j=j?1:0,R[this.ptr+13]=j}get_rethrown(){return R[this.ptr+13]!=0}init(j,n){this.set_adjusted_ptr(0),this.set_type(j),this.set_destructor(n)}set_adjusted_ptr(j){$[this.ptr+16>>2]=j}get_adjusted_ptr(){return $[this.ptr+16>>2]}}var Qt=0,Wt=r=>{EA()},Xt=(r,j,n)=>{var l=new Vt(r);l.init(j,n),Qt++,Wt(r)},zt=()=>EA(""),x,H=r=>{for(var j="";;){var n=x[r++];if(!n)return j;j+=String.fromCharCode(n)}},Z={},Y={},hA={};class lA extends Error{constructor(j){super(j),this.name="BindingError"}}var G=r=>{throw new lA(r)};function Zt(r,j,n={}){var l=j.name;if(r||G(\`type "\${l}" must have a positive integer typeid pointer\`),Y.hasOwnProperty(r)){if(n.ignoreDuplicateRegistrations)return;G(\`Cannot register type '\${l}' twice\`)}if(Y[r]=j,delete hA[r],Z.hasOwnProperty(r)){var o=Z[r];delete Z[r],o.forEach(a=>a())}}function N(r,j,n={}){return Zt(r,j,n)}var $A,oA,Vr,Qr=(r,j,n)=>{switch(j){case 1:return n?l=>R[l]:l=>x[l];case 2:return n?l=>$A[l>>1]:l=>oA[l>>1];case 4:return n?l=>S[l>>2]:l=>$[l>>2];case 8:return n?l=>K[l>>3]:l=>Vr[l>>3];default:throw new TypeError(\`invalid integer width (\${j}): \${r}\`)}},Yt=(r,j,n,l,o)=>{j=H(j);let a=l===0n,k=u=>u;if(a){let u=n*8;k=c=>BigInt.asUintN(u,c),o=k(o)}N(r,{name:j,fromWireType:k,toWireType:(u,c)=>(typeof c=="number"&&(c=BigInt(c)),c),readValueFromPointer:Qr(j,n,!a),destructorFunction:null})},Ae=(r,j,n,l)=>{j=H(j),N(r,{name:j,fromWireType:function(o){return!!o},toWireType:function(o,a){return a?n:l},readValueFromPointer:function(o){return this.fromWireType(x[o])},destructorFunction:null})},re=r=>({count:r.count,deleteScheduled:r.deleteScheduled,preservePointerOnDelete:r.preservePointerOnDelete,ptr:r.ptr,ptrType:r.ptrType,smartPtr:r.smartPtr,smartPtrType:r.smartPtrType}),ZA=r=>{function j(n){return n.$$.ptrType.registeredClass.name}G(j(r)+" instance already deleted")},YA=!1,Wr=r=>{},je=r=>{r.smartPtr?r.smartPtrType.rawDestructor(r.smartPtr):r.ptrType.registeredClass.rawDestructor(r.ptr)},Xr=r=>{r.count.value-=1;var j=r.count.value===0;j&&je(r)},aA=r=>globalThis.FinalizationRegistry?(YA=new FinalizationRegistry(j=>{Xr(j.$$)}),aA=j=>{var n=j.$$,l=!!n.smartPtr;if(l){var o={$$:n};YA.register(j,o,j)}return j},Wr=j=>YA.unregister(j),aA(r)):(aA=j=>j,r),FA=[],te=()=>{for(;FA.length;){var r=FA.pop();r.$$.deleteScheduled=!1,r.delete()}},zr,ee=()=>{let r=vA.prototype;Object.assign(r,{isAliasOf(n){if(!(this instanceof vA)||!(n instanceof vA))return!1;var l=this.$$.ptrType.registeredClass,o=this.$$.ptr;n.$$=n.$$;for(var a=n.$$.ptrType.registeredClass,k=n.$$.ptr;l.baseClass;)o=l.upcast(o),l=l.baseClass;for(;a.baseClass;)k=a.upcast(k),a=a.baseClass;return l===a&&o===k},clone(){if(this.$$.ptr||ZA(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var n=aA(Object.create(Object.getPrototypeOf(this),{$$:{value:re(this.$$)}}));return n.$$.count.value+=1,n.$$.deleteScheduled=!1,n},delete(){this.$$.ptr||ZA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),Wr(this),Xr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||ZA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),FA.push(this),FA.length===1&&zr&&zr(te),this.$$.deleteScheduled=!0,this}});let j=Symbol.dispose;j&&(r[j]=r.delete)};function vA(){}var Zr=(r,j)=>Object.defineProperty(j,"name",{value:r}),Yr={},Aj=(r,j,n)=>{if(r[j].overloadTable===void 0){var l=r[j];r[j]=function(...o){return r[j].overloadTable.hasOwnProperty(o.length)||G(\`Function '\${n}' called with an invalid number of arguments (\${o.length}) - expects one of (\${r[j].overloadTable})!\`),r[j].overloadTable[o.length].apply(this,o)},r[j].overloadTable=[],r[j].overloadTable[l.argCount]=l}},rj=(r,j,n)=>{t.hasOwnProperty(r)?((n===void 0||t[r].overloadTable!==void 0&&t[r].overloadTable[n]!==void 0)&&G(\`Cannot register public name '\${r}' twice\`),Aj(t,r,r),t[r].overloadTable.hasOwnProperty(n)&&G(\`Cannot register multiple overloads of a function with the same number of arguments (\${n})!\`),t[r].overloadTable[n]=j):(t[r]=j,t[r].argCount=n)},ne=48,se=57,ie=r=>{r=r.replace(/[^a-zA-Z0-9_]/g,"$");var j=r.charCodeAt(0);return j>=ne&&j<=se?\`_\${r}\`:r};function le(r,j,n,l,o,a,k,u){this.name=r,this.constructor=j,this.instancePrototype=n,this.rawDestructor=l,this.baseClass=o,this.getActualType=a,this.upcast=k,this.downcast=u,this.pureVirtualFunctions=[]}var IA=(r,j,n)=>{for(;j!==n;)j.upcast||G(\`Expected null or instance of \${n.name}, got an instance of \${j.name}\`),r=j.upcast(r),j=j.baseClass;return r},Ar=r=>{if(r===null)return"null";var j=typeof r;return j==="object"||j==="array"||j==="function"?r.toString():""+r};function oe(r,j){if(j===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;j.$$||G(\`Cannot pass "\${Ar(j)}" as a \${this.name}\`),j.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`);var n=j.$$.ptrType.registeredClass,l=IA(j.$$.ptr,n,this.registeredClass);return l}function ae(r,j){var n;if(j===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),this.isSmartPointer?(n=this.rawConstructor(),r!==null&&r.push(this.rawDestructor,n),n):0;(!j||!j.$$)&&G(\`Cannot pass "\${Ar(j)}" as a \${this.name}\`),j.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`),!this.isConst&&j.$$.ptrType.isConst&&G(\`Cannot convert argument of type \${j.$$.smartPtrType?j.$$.smartPtrType.name:j.$$.ptrType.name} to parameter type \${this.name}\`);var l=j.$$.ptrType.registeredClass;if(n=IA(j.$$.ptr,l,this.registeredClass),this.isSmartPointer)switch(j.$$.smartPtr===void 0&&G("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:j.$$.smartPtrType===this?n=j.$$.smartPtr:G(\`Cannot convert argument of type \${j.$$.smartPtrType?j.$$.smartPtrType.name:j.$$.ptrType.name} to parameter type \${this.name}\`);break;case 1:n=j.$$.smartPtr;break;case 2:if(j.$$.smartPtrType===this)n=j.$$.smartPtr;else{var o=j.clone();n=this.rawShare(n,tr.toHandle(()=>o.delete())),r!==null&&r.push(this.rawDestructor,n)}break;default:G("Unsupported sharing policy")}return n}function ke(r,j){if(j===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;j.$$||G(\`Cannot pass "\${Ar(j)}" as a \${this.name}\`),j.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`),j.$$.ptrType.isConst&&G(\`Cannot convert argument of type \${j.$$.ptrType.name} to parameter type \${this.name}\`);var n=j.$$.ptrType.registeredClass,l=IA(j.$$.ptr,n,this.registeredClass);return l}function _A(r){return this.fromWireType($[r>>2])}var jj=(r,j,n)=>{if(j===n)return r;if(n.baseClass===void 0)return null;var l=jj(r,j,n.baseClass);return l===null?null:n.downcast(l)},ue={},ce=(r,j)=>{for(j===void 0&&G("ptr should not be undefined");r.baseClass;)j=r.upcast(j),r=r.baseClass;return j},de=(r,j)=>(j=ce(r,j),ue[j]);class Ce extends Error{constructor(j){super(j),this.name="InternalError"}}var HA=r=>{throw new Ce(r)},LA=(r,j)=>{(!j.ptrType||!j.ptr)&&HA("makeClassHandle requires ptr and ptrType");var n=!!j.smartPtrType,l=!!j.smartPtr;return n!==l&&HA("Both smartPtrType and smartPtr must be specified"),j.count={value:1},aA(Object.create(r,{$$:{value:j,writable:!0}}))};function fe(r){var j=this.getPointee(r);if(!j)return this.destructor(r),null;var n=de(this.registeredClass,j);if(n!==void 0){if(n.$$.count.value===0)return n.$$.ptr=j,n.$$.smartPtr=r,n.clone();var l=n.clone();return this.destructor(r),l}function o(){return this.isSmartPointer?LA(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:j,smartPtrType:this,smartPtr:r}):LA(this.registeredClass.instancePrototype,{ptrType:this,ptr:r})}var a=this.registeredClass.getActualType(j),k=Yr[a];if(!k)return o.call(this);var u;this.isConst?u=k.constPointerType:u=k.pointerType;var c=jj(j,this.registeredClass,u.registeredClass);return c===null?o.call(this):this.isSmartPointer?LA(u.registeredClass.instancePrototype,{ptrType:u,ptr:c,smartPtrType:this,smartPtr:r}):LA(u.registeredClass.instancePrototype,{ptrType:u,ptr:c})}var qe=()=>{Object.assign(yA.prototype,{getPointee(r){return this.rawGetPointee&&(r=this.rawGetPointee(r)),r},destructor(r){this.rawDestructor?.(r)},readValueFromPointer:_A,fromWireType:fe})};function yA(r,j,n,l,o,a,k,u,c,q,f){this.name=r,this.registeredClass=j,this.isReference=n,this.isConst=l,this.isSmartPointer=o,this.pointeeType=a,this.sharingPolicy=k,this.rawGetPointee=u,this.rawConstructor=c,this.rawShare=q,this.rawDestructor=f,!o&&j.baseClass===void 0?l?(this.toWireType=oe,this.destructorFunction=null):(this.toWireType=ke,this.destructorFunction=null):this.toWireType=ae}var tj=(r,j,n)=>{t.hasOwnProperty(r)||HA("Replacing nonexistent public symbol"),t[r].overloadTable!==void 0&&n!==void 0?t[r].overloadTable[n]=j:(t[r]=j,t[r].argCount=n)},P=(r,j,n=!1)=>{r=H(r);function l(){var a=Rr(j);return a}var o=l();return typeof o!="function"&&G(\`unknown function pointer with signature \${r}: \${j}\`),o};class Ge extends Error{}var pe=r=>{var j=Ej(r),n=H(j);return w(j),n},AA=(r,j)=>{var n=[],l={};function o(a){if(!l[a]&&!Y[a]){if(hA[a]){hA[a].forEach(o);return}n.push(a),l[a]=!0}}throw j.forEach(o),new Ge(\`\${r}: \`+n.map(pe).join([", "]))},M=(r,j,n)=>{r.forEach(u=>hA[u]=j);function l(u){var c=n(u);c.length!==r.length&&HA("Mismatched type converter count");for(var q=0;q<r.length;++q)N(r[q],c[q])}var o=new Array(j.length),a=[],k=0;for(let[u,c]of j.entries())Y.hasOwnProperty(c)?o[u]=Y[c]:(a.push(c),Z.hasOwnProperty(c)||(Z[c]=[]),Z[c].push(()=>{o[u]=Y[c],++k,k===a.length&&l(o)}));a.length===0&&l(o)},Ee=(r,j,n,l,o,a,k,u,c,q,f,p,v)=>{f=H(f),a=P(o,a),u&&=P(k,u),q&&=P(c,q),v=P(p,v);var I=ie(f);rj(I,function(){AA(\`Cannot construct \${f} due to unbound types\`,[l])}),M([r,j,n],l?[l]:[],F=>{F=F[0];var h,b;l?(h=F.registeredClass,b=h.instancePrototype):b=vA.prototype;var y=Zr(f,function(...or){if(Object.getPrototypeOf(this)!==Q)throw new lA(\`Use 'new' to construct \${f}\`);if(g.constructor_body===void 0)throw new lA(\`\${f} has no accessible constructor\`);var Oj=g.constructor_body[or.length];if(Oj===void 0)throw new lA(\`Tried to invoke ctor of \${f} with invalid number of parameters (\${or.length}) - expected (\${Object.keys(g.constructor_body).toString()}) parameters instead!\`);return Oj.apply(this,or)}),Q=Object.create(b,{constructor:{value:y}});y.prototype=Q;var g=new le(f,y,Q,v,h,a,u,q);g.baseClass&&(g.baseClass.__derivedClasses??=[],g.baseClass.__derivedClasses.push(g));var Cn=new yA(f,g,!0,!1,!1),Nj=new yA(f+"*",g,!1,!1,!1),bj=new yA(f+" const*",g,!1,!0,!1);return Yr[r]={pointerType:Nj,constPointerType:bj},tj(I,y),[Cn,Nj,bj]})},rr=(r,j)=>{for(var n=[],l=0;l<r;l++)n.push($[j+l*4>>2]);return n},ej=r=>{for(;r.length;){var j=r.pop(),n=r.pop();n(j)}};function nj(r){for(var j=1;j<r.length;++j)if(r[j]!==null&&r[j].destructorFunction===void 0)return!0;return!1}function sj(r){for(var j=1;j<r.length;++j)if(r[j]!==null&&r[j].argStackAlloc)return!0;return!1}function me(r,j,n,l){var o=nj(r),a=sj(r),k=a&&!l&&!o;a&&!k&&(o=!0);var u=r.length-2,c=[],q=["fn"];j&&q.push("thisWired");for(var f=0;f<u;++f)c.push(\`arg\${f}\`),q.push(\`arg\${f}Wired\`);c=c.join(),q=q.join();var p=\`return function (\${c}) {
|
|
3364
|
+
\\f(\\0p!\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\x94\\0\\0\\0\\0\\0\\0\\0\\0\\0\`)}function Bs(r){return r}async function Jt(r){return r}async function Pt(r,j){try{var n=await Jt(r),l=await WebAssembly.instantiate(n,j);return l}catch(o){J(\`failed to asynchronously prepare wasm: \${o}\`),EA(o)}}async function wt(r,j,n){return Pt(j,n)}function xr(){dn();var r={a:xj};return r}async function Br(){function r(u,c){return jA=u.exports,Rt(jA.M),cn(jA),nA=c,jA}function j(u){return r(u.instance,u.module)}var n=xr(),l=t.instantiateWasm;if(l)return new Promise(u=>{l(n,(c,q)=>u(r(c,q)))});if(C){var o=new WebAssembly.Instance(nA,xr());return r(o,nA)}Dr??=Ot();var a=await wt(gt,Dr,n),k=j(a);return k}class Nr{name="ExitStatus";constructor(j){this.message=\`Program terminated with exit(\${j})\`,this.status=j}}var br=r=>{r.terminate(),r.onmessage=j=>{}},Or=r=>{var j=m.pthreads[r];m.returnWorkerToPool(j)},Jr=r=>{for(;r.length>0;)r.shift()(t)},Pr=[],Tt=r=>{var j=m.getNewWorker();if(!j)return 6;m.pthreads[r.pthread_ptr]=j,j.pthread_ptr=r.pthread_ptr;var n={cmd:2,start_routine:r.startRoutine,arg:r.arg,pthread_ptr:r.pthread_ptr};return j.postMessage(n,r.transferList),0},VA=0,QA=()=>zA||VA>0,wr=()=>gj(),WA=r=>Lj(r),St=r=>yj(r),mA,K,sA=(r,j,n,...l)=>{var o=8*l.length*2,a=wr(),k=St(o),u=k>>3;for(var c of l)typeof c=="bigint"?(K[u++]=1n,K[u++]=c):(K[u++]=0n,mA[u++]=c);var q=vj(r,j,o,k,n);return WA(a),q};function Tr(r){if(C)return sA(0,0,1,r);z=r,QA()||(m.terminateAllThreads(),t.onExit?.(r),pA=!0),D(r,new Nr(r))}function Sr(r){if(C)return sA(1,0,0,r);XA(r)}var Mt=(r,j)=>{if(z=r,C)throw Sr(r),"unwind";Tr(r)},XA=Mt,Mr=!Atomics.waitAsync||globalThis.navigator?.userAgent&&Number((navigator.userAgent.match(/Chrom(e|ium)\\/([0-9]+)\\./)||[])[2])<91,S,m={unusedWorkers:[],tlsInitFunctions:[],pthreads:{},init(){C||m.initMainThread()},initMainThread(){},terminateAllThreads:()=>{for(var r of Object.values(m.pthreads))br(r);for(var r of m.unusedWorkers)br(r);m.unusedWorkers=[],m.pthreads={}},clearMailboxAwait:r=>{Mr||Atomics.notify(S,r>>2)},terminateRuntime:()=>{m.terminateAllThreads();var r=kA();hj(0,0,0,1),m.clearMailboxAwait(r)},returnWorkerToPool:r=>{var j=r.pthread_ptr;delete m.pthreads[j],m.unusedWorkers.push(r),r.pthread_ptr=0,m.clearMailboxAwait(j),Ij(j)},threadInitTLS(){m.tlsInitFunctions.forEach(r=>r())},loadWasmModuleToWorker:r=>new Promise(j=>{r.onmessage=a=>{var k=a.data,u=k.cmd;if(k.targetThread&&k.targetThread!=kA()){var c=m.pthreads[k.targetThread];c?.postMessage(k);return}if(k==="setimmediate"||k==="_si"){r.postMessage(k);return}switch(u){case 4:gA();break;case 5:Tt(k);break;case 6:fj(()=>Or(k.thread));break;case 3:j(r);break;case 9:t[k.handler](...k.args);break;default:u&&J(\`worker sent an unknown command \${u}\`)}},r.onerror=a=>{var k="worker sent an error!";throw J(\`\${k} \${a.filename}:\${a.lineno}: \${a.message}\`),a};var n=[],l=["onExit","onAbort","print","printErr"];for(var o of l)t.propertyIsEnumerable(o)&&n.push(o);r.postMessage({cmd:1,handlers:n,wasmMemory:iA,wasmModule:nA})}),allocateUnusedWorker(){var r,j=e;return r=new Worker(j,{name:"em-pthread"}),m.unusedWorkers.push(r),r},getNewWorker(){if(m.unusedWorkers.length==0){var r=m.allocateUnusedWorker();m.loadWasmModuleToWorker(r)}return m.unusedWorkers.pop()}},Ur=[],$;function Ut(r){var j=$[r+48>>2],n=$[r+52>>2],l=j-n;Hj(j,l),WA(j)}var Kr=[],Rr=r=>{var j=Kr[r];return j||(Kr[r]=j=Dj.get(r)),j},Kt=(r,j)=>{VA=0,zA=0;var n=Rr(r)(j);function l(o){if(QA()){z=o;return}lr(o)}l(n)},zA=!0,Rt=r=>m.tlsInitFunctions.push(r),iA,R;class Vt{constructor(j){this.excPtr=j,this.ptr=j-24}set_type(j){$[this.ptr+4>>2]=j}get_type(){return $[this.ptr+4>>2]}set_destructor(j){$[this.ptr+8>>2]=j}get_destructor(){return $[this.ptr+8>>2]}set_caught(j){j=j?1:0,R[this.ptr+12]=j}get_caught(){return R[this.ptr+12]!=0}set_rethrown(j){j=j?1:0,R[this.ptr+13]=j}get_rethrown(){return R[this.ptr+13]!=0}init(j,n){this.set_adjusted_ptr(0),this.set_type(j),this.set_destructor(n)}set_adjusted_ptr(j){$[this.ptr+16>>2]=j}get_adjusted_ptr(){return $[this.ptr+16>>2]}}var Qt=0,Wt=r=>{EA()},Xt=(r,j,n)=>{var l=new Vt(r);l.init(j,n),Qt++,Wt(r)},zt=()=>EA(""),x,H=r=>{for(var j="";;){var n=x[r++];if(!n)return j;j+=String.fromCharCode(n)}},Z={},Y={},hA={};class lA extends Error{constructor(j){super(j),this.name="BindingError"}}var G=r=>{throw new lA(r)};function Zt(r,j,n={}){var l=j.name;if(r||G(\`type "\${l}" must have a positive integer typeid pointer\`),Y.hasOwnProperty(r)){if(n.ignoreDuplicateRegistrations)return;G(\`Cannot register type '\${l}' twice\`)}if(Y[r]=j,delete hA[r],Z.hasOwnProperty(r)){var o=Z[r];delete Z[r],o.forEach(a=>a())}}function N(r,j,n={}){return Zt(r,j,n)}var $A,oA,Vr,Qr=(r,j,n)=>{switch(j){case 1:return n?l=>R[l]:l=>x[l];case 2:return n?l=>$A[l>>1]:l=>oA[l>>1];case 4:return n?l=>S[l>>2]:l=>$[l>>2];case 8:return n?l=>K[l>>3]:l=>Vr[l>>3];default:throw new TypeError(\`invalid integer width (\${j}): \${r}\`)}},Yt=(r,j,n,l,o)=>{j=H(j);let a=l===0n,k=u=>u;if(a){let u=n*8;k=c=>BigInt.asUintN(u,c),o=k(o)}N(r,{name:j,fromWireType:k,toWireType:(u,c)=>(typeof c=="number"&&(c=BigInt(c)),c),readValueFromPointer:Qr(j,n,!a),destructorFunction:null})},Ae=(r,j,n,l)=>{j=H(j),N(r,{name:j,fromWireType:function(o){return!!o},toWireType:function(o,a){return a?n:l},readValueFromPointer:function(o){return this.fromWireType(x[o])},destructorFunction:null})},re=r=>({count:r.count,deleteScheduled:r.deleteScheduled,preservePointerOnDelete:r.preservePointerOnDelete,ptr:r.ptr,ptrType:r.ptrType,smartPtr:r.smartPtr,smartPtrType:r.smartPtrType}),ZA=r=>{function j(n){return n.$$.ptrType.registeredClass.name}G(j(r)+" instance already deleted")},YA=!1,Wr=r=>{},je=r=>{r.smartPtr?r.smartPtrType.rawDestructor(r.smartPtr):r.ptrType.registeredClass.rawDestructor(r.ptr)},Xr=r=>{r.count.value-=1;var j=r.count.value===0;j&&je(r)},aA=r=>globalThis.FinalizationRegistry?(YA=new FinalizationRegistry(j=>{Xr(j.$$)}),aA=j=>{var n=j.$$,l=!!n.smartPtr;if(l){var o={$$:n};YA.register(j,o,j)}return j},Wr=j=>YA.unregister(j),aA(r)):(aA=j=>j,r),FA=[],te=()=>{for(;FA.length;){var r=FA.pop();r.$$.deleteScheduled=!1,r.delete()}},zr,ee=()=>{let r=vA.prototype;Object.assign(r,{isAliasOf(n){if(!(this instanceof vA)||!(n instanceof vA))return!1;var l=this.$$.ptrType.registeredClass,o=this.$$.ptr;n.$$=n.$$;for(var a=n.$$.ptrType.registeredClass,k=n.$$.ptr;l.baseClass;)o=l.upcast(o),l=l.baseClass;for(;a.baseClass;)k=a.upcast(k),a=a.baseClass;return l===a&&o===k},clone(){if(this.$$.ptr||ZA(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var n=aA(Object.create(Object.getPrototypeOf(this),{$$:{value:re(this.$$)}}));return n.$$.count.value+=1,n.$$.deleteScheduled=!1,n},delete(){this.$$.ptr||ZA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),Wr(this),Xr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||ZA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),FA.push(this),FA.length===1&&zr&&zr(te),this.$$.deleteScheduled=!0,this}});let j=Symbol.dispose;j&&(r[j]=r.delete)};function vA(){}var Zr=(r,j)=>Object.defineProperty(j,"name",{value:r}),Yr={},Aj=(r,j,n)=>{if(r[j].overloadTable===void 0){var l=r[j];r[j]=function(...o){return r[j].overloadTable.hasOwnProperty(o.length)||G(\`Function '\${n}' called with an invalid number of arguments (\${o.length}) - expects one of (\${r[j].overloadTable})!\`),r[j].overloadTable[o.length].apply(this,o)},r[j].overloadTable=[],r[j].overloadTable[l.argCount]=l}},rj=(r,j,n)=>{t.hasOwnProperty(r)?((n===void 0||t[r].overloadTable!==void 0&&t[r].overloadTable[n]!==void 0)&&G(\`Cannot register public name '\${r}' twice\`),Aj(t,r,r),t[r].overloadTable.hasOwnProperty(n)&&G(\`Cannot register multiple overloads of a function with the same number of arguments (\${n})!\`),t[r].overloadTable[n]=j):(t[r]=j,t[r].argCount=n)},ne=48,se=57,ie=r=>{r=r.replace(/[^a-zA-Z0-9_]/g,"$");var j=r.charCodeAt(0);return j>=ne&&j<=se?\`_\${r}\`:r};function le(r,j,n,l,o,a,k,u){this.name=r,this.constructor=j,this.instancePrototype=n,this.rawDestructor=l,this.baseClass=o,this.getActualType=a,this.upcast=k,this.downcast=u,this.pureVirtualFunctions=[]}var IA=(r,j,n)=>{for(;j!==n;)j.upcast||G(\`Expected null or instance of \${n.name}, got an instance of \${j.name}\`),r=j.upcast(r),j=j.baseClass;return r},Ar=r=>{if(r===null)return"null";var j=typeof r;return j==="object"||j==="array"||j==="function"?r.toString():""+r};function oe(r,j){if(j===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;j.$$||G(\`Cannot pass "\${Ar(j)}" as a \${this.name}\`),j.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`);var n=j.$$.ptrType.registeredClass,l=IA(j.$$.ptr,n,this.registeredClass);return l}function ae(r,j){var n;if(j===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),this.isSmartPointer?(n=this.rawConstructor(),r!==null&&r.push(this.rawDestructor,n),n):0;(!j||!j.$$)&&G(\`Cannot pass "\${Ar(j)}" as a \${this.name}\`),j.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`),!this.isConst&&j.$$.ptrType.isConst&&G(\`Cannot convert argument of type \${j.$$.smartPtrType?j.$$.smartPtrType.name:j.$$.ptrType.name} to parameter type \${this.name}\`);var l=j.$$.ptrType.registeredClass;if(n=IA(j.$$.ptr,l,this.registeredClass),this.isSmartPointer)switch(j.$$.smartPtr===void 0&&G("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:j.$$.smartPtrType===this?n=j.$$.smartPtr:G(\`Cannot convert argument of type \${j.$$.smartPtrType?j.$$.smartPtrType.name:j.$$.ptrType.name} to parameter type \${this.name}\`);break;case 1:n=j.$$.smartPtr;break;case 2:if(j.$$.smartPtrType===this)n=j.$$.smartPtr;else{var o=j.clone();n=this.rawShare(n,tr.toHandle(()=>o.delete())),r!==null&&r.push(this.rawDestructor,n)}break;default:G("Unsupported sharing policy")}return n}function ke(r,j){if(j===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;j.$$||G(\`Cannot pass "\${Ar(j)}" as a \${this.name}\`),j.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`),j.$$.ptrType.isConst&&G(\`Cannot convert argument of type \${j.$$.ptrType.name} to parameter type \${this.name}\`);var n=j.$$.ptrType.registeredClass,l=IA(j.$$.ptr,n,this.registeredClass);return l}function _A(r){return this.fromWireType($[r>>2])}var jj=(r,j,n)=>{if(j===n)return r;if(n.baseClass===void 0)return null;var l=jj(r,j,n.baseClass);return l===null?null:n.downcast(l)},ue={},ce=(r,j)=>{for(j===void 0&&G("ptr should not be undefined");r.baseClass;)j=r.upcast(j),r=r.baseClass;return j},de=(r,j)=>(j=ce(r,j),ue[j]);class Ce extends Error{constructor(j){super(j),this.name="InternalError"}}var HA=r=>{throw new Ce(r)},LA=(r,j)=>{(!j.ptrType||!j.ptr)&&HA("makeClassHandle requires ptr and ptrType");var n=!!j.smartPtrType,l=!!j.smartPtr;return n!==l&&HA("Both smartPtrType and smartPtr must be specified"),j.count={value:1},aA(Object.create(r,{$$:{value:j,writable:!0}}))};function fe(r){var j=this.getPointee(r);if(!j)return this.destructor(r),null;var n=de(this.registeredClass,j);if(n!==void 0){if(n.$$.count.value===0)return n.$$.ptr=j,n.$$.smartPtr=r,n.clone();var l=n.clone();return this.destructor(r),l}function o(){return this.isSmartPointer?LA(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:j,smartPtrType:this,smartPtr:r}):LA(this.registeredClass.instancePrototype,{ptrType:this,ptr:r})}var a=this.registeredClass.getActualType(j),k=Yr[a];if(!k)return o.call(this);var u;this.isConst?u=k.constPointerType:u=k.pointerType;var c=jj(j,this.registeredClass,u.registeredClass);return c===null?o.call(this):this.isSmartPointer?LA(u.registeredClass.instancePrototype,{ptrType:u,ptr:c,smartPtrType:this,smartPtr:r}):LA(u.registeredClass.instancePrototype,{ptrType:u,ptr:c})}var qe=()=>{Object.assign(yA.prototype,{getPointee(r){return this.rawGetPointee&&(r=this.rawGetPointee(r)),r},destructor(r){this.rawDestructor?.(r)},readValueFromPointer:_A,fromWireType:fe})};function yA(r,j,n,l,o,a,k,u,c,q,f){this.name=r,this.registeredClass=j,this.isReference=n,this.isConst=l,this.isSmartPointer=o,this.pointeeType=a,this.sharingPolicy=k,this.rawGetPointee=u,this.rawConstructor=c,this.rawShare=q,this.rawDestructor=f,!o&&j.baseClass===void 0?l?(this.toWireType=oe,this.destructorFunction=null):(this.toWireType=ke,this.destructorFunction=null):this.toWireType=ae}var tj=(r,j,n)=>{t.hasOwnProperty(r)||HA("Replacing nonexistent public symbol"),t[r].overloadTable!==void 0&&n!==void 0?t[r].overloadTable[n]=j:(t[r]=j,t[r].argCount=n)},P=(r,j,n=!1)=>{r=H(r);function l(){var a=Rr(j);return a}var o=l();return typeof o!="function"&&G(\`unknown function pointer with signature \${r}: \${j}\`),o};class Ge extends Error{}var pe=r=>{var j=Ej(r),n=H(j);return w(j),n},AA=(r,j)=>{var n=[],l={};function o(a){if(!l[a]&&!Y[a]){if(hA[a]){hA[a].forEach(o);return}n.push(a),l[a]=!0}}throw j.forEach(o),new Ge(\`\${r}: \`+n.map(pe).join([", "]))},M=(r,j,n)=>{r.forEach(u=>hA[u]=j);function l(u){var c=n(u);c.length!==r.length&&HA("Mismatched type converter count");for(var q=0;q<r.length;++q)N(r[q],c[q])}var o=new Array(j.length),a=[],k=0;for(let[u,c]of j.entries())Y.hasOwnProperty(c)?o[u]=Y[c]:(a.push(c),Z.hasOwnProperty(c)||(Z[c]=[]),Z[c].push(()=>{o[u]=Y[c],++k,k===a.length&&l(o)}));a.length===0&&l(o)},Ee=(r,j,n,l,o,a,k,u,c,q,f,p,v)=>{f=H(f),a=P(o,a),u&&=P(k,u),q&&=P(c,q),v=P(p,v);var I=ie(f);rj(I,function(){AA(\`Cannot construct \${f} due to unbound types\`,[l])}),M([r,j,n],l?[l]:[],F=>{F=F[0];var h,b;l?(h=F.registeredClass,b=h.instancePrototype):b=vA.prototype;var y=Zr(f,function(...or){if(Object.getPrototypeOf(this)!==Q)throw new lA(\`Use 'new' to construct \${f}\`);if(g.constructor_body===void 0)throw new lA(\`\${f} has no accessible constructor\`);var Oj=g.constructor_body[or.length];if(Oj===void 0)throw new lA(\`Tried to invoke ctor of \${f} with invalid number of parameters (\${or.length}) - expected (\${Object.keys(g.constructor_body).toString()}) parameters instead!\`);return Oj.apply(this,or)}),Q=Object.create(b,{constructor:{value:y}});y.prototype=Q;var g=new le(f,y,Q,v,h,a,u,q);g.baseClass&&(g.baseClass.__derivedClasses??=[],g.baseClass.__derivedClasses.push(g));var Cn=new yA(f,g,!0,!1,!1),Nj=new yA(f+"*",g,!1,!1,!1),bj=new yA(f+" const*",g,!1,!0,!1);return Yr[r]={pointerType:Nj,constPointerType:bj},tj(I,y),[Cn,Nj,bj]})},rr=(r,j)=>{for(var n=[],l=0;l<r;l++)n.push($[j+l*4>>2]);return n},ej=r=>{for(;r.length;){var j=r.pop(),n=r.pop();n(j)}};function nj(r){for(var j=1;j<r.length;++j)if(r[j]!==null&&r[j].destructorFunction===void 0)return!0;return!1}function sj(r){for(var j=1;j<r.length;++j)if(r[j]!==null&&r[j].argStackAlloc)return!0;return!1}function me(r,j,n,l){var o=nj(r),a=sj(r),k=a&&!l&&!o;a&&!k&&(o=!0);var u=r.length-2,c=[],q=["fn"];j&&q.push("thisWired");for(var f=0;f<u;++f)c.push(\`arg\${f}\`),q.push(\`arg\${f}Wired\`);c=c.join(),q=q.join();var p=\`return function (\${c}) {
|
|
3365
3365
|
\`;o&&(p+=\`var destructors = [];
|
|
3366
3366
|
\`),k&&(p+=\`var sp = stackSave();
|
|
3367
3367
|
try {
|
|
@@ -3376,5 +3376,5 @@ stackRestore(sp);
|
|
|
3376
3376
|
\`,I.push(\`\${h}_dtor\`))}return n&&(p+=\`var ret = fromRetWire(rv);
|
|
3377
3377
|
return ret;
|
|
3378
3378
|
\`),p+=\`}
|
|
3379
|
-
\`,new Function(I,p)}function jr(r,j,n,l,o,a){var k=j.length;k<2&&G("argTypes array size mismatch! Must at least get return value and receiver (this) types!");var u=j[1]!==null&&n!==null,c=nj(j),q=sj(j),f=q&&!a&&!c;q&&!f&&(c=!0);var p=!j[0].isVoid,v=j[0],I=j[1],F=[r,G,l,o,ej,v.fromWireType.bind(v),I?.toWireType.bind(I)];f&&F.push(wr,WA);for(var h=2;h<k;++h){var b=j[h];F.push(b.toWireType.bind(b))}if(!c)for(var h=u?1:2;h<j.length;++h)j[h].destructorFunction!==null&&F.push(j[h].destructorFunction);var Q=me(j,u,p,a)(...F);return Zr(r,Q)}var he=(r,j,n,l,o,a)=>{var k=rr(j,n);o=P(l,o),M([],[r],u=>{u=u[0];var c=\`constructor \${u.name}\`;if(u.registeredClass.constructor_body===void 0&&(u.registeredClass.constructor_body=[]),u.registeredClass.constructor_body[j-1]!==void 0)throw new lA(\`Cannot register multiple constructors with identical number of parameters (\${j-1}) for class '\${u.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!\`);return u.registeredClass.constructor_body[j-1]=()=>{AA(\`Cannot construct \${u.name} due to unbound types\`,k)},M([],k,q=>(q.splice(1,0,null),u.registeredClass.constructor_body[j-1]=jr(c,q,null,o,a),[])),[]})},ij=r=>{r=r.trim();let j=r.indexOf("(");return j===-1?r:r.slice(0,j)},$e=(r,j,n,l,o,a,k,u,c,q)=>{var f=rr(n,l);j=H(j),j=ij(j),a=P(o,a,c),M([],[r],p=>{p=p[0];var v=\`\${p.name}.\${j}\`;j.startsWith("@@")&&(j=Symbol[j.substring(2)]),u&&p.registeredClass.pureVirtualFunctions.push(j);function I(){AA(\`Cannot call \${v} due to unbound types\`,f)}var F=p.registeredClass.instancePrototype,h=F[j];return h===void 0||h.overloadTable===void 0&&h.className!==p.name&&h.argCount===n-2?(I.argCount=n-2,I.className=p.name,F[j]=I):(Aj(F,j,v),F[j].overloadTable[n-2]=I),M([],f,b=>{var y=jr(v,b,p,a,k,c);return F[j].overloadTable===void 0?(y.argCount=n-2,F[j]=y):F[j].overloadTable[n-2]=y,[]}),[]})},lj=(r,j,n)=>(r instanceof Object||G(\`\${n} with invalid "this": \${r}\`),r instanceof j.registeredClass.constructor||G(\`\${n} incompatible with "this" of type \${r.constructor.name}\`),r.$$.ptr||G(\`cannot call emscripten binding method \${n} on deleted object\`),IA(r.$$.ptr,r.$$.ptrType.registeredClass,j.registeredClass)),Fe=(r,j,n,l,o,a,k,u,c,q)=>{j=H(j),o=P(l,o),M([],[r],f=>{f=f[0];var p=\`\${f.name}.\${j}\`,v={get(){AA(\`Cannot access \${p} due to unbound types\`,[n,k])},enumerable:!0,configurable:!0};return c?v.set=()=>AA(\`Cannot access \${p} due to unbound types\`,[n,k]):v.set=I=>G(p+" is a read-only property"),Object.defineProperty(f.registeredClass.instancePrototype,j,v),M([],c?[n,k]:[n],I=>{var F=I[0],h={get(){var y=lj(this,f,p+" getter");return F.fromWireType(o(a,y))},enumerable:!0};if(c){c=P(u,c);var b=I[1];h.set=function(y){var Q=lj(this,f,p+" setter"),g=[];c(q,Q,b.toWireType(g,y)),ej(g)}}return Object.defineProperty(f.registeredClass.instancePrototype,j,h),[]}),[]})},oj=[],V=[0,1,,1,null,1,!0,1,!1,1],ve=r=>{if(r>9&&--V[r+1]===0){var j=V[r];V[r]=void 0,oj.push(r)}},tr={toValue:r=>(r||G(\`Cannot use deleted val. handle = \${r}\`),V[r]),toHandle:r=>{switch(r){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let j=oj.pop()||V.length;return V[j]=r,V[j+1]=1,j}}}},Ie={name:"emscripten::val",fromWireType:r=>{var j=tr.toValue(r);return ve(r),j},toWireType:(r,j)=>tr.toHandle(j),readValueFromPointer:_A,destructorFunction:null},_e=r=>N(r,Ie),aj,He=(r,j)=>{switch(j){case 4:return function(n){return this.fromWireType(aj[n>>2])};case 8:return function(n){return this.fromWireType(mA[n>>3])};default:throw new TypeError(\`invalid float width (\${j}): \${r}\`)}},Le=(r,j,n)=>{j=H(j),N(r,{name:j,fromWireType:l=>l,toWireType:(l,o)=>o,readValueFromPointer:He(j,n),destructorFunction:null})},ye=(r,j,n,l,o,a,k,u)=>{var c=rr(j,n);r=H(r),r=ij(r),o=P(l,o,k),rj(r,function(){AA(\`Cannot call \${r} due to unbound types\`,c)},j-1),M([],c,q=>{var f=[q[0],null].concat(q.slice(1));return tj(r,jr(r,f,null,o,a,k),j-1),[]})},ge=(r,j,n,l,o)=>{j=H(j);let a=l===0,k=c=>c;if(a){var u=32-8*n;k=c=>c<<u>>>u,o=k(o)}N(r,{name:j,fromWireType:k,toWireType:(c,q)=>q,readValueFromPointer:Qr(j,n,l!==0),destructorFunction:null})},De=(r,j,n)=>{var l=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],o=l[j];function a(k){var u=$[k>>2],c=$[k+4>>2];return new o(R.buffer,c,u)}n=H(n),N(r,{name:n,fromWireType:a,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},xe=(r,j,n,l)=>{if(!(l>0))return 0;for(var o=n,a=n+l-1,k=0;k<r.length;++k){var u=r.codePointAt(k);if(u<=127){if(n>=a)break;j[n++]=u}else if(u<=2047){if(n+1>=a)break;j[n++]=192|u>>6,j[n++]=128|u&63}else if(u<=65535){if(n+2>=a)break;j[n++]=224|u>>12,j[n++]=128|u>>6&63,j[n++]=128|u&63}else{if(n+3>=a)break;j[n++]=240|u>>18,j[n++]=128|u>>12&63,j[n++]=128|u>>6&63,j[n++]=128|u&63,k++}}return j[n]=0,n-o},Be=(r,j,n)=>xe(r,x,j,n),Ne=r=>{for(var j=0,n=0;n<r.length;++n){var l=r.charCodeAt(n);l<=127?j++:l<=2047?j+=2:l>=55296&&l<=57343?(j+=4,++n):j+=3}return j},kj=globalThis.TextDecoder&&new TextDecoder,uj=(r,j,n,l)=>{var o=j+n;if(l)return o;for(;r[j]&&!(j>=o);)++j;return j},cj=(r,j=0,n,l)=>{var o=uj(r,j,n,l);if(o-j>16&&r.buffer&&kj)return kj.decode(r.buffer instanceof ArrayBuffer?r.subarray(j,o):r.slice(j,o));for(var a="";j<o;){var k=r[j++];if(!(k&128)){a+=String.fromCharCode(k);continue}var u=r[j++]&63;if((k&224)==192){a+=String.fromCharCode((k&31)<<6|u);continue}var c=r[j++]&63;if((k&240)==224?k=(k&15)<<12|u<<6|c:k=(k&7)<<18|u<<12|c<<6|r[j++]&63,k<65536)a+=String.fromCharCode(k);else{var q=k-65536;a+=String.fromCharCode(55296|q>>10,56320|q&1023)}}return a},be=(r,j,n)=>r?cj(x,r,j,n):"",Oe=(r,j)=>{j=H(j);var n=!0;N(r,{name:j,fromWireType(l){var o=$[l>>2],a=l+4,k;if(n)k=be(a,o,!0);else{k="";for(var u=0;u<o;++u)k+=String.fromCharCode(x[a+u])}return w(l),k},toWireType(l,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var a,k=typeof o=="string";k||ArrayBuffer.isView(o)&&o.BYTES_PER_ELEMENT==1||G("Cannot pass non-string to std::string"),n&&k?a=Ne(o):a=o.length;var u=sr(4+a+1),c=u+4;if($[u>>2]=a,k)if(n)Be(o,c,a+1);else for(var q=0;q<a;++q){var f=o.charCodeAt(q);f>255&&(w(u),G("String has UTF-16 code units that do not fit in 8 bits")),x[c+q]=f}else x.set(o,c);return l!==null&&l.push(w,u),u},readValueFromPointer:_A,destructorFunction(l){w(l)}})},dj=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Je=(r,j,n)=>{var l=r>>1,o=uj(oA,l,j/2,n);if(o-l>16&&dj)return dj.decode(oA.slice(l,o));for(var a="",k=l;k<o;++k){var u=oA[k];a+=String.fromCharCode(u)}return a},Pe=(r,j,n=2147483647)=>{if(n<2)return 0;n-=2;for(var l=j,o=n<r.length*2?n/2:r.length,a=0;a<o;++a){var k=r.charCodeAt(a);$A[j>>1]=k,j+=2}return $A[j>>1]=0,j-l},we=r=>r.length*2,Te=(r,j,n)=>{for(var l="",o=r>>2,a=0;!(a>=j/4);a++){var k=$[o+a];if(!k&&!n)break;l+=String.fromCodePoint(k)}return l},Se=(r,j,n=2147483647)=>{if(n<4)return 0;for(var l=j,o=l+n-4,a=0;a<r.length;++a){var k=r.codePointAt(a);if(k>65535&&a++,S[j>>2]=k,j+=4,j+4>o)break}return S[j>>2]=0,j-l},Me=r=>{for(var j=0,n=0;n<r.length;++n){var l=r.codePointAt(n);l>65535&&n++,j+=4}return j},Ue=(r,j,n)=>{n=H(n);var l,o,a;j===2?(l=Je,o=Pe,a=we):(l=Te,o=Se,a=Me),N(r,{name:n,fromWireType:k=>{var u=$[k>>2],c=l(k+4,u*j,!0);return w(k),c},toWireType:(k,u)=>{typeof u!="string"&&G(\`Cannot pass non-string to C++ string type \${n}\`);var c=a(u),q=sr(4+c+j);return $[q>>2]=c/j,o(u,q+4,c+j),k!==null&&k.push(w,q),q},readValueFromPointer:_A,destructorFunction(k){w(k)}})},Ke=(r,j)=>{j=H(j),N(r,{isVoid:!0,name:j,fromWireType:()=>{},toWireType:(n,l)=>{}})},Re=r=>{var j=!s;try{Atomics.wait(S,0,0,0),j=!0}catch{}ir(r,!i,1,j,65536,!1),m.threadInitTLS()},Cj=r=>{if(r instanceof Nr||r=="unwind")return z;D(1,r)},Ve=()=>{if(!QA())try{if(C){kA()&&lr(z);return}XA(z)}catch(r){Cj(r)}},fj=r=>{if(!pA)try{return r()}catch(j){Cj(j)}finally{Ve()}},er=r=>{if(!Mr){var j=Atomics.waitAsync(S,r>>2,r);j.value.then(gA);var n=r+112;Atomics.store(S,n>>2,1)}},gA=()=>{var r=kA();r&&fj(()=>{er(r),_j()})},Qe=(r,j)=>{if(r==j)setTimeout(gA);else if(C)postMessage({targetThread:r,cmd:4});else{var n=m.pthreads[r];if(!n)return;n.postMessage({cmd:4})}},nr=[],We=(r,j,n,l,o,a,k)=>{nr.length=0;for(var u=o>>3,c=o+l>>3;u<c;){var q;K[u++]?q=K[u++]:q=mA[u++],nr.push(q)}var f=an[r];m.currentProxiedOperationCallerThread=n;var p=f(...nr);if(m.currentProxiedOperationCallerThread=0,a){Promise.resolve(p).then(v=>Fj(a,k,v));return}return p},Xe=r=>{C?postMessage({cmd:6,thread:r}):Or(r)},ze=r=>{},Ze=()=>performance.timeOrigin+performance.now(),Ye=9007199254740992,An=-9007199254740992,rn=r=>r<An||r>Ye?NaN:Number(r),jn=()=>{},tn=()=>{VA+=1},en=()=>{throw tn(),"unwind"},nn=r=>{EA("OOM")},sn=r=>{var j=x.length;r>>>=0,nn(r)};function qj(r){return C?sA(2,0,1,r):52}function Gj(r,j,n,l){return C?sA(3,0,1,r,j,n,l):(j=rn(j),70)}var ln=[null,[],[]],on=(r,j)=>{var n=ln[r];!j||j===10?((r===1?KA:J)(cj(n)),n.length=0):n.push(j)};function pj(r,j,n,l){if(C)return sA(4,0,1,r,j,n,l);for(var o=0,a=0;a<n;a++){var k=$[j>>2],u=$[j+4>>2];j+=8;for(var c=0;c<u;c++)on(r,x[k+c]);o+=u}return $[l>>2]=o,0}m.init(),ee(),qe();{Bt(),t.noExitRuntime&&(zA=t.noExitRuntime),t.print&&(KA=t.print),t.printErr&&(J=t.printErr),t.arguments&&(E=t.arguments),t.thisProgram&&(_=t.thisProgram);var rA=t.preInit;if(rA)for(typeof rA=="function"&&(t.preInit=rA=[rA]);rA.length>0;)rA.shift()()}var an=[Tr,Sr,qj,Gj,pj],Ej,mj,kA,sr,w,kn,ir,hj,$j,Fj,vj,Ij,lr,_j,Hj,Lj,yj,gj,un,Dj;function cn(r){Ej=r.G,mj=r.H,kA=r.J,sr=t._malloc=r.K,w=t._free=r.L,kn=r.M,ir=r.N,hj=r.O,$j=r.P,Fj=r.Q,vj=r.R,Ij=r.S,lr=r.T,_j=r.U,Hj=r.V,Lj=r.W,yj=r.X,gj=r.Y,un=Dj=r.I}var xj;function dn(){xj={l:Xt,C:zt,h:Yt,o:Ae,n:Ee,m:he,e:$e,b:Fe,D:_e,g:Le,q:ye,d:ge,c:De,E:Oe,f:Ue,p:Ke,z:Re,u:Qe,j:We,s:Xe,y:er,B:ze,x:jn,A:en,k:Ze,t:sn,r:XA,w:qj,v:Gj,i:pj,a:iA}}async function Bj(){if(C){gr();return}Nt();var r=t.setStatus;r&&(r("Running..."),await new Promise(j=>setTimeout(j,1)),setTimeout(r,1,"")),!pA&&(gr(),t.onRuntimeInitialized?.(),bt())}var jA;return C||(jA=await Br(),await Bj()),t}})();typeof Ft=="object"&&typeof MA=="object"?(MA.exports=SA,MA.exports.default=SA):typeof define=="function"&&define.amd&&define([],()=>SA);var gs=globalThis.name=="em-pthread";gs&&SA()});var O={};hn(O,{AdditionalCaptureBlocks:()=>In,AdditionalPlaybackBlocks:()=>vn,ClockJumpCheckInterval:()=>xn,ClockJumpThreshold:()=>Bn,ConnectInterval:()=>Un,ConnectTimeout:()=>Tn,DefaultRefreshRate:()=>Hn,DefaultVideoCodec:()=>Rn,HealthCheckTimeout:()=>Dn,MainConnectionPingInterval:()=>Nn,MaxNumberOfDecoders:()=>yn,MaxReconnectDuration:()=>Kn,MinDBFs:()=>Jj,MinTokenLifetime:()=>Sn,MinTokenRefreshInterval:()=>Mn,PlaybackPreload:()=>_n,RenderQuantumSize:()=>gn,VadPreload:()=>Ln,WebRtcAnswerTimeout:()=>Pn,WebRtcIceTimeout:()=>On,WebRtcMaxNegotiationAttempts:()=>wn,WebRtcStatsSnapshotInterval:()=>bn,WebRtcTimeout:()=>Jn});var vn=3,In=3,_n=3,Hn=250,Ln=3,yn=512,gn=128,Jj=-758.596,Dn=1e4,xn=1e3,Bn=1e4,Nn=3e3,bn=1e3,On=3e3,Jn=1e4,Pn=1e4,wn=3,Tn=5e3,Sn=6e4,Mn=5e3,Un=[0,100,200,200,500],Kn=12e4,Rn="H264";function uA(e,A,t){return e.postMessage(A,t)}function kr(e){return e.sampleRate*.02*(e.stereo?2:1)}function ur(e,A){let t=kr(e),s=t*A,i=s+t;return e.samples.subarray(s,i)}function cr(e,A,t){e.headers[A]=t.id}function Pj(e){return[e.values[0],e.values[1]]}function wj(e,A){e.values[0]=A[0],e.values[1]=A[1]}function Tj(e,A){return e.values[2+A*5]}function Sj(e,A,t){e.values[2+A*5]=t}function Mj(e,A){let t=2+A*5+1;return[e.values[t+0],e.values[t+1]]}function Uj(e,A,t){let s=2+A*5+1;e.values[s+0]=t[0],e.values[s+1]=t[1]}function Kj(e,A){return e.values[2+A*5+3]}function Rj(e,A,t){e.values[2+A*5+3]=t}function Vj(e,A){return e.values[2+A*5+4]}function Qj(e,A,t){e.values[2+A*5+4]=t}function Wj(e){return e.values[0]!==0}function Xj(e){return e.values[1]}function zj(e){return e.values[2]}function Zj(e){return e.values[3]}function Yj(e,A){return e.values[3]=A}function At(e){return e?Array.from(e).map(A=>A.toString(16).padStart(2,"0")).join(""):null}var Vn;(e=>{let A;(t=>(t[t.InvalidPassword=-1]="InvalidPassword",t[t.Unknown=0]="Unknown",t[t.Unencrypted=1]="Unencrypted",t[t.Encrypted=2]="Encrypted"))(A=e.PeerCipherStatus||={})})(Vn||={});function nt(e){return{type:"Success",value:e}}function B(e){return{type:"Failure",reason:e}}var{Deno:rt}=globalThis,Qn=typeof rt?.noColor=="boolean"?rt.noColor:!1,Wn=!Qn;function Cr(e,A){return{open:\`\\x1B[\${e.join(";")}m\`,close:\`\\x1B[\${A}m\`,regexp:new RegExp(\`\\\\x1b\\\\[\${A}m\`,"g")}}function fr(e,A){return Wn?\`\${A.open}\${e.replace(A.regexp,A.open)}\${A.close}\`:e}function dr(e){return fr(e,Cr([0],0))}function jt(e){return fr(e,Cr([1],22))}function Xn(e){return fr(e,Cr([2],22))}var Rs=new RegExp(["[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)","(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TXZcf-nq-uy=><~]))"].join("|"),"g"),zn=new Date,DA=(e=>(e[e.CRITICAL=0]="CRITICAL",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(DA||{}),st={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},Zn={4:Xn,3:dr,2:dr,1:jt,0:jt};function Yn({message:e}){return String(e)}function tt(e){return JSON.stringify({timestamp:e.date.toISOString(),level:DA[e.level],message:e.message,extra:e.extra})}function et(e){function A(C,E){return[Math.floor(C/E),C%E]}function t(){let C,E=e.date.valueOf()-zn.valueOf();[E,C]=A(E,1e3);let[_,D]=A(E,60);return\`\${_.toString().padStart(4,"0")}:\${D.toString().padStart(2,"0")}.\${C.toString().padStart(3,"0")}\`}function s(){return e.extra===void 0?"":typeof Deno=="object"?" "+Deno.inspect(e.extra,{compact:!1,colors:!0,trailingComma:!0}).trimStart():" "+JSON.stringify(e.extra)}let i=st[e.level],d=e.logger.name!==void 0?\`@\${e.logger.name}\`:"";return\`\${dr(t())}\${d} \${i} \${Zn[e.level](String(e.message))}\${s()}\`}function As(e){let A=\`[\${e.date.toISOString()}]\`,t=\`[\${DA[e.level]}]\`,s=e.logger.name!==void 0?\`[\${e.logger.name}] \`:"",i=st[e.level];return\`\${A} \${i} \${t.padEnd(7," ")} \${s}\${e.message}\`}function rs(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var it=class{static sparse=Yn;static json=tt;static pretty=et;static structured=As;static default=rs()?et:tt;constructor(){}};var js=class{formatter;consoleObject;filter;constructor(e=it.default,A=4,t=console){this.filter=A,this.formatter=e,this.consoleObject=t}handle(e){let A=this.formatter(e);switch(e.level){case 0:case 1:this.consoleObject.error(A);break;case 2:this.consoleObject.warn(A);break;case 3:this.consoleObject.info(A);break;case 4:this.consoleObject.debug(A);break}}};var W=class{#A;sinks;filter;parent;get name(){return this.#A}constructor(e,A=void 0,t=[],s=void 0){this.#A=A,this.sinks=t,this.filter=e,this.parent=s}log(e,A,t=void 0){let s={date:new Date,level:e,logger:this,message:A,extra:t};this.filter<e||this.insert(s)}insert(e){if(!(this.filter<e.level)){for(let A of this.sinks)A.filter>=e.level&&A.handle(e);this.parent!==void 0&&this.parent.insert(e)}}error=this.log.bind(this,1);warn=this.log.bind(this,2);info=this.log.bind(this,3);debug=this.log.bind(this,4)},cA=globalThis[Symbol.for("odin-global-logger")]??=new W(3,void 0,[new js]),ts=W.prototype.log.bind(cA,1),es=W.prototype.log.bind(cA,2),lt=W.prototype.log.bind(cA,3),ns=W.prototype.log.bind(cA,4),Vs=W.prototype.log.bind(cA);var ot;function at(e,...A){let t=ss(A);ot?ot?.info(e,t):lt(e,t)}function ss(...e){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null)return{...e[0]};if(e.length>0)return{args:e}}function xA(e){return e.connectionId*4294967296+e.mediaId}function kt(e){return{mediaId:e%4294967296,connectionId:Math.floor(e/4294967296)}}function U(e,A,t){let s;switch(A){case"f32":s=e.HEAPF32;break;case"u32":s=e.HEAPU32;break;case"i32":s=e.HEAP32;break;case"u8":s=e.HEAPU8;break;default:throw new Error(\`allocating \${A} is not supported\`)}let i=e._malloc(t*s.BYTES_PER_ELEMENT);if(i===0||i%s.BYTES_PER_ELEMENT!==0)throw new Error(\`failed allocating a \${t} \${A} array\`);let d=i/s.BYTES_PER_ELEMENT;return s.subarray(d,d+t)}function tA(e,A){e._free(A.byteOffset)}function qr(e,A,t,s){return{headers:U(e,"i32",t),samples:U(e,"f32",t*kr({sampleRate:A,stereo:s})),length:t,sampleRate:A,stereo:s}}function Gr(e,A){tA(e,A.headers),tA(e,A.samples)}function ut(e,A){return{values:U(e,"f32",2+A*5),length:A}}function ct(e,A){tA(e,A.values)}function dt(e){return{values:U(e,"f32",4)}}function Ct(e,A){tA(e,A.values)}function ft(e){let A=e.length,t=0,s=0;for(;s<A;){let i=e.charCodeAt(s++);if((i&4294967168)===0){t++;continue}else if((i&4294965248)===0)t+=2;else{if(i>=55296&&i<=56319&&s<A){let d=e.charCodeAt(s);(d&64512)===56320&&(++s,i=((i&1023)<<10)+(d&1023)+65536)}(i&4294901760)===0?t+=3:t+=4}}return t}function is(e,A,t){let s=e.length,i=t,d=0;for(;d<s;){let C=e.charCodeAt(d++);if((C&4294967168)===0){A[i++]=C;continue}else if((C&4294965248)===0)A[i++]=C>>6&31|192;else{if(C>=55296&&C<=56319&&d<s){let E=e.charCodeAt(d);(E&64512)===56320&&(++d,C=((C&1023)<<10)+(E&1023)+65536)}(C&4294901760)===0?(A[i++]=C>>12&15|224,A[i++]=C>>6&63|128):(A[i++]=C>>18&7|240,A[i++]=C>>12&63|128,A[i++]=C>>6&63|128)}A[i++]=C&63|128}}var ls=new TextEncoder,os=50;function as(e,A,t){ls.encodeInto(e,A.subarray(t))}function qt(e,A,t){e.length>os?as(e,A,t):is(e,A,t)}var ks=4096;function pr(e,A,t){let s=A,i=s+t,d=[],C="";for(;s<i;){let E=e[s++];if((E&128)===0)d.push(E);else if((E&224)===192){let _=e[s++]&63;d.push((E&31)<<6|_)}else if((E&240)===224){let _=e[s++]&63,D=e[s++]&63;d.push((E&31)<<12|_<<6|D)}else if((E&248)===240){let _=e[s++]&63,D=e[s++]&63,UA=e[s++]&63,T=(E&7)<<18|_<<12|D<<6|UA;T>65535&&(T-=65536,d.push(T>>>10&1023|55296),T=56320|T&1023),d.push(T)}else d.push(E);d.length>=ks&&(C+=String.fromCharCode(...d),d.length=0)}return d.length>0&&(C+=String.fromCharCode(...d)),C}var us=new TextDecoder,cs=200;function ds(e,A,t){let s=e.subarray(A,A+t);return us.decode(s)}function Gt(e,A,t){return t>cs?ds(e,A,t):pr(e,A,t)}var X=class{type;data;constructor(A,t){this.type=A,this.data=t}};var L=class e extends Error{constructor(A){super(A);let t=Object.create(e.prototype);Object.setPrototypeOf(this,t),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:e.name})}};function pt(e,A,t){let s=t/4294967296,i=t;e.setUint32(A,s),e.setUint32(A+4,i)}function BA(e,A,t){let s=Math.floor(t/4294967296),i=t;e.setUint32(A,s),e.setUint32(A+4,i)}function NA(e,A){let t=e.getInt32(A),s=e.getUint32(A+4);return t*4294967296+s}function Et(e,A){let t=e.getUint32(A),s=e.getUint32(A+4);return t*4294967296+s}var Cs=-1,fs=4294967296-1,qs=17179869184-1;function Gs({sec:e,nsec:A}){if(e>=0&&A>=0&&e<=qs)if(A===0&&e<=fs){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e),t}else{let t=e/4294967296,s=e&4294967295,i=new Uint8Array(8),d=new DataView(i.buffer);return d.setUint32(0,A<<2|t&3),d.setUint32(4,s),i}else{let t=new Uint8Array(12),s=new DataView(t.buffer);return s.setUint32(0,A),BA(s,4,e),t}}function ps(e){let A=e.getTime(),t=Math.floor(A/1e3),s=(A-t*1e3)*1e6,i=Math.floor(s/1e9);return{sec:t+i,nsec:s-i*1e9}}function Es(e){if(e instanceof Date){let A=ps(e);return Gs(A)}else return null}function ms(e){let A=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:A.getUint32(0),nsec:0};case 8:{let t=A.getUint32(0),s=A.getUint32(4),i=(t&3)*4294967296+s,d=t>>>2;return{sec:i,nsec:d}}case 12:{let t=NA(A,4),s=A.getUint32(0);return{sec:t,nsec:s}}default:throw new L(\`Unrecognized data size for timestamp (expected 4, 8, or 12): \${e.length}\`)}}function hs(e){let A=ms(e);return new Date(A.sec*1e3+A.nsec/1e6)}var mt={type:Cs,encode:Es,decode:hs};var eA=class e{static defaultCodec=new e;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(mt)}register({type:A,encode:t,decode:s}){if(A>=0)this.encoders[A]=t,this.decoders[A]=s;else{let i=-1-A;this.builtInEncoders[i]=t,this.builtInDecoders[i]=s}}tryToEncode(A,t){for(let s=0;s<this.builtInEncoders.length;s++){let i=this.builtInEncoders[s];if(i!=null){let d=i(A,t);if(d!=null){let C=-1-s;return new X(C,d)}}}for(let s=0;s<this.encoders.length;s++){let i=this.encoders[s];if(i!=null){let d=i(A,t);if(d!=null){let C=s;return new X(C,d)}}}return A instanceof X?A:null}decode(A,t,s){let i=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return i?i(A,t,s):new X(t,A)}};function $s(e){return e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer}function dA(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):$s(e)?new Uint8Array(e):Uint8Array.from(e)}var Fs=100,vs=2048,bA=class e{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(A){this.extensionCodec=A?.extensionCodec??eA.defaultCodec,this.context=A?.context,this.useBigInt64=A?.useBigInt64??!1,this.maxDepth=A?.maxDepth??Fs,this.initialBufferSize=A?.initialBufferSize??vs,this.sortKeys=A?.sortKeys??!1,this.forceFloat32=A?.forceFloat32??!1,this.ignoreUndefined=A?.ignoreUndefined??!1,this.forceIntegerToFloat=A?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new e({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(A){if(this.entered)return this.clone().encodeSharedRef(A);try{return this.entered=!0,this.reinitializeState(),this.doEncode(A,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(A){if(this.entered)return this.clone().encode(A);try{return this.entered=!0,this.reinitializeState(),this.doEncode(A,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(A,t){if(t>this.maxDepth)throw new Error(\`Too deep objects in depth \${t}\`);A==null?this.encodeNil():typeof A=="boolean"?this.encodeBoolean(A):typeof A=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(A):this.encodeNumber(A):typeof A=="string"?this.encodeString(A):this.useBigInt64&&typeof A=="bigint"?this.encodeBigInt64(A):this.encodeObject(A,t)}ensureBufferSizeToWrite(A){let t=this.pos+A;this.view.byteLength<t&&this.resizeBuffer(t*2)}resizeBuffer(A){let t=new ArrayBuffer(A),s=new Uint8Array(t),i=new DataView(t);s.set(this.bytes),this.view=i,this.bytes=s}encodeNil(){this.writeU8(192)}encodeBoolean(A){A===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(A){!this.forceIntegerToFloat&&Number.isSafeInteger(A)?A>=0?A<128?this.writeU8(A):A<256?(this.writeU8(204),this.writeU8(A)):A<65536?(this.writeU8(205),this.writeU16(A)):A<4294967296?(this.writeU8(206),this.writeU32(A)):this.useBigInt64?this.encodeNumberAsFloat(A):(this.writeU8(207),this.writeU64(A)):A>=-32?this.writeU8(224|A+32):A>=-128?(this.writeU8(208),this.writeI8(A)):A>=-32768?(this.writeU8(209),this.writeI16(A)):A>=-2147483648?(this.writeU8(210),this.writeI32(A)):this.useBigInt64?this.encodeNumberAsFloat(A):(this.writeU8(211),this.writeI64(A)):this.encodeNumberAsFloat(A)}encodeNumberAsFloat(A){this.forceFloat32?(this.writeU8(202),this.writeF32(A)):(this.writeU8(203),this.writeF64(A))}encodeBigInt64(A){A>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(A)):(this.writeU8(211),this.writeBigInt64(A))}writeStringHeader(A){if(A<32)this.writeU8(160+A);else if(A<256)this.writeU8(217),this.writeU8(A);else if(A<65536)this.writeU8(218),this.writeU16(A);else if(A<4294967296)this.writeU8(219),this.writeU32(A);else throw new Error(\`Too long string: \${A} bytes in UTF-8\`)}encodeString(A){let s=ft(A);this.ensureBufferSizeToWrite(5+s),this.writeStringHeader(s),qt(A,this.bytes,this.pos),this.pos+=s}encodeObject(A,t){let s=this.extensionCodec.tryToEncode(A,this.context);if(s!=null)this.encodeExtension(s);else if(Array.isArray(A))this.encodeArray(A,t);else if(ArrayBuffer.isView(A))this.encodeBinary(A);else if(typeof A=="object")this.encodeMap(A,t);else throw new Error(\`Unrecognized object: \${Object.prototype.toString.apply(A)}\`)}encodeBinary(A){let t=A.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else if(t<4294967296)this.writeU8(198),this.writeU32(t);else throw new Error(\`Too large binary: \${t}\`);let s=dA(A);this.writeU8a(s)}encodeArray(A,t){let s=A.length;if(s<16)this.writeU8(144+s);else if(s<65536)this.writeU8(220),this.writeU16(s);else if(s<4294967296)this.writeU8(221),this.writeU32(s);else throw new Error(\`Too large array: \${s}\`);for(let i of A)this.doEncode(i,t+1)}countWithoutUndefined(A,t){let s=0;for(let i of t)A[i]!==void 0&&s++;return s}encodeMap(A,t){let s=Object.keys(A);this.sortKeys&&s.sort();let i=this.ignoreUndefined?this.countWithoutUndefined(A,s):s.length;if(i<16)this.writeU8(128+i);else if(i<65536)this.writeU8(222),this.writeU16(i);else if(i<4294967296)this.writeU8(223),this.writeU32(i);else throw new Error(\`Too large map object: \${i}\`);for(let d of s){let C=A[d];this.ignoreUndefined&&C===void 0||(this.encodeString(d),this.doEncode(C,t+1))}}encodeExtension(A){if(typeof A.data=="function"){let s=A.data(this.pos+6),i=s.length;if(i>=4294967296)throw new Error(\`Too large extension object: \${i}\`);this.writeU8(201),this.writeU32(i),this.writeI8(A.type),this.writeU8a(s);return}let t=A.data.length;if(t===1)this.writeU8(212);else if(t===2)this.writeU8(213);else if(t===4)this.writeU8(214);else if(t===8)this.writeU8(215);else if(t===16)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else if(t<4294967296)this.writeU8(201),this.writeU32(t);else throw new Error(\`Too large extension object: \${t}\`);this.writeI8(A.type),this.writeU8a(A.data)}writeU8(A){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,A),this.pos++}writeU8a(A){let t=A.length;this.ensureBufferSizeToWrite(t),this.bytes.set(A,this.pos),this.pos+=t}writeI8(A){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,A),this.pos++}writeU16(A){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,A),this.pos+=2}writeI16(A){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,A),this.pos+=2}writeU32(A){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,A),this.pos+=4}writeI32(A){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,A),this.pos+=4}writeF32(A){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,A),this.pos+=4}writeF64(A){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,A),this.pos+=8}writeU64(A){this.ensureBufferSizeToWrite(8),pt(this.view,this.pos,A),this.pos+=8}writeI64(A){this.ensureBufferSizeToWrite(8),BA(this.view,this.pos,A),this.pos+=8}writeBigUint64(A){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,A),this.pos+=8}writeBigInt64(A){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,A),this.pos+=8}};function Er(e,A){return new bA(A).encodeSharedRef(e)}function OA(e){return\`\${e<0?"-":""}0x\${Math.abs(e).toString(16).padStart(2,"0")}\`}var Is=16,_s=16,JA=class{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(A=Is,t=_s){this.maxKeyLength=A,this.maxLengthPerKey=t,this.caches=[];for(let s=0;s<this.maxKeyLength;s++)this.caches.push([])}canBeCached(A){return A>0&&A<=this.maxKeyLength}find(A,t,s){let i=this.caches[s-1];A:for(let d of i){let C=d.bytes;for(let E=0;E<s;E++)if(C[E]!==A[t+E])continue A;return d.str}return null}store(A,t){let s=this.caches[A.length-1],i={bytes:A,str:t};s.length>=this.maxLengthPerKey?s[Math.random()*s.length|0]=i:s.push(i)}decode(A,t,s){let i=this.find(A,t,s);if(i!=null)return this.hit++,i;this.miss++;let d=pr(A,t,s),C=Uint8Array.prototype.slice.call(A,t,t+s);return this.store(C,d),d}};var mr="array",qA="map_key",$t="map_value",Hs=e=>{if(typeof e=="string"||typeof e=="number")return e;throw new L("The type of key must be string or number but "+typeof e)},hr=class{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(A){let t=this.getUninitializedStateFromPool();t.type=mr,t.position=0,t.size=A,t.array=new Array(A)}pushMapState(A){let t=this.getUninitializedStateFromPool();t.type=qA,t.readCount=0,t.size=A,t.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){let A={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(A)}return this.stack[this.stackHeadPosition]}release(A){if(this.stack[this.stackHeadPosition]!==A)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(A.type===mr){let s=A;s.size=0,s.array=void 0,s.position=0,s.type=void 0}if(A.type===qA||A.type===$t){let s=A;s.size=0,s.map=void 0,s.readCount=0,s.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},fA=-1,$r=new DataView(new ArrayBuffer(0)),Ls=new Uint8Array($r.buffer);try{$r.getInt8(0)}catch(e){if(!(e instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var ht=new RangeError("Insufficient data"),ys=new JA,PA=class e{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=$r;bytes=Ls;headByte=fA;stack=new hr;entered=!1;constructor(A){this.extensionCodec=A?.extensionCodec??eA.defaultCodec,this.context=A?.context,this.useBigInt64=A?.useBigInt64??!1,this.rawStrings=A?.rawStrings??!1,this.maxStrLength=A?.maxStrLength??4294967295,this.maxBinLength=A?.maxBinLength??4294967295,this.maxArrayLength=A?.maxArrayLength??4294967295,this.maxMapLength=A?.maxMapLength??4294967295,this.maxExtLength=A?.maxExtLength??4294967295,this.keyDecoder=A?.keyDecoder!==void 0?A.keyDecoder:ys,this.mapKeyConverter=A?.mapKeyConverter??Hs}clone(){return new e({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=fA,this.stack.reset()}setBuffer(A){let t=dA(A);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(A){if(this.headByte===fA&&!this.hasRemaining(1))this.setBuffer(A);else{let t=this.bytes.subarray(this.pos),s=dA(A),i=new Uint8Array(t.length+s.length);i.set(t),i.set(s,t.length),this.setBuffer(i)}}hasRemaining(A){return this.view.byteLength-this.pos>=A}createExtraByteError(A){let{view:t,pos:s}=this;return new RangeError(\`Extra \${t.byteLength-s} of \${t.byteLength} byte(s) found at buffer[\${A}]\`)}decode(A){if(this.entered)return this.clone().decode(A);try{this.entered=!0,this.reinitializeState(),this.setBuffer(A);let t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t}finally{this.entered=!1}}*decodeMulti(A){if(this.entered){yield*this.clone().decodeMulti(A);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(A);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(A){if(this.entered)return this.clone().decodeAsync(A);try{this.entered=!0;let t=!1,s;for await(let E of A){if(t)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(E);try{s=this.doDecodeSync(),t=!0}catch(_){if(!(_ instanceof RangeError))throw _}this.totalPos+=this.pos}if(t){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return s}let{headByte:i,pos:d,totalPos:C}=this;throw new RangeError(\`Insufficient data in parsing \${OA(i)} at \${C} (\${d} in the current buffer)\`)}finally{this.entered=!1}}decodeArrayStream(A){return this.decodeMultiAsync(A,!0)}decodeStream(A){return this.decodeMultiAsync(A,!1)}async*decodeMultiAsync(A,t){if(this.entered){yield*this.clone().decodeMultiAsync(A,t);return}try{this.entered=!0;let s=t,i=-1;for await(let d of A){if(t&&i===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(d),s&&(i=this.readArraySize(),s=!1,this.complete());try{for(;yield this.doDecodeSync(),--i!==0;);}catch(C){if(!(C instanceof RangeError))throw C}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){A:for(;;){let A=this.readHeadByte(),t;if(A>=224)t=A-256;else if(A<192)if(A<128)t=A;else if(A<144){let i=A-128;if(i!==0){this.pushMapState(i),this.complete();continue A}else t={}}else if(A<160){let i=A-144;if(i!==0){this.pushArrayState(i),this.complete();continue A}else t=[]}else{let i=A-160;t=this.decodeString(i,0)}else if(A===192)t=null;else if(A===194)t=!1;else if(A===195)t=!0;else if(A===202)t=this.readF32();else if(A===203)t=this.readF64();else if(A===204)t=this.readU8();else if(A===205)t=this.readU16();else if(A===206)t=this.readU32();else if(A===207)this.useBigInt64?t=this.readU64AsBigInt():t=this.readU64();else if(A===208)t=this.readI8();else if(A===209)t=this.readI16();else if(A===210)t=this.readI32();else if(A===211)this.useBigInt64?t=this.readI64AsBigInt():t=this.readI64();else if(A===217){let i=this.lookU8();t=this.decodeString(i,1)}else if(A===218){let i=this.lookU16();t=this.decodeString(i,2)}else if(A===219){let i=this.lookU32();t=this.decodeString(i,4)}else if(A===220){let i=this.readU16();if(i!==0){this.pushArrayState(i),this.complete();continue A}else t=[]}else if(A===221){let i=this.readU32();if(i!==0){this.pushArrayState(i),this.complete();continue A}else t=[]}else if(A===222){let i=this.readU16();if(i!==0){this.pushMapState(i),this.complete();continue A}else t={}}else if(A===223){let i=this.readU32();if(i!==0){this.pushMapState(i),this.complete();continue A}else t={}}else if(A===196){let i=this.lookU8();t=this.decodeBinary(i,1)}else if(A===197){let i=this.lookU16();t=this.decodeBinary(i,2)}else if(A===198){let i=this.lookU32();t=this.decodeBinary(i,4)}else if(A===212)t=this.decodeExtension(1,0);else if(A===213)t=this.decodeExtension(2,0);else if(A===214)t=this.decodeExtension(4,0);else if(A===215)t=this.decodeExtension(8,0);else if(A===216)t=this.decodeExtension(16,0);else if(A===199){let i=this.lookU8();t=this.decodeExtension(i,1)}else if(A===200){let i=this.lookU16();t=this.decodeExtension(i,2)}else if(A===201){let i=this.lookU32();t=this.decodeExtension(i,4)}else throw new L(\`Unrecognized type byte: \${OA(A)}\`);this.complete();let s=this.stack;for(;s.length>0;){let i=s.top();if(i.type===mr)if(i.array[i.position]=t,i.position++,i.position===i.size)t=i.array,s.release(i);else continue A;else if(i.type===qA){if(t==="__proto__")throw new L("The key __proto__ is not allowed");i.key=this.mapKeyConverter(t),i.type=$t;continue A}else if(i.map[i.key]=t,i.readCount++,i.readCount===i.size)t=i.map,s.release(i);else{i.key=null,i.type=qA;continue A}}return t}}readHeadByte(){return this.headByte===fA&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=fA}readArraySize(){let A=this.readHeadByte();switch(A){case 220:return this.readU16();case 221:return this.readU32();default:{if(A<160)return A-144;throw new L(\`Unrecognized array type byte: \${OA(A)}\`)}}}pushMapState(A){if(A>this.maxMapLength)throw new L(\`Max length exceeded: map length (\${A}) > maxMapLengthLength (\${this.maxMapLength})\`);this.stack.pushMapState(A)}pushArrayState(A){if(A>this.maxArrayLength)throw new L(\`Max length exceeded: array length (\${A}) > maxArrayLength (\${this.maxArrayLength})\`);this.stack.pushArrayState(A)}decodeString(A,t){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(A,t):this.decodeBinary(A,t)}decodeUtf8String(A,t){if(A>this.maxStrLength)throw new L(\`Max length exceeded: UTF-8 byte length (\${A}) > maxStrLength (\${this.maxStrLength})\`);if(this.bytes.byteLength<this.pos+t+A)throw ht;let s=this.pos+t,i;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(A)?i=this.keyDecoder.decode(this.bytes,s,A):i=Gt(this.bytes,s,A),this.pos+=t+A,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===qA:!1}decodeBinary(A,t){if(A>this.maxBinLength)throw new L(\`Max length exceeded: bin length (\${A}) > maxBinLength (\${this.maxBinLength})\`);if(!this.hasRemaining(A+t))throw ht;let s=this.pos+t,i=this.bytes.subarray(s,s+A);return this.pos+=t+A,i}decodeExtension(A,t){if(A>this.maxExtLength)throw new L(\`Max length exceeded: ext length (\${A}) > maxExtLength (\${this.maxExtLength})\`);let s=this.view.getInt8(this.pos+t),i=this.decodeBinary(A,t+1);return this.extensionCodec.decode(i,s,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let A=this.view.getUint8(this.pos);return this.pos++,A}readI8(){let A=this.view.getInt8(this.pos);return this.pos++,A}readU16(){let A=this.view.getUint16(this.pos);return this.pos+=2,A}readI16(){let A=this.view.getInt16(this.pos);return this.pos+=2,A}readU32(){let A=this.view.getUint32(this.pos);return this.pos+=4,A}readI32(){let A=this.view.getInt32(this.pos);return this.pos+=4,A}readU64(){let A=Et(this.view,this.pos);return this.pos+=8,A}readI64(){let A=NA(this.view,this.pos);return this.pos+=8,A}readU64AsBigInt(){let A=this.view.getBigUint64(this.pos);return this.pos+=8,A}readI64AsBigInt(){let A=this.view.getBigInt64(this.pos);return this.pos+=8,A}readF32(){let A=this.view.getFloat32(this.pos);return this.pos+=4,A}readF64(){let A=this.view.getFloat64(this.pos);return this.pos+=8,A}};function Fr(e,A){return new PA(A).decode(e)}var GA=class e{constructor(A,t,s,i,d){this.mediaIds=A;this.sequenceNumber=t;this.timeStamp=s;this.isEndOfSpurt=i;this.payload=d}static parse(A){let t;try{t=Fr(A)}catch{return B("not valid msgpack")}if(!Array.isArray(t))return B("container must be an array");if(t.length<6)return B("missing fields");if(t[0]!==1)return B("unknown type");if(!Array.isArray(t[1]))return B("media ids must be an array");if(!t[1].every(D=>typeof D=="number"))return B("media ids must be numbers");if(typeof t[2]!="number")return B("sequence number must be a number");if(typeof t[3]!="number")return B("timestamp must be a number");if(typeof t[4]!="number")return B("flags must be a number");let s=t[1],i=t[2]>>>0,d=t[3]>>>0,E=(t[4]&1)!==0,_=t[t.length-1];return _ instanceof Uint8Array?nt(new e(s,i,d,E,_)):B("payload must be bytes")}toBytes(){let A=Number(this.isEndOfSpurt),t=[1,this.mediaIds,this.sequenceNumber>>>0,this.timeStamp>>>0,A,this.payload];return new Uint8Array(Er(t,{forceFloat32:!0,ignoreUndefined:!0}))}};var wA=class{constructor(A,t){this.sampleRate=A;this.wasm=t;this.sequenceNumber=Math.random()*Math.pow(2,32)>>0;this.timestamp=Math.random()*Math.pow(2,32)>>0;this.connections=[];this.monitoring=!1;this.active=!1;this.stats={numberPackets:0,numberTicks:0,numberPacketError:0,numberPacketsMediaNotFound:0};this.encoder=new t.Encoder(A,15,!0,O.VadPreload),this.encoder.complexity=navigator.hardwareConcurrency>=4?6:4,this.information=dt(this.wasm),this.outBuffer=U(this.wasm,"u8",1270),Yj(this.information,1)}setVad(A){this.encoder.set_volume_gate(A.volumeGate!==void 0,A.volumeGate?.attackThreshold??0,A.volumeGate?.releaseThreshold??0),this.encoder.set_speech_detection(A.voiceActivity!==void 0,A.voiceActivity?.attackThreshold??0,A.voiceActivity?.releaseThreshold??0)}setMedias(A){this.connections=A.filter(({mediaIds:t})=>t.length>0)}close(){Ct(this.wasm,this.information),tA(this.wasm,this.outBuffer),this.encoder.delete()}encode(A){for(this.encoder.push(A.byteOffset,this.information.values.byteOffset);;){let t=this.encoder.pop(this.connections.length===0?0:this.outBuffer.byteOffset,this.outBuffer.length);if(t===0)break;if(t<0){at(\`failed encoding packet: \${t}\`);return}if(this.timestamp=this.timestamp+1800>>0,t===1)continue;this.sequenceNumber=this.sequenceNumber+1>>0;let s=this.active&&!this.encoder.active;this.active=this.encoder.active,this.monitoring=this.connections.some(i=>i.id===0);for(let i of this.connections){if(this.monitoring&&i.id!==0)continue;let d=new GA(i.mediaIds,this.sequenceNumber,this.timestamp,s,this.outBuffer.subarray(0,t));uA(globalThis,["sendPacket",{connectionId:i.id,packet:d.toBytes()}])}}}onMessage(A){let[t,s]=A;switch(t){case"captureSetVad":this?.setVad(s);break;case"captureSetMedias":this?.setMedias(s.connections);break;case"close":this.close();break;case"dump":s.result.postMessage(this.dump());break}}dump(){return{sequenceNumber:this.sequenceNumber,timestamp:this.timestamp,connections:this.connections.map(A=>\`\${A.id} => \${A.mediaIds.join(",")}\`),active:this.active,monitoring:this.monitoring,information:{active:Wj(this.information),speechProbability:Xj(this.information),rmsDBFS:zj(this.information),volume:Zj(this.information)},encoder:{sample_rate:this.encoder.sample_rate,fec_packet_loss:this.encoder.fec_packet_loss,voip:this.encoder.voip,vad_preload:this.encoder.vad_preload,complexity:this.encoder.complexity,speech_probability:this.encoder.speech_probability,rms_dbfs:this.encoder.rms_dbfs,active:this.encoder.active,speech_detection_enabled:this.encoder.speech_detection_enabled,speech_detection_going_active:this.encoder.speech_detection_going_active,speech_detection_going_inactive:this.encoder.speech_detection_going_inactive,volume_gate_enabled:this.encoder.volume_gate_enabled,volume_gate_going_active:this.encoder.volume_gate_going_active,volume_gate_going_inactive:this.encoder.volume_gate_going_inactive}}}},TA=class{constructor(A){this.wasm=A;this.medias=new Map;this.stats={numberPackets:0,numberTicks:0,numberPacketError:0,numberPacketsMediaNotFound:0,numberTicksWithAudio:0};this.largestIndex=-1;this.decoders=U(this.wasm,"u32",O.MaxNumberOfDecoders),this.information=ut(this.wasm,O.MaxNumberOfDecoders),wj(this.information,[1,1])}close(){ct(this.wasm,this.information);for(let{decoder:A}of this.medias.values())A.delete()}receivePacket(A,t){this.stats.numberPackets++;let s=GA.parse(t);if(s.type==="Failure"){this.stats.numberPacketError++;let i=Array.from(t).map(d=>d.toString(16).padStart(2,"0")).join("");console.error(\`failed decoding audio packet; reason: \${s.reason}, connection: \${A}, dump: \${i}\`);return}for(let i of s.value.mediaIds){let d=this.medias.get(xA({connectionId:A,mediaId:i}));if(d===void 0){this.stats.numberPacketsMediaNotFound++;continue}d.lastPacket=t;let C=U(this.wasm,"u8",s.value.payload.length);C.set(s.value.payload),d.decoder.push(s.value.sequenceNumber,s.value.timeStamp,s.value.isEndOfSpurt,C.byteOffset,C.length)}}insertMedia(A,t,s,i=[1,1]){let d=xA({connectionId:t,mediaId:s}),C=new this.wasm.Decoder;this.medias.set(d,{index:A,decoder:C,lastPacket:void 0}),this.decoders[A]=C.$$.ptr,this.largestIndex=Math.max(this.largestIndex,A),Uj(this.information,A,i),Qj(this.information,A,0),Rj(this.information,A,0)}removeMedia(A,t,s){let i=xA({connectionId:t,mediaId:s}),d=this.medias.get(i);if(!(d===void 0||d.index!==A)&&(this.medias.delete(i),Sj(this.information,A,0),this.decoders[A]=0,d.decoder.delete(),A===this.largestIndex)){for(A=A-1;A>=0&&this.decoders[A]===0;A--);this.largestIndex=A}}decode(A){return{hasAudio:this.wasm.pop_many(this.decoders.byteOffset,this.information.values.byteOffset,this.largestIndex+1,A.byteOffset)}}onMessage(A){let[t,s]=A;switch(t){case"playbackReceivePacket":this.receivePacket(s.connectionId,s.packet);break;case"playbackUpdateMedias":for(let{index:i,connectionId:d,mediaId:C}of s.removed)this.removeMedia(i,d,C);for(let{index:i,connectionId:d,mediaId:C,volume:E}of s.added)this.insertMedia(i,d,C,E);break;case"close":this.close();break;case"dump":s.result.postMessage(this.dump());break}}dump(){let A=[];for(let[t,s]of this.medias){let i=kt(t);A.push({index:s.index,connectionId:i.connectionId,mediaId:i.mediaId,rmsDBFS:Tj(this.information,s.index),volume:Mj(this.information,s.index),voicedBlocks:Vj(this.information,s.index),silentBlocks:Kj(this.information,s.index),time:s.decoder.time,consecutive_silence:s.decoder.consecutive_silence,last_voiced_time_point:s.decoder.last_voiced_time_point,sequence_number:s.decoder.sequence_number,packetsSeen:s.decoder.packets_seen,packetsInvalid:s.decoder.packets_invalid,packetsTooLate:s.decoder.packets_too_late,packetsTooEarly:s.decoder.packets_too_early,packetsRepeated:s.decoder.packets_repeated,packetsProcessed:s.decoder.packets_processed,packetsLost:s.decoder.packets_lost,rewinds:s.decoder.rewinds,cacheLength:s.decoder.cache_length,lastPacket:At(s.lastPacket)})}return{largestIndex:this.largestIndex,globalVolume:Pj(this.information),decoders:A}}};var Lt=Fn(vt()),It=(0,Lt.default)(),_t,Ht;globalThis.addEventListener("message",vr);async function vr(e){let A=e.data,[t,s]=A;switch(t){case"captureInit":s.workletPort.onmessage=vr,_t=new Ir(s.sampleRate,await It);break;case"playbackInit":s.workletPort.onmessage=vr,Ht=new _r(await It);break;case"close":globalThis.close();break}_t?.onMessage(A),Ht?.onMessage(A)}var Ir=class extends wA{constructor(t,s){super(t,s);this.id=-1;this.samples=qr(this.wasm,t,2+O.VadPreload+O.AdditionalCaptureBlocks,!1),uA(globalThis,["captureReady",{sampleBuffer:this.samples,informationBuffer:this.information}])}close(){super.close(),Gr(this.wasm,this.samples)}onMessage(t){super.onMessage(t);let[s,i]=t;s==="captureTick"&&this.tick(i.id)}tick(t){for(;this.id<t;this.id+=1)this.encode(ur(this.samples,this.id%this.samples.length))}dump(){return{type:"shared capture worker",id:this.id,sampleRate:this.samples.sampleRate,stereo:this.samples.stereo,length:this.samples.length,...super.dump()}}},_r=class extends TA{constructor(A){super(A);let t=2+O.AdditionalPlaybackBlocks;this.sampleBuffer=qr(A,48e3,t,!0),this.sampleBuffer.samples.fill(0),this.prefill=t-2;for(let s=0;s<this.prefill;s++)cr(this.sampleBuffer,s,{id:s});this.id=this.prefill,uA(globalThis,["playbackReady",{sampleBuffer:this.sampleBuffer,informationBuffer:this.information}])}close(){super.close(),Gr(this.wasm,this.sampleBuffer)}onMessage(A){super.onMessage(A);let[t,s]=A;t==="playbackTick"&&this.tick(s.id)}tick(A){for(this.stats.numberTicks++;this.id<A+this.prefill;this.id++){let t=this.id%this.sampleBuffer.length,{hasAudio:s}=this.decode(ur(this.sampleBuffer,t));s&&(this.stats.numberTicksWithAudio++,cr(this.sampleBuffer,t,{id:this.id}))}}dump(){return{type:"shared playback worker",id:this.id,prefill:this.prefill,sampleRate:this.sampleBuffer.sampleRate,stereo:this.sampleBuffer.stereo,...super.dump()}}};})();
|
|
3380
|
-
`;var p='"use strict";(()=>{var E=Object.defineProperty;var F=(e,t)=>{for(var r in t)E(e,r,{get:t[r],enumerable:!0})};var l={};F(l,{AdditionalCaptureBlocks:()=>C,AdditionalPlaybackBlocks:()=>D,ClockJumpCheckInterval:()=>j,ClockJumpThreshold:()=>$,ConnectInterval:()=>
|
|
3379
|
+
\`,new Function(I,p)}function jr(r,j,n,l,o,a){var k=j.length;k<2&&G("argTypes array size mismatch! Must at least get return value and receiver (this) types!");var u=j[1]!==null&&n!==null,c=nj(j),q=sj(j),f=q&&!a&&!c;q&&!f&&(c=!0);var p=!j[0].isVoid,v=j[0],I=j[1],F=[r,G,l,o,ej,v.fromWireType.bind(v),I?.toWireType.bind(I)];f&&F.push(wr,WA);for(var h=2;h<k;++h){var b=j[h];F.push(b.toWireType.bind(b))}if(!c)for(var h=u?1:2;h<j.length;++h)j[h].destructorFunction!==null&&F.push(j[h].destructorFunction);var Q=me(j,u,p,a)(...F);return Zr(r,Q)}var he=(r,j,n,l,o,a)=>{var k=rr(j,n);o=P(l,o),M([],[r],u=>{u=u[0];var c=\`constructor \${u.name}\`;if(u.registeredClass.constructor_body===void 0&&(u.registeredClass.constructor_body=[]),u.registeredClass.constructor_body[j-1]!==void 0)throw new lA(\`Cannot register multiple constructors with identical number of parameters (\${j-1}) for class '\${u.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!\`);return u.registeredClass.constructor_body[j-1]=()=>{AA(\`Cannot construct \${u.name} due to unbound types\`,k)},M([],k,q=>(q.splice(1,0,null),u.registeredClass.constructor_body[j-1]=jr(c,q,null,o,a),[])),[]})},ij=r=>{r=r.trim();let j=r.indexOf("(");return j===-1?r:r.slice(0,j)},$e=(r,j,n,l,o,a,k,u,c,q)=>{var f=rr(n,l);j=H(j),j=ij(j),a=P(o,a,c),M([],[r],p=>{p=p[0];var v=\`\${p.name}.\${j}\`;j.startsWith("@@")&&(j=Symbol[j.substring(2)]),u&&p.registeredClass.pureVirtualFunctions.push(j);function I(){AA(\`Cannot call \${v} due to unbound types\`,f)}var F=p.registeredClass.instancePrototype,h=F[j];return h===void 0||h.overloadTable===void 0&&h.className!==p.name&&h.argCount===n-2?(I.argCount=n-2,I.className=p.name,F[j]=I):(Aj(F,j,v),F[j].overloadTable[n-2]=I),M([],f,b=>{var y=jr(v,b,p,a,k,c);return F[j].overloadTable===void 0?(y.argCount=n-2,F[j]=y):F[j].overloadTable[n-2]=y,[]}),[]})},lj=(r,j,n)=>(r instanceof Object||G(\`\${n} with invalid "this": \${r}\`),r instanceof j.registeredClass.constructor||G(\`\${n} incompatible with "this" of type \${r.constructor.name}\`),r.$$.ptr||G(\`cannot call emscripten binding method \${n} on deleted object\`),IA(r.$$.ptr,r.$$.ptrType.registeredClass,j.registeredClass)),Fe=(r,j,n,l,o,a,k,u,c,q)=>{j=H(j),o=P(l,o),M([],[r],f=>{f=f[0];var p=\`\${f.name}.\${j}\`,v={get(){AA(\`Cannot access \${p} due to unbound types\`,[n,k])},enumerable:!0,configurable:!0};return c?v.set=()=>AA(\`Cannot access \${p} due to unbound types\`,[n,k]):v.set=I=>G(p+" is a read-only property"),Object.defineProperty(f.registeredClass.instancePrototype,j,v),M([],c?[n,k]:[n],I=>{var F=I[0],h={get(){var y=lj(this,f,p+" getter");return F.fromWireType(o(a,y))},enumerable:!0};if(c){c=P(u,c);var b=I[1];h.set=function(y){var Q=lj(this,f,p+" setter"),g=[];c(q,Q,b.toWireType(g,y)),ej(g)}}return Object.defineProperty(f.registeredClass.instancePrototype,j,h),[]}),[]})},oj=[],V=[0,1,,1,null,1,!0,1,!1,1],ve=r=>{if(r>9&&--V[r+1]===0){var j=V[r];V[r]=void 0,oj.push(r)}},tr={toValue:r=>(r||G(\`Cannot use deleted val. handle = \${r}\`),V[r]),toHandle:r=>{switch(r){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let j=oj.pop()||V.length;return V[j]=r,V[j+1]=1,j}}}},Ie={name:"emscripten::val",fromWireType:r=>{var j=tr.toValue(r);return ve(r),j},toWireType:(r,j)=>tr.toHandle(j),readValueFromPointer:_A,destructorFunction:null},_e=r=>N(r,Ie),aj,He=(r,j)=>{switch(j){case 4:return function(n){return this.fromWireType(aj[n>>2])};case 8:return function(n){return this.fromWireType(mA[n>>3])};default:throw new TypeError(\`invalid float width (\${j}): \${r}\`)}},Le=(r,j,n)=>{j=H(j),N(r,{name:j,fromWireType:l=>l,toWireType:(l,o)=>o,readValueFromPointer:He(j,n),destructorFunction:null})},ye=(r,j,n,l,o,a,k,u)=>{var c=rr(j,n);r=H(r),r=ij(r),o=P(l,o,k),rj(r,function(){AA(\`Cannot call \${r} due to unbound types\`,c)},j-1),M([],c,q=>{var f=[q[0],null].concat(q.slice(1));return tj(r,jr(r,f,null,o,a,k),j-1),[]})},ge=(r,j,n,l,o)=>{j=H(j);let a=l===0,k=c=>c;if(a){var u=32-8*n;k=c=>c<<u>>>u,o=k(o)}N(r,{name:j,fromWireType:k,toWireType:(c,q)=>q,readValueFromPointer:Qr(j,n,l!==0),destructorFunction:null})},De=(r,j,n)=>{var l=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],o=l[j];function a(k){var u=$[k>>2],c=$[k+4>>2];return new o(R.buffer,c,u)}n=H(n),N(r,{name:n,fromWireType:a,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},xe=(r,j,n,l)=>{if(!(l>0))return 0;for(var o=n,a=n+l-1,k=0;k<r.length;++k){var u=r.codePointAt(k);if(u<=127){if(n>=a)break;j[n++]=u}else if(u<=2047){if(n+1>=a)break;j[n++]=192|u>>6,j[n++]=128|u&63}else if(u<=65535){if(n+2>=a)break;j[n++]=224|u>>12,j[n++]=128|u>>6&63,j[n++]=128|u&63}else{if(n+3>=a)break;j[n++]=240|u>>18,j[n++]=128|u>>12&63,j[n++]=128|u>>6&63,j[n++]=128|u&63,k++}}return j[n]=0,n-o},Be=(r,j,n)=>xe(r,x,j,n),Ne=r=>{for(var j=0,n=0;n<r.length;++n){var l=r.charCodeAt(n);l<=127?j++:l<=2047?j+=2:l>=55296&&l<=57343?(j+=4,++n):j+=3}return j},kj=globalThis.TextDecoder&&new TextDecoder,uj=(r,j,n,l)=>{var o=j+n;if(l)return o;for(;r[j]&&!(j>=o);)++j;return j},cj=(r,j=0,n,l)=>{var o=uj(r,j,n,l);if(o-j>16&&r.buffer&&kj)return kj.decode(r.buffer instanceof ArrayBuffer?r.subarray(j,o):r.slice(j,o));for(var a="";j<o;){var k=r[j++];if(!(k&128)){a+=String.fromCharCode(k);continue}var u=r[j++]&63;if((k&224)==192){a+=String.fromCharCode((k&31)<<6|u);continue}var c=r[j++]&63;if((k&240)==224?k=(k&15)<<12|u<<6|c:k=(k&7)<<18|u<<12|c<<6|r[j++]&63,k<65536)a+=String.fromCharCode(k);else{var q=k-65536;a+=String.fromCharCode(55296|q>>10,56320|q&1023)}}return a},be=(r,j,n)=>r?cj(x,r,j,n):"",Oe=(r,j)=>{j=H(j);var n=!0;N(r,{name:j,fromWireType(l){var o=$[l>>2],a=l+4,k;if(n)k=be(a,o,!0);else{k="";for(var u=0;u<o;++u)k+=String.fromCharCode(x[a+u])}return w(l),k},toWireType(l,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var a,k=typeof o=="string";k||ArrayBuffer.isView(o)&&o.BYTES_PER_ELEMENT==1||G("Cannot pass non-string to std::string"),n&&k?a=Ne(o):a=o.length;var u=sr(4+a+1),c=u+4;if($[u>>2]=a,k)if(n)Be(o,c,a+1);else for(var q=0;q<a;++q){var f=o.charCodeAt(q);f>255&&(w(u),G("String has UTF-16 code units that do not fit in 8 bits")),x[c+q]=f}else x.set(o,c);return l!==null&&l.push(w,u),u},readValueFromPointer:_A,destructorFunction(l){w(l)}})},dj=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Je=(r,j,n)=>{var l=r>>1,o=uj(oA,l,j/2,n);if(o-l>16&&dj)return dj.decode(oA.slice(l,o));for(var a="",k=l;k<o;++k){var u=oA[k];a+=String.fromCharCode(u)}return a},Pe=(r,j,n=2147483647)=>{if(n<2)return 0;n-=2;for(var l=j,o=n<r.length*2?n/2:r.length,a=0;a<o;++a){var k=r.charCodeAt(a);$A[j>>1]=k,j+=2}return $A[j>>1]=0,j-l},we=r=>r.length*2,Te=(r,j,n)=>{for(var l="",o=r>>2,a=0;!(a>=j/4);a++){var k=$[o+a];if(!k&&!n)break;l+=String.fromCodePoint(k)}return l},Se=(r,j,n=2147483647)=>{if(n<4)return 0;for(var l=j,o=l+n-4,a=0;a<r.length;++a){var k=r.codePointAt(a);if(k>65535&&a++,S[j>>2]=k,j+=4,j+4>o)break}return S[j>>2]=0,j-l},Me=r=>{for(var j=0,n=0;n<r.length;++n){var l=r.codePointAt(n);l>65535&&n++,j+=4}return j},Ue=(r,j,n)=>{n=H(n);var l,o,a;j===2?(l=Je,o=Pe,a=we):(l=Te,o=Se,a=Me),N(r,{name:n,fromWireType:k=>{var u=$[k>>2],c=l(k+4,u*j,!0);return w(k),c},toWireType:(k,u)=>{typeof u!="string"&&G(\`Cannot pass non-string to C++ string type \${n}\`);var c=a(u),q=sr(4+c+j);return $[q>>2]=c/j,o(u,q+4,c+j),k!==null&&k.push(w,q),q},readValueFromPointer:_A,destructorFunction(k){w(k)}})},Ke=(r,j)=>{j=H(j),N(r,{isVoid:!0,name:j,fromWireType:()=>{},toWireType:(n,l)=>{}})},Re=r=>{var j=!s;try{Atomics.wait(S,0,0,0),j=!0}catch{}ir(r,!i,1,j,65536,!1),m.threadInitTLS()},Cj=r=>{if(r instanceof Nr||r=="unwind")return z;D(1,r)},Ve=()=>{if(!QA())try{if(C){kA()&&lr(z);return}XA(z)}catch(r){Cj(r)}},fj=r=>{if(!pA)try{return r()}catch(j){Cj(j)}finally{Ve()}},er=r=>{if(!Mr){var j=Atomics.waitAsync(S,r>>2,r);j.value.then(gA);var n=r+112;Atomics.store(S,n>>2,1)}},gA=()=>{var r=kA();r&&fj(()=>{er(r),_j()})},Qe=(r,j)=>{if(r==j)setTimeout(gA);else if(C)postMessage({targetThread:r,cmd:4});else{var n=m.pthreads[r];if(!n)return;n.postMessage({cmd:4})}},nr=[],We=(r,j,n,l,o,a,k)=>{nr.length=0;for(var u=o>>3,c=o+l>>3;u<c;){var q;K[u++]?q=K[u++]:q=mA[u++],nr.push(q)}var f=an[r];m.currentProxiedOperationCallerThread=n;var p=f(...nr);if(m.currentProxiedOperationCallerThread=0,a){Promise.resolve(p).then(v=>Fj(a,k,v));return}return p},Xe=r=>{C?postMessage({cmd:6,thread:r}):Or(r)},ze=r=>{},Ze=()=>performance.timeOrigin+performance.now(),Ye=9007199254740992,An=-9007199254740992,rn=r=>r<An||r>Ye?NaN:Number(r),jn=()=>{},tn=()=>{VA+=1},en=()=>{throw tn(),"unwind"},nn=r=>{EA("OOM")},sn=r=>{var j=x.length;r>>>=0,nn(r)};function qj(r){return C?sA(2,0,1,r):52}function Gj(r,j,n,l){return C?sA(3,0,1,r,j,n,l):(j=rn(j),70)}var ln=[null,[],[]],on=(r,j)=>{var n=ln[r];!j||j===10?((r===1?KA:J)(cj(n)),n.length=0):n.push(j)};function pj(r,j,n,l){if(C)return sA(4,0,1,r,j,n,l);for(var o=0,a=0;a<n;a++){var k=$[j>>2],u=$[j+4>>2];j+=8;for(var c=0;c<u;c++)on(r,x[k+c]);o+=u}return $[l>>2]=o,0}m.init(),ee(),qe();{Bt(),t.noExitRuntime&&(zA=t.noExitRuntime),t.print&&(KA=t.print),t.printErr&&(J=t.printErr),t.arguments&&(E=t.arguments),t.thisProgram&&(_=t.thisProgram);var rA=t.preInit;if(rA)for(typeof rA=="function"&&(t.preInit=rA=[rA]);rA.length>0;)rA.shift()()}var an=[Tr,Sr,qj,Gj,pj],Ej,mj,kA,sr,w,kn,ir,hj,$j,Fj,vj,Ij,lr,_j,Hj,Lj,yj,gj,un,Dj;function cn(r){Ej=r.G,mj=r.H,kA=r.J,sr=t._malloc=r.K,w=t._free=r.L,kn=r.M,ir=r.N,hj=r.O,$j=r.P,Fj=r.Q,vj=r.R,Ij=r.S,lr=r.T,_j=r.U,Hj=r.V,Lj=r.W,yj=r.X,gj=r.Y,un=Dj=r.I}var xj;function dn(){xj={l:Xt,C:zt,h:Yt,o:Ae,n:Ee,m:he,e:$e,b:Fe,D:_e,g:Le,q:ye,d:ge,c:De,E:Oe,f:Ue,p:Ke,z:Re,u:Qe,j:We,s:Xe,y:er,B:ze,x:jn,A:en,k:Ze,t:sn,r:XA,w:qj,v:Gj,i:pj,a:iA}}async function Bj(){if(C){gr();return}Nt();var r=t.setStatus;r&&(r("Running..."),await new Promise(j=>setTimeout(j,1)),setTimeout(r,1,"")),!pA&&(gr(),t.onRuntimeInitialized?.(),bt())}var jA;return C||(jA=await Br(),await Bj()),t}})();typeof Ft=="object"&&typeof MA=="object"?(MA.exports=SA,MA.exports.default=SA):typeof define=="function"&&define.amd&&define([],()=>SA);var Ds=globalThis.name=="em-pthread";Ds&&SA()});var O={};hn(O,{AdditionalCaptureBlocks:()=>In,AdditionalPlaybackBlocks:()=>vn,ClockJumpCheckInterval:()=>xn,ClockJumpThreshold:()=>Bn,ConnectInterval:()=>Kn,ConnectTimeout:()=>Sn,DefaultRefreshRate:()=>Hn,DefaultVideoCodec:()=>Vn,HealthCheckTimeout:()=>Dn,MainConnectionPingInterval:()=>Nn,MaxNumberOfDecoders:()=>yn,MaxReconnectDuration:()=>Rn,MinDBFs:()=>Jj,MinTokenLifetime:()=>Mn,MinTokenRefreshInterval:()=>Un,PlaybackPreload:()=>_n,RenderQuantumSize:()=>gn,VadPreload:()=>Ln,WebRtcAnswerTimeout:()=>Pn,WebRtcIceTimeout:()=>On,WebRtcMaxNegotiationAttempts:()=>wn,WebRtcRecoveryDelays:()=>Tn,WebRtcStatsSnapshotInterval:()=>bn,WebRtcTimeout:()=>Jn});var vn=3,In=3,_n=3,Hn=250,Ln=3,yn=512,gn=128,Jj=-758.596,Dn=1e4,xn=1e3,Bn=1e4,Nn=3e3,bn=1e3,On=3e3,Jn=1e4,Pn=1e4,wn=3,Tn=[0,2e3,5e3],Sn=5e3,Mn=6e4,Un=5e3,Kn=[0,100,200,200,500],Rn=12e4,Vn="H264";function uA(e,A,t){return e.postMessage(A,t)}function kr(e){return e.sampleRate*.02*(e.stereo?2:1)}function ur(e,A){let t=kr(e),s=t*A,i=s+t;return e.samples.subarray(s,i)}function cr(e,A,t){e.headers[A]=t.id}function Pj(e){return[e.values[0],e.values[1]]}function wj(e,A){e.values[0]=A[0],e.values[1]=A[1]}function Tj(e,A){return e.values[2+A*5]}function Sj(e,A,t){e.values[2+A*5]=t}function Mj(e,A){let t=2+A*5+1;return[e.values[t+0],e.values[t+1]]}function Uj(e,A,t){let s=2+A*5+1;e.values[s+0]=t[0],e.values[s+1]=t[1]}function Kj(e,A){return e.values[2+A*5+3]}function Rj(e,A,t){e.values[2+A*5+3]=t}function Vj(e,A){return e.values[2+A*5+4]}function Qj(e,A,t){e.values[2+A*5+4]=t}function Wj(e){return e.values[0]!==0}function Xj(e){return e.values[1]}function zj(e){return e.values[2]}function Zj(e){return e.values[3]}function Yj(e,A){return e.values[3]=A}function At(e){return e?Array.from(e).map(A=>A.toString(16).padStart(2,"0")).join(""):null}var Qn;(e=>{let A;(t=>(t[t.InvalidPassword=-1]="InvalidPassword",t[t.Unknown=0]="Unknown",t[t.Unencrypted=1]="Unencrypted",t[t.Encrypted=2]="Encrypted"))(A=e.PeerCipherStatus||={})})(Qn||={});function nt(e){return{type:"Success",value:e}}function B(e){return{type:"Failure",reason:e}}var{Deno:rt}=globalThis,Wn=typeof rt?.noColor=="boolean"?rt.noColor:!1,Xn=!Wn;function Cr(e,A){return{open:\`\\x1B[\${e.join(";")}m\`,close:\`\\x1B[\${A}m\`,regexp:new RegExp(\`\\\\x1b\\\\[\${A}m\`,"g")}}function fr(e,A){return Xn?\`\${A.open}\${e.replace(A.regexp,A.open)}\${A.close}\`:e}function dr(e){return fr(e,Cr([0],0))}function jt(e){return fr(e,Cr([1],22))}function zn(e){return fr(e,Cr([2],22))}var Vs=new RegExp(["[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)","(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TXZcf-nq-uy=><~]))"].join("|"),"g"),Zn=new Date,DA=(e=>(e[e.CRITICAL=0]="CRITICAL",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(DA||{}),st={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},Yn={4:zn,3:dr,2:dr,1:jt,0:jt};function As({message:e}){return String(e)}function tt(e){return JSON.stringify({timestamp:e.date.toISOString(),level:DA[e.level],message:e.message,extra:e.extra})}function et(e){function A(C,E){return[Math.floor(C/E),C%E]}function t(){let C,E=e.date.valueOf()-Zn.valueOf();[E,C]=A(E,1e3);let[_,D]=A(E,60);return\`\${_.toString().padStart(4,"0")}:\${D.toString().padStart(2,"0")}.\${C.toString().padStart(3,"0")}\`}function s(){return e.extra===void 0?"":typeof Deno=="object"?" "+Deno.inspect(e.extra,{compact:!1,colors:!0,trailingComma:!0}).trimStart():" "+JSON.stringify(e.extra)}let i=st[e.level],d=e.logger.name!==void 0?\`@\${e.logger.name}\`:"";return\`\${dr(t())}\${d} \${i} \${Yn[e.level](String(e.message))}\${s()}\`}function rs(e){let A=\`[\${e.date.toISOString()}]\`,t=\`[\${DA[e.level]}]\`,s=e.logger.name!==void 0?\`[\${e.logger.name}] \`:"",i=st[e.level];return\`\${A} \${i} \${t.padEnd(7," ")} \${s}\${e.message}\`}function js(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var it=class{static sparse=As;static json=tt;static pretty=et;static structured=rs;static default=js()?et:tt;constructor(){}};var ts=class{formatter;consoleObject;filter;constructor(e=it.default,A=4,t=console){this.filter=A,this.formatter=e,this.consoleObject=t}handle(e){let A=this.formatter(e);switch(e.level){case 0:case 1:this.consoleObject.error(A);break;case 2:this.consoleObject.warn(A);break;case 3:this.consoleObject.info(A);break;case 4:this.consoleObject.debug(A);break}}};var W=class{#A;sinks;filter;parent;get name(){return this.#A}constructor(e,A=void 0,t=[],s=void 0){this.#A=A,this.sinks=t,this.filter=e,this.parent=s}log(e,A,t=void 0){let s={date:new Date,level:e,logger:this,message:A,extra:t};this.filter<e||this.insert(s)}insert(e){if(!(this.filter<e.level)){for(let A of this.sinks)A.filter>=e.level&&A.handle(e);this.parent!==void 0&&this.parent.insert(e)}}error=this.log.bind(this,1);warn=this.log.bind(this,2);info=this.log.bind(this,3);debug=this.log.bind(this,4)},cA=globalThis[Symbol.for("odin-global-logger")]??=new W(3,void 0,[new ts]),es=W.prototype.log.bind(cA,1),ns=W.prototype.log.bind(cA,2),lt=W.prototype.log.bind(cA,3),ss=W.prototype.log.bind(cA,4),Qs=W.prototype.log.bind(cA);var ot;function at(e,...A){let t=is(A);ot?ot?.info(e,t):lt(e,t)}function is(...e){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null)return{...e[0]};if(e.length>0)return{args:e}}function xA(e){return e.connectionId*4294967296+e.mediaId}function kt(e){return{mediaId:e%4294967296,connectionId:Math.floor(e/4294967296)}}function U(e,A,t){let s;switch(A){case"f32":s=e.HEAPF32;break;case"u32":s=e.HEAPU32;break;case"i32":s=e.HEAP32;break;case"u8":s=e.HEAPU8;break;default:throw new Error(\`allocating \${A} is not supported\`)}let i=e._malloc(t*s.BYTES_PER_ELEMENT);if(i===0||i%s.BYTES_PER_ELEMENT!==0)throw new Error(\`failed allocating a \${t} \${A} array\`);let d=i/s.BYTES_PER_ELEMENT;return s.subarray(d,d+t)}function tA(e,A){e._free(A.byteOffset)}function qr(e,A,t,s){return{headers:U(e,"i32",t),samples:U(e,"f32",t*kr({sampleRate:A,stereo:s})),length:t,sampleRate:A,stereo:s}}function Gr(e,A){tA(e,A.headers),tA(e,A.samples)}function ut(e,A){return{values:U(e,"f32",2+A*5),length:A}}function ct(e,A){tA(e,A.values)}function dt(e){return{values:U(e,"f32",4)}}function Ct(e,A){tA(e,A.values)}function ft(e){let A=e.length,t=0,s=0;for(;s<A;){let i=e.charCodeAt(s++);if((i&4294967168)===0){t++;continue}else if((i&4294965248)===0)t+=2;else{if(i>=55296&&i<=56319&&s<A){let d=e.charCodeAt(s);(d&64512)===56320&&(++s,i=((i&1023)<<10)+(d&1023)+65536)}(i&4294901760)===0?t+=3:t+=4}}return t}function ls(e,A,t){let s=e.length,i=t,d=0;for(;d<s;){let C=e.charCodeAt(d++);if((C&4294967168)===0){A[i++]=C;continue}else if((C&4294965248)===0)A[i++]=C>>6&31|192;else{if(C>=55296&&C<=56319&&d<s){let E=e.charCodeAt(d);(E&64512)===56320&&(++d,C=((C&1023)<<10)+(E&1023)+65536)}(C&4294901760)===0?(A[i++]=C>>12&15|224,A[i++]=C>>6&63|128):(A[i++]=C>>18&7|240,A[i++]=C>>12&63|128,A[i++]=C>>6&63|128)}A[i++]=C&63|128}}var os=new TextEncoder,as=50;function ks(e,A,t){os.encodeInto(e,A.subarray(t))}function qt(e,A,t){e.length>as?ks(e,A,t):ls(e,A,t)}var us=4096;function pr(e,A,t){let s=A,i=s+t,d=[],C="";for(;s<i;){let E=e[s++];if((E&128)===0)d.push(E);else if((E&224)===192){let _=e[s++]&63;d.push((E&31)<<6|_)}else if((E&240)===224){let _=e[s++]&63,D=e[s++]&63;d.push((E&31)<<12|_<<6|D)}else if((E&248)===240){let _=e[s++]&63,D=e[s++]&63,UA=e[s++]&63,T=(E&7)<<18|_<<12|D<<6|UA;T>65535&&(T-=65536,d.push(T>>>10&1023|55296),T=56320|T&1023),d.push(T)}else d.push(E);d.length>=us&&(C+=String.fromCharCode(...d),d.length=0)}return d.length>0&&(C+=String.fromCharCode(...d)),C}var cs=new TextDecoder,ds=200;function Cs(e,A,t){let s=e.subarray(A,A+t);return cs.decode(s)}function Gt(e,A,t){return t>ds?Cs(e,A,t):pr(e,A,t)}var X=class{type;data;constructor(A,t){this.type=A,this.data=t}};var L=class e extends Error{constructor(A){super(A);let t=Object.create(e.prototype);Object.setPrototypeOf(this,t),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:e.name})}};function pt(e,A,t){let s=t/4294967296,i=t;e.setUint32(A,s),e.setUint32(A+4,i)}function BA(e,A,t){let s=Math.floor(t/4294967296),i=t;e.setUint32(A,s),e.setUint32(A+4,i)}function NA(e,A){let t=e.getInt32(A),s=e.getUint32(A+4);return t*4294967296+s}function Et(e,A){let t=e.getUint32(A),s=e.getUint32(A+4);return t*4294967296+s}var fs=-1,qs=4294967296-1,Gs=17179869184-1;function ps({sec:e,nsec:A}){if(e>=0&&A>=0&&e<=Gs)if(A===0&&e<=qs){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e),t}else{let t=e/4294967296,s=e&4294967295,i=new Uint8Array(8),d=new DataView(i.buffer);return d.setUint32(0,A<<2|t&3),d.setUint32(4,s),i}else{let t=new Uint8Array(12),s=new DataView(t.buffer);return s.setUint32(0,A),BA(s,4,e),t}}function Es(e){let A=e.getTime(),t=Math.floor(A/1e3),s=(A-t*1e3)*1e6,i=Math.floor(s/1e9);return{sec:t+i,nsec:s-i*1e9}}function ms(e){if(e instanceof Date){let A=Es(e);return ps(A)}else return null}function hs(e){let A=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:A.getUint32(0),nsec:0};case 8:{let t=A.getUint32(0),s=A.getUint32(4),i=(t&3)*4294967296+s,d=t>>>2;return{sec:i,nsec:d}}case 12:{let t=NA(A,4),s=A.getUint32(0);return{sec:t,nsec:s}}default:throw new L(\`Unrecognized data size for timestamp (expected 4, 8, or 12): \${e.length}\`)}}function $s(e){let A=hs(e);return new Date(A.sec*1e3+A.nsec/1e6)}var mt={type:fs,encode:ms,decode:$s};var eA=class e{static defaultCodec=new e;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(mt)}register({type:A,encode:t,decode:s}){if(A>=0)this.encoders[A]=t,this.decoders[A]=s;else{let i=-1-A;this.builtInEncoders[i]=t,this.builtInDecoders[i]=s}}tryToEncode(A,t){for(let s=0;s<this.builtInEncoders.length;s++){let i=this.builtInEncoders[s];if(i!=null){let d=i(A,t);if(d!=null){let C=-1-s;return new X(C,d)}}}for(let s=0;s<this.encoders.length;s++){let i=this.encoders[s];if(i!=null){let d=i(A,t);if(d!=null){let C=s;return new X(C,d)}}}return A instanceof X?A:null}decode(A,t,s){let i=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return i?i(A,t,s):new X(t,A)}};function Fs(e){return e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer}function dA(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Fs(e)?new Uint8Array(e):Uint8Array.from(e)}var vs=100,Is=2048,bA=class e{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(A){this.extensionCodec=A?.extensionCodec??eA.defaultCodec,this.context=A?.context,this.useBigInt64=A?.useBigInt64??!1,this.maxDepth=A?.maxDepth??vs,this.initialBufferSize=A?.initialBufferSize??Is,this.sortKeys=A?.sortKeys??!1,this.forceFloat32=A?.forceFloat32??!1,this.ignoreUndefined=A?.ignoreUndefined??!1,this.forceIntegerToFloat=A?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new e({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(A){if(this.entered)return this.clone().encodeSharedRef(A);try{return this.entered=!0,this.reinitializeState(),this.doEncode(A,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(A){if(this.entered)return this.clone().encode(A);try{return this.entered=!0,this.reinitializeState(),this.doEncode(A,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(A,t){if(t>this.maxDepth)throw new Error(\`Too deep objects in depth \${t}\`);A==null?this.encodeNil():typeof A=="boolean"?this.encodeBoolean(A):typeof A=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(A):this.encodeNumber(A):typeof A=="string"?this.encodeString(A):this.useBigInt64&&typeof A=="bigint"?this.encodeBigInt64(A):this.encodeObject(A,t)}ensureBufferSizeToWrite(A){let t=this.pos+A;this.view.byteLength<t&&this.resizeBuffer(t*2)}resizeBuffer(A){let t=new ArrayBuffer(A),s=new Uint8Array(t),i=new DataView(t);s.set(this.bytes),this.view=i,this.bytes=s}encodeNil(){this.writeU8(192)}encodeBoolean(A){A===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(A){!this.forceIntegerToFloat&&Number.isSafeInteger(A)?A>=0?A<128?this.writeU8(A):A<256?(this.writeU8(204),this.writeU8(A)):A<65536?(this.writeU8(205),this.writeU16(A)):A<4294967296?(this.writeU8(206),this.writeU32(A)):this.useBigInt64?this.encodeNumberAsFloat(A):(this.writeU8(207),this.writeU64(A)):A>=-32?this.writeU8(224|A+32):A>=-128?(this.writeU8(208),this.writeI8(A)):A>=-32768?(this.writeU8(209),this.writeI16(A)):A>=-2147483648?(this.writeU8(210),this.writeI32(A)):this.useBigInt64?this.encodeNumberAsFloat(A):(this.writeU8(211),this.writeI64(A)):this.encodeNumberAsFloat(A)}encodeNumberAsFloat(A){this.forceFloat32?(this.writeU8(202),this.writeF32(A)):(this.writeU8(203),this.writeF64(A))}encodeBigInt64(A){A>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(A)):(this.writeU8(211),this.writeBigInt64(A))}writeStringHeader(A){if(A<32)this.writeU8(160+A);else if(A<256)this.writeU8(217),this.writeU8(A);else if(A<65536)this.writeU8(218),this.writeU16(A);else if(A<4294967296)this.writeU8(219),this.writeU32(A);else throw new Error(\`Too long string: \${A} bytes in UTF-8\`)}encodeString(A){let s=ft(A);this.ensureBufferSizeToWrite(5+s),this.writeStringHeader(s),qt(A,this.bytes,this.pos),this.pos+=s}encodeObject(A,t){let s=this.extensionCodec.tryToEncode(A,this.context);if(s!=null)this.encodeExtension(s);else if(Array.isArray(A))this.encodeArray(A,t);else if(ArrayBuffer.isView(A))this.encodeBinary(A);else if(typeof A=="object")this.encodeMap(A,t);else throw new Error(\`Unrecognized object: \${Object.prototype.toString.apply(A)}\`)}encodeBinary(A){let t=A.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else if(t<4294967296)this.writeU8(198),this.writeU32(t);else throw new Error(\`Too large binary: \${t}\`);let s=dA(A);this.writeU8a(s)}encodeArray(A,t){let s=A.length;if(s<16)this.writeU8(144+s);else if(s<65536)this.writeU8(220),this.writeU16(s);else if(s<4294967296)this.writeU8(221),this.writeU32(s);else throw new Error(\`Too large array: \${s}\`);for(let i of A)this.doEncode(i,t+1)}countWithoutUndefined(A,t){let s=0;for(let i of t)A[i]!==void 0&&s++;return s}encodeMap(A,t){let s=Object.keys(A);this.sortKeys&&s.sort();let i=this.ignoreUndefined?this.countWithoutUndefined(A,s):s.length;if(i<16)this.writeU8(128+i);else if(i<65536)this.writeU8(222),this.writeU16(i);else if(i<4294967296)this.writeU8(223),this.writeU32(i);else throw new Error(\`Too large map object: \${i}\`);for(let d of s){let C=A[d];this.ignoreUndefined&&C===void 0||(this.encodeString(d),this.doEncode(C,t+1))}}encodeExtension(A){if(typeof A.data=="function"){let s=A.data(this.pos+6),i=s.length;if(i>=4294967296)throw new Error(\`Too large extension object: \${i}\`);this.writeU8(201),this.writeU32(i),this.writeI8(A.type),this.writeU8a(s);return}let t=A.data.length;if(t===1)this.writeU8(212);else if(t===2)this.writeU8(213);else if(t===4)this.writeU8(214);else if(t===8)this.writeU8(215);else if(t===16)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else if(t<4294967296)this.writeU8(201),this.writeU32(t);else throw new Error(\`Too large extension object: \${t}\`);this.writeI8(A.type),this.writeU8a(A.data)}writeU8(A){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,A),this.pos++}writeU8a(A){let t=A.length;this.ensureBufferSizeToWrite(t),this.bytes.set(A,this.pos),this.pos+=t}writeI8(A){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,A),this.pos++}writeU16(A){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,A),this.pos+=2}writeI16(A){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,A),this.pos+=2}writeU32(A){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,A),this.pos+=4}writeI32(A){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,A),this.pos+=4}writeF32(A){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,A),this.pos+=4}writeF64(A){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,A),this.pos+=8}writeU64(A){this.ensureBufferSizeToWrite(8),pt(this.view,this.pos,A),this.pos+=8}writeI64(A){this.ensureBufferSizeToWrite(8),BA(this.view,this.pos,A),this.pos+=8}writeBigUint64(A){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,A),this.pos+=8}writeBigInt64(A){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,A),this.pos+=8}};function Er(e,A){return new bA(A).encodeSharedRef(e)}function OA(e){return\`\${e<0?"-":""}0x\${Math.abs(e).toString(16).padStart(2,"0")}\`}var _s=16,Hs=16,JA=class{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(A=_s,t=Hs){this.maxKeyLength=A,this.maxLengthPerKey=t,this.caches=[];for(let s=0;s<this.maxKeyLength;s++)this.caches.push([])}canBeCached(A){return A>0&&A<=this.maxKeyLength}find(A,t,s){let i=this.caches[s-1];A:for(let d of i){let C=d.bytes;for(let E=0;E<s;E++)if(C[E]!==A[t+E])continue A;return d.str}return null}store(A,t){let s=this.caches[A.length-1],i={bytes:A,str:t};s.length>=this.maxLengthPerKey?s[Math.random()*s.length|0]=i:s.push(i)}decode(A,t,s){let i=this.find(A,t,s);if(i!=null)return this.hit++,i;this.miss++;let d=pr(A,t,s),C=Uint8Array.prototype.slice.call(A,t,t+s);return this.store(C,d),d}};var mr="array",qA="map_key",$t="map_value",Ls=e=>{if(typeof e=="string"||typeof e=="number")return e;throw new L("The type of key must be string or number but "+typeof e)},hr=class{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(A){let t=this.getUninitializedStateFromPool();t.type=mr,t.position=0,t.size=A,t.array=new Array(A)}pushMapState(A){let t=this.getUninitializedStateFromPool();t.type=qA,t.readCount=0,t.size=A,t.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){let A={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(A)}return this.stack[this.stackHeadPosition]}release(A){if(this.stack[this.stackHeadPosition]!==A)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(A.type===mr){let s=A;s.size=0,s.array=void 0,s.position=0,s.type=void 0}if(A.type===qA||A.type===$t){let s=A;s.size=0,s.map=void 0,s.readCount=0,s.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},fA=-1,$r=new DataView(new ArrayBuffer(0)),ys=new Uint8Array($r.buffer);try{$r.getInt8(0)}catch(e){if(!(e instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var ht=new RangeError("Insufficient data"),gs=new JA,PA=class e{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=$r;bytes=ys;headByte=fA;stack=new hr;entered=!1;constructor(A){this.extensionCodec=A?.extensionCodec??eA.defaultCodec,this.context=A?.context,this.useBigInt64=A?.useBigInt64??!1,this.rawStrings=A?.rawStrings??!1,this.maxStrLength=A?.maxStrLength??4294967295,this.maxBinLength=A?.maxBinLength??4294967295,this.maxArrayLength=A?.maxArrayLength??4294967295,this.maxMapLength=A?.maxMapLength??4294967295,this.maxExtLength=A?.maxExtLength??4294967295,this.keyDecoder=A?.keyDecoder!==void 0?A.keyDecoder:gs,this.mapKeyConverter=A?.mapKeyConverter??Ls}clone(){return new e({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=fA,this.stack.reset()}setBuffer(A){let t=dA(A);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(A){if(this.headByte===fA&&!this.hasRemaining(1))this.setBuffer(A);else{let t=this.bytes.subarray(this.pos),s=dA(A),i=new Uint8Array(t.length+s.length);i.set(t),i.set(s,t.length),this.setBuffer(i)}}hasRemaining(A){return this.view.byteLength-this.pos>=A}createExtraByteError(A){let{view:t,pos:s}=this;return new RangeError(\`Extra \${t.byteLength-s} of \${t.byteLength} byte(s) found at buffer[\${A}]\`)}decode(A){if(this.entered)return this.clone().decode(A);try{this.entered=!0,this.reinitializeState(),this.setBuffer(A);let t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t}finally{this.entered=!1}}*decodeMulti(A){if(this.entered){yield*this.clone().decodeMulti(A);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(A);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(A){if(this.entered)return this.clone().decodeAsync(A);try{this.entered=!0;let t=!1,s;for await(let E of A){if(t)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(E);try{s=this.doDecodeSync(),t=!0}catch(_){if(!(_ instanceof RangeError))throw _}this.totalPos+=this.pos}if(t){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return s}let{headByte:i,pos:d,totalPos:C}=this;throw new RangeError(\`Insufficient data in parsing \${OA(i)} at \${C} (\${d} in the current buffer)\`)}finally{this.entered=!1}}decodeArrayStream(A){return this.decodeMultiAsync(A,!0)}decodeStream(A){return this.decodeMultiAsync(A,!1)}async*decodeMultiAsync(A,t){if(this.entered){yield*this.clone().decodeMultiAsync(A,t);return}try{this.entered=!0;let s=t,i=-1;for await(let d of A){if(t&&i===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(d),s&&(i=this.readArraySize(),s=!1,this.complete());try{for(;yield this.doDecodeSync(),--i!==0;);}catch(C){if(!(C instanceof RangeError))throw C}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){A:for(;;){let A=this.readHeadByte(),t;if(A>=224)t=A-256;else if(A<192)if(A<128)t=A;else if(A<144){let i=A-128;if(i!==0){this.pushMapState(i),this.complete();continue A}else t={}}else if(A<160){let i=A-144;if(i!==0){this.pushArrayState(i),this.complete();continue A}else t=[]}else{let i=A-160;t=this.decodeString(i,0)}else if(A===192)t=null;else if(A===194)t=!1;else if(A===195)t=!0;else if(A===202)t=this.readF32();else if(A===203)t=this.readF64();else if(A===204)t=this.readU8();else if(A===205)t=this.readU16();else if(A===206)t=this.readU32();else if(A===207)this.useBigInt64?t=this.readU64AsBigInt():t=this.readU64();else if(A===208)t=this.readI8();else if(A===209)t=this.readI16();else if(A===210)t=this.readI32();else if(A===211)this.useBigInt64?t=this.readI64AsBigInt():t=this.readI64();else if(A===217){let i=this.lookU8();t=this.decodeString(i,1)}else if(A===218){let i=this.lookU16();t=this.decodeString(i,2)}else if(A===219){let i=this.lookU32();t=this.decodeString(i,4)}else if(A===220){let i=this.readU16();if(i!==0){this.pushArrayState(i),this.complete();continue A}else t=[]}else if(A===221){let i=this.readU32();if(i!==0){this.pushArrayState(i),this.complete();continue A}else t=[]}else if(A===222){let i=this.readU16();if(i!==0){this.pushMapState(i),this.complete();continue A}else t={}}else if(A===223){let i=this.readU32();if(i!==0){this.pushMapState(i),this.complete();continue A}else t={}}else if(A===196){let i=this.lookU8();t=this.decodeBinary(i,1)}else if(A===197){let i=this.lookU16();t=this.decodeBinary(i,2)}else if(A===198){let i=this.lookU32();t=this.decodeBinary(i,4)}else if(A===212)t=this.decodeExtension(1,0);else if(A===213)t=this.decodeExtension(2,0);else if(A===214)t=this.decodeExtension(4,0);else if(A===215)t=this.decodeExtension(8,0);else if(A===216)t=this.decodeExtension(16,0);else if(A===199){let i=this.lookU8();t=this.decodeExtension(i,1)}else if(A===200){let i=this.lookU16();t=this.decodeExtension(i,2)}else if(A===201){let i=this.lookU32();t=this.decodeExtension(i,4)}else throw new L(\`Unrecognized type byte: \${OA(A)}\`);this.complete();let s=this.stack;for(;s.length>0;){let i=s.top();if(i.type===mr)if(i.array[i.position]=t,i.position++,i.position===i.size)t=i.array,s.release(i);else continue A;else if(i.type===qA){if(t==="__proto__")throw new L("The key __proto__ is not allowed");i.key=this.mapKeyConverter(t),i.type=$t;continue A}else if(i.map[i.key]=t,i.readCount++,i.readCount===i.size)t=i.map,s.release(i);else{i.key=null,i.type=qA;continue A}}return t}}readHeadByte(){return this.headByte===fA&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=fA}readArraySize(){let A=this.readHeadByte();switch(A){case 220:return this.readU16();case 221:return this.readU32();default:{if(A<160)return A-144;throw new L(\`Unrecognized array type byte: \${OA(A)}\`)}}}pushMapState(A){if(A>this.maxMapLength)throw new L(\`Max length exceeded: map length (\${A}) > maxMapLengthLength (\${this.maxMapLength})\`);this.stack.pushMapState(A)}pushArrayState(A){if(A>this.maxArrayLength)throw new L(\`Max length exceeded: array length (\${A}) > maxArrayLength (\${this.maxArrayLength})\`);this.stack.pushArrayState(A)}decodeString(A,t){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(A,t):this.decodeBinary(A,t)}decodeUtf8String(A,t){if(A>this.maxStrLength)throw new L(\`Max length exceeded: UTF-8 byte length (\${A}) > maxStrLength (\${this.maxStrLength})\`);if(this.bytes.byteLength<this.pos+t+A)throw ht;let s=this.pos+t,i;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(A)?i=this.keyDecoder.decode(this.bytes,s,A):i=Gt(this.bytes,s,A),this.pos+=t+A,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===qA:!1}decodeBinary(A,t){if(A>this.maxBinLength)throw new L(\`Max length exceeded: bin length (\${A}) > maxBinLength (\${this.maxBinLength})\`);if(!this.hasRemaining(A+t))throw ht;let s=this.pos+t,i=this.bytes.subarray(s,s+A);return this.pos+=t+A,i}decodeExtension(A,t){if(A>this.maxExtLength)throw new L(\`Max length exceeded: ext length (\${A}) > maxExtLength (\${this.maxExtLength})\`);let s=this.view.getInt8(this.pos+t),i=this.decodeBinary(A,t+1);return this.extensionCodec.decode(i,s,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let A=this.view.getUint8(this.pos);return this.pos++,A}readI8(){let A=this.view.getInt8(this.pos);return this.pos++,A}readU16(){let A=this.view.getUint16(this.pos);return this.pos+=2,A}readI16(){let A=this.view.getInt16(this.pos);return this.pos+=2,A}readU32(){let A=this.view.getUint32(this.pos);return this.pos+=4,A}readI32(){let A=this.view.getInt32(this.pos);return this.pos+=4,A}readU64(){let A=Et(this.view,this.pos);return this.pos+=8,A}readI64(){let A=NA(this.view,this.pos);return this.pos+=8,A}readU64AsBigInt(){let A=this.view.getBigUint64(this.pos);return this.pos+=8,A}readI64AsBigInt(){let A=this.view.getBigInt64(this.pos);return this.pos+=8,A}readF32(){let A=this.view.getFloat32(this.pos);return this.pos+=4,A}readF64(){let A=this.view.getFloat64(this.pos);return this.pos+=8,A}};function Fr(e,A){return new PA(A).decode(e)}var GA=class e{constructor(A,t,s,i,d){this.mediaIds=A;this.sequenceNumber=t;this.timeStamp=s;this.isEndOfSpurt=i;this.payload=d}static parse(A){let t;try{t=Fr(A)}catch{return B("not valid msgpack")}if(!Array.isArray(t))return B("container must be an array");if(t.length<6)return B("missing fields");if(t[0]!==1)return B("unknown type");if(!Array.isArray(t[1]))return B("media ids must be an array");if(!t[1].every(D=>typeof D=="number"))return B("media ids must be numbers");if(typeof t[2]!="number")return B("sequence number must be a number");if(typeof t[3]!="number")return B("timestamp must be a number");if(typeof t[4]!="number")return B("flags must be a number");let s=t[1],i=t[2]>>>0,d=t[3]>>>0,E=(t[4]&1)!==0,_=t[t.length-1];return _ instanceof Uint8Array?nt(new e(s,i,d,E,_)):B("payload must be bytes")}toBytes(){let A=Number(this.isEndOfSpurt),t=[1,this.mediaIds,this.sequenceNumber>>>0,this.timeStamp>>>0,A,this.payload];return new Uint8Array(Er(t,{forceFloat32:!0,ignoreUndefined:!0}))}};var wA=class{constructor(A,t){this.sampleRate=A;this.wasm=t;this.sequenceNumber=Math.random()*Math.pow(2,32)>>0;this.timestamp=Math.random()*Math.pow(2,32)>>0;this.connections=[];this.monitoring=!1;this.active=!1;this.stats={numberPackets:0,numberTicks:0,numberPacketError:0,numberPacketsMediaNotFound:0};this.encoder=new t.Encoder(A,15,!0,O.VadPreload),this.encoder.complexity=navigator.hardwareConcurrency>=4?6:4,this.information=dt(this.wasm),this.outBuffer=U(this.wasm,"u8",1270),Yj(this.information,1)}setVad(A){this.encoder.set_volume_gate(A.volumeGate!==void 0,A.volumeGate?.attackThreshold??0,A.volumeGate?.releaseThreshold??0),this.encoder.set_speech_detection(A.voiceActivity!==void 0,A.voiceActivity?.attackThreshold??0,A.voiceActivity?.releaseThreshold??0)}setMedias(A){this.connections=A.filter(({mediaIds:t})=>t.length>0)}close(){Ct(this.wasm,this.information),tA(this.wasm,this.outBuffer),this.encoder.delete()}encode(A){for(this.encoder.push(A.byteOffset,this.information.values.byteOffset);;){let t=this.encoder.pop(this.connections.length===0?0:this.outBuffer.byteOffset,this.outBuffer.length);if(t===0)break;if(t<0){at(\`failed encoding packet: \${t}\`);return}if(this.timestamp=this.timestamp+1800>>0,t===1)continue;this.sequenceNumber=this.sequenceNumber+1>>0;let s=this.active&&!this.encoder.active;this.active=this.encoder.active,this.monitoring=this.connections.some(i=>i.id===0);for(let i of this.connections){if(this.monitoring&&i.id!==0)continue;let d=new GA(i.mediaIds,this.sequenceNumber,this.timestamp,s,this.outBuffer.subarray(0,t));uA(globalThis,["sendPacket",{connectionId:i.id,packet:d.toBytes()}])}}}onMessage(A){let[t,s]=A;switch(t){case"captureSetVad":this?.setVad(s);break;case"captureSetMedias":this?.setMedias(s.connections);break;case"close":this.close();break;case"dump":s.result.postMessage(this.dump());break}}dump(){return{sequenceNumber:this.sequenceNumber,timestamp:this.timestamp,connections:this.connections.map(A=>\`\${A.id} => \${A.mediaIds.join(",")}\`),active:this.active,monitoring:this.monitoring,information:{active:Wj(this.information),speechProbability:Xj(this.information),rmsDBFS:zj(this.information),volume:Zj(this.information)},encoder:{sample_rate:this.encoder.sample_rate,fec_packet_loss:this.encoder.fec_packet_loss,voip:this.encoder.voip,vad_preload:this.encoder.vad_preload,complexity:this.encoder.complexity,speech_probability:this.encoder.speech_probability,rms_dbfs:this.encoder.rms_dbfs,active:this.encoder.active,speech_detection_enabled:this.encoder.speech_detection_enabled,speech_detection_going_active:this.encoder.speech_detection_going_active,speech_detection_going_inactive:this.encoder.speech_detection_going_inactive,volume_gate_enabled:this.encoder.volume_gate_enabled,volume_gate_going_active:this.encoder.volume_gate_going_active,volume_gate_going_inactive:this.encoder.volume_gate_going_inactive}}}},TA=class{constructor(A){this.wasm=A;this.medias=new Map;this.stats={numberPackets:0,numberTicks:0,numberPacketError:0,numberPacketsMediaNotFound:0,numberTicksWithAudio:0};this.largestIndex=-1;this.decoders=U(this.wasm,"u32",O.MaxNumberOfDecoders),this.information=ut(this.wasm,O.MaxNumberOfDecoders),wj(this.information,[1,1])}close(){ct(this.wasm,this.information);for(let{decoder:A}of this.medias.values())A.delete()}receivePacket(A,t){this.stats.numberPackets++;let s=GA.parse(t);if(s.type==="Failure"){this.stats.numberPacketError++;let i=Array.from(t).map(d=>d.toString(16).padStart(2,"0")).join("");console.error(\`failed decoding audio packet; reason: \${s.reason}, connection: \${A}, dump: \${i}\`);return}for(let i of s.value.mediaIds){let d=this.medias.get(xA({connectionId:A,mediaId:i}));if(d===void 0){this.stats.numberPacketsMediaNotFound++;continue}d.lastPacket=t;let C=U(this.wasm,"u8",s.value.payload.length);C.set(s.value.payload),d.decoder.push(s.value.sequenceNumber,s.value.timeStamp,s.value.isEndOfSpurt,C.byteOffset,C.length)}}insertMedia(A,t,s,i=[1,1]){let d=xA({connectionId:t,mediaId:s}),C=new this.wasm.Decoder;this.medias.set(d,{index:A,decoder:C,lastPacket:void 0}),this.decoders[A]=C.$$.ptr,this.largestIndex=Math.max(this.largestIndex,A),Uj(this.information,A,i),Qj(this.information,A,0),Rj(this.information,A,0)}removeMedia(A,t,s){let i=xA({connectionId:t,mediaId:s}),d=this.medias.get(i);if(!(d===void 0||d.index!==A)&&(this.medias.delete(i),Sj(this.information,A,0),this.decoders[A]=0,d.decoder.delete(),A===this.largestIndex)){for(A=A-1;A>=0&&this.decoders[A]===0;A--);this.largestIndex=A}}decode(A){return{hasAudio:this.wasm.pop_many(this.decoders.byteOffset,this.information.values.byteOffset,this.largestIndex+1,A.byteOffset)}}onMessage(A){let[t,s]=A;switch(t){case"playbackReceivePacket":this.receivePacket(s.connectionId,s.packet);break;case"playbackUpdateMedias":for(let{index:i,connectionId:d,mediaId:C}of s.removed)this.removeMedia(i,d,C);for(let{index:i,connectionId:d,mediaId:C,volume:E}of s.added)this.insertMedia(i,d,C,E);break;case"close":this.close();break;case"dump":s.result.postMessage(this.dump());break}}dump(){let A=[];for(let[t,s]of this.medias){let i=kt(t);A.push({index:s.index,connectionId:i.connectionId,mediaId:i.mediaId,rmsDBFS:Tj(this.information,s.index),volume:Mj(this.information,s.index),voicedBlocks:Vj(this.information,s.index),silentBlocks:Kj(this.information,s.index),time:s.decoder.time,consecutive_silence:s.decoder.consecutive_silence,last_voiced_time_point:s.decoder.last_voiced_time_point,sequence_number:s.decoder.sequence_number,packetsSeen:s.decoder.packets_seen,packetsInvalid:s.decoder.packets_invalid,packetsTooLate:s.decoder.packets_too_late,packetsTooEarly:s.decoder.packets_too_early,packetsRepeated:s.decoder.packets_repeated,packetsProcessed:s.decoder.packets_processed,packetsLost:s.decoder.packets_lost,rewinds:s.decoder.rewinds,cacheLength:s.decoder.cache_length,lastPacket:At(s.lastPacket)})}return{largestIndex:this.largestIndex,globalVolume:Pj(this.information),decoders:A}}};var Lt=Fn(vt()),It=(0,Lt.default)(),_t,Ht;globalThis.addEventListener("message",e=>{vr(e).catch(console.error)});async function vr(e){let A=e.data,[t,s]=A;switch(t){case"captureInit":s.workletPort.onmessage=vr,_t=new Ir(s.sampleRate,await It);break;case"playbackInit":s.workletPort.onmessage=vr,Ht=new _r(await It);break;case"close":globalThis.close();break}_t?.onMessage(A),Ht?.onMessage(A)}var Ir=class extends wA{constructor(t,s){super(t,s);this.id=-1;this.samples=qr(this.wasm,t,2+O.VadPreload+O.AdditionalCaptureBlocks,!1),uA(globalThis,["captureReady",{sampleBuffer:this.samples,informationBuffer:this.information}])}close(){super.close(),Gr(this.wasm,this.samples)}onMessage(t){super.onMessage(t);let[s,i]=t;s==="captureTick"&&this.tick(i.id)}tick(t){for(;this.id<t;this.id+=1)this.encode(ur(this.samples,this.id%this.samples.length))}dump(){return{type:"shared capture worker",id:this.id,sampleRate:this.samples.sampleRate,stereo:this.samples.stereo,length:this.samples.length,...super.dump()}}},_r=class extends TA{constructor(A){super(A);let t=2+O.AdditionalPlaybackBlocks;this.sampleBuffer=qr(A,48e3,t,!0),this.sampleBuffer.samples.fill(0),this.prefill=t-2;for(let s=0;s<this.prefill;s++)cr(this.sampleBuffer,s,{id:s});this.id=this.prefill,uA(globalThis,["playbackReady",{sampleBuffer:this.sampleBuffer,informationBuffer:this.information}])}close(){super.close(),Gr(this.wasm,this.sampleBuffer)}onMessage(A){super.onMessage(A);let[t,s]=A;t==="playbackTick"&&this.tick(s.id)}tick(A){for(this.stats.numberTicks++;this.id<A+this.prefill;this.id++){let t=this.id%this.sampleBuffer.length,{hasAudio:s}=this.decode(ur(this.sampleBuffer,t));s&&(this.stats.numberTicksWithAudio++,cr(this.sampleBuffer,t,{id:this.id}))}}dump(){return{type:"shared playback worker",id:this.id,prefill:this.prefill,sampleRate:this.sampleBuffer.sampleRate,stereo:this.sampleBuffer.stereo,...super.dump()}}};})();
|
|
3380
|
+
`;var p='"use strict";(()=>{var E=Object.defineProperty;var F=(e,t)=>{for(var r in t)E(e,r,{get:t[r],enumerable:!0})};var l={};F(l,{AdditionalCaptureBlocks:()=>C,AdditionalPlaybackBlocks:()=>D,ClockJumpCheckInterval:()=>j,ClockJumpThreshold:()=>$,ConnectInterval:()=>ee,ConnectTimeout:()=>Y,DefaultRefreshRate:()=>V,DefaultVideoCodec:()=>re,HealthCheckTimeout:()=>W,MainConnectionPingInterval:()=>H,MaxNumberOfDecoders:()=>_,MaxReconnectDuration:()=>te,MinDBFs:()=>k,MinTokenLifetime:()=>K,MinTokenRefreshInterval:()=>X,PlaybackPreload:()=>L,RenderQuantumSize:()=>N,VadPreload:()=>O,WebRtcAnswerTimeout:()=>Z,WebRtcIceTimeout:()=>J,WebRtcMaxNegotiationAttempts:()=>q,WebRtcRecoveryDelays:()=>Q,WebRtcStatsSnapshotInterval:()=>G,WebRtcTimeout:()=>z});var D=3,C=3,L=3,V=250,O=3,_=512,N=128,k=-758.596,W=1e4,j=1e3,$=1e4,H=3e3,G=1e3,J=3e3,z=1e4,Z=1e4,q=3,Q=[0,2e3,5e3],Y=5e3,K=6e4,X=5e3,ee=[0,100,200,200,500],te=12e4,re="H264";function p(e,t,r){return e.postMessage(t,r)}function ne(e){return e.sampleRate*.02*(e.stereo?2:1)}function f(e,t){let r=ne(e),n=r*t,s=n+r;return e.samples.subarray(n,s)}function S(e,t){return{id:e.headers[t]}}function I(e,t,r){e.headers[t]=r.id}var se;(e=>{let t;(r=>(r[r.InvalidPassword=-1]="InvalidPassword",r[r.Unknown=0]="Unknown",r[r.Unencrypted=1]="Unencrypted",r[r.Encrypted=2]="Encrypted"))(t=e.PeerCipherStatus||={})})(se||={});var{Deno:U}=globalThis,oe=typeof U?.noColor=="boolean"?U.noColor:!1,ae=!oe;function h(e,t){return{open:`\\x1B[${e.join(";")}m`,close:`\\x1B[${t}m`,regexp:new RegExp(`\\\\x1b\\\\[${t}m`,"g")}}function b(e,t){return ae?`${t.open}${e.replace(t.regexp,t.open)}${t.close}`:e}function m(e){return b(e,h([0],0))}function T(e){return b(e,h([1],22))}function ie(e){return b(e,h([2],22))}var Ae=new RegExp(["[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)","(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TXZcf-nq-uy=><~]))"].join("|"),"g"),ce=new Date,d=(e=>(e[e.CRITICAL=0]="CRITICAL",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(d||{}),P={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},le={4:ie,3:m,2:m,1:T,0:T};function ue({message:e}){return String(e)}function B(e){return JSON.stringify({timestamp:e.date.toISOString(),level:d[e.level],message:e.message,extra:e.extra})}function w(e){function t(c,i){return[Math.floor(c/i),c%i]}function r(){let c,i=e.date.valueOf()-ce.valueOf();[i,c]=t(i,1e3);let[M,R]=t(i,60);return`${M.toString().padStart(4,"0")}:${R.toString().padStart(2,"0")}.${c.toString().padStart(3,"0")}`}function n(){return e.extra===void 0?"":typeof Deno=="object"?" "+Deno.inspect(e.extra,{compact:!1,colors:!0,trailingComma:!0}).trimStart():" "+JSON.stringify(e.extra)}let s=P[e.level],a=e.logger.name!==void 0?`@${e.logger.name}`:"";return`${m(r())}${a} ${s} ${le[e.level](String(e.message))}${n()}`}function fe(e){let t=`[${e.date.toISOString()}]`,r=`[${d[e.level]}]`,n=e.logger.name!==void 0?`[${e.logger.name}] `:"",s=P[e.level];return`${t} ${s} ${r.padEnd(7," ")} ${n}${e.message}`}function de(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var A=class{static sparse=ue;static json=B;static pretty=w;static structured=fe;static default=de()?w:B;constructor(){}};var pe=class{formatter;consoleObject;filter;constructor(e=A.default,t=4,r=console){this.filter=t,this.formatter=e,this.consoleObject=r}handle(e){let t=this.formatter(e);switch(e.level){case 0:case 1:this.consoleObject.error(t);break;case 2:this.consoleObject.warn(t);break;case 3:this.consoleObject.info(t);break;case 4:this.consoleObject.debug(t);break}}};var o=class{#e;sinks;filter;parent;get name(){return this.#e}constructor(e,t=void 0,r=[],n=void 0){this.#e=t,this.sinks=r,this.filter=e,this.parent=n}log(e,t,r=void 0){let n={date:new Date,level:e,logger:this,message:t,extra:r};this.filter<e||this.insert(n)}insert(e){if(!(this.filter<e.level)){for(let t of this.sinks)t.filter>=e.level&&t.handle(e);this.parent!==void 0&&this.parent.insert(e)}}error=this.log.bind(this,1);warn=this.log.bind(this,2);info=this.log.bind(this,3);debug=this.log.bind(this,4)},u=globalThis[Symbol.for("odin-global-logger")]??=new o(3,void 0,[new pe]),me=o.prototype.log.bind(u,1),he=o.prototype.log.bind(u,2),be=o.prototype.log.bind(u,3),xe=o.prototype.log.bind(u,4),Me=o.prototype.log.bind(u);var x=class extends AudioWorkletProcessor{constructor(){super();this.alive=!0;this.blocks=0;this.port.onmessage=this.onMessage.bind(this)}async onMessage(r){let[n,s]=r.data;switch(n){case"init":this.state=new g(s.sampleBuffer,s.workerPort,sampleRate*.02);break;case"close":this.alive=!1;break;case"dump":s.result.postMessage(this.dump());break}}process(r,n,s){if(this.state===void 0||r.length<1||r[0].length<1)return this.alive;let a=this.state.fill(0,r[0][0]);return this.state.offset===this.state.length&&(this.blocks+=1,this.state.flush(),this.state.fill(a,r[0][0])),this.alive}dump(){return{type:"shared capture worklet",alive:this.alive,sampleRate,id:this.state?.id||null,offset:this.state?.offset||null,length:this.state?.length||null,blocks:this.blocks}}},y=class extends AudioWorkletProcessor{constructor(){super();this.alive=!0;this.silenceBlocks=0;this.voiceBlocks=0;this.totalBlocks=0;this.port.onmessage=this.onMessage.bind(this)}async onMessage(r){let[n,s]=r.data;switch(n){case"close":this.alive=!1;break;case"init":this.state=new v(s.workerPort,s.sampleBuffer,sampleRate*.02);break;case"dump":s.result.postMessage(this.dump());break}n==="close"&&(this.alive=!1)}process(r,n,s){if(this.state===void 0||n.length<1||n[0].length<2)return this.alive;let a=this.state.fill(0,n[0][0],n[0][1]);return a<l.RenderQuantumSize&&(this.totalBlocks+=1,this.state.next(),this.state.hasVoice?this.voiceBlocks+=1:this.silenceBlocks+=1,this.state.fill(a,n[0][0],n[0][1])),this.alive}dump(){return{type:"shared playback worklet",alive:this.alive,sampleRate,id:this.state?.id||null,offset:this.state?.offset||null,length:this.state?.length||null,hasVoice:this.state?.hasVoice??!1,silenceBlocks:this.silenceBlocks,voiceBlocks:this.voiceBlocks,totalBlocks:this.totalBlocks}}},g=class{constructor(t,r,n){this.samples=t;this.port=r;this.length=n;this.id=0,this.offset=0,this.entry=f(this.samples,0)}fill(t,r){let n=Math.min(r.length-t,this.length-this.offset);return this.entry.set(r.subarray(t,t+n),this.offset),this.offset+=n,t+n}flush(){this.id+=1,p(this.port,["captureTick",{id:this.id}]);let t=this.id%this.samples.length;this.entry=f(this.samples,t),I(this.samples,t,{id:this.id}),this.offset=0}},v=class{constructor(t,r,n){this.port=t;this.samples=r;this.length=n;this.id=-1,this.offset=0,this.entry=void 0,this.next()}get hasVoice(){return this.entry!==void 0}fill(t,r,n){let s=Math.min(l.RenderQuantumSize-t,this.length-this.offset);return this.entry!==void 0&&(r.set(this.entry.subarray(this.offset,this.offset+s),t),n.set(this.entry.subarray(this.offset+this.length,this.offset+this.length+s),t)),this.offset+=s,t+s}next(){this.id+=1;let t=this.id%this.samples.length,{id:r}=S(this.samples,t);this.entry=this.id===r?f(this.samples,t):void 0,this.offset=0,p(this.port,["playbackTick",{id:this.id}])}};registerProcessor("OdinCaptureProcessor",x);registerProcessor("OdinPlaybackProcessor",y);})();\n';var ux=new P.Strand;function dx(x,F,A,D,r=f.DefaultRefreshRate){return ux.enqueue(async()=>{let[j,B]=await q(G,p,x,"OdinCaptureProcessor",{channelCount:1,numberOfInputs:1,numberOfOutputs:0});return m.create(x,F,A,j,B,D)})}async function cx(x,F=f.DefaultRefreshRate){if(x.sampleRate!==48e3)throw new Error("playback sample rate must be 48kHz ");let[A,D]=await q(G,p,x,"OdinPlaybackProcessor",{numberOfInputs:0,numberOfOutputs:1,outputChannelCount:[2]});return h.create(x,A,D)}var h=class x extends l{constructor(A,D,r,j){super(A,D,r);this.information=j}static async create(A,D,r){let{port1:j,port2:B}=new MessageChannel;v(D,["playbackInit",{workletPort:j}],[j]);let{informationBuffer:t,sampleBuffer:s}=await k(D,"playbackReady");return u(t,[1,1]),v(r.port,["init",{sampleBuffer:s,workerPort:B}],[B]),new x(A,r,D,t)}getActivity(A){let D=this.medias.get(C(A));if(D===void 0)return;let r=g(this.information,D.index);return r===0?J:{isSilent:!1,rmsDBFS:r}}getJitterStats(A){}setGlobalVolume(A){u(this.information,A)}setVolume(A,D){let r=this.medias.get(C(A));r!==void 0&&y(this.information,r.index,D)}_GetFreeIndex(){let A=super._GetFreeIndex();if(A!==void 0)return A;if(this.information.length>this.medias.size)return this.medias.size}},m=class x extends n{constructor(A,D,r,j,B,t){super(A,D,r,j,t);this.information=B}static async create(A,D,r,j,B,t){let{port1:s,port2:$}=new MessageChannel;v(j,["captureInit",{sampleRate:A.sampleRate,workletPort:s}],[s]);let{sampleBuffer:w,informationBuffer:T}=await k(j,"captureReady");return v(B.port,["init",{workerPort:$,sampleBuffer:w}],[$]),new x(B,j,D,r,T,t)}get activity(){return{isSilent:!H(this.information),rmsDBFS:N(this.information)}}get speechProbability(){return L(this.information)}setVolume(A){_(this.information,A)}};0&&(module.exports={createCaptureWorker,createPlaybackWorker});
|