@4players/odin-plugin-web 1.9.8 → 1.10.1

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