@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
|
-
var I=Object.defineProperty;var y=(r,D)=>{for(var x in D)I(r,x,{get:D[x],enumerable:!0})};import{Strand as
|
|
1
|
+
var I=Object.defineProperty;var y=(r,D)=>{for(var x in D)I(r,x,{get:D[x],enumerable:!0})};import{Strand as vx}from"@4players/odin-common";var E={};y(E,{AdditionalCaptureBlocks:()=>L,AdditionalPlaybackBlocks:()=>g,ClockJumpCheckInterval:()=>w,ClockJumpThreshold:()=>T,ConnectInterval:()=>Z,ConnectTimeout:()=>Q,DefaultRefreshRate:()=>N,DefaultVideoCodec:()=>xx,HealthCheckTimeout:()=>P,MainConnectionPingInterval:()=>M,MaxNumberOfDecoders:()=>O,MaxReconnectDuration:()=>Y,MinDBFs:()=>n,MinTokenLifetime:()=>X,MinTokenRefreshInterval:()=>z,PlaybackPreload:()=>H,RenderQuantumSize:()=>J,VadPreload:()=>_,WebRtcAnswerTimeout:()=>R,WebRtcIceTimeout:()=>K,WebRtcMaxNegotiationAttempts:()=>V,WebRtcRecoveryDelays:()=>W,WebRtcStatsSnapshotInterval:()=>S,WebRtcTimeout:()=>U});var g=3,L=3,H=3,N=250,_=3,O=512,J=128,n=-758.596,P=1e4,w=1e3,T=1e4,M=3e3,S=1e3,K=3e3,U=1e4,R=1e4,V=3,W=[0,2e3,5e3],Q=5e3,X=6e4,z=5e3,Z=[0,100,200,200,500],Y=12e4,xx="H264";function v(r,D,x){return r.postMessage(D,x)}function i(r,D){return new Promise(x=>{let F=A=>{let[B]=A.data;B===D&&(x(A.data[1]),r.removeEventListener("message",F))};r.addEventListener("message",F)})}import{error as Ax,warn as ux,info as cx,debug as dx,Logger as qx,LogLevel as px,CallbackSink as mx,Formatter as $x}from"@4players/odin-common";var m;function o(r,...D){let x=Fx(D);m?m?.error(r,x):Ax(r,x)}function Fx(...r){if(r.length===1&&typeof r[0]=="object"&&r[0]!==null)return{...r[0]};if(r.length>0)return{args:r}}var a={isSilent:!0,rmsDBFS:-758.596};function C(r){return r.connectionId*4294967296+r.mediaId}var f=[],e=[],b=class{constructor(D,x,F){this.audioContext=D;this.worklet=x;this.worker=F;this.availableIndexes=[];this.medias=new Map;F.addEventListener("message",this._OnMessages.bind(this))}connectOutput(D){this.worklet.disconnect(),this.worklet.connect(D)}receivePacket(D,x){v(this.worker,["playbackReceivePacket",{connectionId:D,packet:x}],[x.buffer])}addMedias(D,x,F=[1,1]){let A=[];for(let B of x){let j=this._GetFreeIndex();j!==void 0&&(this.medias.set(C({connectionId:D,mediaId:B}),{index:j}),A.push({connectionId:D,mediaId:B,index:j,volume:F}))}v(this.worker,["playbackUpdateMedias",{added:A,removed:[]}])}removeMedias(D,x){let F=[];for(let A of x){let B=C({connectionId:D,mediaId:A}),j=this.medias.get(B);j!==void 0&&(this.medias.delete(B),this.availableIndexes.push(j.index),F.push({connectionId:D,mediaId:A,index:j.index}))}v(this.worker,["playbackUpdateMedias",{added:[],removed:F}])}close(){v(this.worker,["close",void 0]),v(this.worklet.port,["close",void 0]);let D=f.indexOf(this.worker);D>=0&&f.splice(D,1);let x=e.indexOf(this.worklet);x>=0&&e.splice(x,1)}async dump(){return{playbackWorker:await l(this.worker),playbackWorklet:await l(this.worklet.port)}}_GetFreeIndex(){return this.availableIndexes.pop()}_OnMessages(D){}},s=class r{constructor(D,x,F,A,B){this.worklet=D;this.worker=x;this.sink=(j,t)=>{B.deref()!==void 0?F(j,t):(o("capture worker was left abandoned, aborting capture worker"),r.shutdown(D,x))},this.monitorSink=(j,t)=>{B.deref()!==void 0?A(j,t):(o("capture worker was left abandoned, aborting capture worker"),r.shutdown(D,x))},x.addEventListener("message",this._OnMessages.bind(this))}get context(){return this.worklet.context}setMedias(D){v(this.worker,["captureSetMedias",{connections:D}])}setVad(D){v(this.worker,["captureSetVad",D])}close(){r.shutdown(this.worklet,this.worker)}static shutdown(D,x){v(D.port,["close",void 0]),v(x,["close",void 0]);let F=f.indexOf(x);F>=0&&f.splice(F,1);let A=e.indexOf(D);A>=0&&e.splice(A,1)}async dump(){return{captureWorker:await l(this.worker),captureWorklet:await l(this.worklet.port)}}_OnMessages(D){let[x,F]=D.data;x==="sendPacket"&&(F.connectionId===0?this.monitorSink(F.connectionId,F.packet):this.sink(F.connectionId,F.packet))}};function u(r,D,x,F,A){return Promise.all([Dx(r),rx(x,D,F,A)])}async function Dx(r){let D=URL.createObjectURL(new Blob([r],{type:"text/javascript"})),x=new Worker(D,{type:"module",name:"odin worker"});return f.push(x),x}var k=new WeakMap;async function rx(r,D,x,F){try{let j=new AudioWorkletNode(r,x,F);return e.push(j),j}catch{}let A=k.get(r);if(A===void 0){let j=URL.createObjectURL(new Blob([D],{type:"text/javascript"}));A=r.audioWorklet.addModule(j),k.set(r,A),A.catch(()=>k.delete(r))}await A;let B=new AudioWorkletNode(r,x,F);return e.push(B),B}function l(r){let{port1:D,port2:x}=new MessageChannel,{promise:F,resolve:A}=Promise.withResolvers();return x.onmessage=B=>A(B.data),setTimeout(()=>A("timeout"),100),v(r,["dump",{result:D}],[D]),F}var c=`"use strict";(()=>{var un=Object.create;var XA=Object.defineProperty;var cn=Object.getOwnPropertyDescriptor;var dn=Object.getOwnPropertyNames;var Cn=Object.getPrototypeOf,qn=Object.prototype.hasOwnProperty;var fn=(n,A)=>()=>{try{return A||n((A={exports:{}}).exports,A),A.exports}catch(j){throw A=0,j}},Gn=(n,A)=>{for(var j in A)XA(n,j,{get:A[j],enumerable:!0})},pn=(n,A,j,e)=>{if(A&&typeof A=="object"||typeof A=="function")for(let l of dn(A))!qn.call(n,l)&&l!==j&&XA(n,l,{get:()=>A[l],enumerable:!(e=cn(A,l))||e.enumerable});return n};var En=(n,A,j)=>(j=n!=null?un(Cn(n)):{},pn(A||!n||!n.__esModule?XA(j,"default",{value:n,enumerable:!0}):j,n));var yj=fn((Ij,PA)=>{"use strict";var er=(()=>{var n=globalThis.document?.currentScript?.src;return async function(A={}){var j=A,e=!!globalThis.window,l=!!globalThis.WorkerGlobalScope,c=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer",C=[],p="./this.program";l&&(n=self.location.href);var I="",B,wA;if(e||l){try{I=new URL(".",n).href}catch{}l&&(wA=t=>{var r=new XMLHttpRequest;return r.open("GET",t,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),B=async t=>{var r=await fetch(t,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)}}var b=console.log.bind(console),aA=console.error.bind(console),Dj,or=!1;class Bj{}class _e extends Bj{}function xj(t){for(var r=0,s=t.length,i=new Uint8Array(s),o;r<s;++r)o=t.charCodeAt(r),i[r]=~o>>8&o;return i}var Nj=!1;function bj(){var t=Sr.buffer;U=new Int8Array(t),cA=new Int16Array(t),j.HEAPU8=g=new Uint8Array(t),rA=new Uint16Array(t),j.HEAP32=dA=new Int32Array(t),j.HEAPU32=$=new Uint32Array(t),j.HEAPF32=Br=new Float32Array(t),xr=new Float64Array(t),dr=new BigInt64Array(t),Cr=new BigUint64Array(t)}function Oj(){var t=j.preRun;t&&(typeof t=="function"&&(t=[t]),cr.push(...t)),kr(cr)}function Jj(){Nj=!0,tA.v()}function Pj(){var t=j.postRun;t&&(typeof t=="function"&&(t=[t]),ur.push(...t)),kr(ur)}function kA(t){j.onAbort?.(t),t=\`Aborted(\${t})\`,aA(t),or=!0,t+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(t);throw r}var ar;function wj(){return xj(\`\\0asm\\0\\0\\0\\x8E9\\\`\\x7F\\x7F\\\`\\x7F\\0\\\`\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\\`\\x7F\\x7F\\x7F\\x7F\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\\`\\0\\0\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\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}}\\\`\\0\\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\\\`\\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}}\\0yaa\\0ab\\0ac\\0ad\\0ae\\0af\\0ag\\0!ah\\0 ai\\0aj\\0\\bak\\0"al\\0am\\0an\\0ao\\0\\0ap\\0#aq\\0\\0ar\\0
|
|
3
3
|
as\\0at\\0\\xBD\\xBB\\x07\\0\\0\\f$\\f\\0\\x07\\f\\f\\x07\\0%& \\0
|
|
4
4
|
\\0\\v\\0'\\0\\0(\\0\\f\\0)*+\\x07\\v\\0
|
|
@@ -3327,7 +3327,7 @@ K\\xE08\\xDF\\0}\\xBC\\x8A\\x1B\\f\\xE5\\xFF\\xCF\\xE8?\\x9F\\xFFFq\\0\\x88\\xB
|
|
|
3327
3327
|
|
|
3328
3328
|
|
|
3329
3329
|
\\x07\\0\\0 \\v\\0\\0 \\v\\0\\0\\v\\0\\0\\0\\0\\0A\\xB1\\x9D\\v!\\0\\0\\0\\0\\0\\0\\0\\0\\0\\v\\r\\0\\r\\0\\0\\0 \\0\\0\\0 \\0\\0\\0\\0A\\xEB\\x9D\\v\\f\\0A\\xF7\\x9D\\v\\0\\0\\0\\0\\0\\0\\0\\0 \\f\\0\\0\\0\\0\\0\\f\\0\\0\\f\\0A\\xA5\\x9E\\v\\0A\\xB1\\x9E\\v\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0\\0A\\xDF\\x9E\\v\\0A\\xEB\\x9E\\v\\0\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0A\\xA2\\x9F\\v\\0\\0\\0\\0\\0\\0\\0\\0\\0 \\0A\\xD3\\x9F\\v\\0A\\xDF\\x9F\\v\\0\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0\\0A\\x8D\\xA0\\v\\0A\\x99\\xA0\\v\\xB3 \\0\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0\\0\\x000123456789ABCDEF\\xF0\\0H\\0NSt3__214__shared_countE\\0\\0\\0\\0t\\0|\\0\\0\\0\\0\\0\\0\\0\\0@\\0\\0\\0\\0\\0NSt3__219__shared_weak_countE\\0\\0\\0\\0\\xA8\\0\\xB8\\0N10__cxxabiv116__shim_type_infoE\\0\\0\\0\\0\\0\\xD8\\0\\x9C\\0N10__cxxabiv117__class_type_infoE\\0\\0\\0\\0\\b\\0\\x9C\\0N10__cxxabiv117__pbase_type_infoE\\0\\0\\0\\x008\\0\\xFC\\0N10__cxxabiv119__pointer_type_infoE\\0\\0h\\0\\x9C\\0N10__cxxabiv120__function_type_infoE\\0\\0\\0\\0\\0\\x9C\\0\\xFC\\0N10__cxxabiv129__pointer_to_member_type_infoE\\0\\0\\0\\0\\0\\0\\0\\xE8\\0]\\0\\0\\0^\\0\\0\\0_\\0\\0\\0\\\`\\0\\0\\0a\\0\\0\\0\\0\\xF4\\0\\x9C\\0N10__cxxabiv123__fundamental_type_infoE\\0\\xD4\\0$\\0v\\0Dn\\0\\0\\0\\0\\xD4\\x004\\0b\\0\\0\\0\\xD4\\0@\\0c\\0\\0\\0\\xD4\\0L\\0h\\0\\0\\0\\xD4\\0X\\0a\\0\\0\\0\\xD4\\0d\\0s\\0\\0\\0\\xD4\\0p\\0t\\0\\0\\0\\xD4\\0|\\0i\\0\\0\\0\\xD4\\0\\x88\\0j\\0\\0\\0\\xD4\\0\\x94\\0l\\0\\0\\0\\xD4\\0\\xA0\\0m\\0\\0\\0\\xD4\\0\\xAC\\0x\\0\\0\\0\\xD4\\0\\xB8\\0y\\0\\0\\0\\xD4\\0\\xC4\\0f\\0\\0\\0\\xD0\\0\\xD8\\0\\0\\0\\0\\0\\xBC\\0Pf\\0\\0\\xD4\\0\\xE4\\0d\\0\\0\\0\\0\\0\\0\\0\\xCC\\0]\\0\\0\\0b\\0\\0\\0_\\0\\0\\0\\\`\\0\\0\\0c\\0\\0\\0d\\0\\0\\0e\\0\\0\\0f\\0\\0\\0\\0\\0\\0\\x008\\0]\\0\\0\\0g\\0\\0\\0_\\0\\0\\0\\\`\\0\\0\\0c\\0\\0\\0h\\0\\0\\0i\\0\\0\\0j\\0\\0\\0\\0D\\0\\xCC\\0N10__cxxabiv120__si_class_type_infoE\\0\\0\\0\\0\\0\\0\\0\\0\\x94\\0]\\0\\0\\0k\\0\\0\\0_\\0\\0\\0\\\`\\0\\0\\0c\\0\\0\\0l\\0\\0\\0m\\0\\0\\0n\\0\\0\\0\\0\\xA0\\0\\xCC\\0N10__cxxabiv121__vmi_class_type_infoE\\0\\0\\0\\0\\0\\0\\0,\\0]\\0\\0\\0o\\0\\0\\0_\\0\\0\\0\\\`\\0\\0\\0p\\0\\0\\0\\0\\0\\0\\0,\\0C\\0\\0\\0q\\0\\0\\0r\\0\\0\\0\\xF0\\0\\0\\0St9exception\\0\\0\\0\\0\\0\\0\\xF8\\0St9bad_alloc\\0\\0\\0\\0\\x008\\0\\0St20bad_array_new_length\\0\\0\\0\\0\\0\\0\\0\\0h\\0E\\0\\0\\0s\\0\\0\\0t\\0\\0\\0\\0t\\0\\xF8\\0St11logic_error\\0\\0\\0\\0\\0\\x98\\0E\\0\\0\\0u\\0\\0\\0t\\0\\0\\0\\0\\xA4\\0h\\0St12length_error\\0\\0\\0\\0\\xF0\\0\\xC0\\0St9type_info\\0A\\xD0\\xA9\\v\\0A\\xDC\\xA9\\vU\\0A\\xF4\\xA9\\v\\vV\\0\\0\\0W\\0\\0\\x008\\0A\\x8C\\xAA\\v\\0A\\x9C\\xAA\\v\\b\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\0A\\xE0\\xAA\\v \\xD0\\0\\0\\0\\0\\0\\0A\\xF4\\xAA\\vX\\0A\\x8C\\xAB\\vV\\0\\0\\0Y\\0\\0\\0H\\0\\0\\0A\\xA4\\xAB\\v\\0A\\xB4\\xAB\\v\\xFF\\xFF\\xFF\\xFF
|
|
3330
|
-
\\0A\\xF8\\xAB\\v\\vh\\0h\\0\\x80\`)}function ye(t){return t}async function Tj(t){return t}async function Sj(t,r){try{var s=await Tj(t),i=await WebAssembly.instantiate(s,r);return i}catch(o){aA(\`failed to asynchronously prepare wasm: \${o}\`),kA(o)}}async function Uj(t,r,s){return Sj(r,s)}function Mj(){var t={a:on};return t}async function Kj(){function t(a){return tA=a.exports,ln(tA),bj(),tA}function r(a){return t(a.instance)}var s=Mj(),i=j.instantiateWasm;if(i)return new Promise(a=>{i(s,u=>a(t(u)))});ar??=wj();var o=await Uj(Dj,ar,s),k=r(o);return k}class Le{name="ExitStatus";constructor(r){this.message=\`Program terminated with exit(\${r})\`,this.status=r}}var kr=t=>{for(;t.length>0;)t.shift()(j)},ur=[],cr=[],Rj=!0,Vj=t=>wr(t),Qj=()=>Tr(),U,$;class Xj{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){$[this.ptr+4>>2]=r}get_type(){return $[this.ptr+4>>2]}set_destructor(r){$[this.ptr+8>>2]=r}get_destructor(){return $[this.ptr+8>>2]}set_caught(r){r=r?1:0,U[this.ptr+12]=r}get_caught(){return U[this.ptr+12]!=0}set_rethrown(r){r=r?1:0,U[this.ptr+13]=r}get_rethrown(){return U[this.ptr+13]!=0}init(r,s){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(s)}set_adjusted_ptr(r){$[this.ptr+16>>2]=r}get_adjusted_ptr(){return $[this.ptr+16>>2]}}var zj=0,Wj=t=>{kA()},Zj=(t,r,s)=>{var i=new Xj(t);i.init(r,s),zj++,Wj(t)},Yj=()=>kA(""),g,_=t=>{for(var r="";;){var s=g[t++];if(!s)return r;r+=String.fromCharCode(s)}},X={},z={},uA={};class AA extends Error{constructor(r){super(r),this.name="BindingError"}}var G=t=>{throw new AA(t)};function At(t,r,s={}){var i=r.name;if(t||G(\`type "\${i}" must have a positive integer typeid pointer\`),z.hasOwnProperty(t)){if(s.ignoreDuplicateRegistrations)return;G(\`Cannot register type '\${i}' twice\`)}if(z[t]=r,delete uA[t],X.hasOwnProperty(t)){var o=X[t];delete X[t],o.forEach(k=>k())}}function x(t,r,s={}){return At(t,r,s)}var cA,rA,dA,dr,Cr,qr=(t,r,s)=>{switch(r){case 1:return s?i=>U[i]:i=>g[i];case 2:return s?i=>cA[i>>1]:i=>rA[i>>1];case 4:return s?i=>dA[i>>2]:i=>$[i>>2];case 8:return s?i=>dr[i>>3]:i=>Cr[i>>3];default:throw new TypeError(\`invalid integer width (\${r}): \${t}\`)}},rt=(t,r,s,i,o)=>{r=_(r);let k=i===0n,a=u=>u;if(k){let u=s*8;a=d=>BigInt.asUintN(u,d),o=a(o)}x(t,{name:r,fromWireType:a,toWireType:(u,d)=>(typeof d=="number"&&(d=BigInt(d)),d),readValueFromPointer:qr(r,s,!k),destructorFunction:null})},jt=(t,r,s,i)=>{r=_(r),x(t,{name:r,fromWireType:function(o){return!!o},toWireType:function(o,k){return k?s:i},readValueFromPointer:function(o){return this.fromWireType(g[o])},destructorFunction:null})},tt=t=>({count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType}),TA=t=>{function r(s){return s.$$.ptrType.registeredClass.name}G(r(t)+" instance already deleted")},SA=!1,fr=t=>{},nt=t=>{t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)},Gr=t=>{t.count.value-=1;var r=t.count.value===0;r&&nt(t)},jA=t=>globalThis.FinalizationRegistry?(SA=new FinalizationRegistry(r=>{Gr(r.$$)}),jA=r=>{var s=r.$$,i=!!s.smartPtr;if(i){var o={$$:s};SA.register(r,o,r)}return r},fr=r=>SA.unregister(r),jA(t)):(jA=r=>r,t),CA=[],et=()=>{for(;CA.length;){var t=CA.pop();t.$$.deleteScheduled=!1,t.delete()}},pr,st=()=>{let t=qA.prototype;Object.assign(t,{isAliasOf(s){if(!(this instanceof qA)||!(s instanceof qA))return!1;var i=this.$$.ptrType.registeredClass,o=this.$$.ptr;s.$$=s.$$;for(var k=s.$$.ptrType.registeredClass,a=s.$$.ptr;i.baseClass;)o=i.upcast(o),i=i.baseClass;for(;k.baseClass;)a=k.upcast(a),k=k.baseClass;return i===k&&o===a},clone(){if(this.$$.ptr||TA(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var s=jA(Object.create(Object.getPrototypeOf(this),{$$:{value:tt(this.$$)}}));return s.$$.count.value+=1,s.$$.deleteScheduled=!1,s},delete(){this.$$.ptr||TA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),fr(this),Gr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||TA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),CA.push(this),CA.length===1&&pr&&pr(et),this.$$.deleteScheduled=!0,this}});let r=Symbol.dispose;r&&(t[r]=t.delete)};function qA(){}var Er=(t,r)=>Object.defineProperty(r,"name",{value:t}),mr={},hr=(t,r,s)=>{if(t[r].overloadTable===void 0){var i=t[r];t[r]=function(...o){return t[r].overloadTable.hasOwnProperty(o.length)||G(\`Function '\${s}' called with an invalid number of arguments (\${o.length}) - expects one of (\${t[r].overloadTable})!\`),t[r].overloadTable[o.length].apply(this,o)},t[r].overloadTable=[],t[r].overloadTable[i.argCount]=i}},$r=(t,r,s)=>{j.hasOwnProperty(t)?((s===void 0||j[t].overloadTable!==void 0&&j[t].overloadTable[s]!==void 0)&&G(\`Cannot register public name '\${t}' twice\`),hr(j,t,t),j[t].overloadTable.hasOwnProperty(s)&&G(\`Cannot register multiple overloads of a function with the same number of arguments (\${s})!\`),j[t].overloadTable[s]=r):(j[t]=r,j[t].argCount=s)},lt=48,it=57,ot=t=>{t=t.replace(/[^a-zA-Z0-9_]/g,"$");var r=t.charCodeAt(0);return r>=lt&&r<=it?\`_\${t}\`:t};function at(t,r,s,i,o,k,a,u){this.name=t,this.constructor=r,this.instancePrototype=s,this.rawDestructor=i,this.baseClass=o,this.getActualType=k,this.upcast=a,this.downcast=u,this.pureVirtualFunctions=[]}var fA=(t,r,s)=>{for(;r!==s;)r.upcast||G(\`Expected null or instance of \${s.name}, got an instance of \${r.name}\`),t=r.upcast(t),r=r.baseClass;return t},UA=t=>{if(t===null)return"null";var r=typeof t;return r==="object"||r==="array"||r==="function"?t.toString():""+t};function kt(t,r){if(r===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;r.$$||G(\`Cannot pass "\${UA(r)}" as a \${this.name}\`),r.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`);var s=r.$$.ptrType.registeredClass,i=fA(r.$$.ptr,s,this.registeredClass);return i}function ut(t,r){var s;if(r===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),this.isSmartPointer?(s=this.rawConstructor(),t!==null&&t.push(this.rawDestructor,s),s):0;(!r||!r.$$)&&G(\`Cannot pass "\${UA(r)}" as a \${this.name}\`),r.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`),!this.isConst&&r.$$.ptrType.isConst&&G(\`Cannot convert argument of type \${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type \${this.name}\`);var i=r.$$.ptrType.registeredClass;if(s=fA(r.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&G("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?s=r.$$.smartPtr:G(\`Cannot convert argument of type \${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type \${this.name}\`);break;case 1:s=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)s=r.$$.smartPtr;else{var o=r.clone();s=this.rawShare(s,RA.toHandle(()=>o.delete())),t!==null&&t.push(this.rawDestructor,s)}break;default:G("Unsupported sharing policy")}return s}function ct(t,r){if(r===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;r.$$||G(\`Cannot pass "\${UA(r)}" as a \${this.name}\`),r.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`),r.$$.ptrType.isConst&&G(\`Cannot convert argument of type \${r.$$.ptrType.name} to parameter type \${this.name}\`);var s=r.$$.ptrType.registeredClass,i=fA(r.$$.ptr,s,this.registeredClass);return i}function GA(t){return this.fromWireType($[t>>2])}var Fr=(t,r,s)=>{if(r===s)return t;if(s.baseClass===void 0)return null;var i=Fr(t,r,s.baseClass);return i===null?null:s.downcast(i)},dt={},Ct=(t,r)=>{for(r===void 0&&G("ptr should not be undefined");t.baseClass;)r=t.upcast(r),t=t.baseClass;return r},qt=(t,r)=>(r=Ct(t,r),dt[r]);class ft extends Error{constructor(r){super(r),this.name="InternalError"}}var pA=t=>{throw new ft(t)},EA=(t,r)=>{(!r.ptrType||!r.ptr)&&pA("makeClassHandle requires ptr and ptrType");var s=!!r.smartPtrType,i=!!r.smartPtr;return s!==i&&pA("Both smartPtrType and smartPtr must be specified"),r.count={value:1},jA(Object.create(t,{$$:{value:r,writable:!0}}))};function Gt(t){var r=this.getPointee(t);if(!r)return this.destructor(t),null;var s=qt(this.registeredClass,r);if(s!==void 0){if(s.$$.count.value===0)return s.$$.ptr=r,s.$$.smartPtr=t,s.clone();var i=s.clone();return this.destructor(t),i}function o(){return this.isSmartPointer?EA(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:t}):EA(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var k=this.registeredClass.getActualType(r),a=mr[k];if(!a)return o.call(this);var u;this.isConst?u=a.constPointerType:u=a.pointerType;var d=Fr(r,this.registeredClass,u.registeredClass);return d===null?o.call(this):this.isSmartPointer?EA(u.registeredClass.instancePrototype,{ptrType:u,ptr:d,smartPtrType:this,smartPtr:t}):EA(u.registeredClass.instancePrototype,{ptrType:u,ptr:d})}var pt=()=>{Object.assign(mA.prototype,{getPointee(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t},destructor(t){this.rawDestructor?.(t)},readValueFromPointer:GA,fromWireType:Gt})};function mA(t,r,s,i,o,k,a,u,d,f,q){this.name=t,this.registeredClass=r,this.isReference=s,this.isConst=i,this.isSmartPointer=o,this.pointeeType=k,this.sharingPolicy=a,this.rawGetPointee=u,this.rawConstructor=d,this.rawShare=f,this.rawDestructor=q,!o&&r.baseClass===void 0?i?(this.toWireType=kt,this.destructorFunction=null):(this.toWireType=ct,this.destructorFunction=null):this.toWireType=ut}var vr=(t,r,s)=>{j.hasOwnProperty(t)||pA("Replacing nonexistent public symbol"),j[t].overloadTable!==void 0&&s!==void 0?j[t].overloadTable[s]=r:(j[t]=r,j[t].argCount=s)},Ir=[],Et=t=>{var r=Ir[t];return r||(Ir[t]=r=Ur.get(t)),r},O=(t,r,s=!1)=>{t=_(t);function i(){var k=Et(r);return k}var o=i();return typeof o!="function"&&G(\`unknown function pointer with signature \${t}: \${r}\`),o};class mt extends Error{}var ht=t=>{var r=Pr(t),s=_(r);return J(r),s},W=(t,r)=>{var s=[],i={};function o(k){if(!i[k]&&!z[k]){if(uA[k]){uA[k].forEach(o);return}s.push(k),i[k]=!0}}throw r.forEach(o),new mt(\`\${t}: \`+s.map(ht).join([", "]))},w=(t,r,s)=>{t.forEach(u=>uA[u]=r);function i(u){var d=s(u);d.length!==t.length&&pA("Mismatched type converter count");for(var f=0;f<t.length;++f)x(t[f],d[f])}var o=new Array(r.length),k=[],a=0;for(let[u,d]of r.entries())z.hasOwnProperty(d)?o[u]=z[d]:(k.push(d),X.hasOwnProperty(d)||(X[d]=[]),X[d].push(()=>{o[u]=z[d],++a,a===k.length&&i(o)}));k.length===0&&i(o)},$t=(t,r,s,i,o,k,a,u,d,f,q,E,v)=>{q=_(q),k=O(o,k),u&&=O(a,u),f&&=O(d,f),v=O(E,v);var F=ot(q);$r(F,function(){W(\`Cannot construct \${q} due to unbound types\`,[i])}),w([t,r,s],i?[i]:[],h=>{h=h[0];var m,N;i?(m=h.registeredClass,N=m.instancePrototype):N=qA.prototype;var L=Er(q,function(...QA){if(Object.getPrototypeOf(this)!==K)throw new AA(\`Use 'new' to construct \${q}\`);if(H.constructor_body===void 0)throw new AA(\`\${q} has no accessible constructor\`);var Rr=H.constructor_body[QA.length];if(Rr===void 0)throw new AA(\`Tried to invoke ctor of \${q} with invalid number of parameters (\${QA.length}) - expected (\${Object.keys(H.constructor_body).toString()}) parameters instead!\`);return Rr.apply(this,QA)}),K=Object.create(N,{constructor:{value:L}});L.prototype=K;var H=new at(q,L,K,v,m,k,u,f);H.baseClass&&(H.baseClass.__derivedClasses??=[],H.baseClass.__derivedClasses.push(H));var kn=new mA(q,H,!0,!1,!1),Mr=new mA(q+"*",H,!1,!1,!1),Kr=new mA(q+" const*",H,!1,!0,!1);return mr[t]={pointerType:Mr,constPointerType:Kr},vr(F,L),[kn,Mr,Kr]})},MA=(t,r)=>{for(var s=[],i=0;i<t;i++)s.push($[r+i*4>>2]);return s},_r=t=>{for(;t.length;){var r=t.pop(),s=t.pop();s(r)}};function yr(t){for(var r=1;r<t.length;++r)if(t[r]!==null&&t[r].destructorFunction===void 0)return!0;return!1}function Lr(t){for(var r=1;r<t.length;++r)if(t[r]!==null&&t[r].argStackAlloc)return!0;return!1}function Ft(t,r,s,i){var o=yr(t),k=Lr(t),a=k&&!i&&!o;k&&!a&&(o=!0);var u=t.length-2,d=[],f=["fn"];r&&f.push("thisWired");for(var q=0;q<u;++q)d.push(\`arg\${q}\`),f.push(\`arg\${q}Wired\`);d=d.join(),f=f.join();var E=\`return function (\${d}) {
|
|
3330
|
+
\\0A\\xF8\\xAB\\v\\vh\\0h\\0\\x80\`)}function Le(t){return t}async function Tj(t){return t}async function Sj(t,r){try{var s=await Tj(t),i=await WebAssembly.instantiate(s,r);return i}catch(o){aA(\`failed to asynchronously prepare wasm: \${o}\`),kA(o)}}async function Uj(t,r,s){return Sj(r,s)}function Mj(){var t={a:on};return t}async function Kj(){function t(a){return tA=a.exports,ln(tA),bj(),tA}function r(a){return t(a.instance)}var s=Mj(),i=j.instantiateWasm;if(i)return new Promise(a=>{i(s,u=>a(t(u)))});ar??=wj();var o=await Uj(Dj,ar,s),k=r(o);return k}class He{name="ExitStatus";constructor(r){this.message=\`Program terminated with exit(\${r})\`,this.status=r}}var kr=t=>{for(;t.length>0;)t.shift()(j)},ur=[],cr=[],Rj=!0,Vj=t=>wr(t),Qj=()=>Tr(),U,$;class Xj{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){$[this.ptr+4>>2]=r}get_type(){return $[this.ptr+4>>2]}set_destructor(r){$[this.ptr+8>>2]=r}get_destructor(){return $[this.ptr+8>>2]}set_caught(r){r=r?1:0,U[this.ptr+12]=r}get_caught(){return U[this.ptr+12]!=0}set_rethrown(r){r=r?1:0,U[this.ptr+13]=r}get_rethrown(){return U[this.ptr+13]!=0}init(r,s){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(s)}set_adjusted_ptr(r){$[this.ptr+16>>2]=r}get_adjusted_ptr(){return $[this.ptr+16>>2]}}var Wj=0,zj=t=>{kA()},Zj=(t,r,s)=>{var i=new Xj(t);i.init(r,s),Wj++,zj(t)},Yj=()=>kA(""),g,y=t=>{for(var r="";;){var s=g[t++];if(!s)return r;r+=String.fromCharCode(s)}},X={},W={},uA={};class AA extends Error{constructor(r){super(r),this.name="BindingError"}}var G=t=>{throw new AA(t)};function At(t,r,s={}){var i=r.name;if(t||G(\`type "\${i}" must have a positive integer typeid pointer\`),W.hasOwnProperty(t)){if(s.ignoreDuplicateRegistrations)return;G(\`Cannot register type '\${i}' twice\`)}if(W[t]=r,delete uA[t],X.hasOwnProperty(t)){var o=X[t];delete X[t],o.forEach(k=>k())}}function x(t,r,s={}){return At(t,r,s)}var cA,rA,dA,dr,Cr,qr=(t,r,s)=>{switch(r){case 1:return s?i=>U[i]:i=>g[i];case 2:return s?i=>cA[i>>1]:i=>rA[i>>1];case 4:return s?i=>dA[i>>2]:i=>$[i>>2];case 8:return s?i=>dr[i>>3]:i=>Cr[i>>3];default:throw new TypeError(\`invalid integer width (\${r}): \${t}\`)}},rt=(t,r,s,i,o)=>{r=y(r);let k=i===0n,a=u=>u;if(k){let u=s*8;a=d=>BigInt.asUintN(u,d),o=a(o)}x(t,{name:r,fromWireType:a,toWireType:(u,d)=>(typeof d=="number"&&(d=BigInt(d)),d),readValueFromPointer:qr(r,s,!k),destructorFunction:null})},jt=(t,r,s,i)=>{r=y(r),x(t,{name:r,fromWireType:function(o){return!!o},toWireType:function(o,k){return k?s:i},readValueFromPointer:function(o){return this.fromWireType(g[o])},destructorFunction:null})},tt=t=>({count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType}),TA=t=>{function r(s){return s.$$.ptrType.registeredClass.name}G(r(t)+" instance already deleted")},SA=!1,fr=t=>{},nt=t=>{t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)},Gr=t=>{t.count.value-=1;var r=t.count.value===0;r&&nt(t)},jA=t=>globalThis.FinalizationRegistry?(SA=new FinalizationRegistry(r=>{Gr(r.$$)}),jA=r=>{var s=r.$$,i=!!s.smartPtr;if(i){var o={$$:s};SA.register(r,o,r)}return r},fr=r=>SA.unregister(r),jA(t)):(jA=r=>r,t),CA=[],et=()=>{for(;CA.length;){var t=CA.pop();t.$$.deleteScheduled=!1,t.delete()}},pr,st=()=>{let t=qA.prototype;Object.assign(t,{isAliasOf(s){if(!(this instanceof qA)||!(s instanceof qA))return!1;var i=this.$$.ptrType.registeredClass,o=this.$$.ptr;s.$$=s.$$;for(var k=s.$$.ptrType.registeredClass,a=s.$$.ptr;i.baseClass;)o=i.upcast(o),i=i.baseClass;for(;k.baseClass;)a=k.upcast(a),k=k.baseClass;return i===k&&o===a},clone(){if(this.$$.ptr||TA(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var s=jA(Object.create(Object.getPrototypeOf(this),{$$:{value:tt(this.$$)}}));return s.$$.count.value+=1,s.$$.deleteScheduled=!1,s},delete(){this.$$.ptr||TA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),fr(this),Gr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||TA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),CA.push(this),CA.length===1&&pr&&pr(et),this.$$.deleteScheduled=!0,this}});let r=Symbol.dispose;r&&(t[r]=t.delete)};function qA(){}var Er=(t,r)=>Object.defineProperty(r,"name",{value:t}),mr={},hr=(t,r,s)=>{if(t[r].overloadTable===void 0){var i=t[r];t[r]=function(...o){return t[r].overloadTable.hasOwnProperty(o.length)||G(\`Function '\${s}' called with an invalid number of arguments (\${o.length}) - expects one of (\${t[r].overloadTable})!\`),t[r].overloadTable[o.length].apply(this,o)},t[r].overloadTable=[],t[r].overloadTable[i.argCount]=i}},$r=(t,r,s)=>{j.hasOwnProperty(t)?((s===void 0||j[t].overloadTable!==void 0&&j[t].overloadTable[s]!==void 0)&&G(\`Cannot register public name '\${t}' twice\`),hr(j,t,t),j[t].overloadTable.hasOwnProperty(s)&&G(\`Cannot register multiple overloads of a function with the same number of arguments (\${s})!\`),j[t].overloadTable[s]=r):(j[t]=r,j[t].argCount=s)},lt=48,it=57,ot=t=>{t=t.replace(/[^a-zA-Z0-9_]/g,"$");var r=t.charCodeAt(0);return r>=lt&&r<=it?\`_\${t}\`:t};function at(t,r,s,i,o,k,a,u){this.name=t,this.constructor=r,this.instancePrototype=s,this.rawDestructor=i,this.baseClass=o,this.getActualType=k,this.upcast=a,this.downcast=u,this.pureVirtualFunctions=[]}var fA=(t,r,s)=>{for(;r!==s;)r.upcast||G(\`Expected null or instance of \${s.name}, got an instance of \${r.name}\`),t=r.upcast(t),r=r.baseClass;return t},UA=t=>{if(t===null)return"null";var r=typeof t;return r==="object"||r==="array"||r==="function"?t.toString():""+t};function kt(t,r){if(r===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;r.$$||G(\`Cannot pass "\${UA(r)}" as a \${this.name}\`),r.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`);var s=r.$$.ptrType.registeredClass,i=fA(r.$$.ptr,s,this.registeredClass);return i}function ut(t,r){var s;if(r===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),this.isSmartPointer?(s=this.rawConstructor(),t!==null&&t.push(this.rawDestructor,s),s):0;(!r||!r.$$)&&G(\`Cannot pass "\${UA(r)}" as a \${this.name}\`),r.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`),!this.isConst&&r.$$.ptrType.isConst&&G(\`Cannot convert argument of type \${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type \${this.name}\`);var i=r.$$.ptrType.registeredClass;if(s=fA(r.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&G("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?s=r.$$.smartPtr:G(\`Cannot convert argument of type \${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type \${this.name}\`);break;case 1:s=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)s=r.$$.smartPtr;else{var o=r.clone();s=this.rawShare(s,RA.toHandle(()=>o.delete())),t!==null&&t.push(this.rawDestructor,s)}break;default:G("Unsupported sharing policy")}return s}function ct(t,r){if(r===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;r.$$||G(\`Cannot pass "\${UA(r)}" as a \${this.name}\`),r.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`),r.$$.ptrType.isConst&&G(\`Cannot convert argument of type \${r.$$.ptrType.name} to parameter type \${this.name}\`);var s=r.$$.ptrType.registeredClass,i=fA(r.$$.ptr,s,this.registeredClass);return i}function GA(t){return this.fromWireType($[t>>2])}var Fr=(t,r,s)=>{if(r===s)return t;if(s.baseClass===void 0)return null;var i=Fr(t,r,s.baseClass);return i===null?null:s.downcast(i)},dt={},Ct=(t,r)=>{for(r===void 0&&G("ptr should not be undefined");t.baseClass;)r=t.upcast(r),t=t.baseClass;return r},qt=(t,r)=>(r=Ct(t,r),dt[r]);class ft extends Error{constructor(r){super(r),this.name="InternalError"}}var pA=t=>{throw new ft(t)},EA=(t,r)=>{(!r.ptrType||!r.ptr)&&pA("makeClassHandle requires ptr and ptrType");var s=!!r.smartPtrType,i=!!r.smartPtr;return s!==i&&pA("Both smartPtrType and smartPtr must be specified"),r.count={value:1},jA(Object.create(t,{$$:{value:r,writable:!0}}))};function Gt(t){var r=this.getPointee(t);if(!r)return this.destructor(t),null;var s=qt(this.registeredClass,r);if(s!==void 0){if(s.$$.count.value===0)return s.$$.ptr=r,s.$$.smartPtr=t,s.clone();var i=s.clone();return this.destructor(t),i}function o(){return this.isSmartPointer?EA(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:t}):EA(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var k=this.registeredClass.getActualType(r),a=mr[k];if(!a)return o.call(this);var u;this.isConst?u=a.constPointerType:u=a.pointerType;var d=Fr(r,this.registeredClass,u.registeredClass);return d===null?o.call(this):this.isSmartPointer?EA(u.registeredClass.instancePrototype,{ptrType:u,ptr:d,smartPtrType:this,smartPtr:t}):EA(u.registeredClass.instancePrototype,{ptrType:u,ptr:d})}var pt=()=>{Object.assign(mA.prototype,{getPointee(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t},destructor(t){this.rawDestructor?.(t)},readValueFromPointer:GA,fromWireType:Gt})};function mA(t,r,s,i,o,k,a,u,d,f,q){this.name=t,this.registeredClass=r,this.isReference=s,this.isConst=i,this.isSmartPointer=o,this.pointeeType=k,this.sharingPolicy=a,this.rawGetPointee=u,this.rawConstructor=d,this.rawShare=f,this.rawDestructor=q,!o&&r.baseClass===void 0?i?(this.toWireType=kt,this.destructorFunction=null):(this.toWireType=ct,this.destructorFunction=null):this.toWireType=ut}var vr=(t,r,s)=>{j.hasOwnProperty(t)||pA("Replacing nonexistent public symbol"),j[t].overloadTable!==void 0&&s!==void 0?j[t].overloadTable[s]=r:(j[t]=r,j[t].argCount=s)},Ir=[],Et=t=>{var r=Ir[t];return r||(Ir[t]=r=Ur.get(t)),r},O=(t,r,s=!1)=>{t=y(t);function i(){var k=Et(r);return k}var o=i();return typeof o!="function"&&G(\`unknown function pointer with signature \${t}: \${r}\`),o};class mt extends Error{}var ht=t=>{var r=Pr(t),s=y(r);return J(r),s},z=(t,r)=>{var s=[],i={};function o(k){if(!i[k]&&!W[k]){if(uA[k]){uA[k].forEach(o);return}s.push(k),i[k]=!0}}throw r.forEach(o),new mt(\`\${t}: \`+s.map(ht).join([", "]))},w=(t,r,s)=>{t.forEach(u=>uA[u]=r);function i(u){var d=s(u);d.length!==t.length&&pA("Mismatched type converter count");for(var f=0;f<t.length;++f)x(t[f],d[f])}var o=new Array(r.length),k=[],a=0;for(let[u,d]of r.entries())W.hasOwnProperty(d)?o[u]=W[d]:(k.push(d),X.hasOwnProperty(d)||(X[d]=[]),X[d].push(()=>{o[u]=W[d],++a,a===k.length&&i(o)}));k.length===0&&i(o)},$t=(t,r,s,i,o,k,a,u,d,f,q,E,v)=>{q=y(q),k=O(o,k),u&&=O(a,u),f&&=O(d,f),v=O(E,v);var F=ot(q);$r(F,function(){z(\`Cannot construct \${q} due to unbound types\`,[i])}),w([t,r,s],i?[i]:[],h=>{h=h[0];var m,N;i?(m=h.registeredClass,N=m.instancePrototype):N=qA.prototype;var L=Er(q,function(...QA){if(Object.getPrototypeOf(this)!==K)throw new AA(\`Use 'new' to construct \${q}\`);if(H.constructor_body===void 0)throw new AA(\`\${q} has no accessible constructor\`);var Rr=H.constructor_body[QA.length];if(Rr===void 0)throw new AA(\`Tried to invoke ctor of \${q} with invalid number of parameters (\${QA.length}) - expected (\${Object.keys(H.constructor_body).toString()}) parameters instead!\`);return Rr.apply(this,QA)}),K=Object.create(N,{constructor:{value:L}});L.prototype=K;var H=new at(q,L,K,v,m,k,u,f);H.baseClass&&(H.baseClass.__derivedClasses??=[],H.baseClass.__derivedClasses.push(H));var kn=new mA(q,H,!0,!1,!1),Mr=new mA(q+"*",H,!1,!1,!1),Kr=new mA(q+" const*",H,!1,!0,!1);return mr[t]={pointerType:Mr,constPointerType:Kr},vr(F,L),[kn,Mr,Kr]})},MA=(t,r)=>{for(var s=[],i=0;i<t;i++)s.push($[r+i*4>>2]);return s},yr=t=>{for(;t.length;){var r=t.pop(),s=t.pop();s(r)}};function _r(t){for(var r=1;r<t.length;++r)if(t[r]!==null&&t[r].destructorFunction===void 0)return!0;return!1}function Lr(t){for(var r=1;r<t.length;++r)if(t[r]!==null&&t[r].argStackAlloc)return!0;return!1}function Ft(t,r,s,i){var o=_r(t),k=Lr(t),a=k&&!i&&!o;k&&!a&&(o=!0);var u=t.length-2,d=[],f=["fn"];r&&f.push("thisWired");for(var q=0;q<u;++q)d.push(\`arg\${q}\`),f.push(\`arg\${q}Wired\`);d=d.join(),f=f.join();var E=\`return function (\${d}) {
|
|
3331
3331
|
\`;o&&(E+=\`var destructors = [];
|
|
3332
3332
|
\`),a&&(E+=\`var sp = stackSave();
|
|
3333
3333
|
try {
|
|
@@ -3342,5 +3342,5 @@ stackRestore(sp);
|
|
|
3342
3342
|
\`,F.push(\`\${m}_dtor\`))}return s&&(E+=\`var ret = fromRetWire(rv);
|
|
3343
3343
|
return ret;
|
|
3344
3344
|
\`),E+=\`}
|
|
3345
|
-
\`,new Function(F,E)}function KA(t,r,s,i,o,k){var a=r.length;a<2&&G("argTypes array size mismatch! Must at least get return value and receiver (this) types!");var u=r[1]!==null&&s!==null,d=yr(r),f=Lr(r),q=f&&!k&&!d;f&&!q&&(d=!0);var E=!r[0].isVoid,v=r[0],F=r[1],h=[t,G,i,o,_r,v.fromWireType.bind(v),F?.toWireType.bind(F)];q&&h.push(Qj,Vj);for(var m=2;m<a;++m){var N=r[m];h.push(N.toWireType.bind(N))}if(!d)for(var m=u?1:2;m<r.length;++m)r[m].destructorFunction!==null&&h.push(r[m].destructorFunction);var K=Ft(r,u,E,k)(...h);return Er(t,K)}var vt=(t,r,s,i,o,k)=>{var a=MA(r,s);o=O(i,o),w([],[t],u=>{u=u[0];var d=\`constructor \${u.name}\`;if(u.registeredClass.constructor_body===void 0&&(u.registeredClass.constructor_body=[]),u.registeredClass.constructor_body[r-1]!==void 0)throw new AA(\`Cannot register multiple constructors with identical number of parameters (\${r-1}) for class '\${u.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!\`);return u.registeredClass.constructor_body[r-1]=()=>{W(\`Cannot construct \${u.name} due to unbound types\`,a)},w([],a,f=>(f.splice(1,0,null),u.registeredClass.constructor_body[r-1]=KA(d,f,null,o,k),[])),[]})},Hr=t=>{t=t.trim();let r=t.indexOf("(");return r===-1?t:t.slice(0,r)},It=(t,r,s,i,o,k,a,u,d,f)=>{var q=MA(s,i);r=_(r),r=Hr(r),k=O(o,k,d),w([],[t],E=>{E=E[0];var v=\`\${E.name}.\${r}\`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),u&&E.registeredClass.pureVirtualFunctions.push(r);function F(){W(\`Cannot call \${v} due to unbound types\`,q)}var h=E.registeredClass.instancePrototype,m=h[r];return m===void 0||m.overloadTable===void 0&&m.className!==E.name&&m.argCount===s-2?(F.argCount=s-2,F.className=E.name,h[r]=F):(hr(h,r,v),h[r].overloadTable[s-2]=F),w([],q,N=>{var L=KA(v,N,E,k,a,d);return h[r].overloadTable===void 0?(L.argCount=s-2,h[r]=L):h[r].overloadTable[s-2]=L,[]}),[]})},gr=(t,r,s)=>(t instanceof Object||G(\`\${s} with invalid "this": \${t}\`),t instanceof r.registeredClass.constructor||G(\`\${s} incompatible with "this" of type \${t.constructor.name}\`),t.$$.ptr||G(\`cannot call emscripten binding method \${s} on deleted object\`),fA(t.$$.ptr,t.$$.ptrType.registeredClass,r.registeredClass)),_t=(t,r,s,i,o,k,a,u,d,f)=>{r=_(r),o=O(i,o),w([],[t],q=>{q=q[0];var E=\`\${q.name}.\${r}\`,v={get(){W(\`Cannot access \${E} due to unbound types\`,[s,a])},enumerable:!0,configurable:!0};return d?v.set=()=>W(\`Cannot access \${E} due to unbound types\`,[s,a]):v.set=F=>G(E+" is a read-only property"),Object.defineProperty(q.registeredClass.instancePrototype,r,v),w([],d?[s,a]:[s],F=>{var h=F[0],m={get(){var L=gr(this,q,E+" getter");return h.fromWireType(o(k,L))},enumerable:!0};if(d){d=O(u,d);var N=F[1];m.set=function(L){var K=gr(this,q,E+" setter"),H=[];d(f,K,N.toWireType(H,L)),_r(H)}}return Object.defineProperty(q.registeredClass.instancePrototype,r,m),[]}),[]})},Dr=[],M=[0,1,,1,null,1,!0,1,!1,1],yt=t=>{if(t>9&&--M[t+1]===0){var r=M[t];M[t]=void 0,Dr.push(t)}},RA={toValue:t=>(t||G(\`Cannot use deleted val. handle = \${t}\`),M[t]),toHandle:t=>{switch(t){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let r=Dr.pop()||M.length;return M[r]=t,M[r+1]=1,r}}}},Lt={name:"emscripten::val",fromWireType:t=>{var r=RA.toValue(t);return yt(t),r},toWireType:(t,r)=>RA.toHandle(r),readValueFromPointer:GA,destructorFunction:null},Ht=t=>x(t,Lt),Br,xr,gt=(t,r)=>{switch(r){case 4:return function(s){return this.fromWireType(Br[s>>2])};case 8:return function(s){return this.fromWireType(xr[s>>3])};default:throw new TypeError(\`invalid float width (\${r}): \${t}\`)}},Dt=(t,r,s)=>{r=_(r),x(t,{name:r,fromWireType:i=>i,toWireType:(i,o)=>o,readValueFromPointer:gt(r,s),destructorFunction:null})},Bt=(t,r,s,i,o,k,a,u)=>{var d=MA(r,s);t=_(t),t=Hr(t),o=O(i,o,a),$r(t,function(){W(\`Cannot call \${t} due to unbound types\`,d)},r-1),w([],d,f=>{var q=[f[0],null].concat(f.slice(1));return vr(t,KA(t,q,null,o,k,a),r-1),[]})},xt=(t,r,s,i,o)=>{r=_(r);let k=i===0,a=d=>d;if(k){var u=32-8*s;a=d=>d<<u>>>u,o=a(o)}x(t,{name:r,fromWireType:a,toWireType:(d,f)=>f,readValueFromPointer:qr(r,s,i!==0),destructorFunction:null})},Nt=(t,r,s)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],o=i[r];function k(a){var u=$[a>>2],d=$[a+4>>2];return new o(U.buffer,d,u)}s=_(s),x(t,{name:s,fromWireType:k,readValueFromPointer:k},{ignoreDuplicateRegistrations:!0})},bt=(t,r,s,i)=>{if(!(i>0))return 0;for(var o=s,k=s+i-1,a=0;a<t.length;++a){var u=t.codePointAt(a);if(u<=127){if(s>=k)break;r[s++]=u}else if(u<=2047){if(s+1>=k)break;r[s++]=192|u>>6,r[s++]=128|u&63}else if(u<=65535){if(s+2>=k)break;r[s++]=224|u>>12,r[s++]=128|u>>6&63,r[s++]=128|u&63}else{if(s+3>=k)break;r[s++]=240|u>>18,r[s++]=128|u>>12&63,r[s++]=128|u>>6&63,r[s++]=128|u&63,a++}}return r[s]=0,s-o},Ot=(t,r,s)=>bt(t,g,r,s),Jt=t=>{for(var r=0,s=0;s<t.length;++s){var i=t.charCodeAt(s);i<=127?r++:i<=2047?r+=2:i>=55296&&i<=57343?(r+=4,++s):r+=3}return r},Nr=globalThis.TextDecoder&&new TextDecoder,br=(t,r,s,i)=>{var o=r+s;if(i)return o;for(;t[r]&&!(r>=o);)++r;return r},Or=(t,r=0,s,i)=>{var o=br(t,r,s,i);if(o-r>16&&t.buffer&&Nr)return Nr.decode(t.subarray(r,o));for(var k="";r<o;){var a=t[r++];if(!(a&128)){k+=String.fromCharCode(a);continue}var u=t[r++]&63;if((a&224)==192){k+=String.fromCharCode((a&31)<<6|u);continue}var d=t[r++]&63;if((a&240)==224?a=(a&15)<<12|u<<6|d:a=(a&7)<<18|u<<12|d<<6|t[r++]&63,a<65536)k+=String.fromCharCode(a);else{var f=a-65536;k+=String.fromCharCode(55296|f>>10,56320|f&1023)}}return k},Pt=(t,r,s)=>t?Or(g,t,r,s):"",wt=(t,r)=>{r=_(r);var s=!0;x(t,{name:r,fromWireType(i){var o=$[i>>2],k=i+4,a;if(s)a=Pt(k,o,!0);else{a="";for(var u=0;u<o;++u)a+=String.fromCharCode(g[k+u])}return J(i),a},toWireType(i,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var k,a=typeof o=="string";a||ArrayBuffer.isView(o)&&o.BYTES_PER_ELEMENT==1||G("Cannot pass non-string to std::string"),s&&a?k=Jt(o):k=o.length;var u=VA(4+k+1),d=u+4;if($[u>>2]=k,a)if(s)Ot(o,d,k+1);else for(var f=0;f<k;++f){var q=o.charCodeAt(f);q>255&&(J(u),G("String has UTF-16 code units that do not fit in 8 bits")),g[d+f]=q}else g.set(o,d);return i!==null&&i.push(J,u),u},readValueFromPointer:GA,destructorFunction(i){J(i)}})},Jr=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Tt=(t,r,s)=>{var i=t>>1,o=br(rA,i,r/2,s);if(o-i>16&&Jr)return Jr.decode(rA.subarray(i,o));for(var k="",a=i;a<o;++a){var u=rA[a];k+=String.fromCharCode(u)}return k},St=(t,r,s=2147483647)=>{if(s<2)return 0;s-=2;for(var i=r,o=s<t.length*2?s/2:t.length,k=0;k<o;++k){var a=t.charCodeAt(k);cA[r>>1]=a,r+=2}return cA[r>>1]=0,r-i},Ut=t=>t.length*2,Mt=(t,r,s)=>{for(var i="",o=t>>2,k=0;!(k>=r/4);k++){var a=$[o+k];if(!a&&!s)break;i+=String.fromCodePoint(a)}return i},Kt=(t,r,s=2147483647)=>{if(s<4)return 0;for(var i=r,o=i+s-4,k=0;k<t.length;++k){var a=t.codePointAt(k);if(a>65535&&k++,dA[r>>2]=a,r+=4,r+4>o)break}return dA[r>>2]=0,r-i},Rt=t=>{for(var r=0,s=0;s<t.length;++s){var i=t.codePointAt(s);i>65535&&s++,r+=4}return r},Vt=(t,r,s)=>{s=_(s);var i,o,k;r===2?(i=Tt,o=St,k=Ut):(i=Mt,o=Kt,k=Rt),x(t,{name:s,fromWireType:a=>{var u=$[a>>2],d=i(a+4,u*r,!0);return J(a),d},toWireType:(a,u)=>{typeof u!="string"&&G(\`Cannot pass non-string to C++ string type \${s}\`);var d=k(u),f=VA(4+d+r);return $[f>>2]=d/r,o(u,f+4,d+r),a!==null&&a.push(J,f),f},readValueFromPointer:GA,destructorFunction(a){J(a)}})},Qt=(t,r)=>{r=_(r),x(t,{isVoid:!0,name:r,fromWireType:()=>{},toWireType:(s,i)=>{}})},Xt=t=>{kA("OOM")},zt=t=>{var r=g.length;t>>>=0,Xt(t)},Wt=t=>52,Zt=9007199254740992,Yt=-9007199254740992,An=t=>t<Yt||t>Zt?NaN:Number(t);function rn(t,r,s,i){return r=An(r),70}var jn=[null,[],[]],tn=(t,r)=>{var s=jn[t];!r||r===10?((t===1?b:aA)(Or(s)),s.length=0):s.push(r)},nn=(t,r,s,i)=>{for(var o=0,k=0;k<s;k++){var a=$[r>>2],u=$[r+4>>2];r+=8;for(var d=0;d<u;d++)tn(t,g[a+d]);o+=u}return $[i>>2]=o,0};st(),pt();{j.noExitRuntime&&(Rj=j.noExitRuntime),j.print&&(b=j.print),j.printErr&&(aA=j.printErr),j.arguments&&(C=j.arguments),j.thisProgram&&(p=j.thisProgram);var Z=j.preInit;if(Z)for(typeof Z=="function"&&(j.preInit=Z=[Z]);Z.length>0;)Z.shift()()}var Pr,VA,J,wr,Tr,en,sn,Sr,Ur;function ln(t){Pr=t.w,VA=j._malloc=t.y,J=j._free=t.z,wr=t.A,Tr=t.B,en=Sr=t.u,sn=Ur=t.x}var on={i:Zj,r:Yj,g:rt,l:jt,k:$t,j:vt,d:It,a:_t,s:Ht,f:Dt,n:Bt,c:xt,b:Nt,t:wt,e:Vt,m:Qt,o:zt,q:Wt,p:rn,h:nn};async function an(){Oj();var t=j.setStatus;t&&(t("Running..."),await new Promise(r=>setTimeout(r,1)),setTimeout(t,1,"")),!or&&(Jj(),j.onRuntimeInitialized?.(),Pj())}var tA;return tA=await Kj(),await an(),j}})();typeof Ij=="object"&&typeof PA=="object"?(PA.exports=er,PA.exports.default=er):typeof define=="function"&&define.amd&&define([],()=>er)});var T={};Gn(T,{AdditionalCaptureBlocks:()=>hn,AdditionalPlaybackBlocks:()=>mn,ClockJumpCheckInterval:()=>Ln,ClockJumpThreshold:()=>Hn,ConnectInterval:()=>wn,ConnectTimeout:()=>On,DefaultRefreshRate:()=>Fn,DefaultVideoCodec:()=>Sn,HealthCheckTimeout:()=>yn,MainConnectionPingInterval:()=>gn,MaxNumberOfDecoders:()=>In,MaxReconnectDuration:()=>Tn,MinDBFs:()=>Vr,MinTokenLifetime:()=>Jn,MinTokenRefreshInterval:()=>Pn,PlaybackPreload:()=>$n,RenderQuantumSize:()=>_n,VadPreload:()=>vn,WebRtcAnswerTimeout:()=>Nn,WebRtcIceTimeout:()=>Bn,WebRtcMaxNegotiationAttempts:()=>bn,WebRtcStatsSnapshotInterval:()=>Dn,WebRtcTimeout:()=>xn});var mn=3,hn=3,$n=3,Fn=250,vn=3,In=512,_n=128,Vr=-758.596,yn=1e4,Ln=1e3,Hn=1e4,gn=3e3,Dn=1e3,Bn=3e3,xn=1e4,Nn=1e4,bn=3,On=5e3,Jn=6e4,Pn=5e3,wn=[0,100,200,200,500],Tn=12e4,Sn="H264";function S(n,A,j){return n.postMessage(A,j)}function Qr(n){return[n.values[0],n.values[1]]}function hA(n,A){n.values[0]=A[0],n.values[1]=A[1]}function $A(n,A){return n.values[2+A*5]}function Xr(n,A,j){n.values[2+A*5]=j}function zr(n,A){let j=2+A*5+1;return[n.values[j+0],n.values[j+1]]}function FA(n,A,j){let e=2+A*5+1;n.values[e+0]=j[0],n.values[e+1]=j[1]}function Wr(n,A){return n.values[2+A*5+3]}function Zr(n,A,j){n.values[2+A*5+3]=j}function Yr(n,A){return n.values[2+A*5+4]}function Aj(n,A,j){n.values[2+A*5+4]=j}function vA(n){return n.values[0]!==0}function IA(n){return n.values[1]}function _A(n){return n.values[2]}function rj(n){return n.values[3]}function yA(n,A){return n.values[3]=A}function jj(n){return n?Array.from(n).map(A=>A.toString(16).padStart(2,"0")).join(""):null}var Un;(n=>{let A;(j=>(j[j.InvalidPassword=-1]="InvalidPassword",j[j.Unknown=0]="Unknown",j[j.Unencrypted=1]="Unencrypted",j[j.Encrypted=2]="Encrypted"))(A=n.PeerCipherStatus||={})})(Un||={});function lj(n){return{type:"Success",value:n}}function D(n){return{type:"Failure",reason:n}}var{Deno:tj}=globalThis,Mn=typeof tj?.noColor=="boolean"?tj.noColor:!1,Kn=!Mn;function WA(n,A){return{open:\`\\x1B[\${n.join(";")}m\`,close:\`\\x1B[\${A}m\`,regexp:new RegExp(\`\\\\x1b\\\\[\${A}m\`,"g")}}function ZA(n,A){return Kn?\`\${A.open}\${n.replace(A.regexp,A.open)}\${A.close}\`:n}function zA(n){return ZA(n,WA([0],0))}function nj(n){return ZA(n,WA([1],22))}function Rn(n){return ZA(n,WA([2],22))}var Te=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"),Vn=new Date,LA=(n=>(n[n.CRITICAL=0]="CRITICAL",n[n.ERROR=1]="ERROR",n[n.WARN=2]="WARN",n[n.INFO=3]="INFO",n[n.DEBUG=4]="DEBUG",n))(LA||{}),ij={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},Qn={4:Rn,3:zA,2:zA,1:nj,0:nj};function Xn({message:n}){return String(n)}function ej(n){return JSON.stringify({timestamp:n.date.toISOString(),level:LA[n.level],message:n.message,extra:n.extra})}function sj(n){function A(C,p){return[Math.floor(C/p),C%p]}function j(){let C,p=n.date.valueOf()-Vn.valueOf();[p,C]=A(p,1e3);let[I,B]=A(p,60);return\`\${I.toString().padStart(4,"0")}:\${B.toString().padStart(2,"0")}.\${C.toString().padStart(3,"0")}\`}function e(){return n.extra===void 0?"":typeof Deno=="object"?" "+Deno.inspect(n.extra,{compact:!1,colors:!0,trailingComma:!0}).trimStart():" "+JSON.stringify(n.extra)}let l=ij[n.level],c=n.logger.name!==void 0?\`@\${n.logger.name}\`:"";return\`\${zA(j())}\${c} \${l} \${Qn[n.level](String(n.message))}\${e()}\`}function zn(n){let A=\`[\${n.date.toISOString()}]\`,j=\`[\${LA[n.level]}]\`,e=n.logger.name!==void 0?\`[\${n.logger.name}] \`:"",l=ij[n.level];return\`\${A} \${l} \${j.padEnd(7," ")} \${e}\${n.message}\`}function Wn(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var oj=class{static sparse=Xn;static json=ej;static pretty=sj;static structured=zn;static default=Wn()?sj:ej;constructor(){}};var Zn=class{formatter;consoleObject;filter;constructor(n=oj.default,A=4,j=console){this.filter=A,this.formatter=n,this.consoleObject=j}handle(n){let A=this.formatter(n);switch(n.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 R=class{#A;sinks;filter;parent;get name(){return this.#A}constructor(n,A=void 0,j=[],e=void 0){this.#A=A,this.sinks=j,this.filter=n,this.parent=e}log(n,A,j=void 0){let e={date:new Date,level:n,logger:this,message:A,extra:j};this.filter<n||this.insert(e)}insert(n){if(!(this.filter<n.level)){for(let A of this.sinks)A.filter>=n.level&&A.handle(n);this.parent!==void 0&&this.parent.insert(n)}}error=this.log.bind(this,1);warn=this.log.bind(this,2);info=this.log.bind(this,3);debug=this.log.bind(this,4)},nA=globalThis[Symbol.for("odin-global-logger")]??=new R(3,void 0,[new Zn]),Yn=R.prototype.log.bind(nA,1),Ae=R.prototype.log.bind(nA,2),aj=R.prototype.log.bind(nA,3),re=R.prototype.log.bind(nA,4),Se=R.prototype.log.bind(nA);var kj;function uj(n,...A){let j=je(A);kj?kj?.info(n,j):aj(n,j)}function je(...n){if(n.length===1&&typeof n[0]=="object"&&n[0]!==null)return{...n[0]};if(n.length>0)return{args:n}}function HA(n){return n.connectionId*4294967296+n.mediaId}function cj(n){return{mediaId:n%4294967296,connectionId:Math.floor(n/4294967296)}}function P(n,A,j){let e;switch(A){case"f32":e=n.HEAPF32;break;case"u32":e=n.HEAPU32;break;case"i32":e=n.HEAP32;break;case"u8":e=n.HEAPU8;break;default:throw new Error(\`allocating \${A} is not supported\`)}let l=n._malloc(j*e.BYTES_PER_ELEMENT);if(l===0||l%e.BYTES_PER_ELEMENT!==0)throw new Error(\`failed allocating a \${j} \${A} array\`);let c=l/e.BYTES_PER_ELEMENT;return e.subarray(c,c+j)}function V(n,A){n._free(A.byteOffset)}function dj(n,A){return{values:P(n,"f32",2+A*5),length:A}}function Cj(n,A){V(n,A.values)}function qj(n){return{values:P(n,"f32",4)}}function fj(n,A){V(n,A.values)}function Gj(n){let A=n.length,j=0,e=0;for(;e<A;){let l=n.charCodeAt(e++);if((l&4294967168)===0){j++;continue}else if((l&4294965248)===0)j+=2;else{if(l>=55296&&l<=56319&&e<A){let c=n.charCodeAt(e);(c&64512)===56320&&(++e,l=((l&1023)<<10)+(c&1023)+65536)}(l&4294901760)===0?j+=3:j+=4}}return j}function te(n,A,j){let e=n.length,l=j,c=0;for(;c<e;){let C=n.charCodeAt(c++);if((C&4294967168)===0){A[l++]=C;continue}else if((C&4294965248)===0)A[l++]=C>>6&31|192;else{if(C>=55296&&C<=56319&&c<e){let p=n.charCodeAt(c);(p&64512)===56320&&(++c,C=((C&1023)<<10)+(p&1023)+65536)}(C&4294901760)===0?(A[l++]=C>>12&15|224,A[l++]=C>>6&63|128):(A[l++]=C>>18&7|240,A[l++]=C>>12&63|128,A[l++]=C>>6&63|128)}A[l++]=C&63|128}}var ne=new TextEncoder,ee=50;function se(n,A,j){ne.encodeInto(n,A.subarray(j))}function pj(n,A,j){n.length>ee?se(n,A,j):te(n,A,j)}var le=4096;function YA(n,A,j){let e=A,l=e+j,c=[],C="";for(;e<l;){let p=n[e++];if((p&128)===0)c.push(p);else if((p&224)===192){let I=n[e++]&63;c.push((p&31)<<6|I)}else if((p&240)===224){let I=n[e++]&63,B=n[e++]&63;c.push((p&31)<<12|I<<6|B)}else if((p&248)===240){let I=n[e++]&63,B=n[e++]&63,wA=n[e++]&63,b=(p&7)<<18|I<<12|B<<6|wA;b>65535&&(b-=65536,c.push(b>>>10&1023|55296),b=56320|b&1023),c.push(b)}else c.push(p);c.length>=le&&(C+=String.fromCharCode(...c),c.length=0)}return c.length>0&&(C+=String.fromCharCode(...c)),C}var ie=new TextDecoder,oe=200;function ae(n,A,j){let e=n.subarray(A,A+j);return ie.decode(e)}function Ej(n,A,j){return j>oe?ae(n,A,j):YA(n,A,j)}var Q=class{type;data;constructor(A,j){this.type=A,this.data=j}};var y=class n extends Error{constructor(A){super(A);let j=Object.create(n.prototype);Object.setPrototypeOf(this,j),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:n.name})}};function mj(n,A,j){let e=j/4294967296,l=j;n.setUint32(A,e),n.setUint32(A+4,l)}function gA(n,A,j){let e=Math.floor(j/4294967296),l=j;n.setUint32(A,e),n.setUint32(A+4,l)}function DA(n,A){let j=n.getInt32(A),e=n.getUint32(A+4);return j*4294967296+e}function hj(n,A){let j=n.getUint32(A),e=n.getUint32(A+4);return j*4294967296+e}var ke=-1,ue=4294967296-1,ce=17179869184-1;function de({sec:n,nsec:A}){if(n>=0&&A>=0&&n<=ce)if(A===0&&n<=ue){let j=new Uint8Array(4);return new DataView(j.buffer).setUint32(0,n),j}else{let j=n/4294967296,e=n&4294967295,l=new Uint8Array(8),c=new DataView(l.buffer);return c.setUint32(0,A<<2|j&3),c.setUint32(4,e),l}else{let j=new Uint8Array(12),e=new DataView(j.buffer);return e.setUint32(0,A),gA(e,4,n),j}}function Ce(n){let A=n.getTime(),j=Math.floor(A/1e3),e=(A-j*1e3)*1e6,l=Math.floor(e/1e9);return{sec:j+l,nsec:e-l*1e9}}function qe(n){if(n instanceof Date){let A=Ce(n);return de(A)}else return null}function fe(n){let A=new DataView(n.buffer,n.byteOffset,n.byteLength);switch(n.byteLength){case 4:return{sec:A.getUint32(0),nsec:0};case 8:{let j=A.getUint32(0),e=A.getUint32(4),l=(j&3)*4294967296+e,c=j>>>2;return{sec:l,nsec:c}}case 12:{let j=DA(A,4),e=A.getUint32(0);return{sec:j,nsec:e}}default:throw new y(\`Unrecognized data size for timestamp (expected 4, 8, or 12): \${n.length}\`)}}function Ge(n){let A=fe(n);return new Date(A.sec*1e3+A.nsec/1e6)}var $j={type:ke,encode:qe,decode:Ge};var Y=class n{static defaultCodec=new n;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register($j)}register({type:A,encode:j,decode:e}){if(A>=0)this.encoders[A]=j,this.decoders[A]=e;else{let l=-1-A;this.builtInEncoders[l]=j,this.builtInDecoders[l]=e}}tryToEncode(A,j){for(let e=0;e<this.builtInEncoders.length;e++){let l=this.builtInEncoders[e];if(l!=null){let c=l(A,j);if(c!=null){let C=-1-e;return new Q(C,c)}}}for(let e=0;e<this.encoders.length;e++){let l=this.encoders[e];if(l!=null){let c=l(A,j);if(c!=null){let C=e;return new Q(C,c)}}}return A instanceof Q?A:null}decode(A,j,e){let l=j<0?this.builtInDecoders[-1-j]:this.decoders[j];return l?l(A,j,e):new Q(j,A)}};function pe(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}function eA(n){return n instanceof Uint8Array?n:ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):pe(n)?new Uint8Array(n):Uint8Array.from(n)}var Ee=100,me=2048,BA=class n{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(A){this.extensionCodec=A?.extensionCodec??Y.defaultCodec,this.context=A?.context,this.useBigInt64=A?.useBigInt64??!1,this.maxDepth=A?.maxDepth??Ee,this.initialBufferSize=A?.initialBufferSize??me,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 n({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,j){if(j>this.maxDepth)throw new Error(\`Too deep objects in depth \${j}\`);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,j)}ensureBufferSizeToWrite(A){let j=this.pos+A;this.view.byteLength<j&&this.resizeBuffer(j*2)}resizeBuffer(A){let j=new ArrayBuffer(A),e=new Uint8Array(j),l=new DataView(j);e.set(this.bytes),this.view=l,this.bytes=e}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 e=Gj(A);this.ensureBufferSizeToWrite(5+e),this.writeStringHeader(e),pj(A,this.bytes,this.pos),this.pos+=e}encodeObject(A,j){let e=this.extensionCodec.tryToEncode(A,this.context);if(e!=null)this.encodeExtension(e);else if(Array.isArray(A))this.encodeArray(A,j);else if(ArrayBuffer.isView(A))this.encodeBinary(A);else if(typeof A=="object")this.encodeMap(A,j);else throw new Error(\`Unrecognized object: \${Object.prototype.toString.apply(A)}\`)}encodeBinary(A){let j=A.byteLength;if(j<256)this.writeU8(196),this.writeU8(j);else if(j<65536)this.writeU8(197),this.writeU16(j);else if(j<4294967296)this.writeU8(198),this.writeU32(j);else throw new Error(\`Too large binary: \${j}\`);let e=eA(A);this.writeU8a(e)}encodeArray(A,j){let e=A.length;if(e<16)this.writeU8(144+e);else if(e<65536)this.writeU8(220),this.writeU16(e);else if(e<4294967296)this.writeU8(221),this.writeU32(e);else throw new Error(\`Too large array: \${e}\`);for(let l of A)this.doEncode(l,j+1)}countWithoutUndefined(A,j){let e=0;for(let l of j)A[l]!==void 0&&e++;return e}encodeMap(A,j){let e=Object.keys(A);this.sortKeys&&e.sort();let l=this.ignoreUndefined?this.countWithoutUndefined(A,e):e.length;if(l<16)this.writeU8(128+l);else if(l<65536)this.writeU8(222),this.writeU16(l);else if(l<4294967296)this.writeU8(223),this.writeU32(l);else throw new Error(\`Too large map object: \${l}\`);for(let c of e){let C=A[c];this.ignoreUndefined&&C===void 0||(this.encodeString(c),this.doEncode(C,j+1))}}encodeExtension(A){if(typeof A.data=="function"){let e=A.data(this.pos+6),l=e.length;if(l>=4294967296)throw new Error(\`Too large extension object: \${l}\`);this.writeU8(201),this.writeU32(l),this.writeI8(A.type),this.writeU8a(e);return}let j=A.data.length;if(j===1)this.writeU8(212);else if(j===2)this.writeU8(213);else if(j===4)this.writeU8(214);else if(j===8)this.writeU8(215);else if(j===16)this.writeU8(216);else if(j<256)this.writeU8(199),this.writeU8(j);else if(j<65536)this.writeU8(200),this.writeU16(j);else if(j<4294967296)this.writeU8(201),this.writeU32(j);else throw new Error(\`Too large extension object: \${j}\`);this.writeI8(A.type),this.writeU8a(A.data)}writeU8(A){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,A),this.pos++}writeU8a(A){let j=A.length;this.ensureBufferSizeToWrite(j),this.bytes.set(A,this.pos),this.pos+=j}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),mj(this.view,this.pos,A),this.pos+=8}writeI64(A){this.ensureBufferSizeToWrite(8),gA(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 Ar(n,A){return new BA(A).encodeSharedRef(n)}function xA(n){return\`\${n<0?"-":""}0x\${Math.abs(n).toString(16).padStart(2,"0")}\`}var he=16,$e=16,NA=class{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(A=he,j=$e){this.maxKeyLength=A,this.maxLengthPerKey=j,this.caches=[];for(let e=0;e<this.maxKeyLength;e++)this.caches.push([])}canBeCached(A){return A>0&&A<=this.maxKeyLength}find(A,j,e){let l=this.caches[e-1];A:for(let c of l){let C=c.bytes;for(let p=0;p<e;p++)if(C[p]!==A[j+p])continue A;return c.str}return null}store(A,j){let e=this.caches[A.length-1],l={bytes:A,str:j};e.length>=this.maxLengthPerKey?e[Math.random()*e.length|0]=l:e.push(l)}decode(A,j,e){let l=this.find(A,j,e);if(l!=null)return this.hit++,l;this.miss++;let c=YA(A,j,e),C=Uint8Array.prototype.slice.call(A,j,j+e);return this.store(C,c),c}};var rr="array",iA="map_key",vj="map_value",Fe=n=>{if(typeof n=="string"||typeof n=="number")return n;throw new y("The type of key must be string or number but "+typeof n)},jr=class{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(A){let j=this.getUninitializedStateFromPool();j.type=rr,j.position=0,j.size=A,j.array=new Array(A)}pushMapState(A){let j=this.getUninitializedStateFromPool();j.type=iA,j.readCount=0,j.size=A,j.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===rr){let e=A;e.size=0,e.array=void 0,e.position=0,e.type=void 0}if(A.type===iA||A.type===vj){let e=A;e.size=0,e.map=void 0,e.readCount=0,e.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},lA=-1,tr=new DataView(new ArrayBuffer(0)),ve=new Uint8Array(tr.buffer);try{tr.getInt8(0)}catch(n){if(!(n 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 Fj=new RangeError("Insufficient data"),Ie=new NA,bA=class n{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=tr;bytes=ve;headByte=lA;stack=new jr;entered=!1;constructor(A){this.extensionCodec=A?.extensionCodec??Y.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:Ie,this.mapKeyConverter=A?.mapKeyConverter??Fe}clone(){return new n({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=lA,this.stack.reset()}setBuffer(A){let j=eA(A);this.bytes=j,this.view=new DataView(j.buffer,j.byteOffset,j.byteLength),this.pos=0}appendBuffer(A){if(this.headByte===lA&&!this.hasRemaining(1))this.setBuffer(A);else{let j=this.bytes.subarray(this.pos),e=eA(A),l=new Uint8Array(j.length+e.length);l.set(j),l.set(e,j.length),this.setBuffer(l)}}hasRemaining(A){return this.view.byteLength-this.pos>=A}createExtraByteError(A){let{view:j,pos:e}=this;return new RangeError(\`Extra \${j.byteLength-e} of \${j.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 j=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return j}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 j=!1,e;for await(let p of A){if(j)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(p);try{e=this.doDecodeSync(),j=!0}catch(I){if(!(I instanceof RangeError))throw I}this.totalPos+=this.pos}if(j){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return e}let{headByte:l,pos:c,totalPos:C}=this;throw new RangeError(\`Insufficient data in parsing \${xA(l)} at \${C} (\${c} 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,j){if(this.entered){yield*this.clone().decodeMultiAsync(A,j);return}try{this.entered=!0;let e=j,l=-1;for await(let c of A){if(j&&l===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(c),e&&(l=this.readArraySize(),e=!1,this.complete());try{for(;yield this.doDecodeSync(),--l!==0;);}catch(C){if(!(C instanceof RangeError))throw C}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){A:for(;;){let A=this.readHeadByte(),j;if(A>=224)j=A-256;else if(A<192)if(A<128)j=A;else if(A<144){let l=A-128;if(l!==0){this.pushMapState(l),this.complete();continue A}else j={}}else if(A<160){let l=A-144;if(l!==0){this.pushArrayState(l),this.complete();continue A}else j=[]}else{let l=A-160;j=this.decodeString(l,0)}else if(A===192)j=null;else if(A===194)j=!1;else if(A===195)j=!0;else if(A===202)j=this.readF32();else if(A===203)j=this.readF64();else if(A===204)j=this.readU8();else if(A===205)j=this.readU16();else if(A===206)j=this.readU32();else if(A===207)this.useBigInt64?j=this.readU64AsBigInt():j=this.readU64();else if(A===208)j=this.readI8();else if(A===209)j=this.readI16();else if(A===210)j=this.readI32();else if(A===211)this.useBigInt64?j=this.readI64AsBigInt():j=this.readI64();else if(A===217){let l=this.lookU8();j=this.decodeString(l,1)}else if(A===218){let l=this.lookU16();j=this.decodeString(l,2)}else if(A===219){let l=this.lookU32();j=this.decodeString(l,4)}else if(A===220){let l=this.readU16();if(l!==0){this.pushArrayState(l),this.complete();continue A}else j=[]}else if(A===221){let l=this.readU32();if(l!==0){this.pushArrayState(l),this.complete();continue A}else j=[]}else if(A===222){let l=this.readU16();if(l!==0){this.pushMapState(l),this.complete();continue A}else j={}}else if(A===223){let l=this.readU32();if(l!==0){this.pushMapState(l),this.complete();continue A}else j={}}else if(A===196){let l=this.lookU8();j=this.decodeBinary(l,1)}else if(A===197){let l=this.lookU16();j=this.decodeBinary(l,2)}else if(A===198){let l=this.lookU32();j=this.decodeBinary(l,4)}else if(A===212)j=this.decodeExtension(1,0);else if(A===213)j=this.decodeExtension(2,0);else if(A===214)j=this.decodeExtension(4,0);else if(A===215)j=this.decodeExtension(8,0);else if(A===216)j=this.decodeExtension(16,0);else if(A===199){let l=this.lookU8();j=this.decodeExtension(l,1)}else if(A===200){let l=this.lookU16();j=this.decodeExtension(l,2)}else if(A===201){let l=this.lookU32();j=this.decodeExtension(l,4)}else throw new y(\`Unrecognized type byte: \${xA(A)}\`);this.complete();let e=this.stack;for(;e.length>0;){let l=e.top();if(l.type===rr)if(l.array[l.position]=j,l.position++,l.position===l.size)j=l.array,e.release(l);else continue A;else if(l.type===iA){if(j==="__proto__")throw new y("The key __proto__ is not allowed");l.key=this.mapKeyConverter(j),l.type=vj;continue A}else if(l.map[l.key]=j,l.readCount++,l.readCount===l.size)j=l.map,e.release(l);else{l.key=null,l.type=iA;continue A}}return j}}readHeadByte(){return this.headByte===lA&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=lA}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 y(\`Unrecognized array type byte: \${xA(A)}\`)}}}pushMapState(A){if(A>this.maxMapLength)throw new y(\`Max length exceeded: map length (\${A}) > maxMapLengthLength (\${this.maxMapLength})\`);this.stack.pushMapState(A)}pushArrayState(A){if(A>this.maxArrayLength)throw new y(\`Max length exceeded: array length (\${A}) > maxArrayLength (\${this.maxArrayLength})\`);this.stack.pushArrayState(A)}decodeString(A,j){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(A,j):this.decodeBinary(A,j)}decodeUtf8String(A,j){if(A>this.maxStrLength)throw new y(\`Max length exceeded: UTF-8 byte length (\${A}) > maxStrLength (\${this.maxStrLength})\`);if(this.bytes.byteLength<this.pos+j+A)throw Fj;let e=this.pos+j,l;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(A)?l=this.keyDecoder.decode(this.bytes,e,A):l=Ej(this.bytes,e,A),this.pos+=j+A,l}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===iA:!1}decodeBinary(A,j){if(A>this.maxBinLength)throw new y(\`Max length exceeded: bin length (\${A}) > maxBinLength (\${this.maxBinLength})\`);if(!this.hasRemaining(A+j))throw Fj;let e=this.pos+j,l=this.bytes.subarray(e,e+A);return this.pos+=j+A,l}decodeExtension(A,j){if(A>this.maxExtLength)throw new y(\`Max length exceeded: ext length (\${A}) > maxExtLength (\${this.maxExtLength})\`);let e=this.view.getInt8(this.pos+j),l=this.decodeBinary(A,j+1);return this.extensionCodec.decode(l,e,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=hj(this.view,this.pos);return this.pos+=8,A}readI64(){let A=DA(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 nr(n,A){return new bA(A).decode(n)}var oA=class n{constructor(A,j,e,l,c){this.mediaIds=A;this.sequenceNumber=j;this.timeStamp=e;this.isEndOfSpurt=l;this.payload=c}static parse(A){let j;try{j=nr(A)}catch{return D("not valid msgpack")}if(!Array.isArray(j))return D("container must be an array");if(j.length<6)return D("missing fields");if(j[0]!==1)return D("unknown type");if(!Array.isArray(j[1]))return D("media ids must be an array");if(!j[1].every(B=>typeof B=="number"))return D("media ids must be numbers");if(typeof j[2]!="number")return D("sequence number must be a number");if(typeof j[3]!="number")return D("timestamp must be a number");if(typeof j[4]!="number")return D("flags must be a number");let e=j[1],l=j[2]>>>0,c=j[3]>>>0,p=(j[4]&1)!==0,I=j[j.length-1];return I instanceof Uint8Array?lj(new n(e,l,c,p,I)):D("payload must be bytes")}toBytes(){let A=Number(this.isEndOfSpurt),j=[1,this.mediaIds,this.sequenceNumber>>>0,this.timeStamp>>>0,A,this.payload];return new Uint8Array(Ar(j,{forceFloat32:!0,ignoreUndefined:!0}))}};var OA=class{constructor(A,j){this.sampleRate=A;this.wasm=j;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 j.Encoder(A,15,!0,T.VadPreload),this.encoder.complexity=navigator.hardwareConcurrency>=4?6:4,this.information=qj(this.wasm),this.outBuffer=P(this.wasm,"u8",1270),yA(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:j})=>j.length>0)}close(){fj(this.wasm,this.information),V(this.wasm,this.outBuffer),this.encoder.delete()}encode(A){for(this.encoder.push(A.byteOffset,this.information.values.byteOffset);;){let j=this.encoder.pop(this.connections.length===0?0:this.outBuffer.byteOffset,this.outBuffer.length);if(j===0)break;if(j<0){uj(\`failed encoding packet: \${j}\`);return}if(this.timestamp=this.timestamp+1800>>0,j===1)continue;this.sequenceNumber=this.sequenceNumber+1>>0;let e=this.active&&!this.encoder.active;this.active=this.encoder.active,this.monitoring=this.connections.some(l=>l.id===0);for(let l of this.connections){if(this.monitoring&&l.id!==0)continue;let c=new oA(l.mediaIds,this.sequenceNumber,this.timestamp,e,this.outBuffer.subarray(0,j));S(globalThis,["sendPacket",{connectionId:l.id,packet:c.toBytes()}])}}}onMessage(A){let[j,e]=A;switch(j){case"captureSetVad":this?.setVad(e);break;case"captureSetMedias":this?.setMedias(e.connections);break;case"close":this.close();break;case"dump":e.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:vA(this.information),speechProbability:IA(this.information),rmsDBFS:_A(this.information),volume:rj(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}}}},JA=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=P(this.wasm,"u32",T.MaxNumberOfDecoders),this.information=dj(this.wasm,T.MaxNumberOfDecoders),hA(this.information,[1,1])}close(){Cj(this.wasm,this.information);for(let{decoder:A}of this.medias.values())A.delete()}receivePacket(A,j){this.stats.numberPackets++;let e=oA.parse(j);if(e.type==="Failure"){this.stats.numberPacketError++;let l=Array.from(j).map(c=>c.toString(16).padStart(2,"0")).join("");console.error(\`failed decoding audio packet; reason: \${e.reason}, connection: \${A}, dump: \${l}\`);return}for(let l of e.value.mediaIds){let c=this.medias.get(HA({connectionId:A,mediaId:l}));if(c===void 0){this.stats.numberPacketsMediaNotFound++;continue}c.lastPacket=j;let C=P(this.wasm,"u8",e.value.payload.length);C.set(e.value.payload),c.decoder.push(e.value.sequenceNumber,e.value.timeStamp,e.value.isEndOfSpurt,C.byteOffset,C.length)}}insertMedia(A,j,e,l=[1,1]){let c=HA({connectionId:j,mediaId:e}),C=new this.wasm.Decoder;this.medias.set(c,{index:A,decoder:C,lastPacket:void 0}),this.decoders[A]=C.$$.ptr,this.largestIndex=Math.max(this.largestIndex,A),FA(this.information,A,l),Aj(this.information,A,0),Zr(this.information,A,0)}removeMedia(A,j,e){let l=HA({connectionId:j,mediaId:e}),c=this.medias.get(l);if(!(c===void 0||c.index!==A)&&(this.medias.delete(l),Xr(this.information,A,0),this.decoders[A]=0,c.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[j,e]=A;switch(j){case"playbackReceivePacket":this.receivePacket(e.connectionId,e.packet);break;case"playbackUpdateMedias":for(let{index:l,connectionId:c,mediaId:C}of e.removed)this.removeMedia(l,c,C);for(let{index:l,connectionId:c,mediaId:C,volume:p}of e.added)this.insertMedia(l,c,C,p);break;case"close":this.close();break;case"dump":e.result.postMessage(this.dump());break}}dump(){let A=[];for(let[j,e]of this.medias){let l=cj(j);A.push({index:e.index,connectionId:l.connectionId,mediaId:l.mediaId,rmsDBFS:$A(this.information,e.index),volume:zr(this.information,e.index),voicedBlocks:Yr(this.information,e.index),silentBlocks:Wr(this.information,e.index),time:e.decoder.time,consecutive_silence:e.decoder.consecutive_silence,last_voiced_time_point:e.decoder.last_voiced_time_point,sequence_number:e.decoder.sequence_number,packetsSeen:e.decoder.packets_seen,packetsInvalid:e.decoder.packets_invalid,packetsTooLate:e.decoder.packets_too_late,packetsTooEarly:e.decoder.packets_too_early,packetsRepeated:e.decoder.packets_repeated,packetsProcessed:e.decoder.packets_processed,packetsLost:e.decoder.packets_lost,rewinds:e.decoder.rewinds,cacheLength:e.decoder.cache_length,lastPacket:jj(e.lastPacket)})}return{largestIndex:this.largestIndex,globalVolume:Qr(this.information),decoders:A}}};var gj=En(_j()),yj=(0,gj.default)(),Lj,Hj;globalThis.addEventListener("message",sr);async function sr(n){let A=n.data,[j,e]=A;switch(j){case"captureInit":e.workletPort.onmessage=sr,Lj=new lr(e.sampleRate,await yj,e.refreshRate);break;case"playbackInit":e.workletPort.onmessage=sr,Hj=new ir(await yj,e.workletPort,e.refreshRate);break;case"close":globalThis.close();break}Lj?.onMessage(A),Hj?.onMessage(A)}var lr=class extends OA{constructor(j,e,l){super(j,e);this.sampleRate=j;this.inBuffer=P(this.wasm,"f32",j*.02),this.updateHandle=setInterval(()=>this.update(),l),S(globalThis,["captureReady",{}])}close(){super.close(),V(this.wasm,this.inBuffer),clearInterval(this.updateHandle)}onMessage(j){super.onMessage(j);let[e,l]=j;switch(e){case"captureSetVolume":this.setVolume(l.value);break;case"captureTick":this.tick(l.buffer);break}}setVolume(j){yA(this.information,j)}tick(j){this.inBuffer.set(j,0),this.encode(this.inBuffer)}update(){S(globalThis,["captureUpdate",{active:vA(this.information),rmsDBFs:_A(this.information),speechProbability:IA(this.information)}])}dump(){return{type:"unshared capture worker",sampleRate:this.sampleRate,...super.dump()}}},ir=class extends JA{constructor(j,e,l){super(j);this.workletPort=e;this.id=T.PlaybackPreload,this.outBuffer=P(this.wasm,"f32",48e3*.02*2),this.updateHandle=setInterval(()=>this.update(),l),S(globalThis,["playbackReady",{}])}close(){super.close(),V(this.wasm,this.outBuffer),clearInterval(this.updateHandle)}onMessage(j){super.onMessage(j);let[e,l]=j;switch(e){case"playbackSetVolume":this.setVolume(l.index,l.value);break;case"playbackTick":this.tick();break}}setVolume(j,e){j==="global"?hA(this.information,e):FA(this.information,j,e)}tick(){this.stats.numberTicks++,this.id+=1;let{hasAudio:j}=this.decode(this.outBuffer);if(j){let e=this.outBuffer.slice();S(this.workletPort,["samples",{id:this.id,buffer:e}],[e.buffer])}}update(){let j=new Float32Array(this.information.length*2);for(let l=0;l<=this.largestIndex;l++)j[l]=$A(this.information,l);let e=[];for(let[l,c]of this.medias)e[c.index]={packetsBuffered:c.decoder.cache_length,packetsSeen:c.decoder.packets_seen,packetsProcessed:c.decoder.packets_processed,packetsTooEarly:c.decoder.packets_too_early,packetsTooLate:c.decoder.packets_too_late,packetsDropped:0,packetsInvalid:c.decoder.packets_invalid,packetsRepeated:c.decoder.packets_repeated,packetsLost:c.decoder.packets_lost};S(globalThis,["playbackUpdate",{activities:j,jitterStats:e}],[j.buffer])}dump(){return{type:"unshared playback worker",id:this.id,...super.dump()}}};})();
|
|
3346
|
-
`;var
|
|
3345
|
+
\`,new Function(F,E)}function KA(t,r,s,i,o,k){var a=r.length;a<2&&G("argTypes array size mismatch! Must at least get return value and receiver (this) types!");var u=r[1]!==null&&s!==null,d=_r(r),f=Lr(r),q=f&&!k&&!d;f&&!q&&(d=!0);var E=!r[0].isVoid,v=r[0],F=r[1],h=[t,G,i,o,yr,v.fromWireType.bind(v),F?.toWireType.bind(F)];q&&h.push(Qj,Vj);for(var m=2;m<a;++m){var N=r[m];h.push(N.toWireType.bind(N))}if(!d)for(var m=u?1:2;m<r.length;++m)r[m].destructorFunction!==null&&h.push(r[m].destructorFunction);var K=Ft(r,u,E,k)(...h);return Er(t,K)}var vt=(t,r,s,i,o,k)=>{var a=MA(r,s);o=O(i,o),w([],[t],u=>{u=u[0];var d=\`constructor \${u.name}\`;if(u.registeredClass.constructor_body===void 0&&(u.registeredClass.constructor_body=[]),u.registeredClass.constructor_body[r-1]!==void 0)throw new AA(\`Cannot register multiple constructors with identical number of parameters (\${r-1}) for class '\${u.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!\`);return u.registeredClass.constructor_body[r-1]=()=>{z(\`Cannot construct \${u.name} due to unbound types\`,a)},w([],a,f=>(f.splice(1,0,null),u.registeredClass.constructor_body[r-1]=KA(d,f,null,o,k),[])),[]})},Hr=t=>{t=t.trim();let r=t.indexOf("(");return r===-1?t:t.slice(0,r)},It=(t,r,s,i,o,k,a,u,d,f)=>{var q=MA(s,i);r=y(r),r=Hr(r),k=O(o,k,d),w([],[t],E=>{E=E[0];var v=\`\${E.name}.\${r}\`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),u&&E.registeredClass.pureVirtualFunctions.push(r);function F(){z(\`Cannot call \${v} due to unbound types\`,q)}var h=E.registeredClass.instancePrototype,m=h[r];return m===void 0||m.overloadTable===void 0&&m.className!==E.name&&m.argCount===s-2?(F.argCount=s-2,F.className=E.name,h[r]=F):(hr(h,r,v),h[r].overloadTable[s-2]=F),w([],q,N=>{var L=KA(v,N,E,k,a,d);return h[r].overloadTable===void 0?(L.argCount=s-2,h[r]=L):h[r].overloadTable[s-2]=L,[]}),[]})},gr=(t,r,s)=>(t instanceof Object||G(\`\${s} with invalid "this": \${t}\`),t instanceof r.registeredClass.constructor||G(\`\${s} incompatible with "this" of type \${t.constructor.name}\`),t.$$.ptr||G(\`cannot call emscripten binding method \${s} on deleted object\`),fA(t.$$.ptr,t.$$.ptrType.registeredClass,r.registeredClass)),yt=(t,r,s,i,o,k,a,u,d,f)=>{r=y(r),o=O(i,o),w([],[t],q=>{q=q[0];var E=\`\${q.name}.\${r}\`,v={get(){z(\`Cannot access \${E} due to unbound types\`,[s,a])},enumerable:!0,configurable:!0};return d?v.set=()=>z(\`Cannot access \${E} due to unbound types\`,[s,a]):v.set=F=>G(E+" is a read-only property"),Object.defineProperty(q.registeredClass.instancePrototype,r,v),w([],d?[s,a]:[s],F=>{var h=F[0],m={get(){var L=gr(this,q,E+" getter");return h.fromWireType(o(k,L))},enumerable:!0};if(d){d=O(u,d);var N=F[1];m.set=function(L){var K=gr(this,q,E+" setter"),H=[];d(f,K,N.toWireType(H,L)),yr(H)}}return Object.defineProperty(q.registeredClass.instancePrototype,r,m),[]}),[]})},Dr=[],M=[0,1,,1,null,1,!0,1,!1,1],_t=t=>{if(t>9&&--M[t+1]===0){var r=M[t];M[t]=void 0,Dr.push(t)}},RA={toValue:t=>(t||G(\`Cannot use deleted val. handle = \${t}\`),M[t]),toHandle:t=>{switch(t){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let r=Dr.pop()||M.length;return M[r]=t,M[r+1]=1,r}}}},Lt={name:"emscripten::val",fromWireType:t=>{var r=RA.toValue(t);return _t(t),r},toWireType:(t,r)=>RA.toHandle(r),readValueFromPointer:GA,destructorFunction:null},Ht=t=>x(t,Lt),Br,xr,gt=(t,r)=>{switch(r){case 4:return function(s){return this.fromWireType(Br[s>>2])};case 8:return function(s){return this.fromWireType(xr[s>>3])};default:throw new TypeError(\`invalid float width (\${r}): \${t}\`)}},Dt=(t,r,s)=>{r=y(r),x(t,{name:r,fromWireType:i=>i,toWireType:(i,o)=>o,readValueFromPointer:gt(r,s),destructorFunction:null})},Bt=(t,r,s,i,o,k,a,u)=>{var d=MA(r,s);t=y(t),t=Hr(t),o=O(i,o,a),$r(t,function(){z(\`Cannot call \${t} due to unbound types\`,d)},r-1),w([],d,f=>{var q=[f[0],null].concat(f.slice(1));return vr(t,KA(t,q,null,o,k,a),r-1),[]})},xt=(t,r,s,i,o)=>{r=y(r);let k=i===0,a=d=>d;if(k){var u=32-8*s;a=d=>d<<u>>>u,o=a(o)}x(t,{name:r,fromWireType:a,toWireType:(d,f)=>f,readValueFromPointer:qr(r,s,i!==0),destructorFunction:null})},Nt=(t,r,s)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],o=i[r];function k(a){var u=$[a>>2],d=$[a+4>>2];return new o(U.buffer,d,u)}s=y(s),x(t,{name:s,fromWireType:k,readValueFromPointer:k},{ignoreDuplicateRegistrations:!0})},bt=(t,r,s,i)=>{if(!(i>0))return 0;for(var o=s,k=s+i-1,a=0;a<t.length;++a){var u=t.codePointAt(a);if(u<=127){if(s>=k)break;r[s++]=u}else if(u<=2047){if(s+1>=k)break;r[s++]=192|u>>6,r[s++]=128|u&63}else if(u<=65535){if(s+2>=k)break;r[s++]=224|u>>12,r[s++]=128|u>>6&63,r[s++]=128|u&63}else{if(s+3>=k)break;r[s++]=240|u>>18,r[s++]=128|u>>12&63,r[s++]=128|u>>6&63,r[s++]=128|u&63,a++}}return r[s]=0,s-o},Ot=(t,r,s)=>bt(t,g,r,s),Jt=t=>{for(var r=0,s=0;s<t.length;++s){var i=t.charCodeAt(s);i<=127?r++:i<=2047?r+=2:i>=55296&&i<=57343?(r+=4,++s):r+=3}return r},Nr=globalThis.TextDecoder&&new TextDecoder,br=(t,r,s,i)=>{var o=r+s;if(i)return o;for(;t[r]&&!(r>=o);)++r;return r},Or=(t,r=0,s,i)=>{var o=br(t,r,s,i);if(o-r>16&&t.buffer&&Nr)return Nr.decode(t.subarray(r,o));for(var k="";r<o;){var a=t[r++];if(!(a&128)){k+=String.fromCharCode(a);continue}var u=t[r++]&63;if((a&224)==192){k+=String.fromCharCode((a&31)<<6|u);continue}var d=t[r++]&63;if((a&240)==224?a=(a&15)<<12|u<<6|d:a=(a&7)<<18|u<<12|d<<6|t[r++]&63,a<65536)k+=String.fromCharCode(a);else{var f=a-65536;k+=String.fromCharCode(55296|f>>10,56320|f&1023)}}return k},Pt=(t,r,s)=>t?Or(g,t,r,s):"",wt=(t,r)=>{r=y(r);var s=!0;x(t,{name:r,fromWireType(i){var o=$[i>>2],k=i+4,a;if(s)a=Pt(k,o,!0);else{a="";for(var u=0;u<o;++u)a+=String.fromCharCode(g[k+u])}return J(i),a},toWireType(i,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var k,a=typeof o=="string";a||ArrayBuffer.isView(o)&&o.BYTES_PER_ELEMENT==1||G("Cannot pass non-string to std::string"),s&&a?k=Jt(o):k=o.length;var u=VA(4+k+1),d=u+4;if($[u>>2]=k,a)if(s)Ot(o,d,k+1);else for(var f=0;f<k;++f){var q=o.charCodeAt(f);q>255&&(J(u),G("String has UTF-16 code units that do not fit in 8 bits")),g[d+f]=q}else g.set(o,d);return i!==null&&i.push(J,u),u},readValueFromPointer:GA,destructorFunction(i){J(i)}})},Jr=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Tt=(t,r,s)=>{var i=t>>1,o=br(rA,i,r/2,s);if(o-i>16&&Jr)return Jr.decode(rA.subarray(i,o));for(var k="",a=i;a<o;++a){var u=rA[a];k+=String.fromCharCode(u)}return k},St=(t,r,s=2147483647)=>{if(s<2)return 0;s-=2;for(var i=r,o=s<t.length*2?s/2:t.length,k=0;k<o;++k){var a=t.charCodeAt(k);cA[r>>1]=a,r+=2}return cA[r>>1]=0,r-i},Ut=t=>t.length*2,Mt=(t,r,s)=>{for(var i="",o=t>>2,k=0;!(k>=r/4);k++){var a=$[o+k];if(!a&&!s)break;i+=String.fromCodePoint(a)}return i},Kt=(t,r,s=2147483647)=>{if(s<4)return 0;for(var i=r,o=i+s-4,k=0;k<t.length;++k){var a=t.codePointAt(k);if(a>65535&&k++,dA[r>>2]=a,r+=4,r+4>o)break}return dA[r>>2]=0,r-i},Rt=t=>{for(var r=0,s=0;s<t.length;++s){var i=t.codePointAt(s);i>65535&&s++,r+=4}return r},Vt=(t,r,s)=>{s=y(s);var i,o,k;r===2?(i=Tt,o=St,k=Ut):(i=Mt,o=Kt,k=Rt),x(t,{name:s,fromWireType:a=>{var u=$[a>>2],d=i(a+4,u*r,!0);return J(a),d},toWireType:(a,u)=>{typeof u!="string"&&G(\`Cannot pass non-string to C++ string type \${s}\`);var d=k(u),f=VA(4+d+r);return $[f>>2]=d/r,o(u,f+4,d+r),a!==null&&a.push(J,f),f},readValueFromPointer:GA,destructorFunction(a){J(a)}})},Qt=(t,r)=>{r=y(r),x(t,{isVoid:!0,name:r,fromWireType:()=>{},toWireType:(s,i)=>{}})},Xt=t=>{kA("OOM")},Wt=t=>{var r=g.length;t>>>=0,Xt(t)},zt=t=>52,Zt=9007199254740992,Yt=-9007199254740992,An=t=>t<Yt||t>Zt?NaN:Number(t);function rn(t,r,s,i){return r=An(r),70}var jn=[null,[],[]],tn=(t,r)=>{var s=jn[t];!r||r===10?((t===1?b:aA)(Or(s)),s.length=0):s.push(r)},nn=(t,r,s,i)=>{for(var o=0,k=0;k<s;k++){var a=$[r>>2],u=$[r+4>>2];r+=8;for(var d=0;d<u;d++)tn(t,g[a+d]);o+=u}return $[i>>2]=o,0};st(),pt();{j.noExitRuntime&&(Rj=j.noExitRuntime),j.print&&(b=j.print),j.printErr&&(aA=j.printErr),j.arguments&&(C=j.arguments),j.thisProgram&&(p=j.thisProgram);var Z=j.preInit;if(Z)for(typeof Z=="function"&&(j.preInit=Z=[Z]);Z.length>0;)Z.shift()()}var Pr,VA,J,wr,Tr,en,sn,Sr,Ur;function ln(t){Pr=t.w,VA=j._malloc=t.y,J=j._free=t.z,wr=t.A,Tr=t.B,en=Sr=t.u,sn=Ur=t.x}var on={i:Zj,r:Yj,g:rt,l:jt,k:$t,j:vt,d:It,a:yt,s:Ht,f:Dt,n:Bt,c:xt,b:Nt,t:wt,e:Vt,m:Qt,o:Wt,q:zt,p:rn,h:nn};async function an(){Oj();var t=j.setStatus;t&&(t("Running..."),await new Promise(r=>setTimeout(r,1)),setTimeout(t,1,"")),!or&&(Jj(),j.onRuntimeInitialized?.(),Pj())}var tA;return tA=await Kj(),await an(),j}})();typeof Ij=="object"&&typeof PA=="object"?(PA.exports=er,PA.exports.default=er):typeof define=="function"&&define.amd&&define([],()=>er)});var T={};Gn(T,{AdditionalCaptureBlocks:()=>hn,AdditionalPlaybackBlocks:()=>mn,ClockJumpCheckInterval:()=>Ln,ClockJumpThreshold:()=>Hn,ConnectInterval:()=>Tn,ConnectTimeout:()=>Jn,DefaultRefreshRate:()=>Fn,DefaultVideoCodec:()=>Un,HealthCheckTimeout:()=>_n,MainConnectionPingInterval:()=>gn,MaxNumberOfDecoders:()=>In,MaxReconnectDuration:()=>Sn,MinDBFs:()=>Vr,MinTokenLifetime:()=>Pn,MinTokenRefreshInterval:()=>wn,PlaybackPreload:()=>$n,RenderQuantumSize:()=>yn,VadPreload:()=>vn,WebRtcAnswerTimeout:()=>Nn,WebRtcIceTimeout:()=>Bn,WebRtcMaxNegotiationAttempts:()=>bn,WebRtcRecoveryDelays:()=>On,WebRtcStatsSnapshotInterval:()=>Dn,WebRtcTimeout:()=>xn});var mn=3,hn=3,$n=3,Fn=250,vn=3,In=512,yn=128,Vr=-758.596,_n=1e4,Ln=1e3,Hn=1e4,gn=3e3,Dn=1e3,Bn=3e3,xn=1e4,Nn=1e4,bn=3,On=[0,2e3,5e3],Jn=5e3,Pn=6e4,wn=5e3,Tn=[0,100,200,200,500],Sn=12e4,Un="H264";function S(n,A,j){return n.postMessage(A,j)}function Qr(n){return[n.values[0],n.values[1]]}function hA(n,A){n.values[0]=A[0],n.values[1]=A[1]}function $A(n,A){return n.values[2+A*5]}function Xr(n,A,j){n.values[2+A*5]=j}function Wr(n,A){let j=2+A*5+1;return[n.values[j+0],n.values[j+1]]}function FA(n,A,j){let e=2+A*5+1;n.values[e+0]=j[0],n.values[e+1]=j[1]}function zr(n,A){return n.values[2+A*5+3]}function Zr(n,A,j){n.values[2+A*5+3]=j}function Yr(n,A){return n.values[2+A*5+4]}function Aj(n,A,j){n.values[2+A*5+4]=j}function vA(n){return n.values[0]!==0}function IA(n){return n.values[1]}function yA(n){return n.values[2]}function rj(n){return n.values[3]}function _A(n,A){return n.values[3]=A}function jj(n){return n?Array.from(n).map(A=>A.toString(16).padStart(2,"0")).join(""):null}var Mn;(n=>{let A;(j=>(j[j.InvalidPassword=-1]="InvalidPassword",j[j.Unknown=0]="Unknown",j[j.Unencrypted=1]="Unencrypted",j[j.Encrypted=2]="Encrypted"))(A=n.PeerCipherStatus||={})})(Mn||={});function lj(n){return{type:"Success",value:n}}function D(n){return{type:"Failure",reason:n}}var{Deno:tj}=globalThis,Kn=typeof tj?.noColor=="boolean"?tj.noColor:!1,Rn=!Kn;function zA(n,A){return{open:\`\\x1B[\${n.join(";")}m\`,close:\`\\x1B[\${A}m\`,regexp:new RegExp(\`\\\\x1b\\\\[\${A}m\`,"g")}}function ZA(n,A){return Rn?\`\${A.open}\${n.replace(A.regexp,A.open)}\${A.close}\`:n}function WA(n){return ZA(n,zA([0],0))}function nj(n){return ZA(n,zA([1],22))}function Vn(n){return ZA(n,zA([2],22))}var Se=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"),Qn=new Date,LA=(n=>(n[n.CRITICAL=0]="CRITICAL",n[n.ERROR=1]="ERROR",n[n.WARN=2]="WARN",n[n.INFO=3]="INFO",n[n.DEBUG=4]="DEBUG",n))(LA||{}),ij={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},Xn={4:Vn,3:WA,2:WA,1:nj,0:nj};function Wn({message:n}){return String(n)}function ej(n){return JSON.stringify({timestamp:n.date.toISOString(),level:LA[n.level],message:n.message,extra:n.extra})}function sj(n){function A(C,p){return[Math.floor(C/p),C%p]}function j(){let C,p=n.date.valueOf()-Qn.valueOf();[p,C]=A(p,1e3);let[I,B]=A(p,60);return\`\${I.toString().padStart(4,"0")}:\${B.toString().padStart(2,"0")}.\${C.toString().padStart(3,"0")}\`}function e(){return n.extra===void 0?"":typeof Deno=="object"?" "+Deno.inspect(n.extra,{compact:!1,colors:!0,trailingComma:!0}).trimStart():" "+JSON.stringify(n.extra)}let l=ij[n.level],c=n.logger.name!==void 0?\`@\${n.logger.name}\`:"";return\`\${WA(j())}\${c} \${l} \${Xn[n.level](String(n.message))}\${e()}\`}function zn(n){let A=\`[\${n.date.toISOString()}]\`,j=\`[\${LA[n.level]}]\`,e=n.logger.name!==void 0?\`[\${n.logger.name}] \`:"",l=ij[n.level];return\`\${A} \${l} \${j.padEnd(7," ")} \${e}\${n.message}\`}function Zn(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var oj=class{static sparse=Wn;static json=ej;static pretty=sj;static structured=zn;static default=Zn()?sj:ej;constructor(){}};var Yn=class{formatter;consoleObject;filter;constructor(n=oj.default,A=4,j=console){this.filter=A,this.formatter=n,this.consoleObject=j}handle(n){let A=this.formatter(n);switch(n.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 R=class{#A;sinks;filter;parent;get name(){return this.#A}constructor(n,A=void 0,j=[],e=void 0){this.#A=A,this.sinks=j,this.filter=n,this.parent=e}log(n,A,j=void 0){let e={date:new Date,level:n,logger:this,message:A,extra:j};this.filter<n||this.insert(e)}insert(n){if(!(this.filter<n.level)){for(let A of this.sinks)A.filter>=n.level&&A.handle(n);this.parent!==void 0&&this.parent.insert(n)}}error=this.log.bind(this,1);warn=this.log.bind(this,2);info=this.log.bind(this,3);debug=this.log.bind(this,4)},nA=globalThis[Symbol.for("odin-global-logger")]??=new R(3,void 0,[new Yn]),Ae=R.prototype.log.bind(nA,1),re=R.prototype.log.bind(nA,2),aj=R.prototype.log.bind(nA,3),je=R.prototype.log.bind(nA,4),Ue=R.prototype.log.bind(nA);var kj;function uj(n,...A){let j=te(A);kj?kj?.info(n,j):aj(n,j)}function te(...n){if(n.length===1&&typeof n[0]=="object"&&n[0]!==null)return{...n[0]};if(n.length>0)return{args:n}}function HA(n){return n.connectionId*4294967296+n.mediaId}function cj(n){return{mediaId:n%4294967296,connectionId:Math.floor(n/4294967296)}}function P(n,A,j){let e;switch(A){case"f32":e=n.HEAPF32;break;case"u32":e=n.HEAPU32;break;case"i32":e=n.HEAP32;break;case"u8":e=n.HEAPU8;break;default:throw new Error(\`allocating \${A} is not supported\`)}let l=n._malloc(j*e.BYTES_PER_ELEMENT);if(l===0||l%e.BYTES_PER_ELEMENT!==0)throw new Error(\`failed allocating a \${j} \${A} array\`);let c=l/e.BYTES_PER_ELEMENT;return e.subarray(c,c+j)}function V(n,A){n._free(A.byteOffset)}function dj(n,A){return{values:P(n,"f32",2+A*5),length:A}}function Cj(n,A){V(n,A.values)}function qj(n){return{values:P(n,"f32",4)}}function fj(n,A){V(n,A.values)}function Gj(n){let A=n.length,j=0,e=0;for(;e<A;){let l=n.charCodeAt(e++);if((l&4294967168)===0){j++;continue}else if((l&4294965248)===0)j+=2;else{if(l>=55296&&l<=56319&&e<A){let c=n.charCodeAt(e);(c&64512)===56320&&(++e,l=((l&1023)<<10)+(c&1023)+65536)}(l&4294901760)===0?j+=3:j+=4}}return j}function ne(n,A,j){let e=n.length,l=j,c=0;for(;c<e;){let C=n.charCodeAt(c++);if((C&4294967168)===0){A[l++]=C;continue}else if((C&4294965248)===0)A[l++]=C>>6&31|192;else{if(C>=55296&&C<=56319&&c<e){let p=n.charCodeAt(c);(p&64512)===56320&&(++c,C=((C&1023)<<10)+(p&1023)+65536)}(C&4294901760)===0?(A[l++]=C>>12&15|224,A[l++]=C>>6&63|128):(A[l++]=C>>18&7|240,A[l++]=C>>12&63|128,A[l++]=C>>6&63|128)}A[l++]=C&63|128}}var ee=new TextEncoder,se=50;function le(n,A,j){ee.encodeInto(n,A.subarray(j))}function pj(n,A,j){n.length>se?le(n,A,j):ne(n,A,j)}var ie=4096;function YA(n,A,j){let e=A,l=e+j,c=[],C="";for(;e<l;){let p=n[e++];if((p&128)===0)c.push(p);else if((p&224)===192){let I=n[e++]&63;c.push((p&31)<<6|I)}else if((p&240)===224){let I=n[e++]&63,B=n[e++]&63;c.push((p&31)<<12|I<<6|B)}else if((p&248)===240){let I=n[e++]&63,B=n[e++]&63,wA=n[e++]&63,b=(p&7)<<18|I<<12|B<<6|wA;b>65535&&(b-=65536,c.push(b>>>10&1023|55296),b=56320|b&1023),c.push(b)}else c.push(p);c.length>=ie&&(C+=String.fromCharCode(...c),c.length=0)}return c.length>0&&(C+=String.fromCharCode(...c)),C}var oe=new TextDecoder,ae=200;function ke(n,A,j){let e=n.subarray(A,A+j);return oe.decode(e)}function Ej(n,A,j){return j>ae?ke(n,A,j):YA(n,A,j)}var Q=class{type;data;constructor(A,j){this.type=A,this.data=j}};var _=class n extends Error{constructor(A){super(A);let j=Object.create(n.prototype);Object.setPrototypeOf(this,j),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:n.name})}};function mj(n,A,j){let e=j/4294967296,l=j;n.setUint32(A,e),n.setUint32(A+4,l)}function gA(n,A,j){let e=Math.floor(j/4294967296),l=j;n.setUint32(A,e),n.setUint32(A+4,l)}function DA(n,A){let j=n.getInt32(A),e=n.getUint32(A+4);return j*4294967296+e}function hj(n,A){let j=n.getUint32(A),e=n.getUint32(A+4);return j*4294967296+e}var ue=-1,ce=4294967296-1,de=17179869184-1;function Ce({sec:n,nsec:A}){if(n>=0&&A>=0&&n<=de)if(A===0&&n<=ce){let j=new Uint8Array(4);return new DataView(j.buffer).setUint32(0,n),j}else{let j=n/4294967296,e=n&4294967295,l=new Uint8Array(8),c=new DataView(l.buffer);return c.setUint32(0,A<<2|j&3),c.setUint32(4,e),l}else{let j=new Uint8Array(12),e=new DataView(j.buffer);return e.setUint32(0,A),gA(e,4,n),j}}function qe(n){let A=n.getTime(),j=Math.floor(A/1e3),e=(A-j*1e3)*1e6,l=Math.floor(e/1e9);return{sec:j+l,nsec:e-l*1e9}}function fe(n){if(n instanceof Date){let A=qe(n);return Ce(A)}else return null}function Ge(n){let A=new DataView(n.buffer,n.byteOffset,n.byteLength);switch(n.byteLength){case 4:return{sec:A.getUint32(0),nsec:0};case 8:{let j=A.getUint32(0),e=A.getUint32(4),l=(j&3)*4294967296+e,c=j>>>2;return{sec:l,nsec:c}}case 12:{let j=DA(A,4),e=A.getUint32(0);return{sec:j,nsec:e}}default:throw new _(\`Unrecognized data size for timestamp (expected 4, 8, or 12): \${n.length}\`)}}function pe(n){let A=Ge(n);return new Date(A.sec*1e3+A.nsec/1e6)}var $j={type:ue,encode:fe,decode:pe};var Y=class n{static defaultCodec=new n;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register($j)}register({type:A,encode:j,decode:e}){if(A>=0)this.encoders[A]=j,this.decoders[A]=e;else{let l=-1-A;this.builtInEncoders[l]=j,this.builtInDecoders[l]=e}}tryToEncode(A,j){for(let e=0;e<this.builtInEncoders.length;e++){let l=this.builtInEncoders[e];if(l!=null){let c=l(A,j);if(c!=null){let C=-1-e;return new Q(C,c)}}}for(let e=0;e<this.encoders.length;e++){let l=this.encoders[e];if(l!=null){let c=l(A,j);if(c!=null){let C=e;return new Q(C,c)}}}return A instanceof Q?A:null}decode(A,j,e){let l=j<0?this.builtInDecoders[-1-j]:this.decoders[j];return l?l(A,j,e):new Q(j,A)}};function Ee(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}function eA(n){return n instanceof Uint8Array?n:ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):Ee(n)?new Uint8Array(n):Uint8Array.from(n)}var me=100,he=2048,BA=class n{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(A){this.extensionCodec=A?.extensionCodec??Y.defaultCodec,this.context=A?.context,this.useBigInt64=A?.useBigInt64??!1,this.maxDepth=A?.maxDepth??me,this.initialBufferSize=A?.initialBufferSize??he,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 n({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,j){if(j>this.maxDepth)throw new Error(\`Too deep objects in depth \${j}\`);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,j)}ensureBufferSizeToWrite(A){let j=this.pos+A;this.view.byteLength<j&&this.resizeBuffer(j*2)}resizeBuffer(A){let j=new ArrayBuffer(A),e=new Uint8Array(j),l=new DataView(j);e.set(this.bytes),this.view=l,this.bytes=e}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 e=Gj(A);this.ensureBufferSizeToWrite(5+e),this.writeStringHeader(e),pj(A,this.bytes,this.pos),this.pos+=e}encodeObject(A,j){let e=this.extensionCodec.tryToEncode(A,this.context);if(e!=null)this.encodeExtension(e);else if(Array.isArray(A))this.encodeArray(A,j);else if(ArrayBuffer.isView(A))this.encodeBinary(A);else if(typeof A=="object")this.encodeMap(A,j);else throw new Error(\`Unrecognized object: \${Object.prototype.toString.apply(A)}\`)}encodeBinary(A){let j=A.byteLength;if(j<256)this.writeU8(196),this.writeU8(j);else if(j<65536)this.writeU8(197),this.writeU16(j);else if(j<4294967296)this.writeU8(198),this.writeU32(j);else throw new Error(\`Too large binary: \${j}\`);let e=eA(A);this.writeU8a(e)}encodeArray(A,j){let e=A.length;if(e<16)this.writeU8(144+e);else if(e<65536)this.writeU8(220),this.writeU16(e);else if(e<4294967296)this.writeU8(221),this.writeU32(e);else throw new Error(\`Too large array: \${e}\`);for(let l of A)this.doEncode(l,j+1)}countWithoutUndefined(A,j){let e=0;for(let l of j)A[l]!==void 0&&e++;return e}encodeMap(A,j){let e=Object.keys(A);this.sortKeys&&e.sort();let l=this.ignoreUndefined?this.countWithoutUndefined(A,e):e.length;if(l<16)this.writeU8(128+l);else if(l<65536)this.writeU8(222),this.writeU16(l);else if(l<4294967296)this.writeU8(223),this.writeU32(l);else throw new Error(\`Too large map object: \${l}\`);for(let c of e){let C=A[c];this.ignoreUndefined&&C===void 0||(this.encodeString(c),this.doEncode(C,j+1))}}encodeExtension(A){if(typeof A.data=="function"){let e=A.data(this.pos+6),l=e.length;if(l>=4294967296)throw new Error(\`Too large extension object: \${l}\`);this.writeU8(201),this.writeU32(l),this.writeI8(A.type),this.writeU8a(e);return}let j=A.data.length;if(j===1)this.writeU8(212);else if(j===2)this.writeU8(213);else if(j===4)this.writeU8(214);else if(j===8)this.writeU8(215);else if(j===16)this.writeU8(216);else if(j<256)this.writeU8(199),this.writeU8(j);else if(j<65536)this.writeU8(200),this.writeU16(j);else if(j<4294967296)this.writeU8(201),this.writeU32(j);else throw new Error(\`Too large extension object: \${j}\`);this.writeI8(A.type),this.writeU8a(A.data)}writeU8(A){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,A),this.pos++}writeU8a(A){let j=A.length;this.ensureBufferSizeToWrite(j),this.bytes.set(A,this.pos),this.pos+=j}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),mj(this.view,this.pos,A),this.pos+=8}writeI64(A){this.ensureBufferSizeToWrite(8),gA(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 Ar(n,A){return new BA(A).encodeSharedRef(n)}function xA(n){return\`\${n<0?"-":""}0x\${Math.abs(n).toString(16).padStart(2,"0")}\`}var $e=16,Fe=16,NA=class{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(A=$e,j=Fe){this.maxKeyLength=A,this.maxLengthPerKey=j,this.caches=[];for(let e=0;e<this.maxKeyLength;e++)this.caches.push([])}canBeCached(A){return A>0&&A<=this.maxKeyLength}find(A,j,e){let l=this.caches[e-1];A:for(let c of l){let C=c.bytes;for(let p=0;p<e;p++)if(C[p]!==A[j+p])continue A;return c.str}return null}store(A,j){let e=this.caches[A.length-1],l={bytes:A,str:j};e.length>=this.maxLengthPerKey?e[Math.random()*e.length|0]=l:e.push(l)}decode(A,j,e){let l=this.find(A,j,e);if(l!=null)return this.hit++,l;this.miss++;let c=YA(A,j,e),C=Uint8Array.prototype.slice.call(A,j,j+e);return this.store(C,c),c}};var rr="array",iA="map_key",vj="map_value",ve=n=>{if(typeof n=="string"||typeof n=="number")return n;throw new _("The type of key must be string or number but "+typeof n)},jr=class{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(A){let j=this.getUninitializedStateFromPool();j.type=rr,j.position=0,j.size=A,j.array=new Array(A)}pushMapState(A){let j=this.getUninitializedStateFromPool();j.type=iA,j.readCount=0,j.size=A,j.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===rr){let e=A;e.size=0,e.array=void 0,e.position=0,e.type=void 0}if(A.type===iA||A.type===vj){let e=A;e.size=0,e.map=void 0,e.readCount=0,e.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},lA=-1,tr=new DataView(new ArrayBuffer(0)),Ie=new Uint8Array(tr.buffer);try{tr.getInt8(0)}catch(n){if(!(n 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 Fj=new RangeError("Insufficient data"),ye=new NA,bA=class n{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=tr;bytes=Ie;headByte=lA;stack=new jr;entered=!1;constructor(A){this.extensionCodec=A?.extensionCodec??Y.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:ye,this.mapKeyConverter=A?.mapKeyConverter??ve}clone(){return new n({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=lA,this.stack.reset()}setBuffer(A){let j=eA(A);this.bytes=j,this.view=new DataView(j.buffer,j.byteOffset,j.byteLength),this.pos=0}appendBuffer(A){if(this.headByte===lA&&!this.hasRemaining(1))this.setBuffer(A);else{let j=this.bytes.subarray(this.pos),e=eA(A),l=new Uint8Array(j.length+e.length);l.set(j),l.set(e,j.length),this.setBuffer(l)}}hasRemaining(A){return this.view.byteLength-this.pos>=A}createExtraByteError(A){let{view:j,pos:e}=this;return new RangeError(\`Extra \${j.byteLength-e} of \${j.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 j=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return j}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 j=!1,e;for await(let p of A){if(j)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(p);try{e=this.doDecodeSync(),j=!0}catch(I){if(!(I instanceof RangeError))throw I}this.totalPos+=this.pos}if(j){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return e}let{headByte:l,pos:c,totalPos:C}=this;throw new RangeError(\`Insufficient data in parsing \${xA(l)} at \${C} (\${c} 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,j){if(this.entered){yield*this.clone().decodeMultiAsync(A,j);return}try{this.entered=!0;let e=j,l=-1;for await(let c of A){if(j&&l===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(c),e&&(l=this.readArraySize(),e=!1,this.complete());try{for(;yield this.doDecodeSync(),--l!==0;);}catch(C){if(!(C instanceof RangeError))throw C}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){A:for(;;){let A=this.readHeadByte(),j;if(A>=224)j=A-256;else if(A<192)if(A<128)j=A;else if(A<144){let l=A-128;if(l!==0){this.pushMapState(l),this.complete();continue A}else j={}}else if(A<160){let l=A-144;if(l!==0){this.pushArrayState(l),this.complete();continue A}else j=[]}else{let l=A-160;j=this.decodeString(l,0)}else if(A===192)j=null;else if(A===194)j=!1;else if(A===195)j=!0;else if(A===202)j=this.readF32();else if(A===203)j=this.readF64();else if(A===204)j=this.readU8();else if(A===205)j=this.readU16();else if(A===206)j=this.readU32();else if(A===207)this.useBigInt64?j=this.readU64AsBigInt():j=this.readU64();else if(A===208)j=this.readI8();else if(A===209)j=this.readI16();else if(A===210)j=this.readI32();else if(A===211)this.useBigInt64?j=this.readI64AsBigInt():j=this.readI64();else if(A===217){let l=this.lookU8();j=this.decodeString(l,1)}else if(A===218){let l=this.lookU16();j=this.decodeString(l,2)}else if(A===219){let l=this.lookU32();j=this.decodeString(l,4)}else if(A===220){let l=this.readU16();if(l!==0){this.pushArrayState(l),this.complete();continue A}else j=[]}else if(A===221){let l=this.readU32();if(l!==0){this.pushArrayState(l),this.complete();continue A}else j=[]}else if(A===222){let l=this.readU16();if(l!==0){this.pushMapState(l),this.complete();continue A}else j={}}else if(A===223){let l=this.readU32();if(l!==0){this.pushMapState(l),this.complete();continue A}else j={}}else if(A===196){let l=this.lookU8();j=this.decodeBinary(l,1)}else if(A===197){let l=this.lookU16();j=this.decodeBinary(l,2)}else if(A===198){let l=this.lookU32();j=this.decodeBinary(l,4)}else if(A===212)j=this.decodeExtension(1,0);else if(A===213)j=this.decodeExtension(2,0);else if(A===214)j=this.decodeExtension(4,0);else if(A===215)j=this.decodeExtension(8,0);else if(A===216)j=this.decodeExtension(16,0);else if(A===199){let l=this.lookU8();j=this.decodeExtension(l,1)}else if(A===200){let l=this.lookU16();j=this.decodeExtension(l,2)}else if(A===201){let l=this.lookU32();j=this.decodeExtension(l,4)}else throw new _(\`Unrecognized type byte: \${xA(A)}\`);this.complete();let e=this.stack;for(;e.length>0;){let l=e.top();if(l.type===rr)if(l.array[l.position]=j,l.position++,l.position===l.size)j=l.array,e.release(l);else continue A;else if(l.type===iA){if(j==="__proto__")throw new _("The key __proto__ is not allowed");l.key=this.mapKeyConverter(j),l.type=vj;continue A}else if(l.map[l.key]=j,l.readCount++,l.readCount===l.size)j=l.map,e.release(l);else{l.key=null,l.type=iA;continue A}}return j}}readHeadByte(){return this.headByte===lA&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=lA}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 _(\`Unrecognized array type byte: \${xA(A)}\`)}}}pushMapState(A){if(A>this.maxMapLength)throw new _(\`Max length exceeded: map length (\${A}) > maxMapLengthLength (\${this.maxMapLength})\`);this.stack.pushMapState(A)}pushArrayState(A){if(A>this.maxArrayLength)throw new _(\`Max length exceeded: array length (\${A}) > maxArrayLength (\${this.maxArrayLength})\`);this.stack.pushArrayState(A)}decodeString(A,j){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(A,j):this.decodeBinary(A,j)}decodeUtf8String(A,j){if(A>this.maxStrLength)throw new _(\`Max length exceeded: UTF-8 byte length (\${A}) > maxStrLength (\${this.maxStrLength})\`);if(this.bytes.byteLength<this.pos+j+A)throw Fj;let e=this.pos+j,l;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(A)?l=this.keyDecoder.decode(this.bytes,e,A):l=Ej(this.bytes,e,A),this.pos+=j+A,l}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===iA:!1}decodeBinary(A,j){if(A>this.maxBinLength)throw new _(\`Max length exceeded: bin length (\${A}) > maxBinLength (\${this.maxBinLength})\`);if(!this.hasRemaining(A+j))throw Fj;let e=this.pos+j,l=this.bytes.subarray(e,e+A);return this.pos+=j+A,l}decodeExtension(A,j){if(A>this.maxExtLength)throw new _(\`Max length exceeded: ext length (\${A}) > maxExtLength (\${this.maxExtLength})\`);let e=this.view.getInt8(this.pos+j),l=this.decodeBinary(A,j+1);return this.extensionCodec.decode(l,e,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=hj(this.view,this.pos);return this.pos+=8,A}readI64(){let A=DA(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 nr(n,A){return new bA(A).decode(n)}var oA=class n{constructor(A,j,e,l,c){this.mediaIds=A;this.sequenceNumber=j;this.timeStamp=e;this.isEndOfSpurt=l;this.payload=c}static parse(A){let j;try{j=nr(A)}catch{return D("not valid msgpack")}if(!Array.isArray(j))return D("container must be an array");if(j.length<6)return D("missing fields");if(j[0]!==1)return D("unknown type");if(!Array.isArray(j[1]))return D("media ids must be an array");if(!j[1].every(B=>typeof B=="number"))return D("media ids must be numbers");if(typeof j[2]!="number")return D("sequence number must be a number");if(typeof j[3]!="number")return D("timestamp must be a number");if(typeof j[4]!="number")return D("flags must be a number");let e=j[1],l=j[2]>>>0,c=j[3]>>>0,p=(j[4]&1)!==0,I=j[j.length-1];return I instanceof Uint8Array?lj(new n(e,l,c,p,I)):D("payload must be bytes")}toBytes(){let A=Number(this.isEndOfSpurt),j=[1,this.mediaIds,this.sequenceNumber>>>0,this.timeStamp>>>0,A,this.payload];return new Uint8Array(Ar(j,{forceFloat32:!0,ignoreUndefined:!0}))}};var OA=class{constructor(A,j){this.sampleRate=A;this.wasm=j;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 j.Encoder(A,15,!0,T.VadPreload),this.encoder.complexity=navigator.hardwareConcurrency>=4?6:4,this.information=qj(this.wasm),this.outBuffer=P(this.wasm,"u8",1270),_A(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:j})=>j.length>0)}close(){fj(this.wasm,this.information),V(this.wasm,this.outBuffer),this.encoder.delete()}encode(A){for(this.encoder.push(A.byteOffset,this.information.values.byteOffset);;){let j=this.encoder.pop(this.connections.length===0?0:this.outBuffer.byteOffset,this.outBuffer.length);if(j===0)break;if(j<0){uj(\`failed encoding packet: \${j}\`);return}if(this.timestamp=this.timestamp+1800>>0,j===1)continue;this.sequenceNumber=this.sequenceNumber+1>>0;let e=this.active&&!this.encoder.active;this.active=this.encoder.active,this.monitoring=this.connections.some(l=>l.id===0);for(let l of this.connections){if(this.monitoring&&l.id!==0)continue;let c=new oA(l.mediaIds,this.sequenceNumber,this.timestamp,e,this.outBuffer.subarray(0,j));S(globalThis,["sendPacket",{connectionId:l.id,packet:c.toBytes()}])}}}onMessage(A){let[j,e]=A;switch(j){case"captureSetVad":this?.setVad(e);break;case"captureSetMedias":this?.setMedias(e.connections);break;case"close":this.close();break;case"dump":e.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:vA(this.information),speechProbability:IA(this.information),rmsDBFS:yA(this.information),volume:rj(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}}}},JA=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=P(this.wasm,"u32",T.MaxNumberOfDecoders),this.information=dj(this.wasm,T.MaxNumberOfDecoders),hA(this.information,[1,1])}close(){Cj(this.wasm,this.information);for(let{decoder:A}of this.medias.values())A.delete()}receivePacket(A,j){this.stats.numberPackets++;let e=oA.parse(j);if(e.type==="Failure"){this.stats.numberPacketError++;let l=Array.from(j).map(c=>c.toString(16).padStart(2,"0")).join("");console.error(\`failed decoding audio packet; reason: \${e.reason}, connection: \${A}, dump: \${l}\`);return}for(let l of e.value.mediaIds){let c=this.medias.get(HA({connectionId:A,mediaId:l}));if(c===void 0){this.stats.numberPacketsMediaNotFound++;continue}c.lastPacket=j;let C=P(this.wasm,"u8",e.value.payload.length);C.set(e.value.payload),c.decoder.push(e.value.sequenceNumber,e.value.timeStamp,e.value.isEndOfSpurt,C.byteOffset,C.length)}}insertMedia(A,j,e,l=[1,1]){let c=HA({connectionId:j,mediaId:e}),C=new this.wasm.Decoder;this.medias.set(c,{index:A,decoder:C,lastPacket:void 0}),this.decoders[A]=C.$$.ptr,this.largestIndex=Math.max(this.largestIndex,A),FA(this.information,A,l),Aj(this.information,A,0),Zr(this.information,A,0)}removeMedia(A,j,e){let l=HA({connectionId:j,mediaId:e}),c=this.medias.get(l);if(!(c===void 0||c.index!==A)&&(this.medias.delete(l),Xr(this.information,A,0),this.decoders[A]=0,c.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[j,e]=A;switch(j){case"playbackReceivePacket":this.receivePacket(e.connectionId,e.packet);break;case"playbackUpdateMedias":for(let{index:l,connectionId:c,mediaId:C}of e.removed)this.removeMedia(l,c,C);for(let{index:l,connectionId:c,mediaId:C,volume:p}of e.added)this.insertMedia(l,c,C,p);break;case"close":this.close();break;case"dump":e.result.postMessage(this.dump());break}}dump(){let A=[];for(let[j,e]of this.medias){let l=cj(j);A.push({index:e.index,connectionId:l.connectionId,mediaId:l.mediaId,rmsDBFS:$A(this.information,e.index),volume:Wr(this.information,e.index),voicedBlocks:Yr(this.information,e.index),silentBlocks:zr(this.information,e.index),time:e.decoder.time,consecutive_silence:e.decoder.consecutive_silence,last_voiced_time_point:e.decoder.last_voiced_time_point,sequence_number:e.decoder.sequence_number,packetsSeen:e.decoder.packets_seen,packetsInvalid:e.decoder.packets_invalid,packetsTooLate:e.decoder.packets_too_late,packetsTooEarly:e.decoder.packets_too_early,packetsRepeated:e.decoder.packets_repeated,packetsProcessed:e.decoder.packets_processed,packetsLost:e.decoder.packets_lost,rewinds:e.decoder.rewinds,cacheLength:e.decoder.cache_length,lastPacket:jj(e.lastPacket)})}return{largestIndex:this.largestIndex,globalVolume:Qr(this.information),decoders:A}}};var gj=En(yj()),_j=(0,gj.default)(),Lj,Hj;globalThis.addEventListener("message",n=>{sr(n).catch(console.error)});async function sr(n){let A=n.data,[j,e]=A;switch(j){case"captureInit":e.workletPort.onmessage=sr,Lj=new lr(e.sampleRate,await _j,e.refreshRate);break;case"playbackInit":e.workletPort.onmessage=sr,Hj=new ir(await _j,e.workletPort,e.refreshRate);break;case"close":globalThis.close();break}Lj?.onMessage(A),Hj?.onMessage(A)}var lr=class extends OA{constructor(j,e,l){super(j,e);this.sampleRate=j;this.inBuffer=P(this.wasm,"f32",j*.02),this.updateHandle=setInterval(()=>this.update(),l),S(globalThis,["captureReady",{}])}close(){super.close(),V(this.wasm,this.inBuffer),clearInterval(this.updateHandle)}onMessage(j){super.onMessage(j);let[e,l]=j;switch(e){case"captureSetVolume":this.setVolume(l.value);break;case"captureTick":this.tick(l.buffer);break}}setVolume(j){_A(this.information,j)}tick(j){this.inBuffer.set(j,0),this.encode(this.inBuffer)}update(){S(globalThis,["captureUpdate",{active:vA(this.information),rmsDBFs:yA(this.information),speechProbability:IA(this.information)}])}dump(){return{type:"unshared capture worker",sampleRate:this.sampleRate,...super.dump()}}},ir=class extends JA{constructor(j,e,l){super(j);this.workletPort=e;this.id=T.PlaybackPreload,this.outBuffer=P(this.wasm,"f32",48e3*.02*2),this.updateHandle=setInterval(()=>this.update(),l),S(globalThis,["playbackReady",{}])}close(){super.close(),V(this.wasm,this.outBuffer),clearInterval(this.updateHandle)}onMessage(j){super.onMessage(j);let[e,l]=j;switch(e){case"playbackSetVolume":this.setVolume(l.index,l.value);break;case"playbackTick":this.tick();break}}setVolume(j,e){j==="global"?hA(this.information,e):FA(this.information,j,e)}tick(){this.stats.numberTicks++,this.id+=1;let{hasAudio:j}=this.decode(this.outBuffer);if(j){let e=this.outBuffer.slice();S(this.workletPort,["samples",{id:this.id,buffer:e}],[e.buffer])}}update(){let j=new Float32Array(this.information.length*2);for(let l=0;l<=this.largestIndex;l++)j[l]=$A(this.information,l);let e=[];for(let[l,c]of this.medias)e[c.index]={packetsBuffered:c.decoder.cache_length,packetsSeen:c.decoder.packets_seen,packetsProcessed:c.decoder.packets_processed,packetsTooEarly:c.decoder.packets_too_early,packetsTooLate:c.decoder.packets_too_late,packetsDropped:0,packetsInvalid:c.decoder.packets_invalid,packetsRepeated:c.decoder.packets_repeated,packetsLost:c.decoder.packets_lost};S(globalThis,["playbackUpdate",{activities:j,jitterStats:e}],[j.buffer])}dump(){return{type:"unshared playback worker",id:this.id,...super.dump()}}};})();
|
|
3346
|
+
`;var d='"use strict";(()=>{var P=Object.defineProperty;var M=(e,t)=>{for(var r in t)P(e,r,{get:t[r],enumerable:!0})};var u={};M(u,{AdditionalCaptureBlocks:()=>E,AdditionalPlaybackBlocks:()=>R,ClockJumpCheckInterval:()=>_,ClockJumpThreshold:()=>N,ConnectInterval:()=>Y,ConnectTimeout:()=>Z,DefaultRefreshRate:()=>D,DefaultVideoCodec:()=>X,HealthCheckTimeout:()=>O,MainConnectionPingInterval:()=>W,MaxNumberOfDecoders:()=>L,MaxReconnectDuration:()=>K,MinDBFs:()=>v,MinTokenLifetime:()=>q,MinTokenRefreshInterval:()=>Q,PlaybackPreload:()=>F,RenderQuantumSize:()=>V,VadPreload:()=>C,WebRtcAnswerTimeout:()=>H,WebRtcIceTimeout:()=>$,WebRtcMaxNegotiationAttempts:()=>J,WebRtcRecoveryDelays:()=>z,WebRtcStatsSnapshotInterval:()=>j,WebRtcTimeout:()=>G});var R=3,E=3,F=3,D=250,C=3,L=512,V=128,v=-758.596,O=1e4,_=1e3,N=1e4,W=3e3,j=1e3,$=3e3,G=1e4,H=1e4,J=3,z=[0,2e3,5e3],Z=5e3,q=6e4,Q=5e3,Y=[0,100,200,200,500],K=12e4,X="H264";function d(e,t,r){return e.postMessage(t,r)}var ee;(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||={})})(ee||={});var{Deno:k}=globalThis,te=typeof k?.noColor=="boolean"?k.noColor:!1,re=!te;function m(e,t){return{open:`\\x1B[${e.join(";")}m`,close:`\\x1B[${t}m`,regexp:new RegExp(`\\\\x1b\\\\[${t}m`,"g")}}function h(e,t){return re?`${t.open}${e.replace(t.regexp,t.open)}${t.close}`:e}function p(e){return h(e,m([0],0))}function U(e){return h(e,m([1],22))}function ne(e){return h(e,m([2],22))}var Te=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"),se=new Date,f=(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))(f||{}),T={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},oe={4:ne,3:p,2:p,1:U,0:U};function ae({message:e}){return String(e)}function S(e){return JSON.stringify({timestamp:e.date.toISOString(),level:f[e.level],message:e.message,extra:e.extra})}function I(e){function t(c,i){return[Math.floor(c/i),c%i]}function r(){let c,i=e.date.valueOf()-se.valueOf();[i,c]=t(i,1e3);let[B,A]=t(i,60);return`${B.toString().padStart(4,"0")}:${A.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=T[e.level],a=e.logger.name!==void 0?`@${e.logger.name}`:"";return`${p(r())}${a} ${s} ${oe[e.level](String(e.message))}${n()}`}function ie(e){let t=`[${e.date.toISOString()}]`,r=`[${f[e.level]}]`,n=e.logger.name!==void 0?`[${e.logger.name}] `:"",s=T[e.level];return`${t} ${s} ${r.padEnd(7," ")} ${n}${e.message}`}function ce(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var w=class{static sparse=ae;static json=S;static pretty=I;static structured=ie;static default=ce()?I:S;constructor(){}};var ue=class{formatter;consoleObject;filter;constructor(e=w.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)},l=globalThis[Symbol.for("odin-global-logger")]??=new o(3,void 0,[new ue]),le=o.prototype.log.bind(l,1),fe=o.prototype.log.bind(l,2),de=o.prototype.log.bind(l,3),pe=o.prototype.log.bind(l,4),we=o.prototype.log.bind(l);var b=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 y(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.state.flush(),this.state.fill(a,r[0][0])),this.alive}dump(){return{type:"unshared capture worklet",alive:this.alive,sampleRate,offset:this.state?.offset||null,length:this.state?.length||null,blocks:this.blocks}}},x=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 g(s.workerPort,sampleRate*.02),s.workerPort.onmessage=this.onMessage.bind(this);break;case"samples":this.state?.add(s.id,s.buffer);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<u.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:"unshared 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}}},y=class{constructor(t,r){this.port=t;this.length=r;this.offset=0,this.buffer=new Float32Array(r)}fill(t,r){let n=Math.min(r.length-t,this.length-this.offset);return this.buffer.set(r.subarray(t,t+n),this.offset),this.offset+=n,t+n}flush(){d(this.port,["captureTick",{buffer:this.buffer}],[this.buffer.buffer]),this.offset=0,this.buffer=new Float32Array(this.length)}},g=class{constructor(t,r){this.port=t;this.length=r;this.cache=[];this.id=-1,this.offset=0,this.buffer=void 0,this.next()}get hasVoice(){return this.buffer!==void 0}fill(t,r,n){let s=Math.min(u.RenderQuantumSize-t,this.length-this.offset);return this.buffer!==void 0&&(r.set(this.buffer.subarray(this.offset,this.offset+s),t),n.set(this.buffer.subarray(this.offset+this.length,this.offset+this.length+s),t)),this.offset+=s,t+s}add(t,r){this.cache.push({id:t,buffer:r})}next(){for(this.id+=1;this.cache[0]?.id<this.id;)this.cache.shift();this.cache[0]?.id===this.id?(this.buffer=this.cache[0].buffer,this.cache.shift()):this.buffer=void 0,this.offset=0,d(this.port,["playbackTick",{}])}};registerProcessor("OdinCaptureProcessor",b);registerProcessor("OdinPlaybackProcessor",x);})();\n';var tx=new vx;function v0(r,D,x,F,A=E.DefaultRefreshRate){return tx.enqueue(async()=>{let[B,j]=await u(c,d,r,"OdinCaptureProcessor",{channelCount:1,numberOfInputs:1,numberOfOutputs:0});return console.warn("SharedArrayBuffer is not available; creating ODIN CaptureWorker in fallback mode"),q.create(r,D,x,A,B,j,F)})}async function t0(r,D=E.DefaultRefreshRate){if(r.sampleRate!==48e3)throw new Error("playback sample rate must be 48kHz ");let[x,F]=await u(c,d,r,"OdinPlaybackProcessor",{numberOfInputs:0,numberOfOutputs:1,outputChannelCount:[2]});return G.create(r,D,x,F)}var q=class r extends s{constructor(x,F,A,B,j){super(x,F,A,B,j);this._Activity=a;this._SpeechProbability=0;F.addEventListener("message",this._OnMessages.bind(this))}static async create(x,F,A,B,j,t,$){let{port1:p,port2:h}=new MessageChannel;return v(j,["captureInit",{sampleRate:x.sampleRate,refreshRate:B,workletPort:p}],[p]),await i(j,"captureReady"),v(t.port,["init",{workerPort:h}],[h]),new r(t,j,F,A,$)}get activity(){return this._Activity}get speechProbability(){return this._SpeechProbability}setVolume(x){v(this.worker,["captureSetVolume",{value:x}])}_OnMessages(x){super._OnMessages(x);let[F,A]=x.data;F==="captureUpdate"&&(this._Activity={isSilent:!A.active,rmsDBFS:A.rmsDBFs},this._SpeechProbability=A.speechProbability)}},G=class r extends b{constructor(x,F,A){super(x,F,A);this.activities=new Float32Array;this.jitterStats=[]}static async create(x,F,A,B){let{port1:j,port2:t}=new MessageChannel;return v(A,["playbackInit",{workletPort:j,refreshRate:F}],[j]),await i(A,"playbackReady"),v(B.port,["init",{workerPort:t}],[t]),new r(x,B,A)}getActivity(x){let F=this.medias.get(C(x));if(F===void 0)return;let A=this.activities.at(F.index);if(A!==void 0)return A===0?a:{isSilent:!1,rmsDBFS:A}}getJitterStats(x){let F=this.medias.get(C(x));if(F===void 0)return;let A=this.jitterStats.at(F.index);if(A!==void 0)return A}setGlobalVolume(x){v(this.worker,["playbackSetVolume",{index:"global",value:x}])}setVolume(x,F){let A=this.medias.get(C(x));A!==void 0&&v(this.worker,["playbackSetVolume",{index:A.index,value:F}])}_GetFreeIndex(){let x=super._GetFreeIndex();if(x!==void 0)return x;if(this.medias.size<E.MaxNumberOfDecoders)return this.medias.size}_OnMessages(x){super._OnMessages(x);let[F,A]=x.data;F==="playbackUpdate"&&(this.activities=A.activities,this.jitterStats=A.jitterStats)}};export{q as UnsharedCaptureWorker,G as UnsharedPlaybackWorker,v0 as createCaptureWorker,t0 as createPlaybackWorker};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@4players/odin-plugin-web",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "A backend plugin providing the custom WebAssembly audio processing module for ODIN web clients",
|
|
5
5
|
"homepage": "https://www.4players.io",
|
|
6
6
|
"repository": {
|
|
@@ -41,22 +41,22 @@
|
|
|
41
41
|
"lint": "eslint ."
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@4players/odin-common": "
|
|
45
|
-
"@4players/voice-filter": "1.2.
|
|
46
|
-
"@msgpack/msgpack": "3.1.
|
|
44
|
+
"@4players/odin-common": "~11.4.0",
|
|
45
|
+
"@4players/voice-filter": "~1.2.0",
|
|
46
|
+
"@msgpack/msgpack": "~3.1.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@eslint/js": "10.0.
|
|
50
|
-
"@types/node": "26.
|
|
51
|
-
"dts-bundle-generator": "9.5.
|
|
52
|
-
"esbuild": "0.28.
|
|
53
|
-
"eslint": "10.
|
|
54
|
-
"genversion": "3.2.0",
|
|
55
|
-
"npm-run-all2": "9.0.
|
|
56
|
-
"prettier": "3.9.
|
|
57
|
-
"rimraf": "6.1.
|
|
58
|
-
"tsx": "4.23.
|
|
59
|
-
"typescript": "6.0.
|
|
60
|
-
"typescript-eslint": "8.70.0"
|
|
49
|
+
"@eslint/js": "~10.0.0",
|
|
50
|
+
"@types/node": "~26.6.0",
|
|
51
|
+
"dts-bundle-generator": "~9.5.0",
|
|
52
|
+
"esbuild": "~0.28.0",
|
|
53
|
+
"eslint": "~10.11.0",
|
|
54
|
+
"genversion": "~3.2.0",
|
|
55
|
+
"npm-run-all2": "~9.0.0",
|
|
56
|
+
"prettier": "~3.9.0",
|
|
57
|
+
"rimraf": "~6.1.0",
|
|
58
|
+
"tsx": "~4.23.0",
|
|
59
|
+
"typescript": "~6.0.0",
|
|
60
|
+
"typescript-eslint": "~8.70.0"
|
|
61
61
|
}
|
|
62
62
|
}
|