@hive-p2p/browser 1.0.75 → 1.0.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/hive-p2p.min.js CHANGED
@@ -1,6 +1,6 @@
1
- var Qs=Object.create;var kn=Object.defineProperty;var bs=Object.getOwnPropertyDescriptor;var ws=Object.getOwnPropertyNames;var ms=Object.getPrototypeOf,Ss=Object.prototype.hasOwnProperty;var Le=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var pt=(a,t)=>()=>(a&&(t=a(a=0)),t);var _s=(a,t)=>()=>(t||a((t={exports:{}}).exports,t),t.exports),ke=(a,t)=>{for(var e in t)kn(a,e,{get:t[e],enumerable:!0})},Rs=(a,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ws(t))!Ss.call(a,r)&&r!==e&&kn(a,r,{get:()=>t[r],enumerable:!(n=bs(t,r))||n.enumerable});return a};var xs=(a,t,e)=>(e=a!=null?Qs(ms(a)):{},Rs(t||!a||!a.__esModule?kn(e,"default",{value:a,enumerable:!0}):e,a));var Ds={};var vr=pt(()=>{(function(a){if(typeof exports=="object"&&typeof module<"u")module.exports=a();else if(typeof define=="function"&&define.amd)define([],a);else{var t;t=typeof window>"u"?typeof global>"u"?typeof self>"u"?this:self:global:window,t.SimplePeer=a()}})(function(){var a=Math.floor,t=Math.abs,e=Math.pow;return(function(){function n(r,s,o){function f(u,E){if(!s[u]){if(!r[u]){var l=typeof Le=="function"&&Le;if(!E&&l)return l(u,!0);if(h)return h(u,!0);var y=new Error("Cannot find module '"+u+"'");throw y.code="MODULE_NOT_FOUND",y}var C=s[u]={exports:{}};r[u][0].call(C.exports,function(Q){var S=r[u][1][Q];return f(S||Q)},C,C.exports,n,r,s,o)}return s[u].exports}for(var h=typeof Le=="function"&&Le,c=0;c<o.length;c++)f(o[c]);return f}return n})()({1:[function(n,r,s){"use strict";function o(B){var p=B.length;if(0<p%4)throw new Error("Invalid string. Length must be a multiple of 4");var _=B.indexOf("=");_===-1&&(_=p);var w=_===p?0:4-_%4;return[_,w]}function f(B,p,_){return 3*(p+_)/4-_}function h(B){var p,_,w=o(B),x=w[0],v=w[1],b=new C(f(B,x,v)),m=0,N=0<v?x-4:x;for(_=0;_<N;_+=4)p=y[B.charCodeAt(_)]<<18|y[B.charCodeAt(_+1)]<<12|y[B.charCodeAt(_+2)]<<6|y[B.charCodeAt(_+3)],b[m++]=255&p>>16,b[m++]=255&p>>8,b[m++]=255&p;return v===2&&(p=y[B.charCodeAt(_)]<<2|y[B.charCodeAt(_+1)]>>4,b[m++]=255&p),v===1&&(p=y[B.charCodeAt(_)]<<10|y[B.charCodeAt(_+1)]<<4|y[B.charCodeAt(_+2)]>>2,b[m++]=255&p>>8,b[m++]=255&p),b}function c(B){return l[63&B>>18]+l[63&B>>12]+l[63&B>>6]+l[63&B]}function u(B,p,_){for(var w,x=[],v=p;v<_;v+=3)w=(16711680&B[v]<<16)+(65280&B[v+1]<<8)+(255&B[v+2]),x.push(c(w));return x.join("")}function E(B){for(var p,_=B.length,w=_%3,x=[],v=16383,b=0,m=_-w;b<m;b+=v)x.push(u(B,b,b+v>m?m:b+v));return w===1?(p=B[_-1],x.push(l[p>>2]+l[63&p<<4]+"==")):w===2&&(p=(B[_-2]<<8)+B[_-1],x.push(l[p>>10]+l[63&p>>4]+l[63&p<<2]+"=")),x.join("")}s.byteLength=function(B){var p=o(B),_=p[0],w=p[1];return 3*(_+w)/4-w},s.toByteArray=h,s.fromByteArray=E;for(var l=[],y=[],C=typeof Uint8Array>"u"?Array:Uint8Array,Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",S=0,g=Q.length;S<g;++S)l[S]=Q[S],y[Q.charCodeAt(S)]=S;y[45]=62,y[95]=63},{}],2:[function(){},{}],3:[function(n,r,s){(function(){(function(){"use strict";var o=String.fromCharCode,f=Math.min;function h(i){if(2147483647<i)throw new RangeError('The value "'+i+'" is invalid for option "size"');var A=new Uint8Array(i);return A.__proto__=c.prototype,A}function c(i,A,I){if(typeof i=="number"){if(typeof A=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return y(i)}return u(i,A,I)}function u(i,A,I){if(typeof i=="string")return C(i,A);if(ArrayBuffer.isView(i))return Q(i);if(i==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);if(F(i,ArrayBuffer)||i&&F(i.buffer,ArrayBuffer))return S(i,A,I);if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var R=i.valueOf&&i.valueOf();if(R!=null&&R!==i)return c.from(R,A,I);var U=g(i);if(U)return U;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof i[Symbol.toPrimitive]=="function")return c.from(i[Symbol.toPrimitive]("string"),A,I);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i)}function E(i){if(typeof i!="number")throw new TypeError('"size" argument must be of type number');if(0>i)throw new RangeError('The value "'+i+'" is invalid for option "size"')}function l(i,A,I){return E(i),0>=i||A===void 0?h(i):typeof I=="string"?h(i).fill(A,I):h(i).fill(A)}function y(i){return E(i),h(0>i?0:0|B(i))}function C(i,A){if((typeof A!="string"||A==="")&&(A="utf8"),!c.isEncoding(A))throw new TypeError("Unknown encoding: "+A);var I=0|p(i,A),R=h(I),U=R.write(i,A);return U!==I&&(R=R.slice(0,U)),R}function Q(i){for(var A=0>i.length?0:0|B(i.length),I=h(A),R=0;R<A;R+=1)I[R]=255&i[R];return I}function S(i,A,I){if(0>A||i.byteLength<A)throw new RangeError('"offset" is outside of buffer bounds');if(i.byteLength<A+(I||0))throw new RangeError('"length" is outside of buffer bounds');var R;return R=A===void 0&&I===void 0?new Uint8Array(i):I===void 0?new Uint8Array(i,A):new Uint8Array(i,A,I),R.__proto__=c.prototype,R}function g(i){if(c.isBuffer(i)){var A=0|B(i.length),I=h(A);return I.length===0||i.copy(I,0,0,A),I}return i.length===void 0?i.type==="Buffer"&&Array.isArray(i.data)?Q(i.data):void 0:typeof i.length!="number"||H(i.length)?h(0):Q(i)}function B(i){if(i>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|i}function p(i,A){if(c.isBuffer(i))return i.length;if(ArrayBuffer.isView(i)||F(i,ArrayBuffer))return i.byteLength;if(typeof i!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof i);var I=i.length,R=2<arguments.length&&arguments[2]===!0;if(!R&&I===0)return 0;for(var U=!1;;)switch(A){case"ascii":case"latin1":case"binary":return I;case"utf8":case"utf-8":return lt(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*I;case"hex":return I>>>1;case"base64":return yt(i).length;default:if(U)return R?-1:lt(i).length;A=(""+A).toLowerCase(),U=!0}}function _(i,A,I){var R=!1;if((A===void 0||0>A)&&(A=0),A>this.length||((I===void 0||I>this.length)&&(I=this.length),0>=I)||(I>>>=0,A>>>=0,I<=A))return"";for(i||(i="utf8");;)switch(i){case"hex":return Y(this,A,I);case"utf8":case"utf-8":return G(this,A,I);case"ascii":return P(this,A,I);case"latin1":case"binary":return K(this,A,I);case"base64":return L(this,A,I);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $(this,A,I);default:if(R)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),R=!0}}function w(i,A,I){var R=i[A];i[A]=i[I],i[I]=R}function x(i,A,I,R,U){if(i.length===0)return-1;if(typeof I=="string"?(R=I,I=0):2147483647<I?I=2147483647:-2147483648>I&&(I=-2147483648),I=+I,H(I)&&(I=U?0:i.length-1),0>I&&(I=i.length+I),I>=i.length){if(U)return-1;I=i.length-1}else if(0>I)if(U)I=0;else return-1;if(typeof A=="string"&&(A=c.from(A,R)),c.isBuffer(A))return A.length===0?-1:v(i,A,I,R,U);if(typeof A=="number")return A&=255,typeof Uint8Array.prototype.indexOf=="function"?U?Uint8Array.prototype.indexOf.call(i,A,I):Uint8Array.prototype.lastIndexOf.call(i,A,I):v(i,[A],I,R,U);throw new TypeError("val must be string, number or Buffer")}function v(i,A,I,R,U){function k(Ue,pe){return j===1?Ue[pe]:Ue.readUInt16BE(pe*j)}var j=1,tt=i.length,ut=A.length;if(R!==void 0&&(R=(R+"").toLowerCase(),R==="ucs2"||R==="ucs-2"||R==="utf16le"||R==="utf-16le")){if(2>i.length||2>A.length)return-1;j=2,tt/=2,ut/=2,I/=2}var ot;if(U){var At=-1;for(ot=I;ot<tt;ot++)if(k(i,ot)!==k(A,At===-1?0:ot-At))At!==-1&&(ot-=ot-At),At=-1;else if(At===-1&&(At=ot),ot-At+1===ut)return At*j}else for(I+ut>tt&&(I=tt-ut),ot=I;0<=ot;ot--){for(var at=!0,Ee=0;Ee<ut;Ee++)if(k(i,ot+Ee)!==k(A,Ee)){at=!1;break}if(at)return ot}return-1}function b(i,A,I,R){I=+I||0;var U=i.length-I;R?(R=+R,R>U&&(R=U)):R=U;var k=A.length;R>k/2&&(R=k/2);for(var j,tt=0;tt<R;++tt){if(j=parseInt(A.substr(2*tt,2),16),H(j))return tt;i[I+tt]=j}return tt}function m(i,A,I,R){return Nt(lt(A,i.length-I),i,I,R)}function N(i,A,I,R){return Nt(mt(A),i,I,R)}function M(i,A,I,R){return N(i,A,I,R)}function D(i,A,I,R){return Nt(yt(A),i,I,R)}function T(i,A,I,R){return Nt(Mt(A,i.length-I),i,I,R)}function L(i,A,I){return A===0&&I===i.length?V.fromByteArray(i):V.fromByteArray(i.slice(A,I))}function G(i,A,I){I=f(i.length,I);for(var R=[],U=A;U<I;){var k=i[U],j=null,tt=239<k?4:223<k?3:191<k?2:1;if(U+tt<=I){var ut,ot,At,at;tt===1?128>k&&(j=k):tt===2?(ut=i[U+1],(192&ut)==128&&(at=(31&k)<<6|63&ut,127<at&&(j=at))):tt===3?(ut=i[U+1],ot=i[U+2],(192&ut)==128&&(192&ot)==128&&(at=(15&k)<<12|(63&ut)<<6|63&ot,2047<at&&(55296>at||57343<at)&&(j=at))):tt===4&&(ut=i[U+1],ot=i[U+2],At=i[U+3],(192&ut)==128&&(192&ot)==128&&(192&At)==128&&(at=(15&k)<<18|(63&ut)<<12|(63&ot)<<6|63&At,65535<at&&1114112>at&&(j=at)))}j===null?(j=65533,tt=1):65535<j&&(j-=65536,R.push(55296|1023&j>>>10),j=56320|1023&j),R.push(j),U+=tt}return q(R)}function q(i){var A=i.length;if(A<=4096)return o.apply(String,i);for(var I="",R=0;R<A;)I+=o.apply(String,i.slice(R,R+=4096));return I}function P(i,A,I){var R="";I=f(i.length,I);for(var U=A;U<I;++U)R+=o(127&i[U]);return R}function K(i,A,I){var R="";I=f(i.length,I);for(var U=A;U<I;++U)R+=o(i[U]);return R}function Y(i,A,I){var R=i.length;(!A||0>A)&&(A=0),(!I||0>I||I>R)&&(I=R);for(var U="",k=A;k<I;++k)U+=Et(i[k]);return U}function $(i,A,I){for(var R=i.slice(A,I),U="",k=0;k<R.length;k+=2)U+=o(R[k]+256*R[k+1]);return U}function J(i,A,I){if(i%1!=0||0>i)throw new RangeError("offset is not uint");if(i+A>I)throw new RangeError("Trying to access beyond buffer length")}function X(i,A,I,R,U,k){if(!c.isBuffer(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(A>U||A<k)throw new RangeError('"value" argument is out of bounds');if(I+R>i.length)throw new RangeError("Index out of range")}function et(i,A,I,R){if(I+R>i.length)throw new RangeError("Index out of range");if(0>I)throw new RangeError("Index out of range")}function nt(i,A,I,R,U){return A=+A,I>>>=0,U||et(i,A,I,4,34028234663852886e22,-34028234663852886e22),O.write(i,A,I,R,23,4),I+4}function ct(i,A,I,R,U){return A=+A,I>>>=0,U||et(i,A,I,8,17976931348623157e292,-17976931348623157e292),O.write(i,A,I,R,52,8),I+8}function rt(i){if(i=i.split("=")[0],i=i.trim().replace(W,""),2>i.length)return"";for(;i.length%4!=0;)i+="=";return i}function Et(i){return 16>i?"0"+i.toString(16):i.toString(16)}function lt(i,A){A=A||1/0;for(var I,R=i.length,U=null,k=[],j=0;j<R;++j){if(I=i.charCodeAt(j),55295<I&&57344>I){if(!U){if(56319<I){-1<(A-=3)&&k.push(239,191,189);continue}else if(j+1===R){-1<(A-=3)&&k.push(239,191,189);continue}U=I;continue}if(56320>I){-1<(A-=3)&&k.push(239,191,189),U=I;continue}I=(U-55296<<10|I-56320)+65536}else U&&-1<(A-=3)&&k.push(239,191,189);if(U=null,128>I){if(0>(A-=1))break;k.push(I)}else if(2048>I){if(0>(A-=2))break;k.push(192|I>>6,128|63&I)}else if(65536>I){if(0>(A-=3))break;k.push(224|I>>12,128|63&I>>6,128|63&I)}else if(1114112>I){if(0>(A-=4))break;k.push(240|I>>18,128|63&I>>12,128|63&I>>6,128|63&I)}else throw new Error("Invalid code point")}return k}function mt(i){for(var A=[],I=0;I<i.length;++I)A.push(255&i.charCodeAt(I));return A}function Mt(i,A){for(var I,R,U,k=[],j=0;j<i.length&&!(0>(A-=2));++j)I=i.charCodeAt(j),R=I>>8,U=I%256,k.push(U),k.push(R);return k}function yt(i){return V.toByteArray(rt(i))}function Nt(i,A,I,R){for(var U=0;U<R&&!(U+I>=A.length||U>=i.length);++U)A[U+I]=i[U];return U}function F(i,A){return i instanceof A||i!=null&&i.constructor!=null&&i.constructor.name!=null&&i.constructor.name===A.name}function H(i){return i!==i}var V=n("base64-js"),O=n("ieee754");s.Buffer=c,s.SlowBuffer=function(i){return+i!=i&&(i=0),c.alloc(+i)},s.INSPECT_MAX_BYTES=50,s.kMaxLength=2147483647,c.TYPED_ARRAY_SUPPORT=(function(){try{var i=new Uint8Array(1);return i.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},i.foo()===42}catch{return!1}})(),c.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){return c.isBuffer(this)?this.buffer:void 0}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){return c.isBuffer(this)?this.byteOffset:void 0}}),typeof Symbol<"u"&&Symbol.species!=null&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),c.poolSize=8192,c.from=function(i,A,I){return u(i,A,I)},c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,c.alloc=function(i,A,I){return l(i,A,I)},c.allocUnsafe=function(i){return y(i)},c.allocUnsafeSlow=function(i){return y(i)},c.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==c.prototype},c.compare=function(i,A){if(F(i,Uint8Array)&&(i=c.from(i,i.offset,i.byteLength)),F(A,Uint8Array)&&(A=c.from(A,A.offset,A.byteLength)),!c.isBuffer(i)||!c.isBuffer(A))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(i===A)return 0;for(var I=i.length,R=A.length,U=0,k=f(I,R);U<k;++U)if(i[U]!==A[U]){I=i[U],R=A[U];break}return I<R?-1:R<I?1:0},c.isEncoding=function(i){switch((i+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(i,A){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return c.alloc(0);var I;if(A===void 0)for(A=0,I=0;I<i.length;++I)A+=i[I].length;var R=c.allocUnsafe(A),U=0;for(I=0;I<i.length;++I){var k=i[I];if(F(k,Uint8Array)&&(k=c.from(k)),!c.isBuffer(k))throw new TypeError('"list" argument must be an Array of Buffers');k.copy(R,U),U+=k.length}return R},c.byteLength=p,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var i=this.length;if(i%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var A=0;A<i;A+=2)w(this,A,A+1);return this},c.prototype.swap32=function(){var i=this.length;if(i%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var A=0;A<i;A+=4)w(this,A,A+3),w(this,A+1,A+2);return this},c.prototype.swap64=function(){var i=this.length;if(i%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var A=0;A<i;A+=8)w(this,A,A+7),w(this,A+1,A+6),w(this,A+2,A+5),w(this,A+3,A+4);return this},c.prototype.toString=function(){var i=this.length;return i===0?"":arguments.length===0?G(this,0,i):_.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(i){if(!c.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i||c.compare(this,i)===0},c.prototype.inspect=function(){var i="",A=s.INSPECT_MAX_BYTES;return i=this.toString("hex",0,A).replace(/(.{2})/g,"$1 ").trim(),this.length>A&&(i+=" ... "),"<Buffer "+i+">"},c.prototype.compare=function(i,A,I,R,U){if(F(i,Uint8Array)&&(i=c.from(i,i.offset,i.byteLength)),!c.isBuffer(i))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof i);if(A===void 0&&(A=0),I===void 0&&(I=i?i.length:0),R===void 0&&(R=0),U===void 0&&(U=this.length),0>A||I>i.length||0>R||U>this.length)throw new RangeError("out of range index");if(R>=U&&A>=I)return 0;if(R>=U)return-1;if(A>=I)return 1;if(A>>>=0,I>>>=0,R>>>=0,U>>>=0,this===i)return 0;for(var k=U-R,j=I-A,tt=f(k,j),ut=this.slice(R,U),ot=i.slice(A,I),At=0;At<tt;++At)if(ut[At]!==ot[At]){k=ut[At],j=ot[At];break}return k<j?-1:j<k?1:0},c.prototype.includes=function(i,A,I){return this.indexOf(i,A,I)!==-1},c.prototype.indexOf=function(i,A,I){return x(this,i,A,I,!0)},c.prototype.lastIndexOf=function(i,A,I){return x(this,i,A,I,!1)},c.prototype.write=function(i,A,I,R){if(A===void 0)R="utf8",I=this.length,A=0;else if(I===void 0&&typeof A=="string")R=A,I=this.length,A=0;else if(isFinite(A))A>>>=0,isFinite(I)?(I>>>=0,R===void 0&&(R="utf8")):(R=I,I=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var U=this.length-A;if((I===void 0||I>U)&&(I=U),0<i.length&&(0>I||0>A)||A>this.length)throw new RangeError("Attempt to write outside buffer bounds");R||(R="utf8");for(var k=!1;;)switch(R){case"hex":return b(this,i,A,I);case"utf8":case"utf-8":return m(this,i,A,I);case"ascii":return N(this,i,A,I);case"latin1":case"binary":return M(this,i,A,I);case"base64":return D(this,i,A,I);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,i,A,I);default:if(k)throw new TypeError("Unknown encoding: "+R);R=(""+R).toLowerCase(),k=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},c.prototype.slice=function(i,A){var I=this.length;i=~~i,A=A===void 0?I:~~A,0>i?(i+=I,0>i&&(i=0)):i>I&&(i=I),0>A?(A+=I,0>A&&(A=0)):A>I&&(A=I),A<i&&(A=i);var R=this.subarray(i,A);return R.__proto__=c.prototype,R},c.prototype.readUIntLE=function(i,A,I){i>>>=0,A>>>=0,I||J(i,A,this.length);for(var R=this[i],U=1,k=0;++k<A&&(U*=256);)R+=this[i+k]*U;return R},c.prototype.readUIntBE=function(i,A,I){i>>>=0,A>>>=0,I||J(i,A,this.length);for(var R=this[i+--A],U=1;0<A&&(U*=256);)R+=this[i+--A]*U;return R},c.prototype.readUInt8=function(i,A){return i>>>=0,A||J(i,1,this.length),this[i]},c.prototype.readUInt16LE=function(i,A){return i>>>=0,A||J(i,2,this.length),this[i]|this[i+1]<<8},c.prototype.readUInt16BE=function(i,A){return i>>>=0,A||J(i,2,this.length),this[i]<<8|this[i+1]},c.prototype.readUInt32LE=function(i,A){return i>>>=0,A||J(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+16777216*this[i+3]},c.prototype.readUInt32BE=function(i,A){return i>>>=0,A||J(i,4,this.length),16777216*this[i]+(this[i+1]<<16|this[i+2]<<8|this[i+3])},c.prototype.readIntLE=function(i,A,I){i>>>=0,A>>>=0,I||J(i,A,this.length);for(var R=this[i],U=1,k=0;++k<A&&(U*=256);)R+=this[i+k]*U;return U*=128,R>=U&&(R-=e(2,8*A)),R},c.prototype.readIntBE=function(i,A,I){i>>>=0,A>>>=0,I||J(i,A,this.length);for(var R=A,U=1,k=this[i+--R];0<R&&(U*=256);)k+=this[i+--R]*U;return U*=128,k>=U&&(k-=e(2,8*A)),k},c.prototype.readInt8=function(i,A){return i>>>=0,A||J(i,1,this.length),128&this[i]?-1*(255-this[i]+1):this[i]},c.prototype.readInt16LE=function(i,A){i>>>=0,A||J(i,2,this.length);var I=this[i]|this[i+1]<<8;return 32768&I?4294901760|I:I},c.prototype.readInt16BE=function(i,A){i>>>=0,A||J(i,2,this.length);var I=this[i+1]|this[i]<<8;return 32768&I?4294901760|I:I},c.prototype.readInt32LE=function(i,A){return i>>>=0,A||J(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},c.prototype.readInt32BE=function(i,A){return i>>>=0,A||J(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},c.prototype.readFloatLE=function(i,A){return i>>>=0,A||J(i,4,this.length),O.read(this,i,!0,23,4)},c.prototype.readFloatBE=function(i,A){return i>>>=0,A||J(i,4,this.length),O.read(this,i,!1,23,4)},c.prototype.readDoubleLE=function(i,A){return i>>>=0,A||J(i,8,this.length),O.read(this,i,!0,52,8)},c.prototype.readDoubleBE=function(i,A){return i>>>=0,A||J(i,8,this.length),O.read(this,i,!1,52,8)},c.prototype.writeUIntLE=function(i,A,I,R){if(i=+i,A>>>=0,I>>>=0,!R){var U=e(2,8*I)-1;X(this,i,A,I,U,0)}var k=1,j=0;for(this[A]=255&i;++j<I&&(k*=256);)this[A+j]=255&i/k;return A+I},c.prototype.writeUIntBE=function(i,A,I,R){if(i=+i,A>>>=0,I>>>=0,!R){var U=e(2,8*I)-1;X(this,i,A,I,U,0)}var k=I-1,j=1;for(this[A+k]=255&i;0<=--k&&(j*=256);)this[A+k]=255&i/j;return A+I},c.prototype.writeUInt8=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,1,255,0),this[A]=255&i,A+1},c.prototype.writeUInt16LE=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,2,65535,0),this[A]=255&i,this[A+1]=i>>>8,A+2},c.prototype.writeUInt16BE=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,2,65535,0),this[A]=i>>>8,this[A+1]=255&i,A+2},c.prototype.writeUInt32LE=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,4,4294967295,0),this[A+3]=i>>>24,this[A+2]=i>>>16,this[A+1]=i>>>8,this[A]=255&i,A+4},c.prototype.writeUInt32BE=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,4,4294967295,0),this[A]=i>>>24,this[A+1]=i>>>16,this[A+2]=i>>>8,this[A+3]=255&i,A+4},c.prototype.writeIntLE=function(i,A,I,R){if(i=+i,A>>>=0,!R){var U=e(2,8*I-1);X(this,i,A,I,U-1,-U)}var k=0,j=1,tt=0;for(this[A]=255&i;++k<I&&(j*=256);)0>i&&tt===0&&this[A+k-1]!==0&&(tt=1),this[A+k]=255&(i/j>>0)-tt;return A+I},c.prototype.writeIntBE=function(i,A,I,R){if(i=+i,A>>>=0,!R){var U=e(2,8*I-1);X(this,i,A,I,U-1,-U)}var k=I-1,j=1,tt=0;for(this[A+k]=255&i;0<=--k&&(j*=256);)0>i&&tt===0&&this[A+k+1]!==0&&(tt=1),this[A+k]=255&(i/j>>0)-tt;return A+I},c.prototype.writeInt8=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,1,127,-128),0>i&&(i=255+i+1),this[A]=255&i,A+1},c.prototype.writeInt16LE=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,2,32767,-32768),this[A]=255&i,this[A+1]=i>>>8,A+2},c.prototype.writeInt16BE=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,2,32767,-32768),this[A]=i>>>8,this[A+1]=255&i,A+2},c.prototype.writeInt32LE=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,4,2147483647,-2147483648),this[A]=255&i,this[A+1]=i>>>8,this[A+2]=i>>>16,this[A+3]=i>>>24,A+4},c.prototype.writeInt32BE=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,4,2147483647,-2147483648),0>i&&(i=4294967295+i+1),this[A]=i>>>24,this[A+1]=i>>>16,this[A+2]=i>>>8,this[A+3]=255&i,A+4},c.prototype.writeFloatLE=function(i,A,I){return nt(this,i,A,!0,I)},c.prototype.writeFloatBE=function(i,A,I){return nt(this,i,A,!1,I)},c.prototype.writeDoubleLE=function(i,A,I){return ct(this,i,A,!0,I)},c.prototype.writeDoubleBE=function(i,A,I){return ct(this,i,A,!1,I)},c.prototype.copy=function(i,A,I,R){if(!c.isBuffer(i))throw new TypeError("argument should be a Buffer");if(I||(I=0),R||R===0||(R=this.length),A>=i.length&&(A=i.length),A||(A=0),0<R&&R<I&&(R=I),R===I||i.length===0||this.length===0)return 0;if(0>A)throw new RangeError("targetStart out of bounds");if(0>I||I>=this.length)throw new RangeError("Index out of range");if(0>R)throw new RangeError("sourceEnd out of bounds");R>this.length&&(R=this.length),i.length-A<R-I&&(R=i.length-A+I);var U=R-I;if(this===i&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(A,I,R);else if(this===i&&I<A&&A<R)for(var k=U-1;0<=k;--k)i[k+A]=this[k+I];else Uint8Array.prototype.set.call(i,this.subarray(I,R),A);return U},c.prototype.fill=function(i,A,I,R){if(typeof i=="string"){if(typeof A=="string"?(R=A,A=0,I=this.length):typeof I=="string"&&(R=I,I=this.length),R!==void 0&&typeof R!="string")throw new TypeError("encoding must be a string");if(typeof R=="string"&&!c.isEncoding(R))throw new TypeError("Unknown encoding: "+R);if(i.length===1){var U=i.charCodeAt(0);(R==="utf8"&&128>U||R==="latin1")&&(i=U)}}else typeof i=="number"&&(i&=255);if(0>A||this.length<A||this.length<I)throw new RangeError("Out of range index");if(I<=A)return this;A>>>=0,I=I===void 0?this.length:I>>>0,i||(i=0);var k;if(typeof i=="number")for(k=A;k<I;++k)this[k]=i;else{var j=c.isBuffer(i)?i:c.from(i,R),tt=j.length;if(tt===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(k=0;k<I-A;++k)this[k+A]=j[k%tt]}return this};var W=/[^+/0-9A-Za-z-_]/g}).call(this)}).call(this,n("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:9}],4:[function(n,r,s){(function(o){(function(){function f(){let c;try{c=s.storage.getItem("debug")}catch{}return!c&&typeof o<"u"&&"env"in o&&(c=o.env.DEBUG),c}s.formatArgs=function(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+r.exports.humanize(this.diff),!this.useColors)return;let u="color: "+this.color;c.splice(1,0,u,"color: inherit");let E=0,l=0;c[0].replace(/%[a-zA-Z%]/g,y=>{y==="%%"||(E++,y==="%c"&&(l=E))}),c.splice(l,0,u)},s.save=function(c){try{c?s.storage.setItem("debug",c):s.storage.removeItem("debug")}catch{}},s.load=f,s.useColors=function(){return!!(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))||!(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&(typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},s.storage=(function(){try{return localStorage}catch{}})(),s.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),s.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],s.log=console.debug||console.log||(()=>{}),r.exports=n("./common")(s);let{formatters:h}=r.exports;h.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}).call(this)}).call(this,n("_process"))},{"./common":5,_process:12}],5:[function(n,r){r.exports=function(s){function o(c){function u(...y){if(!u.enabled)return;let C=u,Q=+new Date,S=Q-(E||Q);C.diff=S,C.prev=E,C.curr=Q,E=Q,y[0]=o.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let g=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(p,_)=>{if(p==="%%")return"%";g++;let w=o.formatters[_];if(typeof w=="function"){let x=y[g];p=w.call(C,x),y.splice(g,1),g--}return p}),o.formatArgs.call(C,y),(C.log||o.log).apply(C,y)}let E,l=null;return u.namespace=c,u.useColors=o.useColors(),u.color=o.selectColor(c),u.extend=f,u.destroy=o.destroy,Object.defineProperty(u,"enabled",{enumerable:!0,configurable:!1,get:()=>l===null?o.enabled(c):l,set:y=>{l=y}}),typeof o.init=="function"&&o.init(u),u}function f(c,u){let E=o(this.namespace+(typeof u>"u"?":":u)+c);return E.log=this.log,E}function h(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}return o.debug=o,o.default=o,o.coerce=function(c){return c instanceof Error?c.stack||c.message:c},o.disable=function(){let c=[...o.names.map(h),...o.skips.map(h).map(u=>"-"+u)].join(",");return o.enable(""),c},o.enable=function(c){o.save(c),o.names=[],o.skips=[];let u,E=(typeof c=="string"?c:"").split(/[\s,]+/),l=E.length;for(u=0;u<l;u++)E[u]&&(c=E[u].replace(/\*/g,".*?"),c[0]==="-"?o.skips.push(new RegExp("^"+c.substr(1)+"$")):o.names.push(new RegExp("^"+c+"$")))},o.enabled=function(c){if(c[c.length-1]==="*")return!0;let u,E;for(u=0,E=o.skips.length;u<E;u++)if(o.skips[u].test(c))return!1;for(u=0,E=o.names.length;u<E;u++)if(o.names[u].test(c))return!0;return!1},o.humanize=n("ms"),o.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(s).forEach(c=>{o[c]=s[c]}),o.names=[],o.skips=[],o.formatters={},o.selectColor=function(c){let u=0;for(let E=0;E<c.length;E++)u=(u<<5)-u+c.charCodeAt(E),u|=0;return o.colors[t(u)%o.colors.length]},o.enable(o.load()),o}},{ms:11}],6:[function(n,r){"use strict";function s(o,f){for(let h in f)Object.defineProperty(o,h,{value:f[h],enumerable:!0,configurable:!0});return o}r.exports=function(o,f,h){if(!o||typeof o=="string")throw new TypeError("Please pass an Error to err-code");h||(h={}),typeof f=="object"&&(h=f,f=""),f&&(h.code=f);try{return s(o,h)}catch{h.message=o.message,h.stack=o.stack;let u=function(){};return u.prototype=Object.create(Object.getPrototypeOf(o)),s(new u,h)}}},{}],7:[function(n,r){"use strict";function s(b){console&&console.warn&&console.warn(b)}function o(){o.init.call(this)}function f(b){if(typeof b!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof b)}function h(b){return b._maxListeners===void 0?o.defaultMaxListeners:b._maxListeners}function c(b,m,N,M){var D,T,L;if(f(N),T=b._events,T===void 0?(T=b._events=Object.create(null),b._eventsCount=0):(T.newListener!==void 0&&(b.emit("newListener",m,N.listener?N.listener:N),T=b._events),L=T[m]),L===void 0)L=T[m]=N,++b._eventsCount;else if(typeof L=="function"?L=T[m]=M?[N,L]:[L,N]:M?L.unshift(N):L.push(N),D=h(b),0<D&&L.length>D&&!L.warned){L.warned=!0;var G=new Error("Possible EventEmitter memory leak detected. "+L.length+" "+(m+" listeners added. Use emitter.setMaxListeners() to increase limit"));G.name="MaxListenersExceededWarning",G.emitter=b,G.type=m,G.count=L.length,s(G)}return b}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function E(b,m,N){var M={fired:!1,wrapFn:void 0,target:b,type:m,listener:N},D=u.bind(M);return D.listener=N,M.wrapFn=D,D}function l(b,m,N){var M=b._events;if(M===void 0)return[];var D=M[m];return D===void 0?[]:typeof D=="function"?N?[D.listener||D]:[D]:N?S(D):C(D,D.length)}function y(b){var m=this._events;if(m!==void 0){var N=m[b];if(typeof N=="function")return 1;if(N!==void 0)return N.length}return 0}function C(b,m){for(var N=Array(m),M=0;M<m;++M)N[M]=b[M];return N}function Q(b,m){for(;m+1<b.length;m++)b[m]=b[m+1];b.pop()}function S(b){for(var m=Array(b.length),N=0;N<m.length;++N)m[N]=b[N].listener||b[N];return m}function g(b,m,N){typeof b.on=="function"&&B(b,"error",m,N)}function B(b,m,N,M){if(typeof b.on=="function")M.once?b.once(m,N):b.on(m,N);else if(typeof b.addEventListener=="function")b.addEventListener(m,function D(T){M.once&&b.removeEventListener(m,D),N(T)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof b)}var p,_=typeof Reflect=="object"?Reflect:null,w=_&&typeof _.apply=="function"?_.apply:function(b,m,N){return Function.prototype.apply.call(b,m,N)};p=_&&typeof _.ownKeys=="function"?_.ownKeys:Object.getOwnPropertySymbols?function(b){return Object.getOwnPropertyNames(b).concat(Object.getOwnPropertySymbols(b))}:function(b){return Object.getOwnPropertyNames(b)};var x=Number.isNaN||function(b){return b!==b};r.exports=o,r.exports.once=function(b,m){return new Promise(function(N,M){function D(L){b.removeListener(m,T),M(L)}function T(){typeof b.removeListener=="function"&&b.removeListener("error",D),N([].slice.call(arguments))}B(b,m,T,{once:!0}),m!=="error"&&g(b,D,{once:!0})})},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var v=10;Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return v},set:function(b){if(typeof b!="number"||0>b||x(b))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+b+".");v=b}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(b){if(typeof b!="number"||0>b||x(b))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+b+".");return this._maxListeners=b,this},o.prototype.getMaxListeners=function(){return h(this)},o.prototype.emit=function(b){for(var m=[],N=1;N<arguments.length;N++)m.push(arguments[N]);var M=b==="error",D=this._events;if(D!==void 0)M=M&&D.error===void 0;else if(!M)return!1;if(M){var T;if(0<m.length&&(T=m[0]),T instanceof Error)throw T;var L=new Error("Unhandled error."+(T?" ("+T.message+")":""));throw L.context=T,L}var G=D[b];if(G===void 0)return!1;if(typeof G=="function")w(G,this,m);else for(var q=G.length,P=C(G,q),N=0;N<q;++N)w(P[N],this,m);return!0},o.prototype.addListener=function(b,m){return c(this,b,m,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(b,m){return c(this,b,m,!0)},o.prototype.once=function(b,m){return f(m),this.on(b,E(this,b,m)),this},o.prototype.prependOnceListener=function(b,m){return f(m),this.prependListener(b,E(this,b,m)),this},o.prototype.removeListener=function(b,m){var N,M,D,T,L;if(f(m),M=this._events,M===void 0)return this;if(N=M[b],N===void 0)return this;if(N===m||N.listener===m)--this._eventsCount==0?this._events=Object.create(null):(delete M[b],M.removeListener&&this.emit("removeListener",b,N.listener||m));else if(typeof N!="function"){for(D=-1,T=N.length-1;0<=T;T--)if(N[T]===m||N[T].listener===m){L=N[T].listener,D=T;break}if(0>D)return this;D===0?N.shift():Q(N,D),N.length===1&&(M[b]=N[0]),M.removeListener!==void 0&&this.emit("removeListener",b,L||m)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(b){var m,N,M;if(N=this._events,N===void 0)return this;if(N.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):N[b]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete N[b]),this;if(arguments.length===0){var D,T=Object.keys(N);for(M=0;M<T.length;++M)D=T[M],D!=="removeListener"&&this.removeAllListeners(D);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(m=N[b],typeof m=="function")this.removeListener(b,m);else if(m!==void 0)for(M=m.length-1;0<=M;M--)this.removeListener(b,m[M]);return this},o.prototype.listeners=function(b){return l(this,b,!0)},o.prototype.rawListeners=function(b){return l(this,b,!1)},o.listenerCount=function(b,m){return typeof b.listenerCount=="function"?b.listenerCount(m):y.call(b,m)},o.prototype.listenerCount=y,o.prototype.eventNames=function(){return 0<this._eventsCount?p(this._events):[]}},{}],8:[function(n,r){r.exports=function(){if(typeof globalThis>"u")return null;var s={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return s.RTCPeerConnection?s:null}},{}],9:[function(n,r,s){s.read=function(o,f,h,c,u){var E,l,y=8*u-c-1,C=(1<<y)-1,Q=C>>1,S=-7,g=h?u-1:0,B=h?-1:1,p=o[f+g];for(g+=B,E=p&(1<<-S)-1,p>>=-S,S+=y;0<S;E=256*E+o[f+g],g+=B,S-=8);for(l=E&(1<<-S)-1,E>>=-S,S+=c;0<S;l=256*l+o[f+g],g+=B,S-=8);if(E===0)E=1-Q;else{if(E===C)return l?NaN:(p?-1:1)*(1/0);l+=e(2,c),E-=Q}return(p?-1:1)*l*e(2,E-c)},s.write=function(o,f,h,c,u,E){var l,y,C,Q=Math.LN2,S=Math.log,g=8*E-u-1,B=(1<<g)-1,p=B>>1,_=u===23?e(2,-24)-e(2,-77):0,w=c?0:E-1,x=c?1:-1,v=0>f||f===0&&0>1/f?1:0;for(f=t(f),isNaN(f)||f===1/0?(y=isNaN(f)?1:0,l=B):(l=a(S(f)/Q),1>f*(C=e(2,-l))&&(l--,C*=2),f+=1<=l+p?_/C:_*e(2,1-p),2<=f*C&&(l++,C/=2),l+p>=B?(y=0,l=B):1<=l+p?(y=(f*C-1)*e(2,u),l+=p):(y=f*e(2,p-1)*e(2,u),l=0));8<=u;o[h+w]=255&y,w+=x,y/=256,u-=8);for(l=l<<u|y,g+=u;0<g;o[h+w]=255&l,w+=x,l/=256,g-=8);o[h+w-x]|=128*v}},{}],10:[function(n,r){r.exports=typeof Object.create=="function"?function(s,o){o&&(s.super_=o,s.prototype=Object.create(o.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}))}:function(s,o){if(o){s.super_=o;var f=function(){};f.prototype=o.prototype,s.prototype=new f,s.prototype.constructor=s}}},{}],11:[function(n,r){var s=Math.round;function o(E){if(E+="",!(100<E.length)){var l=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(E);if(l){var y=parseFloat(l[1]),C=(l[2]||"ms").toLowerCase();return C==="years"||C==="year"||C==="yrs"||C==="yr"||C==="y"?315576e5*y:C==="weeks"||C==="week"||C==="w"?6048e5*y:C==="days"||C==="day"||C==="d"?864e5*y:C==="hours"||C==="hour"||C==="hrs"||C==="hr"||C==="h"?36e5*y:C==="minutes"||C==="minute"||C==="mins"||C==="min"||C==="m"?6e4*y:C==="seconds"||C==="second"||C==="secs"||C==="sec"||C==="s"?1e3*y:C==="milliseconds"||C==="millisecond"||C==="msecs"||C==="msec"||C==="ms"?y:void 0}}}function f(E){var l=t(E);return 864e5<=l?s(E/864e5)+"d":36e5<=l?s(E/36e5)+"h":6e4<=l?s(E/6e4)+"m":1e3<=l?s(E/1e3)+"s":E+"ms"}function h(E){var l=t(E);return 864e5<=l?c(E,l,864e5,"day"):36e5<=l?c(E,l,36e5,"hour"):6e4<=l?c(E,l,6e4,"minute"):1e3<=l?c(E,l,1e3,"second"):E+" ms"}function c(E,l,y,C){return s(E/y)+" "+C+(l>=1.5*y?"s":"")}var u=24*(60*6e4);r.exports=function(E,l){l=l||{};var y=typeof E;if(y=="string"&&0<E.length)return o(E);if(y==="number"&&isFinite(E))return l.long?h(E):f(E);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(E))}},{}],12:[function(n,r){function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function f(_){if(y===setTimeout)return setTimeout(_,0);if((y===s||!y)&&setTimeout)return y=setTimeout,setTimeout(_,0);try{return y(_,0)}catch{try{return y.call(null,_,0)}catch{return y.call(this,_,0)}}}function h(_){if(C===clearTimeout)return clearTimeout(_);if((C===o||!C)&&clearTimeout)return C=clearTimeout,clearTimeout(_);try{return C(_)}catch{try{return C.call(null,_)}catch{return C.call(this,_)}}}function c(){B&&S&&(B=!1,S.length?g=S.concat(g):p=-1,g.length&&u())}function u(){if(!B){var _=f(c);B=!0;for(var w=g.length;w;){for(S=g,g=[];++p<w;)S&&S[p].run();p=-1,w=g.length}S=null,B=!1,h(_)}}function E(_,w){this.fun=_,this.array=w}function l(){}var y,C,Q=r.exports={};(function(){try{y=typeof setTimeout=="function"?setTimeout:s}catch{y=s}try{C=typeof clearTimeout=="function"?clearTimeout:o}catch{C=o}})();var S,g=[],B=!1,p=-1;Q.nextTick=function(_){var w=Array(arguments.length-1);if(1<arguments.length)for(var x=1;x<arguments.length;x++)w[x-1]=arguments[x];g.push(new E(_,w)),g.length!==1||B||f(u)},E.prototype.run=function(){this.fun.apply(null,this.array)},Q.title="browser",Q.browser=!0,Q.env={},Q.argv=[],Q.version="",Q.versions={},Q.on=l,Q.addListener=l,Q.once=l,Q.off=l,Q.removeListener=l,Q.removeAllListeners=l,Q.emit=l,Q.prependListener=l,Q.prependOnceListener=l,Q.listeners=function(){return[]},Q.binding=function(){throw new Error("process.binding is not supported")},Q.cwd=function(){return"/"},Q.chdir=function(){throw new Error("process.chdir is not supported")},Q.umask=function(){return 0}},{}],13:[function(n,r){(function(s){(function(){let o;r.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window>"u"?s:window):f=>(o||(o=Promise.resolve())).then(f).catch(h=>setTimeout(()=>{throw h},0))}).call(this)}).call(this,typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{}],14:[function(n,r){(function(s,o){(function(){"use strict";var f=n("safe-buffer").Buffer,h=o.crypto||o.msCrypto;r.exports=h&&h.getRandomValues?function(c,u){if(c>4294967295)throw new RangeError("requested too many random bytes");var E=f.allocUnsafe(c);if(0<c)if(65536<c)for(var l=0;l<c;l+=65536)h.getRandomValues(E.slice(l,l+65536));else h.getRandomValues(E);return typeof u=="function"?s.nextTick(function(){u(null,E)}):E}:function(){throw new Error(`Secure random number generation is not supported by this browser.
2
- Use Chrome, Firefox or Internet Explorer 11`)}}).call(this)}).call(this,n("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{_process:12,"safe-buffer":30}],15:[function(n,r){"use strict";function s(l,y){l.prototype=Object.create(y.prototype),l.prototype.constructor=l,l.__proto__=y}function o(l,y,C){function Q(g,B,p){return typeof y=="string"?y:y(g,B,p)}C||(C=Error);var S=(function(g){function B(p,_,w){return g.call(this,Q(p,_,w))||this}return s(B,g),B})(C);S.prototype.name=C.name,S.prototype.code=l,E[l]=S}function f(l,y){if(Array.isArray(l)){var C=l.length;return l=l.map(function(Q){return Q+""}),2<C?"one of ".concat(y," ").concat(l.slice(0,C-1).join(", "),", or ")+l[C-1]:C===2?"one of ".concat(y," ").concat(l[0]," or ").concat(l[1]):"of ".concat(y," ").concat(l[0])}return"of ".concat(y," ").concat(l+"")}function h(l,y,C){return l.substr(!C||0>C?0:+C,y.length)===y}function c(l,y,C){return(C===void 0||C>l.length)&&(C=l.length),l.substring(C-y.length,C)===y}function u(l,y,C){return typeof C!="number"&&(C=0),!(C+y.length>l.length)&&l.indexOf(y,C)!==-1}var E={};o("ERR_INVALID_OPT_VALUE",function(l,y){return'The value "'+y+'" is invalid for option "'+l+'"'},TypeError),o("ERR_INVALID_ARG_TYPE",function(l,y,C){var Q;typeof y=="string"&&h(y,"not ")?(Q="must not be",y=y.replace(/^not /,"")):Q="must be";var S;if(c(l," argument"))S="The ".concat(l," ").concat(Q," ").concat(f(y,"type"));else{var g=u(l,".")?"property":"argument";S='The "'.concat(l,'" ').concat(g," ").concat(Q," ").concat(f(y,"type"))}return S+=". Received type ".concat(typeof C),S},TypeError),o("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),o("ERR_METHOD_NOT_IMPLEMENTED",function(l){return"The "+l+" method is not implemented"}),o("ERR_STREAM_PREMATURE_CLOSE","Premature close"),o("ERR_STREAM_DESTROYED",function(l){return"Cannot call "+l+" after a stream was destroyed"}),o("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),o("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),o("ERR_STREAM_WRITE_AFTER_END","write after end"),o("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),o("ERR_UNKNOWN_ENCODING",function(l){return"Unknown encoding: "+l},TypeError),o("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),r.exports.codes=E},{}],16:[function(n,r){(function(s){(function(){"use strict";function o(Q){return this instanceof o?(u.call(this,Q),E.call(this,Q),this.allowHalfOpen=!0,void(Q&&(Q.readable===!1&&(this.readable=!1),Q.writable===!1&&(this.writable=!1),Q.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",f))))):new o(Q)}function f(){this._writableState.ended||s.nextTick(h,this)}function h(Q){Q.end()}var c=Object.keys||function(Q){var S=[];for(var g in Q)S.push(g);return S};r.exports=o;var u=n("./_stream_readable"),E=n("./_stream_writable");n("inherits")(o,u);for(var l,y=c(E.prototype),C=0;C<y.length;C++)l=y[C],o.prototype[l]||(o.prototype[l]=E.prototype[l]);Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(Q){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=Q,this._writableState.destroyed=Q)}})}).call(this)}).call(this,n("_process"))},{"./_stream_readable":18,"./_stream_writable":20,_process:12,inherits:10}],17:[function(n,r){"use strict";function s(f){return this instanceof s?void o.call(this,f):new s(f)}r.exports=s;var o=n("./_stream_transform");n("inherits")(s,o),s.prototype._transform=function(f,h,c){c(null,f)}},{"./_stream_transform":19,inherits:10}],18:[function(n,r){(function(s,o){(function(){"use strict";function f(i){return J.from(i)}function h(i){return J.isBuffer(i)||i instanceof X}function c(i,A,I){return typeof i.prependListener=="function"?i.prependListener(A,I):void(i._events&&i._events[A]?Array.isArray(i._events[A])?i._events[A].unshift(I):i._events[A]=[I,i._events[A]]:i.on(A,I))}function u(i,A,I){q=q||n("./_stream_duplex"),i=i||{},typeof I!="boolean"&&(I=A instanceof q),this.objectMode=!!i.objectMode,I&&(this.objectMode=this.objectMode||!!i.readableObjectMode),this.highWaterMark=Mt(this,i,"readableHighWaterMark",I),this.buffer=new Et,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=i.emitClose!==!1,this.autoDestroy=!!i.autoDestroy,this.destroyed=!1,this.defaultEncoding=i.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,i.encoding&&(!nt&&(nt=n("string_decoder/").StringDecoder),this.decoder=new nt(i.encoding),this.encoding=i.encoding)}function E(i){if(q=q||n("./_stream_duplex"),!(this instanceof E))return new E(i);var A=this instanceof q;this._readableState=new u(i,this,A),this.readable=!0,i&&(typeof i.read=="function"&&(this._read=i.read),typeof i.destroy=="function"&&(this._destroy=i.destroy)),$.call(this)}function l(i,A,I,R,U){P("readableAddChunk",A);var k=i._readableState;if(A===null)k.reading=!1,g(i,k);else{var j;if(U||(j=C(k,A)),j)O(i,j);else if(!(k.objectMode||A&&0<A.length))R||(k.reading=!1,_(i,k));else if(typeof A=="string"||k.objectMode||Object.getPrototypeOf(A)===J.prototype||(A=f(A)),R)k.endEmitted?O(i,new V):y(i,k,A,!0);else if(k.ended)O(i,new F);else{if(k.destroyed)return!1;k.reading=!1,k.decoder&&!I?(A=k.decoder.write(A),k.objectMode||A.length!==0?y(i,k,A,!1):_(i,k)):y(i,k,A,!1)}}return!k.ended&&(k.length<k.highWaterMark||k.length===0)}function y(i,A,I,R){A.flowing&&A.length===0&&!A.sync?(A.awaitDrain=0,i.emit("data",I)):(A.length+=A.objectMode?1:I.length,R?A.buffer.unshift(I):A.buffer.push(I),A.needReadable&&B(i)),_(i,A)}function C(i,A){var I;return h(A)||typeof A=="string"||A===void 0||i.objectMode||(I=new Nt("chunk",["string","Buffer","Uint8Array"],A)),I}function Q(i){return 1073741824<=i?i=1073741824:(i--,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i++),i}function S(i,A){return 0>=i||A.length===0&&A.ended?0:A.objectMode?1:i===i?(i>A.highWaterMark&&(A.highWaterMark=Q(i)),i<=A.length?i:A.ended?A.length:(A.needReadable=!0,0)):A.flowing&&A.length?A.buffer.head.data.length:A.length}function g(i,A){if(P("onEofChunk"),!A.ended){if(A.decoder){var I=A.decoder.end();I&&I.length&&(A.buffer.push(I),A.length+=A.objectMode?1:I.length)}A.ended=!0,A.sync?B(i):(A.needReadable=!1,!A.emittedReadable&&(A.emittedReadable=!0,p(i)))}}function B(i){var A=i._readableState;P("emitReadable",A.needReadable,A.emittedReadable),A.needReadable=!1,A.emittedReadable||(P("emitReadable",A.flowing),A.emittedReadable=!0,s.nextTick(p,i))}function p(i){var A=i._readableState;P("emitReadable_",A.destroyed,A.length,A.ended),!A.destroyed&&(A.length||A.ended)&&(i.emit("readable"),A.emittedReadable=!1),A.needReadable=!A.flowing&&!A.ended&&A.length<=A.highWaterMark,M(i)}function _(i,A){A.readingMore||(A.readingMore=!0,s.nextTick(w,i,A))}function w(i,A){for(;!A.reading&&!A.ended&&(A.length<A.highWaterMark||A.flowing&&A.length===0);){var I=A.length;if(P("maybeReadMore read 0"),i.read(0),I===A.length)break}A.readingMore=!1}function x(i){return function(){var A=i._readableState;P("pipeOnDrain",A.awaitDrain),A.awaitDrain&&A.awaitDrain--,A.awaitDrain===0&&Y(i,"data")&&(A.flowing=!0,M(i))}}function v(i){var A=i._readableState;A.readableListening=0<i.listenerCount("readable"),A.resumeScheduled&&!A.paused?A.flowing=!0:0<i.listenerCount("data")&&i.resume()}function b(i){P("readable nexttick read 0"),i.read(0)}function m(i,A){A.resumeScheduled||(A.resumeScheduled=!0,s.nextTick(N,i,A))}function N(i,A){P("resume",A.reading),A.reading||i.read(0),A.resumeScheduled=!1,i.emit("resume"),M(i),A.flowing&&!A.reading&&i.read(0)}function M(i){var A=i._readableState;for(P("flow",A.flowing);A.flowing&&i.read()!==null;);}function D(i,A){if(A.length===0)return null;var I;return A.objectMode?I=A.buffer.shift():!i||i>=A.length?(I=A.decoder?A.buffer.join(""):A.buffer.length===1?A.buffer.first():A.buffer.concat(A.length),A.buffer.clear()):I=A.buffer.consume(i,A.decoder),I}function T(i){var A=i._readableState;P("endReadable",A.endEmitted),A.endEmitted||(A.ended=!0,s.nextTick(L,A,i))}function L(i,A){if(P("endReadableNT",i.endEmitted,i.length),!i.endEmitted&&i.length===0&&(i.endEmitted=!0,A.readable=!1,A.emit("end"),i.autoDestroy)){var I=A._writableState;(!I||I.autoDestroy&&I.finished)&&A.destroy()}}function G(i,A){for(var I=0,R=i.length;I<R;I++)if(i[I]===A)return I;return-1}r.exports=E;var q;E.ReadableState=u;var P,K=n("events").EventEmitter,Y=function(i,A){return i.listeners(A).length},$=n("./internal/streams/stream"),J=n("buffer").Buffer,X=o.Uint8Array||function(){},et=n("util");P=et&&et.debuglog?et.debuglog("stream"):function(){};var nt,ct,rt,Et=n("./internal/streams/buffer_list"),lt=n("./internal/streams/destroy"),mt=n("./internal/streams/state"),Mt=mt.getHighWaterMark,yt=n("../errors").codes,Nt=yt.ERR_INVALID_ARG_TYPE,F=yt.ERR_STREAM_PUSH_AFTER_EOF,H=yt.ERR_METHOD_NOT_IMPLEMENTED,V=yt.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n("inherits")(E,$);var O=lt.errorOrDestroy,W=["error","close","destroy","pause","resume"];Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(i){this._readableState&&(this._readableState.destroyed=i)}}),E.prototype.destroy=lt.destroy,E.prototype._undestroy=lt.undestroy,E.prototype._destroy=function(i,A){A(i)},E.prototype.push=function(i,A){var I,R=this._readableState;return R.objectMode?I=!0:typeof i=="string"&&(A=A||R.defaultEncoding,A!==R.encoding&&(i=J.from(i,A),A=""),I=!0),l(this,i,A,!1,I)},E.prototype.unshift=function(i){return l(this,i,null,!0,!1)},E.prototype.isPaused=function(){return this._readableState.flowing===!1},E.prototype.setEncoding=function(i){nt||(nt=n("string_decoder/").StringDecoder);var A=new nt(i);this._readableState.decoder=A,this._readableState.encoding=this._readableState.decoder.encoding;for(var I=this._readableState.buffer.head,R="";I!==null;)R+=A.write(I.data),I=I.next;return this._readableState.buffer.clear(),R!==""&&this._readableState.buffer.push(R),this._readableState.length=R.length,this},E.prototype.read=function(i){P("read",i),i=parseInt(i,10);var A=this._readableState,I=i;if(i!==0&&(A.emittedReadable=!1),i===0&&A.needReadable&&((A.highWaterMark===0?0<A.length:A.length>=A.highWaterMark)||A.ended))return P("read: emitReadable",A.length,A.ended),A.length===0&&A.ended?T(this):B(this),null;if(i=S(i,A),i===0&&A.ended)return A.length===0&&T(this),null;var R=A.needReadable;P("need readable",R),(A.length===0||A.length-i<A.highWaterMark)&&(R=!0,P("length less than watermark",R)),A.ended||A.reading?(R=!1,P("reading or ended",R)):R&&(P("do read"),A.reading=!0,A.sync=!0,A.length===0&&(A.needReadable=!0),this._read(A.highWaterMark),A.sync=!1,!A.reading&&(i=S(I,A)));var U;return U=0<i?D(i,A):null,U===null?(A.needReadable=A.length<=A.highWaterMark,i=0):(A.length-=i,A.awaitDrain=0),A.length===0&&(!A.ended&&(A.needReadable=!0),I!==i&&A.ended&&T(this)),U!==null&&this.emit("data",U),U},E.prototype._read=function(){O(this,new H("_read()"))},E.prototype.pipe=function(i,A){function I(Be,Ce){P("onunpipe"),Be===At&&Ce&&Ce.hasUnpiped===!1&&(Ce.hasUnpiped=!0,U())}function R(){P("onend"),i.end()}function U(){P("cleanup"),i.removeListener("close",tt),i.removeListener("finish",ut),i.removeListener("drain",pe),i.removeListener("error",j),i.removeListener("unpipe",I),At.removeListener("end",R),At.removeListener("end",ot),At.removeListener("data",k),Nr=!0,at.awaitDrain&&(!i._writableState||i._writableState.needDrain)&&pe()}function k(Be){P("ondata");var Ce=i.write(Be);P("dest.write",Ce),Ce===!1&&((at.pipesCount===1&&at.pipes===i||1<at.pipesCount&&G(at.pipes,i)!==-1)&&!Nr&&(P("false write response, pause",at.awaitDrain),at.awaitDrain++),At.pause())}function j(Be){P("onerror",Be),ot(),i.removeListener("error",j),Y(i,"error")===0&&O(i,Be)}function tt(){i.removeListener("finish",ut),ot()}function ut(){P("onfinish"),i.removeListener("close",tt),ot()}function ot(){P("unpipe"),At.unpipe(i)}var At=this,at=this._readableState;switch(at.pipesCount){case 0:at.pipes=i;break;case 1:at.pipes=[at.pipes,i];break;default:at.pipes.push(i)}at.pipesCount+=1,P("pipe count=%d opts=%j",at.pipesCount,A);var Ee=(!A||A.end!==!1)&&i!==s.stdout&&i!==s.stderr,Ue=Ee?R:ot;at.endEmitted?s.nextTick(Ue):At.once("end",Ue),i.on("unpipe",I);var pe=x(At);i.on("drain",pe);var Nr=!1;return At.on("data",k),c(i,"error",j),i.once("close",tt),i.once("finish",ut),i.emit("pipe",At),at.flowing||(P("pipe resume"),At.resume()),i},E.prototype.unpipe=function(i){var A=this._readableState,I={hasUnpiped:!1};if(A.pipesCount===0)return this;if(A.pipesCount===1)return i&&i!==A.pipes?this:(i||(i=A.pipes),A.pipes=null,A.pipesCount=0,A.flowing=!1,i&&i.emit("unpipe",this,I),this);if(!i){var R=A.pipes,U=A.pipesCount;A.pipes=null,A.pipesCount=0,A.flowing=!1;for(var k=0;k<U;k++)R[k].emit("unpipe",this,{hasUnpiped:!1});return this}var j=G(A.pipes,i);return j===-1?this:(A.pipes.splice(j,1),A.pipesCount-=1,A.pipesCount===1&&(A.pipes=A.pipes[0]),i.emit("unpipe",this,I),this)},E.prototype.on=function(i,A){var I=$.prototype.on.call(this,i,A),R=this._readableState;return i==="data"?(R.readableListening=0<this.listenerCount("readable"),R.flowing!==!1&&this.resume()):i=="readable"&&!R.endEmitted&&!R.readableListening&&(R.readableListening=R.needReadable=!0,R.flowing=!1,R.emittedReadable=!1,P("on readable",R.length,R.reading),R.length?B(this):!R.reading&&s.nextTick(b,this)),I},E.prototype.addListener=E.prototype.on,E.prototype.removeListener=function(i,A){var I=$.prototype.removeListener.call(this,i,A);return i==="readable"&&s.nextTick(v,this),I},E.prototype.removeAllListeners=function(i){var A=$.prototype.removeAllListeners.apply(this,arguments);return(i==="readable"||i===void 0)&&s.nextTick(v,this),A},E.prototype.resume=function(){var i=this._readableState;return i.flowing||(P("resume"),i.flowing=!i.readableListening,m(this,i)),i.paused=!1,this},E.prototype.pause=function(){return P("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(P("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},E.prototype.wrap=function(i){var A=this,I=this._readableState,R=!1;for(var U in i.on("end",function(){if(P("wrapped end"),I.decoder&&!I.ended){var j=I.decoder.end();j&&j.length&&A.push(j)}A.push(null)}),i.on("data",function(j){if(P("wrapped data"),I.decoder&&(j=I.decoder.write(j)),!(I.objectMode&&j==null)&&(I.objectMode||j&&j.length)){var tt=A.push(j);tt||(R=!0,i.pause())}}),i)this[U]===void 0&&typeof i[U]=="function"&&(this[U]=(function(j){return function(){return i[j].apply(i,arguments)}})(U));for(var k=0;k<W.length;k++)i.on(W[k],this.emit.bind(this,W[k]));return this._read=function(j){P("wrapped _read",j),R&&(R=!1,i.resume())},this},typeof Symbol=="function"&&(E.prototype[Symbol.asyncIterator]=function(){return ct===void 0&&(ct=n("./internal/streams/async_iterator")),ct(this)}),Object.defineProperty(E.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(E.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(E.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(i){this._readableState&&(this._readableState.flowing=i)}}),E._fromList=D,Object.defineProperty(E.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(E.from=function(i,A){return rt===void 0&&(rt=n("./internal/streams/from")),rt(E,i,A)})}).call(this)}).call(this,n("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{"../errors":15,"./_stream_duplex":16,"./internal/streams/async_iterator":21,"./internal/streams/buffer_list":22,"./internal/streams/destroy":23,"./internal/streams/from":25,"./internal/streams/state":27,"./internal/streams/stream":28,_process:12,buffer:3,events:7,inherits:10,"string_decoder/":31,util:2}],19:[function(n,r){"use strict";function s(Q,S){var g=this._transformState;g.transforming=!1;var B=g.writecb;if(B===null)return this.emit("error",new E);g.writechunk=null,g.writecb=null,S!=null&&this.push(S),B(Q);var p=this._readableState;p.reading=!1,(p.needReadable||p.length<p.highWaterMark)&&this._read(p.highWaterMark)}function o(Q){return this instanceof o?(C.call(this,Q),this._transformState={afterTransform:s.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,Q&&(typeof Q.transform=="function"&&(this._transform=Q.transform),typeof Q.flush=="function"&&(this._flush=Q.flush)),void this.on("prefinish",f)):new o(Q)}function f(){var Q=this;typeof this._flush!="function"||this._readableState.destroyed?h(this,null,null):this._flush(function(S,g){h(Q,S,g)})}function h(Q,S,g){if(S)return Q.emit("error",S);if(g!=null&&Q.push(g),Q._writableState.length)throw new y;if(Q._transformState.transforming)throw new l;return Q.push(null)}r.exports=o;var c=n("../errors").codes,u=c.ERR_METHOD_NOT_IMPLEMENTED,E=c.ERR_MULTIPLE_CALLBACK,l=c.ERR_TRANSFORM_ALREADY_TRANSFORMING,y=c.ERR_TRANSFORM_WITH_LENGTH_0,C=n("./_stream_duplex");n("inherits")(o,C),o.prototype.push=function(Q,S){return this._transformState.needTransform=!1,C.prototype.push.call(this,Q,S)},o.prototype._transform=function(Q,S,g){g(new u("_transform()"))},o.prototype._write=function(Q,S,g){var B=this._transformState;if(B.writecb=g,B.writechunk=Q,B.writeencoding=S,!B.transforming){var p=this._readableState;(B.needTransform||p.needReadable||p.length<p.highWaterMark)&&this._read(p.highWaterMark)}},o.prototype._read=function(){var Q=this._transformState;Q.writechunk===null||Q.transforming?Q.needTransform=!0:(Q.transforming=!0,this._transform(Q.writechunk,Q.writeencoding,Q.afterTransform))},o.prototype._destroy=function(Q,S){C.prototype._destroy.call(this,Q,function(g){S(g)})}},{"../errors":15,"./_stream_duplex":16,inherits:10}],20:[function(n,r){(function(s,o){(function(){"use strict";function f(F){var H=this;this.next=null,this.entry=null,this.finish=function(){T(H,F)}}function h(F){return P.from(F)}function c(F){return P.isBuffer(F)||F instanceof K}function u(){}function E(F,H,V){L=L||n("./_stream_duplex"),F=F||{},typeof V!="boolean"&&(V=H instanceof L),this.objectMode=!!F.objectMode,V&&(this.objectMode=this.objectMode||!!F.writableObjectMode),this.highWaterMark=J(this,F,"writableHighWaterMark",V),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var O=F.decodeStrings===!1;this.decodeStrings=!O,this.defaultEncoding=F.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(W){_(H,W)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=F.emitClose!==!1,this.autoDestroy=!!F.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new f(this)}function l(F){L=L||n("./_stream_duplex");var H=this instanceof L;return H||Nt.call(l,this)?(this._writableState=new E(F,this,H),this.writable=!0,F&&(typeof F.write=="function"&&(this._write=F.write),typeof F.writev=="function"&&(this._writev=F.writev),typeof F.destroy=="function"&&(this._destroy=F.destroy),typeof F.final=="function"&&(this._final=F.final)),void q.call(this)):new l(F)}function y(F,H){var V=new mt;yt(F,V),s.nextTick(H,V)}function C(F,H,V,O){var W;return V===null?W=new lt:typeof V!="string"&&!H.objectMode&&(W=new et("chunk",["string","Buffer"],V)),!W||(yt(F,W),s.nextTick(O,W),!1)}function Q(F,H,V){return F.objectMode||F.decodeStrings===!1||typeof H!="string"||(H=P.from(H,V)),H}function S(F,H,V,O,W,i){if(!V){var A=Q(H,O,W);O!==A&&(V=!0,W="buffer",O=A)}var I=H.objectMode?1:O.length;H.length+=I;var R=H.length<H.highWaterMark;if(R||(H.needDrain=!0),H.writing||H.corked){var U=H.lastBufferedRequest;H.lastBufferedRequest={chunk:O,encoding:W,isBuf:V,callback:i,next:null},U?U.next=H.lastBufferedRequest:H.bufferedRequest=H.lastBufferedRequest,H.bufferedRequestCount+=1}else g(F,H,!1,I,O,W,i);return R}function g(F,H,V,O,W,i,A){H.writelen=O,H.writecb=A,H.writing=!0,H.sync=!0,H.destroyed?H.onwrite(new Et("write")):V?F._writev(W,H.onwrite):F._write(W,i,H.onwrite),H.sync=!1}function B(F,H,V,O,W){--H.pendingcb,V?(s.nextTick(W,O),s.nextTick(M,F,H),F._writableState.errorEmitted=!0,yt(F,O)):(W(O),F._writableState.errorEmitted=!0,yt(F,O),M(F,H))}function p(F){F.writing=!1,F.writecb=null,F.length-=F.writelen,F.writelen=0}function _(F,H){var V=F._writableState,O=V.sync,W=V.writecb;if(typeof W!="function")throw new ct;if(p(V),H)B(F,V,O,H,W);else{var i=b(V)||F.destroyed;i||V.corked||V.bufferProcessing||!V.bufferedRequest||v(F,V),O?s.nextTick(w,F,V,i,W):w(F,V,i,W)}}function w(F,H,V,O){V||x(F,H),H.pendingcb--,O(),M(F,H)}function x(F,H){H.length===0&&H.needDrain&&(H.needDrain=!1,F.emit("drain"))}function v(F,H){H.bufferProcessing=!0;var V=H.bufferedRequest;if(F._writev&&V&&V.next){var O=H.bufferedRequestCount,W=Array(O),i=H.corkedRequestsFree;i.entry=V;for(var A=0,I=!0;V;)W[A]=V,V.isBuf||(I=!1),V=V.next,A+=1;W.allBuffers=I,g(F,H,!0,H.length,W,"",i.finish),H.pendingcb++,H.lastBufferedRequest=null,i.next?(H.corkedRequestsFree=i.next,i.next=null):H.corkedRequestsFree=new f(H),H.bufferedRequestCount=0}else{for(;V;){var R=V.chunk,U=V.encoding,k=V.callback,j=H.objectMode?1:R.length;if(g(F,H,!1,j,R,U,k),V=V.next,H.bufferedRequestCount--,H.writing)break}V===null&&(H.lastBufferedRequest=null)}H.bufferedRequest=V,H.bufferProcessing=!1}function b(F){return F.ending&&F.length===0&&F.bufferedRequest===null&&!F.finished&&!F.writing}function m(F,H){F._final(function(V){H.pendingcb--,V&&yt(F,V),H.prefinished=!0,F.emit("prefinish"),M(F,H)})}function N(F,H){H.prefinished||H.finalCalled||(typeof F._final!="function"||H.destroyed?(H.prefinished=!0,F.emit("prefinish")):(H.pendingcb++,H.finalCalled=!0,s.nextTick(m,F,H)))}function M(F,H){var V=b(H);if(V&&(N(F,H),H.pendingcb===0&&(H.finished=!0,F.emit("finish"),H.autoDestroy))){var O=F._readableState;(!O||O.autoDestroy&&O.endEmitted)&&F.destroy()}return V}function D(F,H,V){H.ending=!0,M(F,H),V&&(H.finished?s.nextTick(V):F.once("finish",V)),H.ended=!0,F.writable=!1}function T(F,H,V){var O=F.entry;for(F.entry=null;O;){var W=O.callback;H.pendingcb--,W(V),O=O.next}H.corkedRequestsFree.next=F}r.exports=l;var L;l.WritableState=E;var G={deprecate:n("util-deprecate")},q=n("./internal/streams/stream"),P=n("buffer").Buffer,K=o.Uint8Array||function(){},Y=n("./internal/streams/destroy"),$=n("./internal/streams/state"),J=$.getHighWaterMark,X=n("../errors").codes,et=X.ERR_INVALID_ARG_TYPE,nt=X.ERR_METHOD_NOT_IMPLEMENTED,ct=X.ERR_MULTIPLE_CALLBACK,rt=X.ERR_STREAM_CANNOT_PIPE,Et=X.ERR_STREAM_DESTROYED,lt=X.ERR_STREAM_NULL_VALUES,mt=X.ERR_STREAM_WRITE_AFTER_END,Mt=X.ERR_UNKNOWN_ENCODING,yt=Y.errorOrDestroy;n("inherits")(l,q),E.prototype.getBuffer=function(){for(var F=this.bufferedRequest,H=[];F;)H.push(F),F=F.next;return H},(function(){try{Object.defineProperty(E.prototype,"buffer",{get:G.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Nt;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Nt=Function.prototype[Symbol.hasInstance],Object.defineProperty(l,Symbol.hasInstance,{value:function(F){return!!Nt.call(this,F)||this===l&&F&&F._writableState instanceof E}})):Nt=function(F){return F instanceof this},l.prototype.pipe=function(){yt(this,new rt)},l.prototype.write=function(F,H,V){var O=this._writableState,W=!1,i=!O.objectMode&&c(F);return i&&!P.isBuffer(F)&&(F=h(F)),typeof H=="function"&&(V=H,H=null),i?H="buffer":!H&&(H=O.defaultEncoding),typeof V!="function"&&(V=u),O.ending?y(this,V):(i||C(this,O,F,V))&&(O.pendingcb++,W=S(this,O,i,F,H,V)),W},l.prototype.cork=function(){this._writableState.corked++},l.prototype.uncork=function(){var F=this._writableState;F.corked&&(F.corked--,!F.writing&&!F.corked&&!F.bufferProcessing&&F.bufferedRequest&&v(this,F))},l.prototype.setDefaultEncoding=function(F){if(typeof F=="string"&&(F=F.toLowerCase()),!(-1<["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((F+"").toLowerCase())))throw new Mt(F);return this._writableState.defaultEncoding=F,this},Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),l.prototype._write=function(F,H,V){V(new nt("_write()"))},l.prototype._writev=null,l.prototype.end=function(F,H,V){var O=this._writableState;return typeof F=="function"?(V=F,F=null,H=null):typeof H=="function"&&(V=H,H=null),F!=null&&this.write(F,H),O.corked&&(O.corked=1,this.uncork()),O.ending||D(this,O,V),this},Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(l.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(F){this._writableState&&(this._writableState.destroyed=F)}}),l.prototype.destroy=Y.destroy,l.prototype._undestroy=Y.undestroy,l.prototype._destroy=function(F,H){H(F)}}).call(this)}).call(this,n("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{"../errors":15,"./_stream_duplex":16,"./internal/streams/destroy":23,"./internal/streams/state":27,"./internal/streams/stream":28,_process:12,buffer:3,inherits:10,"util-deprecate":32}],21:[function(n,r){(function(s){(function(){"use strict";function o(x,v,b){return v in x?Object.defineProperty(x,v,{value:b,enumerable:!0,configurable:!0,writable:!0}):x[v]=b,x}function f(x,v){return{value:x,done:v}}function h(x){var v=x[y];if(v!==null){var b=x[p].read();b!==null&&(x[g]=null,x[y]=null,x[C]=null,v(f(b,!1)))}}function c(x){s.nextTick(h,x)}function u(x,v){return function(b,m){x.then(function(){return v[S]?void b(f(void 0,!0)):void v[B](b,m)},m)}}var E,l=n("./end-of-stream"),y=Symbol("lastResolve"),C=Symbol("lastReject"),Q=Symbol("error"),S=Symbol("ended"),g=Symbol("lastPromise"),B=Symbol("handlePromise"),p=Symbol("stream"),_=Object.getPrototypeOf(function(){}),w=Object.setPrototypeOf((E={get stream(){return this[p]},next:function(){var x=this,v=this[Q];if(v!==null)return Promise.reject(v);if(this[S])return Promise.resolve(f(void 0,!0));if(this[p].destroyed)return new Promise(function(M,D){s.nextTick(function(){x[Q]?D(x[Q]):M(f(void 0,!0))})});var b,m=this[g];if(m)b=new Promise(u(m,this));else{var N=this[p].read();if(N!==null)return Promise.resolve(f(N,!1));b=new Promise(this[B])}return this[g]=b,b}},o(E,Symbol.asyncIterator,function(){return this}),o(E,"return",function(){var x=this;return new Promise(function(v,b){x[p].destroy(null,function(m){return m?void b(m):void v(f(void 0,!0))})})}),E),_);r.exports=function(x){var v,b=Object.create(w,(v={},o(v,p,{value:x,writable:!0}),o(v,y,{value:null,writable:!0}),o(v,C,{value:null,writable:!0}),o(v,Q,{value:null,writable:!0}),o(v,S,{value:x._readableState.endEmitted,writable:!0}),o(v,B,{value:function(m,N){var M=b[p].read();M?(b[g]=null,b[y]=null,b[C]=null,m(f(M,!1))):(b[y]=m,b[C]=N)},writable:!0}),v));return b[g]=null,l(x,function(m){if(m&&m.code!=="ERR_STREAM_PREMATURE_CLOSE"){var N=b[C];return N!==null&&(b[g]=null,b[y]=null,b[C]=null,N(m)),void(b[Q]=m)}var M=b[y];M!==null&&(b[g]=null,b[y]=null,b[C]=null,M(f(void 0,!0))),b[S]=!0}),x.on("readable",c.bind(null,b)),b}}).call(this)}).call(this,n("_process"))},{"./end-of-stream":24,_process:12}],22:[function(n,r){"use strict";function s(g,B){var p=Object.keys(g);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(g);B&&(_=_.filter(function(w){return Object.getOwnPropertyDescriptor(g,w).enumerable})),p.push.apply(p,_)}return p}function o(g){for(var B,p=1;p<arguments.length;p++)B=arguments[p]==null?{}:arguments[p],p%2?s(Object(B),!0).forEach(function(_){f(g,_,B[_])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(B)):s(Object(B)).forEach(function(_){Object.defineProperty(g,_,Object.getOwnPropertyDescriptor(B,_))});return g}function f(g,B,p){return B in g?Object.defineProperty(g,B,{value:p,enumerable:!0,configurable:!0,writable:!0}):g[B]=p,g}function h(g,B){if(!(g instanceof B))throw new TypeError("Cannot call a class as a function")}function c(g,B){for(var p,_=0;_<B.length;_++)p=B[_],p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(g,p.key,p)}function u(g,B,p){return B&&c(g.prototype,B),p&&c(g,p),g}function E(g,B,p){y.prototype.copy.call(g,B,p)}var l=n("buffer"),y=l.Buffer,C=n("util"),Q=C.inspect,S=Q&&Q.custom||"inspect";r.exports=(function(){function g(){h(this,g),this.head=null,this.tail=null,this.length=0}return u(g,[{key:"push",value:function(B){var p={data:B,next:null};0<this.length?this.tail.next=p:this.head=p,this.tail=p,++this.length}},{key:"unshift",value:function(B){var p={data:B,next:this.head};this.length===0&&(this.tail=p),this.head=p,++this.length}},{key:"shift",value:function(){if(this.length!==0){var B=this.head.data;return this.head=this.length===1?this.tail=null:this.head.next,--this.length,B}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(B){if(this.length===0)return"";for(var p=this.head,_=""+p.data;p=p.next;)_+=B+p.data;return _}},{key:"concat",value:function(B){if(this.length===0)return y.alloc(0);for(var p=y.allocUnsafe(B>>>0),_=this.head,w=0;_;)E(_.data,p,w),w+=_.data.length,_=_.next;return p}},{key:"consume",value:function(B,p){var _;return B<this.head.data.length?(_=this.head.data.slice(0,B),this.head.data=this.head.data.slice(B)):B===this.head.data.length?_=this.shift():_=p?this._getString(B):this._getBuffer(B),_}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(B){var p=this.head,_=1,w=p.data;for(B-=w.length;p=p.next;){var x=p.data,v=B>x.length?x.length:B;if(w+=v===x.length?x:x.slice(0,B),B-=v,B===0){v===x.length?(++_,this.head=p.next?p.next:this.tail=null):(this.head=p,p.data=x.slice(v));break}++_}return this.length-=_,w}},{key:"_getBuffer",value:function(B){var p=y.allocUnsafe(B),_=this.head,w=1;for(_.data.copy(p),B-=_.data.length;_=_.next;){var x=_.data,v=B>x.length?x.length:B;if(x.copy(p,p.length-B,0,v),B-=v,B===0){v===x.length?(++w,this.head=_.next?_.next:this.tail=null):(this.head=_,_.data=x.slice(v));break}++w}return this.length-=w,p}},{key:S,value:function(B,p){return Q(this,o({},p,{depth:0,customInspect:!1}))}}]),g})()},{buffer:3,util:2}],23:[function(n,r){(function(s){(function(){"use strict";function o(c,u){h(c,u),f(c)}function f(c){c._writableState&&!c._writableState.emitClose||c._readableState&&!c._readableState.emitClose||c.emit("close")}function h(c,u){c.emit("error",u)}r.exports={destroy:function(c,u){var E=this,l=this._readableState&&this._readableState.destroyed,y=this._writableState&&this._writableState.destroyed;return l||y?(u?u(c):c&&(this._writableState?!this._writableState.errorEmitted&&(this._writableState.errorEmitted=!0,s.nextTick(h,this,c)):s.nextTick(h,this,c)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(c||null,function(C){!u&&C?E._writableState?E._writableState.errorEmitted?s.nextTick(f,E):(E._writableState.errorEmitted=!0,s.nextTick(o,E,C)):s.nextTick(o,E,C):u?(s.nextTick(f,E),u(C)):s.nextTick(f,E)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(c,u){var E=c._readableState,l=c._writableState;E&&E.autoDestroy||l&&l.autoDestroy?c.destroy(u):c.emit("error",u)}}}).call(this)}).call(this,n("_process"))},{_process:12}],24:[function(n,r){"use strict";function s(u){var E=!1;return function(){if(!E){E=!0;for(var l=arguments.length,y=Array(l),C=0;C<l;C++)y[C]=arguments[C];u.apply(this,y)}}}function o(){}function f(u){return u.setHeader&&typeof u.abort=="function"}function h(u,E,l){if(typeof E=="function")return h(u,null,E);E||(E={}),l=s(l||o);var y=E.readable||E.readable!==!1&&u.readable,C=E.writable||E.writable!==!1&&u.writable,Q=function(){u.writable||g()},S=u._writableState&&u._writableState.finished,g=function(){C=!1,S=!0,y||l.call(u)},B=u._readableState&&u._readableState.endEmitted,p=function(){y=!1,B=!0,C||l.call(u)},_=function(v){l.call(u,v)},w=function(){var v;return y&&!B?(u._readableState&&u._readableState.ended||(v=new c),l.call(u,v)):C&&!S?(u._writableState&&u._writableState.ended||(v=new c),l.call(u,v)):void 0},x=function(){u.req.on("finish",g)};return f(u)?(u.on("complete",g),u.on("abort",w),u.req?x():u.on("request",x)):C&&!u._writableState&&(u.on("end",Q),u.on("close",Q)),u.on("end",p),u.on("finish",g),E.error!==!1&&u.on("error",_),u.on("close",w),function(){u.removeListener("complete",g),u.removeListener("abort",w),u.removeListener("request",x),u.req&&u.req.removeListener("finish",g),u.removeListener("end",Q),u.removeListener("close",Q),u.removeListener("finish",g),u.removeListener("end",p),u.removeListener("error",_),u.removeListener("close",w)}}var c=n("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;r.exports=h},{"../../../errors":15}],25:[function(n,r){r.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],26:[function(n,r){"use strict";function s(S){var g=!1;return function(){g||(g=!0,S.apply(void 0,arguments))}}function o(S){if(S)throw S}function f(S){return S.setHeader&&typeof S.abort=="function"}function h(S,g,B,p){p=s(p);var _=!1;S.on("close",function(){_=!0}),l===void 0&&(l=n("./end-of-stream")),l(S,{readable:g,writable:B},function(x){return x?p(x):(_=!0,void p())});var w=!1;return function(x){if(!_)return w?void 0:(w=!0,f(S)?S.abort():typeof S.destroy=="function"?S.destroy():void p(x||new Q("pipe")))}}function c(S){S()}function u(S,g){return S.pipe(g)}function E(S){return S.length&&typeof S[S.length-1]=="function"?S.pop():o}var l,y=n("../../../errors").codes,C=y.ERR_MISSING_ARGS,Q=y.ERR_STREAM_DESTROYED;r.exports=function(){for(var S=arguments.length,g=Array(S),B=0;B<S;B++)g[B]=arguments[B];var p=E(g);if(Array.isArray(g[0])&&(g=g[0]),2>g.length)throw new C("streams");var _,w=g.map(function(x,v){var b=v<g.length-1;return h(x,b,0<v,function(m){_||(_=m),m&&w.forEach(c),b||(w.forEach(c),p(_))})});return g.reduce(u)}},{"../../../errors":15,"./end-of-stream":24}],27:[function(n,r){"use strict";function s(f,h,c){return f.highWaterMark==null?h?f[c]:null:f.highWaterMark}var o=n("../../../errors").codes.ERR_INVALID_OPT_VALUE;r.exports={getHighWaterMark:function(f,h,c,u){var E=s(h,u,c);if(E!=null){if(!(isFinite(E)&&a(E)===E)||0>E){var l=u?c:"highWaterMark";throw new o(l,E)}return a(E)}return f.objectMode?16:16384}}},{"../../../errors":15}],28:[function(n,r){r.exports=n("events").EventEmitter},{events:7}],29:[function(n,r,s){s=r.exports=n("./lib/_stream_readable.js"),s.Stream=s,s.Readable=s,s.Writable=n("./lib/_stream_writable.js"),s.Duplex=n("./lib/_stream_duplex.js"),s.Transform=n("./lib/_stream_transform.js"),s.PassThrough=n("./lib/_stream_passthrough.js"),s.finished=n("./lib/internal/streams/end-of-stream.js"),s.pipeline=n("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":16,"./lib/_stream_passthrough.js":17,"./lib/_stream_readable.js":18,"./lib/_stream_transform.js":19,"./lib/_stream_writable.js":20,"./lib/internal/streams/end-of-stream.js":24,"./lib/internal/streams/pipeline.js":26}],30:[function(n,r,s){function o(u,E){for(var l in u)E[l]=u[l]}function f(u,E,l){return c(u,E,l)}var h=n("buffer"),c=h.Buffer;c.from&&c.alloc&&c.allocUnsafe&&c.allocUnsafeSlow?r.exports=h:(o(h,s),s.Buffer=f),f.prototype=Object.create(c.prototype),o(c,f),f.from=function(u,E,l){if(typeof u=="number")throw new TypeError("Argument must not be a number");return c(u,E,l)},f.alloc=function(u,E,l){if(typeof u!="number")throw new TypeError("Argument must be a number");var y=c(u);return E===void 0?y.fill(0):typeof l=="string"?y.fill(E,l):y.fill(E),y},f.allocUnsafe=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return c(u)},f.allocUnsafeSlow=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return h.SlowBuffer(u)}},{buffer:3}],31:[function(n,r,s){"use strict";function o(w){if(!w)return"utf8";for(var x;;)switch(w){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return w;default:if(x)return;w=(""+w).toLowerCase(),x=!0}}function f(w){var x=o(w);if(typeof x!="string"&&(p.isEncoding===_||!_(w)))throw new Error("Unknown encoding: "+w);return x||w}function h(w){this.encoding=f(w);var x;switch(this.encoding){case"utf16le":this.text=y,this.end=C,x=4;break;case"utf8":this.fillLast=l,x=4;break;case"base64":this.text=Q,this.end=S,x=3;break;default:return this.write=g,void(this.end=B)}this.lastNeed=0,this.lastTotal=0,this.lastChar=p.allocUnsafe(x)}function c(w){return 127>=w?0:w>>5==6?2:w>>4==14?3:w>>3==30?4:w>>6==2?-1:-2}function u(w,x,v){var b=x.length-1;if(b<v)return 0;var m=c(x[b]);return 0<=m?(0<m&&(w.lastNeed=m-1),m):--b<v||m===-2?0:(m=c(x[b]),0<=m?(0<m&&(w.lastNeed=m-2),m):--b<v||m===-2?0:(m=c(x[b]),0<=m?(0<m&&(m===2?m=0:w.lastNeed=m-3),m):0))}function E(w,x){if((192&x[0])!=128)return w.lastNeed=0,"\uFFFD";if(1<w.lastNeed&&1<x.length){if((192&x[1])!=128)return w.lastNeed=1,"\uFFFD";if(2<w.lastNeed&&2<x.length&&(192&x[2])!=128)return w.lastNeed=2,"\uFFFD"}}function l(w){var x=this.lastTotal-this.lastNeed,v=E(this,w,x);return v===void 0?this.lastNeed<=w.length?(w.copy(this.lastChar,x,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(w.copy(this.lastChar,x,0,w.length),void(this.lastNeed-=w.length)):v}function y(w,x){if((w.length-x)%2==0){var v=w.toString("utf16le",x);if(v){var b=v.charCodeAt(v.length-1);if(55296<=b&&56319>=b)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=w[w.length-2],this.lastChar[1]=w[w.length-1],v.slice(0,-1)}return v}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=w[w.length-1],w.toString("utf16le",x,w.length-1)}function C(w){var x=w&&w.length?this.write(w):"";if(this.lastNeed){var v=this.lastTotal-this.lastNeed;return x+this.lastChar.toString("utf16le",0,v)}return x}function Q(w,x){var v=(w.length-x)%3;return v==0?w.toString("base64",x):(this.lastNeed=3-v,this.lastTotal=3,v==1?this.lastChar[0]=w[w.length-1]:(this.lastChar[0]=w[w.length-2],this.lastChar[1]=w[w.length-1]),w.toString("base64",x,w.length-v))}function S(w){var x=w&&w.length?this.write(w):"";return this.lastNeed?x+this.lastChar.toString("base64",0,3-this.lastNeed):x}function g(w){return w.toString(this.encoding)}function B(w){return w&&w.length?this.write(w):""}var p=n("safe-buffer").Buffer,_=p.isEncoding||function(w){switch(w=""+w,w&&w.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};s.StringDecoder=h,h.prototype.write=function(w){if(w.length===0)return"";var x,v;if(this.lastNeed){if(x=this.fillLast(w),x===void 0)return"";v=this.lastNeed,this.lastNeed=0}else v=0;return v<w.length?x?x+this.text(w,v):this.text(w,v):x||""},h.prototype.end=function(w){var x=w&&w.length?this.write(w):"";return this.lastNeed?x+"\uFFFD":x},h.prototype.text=function(w,x){var v=u(this,w,x);if(!this.lastNeed)return w.toString("utf8",x);this.lastTotal=v;var b=w.length-(v-this.lastNeed);return w.copy(this.lastChar,0,b),w.toString("utf8",x,b)},h.prototype.fillLast=function(w){return this.lastNeed<=w.length?(w.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(w.copy(this.lastChar,this.lastTotal-this.lastNeed,0,w.length),void(this.lastNeed-=w.length))}},{"safe-buffer":30}],32:[function(n,r){(function(s){(function(){function o(f){try{if(!s.localStorage)return!1}catch{return!1}var h=s.localStorage[f];return h!=null&&(h+"").toLowerCase()==="true"}r.exports=function(f,h){function c(){if(!u){if(o("throwDeprecation"))throw new Error(h);o("traceDeprecation")?console.trace(h):console.warn(h),u=!0}return f.apply(this,arguments)}if(o("noDeprecation"))return f;var u=!1;return c}}).call(this)}).call(this,typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{}],"/":[function(n,r){function s(S){return S.replace(/a=ice-options:trickle\s\n/g,"")}function o(S){console.warn(S)}let f=n("debug")("simple-peer"),h=n("get-browser-rtc"),c=n("randombytes"),u=n("readable-stream"),E=n("queue-microtask"),l=n("err-code"),{Buffer:y}=n("buffer"),C=65536;class Q extends u.Duplex{constructor(g){if(g=Object.assign({allowHalfOpen:!1},g),super(g),this._id=c(4).toString("hex").slice(0,7),this._debug("new peer %o",g),this.channelName=g.initiator?g.channelName||c(20).toString("hex"):null,this.initiator=g.initiator||!1,this.channelConfig=g.channelConfig||Q.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},Q.config,g.config),this.offerOptions=g.offerOptions||{},this.answerOptions=g.answerOptions||{},this.sdpTransform=g.sdpTransform||(B=>B),this.streams=g.streams||(g.stream?[g.stream]:[]),this.trickle=g.trickle===void 0||g.trickle,this.allowHalfTrickle=g.allowHalfTrickle!==void 0&&g.allowHalfTrickle,this.iceCompleteTimeout=g.iceCompleteTimeout||5e3,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=g.wrtc&&typeof g.wrtc=="object"?g.wrtc:h(),!this._wrtc)throw l(typeof window>"u"?new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"):new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(B){return void this.destroy(l(B,"ERR_PC_CONSTRUCTOR"))}this._isReactNativeWebrtc=typeof this._pc._peerConnectionId=="number",this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=B=>{this._onIceCandidate(B)},typeof this._pc.peerIdentity=="object"&&this._pc.peerIdentity.catch(B=>{this.destroy(l(B,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=B=>{this._setupData(B)},this.streams&&this.streams.forEach(B=>{this.addStream(B)}),this._pc.ontrack=B=>{this._onTrack(B)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&this._channel.readyState==="open"}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(g){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if(typeof g=="string")try{g=JSON.parse(g)}catch{g={}}this._debug("signal()"),g.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),g.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(g.transceiverRequest.kind,g.transceiverRequest.init)),g.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(g.candidate):this._pendingCandidates.push(g.candidate)),g.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(g)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(B=>{this._addIceCandidate(B)}),this._pendingCandidates=[],this._pc.remoteDescription.type==="offer"&&this._createAnswer())}).catch(B=>{this.destroy(l(B,"ERR_SET_REMOTE_DESCRIPTION"))}),g.sdp||g.candidate||g.renegotiate||g.transceiverRequest||this.destroy(l(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(g){let B=new this._wrtc.RTCIceCandidate(g);this._pc.addIceCandidate(B).catch(p=>{!B.address||B.address.endsWith(".local")?o("Ignoring unsupported ICE candidate."):this.destroy(l(p,"ERR_ADD_ICE_CANDIDATE"))})}send(g){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(g)}}addTransceiver(g,B){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(g,B),this._needsNegotiation()}catch(p){this.destroy(l(p,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:g,init:B}})}}addStream(g){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),g.getTracks().forEach(B=>{this.addTrack(B,g)})}}addTrack(g,B){if(this.destroying)return;if(this.destroyed)throw l(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");let p=this._senderMap.get(g)||new Map,_=p.get(B);if(!_)_=this._pc.addTrack(g,B),p.set(B,_),this._senderMap.set(g,p),this._needsNegotiation();else throw _.removed?l(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):l(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED")}replaceTrack(g,B,p){if(this.destroying)return;if(this.destroyed)throw l(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");let _=this._senderMap.get(g),w=_?_.get(p):null;if(!w)throw l(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");B&&this._senderMap.set(B,_),w.replaceTrack==null?this.destroy(l(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK")):w.replaceTrack(B)}removeTrack(g,B){if(this.destroying)return;if(this.destroyed)throw l(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");let p=this._senderMap.get(g),_=p?p.get(B):null;if(!_)throw l(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{_.removed=!0,this._pc.removeTrack(_)}catch(w){w.name==="NS_ERROR_UNEXPECTED"?this._sendersAwaitingStable.push(_):this.destroy(l(w,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(g){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),g.getTracks().forEach(B=>{this.removeTrack(B,g)})}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,E(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(g){this._destroy(g,()=>{})}_destroy(g,B){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",g&&(g.message||g)),E(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",g&&(g.message||g)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch{}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch{}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,g&&this.emit("error",g),this.emit("close"),B()}))}_setupData(g){if(!g.channel)return this.destroy(l(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=g.channel,this._channel.binaryType="arraybuffer",typeof this._channel.bufferedAmountLowThreshold=="number"&&(this._channel.bufferedAmountLowThreshold=C),this.channelName=this._channel.label,this._channel.onmessage=p=>{this._onChannelMessage(p)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=p=>{let _=p.error instanceof Error?p.error:new Error(`Datachannel error: ${p.message} ${p.filename}:${p.lineno}:${p.colno}`);this.destroy(l(_,"ERR_DATA_CHANNEL"))};let B=!1;this._closingInterval=setInterval(()=>{this._channel&&this._channel.readyState==="closing"?(B&&this._onChannelClose(),B=!0):B=!1},5e3)}_read(){}_write(g,B,p){if(this.destroyed)return p(l(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(g)}catch(_){return this.destroy(l(_,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>C?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=p):p(null)}else this._debug("write before connect"),this._chunk=g,this._cb=p}_onFinish(){if(!this.destroyed){let g=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?g():this.once("connect",g)}}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(g=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(g.sdp=s(g.sdp)),g.sdp=this.sdpTransform(g.sdp);let B=()=>{if(!this.destroyed){let p=this._pc.localDescription||g;this._debug("signal"),this.emit("signal",{type:p.type,sdp:p.sdp})}};this._pc.setLocalDescription(g).then(()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?B():this.once("_iceComplete",B))}).catch(p=>{this.destroy(l(p,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(g=>{this.destroy(l(g,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(g=>{g.mid||!g.sender.track||g.requested||(g.requested=!0,this.addTransceiver(g.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(g=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(g.sdp=s(g.sdp)),g.sdp=this.sdpTransform(g.sdp);let B=()=>{if(!this.destroyed){let p=this._pc.localDescription||g;this._debug("signal"),this.emit("signal",{type:p.type,sdp:p.sdp}),this.initiator||this._requestMissingTransceivers()}};this._pc.setLocalDescription(g).then(()=>{this.destroyed||(this.trickle||this._iceComplete?B():this.once("_iceComplete",B))}).catch(p=>{this.destroy(l(p,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(g=>{this.destroy(l(g,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||this._pc.connectionState==="failed"&&this.destroy(l(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;let g=this._pc.iceConnectionState,B=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",g,B),this.emit("iceStateChange",g,B),(g==="connected"||g==="completed")&&(this._pcReady=!0,this._maybeReady()),g==="failed"&&this.destroy(l(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),g==="closed"&&this.destroy(l(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(g){let B=p=>(Object.prototype.toString.call(p.values)==="[object Array]"&&p.values.forEach(_=>{Object.assign(p,_)}),p);this._pc.getStats.length===0||this._isReactNativeWebrtc?this._pc.getStats().then(p=>{let _=[];p.forEach(w=>{_.push(B(w))}),g(null,_)},p=>g(p)):0<this._pc.getStats.length?this._pc.getStats(p=>{if(this.destroyed)return;let _=[];p.result().forEach(w=>{let x={};w.names().forEach(v=>{x[v]=w.stat(v)}),x.id=w.id,x.type=w.type,x.timestamp=w.timestamp,_.push(B(x))}),g(null,_)},p=>g(p)):g(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;let g=()=>{this.destroyed||this.getStats((B,p)=>{if(this.destroyed)return;B&&(p=[]);let _={},w={},x={},v=!1;p.forEach(m=>{(m.type==="remotecandidate"||m.type==="remote-candidate")&&(_[m.id]=m),(m.type==="localcandidate"||m.type==="local-candidate")&&(w[m.id]=m),(m.type==="candidatepair"||m.type==="candidate-pair")&&(x[m.id]=m)});let b=m=>{v=!0;let N=w[m.localCandidateId];N&&(N.ip||N.address)?(this.localAddress=N.ip||N.address,this.localPort=+N.port):N&&N.ipAddress?(this.localAddress=N.ipAddress,this.localPort=+N.portNumber):typeof m.googLocalAddress=="string"&&(N=m.googLocalAddress.split(":"),this.localAddress=N[0],this.localPort=+N[1]),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let M=_[m.remoteCandidateId];M&&(M.ip||M.address)?(this.remoteAddress=M.ip||M.address,this.remotePort=+M.port):M&&M.ipAddress?(this.remoteAddress=M.ipAddress,this.remotePort=+M.portNumber):typeof m.googRemoteAddress=="string"&&(M=m.googRemoteAddress.split(":"),this.remoteAddress=M[0],this.remotePort=+M[1]),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(p.forEach(m=>{m.type==="transport"&&m.selectedCandidatePairId&&b(x[m.selectedCandidatePairId]),(m.type==="googCandidatePair"&&m.googActiveConnection==="true"||(m.type==="candidatepair"||m.type==="candidate-pair")&&m.selected)&&b(m)}),!v&&(!Object.keys(x).length||Object.keys(w).length))return void setTimeout(g,100);if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(N){return this.destroy(l(N,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');let m=this._cb;this._cb=null,m(null)}typeof this._channel.bufferedAmountLowThreshold!="number"&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")})};g()}_onInterval(){this._cb&&this._channel&&!(this._channel.bufferedAmount>C)&&this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||(this._pc.signalingState==="stable"&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(g=>{this._pc.removeTrack(g),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(g){this.destroyed||(g.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:g.candidate.candidate,sdpMLineIndex:g.candidate.sdpMLineIndex,sdpMid:g.candidate.sdpMid}}):!g.candidate&&!this._iceComplete&&(this._iceComplete=!0,this.emit("_iceComplete")),g.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(g){if(this.destroyed)return;let B=g.data;B instanceof ArrayBuffer&&(B=y.from(B)),this.push(B)}_onChannelBufferedAmountLow(){if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);let g=this._cb;this._cb=null,g(null)}}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(g){this.destroyed||g.streams.forEach(B=>{this._debug("on track"),this.emit("track",g.track,B),this._remoteTracks.push({track:g.track,stream:B}),this._remoteStreams.some(p=>p.id===B.id)||(this._remoteStreams.push(B),E(()=>{this._debug("on stream"),this.emit("stream",B)}))})}_debug(){let g=[].slice.call(arguments);g[0]="["+this._id+"] "+g[0],f.apply(null,g)}}Q.WEBRTC_SUPPORT=!!h(),Q.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},Q.channelConfig={},r.exports=Q},{buffer:3,debug:4,"err-code":6,"get-browser-rtc":8,"queue-microtask":13,randombytes:14,"readable-stream":29}]},{},[])("/")})});var Fr=_s((eA,Tr)=>{"use strict";Tr.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var $e,vt,Ct,Yt,st,St,Bt,Qt,_t,gt,Ur,Ot=pt(async()=>{$e=typeof window>"u";$e||(await Promise.resolve().then(()=>(vr(),Ds))).default;vt={AVOID_INTERVALS:!1,USE_TEST_TRANSPORTS:!1,ICE_DELAY:{min:250,max:3e3},ICE_OFFER_FAILURE_RATE:.2,ICE_ANSWER_FAILURE_RATE:.15,AVOID_FOLLOWERS_NODES:!1,AUTO_START:!0,PUBLIC_PEERS_COUNT:100,PEERS_COUNT:1860,BOOTSTRAPS_PER_PEER:10,DELAY_BETWEEN_INIT:10,RANDOM_UNICAST_PER_SEC:0,RANDOM_GOSSIP_PER_SEC:0,DIFFUSION_TEST_DELAY:1e4},Ct={DEFAULT_VERBOSE:2,CONNECTION_UPGRADE_TIMEOUT:15e3,IS_BROWSER:!$e,MANUAL_BAN_MODE:!1},Yt={PORT:8080,AUTO_KICK_DELAY:6e4,AUTO_KICK_DURATION:3e4,MAX_WS_IN_CONNS:20},st={DIFFICULTY:0,ARGON2_MEM:2**16,ARE_IDS_HEX:!0,PUBLIC_PREFIX:"0",STANDARD_PREFIX:"1",ID_LENGTH:16,PUBKEY_LENGTH:32,PRIVATEKEY_LENGTH:32,SIGNATURE_LENGTH:64},St={CENTRALIZED_STUN_SERVERS:!1,MAX_SDP_OFFERS:2,ICE_COMPLETE_TIMEOUT:1e3,SIGNAL_CREATION_TIMEOUT:8e3,SDP_OFFER_EXPIRATION:4e4,WS_CLIENT:WebSocket,WS_SERVER:$e?(await Promise.resolve().then(()=>xs(Fr(),1))).WebSocketServer:null,PEER:$e?(await import("simple-peer")).default:window.SimplePeer},Bt={PEER_LINK_DELAY:1e4,PEER_LINK_EXPIRATION:6e4,LOOP_DELAY:2500,TARGET_NEIGHBORS_COUNT:5,ON_CONNECT_DISPATCH:{DELAY:0,BROADCAST_EVENT:!1,OVER_NEIGHBORED:!0,SHARE_HISTORY:!1},ON_DISCONNECT_DISPATCH:{DELAY:0,BROADCAST_EVENT:!1},ON_UNICAST:{DIGEST_TRAVELED_ROUTE:!0}},Qt={MAX_HOPS:8,MAX_NODES:256,MAX_ROUTES:5,MARKERS_BYTES:{message:0,0:"message",handshake:1,1:"handshake",signal_answer:2,2:"signal_answer",signal_offer:3,3:"signal_offer",privacy:4,4:"privacy",private_message:5,5:"private_message"}},_t={EXPIRATION:1e4,CACHE_DURATION:2e4,HOPS:{default:20,signal_offer:6,diffusion_test:100,over_neighbored:6},TRANSMISSION_RATE:{MIN_NEIGHBOURS_TO_APPLY_PONDERATION:2,NEIGHBOURS_PONDERATION:5,Default:1,signal_offer:.618},MARKERS_BYTES:{gossip:128,128:"gossip",signal_offer:129,129:"signal_offer",peer_connected:130,130:"peer_connected",peer_disconnected:131,131:"peer_disconnected",diffusion_test:132,132:"diffusion_test",over_neighbored:133,133:"over_neighbored"}},gt={SIMULATOR:"color: yellow; font-weight: bold;",ARBITER:"color: white;",CRYPTO_CODEX:"color: green;",GOSSIP:"color: fuchsia;",UNICAST:"color: cyan;",PEER_STORE:"color: orange;",SERVICE:"color: teal;",PUNISHER:{BAN:"color: red; font-weight: bold;",KICK:"color: darkorange; font-weight: bold;"}},Ur={SIMULATION:vt,NODE:Ct,TRANSPORTS:St,DISCOVERY:Bt,IDENTITY:st,UNICAST:Qt,GOSSIP:_t,LOG_CSS:gt}});var tn,en,kr=pt(async()=>{await Ot();tn=class{sandbox;SIGNAL_OFFER_TIMEOUT=3e4;SIGNAL_ANSWER_TIMEOUT=1e4;PENDING_OFFERS={};PENDING_ANSWERS={};sdpToBuild=[];signalsToDigest=[];constructor(t){this.sandbox=t}tick(){let t=Date.now();this.#e(t);let e=this.sdpToBuild;this.sdpToBuild=[];for(let{transportId:r,type:s,time:o}of e){if(o>t){this.sdpToBuild.push({transportId:r,type:s,time:o});continue}let f=this.sandbox.transportInstances[r];if(!f||f.destroying||f.destroyed)continue;let{success:h,signalData:c,reason:u}=this.#t(r,s);!h||!c?f.dispatchError(u||`Failed to build SDP for peer: ${this.id}`):f.callbacks.signal?.forEach(E=>E(c))}let n=this.signalsToDigest;this.signalsToDigest=[];for(let{signalData:r,receiverId:s}of n){let o=this.sandbox.transportInstances[s];if(!o||o.destroying||o.destroyed)continue;let{success:f,reason:h}=this.#n(r,s);f||o.dispatchError(h||`Failed to digest signal for peer: ${this.id}`)}}#e(t=Date.now()){for(let e in this.PENDING_OFFERS)for(let n in this.PENDING_OFFERS[e])t>this.PENDING_OFFERS[e][n].expiration&&delete this.PENDING_OFFERS[e][n];for(let e in this.PENDING_ANSWERS){let n=this.PENDING_ANSWERS[e];t>n.expiration&&delete this.PENDING_ANSWERS[e]}}#t(t,e){if(e!=="offer"&&e!=="answer")return{success:!1,signalData:null,reason:`Invalid signal type: ${e}.`};if(e==="answer"&&this.PENDING_ANSWERS[t])return{success:!1,signalData:null,reason:`There is already a pending answer for transport ID: ${t}`};let n=e==="offer"?this.SIGNAL_OFFER_TIMEOUT:this.SIGNAL_ANSWER_TIMEOUT||1e4,r=Math.random().toString(36).substring(2),s={transportId:t,expiration:Date.now()+n,type:e,sdp:{id:r,v:"0",o:`- ${Math.random().toString(36).substring(2)} ${Math.floor(Math.random()*1e6)} 2 IN IP4 127.0.0.1\r
3
- `,s:"-",t:"0 0",a:["group:BUNDLE..."]}};return e==="offer"&&this.PENDING_OFFERS[t]?.[r]?{success:!1,signalData:null,reason:`There is already a pending offer with the same SDP ID for transport ID: ${t} (extreme case)`}:(e==="offer"&&!this.PENDING_OFFERS[t]&&(this.PENDING_OFFERS[t]={}),e==="offer"&&(this.PENDING_OFFERS[t][r]=s),e==="answer"&&(this.PENDING_ANSWERS[t]=s),{success:!0,signalData:s,reason:"na"})}#n(t,e){let{transportId:n,type:r,sdp:s}=t;if(n===void 0)return{success:!1,reason:"Missing transportId in signal data."};if(r!=="offer"&&r!=="answer")return{success:!1,reason:`Invalid signal type: ${r}.`};if(r==="offer"&&(!this.PENDING_OFFERS[n]||!this.PENDING_OFFERS[n][s.id]))return{success:!1,reason:`No pending offer found for transport ID: ${n} with SDP ID: ${s.id}`};if(r==="answer"&&(!this.PENDING_ANSWERS[n]||this.PENDING_ANSWERS[n].sdp.id!==s.id))return{success:!1,reason:`No pending answer found for transport ID: ${n} with SDP ID: ${s.id}`};if(r==="offer"&&Math.random()<vt.ICE_OFFER_FAILURE_RATE)return{success:!1,reason:`Simulated failure for 'offer' signal from ${n} to ${e}`};if(r==="answer"&&Math.random()<vt.ICE_ANSWER_FAILURE_RATE)return{success:!1,reason:`Simulated failure for 'answer' signal from ${n} to ${e}`};if(r==="offer")return this.buildSDP(e,"answer"),{success:!0,reason:"na"};delete this.PENDING_OFFERS[e],delete this.PENDING_ANSWERS[n];let o=this.sandbox.linkInstances(e,n);return{success:!o,reason:o||"na"}}buildSDP(t,e){let n={min:vt.ICE_DELAY.min,max:vt.ICE_DELAY.max},r=Math.floor(Math.random()*(n.max-n.min+1))+n.min;this.sdpToBuild.push({transportId:t,type:e,time:Date.now()+r})}digestSignal(t,e){this.signalsToDigest.push({signalData:t,receiverId:e})}},en=class{verbose=Ct.DEFAULT_VERBOSE;wsGlobalIndex=1;tGlobalIndex=1;transportInstances={};wsConnections={};publicWsServers={};inscribeWebSocketServer(t,e){this.publicWsServers[t]=e}removeWebSocketServer(t){delete this.publicWsServers[t]}inscribeWsConnection(t){let e=(this.wsGlobalIndex++).toString();t.id=e,this.wsConnections[e]=t,this.verbose>3&&console.log(`[SANDBOX] Inscribed wsConnection: ${t.id}`)}connectToWebSocketServer(t,e,n){let r=this.wsConnections[e],s=this.publicWsServers[t];if(!r||!s||s.closing||s.clients.size>=s.maxClients)return;let o=new n(s,e);s.clients.add(o),o.init(r.id),s.callbacks.connection.forEach(f=>f(o)),r.init(o.id)}inscribeInstance(t){let e=(this.tGlobalIndex++).toString();t.id=e,this.transportInstances[e]=t,this.verbose>3&&console.log(`[SANDBOX] Inscribed transport: ${e}`)}linkInstances(t,e){let[n,r]=[this.transportInstances[t],this.transportInstances[e]];if(!n||!r)return`Missing transport instances: ${t}=>${!!n}, ${e}=>${!!r}`;if(n.initiator&&r.initiator)return`Both transport instances cannot be initiators: ${t}, ${e}`;if(n.destroying||r.destroying)return`One of the transport instances is destroying: ${t}=>${n.destroying}, ${e}=>${r.destroying}`;if(n.destroyed||r.destroyed)return`One of the transport instances is destroyed: ${t}=>${n.destroyed}, ${e}=>${r.destroyed}`;if(n.remoteId)return`Transport instance tA: ${t} is already linked to remoteId: ${n.remoteId}`;if(r.remoteId)return`Transport instance tB: ${e} is already linked to remoteId: ${r.remoteId}`;n.remoteId=e,r.remoteId=t,this.verbose>2&&console.log(`[SANDBOX] Linked transports: ${t} <-> ${e}`),n.callbacks.connect.forEach(s=>s()),r.callbacks.connect.forEach(s=>s())}sendData(t,e,n){if(t===void 0)return{success:!1,reason:`Cannot send message from id: ${t}`};if(e===void 0)return{success:!1,reason:`Cannot send message to id: ${e}`};let r=this.transportInstances[t];if(!r)return{success:!1,reason:`No transport instance found for id: ${t}`};if(!r.remoteId)return{success:!1,reason:`Transport instance ${t} is not linked to any remoteId`};if(r.id!==t)return{success:!1,reason:`Wrong id for senderInstance ${t} !== ${r.id}`};if(r.remoteId!==e)return{success:!1,reason:`Transport instance ${t} is not linked to remoteId: ${e}`};let s=this.transportInstances[e];return s?s.remoteId?s.id!==e?{success:!1,reason:`Wrong id for remoteInstance ${t} !== ${e}`}:s.remoteId!==t?{success:!1,reason:`Transport instance ${t} is not linked to remoteId: ${e}`}:(this.enqueueTransportData(t,e,n),{success:!0,reason:"na"}):{success:!1,reason:`Transport instance ${e} is not linked to any remoteId`}:{success:!1,reason:`No transport instance found for id: ${e}`}}destroyTransportAndAssociatedTransport(t){let e=this.transportInstances[t];if(!e)return;let n=e.remoteId,r=n?this.transportInstances[n]:null;this.verbose>3&&console.log(`[SANDBOX] Destroying transports: ${t}`),e&&r&&(this.verbose>2&&console.log(`[SANDBOX] Destroying linked transports: ${t} & ${n}`),delete this.transportInstances[n],r.destroy(`Remote transport instance ${t} closed the connection.`)),delete this.transportInstances[t],e.close()}batchSize=2500;messageQueueSync=[];queueIndex=0;messageQueue=new Array(1e5);queueStart=0;queueEnd=0;queueCount=0;processMessageQueueSync(){let t=this.messageQueueSync.length;if(t===0)return;let e=this.batchSize;t>this.batchSize*3&&(e=this.batchSize*1.5),t>this.batchSize*5&&(e=this.batchSize*2),t>this.batchSize*10&&(e=this.batchSize*3),t>this.batchSize*20&&(e=this.batchSize*5),e=Math.round(e);let n=Math.min(this.queueIndex+e,t);for(let s=this.queueIndex;s<n;s++){let[o,f,h,c]=this.messageQueueSync[s];o==="transport_data"?this.#e(f,h,c):o==="ws_message"&&this.#t(f,h,c)}if(this.queueIndex=n,this.queueIndex<5e3)return;let r=this.messageQueueSync.length>5e4;r&&console.warn(`[SANDBOX] Message queue is very long: ${this.messageQueueSync.length} messages pending.`),r&&(this.queueIndex+=this.batchSize),this.messageQueueSync=this.messageQueueSync.slice(this.queueIndex),this.queueIndex=0}async processMessageQueue(){if(this.queueCount===0)return;let t=this.batchSize;this.queueCount>this.batchSize*3&&(t=this.batchSize*1.5),this.queueCount>this.batchSize*5&&(t=this.batchSize*2),this.queueCount>this.batchSize*10&&(t=this.batchSize*3),this.queueCount>this.batchSize*20&&(t=this.batchSize*5);let e=Math.min(t,this.queueCount);for(let n=0;n<e;n++){let r=this.messageQueue[this.queueStart];this.queueStart=(this.queueStart+1)%this.messageQueue.length;let[s,o,f,h]=r;s==="transport_data"?this.#e(o,f,h):s==="ws_message"&&this.#t(o,f,h)}await new Promise(n=>setTimeout(n,0)),this.queueCount-=e}#e(t,e,n){let[r,s]=[this.transportInstances[t],this.transportInstances[e]];if(!r||!s||r.destroying||s.destroying){r?.close(),s?.close();return}if(r.destroyed){s.close();return}if(s.destroyed){r.close();return}for(let o of s.callbacks.data)o(n)}#t(t,e,n){let[r,s]=[this.wsConnections[t],this.wsConnections[e]];if(!s||!r||s.readyState!==1||r.readyState!==1){s?.close(),r?.close();return}if(s.onmessage)s.onmessage({data:n});else for(let o of s.callbacks.message)o(n)}enqueueTransportDataSync(t,e,n){this.messageQueueSync.push(["transport_data",t,e,n])}enqueueWsMessageSync(t,e,n){this.messageQueueSync.push(["ws_message",t,e,n])}enqueueTransportData(t,e,n){this.messageQueue[this.queueEnd]=["transport_data",t,e,n],this.queueEnd=(this.queueEnd+1)%this.messageQueue.length,this.queueCount++,this.queueCount===this.messageQueue.length&&(console.error("[SANDBOX] Message queue overflow, dropping oldest messages."),this.queueStart=(this.queueStart+this.batchSize)%this.messageQueue.length,this.queueCount-=this.batchSize)}enqueueWsMessage(t,e,n){this.messageQueue[this.queueEnd]=["ws_message",t,e,n],this.queueEnd=(this.queueEnd+1)%this.messageQueue.length,this.queueCount++,this.queueCount===this.messageQueue.length&&(console.error("[SANDBOX] Message queue overflow, dropping oldest messages."),this.queueStart=(this.queueStart+this.batchSize)%this.messageQueue.length,this.queueCount-=this.batchSize)}}});var sn={};ke(sn,{ICE_CANDIDATE_EMITTER:()=>Pn,SANDBOX:()=>Tt,TEST_WS_EVENT_MANAGER:()=>nn,TestTransport:()=>Hn,TestWsConnection:()=>rn,TestWsServer:()=>Gn});var On,rn,Gn,Hn,Tt,Pn,nn,on=pt(async()=>{await Ot();await kr();On=class{toInit=[];toClose=[];toError=[];initTick(){if(this.toInit.length<=0)return;let t=Date.now(),e=this.toInit;this.toInit=[];for(let{connId:n,time:r}of e)r>t?this.toInit.push({connId:n,time:r}):this.#e(n)}closeTick(){if(this.toClose.length<=0)return;let t=Date.now(),e=this.toClose;this.toClose=[];for(let{wsId:n,remoteWsId:r,time:s}of e)s>t?this.toClose.push({wsId:n,remoteWsId:r,time:s}):this.#t(n,r)}cleanerTick(){let t=Date.now();for(let e of Object.values(Tt.publicWsServers))for(let n of e.clients)n.readyState===3&&e.clients.delete(n)}errorTick(){if(this.toError.length<=0)return;let t=Date.now(),e=this.toError;this.toError=[];for(let{wsId:n,error:r,time:s}of e)s>t?this.toError.push({wsId:n,error:r,time:s}):Tt.wsConnections[n]?.dispatchError(r)}#e(t){let e=Tt.wsConnections[t];e&&Tt.connectToWebSocketServer(e.url,e.id,rn)}#t(t,e){let n=Tt.wsConnections[t],r=Tt.wsConnections[e];n?.onclose?.(),r?.onclose?.();for(let s of n?.callbacks?.close||[])s();for(let s of r?.callbacks?.close||[])s()}scheduleInit(t,e=500){this.toInit.push({connId:t,time:Date.now()+e})}scheduleClose(t,e,n=100){this.toClose.push({wsId:t,remoteWsId:e,time:Date.now()+n})}scheduleError(t,e,n=100){this.toError.push({wsId:t,error:e,time:Date.now()+n})}},rn=class{id;isTestTransport=!0;remoteWsId=null;remoteId=!1;delayBeforeConnectionTry=500;readyState=0;url;callbacks={message:[],close:[],error:[]};onmessage;onopen;onclose;onerror;constructor(t="ws://...",e){Tt.inscribeWsConnection(this),!e&&(this.url=t,nn.scheduleInit(this.id,this.delayBeforeConnectionTry))}init(t){if(!this.readyState===3||this.remoteWsId){this.close(),console.error(`WebSocket instance already closed or connected: ${this.id}`),nn.scheduleError(this.id,`Failed to connect to WebSocket server at ${this.url}`,1e3);return}this.remoteWsId=t,this.readyState=1,this.onopen&&this.onopen()}on(t,e){if(!this.callbacks[t])return console.error(`Unknown event: ${t}`);this.callbacks[t].push(e)}close(){if(this.readyState===3)return;this.readyState=3;let t=Tt.wsConnections[this.remoteWsId];t&&(t.readyState=3),this.remoteWsId&&nn.scheduleClose(this.id,this.remoteWsId,100)}send(t){if(!this.remoteWsId){console.error(`No WebSocket server found for URL: ${this.url}`),this.close();return}Tt.enqueueWsMessage(this.id,this.remoteWsId,t)}dispatchError(t){this.callbacks.error.forEach(e=>e(t)),this.onerror&&this.onerror(t)}},Gn=class{url;clients=new Set;maxClients=Yt.MAX_WS_IN_CONNS||20;callbacks={connection:[],close:[],error:[]};constructor(t={port,host:domain}){this.url=`ws://${t.host}:${t.port}`,Tt.inscribeWebSocketServer(this.url,this)}on(t,e){if(!this.callbacks[t])return console.error(`Unknown event: ${t}`);this.callbacks[t].push(e)}close(){if(!this.closing){this.closing=!0,Tt.removeWebSocketServer(this.url);for(let t of this.callbacks.close)t()}}},Hn=class{destroying;destroyed;id=null;isTestTransport=!0;remoteId=null;remoteWsId=!1;callbacks={connect:[],close:[],data:[],signal:[],error:[]};initiator;trickle;wrtc;constructor(t={initiator:!1,trickle:!0,wrtc:null,timeout:5e3}){Tt.inscribeInstance(this),this.initiator=t.initiator,this.trickle=t.trickle,this.wrtc=t.wrtc,this.initiator&&Pn.buildSDP(this.id,"offer")}on(t,e){this.callbacks[t]&&this.callbacks[t].push(e)}dispatchError(t){this.callbacks.error.forEach(e=>e(new Error(t)))}signal(t){if(!this.destroying){if(this.destroyed)throw new Error(`Transport instance already destroyed: ${this.id}`);if(this.remoteId)return this.dispatchError(`Transport instance already connected to a remote ID: ${this.remoteId}`);if(!t.sdp||!t.sdp.id)return this.dispatchError("Invalid remote SDP:",t);if(t.type==="answer"&&!this.initiator)return this.dispatchError("Invalid remote SDP type: expecting an answer.");if(t.type==="offer"&&this.initiator)return this.dispatchError("Invalid remote SDP type: expecting an offer.");Pn.digestSignal(t,this.id)}}send(t){let{success:e,reason:n}=Tt.sendData(this.id,this.remoteId,t);e||this.destroy(n)}close(){this.destroy()}destroy(t=null){this.destroying||(this.destroying=!0,t&&this.dispatchError(t),this.callbacks.close?.forEach(e=>e()),Tt.destroyTransportAndAssociatedTransport(this.id),this.destroyed=!0,this.destroying=!1)}},Tt=new en,Pn=new tn(Tt),nn=new On});function Qe(a){return a instanceof Uint8Array||ArrayBuffer.isView(a)&&a.constructor.name==="Uint8Array"}function be(a,t=""){if(!Number.isSafeInteger(a)||a<0){let e=t&&`"${t}" `;throw new Error(`${e}expected integer >= 0, got ${a}`)}}function it(a,t,e=""){let n=Qe(a),r=a?.length,s=t!==void 0;if(!n||s&&r!==t){let o=e&&`"${e}" `,f=s?` of length ${t}`:"",h=n?`length=${r}`:`type=${typeof a}`;throw new Error(o+"expected Uint8Array"+f+", got "+h)}return a}function Jn(a,t=!0){if(a.destroyed)throw new Error("Hash instance has been destroyed");if(t&&a.finished)throw new Error("Hash#digest() has already been called")}function Or(a,t){it(a,void 0,"digestInto() output");let e=t.outputLen;if(a.length<e)throw new Error('"digestInto() output" expected to be of length >='+e)}function Oe(...a){for(let t=0;t<a.length;t++)a[t].fill(0)}function ln(a){return new DataView(a.buffer,a.byteOffset,a.byteLength)}function se(a){if(it(a),Gr)return a.toHex();let t="";for(let e=0;e<a.length;e++)t+=Gs[a[e]];return t}function Mr(a){if(a>=Vt._0&&a<=Vt._9)return a-Vt._0;if(a>=Vt.A&&a<=Vt.F)return a-(Vt.A-10);if(a>=Vt.a&&a<=Vt.f)return a-(Vt.a-10)}function oe(a){if(typeof a!="string")throw new Error("hex string expected, got "+typeof a);if(Gr)return Uint8Array.fromHex(a);let t=a.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(e);for(let r=0,s=0;r<e;r++,s+=2){let o=Mr(a.charCodeAt(s)),f=Mr(a.charCodeAt(s+1));if(o===void 0||f===void 0){let h=a[s]+a[s+1];throw new Error('hex string expected, got non-hex character "'+h+'" at index '+s)}n[r]=o*16+f}return n}function It(...a){let t=0;for(let n=0;n<a.length;n++){let r=a[n];it(r),t+=r.length}let e=new Uint8Array(t);for(let n=0,r=0;n<a.length;n++){let s=a[n];e.set(s,r),r+=s.length}return e}function Hr(a,t={}){let e=(r,s)=>a(s).update(r).digest(),n=a(void 0);return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=r=>a(r),Object.assign(e,t),Object.freeze(e)}function Ft(a=32){let t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return t.getRandomValues(new Uint8Array(a))}var Gr,Gs,Vt,Pr,we=pt(()=>{Gr=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Gs=Array.from({length:256},(a,t)=>t.toString(16).padStart(2,"0"));Vt={_0:48,_9:57,A:65,F:70,a:97,f:102};Pr=a=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,a])})});var dn,xt,Yr=pt(()=>{we();dn=class{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,e,n,r){this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(t),this.view=ln(this.buffer)}update(t){Jn(this),it(t);let{view:e,buffer:n,blockLen:r}=this,s=t.length;for(let o=0;o<s;){let f=Math.min(r-this.pos,s-o);if(f===r){let h=ln(t);for(;r<=s-o;o+=r)this.process(h,o);continue}n.set(t.subarray(o,o+f),this.pos),this.pos+=f,o+=f,this.pos===r&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Jn(this),Or(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:r,isLE:s}=this,{pos:o}=this;e[o++]=128,Oe(this.buffer.subarray(o)),this.padOffset>r-o&&(this.process(n,0),o=0);for(let E=o;E<r;E++)e[E]=0;n.setBigUint64(r-8,BigInt(this.length*8),s),this.process(n,0);let f=ln(t),h=this.outputLen;if(h%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let c=h/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let E=0;E<c;E++)f.setUint32(4*E,u[E],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||=new this.constructor,t.set(...this.get());let{blockLen:e,buffer:n,length:r,finished:s,destroyed:o,pos:f}=this;return t.destroyed=o,t.finished=s,t.length=r,t.pos=f,r%e&&t.buffer.set(n),t}clone(){return this._cloneInto()}},xt=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])});function Hs(a,t=!1){return t?{h:Number(a&In),l:Number(a>>qr&In)}:{h:Number(a>>qr&In)|0,l:Number(a&In)|0}}function Kr(a,t=!1){let e=a.length,n=new Uint32Array(e),r=new Uint32Array(e);for(let s=0;s<e;s++){let{h:o,l:f}=Hs(a[s],t);[n[s],r[s]]=[o,f]}return[n,r]}function qt(a,t,e,n){let r=(t>>>0)+(n>>>0);return{h:a+e+(r/2**32|0)|0,l:r|0}}var In,qr,Wn,jn,Ae,ae,Ge,He,Jr,Wr,jr,Vr,Xr,$r,Zr=pt(()=>{In=BigInt(4294967295),qr=BigInt(32);Wn=(a,t,e)=>a>>>e,jn=(a,t,e)=>a<<32-e|t>>>e,Ae=(a,t,e)=>a>>>e|t<<32-e,ae=(a,t,e)=>a<<32-e|t>>>e,Ge=(a,t,e)=>a<<64-e|t>>>e-32,He=(a,t,e)=>a>>>e-32|t<<64-e;Jr=(a,t,e)=>(a>>>0)+(t>>>0)+(e>>>0),Wr=(a,t,e,n)=>t+e+n+(a/2**32|0)|0,jr=(a,t,e,n)=>(a>>>0)+(t>>>0)+(e>>>0)+(n>>>0),Vr=(a,t,e,n,r)=>t+e+n+r+(a/2**32|0)|0,Xr=(a,t,e,n,r)=>(a>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),$r=(a,t,e,n,r,s)=>t+e+n+r+s+(a/2**32|0)|0});var zr,Ys,qs,zt,te,Vn,Xn,ce,ti=pt(()=>{Yr();Zr();we();zr=Kr(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(a=>BigInt(a))),Ys=zr[0],qs=zr[1],zt=new Uint32Array(80),te=new Uint32Array(80),Vn=class extends dn{constructor(t){super(128,t,16,!1)}get(){let{Ah:t,Al:e,Bh:n,Bl:r,Ch:s,Cl:o,Dh:f,Dl:h,Eh:c,El:u,Fh:E,Fl:l,Gh:y,Gl:C,Hh:Q,Hl:S}=this;return[t,e,n,r,s,o,f,h,c,u,E,l,y,C,Q,S]}set(t,e,n,r,s,o,f,h,c,u,E,l,y,C,Q,S){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=r|0,this.Ch=s|0,this.Cl=o|0,this.Dh=f|0,this.Dl=h|0,this.Eh=c|0,this.El=u|0,this.Fh=E|0,this.Fl=l|0,this.Gh=y|0,this.Gl=C|0,this.Hh=Q|0,this.Hl=S|0}process(t,e){for(let p=0;p<16;p++,e+=4)zt[p]=t.getUint32(e),te[p]=t.getUint32(e+=4);for(let p=16;p<80;p++){let _=zt[p-15]|0,w=te[p-15]|0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,S,g,B)}roundClean(){Oe(zt,te)}destroy(){Oe(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Xn=class extends Vn{Ah=xt[0]|0;Al=xt[1]|0;Bh=xt[2]|0;Bl=xt[3]|0;Ch=xt[4]|0;Cl=xt[5]|0;Dh=xt[6]|0;Dl=xt[7]|0;Eh=xt[8]|0;El=xt[9]|0;Fh=xt[10]|0;Fl=xt[11]|0;Gh=xt[12]|0;Gl=xt[13]|0;Hh=xt[14]|0;Hl=xt[15]|0;constructor(){super(64)}},ce=Hr(()=>new Xn,Pr(3))});function pn(a,t=""){if(typeof a!="boolean"){let e=t&&`"${t}" `;throw new Error(e+"expected boolean, got type="+typeof a)}return a}function Ks(a){if(typeof a=="bigint"){if(!En(a))throw new Error("positive bigint expected, got "+a)}else be(a);return a}function fe(a,t=""){if(!Number.isSafeInteger(a)){let e=t&&`"${t}" `;throw new Error(e+"expected safe integer, got type="+typeof a)}}function ei(a){if(typeof a!="string")throw new Error("hex string expected, got "+typeof a);return a===""?Zn:BigInt("0x"+a)}function he(a){return ei(se(a))}function Ut(a){return ei(se(ge(it(a)).reverse()))}function ue(a,t){be(t),a=Ks(a);let e=oe(a.toString(16).padStart(t*2,"0"));if(e.length!==t)throw new Error("number too large");return e}function Pe(a,t){return ue(a,t).reverse()}function ni(a,t){if(a.length!==t.length)return!1;let e=0;for(let n=0;n<a.length;n++)e|=a[n]^t[n];return e===0}function ge(a){return Uint8Array.from(a)}function kt(a){return Uint8Array.from(a,(t,e)=>{let n=t.charCodeAt(0);if(t.length!==1||n>127)throw new Error(`string contains non-ASCII character "${a[e]}" with code ${n} at position ${e}`);return n})}function Js(a,t,e){return En(a)&&En(t)&&En(e)&&t<=a&&a<e}function me(a,t,e,n){if(!Js(t,e,n))throw new Error("expected valid "+a+": "+e+" <= n < "+n+", got "+t)}function ri(a){let t;for(t=0;a>Zn;a>>=$n,t+=1);return t}function Pt(a,t={},e={}){if(!a||typeof a!="object")throw new Error("expected valid options object");function n(s,o,f){let h=a[s];if(f&&h===void 0)return;let c=typeof h;if(c!==o||h===null)throw new Error(`param "${s}" is invalid: expected ${o}, got ${c}`)}let r=(s,o)=>Object.entries(s).forEach(([f,h])=>n(f,h,o));r(t,!1),r(e,!0)}function er(a){let t=new WeakMap;return(e,...n)=>{let r=t.get(e);if(r!==void 0)return r;let s=a(e,...n);return t.set(e,s),s}}var Zn,$n,En,zn,tr,ee=pt(()=>{we();we();Zn=BigInt(0),$n=BigInt(1);En=a=>typeof a=="bigint"&&Zn<=a;zn=a=>($n<<BigInt(a))-$n;tr=()=>{throw new Error("not implemented")}});function ht(a,t){let e=a%t;return e>=Lt?e:t+e}function Ht(a,t,e){let n=a;for(;t-- >Lt;)n*=n,n%=e;return n}function ii(a,t){if(a===Lt)throw new Error("invert: expected non-zero number");if(t<=Lt)throw new Error("invert: expected positive modulus, got "+t);let e=ht(a,t),n=t,r=Lt,s=bt,o=bt,f=Lt;for(;e!==Lt;){let c=n/e,u=n%e,E=r-o*c,l=s-f*c;n=e,e=u,r=o,s=f,o=E,f=l}if(n!==bt)throw new Error("invert: does not exist");return ht(r,t)}function rr(a,t,e){if(!a.eql(a.sqr(t),e))throw new Error("Cannot find square root")}function hi(a,t){let e=(a.ORDER+bt)/Ai,n=a.pow(t,e);return rr(a,n,t),n}function Vs(a,t){let e=(a.ORDER-ai)/ci,n=a.mul(t,le),r=a.pow(n,e),s=a.mul(t,r),o=a.mul(a.mul(s,le),r),f=a.mul(s,a.sub(o,a.ONE));return rr(a,f,t),f}function Xs(a){let t=Bn(a),e=ui(a),n=e(t,t.neg(t.ONE)),r=e(t,n),s=e(t,t.neg(n)),o=(a+Ws)/fi;return(f,h)=>{let c=f.pow(h,o),u=f.mul(c,n),E=f.mul(c,r),l=f.mul(c,s),y=f.eql(f.sqr(u),h),C=f.eql(f.sqr(E),h);c=f.cmov(c,u,y),u=f.cmov(l,E,C);let Q=f.eql(f.sqr(u),h),S=f.cmov(c,u,Q);return rr(f,S,h),S}}function ui(a){if(a<oi)throw new Error("sqrt is not defined for small field");let t=a-bt,e=0;for(;t%le===Lt;)t/=le,e++;let n=le,r=Bn(a);for(;si(r,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return hi;let s=r.pow(n,t),o=(t+bt)/le;return function(h,c){if(h.is0(c))return c;if(si(h,c)!==1)throw new Error("Cannot find square root");let u=e,E=h.mul(h.ONE,s),l=h.pow(c,t),y=h.pow(c,o);for(;!h.eql(l,h.ONE);){if(h.is0(l))return h.ZERO;let C=1,Q=h.sqr(l);for(;!h.eql(Q,h.ONE);)if(C++,Q=h.sqr(Q),C===u)throw new Error("Cannot find square root");let S=bt<<BigInt(u-C-1),g=h.pow(E,S);u=C,E=h.sqr(g),l=h.mul(l,E),y=h.mul(y,g)}return y}}function $s(a){return a%Ai===oi?hi:a%ci===ai?Vs:a%fi===js?Xs(a):ui(a)}function gi(a){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},e=Zs.reduce((n,r)=>(n[r]="function",n),t);return Pt(a,e),a}function zs(a,t,e){if(e<Lt)throw new Error("invalid exponent, negatives unsupported");if(e===Lt)return a.ONE;if(e===bt)return t;let n=a.ONE,r=t;for(;e>Lt;)e&bt&&(n=a.mul(n,r)),r=a.sqr(r),e>>=bt;return n}function Se(a,t,e=!1){let n=new Array(t.length).fill(e?a.ZERO:void 0),r=t.reduce((o,f,h)=>a.is0(f)?o:(n[h]=o,a.mul(o,f)),a.ONE),s=a.inv(r);return t.reduceRight((o,f,h)=>a.is0(f)?o:(n[h]=a.mul(o,n[h]),a.mul(o,f)),s),n}function si(a,t){let e=(a.ORDER-bt)/le,n=a.pow(t,e),r=a.eql(n,a.ONE),s=a.eql(n,a.ZERO),o=a.eql(n,a.neg(a.ONE));if(!r&&!s&&!o)throw new Error("invalid Legendre symbol result");return r?1:s?0:-1}function to(a,t){t!==void 0&&be(t);let e=t!==void 0?t:a.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function Bn(a,t={}){return new nr(a,t)}function li(a,t){if(!a.isOdd)throw new Error("Field doesn't have isOdd");let e=a.sqrt(t);return a.isOdd(e)?a.neg(e):e}function di(a){if(typeof a!="bigint")throw new Error("field order must be bigint");let t=a.toString(2).length;return Math.ceil(t/8)}function ir(a){let t=di(a);return t+Math.ceil(t/2)}function Ii(a,t,e=!1){it(a);let n=a.length,r=di(t),s=ir(t);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);let o=e?Ut(a):he(a),f=ht(o,t-bt)+bt;return e?Pe(f,r):ue(f,r)}var Lt,bt,le,oi,Ai,ai,Ws,ci,js,fi,Xt,Zs,nr,_e=pt(()=>{ee();Lt=BigInt(0),bt=BigInt(1),le=BigInt(2),oi=BigInt(3),Ai=BigInt(4),ai=BigInt(5),Ws=BigInt(7),ci=BigInt(8),js=BigInt(9),fi=BigInt(16);Xt=(a,t)=>(ht(a,t)&bt)===bt,Zs=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];nr=class{ORDER;BITS;BYTES;isLE;ZERO=Lt;ONE=bt;_lengths;_sqrt;_mod;constructor(t,e={}){if(t<=Lt)throw new Error("invalid field: expected ORDER > 0, got "+t);let n;this.isLE=!1,e!=null&&typeof e=="object"&&(typeof e.BITS=="number"&&(n=e.BITS),typeof e.sqrt=="function"&&(this.sqrt=e.sqrt),typeof e.isLE=="boolean"&&(this.isLE=e.isLE),e.allowedLengths&&(this._lengths=e.allowedLengths?.slice()),typeof e.modFromBytes=="boolean"&&(this._mod=e.modFromBytes));let{nBitLength:r,nByteLength:s}=to(t,n);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=r,this.BYTES=s,this._sqrt=void 0,Object.preventExtensions(this)}create(t){return ht(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof t);return Lt<=t&&t<this.ORDER}is0(t){return t===Lt}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&bt)===bt}neg(t){return ht(-t,this.ORDER)}eql(t,e){return t===e}sqr(t){return ht(t*t,this.ORDER)}add(t,e){return ht(t+e,this.ORDER)}sub(t,e){return ht(t-e,this.ORDER)}mul(t,e){return ht(t*e,this.ORDER)}pow(t,e){return zs(this,t,e)}div(t,e){return ht(t*ii(e,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,e){return t+e}subN(t,e){return t-e}mulN(t,e){return t*e}inv(t){return ii(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=$s(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?Pe(t,this.BYTES):ue(t,this.BYTES)}fromBytes(t,e=!1){it(t);let{_lengths:n,BYTES:r,isLE:s,ORDER:o,_mod:f}=this;if(n){if(!n.includes(t.length)||t.length>r)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+t.length);let c=new Uint8Array(r);c.set(t,s?0:c.length-t.length),t=c}if(t.length!==r)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+t.length);let h=s?Ut(t):he(t);if(f&&(h=ht(h,o)),!e&&!this.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h}invertBatch(t){return Se(this,t)}cmov(t,e,n){return n?e:t}}});function Ei(a,t){let e=t.negate();return a?e:t}function Qn(a,t){let e=Se(a.Fp,t.map(n=>n.Z));return t.map((n,r)=>a.fromAffine(n.toAffine(e[r])))}function yi(a,t){if(!Number.isSafeInteger(a)||a<=0||a>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+a)}function sr(a,t){yi(a,t);let e=Math.ceil(t/a)+1,n=2**(a-1),r=2**a,s=zn(a),o=BigInt(a);return{windows:e,windowSize:n,mask:s,maxNumber:r,shiftBy:o}}function pi(a,t,e){let{windowSize:n,mask:r,maxNumber:s,shiftBy:o}=e,f=Number(a&r),h=a>>o;f>n&&(f-=s,h+=ar);let c=t*n,u=c+Math.abs(f)-1,E=f===0,l=f<0,y=t%2!==0;return{nextN:h,offset:u,isZero:E,isNeg:l,isNegF:y,offsetF:c}}function eo(a,t){if(!Array.isArray(a))throw new Error("array expected");a.forEach((e,n)=>{if(!(e instanceof t))throw new Error("invalid point at index "+n)})}function no(a,t){if(!Array.isArray(a))throw new Error("array of scalars expected");a.forEach((e,n)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+n)})}function Ar(a){return Qi.get(a)||1}function Bi(a){if(a!==Cn)throw new Error("invalid wNAF")}function bi(a,t,e){let n=a.Fn;eo(t,a),no(e,n);let r=t.length,s=e.length;if(r!==s)throw new Error("arrays of points and scalars must have equal length");let o=a.ZERO,f=ri(BigInt(r)),h=1;f>12?h=f-3:f>4?h=f-2:f>0&&(h=2);let c=zn(h),u=new Array(Number(c)+1).fill(o),E=Math.floor((n.BITS-1)/h)*h,l=o;for(let y=E;y>=0;y-=h){u.fill(o);for(let Q=0;Q<s;Q++){let S=e[Q],g=Number(S>>BigInt(y)&c);u[g]=u[g].add(t[Q])}let C=o;for(let Q=u.length-1,S=o;Q>0;Q--)S=S.add(u[Q]),C=C.add(S);if(l=l.add(C),y!==0)for(let Q=0;Q<h;Q++)l=l.double()}return l}function Ci(a,t,e){if(t){if(t.ORDER!==a)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return gi(t),t}else return Bn(a,{isLE:e})}function wi(a,t,e={},n){if(n===void 0&&(n=a==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${a} CURVE object`);for(let h of["p","n","h"]){let c=t[h];if(!(typeof c=="bigint"&&c>Cn))throw new Error(`CURVE.${h} must be positive bigint`)}let r=Ci(t.p,e.Fp,n),s=Ci(t.n,e.Fn,n),f=["Gx","Gy","a",a==="weierstrass"?"b":"d"];for(let h of f)if(!r.isValid(t[h]))throw new Error(`CURVE.${h} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:r,Fn:s}}function bn(a,t){return function(n){let r=a(n);return{secretKey:r,publicKey:t(r)}}}var Cn,ar,or,Qi,yn,wn=pt(()=>{ee();_e();Cn=BigInt(0),ar=BigInt(1);or=new WeakMap,Qi=new WeakMap;yn=class{BASE;ZERO;Fn;bits;constructor(t,e){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=e}_unsafeLadder(t,e,n=this.ZERO){let r=t;for(;e>Cn;)e&ar&&(n=n.add(r)),r=r.double(),e>>=ar;return n}precomputeWindow(t,e){let{windows:n,windowSize:r}=sr(e,this.bits),s=[],o=t,f=o;for(let h=0;h<n;h++){f=o,s.push(f);for(let c=1;c<r;c++)f=f.add(o),s.push(f);o=f.double()}return s}wNAF(t,e,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let r=this.ZERO,s=this.BASE,o=sr(t,this.bits);for(let f=0;f<o.windows;f++){let{nextN:h,offset:c,isZero:u,isNeg:E,isNegF:l,offsetF:y}=pi(n,f,o);n=h,u?s=s.add(Ei(l,e[y])):r=r.add(Ei(E,e[c]))}return Bi(n),{p:r,f:s}}wNAFUnsafe(t,e,n,r=this.ZERO){let s=sr(t,this.bits);for(let o=0;o<s.windows&&n!==Cn;o++){let{nextN:f,offset:h,isZero:c,isNeg:u}=pi(n,o,s);if(n=f,!c){let E=e[h];r=r.add(u?E.negate():E)}}return Bi(n),r}getPrecomputes(t,e,n){let r=or.get(e);return r||(r=this.precomputeWindow(e,t),t!==1&&(typeof n=="function"&&(r=n(r)),or.set(e,r))),r}cached(t,e,n){let r=Ar(t);return this.wNAF(r,this.getPrecomputes(r,t,n),e)}unsafe(t,e,n,r){let s=Ar(t);return s===1?this._unsafeLadder(t,e,r):this.wNAFUnsafe(s,this.getPrecomputes(s,t,n),e,r)}createCache(t,e){yi(e,this.bits),Qi.set(t,e),or.delete(t)}hasCache(t){return Ar(t)!==1}}});function io(a,t,e,n){let r=a.sqr(e),s=a.sqr(n),o=a.add(a.mul(t.a,r),s),f=a.add(a.ONE,a.mul(t.d,a.mul(r,s)));return a.eql(o,f)}function mi(a,t={}){let e=wi("edwards",a,t,t.FpFnLE),{Fp:n,Fn:r}=e,s=e.CURVE,{h:o}=s;Pt(t,{},{uvRatio:"function"});let f=cr<<BigInt(r.BYTES*8)-wt,h=S=>n.create(S),c=t.uvRatio||((S,g)=>{try{return{isValid:!0,value:n.sqrt(n.div(S,g))}}catch{return{isValid:!1,value:ne}}});if(!io(n,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function u(S,g,B=!1){let p=B?wt:ne;return me("coordinate "+S,g,p,f),g}function E(S){if(!(S instanceof C))throw new Error("EdwardsPoint expected")}let l=er((S,g)=>{let{X:B,Y:p,Z:_}=S,w=S.is0();g==null&&(g=w?ro:n.inv(_));let x=h(B*g),v=h(p*g),b=n.mul(_,g);if(w)return{x:ne,y:wt};if(b!==wt)throw new Error("invZ was invalid");return{x,y:v}}),y=er(S=>{let{a:g,d:B}=s;if(S.is0())throw new Error("bad point: ZERO");let{X:p,Y:_,Z:w,T:x}=S,v=h(p*p),b=h(_*_),m=h(w*w),N=h(m*m),M=h(v*g),D=h(m*h(M+b)),T=h(N+h(B*h(v*b)));if(D!==T)throw new Error("bad point: equation left != right (1)");let L=h(p*_),G=h(w*x);if(L!==G)throw new Error("bad point: equation left != right (2)");return!0});class C{static BASE=new C(s.Gx,s.Gy,wt,h(s.Gx*s.Gy));static ZERO=new C(ne,wt,wt,ne);static Fp=n;static Fn=r;X;Y;Z;T;constructor(g,B,p,_){this.X=u("x",g),this.Y=u("y",B),this.Z=u("z",p,!0),this.T=u("t",_),Object.freeze(this)}static CURVE(){return s}static fromAffine(g){if(g instanceof C)throw new Error("extended point not allowed");let{x:B,y:p}=g||{};return u("x",B),u("y",p),new C(B,p,wt,h(B*p))}static fromBytes(g,B=!1){let p=n.BYTES,{a:_,d:w}=s;g=ge(it(g,p,"point")),pn(B,"zip215");let x=ge(g),v=g[p-1];x[p-1]=v&-129;let b=Ut(x),m=B?f:n.ORDER;me("point.y",b,ne,m);let N=h(b*b),M=h(N-wt),D=h(w*N-_),{isValid:T,value:L}=c(M,D);if(!T)throw new Error("bad point: invalid y coordinate");let G=(L&wt)===wt,q=(v&128)!==0;if(!B&&L===ne&&q)throw new Error("bad point: x=0 and x_0=1");return q!==G&&(L=h(-L)),C.fromAffine({x:L,y:b})}static fromHex(g,B=!1){return C.fromBytes(oe(g),B)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(g=8,B=!0){return Q.createCache(this,g),B||this.multiply(cr),this}assertValidity(){y(this)}equals(g){E(g);let{X:B,Y:p,Z:_}=this,{X:w,Y:x,Z:v}=g,b=h(B*v),m=h(w*_),N=h(p*v),M=h(x*_);return b===m&&N===M}is0(){return this.equals(C.ZERO)}negate(){return new C(h(-this.X),this.Y,this.Z,h(-this.T))}double(){let{a:g}=s,{X:B,Y:p,Z:_}=this,w=h(B*B),x=h(p*p),v=h(cr*h(_*_)),b=h(g*w),m=B+p,N=h(h(m*m)-w-x),M=b+x,D=M-v,T=b-x,L=h(N*D),G=h(M*T),q=h(N*T),P=h(D*M);return new C(L,G,P,q)}add(g){E(g);let{a:B,d:p}=s,{X:_,Y:w,Z:x,T:v}=this,{X:b,Y:m,Z:N,T:M}=g,D=h(_*b),T=h(w*m),L=h(v*p*M),G=h(x*N),q=h((_+w)*(b+m)-D-T),P=G-L,K=G+L,Y=h(T-B*D),$=h(q*P),J=h(K*Y),X=h(q*Y),et=h(P*K);return new C($,J,et,X)}subtract(g){return this.add(g.negate())}multiply(g){if(!r.isValidNot0(g))throw new Error("invalid scalar: expected 1 <= sc < curve.n");let{p:B,f:p}=Q.cached(this,g,_=>Qn(C,_));return Qn(C,[B,p])[0]}multiplyUnsafe(g,B=C.ZERO){if(!r.isValid(g))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return g===ne?C.ZERO:this.is0()||g===wt?this:Q.unsafe(this,g,p=>Qn(C,p),B)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}isTorsionFree(){return Q.unsafe(this,s.n).is0()}toAffine(g){return l(this,g)}clearCofactor(){return o===wt?this:this.multiplyUnsafe(o)}toBytes(){let{x:g,y:B}=this.toAffine(),p=n.toBytes(B);return p[p.length-1]|=g&wt?128:0,p}toHex(){return se(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let Q=new yn(C,r.BITS);return C.BASE.precompute(8),C}function Si(a,t,e={}){if(typeof t!="function")throw new Error('"hash" function param is required');Pt(e,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:n}=e,{BASE:r,Fp:s,Fn:o}=a,f=e.randomBytes||Ft,h=e.adjustScalarBytes||(b=>b),c=e.domain||((b,m,N)=>{if(pn(N,"phflag"),m.length||N)throw new Error("Contexts/pre-hash are not supported");return b});function u(b){return o.create(Ut(b))}function E(b){let m=p.secretKey;it(b,p.secretKey,"secretKey");let N=it(t(b),2*m,"hashedSecretKey"),M=h(N.slice(0,m)),D=N.slice(m,2*m),T=u(M);return{head:M,prefix:D,scalar:T}}function l(b){let{head:m,prefix:N,scalar:M}=E(b),D=r.multiply(M),T=D.toBytes();return{head:m,prefix:N,scalar:M,point:D,pointBytes:T}}function y(b){return l(b).pointBytes}function C(b=Uint8Array.of(),...m){let N=It(...m);return u(t(c(N,it(b,void 0,"context"),!!n)))}function Q(b,m,N={}){b=it(b,void 0,"message"),n&&(b=n(b));let{prefix:M,scalar:D,pointBytes:T}=l(m),L=C(N.context,M,b),G=r.multiply(L).toBytes(),q=C(N.context,G,T,b),P=o.create(L+q*D);if(!o.isValid(P))throw new Error("sign failed: invalid s");let K=It(G,o.toBytes(P));return it(K,p.signature,"result")}let S={zip215:!0};function g(b,m,N,M=S){let{context:D,zip215:T}=M,L=p.signature;b=it(b,L,"signature"),m=it(m,void 0,"message"),N=it(N,p.publicKey,"publicKey"),T!==void 0&&pn(T,"zip215"),n&&(m=n(m));let G=L/2,q=b.subarray(0,G),P=Ut(b.subarray(G,L)),K,Y,$;try{K=a.fromBytes(N,T),Y=a.fromBytes(q,T),$=r.multiplyUnsafe(P)}catch{return!1}if(!T&&K.isSmallOrder())return!1;let J=C(D,Y.toBytes(),K.toBytes(),m);return Y.add(K.multiplyUnsafe(J)).subtract($).clearCofactor().is0()}let B=s.BYTES,p={secretKey:B,publicKey:B,signature:2*B,seed:B};function _(b=f(p.seed)){return it(b,p.seed,"seed")}function w(b){return Qe(b)&&b.length===o.BYTES}function x(b,m){try{return!!a.fromBytes(b,m)}catch{return!1}}let v={getExtendedPublicKey:l,randomSecretKey:_,isValidSecretKey:w,isValidPublicKey:x,toMontgomery(b){let{y:m}=a.fromBytes(b),N=p.publicKey,M=N===32;if(!M&&N!==57)throw new Error("only defined for 25519 and 448");let D=M?s.div(wt+m,wt-m):s.div(m-wt,m+wt);return s.toBytes(D)},toMontgomerySecret(b){let m=p.secretKey;it(b,m);let N=t(b.subarray(0,m));return h(N).subarray(0,m)}};return Object.freeze({keygen:bn(_,y),getPublicKey:y,sign:Q,verify:g,utils:v,Point:a,lengths:p})}var ne,wt,cr,ro,mn,_i=pt(()=>{ee();wn();ne=BigInt(0),wt=BigInt(1),cr=BigInt(2),ro=BigInt(8);mn=class{static BASE;static ZERO;static Fp;static Fn;ep;constructor(t){this.ep=t}static fromBytes(t){tr()}static fromHex(t){tr()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(t){return this.ep.toAffine(t)}toHex(){return se(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(t){return this.assertSame(t),this.init(this.ep.add(t.ep))}subtract(t){return this.assertSame(t),this.init(this.ep.subtract(t.ep))}multiply(t){return this.init(this.ep.multiply(t))}multiplyUnsafe(t){return this.init(this.ep.multiplyUnsafe(t))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(t,e){return this.init(this.ep.precompute(t,e))}}});function re(a,t){if(fe(a),fe(t),a<0||a>=1<<8*t)throw new Error("invalid I2OSP input: "+a);let e=Array.from({length:t}).fill(0);for(let n=t-1;n>=0;n--)e[n]=a&255,a>>>=8;return new Uint8Array(e)}function oo(a,t){let e=new Uint8Array(a.length);for(let n=0;n<a.length;n++)e[n]=a[n]^t[n];return e}function Ri(a){if(!Qe(a)&&typeof a!="string")throw new Error("DST must be Uint8Array or ascii string");return typeof a=="string"?kt(a):a}function Sn(a,t,e,n){it(a),fe(e),t=Ri(t),t.length>255&&(t=n(It(kt("H2C-OVERSIZE-DST-"),t)));let{outputLen:r,blockLen:s}=n,o=Math.ceil(e/r);if(e>65535||o>255)throw new Error("expand_message_xmd: invalid lenInBytes");let f=It(t,re(t.length,1)),h=re(0,s),c=re(e,2),u=new Array(o),E=n(It(h,a,c,re(0,1),f));u[0]=n(It(E,re(1,1),f));for(let y=1;y<=o;y++){let C=[oo(E,u[y-1]),re(y+1,1),f];u[y]=n(It(...C))}return It(...u).slice(0,e)}function Ao(a,t,e,n,r){if(it(a),fe(e),t=Ri(t),t.length>255){let s=Math.ceil(2*n/8);t=r.create({dkLen:s}).update(kt("H2C-OVERSIZE-DST-")).update(t).digest()}if(e>65535||t.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return r.create({dkLen:e}).update(a).update(re(e,2)).update(t).update(re(t.length,1)).digest()}function fr(a,t,e){Pt(e,{p:"bigint",m:"number",k:"number",hash:"function"});let{p:n,k:r,m:s,hash:o,expand:f,DST:h}=e;fe(o.outputLen,"valid hash"),it(a),fe(t);let c=n.toString(2).length,u=Math.ceil((c+r)/8),E=t*s*u,l;if(f==="xmd")l=Sn(a,h,E,o);else if(f==="xof")l=Ao(a,h,E,r,o);else if(f==="_internal_pass")l=a;else throw new Error('expand must be "xmd" or "xof"');let y=new Array(t);for(let C=0;C<t;C++){let Q=new Array(s);for(let S=0;S<s;S++){let g=u*(S+C*s),B=l.subarray(g,g+u);Q[S]=ht(so(B),n)}y[C]=Q}return y}function xi(a,t,e){if(typeof t!="function")throw new Error("mapToCurve() must be defined");function n(s){return a.fromAffine(t(s))}function r(s){let o=s.clearCofactor();return o.equals(a.ZERO)?a.ZERO:(o.assertValidity(),o)}return{defaults:Object.freeze(e),Point:a,hashToCurve(s,o){let f=Object.assign({},e,o),h=fr(s,2,f),c=n(h[0]),u=n(h[1]);return r(c.add(u))},encodeToCurve(s,o){let f=e.encodeDST?{DST:e.encodeDST}:{},h=Object.assign({},e,f,o),c=fr(s,1,h),u=n(c[0]);return r(u)},mapToCurve(s){if(e.m===1){if(typeof s!="bigint")throw new Error("expected bigint (m=1)");return r(n([s]))}if(!Array.isArray(s))throw new Error("expected array of bigints");for(let o of s)if(typeof o!="bigint")throw new Error("expected array of bigints");return r(n(s))},hashToScalar(s,o){let f=a.Fn.ORDER,h=Object.assign({},e,{p:f,m:1,DST:Ye},o);return fr(s,1,h)[0][0]}}}var so,Ye,hr=pt(()=>{ee();_e();so=he;Ye=kt("HashToScalar-")});function ao(a){return Pt(a,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...a})}function Di(a){let t=ao(a),{P:e,type:n,adjustScalarBytes:r,powPminus2:s,randomBytes:o}=t,f=n==="x25519";if(!f&&n!=="x448")throw new Error("invalid type");let h=o||Ft,c=f?255:448,u=f?32:56,E=BigInt(f?9:5),l=BigInt(f?121665:39081),y=f?_n**BigInt(254):_n**BigInt(447),C=f?BigInt(8)*_n**BigInt(251)-Re:BigInt(4)*_n**BigInt(445)-Re,Q=y+C+Re,S=L=>ht(L,e),g=B(E);function B(L){return Pe(S(L),u)}function p(L){let G=ge(it(L,u,"uCoordinate"));return f&&(G[31]&=127),S(Ut(G))}function _(L){return Ut(r(ge(it(L,u,"scalar"))))}function w(L,G){let q=N(p(G),_(L));if(q===qe)throw new Error("invalid private or public key received");return B(q)}function x(L){return w(L,g)}let v=x,b=w;function m(L,G,q){let P=S(L*(G-q));return G=S(G-P),q=S(q+P),{x_2:G,x_3:q}}function N(L,G){me("u",L,qe,e),me("scalar",G,y,Q);let q=G,P=L,K=Re,Y=qe,$=L,J=Re,X=qe;for(let nt=BigInt(c-1);nt>=qe;nt--){let ct=q>>nt&Re;X^=ct,{x_2:K,x_3:$}=m(X,K,$),{x_2:Y,x_3:J}=m(X,Y,J),X=ct;let rt=K+Y,Et=S(rt*rt),lt=K-Y,mt=S(lt*lt),Mt=Et-mt,yt=$+J,Nt=$-J,F=S(Nt*rt),H=S(yt*lt),V=F+H,O=F-H;$=S(V*V),J=S(P*S(O*O)),K=S(Et*mt),Y=S(Mt*(Et+S(l*Mt)))}({x_2:K,x_3:$}=m(X,K,$)),{x_2:Y,x_3:J}=m(X,Y,J);let et=s(Y);return S(K*et)}let M={secretKey:u,publicKey:u,seed:u},D=(L=h(u))=>(it(L,M.seed,"seed"),L),T={randomSecretKey:D};return Object.freeze({keygen:bn(D,v),getSharedSecret:b,getPublicKey:v,scalarMult:w,scalarMultBase:x,utils:T,GuBytes:g.slice(),lengths:M})}var qe,Re,_n,Ni=pt(()=>{ee();wn();_e();qe=BigInt(0),Re=BigInt(1),_n=BigInt(2)});function vi(a){Pt(a,{name:"string",hash:"function",hashToScalar:"function",hashToGroup:"function"});let{name:t,Point:e,hash:n}=a,{Fn:r}=e,s=(D,T)=>a.hashToGroup(D,{DST:It(kt("HashToGroup-"),T)}),o=(D,T)=>a.hashToScalar(D,{DST:It(Ye,T)}),f=(D=Ft)=>{let T=Ii(D(ir(r.ORDER)),r.ORDER,r.isLE);return r.isLE?Ut(T):he(T)},h=(D,T)=>bi(e,D,T),c=D=>It(kt("OPRFV1-"),new Uint8Array([D]),kt("-"+t)),u=c(0),E=c(1),l=c(2);function y(...D){let T=[];for(let L of D)typeof L=="number"?T.push(ue(L,2)):typeof L=="string"?T.push(kt(L)):(it(L),T.push(ue(L.length,2),L));return It(...T)}let C=(...D)=>n(y(...D,"Finalize"));function Q(D,T,L,G){let q=D.toBytes(),P=n(y(q,It(kt("Seed-"),G))),K=[];for(let Y=0;Y<T.length;Y++){let $=T[Y].toBytes(),J=L[Y].toBytes(),X=o(y(P,Y,$,J,"Composite"),G);K.push(X)}return K}function S(D,T,L,G){let q=Q(D,T,L,G),P=h(T,q),K=h(L,q);return{M:P,Z:K}}function g(D,T,L,G,q){let P=Q(T,L,G,q),K=h(L,P),Y=K.multiply(D);return{M:K,Z:Y}}function B(D,T,L,G,q,P){let[K,Y,$,J,X]=[D,T,L,G,q].map(et=>et.toBytes());return o(y(K,Y,$,J,X,"Challenge"),P)}function p(D,T,L,G,q,P){let{M:K,Z:Y}=g(T,L,G,q,D),$=f(P),J=e.BASE.multiply($),X=K.multiply($),et=B(L,K,Y,J,X,D),nt=r.sub($,r.mul(et,T));return It(...[et,nt].map(ct=>r.toBytes(ct)))}function _(D,T,L,G,q){it(q,2*r.BYTES);let{M:P,Z:K}=S(T,L,G,D),[Y,$]=[q.subarray(0,r.BYTES),q.subarray(r.BYTES)].map(nt=>r.fromBytes(nt)),J=e.BASE.multiply($).add(T.multiply(Y)),X=P.multiply($).add(K.multiply(Y)),et=B(T,P,K,J,X,D);if(!r.eql(Y,et))throw new Error("proof verification failed")}function w(){let D=f(),T=e.BASE.multiply(D);return{secretKey:r.toBytes(D),publicKey:T.toBytes()}}function x(D,T,L){let G=It(kt("DeriveKeyPair"),D),q=It(T,y(L),Uint8Array.of(0));for(let P=0;P<=255;P++){q[q.length-1]=P;let K=a.hashToScalar(q,{DST:G});if(!r.is0(K))return{secretKey:r.toBytes(K),publicKey:e.BASE.multiply(K).toBytes()}}throw new Error("Cannot derive key")}function v(D,T,L=Ft){let G=f(L),q=s(T,D);if(q.equals(e.ZERO))throw new Error("Input point at infinity");let P=q.multiply(G);return{blind:r.toBytes(G),blinded:P.toBytes()}}function b(D,T,L){let G=r.fromBytes(T),q=s(L,D);if(q.equals(e.ZERO))throw new Error("Input point at infinity");let P=q.multiply(G).toBytes();return C(L,P)}let m={generateKeyPair:w,deriveKeyPair:(D,T)=>x(u,D,T),blind:(D,T=Ft)=>v(u,D,T),blindEvaluate(D,T){let L=r.fromBytes(D);return e.fromBytes(T).multiply(L).toBytes()},finalize(D,T,L){let G=r.fromBytes(T),P=e.fromBytes(L).multiply(r.inv(G)).toBytes();return C(D,P)},evaluate:(D,T)=>b(u,D,T)};return Object.freeze({name:t,oprf:m,voprf:{generateKeyPair:w,deriveKeyPair:(D,T)=>x(E,D,T),blind:(D,T=Ft)=>v(E,D,T),blindEvaluateBatch(D,T,L,G=Ft){if(!Array.isArray(L))throw new Error("expected array");let q=r.fromBytes(D),P=e.fromBytes(T),K=L.map(e.fromBytes),Y=K.map(J=>J.multiply(q)),$=p(E,q,P,K,Y,G);return{evaluated:Y.map(J=>J.toBytes()),proof:$}},blindEvaluate(D,T,L,G=Ft){let q=this.blindEvaluateBatch(D,T,[L],G);return{evaluated:q.evaluated[0],proof:q.proof}},finalizeBatch(D,T,L){if(!Array.isArray(D))throw new Error("expected array");let G=e.fromBytes(T),q=D.map(K=>K.blinded).map(e.fromBytes),P=D.map(K=>K.evaluated).map(e.fromBytes);return _(E,G,q,P,L),D.map(K=>m.finalize(K.input,K.blind,K.evaluated))},finalize(D,T,L,G,q,P){return this.finalizeBatch([{input:D,blind:T,evaluated:L,blinded:G}],q,P)[0]},evaluate:(D,T)=>b(E,D,T)},poprf:D=>{let T=o(y("Info",D),l),L=e.BASE.multiply(T);return{generateKeyPair:w,deriveKeyPair:(G,q)=>x(l,G,q),blind(G,q,P=Ft){let K=e.fromBytes(q),Y=L.add(K);if(Y.equals(e.ZERO))throw new Error("tweakedKey point at infinity");let $=f(P),J=s(G,l);if(J.equals(e.ZERO))throw new Error("Input point at infinity");let X=J.multiply($);return{blind:r.toBytes($),blinded:X.toBytes(),tweakedKey:Y.toBytes()}},blindEvaluateBatch(G,q,P=Ft){if(!Array.isArray(q))throw new Error("expected array");let K=r.fromBytes(G),Y=r.add(K,T),$=r.inv(Y),J=q.map(e.fromBytes),X=J.map(ct=>ct.multiply($)),et=e.BASE.multiply(Y),nt=p(l,Y,et,X,J,P);return{evaluated:X.map(ct=>ct.toBytes()),proof:nt}},blindEvaluate(G,q,P=Ft){let K=this.blindEvaluateBatch(G,[q],P);return{evaluated:K.evaluated[0],proof:K.proof}},finalizeBatch(G,q,P){if(!Array.isArray(G))throw new Error("expected array");let K=G.map(Y=>Y.evaluated).map(e.fromBytes);return _(l,e.fromBytes(P),K,G.map(Y=>Y.blinded).map(e.fromBytes),q),G.map((Y,$)=>{let J=r.fromBytes(Y.blind),X=K[$].multiply(r.inv(J)).toBytes();return C(Y.input,D,X)})},finalize(G,q,P,K,Y,$){return this.finalizeBatch([{input:G,blind:q,evaluated:P,blinded:K}],Y,$)[0]},evaluate(G,q){let P=r.fromBytes(G),K=s(q,l);if(K.equals(e.ZERO))throw new Error("Input point at infinity");let Y=r.add(P,T),$=r.inv(Y),J=K.multiply($).toBytes();return C(q,D,J)}}},__tests:{Fn:r}})}var Ti=pt(()=>{ee();wn();hr();_e();});var qi={};ke(qi,{ED25519_TORSION_SUBGROUP:()=>_o,_map_to_curve_elligator2_curve25519:()=>Yi,ed25519:()=>fo,ed25519_hasher:()=>Bo,ed25519ctx:()=>ho,ed25519ph:()=>uo,ristretto255:()=>mo,ristretto255_hasher:()=>xn,ristretto255_oprf:()=>So,x25519:()=>go});function Oi(a){let t=BigInt(10),e=BigInt(20),n=BigInt(40),r=BigInt(80),s=Jt,f=a*a%s*a%s,h=Ht(f,Rn,s)*f%s,c=Ht(h,Kt,s)*a%s,u=Ht(c,Mi,s)*c%s,E=Ht(u,t,s)*u%s,l=Ht(E,e,s)*E%s,y=Ht(l,n,s)*l%s,C=Ht(y,r,s)*y%s,Q=Ht(C,r,s)*y%s,S=Ht(Q,t,s)*u%s;return{pow_p_5_8:Ht(S,Rn,s)*a%s,b2:f}}function Gi(a){return a[0]&=248,a[31]&=127,a[31]|=64,a}function Er(a,t){let e=Jt,n=ht(t*t*t,e),r=ht(n*n*t,e),s=Oi(a*r).pow_p_5_8,o=ht(a*n*s,e),f=ht(t*o*o,e),h=o,c=ht(o*ur,e),u=f===a,E=f===ht(-a,e),l=f===ht(-a*ur,e);return u&&(o=h),(E||l)&&(o=c),Xt(o,e)&&(o=ht(-o,e)),{isValid:u||E,value:o}}function Pi(a,t,e){if(t.length>255)throw new Error("Context is too big");return It(kt("SigEd25519 no Ed25519 collisions"),new Uint8Array([e?1:0,t.length]),t,a)}function pr(a){return Si($t,ce,Object.assign({adjustScalarBytes:Gi},a))}function Yi(a){let t=(Jt-Mi)/dr,e=BigInt(486662),n=Z.sqr(a);n=Z.mul(n,Rn);let r=Z.add(n,Z.ONE),s=Z.neg(e),o=Z.sqr(r),f=Z.mul(o,r),h=Z.mul(n,e);h=Z.mul(h,s),h=Z.add(h,o),h=Z.mul(h,s);let c=Z.sqr(f);o=Z.sqr(c),c=Z.mul(c,f),c=Z.mul(c,h),o=Z.mul(o,c);let u=Z.pow(o,t);u=Z.mul(u,c);let E=Z.mul(u,Fi);o=Z.sqr(u),o=Z.mul(o,f);let l=Z.eql(o,h),y=Z.cmov(E,u,l),C=Z.mul(s,n),Q=Z.mul(u,a);Q=Z.mul(Q,Io);let S=Z.mul(Q,Fi),g=Z.mul(h,n);o=Z.sqr(Q),o=Z.mul(o,f);let B=Z.eql(o,g),p=Z.cmov(S,Q,B);o=Z.sqr(y),o=Z.mul(o,f);let _=Z.eql(o,h),w=Z.cmov(C,s,_),x=Z.cmov(p,y,_),v=Z.isOdd(x);return x=Z.cmov(x,Z.neg(x),_!==v),{xMn:w,xMd:r,yMn:x,yMd:Kt}}function po(a){let{xMn:t,xMd:e,yMn:n,yMd:r}=Yi(a),s=Z.mul(t,r);s=Z.mul(s,Eo);let o=Z.mul(e,n),f=Z.sub(t,e),h=Z.add(t,e),c=Z.mul(o,h),u=Z.eql(c,Z.ZERO);s=Z.cmov(s,Z.ZERO,u),o=Z.cmov(o,Z.ONE,u),f=Z.cmov(f,Z.ONE,u),h=Z.cmov(h,Z.ONE,u);let[E,l]=Se(Z,[o,h],!0);return{x:Z.mul(s,E),y:Z.mul(f,l)}}function Li(a){let{d:t}=Ir,e=Jt,n=g=>Z.create(g),r=n(gr*a*a),s=n((r+Kt)*Qo),o=BigInt(-1),f=n((o-t*r)*n(r+t)),{isValid:h,value:c}=Er(s,f),u=n(c*a);Xt(u,e)||(u=n(-u)),h||(c=u),h||(o=r);let E=n(o*(r-Kt)*bo-f),l=c*c,y=n((c+c)*f),C=n(E*Co),Q=n(Kt-l),S=n(Kt+l);return new $t(n(y*S),n(Q*C),n(C*S),n(y*Q))}var co,Kt,Rn,ki,Mi,dr,Jt,Ir,ur,$t,Z,Hi,fo,ho,uo,go,lo,Io,Fi,Eo,Bo,gr,Co,yo,Qo,bo,Ui,wo,lr,xe,mo,xn,So,_o,Ki=pt(()=>{ti();we();_i();hr();_e();Ni();Ti();ee();co=BigInt(0),Kt=BigInt(1),Rn=BigInt(2),ki=BigInt(3),Mi=BigInt(5),dr=BigInt(8),Jt=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Ir={p:Jt,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:dr,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};ur=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");$t=mi(Ir,{uvRatio:Er}),Z=$t.Fp,Hi=$t.Fn;fo=pr({}),ho=pr({domain:Pi}),uo=pr({domain:Pi,prehash:ce}),go=(()=>{let a=Jt;return Di({P:a,type:"x25519",powPminus2:t=>{let{pow_p_5_8:e,b2:n}=Oi(t);return ht(Ht(e,ki,a)*n,a)},adjustScalarBytes:Gi})})(),lo=(Jt+ki)/dr,Io=Z.pow(Rn,lo),Fi=Z.sqrt(Z.neg(Z.ONE));Eo=li(Z,Z.neg(BigInt(486664)));Bo=xi($t,a=>po(a[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:Jt,m:1,k:128,expand:"xmd",hash:ce}),gr=ur,Co=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),yo=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),Qo=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),bo=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),Ui=a=>Er(Kt,a),wo=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),lr=a=>Z.create(Ut(a)&wo);xe=class a extends mn{static BASE=new a($t.BASE);static ZERO=new a($t.ZERO);static Fp=Z;static Fn=Hi;constructor(t){super(t)}static fromAffine(t){return new a($t.fromAffine(t))}assertSame(t){if(!(t instanceof a))throw new Error("RistrettoPoint expected")}init(t){return new a(t)}static fromBytes(t){it(t,32);let{a:e,d:n}=Ir,r=Jt,s=_=>Z.create(_),o=lr(t);if(!ni(Z.toBytes(o),t)||Xt(o,r))throw new Error("invalid ristretto255 encoding 1");let f=s(o*o),h=s(Kt+e*f),c=s(Kt-e*f),u=s(h*h),E=s(c*c),l=s(e*n*u-E),{isValid:y,value:C}=Ui(s(l*E)),Q=s(C*c),S=s(C*Q*l),g=s((o+o)*Q);Xt(g,r)&&(g=s(-g));let B=s(h*S),p=s(g*B);if(!y||Xt(p,r)||B===co)throw new Error("invalid ristretto255 encoding 2");return new a(new $t(g,B,Kt,p))}static fromHex(t){return a.fromBytes(oe(t))}toBytes(){let{X:t,Y:e,Z:n,T:r}=this.ep,s=Jt,o=S=>Z.create(S),f=o(o(n+e)*o(n-e)),h=o(t*e),c=o(h*h),{value:u}=Ui(o(f*c)),E=o(u*f),l=o(u*h),y=o(E*l*r),C;if(Xt(r*y,s)){let S=o(e*gr),g=o(t*gr);t=S,e=g,C=o(E*yo)}else C=l;Xt(t*y,s)&&(e=o(-e));let Q=o((n-e)*C);return Xt(Q,s)&&(Q=o(-Q)),Z.toBytes(Q)}equals(t){this.assertSame(t);let{X:e,Y:n}=this.ep,{X:r,Y:s}=t.ep,o=c=>Z.create(c),f=o(e*s)===o(n*r),h=o(n*s)===o(e*r);return f||h}is0(){return this.equals(a.ZERO)}},mo={Point:xe},xn={Point:xe,hashToCurve(a,t){let e=t?.DST||"ristretto255_XMD:SHA-512_R255MAP_RO_",n=Sn(a,e,64,ce);return xn.deriveToCurve(n)},hashToScalar(a,t={DST:Ye}){let e=Sn(a,t.DST,64,ce);return Hi.create(Ut(e))},deriveToCurve(a){it(a,64);let t=lr(a.subarray(0,32)),e=Li(t),n=lr(a.subarray(32,64)),r=Li(n);return new xe(e.add(r))}},So=vi({name:"ristretto255-SHA512",Point:xe,hash:ce,hashToGroup:xn.hashToCurve,hashToScalar:xn.hashToScalar}),_o=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"]});var es={};ke(es,{abool:()=>Ke,abytes:()=>dt,aexists:()=>Dn,anumber:()=>de,aoutput:()=>Br,bytesToHex:()=>Cr,bytesToNumberBE:()=>Do,bytesToUtf8:()=>vo,checkOpts:()=>Qr,clean:()=>jt,complexOverlapBytes:()=>To,concatBytes:()=>Je,copyBytes:()=>Ie,createView:()=>ji,equalBytes:()=>br,getOutput:()=>vn,hexToBytes:()=>$i,hexToNumber:()=>yr,isAligned32:()=>ts,isBytes:()=>Wi,isLE:()=>Vi,managedNonce:()=>Fo,numberToBytesBE:()=>Zi,overlapBytes:()=>zi,randomBytes:()=>Tn,u32:()=>Wt,u64Lengths:()=>wr,u8:()=>Ro,utf8ToBytes:()=>No,wrapCipher:()=>Nn});function Wi(a){return a instanceof Uint8Array||ArrayBuffer.isView(a)&&a.constructor.name==="Uint8Array"}function Ke(a){if(typeof a!="boolean")throw new Error(`boolean expected, not ${a}`)}function de(a){if(!Number.isSafeInteger(a)||a<0)throw new Error("positive integer expected, got "+a)}function dt(a,t,e=""){let n=Wi(a),r=a?.length,s=t!==void 0;if(!n||s&&r!==t){let o=e&&`"${e}" `,f=s?` of length ${t}`:"",h=n?`length=${r}`:`type=${typeof a}`;throw new Error(o+"expected Uint8Array"+f+", got "+h)}return a}function Dn(a,t=!0){if(a.destroyed)throw new Error("Hash instance has been destroyed");if(t&&a.finished)throw new Error("Hash#digest() has already been called")}function Br(a,t){dt(a,void 0,"output");let e=t.outputLen;if(a.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function Ro(a){return new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}function Wt(a){return new Uint32Array(a.buffer,a.byteOffset,Math.floor(a.byteLength/4))}function jt(...a){for(let t=0;t<a.length;t++)a[t].fill(0)}function ji(a){return new DataView(a.buffer,a.byteOffset,a.byteLength)}function Cr(a){if(dt(a),Xi)return a.toHex();let t="";for(let e=0;e<a.length;e++)t+=xo[a[e]];return t}function Ji(a){if(a>=Zt._0&&a<=Zt._9)return a-Zt._0;if(a>=Zt.A&&a<=Zt.F)return a-(Zt.A-10);if(a>=Zt.a&&a<=Zt.f)return a-(Zt.a-10)}function $i(a){if(typeof a!="string")throw new Error("hex string expected, got "+typeof a);if(Xi)return Uint8Array.fromHex(a);let t=a.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(e);for(let r=0,s=0;r<e;r++,s+=2){let o=Ji(a.charCodeAt(s)),f=Ji(a.charCodeAt(s+1));if(o===void 0||f===void 0){let h=a[s]+a[s+1];throw new Error('hex string expected, got non-hex character "'+h+'" at index '+s)}n[r]=o*16+f}return n}function yr(a){if(typeof a!="string")throw new Error("hex string expected, got "+typeof a);return BigInt(a===""?"0":"0x"+a)}function Do(a){return yr(Cr(a))}function Zi(a,t){return $i(a.toString(16).padStart(t*2,"0"))}function No(a){if(typeof a!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(a))}function vo(a){return new TextDecoder().decode(a)}function zi(a,t){return a.buffer===t.buffer&&a.byteOffset<t.byteOffset+t.byteLength&&t.byteOffset<a.byteOffset+a.byteLength}function To(a,t){if(zi(a,t)&&a.byteOffset<t.byteOffset)throw new Error("complex overlap of input and output is not supported")}function Je(...a){let t=0;for(let n=0;n<a.length;n++){let r=a[n];dt(r),t+=r.length}let e=new Uint8Array(t);for(let n=0,r=0;n<a.length;n++){let s=a[n];e.set(s,r),r+=s.length}return e}function Qr(a,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(a,t)}function br(a,t){if(a.length!==t.length)return!1;let e=0;for(let n=0;n<a.length;n++)e|=a[n]^t[n];return e===0}function vn(a,t,e=!0){if(t===void 0)return new Uint8Array(a);if(t.length!==a)throw new Error('"output" expected Uint8Array of length '+a+", got: "+t.length);if(e&&!ts(t))throw new Error("invalid output, must be aligned");return t}function wr(a,t,e){Ke(e);let n=new Uint8Array(16),r=ji(n);return r.setBigUint64(0,BigInt(t),e),r.setBigUint64(8,BigInt(a),e),n}function ts(a){return a.byteOffset%4===0}function Ie(a){return Uint8Array.from(a)}function Tn(a=32){let t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return t.getRandomValues(new Uint8Array(a))}function Fo(a,t=Tn){let{nonceLength:e}=a;de(e);let n=(r,s)=>{let o=Je(r,s);return s.fill(0),o};return((r,...s)=>({encrypt(o){dt(o);let f=t(e),h=a(r,f,...s).encrypt(o);return h instanceof Promise?h.then(c=>n(f,c)):n(f,h)},decrypt(o){dt(o);let f=o.subarray(0,e),h=o.subarray(e);return a(r,f,...s).decrypt(h)}}))}var Vi,Xi,xo,Zt,Nn,De=pt(()=>{Vi=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Xi=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",xo=Array.from({length:256},(a,t)=>t.toString(16).padStart(2,"0"));Zt={_0:48,_9:57,A:65,F:70,a:97,f:102};Nn=(a,t)=>{function e(n,...r){if(dt(n,void 0,"key"),!Vi)throw new Error("Non little-endian hardware is not yet supported");if(a.nonceLength!==void 0){let u=r[0];dt(u,a.varSizeNonce?void 0:a.nonceLength,"nonce")}let s=a.tagLength;s&&r[1]!==void 0&&dt(r[1],void 0,"AAD");let o=t(n,...r),f=(u,E)=>{if(E!==void 0){if(u!==2)throw new Error("cipher output not supported");dt(E,void 0,"output")}},h=!1;return{encrypt(u,E){if(h)throw new Error("cannot encrypt() twice with same key + nonce");return h=!0,dt(u),f(o.encrypt.length,E),o.encrypt(u,E)},decrypt(u,E){if(dt(u),s&&u.length<s)throw new Error('"ciphertext" expected length bigger than tagLength='+s);return f(o.decrypt.length,E),o.decrypt(u,E)}}}return Object.assign(e,a),e}});function z(a,t){return a<<t|a>>>32-t}function mr(a){return a.byteOffset%4===0}function Go(a,t,e,n,r,s,o,f){let h=r.length,c=new Uint8Array(Fn),u=Wt(c),E=mr(r)&&mr(s),l=E?Wt(r):ns,y=E?Wt(s):ns;for(let C=0;C<h;o++){if(a(t,e,n,u,o,f),o>=is)throw new Error("arx: counter overflow");let Q=Math.min(Fn,h-C);if(E&&Q===Fn){let S=C/4;if(C%4!==0)throw new Error("arx: invalid block position");for(let g=0,B;g<Oo;g++)B=S+g,y[B]=l[B]^u[g];C+=Fn;continue}for(let S=0,g;S<Q;S++)g=C+S,s[g]=r[g]^c[S];C+=Q}}function Ne(a,t){let{allowShortKeys:e,extendNonceFn:n,counterLength:r,counterRight:s,rounds:o}=Qr({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof a!="function")throw new Error("core must be a function");return de(r),de(o),Ke(s),Ke(e),(f,h,c,u,E=0)=>{dt(f,void 0,"key"),dt(h,void 0,"nonce"),dt(c,void 0,"data");let l=c.length;if(u===void 0&&(u=new Uint8Array(l)),dt(u,void 0,"output"),de(E),E<0||E>=is)throw new Error("arx: counter overflow");if(u.length<l)throw new Error(`arx: output (${u.length}) is shorter than data (${l})`);let y=[],C=f.length,Q,S;if(C===32)y.push(Q=Ie(f)),S=Mo;else if(C===16&&e)Q=new Uint8Array(32),Q.set(f),Q.set(f,16),S=ko,y.push(Q);else throw dt(f,32,"arx key"),new Error("invalid key size");mr(h)||y.push(h=Ie(h));let g=Wt(Q);if(n){if(h.length!==24)throw new Error("arx: extended nonce must be 24 bytes");n(S,g,Wt(h.subarray(0,16)),g),h=h.subarray(16)}let B=16-r;if(B!==h.length)throw new Error(`arx: nonce must be ${B} or 16 bytes`);if(B!==12){let _=new Uint8Array(12);_.set(h,s?0:12-h.length),h=_,y.push(h)}let p=Wt(h);return Go(a,S,g,p,c,u,E,o),jt(...y),u}}var rs,Uo,Lo,ko,Mo,Fn,Oo,is,ns,Sr,_r,ss=pt(()=>{De();rs=a=>Uint8Array.from(a.split(""),t=>t.charCodeAt(0)),Uo=rs("expand 16-byte k"),Lo=rs("expand 32-byte k"),ko=Wt(Uo),Mo=Wt(Lo);Fn=64,Oo=16,is=2**32-1,ns=Uint32Array.of();Sr=class a{blockLen;keyLen;nonceLen;state;buf;key;nonce;pos;ctr;cipher;constructor(t,e,n,r,s){this.cipher=t,this.blockLen=e,this.keyLen=n,this.nonceLen=r,this.state=new Uint8Array(this.keyLen+this.nonceLen),this.reseed(s),this.ctr=0,this.pos=this.blockLen,this.buf=new Uint8Array(this.blockLen),this.key=this.state.subarray(0,this.keyLen),this.nonce=this.state.subarray(this.keyLen)}reseed(t){if(dt(t),!t||t.length===0)throw new Error("entropy required");for(let e=0;e<t.length;e++)this.state[e%this.state.length]^=t[e];this.ctr=0,this.pos=this.blockLen}addEntropy(t){this.state.set(this.randomBytes(this.state.length)),this.reseed(t)}randomBytes(t){if(de(t),t===0)return new Uint8Array(0);let e=new Uint8Array(t),n=0;if(this.pos<this.blockLen){let o=Math.min(t,this.blockLen-this.pos);if(e.set(this.buf.subarray(this.pos,this.pos+o),0),this.pos+=o,n+=o,n===t)return e}let r=Math.floor((t-n)/this.blockLen);if(r>0){let o=r*this.blockLen,f=e.subarray(n,n+o);this.cipher(this.key,this.nonce,f,f,this.ctr),this.ctr+=r,n+=o}let s=t-n;return s>0&&(this.buf.fill(0),this.cipher(this.key,this.nonce,this.buf,this.buf,this.ctr++),e.set(this.buf.subarray(0,s),n),this.pos=s),e}clone(){return new a(this.cipher,this.blockLen,this.keyLen,this.nonceLen,this.randomBytes(this.state.length))}clean(){this.pos=0,this.ctr=0,this.buf.fill(0),this.state.fill(0)}},_r=(a,t,e,n)=>(r=Tn(32))=>new Sr(a,t,e,n,r)});function Dt(a,t){return a[t++]&255|(a[t++]&255)<<8}function Ho(a){let t=(n,r)=>a(r).update(n).digest(),e=a(new Uint8Array(32));return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>a(n),t}var Rr,os,As=pt(()=>{De();Rr=class{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;constructor(t){t=Ie(dt(t,32,"key"));let e=Dt(t,0),n=Dt(t,2),r=Dt(t,4),s=Dt(t,6),o=Dt(t,8),f=Dt(t,10),h=Dt(t,12),c=Dt(t,14);this.r[0]=e&8191,this.r[1]=(e>>>13|n<<3)&8191,this.r[2]=(n>>>10|r<<6)&7939,this.r[3]=(r>>>7|s<<9)&8191,this.r[4]=(s>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|f<<2)&8191,this.r[7]=(f>>>11|h<<5)&8065,this.r[8]=(h>>>8|c<<8)&8191,this.r[9]=c>>>5&127;for(let u=0;u<8;u++)this.pad[u]=Dt(t,16+2*u)}process(t,e,n=!1){let r=n?0:2048,{h:s,r:o}=this,f=o[0],h=o[1],c=o[2],u=o[3],E=o[4],l=o[5],y=o[6],C=o[7],Q=o[8],S=o[9],g=Dt(t,e+0),B=Dt(t,e+2),p=Dt(t,e+4),_=Dt(t,e+6),w=Dt(t,e+8),x=Dt(t,e+10),v=Dt(t,e+12),b=Dt(t,e+14),m=s[0]+(g&8191),N=s[1]+((g>>>13|B<<3)&8191),M=s[2]+((B>>>10|p<<6)&8191),D=s[3]+((p>>>7|_<<9)&8191),T=s[4]+((_>>>4|w<<12)&8191),L=s[5]+(w>>>1&8191),G=s[6]+((w>>>14|x<<2)&8191),q=s[7]+((x>>>11|v<<5)&8191),P=s[8]+((v>>>8|b<<8)&8191),K=s[9]+(b>>>5|r),Y=0,$=Y+m*f+N*(5*S)+M*(5*Q)+D*(5*C)+T*(5*y);Y=$>>>13,$&=8191,$+=L*(5*l)+G*(5*E)+q*(5*u)+P*(5*c)+K*(5*h),Y+=$>>>13,$&=8191;let J=Y+m*h+N*f+M*(5*S)+D*(5*Q)+T*(5*C);Y=J>>>13,J&=8191,J+=L*(5*y)+G*(5*l)+q*(5*E)+P*(5*u)+K*(5*c),Y+=J>>>13,J&=8191;let X=Y+m*c+N*h+M*f+D*(5*S)+T*(5*Q);Y=X>>>13,X&=8191,X+=L*(5*C)+G*(5*y)+q*(5*l)+P*(5*E)+K*(5*u),Y+=X>>>13,X&=8191;let et=Y+m*u+N*c+M*h+D*f+T*(5*S);Y=et>>>13,et&=8191,et+=L*(5*Q)+G*(5*C)+q*(5*y)+P*(5*l)+K*(5*E),Y+=et>>>13,et&=8191;let nt=Y+m*E+N*u+M*c+D*h+T*f;Y=nt>>>13,nt&=8191,nt+=L*(5*S)+G*(5*Q)+q*(5*C)+P*(5*y)+K*(5*l),Y+=nt>>>13,nt&=8191;let ct=Y+m*l+N*E+M*u+D*c+T*h;Y=ct>>>13,ct&=8191,ct+=L*f+G*(5*S)+q*(5*Q)+P*(5*C)+K*(5*y),Y+=ct>>>13,ct&=8191;let rt=Y+m*y+N*l+M*E+D*u+T*c;Y=rt>>>13,rt&=8191,rt+=L*h+G*f+q*(5*S)+P*(5*Q)+K*(5*C),Y+=rt>>>13,rt&=8191;let Et=Y+m*C+N*y+M*l+D*E+T*u;Y=Et>>>13,Et&=8191,Et+=L*c+G*h+q*f+P*(5*S)+K*(5*Q),Y+=Et>>>13,Et&=8191;let lt=Y+m*Q+N*C+M*y+D*l+T*E;Y=lt>>>13,lt&=8191,lt+=L*u+G*c+q*h+P*f+K*(5*S),Y+=lt>>>13,lt&=8191;let mt=Y+m*S+N*Q+M*C+D*y+T*l;Y=mt>>>13,mt&=8191,mt+=L*E+G*u+q*c+P*h+K*f,Y+=mt>>>13,mt&=8191,Y=(Y<<2)+Y|0,Y=Y+$|0,$=Y&8191,Y=Y>>>13,J+=Y,s[0]=$,s[1]=J,s[2]=X,s[3]=et,s[4]=nt,s[5]=ct,s[6]=rt,s[7]=Et,s[8]=lt,s[9]=mt}finalize(){let{h:t,pad:e}=this,n=new Uint16Array(10),r=t[1]>>>13;t[1]&=8191;for(let f=2;f<10;f++)t[f]+=r,r=t[f]>>>13,t[f]&=8191;t[0]+=r*5,r=t[0]>>>13,t[0]&=8191,t[1]+=r,r=t[1]>>>13,t[1]&=8191,t[2]+=r,n[0]=t[0]+5,r=n[0]>>>13,n[0]&=8191;for(let f=1;f<10;f++)n[f]=t[f]+r,r=n[f]>>>13,n[f]&=8191;n[9]-=8192;let s=(r^1)-1;for(let f=0;f<10;f++)n[f]&=s;s=~s;for(let f=0;f<10;f++)t[f]=t[f]&s|n[f];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let o=t[0]+e[0];t[0]=o&65535;for(let f=1;f<8;f++)o=(t[f]+e[f]|0)+(o>>>16)|0,t[f]=o&65535;jt(n)}update(t){Dn(this),dt(t),t=Ie(t);let{buffer:e,blockLen:n}=this,r=t.length;for(let s=0;s<r;){let o=Math.min(n-this.pos,r-s);if(o===n){for(;n<=r-s;s+=n)this.process(t,s);continue}e.set(t.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===n&&(this.process(e,0,!1),this.pos=0)}return this}destroy(){jt(this.h,this.r,this.buffer,this.pad)}digestInto(t){Dn(this),Br(t,this),this.finished=!0;let{buffer:e,h:n}=this,{pos:r}=this;if(r){for(e[r++]=1;r<16;r++)e[r]=0;this.process(e,0,!0)}this.finalize();let s=0;for(let o=0;o<8;o++)t[s++]=n[o]>>>0,t[s++]=n[o]>>>8;return t}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}};os=Ho(a=>new Rr(a))});var ds={};ke(ds,{_poly1305_aead:()=>xr,chacha12:()=>Po,chacha20:()=>us,chacha20orig:()=>hs,chacha20poly1305:()=>Ko,chacha8:()=>ls,hchacha:()=>fs,rngChacha20:()=>Wo,rngChacha8:()=>jo,xchacha20:()=>gs,xchacha20poly1305:()=>Jo});function We(a,t,e,n,r,s=20){let o=a[0],f=a[1],h=a[2],c=a[3],u=t[0],E=t[1],l=t[2],y=t[3],C=t[4],Q=t[5],S=t[6],g=t[7],B=r,p=e[0],_=e[1],w=e[2],x=o,v=f,b=h,m=c,N=u,M=E,D=l,T=y,L=C,G=Q,q=S,P=g,K=B,Y=p,$=_,J=w;for(let et=0;et<s;et+=2)x=x+N|0,K=z(K^x,16),L=L+K|0,N=z(N^L,12),x=x+N|0,K=z(K^x,8),L=L+K|0,N=z(N^L,7),v=v+M|0,Y=z(Y^v,16),G=G+Y|0,M=z(M^G,12),v=v+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f,16),Q=Q+p|0,E=z(E^Q,12),f=f+E|0,p=z(p^f,8),Q=Q+p|0,E=z(E^Q,7),r=r+c|0,p=z(p^r,16),C=C+p|0,c=z(c^C,12),r=r+c|0,p=z(p^r,8),C=C+p|0,c=z(c^C,7),s=s+u|0,S=z(S^s,16),Q=Q+S|0,u=z(u^Q,12),s=s+u|0,S=z(S^s,8),Q=Q+S|0,u=z(u^Q,7),o=o+E|0,g=z(g^o,16),l=l+g|0,E=z(E^l,12),o=o+E|0,g=z(g^o,8),l=l+g|0,E=z(E^l,7),f=f+h|0,B=z(B^f,16),y=y+B|0,h=z(h^y,12),f=f+h|0,B=z(B^f,8),y=y+B|0,h=z(h^y,7);let _=0;n[_++]=r,n[_++]=s,n[_++]=o,n[_++]=f,n[_++]=S,n[_++]=g,n[_++]=B,n[_++]=p}function cs(a,t,e,n,r){r!==void 0&&dt(r,void 0,"AAD");let s=a(t,e,qo),o=wr(n.length,r?r.length:0,!0),f=os.create(s);r&&as(f,r),as(f,n),f.update(o);let h=f.digest();return jt(s,o),h}var hs,us,gs,ls,Po,Yo,as,qo,xr,Ko,Jo,Wo,jo,Is=pt(()=>{ss();As();De();hs=Ne(We,{counterRight:!1,counterLength:8,allowShortKeys:!0}),us=Ne(We,{counterRight:!1,counterLength:4,allowShortKeys:!1}),gs=Ne(We,{counterRight:!1,counterLength:8,extendNonceFn:fs,allowShortKeys:!1}),ls=Ne(We,{counterRight:!1,counterLength:4,rounds:8}),Po=Ne(We,{counterRight:!1,counterLength:4,rounds:12}),Yo=new Uint8Array(16),as=(a,t)=>{a.update(t);let e=t.length%16;e&&a.update(Yo.subarray(e))},qo=new Uint8Array(32);xr=a=>(t,e,n)=>({encrypt(s,o){let f=s.length;o=vn(f+16,o,!1),o.set(s);let h=o.subarray(0,-16);a(t,e,h,h,1);let c=cs(a,t,e,h,n);return o.set(c,f),jt(c),o},decrypt(s,o){o=vn(s.length-16,o,!1);let f=s.subarray(0,-16),h=s.subarray(-16),c=cs(a,t,e,f,n);if(!br(h,c))throw new Error("invalid tag");return o.set(s.subarray(0,-16)),a(t,e,o,o,1),jt(c),o}}),Ko=Nn({blockSize:64,nonceLength:12,tagLength:16},xr(us)),Jo=Nn({blockSize:64,nonceLength:24,tagLength:16},xr(gs)),Wo=_r(hs,64,32,8),jo=_r(ls,64,32,12)});var Es={};ke(Es,{default:()=>Xo});var Vo,Xo,ps=pt(()=>{Vo=(()=>{var a,t,e={773(s,o,f){var h,c=typeof self<"u"&&self.Module!==void 0?self.Module:{},u={};for(h in c)c.hasOwnProperty(h)&&(u[h]=c[h]);var E,l,y,C,Q=[];E=typeof window=="object",l=typeof importScripts=="function",y=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",C=!E&&!y&&!l;var S,g,B,p,_,w="";y?(w=l?f(967).dirname(w)+"/":"//",S=function(O,W){return p||(p=f(145)),_||(_=f(967)),O=_.normalize(O),p.readFileSync(O,W?null:"utf8")},B=function(O){var W=S(O,!0);return W.buffer||(W=new Uint8Array(W)),N(W.buffer),W},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),Q=process.argv.slice(2),s.exports=c,process.on("uncaughtException",function(O){if(!(O instanceof H))throw O}),process.on("unhandledRejection",X),c.inspect=function(){return"[Emscripten Module object]"}):C?(typeof read<"u"&&(S=function(O){return read(O)}),B=function(O){var W;return typeof readbuffer=="function"?new Uint8Array(readbuffer(O)):(N(typeof(W=read(O,"binary"))=="object"),W)},typeof scriptArgs<"u"?Q=scriptArgs:arguments!==void 0&&(Q=arguments),typeof print<"u"&&(typeof console>"u"&&(console={}),console.log=print,console.warn=console.error=typeof printErr<"u"?printErr:print)):(E||l)&&(l?w=self.location.href:typeof document<"u"&&document.currentScript&&(w=document.currentScript.src),w=w.indexOf("blob:")!==0?w.substr(0,w.lastIndexOf("/")+1):"",S=function(O){var W=new XMLHttpRequest;return W.open("GET",O,!1),W.send(null),W.responseText},l&&(B=function(O){var W=new XMLHttpRequest;return W.open("GET",O,!1),W.responseType="arraybuffer",W.send(null),new Uint8Array(W.response)}),g=function(O,W,i){var A=new XMLHttpRequest;A.open("GET",O,!0),A.responseType="arraybuffer",A.onload=function(){A.status==200||A.status==0&&A.response?W(A.response):i()},A.onerror=i,A.send(null)}),c.print||console.log.bind(console);var x,v,b=c.printErr||console.warn.bind(console);for(h in u)u.hasOwnProperty(h)&&(c[h]=u[h]);u=null,c.arguments&&(Q=c.arguments),c.thisProgram&&c.thisProgram,c.quit&&c.quit,c.wasmBinary&&(x=c.wasmBinary),c.noExitRuntime,typeof WebAssembly!="object"&&X("no native wasm support detected");var m=!1;function N(O,W){O||X("Assertion failed: "+W)}var M,D,T=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function L(O){M=O,c.HEAP8=new Int8Array(O),c.HEAP16=new Int16Array(O),c.HEAP32=new Int32Array(O),c.HEAPU8=D=new Uint8Array(O),c.HEAPU16=new Uint16Array(O),c.HEAPU32=new Uint32Array(O),c.HEAPF32=new Float32Array(O),c.HEAPF64=new Float64Array(O)}c.INITIAL_MEMORY;var G,q=[],P=[],K=[],Y=0,$=null,J=null;function X(O){throw c.onAbort&&c.onAbort(O),b(O+=""),m=!0,O="abort("+O+"). Build with -s ASSERTIONS=1 for more info.",new WebAssembly.RuntimeError(O)}function et(O){return O.startsWith("data:application/octet-stream;base64,")}function nt(O){return O.startsWith("file://")}c.preloadedImages={},c.preloadedAudios={};var ct,rt="argon2.wasm";function Et(O){try{if(O==rt&&x)return new Uint8Array(x);if(B)return B(O);throw"both async and sync fetching of the wasm failed"}catch(W){X(W)}}function lt(O){for(;O.length>0;){var W=O.shift();if(typeof W!="function"){var i=W.func;typeof i=="number"?W.arg===void 0?G.get(i)():G.get(i)(W.arg):i(W.arg===void 0?null:W.arg)}else W(c)}}function mt(O){try{return v.grow(O-M.byteLength+65535>>>16),L(v.buffer),1}catch{}}et(rt)||(ct=rt,rt=c.locateFile?c.locateFile(ct,w):w+ct);var Mt,yt={a:function(O,W,i){D.copyWithin(O,W,W+i)},b:function(O){var W,i=D.length;if((O>>>=0)>2147418112)return!1;for(var A=1;A<=4;A*=2){var I=i*(1+.2/A);if(I=Math.min(I,O+100663296),mt(Math.min(2147418112,((W=Math.max(O,I))%65536>0&&(W+=65536-W%65536),W))))return!0}return!1}},Nt=((function(){var O={a:yt};function W(I,R){var U,k=I.exports;c.asm=k,L((v=c.asm.c).buffer),G=c.asm.k,U=c.asm.d,P.unshift(U),(function(j){if(Y--,c.monitorRunDependencies&&c.monitorRunDependencies(Y),Y==0&&($!==null&&(clearInterval($),$=null),J)){var tt=J;J=null,tt()}})()}function i(I){W(I.instance)}function A(I){return(function(){if(!x&&(E||l)){if(typeof fetch=="function"&&!nt(rt))return fetch(rt,{credentials:"same-origin"}).then(function(R){if(!R.ok)throw"failed to load wasm binary file at '"+rt+"'";return R.arrayBuffer()}).catch(function(){return Et(rt)});if(g)return new Promise(function(R,U){g(rt,function(k){R(new Uint8Array(k))},U)})}return Promise.resolve().then(function(){return Et(rt)})})().then(function(R){return WebAssembly.instantiate(R,O)}).then(I,function(R){b("failed to asynchronously prepare wasm: "+R),X(R)})}if(Y++,c.monitorRunDependencies&&c.monitorRunDependencies(Y),c.instantiateWasm)try{return c.instantiateWasm(O,W)}catch(I){return b("Module.instantiateWasm callback failed with error: "+I),!1}x||typeof WebAssembly.instantiateStreaming!="function"||et(rt)||nt(rt)||typeof fetch!="function"?A(i):fetch(rt,{credentials:"same-origin"}).then(function(I){return WebAssembly.instantiateStreaming(I,O).then(i,function(R){return b("wasm streaming compile failed: "+R),b("falling back to ArrayBuffer instantiation"),A(i)})})})(),c.___wasm_call_ctors=function(){return(c.___wasm_call_ctors=c.asm.d).apply(null,arguments)},c._argon2_hash=function(){return(c._argon2_hash=c.asm.e).apply(null,arguments)},c._malloc=function(){return(Nt=c._malloc=c.asm.f).apply(null,arguments)}),F=(c._free=function(){return(c._free=c.asm.g).apply(null,arguments)},c._argon2_verify=function(){return(c._argon2_verify=c.asm.h).apply(null,arguments)},c._argon2_error_message=function(){return(c._argon2_error_message=c.asm.i).apply(null,arguments)},c._argon2_encodedlen=function(){return(c._argon2_encodedlen=c.asm.j).apply(null,arguments)},c._argon2_hash_ext=function(){return(c._argon2_hash_ext=c.asm.l).apply(null,arguments)},c._argon2_verify_ext=function(){return(c._argon2_verify_ext=c.asm.m).apply(null,arguments)},c.stackAlloc=function(){return(F=c.stackAlloc=c.asm.n).apply(null,arguments)});function H(O){this.name="ExitStatus",this.message="Program terminated with exit("+O+")",this.status=O}function V(O){function W(){Mt||(Mt=!0,c.calledRun=!0,m||(lt(P),c.onRuntimeInitialized&&c.onRuntimeInitialized(),(function(){var i;if(c.postRun)for(typeof c.postRun=="function"&&(c.postRun=[c.postRun]);c.postRun.length;)i=c.postRun.shift(),K.unshift(i);lt(K)})()))}O=O||Q,Y>0||((function(){var i;if(c.preRun)for(typeof c.preRun=="function"&&(c.preRun=[c.preRun]);c.preRun.length;)i=c.preRun.shift(),q.unshift(i);lt(q)})(),Y>0||(c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1),W()},1)):W()))}if(c.allocate=function(O,W){var i;return i=W==1?F(O.length):Nt(O.length),O.subarray||O.slice?D.set(O,i):D.set(new Uint8Array(O),i),i},c.UTF8ToString=function(O,W){return O?(function(i,A,I){for(var R=A+I,U=A;i[U]&&!(U>=R);)++U;if(U-A>16&&i.subarray&&T)return T.decode(i.subarray(A,U));for(var k="";A<U;){var j=i[A++];if(128&j){var tt=63&i[A++];if((224&j)!=192){var ut=63&i[A++];if((j=(240&j)==224?(15&j)<<12|tt<<6|ut:(7&j)<<18|tt<<12|ut<<6|63&i[A++])<65536)k+=String.fromCharCode(j);else{var ot=j-65536;k+=String.fromCharCode(55296|ot>>10,56320|1023&ot)}}else k+=String.fromCharCode((31&j)<<6|tt)}else k+=String.fromCharCode(j)}return k})(D,O,W):""},c.ALLOC_NORMAL=0,J=function O(){Mt||V(),Mt||(J=O)},c.run=V,c.preInit)for(typeof c.preInit=="function"&&(c.preInit=[c.preInit]);c.preInit.length>0;)c.preInit.pop()();V(),s.exports=c,c.unloadRuntime=function(){typeof self<"u"&&delete self.Module,c=v=G=M=D=void 0,delete s.exports}},631:function(s,o,f){var h,c;typeof self<"u",(c=typeof(h=function(){let u=typeof self<"u"?self:this,E={Argon2d:0,Argon2i:1,Argon2id:2};function l(g){if(l._promise)return l._promise;if(l._module)return Promise.resolve(l._module);let B;return B=u.process&&u.process.versions&&u.process.versions.node?y().then(p=>new Promise(_=>{p.postRun=()=>_(p)})):(u.loadArgon2WasmBinary?u.loadArgon2WasmBinary():Promise.resolve(f(721)).then(p=>(function(_){let w=atob(_),x=new Uint8Array(new ArrayBuffer(w.length));for(let v=0;v<w.length;v++)x[v]=w.charCodeAt(v);return x})(p))).then(p=>{var _,w;return _=p,w=g?(function(x){let v=32767;return new WebAssembly.Memory({initial:Math.min(Math.max(Math.ceil(1024*x/65536),256)+256,v),maximum:v})})(g):void 0,new Promise(x=>(u.Module={wasmBinary:_,wasmMemory:w,postRun(){x(Module)}},y()))}),l._promise=B,B.then(p=>(l._module=p,delete l._promise,p))}function y(){return u.loadArgon2WasmModule?u.loadArgon2WasmModule():Promise.resolve(f(773))}function C(g,B){return g.allocate(B,"i8",g.ALLOC_NORMAL)}function Q(g,B){return C(g,new Uint8Array([...B,0]))}function S(g){if(typeof g!="string")return g;if(typeof TextEncoder=="function")return new TextEncoder().encode(g);if(typeof Buffer=="function")return Buffer.from(g);throw Error("Don't know how to encode UTF8")}return{ArgonType:E,hash:function(g){let B=g.mem||1024;return l(B).then(p=>{let _=g.time||1,w=g.parallelism||1,x=S(g.pass),v=Q(p,x),b=x.length,m=S(g.salt),N=Q(p,m),M=m.length,D=g.type||E.Argon2d,T=p.allocate(Array(g.hashLen||24),"i8",p.ALLOC_NORMAL),L=g.secret?C(p,g.secret):0,G=g.secret?g.secret.byteLength:0,q=g.ad?C(p,g.ad):0,P=g.ad?g.ad.byteLength:0,K=g.hashLen||24,Y=p._argon2_encodedlen(_,B,w,M,K,D),$=p.allocate(Array(Y+1),"i8",p.ALLOC_NORMAL),J,X,et;try{X=p._argon2_hash_ext(_,B,w,v,b,N,M,T,K,$,Y,D,L,G,q,P,19)}catch(nt){J=nt}if(X!==0||J){try{J||(J=p.UTF8ToString(p._argon2_error_message(X)))}catch{}et={message:J,code:X}}else{let nt="",ct=new Uint8Array(K);for(let rt=0;rt<K;rt++){let Et=p.HEAP8[T+rt];ct[rt]=Et,nt+=("0"+(255&Et).toString(16)).slice(-2)}et={hash:ct,hashHex:nt,encoded:p.UTF8ToString($)}}try{p._free(v),p._free(N),p._free(T),p._free($),q&&p._free(q),L&&p._free(L)}catch{}if(J)throw et;return et})},verify:function(g){return l().then(B=>{let p=S(g.pass),_=Q(B,p),w=p.length,x=g.secret?C(B,g.secret):0,v=g.secret?g.secret.byteLength:0,b=g.ad?C(B,g.ad):0,m=g.ad?g.ad.byteLength:0,N=Q(B,S(g.encoded)),M,D,T,L=g.type;if(L===void 0){let G=g.encoded.split("$")[1];G&&(L=E[G=G.replace("a","A")]||E.Argon2d)}try{D=B._argon2_verify_ext(N,_,w,x,v,b,m,L)}catch(G){M=G}if(D||M){try{M||(M=B.UTF8ToString(B._argon2_error_message(D)))}catch{}T={message:M,code:D}}try{B._free(_),B._free(N)}catch{}if(M)throw T;return T})},unloadRuntime:function(){l._module&&(l._module.unloadRuntime(),delete l._promise,delete l._module)}}})=="function"?h.apply(o,[]):h)===void 0||(s.exports=c)},721:function(s,o){s.exports="AGFzbQEAAAABkwESYAN/f38Bf2ABfwF/YAJ/fwBgAn9/AX9gAX8AYAR/f39/AX9gA39/fwBgBH9/f38AYAJ/fgBgAn5/AX5gAn5+AX5gBX9/f39/AGAGf3x/f39/AX9gAABgCH9/f39/f39/AX9gEX9/f39/f39/f39/f39/f39/AX9gBn9/f39/fwF/YA1/f39/f39/f39/f39/AX8CDQIBYQFhAAABYQFiAAEDPDsJCgIAAAIEAQEAAQsGAQAHAAIBAwICAwII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AAEAUiAUFAayACIAEQMUEASA0AIAAgAUFAayACEAUaCyAEQZABakHwARAEIARBgANqJAALAwABC5kCACAARQRAQQAPCwJ/AkAgAAR/IAFB/wBNDQECQEGgHigCACgCAEUEQCABQYB/cUGAvwNGDQMMAQsgAUH/D00EQCAAIAFBP3FBgAFyOgABIAAgAUEGdkHAAXI6AABBAgwECyABQYCwA09BACABQYBAcUGAwANHG0UEQCAAIAFBP3FBgAFyOgACIAAgAUEMdkHgAXI6AAAgACABQQZ2QT9xQYABcjoAAUEDDAQLIAFBgIAEa0H//z9NBEAgACABQT9xQYABcjoAAyAAIAFBEnZB8AFyOgAAIAAgAUEGdkE/cUGAAXI6AAIgACABQQx2QT9xQYABcjoAAUEEDAQLC0HcHkEZNgIAQX8FQQELDAELIAAgAToAAEEBCwtQAQN/AkAgACgCACwAABAPRQRADAELA0AgACgCACICLAAAIQMgACACQQFqNgIAIAEgA2pBMGshASACLAABEA9FDQEgAUEKbCEBDAALAAsgAQu7AgACQCABQRRLDQACQAJAAkACQAJAAkACQAJAAkACQCABQQlrDgoAAQIDBAUGBwgJCgsgAiACKAIAIgFBBGo2AgAgACABKAIANgIADwsgAiACKAIAIgFBBGo2AgAgACABNAIANwMADwsgAiACKAIAIgFBBGo2AgAgACABNQIANwMADwsgAiACKAIAQQdqQXhxIgFBCGo2AgAgACABKQMANwMADwsgAiACKAIAIgFBBGo2AgAgACABMgEANwMADwsgAiACKAIAIgFBBGo2AgAgACABMwEANwMADwsgAiACKAIAIgFBBGo2AgAgACABMAAANwMADwsgAiACKAIAIgFBBGo2AgAgACABMQAANwMADwsgAiACKAIAQQdqQXhxIgFBCGo2AgAgACABKwMAOQMADwsgACACQQARAgALCxkAIAAtAOgBBEAgAEJ/NwNYCyAAQn83A1ALIwAgASABKQMwQgF8NwMwIAIgASAAQQAQESACIAAgAEEAEBELOQECfyAAQQNuIgJBAnQhAQJAAkACQCACQQNsQX9zIABqDgIBAAILIAFBAXIhAQsgAUECaiEBCyABC3oB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gIMIAAoAgAgA0EMaiABQQFqECwiAUUNACAAIAMoAgw2AgQgAEEANgJEIABCADcCPCAAQgA3AhggAEIANwIgIAAQHCICDQBBYEEAIAEtAAAbIQILIANBEGokACACCykBAn8DQCAAIAJBA3QiA2ogASADaikAADcDACACQQFqIgJBgAFHDQALCwwAIABBAEGACBALGgtlAQJ/IAAgAhAeIgIEfyACBUFdQQACfyAAKAIAIQRBACECIAAoAgQiAAR/A0AgAyACIARqLQAAIAEgAmotAABzciEDIAJBAWoiAiAARw0ACyADQQFrQQh2QQFxQQFrBUEACwsbCwtdAQJ/IwBB8AFrIgMkAEF/IQQCQCACRSAARSABRXJyIAFBwABLcg0AIAMgARAYQQBIDQAgAyACQcAAEAZBAEgNACADIAAgARASIQQLIANB8AEQBCADQfABaiQAIAQLCQAgACABNwAACxAAIwAgAGtBcHEiACQAIAALMwEBfyAAKAIUIgMgASACIAAoAhAgA2siASABIAJLGyIBEAUaIAAgACgCFCABajYCFCACC9oBAQR/IwBB0ABrIggkAAJAIABFBEBBYCEADAELIAggABAKIgk2AgwgCCAJNgIcIAggCRAJIgo2AhggCCAJEAkiCzYCCEEAIQkCQAJAIApFIAtFcg0AIAggAjYCFCAIIAE2AhAgCEEIaiAAIAcQLSIADQEgCCgCCCEJIAggCCgCDBAJIgA2AgggAEUNACAIIAY2AiwgCCAFNgIoIAggBDYCJCAIIAM2AiAgCEEIaiAJIAcQMCEADAELQWohAAsgCCgCGBAIIAgoAggQCCAJEAgLIAhB0ABqJAAgAAuQAgEDfyMAQdAAayIRJABBfiETAkAgCEEESQ0AIAgQCSISRQRAQWohEwwBCyARQQA2AkwgEUIANwJEIBEgAjYCPCARIAI2AjggESABNgI0IBEgADYCMCARIA82AiwgESAONgIoIBEgDTYCJCARIAw2AiAgESAGNgIcIBEgBTYCGCARIAQ2AhQgESADNgIQIBEgCDYCDCARIBI2AgggESAQNgJAAkAgEUEIaiALEB4iEwRAIBIgCBAEDAELIAcEQCAHIBIgCBAFGgsCQCA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cyBub3QgMABTZWNyZXQgcG9pbnRlciBpcyBOVUxMLCBidXQgc2VjcmV0IGxlbmd0aCBpcyBub3QgMABQYXNzd29yZCBwb2ludGVyIGlzIE5VTEwsIGJ1dCBwYXNzd29yZCBsZW5ndGggaXMgbm90IDAAQXNzb2NpYXRlZCBkYXRhIHBvaW50ZXIgaXMgTlVMTCwgYnV0IGFkIGxlbmd0aCBpcyBub3QgMAAobnVsbCkAAACbCAAAuwcAAEkJAADACQAAsAkAAPAHAAAfCAAAMAgAAMkIAABvCgAA4AkAABYKAAA7CgAAQwgAACsLAADBCgAAkgoAAPQKAAACCAAAEQgAAFsJAABbCAAAdAkAAHQIAAAFCQAAdAcAAC0JAACeBwAA9AgAAGIHAAAYCQAAiAcAAOEIAABOBwAA/wkAAFwKAAABAEGkGAsBAgBByxgLBf//////AEGQGQtBEQAKABEREQAAAAAFAAAAAAAACQAAAAALAAAAAAAAAAARAA8KERERAwoHAAEACQsLAAAJBgsAAAsABhEAAAAREREAQeEZCyELAAAAAAAAAAARAAoKERERAAoAAAIACQsAAAAJAAsAAAsAQZsaCwEMAEGnGgsVDAAAAAAMAAAAAAkMAAAAAAAMAAAMAEHVGgsBDgBB4RoLFQ0AAAAEDQAAAAAJDgAAAAAADgAADgBBjxsLARAAQZsbCx4PAAAAAA8AAAAACRAAAAAAABAAABAAABIAAAASEhIAQdIbCw4SAAAAEhISAAAAAAAACQBBgxwLAQsAQY8cCxUKAAAAAAoAAAAACQsAAAAAAAsAAAsAQb0cCwEMAEHJHAsnDAAAAAAMAAAAAAkMAAAAAAAMAAAMAAAwMTIzNDU2Nzg5QUJDREVGAEHwHAsBAQBBoB4LAogPAEHYHgsDkBFQ"},145(){},967(){}},n={};function r(s){var o=n[s];if(o!==void 0)return o.exports;var f=n[s]={exports:{}};return e[s].call(f.exports,f,f.exports,r),f.exports}return r(631)})(),Xo=Vo});var Mn=class a{verbose;mockMode;static#e=null;#t=null;#n=!1;#r=0;#i=["time.google.com","time.cloudflare.com","pool.ntp.org"];constructor(t=0,e=!1){if(this.verbose=t,this.mockMode=e,a.#e)return a.#e;a.#e=this}static get instance(){return a.#e||new a}static get time(){return a.instance.time}get time(){return this.mockMode?Date.now():this.#t===null?null:Date.now()+Math.round(this.#t)}async sync(t){if(t!==void 0&&(this.verbose=t),this.mockMode)return Date.now();if(this.#n){for(;this.#n;)await new Promise(e=>setTimeout(e,50));return this.time}this.#n=!0;try{let e=await this.#s();return e.length===0?(console.warn("[Clock] All NTP sources failed, using local time"),this.#t=0,this.time):(this.#t=this.#A(e),this.#r=Date.now(),e.length<this.#i.length&&setTimeout(()=>this.#a(),100),this.time)}catch(e){return console.error("[Clock] Sync failed:",e),this.#t=0,this.time}finally{this.#n=!1}}get status(){return this.mockMode?{synchronized:!0,syncing:!1,offset:0,lastSync:Date.now(),age:0}:{synchronized:this.#t!==null,syncing:this.#n,offset:this.#t,lastSync:this.#r,age:this.#r?Date.now()-this.#r:null}}async#s(){let t=this.#i.map(r=>this.#o(r)),e=await Promise.allSettled(t),n=[];for(let r of e)r.status==="fulfilled"&&n.push(r.value);return n}async#o(t){let e=new AbortController,n=setTimeout(()=>e.abort(),2e3);try{let r=Date.now(),s=await fetch(`https://${t}`,{method:"HEAD",signal:e.signal,cache:"no-cache"}),o=(Date.now()-r)/2;if(!s.ok)throw new Error(`HTTP ${s.status}`);let f=new Date(s.headers.get("date")).getTime();if(isNaN(f))throw new Error("Invalid date header");return{source:t,serverTime:f+o,localTime:Date.now(),latency:o*2}}finally{clearTimeout(n)}}#A(t){if(t.length===1)return t[0].serverTime-t[0].localTime;t.sort((r,s)=>r.latency-s.latency);let e=[];for(let r of t)e.push(r.serverTime-r.localTime);e.sort((r,s)=>r-s);let n=Math.floor(e.length/2);return e.length%2===0?(e[n-1]+e[n])/2:e[n]}async#a(){if(!this.#n)try{let t=await this.#s();if(t.length===0)return;let e=this.#A(t);Math.abs(e-this.#t)>100&&(this.#t=e)}catch(t){this.verbose&&console.warn("[Clock] Background refine failed:",t)}}},ft=Mn.instance;await Ot();await Ot();var Ns=1e4,vs=1e6,Ts=1e5,Fs=36e5,Rt={VALID_SIGNATURE:1e4,VALID_POW:3e5,UNICAST_RELAYED:5e3,WRONG_SIGNATURE:-6e5,WRONG_POW:-1e8,WRONG_SERIALIZATION:-6e4,GOSSIP_FLOOD:-6e4,UNICAST_FLOOD:-3e4,HOPS_EXCEEDED:-3e5,UNICAST_INVALID_ROUTE:-6e4,FAILED_HANDSHAKE:-6e5,WRONG_LENGTH:-6e5},Ze=class{id;cryptoCodex;verbose;trustBalances={};manualBanList=new Set;bytesCounters={gossip:{},unicast:{}};bytesCounterResetIn=0;constructor(t,e,n=0){this.id=t,this.cryptoCodex=e,this.verbose=n}tick(){for(let t in this.trustBalances){let e=this.trustBalances[t];e!==0&&(e=e<0?Math.min(0,e+1e3):Math.max(0,e-100))}this.bytesCounterResetIn-=1e3,!(this.bytesCounterResetIn>0)&&(this.bytesCounterResetIn=Ns,this.bytesCounters={gossip:{},unicast:{}})}countPeerAction(t,e){if(Rt[e])return this.adjustTrust(t,Rt[e])}adjustTrust(t,e,n="na"){t!==this.id&&(e&&(this.trustBalances[t]=Math.min(Fs,(this.trustBalances[t]||0)+e)),e&&this.verbose>3&&console.log(`%c(Arbiter: ${this.id}) ${t} +${e}ms (${n}). Updated: ${this.trustBalances[t]}ms.`,gt.ARBITER),this.isBanished(t)&&this.verbose>1&&console.log(`%c(Arbiter: ${this.id}) Peer ${t} is now banished.`,gt.ARBITER))}setBanished(t){this.manualBanList.has(t)||this.manualBanList.add(t)}isBanished(t){return Ct.MANUAL_BAN_MODE?this.manualBanList.has(t):(this.trustBalances[t]||0)<0}countMessageBytes(t,e,n){this.bytesCounters[n][t]||(this.bytesCounters[n][t]=0),this.bytesCounters[n][t]+=e;let[r,s]=n==="gossip"?[Ts,Rt.GOSSIP_FLOOD]:[vs,Rt.UNICAST_FLOOD];return this.bytesCounters[n][t]<r?!0:this.adjustTrust(t,s,`Message ${n} flood detected`)}async digestMessage(t,e,n,r=.01){let{senderId:s,pubkey:o,topic:f,expectedEnd:h}=e;if(!(!this.#e(t,e,n)||!this.#t(t,f?"gossip":"unicast",n,h)||!(f?this.#n(t,e):this.#r(t,e)))&&!(this.isBanished(t)||this.isBanished(s)))return this.trustBalances[s]>Rt.VALID_POW||Math.random()<r&&await this.#i(s,o),!0}#e(t,e,n){try{let{pubkey:r,signature:s,signatureStart:o}=e,f=n.subarray(0,o);if(!this.cryptoCodex.verifySignature(r,f,s))throw new Error("Gossip signature invalid");return this.adjustTrust(t,Rt.VALID_SIGNATURE,"Gossip signature valid"),!0}catch(r){this.verbose>1&&console.error(`%c(Arbiter: ${this.id}) Error during signature verification from ${t}: ${r.stack}`,gt.ARBITER),this.verbose>2&&console.log(`%c(Arbiter) signatureControl() error details: ${e}`,gt.ARBITER)}this.adjustTrust(t,Rt.WRONG_SIGNATURE,"Gossip signature invalid")}#t(t,e,n,r){if(!r||n.length===r)return!0;this.adjustTrust(t,Rt.WRONG_LENGTH,`${e} message length mismatch`)}#n(t,e){if(e.HOPS<=(_t.HOPS[e.topic]||_t.HOPS.default))return!0;this.adjustTrust(t,Rt.HOPS_EXCEEDED,"Gossip HOPS exceeded")}#r(t,e){if(e.route.length<=Qt.MAX_HOPS)return!0;this.adjustTrust(t,Rt.HOPS_EXCEEDED,"Unicast HOPS exceeded")}async#i(t,e){await this.cryptoCodex.pubkeyDifficultyCheck(e)?this.adjustTrust(t,Rt.VALID_POW,"Gossip PoW valid"):this.adjustTrust(t,Rt.WRONG_POW,"Gossip PoW invalid")}};await Ot();var Us;function ye(a,t=0){let e=typeof a=="string"?(Us??=new TextEncoder).encode(a):a,n=e,r=t+374761393&4294967295,s=0;if(n.length>=16){let f=[t+2654435761+2246822519&4294967295,t+2246822519&4294967295,t+0&4294967295,t-2654435761&4294967295],h=e,c=h.length-16,u=0;for(s=0;(s&4294967280)<=c;s+=4){let E=s,l=h[E+0]+(h[E+1]<<8),y=h[E+2]+(h[E+3]<<8),C=l*2246822519+(y*2246822519<<16),Q=f[u]+C&4294967295;Q=Q<<13|Q>>>19;let S=Q&65535,g=Q>>>16;f[u]=S*2654435761+(g*2654435761<<16)&4294967295,u=u+1&3}r=(f[0]<<1|f[0]>>>31)+(f[1]<<7|f[1]>>>25)+(f[2]<<12|f[2]>>>20)+(f[3]<<18|f[3]>>>14)&4294967295}r=r+e.length&4294967295;let o=e.length-4;for(;s<=o;s+=4){let f=s,h=n[f+0]+(n[f+1]<<8),c=n[f+2]+(n[f+3]<<8),u=h*3266489917+(c*3266489917<<16);r=r+u&4294967295,r=r<<17|r>>>15,r=(r&65535)*668265263+((r>>>16)*668265263<<16)&4294967295}for(;s<n.length;++s){let f=n[s];r=r+f*374761393,r=r<<11|r>>>21,r=(r&65535)*2654435761+((r>>>16)*2654435761<<16)&4294967295}return r=r^r>>>15,r=((r&65535)*2246822519&4294967295)+((r>>>16)*2246822519<<16),r=r^r>>>13,r=((r&65535)*3266489917&4294967295)+((r>>>16)*3266489917<<16),r=r^r>>>16,r<0?r+4294967296:r}async function Ls(){if(!(typeof globalThis.RTCPeerConnection<"u"))return(await import("wrtc")).default}var Lr=await Ls(),ze=class{id;verbose;stunUrls;constructor(t,e,n=0){this.id=t,this.verbose=n,this.stunUrls=e}onSignalAnswer=null;onConnect=null;offerInstanceByExpiration={};creatingOffer=!1;offerCreationTimeout=null;offersToCreate=St.MAX_SDP_OFFERS;offers={};tick(){let t=ft.time;for(let s in this.offerInstanceByExpiration){let o=this.offerInstanceByExpiration[s];t<s||(o?.destroy(),delete this.offerInstanceByExpiration[s],this.creatingOffer=!1)}for(let s in this.offers){let o=this.offers[s];if(o.offererInstance.destroyed){delete this.offers[s];continue}if(o.isUsed){delete this.offers[s];continue}o.timestamp+St.SDP_OFFER_EXPIRATION>t||(o.offererInstance?.destroy(),delete this.offers[s])}let e=0;for(let s in this.offers){e++;let o=this.offers[s];if(o.isDigestingOneAnswer){o.isDigestingOneAnswer=!1;continue}if(o.offererInstance.destroyed)continue;let f=o.answers.filter(u=>!u.used);if(!f.length)continue;let h=f.reduce((u,E)=>u.timestamp>E.timestamp?u:E);if(!h)continue;h.used=!0;let c=t-h.timestamp;c>Ct.CONNECTION_UPGRADE_TIMEOUT/2||(o.offererInstance.signal(h.signal),o.isDigestingOneAnswer=!0,this.verbose>2&&console.log(`(${this.id}) Using answer from ${h.peerId} for offer ${s} (received since ${c} ms)`))}if(this.creatingOffer||e>=this.offersToCreate)return;this.creatingOffer=!0;let n=t+(St.SIGNAL_CREATION_TIMEOUT||8e3),r=this.#e(n);this.offerInstanceByExpiration[n]=r}#e(t){let e=St.ICE_COMPLETE_TIMEOUT||1e3,n=new St.PEER({initiator:!0,trickle:!1,iceCompleteTimeout:e,wrtc:Lr,config:{iceServers:this.stunUrls}});return n.on("error",r=>this.#n(r)),n.on("signal",r=>{let{candidate:s,type:o}=r;if(!r||s)throw new Error("Unexpected signal data from offerer instance: "+JSON.stringify(r));if(o!=="offer")throw new Error("Unexpected signal type from offerer instance: "+o);delete this.offerInstanceByExpiration[t];let f=ye(JSON.stringify(r));n.on("connect",()=>{this.offers[f]&&(this.offers[f].isUsed=!0),this.onConnect(void 0,n)}),this.offers[f]={timestamp:ft.time,sentCounter:0,signal:r,offererInstance:n,answers:[],answerers:{},isUsed:!1},this.creatingOffer=!1}),n}#t(t,e="",n=2,r="includes"){return r[0]==="i"&&!t.message.includes(e)?!1:t.message.startsWith(e)?(this.verbose>=n&&console.info(`%cOfferManager => ${t.message}`,gt.PEER_STORE),!0):!1}#n=t=>{this.verbose<1||this.#t(t,"Ice connection failed",2)||this.#t(t,"Connection failed",2)||this.#t(t,"Remote transport instance",3,"startsWith")||this.#t(t,"Simulated failure",4,"startsWith")||this.#t(t,"No peer found",4,"startsWith")||this.#t(t,"Missing transport instance",2,"startsWith")||this.#t(t,"Failed to create answer",2,"startsWith")||this.#t(t,"Transport instance",3,"startsWith")||this.#t(t,"cannot signal after peer is destroyed",3,"startsWith")||this.#t(t,"No pending",3)||this.#t(t,"is already linked",3)||this.#t(t,"There is already a pending",3)||this.#t(t,"closed the connection",3)||this.#t(t,"No transport instance found for id:",3)||this.verbose>0&&console.error("transportInstance ERROR => ",t.stack)};bestReadyOffer(t=0,e=!0){let n=null,r=null,s=null;for(let o in this.offers){let f=this.offers[o],{isUsed:h,sentCounter:c,signal:u,timestamp:E}=f;if(h||c>t)continue;let l=ft.time-E;if(!(e&&l>St.SDP_OFFER_EXPIRATION/2)&&!(s&&l>s)){n=f,r=o,s=l;break}}return{offerHash:r,readyOffer:n,since:s}}addSignalAnswer(t,e,n,r){!e||e.type!=="answer"||!n||!this.offers[n]||this.offers[n].answerers[t]||(this.offers[n].answerers[t]=!0,this.offers[n].answers.push({peerId:t,signal:e,timestamp:r}),this.verbose>3&&console.log(`(OfferManager) Added answer from ${t} for offer ${n}`))}getTransportInstanceForSignal(t,e,n){try{if(!e||!e.type||!e.sdp)throw new Error("Wrong remote SDP provided");let{type:r,sdp:s}=e;if(r!=="offer"&&r!=="answer")throw new Error("Invalid remote SDP type");if(r==="offer"&&!s)throw new Error("No SDP in the remote SDP offer");if(r==="answer"&&!s)throw new Error("No SDP in the remote SDP answer");if(r==="answer"){let h=n?this.offers[n]?.offererInstance:null;if(!h)throw new Error("No pending offer found for the given offer hash to accept the answer");return h}let o=St.ICE_COMPLETE_TIMEOUT||1e3,f=new St.PEER({initiator:!1,trickle:!1,iceCompleteTimeout:o,wrtc:Lr,config:{iceServers:this.stunUrls}});return f.on("error",h=>this.#n(h)),f.on("signal",h=>this.onSignalAnswer(t,h,n)),f.on("connect",()=>this.onConnect(t,f)),f}catch(r){if(r.message.startsWith("No pending offer found")&&this.verbose<2)return null;if(this.verbose>1&&r.message.startsWith("No pending offer found"))return console.info(`%c${r.message}`,gt.PEER_STORE);this.verbose>0&&console.error(r.stack)}}destroy(){for(let t in this.offers)this.offers[t].offererInstance?.destroy()}};await Ot();var{SANDBOX:pA,ICE_CANDIDATE_EMITTER:BA,TEST_WS_EVENT_MANAGER:CA}=vt.ENABLED?await on().then(()=>sn):{},Yn=class{neighbors;connectionsCount;constructor(t={}){this.neighbors=t,this.connectionsCount=Object.keys(t).length}setNeighbor(t,e=ft.time){this.neighbors[t]||this.connectionsCount++,this.neighbors[t]=e}unsetNeighbor(t){this.neighbors[t]&&this.connectionsCount--,delete this.neighbors[t]}};var ie=class{peerId;transportInstance;isWebSocket;direction;pendingUntil;connStartTime;constructor(t,e,n,r=!1){this.peerId=t,this.transportInstance=e,this.isWebSocket=r,this.direction=n,this.pendingUntil=ft.time+Ct.CONNECTION_UPGRADE_TIMEOUT}setConnected(){this.connStartTime=ft.time,this.pendingUntil=0}getConnectionDuration(){return this.connStartTime?ft.time-this.connStartTime:0}close(){this.isWebSocket?this.transportInstance?.close():this.transportInstance?.destroy()}},An=class{id;cryptoCodex;offerManager;arbiter;verbose;isDestroy=!1;neighborsList=[];connecting={};connected={};known={};knownCount=0;privacy={};kick={};callbacks={connect:[(t,e)=>this.#e(t,e)],disconnect:[(t,e)=>this.#t(t,e)],signal:[],data:[]};constructor(t,e,n,r,s=0){this.id=t,this.cryptoCodex=e,this.offerManager=n,this.arbiter=r,this.verbose=s,this.offerManager.onSignalAnswer=(o,f,h)=>{if(!(this.isDestroy||this.isKicked(o)||this.arbiter.isBanished(o)))for(let c of this.callbacks.signal)c(o,{signal:f,offerHash:h})},this.offerManager.onConnect=(o,f)=>{if(this.isDestroy)return f?.destroy();if(o===this.id)throw new Error(`Refusing to connect to self (${this.id}).`);let h=o;if(f.on("close",()=>{if(h)for(let c of this.callbacks.disconnect)c(h,f.initiator?"out":"in")}),f.on("data",c=>{if(h)for(let u of this.callbacks.data)u(h,c);else{let u=new Uint8Array(c);if(u[0]>127)return;let{route:E,type:l,neighborsList:y}=e.readUnicastMessage(u)||{};if(l!=="handshake"||E.length!==2||E[1]!==this.id)return;h=E[0],this.digestPeerNeighbors(h,y);for(let C of this.callbacks.connect)C(h,"out")}}),o)for(let c of this.callbacks.connect)c(o,"in")}}get publicNeighborsList(){return this.neighborsList.filter(t=>this.cryptoCodex.isPublicNode(t))}get standardNeighborsList(){return this.neighborsList.filter(t=>!this.cryptoCodex.isPublicNode(t))}#e(t,e){if(!this.connecting[t]?.[e])return this.verbose>=3?console.info(`%cPeer with ID ${t} is not connecting.`,gt.PEER_STORE):null;let n=this.connecting[t][e];if(this.#n(t,"connecting",e),this.isKicked(t))return this.verbose>=3&&console.info(`%c(${this.id}) Connect => Peer with ID ${t} is kicked. => close()`,gt.PEER_STORE),n.close();if(this.connected[t])return this.verbose>1&&console.warn(`%c(${this.id}) Connect => Peer with ID ${t} is already connected. => close()`,gt.PEER_STORE),n.close();n.setConnected(),this.connected[t]=n,this.neighborsList.push(t),this.#r(this.id,t)}#t(t,e){this.#n(t,"connected",e)}#n(t,e="both",n="both"){if(!t&&t===this.id)return;let[r,s]=[this.connecting[t],this.connected[t]];if(!r&&!s||(e!=="connecting"&&(s?.direction===n||n==="both")&&(s?.close(),delete this.connected[t],this.neighborsList=Object.keys(this.connected),this.#i(this.id,t)),e==="connected"))return;let o=n==="both"?["out","in"]:[n];for(let f of o)delete r?.[f];this.connecting[t]?.in||this.connecting[t]?.out||delete this.connecting[t]}#r(t="toto",e="tutu"){for(let n of[t,e])this.known[n]||(this.known[n]=new Yn,this.knownCount++),this.known[n].setNeighbor(n===t?e:t)}#i(t="toto",e="tutu"){for(let n of[t,e])this.known[n]&&(this.known[n].unsetNeighbor(n===t?e:t),!(this.known[n].connectionsCount>0)&&(delete this.known[n],this.knownCount--))}cleanupExpired(t=!0){let e=ft.time;for(let n of["in","out"])for(let r in this.connecting){if(!this.connecting[r][n])continue;let s=this.connected[r]?1e4:0;this.connecting[r][n].pendingUntil+s>e||(this.verbose>=4&&!this.connected[r]&&console.info(`%c(${this.id}) Pending ${n} connection to peer ${r} expired.`,gt.PEER_STORE),this.verbose>0&&this.connected[r]?.direction===n&&console.info(`%c(${this.id}) Pending ${n} connection to peer ${r} expired (already connected WARNING!).`,"color: white;"),this.connecting[r]?.out?.isWebSocket&&this.connecting[r].out.close(),this.connecting[r]?.in?.close(),this.#n(r,"connecting",n))}t&&(this.neighborsList=Object.keys(this.connected),this.digestPeerNeighbors(this.id,this.neighborsList))}on(t,e){if(!this.callbacks[t])throw new Error(`Unknown callback type: ${t}`);this.callbacks[t].push(e)}getUpdatedPeerConnectionsCount(t,e=!0){let n=ft.time,r=0,s=this.known[t]?.neighbors||{};for(let o in s){if(o!==this.id&&n-s[o]>Bt.PEER_LINK_EXPIRATION){this.#i(t,o);continue}e?r++:this.cryptoCodex.isPublicNode(o)||r++}return r}addConnectingPeer(t,e,n){if(t===this.id)throw new Error(`Refusing to connect to self (${this.id}).`);let r=e.type==="offer"?"in":"out";if(this.connecting[t]?.[r])return;let s=this.offerManager.getTransportInstanceForSignal(t,e,n);return s?(this.connecting[t]||(this.connecting[t]={}),this.connecting[t][r]=new ie(t,s,r),!0):this.verbose>3?console.info(`%cFailed to get transport instance for signal from ${t}.`,gt.PEER_STORE):null}assignSignal(t,e,n,r=ft.time){let s=this.connecting[t]?.[e.type==="offer"?"in":"out"];try{if(s?.isWebSocket)throw new Error(`Cannot assign signal for ID ${t}. (WebSocket)`);e.type==="answer"?this.offerManager.addSignalAnswer(t,e,n,r):s.transportInstance.signal(e)}catch(o){console.error(`Error signaling ${e?.type} for ${t}:`,o.stack)}}kickPeer(t,e=6e4,n){e&&(this.kick[t]=ft.time+e),this.#n(t,"both"),this.verbose>1&&console.log(`%c(${this.id}) Kicked peer ${t} for ${e/1e3}s. ${n?"| Reason: "+n:""}`,"color: green;")}isKicked(t){return this.kick[t]&&this.kick[t]>ft.time}digestValidRoute(t=[]){for(let e=1;e<t.length;e++)this.#r(t[e-1],t[e])}digestPeerNeighbors(t,e=[]){if(!(!t||!Array.isArray(e))){for(let n in this.known[t]?.neighbors||{})e.includes(n)||this.#i(t,n);for(let n of e)this.#r(t,n)}}destroy(){this.isDestroy=!0;for(let[t,e]of Object.entries(this.connected))this.#n(t),e.close();for(let[t,e]of Object.entries(this.connecting))this.#n(t),e.in?.close(),e.out?.close();this.offerManager.destroy()}};await Ot();var an=class{cache={};peerStore;constructor(t,e){this.id=t,this.peerStore=e}buildRoutes(t,e=5,n=3,r=1728,s=!0,o=3){if(this.id===t)throw new Error("Cannot build route to self");if(this.peerStore.connected[t])return{routes:[{path:[this.id,t]}],success:!0,nodesExplored:1};if(!this.peerStore.known[t])return this.#n(t);if(this.cache[t]&&this.#e(this.cache[t]))return{routes:this.cache[t],success:!0,nodesExplored:0};let f=this.#r(t,n,r,o);if(!f.success)return{routes:[],success:!1,nodesExplored:f.nodesExplored};let c=this.#t(f.paths,s).slice(0,e);return this.cache[t]=c,{routes:c,success:!0,nodesExplored:f.nodesExplored}}#e(t){for(let{path:e}of t)for(let n=1;n<e.length;n++){let r=e[n-1],s=e[n];if(r===this.id){if(!this.peerStore.connected[s])return!1}else if(!this.peerStore.known[r]?.neighbors?.[s])return!1}return!0}#t(t,e){let n=[];for(let r of t)n.push({path:r,hops:r.length-1});return e&&n.sort((r,s)=>r.hops-s.hops),n}#n(t){let e=[],n=this.peerStore.neighborsList,r=[...Array(n.length).keys()].sort(()=>Math.random()-.5);for(let s of r)e.push({path:[this.id,n[s],t],hops:0,score:0});return e.length===0?{routes:[],success:!1,nodesExplored:0}:{routes:e,success:"blind",nodesExplored:e.length}}#r(t,e,n,r){let s=[],o=0,f=[{node:this.id,path:[this.id],pathSet:new Set([this.id]),depth:0}],h=new Map;h.set(this.id,[this.id]);let c=[{node:t,path:[t],pathSet:new Set([t]),depth:0}],u=new Map;u.set(t,[t]);let E=Math.ceil(e/2);for(;(f.length>0||c.length>0)&&o<n;){if(f.length>0){let l=this.#i(f,h,u,E);for(let y of l){let C=this.#s(h.get(y),u.get(y));if(s.push(C),!(C.length-1>r))return{success:!0,paths:s,nodesExplored:o}}o++}if(c.length>0){let l=this.#i(c,u,h,E);for(let y of l){let C=this.#s(h.get(y),u.get(y));if(s.push(C),!(C.length-1>r))return{success:!0,paths:s,nodesExplored:o}}o++}}return{success:s.length>0,paths:s,nodesExplored:o}}#i(t,e,n,r){if(t.length===0)return[];let{node:s,path:o,pathSet:f,depth:h}=t.shift();if(h>=r)return[];let c=[];function u(E){if(f.has(E))return;let l=h+1;if(n.has(E)&&c.push(E),e.has(E))return;let y=[...o,E],C=new Set(f).add(E);e.set(E,y),t.push({node:E,path:y,pathSet:C,depth:l})}if(s===this.id)for(let E of this.peerStore.neighborsList)u(E);else for(let E in this.peerStore.known[s]?.neighbors||{})u(E);return c}#s(t,e){let n=t.length+e.length-1,r=new Array(n),s=0;for(let o of t)r[s++]=o;for(let o=e.length-2;o>=0;o--)r[s++]=e[o];return r}};var{SANDBOX:SA,ICE_CANDIDATE_EMITTER:_A,TEST_WS_EVENT_MANAGER:RA}=vt.ENABLED?await on().then(()=>sn):{},ks=an,Me=class{type="message";timestamp;neighborsList;route;pubkey;data;signature;signatureStart;expectedEnd;constructor(t,e,n,r,s,o,f,h,c){this.type=t,this.timestamp=e,this.neighborsList=n,this.route=r,this.pubkey=s,this.data=o,this.signature=f,this.signatureStart=h,this.expectedEnd=c}getSenderId(){return this.route[0]}getTargetId(){return this.route[this.route.length-1]}extractRouteInfo(t="toto"){let e=this.newRoute||this.route,n=[],r=-1;for(let c=0;c<e.length;c++)if(n.push(e[c]),e[c]===t){r=c;break}let s=e[0],o=e[e.length-1],f=r>0?e[r-1]:null,h=r!==-1?e[r+1]:null;return{traveledRoute:n,selfPosition:r,senderId:s,targetId:o,prevId:f,nextId:h,routeLength:e.length}}},cn=class extends Me{rerouterPubkey;newRoute;rerouterSignature;constructor(t,e,n,r,s,o,f,h,c){super(t,e,n,r,s,o),this.rerouterPubkey=f,this.newRoute=h,this.rerouterSignature=c}getRerouterId(){return this.newRoute[0]}},fn=class{callbacks={message_handle:[]};id;cryptoCodex;arbiter;peerStore;verbose;pathFinder;maxHops=Qt.MAX_HOPS;maxRoutes=Qt.MAX_ROUTES;maxNodes=Qt.MAX_NODES;constructor(t,e,n,r,s=0){this.id=t,this.cryptoCodex=e,this.arbiter=n,this.peerStore=r,this.verbose=s,this.pathFinder=new ks(this.id,this.peerStore)}on(t,e){this.callbacks[t]?this.callbacks[t].push(e):this.callbacks[t]=[e]}sendUnicast(t,e,n="message",r=1){if(t===this.id)return!1;let s=this.pathFinder.buildRoutes(t,this.maxRoutes,this.maxHops,this.maxNodes,!0);if(!s.success)return!1;let o=n==="private_message"?this.peerStore.privacy[t]?.sharedSecret:void 0,f=s.success==="blind"?1:r;for(let h=0;h<Math.min(f,s.routes.length);h++){let c=s.routes[h].path;if(c.length>Qt.MAX_HOPS){this.verbose>1&&console.warn(`Cannot send unicast message to ${t} as route exceeds maxHops (${Qt.MAX_HOPS}). BFS incurred.`);continue}let u=this.cryptoCodex.createUnicastMessage(n,e,c,this.peerStore.neighborsList,o);this.#e(c[1],u)}return!0}#e(t,e){if(this.id===t)return{success:!1,reason:"Cannot send message to self."};let n=this.peerStore.connected[t]?.transportInstance;if(!n)return{success:!1,reason:`Transport instance is not available for peer ${t}.`};try{return n.send(e),{success:!0}}catch(r){this.peerStore.kickPeer(t,0,"send-error"),this.verbose>0&&console.error(`Error sending message to ${t}:`,r.message)}return{success:!1,reason:`Error sending message to ${t}.`}}async handleDirectMessage(t,e){if(this.arbiter.isBanished(t))return this.verbose>=3?console.info(`%cReceived direct message from banned peer ${t}, ignoring.`,"color: red;"):null;if(!this.arbiter.countMessageBytes(t,e.byteLength,"unicast"))return;let n=this.cryptoCodex.readUnicastMessage(e,this.peerStore);if(!n)return this.arbiter.countPeerAction(t,"WRONG_SERIALIZATION");if(!await this.arbiter.digestMessage(t,n,e)||this.arbiter.isBanished(t)||this.arbiter.isBanished(n.senderId))return;let{traveledRoute:s,selfPosition:o,senderId:f,targetId:h,prevId:c,nextId:u}=n.extractRouteInfo(this.id);if(t===f&&t===this.id)throw new Error("DirectMessage senderId and from are both self id !!");for(let y of this.callbacks.message_handle||[])y();if(o===-1)return this.arbiter.adjustTrust(t,Rt.UNICAST_INVALID_ROUTE,"Self not in route");if(c&&t!==c)return this.arbiter.adjustTrust(t,Rt.UNICAST_INVALID_ROUTE,"Previous hop id does not match actual from id");if(f===this.id)return this.arbiter.adjustTrust(t,Rt.UNICAST_INVALID_ROUTE,"SenderId is self id");if(this.verbose>3&&console.log(f===t?`(${this.id}) Direct ${n.type} from ${f}: ${n.data}`:`(${this.id}) Direct ${n.type} from ${f} (lastRelay: ${t}): ${n.data}`),this.peerStore.digestPeerNeighbors(f,n.neighborsList),t!==f&&this.arbiter.adjustTrust(t,Rt.UNICAST_RELAYED,"Relayed unicast message"),Bt.ON_UNICAST.DIGEST_TRAVELED_ROUTE&&this.peerStore.digestValidRoute(s),this.id===h){for(let y of this.callbacks[n.type]||[])y(f,n.data);return}let{success:E,reason:l}=this.#e(u,e);if(!E&&!n.rerouterSignature){let y=this.pathFinder.buildRoutes(h,this.maxRoutes,this.maxHops,this.maxNodes,!0);if(!y.success)return;let C=y.routes[0].path;if(C.length>Qt.MAX_HOPS){this.verbose>1&&console.warn(`Cannot re-route unicast message to ${h} as new route exceeds maxHops (${Qt.MAX_HOPS}).`);return}let Q=this.cryptoCodex.createReroutedUnicastMessage(e,C),S=C[o+1];this.#e(S,Q)}}};await Ot();var hn=class{topic="gossip";timestamp;neighborsList;HOPS;senderId;pubkey;data;signature;signatureStart;expectedEnd;constructor(t,e,n,r,s,o,f,h,c,u){this.topic=t,this.timestamp=e,this.neighborsList=n,this.HOPS=r,this.senderId=s,this.pubkey=o,this.data=f,this.signature=h,this.signatureStart=c,this.expectedEnd=u}},qn=class{cryptoCodex;xxHash32UsageCount=0;seenTimeouts={};cache=[];cleanupFrequency=100;cleanupIn=100;cleanupDurationWarning=10;constructor(t){this.cryptoCodex=t}getGossipHistoryByTime(t="asc"){let e=this.cache.map(n=>({senderId:n.senderId,topic:n.topic,data:n.serializedMessage}));return t==="asc"?e:e.reverse()}addMessage(t){let e=ft.time,{marker:n,neighLength:r,timestamp:s,dataLength:o,pubkey:f,associatedId:h}=this.cryptoCodex.readBufferHeader(t);if(e-s>_t.EXPIRATION)return;let c=t.subarray(0,47+r+o),u=ye(c);if(this.xxHash32UsageCount++,this.seenTimeouts[u])return;let E=_t.MARKERS_BYTES[n],l=h,y=e+_t.CACHE_DURATION;return this.cache.push({hash:u,senderId:l,topic:E,serializedMessage:t,timestamp:s,expiration:y}),this.seenTimeouts[u]=y,--this.cleanupIn<=0&&this.#e(e),{hash:u,isNew:!this.seenTimeouts[u]}}#e(t=ft.time){let e=-1;for(let n=0;n<this.cache.length;n++)this.cache[n].expiration<=t?delete this.seenTimeouts[this.cache[n].hash]:e===-1&&(e=n);e>0?this.cache=this.cache.slice(e):e===-1&&(this.cache=[]),this.cleanupIn=this.cleanupFrequency}},un=class{callbacks={message_handle:[]};id;cryptoCodex;arbiter;peerStore;verbose;bloomFilter;constructor(t,e,n,r,s=0){this.id=t,this.cryptoCodex=e,this.arbiter=n,this.peerStore=r,this.verbose=s,this.bloomFilter=new qn(e)}on(t,e){this.callbacks[t]?this.callbacks[t].push(e):this.callbacks[t]=[e]}broadcastToAll(t,e="gossip",n){let r=n||_t.HOPS[e]||_t.HOPS.default,s=this.cryptoCodex.createGossipMessage(e,t,r,this.peerStore.neighborsList);if(this.bloomFilter.addMessage(s)){this.verbose>3&&console.log(`(${this.id}) Gossip ${e}, to ${JSON.stringify(this.peerStore.neighborsList)}: ${t}`);for(let o of this.peerStore.neighborsList)this.#e(o,s)}}#e(t,e){if(t===this.id)throw new Error(`Refusing to send a gossip message to self (${this.id}).`);let n=this.peerStore.connected[t]?.transportInstance;if(!n)return{success:!1,reason:`Transport instance is not available for peer ${t}.`};try{n.send(e)}catch{this.peerStore.connected[t]?.close()}}sendGossipHistoryToPeer(t){let e=this.bloomFilter.getGossipHistoryByTime("asc");for(let n of e)this.#e(t,n.data)}async handleGossipMessage(t,e){if(this.arbiter.isBanished(t))return this.verbose>=3?console.info(`%cReceived gossip message from banned peer ${t}, ignoring.`,"color: red;"):null;if(!this.arbiter.countMessageBytes(t,e.byteLength,"gossip"))return;for(let g of this.callbacks.message_handle||[])g(e);if(!this.bloomFilter.addMessage(e))return;let n=this.cryptoCodex.readGossipMessage(e);if(!n)return this.arbiter.countPeerAction(t,"WRONG_SERIALIZATION");if(!await this.arbiter.digestMessage(t,n,e)||this.arbiter.isBanished(t)||this.arbiter.isBanished(n.senderId))return;let{topic:s,timestamp:o,neighborsList:f,HOPS:h,senderId:c,data:u}=n;if(c===this.id)throw new Error(`#${this.id}#${t}# Received our own message back from peer ${t}.`);this.verbose>3&&console.log(c===t?`(${this.id}) Gossip ${s} from ${c}: ${u}`:`(${this.id}) Gossip ${s} from ${c} (by: ${t}): ${u}`),this.peerStore.digestPeerNeighbors(c,f);for(let g of this.callbacks[s]||[])g(c,u,h,n);if(h<1)return;let E=this.peerStore.neighborsList.length,l=Math.max(1,E/_t.TRANSMISSION_RATE.NEIGHBOURS_PONDERATION),y=_t.TRANSMISSION_RATE[s]||_t.TRANSMISSION_RATE.default,C=Math.pow(y,l),Q=E<_t.TRANSMISSION_RATE.MIN_NEIGHBOURS_TO_APPLY_PONDERATION,S=this.cryptoCodex.decrementGossipHops(e);for(let g of this.peerStore.neighborsList)if(g!==t){if(!Q&&Math.random()>C)continue;this.#e(g,S)}}};await Ot();var{SANDBOX:MA,ICE_CANDIDATE_EMITTER:OA,TEST_WS_EVENT_MANAGER:GA}=vt.ENABLED?await on().then(()=>sn):{},Kn=class{maxOffers=30;offers=[];orderingBy="neighborsCount";get size(){return this.offers.length}updateOrderingBy(t=!1){this.orderingBy=t?"overlap":"neighborsCount"}removeOlderThan(t=1e3){this.offers=this.offers.filter(e=>e.timestamp+t>=ft.time)}get bestOfferInfo(){let{senderId:t,overlap:e,neighborsCount:n,data:r,timestamp:s}=this.offers.shift()||{};return{senderId:t,data:r,timestamp:s,value:this.orderingBy==="overlap"?e:n}}pushSortTrim(t,e={min:.2,max:.8}){let{min:n,max:r}=e;Math.random()<Math.min(n,this.offers.size/this.maxOffers*r)||(this.offers.push(t),this.offers.length!==1&&(this.offers.sort((s,o)=>this.orderingBy==="overlap"?s.overlap-o.overlap:o.neighborsCount-s.neighborsCount),this.size>this.maxOffers&&this.offers.pop()))}},gn=class{id;cryptoCodex;gossip;messager;peerStore;bootstraps;offersQueue=new Kn;bootstrapsConnectionState=new Map;services;NEIGHBORS_TARGET;HALF_TARGET;TWICE_TARGET;setNeighborsTarget(t=Bt.TARGET_NEIGHBORS_COUNT){this.NEIGHBORS_TARGET=t,this.HALF_TARGET=Math.ceil(this.NEIGHBORS_TARGET/2),this.TWICE_TARGET=this.NEIGHBORS_TARGET*2}automation={incomingOffer:!0,incomingAnswer:!0,spreadOffers:!0,connectBootstraps:!0};phase=0;nextBootstrapIndex=0;maxBonus=Ct.CONNECTION_UPGRADE_TIMEOUT*.2;get isPublicNode(){return!!this.services?.publicUrl}constructor(t,e,n,r,s,o){this.setNeighborsTarget(Bt.TARGET_NEIGHBORS_COUNT),this.id=t,this.cryptoCodex=e,this.gossip=n,this.messager=r,this.peerStore=s;for(let f of o)this.bootstrapsConnectionState.set(f,!1);this.bootstraps=[...o].sort(()=>Math.random()-.5),this.nextBootstrapIndex=Math.random()*this.bootstraps.length|0}tick(){let{neighborsCount:t,nonPublicNeighborsCount:e,isEnough:n,isTooMany:r,isHalfReached:s}=this.#e,o=e>=this.NEIGHBORS_TARGET/3?1:St.MAX_SDP_OFFERS;if(this.peerStore.offerManager.offersToCreate=n?0:o,this.isPublicNode){this.services.freePublicNodeByKickingPeers();return}if(r)return Math.random()>.05?this.#A():null;n?Math.random()>.05&&this.#o():this.#o(),this.phase=this.phase?0:1,this.phase===0&&this.tryConnectNextBootstrap(t,e),this.phase===1&&this.#s(e,s)}handleIncomingSignal(t,e,n){if(this.isPublicNode||!t||this.peerStore.isKicked(t)||e.signal?.type!=="offer"&&e.signal?.type!=="answer")return;let{signal:r,offerHash:s}=e||{},{connected:o,nonPublicNeighborsCount:f,isTooMany:h,isHalfReached:c}=this.#e;if(h||o[t])return;if(r.type==="answer"){if(!this.automation.incomingAnswer||this.peerStore.addConnectingPeer(t,r,s)!==!0)return;let y=Math.abs(f-this.#t(t).nonPublicCount),C=this.maxBonus/this.NEIGHBORS_TARGET,Q=Math.round(Math.min(this.maxBonus,y*C));return this.peerStore.assignSignal(t,r,s,ft.time+Q)}if(!this.automation.incomingOffer||f>this.TWICE_TARGET)return;let{overlap:u,nonPublicCount:E}=this.#t(t);if(E>this.TWICE_TARGET)return;let l={senderId:t,data:e,overlap:u,neighborsCount:E,timestamp:ft.time};this.offersQueue.updateOrderingBy(c),this.offersQueue.pushSortTrim(l)}tryConnectNextBootstrap(t=0,e=0){if(!this.automation.connectBootstraps||this.bootstraps.length===0)return;let n=t-e,r=0;for(let o in this.peerStore.connecting)r++;if(this.NEIGHBORS_TARGET||t){if(n>=this.HALF_TARGET)return;if(t>=this.NEIGHBORS_TARGET)return;if(r+e>this.TWICE_TARGET)return}let s=this.bootstraps[this.nextBootstrapIndex++%this.bootstraps.length];this.bootstrapsConnectionState.get(s)||this.#i(s)}get#e(){return{connected:this.peerStore.connected,neighborsCount:this.peerStore.neighborsList.length,nonPublicNeighborsCount:this.peerStore.standardNeighborsList.length,isEnough:this.peerStore.standardNeighborsList.length>=this.NEIGHBORS_TARGET,isTooMany:this.peerStore.standardNeighborsList.length>this.NEIGHBORS_TARGET,isHalfReached:this.peerStore.standardNeighborsList.length>=this.HALF_TARGET}}#t(t="toto"){let e=this.peerStore.known[t]?.neighbors||{},n={overlap:0,nonPublicCount:0,p1nCount:this.peerStore.getUpdatedPeerConnectionsCount(t)};for(let r in e)this.cryptoCodex.isPublicNode(r)||n.nonPublicCount++;for(let r of this.peerStore.standardNeighborsList)e[r]&&n.overlap++;return n}#n(t=[]){return t.map(e=>({id:e,...this.#t(e)}))}#r(t){let e=typeof window<"u",r=e&&window.location.protocol==="https:"?"wss://":"ws://",s=t.endsWith("/ws"),o=e&&!s?window.location.host:t;return t.startsWith("ws")?t:`${r}${o}`}#i(t="localhost:8080"){let e=null,n=new St.WS_CLIENT(this.#r(t));n.binaryType="arraybuffer",n.onerror=r=>console.error("WebSocket error:",r.stack),n.onopen=()=>{this.bootstrapsConnectionState.set(t,!0),n.onclose=()=>{this.bootstrapsConnectionState.set(t,!1);for(let r of this.peerStore.callbacks.disconnect)r(e,"out")},n.onmessage=r=>{if(e)for(let s of this.peerStore.callbacks.data)s(e,r.data);else{let s=new Uint8Array(r.data);if(s[0]>127)return;let o=this.cryptoCodex.readUnicastMessage(s);if(!o)return;let{route:f,type:h,neighborsList:c}=o;if(h!=="handshake"||f.length!==2)return;let{signatureStart:u,pubkey:E,signature:l}=o,y=s.subarray(0,u);if(!this.cryptoCodex.verifySignature(E,y,l))return;e=f[0],this.peerStore.digestPeerNeighbors(e,c),this.peerStore.connecting[e]?.in?.close(),this.peerStore.connecting[e]||(this.peerStore.connecting[e]={}),this.peerStore.connecting[e].out=new ie(e,n,"out",!0);for(let C of this.peerStore.callbacks.connect)C(e,"out")}},n.send(this.cryptoCodex.createUnicastMessage("handshake",null,[this.id,this.id],this.peerStore.neighborsList))}}#s(t=0,e=!1){if(!this.automation.spreadOffers||!this.peerStore.neighborsList.length)return;let r=Object.keys(this.peerStore.connecting).length+t,{offerHash:s,readyOffer:o}=this.peerStore.offerManager.bestReadyOffer(0,!0);if(!s||!o)return;if(!e&&r<=this.TWICE_TARGET){this.gossip.broadcastToAll({signal:o.signal,offerHash:s},"signal_offer"),o.sentCounter++;return}let f=null;for(let C of this.#n(this.peerStore.standardNeighborsList)){let Q=C[e?"overlap":"nonPublicCount"];f===null&&(f=Q),e&&Q<f&&(f=Q),!e&&Q<=f&&(f=Q)}let h=100,c=1e3,u=this.peerStore.knownCount,E=Math.max(Math.min(c/u,u/c),.127),l=[];for(let C in this.peerStore.known){if(Math.random()>E)continue;if(--c<=0)break;if(C===this.id||this.cryptoCodex.isPublicNode(C)||this.peerStore.isKicked(C))continue;if(this.peerStore.connected[C]||this.peerStore.connecting[C])continue;let{overlap:Q,nonPublicCount:S}=this.#t(C);if(!(S>this.NEIGHBORS_TARGET)&&(f===null&&(f=e?Q:S),!(e&&Q>f)&&!(!e&&S<f)&&(l.push(C),--h<=0)))break}if(!l.length)return;let y=new Map;for(let C=0;C<Math.min(l.length,100);C++){let Q=l[Math.floor(Math.random()*l.length)];if(!y.has(Q)&&(y.size===0&&o.sentCounter++,y.set(Q,!0),this.messager.sendUnicast(Q,{signal:o.signal,offerHash:s},"signal_offer"),y.size>=12))break}}#o(){let t=null,e=Object.keys(this.peerStore.connecting).length;this.offersQueue.updateOrderingBy(this.#e.isHalfReached),this.offersQueue.removeOlderThan(St.SDP_OFFER_EXPIRATION/2);for(let n=0;n<this.offersQueue.size;n++){let{senderId:r,data:s,timestamp:o,value:f}=this.offersQueue.bestOfferInfo;if(!r||!s||!o)break;if(!(this.peerStore.connected[r]||this.peerStore.isKicked(r))&&!this.peerStore.connecting[r]?.in){if(t=t===null?f:t,t!==f)break;this.peerStore.addConnectingPeer(r,s.signal,s.offerHash)===!0&&(this.peerStore.assignSignal(r,s.signal,s.offerHash,o),e++)}}}#A(){let e=this.#n(this.peerStore.standardNeighborsList).sort((n,r)=>r.overlap-n.overlap||r.nonPublicCount-n.nonPublicCount);this.peerStore.kickPeer(e[0].id,6e4,"improveTopology")}};await Ot();var Ms={1:0,2:1,3:2,4:3,5:4,6:5,7:6,8:7,9:8,A:9,B:10,C:11,D:12,E:13,F:14,G:15,H:16,J:17,K:18,L:19,M:20,N:21,P:22,Q:23,R:24,S:25,T:26,U:27,V:28,W:29,X:30,Y:31,Z:32,a:33,b:34,c:35,d:36,e:37,f:38,g:39,h:40,i:41,j:42,k:43,m:44,n:45,o:46,p:47,q:48,r:49,s:50,t:51,u:52,v:53,w:54,x:55,y:56,z:57},Os=["1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","J","K","L","M","N","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],Gt=class a{IS_BROWSER=typeof window<"u";FROMBASE64_AVAILABLE=typeof Uint8Array.fromBase64=="function";textEncoder=new TextEncoder;textDecoder=new TextDecoder;buffer2=new ArrayBuffer(2);view2=new DataView(this.buffer2);buffer4=new ArrayBuffer(4);view4=new DataView(this.buffer4);buffer8=new ArrayBuffer(8);view8=new DataView(this.buffer8);hexMap={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15};numberTo2Bytes(t){return this.view2.setUint16(0,t,!0),new Uint8Array(this.buffer2)}numberTo4Bytes(t){return this.view4.setUint32(0,t,!0),new Uint8Array(this.buffer4)}numberTo8Bytes(t){return this.view8.setBigUint64(0,BigInt(t),!0),new Uint8Array(this.buffer8)}stringToBytes(t="toto"){return this.textEncoder.encode(t)}hexToBytes(t){let e=t.length/2,n=new Uint8Array(e);for(let r=0,s=0;r<e;++r,s+=2)n[r]=(this.hexMap[t[s]]<<4)+this.hexMap[t[s+1]];return n}base64toBytes(t){if(!this.IS_BROWSER)return new Uint8Array(Buffer.from(t,"base64"));if(this.FROMBASE64_AVAILABLE)return Uint8Array.fromBase64(t);let e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}bytes2ToNumber(t){for(let e=0;e<2;e++)this.view2.setUint8(e,t[e]);return this.view2.getUint16(0,!0)}bytes4ToNumber(t){for(let e=0;e<4;e++)this.view4.setUint8(e,t[e]);return this.view4.getUint32(0,!0)}bytes8ToNumber(t){for(let e=0;e<8;e++)this.view8.setUint8(e,t[e]);return Number(this.view8.getBigUint64(0,!0))}bytesToString(t){return this.textDecoder.decode(t)}static bytesToHex(t,e=0){let n="";for(let r of t)n+=r<16?`0${r.toString(16)}`:r.toString(16);return e>0&&(n=n.padStart(e,"0")),n}bytesToHex(t,e=0){return a.bytesToHex(t,e)}hexToBase58(t){let e=a.hexToBigInt(t),n="",r=e;for(;r>0;){let o=r%BigInt(58);n=Os[Number(o)]+n,r=r/BigInt(58)}let s=isNode?Buffer.from(n):new TextEncoder().encode(n);for(let o=0;o<s.length&&s[o]===0;o++)n="1"+n;return n}base58ToHex(t,e=0){let n=BigInt(0),r=BigInt(58);for(let o of t)n=n*r+BigInt(Ms[o]);let s=n.toString(16);return s.length%2!==0&&(s="0"+s),e>0&&(s=s.padStart(e,"0")),s}addressBase58ToBytes(t){let e=this.base58ToHex(t,32);return this.hexToBytes(e)}addressBytesToBase58(t){let e=this.bytesToHex(t,32);return this.hexToBase58(e)}static hexToBigInt(t){return BigInt("0x"+t)}static hexToBits(t="ffffff",e="string"){let n=[];if(e==="arrayOfNumbers")for(let r=0;r<t.length;r++)n.push(...parseInt(t[r],16).toString(2).padStart(4,"0").split("").map(s=>parseInt(s,10)));else for(let r=0;r<t.length;r++)n.push(parseInt(t[r],16).toString(2).padStart(4,"0"));return e==="string"?n.join(""):n}static bytesToBits(t,e="string"){return this.hexToBits(this.bytesToHex(t),e)}static ipToInt(t="192.168.0.1"){return t.split(".").reduce((e,n)=>(e<<8)+parseInt(n,10),0)}};var Dr=typeof window<"u",{ed25519:Te,x25519:je}=await Promise.resolve().then(()=>(Ki(),qi)),{chacha20poly1305:Ve}=await Promise.resolve().then(()=>(Is(),ds)),{randomBytes:Un}=await Promise.resolve().then(()=>(De(),es));var ve=class{converter=new Gt;argon2;hash=async(t,e,n=2**16,r=1,s=1,o=2,f=32)=>{let h=this.#e(t,e,r,n,s,o,f),c=await this.getArgon2Lib(),u=Dr?await c.hash(h):await c.hash(t,h);if(!u)return!1;let E=u.encoded||u,l=this.#t(E);return l||!1};async getArgon2Lib(){if(this.argon2)return this.argon2;if(!Dr)try{let e=await import("argon2");this.argon2=e}catch{throw new Error("Please install argon2 package: npm install argon2")}if(this.argon2)return this.argon2;try{if(argon2)return console.log("Argon2 loaded as a global variable"),this.argon2=argon2,this.argon2}catch{}if(this.argon2)return this.argon2;console.log("trying import argon2 ES6 and inject in window");let t=await Promise.resolve().then(()=>(ps(),Es));return window.argon2=t.default,this.argon2=t.default,this.argon2}#e(t="averylongpassword123456",e="saltsaltsaltsaltsalt",n=1,r=2**10,s=1,o=2,f=32){let h=e.padEnd(20,"0").substring(0,16);return{type:o,pass:t,parallelism:s,time:n,timeCost:n,mem:r,memoryCost:r,hashLen:f,hashLength:f,salt:Dr?h:Buffer.from(h)}}#t(t="$argon2id$v=19$m=1048576,t=1,p=1$c2FsdHNhbHRzYWx0c2FsdHNhbHQ$UamPN/XTTX4quPewQNw4/s3y1JJeS22cRroh5l7OTMM"){let e=t.split("$").pop(),n=this.converter.base64toBytes(e),r=this.converter.bytesToHex(n),s=Gt.hexToBits(r,"string");return{encoded:t,hash:n,hex:r,bitsString:s}}};De();var Fe=class a{argon2=new ve;converter=new Gt;AVOID_CRYPTO=!1;verbose=Ct.DEFAULT_VERBOSE;id;publicKey;privateKey;constructor(t,e=Ct.DEFAULT_VERBOSE){if(this.verbose=e,!t)return;this.id=t.padEnd(st.ID_LENGTH," ").slice(0,st.ID_LENGTH),this.privateKey=new Uint8Array(32).fill(0),this.publicKey=new Uint8Array(32).fill(0);let n=new TextEncoder().encode(this.id);for(let r=0;r<st.ID_LENGTH;r++)this.publicKey[r]=n[r]}static async createCryptoCodex(t,e){let n=new a(void 0,this.verbose),r=e?typeof e=="string"?n.converter.hexToBytes(e):e:void 0;return await n.generate(t,r),n}static isPublicNode(t){return(st.ARE_IDS_HEX?Gt.hexToBits(t[0]):t).startsWith(st.PUBLIC_PREFIX)}get idLength(){return st.ARE_IDS_HEX?st.ID_LENGTH/2:st.ID_LENGTH}isPublicNode(t){return a.isPublicNode(t)}async generate(t,e){if(!this.nodeId&&(await this.#t(e,t),this.AVOID_CRYPTO=!1,!this.id))throw new Error("Failed to generate identity")}async pubkeyDifficultyCheck(t){if(this.AVOID_CRYPTO||!st.DIFFICULTY)return!0;let{bitsString:e}=await this.argon2.hash(t,"HiveP2P",st.ARGON2_MEM)||{};if(e&&e.startsWith("0".repeat(st.DIFFICULTY)))return!0}#e(t){return st.ARE_IDS_HEX?this.converter.bytesToHex(t.slice(0,this.idLength),st.ID_LENGTH):this.converter.bytesToString(t.slice(0,st.ID_LENGTH))}async#t(t,e){let n=2**st.DIFFICULTY*100;for(let r=0;r<n;r++){let{secretKey:s,publicKey:o}=Te.keygen(t),f=this.#e(o);if(!(e&&!this.isPublicNode(f))&&!(!e&&this.isPublicNode(f))&&await this.pubkeyDifficultyCheck(o)){this.id=f,this.privateKey=s,this.publicKey=o,this.verbose>2&&console.log(`%cNode generated id: ${this.id} (isPublic: ${e}, difficulty: ${st.DIFFICULTY}) after ${((r+1)/2).toFixed(1)} iterations`,gt.CRYPTO_CODEX);return}}this.verbose>0&&console.log(`%cFAILED to generate id after ${n} iterations. Try lowering the difficulty.`,gt.CRYPTO_CODEX)}generateEphemeralX25519Keypair(){let{secretKey:t,publicKey:e}=je.keygen();return{myPub:e,myPriv:t}}computeX25519SharedSecret(t,e){return je.getSharedSecret(t,e)}encryptData(t,e){if(!e)throw new Error("Cannot encrypt data without shared secret.");let n=Un(12),s=Ve(e,n).encrypt(t);return Je(n,s)}decryptData(t,e){if(!e)throw new Error("Cannot decrypt data without shared secret.");let n=t.slice(0,12);return Ve(e,n).decrypt(t.slice(12))}signBufferViewAndAppendSignature(t,e,n=t.length-st.SIGNATURE_LENGTH){if(this.AVOID_CRYPTO)return;let r=t.subarray(0,n),s=Te.sign(r,e);t.set(s,n)}createGossipMessage(t,e,n=3,r=[],s=ft.time){let o=_t.MARKERS_BYTES[t];if(o===void 0)throw new Error(`Failed to create gossip message: unknown topic '${t}'.`);let f=this.#n(r),{dataCode:h,dataBytes:c}=this.#r(e),u=47+f.length+c.length+st.SIGNATURE_LENGTH+1,E=new ArrayBuffer(u),l=new Uint8Array(E);return this.#i(l,o,h,r.length,s,c,this.publicKey),l.set(f,47),l.set(c,47+f.length),l.set([Math.min(255,n)],u-1),this.signBufferViewAndAppendSignature(l,this.privateKey,u-st.SIGNATURE_LENGTH-1),l}decrementGossipHops(t){let e=new Uint8Array(t),n=t[t.length-1];return e[t.length-1]=Math.max(0,n-1),e}createUnicastMessage(t,e,n,r=[],s,o=ft.time){let f=Qt.MARKERS_BYTES[t];if(f===void 0)throw new Error(`Failed to create unicast message: unknown type '${t}'.`);if(n.length<2)throw new Error("Failed to create unicast message: route must have at least 2 nodes (next hop and target).");if(n.length>Qt.MAX_HOPS)throw new Error(`Failed to create unicast message: route exceeds max hops (${Qt.MAX_HOPS}).`);let h=this.#n(r),{dataCode:c,dataBytes:u}=this.#r(e),E=s?this.encryptData(u,s):u,l=this.#n(n),y=47+h.length+1+l.length+E.length+st.SIGNATURE_LENGTH,C=new ArrayBuffer(y),Q=new Uint8Array(C);this.#i(Q,f,c,r.length,o,E,this.publicKey);let S=h.length+E.length;return Q.set(h,47),Q.set(E,47+h.length),Q.set([n.length],47+S),Q.set(l,48+S),this.signBufferViewAndAppendSignature(Q,this.privateKey,y-st.SIGNATURE_LENGTH),Q}createReroutedUnicastMessage(t,e){if(e.length<2)throw new Error("Failed to create rerouted unicast message: route must have at least 2 nodes (next hop and target).");if(e.length>Qt.MAX_HOPS)throw new Error(`Failed to create rerouted unicast message: route exceeds max hops (${Qt.MAX_HOPS}).`);let n=e.map(f=>this.converter.stringToBytes(f)),r=t.length+32+st.ID_LENGTH*n.length+st.SIGNATURE_LENGTH,s=new ArrayBuffer(r),o=new Uint8Array(s);o.set(t,0),o.set(this.publicKey,t.length);for(let f=0;f<n.length;f++)o.set(n[f],t.length+32+f*st.ID_LENGTH);return this.signBufferViewAndAppendSignature(o,this.privateKey,r-st.SIGNATURE_LENGTH),o}#n(t){return st.ARE_IDS_HEX?this.converter.hexToBytes(t.join(""),st.ID_LENGTH*t.length):this.converter.stringToBytes(t.join(""))}#r(t){return typeof t=="string"?{dataCode:1,dataBytes:this.converter.stringToBytes(t)}:t instanceof Uint8Array?{dataCode:2,dataBytes:t}:{dataCode:3,dataBytes:this.converter.stringToBytes(JSON.stringify(t))}}#i(t,e,n,r,s,o,f){let h=this.converter.numberTo8Bytes(s),c=this.converter.numberTo4Bytes(o.length);t.set([e],0),t.set([n],1),t.set([r],2),t.set(h,3),t.set(c,11),t.set(f,15)}verifySignature(t,e,n){return this.AVOID_CRYPTO?!0:Te.verify(n,e,t)}readBufferHeader(t,e=!0){let n=t[0],r=t[1],s=t[2],o=t.slice(3,11),f=t.slice(11,15),h=t.slice(15,47),c=e?this.#e(h):null,u=s*this.idLength,E=this.converter.bytes8ToNumber(o),l=this.converter.bytes4ToNumber(f);return{marker:n,dataCode:r,neighLength:u,timestamp:E,dataLength:l,pubkey:h,associatedId:c}}readGossipMessage(t){this.verbose>3&&console.log(`%creadGossipMessage ${t.byteLength} bytes`,gt.CRYPTO_CODEX),this.verbose>4&&console.log(`%c${t}`,gt.CRYPTO_CODEX);try{let{marker:e,dataCode:n,neighLength:r,timestamp:s,dataLength:o,pubkey:f,associatedId:h}=this.readBufferHeader(t),c=_t.MARKERS_BYTES[e];if(c===void 0)throw new Error(`Failed to deserialize gossip message: unknown marker byte ${d[0]}.`);let u=r+o,E=this.#s(t.slice(47,47+r)),l=this.#o(n,t.slice(47+r,47+u)),y=47+u,C=t.slice(y,y+st.SIGNATURE_LENGTH),Q=t[t.length-1],S=y+st.SIGNATURE_LENGTH+1,g=h;return new hn(c,s,E,Q,g,f,l,C,y,S)}catch(e){this.verbose>1&&console.warn(`Error deserializing ${topic||"unknown"} gossip message:`,e.stack)}return null}readUnicastMessage(t,e){this.verbose>3&&console.log(`%creadUnicastMessage ${t.byteLength} bytes`,gt.CRYPTO_CODEX),this.verbose>4&&console.log(`%c${t}`,gt.CRYPTO_CODEX);try{let{marker:n,dataCode:r,neighLength:s,timestamp:o,dataLength:f,pubkey:h}=this.readBufferHeader(t,!1),c=Qt.MARKERS_BYTES[n];if(c===void 0)throw new Error(`Failed to deserialize unicast message: unknown marker byte ${B[0]}.`);let u=s+f,E=this.#s(t.slice(47,47+s)),y=t[47+u]*this.idLength,C=47+u+1+y,Q=t.slice(47+u+1,C),S=this.#s(Q),g=S[S.length-1],B=c==="private_message"&&this.id===g?this.decryptData(t.slice(47+s,47+u),e.privacy[this.#e(h)]?.sharedSecret):t.slice(47+s,47+u),p=this.id===g?this.#o(r,B):B,_=C+st.SIGNATURE_LENGTH,w=t.slice(C,_);if(!(t.length>_))return new Me(c,o,E,S,h,p,w,C,_);let v=t.slice(_,_+32),b=this.#s(t.slice(_+32,t.length-st.SIGNATURE_LENGTH)),m=t.slice(t.length-st.SIGNATURE_LENGTH);return new cn(c,o,E,S,h,p,w,v,b,m,t.length)}catch(n){this.verbose>1&&console.warn(`Error deserializing ${type||"unknown"} unicast message:`,n.stack)}return null}#s(t){let e=[],n=this.idLength;if(t.length%n!==0)throw new Error("Failed to parse ids: invalid serialized length.");for(let r=0;r<t.length/n;r++){let s=t.slice(r*n,(r+1)*n);st.ARE_IDS_HEX?e.push(this.converter.bytesToHex(s,st.ID_LENGTH)):e.push(this.converter.bytesToString(s))}return e}#o(t,e){if(t===1)return this.converter.bytesToString(e);if(t===2)return e;if(t===3)return JSON.parse(this.converter.bytesToString(e));throw new Error(`Failed to parse data: unknown data code '${t}'.`)}};await Ot();var $o=Ct.IS_BROWSER?null:await import("dgram"),Ln=class{id;verbose;maxKick;peerStore;cryptoCodex;publicUrl;constructor(t,e,n=3,r=1){this.id=t.id,this.verbose=r,this.maxKick=n,this.peerStore=e,this.cryptoCodex=t}start(t="localhost",e=Yt.PORT){this.publicUrl=`ws://${t}:${e}`,this.#e(t,e),vt.USE_TEST_TRANSPORTS||this.#t(t,e+1)}freePublicNodeByKickingPeers(){let t=Math.min(this.maxKick,this.peerStore.neighborsList.length-Bt.TARGET_NEIGHBORS_COUNT);if(t<=0)return;let e=0,n=Yt.AUTO_KICK_DELAY;for(let r in this.peerStore.connected){let s=this.peerStore.connected[r],o=this.peerStore.getUpdatedPeerConnectionsCount(r,!1);if(o>Bt.TARGET_NEIGHBORS_COUNT){if(this.peerStore.kickPeer(r,Yt.AUTO_KICK_DURATION,"freePublicNode"),this.peerStore.neighborsList.length<=Bt.TARGET_NEIGHBORS_COUNT)break;continue}if(!(s.getConnectionDuration()<(o>2?n:n*2))&&(this.peerStore.kickPeer(r,Yt.AUTO_KICK_DURATION,"freePublicNode"),++e>=t))break}}#e(t="localhost",e=Yt.PORT){this.wsServer=new St.WS_SERVER({port:e,host:t}),this.wsServer.on("error",n=>console.error(`WebSocket error on Node #${this.id}:`,n)),this.wsServer.on("connection",n=>{n.on("close",()=>{if(r)for(let s of this.peerStore.callbacks.disconnect)s(r,"in")}),n.on("error",s=>console.error(`WebSocket error on Node #${this.id} with peer ${r}:`,s.stack));let r;n.on("message",s=>{if(r)for(let o of this.peerStore.callbacks.data)o(r,s);else{let o=new Uint8Array(s);if(o[0]>127)return;let f=this.cryptoCodex.readUnicastMessage(o);if(!f)return;let{route:h,type:c,neighborsList:u}=f;if(c!=="handshake"||h.length!==2)return;let{signatureStart:E,pubkey:l,signature:y}=f,C=o.subarray(0,E);if(!this.cryptoCodex.verifySignature(l,C,y))return;r=h[0],this.peerStore.digestPeerNeighbors(r,u),this.peerStore.connecting[r]?.out?.close(),this.peerStore.connecting[r]||(this.peerStore.connecting[r]={}),this.peerStore.connecting[r].in=new ie(r,n,"in",!0);for(let Q of this.peerStore.callbacks.connect)Q(r,"in")}}),n.send(this.cryptoCodex.createUnicastMessage("handshake",null,[this.id,this.id],this.peerStore.neighborsList))})}#t(t="localhost",e=Yt.PORT+1){this.stunServer=$o.createSocket("udp4"),this.stunServer.on("message",(n,r)=>{this.verbose>2&&console.log(`%cSTUN message from ${r.address}:${r.port} - ${n.toString("hex")}`,gt.SERVICE),this.#n(n)&&this.stunServer.send(this.#r(n,r),r.port,r.address)}),this.stunServer.bind(e,t),this.verbose>2&&console.log(`%cSTUN server listening on ${t}:${e}`,gt.SERVICE)}#n(t){if(t.length<20)return!1;let e=t.readUInt16BE(0),n=t.readUInt32BE(4);return e===1&&n===554869826}#r(t,e){let n=t.subarray(8,20),r=Buffer.allocUnsafe(32);return r.writeUInt16BE(257,0),r.writeUInt16BE(12,2),r.writeUInt32BE(554869826,4),n.copy(r,8),r.writeUInt16BE(1,20),r.writeUInt16BE(8,22),r.writeUInt16BE(1,24),r.writeUInt16BE(e.port,26),r.writeUInt32BE(Gt.ipToInt(e.address),28),this.verbose>2&&console.log(`%cSTUN Response: client will discover IP ${e.address}:${e.port}`,"color: green;"),r}static deriveSTUNServers(t){let e=[];for(let n of t){if(!n.includes(":")||n.endsWith("/ws")||n.endsWith("/wss"))continue;let r=n.replace("ws://","stun:");r.replace("wss://","stun:"),r.includes("stun:")&&e.push({urls:r})}return St.CENTRALIZED_STUN_SERVERS&&(e.push({urls:"stun:stun.l.google.com:5349"}),e.push({urls:"stun:stun.l.google.com:19302"}),e.push({urls:"stun:stun1.l.google.com:3478"}),e.push({urls:"stun:stun1.l.google.com:5349"})),e}};async function Bs(a={}){let t=a.verbose!==void 0?a.verbose:Ct.DEFAULT_VERBOSE,e=a.cryptoCodex||new Fe(void 0,t),n=ft.sync(t);e.publicKey||await e.generate(!1),await n;let r=new Xe(e,a.bootstraps||[],t);return a.autoStart!==!1&&await r.start(),r}var Xe=class{started=!1;id;cryptoCodex;verbose;offerManager;arbiter;peerStore;messager;gossip;topologist;services;constructor(t,e=[],n=Ct.DEFAULT_VERBOSE){this.verbose=n,this.topologist?.services&&(this.topologist.services.verbose=n),this.cryptoCodex=t,this.id=this.cryptoCodex.id;let r=Ln.deriveSTUNServers(e||[]);this.offerManager=new ze(this.id,r,n),this.arbiter=new Ze(this.id,t,n),this.peerStore=new An(this.id,this.cryptoCodex,this.offerManager,this.arbiter,n),this.messager=new fn(this.id,this.cryptoCodex,this.arbiter,this.peerStore,n),this.gossip=new un(this.id,this.cryptoCodex,this.arbiter,this.peerStore,n),this.topologist=new gn(this.id,this.cryptoCodex,this.gossip,this.messager,this.peerStore,e||[]);let{arbiter:s,peerStore:o,messager:f,gossip:h,topologist:c}=this;o.on("signal",(u,E)=>this.sendMessage(u,E,{type:"signal_answer"})),o.on("connect",(u,E)=>this.#e(u,E)),o.on("disconnect",(u,E)=>this.#t(u,E)),o.on("data",(u,E)=>this.#n(u,E)),f.on("signal_answer",(u,E)=>c.handleIncomingSignal(u,E)),f.on("signal_offer",(u,E)=>c.handleIncomingSignal(u,E)),f.on("privacy",(u,E)=>this.#r(u,E)),h.on("signal_offer",(u,E,l)=>c.handleIncomingSignal(u,E,l)),n>2&&console.log(`Node initialized: ${this.id}`)}#e=(t,e)=>{let n=this.cryptoCodex.isPublicNode(t);if(this.publicUrl)return;this.verbose>(this.publicUrl||n?3:2)&&console.log(`(${this.id}) ${e==="in"?"Incoming":"Outgoing"} connection established with peer ${t}`),(!n&&!this.cryptoCodex.isPublicNode(this.id)||e==="in")&&this.sendMessage(t,this.id,"handshake");let s=this.peerStore.neighborsList.length>=Bt.TARGET_NEIGHBORS_COUNT+this.halfTarget,o=()=>{Bt.ON_CONNECT_DISPATCH.OVER_NEIGHBORED&&s&&this.broadcast([],{type:"over_neighbored"}),Bt.ON_CONNECT_DISPATCH.SHARE_HISTORY&&this.peerStore.getUpdatedPeerConnectionsCount(t)<=1&&this.gossip.sendGossipHistoryToPeer(t)};Bt.ON_CONNECT_DISPATCH.DELAY?setTimeout(o,Bt.ON_CONNECT_DISPATCH.DELAY):o()};#t=(t,e)=>{if(!this.peerStore.neighborsList.length){for(let s in this.peerStore.connecting)this.peerStore.kickPeer(s,0,"no_neighbors_left");for(let s in this.offerManager.offers)this.offerManager.offers[s].timestamp=0}let n=this.cryptoCodex.isPublicNode(t);if(this.peerStore.connected[t])return;this.verbose>(this.publicUrl||n?3:2)&&console.log(`(${this.id}) ${e==="in"?"Incoming":"Outgoing"} connection closed with peer ${t}`)};#n=(t,e)=>{let n=new Uint8Array(e);n[0]>127?this.gossip.handleGossipMessage(t,n):this.messager.handleDirectMessage(t,n)};get publicUrl(){return this.services?.publicUrl}get time(){return ft.time}async start(){return await ft.sync(this.verbose),this.started=!0,vt.AVOID_INTERVALS||(this.arbiterInterval=setInterval(()=>this.arbiter.tick(),1e3),this.peerStoreInterval=setInterval(()=>{this.peerStore.cleanupExpired(),this.peerStore.offerManager.tick()},2500),this.publicUrl)||(this.enhancerInterval=setInterval(()=>this.topologist.tick(),Bt.LOOP_DELAY),this.topologist.tryConnectNextBootstrap()),!0}broadcast(t,e={}){let{topic:n,HOPS:r}=e;return this.gossip.broadcastToAll(t,n,r)}async sendMessage(t,e,n={}){let{type:r,spread:s}=n,o=r==="private_message"?await this.getPeerPrivacy(t):null;return o&&!o?.sharedSecret?(this.verbose>1&&console.warn(`Cannot send encrypted message to ${t} as shared secret could not be established.`),!1):this.messager.sendUnicast(t,e,r,s)}async sendPrivateMessage(t,e,n={}){let r={...n,type:"private_message"};return this.sendMessage(t,e,r)}async getPeerPrivacy(t,e=20){let n=this.peerStore.privacy[t];n||(this.peerStore.privacy[t]=this.cryptoCodex.generateEphemeralX25519Keypair(),n=this.peerStore.privacy[t]);let r=1;for(;!n?.sharedSecret&&e-- >0;)r--<=0&&(this.messager.sendUnicast(t,n.myPub,"privacy"),r=5),await new Promise(s=>setTimeout(s,100)),n=this.peerStore.privacy[t];return n}#r(t,e){this.peerStore.privacy[t]?.sharedSecret||(this.peerStore.privacy[t]||(this.peerStore.privacy[t]=this.cryptoCodex.generateEphemeralX25519Keypair()),this.peerStore.privacy[t].peerPub=e,this.peerStore.privacy[t].sharedSecret=this.cryptoCodex.computeX25519SharedSecret(this.peerStore.privacy[t].myPriv,e),this.messager.sendUnicast(t,this.peerStore.privacy[t].myPub,"privacy"))}async tryConnectToPeer(t="toto",e=10){if(!this.peerStore.connected[t])do{let{offerHash:n,readyOffer:r}=this.peerStore.offerManager.bestReadyOffer(100,!1);if(!n||!r)await new Promise(s=>setTimeout(s,1e3));else{this.messager.sendUnicast(t,{signal:r.signal,offerHash:n},"signal_offer");return}}while(e-- >0)}destroy(){this.enhancerInterval&&clearInterval(this.enhancerInterval),this.enhancerInterval=null,this.peerStoreInterval&&clearInterval(this.peerStoreInterval),this.peerStoreInterval=null,this.peerStore.destroy(),this.wsServer&&this.wsServer.close(),this.stunServer&&this.stunServer.close()}onPeerConnect(t){this.peerStore.on("connect",t)}onPeerDisconnect(t){this.peerStore.on("disconnect",t)}onMessageData(t,e=!0){this.messager.on("message",t),e&&this.messager.on("private_message",t)}onPrivateMessageData(t){this.messager.on("private_message",t)}onGossipData(t){this.gossip.on("gossip",t)}onSignalOffer(t){this.messager.on("signal_offer",t),this.gossip.on("signal_offer",t)}onSignalAnswer(t){this.messager.on("signal_answer",t)}kickPeer(t,e="kicked_by_node"){this.peerStore.kickPeer(t,0,e)}banPeer(t,e=6e4,n="banished_by_node"){this.arbiter.trustBalances[t]=0,this.arbiter.adjustTrust(t,-e,n)}};await Ot();function Cs(a,t){for(let e in t)t[e]&&typeof t[e]=="object"&&!Array.isArray(t[e])?(a[e]=a[e]||{},Cs(a[e],t[e])):a[e]=t[e]}var ys={CLOCK:ft,CONFIG:Ur,Converter:Gt,mergeConfig:Cs,Node:Xe,createNode:Bs,CryptoCodex:Fe,ed25519:Te,x25519:je,chacha20poly1305:Ve,randomBytes:Un,Argon2Unified:ve,xxHash32:ye};var Mc=ys;typeof window<"u"&&(window.HiveP2P=ys);export{ve as Argon2Unified,ft as CLOCK,Ur as CONFIG,Gt as Converter,Fe as CryptoCodex,Xe as Node,Ve as chacha20poly1305,Bs as createNode,Mc as default,Te as ed25519,Cs as mergeConfig,Un as randomBytes,je as x25519,ye as xxHash32};
1
+ var Qs=Object.create;var kn=Object.defineProperty;var bs=Object.getOwnPropertyDescriptor;var ws=Object.getOwnPropertyNames;var ms=Object.getPrototypeOf,Ss=Object.prototype.hasOwnProperty;var Le=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var pt=(a,t)=>()=>(a&&(t=a(a=0)),t);var _s=(a,t)=>()=>(t||a((t={exports:{}}).exports,t),t.exports),ke=(a,t)=>{for(var e in t)kn(a,e,{get:t[e],enumerable:!0})},Rs=(a,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ws(t))!Ss.call(a,r)&&r!==e&&kn(a,r,{get:()=>t[r],enumerable:!(n=bs(t,r))||n.enumerable});return a};var xs=(a,t,e)=>(e=a!=null?Qs(ms(a)):{},Rs(t||!a||!a.__esModule?kn(e,"default",{value:a,enumerable:!0}):e,a));var Ds={};var Nr=pt(()=>{(function(a){if(typeof exports=="object"&&typeof module<"u")module.exports=a();else if(typeof define=="function"&&define.amd)define([],a);else{var t;t=typeof window>"u"?typeof global>"u"?typeof self>"u"?this:self:global:window,t.SimplePeer=a()}})(function(){var a=Math.floor,t=Math.abs,e=Math.pow;return(function(){function n(r,s,o){function f(u,E){if(!s[u]){if(!r[u]){var l=typeof Le=="function"&&Le;if(!E&&l)return l(u,!0);if(h)return h(u,!0);var y=new Error("Cannot find module '"+u+"'");throw y.code="MODULE_NOT_FOUND",y}var C=s[u]={exports:{}};r[u][0].call(C.exports,function(Q){var S=r[u][1][Q];return f(S||Q)},C,C.exports,n,r,s,o)}return s[u].exports}for(var h=typeof Le=="function"&&Le,c=0;c<o.length;c++)f(o[c]);return f}return n})()({1:[function(n,r,s){"use strict";function o(B){var p=B.length;if(0<p%4)throw new Error("Invalid string. Length must be a multiple of 4");var _=B.indexOf("=");_===-1&&(_=p);var w=_===p?0:4-_%4;return[_,w]}function f(B,p,_){return 3*(p+_)/4-_}function h(B){var p,_,w=o(B),x=w[0],N=w[1],b=new C(f(B,x,N)),m=0,v=0<N?x-4:x;for(_=0;_<v;_+=4)p=y[B.charCodeAt(_)]<<18|y[B.charCodeAt(_+1)]<<12|y[B.charCodeAt(_+2)]<<6|y[B.charCodeAt(_+3)],b[m++]=255&p>>16,b[m++]=255&p>>8,b[m++]=255&p;return N===2&&(p=y[B.charCodeAt(_)]<<2|y[B.charCodeAt(_+1)]>>4,b[m++]=255&p),N===1&&(p=y[B.charCodeAt(_)]<<10|y[B.charCodeAt(_+1)]<<4|y[B.charCodeAt(_+2)]>>2,b[m++]=255&p>>8,b[m++]=255&p),b}function c(B){return l[63&B>>18]+l[63&B>>12]+l[63&B>>6]+l[63&B]}function u(B,p,_){for(var w,x=[],N=p;N<_;N+=3)w=(16711680&B[N]<<16)+(65280&B[N+1]<<8)+(255&B[N+2]),x.push(c(w));return x.join("")}function E(B){for(var p,_=B.length,w=_%3,x=[],N=16383,b=0,m=_-w;b<m;b+=N)x.push(u(B,b,b+N>m?m:b+N));return w===1?(p=B[_-1],x.push(l[p>>2]+l[63&p<<4]+"==")):w===2&&(p=(B[_-2]<<8)+B[_-1],x.push(l[p>>10]+l[63&p>>4]+l[63&p<<2]+"=")),x.join("")}s.byteLength=function(B){var p=o(B),_=p[0],w=p[1];return 3*(_+w)/4-w},s.toByteArray=h,s.fromByteArray=E;for(var l=[],y=[],C=typeof Uint8Array>"u"?Array:Uint8Array,Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",S=0,g=Q.length;S<g;++S)l[S]=Q[S],y[Q.charCodeAt(S)]=S;y[45]=62,y[95]=63},{}],2:[function(){},{}],3:[function(n,r,s){(function(){(function(){"use strict";var o=String.fromCharCode,f=Math.min;function h(i){if(2147483647<i)throw new RangeError('The value "'+i+'" is invalid for option "size"');var A=new Uint8Array(i);return A.__proto__=c.prototype,A}function c(i,A,I){if(typeof i=="number"){if(typeof A=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return y(i)}return u(i,A,I)}function u(i,A,I){if(typeof i=="string")return C(i,A);if(ArrayBuffer.isView(i))return Q(i);if(i==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);if(F(i,ArrayBuffer)||i&&F(i.buffer,ArrayBuffer))return S(i,A,I);if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var R=i.valueOf&&i.valueOf();if(R!=null&&R!==i)return c.from(R,A,I);var U=g(i);if(U)return U;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof i[Symbol.toPrimitive]=="function")return c.from(i[Symbol.toPrimitive]("string"),A,I);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i)}function E(i){if(typeof i!="number")throw new TypeError('"size" argument must be of type number');if(0>i)throw new RangeError('The value "'+i+'" is invalid for option "size"')}function l(i,A,I){return E(i),0>=i||A===void 0?h(i):typeof I=="string"?h(i).fill(A,I):h(i).fill(A)}function y(i){return E(i),h(0>i?0:0|B(i))}function C(i,A){if((typeof A!="string"||A==="")&&(A="utf8"),!c.isEncoding(A))throw new TypeError("Unknown encoding: "+A);var I=0|p(i,A),R=h(I),U=R.write(i,A);return U!==I&&(R=R.slice(0,U)),R}function Q(i){for(var A=0>i.length?0:0|B(i.length),I=h(A),R=0;R<A;R+=1)I[R]=255&i[R];return I}function S(i,A,I){if(0>A||i.byteLength<A)throw new RangeError('"offset" is outside of buffer bounds');if(i.byteLength<A+(I||0))throw new RangeError('"length" is outside of buffer bounds');var R;return R=A===void 0&&I===void 0?new Uint8Array(i):I===void 0?new Uint8Array(i,A):new Uint8Array(i,A,I),R.__proto__=c.prototype,R}function g(i){if(c.isBuffer(i)){var A=0|B(i.length),I=h(A);return I.length===0||i.copy(I,0,0,A),I}return i.length===void 0?i.type==="Buffer"&&Array.isArray(i.data)?Q(i.data):void 0:typeof i.length!="number"||H(i.length)?h(0):Q(i)}function B(i){if(i>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|i}function p(i,A){if(c.isBuffer(i))return i.length;if(ArrayBuffer.isView(i)||F(i,ArrayBuffer))return i.byteLength;if(typeof i!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof i);var I=i.length,R=2<arguments.length&&arguments[2]===!0;if(!R&&I===0)return 0;for(var U=!1;;)switch(A){case"ascii":case"latin1":case"binary":return I;case"utf8":case"utf-8":return lt(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*I;case"hex":return I>>>1;case"base64":return yt(i).length;default:if(U)return R?-1:lt(i).length;A=(""+A).toLowerCase(),U=!0}}function _(i,A,I){var R=!1;if((A===void 0||0>A)&&(A=0),A>this.length||((I===void 0||I>this.length)&&(I=this.length),0>=I)||(I>>>=0,A>>>=0,I<=A))return"";for(i||(i="utf8");;)switch(i){case"hex":return Y(this,A,I);case"utf8":case"utf-8":return G(this,A,I);case"ascii":return P(this,A,I);case"latin1":case"binary":return K(this,A,I);case"base64":return L(this,A,I);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $(this,A,I);default:if(R)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),R=!0}}function w(i,A,I){var R=i[A];i[A]=i[I],i[I]=R}function x(i,A,I,R,U){if(i.length===0)return-1;if(typeof I=="string"?(R=I,I=0):2147483647<I?I=2147483647:-2147483648>I&&(I=-2147483648),I=+I,H(I)&&(I=U?0:i.length-1),0>I&&(I=i.length+I),I>=i.length){if(U)return-1;I=i.length-1}else if(0>I)if(U)I=0;else return-1;if(typeof A=="string"&&(A=c.from(A,R)),c.isBuffer(A))return A.length===0?-1:N(i,A,I,R,U);if(typeof A=="number")return A&=255,typeof Uint8Array.prototype.indexOf=="function"?U?Uint8Array.prototype.indexOf.call(i,A,I):Uint8Array.prototype.lastIndexOf.call(i,A,I):N(i,[A],I,R,U);throw new TypeError("val must be string, number or Buffer")}function N(i,A,I,R,U){function k(Ue,pe){return j===1?Ue[pe]:Ue.readUInt16BE(pe*j)}var j=1,tt=i.length,ut=A.length;if(R!==void 0&&(R=(R+"").toLowerCase(),R==="ucs2"||R==="ucs-2"||R==="utf16le"||R==="utf-16le")){if(2>i.length||2>A.length)return-1;j=2,tt/=2,ut/=2,I/=2}var ot;if(U){var At=-1;for(ot=I;ot<tt;ot++)if(k(i,ot)!==k(A,At===-1?0:ot-At))At!==-1&&(ot-=ot-At),At=-1;else if(At===-1&&(At=ot),ot-At+1===ut)return At*j}else for(I+ut>tt&&(I=tt-ut),ot=I;0<=ot;ot--){for(var at=!0,Ee=0;Ee<ut;Ee++)if(k(i,ot+Ee)!==k(A,Ee)){at=!1;break}if(at)return ot}return-1}function b(i,A,I,R){I=+I||0;var U=i.length-I;R?(R=+R,R>U&&(R=U)):R=U;var k=A.length;R>k/2&&(R=k/2);for(var j,tt=0;tt<R;++tt){if(j=parseInt(A.substr(2*tt,2),16),H(j))return tt;i[I+tt]=j}return tt}function m(i,A,I,R){return vt(lt(A,i.length-I),i,I,R)}function v(i,A,I,R){return vt(mt(A),i,I,R)}function M(i,A,I,R){return v(i,A,I,R)}function D(i,A,I,R){return vt(yt(A),i,I,R)}function T(i,A,I,R){return vt(Mt(A,i.length-I),i,I,R)}function L(i,A,I){return A===0&&I===i.length?V.fromByteArray(i):V.fromByteArray(i.slice(A,I))}function G(i,A,I){I=f(i.length,I);for(var R=[],U=A;U<I;){var k=i[U],j=null,tt=239<k?4:223<k?3:191<k?2:1;if(U+tt<=I){var ut,ot,At,at;tt===1?128>k&&(j=k):tt===2?(ut=i[U+1],(192&ut)==128&&(at=(31&k)<<6|63&ut,127<at&&(j=at))):tt===3?(ut=i[U+1],ot=i[U+2],(192&ut)==128&&(192&ot)==128&&(at=(15&k)<<12|(63&ut)<<6|63&ot,2047<at&&(55296>at||57343<at)&&(j=at))):tt===4&&(ut=i[U+1],ot=i[U+2],At=i[U+3],(192&ut)==128&&(192&ot)==128&&(192&At)==128&&(at=(15&k)<<18|(63&ut)<<12|(63&ot)<<6|63&At,65535<at&&1114112>at&&(j=at)))}j===null?(j=65533,tt=1):65535<j&&(j-=65536,R.push(55296|1023&j>>>10),j=56320|1023&j),R.push(j),U+=tt}return q(R)}function q(i){var A=i.length;if(A<=4096)return o.apply(String,i);for(var I="",R=0;R<A;)I+=o.apply(String,i.slice(R,R+=4096));return I}function P(i,A,I){var R="";I=f(i.length,I);for(var U=A;U<I;++U)R+=o(127&i[U]);return R}function K(i,A,I){var R="";I=f(i.length,I);for(var U=A;U<I;++U)R+=o(i[U]);return R}function Y(i,A,I){var R=i.length;(!A||0>A)&&(A=0),(!I||0>I||I>R)&&(I=R);for(var U="",k=A;k<I;++k)U+=Et(i[k]);return U}function $(i,A,I){for(var R=i.slice(A,I),U="",k=0;k<R.length;k+=2)U+=o(R[k]+256*R[k+1]);return U}function J(i,A,I){if(i%1!=0||0>i)throw new RangeError("offset is not uint");if(i+A>I)throw new RangeError("Trying to access beyond buffer length")}function X(i,A,I,R,U,k){if(!c.isBuffer(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(A>U||A<k)throw new RangeError('"value" argument is out of bounds');if(I+R>i.length)throw new RangeError("Index out of range")}function et(i,A,I,R){if(I+R>i.length)throw new RangeError("Index out of range");if(0>I)throw new RangeError("Index out of range")}function nt(i,A,I,R,U){return A=+A,I>>>=0,U||et(i,A,I,4,34028234663852886e22,-34028234663852886e22),O.write(i,A,I,R,23,4),I+4}function ct(i,A,I,R,U){return A=+A,I>>>=0,U||et(i,A,I,8,17976931348623157e292,-17976931348623157e292),O.write(i,A,I,R,52,8),I+8}function rt(i){if(i=i.split("=")[0],i=i.trim().replace(W,""),2>i.length)return"";for(;i.length%4!=0;)i+="=";return i}function Et(i){return 16>i?"0"+i.toString(16):i.toString(16)}function lt(i,A){A=A||1/0;for(var I,R=i.length,U=null,k=[],j=0;j<R;++j){if(I=i.charCodeAt(j),55295<I&&57344>I){if(!U){if(56319<I){-1<(A-=3)&&k.push(239,191,189);continue}else if(j+1===R){-1<(A-=3)&&k.push(239,191,189);continue}U=I;continue}if(56320>I){-1<(A-=3)&&k.push(239,191,189),U=I;continue}I=(U-55296<<10|I-56320)+65536}else U&&-1<(A-=3)&&k.push(239,191,189);if(U=null,128>I){if(0>(A-=1))break;k.push(I)}else if(2048>I){if(0>(A-=2))break;k.push(192|I>>6,128|63&I)}else if(65536>I){if(0>(A-=3))break;k.push(224|I>>12,128|63&I>>6,128|63&I)}else if(1114112>I){if(0>(A-=4))break;k.push(240|I>>18,128|63&I>>12,128|63&I>>6,128|63&I)}else throw new Error("Invalid code point")}return k}function mt(i){for(var A=[],I=0;I<i.length;++I)A.push(255&i.charCodeAt(I));return A}function Mt(i,A){for(var I,R,U,k=[],j=0;j<i.length&&!(0>(A-=2));++j)I=i.charCodeAt(j),R=I>>8,U=I%256,k.push(U),k.push(R);return k}function yt(i){return V.toByteArray(rt(i))}function vt(i,A,I,R){for(var U=0;U<R&&!(U+I>=A.length||U>=i.length);++U)A[U+I]=i[U];return U}function F(i,A){return i instanceof A||i!=null&&i.constructor!=null&&i.constructor.name!=null&&i.constructor.name===A.name}function H(i){return i!==i}var V=n("base64-js"),O=n("ieee754");s.Buffer=c,s.SlowBuffer=function(i){return+i!=i&&(i=0),c.alloc(+i)},s.INSPECT_MAX_BYTES=50,s.kMaxLength=2147483647,c.TYPED_ARRAY_SUPPORT=(function(){try{var i=new Uint8Array(1);return i.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},i.foo()===42}catch{return!1}})(),c.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){return c.isBuffer(this)?this.buffer:void 0}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){return c.isBuffer(this)?this.byteOffset:void 0}}),typeof Symbol<"u"&&Symbol.species!=null&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),c.poolSize=8192,c.from=function(i,A,I){return u(i,A,I)},c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,c.alloc=function(i,A,I){return l(i,A,I)},c.allocUnsafe=function(i){return y(i)},c.allocUnsafeSlow=function(i){return y(i)},c.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==c.prototype},c.compare=function(i,A){if(F(i,Uint8Array)&&(i=c.from(i,i.offset,i.byteLength)),F(A,Uint8Array)&&(A=c.from(A,A.offset,A.byteLength)),!c.isBuffer(i)||!c.isBuffer(A))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(i===A)return 0;for(var I=i.length,R=A.length,U=0,k=f(I,R);U<k;++U)if(i[U]!==A[U]){I=i[U],R=A[U];break}return I<R?-1:R<I?1:0},c.isEncoding=function(i){switch((i+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(i,A){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return c.alloc(0);var I;if(A===void 0)for(A=0,I=0;I<i.length;++I)A+=i[I].length;var R=c.allocUnsafe(A),U=0;for(I=0;I<i.length;++I){var k=i[I];if(F(k,Uint8Array)&&(k=c.from(k)),!c.isBuffer(k))throw new TypeError('"list" argument must be an Array of Buffers');k.copy(R,U),U+=k.length}return R},c.byteLength=p,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var i=this.length;if(i%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var A=0;A<i;A+=2)w(this,A,A+1);return this},c.prototype.swap32=function(){var i=this.length;if(i%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var A=0;A<i;A+=4)w(this,A,A+3),w(this,A+1,A+2);return this},c.prototype.swap64=function(){var i=this.length;if(i%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var A=0;A<i;A+=8)w(this,A,A+7),w(this,A+1,A+6),w(this,A+2,A+5),w(this,A+3,A+4);return this},c.prototype.toString=function(){var i=this.length;return i===0?"":arguments.length===0?G(this,0,i):_.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(i){if(!c.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i||c.compare(this,i)===0},c.prototype.inspect=function(){var i="",A=s.INSPECT_MAX_BYTES;return i=this.toString("hex",0,A).replace(/(.{2})/g,"$1 ").trim(),this.length>A&&(i+=" ... "),"<Buffer "+i+">"},c.prototype.compare=function(i,A,I,R,U){if(F(i,Uint8Array)&&(i=c.from(i,i.offset,i.byteLength)),!c.isBuffer(i))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof i);if(A===void 0&&(A=0),I===void 0&&(I=i?i.length:0),R===void 0&&(R=0),U===void 0&&(U=this.length),0>A||I>i.length||0>R||U>this.length)throw new RangeError("out of range index");if(R>=U&&A>=I)return 0;if(R>=U)return-1;if(A>=I)return 1;if(A>>>=0,I>>>=0,R>>>=0,U>>>=0,this===i)return 0;for(var k=U-R,j=I-A,tt=f(k,j),ut=this.slice(R,U),ot=i.slice(A,I),At=0;At<tt;++At)if(ut[At]!==ot[At]){k=ut[At],j=ot[At];break}return k<j?-1:j<k?1:0},c.prototype.includes=function(i,A,I){return this.indexOf(i,A,I)!==-1},c.prototype.indexOf=function(i,A,I){return x(this,i,A,I,!0)},c.prototype.lastIndexOf=function(i,A,I){return x(this,i,A,I,!1)},c.prototype.write=function(i,A,I,R){if(A===void 0)R="utf8",I=this.length,A=0;else if(I===void 0&&typeof A=="string")R=A,I=this.length,A=0;else if(isFinite(A))A>>>=0,isFinite(I)?(I>>>=0,R===void 0&&(R="utf8")):(R=I,I=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var U=this.length-A;if((I===void 0||I>U)&&(I=U),0<i.length&&(0>I||0>A)||A>this.length)throw new RangeError("Attempt to write outside buffer bounds");R||(R="utf8");for(var k=!1;;)switch(R){case"hex":return b(this,i,A,I);case"utf8":case"utf-8":return m(this,i,A,I);case"ascii":return v(this,i,A,I);case"latin1":case"binary":return M(this,i,A,I);case"base64":return D(this,i,A,I);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,i,A,I);default:if(k)throw new TypeError("Unknown encoding: "+R);R=(""+R).toLowerCase(),k=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},c.prototype.slice=function(i,A){var I=this.length;i=~~i,A=A===void 0?I:~~A,0>i?(i+=I,0>i&&(i=0)):i>I&&(i=I),0>A?(A+=I,0>A&&(A=0)):A>I&&(A=I),A<i&&(A=i);var R=this.subarray(i,A);return R.__proto__=c.prototype,R},c.prototype.readUIntLE=function(i,A,I){i>>>=0,A>>>=0,I||J(i,A,this.length);for(var R=this[i],U=1,k=0;++k<A&&(U*=256);)R+=this[i+k]*U;return R},c.prototype.readUIntBE=function(i,A,I){i>>>=0,A>>>=0,I||J(i,A,this.length);for(var R=this[i+--A],U=1;0<A&&(U*=256);)R+=this[i+--A]*U;return R},c.prototype.readUInt8=function(i,A){return i>>>=0,A||J(i,1,this.length),this[i]},c.prototype.readUInt16LE=function(i,A){return i>>>=0,A||J(i,2,this.length),this[i]|this[i+1]<<8},c.prototype.readUInt16BE=function(i,A){return i>>>=0,A||J(i,2,this.length),this[i]<<8|this[i+1]},c.prototype.readUInt32LE=function(i,A){return i>>>=0,A||J(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+16777216*this[i+3]},c.prototype.readUInt32BE=function(i,A){return i>>>=0,A||J(i,4,this.length),16777216*this[i]+(this[i+1]<<16|this[i+2]<<8|this[i+3])},c.prototype.readIntLE=function(i,A,I){i>>>=0,A>>>=0,I||J(i,A,this.length);for(var R=this[i],U=1,k=0;++k<A&&(U*=256);)R+=this[i+k]*U;return U*=128,R>=U&&(R-=e(2,8*A)),R},c.prototype.readIntBE=function(i,A,I){i>>>=0,A>>>=0,I||J(i,A,this.length);for(var R=A,U=1,k=this[i+--R];0<R&&(U*=256);)k+=this[i+--R]*U;return U*=128,k>=U&&(k-=e(2,8*A)),k},c.prototype.readInt8=function(i,A){return i>>>=0,A||J(i,1,this.length),128&this[i]?-1*(255-this[i]+1):this[i]},c.prototype.readInt16LE=function(i,A){i>>>=0,A||J(i,2,this.length);var I=this[i]|this[i+1]<<8;return 32768&I?4294901760|I:I},c.prototype.readInt16BE=function(i,A){i>>>=0,A||J(i,2,this.length);var I=this[i+1]|this[i]<<8;return 32768&I?4294901760|I:I},c.prototype.readInt32LE=function(i,A){return i>>>=0,A||J(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},c.prototype.readInt32BE=function(i,A){return i>>>=0,A||J(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},c.prototype.readFloatLE=function(i,A){return i>>>=0,A||J(i,4,this.length),O.read(this,i,!0,23,4)},c.prototype.readFloatBE=function(i,A){return i>>>=0,A||J(i,4,this.length),O.read(this,i,!1,23,4)},c.prototype.readDoubleLE=function(i,A){return i>>>=0,A||J(i,8,this.length),O.read(this,i,!0,52,8)},c.prototype.readDoubleBE=function(i,A){return i>>>=0,A||J(i,8,this.length),O.read(this,i,!1,52,8)},c.prototype.writeUIntLE=function(i,A,I,R){if(i=+i,A>>>=0,I>>>=0,!R){var U=e(2,8*I)-1;X(this,i,A,I,U,0)}var k=1,j=0;for(this[A]=255&i;++j<I&&(k*=256);)this[A+j]=255&i/k;return A+I},c.prototype.writeUIntBE=function(i,A,I,R){if(i=+i,A>>>=0,I>>>=0,!R){var U=e(2,8*I)-1;X(this,i,A,I,U,0)}var k=I-1,j=1;for(this[A+k]=255&i;0<=--k&&(j*=256);)this[A+k]=255&i/j;return A+I},c.prototype.writeUInt8=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,1,255,0),this[A]=255&i,A+1},c.prototype.writeUInt16LE=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,2,65535,0),this[A]=255&i,this[A+1]=i>>>8,A+2},c.prototype.writeUInt16BE=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,2,65535,0),this[A]=i>>>8,this[A+1]=255&i,A+2},c.prototype.writeUInt32LE=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,4,4294967295,0),this[A+3]=i>>>24,this[A+2]=i>>>16,this[A+1]=i>>>8,this[A]=255&i,A+4},c.prototype.writeUInt32BE=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,4,4294967295,0),this[A]=i>>>24,this[A+1]=i>>>16,this[A+2]=i>>>8,this[A+3]=255&i,A+4},c.prototype.writeIntLE=function(i,A,I,R){if(i=+i,A>>>=0,!R){var U=e(2,8*I-1);X(this,i,A,I,U-1,-U)}var k=0,j=1,tt=0;for(this[A]=255&i;++k<I&&(j*=256);)0>i&&tt===0&&this[A+k-1]!==0&&(tt=1),this[A+k]=255&(i/j>>0)-tt;return A+I},c.prototype.writeIntBE=function(i,A,I,R){if(i=+i,A>>>=0,!R){var U=e(2,8*I-1);X(this,i,A,I,U-1,-U)}var k=I-1,j=1,tt=0;for(this[A+k]=255&i;0<=--k&&(j*=256);)0>i&&tt===0&&this[A+k+1]!==0&&(tt=1),this[A+k]=255&(i/j>>0)-tt;return A+I},c.prototype.writeInt8=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,1,127,-128),0>i&&(i=255+i+1),this[A]=255&i,A+1},c.prototype.writeInt16LE=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,2,32767,-32768),this[A]=255&i,this[A+1]=i>>>8,A+2},c.prototype.writeInt16BE=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,2,32767,-32768),this[A]=i>>>8,this[A+1]=255&i,A+2},c.prototype.writeInt32LE=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,4,2147483647,-2147483648),this[A]=255&i,this[A+1]=i>>>8,this[A+2]=i>>>16,this[A+3]=i>>>24,A+4},c.prototype.writeInt32BE=function(i,A,I){return i=+i,A>>>=0,I||X(this,i,A,4,2147483647,-2147483648),0>i&&(i=4294967295+i+1),this[A]=i>>>24,this[A+1]=i>>>16,this[A+2]=i>>>8,this[A+3]=255&i,A+4},c.prototype.writeFloatLE=function(i,A,I){return nt(this,i,A,!0,I)},c.prototype.writeFloatBE=function(i,A,I){return nt(this,i,A,!1,I)},c.prototype.writeDoubleLE=function(i,A,I){return ct(this,i,A,!0,I)},c.prototype.writeDoubleBE=function(i,A,I){return ct(this,i,A,!1,I)},c.prototype.copy=function(i,A,I,R){if(!c.isBuffer(i))throw new TypeError("argument should be a Buffer");if(I||(I=0),R||R===0||(R=this.length),A>=i.length&&(A=i.length),A||(A=0),0<R&&R<I&&(R=I),R===I||i.length===0||this.length===0)return 0;if(0>A)throw new RangeError("targetStart out of bounds");if(0>I||I>=this.length)throw new RangeError("Index out of range");if(0>R)throw new RangeError("sourceEnd out of bounds");R>this.length&&(R=this.length),i.length-A<R-I&&(R=i.length-A+I);var U=R-I;if(this===i&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(A,I,R);else if(this===i&&I<A&&A<R)for(var k=U-1;0<=k;--k)i[k+A]=this[k+I];else Uint8Array.prototype.set.call(i,this.subarray(I,R),A);return U},c.prototype.fill=function(i,A,I,R){if(typeof i=="string"){if(typeof A=="string"?(R=A,A=0,I=this.length):typeof I=="string"&&(R=I,I=this.length),R!==void 0&&typeof R!="string")throw new TypeError("encoding must be a string");if(typeof R=="string"&&!c.isEncoding(R))throw new TypeError("Unknown encoding: "+R);if(i.length===1){var U=i.charCodeAt(0);(R==="utf8"&&128>U||R==="latin1")&&(i=U)}}else typeof i=="number"&&(i&=255);if(0>A||this.length<A||this.length<I)throw new RangeError("Out of range index");if(I<=A)return this;A>>>=0,I=I===void 0?this.length:I>>>0,i||(i=0);var k;if(typeof i=="number")for(k=A;k<I;++k)this[k]=i;else{var j=c.isBuffer(i)?i:c.from(i,R),tt=j.length;if(tt===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(k=0;k<I-A;++k)this[k+A]=j[k%tt]}return this};var W=/[^+/0-9A-Za-z-_]/g}).call(this)}).call(this,n("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:9}],4:[function(n,r,s){(function(o){(function(){function f(){let c;try{c=s.storage.getItem("debug")}catch{}return!c&&typeof o<"u"&&"env"in o&&(c=o.env.DEBUG),c}s.formatArgs=function(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+r.exports.humanize(this.diff),!this.useColors)return;let u="color: "+this.color;c.splice(1,0,u,"color: inherit");let E=0,l=0;c[0].replace(/%[a-zA-Z%]/g,y=>{y==="%%"||(E++,y==="%c"&&(l=E))}),c.splice(l,0,u)},s.save=function(c){try{c?s.storage.setItem("debug",c):s.storage.removeItem("debug")}catch{}},s.load=f,s.useColors=function(){return!!(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))||!(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&(typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},s.storage=(function(){try{return localStorage}catch{}})(),s.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),s.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],s.log=console.debug||console.log||(()=>{}),r.exports=n("./common")(s);let{formatters:h}=r.exports;h.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}).call(this)}).call(this,n("_process"))},{"./common":5,_process:12}],5:[function(n,r){r.exports=function(s){function o(c){function u(...y){if(!u.enabled)return;let C=u,Q=+new Date,S=Q-(E||Q);C.diff=S,C.prev=E,C.curr=Q,E=Q,y[0]=o.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let g=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(p,_)=>{if(p==="%%")return"%";g++;let w=o.formatters[_];if(typeof w=="function"){let x=y[g];p=w.call(C,x),y.splice(g,1),g--}return p}),o.formatArgs.call(C,y),(C.log||o.log).apply(C,y)}let E,l=null;return u.namespace=c,u.useColors=o.useColors(),u.color=o.selectColor(c),u.extend=f,u.destroy=o.destroy,Object.defineProperty(u,"enabled",{enumerable:!0,configurable:!1,get:()=>l===null?o.enabled(c):l,set:y=>{l=y}}),typeof o.init=="function"&&o.init(u),u}function f(c,u){let E=o(this.namespace+(typeof u>"u"?":":u)+c);return E.log=this.log,E}function h(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}return o.debug=o,o.default=o,o.coerce=function(c){return c instanceof Error?c.stack||c.message:c},o.disable=function(){let c=[...o.names.map(h),...o.skips.map(h).map(u=>"-"+u)].join(",");return o.enable(""),c},o.enable=function(c){o.save(c),o.names=[],o.skips=[];let u,E=(typeof c=="string"?c:"").split(/[\s,]+/),l=E.length;for(u=0;u<l;u++)E[u]&&(c=E[u].replace(/\*/g,".*?"),c[0]==="-"?o.skips.push(new RegExp("^"+c.substr(1)+"$")):o.names.push(new RegExp("^"+c+"$")))},o.enabled=function(c){if(c[c.length-1]==="*")return!0;let u,E;for(u=0,E=o.skips.length;u<E;u++)if(o.skips[u].test(c))return!1;for(u=0,E=o.names.length;u<E;u++)if(o.names[u].test(c))return!0;return!1},o.humanize=n("ms"),o.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(s).forEach(c=>{o[c]=s[c]}),o.names=[],o.skips=[],o.formatters={},o.selectColor=function(c){let u=0;for(let E=0;E<c.length;E++)u=(u<<5)-u+c.charCodeAt(E),u|=0;return o.colors[t(u)%o.colors.length]},o.enable(o.load()),o}},{ms:11}],6:[function(n,r){"use strict";function s(o,f){for(let h in f)Object.defineProperty(o,h,{value:f[h],enumerable:!0,configurable:!0});return o}r.exports=function(o,f,h){if(!o||typeof o=="string")throw new TypeError("Please pass an Error to err-code");h||(h={}),typeof f=="object"&&(h=f,f=""),f&&(h.code=f);try{return s(o,h)}catch{h.message=o.message,h.stack=o.stack;let u=function(){};return u.prototype=Object.create(Object.getPrototypeOf(o)),s(new u,h)}}},{}],7:[function(n,r){"use strict";function s(b){console&&console.warn&&console.warn(b)}function o(){o.init.call(this)}function f(b){if(typeof b!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof b)}function h(b){return b._maxListeners===void 0?o.defaultMaxListeners:b._maxListeners}function c(b,m,v,M){var D,T,L;if(f(v),T=b._events,T===void 0?(T=b._events=Object.create(null),b._eventsCount=0):(T.newListener!==void 0&&(b.emit("newListener",m,v.listener?v.listener:v),T=b._events),L=T[m]),L===void 0)L=T[m]=v,++b._eventsCount;else if(typeof L=="function"?L=T[m]=M?[v,L]:[L,v]:M?L.unshift(v):L.push(v),D=h(b),0<D&&L.length>D&&!L.warned){L.warned=!0;var G=new Error("Possible EventEmitter memory leak detected. "+L.length+" "+(m+" listeners added. Use emitter.setMaxListeners() to increase limit"));G.name="MaxListenersExceededWarning",G.emitter=b,G.type=m,G.count=L.length,s(G)}return b}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function E(b,m,v){var M={fired:!1,wrapFn:void 0,target:b,type:m,listener:v},D=u.bind(M);return D.listener=v,M.wrapFn=D,D}function l(b,m,v){var M=b._events;if(M===void 0)return[];var D=M[m];return D===void 0?[]:typeof D=="function"?v?[D.listener||D]:[D]:v?S(D):C(D,D.length)}function y(b){var m=this._events;if(m!==void 0){var v=m[b];if(typeof v=="function")return 1;if(v!==void 0)return v.length}return 0}function C(b,m){for(var v=Array(m),M=0;M<m;++M)v[M]=b[M];return v}function Q(b,m){for(;m+1<b.length;m++)b[m]=b[m+1];b.pop()}function S(b){for(var m=Array(b.length),v=0;v<m.length;++v)m[v]=b[v].listener||b[v];return m}function g(b,m,v){typeof b.on=="function"&&B(b,"error",m,v)}function B(b,m,v,M){if(typeof b.on=="function")M.once?b.once(m,v):b.on(m,v);else if(typeof b.addEventListener=="function")b.addEventListener(m,function D(T){M.once&&b.removeEventListener(m,D),v(T)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof b)}var p,_=typeof Reflect=="object"?Reflect:null,w=_&&typeof _.apply=="function"?_.apply:function(b,m,v){return Function.prototype.apply.call(b,m,v)};p=_&&typeof _.ownKeys=="function"?_.ownKeys:Object.getOwnPropertySymbols?function(b){return Object.getOwnPropertyNames(b).concat(Object.getOwnPropertySymbols(b))}:function(b){return Object.getOwnPropertyNames(b)};var x=Number.isNaN||function(b){return b!==b};r.exports=o,r.exports.once=function(b,m){return new Promise(function(v,M){function D(L){b.removeListener(m,T),M(L)}function T(){typeof b.removeListener=="function"&&b.removeListener("error",D),v([].slice.call(arguments))}B(b,m,T,{once:!0}),m!=="error"&&g(b,D,{once:!0})})},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var N=10;Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return N},set:function(b){if(typeof b!="number"||0>b||x(b))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+b+".");N=b}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(b){if(typeof b!="number"||0>b||x(b))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+b+".");return this._maxListeners=b,this},o.prototype.getMaxListeners=function(){return h(this)},o.prototype.emit=function(b){for(var m=[],v=1;v<arguments.length;v++)m.push(arguments[v]);var M=b==="error",D=this._events;if(D!==void 0)M=M&&D.error===void 0;else if(!M)return!1;if(M){var T;if(0<m.length&&(T=m[0]),T instanceof Error)throw T;var L=new Error("Unhandled error."+(T?" ("+T.message+")":""));throw L.context=T,L}var G=D[b];if(G===void 0)return!1;if(typeof G=="function")w(G,this,m);else for(var q=G.length,P=C(G,q),v=0;v<q;++v)w(P[v],this,m);return!0},o.prototype.addListener=function(b,m){return c(this,b,m,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(b,m){return c(this,b,m,!0)},o.prototype.once=function(b,m){return f(m),this.on(b,E(this,b,m)),this},o.prototype.prependOnceListener=function(b,m){return f(m),this.prependListener(b,E(this,b,m)),this},o.prototype.removeListener=function(b,m){var v,M,D,T,L;if(f(m),M=this._events,M===void 0)return this;if(v=M[b],v===void 0)return this;if(v===m||v.listener===m)--this._eventsCount==0?this._events=Object.create(null):(delete M[b],M.removeListener&&this.emit("removeListener",b,v.listener||m));else if(typeof v!="function"){for(D=-1,T=v.length-1;0<=T;T--)if(v[T]===m||v[T].listener===m){L=v[T].listener,D=T;break}if(0>D)return this;D===0?v.shift():Q(v,D),v.length===1&&(M[b]=v[0]),M.removeListener!==void 0&&this.emit("removeListener",b,L||m)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(b){var m,v,M;if(v=this._events,v===void 0)return this;if(v.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):v[b]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete v[b]),this;if(arguments.length===0){var D,T=Object.keys(v);for(M=0;M<T.length;++M)D=T[M],D!=="removeListener"&&this.removeAllListeners(D);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(m=v[b],typeof m=="function")this.removeListener(b,m);else if(m!==void 0)for(M=m.length-1;0<=M;M--)this.removeListener(b,m[M]);return this},o.prototype.listeners=function(b){return l(this,b,!0)},o.prototype.rawListeners=function(b){return l(this,b,!1)},o.listenerCount=function(b,m){return typeof b.listenerCount=="function"?b.listenerCount(m):y.call(b,m)},o.prototype.listenerCount=y,o.prototype.eventNames=function(){return 0<this._eventsCount?p(this._events):[]}},{}],8:[function(n,r){r.exports=function(){if(typeof globalThis>"u")return null;var s={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return s.RTCPeerConnection?s:null}},{}],9:[function(n,r,s){s.read=function(o,f,h,c,u){var E,l,y=8*u-c-1,C=(1<<y)-1,Q=C>>1,S=-7,g=h?u-1:0,B=h?-1:1,p=o[f+g];for(g+=B,E=p&(1<<-S)-1,p>>=-S,S+=y;0<S;E=256*E+o[f+g],g+=B,S-=8);for(l=E&(1<<-S)-1,E>>=-S,S+=c;0<S;l=256*l+o[f+g],g+=B,S-=8);if(E===0)E=1-Q;else{if(E===C)return l?NaN:(p?-1:1)*(1/0);l+=e(2,c),E-=Q}return(p?-1:1)*l*e(2,E-c)},s.write=function(o,f,h,c,u,E){var l,y,C,Q=Math.LN2,S=Math.log,g=8*E-u-1,B=(1<<g)-1,p=B>>1,_=u===23?e(2,-24)-e(2,-77):0,w=c?0:E-1,x=c?1:-1,N=0>f||f===0&&0>1/f?1:0;for(f=t(f),isNaN(f)||f===1/0?(y=isNaN(f)?1:0,l=B):(l=a(S(f)/Q),1>f*(C=e(2,-l))&&(l--,C*=2),f+=1<=l+p?_/C:_*e(2,1-p),2<=f*C&&(l++,C/=2),l+p>=B?(y=0,l=B):1<=l+p?(y=(f*C-1)*e(2,u),l+=p):(y=f*e(2,p-1)*e(2,u),l=0));8<=u;o[h+w]=255&y,w+=x,y/=256,u-=8);for(l=l<<u|y,g+=u;0<g;o[h+w]=255&l,w+=x,l/=256,g-=8);o[h+w-x]|=128*N}},{}],10:[function(n,r){r.exports=typeof Object.create=="function"?function(s,o){o&&(s.super_=o,s.prototype=Object.create(o.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}))}:function(s,o){if(o){s.super_=o;var f=function(){};f.prototype=o.prototype,s.prototype=new f,s.prototype.constructor=s}}},{}],11:[function(n,r){var s=Math.round;function o(E){if(E+="",!(100<E.length)){var l=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(E);if(l){var y=parseFloat(l[1]),C=(l[2]||"ms").toLowerCase();return C==="years"||C==="year"||C==="yrs"||C==="yr"||C==="y"?315576e5*y:C==="weeks"||C==="week"||C==="w"?6048e5*y:C==="days"||C==="day"||C==="d"?864e5*y:C==="hours"||C==="hour"||C==="hrs"||C==="hr"||C==="h"?36e5*y:C==="minutes"||C==="minute"||C==="mins"||C==="min"||C==="m"?6e4*y:C==="seconds"||C==="second"||C==="secs"||C==="sec"||C==="s"?1e3*y:C==="milliseconds"||C==="millisecond"||C==="msecs"||C==="msec"||C==="ms"?y:void 0}}}function f(E){var l=t(E);return 864e5<=l?s(E/864e5)+"d":36e5<=l?s(E/36e5)+"h":6e4<=l?s(E/6e4)+"m":1e3<=l?s(E/1e3)+"s":E+"ms"}function h(E){var l=t(E);return 864e5<=l?c(E,l,864e5,"day"):36e5<=l?c(E,l,36e5,"hour"):6e4<=l?c(E,l,6e4,"minute"):1e3<=l?c(E,l,1e3,"second"):E+" ms"}function c(E,l,y,C){return s(E/y)+" "+C+(l>=1.5*y?"s":"")}var u=24*(60*6e4);r.exports=function(E,l){l=l||{};var y=typeof E;if(y=="string"&&0<E.length)return o(E);if(y==="number"&&isFinite(E))return l.long?h(E):f(E);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(E))}},{}],12:[function(n,r){function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function f(_){if(y===setTimeout)return setTimeout(_,0);if((y===s||!y)&&setTimeout)return y=setTimeout,setTimeout(_,0);try{return y(_,0)}catch{try{return y.call(null,_,0)}catch{return y.call(this,_,0)}}}function h(_){if(C===clearTimeout)return clearTimeout(_);if((C===o||!C)&&clearTimeout)return C=clearTimeout,clearTimeout(_);try{return C(_)}catch{try{return C.call(null,_)}catch{return C.call(this,_)}}}function c(){B&&S&&(B=!1,S.length?g=S.concat(g):p=-1,g.length&&u())}function u(){if(!B){var _=f(c);B=!0;for(var w=g.length;w;){for(S=g,g=[];++p<w;)S&&S[p].run();p=-1,w=g.length}S=null,B=!1,h(_)}}function E(_,w){this.fun=_,this.array=w}function l(){}var y,C,Q=r.exports={};(function(){try{y=typeof setTimeout=="function"?setTimeout:s}catch{y=s}try{C=typeof clearTimeout=="function"?clearTimeout:o}catch{C=o}})();var S,g=[],B=!1,p=-1;Q.nextTick=function(_){var w=Array(arguments.length-1);if(1<arguments.length)for(var x=1;x<arguments.length;x++)w[x-1]=arguments[x];g.push(new E(_,w)),g.length!==1||B||f(u)},E.prototype.run=function(){this.fun.apply(null,this.array)},Q.title="browser",Q.browser=!0,Q.env={},Q.argv=[],Q.version="",Q.versions={},Q.on=l,Q.addListener=l,Q.once=l,Q.off=l,Q.removeListener=l,Q.removeAllListeners=l,Q.emit=l,Q.prependListener=l,Q.prependOnceListener=l,Q.listeners=function(){return[]},Q.binding=function(){throw new Error("process.binding is not supported")},Q.cwd=function(){return"/"},Q.chdir=function(){throw new Error("process.chdir is not supported")},Q.umask=function(){return 0}},{}],13:[function(n,r){(function(s){(function(){let o;r.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window>"u"?s:window):f=>(o||(o=Promise.resolve())).then(f).catch(h=>setTimeout(()=>{throw h},0))}).call(this)}).call(this,typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{}],14:[function(n,r){(function(s,o){(function(){"use strict";var f=n("safe-buffer").Buffer,h=o.crypto||o.msCrypto;r.exports=h&&h.getRandomValues?function(c,u){if(c>4294967295)throw new RangeError("requested too many random bytes");var E=f.allocUnsafe(c);if(0<c)if(65536<c)for(var l=0;l<c;l+=65536)h.getRandomValues(E.slice(l,l+65536));else h.getRandomValues(E);return typeof u=="function"?s.nextTick(function(){u(null,E)}):E}:function(){throw new Error(`Secure random number generation is not supported by this browser.
2
+ Use Chrome, Firefox or Internet Explorer 11`)}}).call(this)}).call(this,n("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{_process:12,"safe-buffer":30}],15:[function(n,r){"use strict";function s(l,y){l.prototype=Object.create(y.prototype),l.prototype.constructor=l,l.__proto__=y}function o(l,y,C){function Q(g,B,p){return typeof y=="string"?y:y(g,B,p)}C||(C=Error);var S=(function(g){function B(p,_,w){return g.call(this,Q(p,_,w))||this}return s(B,g),B})(C);S.prototype.name=C.name,S.prototype.code=l,E[l]=S}function f(l,y){if(Array.isArray(l)){var C=l.length;return l=l.map(function(Q){return Q+""}),2<C?"one of ".concat(y," ").concat(l.slice(0,C-1).join(", "),", or ")+l[C-1]:C===2?"one of ".concat(y," ").concat(l[0]," or ").concat(l[1]):"of ".concat(y," ").concat(l[0])}return"of ".concat(y," ").concat(l+"")}function h(l,y,C){return l.substr(!C||0>C?0:+C,y.length)===y}function c(l,y,C){return(C===void 0||C>l.length)&&(C=l.length),l.substring(C-y.length,C)===y}function u(l,y,C){return typeof C!="number"&&(C=0),!(C+y.length>l.length)&&l.indexOf(y,C)!==-1}var E={};o("ERR_INVALID_OPT_VALUE",function(l,y){return'The value "'+y+'" is invalid for option "'+l+'"'},TypeError),o("ERR_INVALID_ARG_TYPE",function(l,y,C){var Q;typeof y=="string"&&h(y,"not ")?(Q="must not be",y=y.replace(/^not /,"")):Q="must be";var S;if(c(l," argument"))S="The ".concat(l," ").concat(Q," ").concat(f(y,"type"));else{var g=u(l,".")?"property":"argument";S='The "'.concat(l,'" ').concat(g," ").concat(Q," ").concat(f(y,"type"))}return S+=". Received type ".concat(typeof C),S},TypeError),o("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),o("ERR_METHOD_NOT_IMPLEMENTED",function(l){return"The "+l+" method is not implemented"}),o("ERR_STREAM_PREMATURE_CLOSE","Premature close"),o("ERR_STREAM_DESTROYED",function(l){return"Cannot call "+l+" after a stream was destroyed"}),o("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),o("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),o("ERR_STREAM_WRITE_AFTER_END","write after end"),o("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),o("ERR_UNKNOWN_ENCODING",function(l){return"Unknown encoding: "+l},TypeError),o("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),r.exports.codes=E},{}],16:[function(n,r){(function(s){(function(){"use strict";function o(Q){return this instanceof o?(u.call(this,Q),E.call(this,Q),this.allowHalfOpen=!0,void(Q&&(Q.readable===!1&&(this.readable=!1),Q.writable===!1&&(this.writable=!1),Q.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",f))))):new o(Q)}function f(){this._writableState.ended||s.nextTick(h,this)}function h(Q){Q.end()}var c=Object.keys||function(Q){var S=[];for(var g in Q)S.push(g);return S};r.exports=o;var u=n("./_stream_readable"),E=n("./_stream_writable");n("inherits")(o,u);for(var l,y=c(E.prototype),C=0;C<y.length;C++)l=y[C],o.prototype[l]||(o.prototype[l]=E.prototype[l]);Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(Q){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=Q,this._writableState.destroyed=Q)}})}).call(this)}).call(this,n("_process"))},{"./_stream_readable":18,"./_stream_writable":20,_process:12,inherits:10}],17:[function(n,r){"use strict";function s(f){return this instanceof s?void o.call(this,f):new s(f)}r.exports=s;var o=n("./_stream_transform");n("inherits")(s,o),s.prototype._transform=function(f,h,c){c(null,f)}},{"./_stream_transform":19,inherits:10}],18:[function(n,r){(function(s,o){(function(){"use strict";function f(i){return J.from(i)}function h(i){return J.isBuffer(i)||i instanceof X}function c(i,A,I){return typeof i.prependListener=="function"?i.prependListener(A,I):void(i._events&&i._events[A]?Array.isArray(i._events[A])?i._events[A].unshift(I):i._events[A]=[I,i._events[A]]:i.on(A,I))}function u(i,A,I){q=q||n("./_stream_duplex"),i=i||{},typeof I!="boolean"&&(I=A instanceof q),this.objectMode=!!i.objectMode,I&&(this.objectMode=this.objectMode||!!i.readableObjectMode),this.highWaterMark=Mt(this,i,"readableHighWaterMark",I),this.buffer=new Et,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=i.emitClose!==!1,this.autoDestroy=!!i.autoDestroy,this.destroyed=!1,this.defaultEncoding=i.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,i.encoding&&(!nt&&(nt=n("string_decoder/").StringDecoder),this.decoder=new nt(i.encoding),this.encoding=i.encoding)}function E(i){if(q=q||n("./_stream_duplex"),!(this instanceof E))return new E(i);var A=this instanceof q;this._readableState=new u(i,this,A),this.readable=!0,i&&(typeof i.read=="function"&&(this._read=i.read),typeof i.destroy=="function"&&(this._destroy=i.destroy)),$.call(this)}function l(i,A,I,R,U){P("readableAddChunk",A);var k=i._readableState;if(A===null)k.reading=!1,g(i,k);else{var j;if(U||(j=C(k,A)),j)O(i,j);else if(!(k.objectMode||A&&0<A.length))R||(k.reading=!1,_(i,k));else if(typeof A=="string"||k.objectMode||Object.getPrototypeOf(A)===J.prototype||(A=f(A)),R)k.endEmitted?O(i,new V):y(i,k,A,!0);else if(k.ended)O(i,new F);else{if(k.destroyed)return!1;k.reading=!1,k.decoder&&!I?(A=k.decoder.write(A),k.objectMode||A.length!==0?y(i,k,A,!1):_(i,k)):y(i,k,A,!1)}}return!k.ended&&(k.length<k.highWaterMark||k.length===0)}function y(i,A,I,R){A.flowing&&A.length===0&&!A.sync?(A.awaitDrain=0,i.emit("data",I)):(A.length+=A.objectMode?1:I.length,R?A.buffer.unshift(I):A.buffer.push(I),A.needReadable&&B(i)),_(i,A)}function C(i,A){var I;return h(A)||typeof A=="string"||A===void 0||i.objectMode||(I=new vt("chunk",["string","Buffer","Uint8Array"],A)),I}function Q(i){return 1073741824<=i?i=1073741824:(i--,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i++),i}function S(i,A){return 0>=i||A.length===0&&A.ended?0:A.objectMode?1:i===i?(i>A.highWaterMark&&(A.highWaterMark=Q(i)),i<=A.length?i:A.ended?A.length:(A.needReadable=!0,0)):A.flowing&&A.length?A.buffer.head.data.length:A.length}function g(i,A){if(P("onEofChunk"),!A.ended){if(A.decoder){var I=A.decoder.end();I&&I.length&&(A.buffer.push(I),A.length+=A.objectMode?1:I.length)}A.ended=!0,A.sync?B(i):(A.needReadable=!1,!A.emittedReadable&&(A.emittedReadable=!0,p(i)))}}function B(i){var A=i._readableState;P("emitReadable",A.needReadable,A.emittedReadable),A.needReadable=!1,A.emittedReadable||(P("emitReadable",A.flowing),A.emittedReadable=!0,s.nextTick(p,i))}function p(i){var A=i._readableState;P("emitReadable_",A.destroyed,A.length,A.ended),!A.destroyed&&(A.length||A.ended)&&(i.emit("readable"),A.emittedReadable=!1),A.needReadable=!A.flowing&&!A.ended&&A.length<=A.highWaterMark,M(i)}function _(i,A){A.readingMore||(A.readingMore=!0,s.nextTick(w,i,A))}function w(i,A){for(;!A.reading&&!A.ended&&(A.length<A.highWaterMark||A.flowing&&A.length===0);){var I=A.length;if(P("maybeReadMore read 0"),i.read(0),I===A.length)break}A.readingMore=!1}function x(i){return function(){var A=i._readableState;P("pipeOnDrain",A.awaitDrain),A.awaitDrain&&A.awaitDrain--,A.awaitDrain===0&&Y(i,"data")&&(A.flowing=!0,M(i))}}function N(i){var A=i._readableState;A.readableListening=0<i.listenerCount("readable"),A.resumeScheduled&&!A.paused?A.flowing=!0:0<i.listenerCount("data")&&i.resume()}function b(i){P("readable nexttick read 0"),i.read(0)}function m(i,A){A.resumeScheduled||(A.resumeScheduled=!0,s.nextTick(v,i,A))}function v(i,A){P("resume",A.reading),A.reading||i.read(0),A.resumeScheduled=!1,i.emit("resume"),M(i),A.flowing&&!A.reading&&i.read(0)}function M(i){var A=i._readableState;for(P("flow",A.flowing);A.flowing&&i.read()!==null;);}function D(i,A){if(A.length===0)return null;var I;return A.objectMode?I=A.buffer.shift():!i||i>=A.length?(I=A.decoder?A.buffer.join(""):A.buffer.length===1?A.buffer.first():A.buffer.concat(A.length),A.buffer.clear()):I=A.buffer.consume(i,A.decoder),I}function T(i){var A=i._readableState;P("endReadable",A.endEmitted),A.endEmitted||(A.ended=!0,s.nextTick(L,A,i))}function L(i,A){if(P("endReadableNT",i.endEmitted,i.length),!i.endEmitted&&i.length===0&&(i.endEmitted=!0,A.readable=!1,A.emit("end"),i.autoDestroy)){var I=A._writableState;(!I||I.autoDestroy&&I.finished)&&A.destroy()}}function G(i,A){for(var I=0,R=i.length;I<R;I++)if(i[I]===A)return I;return-1}r.exports=E;var q;E.ReadableState=u;var P,K=n("events").EventEmitter,Y=function(i,A){return i.listeners(A).length},$=n("./internal/streams/stream"),J=n("buffer").Buffer,X=o.Uint8Array||function(){},et=n("util");P=et&&et.debuglog?et.debuglog("stream"):function(){};var nt,ct,rt,Et=n("./internal/streams/buffer_list"),lt=n("./internal/streams/destroy"),mt=n("./internal/streams/state"),Mt=mt.getHighWaterMark,yt=n("../errors").codes,vt=yt.ERR_INVALID_ARG_TYPE,F=yt.ERR_STREAM_PUSH_AFTER_EOF,H=yt.ERR_METHOD_NOT_IMPLEMENTED,V=yt.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n("inherits")(E,$);var O=lt.errorOrDestroy,W=["error","close","destroy","pause","resume"];Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(i){this._readableState&&(this._readableState.destroyed=i)}}),E.prototype.destroy=lt.destroy,E.prototype._undestroy=lt.undestroy,E.prototype._destroy=function(i,A){A(i)},E.prototype.push=function(i,A){var I,R=this._readableState;return R.objectMode?I=!0:typeof i=="string"&&(A=A||R.defaultEncoding,A!==R.encoding&&(i=J.from(i,A),A=""),I=!0),l(this,i,A,!1,I)},E.prototype.unshift=function(i){return l(this,i,null,!0,!1)},E.prototype.isPaused=function(){return this._readableState.flowing===!1},E.prototype.setEncoding=function(i){nt||(nt=n("string_decoder/").StringDecoder);var A=new nt(i);this._readableState.decoder=A,this._readableState.encoding=this._readableState.decoder.encoding;for(var I=this._readableState.buffer.head,R="";I!==null;)R+=A.write(I.data),I=I.next;return this._readableState.buffer.clear(),R!==""&&this._readableState.buffer.push(R),this._readableState.length=R.length,this},E.prototype.read=function(i){P("read",i),i=parseInt(i,10);var A=this._readableState,I=i;if(i!==0&&(A.emittedReadable=!1),i===0&&A.needReadable&&((A.highWaterMark===0?0<A.length:A.length>=A.highWaterMark)||A.ended))return P("read: emitReadable",A.length,A.ended),A.length===0&&A.ended?T(this):B(this),null;if(i=S(i,A),i===0&&A.ended)return A.length===0&&T(this),null;var R=A.needReadable;P("need readable",R),(A.length===0||A.length-i<A.highWaterMark)&&(R=!0,P("length less than watermark",R)),A.ended||A.reading?(R=!1,P("reading or ended",R)):R&&(P("do read"),A.reading=!0,A.sync=!0,A.length===0&&(A.needReadable=!0),this._read(A.highWaterMark),A.sync=!1,!A.reading&&(i=S(I,A)));var U;return U=0<i?D(i,A):null,U===null?(A.needReadable=A.length<=A.highWaterMark,i=0):(A.length-=i,A.awaitDrain=0),A.length===0&&(!A.ended&&(A.needReadable=!0),I!==i&&A.ended&&T(this)),U!==null&&this.emit("data",U),U},E.prototype._read=function(){O(this,new H("_read()"))},E.prototype.pipe=function(i,A){function I(Be,Ce){P("onunpipe"),Be===At&&Ce&&Ce.hasUnpiped===!1&&(Ce.hasUnpiped=!0,U())}function R(){P("onend"),i.end()}function U(){P("cleanup"),i.removeListener("close",tt),i.removeListener("finish",ut),i.removeListener("drain",pe),i.removeListener("error",j),i.removeListener("unpipe",I),At.removeListener("end",R),At.removeListener("end",ot),At.removeListener("data",k),vr=!0,at.awaitDrain&&(!i._writableState||i._writableState.needDrain)&&pe()}function k(Be){P("ondata");var Ce=i.write(Be);P("dest.write",Ce),Ce===!1&&((at.pipesCount===1&&at.pipes===i||1<at.pipesCount&&G(at.pipes,i)!==-1)&&!vr&&(P("false write response, pause",at.awaitDrain),at.awaitDrain++),At.pause())}function j(Be){P("onerror",Be),ot(),i.removeListener("error",j),Y(i,"error")===0&&O(i,Be)}function tt(){i.removeListener("finish",ut),ot()}function ut(){P("onfinish"),i.removeListener("close",tt),ot()}function ot(){P("unpipe"),At.unpipe(i)}var At=this,at=this._readableState;switch(at.pipesCount){case 0:at.pipes=i;break;case 1:at.pipes=[at.pipes,i];break;default:at.pipes.push(i)}at.pipesCount+=1,P("pipe count=%d opts=%j",at.pipesCount,A);var Ee=(!A||A.end!==!1)&&i!==s.stdout&&i!==s.stderr,Ue=Ee?R:ot;at.endEmitted?s.nextTick(Ue):At.once("end",Ue),i.on("unpipe",I);var pe=x(At);i.on("drain",pe);var vr=!1;return At.on("data",k),c(i,"error",j),i.once("close",tt),i.once("finish",ut),i.emit("pipe",At),at.flowing||(P("pipe resume"),At.resume()),i},E.prototype.unpipe=function(i){var A=this._readableState,I={hasUnpiped:!1};if(A.pipesCount===0)return this;if(A.pipesCount===1)return i&&i!==A.pipes?this:(i||(i=A.pipes),A.pipes=null,A.pipesCount=0,A.flowing=!1,i&&i.emit("unpipe",this,I),this);if(!i){var R=A.pipes,U=A.pipesCount;A.pipes=null,A.pipesCount=0,A.flowing=!1;for(var k=0;k<U;k++)R[k].emit("unpipe",this,{hasUnpiped:!1});return this}var j=G(A.pipes,i);return j===-1?this:(A.pipes.splice(j,1),A.pipesCount-=1,A.pipesCount===1&&(A.pipes=A.pipes[0]),i.emit("unpipe",this,I),this)},E.prototype.on=function(i,A){var I=$.prototype.on.call(this,i,A),R=this._readableState;return i==="data"?(R.readableListening=0<this.listenerCount("readable"),R.flowing!==!1&&this.resume()):i=="readable"&&!R.endEmitted&&!R.readableListening&&(R.readableListening=R.needReadable=!0,R.flowing=!1,R.emittedReadable=!1,P("on readable",R.length,R.reading),R.length?B(this):!R.reading&&s.nextTick(b,this)),I},E.prototype.addListener=E.prototype.on,E.prototype.removeListener=function(i,A){var I=$.prototype.removeListener.call(this,i,A);return i==="readable"&&s.nextTick(N,this),I},E.prototype.removeAllListeners=function(i){var A=$.prototype.removeAllListeners.apply(this,arguments);return(i==="readable"||i===void 0)&&s.nextTick(N,this),A},E.prototype.resume=function(){var i=this._readableState;return i.flowing||(P("resume"),i.flowing=!i.readableListening,m(this,i)),i.paused=!1,this},E.prototype.pause=function(){return P("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(P("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},E.prototype.wrap=function(i){var A=this,I=this._readableState,R=!1;for(var U in i.on("end",function(){if(P("wrapped end"),I.decoder&&!I.ended){var j=I.decoder.end();j&&j.length&&A.push(j)}A.push(null)}),i.on("data",function(j){if(P("wrapped data"),I.decoder&&(j=I.decoder.write(j)),!(I.objectMode&&j==null)&&(I.objectMode||j&&j.length)){var tt=A.push(j);tt||(R=!0,i.pause())}}),i)this[U]===void 0&&typeof i[U]=="function"&&(this[U]=(function(j){return function(){return i[j].apply(i,arguments)}})(U));for(var k=0;k<W.length;k++)i.on(W[k],this.emit.bind(this,W[k]));return this._read=function(j){P("wrapped _read",j),R&&(R=!1,i.resume())},this},typeof Symbol=="function"&&(E.prototype[Symbol.asyncIterator]=function(){return ct===void 0&&(ct=n("./internal/streams/async_iterator")),ct(this)}),Object.defineProperty(E.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(E.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(E.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(i){this._readableState&&(this._readableState.flowing=i)}}),E._fromList=D,Object.defineProperty(E.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(E.from=function(i,A){return rt===void 0&&(rt=n("./internal/streams/from")),rt(E,i,A)})}).call(this)}).call(this,n("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{"../errors":15,"./_stream_duplex":16,"./internal/streams/async_iterator":21,"./internal/streams/buffer_list":22,"./internal/streams/destroy":23,"./internal/streams/from":25,"./internal/streams/state":27,"./internal/streams/stream":28,_process:12,buffer:3,events:7,inherits:10,"string_decoder/":31,util:2}],19:[function(n,r){"use strict";function s(Q,S){var g=this._transformState;g.transforming=!1;var B=g.writecb;if(B===null)return this.emit("error",new E);g.writechunk=null,g.writecb=null,S!=null&&this.push(S),B(Q);var p=this._readableState;p.reading=!1,(p.needReadable||p.length<p.highWaterMark)&&this._read(p.highWaterMark)}function o(Q){return this instanceof o?(C.call(this,Q),this._transformState={afterTransform:s.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,Q&&(typeof Q.transform=="function"&&(this._transform=Q.transform),typeof Q.flush=="function"&&(this._flush=Q.flush)),void this.on("prefinish",f)):new o(Q)}function f(){var Q=this;typeof this._flush!="function"||this._readableState.destroyed?h(this,null,null):this._flush(function(S,g){h(Q,S,g)})}function h(Q,S,g){if(S)return Q.emit("error",S);if(g!=null&&Q.push(g),Q._writableState.length)throw new y;if(Q._transformState.transforming)throw new l;return Q.push(null)}r.exports=o;var c=n("../errors").codes,u=c.ERR_METHOD_NOT_IMPLEMENTED,E=c.ERR_MULTIPLE_CALLBACK,l=c.ERR_TRANSFORM_ALREADY_TRANSFORMING,y=c.ERR_TRANSFORM_WITH_LENGTH_0,C=n("./_stream_duplex");n("inherits")(o,C),o.prototype.push=function(Q,S){return this._transformState.needTransform=!1,C.prototype.push.call(this,Q,S)},o.prototype._transform=function(Q,S,g){g(new u("_transform()"))},o.prototype._write=function(Q,S,g){var B=this._transformState;if(B.writecb=g,B.writechunk=Q,B.writeencoding=S,!B.transforming){var p=this._readableState;(B.needTransform||p.needReadable||p.length<p.highWaterMark)&&this._read(p.highWaterMark)}},o.prototype._read=function(){var Q=this._transformState;Q.writechunk===null||Q.transforming?Q.needTransform=!0:(Q.transforming=!0,this._transform(Q.writechunk,Q.writeencoding,Q.afterTransform))},o.prototype._destroy=function(Q,S){C.prototype._destroy.call(this,Q,function(g){S(g)})}},{"../errors":15,"./_stream_duplex":16,inherits:10}],20:[function(n,r){(function(s,o){(function(){"use strict";function f(F){var H=this;this.next=null,this.entry=null,this.finish=function(){T(H,F)}}function h(F){return P.from(F)}function c(F){return P.isBuffer(F)||F instanceof K}function u(){}function E(F,H,V){L=L||n("./_stream_duplex"),F=F||{},typeof V!="boolean"&&(V=H instanceof L),this.objectMode=!!F.objectMode,V&&(this.objectMode=this.objectMode||!!F.writableObjectMode),this.highWaterMark=J(this,F,"writableHighWaterMark",V),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var O=F.decodeStrings===!1;this.decodeStrings=!O,this.defaultEncoding=F.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(W){_(H,W)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=F.emitClose!==!1,this.autoDestroy=!!F.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new f(this)}function l(F){L=L||n("./_stream_duplex");var H=this instanceof L;return H||vt.call(l,this)?(this._writableState=new E(F,this,H),this.writable=!0,F&&(typeof F.write=="function"&&(this._write=F.write),typeof F.writev=="function"&&(this._writev=F.writev),typeof F.destroy=="function"&&(this._destroy=F.destroy),typeof F.final=="function"&&(this._final=F.final)),void q.call(this)):new l(F)}function y(F,H){var V=new mt;yt(F,V),s.nextTick(H,V)}function C(F,H,V,O){var W;return V===null?W=new lt:typeof V!="string"&&!H.objectMode&&(W=new et("chunk",["string","Buffer"],V)),!W||(yt(F,W),s.nextTick(O,W),!1)}function Q(F,H,V){return F.objectMode||F.decodeStrings===!1||typeof H!="string"||(H=P.from(H,V)),H}function S(F,H,V,O,W,i){if(!V){var A=Q(H,O,W);O!==A&&(V=!0,W="buffer",O=A)}var I=H.objectMode?1:O.length;H.length+=I;var R=H.length<H.highWaterMark;if(R||(H.needDrain=!0),H.writing||H.corked){var U=H.lastBufferedRequest;H.lastBufferedRequest={chunk:O,encoding:W,isBuf:V,callback:i,next:null},U?U.next=H.lastBufferedRequest:H.bufferedRequest=H.lastBufferedRequest,H.bufferedRequestCount+=1}else g(F,H,!1,I,O,W,i);return R}function g(F,H,V,O,W,i,A){H.writelen=O,H.writecb=A,H.writing=!0,H.sync=!0,H.destroyed?H.onwrite(new Et("write")):V?F._writev(W,H.onwrite):F._write(W,i,H.onwrite),H.sync=!1}function B(F,H,V,O,W){--H.pendingcb,V?(s.nextTick(W,O),s.nextTick(M,F,H),F._writableState.errorEmitted=!0,yt(F,O)):(W(O),F._writableState.errorEmitted=!0,yt(F,O),M(F,H))}function p(F){F.writing=!1,F.writecb=null,F.length-=F.writelen,F.writelen=0}function _(F,H){var V=F._writableState,O=V.sync,W=V.writecb;if(typeof W!="function")throw new ct;if(p(V),H)B(F,V,O,H,W);else{var i=b(V)||F.destroyed;i||V.corked||V.bufferProcessing||!V.bufferedRequest||N(F,V),O?s.nextTick(w,F,V,i,W):w(F,V,i,W)}}function w(F,H,V,O){V||x(F,H),H.pendingcb--,O(),M(F,H)}function x(F,H){H.length===0&&H.needDrain&&(H.needDrain=!1,F.emit("drain"))}function N(F,H){H.bufferProcessing=!0;var V=H.bufferedRequest;if(F._writev&&V&&V.next){var O=H.bufferedRequestCount,W=Array(O),i=H.corkedRequestsFree;i.entry=V;for(var A=0,I=!0;V;)W[A]=V,V.isBuf||(I=!1),V=V.next,A+=1;W.allBuffers=I,g(F,H,!0,H.length,W,"",i.finish),H.pendingcb++,H.lastBufferedRequest=null,i.next?(H.corkedRequestsFree=i.next,i.next=null):H.corkedRequestsFree=new f(H),H.bufferedRequestCount=0}else{for(;V;){var R=V.chunk,U=V.encoding,k=V.callback,j=H.objectMode?1:R.length;if(g(F,H,!1,j,R,U,k),V=V.next,H.bufferedRequestCount--,H.writing)break}V===null&&(H.lastBufferedRequest=null)}H.bufferedRequest=V,H.bufferProcessing=!1}function b(F){return F.ending&&F.length===0&&F.bufferedRequest===null&&!F.finished&&!F.writing}function m(F,H){F._final(function(V){H.pendingcb--,V&&yt(F,V),H.prefinished=!0,F.emit("prefinish"),M(F,H)})}function v(F,H){H.prefinished||H.finalCalled||(typeof F._final!="function"||H.destroyed?(H.prefinished=!0,F.emit("prefinish")):(H.pendingcb++,H.finalCalled=!0,s.nextTick(m,F,H)))}function M(F,H){var V=b(H);if(V&&(v(F,H),H.pendingcb===0&&(H.finished=!0,F.emit("finish"),H.autoDestroy))){var O=F._readableState;(!O||O.autoDestroy&&O.endEmitted)&&F.destroy()}return V}function D(F,H,V){H.ending=!0,M(F,H),V&&(H.finished?s.nextTick(V):F.once("finish",V)),H.ended=!0,F.writable=!1}function T(F,H,V){var O=F.entry;for(F.entry=null;O;){var W=O.callback;H.pendingcb--,W(V),O=O.next}H.corkedRequestsFree.next=F}r.exports=l;var L;l.WritableState=E;var G={deprecate:n("util-deprecate")},q=n("./internal/streams/stream"),P=n("buffer").Buffer,K=o.Uint8Array||function(){},Y=n("./internal/streams/destroy"),$=n("./internal/streams/state"),J=$.getHighWaterMark,X=n("../errors").codes,et=X.ERR_INVALID_ARG_TYPE,nt=X.ERR_METHOD_NOT_IMPLEMENTED,ct=X.ERR_MULTIPLE_CALLBACK,rt=X.ERR_STREAM_CANNOT_PIPE,Et=X.ERR_STREAM_DESTROYED,lt=X.ERR_STREAM_NULL_VALUES,mt=X.ERR_STREAM_WRITE_AFTER_END,Mt=X.ERR_UNKNOWN_ENCODING,yt=Y.errorOrDestroy;n("inherits")(l,q),E.prototype.getBuffer=function(){for(var F=this.bufferedRequest,H=[];F;)H.push(F),F=F.next;return H},(function(){try{Object.defineProperty(E.prototype,"buffer",{get:G.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var vt;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(vt=Function.prototype[Symbol.hasInstance],Object.defineProperty(l,Symbol.hasInstance,{value:function(F){return!!vt.call(this,F)||this===l&&F&&F._writableState instanceof E}})):vt=function(F){return F instanceof this},l.prototype.pipe=function(){yt(this,new rt)},l.prototype.write=function(F,H,V){var O=this._writableState,W=!1,i=!O.objectMode&&c(F);return i&&!P.isBuffer(F)&&(F=h(F)),typeof H=="function"&&(V=H,H=null),i?H="buffer":!H&&(H=O.defaultEncoding),typeof V!="function"&&(V=u),O.ending?y(this,V):(i||C(this,O,F,V))&&(O.pendingcb++,W=S(this,O,i,F,H,V)),W},l.prototype.cork=function(){this._writableState.corked++},l.prototype.uncork=function(){var F=this._writableState;F.corked&&(F.corked--,!F.writing&&!F.corked&&!F.bufferProcessing&&F.bufferedRequest&&N(this,F))},l.prototype.setDefaultEncoding=function(F){if(typeof F=="string"&&(F=F.toLowerCase()),!(-1<["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((F+"").toLowerCase())))throw new Mt(F);return this._writableState.defaultEncoding=F,this},Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),l.prototype._write=function(F,H,V){V(new nt("_write()"))},l.prototype._writev=null,l.prototype.end=function(F,H,V){var O=this._writableState;return typeof F=="function"?(V=F,F=null,H=null):typeof H=="function"&&(V=H,H=null),F!=null&&this.write(F,H),O.corked&&(O.corked=1,this.uncork()),O.ending||D(this,O,V),this},Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(l.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(F){this._writableState&&(this._writableState.destroyed=F)}}),l.prototype.destroy=Y.destroy,l.prototype._undestroy=Y.undestroy,l.prototype._destroy=function(F,H){H(F)}}).call(this)}).call(this,n("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{"../errors":15,"./_stream_duplex":16,"./internal/streams/destroy":23,"./internal/streams/state":27,"./internal/streams/stream":28,_process:12,buffer:3,inherits:10,"util-deprecate":32}],21:[function(n,r){(function(s){(function(){"use strict";function o(x,N,b){return N in x?Object.defineProperty(x,N,{value:b,enumerable:!0,configurable:!0,writable:!0}):x[N]=b,x}function f(x,N){return{value:x,done:N}}function h(x){var N=x[y];if(N!==null){var b=x[p].read();b!==null&&(x[g]=null,x[y]=null,x[C]=null,N(f(b,!1)))}}function c(x){s.nextTick(h,x)}function u(x,N){return function(b,m){x.then(function(){return N[S]?void b(f(void 0,!0)):void N[B](b,m)},m)}}var E,l=n("./end-of-stream"),y=Symbol("lastResolve"),C=Symbol("lastReject"),Q=Symbol("error"),S=Symbol("ended"),g=Symbol("lastPromise"),B=Symbol("handlePromise"),p=Symbol("stream"),_=Object.getPrototypeOf(function(){}),w=Object.setPrototypeOf((E={get stream(){return this[p]},next:function(){var x=this,N=this[Q];if(N!==null)return Promise.reject(N);if(this[S])return Promise.resolve(f(void 0,!0));if(this[p].destroyed)return new Promise(function(M,D){s.nextTick(function(){x[Q]?D(x[Q]):M(f(void 0,!0))})});var b,m=this[g];if(m)b=new Promise(u(m,this));else{var v=this[p].read();if(v!==null)return Promise.resolve(f(v,!1));b=new Promise(this[B])}return this[g]=b,b}},o(E,Symbol.asyncIterator,function(){return this}),o(E,"return",function(){var x=this;return new Promise(function(N,b){x[p].destroy(null,function(m){return m?void b(m):void N(f(void 0,!0))})})}),E),_);r.exports=function(x){var N,b=Object.create(w,(N={},o(N,p,{value:x,writable:!0}),o(N,y,{value:null,writable:!0}),o(N,C,{value:null,writable:!0}),o(N,Q,{value:null,writable:!0}),o(N,S,{value:x._readableState.endEmitted,writable:!0}),o(N,B,{value:function(m,v){var M=b[p].read();M?(b[g]=null,b[y]=null,b[C]=null,m(f(M,!1))):(b[y]=m,b[C]=v)},writable:!0}),N));return b[g]=null,l(x,function(m){if(m&&m.code!=="ERR_STREAM_PREMATURE_CLOSE"){var v=b[C];return v!==null&&(b[g]=null,b[y]=null,b[C]=null,v(m)),void(b[Q]=m)}var M=b[y];M!==null&&(b[g]=null,b[y]=null,b[C]=null,M(f(void 0,!0))),b[S]=!0}),x.on("readable",c.bind(null,b)),b}}).call(this)}).call(this,n("_process"))},{"./end-of-stream":24,_process:12}],22:[function(n,r){"use strict";function s(g,B){var p=Object.keys(g);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(g);B&&(_=_.filter(function(w){return Object.getOwnPropertyDescriptor(g,w).enumerable})),p.push.apply(p,_)}return p}function o(g){for(var B,p=1;p<arguments.length;p++)B=arguments[p]==null?{}:arguments[p],p%2?s(Object(B),!0).forEach(function(_){f(g,_,B[_])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(B)):s(Object(B)).forEach(function(_){Object.defineProperty(g,_,Object.getOwnPropertyDescriptor(B,_))});return g}function f(g,B,p){return B in g?Object.defineProperty(g,B,{value:p,enumerable:!0,configurable:!0,writable:!0}):g[B]=p,g}function h(g,B){if(!(g instanceof B))throw new TypeError("Cannot call a class as a function")}function c(g,B){for(var p,_=0;_<B.length;_++)p=B[_],p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(g,p.key,p)}function u(g,B,p){return B&&c(g.prototype,B),p&&c(g,p),g}function E(g,B,p){y.prototype.copy.call(g,B,p)}var l=n("buffer"),y=l.Buffer,C=n("util"),Q=C.inspect,S=Q&&Q.custom||"inspect";r.exports=(function(){function g(){h(this,g),this.head=null,this.tail=null,this.length=0}return u(g,[{key:"push",value:function(B){var p={data:B,next:null};0<this.length?this.tail.next=p:this.head=p,this.tail=p,++this.length}},{key:"unshift",value:function(B){var p={data:B,next:this.head};this.length===0&&(this.tail=p),this.head=p,++this.length}},{key:"shift",value:function(){if(this.length!==0){var B=this.head.data;return this.head=this.length===1?this.tail=null:this.head.next,--this.length,B}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(B){if(this.length===0)return"";for(var p=this.head,_=""+p.data;p=p.next;)_+=B+p.data;return _}},{key:"concat",value:function(B){if(this.length===0)return y.alloc(0);for(var p=y.allocUnsafe(B>>>0),_=this.head,w=0;_;)E(_.data,p,w),w+=_.data.length,_=_.next;return p}},{key:"consume",value:function(B,p){var _;return B<this.head.data.length?(_=this.head.data.slice(0,B),this.head.data=this.head.data.slice(B)):B===this.head.data.length?_=this.shift():_=p?this._getString(B):this._getBuffer(B),_}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(B){var p=this.head,_=1,w=p.data;for(B-=w.length;p=p.next;){var x=p.data,N=B>x.length?x.length:B;if(w+=N===x.length?x:x.slice(0,B),B-=N,B===0){N===x.length?(++_,this.head=p.next?p.next:this.tail=null):(this.head=p,p.data=x.slice(N));break}++_}return this.length-=_,w}},{key:"_getBuffer",value:function(B){var p=y.allocUnsafe(B),_=this.head,w=1;for(_.data.copy(p),B-=_.data.length;_=_.next;){var x=_.data,N=B>x.length?x.length:B;if(x.copy(p,p.length-B,0,N),B-=N,B===0){N===x.length?(++w,this.head=_.next?_.next:this.tail=null):(this.head=_,_.data=x.slice(N));break}++w}return this.length-=w,p}},{key:S,value:function(B,p){return Q(this,o({},p,{depth:0,customInspect:!1}))}}]),g})()},{buffer:3,util:2}],23:[function(n,r){(function(s){(function(){"use strict";function o(c,u){h(c,u),f(c)}function f(c){c._writableState&&!c._writableState.emitClose||c._readableState&&!c._readableState.emitClose||c.emit("close")}function h(c,u){c.emit("error",u)}r.exports={destroy:function(c,u){var E=this,l=this._readableState&&this._readableState.destroyed,y=this._writableState&&this._writableState.destroyed;return l||y?(u?u(c):c&&(this._writableState?!this._writableState.errorEmitted&&(this._writableState.errorEmitted=!0,s.nextTick(h,this,c)):s.nextTick(h,this,c)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(c||null,function(C){!u&&C?E._writableState?E._writableState.errorEmitted?s.nextTick(f,E):(E._writableState.errorEmitted=!0,s.nextTick(o,E,C)):s.nextTick(o,E,C):u?(s.nextTick(f,E),u(C)):s.nextTick(f,E)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(c,u){var E=c._readableState,l=c._writableState;E&&E.autoDestroy||l&&l.autoDestroy?c.destroy(u):c.emit("error",u)}}}).call(this)}).call(this,n("_process"))},{_process:12}],24:[function(n,r){"use strict";function s(u){var E=!1;return function(){if(!E){E=!0;for(var l=arguments.length,y=Array(l),C=0;C<l;C++)y[C]=arguments[C];u.apply(this,y)}}}function o(){}function f(u){return u.setHeader&&typeof u.abort=="function"}function h(u,E,l){if(typeof E=="function")return h(u,null,E);E||(E={}),l=s(l||o);var y=E.readable||E.readable!==!1&&u.readable,C=E.writable||E.writable!==!1&&u.writable,Q=function(){u.writable||g()},S=u._writableState&&u._writableState.finished,g=function(){C=!1,S=!0,y||l.call(u)},B=u._readableState&&u._readableState.endEmitted,p=function(){y=!1,B=!0,C||l.call(u)},_=function(N){l.call(u,N)},w=function(){var N;return y&&!B?(u._readableState&&u._readableState.ended||(N=new c),l.call(u,N)):C&&!S?(u._writableState&&u._writableState.ended||(N=new c),l.call(u,N)):void 0},x=function(){u.req.on("finish",g)};return f(u)?(u.on("complete",g),u.on("abort",w),u.req?x():u.on("request",x)):C&&!u._writableState&&(u.on("end",Q),u.on("close",Q)),u.on("end",p),u.on("finish",g),E.error!==!1&&u.on("error",_),u.on("close",w),function(){u.removeListener("complete",g),u.removeListener("abort",w),u.removeListener("request",x),u.req&&u.req.removeListener("finish",g),u.removeListener("end",Q),u.removeListener("close",Q),u.removeListener("finish",g),u.removeListener("end",p),u.removeListener("error",_),u.removeListener("close",w)}}var c=n("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;r.exports=h},{"../../../errors":15}],25:[function(n,r){r.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],26:[function(n,r){"use strict";function s(S){var g=!1;return function(){g||(g=!0,S.apply(void 0,arguments))}}function o(S){if(S)throw S}function f(S){return S.setHeader&&typeof S.abort=="function"}function h(S,g,B,p){p=s(p);var _=!1;S.on("close",function(){_=!0}),l===void 0&&(l=n("./end-of-stream")),l(S,{readable:g,writable:B},function(x){return x?p(x):(_=!0,void p())});var w=!1;return function(x){if(!_)return w?void 0:(w=!0,f(S)?S.abort():typeof S.destroy=="function"?S.destroy():void p(x||new Q("pipe")))}}function c(S){S()}function u(S,g){return S.pipe(g)}function E(S){return S.length&&typeof S[S.length-1]=="function"?S.pop():o}var l,y=n("../../../errors").codes,C=y.ERR_MISSING_ARGS,Q=y.ERR_STREAM_DESTROYED;r.exports=function(){for(var S=arguments.length,g=Array(S),B=0;B<S;B++)g[B]=arguments[B];var p=E(g);if(Array.isArray(g[0])&&(g=g[0]),2>g.length)throw new C("streams");var _,w=g.map(function(x,N){var b=N<g.length-1;return h(x,b,0<N,function(m){_||(_=m),m&&w.forEach(c),b||(w.forEach(c),p(_))})});return g.reduce(u)}},{"../../../errors":15,"./end-of-stream":24}],27:[function(n,r){"use strict";function s(f,h,c){return f.highWaterMark==null?h?f[c]:null:f.highWaterMark}var o=n("../../../errors").codes.ERR_INVALID_OPT_VALUE;r.exports={getHighWaterMark:function(f,h,c,u){var E=s(h,u,c);if(E!=null){if(!(isFinite(E)&&a(E)===E)||0>E){var l=u?c:"highWaterMark";throw new o(l,E)}return a(E)}return f.objectMode?16:16384}}},{"../../../errors":15}],28:[function(n,r){r.exports=n("events").EventEmitter},{events:7}],29:[function(n,r,s){s=r.exports=n("./lib/_stream_readable.js"),s.Stream=s,s.Readable=s,s.Writable=n("./lib/_stream_writable.js"),s.Duplex=n("./lib/_stream_duplex.js"),s.Transform=n("./lib/_stream_transform.js"),s.PassThrough=n("./lib/_stream_passthrough.js"),s.finished=n("./lib/internal/streams/end-of-stream.js"),s.pipeline=n("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":16,"./lib/_stream_passthrough.js":17,"./lib/_stream_readable.js":18,"./lib/_stream_transform.js":19,"./lib/_stream_writable.js":20,"./lib/internal/streams/end-of-stream.js":24,"./lib/internal/streams/pipeline.js":26}],30:[function(n,r,s){function o(u,E){for(var l in u)E[l]=u[l]}function f(u,E,l){return c(u,E,l)}var h=n("buffer"),c=h.Buffer;c.from&&c.alloc&&c.allocUnsafe&&c.allocUnsafeSlow?r.exports=h:(o(h,s),s.Buffer=f),f.prototype=Object.create(c.prototype),o(c,f),f.from=function(u,E,l){if(typeof u=="number")throw new TypeError("Argument must not be a number");return c(u,E,l)},f.alloc=function(u,E,l){if(typeof u!="number")throw new TypeError("Argument must be a number");var y=c(u);return E===void 0?y.fill(0):typeof l=="string"?y.fill(E,l):y.fill(E),y},f.allocUnsafe=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return c(u)},f.allocUnsafeSlow=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return h.SlowBuffer(u)}},{buffer:3}],31:[function(n,r,s){"use strict";function o(w){if(!w)return"utf8";for(var x;;)switch(w){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return w;default:if(x)return;w=(""+w).toLowerCase(),x=!0}}function f(w){var x=o(w);if(typeof x!="string"&&(p.isEncoding===_||!_(w)))throw new Error("Unknown encoding: "+w);return x||w}function h(w){this.encoding=f(w);var x;switch(this.encoding){case"utf16le":this.text=y,this.end=C,x=4;break;case"utf8":this.fillLast=l,x=4;break;case"base64":this.text=Q,this.end=S,x=3;break;default:return this.write=g,void(this.end=B)}this.lastNeed=0,this.lastTotal=0,this.lastChar=p.allocUnsafe(x)}function c(w){return 127>=w?0:w>>5==6?2:w>>4==14?3:w>>3==30?4:w>>6==2?-1:-2}function u(w,x,N){var b=x.length-1;if(b<N)return 0;var m=c(x[b]);return 0<=m?(0<m&&(w.lastNeed=m-1),m):--b<N||m===-2?0:(m=c(x[b]),0<=m?(0<m&&(w.lastNeed=m-2),m):--b<N||m===-2?0:(m=c(x[b]),0<=m?(0<m&&(m===2?m=0:w.lastNeed=m-3),m):0))}function E(w,x){if((192&x[0])!=128)return w.lastNeed=0,"\uFFFD";if(1<w.lastNeed&&1<x.length){if((192&x[1])!=128)return w.lastNeed=1,"\uFFFD";if(2<w.lastNeed&&2<x.length&&(192&x[2])!=128)return w.lastNeed=2,"\uFFFD"}}function l(w){var x=this.lastTotal-this.lastNeed,N=E(this,w,x);return N===void 0?this.lastNeed<=w.length?(w.copy(this.lastChar,x,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(w.copy(this.lastChar,x,0,w.length),void(this.lastNeed-=w.length)):N}function y(w,x){if((w.length-x)%2==0){var N=w.toString("utf16le",x);if(N){var b=N.charCodeAt(N.length-1);if(55296<=b&&56319>=b)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=w[w.length-2],this.lastChar[1]=w[w.length-1],N.slice(0,-1)}return N}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=w[w.length-1],w.toString("utf16le",x,w.length-1)}function C(w){var x=w&&w.length?this.write(w):"";if(this.lastNeed){var N=this.lastTotal-this.lastNeed;return x+this.lastChar.toString("utf16le",0,N)}return x}function Q(w,x){var N=(w.length-x)%3;return N==0?w.toString("base64",x):(this.lastNeed=3-N,this.lastTotal=3,N==1?this.lastChar[0]=w[w.length-1]:(this.lastChar[0]=w[w.length-2],this.lastChar[1]=w[w.length-1]),w.toString("base64",x,w.length-N))}function S(w){var x=w&&w.length?this.write(w):"";return this.lastNeed?x+this.lastChar.toString("base64",0,3-this.lastNeed):x}function g(w){return w.toString(this.encoding)}function B(w){return w&&w.length?this.write(w):""}var p=n("safe-buffer").Buffer,_=p.isEncoding||function(w){switch(w=""+w,w&&w.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};s.StringDecoder=h,h.prototype.write=function(w){if(w.length===0)return"";var x,N;if(this.lastNeed){if(x=this.fillLast(w),x===void 0)return"";N=this.lastNeed,this.lastNeed=0}else N=0;return N<w.length?x?x+this.text(w,N):this.text(w,N):x||""},h.prototype.end=function(w){var x=w&&w.length?this.write(w):"";return this.lastNeed?x+"\uFFFD":x},h.prototype.text=function(w,x){var N=u(this,w,x);if(!this.lastNeed)return w.toString("utf8",x);this.lastTotal=N;var b=w.length-(N-this.lastNeed);return w.copy(this.lastChar,0,b),w.toString("utf8",x,b)},h.prototype.fillLast=function(w){return this.lastNeed<=w.length?(w.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(w.copy(this.lastChar,this.lastTotal-this.lastNeed,0,w.length),void(this.lastNeed-=w.length))}},{"safe-buffer":30}],32:[function(n,r){(function(s){(function(){function o(f){try{if(!s.localStorage)return!1}catch{return!1}var h=s.localStorage[f];return h!=null&&(h+"").toLowerCase()==="true"}r.exports=function(f,h){function c(){if(!u){if(o("throwDeprecation"))throw new Error(h);o("traceDeprecation")?console.trace(h):console.warn(h),u=!0}return f.apply(this,arguments)}if(o("noDeprecation"))return f;var u=!1;return c}}).call(this)}).call(this,typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{}],"/":[function(n,r){function s(S){return S.replace(/a=ice-options:trickle\s\n/g,"")}function o(S){console.warn(S)}let f=n("debug")("simple-peer"),h=n("get-browser-rtc"),c=n("randombytes"),u=n("readable-stream"),E=n("queue-microtask"),l=n("err-code"),{Buffer:y}=n("buffer"),C=65536;class Q extends u.Duplex{constructor(g){if(g=Object.assign({allowHalfOpen:!1},g),super(g),this._id=c(4).toString("hex").slice(0,7),this._debug("new peer %o",g),this.channelName=g.initiator?g.channelName||c(20).toString("hex"):null,this.initiator=g.initiator||!1,this.channelConfig=g.channelConfig||Q.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},Q.config,g.config),this.offerOptions=g.offerOptions||{},this.answerOptions=g.answerOptions||{},this.sdpTransform=g.sdpTransform||(B=>B),this.streams=g.streams||(g.stream?[g.stream]:[]),this.trickle=g.trickle===void 0||g.trickle,this.allowHalfTrickle=g.allowHalfTrickle!==void 0&&g.allowHalfTrickle,this.iceCompleteTimeout=g.iceCompleteTimeout||5e3,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=g.wrtc&&typeof g.wrtc=="object"?g.wrtc:h(),!this._wrtc)throw l(typeof window>"u"?new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"):new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(B){return void this.destroy(l(B,"ERR_PC_CONSTRUCTOR"))}this._isReactNativeWebrtc=typeof this._pc._peerConnectionId=="number",this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=B=>{this._onIceCandidate(B)},typeof this._pc.peerIdentity=="object"&&this._pc.peerIdentity.catch(B=>{this.destroy(l(B,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=B=>{this._setupData(B)},this.streams&&this.streams.forEach(B=>{this.addStream(B)}),this._pc.ontrack=B=>{this._onTrack(B)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&this._channel.readyState==="open"}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(g){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if(typeof g=="string")try{g=JSON.parse(g)}catch{g={}}this._debug("signal()"),g.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),g.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(g.transceiverRequest.kind,g.transceiverRequest.init)),g.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(g.candidate):this._pendingCandidates.push(g.candidate)),g.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(g)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(B=>{this._addIceCandidate(B)}),this._pendingCandidates=[],this._pc.remoteDescription.type==="offer"&&this._createAnswer())}).catch(B=>{this.destroy(l(B,"ERR_SET_REMOTE_DESCRIPTION"))}),g.sdp||g.candidate||g.renegotiate||g.transceiverRequest||this.destroy(l(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(g){let B=new this._wrtc.RTCIceCandidate(g);this._pc.addIceCandidate(B).catch(p=>{!B.address||B.address.endsWith(".local")?o("Ignoring unsupported ICE candidate."):this.destroy(l(p,"ERR_ADD_ICE_CANDIDATE"))})}send(g){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(g)}}addTransceiver(g,B){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(g,B),this._needsNegotiation()}catch(p){this.destroy(l(p,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:g,init:B}})}}addStream(g){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),g.getTracks().forEach(B=>{this.addTrack(B,g)})}}addTrack(g,B){if(this.destroying)return;if(this.destroyed)throw l(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");let p=this._senderMap.get(g)||new Map,_=p.get(B);if(!_)_=this._pc.addTrack(g,B),p.set(B,_),this._senderMap.set(g,p),this._needsNegotiation();else throw _.removed?l(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):l(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED")}replaceTrack(g,B,p){if(this.destroying)return;if(this.destroyed)throw l(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");let _=this._senderMap.get(g),w=_?_.get(p):null;if(!w)throw l(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");B&&this._senderMap.set(B,_),w.replaceTrack==null?this.destroy(l(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK")):w.replaceTrack(B)}removeTrack(g,B){if(this.destroying)return;if(this.destroyed)throw l(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");let p=this._senderMap.get(g),_=p?p.get(B):null;if(!_)throw l(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{_.removed=!0,this._pc.removeTrack(_)}catch(w){w.name==="NS_ERROR_UNEXPECTED"?this._sendersAwaitingStable.push(_):this.destroy(l(w,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(g){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),g.getTracks().forEach(B=>{this.removeTrack(B,g)})}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,E(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(g){this._destroy(g,()=>{})}_destroy(g,B){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",g&&(g.message||g)),E(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",g&&(g.message||g)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch{}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch{}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,g&&this.emit("error",g),this.emit("close"),B()}))}_setupData(g){if(!g.channel)return this.destroy(l(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=g.channel,this._channel.binaryType="arraybuffer",typeof this._channel.bufferedAmountLowThreshold=="number"&&(this._channel.bufferedAmountLowThreshold=C),this.channelName=this._channel.label,this._channel.onmessage=p=>{this._onChannelMessage(p)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=p=>{let _=p.error instanceof Error?p.error:new Error(`Datachannel error: ${p.message} ${p.filename}:${p.lineno}:${p.colno}`);this.destroy(l(_,"ERR_DATA_CHANNEL"))};let B=!1;this._closingInterval=setInterval(()=>{this._channel&&this._channel.readyState==="closing"?(B&&this._onChannelClose(),B=!0):B=!1},5e3)}_read(){}_write(g,B,p){if(this.destroyed)return p(l(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(g)}catch(_){return this.destroy(l(_,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>C?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=p):p(null)}else this._debug("write before connect"),this._chunk=g,this._cb=p}_onFinish(){if(!this.destroyed){let g=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?g():this.once("connect",g)}}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(g=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(g.sdp=s(g.sdp)),g.sdp=this.sdpTransform(g.sdp);let B=()=>{if(!this.destroyed){let p=this._pc.localDescription||g;this._debug("signal"),this.emit("signal",{type:p.type,sdp:p.sdp})}};this._pc.setLocalDescription(g).then(()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?B():this.once("_iceComplete",B))}).catch(p=>{this.destroy(l(p,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(g=>{this.destroy(l(g,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(g=>{g.mid||!g.sender.track||g.requested||(g.requested=!0,this.addTransceiver(g.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(g=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(g.sdp=s(g.sdp)),g.sdp=this.sdpTransform(g.sdp);let B=()=>{if(!this.destroyed){let p=this._pc.localDescription||g;this._debug("signal"),this.emit("signal",{type:p.type,sdp:p.sdp}),this.initiator||this._requestMissingTransceivers()}};this._pc.setLocalDescription(g).then(()=>{this.destroyed||(this.trickle||this._iceComplete?B():this.once("_iceComplete",B))}).catch(p=>{this.destroy(l(p,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(g=>{this.destroy(l(g,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||this._pc.connectionState==="failed"&&this.destroy(l(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;let g=this._pc.iceConnectionState,B=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",g,B),this.emit("iceStateChange",g,B),(g==="connected"||g==="completed")&&(this._pcReady=!0,this._maybeReady()),g==="failed"&&this.destroy(l(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),g==="closed"&&this.destroy(l(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(g){let B=p=>(Object.prototype.toString.call(p.values)==="[object Array]"&&p.values.forEach(_=>{Object.assign(p,_)}),p);this._pc.getStats.length===0||this._isReactNativeWebrtc?this._pc.getStats().then(p=>{let _=[];p.forEach(w=>{_.push(B(w))}),g(null,_)},p=>g(p)):0<this._pc.getStats.length?this._pc.getStats(p=>{if(this.destroyed)return;let _=[];p.result().forEach(w=>{let x={};w.names().forEach(N=>{x[N]=w.stat(N)}),x.id=w.id,x.type=w.type,x.timestamp=w.timestamp,_.push(B(x))}),g(null,_)},p=>g(p)):g(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;let g=()=>{this.destroyed||this.getStats((B,p)=>{if(this.destroyed)return;B&&(p=[]);let _={},w={},x={},N=!1;p.forEach(m=>{(m.type==="remotecandidate"||m.type==="remote-candidate")&&(_[m.id]=m),(m.type==="localcandidate"||m.type==="local-candidate")&&(w[m.id]=m),(m.type==="candidatepair"||m.type==="candidate-pair")&&(x[m.id]=m)});let b=m=>{N=!0;let v=w[m.localCandidateId];v&&(v.ip||v.address)?(this.localAddress=v.ip||v.address,this.localPort=+v.port):v&&v.ipAddress?(this.localAddress=v.ipAddress,this.localPort=+v.portNumber):typeof m.googLocalAddress=="string"&&(v=m.googLocalAddress.split(":"),this.localAddress=v[0],this.localPort=+v[1]),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let M=_[m.remoteCandidateId];M&&(M.ip||M.address)?(this.remoteAddress=M.ip||M.address,this.remotePort=+M.port):M&&M.ipAddress?(this.remoteAddress=M.ipAddress,this.remotePort=+M.portNumber):typeof m.googRemoteAddress=="string"&&(M=m.googRemoteAddress.split(":"),this.remoteAddress=M[0],this.remotePort=+M[1]),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(p.forEach(m=>{m.type==="transport"&&m.selectedCandidatePairId&&b(x[m.selectedCandidatePairId]),(m.type==="googCandidatePair"&&m.googActiveConnection==="true"||(m.type==="candidatepair"||m.type==="candidate-pair")&&m.selected)&&b(m)}),!N&&(!Object.keys(x).length||Object.keys(w).length))return void setTimeout(g,100);if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(v){return this.destroy(l(v,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');let m=this._cb;this._cb=null,m(null)}typeof this._channel.bufferedAmountLowThreshold!="number"&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")})};g()}_onInterval(){this._cb&&this._channel&&!(this._channel.bufferedAmount>C)&&this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||(this._pc.signalingState==="stable"&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(g=>{this._pc.removeTrack(g),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(g){this.destroyed||(g.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:g.candidate.candidate,sdpMLineIndex:g.candidate.sdpMLineIndex,sdpMid:g.candidate.sdpMid}}):!g.candidate&&!this._iceComplete&&(this._iceComplete=!0,this.emit("_iceComplete")),g.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(g){if(this.destroyed)return;let B=g.data;B instanceof ArrayBuffer&&(B=y.from(B)),this.push(B)}_onChannelBufferedAmountLow(){if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);let g=this._cb;this._cb=null,g(null)}}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(g){this.destroyed||g.streams.forEach(B=>{this._debug("on track"),this.emit("track",g.track,B),this._remoteTracks.push({track:g.track,stream:B}),this._remoteStreams.some(p=>p.id===B.id)||(this._remoteStreams.push(B),E(()=>{this._debug("on stream"),this.emit("stream",B)}))})}_debug(){let g=[].slice.call(arguments);g[0]="["+this._id+"] "+g[0],f.apply(null,g)}}Q.WEBRTC_SUPPORT=!!h(),Q.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},Q.channelConfig={},r.exports=Q},{buffer:3,debug:4,"err-code":6,"get-browser-rtc":8,"queue-microtask":13,randombytes:14,"readable-stream":29}]},{},[])("/")})});var Fr=_s((eA,Tr)=>{"use strict";Tr.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var $e,Nt,Ct,Yt,st,St,Bt,Qt,_t,gt,Ur,Ot=pt(async()=>{$e=typeof window>"u";$e||(await Promise.resolve().then(()=>(Nr(),Ds))).default;Nt={AVOID_INTERVALS:!1,USE_TEST_TRANSPORTS:!1,ICE_DELAY:{min:250,max:3e3},ICE_OFFER_FAILURE_RATE:.2,ICE_ANSWER_FAILURE_RATE:.15,AVOID_FOLLOWERS_NODES:!1,AUTO_START:!0,PUBLIC_PEERS_COUNT:100,PEERS_COUNT:1860,BOOTSTRAPS_PER_PEER:10,DELAY_BETWEEN_INIT:10,RANDOM_UNICAST_PER_SEC:0,RANDOM_GOSSIP_PER_SEC:0,DIFFUSION_TEST_DELAY:1e4},Ct={DEFAULT_VERBOSE:2,CONNECTION_UPGRADE_TIMEOUT:15e3,IS_BROWSER:!$e,MANUAL_BAN_MODE:!1},Yt={PORT:8080,AUTO_KICK_DELAY:6e4,AUTO_KICK_DURATION:3e4,MAX_WS_IN_CONNS:20},st={DIFFICULTY:0,ARGON2_MEM:2**16,ARE_IDS_HEX:!0,PUBLIC_PREFIX:"0",STANDARD_PREFIX:"1",ID_LENGTH:16,PUBKEY_LENGTH:32,PRIVATEKEY_LENGTH:32,SIGNATURE_LENGTH:64},St={CENTRALIZED_STUN_SERVERS:!1,MAX_SDP_OFFERS:2,ICE_COMPLETE_TIMEOUT:1e3,SIGNAL_CREATION_TIMEOUT:8e3,SDP_OFFER_EXPIRATION:4e4,WS_CLIENT:WebSocket,WS_SERVER:$e?(await Promise.resolve().then(()=>xs(Fr(),1))).WebSocketServer:null,PEER:$e?(await import("simple-peer")).default:window.SimplePeer},Bt={PEER_LINK_DELAY:1e4,PEER_LINK_EXPIRATION:6e4,LOOP_DELAY:2500,TARGET_NEIGHBORS_COUNT:5,ON_CONNECT_DISPATCH:{DELAY:0,BROADCAST_EVENT:!1,OVER_NEIGHBORED:!0,SHARE_HISTORY:!1},ON_DISCONNECT_DISPATCH:{DELAY:0,BROADCAST_EVENT:!1},ON_UNICAST:{DIGEST_TRAVELED_ROUTE:!0}},Qt={MAX_HOPS:8,MAX_NODES:256,MAX_ROUTES:5,MARKERS_BYTES:{message:0,0:"message",handshake:1,1:"handshake",signal_answer:2,2:"signal_answer",signal_offer:3,3:"signal_offer",privacy:4,4:"privacy",private_message:5,5:"private_message"}},_t={EXPIRATION:1e4,CACHE_DURATION:2e4,HOPS:{default:20,signal_offer:6,diffusion_test:100,over_neighbored:6},TRANSMISSION_RATE:{MIN_NEIGHBOURS_TO_APPLY_PONDERATION:2,NEIGHBOURS_PONDERATION:5,Default:1,signal_offer:.618},MARKERS_BYTES:{gossip:128,128:"gossip",signal_offer:129,129:"signal_offer",peer_connected:130,130:"peer_connected",peer_disconnected:131,131:"peer_disconnected",diffusion_test:132,132:"diffusion_test",over_neighbored:133,133:"over_neighbored"}},gt={SIMULATOR:"color: yellow; font-weight: bold;",ARBITER:"color: white;",CRYPTO_CODEX:"color: green;",GOSSIP:"color: fuchsia;",UNICAST:"color: cyan;",PEER_STORE:"color: orange;",SERVICE:"color: teal;",PUNISHER:{BAN:"color: red; font-weight: bold;",KICK:"color: darkorange; font-weight: bold;"}},Ur={SIMULATION:Nt,NODE:Ct,TRANSPORTS:St,DISCOVERY:Bt,IDENTITY:st,UNICAST:Qt,GOSSIP:_t,LOG_CSS:gt}});var tn,en,kr=pt(async()=>{await Ot();tn=class{sandbox;SIGNAL_OFFER_TIMEOUT=3e4;SIGNAL_ANSWER_TIMEOUT=1e4;PENDING_OFFERS={};PENDING_ANSWERS={};sdpToBuild=[];signalsToDigest=[];constructor(t){this.sandbox=t}tick(){let t=Date.now();this.#e(t);let e=this.sdpToBuild;this.sdpToBuild=[];for(let{transportId:r,type:s,time:o}of e){if(o>t){this.sdpToBuild.push({transportId:r,type:s,time:o});continue}let f=this.sandbox.transportInstances[r];if(!f||f.destroying||f.destroyed)continue;let{success:h,signalData:c,reason:u}=this.#t(r,s);!h||!c?f.dispatchError(u||`Failed to build SDP for peer: ${this.id}`):f.callbacks.signal?.forEach(E=>E(c))}let n=this.signalsToDigest;this.signalsToDigest=[];for(let{signalData:r,receiverId:s}of n){let o=this.sandbox.transportInstances[s];if(!o||o.destroying||o.destroyed)continue;let{success:f,reason:h}=this.#n(r,s);f||o.dispatchError(h||`Failed to digest signal for peer: ${this.id}`)}}#e(t=Date.now()){for(let e in this.PENDING_OFFERS)for(let n in this.PENDING_OFFERS[e])t>this.PENDING_OFFERS[e][n].expiration&&delete this.PENDING_OFFERS[e][n];for(let e in this.PENDING_ANSWERS){let n=this.PENDING_ANSWERS[e];t>n.expiration&&delete this.PENDING_ANSWERS[e]}}#t(t,e){if(e!=="offer"&&e!=="answer")return{success:!1,signalData:null,reason:`Invalid signal type: ${e}.`};if(e==="answer"&&this.PENDING_ANSWERS[t])return{success:!1,signalData:null,reason:`There is already a pending answer for transport ID: ${t}`};let n=e==="offer"?this.SIGNAL_OFFER_TIMEOUT:this.SIGNAL_ANSWER_TIMEOUT||1e4,r=Math.random().toString(36).substring(2),s={transportId:t,expiration:Date.now()+n,type:e,sdp:{id:r,v:"0",o:`- ${Math.random().toString(36).substring(2)} ${Math.floor(Math.random()*1e6)} 2 IN IP4 127.0.0.1\r
3
+ `,s:"-",t:"0 0",a:["group:BUNDLE..."]}};return e==="offer"&&this.PENDING_OFFERS[t]?.[r]?{success:!1,signalData:null,reason:`There is already a pending offer with the same SDP ID for transport ID: ${t} (extreme case)`}:(e==="offer"&&!this.PENDING_OFFERS[t]&&(this.PENDING_OFFERS[t]={}),e==="offer"&&(this.PENDING_OFFERS[t][r]=s),e==="answer"&&(this.PENDING_ANSWERS[t]=s),{success:!0,signalData:s,reason:"na"})}#n(t,e){let{transportId:n,type:r,sdp:s}=t;if(n===void 0)return{success:!1,reason:"Missing transportId in signal data."};if(r!=="offer"&&r!=="answer")return{success:!1,reason:`Invalid signal type: ${r}.`};if(r==="offer"&&(!this.PENDING_OFFERS[n]||!this.PENDING_OFFERS[n][s.id]))return{success:!1,reason:`No pending offer found for transport ID: ${n} with SDP ID: ${s.id}`};if(r==="answer"&&(!this.PENDING_ANSWERS[n]||this.PENDING_ANSWERS[n].sdp.id!==s.id))return{success:!1,reason:`No pending answer found for transport ID: ${n} with SDP ID: ${s.id}`};if(r==="offer"&&Math.random()<Nt.ICE_OFFER_FAILURE_RATE)return{success:!1,reason:`Simulated failure for 'offer' signal from ${n} to ${e}`};if(r==="answer"&&Math.random()<Nt.ICE_ANSWER_FAILURE_RATE)return{success:!1,reason:`Simulated failure for 'answer' signal from ${n} to ${e}`};if(r==="offer")return this.buildSDP(e,"answer"),{success:!0,reason:"na"};delete this.PENDING_OFFERS[e],delete this.PENDING_ANSWERS[n];let o=this.sandbox.linkInstances(e,n);return{success:!o,reason:o||"na"}}buildSDP(t,e){let n={min:Nt.ICE_DELAY.min,max:Nt.ICE_DELAY.max},r=Math.floor(Math.random()*(n.max-n.min+1))+n.min;this.sdpToBuild.push({transportId:t,type:e,time:Date.now()+r})}digestSignal(t,e){this.signalsToDigest.push({signalData:t,receiverId:e})}},en=class{verbose=Ct.DEFAULT_VERBOSE;wsGlobalIndex=1;tGlobalIndex=1;transportInstances={};wsConnections={};publicWsServers={};inscribeWebSocketServer(t,e){this.publicWsServers[t]=e}removeWebSocketServer(t){delete this.publicWsServers[t]}inscribeWsConnection(t){let e=(this.wsGlobalIndex++).toString();t.id=e,this.wsConnections[e]=t,this.verbose>3&&console.log(`[SANDBOX] Inscribed wsConnection: ${t.id}`)}connectToWebSocketServer(t,e,n){let r=this.wsConnections[e],s=this.publicWsServers[t];if(!r||!s||s.closing||s.clients.size>=s.maxClients)return;let o=new n(s,e);s.clients.add(o),o.init(r.id),s.callbacks.connection.forEach(f=>f(o)),r.init(o.id)}inscribeInstance(t){let e=(this.tGlobalIndex++).toString();t.id=e,this.transportInstances[e]=t,this.verbose>3&&console.log(`[SANDBOX] Inscribed transport: ${e}`)}linkInstances(t,e){let[n,r]=[this.transportInstances[t],this.transportInstances[e]];if(!n||!r)return`Missing transport instances: ${t}=>${!!n}, ${e}=>${!!r}`;if(n.initiator&&r.initiator)return`Both transport instances cannot be initiators: ${t}, ${e}`;if(n.destroying||r.destroying)return`One of the transport instances is destroying: ${t}=>${n.destroying}, ${e}=>${r.destroying}`;if(n.destroyed||r.destroyed)return`One of the transport instances is destroyed: ${t}=>${n.destroyed}, ${e}=>${r.destroyed}`;if(n.remoteId)return`Transport instance tA: ${t} is already linked to remoteId: ${n.remoteId}`;if(r.remoteId)return`Transport instance tB: ${e} is already linked to remoteId: ${r.remoteId}`;n.remoteId=e,r.remoteId=t,this.verbose>2&&console.log(`[SANDBOX] Linked transports: ${t} <-> ${e}`),n.callbacks.connect.forEach(s=>s()),r.callbacks.connect.forEach(s=>s())}sendData(t,e,n){if(t===void 0)return{success:!1,reason:`Cannot send message from id: ${t}`};if(e===void 0)return{success:!1,reason:`Cannot send message to id: ${e}`};let r=this.transportInstances[t];if(!r)return{success:!1,reason:`No transport instance found for id: ${t}`};if(!r.remoteId)return{success:!1,reason:`Transport instance ${t} is not linked to any remoteId`};if(r.id!==t)return{success:!1,reason:`Wrong id for senderInstance ${t} !== ${r.id}`};if(r.remoteId!==e)return{success:!1,reason:`Transport instance ${t} is not linked to remoteId: ${e}`};let s=this.transportInstances[e];return s?s.remoteId?s.id!==e?{success:!1,reason:`Wrong id for remoteInstance ${t} !== ${e}`}:s.remoteId!==t?{success:!1,reason:`Transport instance ${t} is not linked to remoteId: ${e}`}:(this.enqueueTransportData(t,e,n),{success:!0,reason:"na"}):{success:!1,reason:`Transport instance ${e} is not linked to any remoteId`}:{success:!1,reason:`No transport instance found for id: ${e}`}}destroyTransportAndAssociatedTransport(t){let e=this.transportInstances[t];if(!e)return;let n=e.remoteId,r=n?this.transportInstances[n]:null;this.verbose>3&&console.log(`[SANDBOX] Destroying transports: ${t}`),e&&r&&(this.verbose>2&&console.log(`[SANDBOX] Destroying linked transports: ${t} & ${n}`),delete this.transportInstances[n],r.destroy(`Remote transport instance ${t} closed the connection.`)),delete this.transportInstances[t],e.close()}batchSize=2500;messageQueueSync=[];queueIndex=0;messageQueue=new Array(1e5);queueStart=0;queueEnd=0;queueCount=0;processMessageQueueSync(){let t=this.messageQueueSync.length;if(t===0)return;let e=this.batchSize;t>this.batchSize*3&&(e=this.batchSize*1.5),t>this.batchSize*5&&(e=this.batchSize*2),t>this.batchSize*10&&(e=this.batchSize*3),t>this.batchSize*20&&(e=this.batchSize*5),e=Math.round(e);let n=Math.min(this.queueIndex+e,t);for(let s=this.queueIndex;s<n;s++){let[o,f,h,c]=this.messageQueueSync[s];o==="transport_data"?this.#e(f,h,c):o==="ws_message"&&this.#t(f,h,c)}if(this.queueIndex=n,this.queueIndex<5e3)return;let r=this.messageQueueSync.length>5e4;r&&console.warn(`[SANDBOX] Message queue is very long: ${this.messageQueueSync.length} messages pending.`),r&&(this.queueIndex+=this.batchSize),this.messageQueueSync=this.messageQueueSync.slice(this.queueIndex),this.queueIndex=0}async processMessageQueue(){if(this.queueCount===0)return;let t=this.batchSize;this.queueCount>this.batchSize*3&&(t=this.batchSize*1.5),this.queueCount>this.batchSize*5&&(t=this.batchSize*2),this.queueCount>this.batchSize*10&&(t=this.batchSize*3),this.queueCount>this.batchSize*20&&(t=this.batchSize*5);let e=Math.min(t,this.queueCount);for(let n=0;n<e;n++){let r=this.messageQueue[this.queueStart];this.queueStart=(this.queueStart+1)%this.messageQueue.length;let[s,o,f,h]=r;s==="transport_data"?this.#e(o,f,h):s==="ws_message"&&this.#t(o,f,h)}await new Promise(n=>setTimeout(n,0)),this.queueCount-=e}#e(t,e,n){let[r,s]=[this.transportInstances[t],this.transportInstances[e]];if(!r||!s||r.destroying||s.destroying){r?.close(),s?.close();return}if(r.destroyed){s.close();return}if(s.destroyed){r.close();return}for(let o of s.callbacks.data)o(n)}#t(t,e,n){let[r,s]=[this.wsConnections[t],this.wsConnections[e]];if(!s||!r||s.readyState!==1||r.readyState!==1){s?.close(),r?.close();return}if(s.onmessage)s.onmessage({data:n});else for(let o of s.callbacks.message)o(n)}enqueueTransportDataSync(t,e,n){this.messageQueueSync.push(["transport_data",t,e,n])}enqueueWsMessageSync(t,e,n){this.messageQueueSync.push(["ws_message",t,e,n])}enqueueTransportData(t,e,n){this.messageQueue[this.queueEnd]=["transport_data",t,e,n],this.queueEnd=(this.queueEnd+1)%this.messageQueue.length,this.queueCount++,this.queueCount===this.messageQueue.length&&(console.error("[SANDBOX] Message queue overflow, dropping oldest messages."),this.queueStart=(this.queueStart+this.batchSize)%this.messageQueue.length,this.queueCount-=this.batchSize)}enqueueWsMessage(t,e,n){this.messageQueue[this.queueEnd]=["ws_message",t,e,n],this.queueEnd=(this.queueEnd+1)%this.messageQueue.length,this.queueCount++,this.queueCount===this.messageQueue.length&&(console.error("[SANDBOX] Message queue overflow, dropping oldest messages."),this.queueStart=(this.queueStart+this.batchSize)%this.messageQueue.length,this.queueCount-=this.batchSize)}}});var sn={};ke(sn,{ICE_CANDIDATE_EMITTER:()=>Pn,SANDBOX:()=>Tt,TEST_WS_EVENT_MANAGER:()=>nn,TestTransport:()=>Hn,TestWsConnection:()=>rn,TestWsServer:()=>Gn});var On,rn,Gn,Hn,Tt,Pn,nn,on=pt(async()=>{await Ot();await kr();On=class{toInit=[];toClose=[];toError=[];initTick(){if(this.toInit.length<=0)return;let t=Date.now(),e=this.toInit;this.toInit=[];for(let{connId:n,time:r}of e)r>t?this.toInit.push({connId:n,time:r}):this.#e(n)}closeTick(){if(this.toClose.length<=0)return;let t=Date.now(),e=this.toClose;this.toClose=[];for(let{wsId:n,remoteWsId:r,time:s}of e)s>t?this.toClose.push({wsId:n,remoteWsId:r,time:s}):this.#t(n,r)}cleanerTick(){let t=Date.now();for(let e of Object.values(Tt.publicWsServers))for(let n of e.clients)n.readyState===3&&e.clients.delete(n)}errorTick(){if(this.toError.length<=0)return;let t=Date.now(),e=this.toError;this.toError=[];for(let{wsId:n,error:r,time:s}of e)s>t?this.toError.push({wsId:n,error:r,time:s}):Tt.wsConnections[n]?.dispatchError(r)}#e(t){let e=Tt.wsConnections[t];e&&Tt.connectToWebSocketServer(e.url,e.id,rn)}#t(t,e){let n=Tt.wsConnections[t],r=Tt.wsConnections[e];n?.onclose?.(),r?.onclose?.();for(let s of n?.callbacks?.close||[])s();for(let s of r?.callbacks?.close||[])s()}scheduleInit(t,e=500){this.toInit.push({connId:t,time:Date.now()+e})}scheduleClose(t,e,n=100){this.toClose.push({wsId:t,remoteWsId:e,time:Date.now()+n})}scheduleError(t,e,n=100){this.toError.push({wsId:t,error:e,time:Date.now()+n})}},rn=class{id;isTestTransport=!0;remoteWsId=null;remoteId=!1;delayBeforeConnectionTry=500;readyState=0;url;callbacks={message:[],close:[],error:[]};onmessage;onopen;onclose;onerror;constructor(t="ws://...",e){Tt.inscribeWsConnection(this),!e&&(this.url=t,nn.scheduleInit(this.id,this.delayBeforeConnectionTry))}init(t){if(!this.readyState===3||this.remoteWsId){this.close(),console.error(`WebSocket instance already closed or connected: ${this.id}`),nn.scheduleError(this.id,`Failed to connect to WebSocket server at ${this.url}`,1e3);return}this.remoteWsId=t,this.readyState=1,this.onopen&&this.onopen()}on(t,e){if(!this.callbacks[t])return console.error(`Unknown event: ${t}`);this.callbacks[t].push(e)}close(){if(this.readyState===3)return;this.readyState=3;let t=Tt.wsConnections[this.remoteWsId];t&&(t.readyState=3),this.remoteWsId&&nn.scheduleClose(this.id,this.remoteWsId,100)}send(t){if(!this.remoteWsId){console.error(`No WebSocket server found for URL: ${this.url}`),this.close();return}Tt.enqueueWsMessage(this.id,this.remoteWsId,t)}dispatchError(t){this.callbacks.error.forEach(e=>e(t)),this.onerror&&this.onerror(t)}},Gn=class{url;clients=new Set;maxClients=Yt.MAX_WS_IN_CONNS||20;callbacks={connection:[],close:[],error:[]};constructor(t={port,host:domain}){this.url=`ws://${t.host}:${t.port}`,Tt.inscribeWebSocketServer(this.url,this)}on(t,e){if(!this.callbacks[t])return console.error(`Unknown event: ${t}`);this.callbacks[t].push(e)}close(){if(!this.closing){this.closing=!0,Tt.removeWebSocketServer(this.url);for(let t of this.callbacks.close)t()}}},Hn=class{destroying;destroyed;id=null;isTestTransport=!0;remoteId=null;remoteWsId=!1;callbacks={connect:[],close:[],data:[],signal:[],error:[]};initiator;trickle;wrtc;constructor(t={initiator:!1,trickle:!0,wrtc:null,timeout:5e3}){Tt.inscribeInstance(this),this.initiator=t.initiator,this.trickle=t.trickle,this.wrtc=t.wrtc,this.initiator&&Pn.buildSDP(this.id,"offer")}on(t,e){this.callbacks[t]&&this.callbacks[t].push(e)}dispatchError(t){this.callbacks.error.forEach(e=>e(new Error(t)))}signal(t){if(!this.destroying){if(this.destroyed)throw new Error(`Transport instance already destroyed: ${this.id}`);if(this.remoteId)return this.dispatchError(`Transport instance already connected to a remote ID: ${this.remoteId}`);if(!t.sdp||!t.sdp.id)return this.dispatchError("Invalid remote SDP:",t);if(t.type==="answer"&&!this.initiator)return this.dispatchError("Invalid remote SDP type: expecting an answer.");if(t.type==="offer"&&this.initiator)return this.dispatchError("Invalid remote SDP type: expecting an offer.");Pn.digestSignal(t,this.id)}}send(t){let{success:e,reason:n}=Tt.sendData(this.id,this.remoteId,t);e||this.destroy(n)}close(){this.destroy()}destroy(t=null){this.destroying||(this.destroying=!0,t&&this.dispatchError(t),this.callbacks.close?.forEach(e=>e()),Tt.destroyTransportAndAssociatedTransport(this.id),this.destroyed=!0,this.destroying=!1)}},Tt=new en,Pn=new tn(Tt),nn=new On});function Qe(a){return a instanceof Uint8Array||ArrayBuffer.isView(a)&&a.constructor.name==="Uint8Array"}function be(a,t=""){if(!Number.isSafeInteger(a)||a<0){let e=t&&`"${t}" `;throw new Error(`${e}expected integer >= 0, got ${a}`)}}function it(a,t,e=""){let n=Qe(a),r=a?.length,s=t!==void 0;if(!n||s&&r!==t){let o=e&&`"${e}" `,f=s?` of length ${t}`:"",h=n?`length=${r}`:`type=${typeof a}`;throw new Error(o+"expected Uint8Array"+f+", got "+h)}return a}function Jn(a,t=!0){if(a.destroyed)throw new Error("Hash instance has been destroyed");if(t&&a.finished)throw new Error("Hash#digest() has already been called")}function Or(a,t){it(a,void 0,"digestInto() output");let e=t.outputLen;if(a.length<e)throw new Error('"digestInto() output" expected to be of length >='+e)}function Oe(...a){for(let t=0;t<a.length;t++)a[t].fill(0)}function ln(a){return new DataView(a.buffer,a.byteOffset,a.byteLength)}function se(a){if(it(a),Gr)return a.toHex();let t="";for(let e=0;e<a.length;e++)t+=Gs[a[e]];return t}function Mr(a){if(a>=Vt._0&&a<=Vt._9)return a-Vt._0;if(a>=Vt.A&&a<=Vt.F)return a-(Vt.A-10);if(a>=Vt.a&&a<=Vt.f)return a-(Vt.a-10)}function oe(a){if(typeof a!="string")throw new Error("hex string expected, got "+typeof a);if(Gr)return Uint8Array.fromHex(a);let t=a.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(e);for(let r=0,s=0;r<e;r++,s+=2){let o=Mr(a.charCodeAt(s)),f=Mr(a.charCodeAt(s+1));if(o===void 0||f===void 0){let h=a[s]+a[s+1];throw new Error('hex string expected, got non-hex character "'+h+'" at index '+s)}n[r]=o*16+f}return n}function It(...a){let t=0;for(let n=0;n<a.length;n++){let r=a[n];it(r),t+=r.length}let e=new Uint8Array(t);for(let n=0,r=0;n<a.length;n++){let s=a[n];e.set(s,r),r+=s.length}return e}function Hr(a,t={}){let e=(r,s)=>a(s).update(r).digest(),n=a(void 0);return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=r=>a(r),Object.assign(e,t),Object.freeze(e)}function Ft(a=32){let t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return t.getRandomValues(new Uint8Array(a))}var Gr,Gs,Vt,Pr,we=pt(()=>{Gr=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Gs=Array.from({length:256},(a,t)=>t.toString(16).padStart(2,"0"));Vt={_0:48,_9:57,A:65,F:70,a:97,f:102};Pr=a=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,a])})});var dn,xt,Yr=pt(()=>{we();dn=class{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,e,n,r){this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(t),this.view=ln(this.buffer)}update(t){Jn(this),it(t);let{view:e,buffer:n,blockLen:r}=this,s=t.length;for(let o=0;o<s;){let f=Math.min(r-this.pos,s-o);if(f===r){let h=ln(t);for(;r<=s-o;o+=r)this.process(h,o);continue}n.set(t.subarray(o,o+f),this.pos),this.pos+=f,o+=f,this.pos===r&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Jn(this),Or(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:r,isLE:s}=this,{pos:o}=this;e[o++]=128,Oe(this.buffer.subarray(o)),this.padOffset>r-o&&(this.process(n,0),o=0);for(let E=o;E<r;E++)e[E]=0;n.setBigUint64(r-8,BigInt(this.length*8),s),this.process(n,0);let f=ln(t),h=this.outputLen;if(h%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let c=h/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let E=0;E<c;E++)f.setUint32(4*E,u[E],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||=new this.constructor,t.set(...this.get());let{blockLen:e,buffer:n,length:r,finished:s,destroyed:o,pos:f}=this;return t.destroyed=o,t.finished=s,t.length=r,t.pos=f,r%e&&t.buffer.set(n),t}clone(){return this._cloneInto()}},xt=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])});function Hs(a,t=!1){return t?{h:Number(a&In),l:Number(a>>qr&In)}:{h:Number(a>>qr&In)|0,l:Number(a&In)|0}}function Kr(a,t=!1){let e=a.length,n=new Uint32Array(e),r=new Uint32Array(e);for(let s=0;s<e;s++){let{h:o,l:f}=Hs(a[s],t);[n[s],r[s]]=[o,f]}return[n,r]}function qt(a,t,e,n){let r=(t>>>0)+(n>>>0);return{h:a+e+(r/2**32|0)|0,l:r|0}}var In,qr,Wn,jn,Ae,ae,Ge,He,Jr,Wr,jr,Vr,Xr,$r,Zr=pt(()=>{In=BigInt(4294967295),qr=BigInt(32);Wn=(a,t,e)=>a>>>e,jn=(a,t,e)=>a<<32-e|t>>>e,Ae=(a,t,e)=>a>>>e|t<<32-e,ae=(a,t,e)=>a<<32-e|t>>>e,Ge=(a,t,e)=>a<<64-e|t>>>e-32,He=(a,t,e)=>a>>>e-32|t<<64-e;Jr=(a,t,e)=>(a>>>0)+(t>>>0)+(e>>>0),Wr=(a,t,e,n)=>t+e+n+(a/2**32|0)|0,jr=(a,t,e,n)=>(a>>>0)+(t>>>0)+(e>>>0)+(n>>>0),Vr=(a,t,e,n,r)=>t+e+n+r+(a/2**32|0)|0,Xr=(a,t,e,n,r)=>(a>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),$r=(a,t,e,n,r,s)=>t+e+n+r+s+(a/2**32|0)|0});var zr,Ys,qs,zt,te,Vn,Xn,ce,ti=pt(()=>{Yr();Zr();we();zr=Kr(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(a=>BigInt(a))),Ys=zr[0],qs=zr[1],zt=new Uint32Array(80),te=new Uint32Array(80),Vn=class extends dn{constructor(t){super(128,t,16,!1)}get(){let{Ah:t,Al:e,Bh:n,Bl:r,Ch:s,Cl:o,Dh:f,Dl:h,Eh:c,El:u,Fh:E,Fl:l,Gh:y,Gl:C,Hh:Q,Hl:S}=this;return[t,e,n,r,s,o,f,h,c,u,E,l,y,C,Q,S]}set(t,e,n,r,s,o,f,h,c,u,E,l,y,C,Q,S){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=r|0,this.Ch=s|0,this.Cl=o|0,this.Dh=f|0,this.Dl=h|0,this.Eh=c|0,this.El=u|0,this.Fh=E|0,this.Fl=l|0,this.Gh=y|0,this.Gl=C|0,this.Hh=Q|0,this.Hl=S|0}process(t,e){for(let p=0;p<16;p++,e+=4)zt[p]=t.getUint32(e),te[p]=t.getUint32(e+=4);for(let p=16;p<80;p++){let _=zt[p-15]|0,w=te[p-15]|0,x=Ae(_,w,1)^Ae(_,w,8)^Wn(_,w,7),N=ae(_,w,1)^ae(_,w,8)^jn(_,w,7),b=zt[p-2]|0,m=te[p-2]|0,v=Ae(b,m,19)^Ge(b,m,61)^Wn(b,m,6),M=ae(b,m,19)^He(b,m,61)^jn(b,m,6),D=jr(N,M,te[p-7],te[p-16]),T=Vr(D,x,v,zt[p-7],zt[p-16]);zt[p]=T|0,te[p]=D|0}let{Ah:n,Al:r,Bh:s,Bl:o,Ch:f,Cl:h,Dh:c,Dl:u,Eh:E,El:l,Fh:y,Fl:C,Gh:Q,Gl:S,Hh:g,Hl:B}=this;for(let p=0;p<80;p++){let _=Ae(E,l,14)^Ae(E,l,18)^Ge(E,l,41),w=ae(E,l,14)^ae(E,l,18)^He(E,l,41),x=E&y^~E&Q,N=l&C^~l&S,b=Xr(B,w,N,qs[p],te[p]),m=$r(b,g,_,x,Ys[p],zt[p]),v=b|0,M=Ae(n,r,28)^Ge(n,r,34)^Ge(n,r,39),D=ae(n,r,28)^He(n,r,34)^He(n,r,39),T=n&s^n&f^s&f,L=r&o^r&h^o&h;g=Q|0,B=S|0,Q=y|0,S=C|0,y=E|0,C=l|0,{h:E,l}=qt(c|0,u|0,m|0,v|0),c=f|0,u=h|0,f=s|0,h=o|0,s=n|0,o=r|0;let G=Jr(v,D,L);n=Wr(G,m,M,T),r=G|0}({h:n,l:r}=qt(this.Ah|0,this.Al|0,n|0,r|0)),{h:s,l:o}=qt(this.Bh|0,this.Bl|0,s|0,o|0),{h:f,l:h}=qt(this.Ch|0,this.Cl|0,f|0,h|0),{h:c,l:u}=qt(this.Dh|0,this.Dl|0,c|0,u|0),{h:E,l}=qt(this.Eh|0,this.El|0,E|0,l|0),{h:y,l:C}=qt(this.Fh|0,this.Fl|0,y|0,C|0),{h:Q,l:S}=qt(this.Gh|0,this.Gl|0,Q|0,S|0),{h:g,l:B}=qt(this.Hh|0,this.Hl|0,g|0,B|0),this.set(n,r,s,o,f,h,c,u,E,l,y,C,Q,S,g,B)}roundClean(){Oe(zt,te)}destroy(){Oe(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Xn=class extends Vn{Ah=xt[0]|0;Al=xt[1]|0;Bh=xt[2]|0;Bl=xt[3]|0;Ch=xt[4]|0;Cl=xt[5]|0;Dh=xt[6]|0;Dl=xt[7]|0;Eh=xt[8]|0;El=xt[9]|0;Fh=xt[10]|0;Fl=xt[11]|0;Gh=xt[12]|0;Gl=xt[13]|0;Hh=xt[14]|0;Hl=xt[15]|0;constructor(){super(64)}},ce=Hr(()=>new Xn,Pr(3))});function pn(a,t=""){if(typeof a!="boolean"){let e=t&&`"${t}" `;throw new Error(e+"expected boolean, got type="+typeof a)}return a}function Ks(a){if(typeof a=="bigint"){if(!En(a))throw new Error("positive bigint expected, got "+a)}else be(a);return a}function fe(a,t=""){if(!Number.isSafeInteger(a)){let e=t&&`"${t}" `;throw new Error(e+"expected safe integer, got type="+typeof a)}}function ei(a){if(typeof a!="string")throw new Error("hex string expected, got "+typeof a);return a===""?Zn:BigInt("0x"+a)}function he(a){return ei(se(a))}function Ut(a){return ei(se(ge(it(a)).reverse()))}function ue(a,t){be(t),a=Ks(a);let e=oe(a.toString(16).padStart(t*2,"0"));if(e.length!==t)throw new Error("number too large");return e}function Pe(a,t){return ue(a,t).reverse()}function ni(a,t){if(a.length!==t.length)return!1;let e=0;for(let n=0;n<a.length;n++)e|=a[n]^t[n];return e===0}function ge(a){return Uint8Array.from(a)}function kt(a){return Uint8Array.from(a,(t,e)=>{let n=t.charCodeAt(0);if(t.length!==1||n>127)throw new Error(`string contains non-ASCII character "${a[e]}" with code ${n} at position ${e}`);return n})}function Js(a,t,e){return En(a)&&En(t)&&En(e)&&t<=a&&a<e}function me(a,t,e,n){if(!Js(t,e,n))throw new Error("expected valid "+a+": "+e+" <= n < "+n+", got "+t)}function ri(a){let t;for(t=0;a>Zn;a>>=$n,t+=1);return t}function Pt(a,t={},e={}){if(!a||typeof a!="object")throw new Error("expected valid options object");function n(s,o,f){let h=a[s];if(f&&h===void 0)return;let c=typeof h;if(c!==o||h===null)throw new Error(`param "${s}" is invalid: expected ${o}, got ${c}`)}let r=(s,o)=>Object.entries(s).forEach(([f,h])=>n(f,h,o));r(t,!1),r(e,!0)}function er(a){let t=new WeakMap;return(e,...n)=>{let r=t.get(e);if(r!==void 0)return r;let s=a(e,...n);return t.set(e,s),s}}var Zn,$n,En,zn,tr,ee=pt(()=>{we();we();Zn=BigInt(0),$n=BigInt(1);En=a=>typeof a=="bigint"&&Zn<=a;zn=a=>($n<<BigInt(a))-$n;tr=()=>{throw new Error("not implemented")}});function ht(a,t){let e=a%t;return e>=Lt?e:t+e}function Ht(a,t,e){let n=a;for(;t-- >Lt;)n*=n,n%=e;return n}function ii(a,t){if(a===Lt)throw new Error("invert: expected non-zero number");if(t<=Lt)throw new Error("invert: expected positive modulus, got "+t);let e=ht(a,t),n=t,r=Lt,s=bt,o=bt,f=Lt;for(;e!==Lt;){let c=n/e,u=n%e,E=r-o*c,l=s-f*c;n=e,e=u,r=o,s=f,o=E,f=l}if(n!==bt)throw new Error("invert: does not exist");return ht(r,t)}function rr(a,t,e){if(!a.eql(a.sqr(t),e))throw new Error("Cannot find square root")}function hi(a,t){let e=(a.ORDER+bt)/Ai,n=a.pow(t,e);return rr(a,n,t),n}function Vs(a,t){let e=(a.ORDER-ai)/ci,n=a.mul(t,le),r=a.pow(n,e),s=a.mul(t,r),o=a.mul(a.mul(s,le),r),f=a.mul(s,a.sub(o,a.ONE));return rr(a,f,t),f}function Xs(a){let t=Bn(a),e=ui(a),n=e(t,t.neg(t.ONE)),r=e(t,n),s=e(t,t.neg(n)),o=(a+Ws)/fi;return(f,h)=>{let c=f.pow(h,o),u=f.mul(c,n),E=f.mul(c,r),l=f.mul(c,s),y=f.eql(f.sqr(u),h),C=f.eql(f.sqr(E),h);c=f.cmov(c,u,y),u=f.cmov(l,E,C);let Q=f.eql(f.sqr(u),h),S=f.cmov(c,u,Q);return rr(f,S,h),S}}function ui(a){if(a<oi)throw new Error("sqrt is not defined for small field");let t=a-bt,e=0;for(;t%le===Lt;)t/=le,e++;let n=le,r=Bn(a);for(;si(r,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return hi;let s=r.pow(n,t),o=(t+bt)/le;return function(h,c){if(h.is0(c))return c;if(si(h,c)!==1)throw new Error("Cannot find square root");let u=e,E=h.mul(h.ONE,s),l=h.pow(c,t),y=h.pow(c,o);for(;!h.eql(l,h.ONE);){if(h.is0(l))return h.ZERO;let C=1,Q=h.sqr(l);for(;!h.eql(Q,h.ONE);)if(C++,Q=h.sqr(Q),C===u)throw new Error("Cannot find square root");let S=bt<<BigInt(u-C-1),g=h.pow(E,S);u=C,E=h.sqr(g),l=h.mul(l,E),y=h.mul(y,g)}return y}}function $s(a){return a%Ai===oi?hi:a%ci===ai?Vs:a%fi===js?Xs(a):ui(a)}function gi(a){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},e=Zs.reduce((n,r)=>(n[r]="function",n),t);return Pt(a,e),a}function zs(a,t,e){if(e<Lt)throw new Error("invalid exponent, negatives unsupported");if(e===Lt)return a.ONE;if(e===bt)return t;let n=a.ONE,r=t;for(;e>Lt;)e&bt&&(n=a.mul(n,r)),r=a.sqr(r),e>>=bt;return n}function Se(a,t,e=!1){let n=new Array(t.length).fill(e?a.ZERO:void 0),r=t.reduce((o,f,h)=>a.is0(f)?o:(n[h]=o,a.mul(o,f)),a.ONE),s=a.inv(r);return t.reduceRight((o,f,h)=>a.is0(f)?o:(n[h]=a.mul(o,n[h]),a.mul(o,f)),s),n}function si(a,t){let e=(a.ORDER-bt)/le,n=a.pow(t,e),r=a.eql(n,a.ONE),s=a.eql(n,a.ZERO),o=a.eql(n,a.neg(a.ONE));if(!r&&!s&&!o)throw new Error("invalid Legendre symbol result");return r?1:s?0:-1}function to(a,t){t!==void 0&&be(t);let e=t!==void 0?t:a.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function Bn(a,t={}){return new nr(a,t)}function li(a,t){if(!a.isOdd)throw new Error("Field doesn't have isOdd");let e=a.sqrt(t);return a.isOdd(e)?a.neg(e):e}function di(a){if(typeof a!="bigint")throw new Error("field order must be bigint");let t=a.toString(2).length;return Math.ceil(t/8)}function ir(a){let t=di(a);return t+Math.ceil(t/2)}function Ii(a,t,e=!1){it(a);let n=a.length,r=di(t),s=ir(t);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);let o=e?Ut(a):he(a),f=ht(o,t-bt)+bt;return e?Pe(f,r):ue(f,r)}var Lt,bt,le,oi,Ai,ai,Ws,ci,js,fi,Xt,Zs,nr,_e=pt(()=>{ee();Lt=BigInt(0),bt=BigInt(1),le=BigInt(2),oi=BigInt(3),Ai=BigInt(4),ai=BigInt(5),Ws=BigInt(7),ci=BigInt(8),js=BigInt(9),fi=BigInt(16);Xt=(a,t)=>(ht(a,t)&bt)===bt,Zs=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];nr=class{ORDER;BITS;BYTES;isLE;ZERO=Lt;ONE=bt;_lengths;_sqrt;_mod;constructor(t,e={}){if(t<=Lt)throw new Error("invalid field: expected ORDER > 0, got "+t);let n;this.isLE=!1,e!=null&&typeof e=="object"&&(typeof e.BITS=="number"&&(n=e.BITS),typeof e.sqrt=="function"&&(this.sqrt=e.sqrt),typeof e.isLE=="boolean"&&(this.isLE=e.isLE),e.allowedLengths&&(this._lengths=e.allowedLengths?.slice()),typeof e.modFromBytes=="boolean"&&(this._mod=e.modFromBytes));let{nBitLength:r,nByteLength:s}=to(t,n);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=r,this.BYTES=s,this._sqrt=void 0,Object.preventExtensions(this)}create(t){return ht(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof t);return Lt<=t&&t<this.ORDER}is0(t){return t===Lt}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&bt)===bt}neg(t){return ht(-t,this.ORDER)}eql(t,e){return t===e}sqr(t){return ht(t*t,this.ORDER)}add(t,e){return ht(t+e,this.ORDER)}sub(t,e){return ht(t-e,this.ORDER)}mul(t,e){return ht(t*e,this.ORDER)}pow(t,e){return zs(this,t,e)}div(t,e){return ht(t*ii(e,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,e){return t+e}subN(t,e){return t-e}mulN(t,e){return t*e}inv(t){return ii(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=$s(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?Pe(t,this.BYTES):ue(t,this.BYTES)}fromBytes(t,e=!1){it(t);let{_lengths:n,BYTES:r,isLE:s,ORDER:o,_mod:f}=this;if(n){if(!n.includes(t.length)||t.length>r)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+t.length);let c=new Uint8Array(r);c.set(t,s?0:c.length-t.length),t=c}if(t.length!==r)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+t.length);let h=s?Ut(t):he(t);if(f&&(h=ht(h,o)),!e&&!this.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h}invertBatch(t){return Se(this,t)}cmov(t,e,n){return n?e:t}}});function Ei(a,t){let e=t.negate();return a?e:t}function Qn(a,t){let e=Se(a.Fp,t.map(n=>n.Z));return t.map((n,r)=>a.fromAffine(n.toAffine(e[r])))}function yi(a,t){if(!Number.isSafeInteger(a)||a<=0||a>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+a)}function sr(a,t){yi(a,t);let e=Math.ceil(t/a)+1,n=2**(a-1),r=2**a,s=zn(a),o=BigInt(a);return{windows:e,windowSize:n,mask:s,maxNumber:r,shiftBy:o}}function pi(a,t,e){let{windowSize:n,mask:r,maxNumber:s,shiftBy:o}=e,f=Number(a&r),h=a>>o;f>n&&(f-=s,h+=ar);let c=t*n,u=c+Math.abs(f)-1,E=f===0,l=f<0,y=t%2!==0;return{nextN:h,offset:u,isZero:E,isNeg:l,isNegF:y,offsetF:c}}function eo(a,t){if(!Array.isArray(a))throw new Error("array expected");a.forEach((e,n)=>{if(!(e instanceof t))throw new Error("invalid point at index "+n)})}function no(a,t){if(!Array.isArray(a))throw new Error("array of scalars expected");a.forEach((e,n)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+n)})}function Ar(a){return Qi.get(a)||1}function Bi(a){if(a!==Cn)throw new Error("invalid wNAF")}function bi(a,t,e){let n=a.Fn;eo(t,a),no(e,n);let r=t.length,s=e.length;if(r!==s)throw new Error("arrays of points and scalars must have equal length");let o=a.ZERO,f=ri(BigInt(r)),h=1;f>12?h=f-3:f>4?h=f-2:f>0&&(h=2);let c=zn(h),u=new Array(Number(c)+1).fill(o),E=Math.floor((n.BITS-1)/h)*h,l=o;for(let y=E;y>=0;y-=h){u.fill(o);for(let Q=0;Q<s;Q++){let S=e[Q],g=Number(S>>BigInt(y)&c);u[g]=u[g].add(t[Q])}let C=o;for(let Q=u.length-1,S=o;Q>0;Q--)S=S.add(u[Q]),C=C.add(S);if(l=l.add(C),y!==0)for(let Q=0;Q<h;Q++)l=l.double()}return l}function Ci(a,t,e){if(t){if(t.ORDER!==a)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return gi(t),t}else return Bn(a,{isLE:e})}function wi(a,t,e={},n){if(n===void 0&&(n=a==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${a} CURVE object`);for(let h of["p","n","h"]){let c=t[h];if(!(typeof c=="bigint"&&c>Cn))throw new Error(`CURVE.${h} must be positive bigint`)}let r=Ci(t.p,e.Fp,n),s=Ci(t.n,e.Fn,n),f=["Gx","Gy","a",a==="weierstrass"?"b":"d"];for(let h of f)if(!r.isValid(t[h]))throw new Error(`CURVE.${h} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:r,Fn:s}}function bn(a,t){return function(n){let r=a(n);return{secretKey:r,publicKey:t(r)}}}var Cn,ar,or,Qi,yn,wn=pt(()=>{ee();_e();Cn=BigInt(0),ar=BigInt(1);or=new WeakMap,Qi=new WeakMap;yn=class{BASE;ZERO;Fn;bits;constructor(t,e){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=e}_unsafeLadder(t,e,n=this.ZERO){let r=t;for(;e>Cn;)e&ar&&(n=n.add(r)),r=r.double(),e>>=ar;return n}precomputeWindow(t,e){let{windows:n,windowSize:r}=sr(e,this.bits),s=[],o=t,f=o;for(let h=0;h<n;h++){f=o,s.push(f);for(let c=1;c<r;c++)f=f.add(o),s.push(f);o=f.double()}return s}wNAF(t,e,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let r=this.ZERO,s=this.BASE,o=sr(t,this.bits);for(let f=0;f<o.windows;f++){let{nextN:h,offset:c,isZero:u,isNeg:E,isNegF:l,offsetF:y}=pi(n,f,o);n=h,u?s=s.add(Ei(l,e[y])):r=r.add(Ei(E,e[c]))}return Bi(n),{p:r,f:s}}wNAFUnsafe(t,e,n,r=this.ZERO){let s=sr(t,this.bits);for(let o=0;o<s.windows&&n!==Cn;o++){let{nextN:f,offset:h,isZero:c,isNeg:u}=pi(n,o,s);if(n=f,!c){let E=e[h];r=r.add(u?E.negate():E)}}return Bi(n),r}getPrecomputes(t,e,n){let r=or.get(e);return r||(r=this.precomputeWindow(e,t),t!==1&&(typeof n=="function"&&(r=n(r)),or.set(e,r))),r}cached(t,e,n){let r=Ar(t);return this.wNAF(r,this.getPrecomputes(r,t,n),e)}unsafe(t,e,n,r){let s=Ar(t);return s===1?this._unsafeLadder(t,e,r):this.wNAFUnsafe(s,this.getPrecomputes(s,t,n),e,r)}createCache(t,e){yi(e,this.bits),Qi.set(t,e),or.delete(t)}hasCache(t){return Ar(t)!==1}}});function io(a,t,e,n){let r=a.sqr(e),s=a.sqr(n),o=a.add(a.mul(t.a,r),s),f=a.add(a.ONE,a.mul(t.d,a.mul(r,s)));return a.eql(o,f)}function mi(a,t={}){let e=wi("edwards",a,t,t.FpFnLE),{Fp:n,Fn:r}=e,s=e.CURVE,{h:o}=s;Pt(t,{},{uvRatio:"function"});let f=cr<<BigInt(r.BYTES*8)-wt,h=S=>n.create(S),c=t.uvRatio||((S,g)=>{try{return{isValid:!0,value:n.sqrt(n.div(S,g))}}catch{return{isValid:!1,value:ne}}});if(!io(n,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function u(S,g,B=!1){let p=B?wt:ne;return me("coordinate "+S,g,p,f),g}function E(S){if(!(S instanceof C))throw new Error("EdwardsPoint expected")}let l=er((S,g)=>{let{X:B,Y:p,Z:_}=S,w=S.is0();g==null&&(g=w?ro:n.inv(_));let x=h(B*g),N=h(p*g),b=n.mul(_,g);if(w)return{x:ne,y:wt};if(b!==wt)throw new Error("invZ was invalid");return{x,y:N}}),y=er(S=>{let{a:g,d:B}=s;if(S.is0())throw new Error("bad point: ZERO");let{X:p,Y:_,Z:w,T:x}=S,N=h(p*p),b=h(_*_),m=h(w*w),v=h(m*m),M=h(N*g),D=h(m*h(M+b)),T=h(v+h(B*h(N*b)));if(D!==T)throw new Error("bad point: equation left != right (1)");let L=h(p*_),G=h(w*x);if(L!==G)throw new Error("bad point: equation left != right (2)");return!0});class C{static BASE=new C(s.Gx,s.Gy,wt,h(s.Gx*s.Gy));static ZERO=new C(ne,wt,wt,ne);static Fp=n;static Fn=r;X;Y;Z;T;constructor(g,B,p,_){this.X=u("x",g),this.Y=u("y",B),this.Z=u("z",p,!0),this.T=u("t",_),Object.freeze(this)}static CURVE(){return s}static fromAffine(g){if(g instanceof C)throw new Error("extended point not allowed");let{x:B,y:p}=g||{};return u("x",B),u("y",p),new C(B,p,wt,h(B*p))}static fromBytes(g,B=!1){let p=n.BYTES,{a:_,d:w}=s;g=ge(it(g,p,"point")),pn(B,"zip215");let x=ge(g),N=g[p-1];x[p-1]=N&-129;let b=Ut(x),m=B?f:n.ORDER;me("point.y",b,ne,m);let v=h(b*b),M=h(v-wt),D=h(w*v-_),{isValid:T,value:L}=c(M,D);if(!T)throw new Error("bad point: invalid y coordinate");let G=(L&wt)===wt,q=(N&128)!==0;if(!B&&L===ne&&q)throw new Error("bad point: x=0 and x_0=1");return q!==G&&(L=h(-L)),C.fromAffine({x:L,y:b})}static fromHex(g,B=!1){return C.fromBytes(oe(g),B)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(g=8,B=!0){return Q.createCache(this,g),B||this.multiply(cr),this}assertValidity(){y(this)}equals(g){E(g);let{X:B,Y:p,Z:_}=this,{X:w,Y:x,Z:N}=g,b=h(B*N),m=h(w*_),v=h(p*N),M=h(x*_);return b===m&&v===M}is0(){return this.equals(C.ZERO)}negate(){return new C(h(-this.X),this.Y,this.Z,h(-this.T))}double(){let{a:g}=s,{X:B,Y:p,Z:_}=this,w=h(B*B),x=h(p*p),N=h(cr*h(_*_)),b=h(g*w),m=B+p,v=h(h(m*m)-w-x),M=b+x,D=M-N,T=b-x,L=h(v*D),G=h(M*T),q=h(v*T),P=h(D*M);return new C(L,G,P,q)}add(g){E(g);let{a:B,d:p}=s,{X:_,Y:w,Z:x,T:N}=this,{X:b,Y:m,Z:v,T:M}=g,D=h(_*b),T=h(w*m),L=h(N*p*M),G=h(x*v),q=h((_+w)*(b+m)-D-T),P=G-L,K=G+L,Y=h(T-B*D),$=h(q*P),J=h(K*Y),X=h(q*Y),et=h(P*K);return new C($,J,et,X)}subtract(g){return this.add(g.negate())}multiply(g){if(!r.isValidNot0(g))throw new Error("invalid scalar: expected 1 <= sc < curve.n");let{p:B,f:p}=Q.cached(this,g,_=>Qn(C,_));return Qn(C,[B,p])[0]}multiplyUnsafe(g,B=C.ZERO){if(!r.isValid(g))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return g===ne?C.ZERO:this.is0()||g===wt?this:Q.unsafe(this,g,p=>Qn(C,p),B)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}isTorsionFree(){return Q.unsafe(this,s.n).is0()}toAffine(g){return l(this,g)}clearCofactor(){return o===wt?this:this.multiplyUnsafe(o)}toBytes(){let{x:g,y:B}=this.toAffine(),p=n.toBytes(B);return p[p.length-1]|=g&wt?128:0,p}toHex(){return se(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let Q=new yn(C,r.BITS);return C.BASE.precompute(8),C}function Si(a,t,e={}){if(typeof t!="function")throw new Error('"hash" function param is required');Pt(e,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:n}=e,{BASE:r,Fp:s,Fn:o}=a,f=e.randomBytes||Ft,h=e.adjustScalarBytes||(b=>b),c=e.domain||((b,m,v)=>{if(pn(v,"phflag"),m.length||v)throw new Error("Contexts/pre-hash are not supported");return b});function u(b){return o.create(Ut(b))}function E(b){let m=p.secretKey;it(b,p.secretKey,"secretKey");let v=it(t(b),2*m,"hashedSecretKey"),M=h(v.slice(0,m)),D=v.slice(m,2*m),T=u(M);return{head:M,prefix:D,scalar:T}}function l(b){let{head:m,prefix:v,scalar:M}=E(b),D=r.multiply(M),T=D.toBytes();return{head:m,prefix:v,scalar:M,point:D,pointBytes:T}}function y(b){return l(b).pointBytes}function C(b=Uint8Array.of(),...m){let v=It(...m);return u(t(c(v,it(b,void 0,"context"),!!n)))}function Q(b,m,v={}){b=it(b,void 0,"message"),n&&(b=n(b));let{prefix:M,scalar:D,pointBytes:T}=l(m),L=C(v.context,M,b),G=r.multiply(L).toBytes(),q=C(v.context,G,T,b),P=o.create(L+q*D);if(!o.isValid(P))throw new Error("sign failed: invalid s");let K=It(G,o.toBytes(P));return it(K,p.signature,"result")}let S={zip215:!0};function g(b,m,v,M=S){let{context:D,zip215:T}=M,L=p.signature;b=it(b,L,"signature"),m=it(m,void 0,"message"),v=it(v,p.publicKey,"publicKey"),T!==void 0&&pn(T,"zip215"),n&&(m=n(m));let G=L/2,q=b.subarray(0,G),P=Ut(b.subarray(G,L)),K,Y,$;try{K=a.fromBytes(v,T),Y=a.fromBytes(q,T),$=r.multiplyUnsafe(P)}catch{return!1}if(!T&&K.isSmallOrder())return!1;let J=C(D,Y.toBytes(),K.toBytes(),m);return Y.add(K.multiplyUnsafe(J)).subtract($).clearCofactor().is0()}let B=s.BYTES,p={secretKey:B,publicKey:B,signature:2*B,seed:B};function _(b=f(p.seed)){return it(b,p.seed,"seed")}function w(b){return Qe(b)&&b.length===o.BYTES}function x(b,m){try{return!!a.fromBytes(b,m)}catch{return!1}}let N={getExtendedPublicKey:l,randomSecretKey:_,isValidSecretKey:w,isValidPublicKey:x,toMontgomery(b){let{y:m}=a.fromBytes(b),v=p.publicKey,M=v===32;if(!M&&v!==57)throw new Error("only defined for 25519 and 448");let D=M?s.div(wt+m,wt-m):s.div(m-wt,m+wt);return s.toBytes(D)},toMontgomerySecret(b){let m=p.secretKey;it(b,m);let v=t(b.subarray(0,m));return h(v).subarray(0,m)}};return Object.freeze({keygen:bn(_,y),getPublicKey:y,sign:Q,verify:g,utils:N,Point:a,lengths:p})}var ne,wt,cr,ro,mn,_i=pt(()=>{ee();wn();ne=BigInt(0),wt=BigInt(1),cr=BigInt(2),ro=BigInt(8);mn=class{static BASE;static ZERO;static Fp;static Fn;ep;constructor(t){this.ep=t}static fromBytes(t){tr()}static fromHex(t){tr()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(t){return this.ep.toAffine(t)}toHex(){return se(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(t){return this.assertSame(t),this.init(this.ep.add(t.ep))}subtract(t){return this.assertSame(t),this.init(this.ep.subtract(t.ep))}multiply(t){return this.init(this.ep.multiply(t))}multiplyUnsafe(t){return this.init(this.ep.multiplyUnsafe(t))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(t,e){return this.init(this.ep.precompute(t,e))}}});function re(a,t){if(fe(a),fe(t),a<0||a>=1<<8*t)throw new Error("invalid I2OSP input: "+a);let e=Array.from({length:t}).fill(0);for(let n=t-1;n>=0;n--)e[n]=a&255,a>>>=8;return new Uint8Array(e)}function oo(a,t){let e=new Uint8Array(a.length);for(let n=0;n<a.length;n++)e[n]=a[n]^t[n];return e}function Ri(a){if(!Qe(a)&&typeof a!="string")throw new Error("DST must be Uint8Array or ascii string");return typeof a=="string"?kt(a):a}function Sn(a,t,e,n){it(a),fe(e),t=Ri(t),t.length>255&&(t=n(It(kt("H2C-OVERSIZE-DST-"),t)));let{outputLen:r,blockLen:s}=n,o=Math.ceil(e/r);if(e>65535||o>255)throw new Error("expand_message_xmd: invalid lenInBytes");let f=It(t,re(t.length,1)),h=re(0,s),c=re(e,2),u=new Array(o),E=n(It(h,a,c,re(0,1),f));u[0]=n(It(E,re(1,1),f));for(let y=1;y<=o;y++){let C=[oo(E,u[y-1]),re(y+1,1),f];u[y]=n(It(...C))}return It(...u).slice(0,e)}function Ao(a,t,e,n,r){if(it(a),fe(e),t=Ri(t),t.length>255){let s=Math.ceil(2*n/8);t=r.create({dkLen:s}).update(kt("H2C-OVERSIZE-DST-")).update(t).digest()}if(e>65535||t.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return r.create({dkLen:e}).update(a).update(re(e,2)).update(t).update(re(t.length,1)).digest()}function fr(a,t,e){Pt(e,{p:"bigint",m:"number",k:"number",hash:"function"});let{p:n,k:r,m:s,hash:o,expand:f,DST:h}=e;fe(o.outputLen,"valid hash"),it(a),fe(t);let c=n.toString(2).length,u=Math.ceil((c+r)/8),E=t*s*u,l;if(f==="xmd")l=Sn(a,h,E,o);else if(f==="xof")l=Ao(a,h,E,r,o);else if(f==="_internal_pass")l=a;else throw new Error('expand must be "xmd" or "xof"');let y=new Array(t);for(let C=0;C<t;C++){let Q=new Array(s);for(let S=0;S<s;S++){let g=u*(S+C*s),B=l.subarray(g,g+u);Q[S]=ht(so(B),n)}y[C]=Q}return y}function xi(a,t,e){if(typeof t!="function")throw new Error("mapToCurve() must be defined");function n(s){return a.fromAffine(t(s))}function r(s){let o=s.clearCofactor();return o.equals(a.ZERO)?a.ZERO:(o.assertValidity(),o)}return{defaults:Object.freeze(e),Point:a,hashToCurve(s,o){let f=Object.assign({},e,o),h=fr(s,2,f),c=n(h[0]),u=n(h[1]);return r(c.add(u))},encodeToCurve(s,o){let f=e.encodeDST?{DST:e.encodeDST}:{},h=Object.assign({},e,f,o),c=fr(s,1,h),u=n(c[0]);return r(u)},mapToCurve(s){if(e.m===1){if(typeof s!="bigint")throw new Error("expected bigint (m=1)");return r(n([s]))}if(!Array.isArray(s))throw new Error("expected array of bigints");for(let o of s)if(typeof o!="bigint")throw new Error("expected array of bigints");return r(n(s))},hashToScalar(s,o){let f=a.Fn.ORDER,h=Object.assign({},e,{p:f,m:1,DST:Ye},o);return fr(s,1,h)[0][0]}}}var so,Ye,hr=pt(()=>{ee();_e();so=he;Ye=kt("HashToScalar-")});function ao(a){return Pt(a,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...a})}function Di(a){let t=ao(a),{P:e,type:n,adjustScalarBytes:r,powPminus2:s,randomBytes:o}=t,f=n==="x25519";if(!f&&n!=="x448")throw new Error("invalid type");let h=o||Ft,c=f?255:448,u=f?32:56,E=BigInt(f?9:5),l=BigInt(f?121665:39081),y=f?_n**BigInt(254):_n**BigInt(447),C=f?BigInt(8)*_n**BigInt(251)-Re:BigInt(4)*_n**BigInt(445)-Re,Q=y+C+Re,S=L=>ht(L,e),g=B(E);function B(L){return Pe(S(L),u)}function p(L){let G=ge(it(L,u,"uCoordinate"));return f&&(G[31]&=127),S(Ut(G))}function _(L){return Ut(r(ge(it(L,u,"scalar"))))}function w(L,G){let q=v(p(G),_(L));if(q===qe)throw new Error("invalid private or public key received");return B(q)}function x(L){return w(L,g)}let N=x,b=w;function m(L,G,q){let P=S(L*(G-q));return G=S(G-P),q=S(q+P),{x_2:G,x_3:q}}function v(L,G){me("u",L,qe,e),me("scalar",G,y,Q);let q=G,P=L,K=Re,Y=qe,$=L,J=Re,X=qe;for(let nt=BigInt(c-1);nt>=qe;nt--){let ct=q>>nt&Re;X^=ct,{x_2:K,x_3:$}=m(X,K,$),{x_2:Y,x_3:J}=m(X,Y,J),X=ct;let rt=K+Y,Et=S(rt*rt),lt=K-Y,mt=S(lt*lt),Mt=Et-mt,yt=$+J,vt=$-J,F=S(vt*rt),H=S(yt*lt),V=F+H,O=F-H;$=S(V*V),J=S(P*S(O*O)),K=S(Et*mt),Y=S(Mt*(Et+S(l*Mt)))}({x_2:K,x_3:$}=m(X,K,$)),{x_2:Y,x_3:J}=m(X,Y,J);let et=s(Y);return S(K*et)}let M={secretKey:u,publicKey:u,seed:u},D=(L=h(u))=>(it(L,M.seed,"seed"),L),T={randomSecretKey:D};return Object.freeze({keygen:bn(D,N),getSharedSecret:b,getPublicKey:N,scalarMult:w,scalarMultBase:x,utils:T,GuBytes:g.slice(),lengths:M})}var qe,Re,_n,vi=pt(()=>{ee();wn();_e();qe=BigInt(0),Re=BigInt(1),_n=BigInt(2)});function Ni(a){Pt(a,{name:"string",hash:"function",hashToScalar:"function",hashToGroup:"function"});let{name:t,Point:e,hash:n}=a,{Fn:r}=e,s=(D,T)=>a.hashToGroup(D,{DST:It(kt("HashToGroup-"),T)}),o=(D,T)=>a.hashToScalar(D,{DST:It(Ye,T)}),f=(D=Ft)=>{let T=Ii(D(ir(r.ORDER)),r.ORDER,r.isLE);return r.isLE?Ut(T):he(T)},h=(D,T)=>bi(e,D,T),c=D=>It(kt("OPRFV1-"),new Uint8Array([D]),kt("-"+t)),u=c(0),E=c(1),l=c(2);function y(...D){let T=[];for(let L of D)typeof L=="number"?T.push(ue(L,2)):typeof L=="string"?T.push(kt(L)):(it(L),T.push(ue(L.length,2),L));return It(...T)}let C=(...D)=>n(y(...D,"Finalize"));function Q(D,T,L,G){let q=D.toBytes(),P=n(y(q,It(kt("Seed-"),G))),K=[];for(let Y=0;Y<T.length;Y++){let $=T[Y].toBytes(),J=L[Y].toBytes(),X=o(y(P,Y,$,J,"Composite"),G);K.push(X)}return K}function S(D,T,L,G){let q=Q(D,T,L,G),P=h(T,q),K=h(L,q);return{M:P,Z:K}}function g(D,T,L,G,q){let P=Q(T,L,G,q),K=h(L,P),Y=K.multiply(D);return{M:K,Z:Y}}function B(D,T,L,G,q,P){let[K,Y,$,J,X]=[D,T,L,G,q].map(et=>et.toBytes());return o(y(K,Y,$,J,X,"Challenge"),P)}function p(D,T,L,G,q,P){let{M:K,Z:Y}=g(T,L,G,q,D),$=f(P),J=e.BASE.multiply($),X=K.multiply($),et=B(L,K,Y,J,X,D),nt=r.sub($,r.mul(et,T));return It(...[et,nt].map(ct=>r.toBytes(ct)))}function _(D,T,L,G,q){it(q,2*r.BYTES);let{M:P,Z:K}=S(T,L,G,D),[Y,$]=[q.subarray(0,r.BYTES),q.subarray(r.BYTES)].map(nt=>r.fromBytes(nt)),J=e.BASE.multiply($).add(T.multiply(Y)),X=P.multiply($).add(K.multiply(Y)),et=B(T,P,K,J,X,D);if(!r.eql(Y,et))throw new Error("proof verification failed")}function w(){let D=f(),T=e.BASE.multiply(D);return{secretKey:r.toBytes(D),publicKey:T.toBytes()}}function x(D,T,L){let G=It(kt("DeriveKeyPair"),D),q=It(T,y(L),Uint8Array.of(0));for(let P=0;P<=255;P++){q[q.length-1]=P;let K=a.hashToScalar(q,{DST:G});if(!r.is0(K))return{secretKey:r.toBytes(K),publicKey:e.BASE.multiply(K).toBytes()}}throw new Error("Cannot derive key")}function N(D,T,L=Ft){let G=f(L),q=s(T,D);if(q.equals(e.ZERO))throw new Error("Input point at infinity");let P=q.multiply(G);return{blind:r.toBytes(G),blinded:P.toBytes()}}function b(D,T,L){let G=r.fromBytes(T),q=s(L,D);if(q.equals(e.ZERO))throw new Error("Input point at infinity");let P=q.multiply(G).toBytes();return C(L,P)}let m={generateKeyPair:w,deriveKeyPair:(D,T)=>x(u,D,T),blind:(D,T=Ft)=>N(u,D,T),blindEvaluate(D,T){let L=r.fromBytes(D);return e.fromBytes(T).multiply(L).toBytes()},finalize(D,T,L){let G=r.fromBytes(T),P=e.fromBytes(L).multiply(r.inv(G)).toBytes();return C(D,P)},evaluate:(D,T)=>b(u,D,T)};return Object.freeze({name:t,oprf:m,voprf:{generateKeyPair:w,deriveKeyPair:(D,T)=>x(E,D,T),blind:(D,T=Ft)=>N(E,D,T),blindEvaluateBatch(D,T,L,G=Ft){if(!Array.isArray(L))throw new Error("expected array");let q=r.fromBytes(D),P=e.fromBytes(T),K=L.map(e.fromBytes),Y=K.map(J=>J.multiply(q)),$=p(E,q,P,K,Y,G);return{evaluated:Y.map(J=>J.toBytes()),proof:$}},blindEvaluate(D,T,L,G=Ft){let q=this.blindEvaluateBatch(D,T,[L],G);return{evaluated:q.evaluated[0],proof:q.proof}},finalizeBatch(D,T,L){if(!Array.isArray(D))throw new Error("expected array");let G=e.fromBytes(T),q=D.map(K=>K.blinded).map(e.fromBytes),P=D.map(K=>K.evaluated).map(e.fromBytes);return _(E,G,q,P,L),D.map(K=>m.finalize(K.input,K.blind,K.evaluated))},finalize(D,T,L,G,q,P){return this.finalizeBatch([{input:D,blind:T,evaluated:L,blinded:G}],q,P)[0]},evaluate:(D,T)=>b(E,D,T)},poprf:D=>{let T=o(y("Info",D),l),L=e.BASE.multiply(T);return{generateKeyPair:w,deriveKeyPair:(G,q)=>x(l,G,q),blind(G,q,P=Ft){let K=e.fromBytes(q),Y=L.add(K);if(Y.equals(e.ZERO))throw new Error("tweakedKey point at infinity");let $=f(P),J=s(G,l);if(J.equals(e.ZERO))throw new Error("Input point at infinity");let X=J.multiply($);return{blind:r.toBytes($),blinded:X.toBytes(),tweakedKey:Y.toBytes()}},blindEvaluateBatch(G,q,P=Ft){if(!Array.isArray(q))throw new Error("expected array");let K=r.fromBytes(G),Y=r.add(K,T),$=r.inv(Y),J=q.map(e.fromBytes),X=J.map(ct=>ct.multiply($)),et=e.BASE.multiply(Y),nt=p(l,Y,et,X,J,P);return{evaluated:X.map(ct=>ct.toBytes()),proof:nt}},blindEvaluate(G,q,P=Ft){let K=this.blindEvaluateBatch(G,[q],P);return{evaluated:K.evaluated[0],proof:K.proof}},finalizeBatch(G,q,P){if(!Array.isArray(G))throw new Error("expected array");let K=G.map(Y=>Y.evaluated).map(e.fromBytes);return _(l,e.fromBytes(P),K,G.map(Y=>Y.blinded).map(e.fromBytes),q),G.map((Y,$)=>{let J=r.fromBytes(Y.blind),X=K[$].multiply(r.inv(J)).toBytes();return C(Y.input,D,X)})},finalize(G,q,P,K,Y,$){return this.finalizeBatch([{input:G,blind:q,evaluated:P,blinded:K}],Y,$)[0]},evaluate(G,q){let P=r.fromBytes(G),K=s(q,l);if(K.equals(e.ZERO))throw new Error("Input point at infinity");let Y=r.add(P,T),$=r.inv(Y),J=K.multiply($).toBytes();return C(q,D,J)}}},__tests:{Fn:r}})}var Ti=pt(()=>{ee();wn();hr();_e();});var qi={};ke(qi,{ED25519_TORSION_SUBGROUP:()=>_o,_map_to_curve_elligator2_curve25519:()=>Yi,ed25519:()=>fo,ed25519_hasher:()=>Bo,ed25519ctx:()=>ho,ed25519ph:()=>uo,ristretto255:()=>mo,ristretto255_hasher:()=>xn,ristretto255_oprf:()=>So,x25519:()=>go});function Oi(a){let t=BigInt(10),e=BigInt(20),n=BigInt(40),r=BigInt(80),s=Jt,f=a*a%s*a%s,h=Ht(f,Rn,s)*f%s,c=Ht(h,Kt,s)*a%s,u=Ht(c,Mi,s)*c%s,E=Ht(u,t,s)*u%s,l=Ht(E,e,s)*E%s,y=Ht(l,n,s)*l%s,C=Ht(y,r,s)*y%s,Q=Ht(C,r,s)*y%s,S=Ht(Q,t,s)*u%s;return{pow_p_5_8:Ht(S,Rn,s)*a%s,b2:f}}function Gi(a){return a[0]&=248,a[31]&=127,a[31]|=64,a}function Er(a,t){let e=Jt,n=ht(t*t*t,e),r=ht(n*n*t,e),s=Oi(a*r).pow_p_5_8,o=ht(a*n*s,e),f=ht(t*o*o,e),h=o,c=ht(o*ur,e),u=f===a,E=f===ht(-a,e),l=f===ht(-a*ur,e);return u&&(o=h),(E||l)&&(o=c),Xt(o,e)&&(o=ht(-o,e)),{isValid:u||E,value:o}}function Pi(a,t,e){if(t.length>255)throw new Error("Context is too big");return It(kt("SigEd25519 no Ed25519 collisions"),new Uint8Array([e?1:0,t.length]),t,a)}function pr(a){return Si($t,ce,Object.assign({adjustScalarBytes:Gi},a))}function Yi(a){let t=(Jt-Mi)/dr,e=BigInt(486662),n=Z.sqr(a);n=Z.mul(n,Rn);let r=Z.add(n,Z.ONE),s=Z.neg(e),o=Z.sqr(r),f=Z.mul(o,r),h=Z.mul(n,e);h=Z.mul(h,s),h=Z.add(h,o),h=Z.mul(h,s);let c=Z.sqr(f);o=Z.sqr(c),c=Z.mul(c,f),c=Z.mul(c,h),o=Z.mul(o,c);let u=Z.pow(o,t);u=Z.mul(u,c);let E=Z.mul(u,Fi);o=Z.sqr(u),o=Z.mul(o,f);let l=Z.eql(o,h),y=Z.cmov(E,u,l),C=Z.mul(s,n),Q=Z.mul(u,a);Q=Z.mul(Q,Io);let S=Z.mul(Q,Fi),g=Z.mul(h,n);o=Z.sqr(Q),o=Z.mul(o,f);let B=Z.eql(o,g),p=Z.cmov(S,Q,B);o=Z.sqr(y),o=Z.mul(o,f);let _=Z.eql(o,h),w=Z.cmov(C,s,_),x=Z.cmov(p,y,_),N=Z.isOdd(x);return x=Z.cmov(x,Z.neg(x),_!==N),{xMn:w,xMd:r,yMn:x,yMd:Kt}}function po(a){let{xMn:t,xMd:e,yMn:n,yMd:r}=Yi(a),s=Z.mul(t,r);s=Z.mul(s,Eo);let o=Z.mul(e,n),f=Z.sub(t,e),h=Z.add(t,e),c=Z.mul(o,h),u=Z.eql(c,Z.ZERO);s=Z.cmov(s,Z.ZERO,u),o=Z.cmov(o,Z.ONE,u),f=Z.cmov(f,Z.ONE,u),h=Z.cmov(h,Z.ONE,u);let[E,l]=Se(Z,[o,h],!0);return{x:Z.mul(s,E),y:Z.mul(f,l)}}function Li(a){let{d:t}=Ir,e=Jt,n=g=>Z.create(g),r=n(gr*a*a),s=n((r+Kt)*Qo),o=BigInt(-1),f=n((o-t*r)*n(r+t)),{isValid:h,value:c}=Er(s,f),u=n(c*a);Xt(u,e)||(u=n(-u)),h||(c=u),h||(o=r);let E=n(o*(r-Kt)*bo-f),l=c*c,y=n((c+c)*f),C=n(E*Co),Q=n(Kt-l),S=n(Kt+l);return new $t(n(y*S),n(Q*C),n(C*S),n(y*Q))}var co,Kt,Rn,ki,Mi,dr,Jt,Ir,ur,$t,Z,Hi,fo,ho,uo,go,lo,Io,Fi,Eo,Bo,gr,Co,yo,Qo,bo,Ui,wo,lr,xe,mo,xn,So,_o,Ki=pt(()=>{ti();we();_i();hr();_e();vi();Ti();ee();co=BigInt(0),Kt=BigInt(1),Rn=BigInt(2),ki=BigInt(3),Mi=BigInt(5),dr=BigInt(8),Jt=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Ir={p:Jt,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:dr,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};ur=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");$t=mi(Ir,{uvRatio:Er}),Z=$t.Fp,Hi=$t.Fn;fo=pr({}),ho=pr({domain:Pi}),uo=pr({domain:Pi,prehash:ce}),go=(()=>{let a=Jt;return Di({P:a,type:"x25519",powPminus2:t=>{let{pow_p_5_8:e,b2:n}=Oi(t);return ht(Ht(e,ki,a)*n,a)},adjustScalarBytes:Gi})})(),lo=(Jt+ki)/dr,Io=Z.pow(Rn,lo),Fi=Z.sqrt(Z.neg(Z.ONE));Eo=li(Z,Z.neg(BigInt(486664)));Bo=xi($t,a=>po(a[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:Jt,m:1,k:128,expand:"xmd",hash:ce}),gr=ur,Co=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),yo=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),Qo=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),bo=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),Ui=a=>Er(Kt,a),wo=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),lr=a=>Z.create(Ut(a)&wo);xe=class a extends mn{static BASE=new a($t.BASE);static ZERO=new a($t.ZERO);static Fp=Z;static Fn=Hi;constructor(t){super(t)}static fromAffine(t){return new a($t.fromAffine(t))}assertSame(t){if(!(t instanceof a))throw new Error("RistrettoPoint expected")}init(t){return new a(t)}static fromBytes(t){it(t,32);let{a:e,d:n}=Ir,r=Jt,s=_=>Z.create(_),o=lr(t);if(!ni(Z.toBytes(o),t)||Xt(o,r))throw new Error("invalid ristretto255 encoding 1");let f=s(o*o),h=s(Kt+e*f),c=s(Kt-e*f),u=s(h*h),E=s(c*c),l=s(e*n*u-E),{isValid:y,value:C}=Ui(s(l*E)),Q=s(C*c),S=s(C*Q*l),g=s((o+o)*Q);Xt(g,r)&&(g=s(-g));let B=s(h*S),p=s(g*B);if(!y||Xt(p,r)||B===co)throw new Error("invalid ristretto255 encoding 2");return new a(new $t(g,B,Kt,p))}static fromHex(t){return a.fromBytes(oe(t))}toBytes(){let{X:t,Y:e,Z:n,T:r}=this.ep,s=Jt,o=S=>Z.create(S),f=o(o(n+e)*o(n-e)),h=o(t*e),c=o(h*h),{value:u}=Ui(o(f*c)),E=o(u*f),l=o(u*h),y=o(E*l*r),C;if(Xt(r*y,s)){let S=o(e*gr),g=o(t*gr);t=S,e=g,C=o(E*yo)}else C=l;Xt(t*y,s)&&(e=o(-e));let Q=o((n-e)*C);return Xt(Q,s)&&(Q=o(-Q)),Z.toBytes(Q)}equals(t){this.assertSame(t);let{X:e,Y:n}=this.ep,{X:r,Y:s}=t.ep,o=c=>Z.create(c),f=o(e*s)===o(n*r),h=o(n*s)===o(e*r);return f||h}is0(){return this.equals(a.ZERO)}},mo={Point:xe},xn={Point:xe,hashToCurve(a,t){let e=t?.DST||"ristretto255_XMD:SHA-512_R255MAP_RO_",n=Sn(a,e,64,ce);return xn.deriveToCurve(n)},hashToScalar(a,t={DST:Ye}){let e=Sn(a,t.DST,64,ce);return Hi.create(Ut(e))},deriveToCurve(a){it(a,64);let t=lr(a.subarray(0,32)),e=Li(t),n=lr(a.subarray(32,64)),r=Li(n);return new xe(e.add(r))}},So=Ni({name:"ristretto255-SHA512",Point:xe,hash:ce,hashToGroup:xn.hashToCurve,hashToScalar:xn.hashToScalar}),_o=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"]});var es={};ke(es,{abool:()=>Ke,abytes:()=>dt,aexists:()=>Dn,anumber:()=>de,aoutput:()=>Br,bytesToHex:()=>Cr,bytesToNumberBE:()=>Do,bytesToUtf8:()=>No,checkOpts:()=>Qr,clean:()=>jt,complexOverlapBytes:()=>To,concatBytes:()=>Je,copyBytes:()=>Ie,createView:()=>ji,equalBytes:()=>br,getOutput:()=>Nn,hexToBytes:()=>$i,hexToNumber:()=>yr,isAligned32:()=>ts,isBytes:()=>Wi,isLE:()=>Vi,managedNonce:()=>Fo,numberToBytesBE:()=>Zi,overlapBytes:()=>zi,randomBytes:()=>Tn,u32:()=>Wt,u64Lengths:()=>wr,u8:()=>Ro,utf8ToBytes:()=>vo,wrapCipher:()=>vn});function Wi(a){return a instanceof Uint8Array||ArrayBuffer.isView(a)&&a.constructor.name==="Uint8Array"}function Ke(a){if(typeof a!="boolean")throw new Error(`boolean expected, not ${a}`)}function de(a){if(!Number.isSafeInteger(a)||a<0)throw new Error("positive integer expected, got "+a)}function dt(a,t,e=""){let n=Wi(a),r=a?.length,s=t!==void 0;if(!n||s&&r!==t){let o=e&&`"${e}" `,f=s?` of length ${t}`:"",h=n?`length=${r}`:`type=${typeof a}`;throw new Error(o+"expected Uint8Array"+f+", got "+h)}return a}function Dn(a,t=!0){if(a.destroyed)throw new Error("Hash instance has been destroyed");if(t&&a.finished)throw new Error("Hash#digest() has already been called")}function Br(a,t){dt(a,void 0,"output");let e=t.outputLen;if(a.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function Ro(a){return new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}function Wt(a){return new Uint32Array(a.buffer,a.byteOffset,Math.floor(a.byteLength/4))}function jt(...a){for(let t=0;t<a.length;t++)a[t].fill(0)}function ji(a){return new DataView(a.buffer,a.byteOffset,a.byteLength)}function Cr(a){if(dt(a),Xi)return a.toHex();let t="";for(let e=0;e<a.length;e++)t+=xo[a[e]];return t}function Ji(a){if(a>=Zt._0&&a<=Zt._9)return a-Zt._0;if(a>=Zt.A&&a<=Zt.F)return a-(Zt.A-10);if(a>=Zt.a&&a<=Zt.f)return a-(Zt.a-10)}function $i(a){if(typeof a!="string")throw new Error("hex string expected, got "+typeof a);if(Xi)return Uint8Array.fromHex(a);let t=a.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(e);for(let r=0,s=0;r<e;r++,s+=2){let o=Ji(a.charCodeAt(s)),f=Ji(a.charCodeAt(s+1));if(o===void 0||f===void 0){let h=a[s]+a[s+1];throw new Error('hex string expected, got non-hex character "'+h+'" at index '+s)}n[r]=o*16+f}return n}function yr(a){if(typeof a!="string")throw new Error("hex string expected, got "+typeof a);return BigInt(a===""?"0":"0x"+a)}function Do(a){return yr(Cr(a))}function Zi(a,t){return $i(a.toString(16).padStart(t*2,"0"))}function vo(a){if(typeof a!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(a))}function No(a){return new TextDecoder().decode(a)}function zi(a,t){return a.buffer===t.buffer&&a.byteOffset<t.byteOffset+t.byteLength&&t.byteOffset<a.byteOffset+a.byteLength}function To(a,t){if(zi(a,t)&&a.byteOffset<t.byteOffset)throw new Error("complex overlap of input and output is not supported")}function Je(...a){let t=0;for(let n=0;n<a.length;n++){let r=a[n];dt(r),t+=r.length}let e=new Uint8Array(t);for(let n=0,r=0;n<a.length;n++){let s=a[n];e.set(s,r),r+=s.length}return e}function Qr(a,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(a,t)}function br(a,t){if(a.length!==t.length)return!1;let e=0;for(let n=0;n<a.length;n++)e|=a[n]^t[n];return e===0}function Nn(a,t,e=!0){if(t===void 0)return new Uint8Array(a);if(t.length!==a)throw new Error('"output" expected Uint8Array of length '+a+", got: "+t.length);if(e&&!ts(t))throw new Error("invalid output, must be aligned");return t}function wr(a,t,e){Ke(e);let n=new Uint8Array(16),r=ji(n);return r.setBigUint64(0,BigInt(t),e),r.setBigUint64(8,BigInt(a),e),n}function ts(a){return a.byteOffset%4===0}function Ie(a){return Uint8Array.from(a)}function Tn(a=32){let t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return t.getRandomValues(new Uint8Array(a))}function Fo(a,t=Tn){let{nonceLength:e}=a;de(e);let n=(r,s)=>{let o=Je(r,s);return s.fill(0),o};return((r,...s)=>({encrypt(o){dt(o);let f=t(e),h=a(r,f,...s).encrypt(o);return h instanceof Promise?h.then(c=>n(f,c)):n(f,h)},decrypt(o){dt(o);let f=o.subarray(0,e),h=o.subarray(e);return a(r,f,...s).decrypt(h)}}))}var Vi,Xi,xo,Zt,vn,De=pt(()=>{Vi=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Xi=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",xo=Array.from({length:256},(a,t)=>t.toString(16).padStart(2,"0"));Zt={_0:48,_9:57,A:65,F:70,a:97,f:102};vn=(a,t)=>{function e(n,...r){if(dt(n,void 0,"key"),!Vi)throw new Error("Non little-endian hardware is not yet supported");if(a.nonceLength!==void 0){let u=r[0];dt(u,a.varSizeNonce?void 0:a.nonceLength,"nonce")}let s=a.tagLength;s&&r[1]!==void 0&&dt(r[1],void 0,"AAD");let o=t(n,...r),f=(u,E)=>{if(E!==void 0){if(u!==2)throw new Error("cipher output not supported");dt(E,void 0,"output")}},h=!1;return{encrypt(u,E){if(h)throw new Error("cannot encrypt() twice with same key + nonce");return h=!0,dt(u),f(o.encrypt.length,E),o.encrypt(u,E)},decrypt(u,E){if(dt(u),s&&u.length<s)throw new Error('"ciphertext" expected length bigger than tagLength='+s);return f(o.decrypt.length,E),o.decrypt(u,E)}}}return Object.assign(e,a),e}});function z(a,t){return a<<t|a>>>32-t}function mr(a){return a.byteOffset%4===0}function Go(a,t,e,n,r,s,o,f){let h=r.length,c=new Uint8Array(Fn),u=Wt(c),E=mr(r)&&mr(s),l=E?Wt(r):ns,y=E?Wt(s):ns;for(let C=0;C<h;o++){if(a(t,e,n,u,o,f),o>=is)throw new Error("arx: counter overflow");let Q=Math.min(Fn,h-C);if(E&&Q===Fn){let S=C/4;if(C%4!==0)throw new Error("arx: invalid block position");for(let g=0,B;g<Oo;g++)B=S+g,y[B]=l[B]^u[g];C+=Fn;continue}for(let S=0,g;S<Q;S++)g=C+S,s[g]=r[g]^c[S];C+=Q}}function ve(a,t){let{allowShortKeys:e,extendNonceFn:n,counterLength:r,counterRight:s,rounds:o}=Qr({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof a!="function")throw new Error("core must be a function");return de(r),de(o),Ke(s),Ke(e),(f,h,c,u,E=0)=>{dt(f,void 0,"key"),dt(h,void 0,"nonce"),dt(c,void 0,"data");let l=c.length;if(u===void 0&&(u=new Uint8Array(l)),dt(u,void 0,"output"),de(E),E<0||E>=is)throw new Error("arx: counter overflow");if(u.length<l)throw new Error(`arx: output (${u.length}) is shorter than data (${l})`);let y=[],C=f.length,Q,S;if(C===32)y.push(Q=Ie(f)),S=Mo;else if(C===16&&e)Q=new Uint8Array(32),Q.set(f),Q.set(f,16),S=ko,y.push(Q);else throw dt(f,32,"arx key"),new Error("invalid key size");mr(h)||y.push(h=Ie(h));let g=Wt(Q);if(n){if(h.length!==24)throw new Error("arx: extended nonce must be 24 bytes");n(S,g,Wt(h.subarray(0,16)),g),h=h.subarray(16)}let B=16-r;if(B!==h.length)throw new Error(`arx: nonce must be ${B} or 16 bytes`);if(B!==12){let _=new Uint8Array(12);_.set(h,s?0:12-h.length),h=_,y.push(h)}let p=Wt(h);return Go(a,S,g,p,c,u,E,o),jt(...y),u}}var rs,Uo,Lo,ko,Mo,Fn,Oo,is,ns,Sr,_r,ss=pt(()=>{De();rs=a=>Uint8Array.from(a.split(""),t=>t.charCodeAt(0)),Uo=rs("expand 16-byte k"),Lo=rs("expand 32-byte k"),ko=Wt(Uo),Mo=Wt(Lo);Fn=64,Oo=16,is=2**32-1,ns=Uint32Array.of();Sr=class a{blockLen;keyLen;nonceLen;state;buf;key;nonce;pos;ctr;cipher;constructor(t,e,n,r,s){this.cipher=t,this.blockLen=e,this.keyLen=n,this.nonceLen=r,this.state=new Uint8Array(this.keyLen+this.nonceLen),this.reseed(s),this.ctr=0,this.pos=this.blockLen,this.buf=new Uint8Array(this.blockLen),this.key=this.state.subarray(0,this.keyLen),this.nonce=this.state.subarray(this.keyLen)}reseed(t){if(dt(t),!t||t.length===0)throw new Error("entropy required");for(let e=0;e<t.length;e++)this.state[e%this.state.length]^=t[e];this.ctr=0,this.pos=this.blockLen}addEntropy(t){this.state.set(this.randomBytes(this.state.length)),this.reseed(t)}randomBytes(t){if(de(t),t===0)return new Uint8Array(0);let e=new Uint8Array(t),n=0;if(this.pos<this.blockLen){let o=Math.min(t,this.blockLen-this.pos);if(e.set(this.buf.subarray(this.pos,this.pos+o),0),this.pos+=o,n+=o,n===t)return e}let r=Math.floor((t-n)/this.blockLen);if(r>0){let o=r*this.blockLen,f=e.subarray(n,n+o);this.cipher(this.key,this.nonce,f,f,this.ctr),this.ctr+=r,n+=o}let s=t-n;return s>0&&(this.buf.fill(0),this.cipher(this.key,this.nonce,this.buf,this.buf,this.ctr++),e.set(this.buf.subarray(0,s),n),this.pos=s),e}clone(){return new a(this.cipher,this.blockLen,this.keyLen,this.nonceLen,this.randomBytes(this.state.length))}clean(){this.pos=0,this.ctr=0,this.buf.fill(0),this.state.fill(0)}},_r=(a,t,e,n)=>(r=Tn(32))=>new Sr(a,t,e,n,r)});function Dt(a,t){return a[t++]&255|(a[t++]&255)<<8}function Ho(a){let t=(n,r)=>a(r).update(n).digest(),e=a(new Uint8Array(32));return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>a(n),t}var Rr,os,As=pt(()=>{De();Rr=class{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;constructor(t){t=Ie(dt(t,32,"key"));let e=Dt(t,0),n=Dt(t,2),r=Dt(t,4),s=Dt(t,6),o=Dt(t,8),f=Dt(t,10),h=Dt(t,12),c=Dt(t,14);this.r[0]=e&8191,this.r[1]=(e>>>13|n<<3)&8191,this.r[2]=(n>>>10|r<<6)&7939,this.r[3]=(r>>>7|s<<9)&8191,this.r[4]=(s>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|f<<2)&8191,this.r[7]=(f>>>11|h<<5)&8065,this.r[8]=(h>>>8|c<<8)&8191,this.r[9]=c>>>5&127;for(let u=0;u<8;u++)this.pad[u]=Dt(t,16+2*u)}process(t,e,n=!1){let r=n?0:2048,{h:s,r:o}=this,f=o[0],h=o[1],c=o[2],u=o[3],E=o[4],l=o[5],y=o[6],C=o[7],Q=o[8],S=o[9],g=Dt(t,e+0),B=Dt(t,e+2),p=Dt(t,e+4),_=Dt(t,e+6),w=Dt(t,e+8),x=Dt(t,e+10),N=Dt(t,e+12),b=Dt(t,e+14),m=s[0]+(g&8191),v=s[1]+((g>>>13|B<<3)&8191),M=s[2]+((B>>>10|p<<6)&8191),D=s[3]+((p>>>7|_<<9)&8191),T=s[4]+((_>>>4|w<<12)&8191),L=s[5]+(w>>>1&8191),G=s[6]+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M*C+D*y+T*l;Y=mt>>>13,mt&=8191,mt+=L*E+G*u+q*c+P*h+K*f,Y+=mt>>>13,mt&=8191,Y=(Y<<2)+Y|0,Y=Y+$|0,$=Y&8191,Y=Y>>>13,J+=Y,s[0]=$,s[1]=J,s[2]=X,s[3]=et,s[4]=nt,s[5]=ct,s[6]=rt,s[7]=Et,s[8]=lt,s[9]=mt}finalize(){let{h:t,pad:e}=this,n=new Uint16Array(10),r=t[1]>>>13;t[1]&=8191;for(let f=2;f<10;f++)t[f]+=r,r=t[f]>>>13,t[f]&=8191;t[0]+=r*5,r=t[0]>>>13,t[0]&=8191,t[1]+=r,r=t[1]>>>13,t[1]&=8191,t[2]+=r,n[0]=t[0]+5,r=n[0]>>>13,n[0]&=8191;for(let f=1;f<10;f++)n[f]=t[f]+r,r=n[f]>>>13,n[f]&=8191;n[9]-=8192;let s=(r^1)-1;for(let f=0;f<10;f++)n[f]&=s;s=~s;for(let f=0;f<10;f++)t[f]=t[f]&s|n[f];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let o=t[0]+e[0];t[0]=o&65535;for(let f=1;f<8;f++)o=(t[f]+e[f]|0)+(o>>>16)|0,t[f]=o&65535;jt(n)}update(t){Dn(this),dt(t),t=Ie(t);let{buffer:e,blockLen:n}=this,r=t.length;for(let s=0;s<r;){let o=Math.min(n-this.pos,r-s);if(o===n){for(;n<=r-s;s+=n)this.process(t,s);continue}e.set(t.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===n&&(this.process(e,0,!1),this.pos=0)}return this}destroy(){jt(this.h,this.r,this.buffer,this.pad)}digestInto(t){Dn(this),Br(t,this),this.finished=!0;let{buffer:e,h:n}=this,{pos:r}=this;if(r){for(e[r++]=1;r<16;r++)e[r]=0;this.process(e,0,!0)}this.finalize();let s=0;for(let o=0;o<8;o++)t[s++]=n[o]>>>0,t[s++]=n[o]>>>8;return t}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}};os=Ho(a=>new Rr(a))});var ds={};ke(ds,{_poly1305_aead:()=>xr,chacha12:()=>Po,chacha20:()=>us,chacha20orig:()=>hs,chacha20poly1305:()=>Ko,chacha8:()=>ls,hchacha:()=>fs,rngChacha20:()=>Wo,rngChacha8:()=>jo,xchacha20:()=>gs,xchacha20poly1305:()=>Jo});function We(a,t,e,n,r,s=20){let o=a[0],f=a[1],h=a[2],c=a[3],u=t[0],E=t[1],l=t[2],y=t[3],C=t[4],Q=t[5],S=t[6],g=t[7],B=r,p=e[0],_=e[1],w=e[2],x=o,N=f,b=h,m=c,v=u,M=E,D=l,T=y,L=C,G=Q,q=S,P=g,K=B,Y=p,$=_,J=w;for(let et=0;et<s;et+=2)x=x+v|0,K=z(K^x,16),L=L+K|0,v=z(v^L,12),x=x+v|0,K=z(K^x,8),L=L+K|0,v=z(v^L,7),N=N+M|0,Y=z(Y^N,16),G=G+Y|0,M=z(M^G,12),N=N+M|0,Y=z(Y^N,8),G=G+Y|0,M=z(M^G,7),b=b+D|0,$=z($^b,16),q=q+$|0,D=z(D^q,12),b=b+D|0,$=z($^b,8),q=q+$|0,D=z(D^q,7),m=m+T|0,J=z(J^m,16),P=P+J|0,T=z(T^P,12),m=m+T|0,J=z(J^m,8),P=P+J|0,T=z(T^P,7),x=x+M|0,J=z(J^x,16),q=q+J|0,M=z(M^q,12),x=x+M|0,J=z(J^x,8),q=q+J|0,M=z(M^q,7),N=N+D|0,K=z(K^N,16),P=P+K|0,D=z(D^P,12),N=N+D|0,K=z(K^N,8),P=P+K|0,D=z(D^P,7),b=b+T|0,Y=z(Y^b,16),L=L+Y|0,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z(h^y,7);let _=0;n[_++]=r,n[_++]=s,n[_++]=o,n[_++]=f,n[_++]=S,n[_++]=g,n[_++]=B,n[_++]=p}function cs(a,t,e,n,r){r!==void 0&&dt(r,void 0,"AAD");let s=a(t,e,qo),o=wr(n.length,r?r.length:0,!0),f=os.create(s);r&&as(f,r),as(f,n),f.update(o);let h=f.digest();return jt(s,o),h}var hs,us,gs,ls,Po,Yo,as,qo,xr,Ko,Jo,Wo,jo,Is=pt(()=>{ss();As();De();hs=ve(We,{counterRight:!1,counterLength:8,allowShortKeys:!0}),us=ve(We,{counterRight:!1,counterLength:4,allowShortKeys:!1}),gs=ve(We,{counterRight:!1,counterLength:8,extendNonceFn:fs,allowShortKeys:!1}),ls=ve(We,{counterRight:!1,counterLength:4,rounds:8}),Po=ve(We,{counterRight:!1,counterLength:4,rounds:12}),Yo=new Uint8Array(16),as=(a,t)=>{a.update(t);let e=t.length%16;e&&a.update(Yo.subarray(e))},qo=new Uint8Array(32);xr=a=>(t,e,n)=>({encrypt(s,o){let f=s.length;o=Nn(f+16,o,!1),o.set(s);let h=o.subarray(0,-16);a(t,e,h,h,1);let c=cs(a,t,e,h,n);return o.set(c,f),jt(c),o},decrypt(s,o){o=Nn(s.length-16,o,!1);let f=s.subarray(0,-16),h=s.subarray(-16),c=cs(a,t,e,f,n);if(!br(h,c))throw new Error("invalid tag");return o.set(s.subarray(0,-16)),a(t,e,o,o,1),jt(c),o}}),Ko=vn({blockSize:64,nonceLength:12,tagLength:16},xr(us)),Jo=vn({blockSize:64,nonceLength:24,tagLength:16},xr(gs)),Wo=_r(hs,64,32,8),jo=_r(ls,64,32,12)});var Es={};ke(Es,{default:()=>Xo});var Vo,Xo,ps=pt(()=>{Vo=(()=>{var a,t,e={773(s,o,f){var h,c=typeof self<"u"&&self.Module!==void 0?self.Module:{},u={};for(h in c)c.hasOwnProperty(h)&&(u[h]=c[h]);var E,l,y,C,Q=[];E=typeof window=="object",l=typeof importScripts=="function",y=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",C=!E&&!y&&!l;var S,g,B,p,_,w="";y?(w=l?f(967).dirname(w)+"/":"//",S=function(O,W){return p||(p=f(145)),_||(_=f(967)),O=_.normalize(O),p.readFileSync(O,W?null:"utf8")},B=function(O){var W=S(O,!0);return W.buffer||(W=new Uint8Array(W)),v(W.buffer),W},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),Q=process.argv.slice(2),s.exports=c,process.on("uncaughtException",function(O){if(!(O instanceof H))throw O}),process.on("unhandledRejection",X),c.inspect=function(){return"[Emscripten Module object]"}):C?(typeof read<"u"&&(S=function(O){return read(O)}),B=function(O){var W;return typeof readbuffer=="function"?new Uint8Array(readbuffer(O)):(v(typeof(W=read(O,"binary"))=="object"),W)},typeof scriptArgs<"u"?Q=scriptArgs:arguments!==void 0&&(Q=arguments),typeof print<"u"&&(typeof console>"u"&&(console={}),console.log=print,console.warn=console.error=typeof printErr<"u"?printErr:print)):(E||l)&&(l?w=self.location.href:typeof document<"u"&&document.currentScript&&(w=document.currentScript.src),w=w.indexOf("blob:")!==0?w.substr(0,w.lastIndexOf("/")+1):"",S=function(O){var W=new XMLHttpRequest;return W.open("GET",O,!1),W.send(null),W.responseText},l&&(B=function(O){var W=new XMLHttpRequest;return W.open("GET",O,!1),W.responseType="arraybuffer",W.send(null),new Uint8Array(W.response)}),g=function(O,W,i){var A=new XMLHttpRequest;A.open("GET",O,!0),A.responseType="arraybuffer",A.onload=function(){A.status==200||A.status==0&&A.response?W(A.response):i()},A.onerror=i,A.send(null)}),c.print||console.log.bind(console);var x,N,b=c.printErr||console.warn.bind(console);for(h in u)u.hasOwnProperty(h)&&(c[h]=u[h]);u=null,c.arguments&&(Q=c.arguments),c.thisProgram&&c.thisProgram,c.quit&&c.quit,c.wasmBinary&&(x=c.wasmBinary),c.noExitRuntime,typeof WebAssembly!="object"&&X("no native wasm support detected");var m=!1;function v(O,W){O||X("Assertion failed: "+W)}var M,D,T=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function L(O){M=O,c.HEAP8=new Int8Array(O),c.HEAP16=new Int16Array(O),c.HEAP32=new Int32Array(O),c.HEAPU8=D=new Uint8Array(O),c.HEAPU16=new Uint16Array(O),c.HEAPU32=new Uint32Array(O),c.HEAPF32=new Float32Array(O),c.HEAPF64=new Float64Array(O)}c.INITIAL_MEMORY;var G,q=[],P=[],K=[],Y=0,$=null,J=null;function X(O){throw c.onAbort&&c.onAbort(O),b(O+=""),m=!0,O="abort("+O+"). Build with -s ASSERTIONS=1 for more info.",new WebAssembly.RuntimeError(O)}function et(O){return O.startsWith("data:application/octet-stream;base64,")}function nt(O){return O.startsWith("file://")}c.preloadedImages={},c.preloadedAudios={};var ct,rt="argon2.wasm";function Et(O){try{if(O==rt&&x)return new Uint8Array(x);if(B)return B(O);throw"both async and sync fetching of the wasm failed"}catch(W){X(W)}}function lt(O){for(;O.length>0;){var W=O.shift();if(typeof W!="function"){var i=W.func;typeof i=="number"?W.arg===void 0?G.get(i)():G.get(i)(W.arg):i(W.arg===void 0?null:W.arg)}else W(c)}}function mt(O){try{return N.grow(O-M.byteLength+65535>>>16),L(N.buffer),1}catch{}}et(rt)||(ct=rt,rt=c.locateFile?c.locateFile(ct,w):w+ct);var Mt,yt={a:function(O,W,i){D.copyWithin(O,W,W+i)},b:function(O){var W,i=D.length;if((O>>>=0)>2147418112)return!1;for(var A=1;A<=4;A*=2){var I=i*(1+.2/A);if(I=Math.min(I,O+100663296),mt(Math.min(2147418112,((W=Math.max(O,I))%65536>0&&(W+=65536-W%65536),W))))return!0}return!1}},vt=((function(){var O={a:yt};function W(I,R){var U,k=I.exports;c.asm=k,L((N=c.asm.c).buffer),G=c.asm.k,U=c.asm.d,P.unshift(U),(function(j){if(Y--,c.monitorRunDependencies&&c.monitorRunDependencies(Y),Y==0&&($!==null&&(clearInterval($),$=null),J)){var tt=J;J=null,tt()}})()}function i(I){W(I.instance)}function A(I){return(function(){if(!x&&(E||l)){if(typeof fetch=="function"&&!nt(rt))return fetch(rt,{credentials:"same-origin"}).then(function(R){if(!R.ok)throw"failed to load wasm binary file at '"+rt+"'";return R.arrayBuffer()}).catch(function(){return Et(rt)});if(g)return new Promise(function(R,U){g(rt,function(k){R(new Uint8Array(k))},U)})}return Promise.resolve().then(function(){return Et(rt)})})().then(function(R){return WebAssembly.instantiate(R,O)}).then(I,function(R){b("failed to asynchronously prepare wasm: "+R),X(R)})}if(Y++,c.monitorRunDependencies&&c.monitorRunDependencies(Y),c.instantiateWasm)try{return c.instantiateWasm(O,W)}catch(I){return b("Module.instantiateWasm callback failed with error: "+I),!1}x||typeof WebAssembly.instantiateStreaming!="function"||et(rt)||nt(rt)||typeof fetch!="function"?A(i):fetch(rt,{credentials:"same-origin"}).then(function(I){return WebAssembly.instantiateStreaming(I,O).then(i,function(R){return b("wasm streaming compile failed: "+R),b("falling back to ArrayBuffer instantiation"),A(i)})})})(),c.___wasm_call_ctors=function(){return(c.___wasm_call_ctors=c.asm.d).apply(null,arguments)},c._argon2_hash=function(){return(c._argon2_hash=c.asm.e).apply(null,arguments)},c._malloc=function(){return(vt=c._malloc=c.asm.f).apply(null,arguments)}),F=(c._free=function(){return(c._free=c.asm.g).apply(null,arguments)},c._argon2_verify=function(){return(c._argon2_verify=c.asm.h).apply(null,arguments)},c._argon2_error_message=function(){return(c._argon2_error_message=c.asm.i).apply(null,arguments)},c._argon2_encodedlen=function(){return(c._argon2_encodedlen=c.asm.j).apply(null,arguments)},c._argon2_hash_ext=function(){return(c._argon2_hash_ext=c.asm.l).apply(null,arguments)},c._argon2_verify_ext=function(){return(c._argon2_verify_ext=c.asm.m).apply(null,arguments)},c.stackAlloc=function(){return(F=c.stackAlloc=c.asm.n).apply(null,arguments)});function H(O){this.name="ExitStatus",this.message="Program terminated with exit("+O+")",this.status=O}function V(O){function W(){Mt||(Mt=!0,c.calledRun=!0,m||(lt(P),c.onRuntimeInitialized&&c.onRuntimeInitialized(),(function(){var i;if(c.postRun)for(typeof c.postRun=="function"&&(c.postRun=[c.postRun]);c.postRun.length;)i=c.postRun.shift(),K.unshift(i);lt(K)})()))}O=O||Q,Y>0||((function(){var i;if(c.preRun)for(typeof c.preRun=="function"&&(c.preRun=[c.preRun]);c.preRun.length;)i=c.preRun.shift(),q.unshift(i);lt(q)})(),Y>0||(c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1),W()},1)):W()))}if(c.allocate=function(O,W){var i;return i=W==1?F(O.length):vt(O.length),O.subarray||O.slice?D.set(O,i):D.set(new Uint8Array(O),i),i},c.UTF8ToString=function(O,W){return O?(function(i,A,I){for(var R=A+I,U=A;i[U]&&!(U>=R);)++U;if(U-A>16&&i.subarray&&T)return T.decode(i.subarray(A,U));for(var k="";A<U;){var j=i[A++];if(128&j){var tt=63&i[A++];if((224&j)!=192){var ut=63&i[A++];if((j=(240&j)==224?(15&j)<<12|tt<<6|ut:(7&j)<<18|tt<<12|ut<<6|63&i[A++])<65536)k+=String.fromCharCode(j);else{var ot=j-65536;k+=String.fromCharCode(55296|ot>>10,56320|1023&ot)}}else k+=String.fromCharCode((31&j)<<6|tt)}else k+=String.fromCharCode(j)}return k})(D,O,W):""},c.ALLOC_NORMAL=0,J=function O(){Mt||V(),Mt||(J=O)},c.run=V,c.preInit)for(typeof c.preInit=="function"&&(c.preInit=[c.preInit]);c.preInit.length>0;)c.preInit.pop()();V(),s.exports=c,c.unloadRuntime=function(){typeof self<"u"&&delete self.Module,c=N=G=M=D=void 0,delete s.exports}},631:function(s,o,f){var h,c;typeof self<"u",(c=typeof(h=function(){let u=typeof self<"u"?self:this,E={Argon2d:0,Argon2i:1,Argon2id:2};function l(g){if(l._promise)return l._promise;if(l._module)return Promise.resolve(l._module);let B;return B=u.process&&u.process.versions&&u.process.versions.node?y().then(p=>new Promise(_=>{p.postRun=()=>_(p)})):(u.loadArgon2WasmBinary?u.loadArgon2WasmBinary():Promise.resolve(f(721)).then(p=>(function(_){let w=atob(_),x=new Uint8Array(new ArrayBuffer(w.length));for(let N=0;N<w.length;N++)x[N]=w.charCodeAt(N);return x})(p))).then(p=>{var _,w;return _=p,w=g?(function(x){let N=32767;return new WebAssembly.Memory({initial:Math.min(Math.max(Math.ceil(1024*x/65536),256)+256,N),maximum:N})})(g):void 0,new Promise(x=>(u.Module={wasmBinary:_,wasmMemory:w,postRun(){x(Module)}},y()))}),l._promise=B,B.then(p=>(l._module=p,delete l._promise,p))}function y(){return u.loadArgon2WasmModule?u.loadArgon2WasmModule():Promise.resolve(f(773))}function C(g,B){return g.allocate(B,"i8",g.ALLOC_NORMAL)}function Q(g,B){return C(g,new Uint8Array([...B,0]))}function S(g){if(typeof g!="string")return g;if(typeof TextEncoder=="function")return new TextEncoder().encode(g);if(typeof Buffer=="function")return Buffer.from(g);throw Error("Don't know how to encode UTF8")}return{ArgonType:E,hash:function(g){let B=g.mem||1024;return l(B).then(p=>{let _=g.time||1,w=g.parallelism||1,x=S(g.pass),N=Q(p,x),b=x.length,m=S(g.salt),v=Q(p,m),M=m.length,D=g.type||E.Argon2d,T=p.allocate(Array(g.hashLen||24),"i8",p.ALLOC_NORMAL),L=g.secret?C(p,g.secret):0,G=g.secret?g.secret.byteLength:0,q=g.ad?C(p,g.ad):0,P=g.ad?g.ad.byteLength:0,K=g.hashLen||24,Y=p._argon2_encodedlen(_,B,w,M,K,D),$=p.allocate(Array(Y+1),"i8",p.ALLOC_NORMAL),J,X,et;try{X=p._argon2_hash_ext(_,B,w,N,b,v,M,T,K,$,Y,D,L,G,q,P,19)}catch(nt){J=nt}if(X!==0||J){try{J||(J=p.UTF8ToString(p._argon2_error_message(X)))}catch{}et={message:J,code:X}}else{let nt="",ct=new Uint8Array(K);for(let rt=0;rt<K;rt++){let Et=p.HEAP8[T+rt];ct[rt]=Et,nt+=("0"+(255&Et).toString(16)).slice(-2)}et={hash:ct,hashHex:nt,encoded:p.UTF8ToString($)}}try{p._free(N),p._free(v),p._free(T),p._free($),q&&p._free(q),L&&p._free(L)}catch{}if(J)throw et;return et})},verify:function(g){return l().then(B=>{let p=S(g.pass),_=Q(B,p),w=p.length,x=g.secret?C(B,g.secret):0,N=g.secret?g.secret.byteLength:0,b=g.ad?C(B,g.ad):0,m=g.ad?g.ad.byteLength:0,v=Q(B,S(g.encoded)),M,D,T,L=g.type;if(L===void 0){let G=g.encoded.split("$")[1];G&&(L=E[G=G.replace("a","A")]||E.Argon2d)}try{D=B._argon2_verify_ext(v,_,w,x,N,b,m,L)}catch(G){M=G}if(D||M){try{M||(M=B.UTF8ToString(B._argon2_error_message(D)))}catch{}T={message:M,code:D}}try{B._free(_),B._free(v)}catch{}if(M)throw T;return T})},unloadRuntime:function(){l._module&&(l._module.unloadRuntime(),delete l._promise,delete l._module)}}})=="function"?h.apply(o,[]):h)===void 0||(s.exports=c)},721:function(s,o){s.exports="AGFzbQEAAAABkwESYAN/f38Bf2ABfwF/YAJ/fwBgAn9/AX9gAX8AYAR/f39/AX9gA39/fwBgBH9/f38AYAJ/fgBgAn5/AX5gAn5+AX5gBX9/f39/AGAGf3x/f39/AX9gAABgCH9/f39/f39/AX9gEX9/f39/f39/f39/f39/f39/AX9gBn9/f39/fwF/YA1/f39/f39/f39/f39/AX8CDQIBYQFhAAABYQFiAAEDPDsJCgIAAAIEAQEAAQsGAQAHAAIBAwICAwIIBQECAwEHDQMBBgQGAQEFBQEAAAIEAAAIAQAODwQQAQURAwQFAXABAwMFBwEBgAL//wEGCQF/AUGQo8ACCwcxDAFjAgABZAAhAWUAOwFmAAkBZwAIAWgAOgFpADkBagA4AWsBAAFsADYBbQA1AW4AMwkIAQBBAQsCCzQKwbMBOwgAIAAgAa2KCx4AIAAgAXwgAEIBhkL+////H4MgAUL/////D4N+fAsXAEHwHCgCAEUgAEVyRQRAIAAgARAdCwuDBAEDfyACQYAETwRAIAAgASACEAAaIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAEEDcUUEQCAAIQIMAQsgAkEBSARAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAkEDcUUNASACIANJDQALCwJAIANBfHEiBEHAAEkNACACIARBQGoiBUsNAANAIAIgASgCADYCACACIAEoAgQ2AgQgAiABKAIINgIIIAIgASgCDDYCDCACIAEoAhA2AhAgAiABKAIUNgIUIAIgASgCGDYCGCACIAEoAhw2AhwgAiABKAIgNgIgIAIgASgCJDYCJCACIAEoAig2AiggAiABKAIsNgIsIAIgASgCMDYCMCACIAEoAjQ2AjQgAiABKAI4NgI4IAIgASgCPDYCPCABQUBrIQEgAkFAayICIAVNDQALCyACIARPDQEDQCACIAEoAgA2AgAgAUEEaiEBIAJBBGoiAiAESQ0ACwwBCyADQQRJBEAgACECDAELIAAgA0EEayIESwRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAiABLQABOgABIAIgAS0AAjoAAiACIAEtAAM6AAMgAUEEaiEBIAJBBGoiAiAETQ0ACwsgAiADSQRAA0AgAiABLQAAOgAAIAFBAWohASACQQFqIgIgA0cNAAsLIAALzwEBA38CQCACRQ0AQX8hAyAARSABRXINACAAKQNQQgBSDQACQCAAKALgASIDIAJqQYEBSQ0AIABB4ABqIgUgA2ogAUGAASADayIEEAUaIABCgAEQGiAAIAUQGUEAIQMgAEEANgLgASABIARqIQEgAiAEayICQYEBSQ0AA0AgAEKAARAaIAAgARAZIAFBgAFqIQEgAkGAAWsiAkGAAUsNAAsgACgC4AEhAwsgACADakHgAGogASACEAUaIAAgACgC4AEgAmo2AuABQQAhAwsgAwsJACAAIAE2AAALpwwBB38CQCAARQ0AIABBCGsiAyAAQQRrKAIAIgFBeHEiAGohBQJAIAFBAXENACABQQNxRQ0BIAMgAygCACIBayIDQbAfKAIASQ0BIAAgAWohACADQbQfKAIARwRAIAFB/wFNBEAgAygCCCICIAFBA3YiBEEDdEHIH2pGGiACIAMoAgwiAUYEQEGgH0GgHygCAEF+IAR3cTYCAAwDCyACIAE2AgwgASACNgIIDAILIAMoAhghBgJAIAMgAygCDCIBRwRAIAMoAggiAiABNg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ARBCUkNACADIAE2AgggAyABNgIEIAJBCGsgATYCACACQQxrIAE2AgAgBEEZSQ0AIAMgATYCGCADIAE2AhQgAyABNgIQIAMgATYCDCACQRBrIAE2AgAgAkEUayABNgIAIAJBGGsgATYCACACQRxrIAE2AgAgBCADQQRxQRhyIgRrIgJBIEkNACABrUKBgICAEH4hBSADIARqIQEDQCABIAU3AxggASAFNwMQIAEgBTcDCCABIAU3AwAgAUEgaiEBIAJBIGsiAkEfSw0ACwsgAAtPAQJ/QdgeKAIAIgEgAEEDakF8cSICaiEAAkAgAkEAIAAgAU0bDQAgAD8AQRB0SwRAIAAQAUUNAQtB2B4gADYCACABDwtB3B5BMDYCAEF/C20BAX8jAEGAAmsiBSQAIARBgMAEcSACIANMckUEQCAFIAFB/wFxIAIgA2siAkGAAiACQYACSSIBGxALGiABRQRAA0AgACAFQYACEA4gAkGAAmsiAkH/AUsNAAsLIAAgBSACEA4LIAVBgAJqJAALnQIBA38gAC0AAEEgcUUEQAJAIAEhBAJAIAIgACIBKAIQIgAEfyAABQJ/IAEiACABLQBKIgNBAWsgA3I6AEogASgCACIDQQhxBEAgACADQSByNgIAQX8MAQsgAEIANwIEIAAgACgCLCIDNgIcIAAgAzYCFCAAIAMgACgCMGo2AhBBAAsNASABKAIQCyABKAIUIgVrSwRAIAEgBCACIAEoAiQRAAAaDAILAn8gASwAS0F/SgRAIAIhAANAIAIgACIDRQ0CGiAEIANBAWsiAGotAABBCkcNAAsgASAEIAMgASgCJBEAACADSQ0CIAMgBGohBCABKAIUIQUgAiADawwBCyACCyEAIAUgBCAAEAUaIAEgASgCFCAAajYCFAsLCwsKACAAQTBrQQpJC2MBAn8gAkUEQEEADwsCfyAALQAAIgMEQANAAkACQCABLQAAIgRFDQAgAkEBayICRQ0AIAMgBEYNAQsgAwwDCyABQQFqIQEgAC0AASEDIABBAWohACADDQALC0EACyABLQAAawucDQIQfhB/IwBBgBBrIhQkACAUQYAIaiABEBcgFEGACGogABAWIBQgFEGACGoQFyAD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GEkNAAsLIAMiAkGACGohC0EAIQQDQCACIARBA3QiBWogBSALaikDABAyIARBAWoiBEGAAUcNAAsgACgCACAAKAIEIANBgAgQICADQYAIakGACBAEIANBgAgQBCABKAIAIgQgASgCDEEKdCIBEAQCQCAAKAJAIgAEQCAEIAEgABECAAwBCyAEEAgLCyADQYAQaiQAQQAhBAsgCUEwaiQAIAQLJwEBfwJAAkACQAJAIAAOAwABAgMLQdATDwtBixEPC0GeEyEBCyABC48DAQF/IwBBgANrIgQkACAEQQA2AowBIARBjAFqIAEQBwJAIAFBwABNBEAgBEGQAWogARAYQQBIDQEgBEGQAWogBEGMAWpBBBAGQQBIDQEgBEGQAWogAiADEAZBAEgNASAEQZABaiAAIAEQEhoMAQsgBEGQAWpBwAAQGEEASA0AIARBkAFqIARBjAFqQQQQBkEASA0AIARBkAFqIAIgAxAGQQBIDQAgBEGQAWogBEFAa0HAABASQQBIDQAgACAEKQNANwAAIAAgBCkDSDcACCAAIAQpA1g3ABggACAEKQNQNwAQIABBIGohACABQSBrIgJBwQBPBEADQCAEIARBQGtBwAAQBSIBQUBrQcAAIAEQMUEASA0CIAAgASkDQDcAACAAIAEpA0g3AAggACAEKQNYNwAYIAAgBCkDUDcAECAAQSBqIQAgAkEgayICQcAASw0ACwsgBCAEQUBrQcAAEAUiAUFAayACIAEQMUEASA0AIAAgAUFAayACEAUaCyAEQZABakHwARAEIARBgANqJAALAwABC5kCACAARQRAQQAPCwJ/AkAgAAR/IAFB/wBNDQECQEGgHigCACgCAEUEQCABQYB/cUGAvwNGDQMMAQsgAUH/D00EQCAAIAFBP3FBgAFyOgABIAAgAUEGdkHAAXI6AABBAgwECyABQYCwA09BACABQYBAcUGAwANHG0UEQCAAIAFBP3FBgAFyOgACIAAgAUEMdkHgAXI6AAAgACABQQZ2QT9xQYABcjoAAUEDDAQLIAFBgIAEa0H//z9NBEAgACABQT9xQYABcjoAAyAAIAFBEnZB8AFyOgAAIAAgAUEGdkE/cUGAAXI6AAIgACABQQx2QT9xQYABcjoAAUEEDAQLC0HcHkEZNgIAQX8FQQELDAELIAAgAToAAEEBCwtQAQN/AkAgACgCACwAABAPRQRADAELA0AgACgCACICLAAAIQMgACACQQFqNgIAIAEgA2pBMGshASACLAABEA9FDQEgAUEKbCEBDAALAAsgAQu7AgACQCABQRRLDQACQAJAAkACQAJAAkACQAJAAkACQCABQQlrDgoAAQIDBAUGBwgJCgsgAiACKAIAIgFBBGo2AgAgACABKAIANgIADwsgAiACKAIAIgFBBGo2AgAgACABNAIANwMADwsgAiACKAIAIgFBBGo2AgAgACABNQIANwMADwsgAiACKAIAQQdqQXhxIgFBCGo2AgAgACABKQMANwMADwsgAiACKAIAIgFBBGo2AgAgACABMgEANwMADwsgAiACKAIAIgFBBGo2AgAgACABMwEANwMADwsgAiACKAIAIgFBBGo2AgAgACABMAAANwMADwsgAiACKAIAIgFBBGo2AgAgACABMQAANwMADwsgAiACKAIAQQdqQXhxIgFBCGo2AgAgACABKwMAOQMADwsgACACQQARAgALCxkAIAAtAOgBBEAgAEJ/NwNYCyAAQn83A1ALIwAgASABKQMwQgF8NwMwIAIgASAAQQAQESACIAAgAEEAEBELOQECfyAAQQNuIgJBAnQhAQJAAkACQCACQQNsQX9zIABqDgIBAAILIAFBAXIhAQsgAUECaiEBCyABC3oBAn8gAEHA/wBzQQFqQQh2QX9zQS9xIABBwf8Ac0EBakEIdkF/c0ErcSAAQeb/A2pBCHZB/wFxIgEgAEHBAGpxcnIgAEHM/wNqQQh2IgIgAEHHAGpxIAFB/wFzcXIgAEH8AWogAEHC/wNqQQh2cSACQX9zcUH/AXFyC9YBAQV/QX8hBCADQQNuIgZBAnQhBQJAAkACQCAGQQNsQX9zIANqDgIBAAILIAVBAXIhBQsgBUECaiEFCyABIAVLBH8CQCADRQ0AQQAhAUEIIQQDQCABIAItAAAiCHIhBwNAIAAiASAHIAQiBkEGayIEdkE/cRAoOgAAIAFBAWohACAEQQVLDQALIANBAWsiAwRAIAJBAWohAiAHQQh0IQEg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JAACeBwAA9AgAAGIHAAAYCQAAiAcAAOEIAABOBwAA/wkAAFwKAAABAEGkGAsBAgBByxgLBf//////AEGQGQtBEQAKABEREQAAAAAFAAAAAAAACQAAAAALAAAAAAAAAAARAA8KERERAwoHAAEACQsLAAAJBgsAAAsABhEAAAAREREAQeEZCyELAAAAAAAAAAARAAoKERERAAoAAAIACQsAAAAJAAsAAAsAQZsaCwEMAEGnGgsVDAAAAAAMAAAAAAkMAAAAAAAMAAAMAEHVGgsBDgBB4RoLFQ0AAAAEDQAAAAAJDgAAAAAADgAADgBBjxsLARAAQZsbCx4PAAAAAA8AAAAACRAAAAAAABAAABAAABIAAAASEhIAQdIbCw4SAAAAEhISAAAAAAAACQBBgxwLAQsAQY8cCxUKAAAAAAoAAAAACQsAAAAAAAsAAAsAQb0cCwEMAEHJHAsnDAAAAAAMAAAAAAkMAAAAAAAMAAAMAAAwMTIzNDU2Nzg5QUJDREVGAEHwHAsBAQBBoB4LAogPAEHYHgsDkBFQ"},145(){},967(){}},n={};function r(s){var o=n[s];if(o!==void 0)return o.exports;var f=n[s]={exports:{}};return e[s].call(f.exports,f,f.exports,r),f.exports}return r(631)})(),Xo=Vo});var Mn=class a{verbose;mockMode;static#e=null;#t=null;#n=!1;#r=0;#i=["time.google.com","time.cloudflare.com","pool.ntp.org"];constructor(t=0,e=!1){if(this.verbose=t,this.mockMode=e,a.#e)return a.#e;a.#e=this}static get instance(){return a.#e||new a}static get time(){return a.instance.time}get time(){return this.mockMode?Date.now():this.#t===null?null:Date.now()+Math.round(this.#t)}async sync(t){if(t!==void 0&&(this.verbose=t),this.mockMode)return Date.now();if(this.#n){for(;this.#n;)await new Promise(e=>setTimeout(e,50));return this.time}this.#n=!0;try{let e=await this.#s();return e.length===0?(console.warn("[Clock] All NTP sources failed, using local time"),this.#t=0,this.time):(this.#t=this.#A(e),this.#r=Date.now(),e.length<this.#i.length&&setTimeout(()=>this.#a(),100),this.time)}catch(e){return console.error("[Clock] Sync failed:",e),this.#t=0,this.time}finally{this.#n=!1}}get status(){return this.mockMode?{synchronized:!0,syncing:!1,offset:0,lastSync:Date.now(),age:0}:{synchronized:this.#t!==null,syncing:this.#n,offset:this.#t,lastSync:this.#r,age:this.#r?Date.now()-this.#r:null}}async#s(){let t=this.#i.map(r=>this.#o(r)),e=await Promise.allSettled(t),n=[];for(let r of e)r.status==="fulfilled"&&n.push(r.value);return n}async#o(t){let e=new AbortController,n=setTimeout(()=>e.abort(),2e3);try{let r=Date.now(),s=await fetch(`https://${t}`,{method:"HEAD",signal:e.signal,cache:"no-cache"}),o=(Date.now()-r)/2;if(!s.ok)throw new Error(`HTTP ${s.status}`);let f=new Date(s.headers.get("date")).getTime();if(isNaN(f))throw new Error("Invalid date header");return{source:t,serverTime:f+o,localTime:Date.now(),latency:o*2}}finally{clearTimeout(n)}}#A(t){if(t.length===1)return t[0].serverTime-t[0].localTime;t.sort((r,s)=>r.latency-s.latency);let e=[];for(let r of t)e.push(r.serverTime-r.localTime);e.sort((r,s)=>r-s);let n=Math.floor(e.length/2);return e.length%2===0?(e[n-1]+e[n])/2:e[n]}async#a(){if(!this.#n)try{let t=await this.#s();if(t.length===0)return;let e=this.#A(t);Math.abs(e-this.#t)>100&&(this.#t=e)}catch(t){this.verbose&&console.warn("[Clock] Background refine failed:",t)}}},ft=Mn.instance;await Ot();await Ot();var vs=1e4,Ns=1e6,Ts=1e5,Fs=36e5,Rt={VALID_SIGNATURE:1e4,VALID_POW:3e5,UNICAST_RELAYED:5e3,WRONG_SIGNATURE:-6e5,WRONG_POW:-1e8,WRONG_SERIALIZATION:-6e4,GOSSIP_FLOOD:-6e4,UNICAST_FLOOD:-3e4,HOPS_EXCEEDED:-3e5,UNICAST_INVALID_ROUTE:-6e4,FAILED_HANDSHAKE:-6e5,WRONG_LENGTH:-6e5},Ze=class{id;cryptoCodex;verbose;trustBalances={};manualBanList=new Set;bytesCounters={gossip:{},unicast:{}};bytesCounterResetIn=0;constructor(t,e,n=0){this.id=t,this.cryptoCodex=e,this.verbose=n}tick(){for(let t in this.trustBalances){let e=this.trustBalances[t];e!==0&&(e=e<0?Math.min(0,e+1e3):Math.max(0,e-100))}this.bytesCounterResetIn-=1e3,!(this.bytesCounterResetIn>0)&&(this.bytesCounterResetIn=vs,this.bytesCounters={gossip:{},unicast:{}})}countPeerAction(t,e){if(Rt[e])return this.adjustTrust(t,Rt[e])}adjustTrust(t,e,n="na"){t!==this.id&&(e&&(this.trustBalances[t]=Math.min(Fs,(this.trustBalances[t]||0)+e)),e&&this.verbose>3&&console.log(`%c(Arbiter: ${this.id}) ${t} +${e}ms (${n}). Updated: ${this.trustBalances[t]}ms.`,gt.ARBITER),this.isBanished(t)&&this.verbose>1&&console.log(`%c(Arbiter: ${this.id}) Peer ${t} is now banished.`,gt.ARBITER))}setBanished(t){this.manualBanList.has(t)||this.manualBanList.add(t)}isBanished(t){return Ct.MANUAL_BAN_MODE?this.manualBanList.has(t):(this.trustBalances[t]||0)<0}countMessageBytes(t,e,n){this.bytesCounters[n][t]||(this.bytesCounters[n][t]=0),this.bytesCounters[n][t]+=e;let[r,s]=n==="gossip"?[Ts,Rt.GOSSIP_FLOOD]:[Ns,Rt.UNICAST_FLOOD];return this.bytesCounters[n][t]<r?!0:this.adjustTrust(t,s,`Message ${n} flood detected`)}async digestMessage(t,e,n,r=.01){let{senderId:s,pubkey:o,topic:f,expectedEnd:h}=e;if(!(!this.#e(t,e,n)||!this.#t(t,f?"gossip":"unicast",n,h)||!(f?this.#n(t,e):this.#r(t,e)))&&!(this.isBanished(t)||this.isBanished(s)))return this.trustBalances[s]>Rt.VALID_POW||Math.random()<r&&await this.#i(s,o),!0}#e(t,e,n){try{let{pubkey:r,signature:s,signatureStart:o}=e,f=n.subarray(0,o);if(!this.cryptoCodex.verifySignature(r,f,s))throw new Error("Gossip signature invalid");return this.adjustTrust(t,Rt.VALID_SIGNATURE,"Gossip signature valid"),!0}catch(r){this.verbose>1&&console.error(`%c(Arbiter: ${this.id}) Error during signature verification from ${t}: ${r.stack}`,gt.ARBITER),this.verbose>2&&console.log(`%c(Arbiter) signatureControl() error details: ${e}`,gt.ARBITER)}this.adjustTrust(t,Rt.WRONG_SIGNATURE,"Gossip signature invalid")}#t(t,e,n,r){if(!r||n.length===r)return!0;this.adjustTrust(t,Rt.WRONG_LENGTH,`${e} message length mismatch`)}#n(t,e){if(e.HOPS<=(_t.HOPS[e.topic]||_t.HOPS.default))return!0;this.adjustTrust(t,Rt.HOPS_EXCEEDED,"Gossip HOPS exceeded")}#r(t,e){if(e.route.length<=Qt.MAX_HOPS)return!0;this.adjustTrust(t,Rt.HOPS_EXCEEDED,"Unicast HOPS exceeded")}async#i(t,e){await this.cryptoCodex.pubkeyDifficultyCheck(e)?this.adjustTrust(t,Rt.VALID_POW,"Gossip PoW valid"):this.adjustTrust(t,Rt.WRONG_POW,"Gossip PoW invalid")}};await Ot();var Us;function ye(a,t=0){let e=typeof a=="string"?(Us??=new TextEncoder).encode(a):a,n=e,r=t+374761393&4294967295,s=0;if(n.length>=16){let f=[t+2654435761+2246822519&4294967295,t+2246822519&4294967295,t+0&4294967295,t-2654435761&4294967295],h=e,c=h.length-16,u=0;for(s=0;(s&4294967280)<=c;s+=4){let E=s,l=h[E+0]+(h[E+1]<<8),y=h[E+2]+(h[E+3]<<8),C=l*2246822519+(y*2246822519<<16),Q=f[u]+C&4294967295;Q=Q<<13|Q>>>19;let S=Q&65535,g=Q>>>16;f[u]=S*2654435761+(g*2654435761<<16)&4294967295,u=u+1&3}r=(f[0]<<1|f[0]>>>31)+(f[1]<<7|f[1]>>>25)+(f[2]<<12|f[2]>>>20)+(f[3]<<18|f[3]>>>14)&4294967295}r=r+e.length&4294967295;let o=e.length-4;for(;s<=o;s+=4){let f=s,h=n[f+0]+(n[f+1]<<8),c=n[f+2]+(n[f+3]<<8),u=h*3266489917+(c*3266489917<<16);r=r+u&4294967295,r=r<<17|r>>>15,r=(r&65535)*668265263+((r>>>16)*668265263<<16)&4294967295}for(;s<n.length;++s){let f=n[s];r=r+f*374761393,r=r<<11|r>>>21,r=(r&65535)*2654435761+((r>>>16)*2654435761<<16)&4294967295}return r=r^r>>>15,r=((r&65535)*2246822519&4294967295)+((r>>>16)*2246822519<<16),r=r^r>>>13,r=((r&65535)*3266489917&4294967295)+((r>>>16)*3266489917<<16),r=r^r>>>16,r<0?r+4294967296:r}async function Ls(){if(!(typeof globalThis.RTCPeerConnection<"u"))return(await import("wrtc")).default}var Lr=await Ls(),ze=class{id;verbose;stunUrls;constructor(t,e,n=0){this.id=t,this.verbose=n,this.stunUrls=e}onSignalAnswer=null;onConnect=null;offerInstanceByExpiration={};creatingOffer=!1;offerCreationTimeout=null;offersToCreate=St.MAX_SDP_OFFERS;offers={};tick(){let t=ft.time;for(let s in this.offerInstanceByExpiration){let o=this.offerInstanceByExpiration[s];t<s||(o?.destroy(),delete this.offerInstanceByExpiration[s],this.creatingOffer=!1)}for(let s in this.offers){let o=this.offers[s];if(o.offererInstance.destroyed){delete this.offers[s];continue}if(o.isUsed){delete this.offers[s];continue}o.timestamp+St.SDP_OFFER_EXPIRATION>t||(o.offererInstance?.destroy(),delete this.offers[s])}let e=0;for(let s in this.offers){e++;let o=this.offers[s];if(o.isDigestingOneAnswer){o.isDigestingOneAnswer=!1;continue}if(o.offererInstance.destroyed)continue;let f=o.answers.filter(u=>!u.used);if(!f.length)continue;let h=f.reduce((u,E)=>u.timestamp>E.timestamp?u:E);if(!h)continue;h.used=!0;let c=t-h.timestamp;c>Ct.CONNECTION_UPGRADE_TIMEOUT/2||(o.offererInstance.signal(h.signal),o.isDigestingOneAnswer=!0,this.verbose>2&&console.log(`(${this.id}) Using answer from ${h.peerId} for offer ${s} (received since ${c} ms)`))}if(this.creatingOffer||e>=this.offersToCreate)return;this.creatingOffer=!0;let n=t+(St.SIGNAL_CREATION_TIMEOUT||8e3),r=this.#e(n);this.offerInstanceByExpiration[n]=r}#e(t){let e=St.ICE_COMPLETE_TIMEOUT||1e3,n=new St.PEER({initiator:!0,trickle:!1,iceCompleteTimeout:e,wrtc:Lr,config:{iceServers:this.stunUrls}});return n.on("error",r=>this.#n(r)),n.on("signal",r=>{let{candidate:s,type:o}=r;if(!r||s)throw new Error("Unexpected signal data from offerer instance: "+JSON.stringify(r));if(o!=="offer")throw new Error("Unexpected signal type from offerer instance: "+o);delete this.offerInstanceByExpiration[t];let f=ye(JSON.stringify(r));n.on("connect",()=>{this.offers[f]&&(this.offers[f].isUsed=!0),this.onConnect(void 0,n)}),this.offers[f]={timestamp:ft.time,sentCounter:0,signal:r,offererInstance:n,answers:[],answerers:{},isUsed:!1},this.creatingOffer=!1}),n}#t(t,e="",n=2,r="includes"){return r[0]==="i"&&!t.message.includes(e)?!1:t.message.startsWith(e)?(this.verbose>=n&&console.info(`%cOfferManager => ${t.message}`,gt.PEER_STORE),!0):!1}#n=t=>{this.verbose<1||this.#t(t,"Ice connection failed",2)||this.#t(t,"Connection failed",2)||this.#t(t,"Remote transport instance",3,"startsWith")||this.#t(t,"Simulated failure",4,"startsWith")||this.#t(t,"No peer found",4,"startsWith")||this.#t(t,"Missing transport instance",2,"startsWith")||this.#t(t,"Failed to create answer",2,"startsWith")||this.#t(t,"Transport instance",3,"startsWith")||this.#t(t,"cannot signal after peer is destroyed",3,"startsWith")||this.#t(t,"No pending",3)||this.#t(t,"is already linked",3)||this.#t(t,"There is already a pending",3)||this.#t(t,"closed the connection",3)||this.#t(t,"No transport instance found for id:",3)||this.verbose>0&&console.error("transportInstance ERROR => ",t.stack)};bestReadyOffer(t=0,e=!0){let n=null,r=null,s=null;for(let o in this.offers){let f=this.offers[o],{isUsed:h,sentCounter:c,signal:u,timestamp:E}=f;if(h||c>t)continue;let l=ft.time-E;if(!(e&&l>St.SDP_OFFER_EXPIRATION/2)&&!(s&&l>s)){n=f,r=o,s=l;break}}return{offerHash:r,readyOffer:n,since:s}}addSignalAnswer(t,e,n,r){!e||e.type!=="answer"||!n||!this.offers[n]||this.offers[n].answerers[t]||(this.offers[n].answerers[t]=!0,this.offers[n].answers.push({peerId:t,signal:e,timestamp:r}),this.verbose>3&&console.log(`(OfferManager) Added answer from ${t} for offer ${n}`))}getTransportInstanceForSignal(t,e,n){try{if(!e||!e.type||!e.sdp)throw new Error("Wrong remote SDP provided");let{type:r,sdp:s}=e;if(r!=="offer"&&r!=="answer")throw new Error("Invalid remote SDP type");if(r==="offer"&&!s)throw new Error("No SDP in the remote SDP offer");if(r==="answer"&&!s)throw new Error("No SDP in the remote SDP answer");if(r==="answer"){let h=n?this.offers[n]?.offererInstance:null;if(!h)throw new Error("No pending offer found for the given offer hash to accept the answer");return h}let o=St.ICE_COMPLETE_TIMEOUT||1e3,f=new St.PEER({initiator:!1,trickle:!1,iceCompleteTimeout:o,wrtc:Lr,config:{iceServers:this.stunUrls}});return f.on("error",h=>this.#n(h)),f.on("signal",h=>this.onSignalAnswer(t,h,n)),f.on("connect",()=>this.onConnect(t,f)),f}catch(r){if(r.message.startsWith("No pending offer found")&&this.verbose<2)return null;if(this.verbose>1&&r.message.startsWith("No pending offer found"))return console.info(`%c${r.message}`,gt.PEER_STORE);this.verbose>0&&console.error(r.stack)}}destroy(){for(let t in this.offers)this.offers[t].offererInstance?.destroy()}};await Ot();var{SANDBOX:pA,ICE_CANDIDATE_EMITTER:BA,TEST_WS_EVENT_MANAGER:CA}=Nt.ENABLED?await on().then(()=>sn):{},Yn=class{neighbors;connectionsCount;constructor(t={}){this.neighbors=t,this.connectionsCount=Object.keys(t).length}setNeighbor(t,e=ft.time){this.neighbors[t]||this.connectionsCount++,this.neighbors[t]=e}unsetNeighbor(t){this.neighbors[t]&&this.connectionsCount--,delete this.neighbors[t]}};var ie=class{peerId;transportInstance;isWebSocket;direction;pendingUntil;connStartTime;constructor(t,e,n,r=!1){this.peerId=t,this.transportInstance=e,this.isWebSocket=r,this.direction=n,this.pendingUntil=ft.time+Ct.CONNECTION_UPGRADE_TIMEOUT}setConnected(){this.connStartTime=ft.time,this.pendingUntil=0}getConnectionDuration(){return this.connStartTime?ft.time-this.connStartTime:0}close(){this.isWebSocket?this.transportInstance?.close():this.transportInstance?.destroy()}},An=class{id;cryptoCodex;offerManager;arbiter;verbose;isDestroy=!1;neighborsList=[];connecting={};connected={};known={};knownCount=0;privacy={};kick={};callbacks={connect:[(t,e)=>this.#e(t,e)],disconnect:[(t,e)=>this.#t(t,e)],signal:[],data:[]};constructor(t,e,n,r,s=0){this.id=t,this.cryptoCodex=e,this.offerManager=n,this.arbiter=r,this.verbose=s,this.offerManager.onSignalAnswer=(o,f,h)=>{if(!(this.isDestroy||this.isKicked(o)||this.arbiter.isBanished(o)))for(let c of this.callbacks.signal)c(o,{signal:f,offerHash:h})},this.offerManager.onConnect=(o,f)=>{if(this.isDestroy)return f?.destroy();if(o===this.id)throw new Error(`Refusing to connect to self (${this.id}).`);let h=o;if(f.on("close",()=>{if(h)for(let c of this.callbacks.disconnect)c(h,f.initiator?"out":"in")}),f.on("data",c=>{if(h)for(let u of this.callbacks.data)u(h,c);else{let u=new Uint8Array(c);if(u[0]>127)return;let{route:E,type:l,neighborsList:y}=e.readUnicastMessage(u)||{};if(l!=="handshake"||E.length!==2||E[1]!==this.id)return;h=E[0],this.digestPeerNeighbors(h,y);for(let C of this.callbacks.connect)C(h,"out")}}),o)for(let c of this.callbacks.connect)c(o,"in")}}get publicNeighborsList(){return this.neighborsList.filter(t=>this.cryptoCodex.isPublicNode(t))}get standardNeighborsList(){return this.neighborsList.filter(t=>!this.cryptoCodex.isPublicNode(t))}#e(t,e){if(!this.connecting[t]?.[e])return this.verbose>=3?console.info(`%cPeer with ID ${t} is not connecting.`,gt.PEER_STORE):null;let n=this.connecting[t][e];if(this.#n(t,"connecting",e),this.isKicked(t))return this.verbose>=3&&console.info(`%c(${this.id}) Connect => Peer with ID ${t} is kicked. => close()`,gt.PEER_STORE),n.close();if(this.connected[t])return this.verbose>1&&console.warn(`%c(${this.id}) Connect => Peer with ID ${t} is already connected. => close()`,gt.PEER_STORE),n.close();n.setConnected(),this.connected[t]=n,this.neighborsList.push(t),this.#r(this.id,t)}#t(t,e){this.#n(t,"connected",e)}#n(t,e="both",n="both"){if(!t&&t===this.id)return;let[r,s]=[this.connecting[t],this.connected[t]];if(!r&&!s||(e!=="connecting"&&(s?.direction===n||n==="both")&&(s?.close(),delete this.connected[t],this.neighborsList=Object.keys(this.connected),this.#i(this.id,t)),e==="connected"))return;let o=n==="both"?["out","in"]:[n];for(let f of o)delete r?.[f];this.connecting[t]?.in||this.connecting[t]?.out||delete this.connecting[t]}#r(t="toto",e="tutu"){for(let n of[t,e])this.known[n]||(this.known[n]=new Yn,this.knownCount++),this.known[n].setNeighbor(n===t?e:t)}#i(t="toto",e="tutu"){for(let n of[t,e])this.known[n]&&(this.known[n].unsetNeighbor(n===t?e:t),!(this.known[n].connectionsCount>0)&&(delete this.known[n],this.knownCount--))}cleanupExpired(t=!0){let e=ft.time;for(let n of["in","out"])for(let r in this.connecting){if(!this.connecting[r][n])continue;let s=this.connected[r]?1e4:0;this.connecting[r][n].pendingUntil+s>e||(this.verbose>=4&&!this.connected[r]&&console.info(`%c(${this.id}) Pending ${n} connection to peer ${r} expired.`,gt.PEER_STORE),this.verbose>0&&this.connected[r]?.direction===n&&console.info(`%c(${this.id}) Pending ${n} connection to peer ${r} expired (already connected WARNING!).`,"color: white;"),this.connecting[r]?.out?.isWebSocket&&this.connecting[r].out.close(),this.connecting[r]?.in?.close(),this.#n(r,"connecting",n))}t&&(this.neighborsList=Object.keys(this.connected),this.digestPeerNeighbors(this.id,this.neighborsList))}on(t,e){if(!this.callbacks[t])throw new Error(`Unknown callback type: ${t}`);this.callbacks[t].push(e)}getUpdatedPeerConnectionsCount(t,e=!0){let n=ft.time,r=0,s=this.known[t]?.neighbors||{};for(let o in s){if(o!==this.id&&n-s[o]>Bt.PEER_LINK_EXPIRATION){this.#i(t,o);continue}e?r++:this.cryptoCodex.isPublicNode(o)||r++}return r}addConnectingPeer(t,e,n){if(t===this.id)throw new Error(`Refusing to connect to self (${this.id}).`);let r=e.type==="offer"?"in":"out";if(this.connecting[t]?.[r])return;let s=this.offerManager.getTransportInstanceForSignal(t,e,n);return s?(this.connecting[t]||(this.connecting[t]={}),this.connecting[t][r]=new ie(t,s,r),!0):this.verbose>3?console.info(`%cFailed to get transport instance for signal from ${t}.`,gt.PEER_STORE):null}assignSignal(t,e,n,r=ft.time){let s=this.connecting[t]?.[e.type==="offer"?"in":"out"];try{if(s?.isWebSocket)throw new Error(`Cannot assign signal for ID ${t}. (WebSocket)`);e.type==="answer"?this.offerManager.addSignalAnswer(t,e,n,r):s.transportInstance.signal(e)}catch(o){console.error(`Error signaling ${e?.type} for ${t}:`,o.stack)}}kickPeer(t,e=6e4,n){e&&(this.kick[t]=ft.time+e),this.#n(t,"both"),this.verbose>1&&console.log(`%c(${this.id}) Kicked peer ${t} for ${e/1e3}s. ${n?"| Reason: "+n:""}`,"color: green;")}isKicked(t){return this.kick[t]&&this.kick[t]>ft.time}digestValidRoute(t=[]){for(let e=1;e<t.length;e++)this.#r(t[e-1],t[e])}digestPeerNeighbors(t,e=[]){if(!(!t||!Array.isArray(e))){for(let n in this.known[t]?.neighbors||{})e.includes(n)||this.#i(t,n);for(let n of e)this.#r(t,n)}}destroy(){this.isDestroy=!0;for(let[t,e]of Object.entries(this.connected))this.#n(t),e.close();for(let[t,e]of Object.entries(this.connecting))this.#n(t),e.in?.close(),e.out?.close();this.offerManager.destroy()}};await Ot();var an=class{cache={};peerStore;constructor(t,e){this.id=t,this.peerStore=e}buildRoutes(t,e=5,n=3,r=1728,s=!0,o=3){if(this.id===t)throw new Error("Cannot build route to self");if(this.peerStore.connected[t])return{routes:[{path:[this.id,t]}],success:!0,nodesExplored:1};if(!this.peerStore.known[t])return this.#n(t);if(this.cache[t]&&this.#e(this.cache[t]))return{routes:this.cache[t],success:!0,nodesExplored:0};let f=this.#r(t,n,r,o);if(!f.success)return{routes:[],success:!1,nodesExplored:f.nodesExplored};let c=this.#t(f.paths,s).slice(0,e);return this.cache[t]=c,{routes:c,success:!0,nodesExplored:f.nodesExplored}}#e(t){for(let{path:e}of t)for(let n=1;n<e.length;n++){let r=e[n-1],s=e[n];if(r===this.id){if(!this.peerStore.connected[s])return!1}else if(!this.peerStore.known[r]?.neighbors?.[s])return!1}return!0}#t(t,e){let n=[];for(let r of t)n.push({path:r,hops:r.length-1});return e&&n.sort((r,s)=>r.hops-s.hops),n}#n(t){let e=[],n=this.peerStore.neighborsList,r=[...Array(n.length).keys()].sort(()=>Math.random()-.5);for(let s of r)e.push({path:[this.id,n[s],t],hops:0,score:0});return e.length===0?{routes:[],success:!1,nodesExplored:0}:{routes:e,success:"blind",nodesExplored:e.length}}#r(t,e,n,r){let s=[],o=0,f=[{node:this.id,path:[this.id],pathSet:new Set([this.id]),depth:0}],h=new Map;h.set(this.id,[this.id]);let c=[{node:t,path:[t],pathSet:new Set([t]),depth:0}],u=new Map;u.set(t,[t]);let E=Math.ceil(e/2);for(;(f.length>0||c.length>0)&&o<n;){if(f.length>0){let l=this.#i(f,h,u,E);for(let y of l){let C=this.#s(h.get(y),u.get(y));if(s.push(C),!(C.length-1>r))return{success:!0,paths:s,nodesExplored:o}}o++}if(c.length>0){let l=this.#i(c,u,h,E);for(let y of l){let C=this.#s(h.get(y),u.get(y));if(s.push(C),!(C.length-1>r))return{success:!0,paths:s,nodesExplored:o}}o++}}return{success:s.length>0,paths:s,nodesExplored:o}}#i(t,e,n,r){if(t.length===0)return[];let{node:s,path:o,pathSet:f,depth:h}=t.shift();if(h>=r)return[];let c=[];function u(E){if(f.has(E))return;let l=h+1;if(n.has(E)&&c.push(E),e.has(E))return;let y=[...o,E],C=new Set(f).add(E);e.set(E,y),t.push({node:E,path:y,pathSet:C,depth:l})}if(s===this.id)for(let E of this.peerStore.neighborsList)u(E);else for(let E in this.peerStore.known[s]?.neighbors||{})u(E);return c}#s(t,e){let n=t.length+e.length-1,r=new Array(n),s=0;for(let o of t)r[s++]=o;for(let o=e.length-2;o>=0;o--)r[s++]=e[o];return r}};var{SANDBOX:SA,ICE_CANDIDATE_EMITTER:_A,TEST_WS_EVENT_MANAGER:RA}=Nt.ENABLED?await on().then(()=>sn):{},ks=an,Me=class{type="message";timestamp;neighborsList;route;pubkey;data;signature;signatureStart;expectedEnd;constructor(t,e,n,r,s,o,f,h,c){this.type=t,this.timestamp=e,this.neighborsList=n,this.route=r,this.pubkey=s,this.data=o,this.signature=f,this.signatureStart=h,this.expectedEnd=c}getSenderId(){return this.route[0]}getTargetId(){return this.route[this.route.length-1]}extractRouteInfo(t="toto"){let e=this.newRoute||this.route,n=[],r=-1;for(let c=0;c<e.length;c++)if(n.push(e[c]),e[c]===t){r=c;break}let s=e[0],o=e[e.length-1],f=r>0?e[r-1]:null,h=r!==-1?e[r+1]:null;return{traveledRoute:n,selfPosition:r,senderId:s,targetId:o,prevId:f,nextId:h,routeLength:e.length}}},cn=class extends Me{rerouterPubkey;newRoute;rerouterSignature;constructor(t,e,n,r,s,o,f,h,c){super(t,e,n,r,s,o),this.rerouterPubkey=f,this.newRoute=h,this.rerouterSignature=c}getRerouterId(){return this.newRoute[0]}},fn=class{callbacks={message_handle:[]};id;cryptoCodex;arbiter;peerStore;verbose;pathFinder;maxHops=Qt.MAX_HOPS;maxRoutes=Qt.MAX_ROUTES;maxNodes=Qt.MAX_NODES;constructor(t,e,n,r,s=0){this.id=t,this.cryptoCodex=e,this.arbiter=n,this.peerStore=r,this.verbose=s,this.pathFinder=new ks(this.id,this.peerStore)}on(t,e){this.callbacks[t]?this.callbacks[t].push(e):this.callbacks[t]=[e]}sendUnicast(t,e,n="message",r=1){if(t===this.id)return!1;let s=this.pathFinder.buildRoutes(t,this.maxRoutes,this.maxHops,this.maxNodes,!0);if(!s.success)return!1;let o=n==="private_message"?this.peerStore.privacy[t]?.sharedSecret:void 0,f=s.success==="blind"?1:r;for(let h=0;h<Math.min(f,s.routes.length);h++){let c=s.routes[h].path;if(c.length>Qt.MAX_HOPS){this.verbose>1&&console.warn(`Cannot send unicast message to ${t} as route exceeds maxHops (${Qt.MAX_HOPS}). BFS incurred.`);continue}let u=this.cryptoCodex.createUnicastMessage(n,e,c,this.peerStore.neighborsList,o);this.#e(c[1],u)}return!0}#e(t,e){if(this.id===t)return{success:!1,reason:"Cannot send message to self."};let n=this.peerStore.connected[t]?.transportInstance;if(!n)return{success:!1,reason:`Transport instance is not available for peer ${t}.`};try{return n.send(e),{success:!0}}catch(r){this.peerStore.kickPeer(t,0,"send-error"),this.verbose>0&&console.error(`Error sending message to ${t}:`,r.message)}return{success:!1,reason:`Error sending message to ${t}.`}}async handleDirectMessage(t,e){if(this.arbiter.isBanished(t))return this.verbose>=3?console.info(`%cReceived direct message from banned peer ${t}, ignoring.`,"color: red;"):null;if(!this.arbiter.countMessageBytes(t,e.byteLength,"unicast"))return;let n=this.cryptoCodex.readUnicastMessage(e,this.peerStore);if(!n)return this.arbiter.countPeerAction(t,"WRONG_SERIALIZATION");if(!await this.arbiter.digestMessage(t,n,e)||this.arbiter.isBanished(t)||this.arbiter.isBanished(n.senderId))return;let{traveledRoute:s,selfPosition:o,senderId:f,targetId:h,prevId:c,nextId:u}=n.extractRouteInfo(this.id);if(t===f&&t===this.id)throw new Error("DirectMessage senderId and from are both self id !!");for(let y of this.callbacks.message_handle||[])y();if(o===-1)return this.arbiter.adjustTrust(t,Rt.UNICAST_INVALID_ROUTE,"Self not in route");if(c&&t!==c)return this.arbiter.adjustTrust(t,Rt.UNICAST_INVALID_ROUTE,"Previous hop id does not match actual from id");if(f===this.id)return this.arbiter.adjustTrust(t,Rt.UNICAST_INVALID_ROUTE,"SenderId is self id");if(this.verbose>3&&console.log(f===t?`(${this.id}) Direct ${n.type} from ${f}: ${n.data}`:`(${this.id}) Direct ${n.type} from ${f} (lastRelay: ${t}): ${n.data}`),this.peerStore.digestPeerNeighbors(f,n.neighborsList),t!==f&&this.arbiter.adjustTrust(t,Rt.UNICAST_RELAYED,"Relayed unicast message"),Bt.ON_UNICAST.DIGEST_TRAVELED_ROUTE&&this.peerStore.digestValidRoute(s),this.id===h){for(let y of this.callbacks[n.type]||[])y(f,n.data);return}let{success:E,reason:l}=this.#e(u,e);if(!E&&!n.rerouterSignature){let y=this.pathFinder.buildRoutes(h,this.maxRoutes,this.maxHops,this.maxNodes,!0);if(!y.success)return;let C=y.routes[0].path;if(C.length>Qt.MAX_HOPS){this.verbose>1&&console.warn(`Cannot re-route unicast message to ${h} as new route exceeds maxHops (${Qt.MAX_HOPS}).`);return}let Q=this.cryptoCodex.createReroutedUnicastMessage(e,C),S=C[o+1];this.#e(S,Q)}}};await Ot();var hn=class{topic="gossip";timestamp;neighborsList;HOPS;senderId;pubkey;data;signature;signatureStart;expectedEnd;constructor(t,e,n,r,s,o,f,h,c,u){this.topic=t,this.timestamp=e,this.neighborsList=n,this.HOPS=r,this.senderId=s,this.pubkey=o,this.data=f,this.signature=h,this.signatureStart=c,this.expectedEnd=u}},qn=class{cryptoCodex;xxHash32UsageCount=0;seenTimeouts={};cache=[];cleanupFrequency=100;cleanupIn=100;cleanupDurationWarning=10;constructor(t){this.cryptoCodex=t}getGossipHistoryByTime(t="asc"){let e=this.cache.map(n=>({senderId:n.senderId,topic:n.topic,data:n.serializedMessage}));return t==="asc"?e:e.reverse()}addMessage(t){let e=ft.time,{marker:n,neighLength:r,timestamp:s,dataLength:o,pubkey:f,associatedId:h}=this.cryptoCodex.readBufferHeader(t);if(e-s>_t.EXPIRATION)return;let c=t.subarray(0,47+r+o),u=ye(c);if(this.xxHash32UsageCount++,this.seenTimeouts[u])return;let E=_t.MARKERS_BYTES[n],l=h,y=e+_t.CACHE_DURATION;return this.cache.push({hash:u,senderId:l,topic:E,serializedMessage:t,timestamp:s,expiration:y}),this.seenTimeouts[u]=y,--this.cleanupIn<=0&&this.#e(e),{hash:u,isNew:!this.seenTimeouts[u]}}#e(t=ft.time){let e=-1;for(let n=0;n<this.cache.length;n++)this.cache[n].expiration<=t?delete this.seenTimeouts[this.cache[n].hash]:e===-1&&(e=n);e>0?this.cache=this.cache.slice(e):e===-1&&(this.cache=[]),this.cleanupIn=this.cleanupFrequency}},un=class{callbacks={message_handle:[]};id;cryptoCodex;arbiter;peerStore;verbose;bloomFilter;constructor(t,e,n,r,s=0){this.id=t,this.cryptoCodex=e,this.arbiter=n,this.peerStore=r,this.verbose=s,this.bloomFilter=new qn(e)}on(t,e){this.callbacks[t]?this.callbacks[t].push(e):this.callbacks[t]=[e]}broadcastToAll(t,e="gossip",n){let r=n||_t.HOPS[e]||_t.HOPS.default,s=this.cryptoCodex.createGossipMessage(e,t,r,this.peerStore.neighborsList);if(this.bloomFilter.addMessage(s)){this.verbose>3&&console.log(`(${this.id}) Gossip ${e}, to ${JSON.stringify(this.peerStore.neighborsList)}: ${t}`);for(let o of this.peerStore.neighborsList)this.#e(o,s)}}#e(t,e){if(t===this.id)throw new Error(`Refusing to send a gossip message to self (${this.id}).`);let n=this.peerStore.connected[t]?.transportInstance;if(!n)return{success:!1,reason:`Transport instance is not available for peer ${t}.`};try{n.send(e)}catch{this.peerStore.connected[t]?.close()}}sendGossipHistoryToPeer(t){let e=this.bloomFilter.getGossipHistoryByTime("asc");for(let n of e)this.#e(t,n.data)}async handleGossipMessage(t,e){if(this.arbiter.isBanished(t))return this.verbose>=3?console.info(`%cReceived gossip message from banned peer ${t}, ignoring.`,"color: red;"):null;if(!this.arbiter.countMessageBytes(t,e.byteLength,"gossip"))return;for(let g of this.callbacks.message_handle||[])g(e);if(!this.bloomFilter.addMessage(e))return;let n=this.cryptoCodex.readGossipMessage(e);if(!n)return this.arbiter.countPeerAction(t,"WRONG_SERIALIZATION");if(!await this.arbiter.digestMessage(t,n,e)||this.arbiter.isBanished(t)||this.arbiter.isBanished(n.senderId))return;let{topic:s,timestamp:o,neighborsList:f,HOPS:h,senderId:c,data:u}=n;if(c===this.id)throw new Error(`#${this.id}#${t}# Received our own message back from peer ${t}.`);this.verbose>3&&console.log(c===t?`(${this.id}) Gossip ${s} from ${c}: ${u}`:`(${this.id}) Gossip ${s} from ${c} (by: ${t}): ${u}`),this.peerStore.digestPeerNeighbors(c,f);for(let g of this.callbacks[s]||[])g(c,u,h,n);if(h<1)return;let E=this.peerStore.neighborsList.length,l=Math.max(1,E/_t.TRANSMISSION_RATE.NEIGHBOURS_PONDERATION),y=_t.TRANSMISSION_RATE[s]||_t.TRANSMISSION_RATE.default,C=Math.pow(y,l),Q=E<_t.TRANSMISSION_RATE.MIN_NEIGHBOURS_TO_APPLY_PONDERATION,S=this.cryptoCodex.decrementGossipHops(e);for(let g of this.peerStore.neighborsList)if(g!==t){if(!Q&&Math.random()>C)continue;this.#e(g,S)}}};await Ot();var{SANDBOX:MA,ICE_CANDIDATE_EMITTER:OA,TEST_WS_EVENT_MANAGER:GA}=Nt.ENABLED?await on().then(()=>sn):{},Kn=class{maxOffers=30;offers=[];orderingBy="neighborsCount";get size(){return this.offers.length}updateOrderingBy(t=!1){this.orderingBy=t?"overlap":"neighborsCount"}removeOlderThan(t=1e3){this.offers=this.offers.filter(e=>e.timestamp+t>=ft.time)}get bestOfferInfo(){let{senderId:t,overlap:e,neighborsCount:n,data:r,timestamp:s}=this.offers.shift()||{};return{senderId:t,data:r,timestamp:s,value:this.orderingBy==="overlap"?e:n}}pushSortTrim(t,e={min:.2,max:.8}){let{min:n,max:r}=e;Math.random()<Math.min(n,this.offers.size/this.maxOffers*r)||(this.offers.push(t),this.offers.length!==1&&(this.offers.sort((s,o)=>this.orderingBy==="overlap"?s.overlap-o.overlap:o.neighborsCount-s.neighborsCount),this.size>this.maxOffers&&this.offers.pop()))}},gn=class{id;cryptoCodex;gossip;messager;peerStore;bootstraps;offersQueue=new Kn;bootstrapsConnectionState=new Map;services;NEIGHBORS_TARGET;HALF_TARGET;TWICE_TARGET;setNeighborsTarget(t=Bt.TARGET_NEIGHBORS_COUNT){this.NEIGHBORS_TARGET=t,this.HALF_TARGET=Math.ceil(this.NEIGHBORS_TARGET/2),this.TWICE_TARGET=this.NEIGHBORS_TARGET*2}automation={incomingOffer:!0,incomingAnswer:!0,spreadOffers:!0,connectBootstraps:!0};phase=0;nextBootstrapIndex=0;maxBonus=Ct.CONNECTION_UPGRADE_TIMEOUT*.2;get isPublicNode(){return!!this.services?.publicUrl}constructor(t,e,n,r,s,o){this.setNeighborsTarget(Bt.TARGET_NEIGHBORS_COUNT),this.id=t,this.cryptoCodex=e,this.gossip=n,this.messager=r,this.peerStore=s;for(let f of o)this.bootstrapsConnectionState.set(f,!1);this.bootstraps=[...o].sort(()=>Math.random()-.5),this.nextBootstrapIndex=Math.random()*this.bootstraps.length|0}tick(){let{neighborsCount:t,nonPublicNeighborsCount:e,isEnough:n,isTooMany:r,isHalfReached:s}=this.#e,o=e>=this.NEIGHBORS_TARGET/3?1:St.MAX_SDP_OFFERS;if(this.peerStore.offerManager.offersToCreate=n?0:o,this.isPublicNode){this.services.freePublicNodeByKickingPeers();return}if(r)return Math.random()>.05?this.#A():null;n?Math.random()>.05&&this.#o():this.#o(),this.phase=this.phase?0:1,this.phase===0&&this.tryConnectNextBootstrap(t,e),this.phase===1&&this.#s(e,s)}handleIncomingSignal(t,e,n){if(this.isPublicNode||!t||this.peerStore.isKicked(t)||e.signal?.type!=="offer"&&e.signal?.type!=="answer")return;let{signal:r,offerHash:s}=e||{},{connected:o,nonPublicNeighborsCount:f,isTooMany:h,isHalfReached:c}=this.#e;if(h||o[t])return;if(r.type==="answer"){if(!this.automation.incomingAnswer||this.peerStore.addConnectingPeer(t,r,s)!==!0)return;let y=Math.abs(f-this.#t(t).nonPublicCount),C=this.maxBonus/this.NEIGHBORS_TARGET,Q=Math.round(Math.min(this.maxBonus,y*C));return this.peerStore.assignSignal(t,r,s,ft.time+Q)}if(!this.automation.incomingOffer||f>this.TWICE_TARGET)return;let{overlap:u,nonPublicCount:E}=this.#t(t);if(E>this.TWICE_TARGET)return;let l={senderId:t,data:e,overlap:u,neighborsCount:E,timestamp:ft.time};this.offersQueue.updateOrderingBy(c),this.offersQueue.pushSortTrim(l)}tryConnectNextBootstrap(t=0,e=0){if(!this.automation.connectBootstraps||this.bootstraps.length===0)return;let n=t-e,r=0;for(let o in this.peerStore.connecting)r++;if(this.NEIGHBORS_TARGET||t){if(n>=this.HALF_TARGET)return;if(t>=this.NEIGHBORS_TARGET)return;if(r+e>this.TWICE_TARGET)return}let s=this.bootstraps[this.nextBootstrapIndex++%this.bootstraps.length];this.bootstrapsConnectionState.get(s)||this.#i(s)}get#e(){return{connected:this.peerStore.connected,neighborsCount:this.peerStore.neighborsList.length,nonPublicNeighborsCount:this.peerStore.standardNeighborsList.length,isEnough:this.peerStore.standardNeighborsList.length>=this.NEIGHBORS_TARGET,isTooMany:this.peerStore.standardNeighborsList.length>this.NEIGHBORS_TARGET,isHalfReached:this.peerStore.standardNeighborsList.length>=this.HALF_TARGET}}#t(t="toto"){let e=this.peerStore.known[t]?.neighbors||{},n={overlap:0,nonPublicCount:0,p1nCount:this.peerStore.getUpdatedPeerConnectionsCount(t)};for(let r in e)this.cryptoCodex.isPublicNode(r)||n.nonPublicCount++;for(let r of this.peerStore.standardNeighborsList)e[r]&&n.overlap++;return n}#n(t=[]){return t.map(e=>({id:e,...this.#t(e)}))}#r(t){let e=typeof window<"u",r=e&&window.location.protocol==="https:"?"wss://":"ws://",s=t.endsWith("/ws"),o=e&&!s?window.location.host:t;return t.startsWith("ws")?t:`${r}${o}`}#i(t="localhost:8080"){let e=null,n=new St.WS_CLIENT(this.#r(t));n.binaryType="arraybuffer",n.onerror=r=>console.error("WebSocket error:",r.stack),n.onopen=()=>{this.bootstrapsConnectionState.set(t,!0),n.onclose=()=>{this.bootstrapsConnectionState.set(t,!1);for(let r of this.peerStore.callbacks.disconnect)r(e,"out")},n.onmessage=r=>{if(e)for(let s of this.peerStore.callbacks.data)s(e,r.data);else{let s=new Uint8Array(r.data);if(s[0]>127)return;let o=this.cryptoCodex.readUnicastMessage(s);if(!o)return;let{route:f,type:h,neighborsList:c}=o;if(h!=="handshake"||f.length!==2)return;let{signatureStart:u,pubkey:E,signature:l}=o,y=s.subarray(0,u);if(!this.cryptoCodex.verifySignature(E,y,l))return;e=f[0],this.peerStore.digestPeerNeighbors(e,c),this.peerStore.connecting[e]?.in?.close(),this.peerStore.connecting[e]||(this.peerStore.connecting[e]={}),this.peerStore.connecting[e].out=new ie(e,n,"out",!0);for(let C of this.peerStore.callbacks.connect)C(e,"out")}},n.send(this.cryptoCodex.createUnicastMessage("handshake",null,[this.id,this.id],this.peerStore.neighborsList))}}#s(t=0,e=!1){if(!this.automation.spreadOffers||!this.peerStore.neighborsList.length)return;let r=Object.keys(this.peerStore.connecting).length+t,{offerHash:s,readyOffer:o}=this.peerStore.offerManager.bestReadyOffer(0,!0);if(!s||!o)return;if(!e&&r<=this.TWICE_TARGET){this.gossip.broadcastToAll({signal:o.signal,offerHash:s},"signal_offer"),o.sentCounter++;return}let f=null;for(let C of this.#n(this.peerStore.standardNeighborsList)){let Q=C[e?"overlap":"nonPublicCount"];f===null&&(f=Q),e&&Q<f&&(f=Q),!e&&Q<=f&&(f=Q)}let h=100,c=1e3,u=this.peerStore.knownCount,E=Math.max(Math.min(c/u,u/c),.127),l=[];for(let C in this.peerStore.known){if(Math.random()>E)continue;if(--c<=0)break;if(C===this.id||this.cryptoCodex.isPublicNode(C)||this.peerStore.isKicked(C))continue;if(this.peerStore.connected[C]||this.peerStore.connecting[C])continue;let{overlap:Q,nonPublicCount:S}=this.#t(C);if(!(S>this.NEIGHBORS_TARGET)&&(f===null&&(f=e?Q:S),!(e&&Q>f)&&!(!e&&S<f)&&(l.push(C),--h<=0)))break}if(!l.length)return;let y=new Map;for(let C=0;C<Math.min(l.length,100);C++){let Q=l[Math.floor(Math.random()*l.length)];if(!y.has(Q)&&(y.size===0&&o.sentCounter++,y.set(Q,!0),this.messager.sendUnicast(Q,{signal:o.signal,offerHash:s},"signal_offer"),y.size>=12))break}}#o(){let t=null,e=Object.keys(this.peerStore.connecting).length;this.offersQueue.updateOrderingBy(this.#e.isHalfReached),this.offersQueue.removeOlderThan(St.SDP_OFFER_EXPIRATION/2);for(let n=0;n<this.offersQueue.size;n++){let{senderId:r,data:s,timestamp:o,value:f}=this.offersQueue.bestOfferInfo;if(!r||!s||!o)break;if(!(this.peerStore.connected[r]||this.peerStore.isKicked(r))&&!this.peerStore.connecting[r]?.in){if(t=t===null?f:t,t!==f)break;this.peerStore.addConnectingPeer(r,s.signal,s.offerHash)===!0&&(this.peerStore.assignSignal(r,s.signal,s.offerHash,o),e++)}}}#A(){let e=this.#n(this.peerStore.standardNeighborsList).sort((n,r)=>r.overlap-n.overlap||r.nonPublicCount-n.nonPublicCount);this.peerStore.kickPeer(e[0].id,6e4,"improveTopology")}};await Ot();var Ms={1:0,2:1,3:2,4:3,5:4,6:5,7:6,8:7,9:8,A:9,B:10,C:11,D:12,E:13,F:14,G:15,H:16,J:17,K:18,L:19,M:20,N:21,P:22,Q:23,R:24,S:25,T:26,U:27,V:28,W:29,X:30,Y:31,Z:32,a:33,b:34,c:35,d:36,e:37,f:38,g:39,h:40,i:41,j:42,k:43,m:44,n:45,o:46,p:47,q:48,r:49,s:50,t:51,u:52,v:53,w:54,x:55,y:56,z:57},Os=["1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","J","K","L","M","N","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],Gt=class a{IS_BROWSER=typeof window<"u";FROMBASE64_AVAILABLE=typeof Uint8Array.fromBase64=="function";textEncoder=new TextEncoder;textDecoder=new TextDecoder;buffer2=new ArrayBuffer(2);view2=new DataView(this.buffer2);buffer4=new ArrayBuffer(4);view4=new DataView(this.buffer4);buffer8=new ArrayBuffer(8);view8=new DataView(this.buffer8);hexMap={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15};numberTo2Bytes(t){return this.view2.setUint16(0,t,!0),new Uint8Array(this.buffer2)}numberTo4Bytes(t){return this.view4.setUint32(0,t,!0),new Uint8Array(this.buffer4)}numberTo8Bytes(t){return this.view8.setBigUint64(0,BigInt(t),!0),new Uint8Array(this.buffer8)}stringToBytes(t="toto"){return this.textEncoder.encode(t)}hexToBytes(t){let e=t.length/2,n=new Uint8Array(e);for(let r=0,s=0;r<e;++r,s+=2)n[r]=(this.hexMap[t[s]]<<4)+this.hexMap[t[s+1]];return n}base64toBytes(t){if(!this.IS_BROWSER)return new Uint8Array(Buffer.from(t,"base64"));if(this.FROMBASE64_AVAILABLE)return Uint8Array.fromBase64(t);let e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}bytes2ToNumber(t){for(let e=0;e<2;e++)this.view2.setUint8(e,t[e]);return this.view2.getUint16(0,!0)}bytes4ToNumber(t){for(let e=0;e<4;e++)this.view4.setUint8(e,t[e]);return this.view4.getUint32(0,!0)}bytes8ToNumber(t){for(let e=0;e<8;e++)this.view8.setUint8(e,t[e]);return Number(this.view8.getBigUint64(0,!0))}bytesToString(t){return this.textDecoder.decode(t)}static bytesToHex(t,e=0){let n="";for(let r of t)n+=r<16?`0${r.toString(16)}`:r.toString(16);return e>0&&(n=n.padStart(e,"0")),n}bytesToHex(t,e=0){return a.bytesToHex(t,e)}hexToBase58(t){let e=a.hexToBigInt(t),n="",r=e;for(;r>0;){let o=r%BigInt(58);n=Os[Number(o)]+n,r=r/BigInt(58)}let s=this.textEncoder.encode(n);for(let o=0;o<s.length&&s[o]===0;o++)n="1"+n;return n}base58ToHex(t,e=0){let n=BigInt(0),r=BigInt(58);for(let o of t)n=n*r+BigInt(Ms[o]);let s=n.toString(16);return s.length%2!==0&&(s="0"+s),e>0&&(s=s.padStart(e,"0")),s}addressBase58ToBytes(t){let e=this.base58ToHex(t,32);return this.hexToBytes(e)}addressBytesToBase58(t){let e=this.bytesToHex(t,32);return this.hexToBase58(e)}static hexToBigInt(t){return BigInt("0x"+t)}static hexToBits(t="ffffff",e="string"){let n=[];if(e==="arrayOfNumbers")for(let r=0;r<t.length;r++)n.push(...parseInt(t[r],16).toString(2).padStart(4,"0").split("").map(s=>parseInt(s,10)));else for(let r=0;r<t.length;r++)n.push(parseInt(t[r],16).toString(2).padStart(4,"0"));return e==="string"?n.join(""):n}static bytesToBits(t,e="string"){return this.hexToBits(this.bytesToHex(t),e)}static ipToInt(t="192.168.0.1"){return t.split(".").reduce((e,n)=>(e<<8)+parseInt(n,10),0)}};var Dr=typeof window<"u",{ed25519:Te,x25519:je}=await Promise.resolve().then(()=>(Ki(),qi)),{chacha20poly1305:Ve}=await Promise.resolve().then(()=>(Is(),ds)),{randomBytes:Un}=await Promise.resolve().then(()=>(De(),es));var Ne=class{converter=new Gt;argon2;hash=async(t,e,n=2**16,r=1,s=1,o=2,f=32)=>{let h=this.#e(t,e,r,n,s,o,f),c=await this.getArgon2Lib(),u=Dr?await c.hash(h):await c.hash(t,h);if(!u)return!1;let E=u.encoded||u,l=this.#t(E);return l||!1};async getArgon2Lib(){if(this.argon2)return this.argon2;if(!Dr)try{let e=await import("argon2");this.argon2=e}catch{throw new Error("Please install argon2 package: npm install argon2")}if(this.argon2)return this.argon2;try{if(argon2)return console.log("Argon2 loaded as a global variable"),this.argon2=argon2,this.argon2}catch{}if(this.argon2)return this.argon2;console.log("trying import argon2 ES6 and inject in window");let t=await Promise.resolve().then(()=>(ps(),Es));return window.argon2=t.default,this.argon2=t.default,this.argon2}#e(t="averylongpassword123456",e="saltsaltsaltsaltsalt",n=1,r=2**10,s=1,o=2,f=32){let h=e.padEnd(20,"0").substring(0,16);return{type:o,pass:t,parallelism:s,time:n,timeCost:n,mem:r,memoryCost:r,hashLen:f,hashLength:f,salt:Dr?h:Buffer.from(h)}}#t(t="$argon2id$v=19$m=1048576,t=1,p=1$c2FsdHNhbHRzYWx0c2FsdHNhbHQ$UamPN/XTTX4quPewQNw4/s3y1JJeS22cRroh5l7OTMM"){let e=t.split("$").pop(),n=this.converter.base64toBytes(e),r=this.converter.bytesToHex(n),s=Gt.hexToBits(r,"string");return{encoded:t,hash:n,hex:r,bitsString:s}}};De();var Fe=class a{argon2=new Ne;converter=new Gt;AVOID_CRYPTO=!1;verbose=Ct.DEFAULT_VERBOSE;id;publicKey;privateKey;constructor(t,e=Ct.DEFAULT_VERBOSE){if(this.verbose=e,!t)return;this.id=t.padEnd(st.ID_LENGTH," ").slice(0,st.ID_LENGTH),this.privateKey=new Uint8Array(32).fill(0),this.publicKey=new Uint8Array(32).fill(0);let n=new TextEncoder().encode(this.id);for(let r=0;r<st.ID_LENGTH;r++)this.publicKey[r]=n[r]}static async createCryptoCodex(t,e){let n=new a(void 0,this.verbose),r=e?typeof e=="string"?n.converter.hexToBytes(e):e:void 0;return await n.generate(t,r),n}static isPublicNode(t){return(st.ARE_IDS_HEX?Gt.hexToBits(t[0]):t).startsWith(st.PUBLIC_PREFIX)}get idLength(){return st.ARE_IDS_HEX?st.ID_LENGTH/2:st.ID_LENGTH}isPublicNode(t){return a.isPublicNode(t)}async generate(t,e){if(!this.nodeId&&(await this.#t(e,t),this.AVOID_CRYPTO=!1,!this.id))throw new Error("Failed to generate identity")}async pubkeyDifficultyCheck(t){if(this.AVOID_CRYPTO||!st.DIFFICULTY)return!0;let{bitsString:e}=await this.argon2.hash(t,"HiveP2P",st.ARGON2_MEM)||{};if(e&&e.startsWith("0".repeat(st.DIFFICULTY)))return!0}#e(t){return st.ARE_IDS_HEX?this.converter.bytesToHex(t.slice(0,this.idLength),st.ID_LENGTH):this.converter.bytesToString(t.slice(0,st.ID_LENGTH))}async#t(t,e){let n=2**st.DIFFICULTY*100;for(let r=0;r<n;r++){let{secretKey:s,publicKey:o}=Te.keygen(t),f=this.#e(o);if(!(e&&!this.isPublicNode(f))&&!(!e&&this.isPublicNode(f))&&await this.pubkeyDifficultyCheck(o)){this.id=f,this.privateKey=s,this.publicKey=o,this.verbose>2&&console.log(`%cNode generated id: ${this.id} (isPublic: ${e}, difficulty: ${st.DIFFICULTY}) after ${((r+1)/2).toFixed(1)} iterations`,gt.CRYPTO_CODEX);return}}this.verbose>0&&console.log(`%cFAILED to generate id after ${n} iterations. Try lowering the difficulty.`,gt.CRYPTO_CODEX)}generateEphemeralX25519Keypair(){let{secretKey:t,publicKey:e}=je.keygen();return{myPub:e,myPriv:t}}computeX25519SharedSecret(t,e){return je.getSharedSecret(t,e)}encryptData(t,e){if(!e)throw new Error("Cannot encrypt data without shared secret.");let n=Un(12),s=Ve(e,n).encrypt(t);return Je(n,s)}decryptData(t,e){if(!e)throw new Error("Cannot decrypt data without shared secret.");let n=t.slice(0,12);return Ve(e,n).decrypt(t.slice(12))}signBufferViewAndAppendSignature(t,e,n=t.length-st.SIGNATURE_LENGTH){if(this.AVOID_CRYPTO)return;let r=t.subarray(0,n),s=Te.sign(r,e);t.set(s,n)}createGossipMessage(t,e,n=3,r=[],s=ft.time){let o=_t.MARKERS_BYTES[t];if(o===void 0)throw new Error(`Failed to create gossip message: unknown topic '${t}'.`);let f=this.#n(r),{dataCode:h,dataBytes:c}=this.#r(e),u=47+f.length+c.length+st.SIGNATURE_LENGTH+1,E=new ArrayBuffer(u),l=new Uint8Array(E);return this.#i(l,o,h,r.length,s,c,this.publicKey),l.set(f,47),l.set(c,47+f.length),l.set([Math.min(255,n)],u-1),this.signBufferViewAndAppendSignature(l,this.privateKey,u-st.SIGNATURE_LENGTH-1),l}decrementGossipHops(t){let e=new Uint8Array(t),n=t[t.length-1];return e[t.length-1]=Math.max(0,n-1),e}createUnicastMessage(t,e,n,r=[],s,o=ft.time){let f=Qt.MARKERS_BYTES[t];if(f===void 0)throw new Error(`Failed to create unicast message: unknown type '${t}'.`);if(n.length<2)throw new Error("Failed to create unicast message: route must have at least 2 nodes (next hop and target).");if(n.length>Qt.MAX_HOPS)throw new Error(`Failed to create unicast message: route exceeds max hops (${Qt.MAX_HOPS}).`);let h=this.#n(r),{dataCode:c,dataBytes:u}=this.#r(e),E=s?this.encryptData(u,s):u,l=this.#n(n),y=47+h.length+1+l.length+E.length+st.SIGNATURE_LENGTH,C=new ArrayBuffer(y),Q=new Uint8Array(C);this.#i(Q,f,c,r.length,o,E,this.publicKey);let S=h.length+E.length;return Q.set(h,47),Q.set(E,47+h.length),Q.set([n.length],47+S),Q.set(l,48+S),this.signBufferViewAndAppendSignature(Q,this.privateKey,y-st.SIGNATURE_LENGTH),Q}createReroutedUnicastMessage(t,e){if(e.length<2)throw new Error("Failed to create rerouted unicast message: route must have at least 2 nodes (next hop and target).");if(e.length>Qt.MAX_HOPS)throw new Error(`Failed to create rerouted unicast message: route exceeds max hops (${Qt.MAX_HOPS}).`);let n=e.map(f=>this.converter.stringToBytes(f)),r=t.length+32+st.ID_LENGTH*n.length+st.SIGNATURE_LENGTH,s=new ArrayBuffer(r),o=new Uint8Array(s);o.set(t,0),o.set(this.publicKey,t.length);for(let f=0;f<n.length;f++)o.set(n[f],t.length+32+f*st.ID_LENGTH);return this.signBufferViewAndAppendSignature(o,this.privateKey,r-st.SIGNATURE_LENGTH),o}#n(t){return st.ARE_IDS_HEX?this.converter.hexToBytes(t.join(""),st.ID_LENGTH*t.length):this.converter.stringToBytes(t.join(""))}#r(t){return typeof t=="string"?{dataCode:1,dataBytes:this.converter.stringToBytes(t)}:t instanceof Uint8Array?{dataCode:2,dataBytes:t}:{dataCode:3,dataBytes:this.converter.stringToBytes(JSON.stringify(t))}}#i(t,e,n,r,s,o,f){let h=this.converter.numberTo8Bytes(s),c=this.converter.numberTo4Bytes(o.length);t.set([e],0),t.set([n],1),t.set([r],2),t.set(h,3),t.set(c,11),t.set(f,15)}verifySignature(t,e,n){return this.AVOID_CRYPTO?!0:Te.verify(n,e,t)}readBufferHeader(t,e=!0){let n=t[0],r=t[1],s=t[2],o=t.slice(3,11),f=t.slice(11,15),h=t.slice(15,47),c=e?this.#e(h):null,u=s*this.idLength,E=this.converter.bytes8ToNumber(o),l=this.converter.bytes4ToNumber(f);return{marker:n,dataCode:r,neighLength:u,timestamp:E,dataLength:l,pubkey:h,associatedId:c}}readGossipMessage(t){this.verbose>3&&console.log(`%creadGossipMessage ${t.byteLength} bytes`,gt.CRYPTO_CODEX),this.verbose>4&&console.log(`%c${t}`,gt.CRYPTO_CODEX);try{let{marker:e,dataCode:n,neighLength:r,timestamp:s,dataLength:o,pubkey:f,associatedId:h}=this.readBufferHeader(t),c=_t.MARKERS_BYTES[e];if(c===void 0)throw new Error(`Failed to deserialize gossip message: unknown marker byte ${d[0]}.`);let u=r+o,E=this.#s(t.slice(47,47+r)),l=this.#o(n,t.slice(47+r,47+u)),y=47+u,C=t.slice(y,y+st.SIGNATURE_LENGTH),Q=t[t.length-1],S=y+st.SIGNATURE_LENGTH+1,g=h;return new hn(c,s,E,Q,g,f,l,C,y,S)}catch(e){this.verbose>1&&console.warn(`Error deserializing ${topic||"unknown"} gossip message:`,e.stack)}return null}readUnicastMessage(t,e){this.verbose>3&&console.log(`%creadUnicastMessage ${t.byteLength} bytes`,gt.CRYPTO_CODEX),this.verbose>4&&console.log(`%c${t}`,gt.CRYPTO_CODEX);try{let{marker:n,dataCode:r,neighLength:s,timestamp:o,dataLength:f,pubkey:h}=this.readBufferHeader(t,!1),c=Qt.MARKERS_BYTES[n];if(c===void 0)throw new Error(`Failed to deserialize unicast message: unknown marker byte ${B[0]}.`);let u=s+f,E=this.#s(t.slice(47,47+s)),y=t[47+u]*this.idLength,C=47+u+1+y,Q=t.slice(47+u+1,C),S=this.#s(Q),g=S[S.length-1],B=c==="private_message"&&this.id===g?this.decryptData(t.slice(47+s,47+u),e.privacy[this.#e(h)]?.sharedSecret):t.slice(47+s,47+u),p=this.id===g?this.#o(r,B):B,_=C+st.SIGNATURE_LENGTH,w=t.slice(C,_);if(!(t.length>_))return new Me(c,o,E,S,h,p,w,C,_);let N=t.slice(_,_+32),b=this.#s(t.slice(_+32,t.length-st.SIGNATURE_LENGTH)),m=t.slice(t.length-st.SIGNATURE_LENGTH);return new cn(c,o,E,S,h,p,w,N,b,m,t.length)}catch(n){this.verbose>1&&console.warn(`Error deserializing ${type||"unknown"} unicast message:`,n.stack)}return null}#s(t){let e=[],n=this.idLength;if(t.length%n!==0)throw new Error("Failed to parse ids: invalid serialized length.");for(let r=0;r<t.length/n;r++){let s=t.slice(r*n,(r+1)*n);st.ARE_IDS_HEX?e.push(this.converter.bytesToHex(s,st.ID_LENGTH)):e.push(this.converter.bytesToString(s))}return e}#o(t,e){if(t===1)return this.converter.bytesToString(e);if(t===2)return e;if(t===3)return JSON.parse(this.converter.bytesToString(e));throw new Error(`Failed to parse data: unknown data code '${t}'.`)}};await Ot();var $o=Ct.IS_BROWSER?null:await import("dgram"),Ln=class{id;verbose;maxKick;peerStore;cryptoCodex;publicUrl;constructor(t,e,n=3,r=1){this.id=t.id,this.verbose=r,this.maxKick=n,this.peerStore=e,this.cryptoCodex=t}start(t="localhost",e=Yt.PORT){this.publicUrl=`ws://${t}:${e}`,this.#e(t,e),Nt.USE_TEST_TRANSPORTS||this.#t(t,e+1)}freePublicNodeByKickingPeers(){let t=Math.min(this.maxKick,this.peerStore.neighborsList.length-Bt.TARGET_NEIGHBORS_COUNT);if(t<=0)return;let e=0,n=Yt.AUTO_KICK_DELAY;for(let r in this.peerStore.connected){let s=this.peerStore.connected[r],o=this.peerStore.getUpdatedPeerConnectionsCount(r,!1);if(o>Bt.TARGET_NEIGHBORS_COUNT){if(this.peerStore.kickPeer(r,Yt.AUTO_KICK_DURATION,"freePublicNode"),this.peerStore.neighborsList.length<=Bt.TARGET_NEIGHBORS_COUNT)break;continue}if(!(s.getConnectionDuration()<(o>2?n:n*2))&&(this.peerStore.kickPeer(r,Yt.AUTO_KICK_DURATION,"freePublicNode"),++e>=t))break}}#e(t="localhost",e=Yt.PORT){this.wsServer=new St.WS_SERVER({port:e,host:t}),this.wsServer.on("error",n=>console.error(`WebSocket error on Node #${this.id}:`,n)),this.wsServer.on("connection",n=>{n.on("close",()=>{if(r)for(let s of this.peerStore.callbacks.disconnect)s(r,"in")}),n.on("error",s=>console.error(`WebSocket error on Node #${this.id} with peer ${r}:`,s.stack));let r;n.on("message",s=>{if(r)for(let o of this.peerStore.callbacks.data)o(r,s);else{let o=new Uint8Array(s);if(o[0]>127)return;let f=this.cryptoCodex.readUnicastMessage(o);if(!f)return;let{route:h,type:c,neighborsList:u}=f;if(c!=="handshake"||h.length!==2)return;let{signatureStart:E,pubkey:l,signature:y}=f,C=o.subarray(0,E);if(!this.cryptoCodex.verifySignature(l,C,y))return;r=h[0],this.peerStore.digestPeerNeighbors(r,u),this.peerStore.connecting[r]?.out?.close(),this.peerStore.connecting[r]||(this.peerStore.connecting[r]={}),this.peerStore.connecting[r].in=new ie(r,n,"in",!0);for(let Q of this.peerStore.callbacks.connect)Q(r,"in")}}),n.send(this.cryptoCodex.createUnicastMessage("handshake",null,[this.id,this.id],this.peerStore.neighborsList))})}#t(t="localhost",e=Yt.PORT+1){this.stunServer=$o.createSocket("udp4"),this.stunServer.on("message",(n,r)=>{this.verbose>2&&console.log(`%cSTUN message from ${r.address}:${r.port} - ${n.toString("hex")}`,gt.SERVICE),this.#n(n)&&this.stunServer.send(this.#r(n,r),r.port,r.address)}),this.stunServer.bind(e,t),this.verbose>2&&console.log(`%cSTUN server listening on ${t}:${e}`,gt.SERVICE)}#n(t){if(t.length<20)return!1;let e=t.readUInt16BE(0),n=t.readUInt32BE(4);return e===1&&n===554869826}#r(t,e){let n=t.subarray(8,20),r=Buffer.allocUnsafe(32);return r.writeUInt16BE(257,0),r.writeUInt16BE(12,2),r.writeUInt32BE(554869826,4),n.copy(r,8),r.writeUInt16BE(1,20),r.writeUInt16BE(8,22),r.writeUInt16BE(1,24),r.writeUInt16BE(e.port,26),r.writeUInt32BE(Gt.ipToInt(e.address),28),this.verbose>2&&console.log(`%cSTUN Response: client will discover IP ${e.address}:${e.port}`,"color: green;"),r}static deriveSTUNServers(t){let e=[];for(let n of t){if(!n.includes(":")||n.endsWith("/ws")||n.endsWith("/wss"))continue;let r=n.replace("ws://","stun:");r.replace("wss://","stun:"),r.includes("stun:")&&e.push({urls:r})}return St.CENTRALIZED_STUN_SERVERS&&(e.push({urls:"stun:stun.l.google.com:5349"}),e.push({urls:"stun:stun.l.google.com:19302"}),e.push({urls:"stun:stun1.l.google.com:3478"}),e.push({urls:"stun:stun1.l.google.com:5349"})),e}};async function Bs(a={}){let t=a.verbose!==void 0?a.verbose:Ct.DEFAULT_VERBOSE,e=a.cryptoCodex||new Fe(void 0,t),n=ft.sync(t);e.publicKey||await e.generate(!1),await n;let r=new Xe(e,a.bootstraps||[],t);return a.autoStart!==!1&&await r.start(),r}var Xe=class{started=!1;id;cryptoCodex;verbose;offerManager;arbiter;peerStore;messager;gossip;topologist;services;constructor(t,e=[],n=Ct.DEFAULT_VERBOSE){this.verbose=n,this.topologist?.services&&(this.topologist.services.verbose=n),this.cryptoCodex=t,this.id=this.cryptoCodex.id;let r=Ln.deriveSTUNServers(e||[]);this.offerManager=new ze(this.id,r,n),this.arbiter=new Ze(this.id,t,n),this.peerStore=new An(this.id,this.cryptoCodex,this.offerManager,this.arbiter,n),this.messager=new fn(this.id,this.cryptoCodex,this.arbiter,this.peerStore,n),this.gossip=new un(this.id,this.cryptoCodex,this.arbiter,this.peerStore,n),this.topologist=new gn(this.id,this.cryptoCodex,this.gossip,this.messager,this.peerStore,e||[]);let{arbiter:s,peerStore:o,messager:f,gossip:h,topologist:c}=this;o.on("signal",(u,E)=>this.sendMessage(u,E,{type:"signal_answer"})),o.on("connect",(u,E)=>this.#e(u,E)),o.on("disconnect",(u,E)=>this.#t(u,E)),o.on("data",(u,E)=>this.#n(u,E)),f.on("signal_answer",(u,E)=>c.handleIncomingSignal(u,E)),f.on("signal_offer",(u,E)=>c.handleIncomingSignal(u,E)),f.on("privacy",(u,E)=>this.#r(u,E)),h.on("signal_offer",(u,E,l)=>c.handleIncomingSignal(u,E,l)),n>2&&console.log(`Node initialized: ${this.id}`)}#e=(t,e)=>{let n=this.cryptoCodex.isPublicNode(t);if(this.publicUrl)return;this.verbose>(this.publicUrl||n?3:2)&&console.log(`(${this.id}) ${e==="in"?"Incoming":"Outgoing"} connection established with peer ${t}`),(!n&&!this.cryptoCodex.isPublicNode(this.id)||e==="in")&&this.sendMessage(t,this.id,"handshake");let s=this.peerStore.neighborsList.length>=Bt.TARGET_NEIGHBORS_COUNT+this.halfTarget,o=()=>{Bt.ON_CONNECT_DISPATCH.OVER_NEIGHBORED&&s&&this.broadcast([],{type:"over_neighbored"}),Bt.ON_CONNECT_DISPATCH.SHARE_HISTORY&&this.peerStore.getUpdatedPeerConnectionsCount(t)<=1&&this.gossip.sendGossipHistoryToPeer(t)};Bt.ON_CONNECT_DISPATCH.DELAY?setTimeout(o,Bt.ON_CONNECT_DISPATCH.DELAY):o()};#t=(t,e)=>{if(!this.peerStore.neighborsList.length){for(let s in this.peerStore.connecting)this.peerStore.kickPeer(s,0,"no_neighbors_left");for(let s in this.offerManager.offers)this.offerManager.offers[s].timestamp=0}let n=this.cryptoCodex.isPublicNode(t);if(this.peerStore.connected[t])return;this.verbose>(this.publicUrl||n?3:2)&&console.log(`(${this.id}) ${e==="in"?"Incoming":"Outgoing"} connection closed with peer ${t}`)};#n=(t,e)=>{let n=new Uint8Array(e);n[0]>127?this.gossip.handleGossipMessage(t,n):this.messager.handleDirectMessage(t,n)};get publicUrl(){return this.services?.publicUrl}get time(){return ft.time}async start(){return await ft.sync(this.verbose),this.started=!0,Nt.AVOID_INTERVALS||(this.arbiterInterval=setInterval(()=>this.arbiter.tick(),1e3),this.peerStoreInterval=setInterval(()=>{this.peerStore.cleanupExpired(),this.peerStore.offerManager.tick()},2500),this.publicUrl)||(this.enhancerInterval=setInterval(()=>this.topologist.tick(),Bt.LOOP_DELAY),this.topologist.tryConnectNextBootstrap()),!0}broadcast(t,e={}){let{topic:n,HOPS:r}=e;return this.gossip.broadcastToAll(t,n,r)}async sendMessage(t,e,n={}){let{type:r,spread:s}=n,o=r==="private_message"?await this.getPeerPrivacy(t):null;return o&&!o?.sharedSecret?(this.verbose>1&&console.warn(`Cannot send encrypted message to ${t} as shared secret could not be established.`),!1):this.messager.sendUnicast(t,e,r,s)}async sendPrivateMessage(t,e,n={}){let r={...n,type:"private_message"};return this.sendMessage(t,e,r)}async getPeerPrivacy(t,e=20){let n=this.peerStore.privacy[t];n||(this.peerStore.privacy[t]=this.cryptoCodex.generateEphemeralX25519Keypair(),n=this.peerStore.privacy[t]);let r=1;for(;!n?.sharedSecret&&e-- >0;)r--<=0&&(this.messager.sendUnicast(t,n.myPub,"privacy"),r=5),await new Promise(s=>setTimeout(s,100)),n=this.peerStore.privacy[t];return n}#r(t,e){this.peerStore.privacy[t]?.sharedSecret||(this.peerStore.privacy[t]||(this.peerStore.privacy[t]=this.cryptoCodex.generateEphemeralX25519Keypair()),this.peerStore.privacy[t].peerPub=e,this.peerStore.privacy[t].sharedSecret=this.cryptoCodex.computeX25519SharedSecret(this.peerStore.privacy[t].myPriv,e),this.messager.sendUnicast(t,this.peerStore.privacy[t].myPub,"privacy"))}async tryConnectToPeer(t="toto",e=10){if(!this.peerStore.connected[t])do{let{offerHash:n,readyOffer:r}=this.peerStore.offerManager.bestReadyOffer(100,!1);if(!n||!r)await new Promise(s=>setTimeout(s,1e3));else{this.messager.sendUnicast(t,{signal:r.signal,offerHash:n},"signal_offer");return}}while(e-- >0)}destroy(){this.enhancerInterval&&clearInterval(this.enhancerInterval),this.enhancerInterval=null,this.peerStoreInterval&&clearInterval(this.peerStoreInterval),this.peerStoreInterval=null,this.peerStore.destroy(),this.wsServer&&this.wsServer.close(),this.stunServer&&this.stunServer.close()}onPeerConnect(t){this.peerStore.on("connect",t)}onPeerDisconnect(t){this.peerStore.on("disconnect",t)}onMessageData(t,e=!0){this.messager.on("message",t),e&&this.messager.on("private_message",t)}onPrivateMessageData(t){this.messager.on("private_message",t)}onGossipData(t){this.gossip.on("gossip",t)}onSignalOffer(t){this.messager.on("signal_offer",t),this.gossip.on("signal_offer",t)}onSignalAnswer(t){this.messager.on("signal_answer",t)}kickPeer(t,e="kicked_by_node"){this.peerStore.kickPeer(t,0,e)}banPeer(t,e=6e4,n="banished_by_node"){this.arbiter.trustBalances[t]=0,this.arbiter.adjustTrust(t,-e,n)}};await Ot();function Cs(a,t){for(let e in t)t[e]&&typeof t[e]=="object"&&!Array.isArray(t[e])?(a[e]=a[e]||{},Cs(a[e],t[e])):a[e]=t[e]}var ys={CLOCK:ft,CONFIG:Ur,Converter:Gt,mergeConfig:Cs,Node:Xe,createNode:Bs,CryptoCodex:Fe,ed25519:Te,x25519:je,chacha20poly1305:Ve,randomBytes:Un,Argon2Unified:Ne,xxHash32:ye};var Mc=ys;typeof window<"u"&&(window.HiveP2P=ys);export{Ne as Argon2Unified,ft as CLOCK,Ur as CONFIG,Gt as Converter,Fe as CryptoCodex,Xe as Node,Ve as chacha20poly1305,Bs as createNode,Mc as default,Te as ed25519,Cs as mergeConfig,Un as randomBytes,je as x25519,ye as xxHash32};
4
4
  /*!
5
5
  * The buffer module from node.js, for the browser.
6
6
  *