@libp2p/tcp 8.0.0 → 8.0.1-446fff87
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/dist/index.min.js +4 -4
- package/package.json +5 -5
package/dist/index.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PTcp = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var Libp2PTcp=(()=>{var
|
|
2
|
+
"use strict";var Libp2PTcp=(()=>{var Ai=Object.create;var de=Object.defineProperty;var Ii=Object.getOwnPropertyDescriptor;var Ri=Object.getOwnPropertyNames;var Bi=Object.getPrototypeOf,Mi=Object.prototype.hasOwnProperty;var bt=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var N=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),K=(e,t)=>{for(var r in t)de(e,r,{get:t[r],enumerable:!0})},un=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ri(t))!Mi.call(e,i)&&i!==r&&de(e,i,{get:()=>t[i],enumerable:!(n=Ii(t,i))||n.enumerable});return e};var H=(e,t,r)=>(r=e!=null?Ai(Bi(e)):{},un(t||!e||!e.__esModule?de(r,"default",{value:e,enumerable:!0}):r,e)),Di=e=>un(de({},"__esModule",{value:!0}),e);var hn=N((xu,pn)=>{var $t=1e3,Vt=$t*60,jt=Vt*60,Dt=jt*24,ki=Dt*7,Pi=Dt*365.25;pn.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Oi(e);if(r==="number"&&isFinite(e))return t.long?_i(e):Ni(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Oi(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\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(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Pi;case"weeks":case"week":case"w":return r*ki;case"days":case"day":case"d":return r*Dt;case"hours":case"hour":case"hrs":case"hr":case"h":return r*jt;case"minutes":case"minute":case"mins":case"min":case"m":return r*Vt;case"seconds":case"second":case"secs":case"sec":case"s":return r*$t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Ni(e){var t=Math.abs(e);return t>=Dt?Math.round(e/Dt)+"d":t>=jt?Math.round(e/jt)+"h":t>=Vt?Math.round(e/Vt)+"m":t>=$t?Math.round(e/$t)+"s":e+"ms"}function _i(e){var t=Math.abs(e);return t>=Dt?me(e,t,Dt,"day"):t>=jt?me(e,t,jt,"hour"):t>=Vt?me(e,t,Vt,"minute"):t>=$t?me(e,t,$t,"second"):e+" ms"}function me(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}});var He=N((Su,dn)=>{function Fi(e){r.debug=r,r.default=r,r.coerce=g,r.disable=c,r.enable=i,r.enabled=f,r.humanize=hn(),r.destroy=C,Object.keys(e).forEach(l=>{r[l]=e[l]}),r.names=[],r.skips=[],r.formatters={};function t(l){let y=0;for(let x=0;x<l.length;x++)y=(y<<5)-y+l.charCodeAt(x),y|=0;return r.colors[Math.abs(y)%r.colors.length]}r.selectColor=t;function r(l){let y,x=null,S,m;function A(...R){if(!A.enabled)return;let E=A,I=Number(new Date),k=I-(y||I);E.diff=k,E.prev=y,E.curr=I,y=I,R[0]=r.coerce(R[0]),typeof R[0]!="string"&&R.unshift("%O");let O=0;R[0]=R[0].replace(/%([a-zA-Z%])/g,(Z,q)=>{if(Z==="%%")return"%";O++;let W=r.formatters[q];if(typeof W=="function"){let it=R[O];Z=W.call(E,it),R.splice(O,1),O--}return Z}),r.formatArgs.call(E,R),(E.log||r.log).apply(E,R)}return A.namespace=l,A.useColors=r.useColors(),A.color=r.selectColor(l),A.extend=n,A.destroy=r.destroy,Object.defineProperty(A,"enabled",{enumerable:!0,configurable:!1,get:()=>x!==null?x:(S!==r.namespaces&&(S=r.namespaces,m=r.enabled(l)),m),set:R=>{x=R}}),typeof r.init=="function"&&r.init(A),A}function n(l,y){let x=r(this.namespace+(typeof y>"u"?":":y)+l);return x.log=this.log,x}function i(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let y,x=(typeof l=="string"?l:"").split(/[\s,]+/),S=x.length;for(y=0;y<S;y++)x[y]&&(l=x[y].replace(/\*/g,".*?"),l[0]==="-"?r.skips.push(new RegExp("^"+l.slice(1)+"$")):r.names.push(new RegExp("^"+l+"$")))}function c(){let l=[...r.names.map(h),...r.skips.map(h).map(y=>"-"+y)].join(",");return r.enable(""),l}function f(l){if(l[l.length-1]==="*")return!0;let y,x;for(y=0,x=r.skips.length;y<x;y++)if(r.skips[y].test(l))return!1;for(y=0,x=r.names.length;y<x;y++)if(r.names[y].test(l))return!0;return!1}function h(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function g(l){return l instanceof Error?l.stack||l.message:l}function C(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}dn.exports=Fi});var mn=N((tt,ge)=>{tt.formatArgs=Ui;tt.save=$i;tt.load=Vi;tt.useColors=Li;tt.storage=ji();tt.destroy=(()=>{let e=!1;return()=>{e||(e=!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`."))}})();tt.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"];function Li(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1: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+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Ui(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+ge.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),e.splice(n,0,t)}tt.log=console.debug||console.log||(()=>{});function $i(e){try{e?tt.storage.setItem("debug",e):tt.storage.removeItem("debug")}catch{}}function Vi(){let e;try{e=tt.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function ji(){try{return localStorage}catch{}}ge.exports=He()(tt);var{formatters:zi}=ge.exports;zi.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var bn=N((Tu,gn)=>{"use strict";gn.exports=(e,t)=>{t=t||process.argv;let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),i=t.indexOf("--");return n!==-1&&(i===-1?!0:n<i)}});var yn=N((Cu,wn)=>{"use strict";var qi=bt("os"),lt=bn(),U=process.env,zt;lt("no-color")||lt("no-colors")||lt("color=false")?zt=!1:(lt("color")||lt("colors")||lt("color=true")||lt("color=always"))&&(zt=!0);"FORCE_COLOR"in U&&(zt=U.FORCE_COLOR.length===0||parseInt(U.FORCE_COLOR,10)!==0);function Gi(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Hi(e){if(zt===!1)return 0;if(lt("color=16m")||lt("color=full")||lt("color=truecolor"))return 3;if(lt("color=256"))return 2;if(e&&!e.isTTY&&zt!==!0)return 0;let t=zt?1:0;if(process.platform==="win32"){let r=qi.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in U)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(r=>r in U)||U.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in U)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(U.TEAMCITY_VERSION)?1:0;if(U.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in U){let r=parseInt((U.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(U.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(U.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(U.TERM)||"COLORTERM"in U?1:(U.TERM==="dumb",t)}function Ze(e){let t=Hi(e);return Gi(t)}wn.exports={supportsColor:Ze,stdout:Ze(process.stdout),stderr:Ze(process.stderr)}});var xn=N((L,we)=>{var Zi=bt("tty"),be=bt("util");L.init=ta;L.log=Yi;L.formatArgs=Xi;L.save=Qi;L.load=Ki;L.useColors=Wi;L.destroy=be.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");L.colors=[6,2,3,4,5,1];try{let e=yn();e&&(e.stderr||e).level>=2&&(L.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}L.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(i,c)=>c.toUpperCase()),n=process.env[t];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),e[r]=n,e},{});function Wi(){return"colors"in L.inspectOpts?!!L.inspectOpts.colors:Zi.isatty(process.stderr.fd)}function Xi(e){let{namespace:t,useColors:r}=this;if(r){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),c=` ${i};1m${t} \x1B[0m`;e[0]=c+e[0].split(`
|
|
3
3
|
`).join(`
|
|
4
|
-
`+c),
|
|
5
|
-
`)}function
|
|
6
|
-
`).map(t=>t.trim()).join(" ")};ns.O=function(r){return this.inspectOpts.colors=this.useColors,Re.inspect(r,this.inspectOpts)}});var os=z((Np,ur)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?ur.exports=Yn():ur.exports=ss()});var Vs=z((Ql,zs)=>{zs.exports=jr;var $s=128,Yu=127,Ku=~Yu,tf=Math.pow(2,31);function jr(r,t,e){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw jr.bytes=0,new RangeError("Could not encode varint");t=t||[],e=e||0;for(var n=e;r>=tf;)t[e++]=r&255|$s,r/=128;for(;r&Ku;)t[e++]=r&255|$s,r>>>=7;return t[e]=r|0,jr.bytes=e-n+1,t}});var Gs=z((Yl,qs)=>{qs.exports=qr;var ef=128,js=127;function qr(r,n){var e=0,n=n||0,o=0,c=n,f,l=r.length;do{if(c>=l||o>49)throw qr.bytes=0,new RangeError("Could not decode varint");f=r[c++],e+=o<28?(f&js)<<o:(f&js)*Math.pow(2,o),o+=7}while(f>=ef);return qr.bytes=c-n,e}});var Zs=z((Kl,Hs)=>{var rf=Math.pow(2,7),nf=Math.pow(2,14),sf=Math.pow(2,21),of=Math.pow(2,28),af=Math.pow(2,35),cf=Math.pow(2,42),uf=Math.pow(2,49),ff=Math.pow(2,56),pf=Math.pow(2,63);Hs.exports=function(r){return r<rf?1:r<nf?2:r<sf?3:r<of?4:r<af?5:r<cf?6:r<uf?7:r<ff?8:r<pf?9:10}});var Gr=z((th,Ws)=>{Ws.exports={encode:Vs(),decode:Gs(),encodingLength:Zs()}});var Sn=z((We,Eo)=>{(function(){var r,t=0xdeadbeefcafe,e=(t&16777215)==15715070;function n(s,i,a){s!=null&&(typeof s=="number"?this.fromNumber(s,i,a):i==null&&typeof s!="string"?this.fromString(s,256):this.fromString(s,i))}function o(){return new n(null)}function c(s,i,a,u,d,m){for(;--m>=0;){var w=i*this[s++]+a[u]+d;d=Math.floor(w/67108864),a[u++]=w&67108863}return d}function f(s,i,a,u,d,m){for(var w=i&32767,x=i>>15;--m>=0;){var k=this[s]&32767,j=this[s++]>>15,it=x*k+j*w;k=w*k+((it&32767)<<15)+a[u]+(d&1073741823),d=(k>>>30)+(it>>>15)+x*j+(d>>>30),a[u++]=k&1073741823}return d}function l(s,i,a,u,d,m){for(var w=i&16383,x=i>>14;--m>=0;){var k=this[s]&16383,j=this[s++]>>14,it=x*k+j*w;k=w*k+((it&16383)<<14)+a[u]+d,d=(k>>28)+(it>>14)+x*j,a[u++]=k&268435455}return d}var g=typeof navigator<"u";g&&e&&navigator.appName=="Microsoft Internet Explorer"?(n.prototype.am=f,r=30):g&&e&&navigator.appName!="Netscape"?(n.prototype.am=c,r=26):(n.prototype.am=l,r=28),n.prototype.DB=r,n.prototype.DM=(1<<r)-1,n.prototype.DV=1<<r;var A=52;n.prototype.FV=Math.pow(2,A),n.prototype.F1=A-r,n.prototype.F2=2*r-A;var p="0123456789abcdefghijklmnopqrstuvwxyz",b=new Array,y,S;for(y="0".charCodeAt(0),S=0;S<=9;++S)b[y++]=S;for(y="a".charCodeAt(0),S=10;S<36;++S)b[y++]=S;for(y="A".charCodeAt(0),S=10;S<36;++S)b[y++]=S;function h(s){return p.charAt(s)}function T(s,i){var a=b[s.charCodeAt(i)];return a??-1}function B(s){for(var i=this.t-1;i>=0;--i)s[i]=this[i];s.t=this.t,s.s=this.s}function C(s){this.t=1,this.s=s<0?-1:0,s>0?this[0]=s:s<-1?this[0]=s+this.DV:this.t=0}function I(s){var i=o();return i.fromInt(s),i}function M(s,i){var a;if(i==16)a=4;else if(i==8)a=3;else if(i==256)a=8;else if(i==2)a=1;else if(i==32)a=5;else if(i==4)a=2;else{this.fromRadix(s,i);return}this.t=0,this.s=0;for(var u=s.length,d=!1,m=0;--u>=0;){var w=a==8?s[u]&255:T(s,u);if(w<0){s.charAt(u)=="-"&&(d=!0);continue}d=!1,m==0?this[this.t++]=w:m+a>this.DB?(this[this.t-1]|=(w&(1<<this.DB-m)-1)<<m,this[this.t++]=w>>this.DB-m):this[this.t-1]|=w<<m,m+=a,m>=this.DB&&(m-=this.DB)}a==8&&s[0]&128&&(this.s=-1,m>0&&(this[this.t-1]|=(1<<this.DB-m)-1<<m)),this.clamp(),d&&n.ZERO.subTo(this,this)}function R(){for(var s=this.s&this.DM;this.t>0&&this[this.t-1]==s;)--this.t}function N(s){if(this.s<0)return"-"+this.negate().toString(s);var i;if(s==16)i=4;else if(s==8)i=3;else if(s==2)i=1;else if(s==32)i=5;else if(s==4)i=2;else return this.toRadix(s);var a=(1<<i)-1,u,d=!1,m="",w=this.t,x=this.DB-w*this.DB%i;if(w-- >0)for(x<this.DB&&(u=this[w]>>x)>0&&(d=!0,m=h(u));w>=0;)x<i?(u=(this[w]&(1<<x)-1)<<i-x,u|=this[--w]>>(x+=this.DB-i)):(u=this[w]>>(x-=i)&a,x<=0&&(x+=this.DB,--w)),u>0&&(d=!0),d&&(m+=h(u));return d?m:"0"}function _(){var s=o();return n.ZERO.subTo(this,s),s}function D(){return this.s<0?this.negate():this}function F(s){var i=this.s-s.s;if(i!=0)return i;var a=this.t;if(i=a-s.t,i!=0)return this.s<0?-i:i;for(;--a>=0;)if((i=this[a]-s[a])!=0)return i;return 0}function G(s){var i=1,a;return(a=s>>>16)!=0&&(s=a,i+=16),(a=s>>8)!=0&&(s=a,i+=8),(a=s>>4)!=0&&(s=a,i+=4),(a=s>>2)!=0&&(s=a,i+=2),(a=s>>1)!=0&&(s=a,i+=1),i}function Wo(){return this.t<=0?0:this.DB*(this.t-1)+G(this[this.t-1]^this.s&this.DM)}function Jo(s,i){var a;for(a=this.t-1;a>=0;--a)i[a+s]=this[a];for(a=s-1;a>=0;--a)i[a]=0;i.t=this.t+s,i.s=this.s}function Xo(s,i){for(var a=s;a<this.t;++a)i[a-s]=this[a];i.t=Math.max(this.t-s,0),i.s=this.s}function Qo(s,i){var a=s%this.DB,u=this.DB-a,d=(1<<u)-1,m=Math.floor(s/this.DB),w=this.s<<a&this.DM,x;for(x=this.t-1;x>=0;--x)i[x+m+1]=this[x]>>u|w,w=(this[x]&d)<<a;for(x=m-1;x>=0;--x)i[x]=0;i[m]=w,i.t=this.t+m+1,i.s=this.s,i.clamp()}function Yo(s,i){i.s=this.s;var a=Math.floor(s/this.DB);if(a>=this.t){i.t=0;return}var u=s%this.DB,d=this.DB-u,m=(1<<u)-1;i[0]=this[a]>>u;for(var w=a+1;w<this.t;++w)i[w-a-1]|=(this[w]&m)<<d,i[w-a]=this[w]>>u;u>0&&(i[this.t-a-1]|=(this.s&m)<<d),i.t=this.t-a,i.clamp()}function Ko(s,i){for(var a=0,u=0,d=Math.min(s.t,this.t);a<d;)u+=this[a]-s[a],i[a++]=u&this.DM,u>>=this.DB;if(s.t<this.t){for(u-=s.s;a<this.t;)u+=this[a],i[a++]=u&this.DM,u>>=this.DB;u+=this.s}else{for(u+=this.s;a<s.t;)u-=s[a],i[a++]=u&this.DM,u>>=this.DB;u-=s.s}i.s=u<0?-1:0,u<-1?i[a++]=this.DV+u:u>0&&(i[a++]=u),i.t=a,i.clamp()}function ti(s,i){var a=this.abs(),u=s.abs(),d=a.t;for(i.t=d+u.t;--d>=0;)i[d]=0;for(d=0;d<u.t;++d)i[d+a.t]=a.am(0,u[d],i,d,0,a.t);i.s=0,i.clamp(),this.s!=s.s&&n.ZERO.subTo(i,i)}function ei(s){for(var i=this.abs(),a=s.t=2*i.t;--a>=0;)s[a]=0;for(a=0;a<i.t-1;++a){var u=i.am(a,i[a],s,2*a,0,1);(s[a+i.t]+=i.am(a+1,2*i[a],s,2*a+1,u,i.t-a-1))>=i.DV&&(s[a+i.t]-=i.DV,s[a+i.t+1]=1)}s.t>0&&(s[s.t-1]+=i.am(a,i[a],s,2*a,0,1)),s.s=0,s.clamp()}function ri(s,i,a){var u=s.abs();if(!(u.t<=0)){var d=this.abs();if(d.t<u.t){i?.fromInt(0),a!=null&&this.copyTo(a);return}a==null&&(a=o());var m=o(),w=this.s,x=s.s,k=this.DB-G(u[u.t-1]);k>0?(u.lShiftTo(k,m),d.lShiftTo(k,a)):(u.copyTo(m),d.copyTo(a));var j=m.t,it=m[j-1];if(it!=0){var et=it*(1<<this.F1)+(j>1?m[j-2]>>this.F2:0),vt=this.FV/et,Ee=(1<<this.F1)/et,ft=1<<this.F2,pt=a.t,Ae=pt-j,Ct=i??o();for(m.dlShiftTo(Ae,Ct),a.compareTo(Ct)>=0&&(a[a.t++]=1,a.subTo(Ct,a)),n.ONE.dlShiftTo(j,Ct),Ct.subTo(m,m);m.t<j;)m[m.t++]=0;for(;--Ae>=0;){var ir=a[--pt]==it?this.DM:Math.floor(a[pt]*vt+(a[pt-1]+ft)*Ee);if((a[pt]+=m.am(0,ir,a,Ae,0,j))<ir)for(m.dlShiftTo(Ae,Ct),a.subTo(Ct,a);a[pt]<--ir;)a.subTo(Ct,a)}i!=null&&(a.drShiftTo(j,i),w!=x&&n.ZERO.subTo(i,i)),a.t=j,a.clamp(),k>0&&a.rShiftTo(k,a),w<0&&n.ZERO.subTo(a,a)}}}function ni(s){var i=o();return this.abs().divRemTo(s,null,i),this.s<0&&i.compareTo(n.ZERO)>0&&s.subTo(i,i),i}function Pt(s){this.m=s}function si(s){return s.s<0||s.compareTo(this.m)>=0?s.mod(this.m):s}function oi(s){return s}function ii(s){s.divRemTo(this.m,null,s)}function ai(s,i,a){s.multiplyTo(i,a),this.reduce(a)}function ci(s,i){s.squareTo(i),this.reduce(i)}Pt.prototype.convert=si,Pt.prototype.revert=oi,Pt.prototype.reduce=ii,Pt.prototype.mulTo=ai,Pt.prototype.sqrTo=ci;function ui(){if(this.t<1)return 0;var s=this[0];if(!(s&1))return 0;var i=s&3;return i=i*(2-(s&15)*i)&15,i=i*(2-(s&255)*i)&255,i=i*(2-((s&65535)*i&65535))&65535,i=i*(2-s*i%this.DV)%this.DV,i>0?this.DV-i:-i}function kt(s){this.m=s,this.mp=s.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<s.DB-15)-1,this.mt2=2*s.t}function fi(s){var i=o();return s.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),s.s<0&&i.compareTo(n.ZERO)>0&&this.m.subTo(i,i),i}function pi(s){var i=o();return s.copyTo(i),this.reduce(i),i}function li(s){for(;s.t<=this.mt2;)s[s.t++]=0;for(var i=0;i<this.m.t;++i){var a=s[i]&32767,u=a*this.mpl+((a*this.mph+(s[i]>>15)*this.mpl&this.um)<<15)&s.DM;for(a=i+this.m.t,s[a]+=this.m.am(0,u,s,i,0,this.m.t);s[a]>=s.DV;)s[a]-=s.DV,s[++a]++}s.clamp(),s.drShiftTo(this.m.t,s),s.compareTo(this.m)>=0&&s.subTo(this.m,s)}function hi(s,i){s.squareTo(i),this.reduce(i)}function di(s,i,a){s.multiplyTo(i,a),this.reduce(a)}kt.prototype.convert=fi,kt.prototype.revert=pi,kt.prototype.reduce=li,kt.prototype.mulTo=di,kt.prototype.sqrTo=hi;function mi(){return(this.t>0?this[0]&1:this.s)==0}function gi(s,i){if(s>4294967295||s<1)return n.ONE;var a=o(),u=o(),d=i.convert(this),m=G(s)-1;for(d.copyTo(a);--m>=0;)if(i.sqrTo(a,u),(s&1<<m)>0)i.mulTo(u,d,a);else{var w=a;a=u,u=w}return i.revert(a)}function bi(s,i){var a;return s<256||i.isEven()?a=new Pt(i):a=new kt(i),this.exp(s,a)}n.prototype.copyTo=B,n.prototype.fromInt=C,n.prototype.fromString=M,n.prototype.clamp=R,n.prototype.dlShiftTo=Jo,n.prototype.drShiftTo=Xo,n.prototype.lShiftTo=Qo,n.prototype.rShiftTo=Yo,n.prototype.subTo=Ko,n.prototype.multiplyTo=ti,n.prototype.squareTo=ei,n.prototype.divRemTo=ri,n.prototype.invDigit=ui,n.prototype.isEven=mi,n.prototype.exp=gi,n.prototype.toString=N,n.prototype.negate=_,n.prototype.abs=D,n.prototype.compareTo=F,n.prototype.bitLength=Wo,n.prototype.mod=ni,n.prototype.modPowInt=bi,n.ZERO=I(0),n.ONE=I(1);function wi(){var s=o();return this.copyTo(s),s}function yi(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function vi(){return this.t==0?this.s:this[0]<<24>>24}function xi(){return this.t==0?this.s:this[0]<<16>>16}function Si(s){return Math.floor(Math.LN2*this.DB/Math.log(s))}function Ti(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function Ci(s){if(s==null&&(s=10),this.signum()==0||s<2||s>36)return"0";var i=this.chunkSize(s),a=Math.pow(s,i),u=I(a),d=o(),m=o(),w="";for(this.divRemTo(u,d,m);d.signum()>0;)w=(a+m.intValue()).toString(s).substr(1)+w,d.divRemTo(u,d,m);return m.intValue().toString(s)+w}function Ei(s,i){this.fromInt(0),i==null&&(i=10);for(var a=this.chunkSize(i),u=Math.pow(i,a),d=!1,m=0,w=0,x=0;x<s.length;++x){var k=T(s,x);if(k<0){s.charAt(x)=="-"&&this.signum()==0&&(d=!0);continue}w=i*w+k,++m>=a&&(this.dMultiply(u),this.dAddOffset(w,0),m=0,w=0)}m>0&&(this.dMultiply(Math.pow(i,m)),this.dAddOffset(w,0)),d&&n.ZERO.subTo(this,this)}function Ai(s,i,a){if(typeof i=="number")if(s<2)this.fromInt(1);else for(this.fromNumber(s,a),this.testBit(s-1)||this.bitwiseTo(n.ONE.shiftLeft(s-1),rr,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>s&&this.subTo(n.ONE.shiftLeft(s-1),this);else{var u=new Array,d=s&7;u.length=(s>>3)+1,i.nextBytes(u),d>0?u[0]&=(1<<d)-1:u[0]=0,this.fromString(u,256)}}function Ii(){var s=this.t,i=new Array;i[0]=this.s;var a=this.DB-s*this.DB%8,u,d=0;if(s-- >0)for(a<this.DB&&(u=this[s]>>a)!=(this.s&this.DM)>>a&&(i[d++]=u|this.s<<this.DB-a);s>=0;)a<8?(u=(this[s]&(1<<a)-1)<<8-a,u|=this[--s]>>(a+=this.DB-8)):(u=this[s]>>(a-=8)&255,a<=0&&(a+=this.DB,--s)),u&128&&(u|=-256),d==0&&(this.s&128)!=(u&128)&&++d,(d>0||u!=this.s)&&(i[d++]=u);return i}function Bi(s){return this.compareTo(s)==0}function Mi(s){return this.compareTo(s)<0?this:s}function Ri(s){return this.compareTo(s)>0?this:s}function Di(s,i,a){var u,d,m=Math.min(s.t,this.t);for(u=0;u<m;++u)a[u]=i(this[u],s[u]);if(s.t<this.t){for(d=s.s&this.DM,u=m;u<this.t;++u)a[u]=i(this[u],d);a.t=this.t}else{for(d=this.s&this.DM,u=m;u<s.t;++u)a[u]=i(d,s[u]);a.t=s.t}a.s=i(this.s,s.s),a.clamp()}function Pi(s,i){return s&i}function ki(s){var i=o();return this.bitwiseTo(s,Pi,i),i}function rr(s,i){return s|i}function Oi(s){var i=o();return this.bitwiseTo(s,rr,i),i}function $n(s,i){return s^i}function Ni(s){var i=o();return this.bitwiseTo(s,$n,i),i}function zn(s,i){return s&~i}function Fi(s){var i=o();return this.bitwiseTo(s,zn,i),i}function _i(){for(var s=o(),i=0;i<this.t;++i)s[i]=this.DM&~this[i];return s.t=this.t,s.s=~this.s,s}function Ui(s){var i=o();return s<0?this.rShiftTo(-s,i):this.lShiftTo(s,i),i}function Li(s){var i=o();return s<0?this.lShiftTo(-s,i):this.rShiftTo(s,i),i}function $i(s){if(s==0)return-1;var i=0;return s&65535||(s>>=16,i+=16),s&255||(s>>=8,i+=8),s&15||(s>>=4,i+=4),s&3||(s>>=2,i+=2),s&1||++i,i}function zi(){for(var s=0;s<this.t;++s)if(this[s]!=0)return s*this.DB+$i(this[s]);return this.s<0?this.t*this.DB:-1}function Vi(s){for(var i=0;s!=0;)s&=s-1,++i;return i}function ji(){for(var s=0,i=this.s&this.DM,a=0;a<this.t;++a)s+=Vi(this[a]^i);return s}function qi(s){var i=Math.floor(s/this.DB);return i>=this.t?this.s!=0:(this[i]&1<<s%this.DB)!=0}function Gi(s,i){var a=n.ONE.shiftLeft(s);return this.bitwiseTo(a,i,a),a}function Hi(s){return this.changeBit(s,rr)}function Zi(s){return this.changeBit(s,zn)}function Wi(s){return this.changeBit(s,$n)}function Ji(s,i){for(var a=0,u=0,d=Math.min(s.t,this.t);a<d;)u+=this[a]+s[a],i[a++]=u&this.DM,u>>=this.DB;if(s.t<this.t){for(u+=s.s;a<this.t;)u+=this[a],i[a++]=u&this.DM,u>>=this.DB;u+=this.s}else{for(u+=this.s;a<s.t;)u+=s[a],i[a++]=u&this.DM,u>>=this.DB;u+=s.s}i.s=u<0?-1:0,u>0?i[a++]=u:u<-1&&(i[a++]=this.DV+u),i.t=a,i.clamp()}function Xi(s){var i=o();return this.addTo(s,i),i}function Qi(s){var i=o();return this.subTo(s,i),i}function Yi(s){var i=o();return this.multiplyTo(s,i),i}function Ki(){var s=o();return this.squareTo(s),s}function ta(s){var i=o();return this.divRemTo(s,i,null),i}function ea(s){var i=o();return this.divRemTo(s,null,i),i}function ra(s){var i=o(),a=o();return this.divRemTo(s,i,a),new Array(i,a)}function na(s){this[this.t]=this.am(0,s-1,this,0,0,this.t),++this.t,this.clamp()}function sa(s,i){if(s!=0){for(;this.t<=i;)this[this.t++]=0;for(this[i]+=s;this[i]>=this.DV;)this[i]-=this.DV,++i>=this.t&&(this[this.t++]=0),++this[i]}}function de(){}function Vn(s){return s}function oa(s,i,a){s.multiplyTo(i,a)}function ia(s,i){s.squareTo(i)}de.prototype.convert=Vn,de.prototype.revert=Vn,de.prototype.mulTo=oa,de.prototype.sqrTo=ia;function aa(s){return this.exp(s,new de)}function ca(s,i,a){var u=Math.min(this.t+s.t,i);for(a.s=0,a.t=u;u>0;)a[--u]=0;var d;for(d=a.t-this.t;u<d;++u)a[u+this.t]=this.am(0,s[u],a,u,0,this.t);for(d=Math.min(s.t,i);u<d;++u)this.am(0,s[u],a,u,0,i-u);a.clamp()}function ua(s,i,a){--i;var u=a.t=this.t+s.t-i;for(a.s=0;--u>=0;)a[u]=0;for(u=Math.max(i-this.t,0);u<s.t;++u)a[this.t+u-i]=this.am(i-u,s[u],a,0,0,this.t+u-i);a.clamp(),a.drShiftTo(1,a)}function Ot(s){this.r2=o(),this.q3=o(),n.ONE.dlShiftTo(2*s.t,this.r2),this.mu=this.r2.divide(s),this.m=s}function fa(s){if(s.s<0||s.t>2*this.m.t)return s.mod(this.m);if(s.compareTo(this.m)<0)return s;var i=o();return s.copyTo(i),this.reduce(i),i}function pa(s){return s}function la(s){for(s.drShiftTo(this.m.t-1,this.r2),s.t>this.m.t+1&&(s.t=this.m.t+1,s.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);s.compareTo(this.r2)<0;)s.dAddOffset(1,this.m.t+1);for(s.subTo(this.r2,s);s.compareTo(this.m)>=0;)s.subTo(this.m,s)}function ha(s,i){s.squareTo(i),this.reduce(i)}function da(s,i,a){s.multiplyTo(i,a),this.reduce(a)}Ot.prototype.convert=fa,Ot.prototype.revert=pa,Ot.prototype.reduce=la,Ot.prototype.mulTo=da,Ot.prototype.sqrTo=ha;function ma(s,i){var a=s.bitLength(),u,d=I(1),m;if(a<=0)return d;a<18?u=1:a<48?u=3:a<144?u=4:a<768?u=5:u=6,a<8?m=new Pt(i):i.isEven()?m=new Ot(i):m=new kt(i);var w=new Array,x=3,k=u-1,j=(1<<u)-1;if(w[1]=m.convert(this),u>1){var it=o();for(m.sqrTo(w[1],it);x<=j;)w[x]=o(),m.mulTo(it,w[x-2],w[x]),x+=2}var et=s.t-1,vt,Ee=!0,ft=o(),pt;for(a=G(s[et])-1;et>=0;){for(a>=k?vt=s[et]>>a-k&j:(vt=(s[et]&(1<<a+1)-1)<<k-a,et>0&&(vt|=s[et-1]>>this.DB+a-k)),x=u;!(vt&1);)vt>>=1,--x;if((a-=x)<0&&(a+=this.DB,--et),Ee)w[vt].copyTo(d),Ee=!1;else{for(;x>1;)m.sqrTo(d,ft),m.sqrTo(ft,d),x-=2;x>0?m.sqrTo(d,ft):(pt=d,d=ft,ft=pt),m.mulTo(ft,w[vt],d)}for(;et>=0&&!(s[et]&1<<a);)m.sqrTo(d,ft),pt=d,d=ft,ft=pt,--a<0&&(a=this.DB-1,--et)}return m.revert(d)}function ga(s){var i=this.s<0?this.negate():this.clone(),a=s.s<0?s.negate():s.clone();if(i.compareTo(a)<0){var u=i;i=a,a=u}var d=i.getLowestSetBit(),m=a.getLowestSetBit();if(m<0)return i;for(d<m&&(m=d),m>0&&(i.rShiftTo(m,i),a.rShiftTo(m,a));i.signum()>0;)(d=i.getLowestSetBit())>0&&i.rShiftTo(d,i),(d=a.getLowestSetBit())>0&&a.rShiftTo(d,a),i.compareTo(a)>=0?(i.subTo(a,i),i.rShiftTo(1,i)):(a.subTo(i,a),a.rShiftTo(1,a));return m>0&&a.lShiftTo(m,a),a}function ba(s){if(s<=0)return 0;var i=this.DV%s,a=this.s<0?s-1:0;if(this.t>0)if(i==0)a=this[0]%s;else for(var u=this.t-1;u>=0;--u)a=(i*a+this[u])%s;return a}function wa(s){var i=s.isEven();if(this.isEven()&&i||s.signum()==0)return n.ZERO;for(var a=s.clone(),u=this.clone(),d=I(1),m=I(0),w=I(0),x=I(1);a.signum()!=0;){for(;a.isEven();)a.rShiftTo(1,a),i?((!d.isEven()||!m.isEven())&&(d.addTo(this,d),m.subTo(s,m)),d.rShiftTo(1,d)):m.isEven()||m.subTo(s,m),m.rShiftTo(1,m);for(;u.isEven();)u.rShiftTo(1,u),i?((!w.isEven()||!x.isEven())&&(w.addTo(this,w),x.subTo(s,x)),w.rShiftTo(1,w)):x.isEven()||x.subTo(s,x),x.rShiftTo(1,x);a.compareTo(u)>=0?(a.subTo(u,a),i&&d.subTo(w,d),m.subTo(x,m)):(u.subTo(a,u),i&&w.subTo(d,w),x.subTo(m,x))}if(u.compareTo(n.ONE)!=0)return n.ZERO;if(x.compareTo(s)>=0)return x.subtract(s);if(x.signum()<0)x.addTo(s,x);else return x;return x.signum()<0?x.add(s):x}var Y=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],ya=(1<<26)/Y[Y.length-1];function va(s){var i,a=this.abs();if(a.t==1&&a[0]<=Y[Y.length-1]){for(i=0;i<Y.length;++i)if(a[0]==Y[i])return!0;return!1}if(a.isEven())return!1;for(i=1;i<Y.length;){for(var u=Y[i],d=i+1;d<Y.length&&u<ya;)u*=Y[d++];for(u=a.modInt(u);i<d;)if(u%Y[i++]==0)return!1}return a.millerRabin(s)}function xa(s){var i=this.subtract(n.ONE),a=i.getLowestSetBit();if(a<=0)return!1;var u=i.shiftRight(a);s=s+1>>1,s>Y.length&&(s=Y.length);for(var d=o(),m=0;m<s;++m){d.fromInt(Y[Math.floor(Math.random()*Y.length)]);var w=d.modPow(u,this);if(w.compareTo(n.ONE)!=0&&w.compareTo(i)!=0){for(var x=1;x++<a&&w.compareTo(i)!=0;)if(w=w.modPowInt(2,this),w.compareTo(n.ONE)==0)return!1;if(w.compareTo(i)!=0)return!1}}return!0}n.prototype.chunkSize=Si,n.prototype.toRadix=Ci,n.prototype.fromRadix=Ei,n.prototype.fromNumber=Ai,n.prototype.bitwiseTo=Di,n.prototype.changeBit=Gi,n.prototype.addTo=Ji,n.prototype.dMultiply=na,n.prototype.dAddOffset=sa,n.prototype.multiplyLowerTo=ca,n.prototype.multiplyUpperTo=ua,n.prototype.modInt=ba,n.prototype.millerRabin=xa,n.prototype.clone=wi,n.prototype.intValue=yi,n.prototype.byteValue=vi,n.prototype.shortValue=xi,n.prototype.signum=Ti,n.prototype.toByteArray=Ii,n.prototype.equals=Bi,n.prototype.min=Mi,n.prototype.max=Ri,n.prototype.and=ki,n.prototype.or=Oi,n.prototype.xor=Ni,n.prototype.andNot=Fi,n.prototype.not=_i,n.prototype.shiftLeft=Ui,n.prototype.shiftRight=Li,n.prototype.getLowestSetBit=zi,n.prototype.bitCount=ji,n.prototype.testBit=qi,n.prototype.setBit=Hi,n.prototype.clearBit=Zi,n.prototype.flipBit=Wi,n.prototype.add=Xi,n.prototype.subtract=Qi,n.prototype.multiply=Yi,n.prototype.divide=ta,n.prototype.remainder=ea,n.prototype.divideAndRemainder=ra,n.prototype.modPow=ma,n.prototype.modInverse=wa,n.prototype.pow=aa,n.prototype.gcd=ga,n.prototype.isProbablePrime=va,n.prototype.square=Ki,n.prototype.Barrett=Ot;var Ce,tt,V;function Sa(s){tt[V++]^=s&255,tt[V++]^=s>>8&255,tt[V++]^=s>>16&255,tt[V++]^=s>>24&255,V>=or&&(V-=or)}function jn(){Sa(new Date().getTime())}if(tt==null){tt=new Array,V=0;var ut;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var qn=new Uint8Array(32);for(window.crypto.getRandomValues(qn),ut=0;ut<32;++ut)tt[V++]=qn[ut]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var Gn=window.crypto.random(32);for(ut=0;ut<Gn.length;++ut)tt[V++]=Gn.charCodeAt(ut)&255}}for(;V<or;)ut=Math.floor(65536*Math.random()),tt[V++]=ut>>>8,tt[V++]=ut&255;V=0,jn()}function Ta(){if(Ce==null){for(jn(),Ce=Ia(),Ce.init(tt),V=0;V<tt.length;++V)tt[V]=0;V=0}return Ce.next()}function Ca(s){var i;for(i=0;i<s.length;++i)s[i]=Ta()}function nr(){}nr.prototype.nextBytes=Ca;function sr(){this.i=0,this.j=0,this.S=new Array}function Ea(s){var i,a,u;for(i=0;i<256;++i)this.S[i]=i;for(a=0,i=0;i<256;++i)a=a+this.S[i]+s[i%s.length]&255,u=this.S[i],this.S[i]=this.S[a],this.S[a]=u;this.i=0,this.j=0}function Aa(){var s;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,s=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=s,this.S[s+this.S[this.i]&255]}sr.prototype.init=Ea,sr.prototype.next=Aa;function Ia(){return new sr}var or=256;typeof We<"u"?We=Eo.exports={default:n,BigInteger:n,SecureRandom:nr}:this.jsbn={BigInteger:n,SecureRandom:nr}}).call(We)});var Se=z(Je=>{(function(){"use strict";var r={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(f){return n(c(f),arguments)}function e(f,l){return t.apply(null,[f].concat(l||[]))}function n(f,l){var g=1,A=f.length,p,b="",y,S,h,T,B,C,I,M;for(y=0;y<A;y++)if(typeof f[y]=="string")b+=f[y];else if(typeof f[y]=="object"){if(h=f[y],h.keys)for(p=l[g],S=0;S<h.keys.length;S++){if(p==null)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',h.keys[S],h.keys[S-1]));p=p[h.keys[S]]}else h.param_no?p=l[h.param_no]:p=l[g++];if(r.not_type.test(h.type)&&r.not_primitive.test(h.type)&&p instanceof Function&&(p=p()),r.numeric_arg.test(h.type)&&typeof p!="number"&&isNaN(p))throw new TypeError(t("[sprintf] expecting number but found %T",p));switch(r.number.test(h.type)&&(I=p>=0),h.type){case"b":p=parseInt(p,10).toString(2);break;case"c":p=String.fromCharCode(parseInt(p,10));break;case"d":case"i":p=parseInt(p,10);break;case"j":p=JSON.stringify(p,null,h.width?parseInt(h.width):0);break;case"e":p=h.precision?parseFloat(p).toExponential(h.precision):parseFloat(p).toExponential();break;case"f":p=h.precision?parseFloat(p).toFixed(h.precision):parseFloat(p);break;case"g":p=h.precision?String(Number(p.toPrecision(h.precision))):parseFloat(p);break;case"o":p=(parseInt(p,10)>>>0).toString(8);break;case"s":p=String(p),p=h.precision?p.substring(0,h.precision):p;break;case"t":p=String(!!p),p=h.precision?p.substring(0,h.precision):p;break;case"T":p=Object.prototype.toString.call(p).slice(8,-1).toLowerCase(),p=h.precision?p.substring(0,h.precision):p;break;case"u":p=parseInt(p,10)>>>0;break;case"v":p=p.valueOf(),p=h.precision?p.substring(0,h.precision):p;break;case"x":p=(parseInt(p,10)>>>0).toString(16);break;case"X":p=(parseInt(p,10)>>>0).toString(16).toUpperCase();break}r.json.test(h.type)?b+=p:(r.number.test(h.type)&&(!I||h.sign)?(M=I?"+":"-",p=p.toString().replace(r.sign,"")):M="",B=h.pad_char?h.pad_char==="0"?"0":h.pad_char.charAt(1):" ",C=h.width-(M+p).length,T=h.width&&C>0?B.repeat(C):"",b+=h.align?M+p+T:B==="0"?M+T+p:T+M+p)}return b}var o=Object.create(null);function c(f){if(o[f])return o[f];for(var l=f,g,A=[],p=0;l;){if((g=r.text.exec(l))!==null)A.push(g[0]);else if((g=r.modulo.exec(l))!==null)A.push("%");else if((g=r.placeholder.exec(l))!==null){if(g[2]){p|=1;var b=[],y=g[2],S=[];if((S=r.key.exec(y))!==null)for(b.push(S[1]);(y=y.substring(S[0].length))!=="";)if((S=r.key_access.exec(y))!==null)b.push(S[1]);else if((S=r.index_access.exec(y))!==null)b.push(S[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");g[2]=b}else p|=2;if(p===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");A.push({placeholder:g[0],param_no:g[1],keys:g[2],sign:g[3],pad_char:g[4],align:g[5],width:g[6],precision:g[7],type:g[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");l=l.substring(g[0].length)}return o[f]=A}typeof Je<"u"&&(Je.sprintf=t,Je.vsprintf=e),typeof window<"u"&&(window.sprintf=t,window.vsprintf=e,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:e}}))})()});var Ke=z((hm,Fo)=>{Fo.exports=r=>{if(r[Symbol.asyncIterator])return r;if(r.getReader)return async function*(){let t=r.getReader();try{for(;;){let{done:e,value:n}=await t.read();if(e)return;yield n}}finally{t.releaseLock()}}();throw new Error("unknown stream")}});var Uo=z((dm,_o)=>{_o.exports=function(t){if(t){if(typeof t[Symbol.iterator]=="function")return t[Symbol.iterator]();if(typeof t[Symbol.asyncIterator]=="function")return t[Symbol.asyncIterator]();if(typeof t.next=="function")return t}throw new Error("argument is not an iterator or iterable")}});var kn=z((mm,Lo)=>{var lp=Uo();Lo.exports=r=>async t=>{t=lp(t);let e=C=>{typeof C.return=="function"&&C.return()},n=null,o=null,c=C=>{n=C,o&&o(C),e(t)},f=null,l=!1,g=()=>{l=!0,f&&f()},A=null,p=!1,b=()=>{p=!0,A&&A()},y=null,S=()=>{y&&y()},h=()=>new Promise((C,I)=>{f=y=C,o=I,r.once("drain",S)}),T=()=>(e(t),new Promise((C,I)=>{if(l||p||n)return C();A=f=C,o=I})),B=()=>{r.removeListener("error",c),r.removeListener("close",g),r.removeListener("finish",b),r.removeListener("drain",S)};r.once("error",c),r.once("close",g),r.once("finish",b);try{for await(let C of t){if(!r.writable||r.destroyed||n)break;r.write(C)===!1&&await h()}}catch(C){n||r.destroy(),n=C}try{if(r.writable&&r.end(),await T(),n)throw n}finally{B()}}});var On=z((gm,$o)=>{var hp=kn(),dp=Ke();$o.exports=r=>({sink:hp(r),source:dp(r)})});var Vo=z((bm,zo)=>{var mp=On();zo.exports=r=>async function*(t){let e=mp(r),n;if(e.sink(t).catch(o=>{n=o}),yield*e.source,n)throw n}});var jo=z((wm,le)=>{le.exports=Ke();le.exports.source=Ke();le.exports.sink=kn();le.exports.transform=Vo();le.exports.duplex=On()});var Ip={};O(Ip,{tcp:()=>Ap});var Zo=H(mt("net"),1);var qt=class r extends Error{code;type;constructor(t="The operation was aborted"){super(t),this.code=r.code,this.type=r.type}static code="ABORT_ERR";static type="aborted"},lt=class extends Error{code;props;constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};var Wn=Symbol.for("@libp2p/transport");var Zn;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(Zn||(Zn={}));var nt=H(os(),1);var dr={};O(dr,{base32:()=>dt,base32hex:()=>pc,base32hexpad:()=>hc,base32hexpadupper:()=>dc,base32hexupper:()=>lc,base32pad:()=>uc,base32padupper:()=>fc,base32upper:()=>cc,base32z:()=>mc});function nc(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var o=0;o<r.length;o++){var c=r.charAt(o),f=c.charCodeAt(0);if(e[f]!==255)throw new TypeError(c+" is ambiguous");e[f]=o}var l=r.length,g=r.charAt(0),A=Math.log(l)/Math.log(256),p=Math.log(256)/Math.log(l);function b(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var T=0,B=0,C=0,I=h.length;C!==I&&h[C]===0;)C++,T++;for(var M=(I-C)*p+1>>>0,R=new Uint8Array(M);C!==I;){for(var N=h[C],_=0,D=M-1;(N!==0||_<B)&&D!==-1;D--,_++)N+=256*R[D]>>>0,R[D]=N%l>>>0,N=N/l>>>0;if(N!==0)throw new Error("Non-zero carry");B=_,C++}for(var F=M-B;F!==M&&R[F]===0;)F++;for(var G=g.repeat(T);F<M;++F)G+=r.charAt(R[F]);return G}function y(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var T=0;if(h[T]!==" "){for(var B=0,C=0;h[T]===g;)B++,T++;for(var I=(h.length-T)*A+1>>>0,M=new Uint8Array(I);h[T];){var R=e[h.charCodeAt(T)];if(R===255)return;for(var N=0,_=I-1;(R!==0||N<C)&&_!==-1;_--,N++)R+=l*M[_]>>>0,M[_]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");C=N,T++}if(h[T]!==" "){for(var D=I-C;D!==I&&M[D]===0;)D++;for(var F=new Uint8Array(B+(I-D)),G=B;D!==I;)F[G++]=M[D++];return F}}}function S(h){var T=y(h);if(T)return T;throw new Error(`Non-${t} character`)}return{encode:b,decodeUnsafe:y,decode:S}}var sc=nc,oc=sc,is=oc;var _p=new Uint8Array(0);var as=(r,t)=>{if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0},at=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")};var cs=r=>new TextEncoder().encode(r),us=r=>new TextDecoder().decode(r);var fr=class{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},pr=class{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return ps(this,t)}},lr=class{constructor(t){this.decoders=t}or(t){return ps(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},ps=(r,t)=>new lr({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),hr=class{constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new fr(t,e,n),this.decoder=new pr(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},Jt=({name:r,prefix:t,encode:e,decode:n})=>new hr(r,t,e,n),Et=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:o}=is(e,t);return Jt({prefix:r,name:t,encode:n,decode:c=>at(o(c))})},ic=(r,t,e,n)=>{let o={};for(let p=0;p<t.length;++p)o[t[p]]=p;let c=r.length;for(;r[c-1]==="=";)--c;let f=new Uint8Array(c*e/8|0),l=0,g=0,A=0;for(let p=0;p<c;++p){let b=o[r[p]];if(b===void 0)throw new SyntaxError(`Non-${n} character`);g=g<<e|b,l+=e,l>=8&&(l-=8,f[A++]=255&g>>l)}if(l>=e||255&g<<8-l)throw new SyntaxError("Unexpected end of data");return f},ac=(r,t,e)=>{let n=t[t.length-1]==="=",o=(1<<e)-1,c="",f=0,l=0;for(let g=0;g<r.length;++g)for(l=l<<8|r[g],f+=8;f>e;)f-=e,c+=t[o&l>>f];if(f&&(c+=t[o&l<<e-f]),n)for(;c.length*e&7;)c+="=";return c},U=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>Jt({prefix:t,name:r,encode(o){return ac(o,n,e)},decode(o){return ic(o,n,e,r)}});var dt=U({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),cc=U({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),uc=U({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),fc=U({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),pc=U({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),lc=U({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),hc=U({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),dc=U({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),mc=U({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var mr={};O(mr,{base58btc:()=>W,base58flickr:()=>gc});var W=Et({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),gc=Et({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var br={};O(br,{base64:()=>gr,base64pad:()=>bc,base64url:()=>wc,base64urlpad:()=>yc});var gr=U({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),bc=U({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wc=U({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),yc=U({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});nt.default.formatters.b=r=>r==null?"undefined":W.baseEncode(r);nt.default.formatters.t=r=>r==null?"undefined":dt.baseEncode(r);nt.default.formatters.m=r=>r==null?"undefined":gr.baseEncode(r);nt.default.formatters.p=r=>r==null?"undefined":r.toString();nt.default.formatters.c=r=>r==null?"undefined":r.toString();nt.default.formatters.k=r=>r==null?"undefined":r.toString();nt.default.formatters.a=r=>r==null?"undefined":r.toString();function vc(r){let t=()=>{};return t.enabled=!1,t.color="",t.diff=0,t.log=()=>{},t.namespace=r,t.destroy=()=>!0,t.extend=()=>t,t}function At(r){let t=vc(`${r}:trace`);return nt.default.enabled(`${r}:trace`)&&nt.default.names.map(e=>e.toString()).find(e=>e.includes(":trace"))!=null&&(t=(0,nt.default)(`${r}:trace`)),Object.assign((0,nt.default)(r),{error:(0,nt.default)(`${r}:error`),trace:t})}var Pe=class extends Error{code;props;constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};var xc=ds,ls=128,Sc=127,Tc=~Sc,Cc=Math.pow(2,31);function ds(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Cc;)t[e++]=r&255|ls,r/=128;for(;r&Tc;)t[e++]=r&255|ls,r>>>=7;return t[e]=r|0,ds.bytes=e-n+1,t}var Ec=wr,Ac=128,hs=127;function wr(r,n){var e=0,n=n||0,o=0,c=n,f,l=r.length;do{if(c>=l)throw wr.bytes=0,new RangeError("Could not decode varint");f=r[c++],e+=o<28?(f&hs)<<o:(f&hs)*Math.pow(2,o),o+=7}while(f>=Ac);return wr.bytes=c-n,e}var Ic=Math.pow(2,7),Bc=Math.pow(2,14),Mc=Math.pow(2,21),Rc=Math.pow(2,28),Dc=Math.pow(2,35),Pc=Math.pow(2,42),kc=Math.pow(2,49),Oc=Math.pow(2,56),Nc=Math.pow(2,63),Fc=function(r){return r<Ic?1:r<Bc?2:r<Mc?3:r<Rc?4:r<Dc?5:r<Pc?6:r<kc?7:r<Oc?8:r<Nc?9:10},_c={encode:xc,decode:Ec,encodingLength:Fc},Uc=_c,me=Uc;var ge=(r,t=0)=>[me.decode(r,t),me.decode.bytes],Xt=(r,t,e=0)=>(me.encode(r,t,e),t),Qt=r=>me.encodingLength(r);var Ft=(r,t)=>{let e=t.byteLength,n=Qt(r),o=n+Qt(e),c=new Uint8Array(o+e);return Xt(r,c,0),Xt(e,c,n),c.set(t,o),new Yt(r,e,t,c)},Oe=r=>{let t=at(r),[e,n]=ge(t),[o,c]=ge(t.subarray(n)),f=t.subarray(n+c);if(f.byteLength!==o)throw new Error("Incorrect length");return new Yt(e,o,f,t)},ms=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&as(r.bytes,e.bytes)}},Yt=class{constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};var gs=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return $c(e,yr(r),t||W.encoder);default:return zc(e,yr(r),t||dt.encoder)}};var bs=new WeakMap,yr=r=>{let t=bs.get(r);if(t==null){let e=new Map;return bs.set(r,e),e}return t},It=class r{constructor(t,e,n,o){this.code=e,this.version=t,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:e}=this;if(t!==be)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Vc)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,n=Ft(t,e);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return r.equals(this,t)}static equals(t,e){let n=e;return n&&t.code===n.code&&t.version===n.version&&ms(t.multihash,n.multihash)}toString(t){return gs(this,t)}toJSON(){return{"/":gs(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:o,multihash:c,bytes:f}=e;return new r(n,o,c,f||ws(n,o,c.bytes))}else if(e[jc]===!0){let{version:n,multihash:o,code:c}=e,f=Oe(o);return r.create(n,c,f)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==be)throw new Error(`Version 0 CID must use dag-pb (code: ${be}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=ws(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,be,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,o=at(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let c=o.subarray(e.multihashSize-e.digestSize),f=new Yt(e.multihashCode,e.digestSize,c,o);return[e.version===0?r.createV0(f):r.createV1(e.codec,f),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[b,y]=ge(t.subarray(e));return e+=y,b},o=n(),c=be;if(o===18?(o=0,e=0):c=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let f=e,l=n(),g=n(),A=e+g,p=A-f;return{version:o,codec:c,multihashCode:l,digestSize:g,multihashSize:p,size:A}}static parse(t,e){let[n,o]=Lc(t,e),c=r.decode(o);if(c.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return yr(c).set(n,t),c}},Lc=(r,t)=>{switch(r[0]){case"Q":{let e=t||W;return[W.prefix,e.decode(`${W.prefix}${r}`)]}case W.prefix:{let e=t||W;return[W.prefix,e.decode(r)]}case dt.prefix:{let e=t||dt;return[dt.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}},$c=(r,t,e)=>{let{prefix:n}=e;if(n!==W.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let o=t.get(n);if(o==null){let c=e.encode(r).slice(1);return t.set(n,c),c}else return o},zc=(r,t,e)=>{let{prefix:n}=e,o=t.get(n);if(o==null){let c=e.encode(r);return t.set(n,c),c}else return o},be=112,Vc=18,ws=(r,t,e)=>{let n=Qt(r),o=n+Qt(t),c=new Uint8Array(o+e.byteLength);return Xt(r,c,0),Xt(t,c,n),c.set(e,o),c},jc=Symbol.for("@ipld/js-cid/CID");function ys(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}var Cr={};O(Cr,{identity:()=>Jc});function qc(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var o=0;o<r.length;o++){var c=r.charAt(o),f=c.charCodeAt(0);if(e[f]!==255)throw new TypeError(c+" is ambiguous");e[f]=o}var l=r.length,g=r.charAt(0),A=Math.log(l)/Math.log(256),p=Math.log(256)/Math.log(l);function b(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var T=0,B=0,C=0,I=h.length;C!==I&&h[C]===0;)C++,T++;for(var M=(I-C)*p+1>>>0,R=new Uint8Array(M);C!==I;){for(var N=h[C],_=0,D=M-1;(N!==0||_<B)&&D!==-1;D--,_++)N+=256*R[D]>>>0,R[D]=N%l>>>0,N=N/l>>>0;if(N!==0)throw new Error("Non-zero carry");B=_,C++}for(var F=M-B;F!==M&&R[F]===0;)F++;for(var G=g.repeat(T);F<M;++F)G+=r.charAt(R[F]);return G}function y(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var T=0;if(h[T]!==" "){for(var B=0,C=0;h[T]===g;)B++,T++;for(var I=(h.length-T)*A+1>>>0,M=new Uint8Array(I);h[T];){var R=e[h.charCodeAt(T)];if(R===255)return;for(var N=0,_=I-1;(R!==0||N<C)&&_!==-1;_--,N++)R+=l*M[_]>>>0,M[_]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");C=N,T++}if(h[T]!==" "){for(var D=I-C;D!==I&&M[D]===0;)D++;for(var F=new Uint8Array(B+(I-D)),G=B;D!==I;)F[G++]=M[D++];return F}}}function S(h){var T=y(h);if(T)return T;throw new Error(`Non-${t} character`)}return{encode:b,decodeUnsafe:y,decode:S}}var Gc=qc,Hc=Gc,vs=Hc;var ol=new Uint8Array(0);var xs=(r,t)=>{if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0},ct=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")};var Ss=r=>new TextEncoder().encode(r),Ts=r=>new TextDecoder().decode(r);var vr=class{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},xr=class{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Es(this,t)}},Sr=class{constructor(t){this.decoders=t}or(t){return Es(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Es=(r,t)=>new Sr({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),Tr=class{constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new vr(t,e,n),this.decoder=new xr(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},te=({name:r,prefix:t,encode:e,decode:n})=>new Tr(r,t,e,n),Bt=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:o}=vs(e,t);return te({prefix:r,name:t,encode:n,decode:c=>ct(o(c))})},Zc=(r,t,e,n)=>{let o={};for(let p=0;p<t.length;++p)o[t[p]]=p;let c=r.length;for(;r[c-1]==="=";)--c;let f=new Uint8Array(c*e/8|0),l=0,g=0,A=0;for(let p=0;p<c;++p){let b=o[r[p]];if(b===void 0)throw new SyntaxError(`Non-${n} character`);g=g<<e|b,l+=e,l>=8&&(l-=8,f[A++]=255&g>>l)}if(l>=e||255&g<<8-l)throw new SyntaxError("Unexpected end of data");return f},Wc=(r,t,e)=>{let n=t[t.length-1]==="=",o=(1<<e)-1,c="",f=0,l=0;for(let g=0;g<r.length;++g)for(l=l<<8|r[g],f+=8;f>e;)f-=e,c+=t[o&l>>f];if(f&&(c+=t[o&l<<e-f]),n)for(;c.length*e&7;)c+="=";return c},L=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>te({prefix:t,name:r,encode(o){return Wc(o,n,e)},decode(o){return Zc(o,n,e,r)}});var Jc=te({prefix:"\0",name:"identity",encode:r=>Ts(r),decode:r=>Ss(r)});var Er={};O(Er,{base2:()=>Xc});var Xc=L({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ar={};O(Ar,{base8:()=>Qc});var Qc=L({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Ir={};O(Ir,{base10:()=>Yc});var Yc=Bt({prefix:"9",name:"base10",alphabet:"0123456789"});var Br={};O(Br,{base16:()=>Kc,base16upper:()=>tu});var Kc=L({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),tu=L({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Mr={};O(Mr,{base32:()=>ee,base32hex:()=>su,base32hexpad:()=>iu,base32hexpadupper:()=>au,base32hexupper:()=>ou,base32pad:()=>ru,base32padupper:()=>nu,base32upper:()=>eu,base32z:()=>cu});var ee=L({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),eu=L({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ru=L({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),nu=L({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),su=L({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ou=L({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),iu=L({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),au=L({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),cu=L({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Rr={};O(Rr,{base36:()=>uu,base36upper:()=>fu});var uu=Bt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),fu=Bt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Dr={};O(Dr,{base58btc:()=>gt,base58flickr:()=>pu});var gt=Bt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),pu=Bt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Pr={};O(Pr,{base64:()=>lu,base64pad:()=>hu,base64url:()=>du,base64urlpad:()=>mu});var lu=L({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),hu=L({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),du=L({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),mu=L({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var kr={};O(kr,{base256emoji:()=>vu});var As=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),gu=As.reduce((r,t,e)=>(r[e]=t,r),[]),bu=As.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function wu(r){return r.reduce((t,e)=>(t+=gu[e],t),"")}function yu(r){let t=[];for(let e of r){let n=bu[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var vu=te({prefix:"\u{1F680}",name:"base256emoji",encode:wu,decode:yu});var Ur={};O(Ur,{sha256:()=>Lu,sha512:()=>$u});var _r=H(mt("crypto"),1);var xu=Ms,Is=128,Su=127,Tu=~Su,Cu=Math.pow(2,31);function Ms(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Cu;)t[e++]=r&255|Is,r/=128;for(;r&Tu;)t[e++]=r&255|Is,r>>>=7;return t[e]=r|0,Ms.bytes=e-n+1,t}var Eu=Or,Au=128,Bs=127;function Or(r,n){var e=0,n=n||0,o=0,c=n,f,l=r.length;do{if(c>=l)throw Or.bytes=0,new RangeError("Could not decode varint");f=r[c++],e+=o<28?(f&Bs)<<o:(f&Bs)*Math.pow(2,o),o+=7}while(f>=Au);return Or.bytes=c-n,e}var Iu=Math.pow(2,7),Bu=Math.pow(2,14),Mu=Math.pow(2,21),Ru=Math.pow(2,28),Du=Math.pow(2,35),Pu=Math.pow(2,42),ku=Math.pow(2,49),Ou=Math.pow(2,56),Nu=Math.pow(2,63),Fu=function(r){return r<Iu?1:r<Bu?2:r<Mu?3:r<Ru?4:r<Du?5:r<Pu?6:r<ku?7:r<Ou?8:r<Nu?9:10},_u={encode:xu,decode:Eu,encodingLength:Fu},Uu=_u,we=Uu;var ye=(r,t=0)=>[we.decode(r,t),we.decode.bytes],re=(r,t,e=0)=>(we.encode(r,t,e),t),ne=r=>we.encodingLength(r);var _t=(r,t)=>{let e=t.byteLength,n=ne(r),o=n+ne(e),c=new Uint8Array(o+e);return re(r,c,0),re(e,c,n),c.set(t,o),new se(r,e,t,c)},Rs=r=>{let t=ct(r),[e,n]=ye(t),[o,c]=ye(t.subarray(n)),f=t.subarray(n+c);if(f.byteLength!==o)throw new Error("Incorrect length");return new se(e,o,f,t)},Ds=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&xs(r.bytes,e.bytes)}},se=class{constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};var Fr=({name:r,code:t,encode:e})=>new Nr(r,t,e),Nr=class{constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?_t(this.code,e):e.then(n=>_t(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Lu=Fr({name:"sha2-256",code:18,encode:r=>ct(_r.default.createHash("sha256").update(r).digest())}),$u=Fr({name:"sha2-512",code:19,encode:r=>ct(_r.default.createHash("sha512").update(r).digest())});var Lr={};O(Lr,{identity:()=>ju});var ks=0,zu="identity",Os=ct,Vu=r=>_t(ks,Os(r)),ju={code:ks,name:zu,encode:Os,digest:Vu};var Il=new TextEncoder,Bl=new TextDecoder;var Ns=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return Zu(e,$r(r),t||gt.encoder);default:return Wu(e,$r(r),t||ee.encoder)}};var Fs=new WeakMap,$r=r=>{let t=Fs.get(r);if(t==null){let e=new Map;return Fs.set(r,e),e}return t},Fe=class r{constructor(t,e,n,o){this.code=e,this.version=t,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:e}=this;if(t!==xe)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Ju)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,n=_t(t,e);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return r.equals(this,t)}static equals(t,e){let n=e;return n&&t.code===n.code&&t.version===n.version&&Ds(t.multihash,n.multihash)}toString(t){return Ns(this,t)}toJSON(){return{"/":Ns(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:o,multihash:c,bytes:f}=e;return new r(n,o,c,f||_s(n,o,c.bytes))}else if(e[Xu]===!0){let{version:n,multihash:o,code:c}=e,f=Rs(o);return r.create(n,c,f)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==xe)throw new Error(`Version 0 CID must use dag-pb (code: ${xe}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=_s(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,xe,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,o=ct(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let c=o.subarray(e.multihashSize-e.digestSize),f=new se(e.multihashCode,e.digestSize,c,o);return[e.version===0?r.createV0(f):r.createV1(e.codec,f),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[b,y]=ye(t.subarray(e));return e+=y,b},o=n(),c=xe;if(o===18?(o=0,e=0):c=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let f=e,l=n(),g=n(),A=e+g,p=A-f;return{version:o,codec:c,multihashCode:l,digestSize:g,multihashSize:p,size:A}}static parse(t,e){let[n,o]=Hu(t,e),c=r.decode(o);if(c.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return $r(c).set(n,t),c}},Hu=(r,t)=>{switch(r[0]){case"Q":{let e=t||gt;return[gt.prefix,e.decode(`${gt.prefix}${r}`)]}case gt.prefix:{let e=t||gt;return[gt.prefix,e.decode(r)]}case ee.prefix:{let e=t||ee;return[ee.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}},Zu=(r,t,e)=>{let{prefix:n}=e;if(n!==gt.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let o=t.get(n);if(o==null){let c=e.encode(r).slice(1);return t.set(n,c),c}else return o},Wu=(r,t,e)=>{let{prefix:n}=e,o=t.get(n);if(o==null){let c=e.encode(r);return t.set(n,c),c}else return o},xe=112,Ju=18,_s=(r,t,e)=>{let n=ne(r),o=n+ne(t),c=new Uint8Array(o+e.byteLength);return re(r,c,0),re(t,c,n),c.set(e,o),c},Xu=Symbol.for("@ipld/js-cid/CID");var zr={...Cr,...Er,...Ar,...Ir,...Br,...Mr,...Rr,...Dr,...Pr,...kr},Ul={...Ur,...Lr};function oe(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function _e(r=0){return globalThis.Buffer?.allocUnsafe!=null?oe(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Ls(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Us=Ls("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Vr=Ls("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=_e(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Qu={utf8:Us,"utf-8":Us,hex:zr.base16,latin1:Vr,ascii:Vr,binary:Vr,...zr},Ue=Qu;function K(r,t="utf8"){let e=Ue[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):e.encoder.encode(r).substring(1)}function xt(r,t){t==null&&(t=r.reduce((o,c)=>o+c.length,0));let e=_e(t),n=0;for(let o of r)e.set(o,n),n+=o.length;return oe(e)}var ae=H(Gr(),1);var Le=class{index=0;input="";new(t){return this.index=0,this.input=t,this}readAtomically(t){let e=this.index,n=t();return n===void 0&&(this.index=e),n}parseWith(t){let e=t();if(this.index===this.input.length)return e}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(t){return this.readAtomically(()=>{let e=this.readChar();if(e===t)return e})}readSeparator(t,e,n){return this.readAtomically(()=>{if(!(e>0&&this.readGivenChar(t)===void 0))return n()})}readNumber(t,e,n,o){return this.readAtomically(()=>{let c=0,f=0,l=this.peekChar();if(l===void 0)return;let g=l==="0",A=2**(8*o)-1;for(;;){let p=this.readAtomically(()=>{let b=this.readChar();if(b===void 0)return;let y=Number.parseInt(b,t);if(!Number.isNaN(y))return y});if(p===void 0)break;if(c*=t,c+=p,c>A||(f+=1,e!==void 0&&f>e))return}if(f!==0)return!n&&g&&f>1?void 0:c})}readIPv4Addr(){return this.readAtomically(()=>{let t=new Uint8Array(4);for(let e=0;e<t.length;e++){let n=this.readSeparator(".",e,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;t[e]=n}return t})}readIPv6Addr(){let t=e=>{for(let n=0;n<e.length/2;n++){let o=n*2;if(n<e.length-3){let f=this.readSeparator(":",n,()=>this.readIPv4Addr());if(f!==void 0)return e[o]=f[0],e[o+1]=f[1],e[o+2]=f[2],e[o+3]=f[3],[o+4,!0]}let c=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(c===void 0)return[o,!1];e[o]=c>>8,e[o+1]=c&255}return[e.length,!1]};return this.readAtomically(()=>{let e=new Uint8Array(16),[n,o]=t(e);if(n===16)return e;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let c=new Uint8Array(14),f=16-(n+2),[l]=t(c.subarray(0,f));return e.set(c.subarray(0,l),16-l),e})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var nh=new Le;var ph=parseInt("0xFFFF",16),lh=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var Hr={};O(Hr,{identity:()=>bf});var bf=Jt({prefix:"\0",name:"identity",encode:r=>us(r),decode:r=>cs(r)});var Zr={};O(Zr,{base2:()=>wf});var wf=U({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Wr={};O(Wr,{base8:()=>yf});var yf=U({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Jr={};O(Jr,{base10:()=>vf});var vf=Et({prefix:"9",name:"base10",alphabet:"0123456789"});var Xr={};O(Xr,{base16:()=>xf,base16upper:()=>Sf});var xf=U({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Sf=U({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Qr={};O(Qr,{base36:()=>Tf,base36upper:()=>Cf});var Tf=Et({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Cf=Et({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Yr={};O(Yr,{base256emoji:()=>Mf});var Qs=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Ef=Qs.reduce((r,t,e)=>(r[e]=t,r),[]),Af=Qs.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function If(r){return r.reduce((t,e)=>(t+=Ef[e],t),"")}function Bf(r){let t=[];for(let e of r){let n=Af[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var Mf=Jt({prefix:"\u{1F680}",name:"base256emoji",encode:If,decode:Bf});var rn={};O(rn,{sha256:()=>Rf,sha512:()=>Df});var en=H(mt("crypto"),1);var tn=({name:r,code:t,encode:e})=>new Kr(r,t,e),Kr=class{constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?Ft(this.code,e):e.then(n=>Ft(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Rf=tn({name:"sha2-256",code:18,encode:r=>at(en.default.createHash("sha256").update(r).digest())}),Df=tn({name:"sha2-512",code:19,encode:r=>at(en.default.createHash("sha512").update(r).digest())});var nn={};O(nn,{identity:()=>Of});var Ks=0,Pf="identity",to=at,kf=r=>Ft(Ks,to(r)),Of={code:Ks,name:Pf,encode:to,digest:kf};var Wh=new TextEncoder,Jh=new TextDecoder;var eo={...Hr,...Zr,...Wr,...Jr,...Xr,...dr,...Qr,...mr,...br,...Yr},td={...rn,...nn};function sn(r,t="utf8"){let e=Ue[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?oe(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}var bt=H(Gr(),1);var Mt=mt("node:net");function $e(r){return!!(0,Mt.isIP)(r)}var ro=Mt.isIPv4,_f=Mt.isIPv6,on=function(r){let t=0;if(r=r.toString().trim(),ro(r)){let e=new Uint8Array(t+4);return r.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(_f(r)){let e=r.split(":",8),n;for(n=0;n<e.length;n++){let c=ro(e[n]),f;c&&(f=on(e[n]),e[n]=K(f.slice(0,2),"base16")),f!=null&&++n<8&&e.splice(n,0,K(f.slice(2,4),"base16"))}if(e[0]==="")for(;e.length<8;)e.unshift("0");else if(e[e.length-1]==="")for(;e.length<8;)e.push("0");else if(e.length<8){for(n=0;n<e.length&&e[n]!=="";n++);let c=[n,1];for(n=9-e.length;n>0;n--)c.push("0");e.splice.apply(e,c)}let o=new Uint8Array(t+16);for(n=0;n<e.length;n++){let c=parseInt(e[n],16);o[t++]=c>>8&255,o[t++]=c&255}return o}throw new Error("invalid ip address")},no=function(r,t=0,e){t=~~t,e=e??r.length-t;let n=new DataView(r.buffer);if(e===4){let o=[];for(let c=0;c<e;c++)o.push(r[t+c]);return o.join(".")}if(e===16){let o=[];for(let c=0;c<e;c+=2)o.push(n.getUint16(t+c).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var ie={},an={},Lf=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[449,-1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];Lf.forEach(r=>{let t=$f(...r);an[t.code]=t,ie[t.name]=t});function $f(r,t,e,n,o){return{code:r,size:t,name:e,resolvable:!!n,path:!!o}}function P(r){if(typeof r=="number"){if(an[r]!=null)return an[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(ie[r]!=null)return ie[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var yd=P("ip4"),vd=P("ip6"),xd=P("ipcidr");function un(r,t){switch(P(r).code){case 4:case 41:return Vf(t);case 42:return io(t);case 6:case 273:case 33:case 132:return co(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return io(t);case 421:return Hf(t);case 444:return ao(t);case 445:return ao(t);case 466:return Gf(t);default:return K(t,"base16")}}function fn(r,t){switch(P(r).code){case 4:return so(t);case 41:return so(t);case 42:return oo(t);case 6:case 273:case 33:case 132:return pn(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return oo(t);case 421:return jf(t);case 444:return Zf(t);case 445:return Wf(t);case 466:return qf(t);default:return sn(t,"base16")}}var cn=Object.values(eo).map(r=>r.decoder),zf=function(){let r=cn[0].or(cn[1]);return cn.slice(2).forEach(t=>r=r.or(t)),r}();function so(r){if(!$e(r))throw new Error("invalid ip address");return on(r)}function Vf(r){let t=no(r,0,r.length);if(t==null)throw new Error("ipBuff is required");if(!$e(t))throw new Error("invalid ip address");return t}function pn(r){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,r),new Uint8Array(t)}function co(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function oo(r){let t=sn(r),e=Uint8Array.from(bt.default.encode(t.length));return xt([e,t],e.length+t.length)}function io(r){let t=bt.default.decode(r);if(r=r.slice(bt.default.decode.bytes),r.length!==t)throw new Error("inconsistent lengths");return K(r)}function jf(r){let t;r[0]==="Q"||r[0]==="1"?t=Oe(W.decode(`z${r}`)).bytes:t=It.parse(r).multihash.bytes;let e=Uint8Array.from(bt.default.encode(t.length));return xt([e,t],e.length+t.length)}function qf(r){let t=zf.decode(r),e=Uint8Array.from(bt.default.encode(t.length));return xt([e,t],e.length+t.length)}function Gf(r){let t=bt.default.decode(r),e=r.slice(bt.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return"u"+K(e,"base64url")}function Hf(r){let t=bt.default.decode(r),e=r.slice(bt.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return K(e,"base58btc")}function Zf(r){let t=r.split(":");if(t.length!==2)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(t[0].length!==16)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion address.`);let e=dt.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=pn(n);return xt([e,o],e.length+o.length)}function Wf(r){let t=r.split(":");if(t.length!==2)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(t[0].length!==56)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion3 address.`);let e=dt.decode(`b${t[0]}`),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=pn(n);return xt([e,o],e.length+o.length)}function ao(r){let t=r.slice(0,r.length-2),e=r.slice(r.length-2),n=K(t,"base32"),o=co(e);return`${n}:${o}`}function uo(r){r=ln(r);let t=[],e=[],n=null,o=r.split("/").slice(1);if(o.length===1&&o[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let c=0;c<o.length;c++){let f=o[c],l=P(f);if(l.size===0){t.push([l.code]),e.push([l.code]);continue}if(c++,c>=o.length)throw po("invalid address: "+r);if(l.path===!0){n=ln(o.slice(c).join("/")),t.push([l.code,fn(l.code,n)]),e.push([l.code,n]);break}let g=fn(l.code,o[c]);t.push([l.code,g]),e.push([l.code,un(l.code,g)])}return{string:fo(e),bytes:dn(t),tuples:t,stringTuples:e,path:n}}function hn(r){let t=[],e=[],n=null,o=0;for(;o<r.length;){let c=ae.default.decode(r,o),f=ae.default.decode.bytes??0,l=P(c),g=Jf(l,r.slice(o+f));if(g===0){t.push([c]),e.push([c]),o+=f;continue}let A=r.slice(o+f,o+f+g);if(o+=g+f,o>r.length)throw po("Invalid address Uint8Array: "+K(r,"base16"));t.push([c,A]);let p=un(c,A);if(e.push([c,p]),l.path===!0){n=p;break}}return{bytes:Uint8Array.from(r),string:fo(e),tuples:t,stringTuples:e,path:n}}function fo(r){let t=[];return r.map(e=>{let n=P(e[0]);return t.push(n.name),e.length>1&&e[1]!=null&&t.push(e[1]),null}),ln(t.join("/"))}function dn(r){return xt(r.map(t=>{let e=P(t[0]),n=Uint8Array.from(ae.default.encode(e.code));return t.length>1&&t[1]!=null&&(n=xt([n,t[1]])),n}))}function Jf(r,t){return r.size>0?r.size/8:r.size===0?0:ae.default.decode(t)+(ae.default.decode.bytes??0)}function ln(r){return"/"+r.trim().split("/").filter(t=>t).join("/")}function po(r){return new Error("Error parsing address: "+r)}var Xf=Symbol.for("nodejs.util.inspect.custom"),Qf=[P("dns").code,P("dns4").code,P("dns6").code,P("dnsaddr").code],Yf=new Map,lo=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Kf(r){return!!r?.[lo]}var mn=class r{bytes;#t;#e;#r;#n;[lo]=!0;constructor(t){t==null&&(t="");let e;if(t instanceof Uint8Array)e=hn(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);e=uo(t)}else if(Kf(t))e=hn(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=e.bytes,this.#t=e.string,this.#e=e.tuples,this.#r=e.stringTuples,this.#n=e.path}toString(){return this.#t}toJSON(){return this.toString()}toOptions(){let t,e,n,o,c="",f=P("tcp"),l=P("udp"),g=P("ip4"),A=P("ip6"),p=P("dns6"),b=P("ip6zone");for(let[S,h]of this.stringTuples())S===b.code&&(c=`%${h??""}`),Qf.includes(S)&&(e=f.name,o=443,n=`${h??""}${c}`,t=S===p.code?6:4),(S===f.code||S===l.code)&&(e=P(S).name,o=parseInt(h??"")),(S===g.code||S===A.code)&&(e=P(S).name,n=`${h??""}${c}`,t=S===A.code?6:4);if(t==null||e==null||n==null||o==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:t,host:n,transport:e,port:o}}protos(){return this.#e.map(([t])=>Object.assign({},P(t)))}protoCodes(){return this.#e.map(([t])=>t)}protoNames(){return this.#e.map(([t])=>P(t).name)}tuples(){return this.#e}stringTuples(){return this.#r}encapsulate(t){return t=new r(t),new r(this.toString()+t.toString())}decapsulate(t){let e=t.toString(),n=this.toString(),o=n.lastIndexOf(e);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new r(n.slice(0,o))}decapsulateCode(t){let e=this.tuples();for(let n=e.length-1;n>=0;n--)if(e[n][0]===t)return new r(dn(e.slice(0,n)));return this}getPeerId(){try{let t=[];this.stringTuples().forEach(([n,o])=>{n===ie.p2p.code&&t.push([n,o]),n===ie["p2p-circuit"].code&&(t=[])});let e=t.pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?K(W.decode(`z${n}`),"base58btc"):K(It.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(t){return ys(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(c=>c.resolvable);if(e==null)return[this];let n=Yf.get(e.name);if(n==null)throw new Pe(`no available resolver for ${e.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(c=>new r(c))}nodeAddress(){let t=this.toOptions();if(t.transport!=="tcp"&&t.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${t.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:t.family,address:t.host,port:t.port}}isThinWaistAddress(t){let e=(t??this).protos();return!(e.length!==2||e[0].code!==4&&e[0].code!==41||e[1].code!==6&&e[1].code!==273)}[Xf](){return`Multiaddr(${this.#t})`}};function wt(r){return new mn(r)}var tp=v("dns4"),ep=v("dns6"),rp=v("dnsaddr"),Lt=$(v("dns"),rp,tp,ep),je=$(v("ip4"),v("ip6")),Dt=$(E(je,v("tcp")),E(Lt,v("tcp"))),qe=E(je,v("udp")),np=E(qe,v("utp")),sp=E(qe,v("quic")),op=E(qe,v("quic-v1")),gn=$(E(Dt,v("ws")),E(Lt,v("ws"))),ze=$(E(gn,v("p2p")),gn),bn=$(E(Dt,v("wss")),E(Lt,v("wss")),E(Dt,v("tls"),v("ws")),E(Lt,v("tls"),v("ws"))),Ve=$(E(bn,v("p2p")),bn),wn=$(E(Dt,v("http")),E(je,v("http")),E(Lt,v("http"))),yn=$(E(Dt,v("https")),E(je,v("https")),E(Lt,v("https"))),ho=E(qe,v("webrtc-direct"),v("certhash")),bo=$(E(ho,v("p2p")),ho),mo=E(op,v("webtransport"),v("certhash"),v("certhash")),wo=$(E(mo,v("p2p")),mo),yo=$(E(ze,v("p2p-webrtc-star"),v("p2p")),E(Ve,v("p2p-webrtc-star"),v("p2p")),E(ze,v("p2p-webrtc-star")),E(Ve,v("p2p-webrtc-star"))),jd=$(E(ze,v("p2p-websocket-star"),v("p2p")),E(Ve,v("p2p-websocket-star"),v("p2p")),E(ze,v("p2p-websocket-star")),E(Ve,v("p2p-websocket-star"))),vo=$(E(wn,v("p2p-webrtc-direct"),v("p2p")),E(yn,v("p2p-webrtc-direct"),v("p2p")),E(wn,v("p2p-webrtc-direct")),E(yn,v("p2p-webrtc-direct"))),$t=$(gn,bn,wn,yn,yo,vo,Dt,np,sp,Lt,bo,wo),qd=$(E($t,v("p2p-stardust"),v("p2p")),E($t,v("p2p-stardust"))),Rt=$(E($t,v("p2p")),yo,vo,bo,wo,v("p2p")),go=$(E(Rt,v("p2p-circuit"),Rt),E(Rt,v("p2p-circuit")),E(v("p2p-circuit"),Rt),E($t,v("p2p-circuit")),E(v("p2p-circuit"),$t),v("p2p-circuit")),xo=()=>$(E(go,xo),go),Ut=xo(),Gd=$(E(Ut,Rt,Ut),E(Rt,Ut),E(Ut,Rt),Ut,Rt);var Hd=$(E(Ut,v("webrtc"),v("p2p")),E(Ut,v("webrtc")),E($t,v("webrtc"),v("p2p")),E($t,v("webrtc")),v("webrtc"));function So(r){function t(e){let n;try{n=wt(e)}catch{return!1}let o=r(n.protoNames());return o===null?!1:o===!0||o===!1?o:o.length===0}return t}function E(...r){function t(e){if(e.length<r.length)return null;let n=e;return r.some(o=>(n=typeof o=="function"?o().partialMatch(e):o.partialMatch(e),Array.isArray(n)&&(e=n),n===null)),n}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:So(t),partialMatch:t}}function $(...r){function t(n){let o=null;return r.some(c=>{let f=typeof c=="function"?c().partialMatch(n):c.partialMatch(n);return f!=null?(o=f,!0):!1}),o}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:So(t),partialMatch:t}}function v(r){let t=r;function e(o){let c;try{c=wt(o)}catch{return!1}let f=c.protoNames();return f.length===1&&f[0]===t}function n(o){return o.length===0?null:o[0]===t?o.slice(1):null}return{toString:function(){return t},matches:e,partialMatch:n}}var Ho=H(mt("net"),1);var Ge=class extends EventTarget{#t=new Map;listenerCount(t){let e=this.#t.get(t);return e==null?0:e.length}addEventListener(t,e,n){super.addEventListener(t,e,n);let o=this.#t.get(t);o==null&&(o=[],this.#t.set(t,o)),o.push({callback:e,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(t,e,n){super.removeEventListener(t.toString(),e??null,n);let o=this.#t.get(t);o!=null&&(o=o.filter(({callback:c})=>c!==e),this.#t.set(t,o))}dispatchEvent(t){let e=super.dispatchEvent(t),n=this.#t.get(t.type);return n==null||(n=n.filter(({once:o})=>!o),this.#t.set(t.type,n)),e}safeDispatchEvent(t,e){return this.dispatchEvent(new ce(t,e))}},vn=class extends Event{detail;constructor(t,e){super(t,e),this.detail=e?.detail}},ce=globalThis.CustomEvent??vn;function He(r){return this.subnetMask<r.subnetMask?!1:this.mask(r.subnetMask)===r.mask()}function Ze(r){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===r&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}var ue=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,xn=/\/\d{1,2}$/;var J=class extends Error{constructor(t,e){super(t),this.name="AddressError",e!==null&&(this.parseMessage=e)}};var fe=H(Sn(),1),zt=H(Se(),1),st=class r{constructor(t){this.groups=4,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=Ze(32),this.isInSubnet=He,this.address=t;let e=xn.exec(t);if(e){if(this.parsedSubnet=e[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>32)throw new J("Invalid subnet mask.");t=t.replace(xn,"")}this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}static isValid(t){try{return new r(t),!0}catch{return!1}}parse(t){let e=t.split(".");if(!t.match(ue))throw new J("Invalid IPv4 address.");return e}correctForm(){return this.parsedAddress.map(t=>parseInt(t,10)).join(".")}static fromHex(t){let e=t.replace(/:/g,"").padStart(8,"0"),n=[],o;for(o=0;o<8;o+=2){let c=e.slice(o,o+2);n.push(parseInt(c,16))}return new r(n.join("."))}static fromInteger(t){return r.fromHex(t.toString(16))}static fromArpa(t){let n=t.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new r(n)}toHex(){return this.parsedAddress.map(t=>(0,zt.sprintf)("%02x",parseInt(t,10))).join(":")}toArray(){return this.parsedAddress.map(t=>parseInt(t,10))}toGroup6(){let t=[],e;for(e=0;e<4;e+=2){let n=(0,zt.sprintf)("%02x%02x",parseInt(this.parsedAddress[e],10),parseInt(this.parsedAddress[e+1],10));t.push((0,zt.sprintf)("%x",parseInt(n,16)))}return t.join(":")}bigInteger(){return new fe.BigInteger(this.parsedAddress.map(t=>(0,zt.sprintf)("%02x",parseInt(t,10))).join(""),16)}_startAddress(){return new fe.BigInteger(this.mask()+"0".repeat(32-this.subnetMask),2)}startAddress(){return r.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new fe.BigInteger("1");return r.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new fe.BigInteger(this.mask()+"1".repeat(32-this.subnetMask),2)}endAddress(){return r.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new fe.BigInteger("1");return r.fromBigInteger(this._endAddress().subtract(t))}static fromBigInteger(t){return r.fromInteger(parseInt(t.toString(),10))}mask(t){return t===void 0&&(t=this.subnetMask),this.getBitsBase2(0,t)}getBitsBase2(t,e){return this.binaryZeroPad().slice(t,e)}reverseForm(t){t||(t={});let e=this.correctForm().split(".").reverse().join(".");return t.omitSuffix?e:(0,zt.sprintf)("%s.in-addr.arpa.",e)}isMulticast(){return this.isInSubnet(new r("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(32,"0")}groupForV6(){let t=this.parsedAddress;return this.address.replace(ue,(0,zt.sprintf)('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',t.slice(0,2).join("."),t.slice(2,4).join(".")))}};var Io={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},Tn={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"},Cn=/([^0-9a-f:/%])/gi,En=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,An=/\/\d{1,3}(?=%|$)/,In=/%.*$/,Bo=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),Mo=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/);var Do=H(Se(),1);function ap(r){return r.replace(/^(0+)/,'<span class="zero">$1</span>')}function Xe(r,t=0){return r.split(":").map((n,o)=>/group-v4/.test(n)?n:(0,Do.sprintf)('<span class="hover-group group-%d">%s</span>',o+t,ap(n)))}var jt=H(Se(),1);function Mn(r){return(0,jt.sprintf)("(%s)",r.join("|"))}function Bn(r){return r.length<4?(0,jt.sprintf)("0{0,%d}%s",4-r.length,r):r}var Rn="[^A-Fa-f0-9:]";function Qe(r){let t=[];r.forEach((n,o)=>{parseInt(n,16)===0&&t.push(o)});let e=t.map(n=>r.map((o,c)=>{if(c===n){let f=c===0||c===8-1?":":"";return Mn([Bn(o),f])}return Bn(o)}).join(":"));return e.push(r.map(Bn).join(":")),Mn(e)}function Dn(r,t,e){let n=t?"":":",o=e?"":":",c=[];!t&&!e&&c.push("::"),t&&e&&c.push(""),(e&&!t||!e&&t)&&c.push(":"),c.push((0,jt.sprintf)("%s(:0{1,4}){1,%d}",n,r-1)),c.push((0,jt.sprintf)("(0{1,4}:){1,%d}%s",r-1,o)),c.push((0,jt.sprintf)("(0{1,4}:){%d}0{1,4}",r-1));for(let f=1;f<r-1;f++)for(let l=1;l<r-f;l++)c.push((0,jt.sprintf)("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",l,r-l-f-1));return Mn(c)}var X=H(Sn(),1),Q=H(Se(),1);function Ye(r){if(!r)throw new Error("Assertion failed.")}function cp(r){let t=/(\d+)(\d{3})/;for(;t.test(r);)r=r.replace(t,"$1,$2");return r}function up(r){return r=r.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),r=r.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2'),r}function fp(r,t){let e=[],n=[],o;for(o=0;o<r.length;o++)o<t[0]?e.push(r[o]):o>t[1]&&n.push(r[o]);return e.concat(["compact"]).concat(n)}function ko(r){return(0,Q.sprintf)("%04x",parseInt(r,16))}function Oo(r){return r&255}var Te=class r{constructor(t,e){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=He,this.isCorrect=Ze(128),e===void 0?this.groups=8:this.groups=e,this.address=t;let n=An.exec(t);if(n){if(this.parsedSubnet=n[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>128)throw new J("Invalid subnet mask.");t=t.replace(An,"")}else if(/\//.test(t))throw new J("Invalid subnet mask.");let o=In.exec(t);o&&(this.zone=o[0],t=t.replace(In,"")),this.addressMinusSuffix=t,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(t){try{return new r(t),!0}catch{return!1}}static fromBigInteger(t){let e=t.toString(16).padStart(32,"0"),n=[],o;for(o=0;o<8;o++)n.push(e.slice(o*4,(o+1)*4));return new r(n.join(":"))}static fromURL(t){let e,n=null,o;if(t.indexOf("[")!==-1&&t.indexOf("]:")!==-1){if(o=Mo.exec(t),o===null)return{error:"failed to parse address with port",address:null,port:null};e=o[1],n=o[2]}else if(t.indexOf("/")!==-1){if(t=t.replace(/^[a-z0-9]+:\/\//,""),o=Bo.exec(t),o===null)return{error:"failed to parse address from URL",address:null,port:null};e=o[1]}else e=t;return n?(n=parseInt(n,10),(n<0||n>65536)&&(n=null)):n=null,{address:new r(e),port:n}}static fromAddress4(t){let e=new st(t),n=128-(32-e.subnetMask);return new r(`::ffff:${e.correctForm()}/${n}`)}static fromArpa(t){let e=t.replace(/(\.ip6\.arpa)?\.$/,""),n=7;if(e.length!==63)throw new J("Invalid 'ip6.arpa' form.");let o=e.split(".").reverse();for(let c=n;c>0;c--){let f=c*4;o.splice(f,0,":")}return e=o.join(""),new r(e)}microsoftTranscription(){return(0,Q.sprintf)("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))}mask(t=this.subnetMask){return this.getBitsBase2(0,t)}possibleSubnets(t=128){let e=128-this.subnetMask,n=Math.abs(t-128),o=e-n;return o<0?"0":cp(new X.BigInteger("2",10).pow(o).toString(10))}_startAddress(){return new X.BigInteger(this.mask()+"0".repeat(128-this.subnetMask),2)}startAddress(){return r.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new X.BigInteger("1");return r.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new X.BigInteger(this.mask()+"1".repeat(128-this.subnetMask),2)}endAddress(){return r.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new X.BigInteger("1");return r.fromBigInteger(this._endAddress().subtract(t))}getScope(){let t=Io[this.getBits(12,16).intValue()];return this.getType()==="Global unicast"&&t!=="Link local"&&(t="Global"),t||"Unknown"}getType(){for(let t of Object.keys(Tn))if(this.isInSubnet(new r(t)))return Tn[t];return"Global unicast"}getBits(t,e){return new X.BigInteger(this.getBitsBase2(t,e),2)}getBitsBase2(t,e){return this.binaryZeroPad().slice(t,e)}getBitsBase16(t,e){let n=e-t;if(n%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(t,e).toString(16).padStart(n/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,128)}reverseForm(t){t||(t={});let e=Math.floor(this.subnetMask/4),n=this.canonicalForm().replace(/:/g,"").split("").slice(0,e).reverse().join(".");return e>0?t.omitSuffix?n:(0,Q.sprintf)("%s.ip6.arpa.",n):t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,e=[],n=0,o=[];for(t=0;t<this.parsedAddress.length;t++){let l=parseInt(this.parsedAddress[t],16);l===0&&n++,l!==0&&n>0&&(n>1&&o.push([t-n,t-1]),n=0)}n>1&&o.push([this.parsedAddress.length-n,this.parsedAddress.length-1]);let c=o.map(l=>l[1]-l[0]+1);if(o.length>0){let l=c.indexOf(Math.max(...c));e=fp(this.parsedAddress,o[l])}else e=this.parsedAddress;for(t=0;t<e.length;t++)e[t]!=="compact"&&(e[t]=parseInt(e[t],16).toString(16));let f=e.join(":");return f=f.replace(/^compact$/,"::"),f=f.replace(/^compact|compact$/,":"),f=f.replace(/compact/,""),f}binaryZeroPad(){return this.bigInteger().toString(2).padStart(128,"0")}parse4in6(t){let e=t.split(":"),o=e.slice(-1)[0].match(ue);if(o){this.parsedAddress4=o[0],this.address4=new st(this.parsedAddress4);for(let c=0;c<this.address4.groups;c++)if(/^0[0-9]+/.test(this.address4.parsedAddress[c]))throw new J("IPv4 addresses can't have leading zeroes.",t.replace(ue,this.address4.parsedAddress.map(up).join(".")));this.v4=!0,e[e.length-1]=this.address4.toGroup6(),t=e.join(":")}return t}parse(t){t=this.parse4in6(t);let e=t.match(Cn);if(e)throw new J((0,Q.sprintf)("Bad character%s detected in address: %s",e.length>1?"s":"",e.join("")),t.replace(Cn,'<span class="parse-error">$1</span>'));let n=t.match(En);if(n)throw new J((0,Q.sprintf)("Address failed regex: %s",n.join("")),t.replace(En,'<span class="parse-error">$1</span>'));let o=[],c=t.split("::");if(c.length===2){let f=c[0].split(":"),l=c[1].split(":");f.length===1&&f[0]===""&&(f=[]),l.length===1&&l[0]===""&&(l=[]);let g=this.groups-(f.length+l.length);if(!g)throw new J("Error parsing groups");this.elidedGroups=g,this.elisionBegin=f.length,this.elisionEnd=f.length+this.elidedGroups,o=o.concat(f);for(let A=0;A<g;A++)o.push("0");o=o.concat(l)}else if(c.length===1)o=t.split(":"),this.elidedGroups=0;else throw new J("Too many :: groups found");if(o=o.map(f=>(0,Q.sprintf)("%x",parseInt(f,16))),o.length!==this.groups)throw new J("Incorrect number of groups found");return o}canonicalForm(){return this.parsedAddress.map(ko).join(":")}decimal(){return this.parsedAddress.map(t=>(0,Q.sprintf)("%05d",parseInt(t,16))).join(":")}bigInteger(){return new X.BigInteger(this.parsedAddress.map(ko).join(""),16)}to4(){let t=this.binaryZeroPad().split("");return st.fromHex(new X.BigInteger(t.slice(96,128).join(""),2).toString(16))}to4in6(){let t=this.to4(),n=new r(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),o="";return/:$/.test(n)||(o=":"),n+o+t.address}inspectTeredo(){let t=this.getBitsBase16(0,32),e=this.getBits(80,96).xor(new X.BigInteger("ffff",16)).toString(),n=st.fromHex(this.getBitsBase16(32,64)),o=st.fromHex(this.getBits(96,128).xor(new X.BigInteger("ffffffff",16)).toString(16)),c=this.getBits(64,80),f=this.getBitsBase2(64,80),l=c.testBit(15),g=c.testBit(14),A=c.testBit(8),p=c.testBit(9),b=new X.BigInteger(f.slice(2,6)+f.slice(8,16),2).toString(10);return{prefix:(0,Q.sprintf)("%s:%s",t.slice(0,4),t.slice(4,8)),server4:n.address,client4:o.address,flags:f,coneNat:l,microsoft:{reserved:g,universalLocal:p,groupIndividual:A,nonce:b},udpPort:e}}inspect6to4(){let t=this.getBitsBase16(0,16),e=st.fromHex(this.getBitsBase16(16,48));return{prefix:(0,Q.sprintf)("%s",t.slice(0,4)),gateway:e.address}}to6to4(){if(!this.is4())return null;let t=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new r(t)}toByteArray(){let t=this.bigInteger().toByteArray();return t.length===17&&t[0]===0?t.slice(1):t}toUnsignedByteArray(){return this.toByteArray().map(Oo)}static fromByteArray(t){return this.fromUnsignedByteArray(t.map(Oo))}static fromUnsignedByteArray(t){let e=new X.BigInteger("256",10),n=new X.BigInteger("0",10),o=new X.BigInteger("1",10);for(let c=t.length-1;c>=0;c--)n=n.add(o.multiply(new X.BigInteger(t[c].toString(10),10))),o=o.multiply(e);return r.fromBigInteger(n)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){return this.getBitsBase2(0,64)==="1111111010000000000000000000000000000000000000000000000000000000"}isMulticast(){return this.getType()==="Multicast"}is4(){return this.v4}isTeredo(){return this.isInSubnet(new r("2001::/32"))}is6to4(){return this.isInSubnet(new r("2002::/16"))}isLoopback(){return this.getType()==="Loopback"}href(t){return t===void 0?t="":t=(0,Q.sprintf)(":%s",t),(0,Q.sprintf)("http://[%s]%s/",this.correctForm(),t)}link(t){t||(t={}),t.className===void 0&&(t.className=""),t.prefix===void 0&&(t.prefix="/#address="),t.v4===void 0&&(t.v4=!1);let e=this.correctForm;return t.v4&&(e=this.to4in6),t.className?(0,Q.sprintf)('<a href="%1$s%2$s" class="%3$s">%2$s</a>',t.prefix,e.call(this),t.className):(0,Q.sprintf)('<a href="%1$s%2$s">%2$s</a>',t.prefix,e.call(this))}group(){if(this.elidedGroups===0)return Xe(this.address).join(":");Ye(typeof this.elidedGroups=="number"),Ye(typeof this.elisionBegin=="number");let t=[],[e,n]=this.address.split("::");e.length?t.push(...Xe(e)):t.push("");let o=["hover-group"];for(let c=this.elisionBegin;c<this.elisionBegin+this.elidedGroups;c++)o.push((0,Q.sprintf)("group-%d",c));return t.push((0,Q.sprintf)('<span class="%s"></span>',o.join(" "))),n.length?t.push(...Xe(n,this.elisionEnd)):t.push(""),this.is4()&&(Ye(this.address4 instanceof st),t.pop(),t.push(this.address4.groupForV6())),t.join(":")}regularExpressionString(t=!1){let e=[],n=new r(this.correctForm());if(n.elidedGroups===0)e.push(Qe(n.parsedAddress));else if(n.elidedGroups===8)e.push(Dn(8));else{let o=n.address.split("::");o[0].length&&e.push(Qe(o[0].split(":"))),Ye(typeof n.elidedGroups=="number"),e.push(Dn(n.elidedGroups,o[0].length!==0,o[1].length!==0)),o[1].length&&e.push(Qe(o[1].split(":"))),e=[e.join(":")]}return t||(e=["(?=^|",Rn,"|[^\\w\\:])(",...e,")(?=[^\\w\\:]|",Rn,"|$)"]),e.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};var pp=At("libp2p:ip-port-to-multiaddr"),Pn={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};function No(r,t){if(typeof r!="string")throw new lt(`invalid ip provided: ${r}`,Pn.ERR_INVALID_IP_PARAMETER);if(typeof t=="string"&&(t=parseInt(t)),isNaN(t))throw new lt(`invalid port provided: ${t}`,Pn.ERR_INVALID_PORT_PARAMETER);try{return new st(r),wt(`/ip4/${r}/tcp/${t}`)}catch{}try{let e=new Te(r);return e.is4()?wt(`/ip4/${e.to4().correctForm()}/tcp/${t}`):wt(`/ip6/${r}/tcp/${t}`)}catch{let n=`invalid ip:port for creating a multiaddr: ${r}:${t}`;throw pp.error(n),new lt(n,Pn.ERR_INVALID_IP)}}var Go=H(jo(),1);var Nn=H(mt("os"),1),qo=H(mt("path"),1);var gp={ip4:"IPv4",ip6:"IPv6"};function he(r,t={}){let e=r.getPath();return e!=null?Nn.default.platform()==="win32"?{path:qo.default.join("\\\\.\\pipe\\",e)}:{path:e}:{...r.toOptions(),...t}}function Fn(r,t,e){let n=o=>wt(`/${r}/${o}/tcp/${e}`);return(bp(t)?yp(gp[r]):[t]).map(n)}function bp(r){return["0.0.0.0","::"].includes(r)}var wp=Nn.default.networkInterfaces();function yp(r){let t=[];for(let[,e]of Object.entries(wp))if(e!=null)for(let n of e)n.family===r&&t.push(n.address);return t}var yt=At("libp2p:tcp:socket"),tr=(r,t)=>{let e=t.metrics,n=t.metricPrefix??"",o=t.socketInactivityTimeout??3e5,c=t.socketCloseTimeout??500;t.listeningAddr?.getPath()!=null&&(t.remoteAddr=t.listeningAddr),t.remoteAddr?.getPath()!=null&&(t.localAddr=t.remoteAddr);let f;if(t.remoteAddr!=null)f=t.remoteAddr;else{if(r.remoteAddress==null||r.remotePort==null)throw new lt("Could not determine remote address or port","ERR_NO_REMOTE_ADDRESS");f=No(r.remoteAddress,r.remotePort)}let l=he(f),g=l.path??`${l.host??""}:${l.port??""}`,{sink:A,source:p}=Go.default.duplex(r);r.setTimeout(o,()=>{yt("%s socket read timeout",g),e?.increment({[`${n}timeout`]:!0});let y;r.readable&&(y=new lt("Socket read timeout","ERR_SOCKET_READ_TIMEOUT")),r.destroy(y)}),r.once("close",()=>{yt("%s socket close",g),e?.increment({[`${n}close`]:!0}),b.timeline.close==null&&(b.timeline.close=Date.now())}),r.once("end",()=>{yt("%s socket end",g),e?.increment({[`${n}end`]:!0})});let b={async sink(y){try{await A(y)}catch(S){S.type!=="aborted"&&yt(S)}r.end()},source:p,remoteAddr:f,timeline:{open:Date.now()},async close(y={}){if(r.destroyed){yt("%s socket was already destroyed when trying to close",g);return}y.signal=y.signal??AbortSignal.timeout(c);try{yt("%s closing socket",g),await new Promise((S,h)=>{r.once("close",()=>{yt("%s socket closed",g),S()}),r.once("error",T=>{yt("%s socket error",g,T),b.timeline.close==null&&(b.timeline.close=Date.now()),h(T)}),r.setTimeout(c),r.end(),r.writableLength>0?r.once("drain",()=>{yt("%s socket drained",g),r.destroy()}):r.destroy()})}catch(S){this.abort(S)}},abort:y=>{yt("%s socket abort due to error",g,y),r.destroy(y)}};return b};var ot=At("libp2p:tcp:listener");async function _n(r){try{await r.close()}catch(t){ot.error("an error occurred closing the connection",t)}}var Sp=1,Tp=0,er=class extends Ge{context;server;connections=new Set;status={started:!1};metrics;addr;constructor(t){if(super(),this.context=t,t.keepAlive=t.keepAlive??!0,this.addr="unknown",this.server=Ho.default.createServer(t,this.onSocket.bind(this)),t.maxConnections!==void 0&&(this.server.maxConnections=t.maxConnections),t.closeServerOnMaxConnections!=null&&t.closeServerOnMaxConnections.closeAbove<t.closeServerOnMaxConnections.listenBelow)throw Error("closeAbove must be >= listenBelow");this.server.on("listening",()=>{if(t.metrics!=null){let e=this.server.address();e==null?this.addr="unknown":typeof e=="string"?this.addr=e:this.addr=`${e.address}:${e.port}`,t.metrics?.registerMetricGroup("libp2p_tcp_inbound_connections_total",{label:"address",help:"Current active connections in TCP listener",calculate:()=>({[this.addr]:this.connections.size})}),this.metrics={status:t.metrics.registerMetricGroup("libp2p_tcp_listener_status_info",{label:"address",help:"Current status of the TCP listener socket"}),errors:t.metrics.registerMetricGroup("libp2p_tcp_listener_errors_total",{label:"address",help:"Total count of TCP listener errors by type"}),events:t.metrics.registerMetricGroup("libp2p_tcp_listener_events_total",{label:"address",help:"Total count of TCP listener events by type"})},this.metrics?.status.update({[this.addr]:Sp})}this.dispatchEvent(new ce("listening"))}).on("error",e=>{this.metrics?.errors.increment({[`${this.addr} listen_error`]:!0}),this.dispatchEvent(new ce("error",{detail:e}))}).on("close",()=>{this.metrics?.status.update({[this.addr]:Tp}),this.dispatchEvent(new ce("close"))})}onSocket(t){t.on("error",n=>{ot("socket error",n),this.metrics?.events.increment({[`${this.addr} error`]:!0})});let e;try{e=tr(t,{listeningAddr:this.status.started?this.status.listeningAddr:void 0,socketInactivityTimeout:this.context.socketInactivityTimeout,socketCloseTimeout:this.context.socketCloseTimeout,metrics:this.metrics?.events,metricPrefix:`${this.addr} `})}catch(n){ot.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_to_connection`]:!0});return}ot("new inbound connection %s",e.remoteAddr);try{this.context.upgrader.upgradeInbound(e).then(n=>{ot("inbound connection upgraded %s",e.remoteAddr),this.connections.add(e),t.once("close",()=>{this.connections.delete(e),this.context.closeServerOnMaxConnections!=null&&this.connections.size<this.context.closeServerOnMaxConnections.listenBelow&&this.netListen().catch(o=>{ot.error("error attempting to listen server once connection count under limit",o),this.context.closeServerOnMaxConnections?.onListenError?.(o)})}),this.context.handler!=null&&this.context.handler(n),this.context.closeServerOnMaxConnections!=null&&this.connections.size>=this.context.closeServerOnMaxConnections.closeAbove&&this.netClose(),this.dispatchEvent(new ce("connection",{detail:n}))}).catch(async n=>{ot.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_upgrade`]:!0}),await _n(e)}).catch(n=>{ot.error("closing inbound connection failed",n)})}catch(n){ot.error("inbound connection failed",n),_n(e).catch(o=>{ot.error("closing inbound connection failed",o),this.metrics?.errors.increment({[`${this.addr} inbound_closing_failed`]:!0})})}}getAddrs(){if(!this.status.started)return[];let t=[],e=this.server.address(),{listeningAddr:n,peerId:o}=this.status;if(e==null)return[];if(typeof e=="string")t=[n];else try{n.toString().startsWith("/ip4")?t=t.concat(Fn("ip4",e.address,e.port)):e.family==="IPv6"&&(t=t.concat(Fn("ip6",e.address,e.port)))}catch(c){ot.error("could not turn %s:%s into multiaddr",e.address,e.port,c)}return t.map(c=>o!=null?c.encapsulate(`/p2p/${o}`):c)}async listen(t){if(this.status.started)throw Error("server is already listening");let e=t.getPeerId(),n=e==null?t.decapsulateCode(421):t,{backlog:o}=this.context;this.status={started:!0,listeningAddr:n,peerId:e,netConfig:he(n,{backlog:o})},await this.netListen()}async close(){await Promise.all(Array.from(this.connections.values()).map(async t=>{await _n(t)})),this.netClose()}async netListen(){if(!this.status.started||this.server.listening)return;let t=this.status.netConfig;await new Promise((e,n)=>{this.server.once("error",n),this.server.listen(t,e)}),ot("Listening on %s",this.server.address())}netClose(){!this.status.started||!this.server.listening||(ot("Closing server on %s",this.server.address()),this.server.close())}};var Tt=At("libp2p:tcp"),Ln=class{opts;metrics;components;constructor(t,e={}){this.opts=e,this.components=t,t.metrics!=null&&(this.metrics={dialerEvents:t.metrics.registerCounterGroup("libp2p_tcp_dialer_events_total",{label:"event",help:"Total count of TCP dialer events by type"})})}[Wn]=!0;[Symbol.toStringTag]="@libp2p/tcp";async dial(t,e){e.keepAlive=e.keepAlive??!0;let n=await this._connect(t,e);n.on("error",l=>{Tt("socket error",l)});let o=tr(n,{remoteAddr:t,socketInactivityTimeout:this.opts.outboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.metrics?.dialerEvents}),c=()=>{o.close().catch(l=>{Tt.error("Error closing maConn after abort",l)})};e.signal?.addEventListener("abort",c,{once:!0}),Tt("new outbound connection %s",o.remoteAddr);let f=await e.upgrader.upgradeOutbound(o);if(Tt("outbound connection %s upgraded",o.remoteAddr),e.signal?.removeEventListener("abort",c),e.signal?.aborted===!0)throw f.close().catch(l=>{Tt.error("Error closing conn after abort",l)}),new qt;return f}async _connect(t,e){if(e.signal?.aborted===!0)throw new qt;return new Promise((n,o)=>{let c=Date.now(),f=he(t),l=f.path??`${f.host??""}:${f.port}`;Tt("dialing %j",f);let g=Zo.default.connect(f),A=h=>{h.message=`connection error ${l}: ${h.message}`,this.metrics?.dialerEvents.increment({error:!0}),S(h)},p=()=>{Tt("connection timeout %s",l),this.metrics?.dialerEvents.increment({timeout:!0});let h=new lt(`connection timeout after ${Date.now()-c}ms`,"ERR_CONNECT_TIMEOUT");g.emit("error",h)},b=()=>{Tt("connection opened %j",f),this.metrics?.dialerEvents.increment({connect:!0}),S()},y=()=>{Tt("connection aborted %j",f),this.metrics?.dialerEvents.increment({abort:!0}),g.destroy(),S(new qt)},S=h=>{if(g.removeListener("error",A),g.removeListener("timeout",p),g.removeListener("connect",b),e.signal!=null&&e.signal.removeEventListener("abort",y),h!=null){o(h);return}n(g)};g.on("error",A),g.on("timeout",p),g.on("connect",b),e.signal!=null&&e.signal.addEventListener("abort",y)})}createListener(t){return new er({...t,maxConnections:this.opts.maxConnections,backlog:this.opts.backlog,closeServerOnMaxConnections:this.opts.closeServerOnMaxConnections,socketInactivityTimeout:this.opts.inboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.components.metrics})}filter(t){return t=Array.isArray(t)?t:[t],t.filter(e=>e.protoCodes().includes(290)?!1:e.protoCodes().includes(400)?!0:Dt.matches(e.decapsulateCode(421)))}};function Ap(r={}){return(t={})=>new Ln(t,r)}return ka(Ip);})();
|
|
4
|
+
`+c),e.push(i+"m+"+we.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Ji()+t+" "+e[0]}function Ji(){return L.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Yi(...e){return process.stderr.write(be.format(...e)+`
|
|
5
|
+
`)}function Qi(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function Ki(){return process.env.DEBUG}function ta(e){e.inspectOpts={};let t=Object.keys(L.inspectOpts);for(let r=0;r<t.length;r++)e.inspectOpts[t[r]]=L.inspectOpts[t[r]]}we.exports=He()(L);var{formatters:vn}=we.exports;vn.o=function(e){return this.inspectOpts.colors=this.useColors,be.inspect(e,this.inspectOpts).split(`
|
|
6
|
+
`).map(t=>t.trim()).join(" ")};vn.O=function(e){return this.inspectOpts.colors=this.useColors,be.inspect(e,this.inspectOpts)}});var Sn=N((Eu,We)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?We.exports=mn():We.exports=xn()});var Gn=N((Af,qn)=>{qn.exports=wr;var zn=128,uc=127,fc=~uc,lc=Math.pow(2,31);function wr(e,t,r){if(Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw wr.bytes=0,new RangeError("Could not encode varint");t=t||[],r=r||0;for(var n=r;e>=lc;)t[r++]=e&255|zn,e/=128;for(;e&fc;)t[r++]=e&255|zn,e>>>=7;return t[r]=e|0,wr.bytes=r-n+1,t}});var Wn=N((If,Zn)=>{Zn.exports=yr;var pc=128,Hn=127;function yr(e,n){var r=0,n=n||0,i=0,c=n,f,h=e.length;do{if(c>=h||i>49)throw yr.bytes=0,new RangeError("Could not decode varint");f=e[c++],r+=i<28?(f&Hn)<<i:(f&Hn)*Math.pow(2,i),i+=7}while(f>=pc);return yr.bytes=c-n,r}});var Jn=N((Rf,Xn)=>{var hc=Math.pow(2,7),dc=Math.pow(2,14),mc=Math.pow(2,21),gc=Math.pow(2,28),bc=Math.pow(2,35),wc=Math.pow(2,42),yc=Math.pow(2,49),vc=Math.pow(2,56),xc=Math.pow(2,63);Xn.exports=function(e){return e<hc?1:e<dc?2:e<mc?3:e<gc?4:e<bc?5:e<wc?6:e<yc?7:e<vc?8:e<xc?9:10}});var vr=N((Bf,Yn)=>{Yn.exports={encode:Gn(),decode:Wn(),encodingLength:Jn()}});var Lr=N((Pe,Ss)=>{(function(){var e,t=0xdeadbeefcafe,r=(t&16777215)==15715070;function n(s,o,a){s!=null&&(typeof s=="number"?this.fromNumber(s,o,a):o==null&&typeof s!="string"?this.fromString(s,256):this.fromString(s,o))}function i(){return new n(null)}function c(s,o,a,u,p,d){for(;--d>=0;){var b=o*this[s++]+a[u]+p;p=Math.floor(b/67108864),a[u++]=b&67108863}return p}function f(s,o,a,u,p,d){for(var b=o&32767,v=o>>15;--d>=0;){var M=this[s]&32767,F=this[s++]>>15,st=v*M+F*b;M=b*M+((st&32767)<<15)+a[u]+(p&1073741823),p=(M>>>30)+(st>>>15)+v*F+(p>>>30),a[u++]=M&1073741823}return p}function h(s,o,a,u,p,d){for(var b=o&16383,v=o>>14;--d>=0;){var M=this[s]&16383,F=this[s++]>>14,st=v*M+F*b;M=b*M+((st&16383)<<14)+a[u]+p,p=(M>>28)+(st>>14)+v*F,a[u++]=M&268435455}return p}var g=typeof navigator<"u";g&&r&&navigator.appName=="Microsoft Internet Explorer"?(n.prototype.am=f,e=30):g&&r&&navigator.appName!="Netscape"?(n.prototype.am=c,e=26):(n.prototype.am=h,e=28),n.prototype.DB=e,n.prototype.DM=(1<<e)-1,n.prototype.DV=1<<e;var C=52;n.prototype.FV=Math.pow(2,C),n.prototype.F1=C-e,n.prototype.F2=2*e-C;var l="0123456789abcdefghijklmnopqrstuvwxyz",y=new Array,x,S;for(x="0".charCodeAt(0),S=0;S<=9;++S)y[x++]=S;for(x="a".charCodeAt(0),S=10;S<36;++S)y[x++]=S;for(x="A".charCodeAt(0),S=10;S<36;++S)y[x++]=S;function m(s){return l.charAt(s)}function A(s,o){var a=y[s.charCodeAt(o)];return a??-1}function R(s){for(var o=this.t-1;o>=0;--o)s[o]=this[o];s.t=this.t,s.s=this.s}function E(s){this.t=1,this.s=s<0?-1:0,s>0?this[0]=s:s<-1?this[0]=s+this.DV:this.t=0}function I(s){var o=i();return o.fromInt(s),o}function k(s,o){var a;if(o==16)a=4;else if(o==8)a=3;else if(o==256)a=8;else if(o==2)a=1;else if(o==32)a=5;else if(o==4)a=2;else{this.fromRadix(s,o);return}this.t=0,this.s=0;for(var u=s.length,p=!1,d=0;--u>=0;){var b=a==8?s[u]&255:A(s,u);if(b<0){s.charAt(u)=="-"&&(p=!0);continue}p=!1,d==0?this[this.t++]=b:d+a>this.DB?(this[this.t-1]|=(b&(1<<this.DB-d)-1)<<d,this[this.t++]=b>>this.DB-d):this[this.t-1]|=b<<d,d+=a,d>=this.DB&&(d-=this.DB)}a==8&&s[0]&128&&(this.s=-1,d>0&&(this[this.t-1]|=(1<<this.DB-d)-1<<d)),this.clamp(),p&&n.ZERO.subTo(this,this)}function O(){for(var s=this.s&this.DM;this.t>0&&this[this.t-1]==s;)--this.t}function J(s){if(this.s<0)return"-"+this.negate().toString(s);var o;if(s==16)o=4;else if(s==8)o=3;else if(s==2)o=1;else if(s==32)o=5;else if(s==4)o=2;else return this.toRadix(s);var a=(1<<o)-1,u,p=!1,d="",b=this.t,v=this.DB-b*this.DB%o;if(b-- >0)for(v<this.DB&&(u=this[b]>>v)>0&&(p=!0,d=m(u));b>=0;)v<o?(u=(this[b]&(1<<v)-1)<<o-v,u|=this[--b]>>(v+=this.DB-o)):(u=this[b]>>(v-=o)&a,v<=0&&(v+=this.DB,--b)),u>0&&(p=!0),p&&(d+=m(u));return p?d:"0"}function Z(){var s=i();return n.ZERO.subTo(this,s),s}function q(){return this.s<0?this.negate():this}function W(s){var o=this.s-s.s;if(o!=0)return o;var a=this.t;if(o=a-s.t,o!=0)return this.s<0?-o:o;for(;--a>=0;)if((o=this[a]-s[a])!=0)return o;return 0}function it(s){var o=1,a;return(a=s>>>16)!=0&&(s=a,o+=16),(a=s>>8)!=0&&(s=a,o+=8),(a=s>>4)!=0&&(s=a,o+=4),(a=s>>2)!=0&&(s=a,o+=2),(a=s>>1)!=0&&(s=a,o+=1),o}function Gs(){return this.t<=0?0:this.DB*(this.t-1)+it(this[this.t-1]^this.s&this.DM)}function Hs(s,o){var a;for(a=this.t-1;a>=0;--a)o[a+s]=this[a];for(a=s-1;a>=0;--a)o[a]=0;o.t=this.t+s,o.s=this.s}function Zs(s,o){for(var a=s;a<this.t;++a)o[a-s]=this[a];o.t=Math.max(this.t-s,0),o.s=this.s}function Ws(s,o){var a=s%this.DB,u=this.DB-a,p=(1<<u)-1,d=Math.floor(s/this.DB),b=this.s<<a&this.DM,v;for(v=this.t-1;v>=0;--v)o[v+d+1]=this[v]>>u|b,b=(this[v]&p)<<a;for(v=d-1;v>=0;--v)o[v]=0;o[d]=b,o.t=this.t+d+1,o.s=this.s,o.clamp()}function Xs(s,o){o.s=this.s;var a=Math.floor(s/this.DB);if(a>=this.t){o.t=0;return}var u=s%this.DB,p=this.DB-u,d=(1<<u)-1;o[0]=this[a]>>u;for(var b=a+1;b<this.t;++b)o[b-a-1]|=(this[b]&d)<<p,o[b-a]=this[b]>>u;u>0&&(o[this.t-a-1]|=(this.s&d)<<p),o.t=this.t-a,o.clamp()}function Js(s,o){for(var a=0,u=0,p=Math.min(s.t,this.t);a<p;)u+=this[a]-s[a],o[a++]=u&this.DM,u>>=this.DB;if(s.t<this.t){for(u-=s.s;a<this.t;)u+=this[a],o[a++]=u&this.DM,u>>=this.DB;u+=this.s}else{for(u+=this.s;a<s.t;)u-=s[a],o[a++]=u&this.DM,u>>=this.DB;u-=s.s}o.s=u<0?-1:0,u<-1?o[a++]=this.DV+u:u>0&&(o[a++]=u),o.t=a,o.clamp()}function Ys(s,o){var a=this.abs(),u=s.abs(),p=a.t;for(o.t=p+u.t;--p>=0;)o[p]=0;for(p=0;p<u.t;++p)o[p+a.t]=a.am(0,u[p],o,p,0,a.t);o.s=0,o.clamp(),this.s!=s.s&&n.ZERO.subTo(o,o)}function Qs(s){for(var o=this.abs(),a=s.t=2*o.t;--a>=0;)s[a]=0;for(a=0;a<o.t-1;++a){var u=o.am(a,o[a],s,2*a,0,1);(s[a+o.t]+=o.am(a+1,2*o[a],s,2*a+1,u,o.t-a-1))>=o.DV&&(s[a+o.t]-=o.DV,s[a+o.t+1]=1)}s.t>0&&(s[s.t-1]+=o.am(a,o[a],s,2*a,0,1)),s.s=0,s.clamp()}function Ks(s,o,a){var u=s.abs();if(!(u.t<=0)){var p=this.abs();if(p.t<u.t){o?.fromInt(0),a!=null&&this.copyTo(a);return}a==null&&(a=i());var d=i(),b=this.s,v=s.s,M=this.DB-it(u[u.t-1]);M>0?(u.lShiftTo(M,d),p.lShiftTo(M,a)):(u.copyTo(d),p.copyTo(a));var F=d.t,st=d[F-1];if(st!=0){var Q=st*(1<<this.F1)+(F>1?d[F-2]>>this.F2:0),gt=this.FV/Q,pe=(1<<this.F1)/Q,ct=1<<this.F2,ut=a.t,he=ut-F,xt=o??i();for(d.dlShiftTo(he,xt),a.compareTo(xt)>=0&&(a[a.t++]=1,a.subTo(xt,a)),n.ONE.dlShiftTo(F,xt),xt.subTo(d,d);d.t<F;)d[d.t++]=0;for(;--he>=0;){var Ge=a[--ut]==st?this.DM:Math.floor(a[ut]*gt+(a[ut-1]+ct)*pe);if((a[ut]+=d.am(0,Ge,a,he,0,F))<Ge)for(d.dlShiftTo(he,xt),a.subTo(xt,a);a[ut]<--Ge;)a.subTo(xt,a)}o!=null&&(a.drShiftTo(F,o),b!=v&&n.ZERO.subTo(o,o)),a.t=F,a.clamp(),M>0&&a.rShiftTo(M,a),b<0&&n.ZERO.subTo(a,a)}}}function to(s){var o=i();return this.abs().divRemTo(s,null,o),this.s<0&&o.compareTo(n.ZERO)>0&&s.subTo(o,o),o}function Rt(s){this.m=s}function eo(s){return s.s<0||s.compareTo(this.m)>=0?s.mod(this.m):s}function ro(s){return s}function no(s){s.divRemTo(this.m,null,s)}function so(s,o,a){s.multiplyTo(o,a),this.reduce(a)}function oo(s,o){s.squareTo(o),this.reduce(o)}Rt.prototype.convert=eo,Rt.prototype.revert=ro,Rt.prototype.reduce=no,Rt.prototype.mulTo=so,Rt.prototype.sqrTo=oo;function io(){if(this.t<1)return 0;var s=this[0];if(!(s&1))return 0;var o=s&3;return o=o*(2-(s&15)*o)&15,o=o*(2-(s&255)*o)&255,o=o*(2-((s&65535)*o&65535))&65535,o=o*(2-s*o%this.DV)%this.DV,o>0?this.DV-o:-o}function Bt(s){this.m=s,this.mp=s.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<s.DB-15)-1,this.mt2=2*s.t}function ao(s){var o=i();return s.abs().dlShiftTo(this.m.t,o),o.divRemTo(this.m,null,o),s.s<0&&o.compareTo(n.ZERO)>0&&this.m.subTo(o,o),o}function co(s){var o=i();return s.copyTo(o),this.reduce(o),o}function uo(s){for(;s.t<=this.mt2;)s[s.t++]=0;for(var o=0;o<this.m.t;++o){var a=s[o]&32767,u=a*this.mpl+((a*this.mph+(s[o]>>15)*this.mpl&this.um)<<15)&s.DM;for(a=o+this.m.t,s[a]+=this.m.am(0,u,s,o,0,this.m.t);s[a]>=s.DV;)s[a]-=s.DV,s[++a]++}s.clamp(),s.drShiftTo(this.m.t,s),s.compareTo(this.m)>=0&&s.subTo(this.m,s)}function fo(s,o){s.squareTo(o),this.reduce(o)}function lo(s,o,a){s.multiplyTo(o,a),this.reduce(a)}Bt.prototype.convert=ao,Bt.prototype.revert=co,Bt.prototype.reduce=uo,Bt.prototype.mulTo=lo,Bt.prototype.sqrTo=fo;function po(){return(this.t>0?this[0]&1:this.s)==0}function ho(s,o){if(s>4294967295||s<1)return n.ONE;var a=i(),u=i(),p=o.convert(this),d=it(s)-1;for(p.copyTo(a);--d>=0;)if(o.sqrTo(a,u),(s&1<<d)>0)o.mulTo(u,p,a);else{var b=a;a=u,u=b}return o.revert(a)}function mo(s,o){var a;return s<256||o.isEven()?a=new Rt(o):a=new Bt(o),this.exp(s,a)}n.prototype.copyTo=R,n.prototype.fromInt=E,n.prototype.fromString=k,n.prototype.clamp=O,n.prototype.dlShiftTo=Hs,n.prototype.drShiftTo=Zs,n.prototype.lShiftTo=Ws,n.prototype.rShiftTo=Xs,n.prototype.subTo=Js,n.prototype.multiplyTo=Ys,n.prototype.squareTo=Qs,n.prototype.divRemTo=Ks,n.prototype.invDigit=io,n.prototype.isEven=po,n.prototype.exp=ho,n.prototype.toString=J,n.prototype.negate=Z,n.prototype.abs=q,n.prototype.compareTo=W,n.prototype.bitLength=Gs,n.prototype.mod=to,n.prototype.modPowInt=mo,n.ZERO=I(0),n.ONE=I(1);function go(){var s=i();return this.copyTo(s),s}function bo(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function wo(){return this.t==0?this.s:this[0]<<24>>24}function yo(){return this.t==0?this.s:this[0]<<16>>16}function vo(s){return Math.floor(Math.LN2*this.DB/Math.log(s))}function xo(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function So(s){if(s==null&&(s=10),this.signum()==0||s<2||s>36)return"0";var o=this.chunkSize(s),a=Math.pow(s,o),u=I(a),p=i(),d=i(),b="";for(this.divRemTo(u,p,d);p.signum()>0;)b=(a+d.intValue()).toString(s).substr(1)+b,p.divRemTo(u,p,d);return d.intValue().toString(s)+b}function To(s,o){this.fromInt(0),o==null&&(o=10);for(var a=this.chunkSize(o),u=Math.pow(o,a),p=!1,d=0,b=0,v=0;v<s.length;++v){var M=A(s,v);if(M<0){s.charAt(v)=="-"&&this.signum()==0&&(p=!0);continue}b=o*b+M,++d>=a&&(this.dMultiply(u),this.dAddOffset(b,0),d=0,b=0)}d>0&&(this.dMultiply(Math.pow(o,d)),this.dAddOffset(b,0)),p&&n.ZERO.subTo(this,this)}function Co(s,o,a){if(typeof o=="number")if(s<2)this.fromInt(1);else for(this.fromNumber(s,a),this.testBit(s-1)||this.bitwiseTo(n.ONE.shiftLeft(s-1),Ve,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(o);)this.dAddOffset(2,0),this.bitLength()>s&&this.subTo(n.ONE.shiftLeft(s-1),this);else{var u=new Array,p=s&7;u.length=(s>>3)+1,o.nextBytes(u),p>0?u[0]&=(1<<p)-1:u[0]=0,this.fromString(u,256)}}function Eo(){var s=this.t,o=new Array;o[0]=this.s;var a=this.DB-s*this.DB%8,u,p=0;if(s-- >0)for(a<this.DB&&(u=this[s]>>a)!=(this.s&this.DM)>>a&&(o[p++]=u|this.s<<this.DB-a);s>=0;)a<8?(u=(this[s]&(1<<a)-1)<<8-a,u|=this[--s]>>(a+=this.DB-8)):(u=this[s]>>(a-=8)&255,a<=0&&(a+=this.DB,--s)),u&128&&(u|=-256),p==0&&(this.s&128)!=(u&128)&&++p,(p>0||u!=this.s)&&(o[p++]=u);return o}function Ao(s){return this.compareTo(s)==0}function Io(s){return this.compareTo(s)<0?this:s}function Ro(s){return this.compareTo(s)>0?this:s}function Bo(s,o,a){var u,p,d=Math.min(s.t,this.t);for(u=0;u<d;++u)a[u]=o(this[u],s[u]);if(s.t<this.t){for(p=s.s&this.DM,u=d;u<this.t;++u)a[u]=o(this[u],p);a.t=this.t}else{for(p=this.s&this.DM,u=d;u<s.t;++u)a[u]=o(p,s[u]);a.t=s.t}a.s=o(this.s,s.s),a.clamp()}function Mo(s,o){return s&o}function Do(s){var o=i();return this.bitwiseTo(s,Mo,o),o}function Ve(s,o){return s|o}function ko(s){var o=i();return this.bitwiseTo(s,Ve,o),o}function rn(s,o){return s^o}function Po(s){var o=i();return this.bitwiseTo(s,rn,o),o}function nn(s,o){return s&~o}function Oo(s){var o=i();return this.bitwiseTo(s,nn,o),o}function No(){for(var s=i(),o=0;o<this.t;++o)s[o]=this.DM&~this[o];return s.t=this.t,s.s=~this.s,s}function _o(s){var o=i();return s<0?this.rShiftTo(-s,o):this.lShiftTo(s,o),o}function Fo(s){var o=i();return s<0?this.lShiftTo(-s,o):this.rShiftTo(s,o),o}function Lo(s){if(s==0)return-1;var o=0;return s&65535||(s>>=16,o+=16),s&255||(s>>=8,o+=8),s&15||(s>>=4,o+=4),s&3||(s>>=2,o+=2),s&1||++o,o}function Uo(){for(var s=0;s<this.t;++s)if(this[s]!=0)return s*this.DB+Lo(this[s]);return this.s<0?this.t*this.DB:-1}function $o(s){for(var o=0;s!=0;)s&=s-1,++o;return o}function Vo(){for(var s=0,o=this.s&this.DM,a=0;a<this.t;++a)s+=$o(this[a]^o);return s}function jo(s){var o=Math.floor(s/this.DB);return o>=this.t?this.s!=0:(this[o]&1<<s%this.DB)!=0}function zo(s,o){var a=n.ONE.shiftLeft(s);return this.bitwiseTo(a,o,a),a}function qo(s){return this.changeBit(s,Ve)}function Go(s){return this.changeBit(s,nn)}function Ho(s){return this.changeBit(s,rn)}function Zo(s,o){for(var a=0,u=0,p=Math.min(s.t,this.t);a<p;)u+=this[a]+s[a],o[a++]=u&this.DM,u>>=this.DB;if(s.t<this.t){for(u+=s.s;a<this.t;)u+=this[a],o[a++]=u&this.DM,u>>=this.DB;u+=this.s}else{for(u+=this.s;a<s.t;)u+=s[a],o[a++]=u&this.DM,u>>=this.DB;u+=s.s}o.s=u<0?-1:0,u>0?o[a++]=u:u<-1&&(o[a++]=this.DV+u),o.t=a,o.clamp()}function Wo(s){var o=i();return this.addTo(s,o),o}function Xo(s){var o=i();return this.subTo(s,o),o}function Jo(s){var o=i();return this.multiplyTo(s,o),o}function Yo(){var s=i();return this.squareTo(s),s}function Qo(s){var o=i();return this.divRemTo(s,o,null),o}function Ko(s){var o=i();return this.divRemTo(s,null,o),o}function ti(s){var o=i(),a=i();return this.divRemTo(s,o,a),new Array(o,a)}function ei(s){this[this.t]=this.am(0,s-1,this,0,0,this.t),++this.t,this.clamp()}function ri(s,o){if(s!=0){for(;this.t<=o;)this[this.t++]=0;for(this[o]+=s;this[o]>=this.DV;)this[o]-=this.DV,++o>=this.t&&(this[this.t++]=0),++this[o]}}function se(){}function sn(s){return s}function ni(s,o,a){s.multiplyTo(o,a)}function si(s,o){s.squareTo(o)}se.prototype.convert=sn,se.prototype.revert=sn,se.prototype.mulTo=ni,se.prototype.sqrTo=si;function oi(s){return this.exp(s,new se)}function ii(s,o,a){var u=Math.min(this.t+s.t,o);for(a.s=0,a.t=u;u>0;)a[--u]=0;var p;for(p=a.t-this.t;u<p;++u)a[u+this.t]=this.am(0,s[u],a,u,0,this.t);for(p=Math.min(s.t,o);u<p;++u)this.am(0,s[u],a,u,0,o-u);a.clamp()}function ai(s,o,a){--o;var u=a.t=this.t+s.t-o;for(a.s=0;--u>=0;)a[u]=0;for(u=Math.max(o-this.t,0);u<s.t;++u)a[this.t+u-o]=this.am(o-u,s[u],a,0,0,this.t+u-o);a.clamp(),a.drShiftTo(1,a)}function Mt(s){this.r2=i(),this.q3=i(),n.ONE.dlShiftTo(2*s.t,this.r2),this.mu=this.r2.divide(s),this.m=s}function ci(s){if(s.s<0||s.t>2*this.m.t)return s.mod(this.m);if(s.compareTo(this.m)<0)return s;var o=i();return s.copyTo(o),this.reduce(o),o}function ui(s){return s}function fi(s){for(s.drShiftTo(this.m.t-1,this.r2),s.t>this.m.t+1&&(s.t=this.m.t+1,s.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);s.compareTo(this.r2)<0;)s.dAddOffset(1,this.m.t+1);for(s.subTo(this.r2,s);s.compareTo(this.m)>=0;)s.subTo(this.m,s)}function li(s,o){s.squareTo(o),this.reduce(o)}function pi(s,o,a){s.multiplyTo(o,a),this.reduce(a)}Mt.prototype.convert=ci,Mt.prototype.revert=ui,Mt.prototype.reduce=fi,Mt.prototype.mulTo=pi,Mt.prototype.sqrTo=li;function hi(s,o){var a=s.bitLength(),u,p=I(1),d;if(a<=0)return p;a<18?u=1:a<48?u=3:a<144?u=4:a<768?u=5:u=6,a<8?d=new Rt(o):o.isEven()?d=new Mt(o):d=new Bt(o);var b=new Array,v=3,M=u-1,F=(1<<u)-1;if(b[1]=d.convert(this),u>1){var st=i();for(d.sqrTo(b[1],st);v<=F;)b[v]=i(),d.mulTo(st,b[v-2],b[v]),v+=2}var Q=s.t-1,gt,pe=!0,ct=i(),ut;for(a=it(s[Q])-1;Q>=0;){for(a>=M?gt=s[Q]>>a-M&F:(gt=(s[Q]&(1<<a+1)-1)<<M-a,Q>0&&(gt|=s[Q-1]>>this.DB+a-M)),v=u;!(gt&1);)gt>>=1,--v;if((a-=v)<0&&(a+=this.DB,--Q),pe)b[gt].copyTo(p),pe=!1;else{for(;v>1;)d.sqrTo(p,ct),d.sqrTo(ct,p),v-=2;v>0?d.sqrTo(p,ct):(ut=p,p=ct,ct=ut),d.mulTo(ct,b[gt],p)}for(;Q>=0&&!(s[Q]&1<<a);)d.sqrTo(p,ct),ut=p,p=ct,ct=ut,--a<0&&(a=this.DB-1,--Q)}return d.revert(p)}function di(s){var o=this.s<0?this.negate():this.clone(),a=s.s<0?s.negate():s.clone();if(o.compareTo(a)<0){var u=o;o=a,a=u}var p=o.getLowestSetBit(),d=a.getLowestSetBit();if(d<0)return o;for(p<d&&(d=p),d>0&&(o.rShiftTo(d,o),a.rShiftTo(d,a));o.signum()>0;)(p=o.getLowestSetBit())>0&&o.rShiftTo(p,o),(p=a.getLowestSetBit())>0&&a.rShiftTo(p,a),o.compareTo(a)>=0?(o.subTo(a,o),o.rShiftTo(1,o)):(a.subTo(o,a),a.rShiftTo(1,a));return d>0&&a.lShiftTo(d,a),a}function mi(s){if(s<=0)return 0;var o=this.DV%s,a=this.s<0?s-1:0;if(this.t>0)if(o==0)a=this[0]%s;else for(var u=this.t-1;u>=0;--u)a=(o*a+this[u])%s;return a}function gi(s){var o=s.isEven();if(this.isEven()&&o||s.signum()==0)return n.ZERO;for(var a=s.clone(),u=this.clone(),p=I(1),d=I(0),b=I(0),v=I(1);a.signum()!=0;){for(;a.isEven();)a.rShiftTo(1,a),o?((!p.isEven()||!d.isEven())&&(p.addTo(this,p),d.subTo(s,d)),p.rShiftTo(1,p)):d.isEven()||d.subTo(s,d),d.rShiftTo(1,d);for(;u.isEven();)u.rShiftTo(1,u),o?((!b.isEven()||!v.isEven())&&(b.addTo(this,b),v.subTo(s,v)),b.rShiftTo(1,b)):v.isEven()||v.subTo(s,v),v.rShiftTo(1,v);a.compareTo(u)>=0?(a.subTo(u,a),o&&p.subTo(b,p),d.subTo(v,d)):(u.subTo(a,u),o&&b.subTo(p,b),v.subTo(d,v))}if(u.compareTo(n.ONE)!=0)return n.ZERO;if(v.compareTo(s)>=0)return v.subtract(s);if(v.signum()<0)v.addTo(s,v);else return v;return v.signum()<0?v.add(s):v}var G=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],bi=(1<<26)/G[G.length-1];function wi(s){var o,a=this.abs();if(a.t==1&&a[0]<=G[G.length-1]){for(o=0;o<G.length;++o)if(a[0]==G[o])return!0;return!1}if(a.isEven())return!1;for(o=1;o<G.length;){for(var u=G[o],p=o+1;p<G.length&&u<bi;)u*=G[p++];for(u=a.modInt(u);o<p;)if(u%G[o++]==0)return!1}return a.millerRabin(s)}function yi(s){var o=this.subtract(n.ONE),a=o.getLowestSetBit();if(a<=0)return!1;var u=o.shiftRight(a);s=s+1>>1,s>G.length&&(s=G.length);for(var p=i(),d=0;d<s;++d){p.fromInt(G[Math.floor(Math.random()*G.length)]);var b=p.modPow(u,this);if(b.compareTo(n.ONE)!=0&&b.compareTo(o)!=0){for(var v=1;v++<a&&b.compareTo(o)!=0;)if(b=b.modPowInt(2,this),b.compareTo(n.ONE)==0)return!1;if(b.compareTo(o)!=0)return!1}}return!0}n.prototype.chunkSize=vo,n.prototype.toRadix=So,n.prototype.fromRadix=To,n.prototype.fromNumber=Co,n.prototype.bitwiseTo=Bo,n.prototype.changeBit=zo,n.prototype.addTo=Zo,n.prototype.dMultiply=ei,n.prototype.dAddOffset=ri,n.prototype.multiplyLowerTo=ii,n.prototype.multiplyUpperTo=ai,n.prototype.modInt=mi,n.prototype.millerRabin=yi,n.prototype.clone=go,n.prototype.intValue=bo,n.prototype.byteValue=wo,n.prototype.shortValue=yo,n.prototype.signum=xo,n.prototype.toByteArray=Eo,n.prototype.equals=Ao,n.prototype.min=Io,n.prototype.max=Ro,n.prototype.and=Do,n.prototype.or=ko,n.prototype.xor=Po,n.prototype.andNot=Oo,n.prototype.not=No,n.prototype.shiftLeft=_o,n.prototype.shiftRight=Fo,n.prototype.getLowestSetBit=Uo,n.prototype.bitCount=Vo,n.prototype.testBit=jo,n.prototype.setBit=qo,n.prototype.clearBit=Go,n.prototype.flipBit=Ho,n.prototype.add=Wo,n.prototype.subtract=Xo,n.prototype.multiply=Jo,n.prototype.divide=Qo,n.prototype.remainder=Ko,n.prototype.divideAndRemainder=ti,n.prototype.modPow=hi,n.prototype.modInverse=gi,n.prototype.pow=oi,n.prototype.gcd=di,n.prototype.isProbablePrime=wi,n.prototype.square=Yo,n.prototype.Barrett=Mt;var le,Y,_;function vi(s){Y[_++]^=s&255,Y[_++]^=s>>8&255,Y[_++]^=s>>16&255,Y[_++]^=s>>24&255,_>=qe&&(_-=qe)}function on(){vi(new Date().getTime())}if(Y==null){Y=new Array,_=0;var at;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var an=new Uint8Array(32);for(window.crypto.getRandomValues(an),at=0;at<32;++at)Y[_++]=an[at]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var cn=window.crypto.random(32);for(at=0;at<cn.length;++at)Y[_++]=cn.charCodeAt(at)&255}}for(;_<qe;)at=Math.floor(65536*Math.random()),Y[_++]=at>>>8,Y[_++]=at&255;_=0,on()}function xi(){if(le==null){for(on(),le=Ei(),le.init(Y),_=0;_<Y.length;++_)Y[_]=0;_=0}return le.next()}function Si(s){var o;for(o=0;o<s.length;++o)s[o]=xi()}function je(){}je.prototype.nextBytes=Si;function ze(){this.i=0,this.j=0,this.S=new Array}function Ti(s){var o,a,u;for(o=0;o<256;++o)this.S[o]=o;for(a=0,o=0;o<256;++o)a=a+this.S[o]+s[o%s.length]&255,u=this.S[o],this.S[o]=this.S[a],this.S[a]=u;this.i=0,this.j=0}function Ci(){var s;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,s=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=s,this.S[s+this.S[this.i]&255]}ze.prototype.init=Ti,ze.prototype.next=Ci;function Ei(){return new ze}var qe=256;typeof Pe<"u"?Pe=Ss.exports={default:n,BigInteger:n,SecureRandom:je}:this.jsbn={BigInteger:n,SecureRandom:je}}).call(Pe)});var ue=N(Oe=>{(function(){"use strict";var e={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(f){return n(c(f),arguments)}function r(f,h){return t.apply(null,[f].concat(h||[]))}function n(f,h){var g=1,C=f.length,l,y="",x,S,m,A,R,E,I,k;for(x=0;x<C;x++)if(typeof f[x]=="string")y+=f[x];else if(typeof f[x]=="object"){if(m=f[x],m.keys)for(l=h[g],S=0;S<m.keys.length;S++){if(l==null)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',m.keys[S],m.keys[S-1]));l=l[m.keys[S]]}else m.param_no?l=h[m.param_no]:l=h[g++];if(e.not_type.test(m.type)&&e.not_primitive.test(m.type)&&l instanceof Function&&(l=l()),e.numeric_arg.test(m.type)&&typeof l!="number"&&isNaN(l))throw new TypeError(t("[sprintf] expecting number but found %T",l));switch(e.number.test(m.type)&&(I=l>=0),m.type){case"b":l=parseInt(l,10).toString(2);break;case"c":l=String.fromCharCode(parseInt(l,10));break;case"d":case"i":l=parseInt(l,10);break;case"j":l=JSON.stringify(l,null,m.width?parseInt(m.width):0);break;case"e":l=m.precision?parseFloat(l).toExponential(m.precision):parseFloat(l).toExponential();break;case"f":l=m.precision?parseFloat(l).toFixed(m.precision):parseFloat(l);break;case"g":l=m.precision?String(Number(l.toPrecision(m.precision))):parseFloat(l);break;case"o":l=(parseInt(l,10)>>>0).toString(8);break;case"s":l=String(l),l=m.precision?l.substring(0,m.precision):l;break;case"t":l=String(!!l),l=m.precision?l.substring(0,m.precision):l;break;case"T":l=Object.prototype.toString.call(l).slice(8,-1).toLowerCase(),l=m.precision?l.substring(0,m.precision):l;break;case"u":l=parseInt(l,10)>>>0;break;case"v":l=l.valueOf(),l=m.precision?l.substring(0,m.precision):l;break;case"x":l=(parseInt(l,10)>>>0).toString(16);break;case"X":l=(parseInt(l,10)>>>0).toString(16).toUpperCase();break}e.json.test(m.type)?y+=l:(e.number.test(m.type)&&(!I||m.sign)?(k=I?"+":"-",l=l.toString().replace(e.sign,"")):k="",R=m.pad_char?m.pad_char==="0"?"0":m.pad_char.charAt(1):" ",E=m.width-(k+l).length,A=m.width&&E>0?R.repeat(E):"",y+=m.align?k+l+A:R==="0"?k+A+l:A+k+l)}return y}var i=Object.create(null);function c(f){if(i[f])return i[f];for(var h=f,g,C=[],l=0;h;){if((g=e.text.exec(h))!==null)C.push(g[0]);else if((g=e.modulo.exec(h))!==null)C.push("%");else if((g=e.placeholder.exec(h))!==null){if(g[2]){l|=1;var y=[],x=g[2],S=[];if((S=e.key.exec(x))!==null)for(y.push(S[1]);(x=x.substring(S[0].length))!=="";)if((S=e.key_access.exec(x))!==null)y.push(S[1]);else if((S=e.index_access.exec(x))!==null)y.push(S[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");g[2]=y}else l|=2;if(l===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");C.push({placeholder:g[0],param_no:g[1],keys:g[2],sign:g[3],pad_char:g[4],align:g[5],width:g[6],precision:g[7],type:g[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");h=h.substring(g[0].length)}return i[f]=C}typeof Oe<"u"&&(Oe.sprintf=t,Oe.vsprintf=r),typeof window<"u"&&(window.sprintf=t,window.vsprintf=r,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:r}}))})()});var Le=N((Sp,Ps)=>{Ps.exports=e=>{if(e[Symbol.asyncIterator])return e;if(e.getReader)return async function*(){let t=e.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r)return;yield n}}finally{t.releaseLock()}}();throw new Error("unknown stream")}});var Ns=N((Tp,Os)=>{Os.exports=function(t){if(t){if(typeof t[Symbol.iterator]=="function")return t[Symbol.iterator]();if(typeof t[Symbol.asyncIterator]=="function")return t[Symbol.asyncIterator]();if(typeof t.next=="function")return t}throw new Error("argument is not an iterator or iterable")}});var Xr=N((Cp,_s)=>{var ru=Ns();_s.exports=e=>async t=>{t=ru(t);let r=E=>{typeof E.return=="function"&&E.return()},n=null,i=null,c=E=>{n=E,i&&i(E),r(t)},f=null,h=!1,g=()=>{h=!0,f&&f()},C=null,l=!1,y=()=>{l=!0,C&&C()},x=null,S=()=>{x&&x()},m=()=>new Promise((E,I)=>{f=x=E,i=I,e.once("drain",S)}),A=()=>(r(t),new Promise((E,I)=>{if(h||l||n)return E();C=f=E,i=I})),R=()=>{e.removeListener("error",c),e.removeListener("close",g),e.removeListener("finish",y),e.removeListener("drain",S)};e.once("error",c),e.once("close",g),e.once("finish",y);try{for await(let E of t){if(!e.writable||e.destroyed||n)break;e.write(E)===!1&&await m()}}catch(E){n||e.destroy(),n=E}try{if(e.writable&&e.end(),await A(),n)throw n}finally{R()}}});var Jr=N((Ep,Fs)=>{var nu=Xr(),su=Le();Fs.exports=e=>({sink:nu(e),source:su(e)})});var Us=N((Ap,Ls)=>{var ou=Jr();Ls.exports=e=>async function*(t){let r=ou(e),n;if(r.sink(t).catch(i=>{n=i}),yield*r.source,n)throw n}});var $s=N((Ip,re)=>{re.exports=Le();re.exports.source=Le();re.exports.sink=Xr();re.exports.transform=Us();re.exports.duplex=Jr()});var bu={};K(bu,{tcp:()=>gu});var qs=H(bt("net"),1);var Ut=class e extends Error{code;type;constructor(t="The operation was aborted"){super(t),this.code=e.code,this.type=e.type}static code="ABORT_ERR";static type="aborted"},ft=class extends Error{code;props;constructor(t,r,n){super(t),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var ln=Symbol.for("@libp2p/transport");var fn;(function(e){e[e.FATAL_ALL=0]="FATAL_ALL",e[e.NO_FATAL=1]="NO_FATAL"})(fn||(fn={}));var et=H(Sn(),1);var Ke={};K(Ke,{base32:()=>pt,base32hex:()=>ua,base32hexpad:()=>la,base32hexpadupper:()=>pa,base32hexupper:()=>fa,base32pad:()=>aa,base32padupper:()=>ca,base32upper:()=>ia,base32z:()=>ha});function ea(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var c=e.charAt(i),f=c.charCodeAt(0);if(r[f]!==255)throw new TypeError(c+" is ambiguous");r[f]=i}var h=e.length,g=e.charAt(0),C=Math.log(h)/Math.log(256),l=Math.log(256)/Math.log(h);function y(m){if(m instanceof Uint8Array||(ArrayBuffer.isView(m)?m=new Uint8Array(m.buffer,m.byteOffset,m.byteLength):Array.isArray(m)&&(m=Uint8Array.from(m))),!(m instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(m.length===0)return"";for(var A=0,R=0,E=0,I=m.length;E!==I&&m[E]===0;)E++,A++;for(var k=(I-E)*l+1>>>0,O=new Uint8Array(k);E!==I;){for(var J=m[E],Z=0,q=k-1;(J!==0||Z<R)&&q!==-1;q--,Z++)J+=256*O[q]>>>0,O[q]=J%h>>>0,J=J/h>>>0;if(J!==0)throw new Error("Non-zero carry");R=Z,E++}for(var W=k-R;W!==k&&O[W]===0;)W++;for(var it=g.repeat(A);W<k;++W)it+=e.charAt(O[W]);return it}function x(m){if(typeof m!="string")throw new TypeError("Expected String");if(m.length===0)return new Uint8Array;var A=0;if(m[A]!==" "){for(var R=0,E=0;m[A]===g;)R++,A++;for(var I=(m.length-A)*C+1>>>0,k=new Uint8Array(I);m[A];){var O=r[m.charCodeAt(A)];if(O===255)return;for(var J=0,Z=I-1;(O!==0||J<E)&&Z!==-1;Z--,J++)O+=h*k[Z]>>>0,k[Z]=O%256>>>0,O=O/256>>>0;if(O!==0)throw new Error("Non-zero carry");E=J,A++}if(m[A]!==" "){for(var q=I-E;q!==I&&k[q]===0;)q++;for(var W=new Uint8Array(R+(I-q)),it=R;q!==I;)W[it++]=k[q++];return W}}}function S(m){var A=x(m);if(A)return A;throw new Error(`Non-${t} character`)}return{encode:y,decodeUnsafe:x,decode:S}}var ra=ea,na=ra,Tn=na;var Iu=new Uint8Array(0);var Cn=(e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},ot=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};var En=e=>new TextEncoder().encode(e),An=e=>new TextDecoder().decode(e);var Xe=class{constructor(t,r,n){this.name=t,this.prefix=r,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},Je=class{constructor(t,r,n){if(this.name=t,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Rn(this,t)}},Ye=class{constructor(t){this.decoders=t}or(t){return Rn(this,t)}decode(t){let r=t[0],n=this.decoders[r];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Rn=(e,t)=>new Ye({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}}),Qe=class{constructor(t,r,n,i){this.name=t,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Xe(t,r,n),this.decoder=new Je(t,r,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},qt=({name:e,prefix:t,encode:r,decode:n})=>new Qe(e,t,r,n),St=({prefix:e,name:t,alphabet:r})=>{let{encode:n,decode:i}=Tn(r,t);return qt({prefix:e,name:t,encode:n,decode:c=>ot(i(c))})},sa=(e,t,r,n)=>{let i={};for(let l=0;l<t.length;++l)i[t[l]]=l;let c=e.length;for(;e[c-1]==="=";)--c;let f=new Uint8Array(c*r/8|0),h=0,g=0,C=0;for(let l=0;l<c;++l){let y=i[e[l]];if(y===void 0)throw new SyntaxError(`Non-${n} character`);g=g<<r|y,h+=r,h>=8&&(h-=8,f[C++]=255&g>>h)}if(h>=r||255&g<<8-h)throw new SyntaxError("Unexpected end of data");return f},oa=(e,t,r)=>{let n=t[t.length-1]==="=",i=(1<<r)-1,c="",f=0,h=0;for(let g=0;g<e.length;++g)for(h=h<<8|e[g],f+=8;f>r;)f-=r,c+=t[i&h>>f];if(f&&(c+=t[i&h<<r-f]),n)for(;c.length*r&7;)c+="=";return c},D=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>qt({prefix:t,name:e,encode(i){return oa(i,n,r)},decode(i){return sa(i,n,r,e)}});var pt=D({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ia=D({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),aa=D({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ca=D({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ua=D({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),fa=D({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),la=D({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),pa=D({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ha=D({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var tr={};K(tr,{base58btc:()=>$,base58flickr:()=>da});var $=St({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),da=St({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var rr={};K(rr,{base64:()=>er,base64pad:()=>ma,base64url:()=>ga,base64urlpad:()=>ba});var er=D({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ma=D({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ga=D({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ba=D({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});et.default.formatters.b=e=>e==null?"undefined":$.baseEncode(e);et.default.formatters.t=e=>e==null?"undefined":pt.baseEncode(e);et.default.formatters.m=e=>e==null?"undefined":er.baseEncode(e);et.default.formatters.p=e=>e==null?"undefined":e.toString();et.default.formatters.c=e=>e==null?"undefined":e.toString();et.default.formatters.k=e=>e==null?"undefined":e.toString();et.default.formatters.a=e=>e==null?"undefined":e.toString();function wa(e){let t=()=>{};return t.enabled=!1,t.color="",t.diff=0,t.log=()=>{},t.namespace=e,t.destroy=()=>!0,t.extend=()=>t,t}function Tt(e){let t=wa(`${e}:trace`);return et.default.enabled(`${e}:trace`)&&et.default.names.map(r=>r.toString()).find(r=>r.includes(":trace"))!=null&&(t=(0,et.default)(`${e}:trace`)),Object.assign((0,et.default)(e),{error:(0,et.default)(`${e}:error`),trace:t})}var ye=class extends Error{code;props;constructor(t,r,n){super(t),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var ya=Dn,Bn=128,va=127,xa=~va,Sa=Math.pow(2,31);function Dn(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Sa;)t[r++]=e&255|Bn,e/=128;for(;e&xa;)t[r++]=e&255|Bn,e>>>=7;return t[r]=e|0,Dn.bytes=r-n+1,t}var Ta=nr,Ca=128,Mn=127;function nr(e,n){var r=0,n=n||0,i=0,c=n,f,h=e.length;do{if(c>=h)throw nr.bytes=0,new RangeError("Could not decode varint");f=e[c++],r+=i<28?(f&Mn)<<i:(f&Mn)*Math.pow(2,i),i+=7}while(f>=Ca);return nr.bytes=c-n,r}var Ea=Math.pow(2,7),Aa=Math.pow(2,14),Ia=Math.pow(2,21),Ra=Math.pow(2,28),Ba=Math.pow(2,35),Ma=Math.pow(2,42),Da=Math.pow(2,49),ka=Math.pow(2,56),Pa=Math.pow(2,63),Oa=function(e){return e<Ea?1:e<Aa?2:e<Ia?3:e<Ra?4:e<Ba?5:e<Ma?6:e<Da?7:e<ka?8:e<Pa?9:10},Na={encode:ya,decode:Ta,encodingLength:Oa},_a=Na,oe=_a;var ie=(e,t=0)=>[oe.decode(e,t),oe.decode.bytes],Gt=(e,t,r=0)=>(oe.encode(e,t,r),t),Ht=e=>oe.encodingLength(e);var kt=(e,t)=>{let r=t.byteLength,n=Ht(e),i=n+Ht(r),c=new Uint8Array(i+r);return Gt(e,c,0),Gt(r,c,n),c.set(t,i),new Zt(e,r,t,c)},xe=e=>{let t=ot(e),[r,n]=ie(t),[i,c]=ie(t.subarray(n)),f=t.subarray(n+c);if(f.byteLength!==i)throw new Error("Incorrect length");return new Zt(r,i,f,t)},kn=(e,t)=>{if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Cn(e.bytes,r.bytes)}},Zt=class{constructor(t,r,n,i){this.code=t,this.size=r,this.digest=n,this.bytes=i}};var Pn=(e,t)=>{let{bytes:r,version:n}=e;switch(n){case 0:return La(r,sr(e),t||$.encoder);default:return Ua(r,sr(e),t||pt.encoder)}};var On=new WeakMap,sr=e=>{let t=On.get(e);if(t==null){let r=new Map;return On.set(e,r),r}return t},Ct=class e{constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==ae)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==$a)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return e.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=kt(t,r);return e.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return e.equals(this,t)}static equals(t,r){let n=r;return n&&t.code===n.code&&t.version===n.version&&kn(t.multihash,n.multihash)}toString(t){return Pn(this,t)}toJSON(){return{"/":Pn(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof e)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:c,bytes:f}=r;return new e(n,i,c,f||Nn(n,i,c.bytes))}else if(r[Va]===!0){let{version:n,multihash:i,code:c}=r,f=xe(i);return e.create(n,c,f)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==ae)throw new Error(`Version 0 CID must use dag-pb (code: ${ae}) block encoding`);return new e(t,r,n,n.bytes)}case 1:{let i=Nn(t,r,n.bytes);return new e(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return e.create(0,ae,t)}static createV1(t,r){return e.create(1,t,r)}static decode(t){let[r,n]=e.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=e.inspectBytes(t),n=r.size-r.multihashSize,i=ot(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let c=i.subarray(r.multihashSize-r.digestSize),f=new Zt(r.multihashCode,r.digestSize,c,i);return[r.version===0?e.createV0(f):e.createV1(r.codec,f),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[y,x]=ie(t.subarray(r));return r+=x,y},i=n(),c=ae;if(i===18?(i=0,r=0):c=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let f=r,h=n(),g=n(),C=r+g,l=C-f;return{version:i,codec:c,multihashCode:h,digestSize:g,multihashSize:l,size:C}}static parse(t,r){let[n,i]=Fa(t,r),c=e.decode(i);if(c.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return sr(c).set(n,t),c}},Fa=(e,t)=>{switch(e[0]){case"Q":{let r=t||$;return[$.prefix,r.decode(`${$.prefix}${e}`)]}case $.prefix:{let r=t||$;return[$.prefix,r.decode(e)]}case pt.prefix:{let r=t||pt;return[pt.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}},La=(e,t,r)=>{let{prefix:n}=r;if(n!==$.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let c=r.encode(e).slice(1);return t.set(n,c),c}else return i},Ua=(e,t,r)=>{let{prefix:n}=r,i=t.get(n);if(i==null){let c=r.encode(e);return t.set(n,c),c}else return i},ae=112,$a=18,Nn=(e,t,r)=>{let n=Ht(e),i=n+Ht(t),c=new Uint8Array(i+r.byteLength);return Gt(e,c,0),Gt(t,c,n),c.set(r,i),c},Va=Symbol.for("@ipld/js-cid/CID");function _n(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}var or={};K(or,{identity:()=>ja});var ja=qt({prefix:"\0",name:"identity",encode:e=>An(e),decode:e=>En(e)});var ir={};K(ir,{base2:()=>za});var za=D({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ar={};K(ar,{base8:()=>qa});var qa=D({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var cr={};K(cr,{base10:()=>Ga});var Ga=St({prefix:"9",name:"base10",alphabet:"0123456789"});var ur={};K(ur,{base16:()=>Ha,base16upper:()=>Za});var Ha=D({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Za=D({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var fr={};K(fr,{base36:()=>Wa,base36upper:()=>Xa});var Wa=St({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Xa=St({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var lr={};K(lr,{base256emoji:()=>tc});var Fn=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Ja=Fn.reduce((e,t,r)=>(e[r]=t,e),[]),Ya=Fn.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);function Qa(e){return e.reduce((t,r)=>(t+=Ja[r],t),"")}function Ka(e){let t=[];for(let r of e){let n=Ya[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);t.push(n)}return new Uint8Array(t)}var tc=qt({prefix:"\u{1F680}",name:"base256emoji",encode:Qa,decode:Ka});var mr={};K(mr,{sha256:()=>ec,sha512:()=>rc});var dr=H(bt("crypto"),1);var hr=({name:e,code:t,encode:r})=>new pr(e,t,r),pr=class{constructor(t,r,n){this.name=t,this.code=r,this.encode=n}digest(t){if(t instanceof Uint8Array){let r=this.encode(t);return r instanceof Uint8Array?kt(this.code,r):r.then(n=>kt(this.code,n))}else throw Error("Unknown type, must be binary type")}};var ec=hr({name:"sha2-256",code:18,encode:e=>ot(dr.default.createHash("sha256").update(e).digest())}),rc=hr({name:"sha2-512",code:19,encode:e=>ot(dr.default.createHash("sha512").update(e).digest())});var gr={};K(gr,{identity:()=>oc});var Un=0,nc="identity",$n=ot,sc=e=>kt(Un,$n(e)),oc={code:Un,name:nc,encode:$n,digest:sc};var af=new TextEncoder,cf=new TextDecoder;var ce={...or,...ir,...ar,...cr,...ur,...Ke,...fr,...tr,...rr,...lr},hf={...mr,...gr};function Xt(e){return globalThis.Buffer!=null?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function Se(e=0){return globalThis.Buffer?.allocUnsafe!=null?Xt(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function jn(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}var Vn=jn("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),br=jn("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{e=e.substring(1);let t=Se(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),cc={utf8:Vn,"utf-8":Vn,hex:ce.base16,latin1:br,ascii:br,binary:br,...ce},Te=cc;function X(e,t="utf8"){let r=Te[t];if(r==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):r.encoder.encode(e).substring(1)}function wt(e,t){t==null&&(t=e.reduce((i,c)=>i+c.length,0));let r=Se(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return Xt(r)}var Yt=H(vr(),1);var Ce=class{index=0;input="";new(t){return this.index=0,this.input=t,this}readAtomically(t){let r=this.index,n=t();return n===void 0&&(this.index=r),n}parseWith(t){let r=t();if(this.index===this.input.length)return r}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(t){return this.readAtomically(()=>{let r=this.readChar();if(r===t)return r})}readSeparator(t,r,n){return this.readAtomically(()=>{if(!(r>0&&this.readGivenChar(t)===void 0))return n()})}readNumber(t,r,n,i){return this.readAtomically(()=>{let c=0,f=0,h=this.peekChar();if(h===void 0)return;let g=h==="0",C=2**(8*i)-1;for(;;){let l=this.readAtomically(()=>{let y=this.readChar();if(y===void 0)return;let x=Number.parseInt(y,t);if(!Number.isNaN(x))return x});if(l===void 0)break;if(c*=t,c+=l,c>C||(f+=1,r!==void 0&&f>r))return}if(f!==0)return!n&&g&&f>1?void 0:c})}readIPv4Addr(){return this.readAtomically(()=>{let t=new Uint8Array(4);for(let r=0;r<t.length;r++){let n=this.readSeparator(".",r,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;t[r]=n}return t})}readIPv6Addr(){let t=r=>{for(let n=0;n<r.length/2;n++){let i=n*2;if(n<r.length-3){let f=this.readSeparator(":",n,()=>this.readIPv4Addr());if(f!==void 0)return r[i]=f[0],r[i+1]=f[1],r[i+2]=f[2],r[i+3]=f[3],[i+4,!0]}let c=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(c===void 0)return[i,!1];r[i]=c>>8,r[i+1]=c&255}return[r.length,!1]};return this.readAtomically(()=>{let r=new Uint8Array(16),[n,i]=t(r);if(n===16)return r;if(i||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let c=new Uint8Array(14),f=16-(n+2),[h]=t(c.subarray(0,f));return r.set(c.subarray(0,h),16-h),r})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var kf=new Ce;var $f=parseInt("0xFFFF",16),Vf=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function xr(e,t="utf8"){let r=Te[t];if(r==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Xt(globalThis.Buffer.from(e,"utf-8")):r.decoder.decode(`${r.prefix}${e}`)}var ht=H(vr(),1);var Et=bt("node:net");function Ee(e){return!!(0,Et.isIP)(e)}var ts=Et.isIPv4,Ic=Et.isIPv6,Sr=function(e){let t=0;if(e=e.toString().trim(),ts(e)){let r=new Uint8Array(t+4);return e.split(/\./g).forEach(n=>{r[t++]=parseInt(n,10)&255}),r}if(Ic(e)){let r=e.split(":",8),n;for(n=0;n<r.length;n++){let c=ts(r[n]),f;c&&(f=Sr(r[n]),r[n]=X(f.slice(0,2),"base16")),f!=null&&++n<8&&r.splice(n,0,X(f.slice(2,4),"base16"))}if(r[0]==="")for(;r.length<8;)r.unshift("0");else if(r[r.length-1]==="")for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&r[n]!=="";n++);let c=[n,1];for(n=9-r.length;n>0;n--)c.push("0");r.splice.apply(r,c)}let i=new Uint8Array(t+16);for(n=0;n<r.length;n++){let c=parseInt(r[n],16);i[t++]=c>>8&255,i[t++]=c&255}return i}throw new Error("invalid ip address")},es=function(e,t=0,r){t=~~t,r=r??e.length-t;let n=new DataView(e.buffer);if(r===4){let i=[];for(let c=0;c<r;c++)i.push(e[t+c]);return i.join(".")}if(r===16){let i=[];for(let c=0;c<r;c+=2)i.push(n.getUint16(t+c).toString(16));return i.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Jt={},Tr={},Bc=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[449,-1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];Bc.forEach(e=>{let t=Mc(...e);Tr[t.code]=t,Jt[t.name]=t});function Mc(e,t,r,n,i){return{code:e,size:t,name:r,resolvable:!!n,path:!!i}}function B(e){if(typeof e=="number"){if(Tr[e]!=null)return Tr[e];throw new Error(`no protocol with code: ${e}`)}else if(typeof e=="string"){if(Jt[e]!=null)return Jt[e];throw new Error(`no protocol with name: ${e}`)}throw new Error(`invalid protocol id type: ${typeof e}`)}var Rl=B("ip4"),Bl=B("ip6"),Ml=B("ipcidr");function Er(e,t){switch(B(e).code){case 4:case 41:return kc(t);case 42:return ss(t);case 6:case 273:case 33:case 132:return is(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return ss(t);case 421:return _c(t);case 444:return os(t);case 445:return os(t);case 466:return Nc(t);default:return X(t,"base16")}}function Ar(e,t){switch(B(e).code){case 4:return rs(t);case 41:return rs(t);case 42:return ns(t);case 6:case 273:case 33:case 132:return Ir(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return ns(t);case 421:return Pc(t);case 444:return Fc(t);case 445:return Lc(t);case 466:return Oc(t);default:return xr(t,"base16")}}var Cr=Object.values(ce).map(e=>e.decoder),Dc=function(){let e=Cr[0].or(Cr[1]);return Cr.slice(2).forEach(t=>e=e.or(t)),e}();function rs(e){if(!Ee(e))throw new Error("invalid ip address");return Sr(e)}function kc(e){let t=es(e,0,e.length);if(t==null)throw new Error("ipBuff is required");if(!Ee(t))throw new Error("invalid ip address");return t}function Ir(e){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function is(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function ns(e){let t=xr(e),r=Uint8Array.from(ht.default.encode(t.length));return wt([r,t],r.length+t.length)}function ss(e){let t=ht.default.decode(e);if(e=e.slice(ht.default.decode.bytes),e.length!==t)throw new Error("inconsistent lengths");return X(e)}function Pc(e){let t;e[0]==="Q"||e[0]==="1"?t=xe($.decode(`z${e}`)).bytes:t=Ct.parse(e).multihash.bytes;let r=Uint8Array.from(ht.default.encode(t.length));return wt([r,t],r.length+t.length)}function Oc(e){let t=Dc.decode(e),r=Uint8Array.from(ht.default.encode(t.length));return wt([r,t],r.length+t.length)}function Nc(e){let t=ht.default.decode(e),r=e.slice(ht.default.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return"u"+X(r,"base64url")}function _c(e){let t=ht.default.decode(e),r=e.slice(ht.default.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return X(r,"base58btc")}function Fc(e){let t=e.split(":");if(t.length!==2)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(t[0].length!==16)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion address.`);let r=pt.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let i=Ir(n);return wt([r,i],r.length+i.length)}function Lc(e){let t=e.split(":");if(t.length!==2)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(t[0].length!==56)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion3 address.`);let r=pt.decode(`b${t[0]}`),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let i=Ir(n);return wt([r,i],r.length+i.length)}function os(e){let t=e.slice(0,e.length-2),r=e.slice(e.length-2),n=X(t,"base32"),i=is(r);return`${n}:${i}`}function as(e){e=Rr(e);let t=[],r=[],n=null,i=e.split("/").slice(1);if(i.length===1&&i[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let c=0;c<i.length;c++){let f=i[c],h=B(f);if(h.size===0){t.push([h.code]),r.push([h.code]);continue}if(c++,c>=i.length)throw us("invalid address: "+e);if(h.path===!0){n=Rr(i.slice(c).join("/")),t.push([h.code,Ar(h.code,n)]),r.push([h.code,n]);break}let g=Ar(h.code,i[c]);t.push([h.code,g]),r.push([h.code,Er(h.code,g)])}return{string:cs(r),bytes:Mr(t),tuples:t,stringTuples:r,path:n}}function Br(e){let t=[],r=[],n=null,i=0;for(;i<e.length;){let c=Yt.default.decode(e,i),f=Yt.default.decode.bytes??0,h=B(c),g=Uc(h,e.slice(i+f));if(g===0){t.push([c]),r.push([c]),i+=f;continue}let C=e.slice(i+f,i+f+g);if(i+=g+f,i>e.length)throw us("Invalid address Uint8Array: "+X(e,"base16"));t.push([c,C]);let l=Er(c,C);if(r.push([c,l]),h.path===!0){n=l;break}}return{bytes:Uint8Array.from(e),string:cs(r),tuples:t,stringTuples:r,path:n}}function cs(e){let t=[];return e.map(r=>{let n=B(r[0]);return t.push(n.name),r.length>1&&r[1]!=null&&t.push(r[1]),null}),Rr(t.join("/"))}function Mr(e){return wt(e.map(t=>{let r=B(t[0]),n=Uint8Array.from(Yt.default.encode(r.code));return t.length>1&&t[1]!=null&&(n=wt([n,t[1]])),n}))}function Uc(e,t){return e.size>0?e.size/8:e.size===0?0:Yt.default.decode(t)+(Yt.default.decode.bytes??0)}function Rr(e){return"/"+e.trim().split("/").filter(t=>t).join("/")}function us(e){return new Error("Error parsing address: "+e)}var $c=Symbol.for("nodejs.util.inspect.custom"),Vc=[B("dns").code,B("dns4").code,B("dns6").code,B("dnsaddr").code],jc=new Map,fs=Symbol.for("@multiformats/js-multiaddr/multiaddr");function zc(e){return!!e?.[fs]}var Dr=class e{bytes;#t;#e;#r;#n;[fs]=!0;constructor(t){t==null&&(t="");let r;if(t instanceof Uint8Array)r=Br(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);r=as(t)}else if(zc(t))r=Br(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=r.bytes,this.#t=r.string,this.#e=r.tuples,this.#r=r.stringTuples,this.#n=r.path}toString(){return this.#t}toJSON(){return this.toString()}toOptions(){let t,r,n,i,c="",f=B("tcp"),h=B("udp"),g=B("ip4"),C=B("ip6"),l=B("dns6"),y=B("ip6zone");for(let[S,m]of this.stringTuples())S===y.code&&(c=`%${m??""}`),Vc.includes(S)&&(r=f.name,i=443,n=`${m??""}${c}`,t=S===l.code?6:4),(S===f.code||S===h.code)&&(r=B(S).name,i=parseInt(m??"")),(S===g.code||S===C.code)&&(r=B(S).name,n=`${m??""}${c}`,t=S===C.code?6:4);if(t==null||r==null||n==null||i==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:t,host:n,transport:r,port:i}}protos(){return this.#e.map(([t])=>Object.assign({},B(t)))}protoCodes(){return this.#e.map(([t])=>t)}protoNames(){return this.#e.map(([t])=>B(t).name)}tuples(){return this.#e}stringTuples(){return this.#r}encapsulate(t){return t=new e(t),new e(this.toString()+t.toString())}decapsulate(t){let r=t.toString(),n=this.toString(),i=n.lastIndexOf(r);if(i<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new e(n.slice(0,i))}decapsulateCode(t){let r=this.tuples();for(let n=r.length-1;n>=0;n--)if(r[n][0]===t)return new e(Mr(r.slice(0,n)));return this}getPeerId(){try{let t=[];this.stringTuples().forEach(([n,i])=>{n===Jt.p2p.code&&t.push([n,i]),n===Jt["p2p-circuit"].code&&(t=[])});let r=t.pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?X($.decode(`z${n}`),"base58btc"):X(Ct.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(t){return _n(this.bytes,t.bytes)}async resolve(t){let r=this.protos().find(c=>c.resolvable);if(r==null)return[this];let n=jc.get(r.name);if(n==null)throw new ye(`no available resolver for ${r.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(c=>new e(c))}nodeAddress(){let t=this.toOptions();if(t.transport!=="tcp"&&t.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${t.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:t.family,address:t.host,port:t.port}}isThinWaistAddress(t){let r=(t??this).protos();return!(r.length!==2||r[0].code!==4&&r[0].code!==41||r[1].code!==6&&r[1].code!==273)}[$c](){return`Multiaddr(${this.#t})`}};function dt(e){return new Dr(e)}var qc=w("dns4"),Gc=w("dns6"),Hc=w("dnsaddr"),Ot=P(w("dns"),Hc,qc,Gc),Re=P(w("ip4"),w("ip6")),It=P(T(Re,w("tcp")),T(Ot,w("tcp"))),Be=T(Re,w("udp")),Zc=T(Be,w("utp")),Wc=T(Be,w("quic")),Xc=T(Be,w("quic-v1")),kr=P(T(It,w("ws")),T(Ot,w("ws"))),Ae=P(T(kr,w("p2p")),kr),Pr=P(T(It,w("wss")),T(Ot,w("wss")),T(It,w("tls"),w("ws")),T(Ot,w("tls"),w("ws"))),Ie=P(T(Pr,w("p2p")),Pr),Or=P(T(It,w("http")),T(Re,w("http")),T(Ot,w("http"))),Nr=P(T(It,w("https")),T(Re,w("https")),T(Ot,w("https"))),ls=T(Be,w("webrtc-direct"),w("certhash")),ds=P(T(ls,w("p2p")),ls),ps=T(Xc,w("webtransport"),w("certhash"),w("certhash")),ms=P(T(ps,w("p2p")),ps),gs=P(T(Ae,w("p2p-webrtc-star"),w("p2p")),T(Ie,w("p2p-webrtc-star"),w("p2p")),T(Ae,w("p2p-webrtc-star")),T(Ie,w("p2p-webrtc-star"))),Ql=P(T(Ae,w("p2p-websocket-star"),w("p2p")),T(Ie,w("p2p-websocket-star"),w("p2p")),T(Ae,w("p2p-websocket-star")),T(Ie,w("p2p-websocket-star"))),bs=P(T(Or,w("p2p-webrtc-direct"),w("p2p")),T(Nr,w("p2p-webrtc-direct"),w("p2p")),T(Or,w("p2p-webrtc-direct")),T(Nr,w("p2p-webrtc-direct"))),Nt=P(kr,Pr,Or,Nr,gs,bs,It,Zc,Wc,Ot,ds,ms),Kl=P(T(Nt,w("p2p-stardust"),w("p2p")),T(Nt,w("p2p-stardust"))),At=P(T(Nt,w("p2p")),gs,bs,ds,ms,w("p2p")),hs=P(T(At,w("p2p-circuit"),At),T(At,w("p2p-circuit")),T(w("p2p-circuit"),At),T(Nt,w("p2p-circuit")),T(w("p2p-circuit"),Nt),w("p2p-circuit")),ws=()=>P(T(hs,ws),hs),Pt=ws(),tp=P(T(Pt,At,Pt),T(At,Pt),T(Pt,At),Pt,At);var ep=P(T(Pt,w("webrtc"),w("p2p")),T(Pt,w("webrtc")),T(Nt,w("webrtc"),w("p2p")),T(Nt,w("webrtc")),w("webrtc"));function ys(e){function t(r){let n;try{n=dt(r)}catch{return!1}let i=e(n.protoNames());return i===null?!1:i===!0||i===!1?i:i.length===0}return t}function T(...e){function t(r){if(r.length<e.length)return null;let n=r;return e.some(i=>(n=typeof i=="function"?i().partialMatch(r):i.partialMatch(r),Array.isArray(n)&&(r=n),n===null)),n}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:ys(t),partialMatch:t}}function P(...e){function t(n){let i=null;return e.some(c=>{let f=typeof c=="function"?c().partialMatch(n):c.partialMatch(n);return f!=null?(i=f,!0):!1}),i}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:ys(t),partialMatch:t}}function w(e){let t=e;function r(i){let c;try{c=dt(i)}catch{return!1}let f=c.protoNames();return f.length===1&&f[0]===t}function n(i){return i.length===0?null:i[0]===t?i.slice(1):null}return{toString:function(){return t},matches:r,partialMatch:n}}var zs=H(bt("net"),1);var Me=class extends EventTarget{#t=new Map;listenerCount(t){let r=this.#t.get(t);return r==null?0:r.length}addEventListener(t,r,n){super.addEventListener(t,r,n);let i=this.#t.get(t);i==null&&(i=[],this.#t.set(t,i)),i.push({callback:r,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(t,r,n){super.removeEventListener(t.toString(),r??null,n);let i=this.#t.get(t);i!=null&&(i=i.filter(({callback:c})=>c!==r),this.#t.set(t,i))}dispatchEvent(t){let r=super.dispatchEvent(t),n=this.#t.get(t.type);return n==null||(n=n.filter(({once:i})=>!i),this.#t.set(t.type,n)),r}safeDispatchEvent(t,r){return this.dispatchEvent(new Qt(t,r))}},_r=class extends Event{detail;constructor(t,r){super(t,r),this.detail=r?.detail}},Qt=globalThis.CustomEvent??_r;function De(e){return this.subnetMask<e.subnetMask?!1:this.mask(e.subnetMask)===e.mask()}function ke(e){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===e&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}var Kt=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,Fr=/\/\d{1,2}$/;var V=class extends Error{constructor(t,r){super(t),this.name="AddressError",r!==null&&(this.parseMessage=r)}};var te=H(Lr(),1),_t=H(ue(),1),rt=class e{constructor(t){this.groups=4,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=ke(32),this.isInSubnet=De,this.address=t;let r=Fr.exec(t);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>32)throw new V("Invalid subnet mask.");t=t.replace(Fr,"")}this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}static isValid(t){try{return new e(t),!0}catch{return!1}}parse(t){let r=t.split(".");if(!t.match(Kt))throw new V("Invalid IPv4 address.");return r}correctForm(){return this.parsedAddress.map(t=>parseInt(t,10)).join(".")}static fromHex(t){let r=t.replace(/:/g,"").padStart(8,"0"),n=[],i;for(i=0;i<8;i+=2){let c=r.slice(i,i+2);n.push(parseInt(c,16))}return new e(n.join("."))}static fromInteger(t){return e.fromHex(t.toString(16))}static fromArpa(t){let n=t.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new e(n)}toHex(){return this.parsedAddress.map(t=>(0,_t.sprintf)("%02x",parseInt(t,10))).join(":")}toArray(){return this.parsedAddress.map(t=>parseInt(t,10))}toGroup6(){let t=[],r;for(r=0;r<4;r+=2){let n=(0,_t.sprintf)("%02x%02x",parseInt(this.parsedAddress[r],10),parseInt(this.parsedAddress[r+1],10));t.push((0,_t.sprintf)("%x",parseInt(n,16)))}return t.join(":")}bigInteger(){return new te.BigInteger(this.parsedAddress.map(t=>(0,_t.sprintf)("%02x",parseInt(t,10))).join(""),16)}_startAddress(){return new te.BigInteger(this.mask()+"0".repeat(32-this.subnetMask),2)}startAddress(){return e.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new te.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new te.BigInteger(this.mask()+"1".repeat(32-this.subnetMask),2)}endAddress(){return e.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new te.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(t))}static fromBigInteger(t){return e.fromInteger(parseInt(t.toString(),10))}mask(t){return t===void 0&&(t=this.subnetMask),this.getBitsBase2(0,t)}getBitsBase2(t,r){return this.binaryZeroPad().slice(t,r)}reverseForm(t){t||(t={});let r=this.correctForm().split(".").reverse().join(".");return t.omitSuffix?r:(0,_t.sprintf)("%s.in-addr.arpa.",r)}isMulticast(){return this.isInSubnet(new e("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(32,"0")}groupForV6(){let t=this.parsedAddress;return this.address.replace(Kt,(0,_t.sprintf)('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',t.slice(0,2).join("."),t.slice(2,4).join(".")))}};var Cs={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},Ur={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"},$r=/([^0-9a-f:/%])/gi,Vr=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,jr=/\/\d{1,3}(?=%|$)/,zr=/%.*$/,Es=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),As=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/);var Rs=H(ue(),1);function Yc(e){return e.replace(/^(0+)/,'<span class="zero">$1</span>')}function Ne(e,t=0){return e.split(":").map((n,i)=>/group-v4/.test(n)?n:(0,Rs.sprintf)('<span class="hover-group group-%d">%s</span>',i+t,Yc(n)))}var Lt=H(ue(),1);function Gr(e){return(0,Lt.sprintf)("(%s)",e.join("|"))}function qr(e){return e.length<4?(0,Lt.sprintf)("0{0,%d}%s",4-e.length,e):e}var Hr="[^A-Fa-f0-9:]";function _e(e){let t=[];e.forEach((n,i)=>{parseInt(n,16)===0&&t.push(i)});let r=t.map(n=>e.map((i,c)=>{if(c===n){let f=c===0||c===8-1?":":"";return Gr([qr(i),f])}return qr(i)}).join(":"));return r.push(e.map(qr).join(":")),Gr(r)}function Zr(e,t,r){let n=t?"":":",i=r?"":":",c=[];!t&&!r&&c.push("::"),t&&r&&c.push(""),(r&&!t||!r&&t)&&c.push(":"),c.push((0,Lt.sprintf)("%s(:0{1,4}){1,%d}",n,e-1)),c.push((0,Lt.sprintf)("(0{1,4}:){1,%d}%s",e-1,i)),c.push((0,Lt.sprintf)("(0{1,4}:){%d}0{1,4}",e-1));for(let f=1;f<e-1;f++)for(let h=1;h<e-f;h++)c.push((0,Lt.sprintf)("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",h,e-h-f-1));return Gr(c)}var j=H(Lr(),1),z=H(ue(),1);function Fe(e){if(!e)throw new Error("Assertion failed.")}function Qc(e){let t=/(\d+)(\d{3})/;for(;t.test(e);)e=e.replace(t,"$1,$2");return e}function Kc(e){return e=e.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),e=e.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2'),e}function tu(e,t){let r=[],n=[],i;for(i=0;i<e.length;i++)i<t[0]?r.push(e[i]):i>t[1]&&n.push(e[i]);return r.concat(["compact"]).concat(n)}function Ms(e){return(0,z.sprintf)("%04x",parseInt(e,16))}function Ds(e){return e&255}var fe=class e{constructor(t,r){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=De,this.isCorrect=ke(128),r===void 0?this.groups=8:this.groups=r,this.address=t;let n=jr.exec(t);if(n){if(this.parsedSubnet=n[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>128)throw new V("Invalid subnet mask.");t=t.replace(jr,"")}else if(/\//.test(t))throw new V("Invalid subnet mask.");let i=zr.exec(t);i&&(this.zone=i[0],t=t.replace(zr,"")),this.addressMinusSuffix=t,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(t){try{return new e(t),!0}catch{return!1}}static fromBigInteger(t){let r=t.toString(16).padStart(32,"0"),n=[],i;for(i=0;i<8;i++)n.push(r.slice(i*4,(i+1)*4));return new e(n.join(":"))}static fromURL(t){let r,n=null,i;if(t.indexOf("[")!==-1&&t.indexOf("]:")!==-1){if(i=As.exec(t),i===null)return{error:"failed to parse address with port",address:null,port:null};r=i[1],n=i[2]}else if(t.indexOf("/")!==-1){if(t=t.replace(/^[a-z0-9]+:\/\//,""),i=Es.exec(t),i===null)return{error:"failed to parse address from URL",address:null,port:null};r=i[1]}else r=t;return n?(n=parseInt(n,10),(n<0||n>65536)&&(n=null)):n=null,{address:new e(r),port:n}}static fromAddress4(t){let r=new rt(t),n=128-(32-r.subnetMask);return new e(`::ffff:${r.correctForm()}/${n}`)}static fromArpa(t){let r=t.replace(/(\.ip6\.arpa)?\.$/,""),n=7;if(r.length!==63)throw new V("Invalid 'ip6.arpa' form.");let i=r.split(".").reverse();for(let c=n;c>0;c--){let f=c*4;i.splice(f,0,":")}return r=i.join(""),new e(r)}microsoftTranscription(){return(0,z.sprintf)("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))}mask(t=this.subnetMask){return this.getBitsBase2(0,t)}possibleSubnets(t=128){let r=128-this.subnetMask,n=Math.abs(t-128),i=r-n;return i<0?"0":Qc(new j.BigInteger("2",10).pow(i).toString(10))}_startAddress(){return new j.BigInteger(this.mask()+"0".repeat(128-this.subnetMask),2)}startAddress(){return e.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new j.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new j.BigInteger(this.mask()+"1".repeat(128-this.subnetMask),2)}endAddress(){return e.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new j.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(t))}getScope(){let t=Cs[this.getBits(12,16).intValue()];return this.getType()==="Global unicast"&&t!=="Link local"&&(t="Global"),t||"Unknown"}getType(){for(let t of Object.keys(Ur))if(this.isInSubnet(new e(t)))return Ur[t];return"Global unicast"}getBits(t,r){return new j.BigInteger(this.getBitsBase2(t,r),2)}getBitsBase2(t,r){return this.binaryZeroPad().slice(t,r)}getBitsBase16(t,r){let n=r-t;if(n%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(t,r).toString(16).padStart(n/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,128)}reverseForm(t){t||(t={});let r=Math.floor(this.subnetMask/4),n=this.canonicalForm().replace(/:/g,"").split("").slice(0,r).reverse().join(".");return r>0?t.omitSuffix?n:(0,z.sprintf)("%s.ip6.arpa.",n):t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,r=[],n=0,i=[];for(t=0;t<this.parsedAddress.length;t++){let h=parseInt(this.parsedAddress[t],16);h===0&&n++,h!==0&&n>0&&(n>1&&i.push([t-n,t-1]),n=0)}n>1&&i.push([this.parsedAddress.length-n,this.parsedAddress.length-1]);let c=i.map(h=>h[1]-h[0]+1);if(i.length>0){let h=c.indexOf(Math.max(...c));r=tu(this.parsedAddress,i[h])}else r=this.parsedAddress;for(t=0;t<r.length;t++)r[t]!=="compact"&&(r[t]=parseInt(r[t],16).toString(16));let f=r.join(":");return f=f.replace(/^compact$/,"::"),f=f.replace(/^compact|compact$/,":"),f=f.replace(/compact/,""),f}binaryZeroPad(){return this.bigInteger().toString(2).padStart(128,"0")}parse4in6(t){let r=t.split(":"),i=r.slice(-1)[0].match(Kt);if(i){this.parsedAddress4=i[0],this.address4=new rt(this.parsedAddress4);for(let c=0;c<this.address4.groups;c++)if(/^0[0-9]+/.test(this.address4.parsedAddress[c]))throw new V("IPv4 addresses can't have leading zeroes.",t.replace(Kt,this.address4.parsedAddress.map(Kc).join(".")));this.v4=!0,r[r.length-1]=this.address4.toGroup6(),t=r.join(":")}return t}parse(t){t=this.parse4in6(t);let r=t.match($r);if(r)throw new V((0,z.sprintf)("Bad character%s detected in address: %s",r.length>1?"s":"",r.join("")),t.replace($r,'<span class="parse-error">$1</span>'));let n=t.match(Vr);if(n)throw new V((0,z.sprintf)("Address failed regex: %s",n.join("")),t.replace(Vr,'<span class="parse-error">$1</span>'));let i=[],c=t.split("::");if(c.length===2){let f=c[0].split(":"),h=c[1].split(":");f.length===1&&f[0]===""&&(f=[]),h.length===1&&h[0]===""&&(h=[]);let g=this.groups-(f.length+h.length);if(!g)throw new V("Error parsing groups");this.elidedGroups=g,this.elisionBegin=f.length,this.elisionEnd=f.length+this.elidedGroups,i=i.concat(f);for(let C=0;C<g;C++)i.push("0");i=i.concat(h)}else if(c.length===1)i=t.split(":"),this.elidedGroups=0;else throw new V("Too many :: groups found");if(i=i.map(f=>(0,z.sprintf)("%x",parseInt(f,16))),i.length!==this.groups)throw new V("Incorrect number of groups found");return i}canonicalForm(){return this.parsedAddress.map(Ms).join(":")}decimal(){return this.parsedAddress.map(t=>(0,z.sprintf)("%05d",parseInt(t,16))).join(":")}bigInteger(){return new j.BigInteger(this.parsedAddress.map(Ms).join(""),16)}to4(){let t=this.binaryZeroPad().split("");return rt.fromHex(new j.BigInteger(t.slice(96,128).join(""),2).toString(16))}to4in6(){let t=this.to4(),n=new e(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),i="";return/:$/.test(n)||(i=":"),n+i+t.address}inspectTeredo(){let t=this.getBitsBase16(0,32),r=this.getBits(80,96).xor(new j.BigInteger("ffff",16)).toString(),n=rt.fromHex(this.getBitsBase16(32,64)),i=rt.fromHex(this.getBits(96,128).xor(new j.BigInteger("ffffffff",16)).toString(16)),c=this.getBits(64,80),f=this.getBitsBase2(64,80),h=c.testBit(15),g=c.testBit(14),C=c.testBit(8),l=c.testBit(9),y=new j.BigInteger(f.slice(2,6)+f.slice(8,16),2).toString(10);return{prefix:(0,z.sprintf)("%s:%s",t.slice(0,4),t.slice(4,8)),server4:n.address,client4:i.address,flags:f,coneNat:h,microsoft:{reserved:g,universalLocal:l,groupIndividual:C,nonce:y},udpPort:r}}inspect6to4(){let t=this.getBitsBase16(0,16),r=rt.fromHex(this.getBitsBase16(16,48));return{prefix:(0,z.sprintf)("%s",t.slice(0,4)),gateway:r.address}}to6to4(){if(!this.is4())return null;let t=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new e(t)}toByteArray(){let t=this.bigInteger().toByteArray();return t.length===17&&t[0]===0?t.slice(1):t}toUnsignedByteArray(){return this.toByteArray().map(Ds)}static fromByteArray(t){return this.fromUnsignedByteArray(t.map(Ds))}static fromUnsignedByteArray(t){let r=new j.BigInteger("256",10),n=new j.BigInteger("0",10),i=new j.BigInteger("1",10);for(let c=t.length-1;c>=0;c--)n=n.add(i.multiply(new j.BigInteger(t[c].toString(10),10))),i=i.multiply(r);return e.fromBigInteger(n)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){return this.getBitsBase2(0,64)==="1111111010000000000000000000000000000000000000000000000000000000"}isMulticast(){return this.getType()==="Multicast"}is4(){return this.v4}isTeredo(){return this.isInSubnet(new e("2001::/32"))}is6to4(){return this.isInSubnet(new e("2002::/16"))}isLoopback(){return this.getType()==="Loopback"}href(t){return t===void 0?t="":t=(0,z.sprintf)(":%s",t),(0,z.sprintf)("http://[%s]%s/",this.correctForm(),t)}link(t){t||(t={}),t.className===void 0&&(t.className=""),t.prefix===void 0&&(t.prefix="/#address="),t.v4===void 0&&(t.v4=!1);let r=this.correctForm;return t.v4&&(r=this.to4in6),t.className?(0,z.sprintf)('<a href="%1$s%2$s" class="%3$s">%2$s</a>',t.prefix,r.call(this),t.className):(0,z.sprintf)('<a href="%1$s%2$s">%2$s</a>',t.prefix,r.call(this))}group(){if(this.elidedGroups===0)return Ne(this.address).join(":");Fe(typeof this.elidedGroups=="number"),Fe(typeof this.elisionBegin=="number");let t=[],[r,n]=this.address.split("::");r.length?t.push(...Ne(r)):t.push("");let i=["hover-group"];for(let c=this.elisionBegin;c<this.elisionBegin+this.elidedGroups;c++)i.push((0,z.sprintf)("group-%d",c));return t.push((0,z.sprintf)('<span class="%s"></span>',i.join(" "))),n.length?t.push(...Ne(n,this.elisionEnd)):t.push(""),this.is4()&&(Fe(this.address4 instanceof rt),t.pop(),t.push(this.address4.groupForV6())),t.join(":")}regularExpressionString(t=!1){let r=[],n=new e(this.correctForm());if(n.elidedGroups===0)r.push(_e(n.parsedAddress));else if(n.elidedGroups===8)r.push(Zr(8));else{let i=n.address.split("::");i[0].length&&r.push(_e(i[0].split(":"))),Fe(typeof n.elidedGroups=="number"),r.push(Zr(n.elidedGroups,i[0].length!==0,i[1].length!==0)),i[1].length&&r.push(_e(i[1].split(":"))),r=[r.join(":")]}return t||(r=["(?=^|",Hr,"|[^\\w\\:])(",...r,")(?=[^\\w\\:]|",Hr,"|$)"]),r.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};var eu=Tt("libp2p:ip-port-to-multiaddr"),Wr={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};function ks(e,t){if(typeof e!="string")throw new ft(`invalid ip provided: ${e}`,Wr.ERR_INVALID_IP_PARAMETER);if(typeof t=="string"&&(t=parseInt(t)),isNaN(t))throw new ft(`invalid port provided: ${t}`,Wr.ERR_INVALID_PORT_PARAMETER);try{return new rt(e),dt(`/ip4/${e}/tcp/${t}`)}catch{}try{let r=new fe(e);return r.is4()?dt(`/ip4/${r.to4().correctForm()}/tcp/${t}`):dt(`/ip6/${e}/tcp/${t}`)}catch{let n=`invalid ip:port for creating a multiaddr: ${e}:${t}`;throw eu.error(n),new ft(n,Wr.ERR_INVALID_IP)}}var js=H($s(),1);var Yr=H(bt("os"),1),Vs=H(bt("path"),1);var iu={ip4:"IPv4",ip6:"IPv6"};function ne(e,t={}){let r=e.getPath();return r!=null?Yr.default.platform()==="win32"?{path:Vs.default.join("\\\\.\\pipe\\",r)}:{path:r}:{...e.toOptions(),...t}}function Qr(e,t,r){let n=i=>dt(`/${e}/${i}/tcp/${r}`);return(au(t)?uu(iu[e]):[t]).map(n)}function au(e){return["0.0.0.0","::"].includes(e)}var cu=Yr.default.networkInterfaces();function uu(e){let t=[];for(let[,r]of Object.entries(cu))if(r!=null)for(let n of r)n.family===e&&t.push(n.address);return t}var mt=Tt("libp2p:tcp:socket"),Ue=(e,t)=>{let r=t.metrics,n=t.metricPrefix??"",i=t.socketInactivityTimeout??3e5,c=t.socketCloseTimeout??500;t.listeningAddr?.getPath()!=null&&(t.remoteAddr=t.listeningAddr),t.remoteAddr?.getPath()!=null&&(t.localAddr=t.remoteAddr);let f;if(t.remoteAddr!=null)f=t.remoteAddr;else{if(e.remoteAddress==null||e.remotePort==null)throw new ft("Could not determine remote address or port","ERR_NO_REMOTE_ADDRESS");f=ks(e.remoteAddress,e.remotePort)}let h=ne(f),g=h.path??`${h.host??""}:${h.port??""}`,{sink:C,source:l}=js.default.duplex(e);e.setTimeout(i,()=>{mt("%s socket read timeout",g),r?.increment({[`${n}timeout`]:!0});let x;e.readable&&(x=new ft("Socket read timeout","ERR_SOCKET_READ_TIMEOUT")),e.destroy(x)}),e.once("close",()=>{mt("%s socket close",g),r?.increment({[`${n}close`]:!0}),y.timeline.close==null&&(y.timeline.close=Date.now())}),e.once("end",()=>{mt("%s socket end",g),r?.increment({[`${n}end`]:!0})});let y={async sink(x){try{await C(x)}catch(S){S.type!=="aborted"&&mt(S)}e.end()},source:l,remoteAddr:f,timeline:{open:Date.now()},async close(x={}){if(e.destroyed){mt("%s socket was already destroyed when trying to close",g);return}x.signal=x.signal??AbortSignal.timeout(c);try{mt("%s closing socket",g),await new Promise((S,m)=>{e.once("close",()=>{mt("%s socket closed",g),S()}),e.once("error",A=>{mt("%s socket error",g,A),y.timeline.close==null&&(y.timeline.close=Date.now()),m(A)}),e.setTimeout(c),e.end(),e.writableLength>0?e.once("drain",()=>{mt("%s socket drained",g),e.destroy()}):e.destroy()})}catch(S){this.abort(S)}},abort:x=>{mt("%s socket abort due to error",g,x),e.destroy(x)}};return y};var nt=Tt("libp2p:tcp:listener");async function Kr(e){try{await e.close()}catch(t){nt.error("an error occurred closing the connection",t)}}var pu=1,hu=0,$e=class extends Me{context;server;connections=new Set;status={started:!1};metrics;addr;constructor(t){if(super(),this.context=t,t.keepAlive=t.keepAlive??!0,this.addr="unknown",this.server=zs.default.createServer(t,this.onSocket.bind(this)),t.maxConnections!==void 0&&(this.server.maxConnections=t.maxConnections),t.closeServerOnMaxConnections!=null&&t.closeServerOnMaxConnections.closeAbove<t.closeServerOnMaxConnections.listenBelow)throw Error("closeAbove must be >= listenBelow");this.server.on("listening",()=>{if(t.metrics!=null){let r=this.server.address();r==null?this.addr="unknown":typeof r=="string"?this.addr=r:this.addr=`${r.address}:${r.port}`,t.metrics?.registerMetricGroup("libp2p_tcp_inbound_connections_total",{label:"address",help:"Current active connections in TCP listener",calculate:()=>({[this.addr]:this.connections.size})}),this.metrics={status:t.metrics.registerMetricGroup("libp2p_tcp_listener_status_info",{label:"address",help:"Current status of the TCP listener socket"}),errors:t.metrics.registerMetricGroup("libp2p_tcp_listener_errors_total",{label:"address",help:"Total count of TCP listener errors by type"}),events:t.metrics.registerMetricGroup("libp2p_tcp_listener_events_total",{label:"address",help:"Total count of TCP listener events by type"})},this.metrics?.status.update({[this.addr]:pu})}this.dispatchEvent(new Qt("listening"))}).on("error",r=>{this.metrics?.errors.increment({[`${this.addr} listen_error`]:!0}),this.dispatchEvent(new Qt("error",{detail:r}))}).on("close",()=>{this.metrics?.status.update({[this.addr]:hu}),this.dispatchEvent(new Qt("close"))})}onSocket(t){t.on("error",n=>{nt("socket error",n),this.metrics?.events.increment({[`${this.addr} error`]:!0})});let r;try{r=Ue(t,{listeningAddr:this.status.started?this.status.listeningAddr:void 0,socketInactivityTimeout:this.context.socketInactivityTimeout,socketCloseTimeout:this.context.socketCloseTimeout,metrics:this.metrics?.events,metricPrefix:`${this.addr} `})}catch(n){nt.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_to_connection`]:!0});return}nt("new inbound connection %s",r.remoteAddr);try{this.context.upgrader.upgradeInbound(r).then(n=>{nt("inbound connection upgraded %s",r.remoteAddr),this.connections.add(r),t.once("close",()=>{this.connections.delete(r),this.context.closeServerOnMaxConnections!=null&&this.connections.size<this.context.closeServerOnMaxConnections.listenBelow&&this.netListen().catch(i=>{nt.error("error attempting to listen server once connection count under limit",i),this.context.closeServerOnMaxConnections?.onListenError?.(i)})}),this.context.handler!=null&&this.context.handler(n),this.context.closeServerOnMaxConnections!=null&&this.connections.size>=this.context.closeServerOnMaxConnections.closeAbove&&this.netClose(),this.dispatchEvent(new Qt("connection",{detail:n}))}).catch(async n=>{nt.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_upgrade`]:!0}),await Kr(r)}).catch(n=>{nt.error("closing inbound connection failed",n)})}catch(n){nt.error("inbound connection failed",n),Kr(r).catch(i=>{nt.error("closing inbound connection failed",i),this.metrics?.errors.increment({[`${this.addr} inbound_closing_failed`]:!0})})}}getAddrs(){if(!this.status.started)return[];let t=[],r=this.server.address(),{listeningAddr:n,peerId:i}=this.status;if(r==null)return[];if(typeof r=="string")t=[n];else try{n.toString().startsWith("/ip4")?t=t.concat(Qr("ip4",r.address,r.port)):r.family==="IPv6"&&(t=t.concat(Qr("ip6",r.address,r.port)))}catch(c){nt.error("could not turn %s:%s into multiaddr",r.address,r.port,c)}return t.map(c=>i!=null?c.encapsulate(`/p2p/${i}`):c)}async listen(t){if(this.status.started)throw Error("server is already listening");let r=t.getPeerId(),n=r==null?t.decapsulateCode(421):t,{backlog:i}=this.context;this.status={started:!0,listeningAddr:n,peerId:r,netConfig:ne(n,{backlog:i})},await this.netListen()}async close(){await Promise.all(Array.from(this.connections.values()).map(async t=>{await Kr(t)})),this.netClose()}async netListen(){if(!this.status.started||this.server.listening)return;let t=this.status.netConfig;await new Promise((r,n)=>{this.server.once("error",n),this.server.listen(t,r)}),nt("Listening on %s",this.server.address())}netClose(){!this.status.started||!this.server.listening||(nt("Closing server on %s",this.server.address()),this.server.close())}};var vt=Tt("libp2p:tcp"),en=class{opts;metrics;components;constructor(t,r={}){this.opts=r,this.components=t,t.metrics!=null&&(this.metrics={dialerEvents:t.metrics.registerCounterGroup("libp2p_tcp_dialer_events_total",{label:"event",help:"Total count of TCP dialer events by type"})})}[ln]=!0;[Symbol.toStringTag]="@libp2p/tcp";async dial(t,r){r.keepAlive=r.keepAlive??!0;let n=await this._connect(t,r);n.on("error",h=>{vt("socket error",h)});let i=Ue(n,{remoteAddr:t,socketInactivityTimeout:this.opts.outboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.metrics?.dialerEvents}),c=()=>{i.close().catch(h=>{vt.error("Error closing maConn after abort",h)})};r.signal?.addEventListener("abort",c,{once:!0}),vt("new outbound connection %s",i.remoteAddr);let f=await r.upgrader.upgradeOutbound(i);if(vt("outbound connection %s upgraded",i.remoteAddr),r.signal?.removeEventListener("abort",c),r.signal?.aborted===!0)throw f.close().catch(h=>{vt.error("Error closing conn after abort",h)}),new Ut;return f}async _connect(t,r){if(r.signal?.aborted===!0)throw new Ut;return new Promise((n,i)=>{let c=Date.now(),f=ne(t),h=f.path??`${f.host??""}:${f.port}`;vt("dialing %j",f);let g=qs.default.connect(f),C=m=>{m.message=`connection error ${h}: ${m.message}`,this.metrics?.dialerEvents.increment({error:!0}),S(m)},l=()=>{vt("connection timeout %s",h),this.metrics?.dialerEvents.increment({timeout:!0});let m=new ft(`connection timeout after ${Date.now()-c}ms`,"ERR_CONNECT_TIMEOUT");g.emit("error",m)},y=()=>{vt("connection opened %j",f),this.metrics?.dialerEvents.increment({connect:!0}),S()},x=()=>{vt("connection aborted %j",f),this.metrics?.dialerEvents.increment({abort:!0}),g.destroy(),S(new Ut)},S=m=>{if(g.removeListener("error",C),g.removeListener("timeout",l),g.removeListener("connect",y),r.signal!=null&&r.signal.removeEventListener("abort",x),m!=null){i(m);return}n(g)};g.on("error",C),g.on("timeout",l),g.on("connect",y),r.signal!=null&&r.signal.addEventListener("abort",x)})}createListener(t){return new $e({...t,maxConnections:this.opts.maxConnections,backlog:this.opts.backlog,closeServerOnMaxConnections:this.opts.closeServerOnMaxConnections,socketInactivityTimeout:this.opts.inboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.components.metrics})}filter(t){return t=Array.isArray(t)?t:[t],t.filter(r=>r.protoCodes().includes(290)?!1:r.protoCodes().includes(400)?!0:It.matches(r.decapsulateCode(421)))}};function gu(e={}){return(t={})=>new en(t,e)}return Di(bu);})();
|
|
7
7
|
return Libp2PTcp}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/tcp",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.1-446fff87",
|
|
4
4
|
"description": "A TCP transport for libp2p",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/transport-tcp#readme",
|
|
@@ -50,16 +50,16 @@
|
|
|
50
50
|
"test:electron-main": "aegir test -t electron-main"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@libp2p/interface": "
|
|
54
|
-
"@libp2p/logger": "
|
|
55
|
-
"@libp2p/utils": "
|
|
53
|
+
"@libp2p/interface": "0.1.0-446fff87",
|
|
54
|
+
"@libp2p/logger": "3.0.0-446fff87",
|
|
55
|
+
"@libp2p/utils": "4.0.0-446fff87",
|
|
56
56
|
"@multiformats/mafmt": "^12.1.2",
|
|
57
57
|
"@multiformats/multiaddr": "^12.1.3",
|
|
58
58
|
"@types/sinon": "^10.0.15",
|
|
59
59
|
"stream-to-it": "^0.2.2"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@libp2p/interface-compliance-tests": "
|
|
62
|
+
"@libp2p/interface-compliance-tests": "4.0.1-446fff87",
|
|
63
63
|
"aegir": "^40.0.1",
|
|
64
64
|
"it-all": "^3.0.1",
|
|
65
65
|
"it-pipe": "^3.0.1",
|