@4players/odin-plugin-web 1.8.0 → 1.9.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.
@@ -3187,5 +3187,5 @@ K\\xE08\\xDF\\0}\\xBC\\x8A\\x1B\\f\\xE5\\xFF\\xCF\\xE8?\\x9F\\xFFFq\\0\\x88\\xB
3187
3187
  \`,m.push(\`\${h}_dtor\`))}return s&&(C+=\`var ret = fromRetWire(rv);
3188
3188
  return ret;
3189
3189
  \`),C+=\`}
3190
- \`,new Function(m,C)}function SA(j,r,s,l,o,a){var k=r.length;k<2&&G("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var u=r[1]!==null&&s!==null,c=Jr(r),C=!r[0].isVoid,f=r[0],m=r[1],E=[j,G,l,o,Br,f.fromWireType.bind(f),m?.toWireType.bind(m)],h=2;h<k;++h){var $=r[h];E.push($.toWireType.bind($))}if(!c)for(var h=u?1:2;h<r.length;++h)r[h].destructorFunction!==null&&E.push(r[h].destructorFunction);var J=$t(r,u,C,a)(...E);return Hr(j,J)}var Ft=(j,r,s,l,o,a)=>{var k=VA(r,s);o=N(l,o),w([],[j],u=>{u=u[0];var c=\`constructor \${u.name}\`;if(u.registeredClass.constructor_body===void 0&&(u.registeredClass.constructor_body=[]),u.registeredClass.constructor_body[r-1]!==void 0)throw new AA(\`Cannot register multiple constructors with identical number of parameters (\${r-1}) for class '\${u.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!\`);return u.registeredClass.constructor_body[r-1]=()=>{Q(\`Cannot construct \${u.name} due to unbound types\`,k)},w([],k,C=>(C.splice(1,0,null),u.registeredClass.constructor_body[r-1]=SA(c,C,null,o,a),[])),[]})},br=j=>{j=j.trim();let r=j.indexOf("(");return r===-1?j:j.slice(0,r)},vt=(j,r,s,l,o,a,k,u,c,C)=>{var f=VA(s,l);r=v(r),r=br(r),a=N(o,a,c),w([],[j],m=>{m=m[0];var E=\`\${m.name}.\${r}\`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),u&&m.registeredClass.pureVirtualFunctions.push(r);function h(){Q(\`Cannot call \${E} due to unbound types\`,f)}var $=m.registeredClass.instancePrototype,H=$[r];return H===void 0||H.overloadTable===void 0&&H.className!==m.name&&H.argCount===s-2?(h.argCount=s-2,h.className=m.name,$[r]=h):(_r($,r,E),$[r].overloadTable[s-2]=h),w([],f,J=>{var y=SA(E,J,m,a,k,c);return $[r].overloadTable===void 0?(y.argCount=s-2,$[r]=y):$[r].overloadTable[s-2]=y,[]}),[]})},Or=(j,r,s)=>(j instanceof Object||G(\`\${s} with invalid "this": \${j}\`),j instanceof r.registeredClass.constructor||G(\`\${s} incompatible with "this" of type \${j.constructor.name}\`),j.$$.ptr||G(\`cannot call emscripten binding method \${s} on deleted object\`),fA(j.$$.ptr,j.$$.ptrType.registeredClass,r.registeredClass)),Lt=(j,r,s,l,o,a,k,u,c,C)=>{r=v(r),o=N(l,o),w([],[j],f=>{f=f[0];var m=\`\${f.name}.\${r}\`,E={get(){Q(\`Cannot access \${m} due to unbound types\`,[s,k])},enumerable:!0,configurable:!0};return c?E.set=()=>Q(\`Cannot access \${m} due to unbound types\`,[s,k]):E.set=h=>G(m+" is a read-only property"),Object.defineProperty(f.registeredClass.instancePrototype,r,E),w([],c?[s,k]:[s],h=>{var $=h[0],H={get(){var y=Or(this,f,m+" getter");return $.fromWireType(o(a,y))},enumerable:!0};if(c){c=N(u,c);var J=h[1];H.set=function(y){var eA=Or(this,f,m+" setter"),g=[];c(C,eA,J.toWireType(g,y)),Br(g)}}return Object.defineProperty(f.registeredClass.instancePrototype,r,H),[]}),[]})},wr=[],Y=[0,1,,1,null,1,!0,1,!1,1],gt=j=>{j>9&&--Y[j+1]===0&&(Y[j]=void 0,wr.push(j))},WA={toValue:j=>(j||G(\`Cannot use deleted val. handle = \${j}\`),Y[j]),toHandle:j=>{switch(j){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let r=wr.pop()||Y.length;return Y[r]=j,Y[r+1]=1,r}}}},Ht={name:"emscripten::val",fromWireType:j=>{var r=WA.toValue(j);return gt(j),r},toWireType:(j,r)=>WA.toHandle(r),readValueFromPointer:GA,destructorFunction:null},yt=j=>K(j,Ht),_t=(j,r)=>{switch(r){case 4:return function(s){return this.fromWireType(qr[s>>2])};case 8:return function(s){return this.fromWireType(Cr[s>>3])};default:throw new TypeError(\`invalid float width (\${r}): \${j}\`)}},Dt=(j,r,s)=>{r=v(r),K(j,{name:r,fromWireType:l=>l,toWireType:(l,o)=>o,readValueFromPointer:_t(r,s),destructorFunction:null})},xt=(j,r,s,l,o,a,k,u)=>{var c=VA(r,s);j=v(j),j=br(j),o=N(l,o,k),Dr(j,function(){Q(\`Cannot call \${j} due to unbound types\`,c)},r-1),w([],c,C=>{var f=[C[0],null].concat(C.slice(1));return Kr(j,SA(j,f,null,o,a,k),r-1),[]})},Kt=(j,r,s,l,o)=>{r=v(r);let a=l===0,k=c=>c;if(a){var u=32-8*s;k=c=>c<<u>>>u,o=k(o)}K(j,{name:r,fromWireType:k,toWireType:(c,C)=>C,readValueFromPointer:Fr(r,s,l!==0),destructorFunction:null})},Nt=(j,r,s)=>{var l=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],o=l[r];function a(k){var u=I[k>>2],c=I[k+4>>2];return new o(V.buffer,c,u)}s=v(s),K(j,{name:s,fromWireType:a,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},Bt=(j,r,s,l)=>{if(!(l>0))return 0;for(var o=s,a=s+l-1,k=0;k<j.length;++k){var u=j.codePointAt(k);if(u<=127){if(s>=a)break;r[s++]=u}else if(u<=2047){if(s+1>=a)break;r[s++]=192|u>>6,r[s++]=128|u&63}else if(u<=65535){if(s+2>=a)break;r[s++]=224|u>>12,r[s++]=128|u>>6&63,r[s++]=128|u&63}else{if(s+3>=a)break;r[s++]=240|u>>18,r[s++]=128|u>>12&63,r[s++]=128|u>>6&63,r[s++]=128|u&63,k++}}return r[s]=0,s-o},Jt=(j,r,s)=>Bt(j,_,r,s),bt=j=>{for(var r=0,s=0;s<j.length;++s){var l=j.charCodeAt(s);l<=127?r++:l<=2047?r+=2:l>=55296&&l<=57343?(r+=4,++s):r+=3}return r},Pr=globalThis.TextDecoder&&new TextDecoder,Mr=(j,r,s,l)=>{var o=r+s;if(l)return o;for(;j[r]&&!(r>=o);)++r;return r},Tr=(j,r=0,s,l)=>{var o=Mr(j,r,s,l);if(o-r>16&&j.buffer&&Pr)return Pr.decode(j.subarray(r,o));for(var a="";r<o;){var k=j[r++];if(!(k&128)){a+=String.fromCharCode(k);continue}var u=j[r++]&63;if((k&224)==192){a+=String.fromCharCode((k&31)<<6|u);continue}var c=j[r++]&63;if((k&240)==224?k=(k&15)<<12|u<<6|c:k=(k&7)<<18|u<<12|c<<6|j[r++]&63,k<65536)a+=String.fromCharCode(k);else{var C=k-65536;a+=String.fromCharCode(55296|C>>10,56320|C&1023)}}return a},Ot=(j,r,s)=>j?Tr(_,j,r,s):"",wt=(j,r)=>{r=v(r);var s=!0;K(j,{name:r,fromWireType(l){var o=I[l>>2],a=l+4,k;if(s)k=Ot(a,o,!0);else{k="";for(var u=0;u<o;++u)k+=String.fromCharCode(_[a+u])}return B(l),k},toWireType(l,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var a,k=typeof o=="string";k||ArrayBuffer.isView(o)&&o.BYTES_PER_ELEMENT==1||G("Cannot pass non-string to std::string"),s&&k?a=bt(o):a=o.length;var u=RA(4+a+1),c=u+4;if(I[u>>2]=a,k)if(s)Jt(o,c,a+1);else for(var C=0;C<a;++C){var f=o.charCodeAt(C);f>255&&(B(u),G("String has UTF-16 code units that do not fit in 8 bits")),_[c+C]=f}else _.set(o,c);return l!==null&&l.push(B,u),u},readValueFromPointer:GA,destructorFunction(l){B(l)}})},Ur=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Pt=(j,r,s)=>{var l=j>>1,o=Mr(Z,l,r/2,s);if(o-l>16&&Ur)return Ur.decode(Z.subarray(l,o));for(var a="",k=l;k<o;++k){var u=Z[k];a+=String.fromCharCode(u)}return a},Mt=(j,r,s)=>{if(s??=2147483647,s<2)return 0;s-=2;for(var l=r,o=s<j.length*2?s/2:j.length,a=0;a<o;++a){var k=j.charCodeAt(a);uA[r>>1]=k,r+=2}return uA[r>>1]=0,r-l},Tt=j=>j.length*2,Ut=(j,r,s)=>{for(var l="",o=j>>2,a=0;!(a>=r/4);a++){var k=I[o+a];if(!k&&!s)break;l+=String.fromCodePoint(k)}return l},Vt=(j,r,s)=>{if(s??=2147483647,s<4)return 0;for(var l=r,o=l+s-4,a=0;a<j.length;++a){var k=j.codePointAt(a);if(k>65535&&a++,cA[r>>2]=k,r+=4,r+4>o)break}return cA[r>>2]=0,r-l},St=j=>{for(var r=0,s=0;s<j.length;++s){var l=j.codePointAt(s);l>65535&&s++,r+=4}return r},Wt=(j,r,s)=>{s=v(s);var l,o,a;r===2?(l=Pt,o=Mt,a=Tt):(l=Ut,o=Vt,a=St),K(j,{name:s,fromWireType:k=>{var u=I[k>>2],c=l(k+4,u*r,!0);return B(k),c},toWireType:(k,u)=>{typeof u!="string"&&G(\`Cannot pass non-string to C++ string type \${s}\`);var c=a(u),C=RA(4+c+r);return I[C>>2]=c/r,o(u,C+4,c+r),k!==null&&k.push(B,C),C},readValueFromPointer:GA,destructorFunction(k){B(k)}})},Rt=(j,r)=>{r=v(r),K(j,{isVoid:!0,name:r,fromWireType:()=>{},toWireType:(s,l)=>{}})},zt=j=>{PA("OOM")},Xt=j=>{var r=_.length;j>>>=0,zt(j)},Qt=j=>52,Yt=9007199254740992,Zt=-9007199254740992,Ae=j=>j<Zt||j>Yt?NaN:Number(j);function re(j,r,s,l){return r=Ae(r),70}for(var je=[null,[],[]],te=(j,r)=>{var s=je[j];r===0||r===10?((j===1?ar:kA)(Tr(s)),s.length=0):s.push(r)},ee=(j,r,s,l)=>{for(var o=0,a=0;a<s;a++){var k=I[r>>2],u=I[r+4>>2];r+=8;for(var c=0;c<u;c++)te(j,_[k+c]);o+=u}return I[l>>2]=o,0},jA=new Uint8Array(123),P=25;P>=0;--P)jA[48+P]=52+P,jA[65+P]=P,jA[97+P]=26+P;if(jA[43]=62,jA[47]=63,st(),pt(),e.noExitRuntime&&(zj=e.noExitRuntime),e.print&&(ar=e.print),e.printErr&&(kA=e.printErr),e.wasmBinary&&(kr=e.wasmBinary),e.arguments&&(p=e.arguments),e.thisProgram&&(F=e.thisProgram),e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.shift()();var Vr,RA,B,ne,se,Sr,Wr;function ie(j){Vr=j.w,RA=e._malloc=j.y,B=e._free=j.z,ne=Sr=j.u,se=Wr=j.x}var le={g:Yj,r:Zj,f:rt,l:jt,k:Et,j:Ft,d:vt,a:Lt,s:yt,i:Dt,n:xt,c:Kt,b:Nt,t:wt,e:Wt,m:Rt,o:Xt,q:Qt,p:re,h:ee};function oe(){bj();function j(){e.calledRun=!0,!ur&&(Oj(),cr?.(e),e.onRuntimeInitialized?.(),wj())}e.setStatus?(e.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>e.setStatus(""),1),j()},1)):j()}var tA;return tA=await Sj(),oe(),pr?t=e:t=new Promise((j,r)=>{cr=j,dr=r}),t}})();typeof yj=="object"&&typeof OA=="object"?(OA.exports=sr,OA.exports.default=sr):typeof define=="function"&&define.amd&&define([],()=>sr)});var M={};fe(M,{AdditionalCaptureBlocks:()=>me,AdditionalPlaybackBlocks:()=>he,ClockJumpCheckInterval:()=>ge,ClockJumpThreshold:()=>He,ConnectInterval:()=>Je,ConnectTimeout:()=>Ke,DefaultRefreshRate:()=>Ee,DefaultVideoCodec:()=>be,HealthCheckTimeout:()=>Le,MainConnectionPingInterval:()=>ye,MaxNumberOfDecoders:()=>Fe,MinDBFs:()=>Qr,MinTokenLifetime:()=>Ne,MinTokenRefreshInterval:()=>Be,PlaybackPreload:()=>Ie,RenderQuantumSize:()=>ve,VadPreload:()=>$e,WebRtcIceTimeout:()=>De,WebRtcStatsSnapshotInterval:()=>_e,WebRtcTimeout:()=>xe});var he=3,me=3,Ie=3,Ee=250,$e=3,Fe=512,ve=128,Qr=-758.596,Le=1e4,ge=1e3,He=1e4,ye=3e3,_e=1e3,De=3e3,xe=1e4,Ke=5e3,Ne=6e4,Be=5e3,Je=[0,100,200,200,500],be="H264";function T(n,A,t){return n.postMessage(A,t)}function Yr(n){return[n.values[0],n.values[1]]}function IA(n,A){n.values[0]=A[0],n.values[1]=A[1]}function EA(n,A){return n.values[2+A*5]}function Zr(n,A,t){n.values[2+A*5]=t}function Aj(n,A){let t=2+A*5+1;return[n.values[t+0],n.values[t+1]]}function $A(n,A,t){let e=2+A*5+1;n.values[e+0]=t[0],n.values[e+1]=t[1]}function rj(n,A){return n.values[2+A*5+3]}function jj(n,A,t){n.values[2+A*5+3]=t}function tj(n,A){return n.values[2+A*5+4]}function ej(n,A,t){n.values[2+A*5+4]=t}function FA(n){return n.values[0]!==0}function vA(n){return n.values[1]}function LA(n){return n.values[2]}function nj(n){return n.values[3]}function gA(n,A){return n.values[3]=A}function sj(n){return n?Array.from(n).map(A=>A.toString(16).padStart(2,"0")).join(""):null}var Oe;(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||={})})(Oe||={});function kj(n){return{type:"Success",value:n}}function D(n){return{type:"Failure",reason:n}}var{Deno:ij}=globalThis,we=typeof ij?.noColor=="boolean"?ij.noColor:!1,Pe=!we;function YA(n,A){return{open:\`\\x1B[\${n.join(";")}m\`,close:\`\\x1B[\${A}m\`,regexp:new RegExp(\`\\\\x1b\\\\[\${A}m\`,"g")}}function ZA(n,A){return Pe?\`\${A.open}\${n.replace(A.regexp,A.open)}\${A.close}\`:n}function QA(n){return ZA(n,YA([0],0))}function lj(n){return ZA(n,YA([1],22))}function Me(n){return ZA(n,YA([2],22))}var Jn=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"),Te=new Date,HA=(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))(HA||{}),uj={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},Ue={4:Me,3:QA,2:QA,1:lj,0:lj};function Ve({message:n}){return String(n)}function oj(n){return JSON.stringify({timestamp:n.date.toISOString(),level:HA[n.level],message:n.message,extra:n.extra})}function aj(n){function A(q,p){return[Math.floor(q/p),q%p]}function t(){let q,p=n.date.valueOf()-Te.valueOf();[p,q]=A(p,1e3);let[F,x]=A(p,60);return\`\${F.toString().padStart(4,"0")}:\${x.toString().padStart(2,"0")}.\${q.toString().padStart(4,"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=uj[n.level],d=n.logger.name!==void 0?\`@\${n.logger}\`:"";return\`\${QA(t())}\${d} \${i} \${Ue[n.level](String(n.message))}\${e()}\`}function Se(n){let A=\`[\${n.date.toISOString()}]\`,t=\`[\${HA[n.level]}]\`,e=n.logger.name!==void 0?\`[\${n.logger.name}] \`:"",i=uj[n.level];return\`\${A} \${i} \${t.padEnd(7," ")} \${e}\${n.message}\`}function We(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var cj=class{static sparse=Ve;static json=oj;static pretty=aj;static structured=Se;static default=We()?aj:oj;constructor(){}},Re=class{formatter;consoleObject;filter;constructor(n=cj.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 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 S=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)},nA=new S(3,void 0,[new Re]),ze=S.prototype.log.bind(nA,1),Xe=S.prototype.log.bind(nA,2),dj=S.prototype.log.bind(nA,3),Qe=S.prototype.log.bind(nA,4),bn=S.prototype.log.bind(nA);var qj;function Cj(n,...A){let t=Ye(A);qj?qj?.info(n,t):dj(n,t)}function Ye(...n){if(n.length===1&&typeof n[0]=="object"&&n[0]!==null)return{...n[0]};if(n.length>0)return{args:n}}function yA(n){return n.connectionId*4294967296+n.mediaId}function fj(n){return{mediaId:n%4294967296,connectionId:Math.floor(n/4294967296)}}function b(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 W(n,A){n._free(A.byteOffset)}function Gj(n,A){return{values:b(n,"f32",2+A*5),length:A}}function pj(n,A){W(n,A.values)}function hj(n){return{values:b(n,"f32",4)}}function mj(n,A){W(n,A.values)}function Ij(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 Ze(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 p=n.charCodeAt(d);(p&64512)===56320&&(++d,q=((q&1023)<<10)+(p&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 An=new TextEncoder,rn=50;function jn(n,A,t){An.encodeInto(n,A.subarray(t))}function Ej(n,A,t){n.length>rn?jn(n,A,t):Ze(n,A,t)}var tn=4096;function Ar(n,A,t){let e=A,i=e+t,d=[],q="";for(;e<i;){let p=n[e++];if((p&128)===0)d.push(p);else if((p&224)===192){let F=n[e++]&63;d.push((p&31)<<6|F)}else if((p&240)===224){let F=n[e++]&63,x=n[e++]&63;d.push((p&31)<<12|F<<6|x)}else if((p&248)===240){let F=n[e++]&63,x=n[e++]&63,wA=n[e++]&63,O=(p&7)<<18|F<<12|x<<6|wA;O>65535&&(O-=65536,d.push(O>>>10&1023|55296),O=56320|O&1023),d.push(O)}else d.push(p);d.length>=tn&&(q+=String.fromCharCode(...d),d.length=0)}return d.length>0&&(q+=String.fromCharCode(...d)),q}var en=new TextDecoder,nn=200;function sn(n,A,t){let e=n.subarray(A,A+t);return en.decode(e)}function $j(n,A,t){return t>nn?sn(n,A,t):Ar(n,A,t)}var R=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 Fj(n,A,t){let e=t/4294967296,i=t;n.setUint32(A,e),n.setUint32(A+4,i)}function _A(n,A,t){let e=Math.floor(t/4294967296),i=t;n.setUint32(A,e),n.setUint32(A+4,i)}function DA(n,A){let t=n.getInt32(A),e=n.getUint32(A+4);return t*4294967296+e}function vj(n,A){let t=n.getUint32(A),e=n.getUint32(A+4);return t*4294967296+e}var ln=-1,on=4294967296-1,an=17179869184-1;function kn({sec:n,nsec:A}){if(n>=0&&A>=0&&n<=an)if(A===0&&n<=on){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),_A(e,4,n),t}}function un(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 cn(n){if(n instanceof Date){let A=un(n);return kn(A)}else return null}function dn(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=DA(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 qn(n){let A=dn(n);return new Date(A.sec*1e3+A.nsec/1e6)}var Lj={type:ln,encode:cn,decode:qn};var U=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Lj)}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 R(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 R(q,d)}}}return A instanceof R?A:null}decode(A,t,e){let i=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return i?i(A,t,e):new R(t,A)}};U.defaultCodec=new U;function Cn(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}function sA(n){return n instanceof Uint8Array?n:ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):Cn(n)?new Uint8Array(n):Uint8Array.from(n)}var fn=100,Gn=2048,xA=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??fn,this.initialBufferSize=A?.initialBufferSize??Gn,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=Ij(A);this.ensureBufferSizeToWrite(5+e),this.writeStringHeader(e),Ej(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=sA(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),Fj(this.view,this.pos,A),this.pos+=8}writeI64(A){this.ensureBufferSizeToWrite(8),_A(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 rr(n,A){return new xA(A).encodeSharedRef(n)}function KA(n){return\`\${n<0?"-":""}0x\${Math.abs(n).toString(16).padStart(2,"0")}\`}var pn=16,hn=16,NA=class{constructor(A=pn,t=hn){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 p=0;p<e;p++)if(q[p]!==A[t+p])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=Ar(A,t,e),q=Uint8Array.prototype.slice.call(A,t,t+e);return this.store(q,d),d}};var jr="array",oA="map_key",Hj="map_value",mn=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)},tr=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=jr,t.position=0,t.size=A,t.array=new Array(A)}pushMapState(A){let t=this.getUninitializedStateFromPool();t.type=oA,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===jr){let e=A;e.size=0,e.array=void 0,e.position=0,e.type=void 0}if(A.type===oA||A.type===Hj){let e=A;e.size=0,e.map=void 0,e.readCount=0,e.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},lA=-1,er=new DataView(new ArrayBuffer(0)),In=new Uint8Array(er.buffer);try{er.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 gj=new RangeError("Insufficient data"),En=new NA,BA=class n{constructor(A){this.totalPos=0,this.pos=0,this.view=er,this.bytes=In,this.headByte=lA,this.stack=new tr,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:En,this.mapKeyConverter=A?.mapKeyConverter??mn}clone(){return new n({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=lA,this.stack.reset()}setBuffer(A){let t=sA(A);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(A){if(this.headByte===lA&&!this.hasRemaining(1))this.setBuffer(A);else{let t=this.bytes.subarray(this.pos),e=sA(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 p of A){if(t)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(p);try{e=this.doDecodeSync(),t=!0}catch(F){if(!(F instanceof RangeError))throw F}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 \${KA(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: \${KA(A)}\`);this.complete();let e=this.stack;for(;e.length>0;){let i=e.top();if(i.type===jr)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===oA){if(t==="__proto__")throw new L("The key __proto__ is not allowed");i.key=this.mapKeyConverter(t),i.type=Hj;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=oA;continue A}}return t}}readHeadByte(){return this.headByte===lA&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=lA}readArraySize(){let A=this.readHeadByte();switch(A){case 220:return this.readU16();case 221:return this.readU32();default:{if(A<160)return A-144;throw new L(\`Unrecognized array type byte: \${KA(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 gj;let e=this.pos+t,i;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(A)?i=this.keyDecoder.decode(this.bytes,e,A):i=$j(this.bytes,e,A),this.pos+=t+A,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===oA:!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 gj;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=vj(this.view,this.pos);return this.pos+=8,A}readI64(){let A=DA(this.view,this.pos);return this.pos+=8,A}readU64AsBigInt(){let A=this.view.getBigUint64(this.pos);return this.pos+=8,A}readI64AsBigInt(){let A=this.view.getBigInt64(this.pos);return this.pos+=8,A}readF32(){let A=this.view.getFloat32(this.pos);return this.pos+=4,A}readF64(){let A=this.view.getFloat64(this.pos);return this.pos+=8,A}};function nr(n,A){return new BA(A).decode(n)}var aA=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=nr(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(x=>typeof x=="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,p=(t[4]&1)!==0,F=t[t.length-1];return F instanceof Uint8Array?kj(new n(e,i,d,p,F)):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(rr(t,{forceFloat32:!0,ignoreUndefined:!0}))}};var JA=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,M.VadPreload),this.encoder.complexity=navigator.hardwareConcurrency>=4?6:4,this.information=hj(this.wasm),this.outBuffer=b(this.wasm,"u8",1270),gA(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(){mj(this.wasm,this.information),W(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){Cj(\`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 aA(i.mediaIds,this.sequenceNumber,this.timestamp,e,this.outBuffer.subarray(0,t));T(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:FA(this.information),speechProbability:vA(this.information),rmsDBFS:LA(this.information),volume:nj(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}}}},bA=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=b(this.wasm,"u32",M.MaxNumberOfDecoders),this.information=Gj(this.wasm,M.MaxNumberOfDecoders),IA(this.information,[1,1])}close(){pj(this.wasm,this.information);for(let{decoder:A}of this.medias.values())A.delete()}receivePacket(A,t){this.stats.numberPackets++;let e=aA.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(yA({connectionId:A,mediaId:i}));if(d===void 0){this.stats.numberPacketsMediaNotFound++;continue}d.lastPacket=t;let q=b(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=yA({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),$A(this.information,A,i),ej(this.information,A,0),jj(this.information,A,0)}removeMedia(A,t,e){let i=yA({connectionId:t,mediaId:e}),d=this.medias.get(i);if(!(d===void 0||d.index!==A)&&(this.medias.delete(i),Zr(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:p}of e.added)this.insertMedia(i,d,q,p);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=fj(t);A.push({index:e.index,connectionId:i.connectionId,mediaId:i.mediaId,rmsDBFS:EA(this.information,e.index),volume:Aj(this.information,e.index),voicedBlocks:tj(this.information,e.index),silentBlocks:rj(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:sj(e.lastPacket)})}return{largestIndex:this.largestIndex,globalVolume:Yr(this.information),decoders:A}}};var Nj=pe(_j()),Dj=(0,Nj.default)(),xj,Kj;globalThis.addEventListener("message",ir);async function ir(n){let A=n.data,[t,e]=A;switch(t){case"captureInit":e.workletPort.onmessage=ir,xj=new lr(e.sampleRate,await Dj,e.refreshRate);break;case"playbackInit":e.workletPort.onmessage=ir,Kj=new or(await Dj,e.workletPort,e.refreshRate);break;case"close":globalThis.close();break}xj?.onMessage(A),Kj?.onMessage(A)}var lr=class extends JA{constructor(t,e,i){super(t,e);this.sampleRate=t;this.inBuffer=b(this.wasm,"f32",t*.02),this.updateHandle=setInterval(()=>this.update(),i),T(globalThis,["captureReady",{}])}close(){super.close(),W(this.wasm,this.inBuffer),clearInterval(this.updateHandle)}onMessage(t){super.onMessage(t);let[e,i]=t;switch(e){case"captureSetVolume":this.setVolume(i.value);break;case"captureTick":this.tick(i.buffer);break}}setVolume(t){gA(this.information,t)}tick(t){this.inBuffer.set(t,0),this.encode(this.inBuffer)}update(){T(globalThis,["captureUpdate",{active:FA(this.information),rmsDBFs:LA(this.information),speechProbability:vA(this.information)}])}dump(){return{type:"unshared capture worker",sampleRate:this.sampleRate,...super.dump()}}},or=class extends bA{constructor(t,e,i){super(t);this.workletPort=e;this.id=M.PlaybackPreload,this.outBuffer=b(this.wasm,"f32",48e3*.02*2),this.updateHandle=setInterval(()=>this.update(),i),T(globalThis,["playbackReady",{}])}close(){super.close(),W(this.wasm,this.outBuffer),clearInterval(this.updateHandle)}onMessage(t){super.onMessage(t);let[e,i]=t;switch(e){case"playbackSetVolume":this.setVolume(i.index,i.value);break;case"playbackTick":this.tick();break}}setVolume(t,e){t==="global"?IA(this.information,e):$A(this.information,t,e)}tick(){this.stats.numberTicks++,this.id+=1;let{hasAudio:t}=this.decode(this.outBuffer);if(t){let e=this.outBuffer.slice();T(this.workletPort,["samples",{id:this.id,buffer:e}],[e.buffer])}}update(){let t=new Float32Array(this.information.length*2);for(let i=0;i<=this.largestIndex;i++)t[i]=EA(this.information,i);let e=[];for(let[i,d]of this.medias)e[d.index]={packetsBuffered:d.decoder.cache_length,packetsSeen:d.decoder.packets_seen,packetsProcessed:d.decoder.packets_processed,packetsTooEarly:d.decoder.packets_too_early,packetsTooLate:d.decoder.packets_too_late,packetsDropped:0,packetsInvalid:d.decoder.packets_invalid,packetsRepeated:d.decoder.packets_repeated,packetsLost:d.decoder.packets_lost};T(globalThis,["playbackUpdate",{activities:t,jitterStats:e}],[t.buffer])}dump(){return{type:"unshared playback worker",id:this.id,...super.dump()}}};})();
3191
- `;var h='"use strict";(()=>{var P=Object.defineProperty;var M=(e,t)=>{for(var r in t)P(e,r,{get:t[r],enumerable:!0})};var u={};M(u,{AdditionalCaptureBlocks:()=>R,AdditionalPlaybackBlocks:()=>E,ClockJumpCheckInterval:()=>_,ClockJumpThreshold:()=>N,ConnectInterval:()=>Z,ConnectTimeout:()=>J,DefaultRefreshRate:()=>D,DefaultVideoCodec:()=>q,HealthCheckTimeout:()=>O,MainConnectionPingInterval:()=>W,MaxNumberOfDecoders:()=>L,MinDBFs:()=>v,MinTokenLifetime:()=>z,MinTokenRefreshInterval:()=>G,PlaybackPreload:()=>F,RenderQuantumSize:()=>V,VadPreload:()=>C,WebRtcIceTimeout:()=>j,WebRtcStatsSnapshotInterval:()=>$,WebRtcTimeout:()=>H});var E=3,R=3,F=3,D=250,C=3,L=512,V=128,v=-758.596,O=1e4,_=1e3,N=1e4,W=3e3,$=1e3,j=3e3,H=1e4,J=5e3,z=6e4,G=5e3,Z=[0,100,200,200,500],q="H264";function d(e,t,r){return e.postMessage(t,r)}var Q;(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||={})})(Q||={});var{Deno:k}=globalThis,K=typeof k?.noColor=="boolean"?k.noColor:!1,X=!K;function m(e,t){return{open:`\\x1B[${e.join(";")}m`,close:`\\x1B[${t}m`,regexp:new RegExp(`\\\\x1b\\\\[${t}m`,"g")}}function h(e,t){return X?`${t.open}${e.replace(t.regexp,t.open)}${t.close}`:e}function p(e){return h(e,m([0],0))}function U(e){return h(e,m([1],22))}function Y(e){return h(e,m([2],22))}var ke=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"),ee=new Date,f=(e=>(e[e.CRITICAL=0]="CRITICAL",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(f||{}),T={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},te={4:Y,3:p,2:p,1:U,0:U};function re({message:e}){return String(e)}function S(e){return JSON.stringify({timestamp:e.date.toISOString(),level:f[e.level],message:e.message,extra:e.extra})}function I(e){function t(c,i){return[Math.floor(c/i),c%i]}function r(){let c,i=e.date.valueOf()-ee.valueOf();[i,c]=t(i,1e3);let[B,A]=t(i,60);return`${B.toString().padStart(4,"0")}:${A.toString().padStart(2,"0")}.${c.toString().padStart(4,"0")}`}function n(){return e.extra===void 0?"":typeof Deno=="object"?" "+Deno.inspect(e.extra,{compact:!1,colors:!0,trailingComma:!0}).trimStart():" "+JSON.stringify(e.extra)}let s=T[e.level],a=e.logger.name!==void 0?`@${e.logger}`:"";return`${p(r())}${a} ${s} ${te[e.level](String(e.message))}${n()}`}function ne(e){let t=`[${e.date.toISOString()}]`,r=`[${f[e.level]}]`,n=e.logger.name!==void 0?`[${e.logger.name}] `:"",s=T[e.level];return`${t} ${s} ${r.padEnd(7," ")} ${n}${e.message}`}function se(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var w=class{static sparse=re;static json=S;static pretty=I;static structured=ne;static default=se()?I:S;constructor(){}},oe=class{formatter;consoleObject;filter;constructor(e=w.default,t=4,r=console){this.filter=t,this.formatter=e,this.consoleObject=r}handle(e){let t=this.formatter(e);switch(e.level){case 1:this.consoleObject.error(t);break;case 2:this.consoleObject.warn(t);break;case 3:this.consoleObject.info(t);break;case 4:this.consoleObject.debug(t);break}}};var o=class{#e;sinks;filter;parent;get name(){return this.#e}constructor(e,t=void 0,r=[],n=void 0){this.#e=t,this.sinks=r,this.filter=e,this.parent=n}log(e,t,r=void 0){let n={date:new Date,level:e,logger:this,message:t,extra:r};this.filter<e||this.insert(n)}insert(e){if(!(this.filter<e.level)){for(let t of this.sinks)t.filter>=e.level&&t.handle(e);this.parent!==void 0&&this.parent.insert(e)}}error=this.log.bind(this,1);warn=this.log.bind(this,2);info=this.log.bind(this,3);debug=this.log.bind(this,4)},l=new o(3,void 0,[new oe]),ae=o.prototype.log.bind(l,1),ie=o.prototype.log.bind(l,2),ce=o.prototype.log.bind(l,3),ue=o.prototype.log.bind(l,4),Ue=o.prototype.log.bind(l);var b=class extends AudioWorkletProcessor{constructor(){super();this.alive=!0;this.blocks=0;this.port.onmessage=this.onMessage.bind(this)}async onMessage(r){let[n,s]=r.data;switch(n){case"init":this.state=new y(s.workerPort,sampleRate*.02);break;case"close":this.alive=!1;break;case"dump":s.result.postMessage(this.dump());break}}process(r,n,s){if(this.state===void 0||r.length<1||r[0].length<1)return this.alive;let a=this.state.fill(0,r[0][0]);return this.state.offset===this.state.length&&(this.state.flush(),this.state.fill(a,r[0][0])),this.alive}dump(){return{type:"unshared capture worklet",alive:this.alive,sampleRate,offset:this.state?.offset||null,length:this.state?.length||null,blocks:this.blocks}}},x=class extends AudioWorkletProcessor{constructor(){super();this.alive=!0;this.silenceBlocks=0;this.voiceBlocks=0;this.totalBlocks=0;this.port.onmessage=this.onMessage.bind(this)}async onMessage(r){let[n,s]=r.data;switch(n){case"close":this.alive=!1;break;case"init":this.state=new g(s.workerPort,sampleRate*.02),s.workerPort.onmessage=this.onMessage.bind(this);break;case"samples":this.state?.add(s.id,s.buffer);break;case"dump":s.result.postMessage(this.dump());break}n==="close"&&(this.alive=!1)}process(r,n,s){if(this.state===void 0||n.length<1||n[0].length<2)return this.alive;let a=this.state.fill(0,n[0][0],n[0][1]);return a<u.RenderQuantumSize&&(this.totalBlocks+=1,this.state.next(),this.state.hasVoice?this.voiceBlocks+=1:this.silenceBlocks+=1,this.state.fill(a,n[0][0],n[0][1])),this.alive}dump(){return{type:"unshared playback worklet",alive:this.alive,sampleRate,id:this.state?.id||null,offset:this.state?.offset||null,length:this.state?.length||null,hasVoice:this.state?.hasVoice??!1,silenceBlocks:this.silenceBlocks,voiceBlocks:this.voiceBlocks,totalBlocks:this.totalBlocks}}},y=class{constructor(t,r){this.port=t;this.length=r;this.offset=0,this.buffer=new Float32Array(r)}fill(t,r){let n=Math.min(r.length-t,this.length-this.offset);return this.buffer.set(r.subarray(t,t+n),this.offset),this.offset+=n,t+n}flush(){d(this.port,["captureTick",{buffer:this.buffer}],[this.buffer.buffer]),this.offset=0,this.buffer=new Float32Array(this.length)}},g=class{constructor(t,r){this.port=t;this.length=r;this.cache=[];this.id=-1,this.offset=0,this.buffer=void 0,this.next()}get hasVoice(){return this.buffer!==void 0}fill(t,r,n){let s=Math.min(u.RenderQuantumSize-t,this.length-this.offset);return this.buffer!==void 0&&(r.set(this.buffer.subarray(this.offset,this.offset+s),t),n.set(this.buffer.subarray(this.offset+this.length,this.offset+this.length+s),t)),this.offset+=s,t+s}add(t,r){this.cache.push({id:t,buffer:r})}next(){for(this.id+=1;this.cache[0]?.id<this.id;)this.cache.shift();this.cache[0]?.id===this.id?(this.buffer=this.cache[0].buffer,this.cache.shift()):this.buffer=void 0,this.offset=0,d(this.port,["playbackTick",{}])}};registerProcessor("OdinCaptureProcessor",b);registerProcessor("OdinPlaybackProcessor",x);})();\n';var tx=new g.Strand;function Cx(r,A,x,F,D=e.DefaultRefreshRate){return tx.enqueue(async()=>{let[B,j]=await q(G,h,r,"OdinCaptureProcessor",{channelCount:1,numberOfInputs:1,numberOfOutputs:0});return console.warn("SharedArrayBuffer is not available; creating ODIN CaptureWorker in fallback mode"),i.create(r,A,x,D,B,j,F)})}async function Ex(r,A=e.DefaultRefreshRate){if(r.sampleRate!==48e3)throw new Error("playback sample rate must be 48kHz ");let[x,F]=await q(G,h,r,"OdinPlaybackProcessor",{numberOfInputs:0,numberOfOutputs:1,outputChannelCount:[2]});return o.create(r,A,x,F)}var i=class r extends l{constructor(x,F,D,B,j){super(x,F,D,B,j);this._Activity=c;this._SpeechProbability=0;F.addEventListener("message",this._OnMessages.bind(this))}static async create(x,F,D,B,j,t,L){let{port1:p,port2:m}=new MessageChannel;return v(j,["captureInit",{sampleRate:x.sampleRate,refreshRate:B,workletPort:p}],[p]),await u(j,"captureReady"),v(t.port,["init",{workerPort:m}],[m]),new r(t,j,F,D,L)}get activity(){return this._Activity}get speechProbability(){return this._SpeechProbability}setVolume(x){v(this.worker,["captureSetVolume",{value:x}])}_OnMessages(x){super._OnMessages(x);let[F,D]=x.data;F==="captureUpdate"&&(this._Activity={isSilent:!D.active,rmsDBFS:D.rmsDBFs},this._SpeechProbability=D.speechProbability)}},o=class r extends s{constructor(x,F,D){super(x,F,D);this.activities=new Float32Array;this.jitterStats=[]}static async create(x,F,D,B){let{port1:j,port2:t}=new MessageChannel;return v(D,["playbackInit",{workletPort:j,refreshRate:F}],[j]),await u(D,"playbackReady"),v(B.port,["init",{workerPort:t}],[t]),B.connect(x.destination),new r(x,B,D)}getActivity(x){let F=this.medias.get(E(x));if(F===void 0)return;let D=this.activities.at(F.index);if(D!==void 0)return D===0?c:{isSilent:!1,rmsDBFS:D}}getJitterStats(x){let F=this.medias.get(E(x));if(F===void 0)return;let D=this.jitterStats.at(F.index);if(D!==void 0)return D}setGlobalVolume(x){v(this.worker,["playbackSetVolume",{index:"global",value:x}])}setVolume(x,F){let D=this.medias.get(E(x));D!==void 0&&v(this.worker,["playbackSetVolume",{index:D.index,value:F}])}_GetFreeIndex(){let x=super._GetFreeIndex();if(x!==void 0)return x;if(this.medias.size<e.MaxNumberOfDecoders)return this.medias.size}_OnMessages(x){super._OnMessages(x);let[F,D]=x.data;F==="playbackUpdate"&&(this.activities=D.activities,this.jitterStats=D.jitterStats)}};0&&(module.exports={UnsharedCaptureWorker,UnsharedPlaybackWorker,createCaptureWorker,createPlaybackWorker});
3190
+ \`,new Function(m,C)}function SA(j,r,s,l,o,a){var k=r.length;k<2&&G("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var u=r[1]!==null&&s!==null,c=Jr(r),C=!r[0].isVoid,f=r[0],m=r[1],E=[j,G,l,o,Br,f.fromWireType.bind(f),m?.toWireType.bind(m)],h=2;h<k;++h){var $=r[h];E.push($.toWireType.bind($))}if(!c)for(var h=u?1:2;h<r.length;++h)r[h].destructorFunction!==null&&E.push(r[h].destructorFunction);var J=$t(r,u,C,a)(...E);return Hr(j,J)}var Ft=(j,r,s,l,o,a)=>{var k=VA(r,s);o=N(l,o),w([],[j],u=>{u=u[0];var c=\`constructor \${u.name}\`;if(u.registeredClass.constructor_body===void 0&&(u.registeredClass.constructor_body=[]),u.registeredClass.constructor_body[r-1]!==void 0)throw new AA(\`Cannot register multiple constructors with identical number of parameters (\${r-1}) for class '\${u.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!\`);return u.registeredClass.constructor_body[r-1]=()=>{Q(\`Cannot construct \${u.name} due to unbound types\`,k)},w([],k,C=>(C.splice(1,0,null),u.registeredClass.constructor_body[r-1]=SA(c,C,null,o,a),[])),[]})},br=j=>{j=j.trim();let r=j.indexOf("(");return r===-1?j:j.slice(0,r)},vt=(j,r,s,l,o,a,k,u,c,C)=>{var f=VA(s,l);r=v(r),r=br(r),a=N(o,a,c),w([],[j],m=>{m=m[0];var E=\`\${m.name}.\${r}\`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),u&&m.registeredClass.pureVirtualFunctions.push(r);function h(){Q(\`Cannot call \${E} due to unbound types\`,f)}var $=m.registeredClass.instancePrototype,H=$[r];return H===void 0||H.overloadTable===void 0&&H.className!==m.name&&H.argCount===s-2?(h.argCount=s-2,h.className=m.name,$[r]=h):(_r($,r,E),$[r].overloadTable[s-2]=h),w([],f,J=>{var y=SA(E,J,m,a,k,c);return $[r].overloadTable===void 0?(y.argCount=s-2,$[r]=y):$[r].overloadTable[s-2]=y,[]}),[]})},Or=(j,r,s)=>(j instanceof Object||G(\`\${s} with invalid "this": \${j}\`),j instanceof r.registeredClass.constructor||G(\`\${s} incompatible with "this" of type \${j.constructor.name}\`),j.$$.ptr||G(\`cannot call emscripten binding method \${s} on deleted object\`),fA(j.$$.ptr,j.$$.ptrType.registeredClass,r.registeredClass)),Lt=(j,r,s,l,o,a,k,u,c,C)=>{r=v(r),o=N(l,o),w([],[j],f=>{f=f[0];var m=\`\${f.name}.\${r}\`,E={get(){Q(\`Cannot access \${m} due to unbound types\`,[s,k])},enumerable:!0,configurable:!0};return c?E.set=()=>Q(\`Cannot access \${m} due to unbound types\`,[s,k]):E.set=h=>G(m+" is a read-only property"),Object.defineProperty(f.registeredClass.instancePrototype,r,E),w([],c?[s,k]:[s],h=>{var $=h[0],H={get(){var y=Or(this,f,m+" getter");return $.fromWireType(o(a,y))},enumerable:!0};if(c){c=N(u,c);var J=h[1];H.set=function(y){var eA=Or(this,f,m+" setter"),g=[];c(C,eA,J.toWireType(g,y)),Br(g)}}return Object.defineProperty(f.registeredClass.instancePrototype,r,H),[]}),[]})},wr=[],Y=[0,1,,1,null,1,!0,1,!1,1],gt=j=>{j>9&&--Y[j+1]===0&&(Y[j]=void 0,wr.push(j))},WA={toValue:j=>(j||G(\`Cannot use deleted val. handle = \${j}\`),Y[j]),toHandle:j=>{switch(j){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let r=wr.pop()||Y.length;return Y[r]=j,Y[r+1]=1,r}}}},Ht={name:"emscripten::val",fromWireType:j=>{var r=WA.toValue(j);return gt(j),r},toWireType:(j,r)=>WA.toHandle(r),readValueFromPointer:GA,destructorFunction:null},yt=j=>K(j,Ht),_t=(j,r)=>{switch(r){case 4:return function(s){return this.fromWireType(qr[s>>2])};case 8:return function(s){return this.fromWireType(Cr[s>>3])};default:throw new TypeError(\`invalid float width (\${r}): \${j}\`)}},Dt=(j,r,s)=>{r=v(r),K(j,{name:r,fromWireType:l=>l,toWireType:(l,o)=>o,readValueFromPointer:_t(r,s),destructorFunction:null})},xt=(j,r,s,l,o,a,k,u)=>{var c=VA(r,s);j=v(j),j=br(j),o=N(l,o,k),Dr(j,function(){Q(\`Cannot call \${j} due to unbound types\`,c)},r-1),w([],c,C=>{var f=[C[0],null].concat(C.slice(1));return Kr(j,SA(j,f,null,o,a,k),r-1),[]})},Kt=(j,r,s,l,o)=>{r=v(r);let a=l===0,k=c=>c;if(a){var u=32-8*s;k=c=>c<<u>>>u,o=k(o)}K(j,{name:r,fromWireType:k,toWireType:(c,C)=>C,readValueFromPointer:Fr(r,s,l!==0),destructorFunction:null})},Nt=(j,r,s)=>{var l=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],o=l[r];function a(k){var u=I[k>>2],c=I[k+4>>2];return new o(V.buffer,c,u)}s=v(s),K(j,{name:s,fromWireType:a,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},Bt=(j,r,s,l)=>{if(!(l>0))return 0;for(var o=s,a=s+l-1,k=0;k<j.length;++k){var u=j.codePointAt(k);if(u<=127){if(s>=a)break;r[s++]=u}else if(u<=2047){if(s+1>=a)break;r[s++]=192|u>>6,r[s++]=128|u&63}else if(u<=65535){if(s+2>=a)break;r[s++]=224|u>>12,r[s++]=128|u>>6&63,r[s++]=128|u&63}else{if(s+3>=a)break;r[s++]=240|u>>18,r[s++]=128|u>>12&63,r[s++]=128|u>>6&63,r[s++]=128|u&63,k++}}return r[s]=0,s-o},Jt=(j,r,s)=>Bt(j,_,r,s),bt=j=>{for(var r=0,s=0;s<j.length;++s){var l=j.charCodeAt(s);l<=127?r++:l<=2047?r+=2:l>=55296&&l<=57343?(r+=4,++s):r+=3}return r},Pr=globalThis.TextDecoder&&new TextDecoder,Mr=(j,r,s,l)=>{var o=r+s;if(l)return o;for(;j[r]&&!(r>=o);)++r;return r},Tr=(j,r=0,s,l)=>{var o=Mr(j,r,s,l);if(o-r>16&&j.buffer&&Pr)return Pr.decode(j.subarray(r,o));for(var a="";r<o;){var k=j[r++];if(!(k&128)){a+=String.fromCharCode(k);continue}var u=j[r++]&63;if((k&224)==192){a+=String.fromCharCode((k&31)<<6|u);continue}var c=j[r++]&63;if((k&240)==224?k=(k&15)<<12|u<<6|c:k=(k&7)<<18|u<<12|c<<6|j[r++]&63,k<65536)a+=String.fromCharCode(k);else{var C=k-65536;a+=String.fromCharCode(55296|C>>10,56320|C&1023)}}return a},Ot=(j,r,s)=>j?Tr(_,j,r,s):"",wt=(j,r)=>{r=v(r);var s=!0;K(j,{name:r,fromWireType(l){var o=I[l>>2],a=l+4,k;if(s)k=Ot(a,o,!0);else{k="";for(var u=0;u<o;++u)k+=String.fromCharCode(_[a+u])}return B(l),k},toWireType(l,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var a,k=typeof o=="string";k||ArrayBuffer.isView(o)&&o.BYTES_PER_ELEMENT==1||G("Cannot pass non-string to std::string"),s&&k?a=bt(o):a=o.length;var u=RA(4+a+1),c=u+4;if(I[u>>2]=a,k)if(s)Jt(o,c,a+1);else for(var C=0;C<a;++C){var f=o.charCodeAt(C);f>255&&(B(u),G("String has UTF-16 code units that do not fit in 8 bits")),_[c+C]=f}else _.set(o,c);return l!==null&&l.push(B,u),u},readValueFromPointer:GA,destructorFunction(l){B(l)}})},Ur=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Pt=(j,r,s)=>{var l=j>>1,o=Mr(Z,l,r/2,s);if(o-l>16&&Ur)return Ur.decode(Z.subarray(l,o));for(var a="",k=l;k<o;++k){var u=Z[k];a+=String.fromCharCode(u)}return a},Mt=(j,r,s)=>{if(s??=2147483647,s<2)return 0;s-=2;for(var l=r,o=s<j.length*2?s/2:j.length,a=0;a<o;++a){var k=j.charCodeAt(a);uA[r>>1]=k,r+=2}return uA[r>>1]=0,r-l},Tt=j=>j.length*2,Ut=(j,r,s)=>{for(var l="",o=j>>2,a=0;!(a>=r/4);a++){var k=I[o+a];if(!k&&!s)break;l+=String.fromCodePoint(k)}return l},Vt=(j,r,s)=>{if(s??=2147483647,s<4)return 0;for(var l=r,o=l+s-4,a=0;a<j.length;++a){var k=j.codePointAt(a);if(k>65535&&a++,cA[r>>2]=k,r+=4,r+4>o)break}return cA[r>>2]=0,r-l},St=j=>{for(var r=0,s=0;s<j.length;++s){var l=j.codePointAt(s);l>65535&&s++,r+=4}return r},Wt=(j,r,s)=>{s=v(s);var l,o,a;r===2?(l=Pt,o=Mt,a=Tt):(l=Ut,o=Vt,a=St),K(j,{name:s,fromWireType:k=>{var u=I[k>>2],c=l(k+4,u*r,!0);return B(k),c},toWireType:(k,u)=>{typeof u!="string"&&G(\`Cannot pass non-string to C++ string type \${s}\`);var c=a(u),C=RA(4+c+r);return I[C>>2]=c/r,o(u,C+4,c+r),k!==null&&k.push(B,C),C},readValueFromPointer:GA,destructorFunction(k){B(k)}})},Rt=(j,r)=>{r=v(r),K(j,{isVoid:!0,name:r,fromWireType:()=>{},toWireType:(s,l)=>{}})},zt=j=>{PA("OOM")},Xt=j=>{var r=_.length;j>>>=0,zt(j)},Qt=j=>52,Yt=9007199254740992,Zt=-9007199254740992,Ae=j=>j<Zt||j>Yt?NaN:Number(j);function re(j,r,s,l){return r=Ae(r),70}for(var je=[null,[],[]],te=(j,r)=>{var s=je[j];r===0||r===10?((j===1?ar:kA)(Tr(s)),s.length=0):s.push(r)},ee=(j,r,s,l)=>{for(var o=0,a=0;a<s;a++){var k=I[r>>2],u=I[r+4>>2];r+=8;for(var c=0;c<u;c++)te(j,_[k+c]);o+=u}return I[l>>2]=o,0},jA=new Uint8Array(123),P=25;P>=0;--P)jA[48+P]=52+P,jA[65+P]=P,jA[97+P]=26+P;if(jA[43]=62,jA[47]=63,st(),pt(),e.noExitRuntime&&(zj=e.noExitRuntime),e.print&&(ar=e.print),e.printErr&&(kA=e.printErr),e.wasmBinary&&(kr=e.wasmBinary),e.arguments&&(p=e.arguments),e.thisProgram&&(F=e.thisProgram),e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.shift()();var Vr,RA,B,ne,se,Sr,Wr;function ie(j){Vr=j.w,RA=e._malloc=j.y,B=e._free=j.z,ne=Sr=j.u,se=Wr=j.x}var le={g:Yj,r:Zj,f:rt,l:jt,k:Et,j:Ft,d:vt,a:Lt,s:yt,i:Dt,n:xt,c:Kt,b:Nt,t:wt,e:Wt,m:Rt,o:Xt,q:Qt,p:re,h:ee};function oe(){bj();function j(){e.calledRun=!0,!ur&&(Oj(),cr?.(e),e.onRuntimeInitialized?.(),wj())}e.setStatus?(e.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>e.setStatus(""),1),j()},1)):j()}var tA;return tA=await Sj(),oe(),pr?t=e:t=new Promise((j,r)=>{cr=j,dr=r}),t}})();typeof yj=="object"&&typeof OA=="object"?(OA.exports=sr,OA.exports.default=sr):typeof define=="function"&&define.amd&&define([],()=>sr)});var M={};fe(M,{AdditionalCaptureBlocks:()=>me,AdditionalPlaybackBlocks:()=>he,ClockJumpCheckInterval:()=>ge,ClockJumpThreshold:()=>He,ConnectInterval:()=>Je,ConnectTimeout:()=>Ke,DefaultRefreshRate:()=>Ee,DefaultVideoCodec:()=>be,HealthCheckTimeout:()=>Le,MainConnectionPingInterval:()=>ye,MaxNumberOfDecoders:()=>Fe,MinDBFs:()=>Qr,MinTokenLifetime:()=>Ne,MinTokenRefreshInterval:()=>Be,PlaybackPreload:()=>Ie,RenderQuantumSize:()=>ve,VadPreload:()=>$e,WebRtcIceTimeout:()=>De,WebRtcStatsSnapshotInterval:()=>_e,WebRtcTimeout:()=>xe});var he=3,me=3,Ie=3,Ee=250,$e=3,Fe=512,ve=128,Qr=-758.596,Le=1e4,ge=1e3,He=1e4,ye=3e3,_e=1e3,De=3e3,xe=1e4,Ke=5e3,Ne=6e4,Be=5e3,Je=[0,100,200,200,500],be="H264";function T(n,A,t){return n.postMessage(A,t)}function Yr(n){return[n.values[0],n.values[1]]}function IA(n,A){n.values[0]=A[0],n.values[1]=A[1]}function EA(n,A){return n.values[2+A*5]}function Zr(n,A,t){n.values[2+A*5]=t}function Aj(n,A){let t=2+A*5+1;return[n.values[t+0],n.values[t+1]]}function $A(n,A,t){let e=2+A*5+1;n.values[e+0]=t[0],n.values[e+1]=t[1]}function rj(n,A){return n.values[2+A*5+3]}function jj(n,A,t){n.values[2+A*5+3]=t}function tj(n,A){return n.values[2+A*5+4]}function ej(n,A,t){n.values[2+A*5+4]=t}function FA(n){return n.values[0]!==0}function vA(n){return n.values[1]}function LA(n){return n.values[2]}function nj(n){return n.values[3]}function gA(n,A){return n.values[3]=A}function sj(n){return n?Array.from(n).map(A=>A.toString(16).padStart(2,"0")).join(""):null}var Oe;(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||={})})(Oe||={});function kj(n){return{type:"Success",value:n}}function D(n){return{type:"Failure",reason:n}}var{Deno:ij}=globalThis,we=typeof ij?.noColor=="boolean"?ij.noColor:!1,Pe=!we;function YA(n,A){return{open:\`\\x1B[\${n.join(";")}m\`,close:\`\\x1B[\${A}m\`,regexp:new RegExp(\`\\\\x1b\\\\[\${A}m\`,"g")}}function ZA(n,A){return Pe?\`\${A.open}\${n.replace(A.regexp,A.open)}\${A.close}\`:n}function QA(n){return ZA(n,YA([0],0))}function lj(n){return ZA(n,YA([1],22))}function Me(n){return ZA(n,YA([2],22))}var Jn=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"),Te=new Date,HA=(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))(HA||{}),uj={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},Ue={4:Me,3:QA,2:QA,1:lj,0:lj};function Ve({message:n}){return String(n)}function oj(n){return JSON.stringify({timestamp:n.date.toISOString(),level:HA[n.level],message:n.message,extra:n.extra})}function aj(n){function A(q,p){return[Math.floor(q/p),q%p]}function t(){let q,p=n.date.valueOf()-Te.valueOf();[p,q]=A(p,1e3);let[F,x]=A(p,60);return\`\${F.toString().padStart(4,"0")}:\${x.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=uj[n.level],d=n.logger.name!==void 0?\`@\${n.logger.name}\`:"";return\`\${QA(t())}\${d} \${i} \${Ue[n.level](String(n.message))}\${e()}\`}function Se(n){let A=\`[\${n.date.toISOString()}]\`,t=\`[\${HA[n.level]}]\`,e=n.logger.name!==void 0?\`[\${n.logger.name}] \`:"",i=uj[n.level];return\`\${A} \${i} \${t.padEnd(7," ")} \${e}\${n.message}\`}function We(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var cj=class{static sparse=Ve;static json=oj;static pretty=aj;static structured=Se;static default=We()?aj:oj;constructor(){}},Re=class{formatter;consoleObject;filter;constructor(n=cj.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 S=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)},nA=new S(3,void 0,[new Re]),ze=S.prototype.log.bind(nA,1),Xe=S.prototype.log.bind(nA,2),dj=S.prototype.log.bind(nA,3),Qe=S.prototype.log.bind(nA,4),bn=S.prototype.log.bind(nA);var qj;function Cj(n,...A){let t=Ye(A);qj?qj?.info(n,t):dj(n,t)}function Ye(...n){if(n.length===1&&typeof n[0]=="object"&&n[0]!==null)return{...n[0]};if(n.length>0)return{args:n}}function yA(n){return n.connectionId*4294967296+n.mediaId}function fj(n){return{mediaId:n%4294967296,connectionId:Math.floor(n/4294967296)}}function b(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 W(n,A){n._free(A.byteOffset)}function Gj(n,A){return{values:b(n,"f32",2+A*5),length:A}}function pj(n,A){W(n,A.values)}function hj(n){return{values:b(n,"f32",4)}}function mj(n,A){W(n,A.values)}function Ij(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 Ze(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 p=n.charCodeAt(d);(p&64512)===56320&&(++d,q=((q&1023)<<10)+(p&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 An=new TextEncoder,rn=50;function jn(n,A,t){An.encodeInto(n,A.subarray(t))}function Ej(n,A,t){n.length>rn?jn(n,A,t):Ze(n,A,t)}var tn=4096;function Ar(n,A,t){let e=A,i=e+t,d=[],q="";for(;e<i;){let p=n[e++];if((p&128)===0)d.push(p);else if((p&224)===192){let F=n[e++]&63;d.push((p&31)<<6|F)}else if((p&240)===224){let F=n[e++]&63,x=n[e++]&63;d.push((p&31)<<12|F<<6|x)}else if((p&248)===240){let F=n[e++]&63,x=n[e++]&63,wA=n[e++]&63,O=(p&7)<<18|F<<12|x<<6|wA;O>65535&&(O-=65536,d.push(O>>>10&1023|55296),O=56320|O&1023),d.push(O)}else d.push(p);d.length>=tn&&(q+=String.fromCharCode(...d),d.length=0)}return d.length>0&&(q+=String.fromCharCode(...d)),q}var en=new TextDecoder,nn=200;function sn(n,A,t){let e=n.subarray(A,A+t);return en.decode(e)}function $j(n,A,t){return t>nn?sn(n,A,t):Ar(n,A,t)}var R=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 Fj(n,A,t){let e=t/4294967296,i=t;n.setUint32(A,e),n.setUint32(A+4,i)}function _A(n,A,t){let e=Math.floor(t/4294967296),i=t;n.setUint32(A,e),n.setUint32(A+4,i)}function DA(n,A){let t=n.getInt32(A),e=n.getUint32(A+4);return t*4294967296+e}function vj(n,A){let t=n.getUint32(A),e=n.getUint32(A+4);return t*4294967296+e}var ln=-1,on=4294967296-1,an=17179869184-1;function kn({sec:n,nsec:A}){if(n>=0&&A>=0&&n<=an)if(A===0&&n<=on){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),_A(e,4,n),t}}function un(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 cn(n){if(n instanceof Date){let A=un(n);return kn(A)}else return null}function dn(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=DA(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 qn(n){let A=dn(n);return new Date(A.sec*1e3+A.nsec/1e6)}var Lj={type:ln,encode:cn,decode:qn};var U=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Lj)}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 R(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 R(q,d)}}}return A instanceof R?A:null}decode(A,t,e){let i=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return i?i(A,t,e):new R(t,A)}};U.defaultCodec=new U;function Cn(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}function sA(n){return n instanceof Uint8Array?n:ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):Cn(n)?new Uint8Array(n):Uint8Array.from(n)}var fn=100,Gn=2048,xA=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??fn,this.initialBufferSize=A?.initialBufferSize??Gn,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=Ij(A);this.ensureBufferSizeToWrite(5+e),this.writeStringHeader(e),Ej(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=sA(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),Fj(this.view,this.pos,A),this.pos+=8}writeI64(A){this.ensureBufferSizeToWrite(8),_A(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 rr(n,A){return new xA(A).encodeSharedRef(n)}function KA(n){return\`\${n<0?"-":""}0x\${Math.abs(n).toString(16).padStart(2,"0")}\`}var pn=16,hn=16,NA=class{constructor(A=pn,t=hn){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 p=0;p<e;p++)if(q[p]!==A[t+p])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=Ar(A,t,e),q=Uint8Array.prototype.slice.call(A,t,t+e);return this.store(q,d),d}};var jr="array",oA="map_key",Hj="map_value",mn=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)},tr=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=jr,t.position=0,t.size=A,t.array=new Array(A)}pushMapState(A){let t=this.getUninitializedStateFromPool();t.type=oA,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===jr){let e=A;e.size=0,e.array=void 0,e.position=0,e.type=void 0}if(A.type===oA||A.type===Hj){let e=A;e.size=0,e.map=void 0,e.readCount=0,e.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},lA=-1,er=new DataView(new ArrayBuffer(0)),In=new Uint8Array(er.buffer);try{er.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 gj=new RangeError("Insufficient data"),En=new NA,BA=class n{constructor(A){this.totalPos=0,this.pos=0,this.view=er,this.bytes=In,this.headByte=lA,this.stack=new tr,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:En,this.mapKeyConverter=A?.mapKeyConverter??mn}clone(){return new n({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=lA,this.stack.reset()}setBuffer(A){let t=sA(A);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(A){if(this.headByte===lA&&!this.hasRemaining(1))this.setBuffer(A);else{let t=this.bytes.subarray(this.pos),e=sA(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 p of A){if(t)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(p);try{e=this.doDecodeSync(),t=!0}catch(F){if(!(F instanceof RangeError))throw F}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 \${KA(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: \${KA(A)}\`);this.complete();let e=this.stack;for(;e.length>0;){let i=e.top();if(i.type===jr)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===oA){if(t==="__proto__")throw new L("The key __proto__ is not allowed");i.key=this.mapKeyConverter(t),i.type=Hj;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=oA;continue A}}return t}}readHeadByte(){return this.headByte===lA&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=lA}readArraySize(){let A=this.readHeadByte();switch(A){case 220:return this.readU16();case 221:return this.readU32();default:{if(A<160)return A-144;throw new L(\`Unrecognized array type byte: \${KA(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 gj;let e=this.pos+t,i;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(A)?i=this.keyDecoder.decode(this.bytes,e,A):i=$j(this.bytes,e,A),this.pos+=t+A,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===oA:!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 gj;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=vj(this.view,this.pos);return this.pos+=8,A}readI64(){let A=DA(this.view,this.pos);return this.pos+=8,A}readU64AsBigInt(){let A=this.view.getBigUint64(this.pos);return this.pos+=8,A}readI64AsBigInt(){let A=this.view.getBigInt64(this.pos);return this.pos+=8,A}readF32(){let A=this.view.getFloat32(this.pos);return this.pos+=4,A}readF64(){let A=this.view.getFloat64(this.pos);return this.pos+=8,A}};function nr(n,A){return new BA(A).decode(n)}var aA=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=nr(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(x=>typeof x=="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,p=(t[4]&1)!==0,F=t[t.length-1];return F instanceof Uint8Array?kj(new n(e,i,d,p,F)):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(rr(t,{forceFloat32:!0,ignoreUndefined:!0}))}};var JA=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,M.VadPreload),this.encoder.complexity=navigator.hardwareConcurrency>=4?6:4,this.information=hj(this.wasm),this.outBuffer=b(this.wasm,"u8",1270),gA(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(){mj(this.wasm,this.information),W(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){Cj(\`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 aA(i.mediaIds,this.sequenceNumber,this.timestamp,e,this.outBuffer.subarray(0,t));T(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:FA(this.information),speechProbability:vA(this.information),rmsDBFS:LA(this.information),volume:nj(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}}}},bA=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=b(this.wasm,"u32",M.MaxNumberOfDecoders),this.information=Gj(this.wasm,M.MaxNumberOfDecoders),IA(this.information,[1,1])}close(){pj(this.wasm,this.information);for(let{decoder:A}of this.medias.values())A.delete()}receivePacket(A,t){this.stats.numberPackets++;let e=aA.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(yA({connectionId:A,mediaId:i}));if(d===void 0){this.stats.numberPacketsMediaNotFound++;continue}d.lastPacket=t;let q=b(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=yA({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),$A(this.information,A,i),ej(this.information,A,0),jj(this.information,A,0)}removeMedia(A,t,e){let i=yA({connectionId:t,mediaId:e}),d=this.medias.get(i);if(!(d===void 0||d.index!==A)&&(this.medias.delete(i),Zr(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:p}of e.added)this.insertMedia(i,d,q,p);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=fj(t);A.push({index:e.index,connectionId:i.connectionId,mediaId:i.mediaId,rmsDBFS:EA(this.information,e.index),volume:Aj(this.information,e.index),voicedBlocks:tj(this.information,e.index),silentBlocks:rj(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:sj(e.lastPacket)})}return{largestIndex:this.largestIndex,globalVolume:Yr(this.information),decoders:A}}};var Nj=pe(_j()),Dj=(0,Nj.default)(),xj,Kj;globalThis.addEventListener("message",ir);async function ir(n){let A=n.data,[t,e]=A;switch(t){case"captureInit":e.workletPort.onmessage=ir,xj=new lr(e.sampleRate,await Dj,e.refreshRate);break;case"playbackInit":e.workletPort.onmessage=ir,Kj=new or(await Dj,e.workletPort,e.refreshRate);break;case"close":globalThis.close();break}xj?.onMessage(A),Kj?.onMessage(A)}var lr=class extends JA{constructor(t,e,i){super(t,e);this.sampleRate=t;this.inBuffer=b(this.wasm,"f32",t*.02),this.updateHandle=setInterval(()=>this.update(),i),T(globalThis,["captureReady",{}])}close(){super.close(),W(this.wasm,this.inBuffer),clearInterval(this.updateHandle)}onMessage(t){super.onMessage(t);let[e,i]=t;switch(e){case"captureSetVolume":this.setVolume(i.value);break;case"captureTick":this.tick(i.buffer);break}}setVolume(t){gA(this.information,t)}tick(t){this.inBuffer.set(t,0),this.encode(this.inBuffer)}update(){T(globalThis,["captureUpdate",{active:FA(this.information),rmsDBFs:LA(this.information),speechProbability:vA(this.information)}])}dump(){return{type:"unshared capture worker",sampleRate:this.sampleRate,...super.dump()}}},or=class extends bA{constructor(t,e,i){super(t);this.workletPort=e;this.id=M.PlaybackPreload,this.outBuffer=b(this.wasm,"f32",48e3*.02*2),this.updateHandle=setInterval(()=>this.update(),i),T(globalThis,["playbackReady",{}])}close(){super.close(),W(this.wasm,this.outBuffer),clearInterval(this.updateHandle)}onMessage(t){super.onMessage(t);let[e,i]=t;switch(e){case"playbackSetVolume":this.setVolume(i.index,i.value);break;case"playbackTick":this.tick();break}}setVolume(t,e){t==="global"?IA(this.information,e):$A(this.information,t,e)}tick(){this.stats.numberTicks++,this.id+=1;let{hasAudio:t}=this.decode(this.outBuffer);if(t){let e=this.outBuffer.slice();T(this.workletPort,["samples",{id:this.id,buffer:e}],[e.buffer])}}update(){let t=new Float32Array(this.information.length*2);for(let i=0;i<=this.largestIndex;i++)t[i]=EA(this.information,i);let e=[];for(let[i,d]of this.medias)e[d.index]={packetsBuffered:d.decoder.cache_length,packetsSeen:d.decoder.packets_seen,packetsProcessed:d.decoder.packets_processed,packetsTooEarly:d.decoder.packets_too_early,packetsTooLate:d.decoder.packets_too_late,packetsDropped:0,packetsInvalid:d.decoder.packets_invalid,packetsRepeated:d.decoder.packets_repeated,packetsLost:d.decoder.packets_lost};T(globalThis,["playbackUpdate",{activities:t,jitterStats:e}],[t.buffer])}dump(){return{type:"unshared playback worker",id:this.id,...super.dump()}}};})();
3191
+ `;var h='"use strict";(()=>{var P=Object.defineProperty;var M=(e,t)=>{for(var r in t)P(e,r,{get:t[r],enumerable:!0})};var u={};M(u,{AdditionalCaptureBlocks:()=>R,AdditionalPlaybackBlocks:()=>E,ClockJumpCheckInterval:()=>_,ClockJumpThreshold:()=>N,ConnectInterval:()=>Z,ConnectTimeout:()=>J,DefaultRefreshRate:()=>D,DefaultVideoCodec:()=>q,HealthCheckTimeout:()=>O,MainConnectionPingInterval:()=>W,MaxNumberOfDecoders:()=>L,MinDBFs:()=>v,MinTokenLifetime:()=>z,MinTokenRefreshInterval:()=>G,PlaybackPreload:()=>F,RenderQuantumSize:()=>V,VadPreload:()=>C,WebRtcIceTimeout:()=>j,WebRtcStatsSnapshotInterval:()=>$,WebRtcTimeout:()=>H});var E=3,R=3,F=3,D=250,C=3,L=512,V=128,v=-758.596,O=1e4,_=1e3,N=1e4,W=3e3,$=1e3,j=3e3,H=1e4,J=5e3,z=6e4,G=5e3,Z=[0,100,200,200,500],q="H264";function d(e,t,r){return e.postMessage(t,r)}var Q;(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||={})})(Q||={});var{Deno:k}=globalThis,K=typeof k?.noColor=="boolean"?k.noColor:!1,X=!K;function m(e,t){return{open:`\\x1B[${e.join(";")}m`,close:`\\x1B[${t}m`,regexp:new RegExp(`\\\\x1b\\\\[${t}m`,"g")}}function h(e,t){return X?`${t.open}${e.replace(t.regexp,t.open)}${t.close}`:e}function p(e){return h(e,m([0],0))}function U(e){return h(e,m([1],22))}function Y(e){return h(e,m([2],22))}var ke=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"),ee=new Date,f=(e=>(e[e.CRITICAL=0]="CRITICAL",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(f||{}),T={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},te={4:Y,3:p,2:p,1:U,0:U};function re({message:e}){return String(e)}function S(e){return JSON.stringify({timestamp:e.date.toISOString(),level:f[e.level],message:e.message,extra:e.extra})}function I(e){function t(c,i){return[Math.floor(c/i),c%i]}function r(){let c,i=e.date.valueOf()-ee.valueOf();[i,c]=t(i,1e3);let[B,A]=t(i,60);return`${B.toString().padStart(4,"0")}:${A.toString().padStart(2,"0")}.${c.toString().padStart(3,"0")}`}function n(){return e.extra===void 0?"":typeof Deno=="object"?" "+Deno.inspect(e.extra,{compact:!1,colors:!0,trailingComma:!0}).trimStart():" "+JSON.stringify(e.extra)}let s=T[e.level],o=e.logger.name!==void 0?`@${e.logger.name}`:"";return`${p(r())}${o} ${s} ${te[e.level](String(e.message))}${n()}`}function ne(e){let t=`[${e.date.toISOString()}]`,r=`[${f[e.level]}]`,n=e.logger.name!==void 0?`[${e.logger.name}] `:"",s=T[e.level];return`${t} ${s} ${r.padEnd(7," ")} ${n}${e.message}`}function se(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var w=class{static sparse=re;static json=S;static pretty=I;static structured=ne;static default=se()?I:S;constructor(){}},ae=class{formatter;consoleObject;filter;constructor(e=w.default,t=4,r=console){this.filter=t,this.formatter=e,this.consoleObject=r}handle(e){let t=this.formatter(e);switch(e.level){case 0:case 1:this.consoleObject.error(t);break;case 2:this.consoleObject.warn(t);break;case 3:this.consoleObject.info(t);break;case 4:this.consoleObject.debug(t);break}}};var a=class{#e;sinks;filter;parent;get name(){return this.#e}constructor(e,t=void 0,r=[],n=void 0){this.#e=t,this.sinks=r,this.filter=e,this.parent=n}log(e,t,r=void 0){let n={date:new Date,level:e,logger:this,message:t,extra:r};this.filter<e||this.insert(n)}insert(e){if(!(this.filter<e.level)){for(let t of this.sinks)t.filter>=e.level&&t.handle(e);this.parent!==void 0&&this.parent.insert(e)}}error=this.log.bind(this,1);warn=this.log.bind(this,2);info=this.log.bind(this,3);debug=this.log.bind(this,4)},l=new a(3,void 0,[new ae]),oe=a.prototype.log.bind(l,1),ie=a.prototype.log.bind(l,2),ce=a.prototype.log.bind(l,3),ue=a.prototype.log.bind(l,4),Ue=a.prototype.log.bind(l);var b=class extends AudioWorkletProcessor{constructor(){super();this.alive=!0;this.blocks=0;this.port.onmessage=this.onMessage.bind(this)}async onMessage(r){let[n,s]=r.data;switch(n){case"init":this.state=new y(s.workerPort,sampleRate*.02);break;case"close":this.alive=!1;break;case"dump":s.result.postMessage(this.dump());break}}process(r,n,s){if(this.state===void 0||r.length<1||r[0].length<1)return this.alive;let o=this.state.fill(0,r[0][0]);return this.state.offset===this.state.length&&(this.state.flush(),this.state.fill(o,r[0][0])),this.alive}dump(){return{type:"unshared capture worklet",alive:this.alive,sampleRate,offset:this.state?.offset||null,length:this.state?.length||null,blocks:this.blocks}}},x=class extends AudioWorkletProcessor{constructor(){super();this.alive=!0;this.silenceBlocks=0;this.voiceBlocks=0;this.totalBlocks=0;this.port.onmessage=this.onMessage.bind(this)}async onMessage(r){let[n,s]=r.data;switch(n){case"close":this.alive=!1;break;case"init":this.state=new g(s.workerPort,sampleRate*.02),s.workerPort.onmessage=this.onMessage.bind(this);break;case"samples":this.state?.add(s.id,s.buffer);break;case"dump":s.result.postMessage(this.dump());break}n==="close"&&(this.alive=!1)}process(r,n,s){if(this.state===void 0||n.length<1||n[0].length<2)return this.alive;let o=this.state.fill(0,n[0][0],n[0][1]);return o<u.RenderQuantumSize&&(this.totalBlocks+=1,this.state.next(),this.state.hasVoice?this.voiceBlocks+=1:this.silenceBlocks+=1,this.state.fill(o,n[0][0],n[0][1])),this.alive}dump(){return{type:"unshared playback worklet",alive:this.alive,sampleRate,id:this.state?.id||null,offset:this.state?.offset||null,length:this.state?.length||null,hasVoice:this.state?.hasVoice??!1,silenceBlocks:this.silenceBlocks,voiceBlocks:this.voiceBlocks,totalBlocks:this.totalBlocks}}},y=class{constructor(t,r){this.port=t;this.length=r;this.offset=0,this.buffer=new Float32Array(r)}fill(t,r){let n=Math.min(r.length-t,this.length-this.offset);return this.buffer.set(r.subarray(t,t+n),this.offset),this.offset+=n,t+n}flush(){d(this.port,["captureTick",{buffer:this.buffer}],[this.buffer.buffer]),this.offset=0,this.buffer=new Float32Array(this.length)}},g=class{constructor(t,r){this.port=t;this.length=r;this.cache=[];this.id=-1,this.offset=0,this.buffer=void 0,this.next()}get hasVoice(){return this.buffer!==void 0}fill(t,r,n){let s=Math.min(u.RenderQuantumSize-t,this.length-this.offset);return this.buffer!==void 0&&(r.set(this.buffer.subarray(this.offset,this.offset+s),t),n.set(this.buffer.subarray(this.offset+this.length,this.offset+this.length+s),t)),this.offset+=s,t+s}add(t,r){this.cache.push({id:t,buffer:r})}next(){for(this.id+=1;this.cache[0]?.id<this.id;)this.cache.shift();this.cache[0]?.id===this.id?(this.buffer=this.cache[0].buffer,this.cache.shift()):this.buffer=void 0,this.offset=0,d(this.port,["playbackTick",{}])}};registerProcessor("OdinCaptureProcessor",b);registerProcessor("OdinPlaybackProcessor",x);})();\n';var tx=new g.Strand;function Cx(r,A,x,F,D=e.DefaultRefreshRate){return tx.enqueue(async()=>{let[B,j]=await q(G,h,r,"OdinCaptureProcessor",{channelCount:1,numberOfInputs:1,numberOfOutputs:0});return console.warn("SharedArrayBuffer is not available; creating ODIN CaptureWorker in fallback mode"),i.create(r,A,x,D,B,j,F)})}async function Ex(r,A=e.DefaultRefreshRate){if(r.sampleRate!==48e3)throw new Error("playback sample rate must be 48kHz ");let[x,F]=await q(G,h,r,"OdinPlaybackProcessor",{numberOfInputs:0,numberOfOutputs:1,outputChannelCount:[2]});return o.create(r,A,x,F)}var i=class r extends l{constructor(x,F,D,B,j){super(x,F,D,B,j);this._Activity=c;this._SpeechProbability=0;F.addEventListener("message",this._OnMessages.bind(this))}static async create(x,F,D,B,j,t,L){let{port1:p,port2:m}=new MessageChannel;return v(j,["captureInit",{sampleRate:x.sampleRate,refreshRate:B,workletPort:p}],[p]),await u(j,"captureReady"),v(t.port,["init",{workerPort:m}],[m]),new r(t,j,F,D,L)}get activity(){return this._Activity}get speechProbability(){return this._SpeechProbability}setVolume(x){v(this.worker,["captureSetVolume",{value:x}])}_OnMessages(x){super._OnMessages(x);let[F,D]=x.data;F==="captureUpdate"&&(this._Activity={isSilent:!D.active,rmsDBFS:D.rmsDBFs},this._SpeechProbability=D.speechProbability)}},o=class r extends s{constructor(x,F,D){super(x,F,D);this.activities=new Float32Array;this.jitterStats=[]}static async create(x,F,D,B){let{port1:j,port2:t}=new MessageChannel;return v(D,["playbackInit",{workletPort:j,refreshRate:F}],[j]),await u(D,"playbackReady"),v(B.port,["init",{workerPort:t}],[t]),B.connect(x.destination),new r(x,B,D)}getActivity(x){let F=this.medias.get(E(x));if(F===void 0)return;let D=this.activities.at(F.index);if(D!==void 0)return D===0?c:{isSilent:!1,rmsDBFS:D}}getJitterStats(x){let F=this.medias.get(E(x));if(F===void 0)return;let D=this.jitterStats.at(F.index);if(D!==void 0)return D}setGlobalVolume(x){v(this.worker,["playbackSetVolume",{index:"global",value:x}])}setVolume(x,F){let D=this.medias.get(E(x));D!==void 0&&v(this.worker,["playbackSetVolume",{index:D.index,value:F}])}_GetFreeIndex(){let x=super._GetFreeIndex();if(x!==void 0)return x;if(this.medias.size<e.MaxNumberOfDecoders)return this.medias.size}_OnMessages(x){super._OnMessages(x);let[F,D]=x.data;F==="playbackUpdate"&&(this.activities=D.activities,this.jitterStats=D.jitterStats)}};0&&(module.exports={UnsharedCaptureWorker,UnsharedPlaybackWorker,createCaptureWorker,createPlaybackWorker});