@libp2p/tcp 6.2.0 → 6.2.2

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 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 Fi=Object.create;var Te=Object.defineProperty;var Ni=Object.getOwnPropertyDescriptor;var Li=Object.getOwnPropertyNames;var Ui=Object.getPrototypeOf,$i=Object.prototype.hasOwnProperty;var yt=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var N=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),nt=(r,t)=>{for(var e in t)Te(r,e,{get:t[e],enumerable:!0})},bn=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Li(t))!$i.call(r,i)&&i!==e&&Te(r,i,{get:()=>t[i],enumerable:!(n=Ni(t,i))||n.enumerable});return r};var V=(r,t,e)=>(e=r!=null?Fi(Ui(r)):{},bn(t||!r||!r.__esModule?Te(e,"default",{value:r,enumerable:!0}):e,r)),ji=r=>bn(Te({},"__esModule",{value:!0}),r);var jn=N((Mf,$n)=>{$n.exports=Ir;var Un=128,Ka=127,tc=~Ka,ec=Math.pow(2,31);function Ir(r,t,e){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw Ir.bytes=0,new RangeError("Could not encode varint");t=t||[],e=e||0;for(var n=e;r>=ec;)t[e++]=r&255|Un,r/=128;for(;r&tc;)t[e++]=r&255|Un,r>>>=7;return t[e]=r|0,Ir.bytes=e-n+1,t}});var qn=N((Df,zn)=>{zn.exports=Br;var rc=128,Vn=127;function Br(r,n){var e=0,n=n||0,i=0,u=n,f,d=r.length;do{if(u>=d||i>49)throw Br.bytes=0,new RangeError("Could not decode varint");f=r[u++],e+=i<28?(f&Vn)<<i:(f&Vn)*Math.pow(2,i),i+=7}while(f>=rc);return Br.bytes=u-n,e}});var Hn=N((Pf,Gn)=>{var nc=Math.pow(2,7),sc=Math.pow(2,14),oc=Math.pow(2,21),ic=Math.pow(2,28),ac=Math.pow(2,35),cc=Math.pow(2,42),uc=Math.pow(2,49),fc=Math.pow(2,56),lc=Math.pow(2,63);Gn.exports=function(r){return r<nc?1:r<sc?2:r<oc?3:r<ic?4:r<ac?5:r<cc?6:r<uc?7:r<fc?8:r<lc?9:10}});var Re=N((kf,Zn)=>{Zn.exports={encode:jn(),decode:qn(),encodingLength:Hn()}});var ws=N((sp,bs)=>{var Qt=1e3,Kt=Qt*60,te=Kt*60,Nt=te*24,Vc=Nt*7,zc=Nt*365.25;bs.exports=function(r,t){t=t||{};var e=typeof r;if(e==="string"&&r.length>0)return qc(r);if(e==="number"&&isFinite(r))return t.long?Hc(r):Gc(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function qc(r){if(r=String(r),!(r.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(r);if(t){var e=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return e*zc;case"weeks":case"week":case"w":return e*Vc;case"days":case"day":case"d":return e*Nt;case"hours":case"hour":case"hrs":case"hr":case"h":return e*te;case"minutes":case"minute":case"mins":case"min":case"m":return e*Kt;case"seconds":case"second":case"secs":case"sec":case"s":return e*Qt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function Gc(r){var t=Math.abs(r);return t>=Nt?Math.round(r/Nt)+"d":t>=te?Math.round(r/te)+"h":t>=Kt?Math.round(r/Kt)+"m":t>=Qt?Math.round(r/Qt)+"s":r+"ms"}function Hc(r){var t=Math.abs(r);return t>=Nt?Fe(r,t,Nt,"day"):t>=te?Fe(r,t,te,"hour"):t>=Kt?Fe(r,t,Kt,"minute"):t>=Qt?Fe(r,t,Qt,"second"):r+" ms"}function Fe(r,t,e,n){var i=t>=e*1.5;return Math.round(r/e)+" "+n+(i?"s":"")}});var jr=N((op,ys)=>{function Zc(r){e.debug=e,e.default=e,e.coerce=g,e.disable=u,e.enable=i,e.enabled=f,e.humanize=ws(),e.destroy=A,Object.keys(r).forEach(l=>{e[l]=r[l]}),e.names=[],e.skips=[],e.formatters={};function t(l){let w=0;for(let x=0;x<l.length;x++)w=(w<<5)-w+l.charCodeAt(x),w|=0;return e.colors[Math.abs(w)%e.colors.length]}e.selectColor=t;function e(l){let w,x=null,S,m;function E(...B){if(!E.enabled)return;let C=E,I=Number(new Date),O=I-(w||I);C.diff=O,C.prev=w,C.curr=I,w=I,B[0]=e.coerce(B[0]),typeof B[0]!="string"&&B.unshift("%O");let F=0;B[0]=B[0].replace(/%([a-zA-Z%])/g,(J,W)=>{if(J==="%%")return"%";F++;let Y=e.formatters[W];if(typeof Y=="function"){let ut=B[F];J=Y.call(C,ut),B.splice(F,1),F--}return J}),e.formatArgs.call(C,B),(C.log||e.log).apply(C,B)}return E.namespace=l,E.useColors=e.useColors(),E.color=e.selectColor(l),E.extend=n,E.destroy=e.destroy,Object.defineProperty(E,"enabled",{enumerable:!0,configurable:!1,get:()=>x!==null?x:(S!==e.namespaces&&(S=e.namespaces,m=e.enabled(l)),m),set:B=>{x=B}}),typeof e.init=="function"&&e.init(E),E}function n(l,w){let x=e(this.namespace+(typeof w>"u"?":":w)+l);return x.log=this.log,x}function i(l){e.save(l),e.namespaces=l,e.names=[],e.skips=[];let w,x=(typeof l=="string"?l:"").split(/[\s,]+/),S=x.length;for(w=0;w<S;w++)x[w]&&(l=x[w].replace(/\*/g,".*?"),l[0]==="-"?e.skips.push(new RegExp("^"+l.slice(1)+"$")):e.names.push(new RegExp("^"+l+"$")))}function u(){let l=[...e.names.map(d),...e.skips.map(d).map(w=>"-"+w)].join(",");return e.enable(""),l}function f(l){if(l[l.length-1]==="*")return!0;let w,x;for(w=0,x=e.skips.length;w<x;w++)if(e.skips[w].test(l))return!1;for(w=0,x=e.names.length;w<x;w++)if(e.names[w].test(l))return!0;return!1}function d(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function g(l){return l instanceof Error?l.stack||l.message:l}function A(){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 e.enable(e.load()),e}ys.exports=Zc});var vs=N((st,Ne)=>{st.formatArgs=Xc;st.save=Jc;st.load=Yc;st.useColors=Wc;st.storage=Qc();st.destroy=(()=>{let r=!1;return()=>{r||(r=!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`."))}})();st.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 Wc(){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 Xc(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Ne.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;r.splice(1,0,t,"color: inherit");let e=0,n=0;r[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(e++,i==="%c"&&(n=e))}),r.splice(n,0,t)}st.log=console.debug||console.log||(()=>{});function Jc(r){try{r?st.storage.setItem("debug",r):st.storage.removeItem("debug")}catch{}}function Yc(){let r;try{r=st.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function Qc(){try{return localStorage}catch{}}Ne.exports=jr()(st);var{formatters:Kc}=Ne.exports;Kc.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Ss=N((ip,xs)=>{"use strict";xs.exports=(r,t)=>{t=t||process.argv;let e=r.startsWith("-")?"":r.length===1?"-":"--",n=t.indexOf(e+r),i=t.indexOf("--");return n!==-1&&(i===-1?!0:n<i)}});var Es=N((ap,Ts)=>{"use strict";var tu=yt("os"),dt=Ss(),q=process.env,ee;dt("no-color")||dt("no-colors")||dt("color=false")?ee=!1:(dt("color")||dt("colors")||dt("color=true")||dt("color=always"))&&(ee=!0);"FORCE_COLOR"in q&&(ee=q.FORCE_COLOR.length===0||parseInt(q.FORCE_COLOR,10)!==0);function eu(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function ru(r){if(ee===!1)return 0;if(dt("color=16m")||dt("color=full")||dt("color=truecolor"))return 3;if(dt("color=256"))return 2;if(r&&!r.isTTY&&ee!==!0)return 0;let t=ee?1:0;if(process.platform==="win32"){let e=tu.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in q)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(e=>e in q)||q.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in q)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(q.TEAMCITY_VERSION)?1:0;if(q.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in q){let e=parseInt((q.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(q.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(q.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(q.TERM)||"COLORTERM"in q?1:(q.TERM==="dumb",t)}function Vr(r){let t=ru(r);return eu(t)}Ts.exports={supportsColor:Vr,stdout:Vr(process.stdout),stderr:Vr(process.stderr)}});var As=N((j,Ue)=>{var nu=yt("tty"),Le=yt("util");j.init=fu;j.log=au;j.formatArgs=ou;j.save=cu;j.load=uu;j.useColors=su;j.destroy=Le.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");j.colors=[6,2,3,4,5,1];try{let r=Es();r&&(r.stderr||r).level>=2&&(j.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{}j.inspectOpts=Object.keys(process.env).filter(r=>/^debug_/i.test(r)).reduce((r,t)=>{let e=t.substring(6).toLowerCase().replace(/_([a-z])/g,(i,u)=>u.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),r[e]=n,r},{});function su(){return"colors"in j.inspectOpts?!!j.inspectOpts.colors:nu.isatty(process.stderr.fd)}function ou(r){let{namespace:t,useColors:e}=this;if(e){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),u=` ${i};1m${t} \x1B[0m`;r[0]=u+r[0].split(`
2
+ "use strict";var Libp2PTcp=(()=>{var Ni=Object.create;var Ce=Object.defineProperty;var Li=Object.getOwnPropertyDescriptor;var Ui=Object.getOwnPropertyNames;var $i=Object.getPrototypeOf,ji=Object.prototype.hasOwnProperty;var yt=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var N=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),nt=(r,t)=>{for(var e in t)Ce(r,e,{get:t[e],enumerable:!0})},wn=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ui(t))!ji.call(r,i)&&i!==e&&Ce(r,i,{get:()=>t[i],enumerable:!(n=Li(t,i))||n.enumerable});return r};var V=(r,t,e)=>(e=r!=null?Ni($i(r)):{},wn(t||!r||!r.__esModule?Ce(e,"default",{value:r,enumerable:!0}):e,r)),Vi=r=>wn(Ce({},"__esModule",{value:!0}),r);var Vn=N((Df,jn)=>{jn.exports=Rr;var $n=128,tc=127,ec=~tc,rc=Math.pow(2,31);function Rr(r,t,e){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw Rr.bytes=0,new RangeError("Could not encode varint");t=t||[],e=e||0;for(var n=e;r>=rc;)t[e++]=r&255|$n,r/=128;for(;r&ec;)t[e++]=r&255|$n,r>>>=7;return t[e]=r|0,Rr.bytes=e-n+1,t}});var Gn=N((Pf,qn)=>{qn.exports=Mr;var nc=128,zn=127;function Mr(r,n){var e=0,n=n||0,i=0,u=n,f,d=r.length;do{if(u>=d||i>49)throw Mr.bytes=0,new RangeError("Could not decode varint");f=r[u++],e+=i<28?(f&zn)<<i:(f&zn)*Math.pow(2,i),i+=7}while(f>=nc);return Mr.bytes=u-n,e}});var Wn=N((kf,Hn)=>{var sc=Math.pow(2,7),oc=Math.pow(2,14),ic=Math.pow(2,21),ac=Math.pow(2,28),cc=Math.pow(2,35),uc=Math.pow(2,42),fc=Math.pow(2,49),lc=Math.pow(2,56),pc=Math.pow(2,63);Hn.exports=function(r){return r<sc?1:r<oc?2:r<ic?3:r<ac?4:r<cc?5:r<uc?6:r<fc?7:r<lc?8:r<pc?9:10}});var De=N((_f,Zn)=>{Zn.exports={encode:Vn(),decode:Gn(),encodingLength:Wn()}});var ys=N((op,ws)=>{var te=1e3,ee=te*60,re=ee*60,Ut=re*24,zc=Ut*7,qc=Ut*365.25;ws.exports=function(r,t){t=t||{};var e=typeof r;if(e==="string"&&r.length>0)return Gc(r);if(e==="number"&&isFinite(r))return t.long?Wc(r):Hc(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function Gc(r){if(r=String(r),!(r.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(r);if(t){var e=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return e*qc;case"weeks":case"week":case"w":return e*zc;case"days":case"day":case"d":return e*Ut;case"hours":case"hour":case"hrs":case"hr":case"h":return e*re;case"minutes":case"minute":case"mins":case"min":case"m":return e*ee;case"seconds":case"second":case"secs":case"sec":case"s":return e*te;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function Hc(r){var t=Math.abs(r);return t>=Ut?Math.round(r/Ut)+"d":t>=re?Math.round(r/re)+"h":t>=ee?Math.round(r/ee)+"m":t>=te?Math.round(r/te)+"s":r+"ms"}function Wc(r){var t=Math.abs(r);return t>=Ut?Le(r,t,Ut,"day"):t>=re?Le(r,t,re,"hour"):t>=ee?Le(r,t,ee,"minute"):t>=te?Le(r,t,te,"second"):r+" ms"}function Le(r,t,e,n){var i=t>=e*1.5;return Math.round(r/e)+" "+n+(i?"s":"")}});var Vr=N((ip,vs)=>{function Zc(r){e.debug=e,e.default=e,e.coerce=g,e.disable=u,e.enable=i,e.enabled=f,e.humanize=ys(),e.destroy=A,Object.keys(r).forEach(l=>{e[l]=r[l]}),e.names=[],e.skips=[],e.formatters={};function t(l){let w=0;for(let x=0;x<l.length;x++)w=(w<<5)-w+l.charCodeAt(x),w|=0;return e.colors[Math.abs(w)%e.colors.length]}e.selectColor=t;function e(l){let w,x=null,S,m;function E(...B){if(!E.enabled)return;let C=E,I=Number(new Date),O=I-(w||I);C.diff=O,C.prev=w,C.curr=I,w=I,B[0]=e.coerce(B[0]),typeof B[0]!="string"&&B.unshift("%O");let F=0;B[0]=B[0].replace(/%([a-zA-Z%])/g,(J,Z)=>{if(J==="%%")return"%";F++;let Y=e.formatters[Z];if(typeof Y=="function"){let ut=B[F];J=Y.call(C,ut),B.splice(F,1),F--}return J}),e.formatArgs.call(C,B),(C.log||e.log).apply(C,B)}return E.namespace=l,E.useColors=e.useColors(),E.color=e.selectColor(l),E.extend=n,E.destroy=e.destroy,Object.defineProperty(E,"enabled",{enumerable:!0,configurable:!1,get:()=>x!==null?x:(S!==e.namespaces&&(S=e.namespaces,m=e.enabled(l)),m),set:B=>{x=B}}),typeof e.init=="function"&&e.init(E),E}function n(l,w){let x=e(this.namespace+(typeof w>"u"?":":w)+l);return x.log=this.log,x}function i(l){e.save(l),e.namespaces=l,e.names=[],e.skips=[];let w,x=(typeof l=="string"?l:"").split(/[\s,]+/),S=x.length;for(w=0;w<S;w++)x[w]&&(l=x[w].replace(/\*/g,".*?"),l[0]==="-"?e.skips.push(new RegExp("^"+l.slice(1)+"$")):e.names.push(new RegExp("^"+l+"$")))}function u(){let l=[...e.names.map(d),...e.skips.map(d).map(w=>"-"+w)].join(",");return e.enable(""),l}function f(l){if(l[l.length-1]==="*")return!0;let w,x;for(w=0,x=e.skips.length;w<x;w++)if(e.skips[w].test(l))return!1;for(w=0,x=e.names.length;w<x;w++)if(e.names[w].test(l))return!0;return!1}function d(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function g(l){return l instanceof Error?l.stack||l.message:l}function A(){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 e.enable(e.load()),e}vs.exports=Zc});var xs=N((st,Ue)=>{st.formatArgs=Jc;st.save=Yc;st.load=Qc;st.useColors=Xc;st.storage=Kc();st.destroy=(()=>{let r=!1;return()=>{r||(r=!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`."))}})();st.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 Xc(){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 Jc(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Ue.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;r.splice(1,0,t,"color: inherit");let e=0,n=0;r[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(e++,i==="%c"&&(n=e))}),r.splice(n,0,t)}st.log=console.debug||console.log||(()=>{});function Yc(r){try{r?st.storage.setItem("debug",r):st.storage.removeItem("debug")}catch{}}function Qc(){let r;try{r=st.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function Kc(){try{return localStorage}catch{}}Ue.exports=Vr()(st);var{formatters:tu}=Ue.exports;tu.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Ts=N((ap,Ss)=>{"use strict";Ss.exports=(r,t)=>{t=t||process.argv;let e=r.startsWith("-")?"":r.length===1?"-":"--",n=t.indexOf(e+r),i=t.indexOf("--");return n!==-1&&(i===-1?!0:n<i)}});var Cs=N((cp,Es)=>{"use strict";var eu=yt("os"),dt=Ts(),q=process.env,ne;dt("no-color")||dt("no-colors")||dt("color=false")?ne=!1:(dt("color")||dt("colors")||dt("color=true")||dt("color=always"))&&(ne=!0);"FORCE_COLOR"in q&&(ne=q.FORCE_COLOR.length===0||parseInt(q.FORCE_COLOR,10)!==0);function ru(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function nu(r){if(ne===!1)return 0;if(dt("color=16m")||dt("color=full")||dt("color=truecolor"))return 3;if(dt("color=256"))return 2;if(r&&!r.isTTY&&ne!==!0)return 0;let t=ne?1:0;if(process.platform==="win32"){let e=eu.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in q)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(e=>e in q)||q.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in q)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(q.TEAMCITY_VERSION)?1:0;if(q.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in q){let e=parseInt((q.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(q.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(q.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(q.TERM)||"COLORTERM"in q?1:(q.TERM==="dumb",t)}function zr(r){let t=nu(r);return ru(t)}Es.exports={supportsColor:zr,stdout:zr(process.stdout),stderr:zr(process.stderr)}});var Is=N((j,je)=>{var su=yt("tty"),$e=yt("util");j.init=lu;j.log=cu;j.formatArgs=iu;j.save=uu;j.load=fu;j.useColors=ou;j.destroy=$e.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");j.colors=[6,2,3,4,5,1];try{let r=Cs();r&&(r.stderr||r).level>=2&&(j.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{}j.inspectOpts=Object.keys(process.env).filter(r=>/^debug_/i.test(r)).reduce((r,t)=>{let e=t.substring(6).toLowerCase().replace(/_([a-z])/g,(i,u)=>u.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),r[e]=n,r},{});function ou(){return"colors"in j.inspectOpts?!!j.inspectOpts.colors:su.isatty(process.stderr.fd)}function iu(r){let{namespace:t,useColors:e}=this;if(e){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),u=` ${i};1m${t} \x1B[0m`;r[0]=u+r[0].split(`
3
3
  `).join(`
4
- `+u),r.push(i+"m+"+Ue.exports.humanize(this.diff)+"\x1B[0m")}else r[0]=iu()+t+" "+r[0]}function iu(){return j.inspectOpts.hideDate?"":new Date().toISOString()+" "}function au(...r){return process.stderr.write(Le.format(...r)+`
5
- `)}function cu(r){r?process.env.DEBUG=r:delete process.env.DEBUG}function uu(){return process.env.DEBUG}function fu(r){r.inspectOpts={};let t=Object.keys(j.inspectOpts);for(let e=0;e<t.length;e++)r.inspectOpts[t[e]]=j.inspectOpts[t[e]]}Ue.exports=jr()(j);var{formatters:Cs}=Ue.exports;Cs.o=function(r){return this.inspectOpts.colors=this.useColors,Le.inspect(r,this.inspectOpts).split(`
6
- `).map(t=>t.trim()).join(" ")};Cs.O=function(r){return this.inspectOpts.colors=this.useColors,Le.inspect(r,this.inspectOpts)}});var Is=N((cp,zr)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?zr.exports=vs():zr.exports=As()});var $e=N((hp,Bs)=>{Bs.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 Ms=N((dp,Rs)=>{Rs.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 qr=N((mp,Ds)=>{var pu=Ms();Ds.exports=r=>async t=>{t=pu(t);let e=C=>{typeof C.return=="function"&&C.return()},n=null,i=null,u=C=>{n=C,i&&i(C),e(t)},f=null,d=!1,g=()=>{d=!0,f&&f()},A=null,l=!1,w=()=>{l=!0,A&&A()},x=null,S=()=>{x&&x()},m=()=>new Promise((C,I)=>{f=x=C,i=I,r.once("drain",S)}),E=()=>(e(t),new Promise((C,I)=>{if(d||l||n)return C();A=f=C,i=I})),B=()=>{r.removeListener("error",u),r.removeListener("close",g),r.removeListener("finish",w),r.removeListener("drain",S)};r.once("error",u),r.once("close",g),r.once("finish",w);try{for await(let C of t){if(!r.writable||r.destroyed||n)break;r.write(C)===!1&&await m()}}catch(C){n||r.destroy(),n=C}try{if(r.writable&&r.end(),await E(),n)throw n}finally{B()}}});var Gr=N((gp,Ps)=>{var hu=qr(),du=$e();Ps.exports=r=>({sink:hu(r),source:du(r)})});var _s=N((bp,ks)=>{var mu=Gr();ks.exports=r=>async function*(t){let e=mu(r),n;if(e.sink(t).catch(i=>{n=i}),yield*e.source,n)throw n}});var Os=N((wp,re)=>{re.exports=$e();re.exports.source=$e();re.exports.sink=qr();re.exports.transform=_s();re.exports.duplex=Gr()});var Zr=N((ze,Ls)=>{(function(){var r,t=0xdeadbeefcafe,e=(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 u(s,o,a,c,p,h){for(;--h>=0;){var b=o*this[s++]+a[c]+p;p=Math.floor(b/67108864),a[c++]=b&67108863}return p}function f(s,o,a,c,p,h){for(var b=o&32767,y=o>>15;--h>=0;){var M=this[s]&32767,$=this[s++]>>15,it=y*M+$*b;M=b*M+((it&32767)<<15)+a[c]+(p&1073741823),p=(M>>>30)+(it>>>15)+y*$+(p>>>30),a[c++]=M&1073741823}return p}function d(s,o,a,c,p,h){for(var b=o&16383,y=o>>14;--h>=0;){var M=this[s]&16383,$=this[s++]>>14,it=y*M+$*b;M=b*M+((it&16383)<<14)+a[c]+p,p=(M>>28)+(it>>14)+y*$,a[c++]=M&268435455}return p}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=u,r=26):(n.prototype.am=d,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 l="0123456789abcdefghijklmnopqrstuvwxyz",w=new Array,x,S;for(x="0".charCodeAt(0),S=0;S<=9;++S)w[x++]=S;for(x="a".charCodeAt(0),S=10;S<36;++S)w[x++]=S;for(x="A".charCodeAt(0),S=10;S<36;++S)w[x++]=S;function m(s){return l.charAt(s)}function E(s,o){var a=w[s.charCodeAt(o)];return a??-1}function B(s){for(var o=this.t-1;o>=0;--o)s[o]=this[o];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 o=i();return o.fromInt(s),o}function O(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 c=s.length,p=!1,h=0;--c>=0;){var b=a==8?s[c]&255:E(s,c);if(b<0){s.charAt(c)=="-"&&(p=!0);continue}p=!1,h==0?this[this.t++]=b:h+a>this.DB?(this[this.t-1]|=(b&(1<<this.DB-h)-1)<<h,this[this.t++]=b>>this.DB-h):this[this.t-1]|=b<<h,h+=a,h>=this.DB&&(h-=this.DB)}a==8&&s[0]&128&&(this.s=-1,h>0&&(this[this.t-1]|=(1<<this.DB-h)-1<<h)),this.clamp(),p&&n.ZERO.subTo(this,this)}function F(){for(var s=this.s&this.DM;this.t>0&&this[this.t-1]==s;)--this.t}function tt(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,c,p=!1,h="",b=this.t,y=this.DB-b*this.DB%o;if(b-- >0)for(y<this.DB&&(c=this[b]>>y)>0&&(p=!0,h=m(c));b>=0;)y<o?(c=(this[b]&(1<<y)-1)<<o-y,c|=this[--b]>>(y+=this.DB-o)):(c=this[b]>>(y-=o)&a,y<=0&&(y+=this.DB,--b)),c>0&&(p=!0),p&&(h+=m(c));return p?h:"0"}function J(){var s=i();return n.ZERO.subTo(this,s),s}function W(){return this.s<0?this.negate():this}function Y(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 ut(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 eo(){return this.t<=0?0:this.DB*(this.t-1)+ut(this[this.t-1]^this.s&this.DM)}function ro(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 no(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 so(s,o){var a=s%this.DB,c=this.DB-a,p=(1<<c)-1,h=Math.floor(s/this.DB),b=this.s<<a&this.DM,y;for(y=this.t-1;y>=0;--y)o[y+h+1]=this[y]>>c|b,b=(this[y]&p)<<a;for(y=h-1;y>=0;--y)o[y]=0;o[h]=b,o.t=this.t+h+1,o.s=this.s,o.clamp()}function oo(s,o){o.s=this.s;var a=Math.floor(s/this.DB);if(a>=this.t){o.t=0;return}var c=s%this.DB,p=this.DB-c,h=(1<<c)-1;o[0]=this[a]>>c;for(var b=a+1;b<this.t;++b)o[b-a-1]|=(this[b]&h)<<p,o[b-a]=this[b]>>c;c>0&&(o[this.t-a-1]|=(this.s&h)<<p),o.t=this.t-a,o.clamp()}function io(s,o){for(var a=0,c=0,p=Math.min(s.t,this.t);a<p;)c+=this[a]-s[a],o[a++]=c&this.DM,c>>=this.DB;if(s.t<this.t){for(c-=s.s;a<this.t;)c+=this[a],o[a++]=c&this.DM,c>>=this.DB;c+=this.s}else{for(c+=this.s;a<s.t;)c-=s[a],o[a++]=c&this.DM,c>>=this.DB;c-=s.s}o.s=c<0?-1:0,c<-1?o[a++]=this.DV+c:c>0&&(o[a++]=c),o.t=a,o.clamp()}function ao(s,o){var a=this.abs(),c=s.abs(),p=a.t;for(o.t=p+c.t;--p>=0;)o[p]=0;for(p=0;p<c.t;++p)o[p+a.t]=a.am(0,c[p],o,p,0,a.t);o.s=0,o.clamp(),this.s!=s.s&&n.ZERO.subTo(o,o)}function co(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 c=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,c,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 uo(s,o,a){var c=s.abs();if(!(c.t<=0)){var p=this.abs();if(p.t<c.t){o?.fromInt(0),a!=null&&this.copyTo(a);return}a==null&&(a=i());var h=i(),b=this.s,y=s.s,M=this.DB-ut(c[c.t-1]);M>0?(c.lShiftTo(M,h),p.lShiftTo(M,a)):(c.copyTo(h),p.copyTo(a));var $=h.t,it=h[$-1];if(it!=0){var rt=it*(1<<this.F1)+($>1?h[$-2]>>this.F2:0),wt=this.FV/rt,xe=(1<<this.F1)/rt,lt=1<<this.F2,pt=a.t,Se=pt-$,At=o??i();for(h.dlShiftTo(Se,At),a.compareTo(At)>=0&&(a[a.t++]=1,a.subTo(At,a)),n.ONE.dlShiftTo($,At),At.subTo(h,h);h.t<$;)h[h.t++]=0;for(;--Se>=0;){var er=a[--pt]==it?this.DM:Math.floor(a[pt]*wt+(a[pt-1]+lt)*xe);if((a[pt]+=h.am(0,er,a,Se,0,$))<er)for(h.dlShiftTo(Se,At),a.subTo(At,a);a[pt]<--er;)a.subTo(At,a)}o!=null&&(a.drShiftTo($,o),b!=y&&n.ZERO.subTo(o,o)),a.t=$,a.clamp(),M>0&&a.rShiftTo(M,a),b<0&&n.ZERO.subTo(a,a)}}}function fo(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 Pt(s){this.m=s}function lo(s){return s.s<0||s.compareTo(this.m)>=0?s.mod(this.m):s}function po(s){return s}function ho(s){s.divRemTo(this.m,null,s)}function mo(s,o,a){s.multiplyTo(o,a),this.reduce(a)}function go(s,o){s.squareTo(o),this.reduce(o)}Pt.prototype.convert=lo,Pt.prototype.revert=po,Pt.prototype.reduce=ho,Pt.prototype.mulTo=mo,Pt.prototype.sqrTo=go;function bo(){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 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 wo(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 yo(s){var o=i();return s.copyTo(o),this.reduce(o),o}function vo(s){for(;s.t<=this.mt2;)s[s.t++]=0;for(var o=0;o<this.m.t;++o){var a=s[o]&32767,c=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,c,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 xo(s,o){s.squareTo(o),this.reduce(o)}function So(s,o,a){s.multiplyTo(o,a),this.reduce(a)}kt.prototype.convert=wo,kt.prototype.revert=yo,kt.prototype.reduce=vo,kt.prototype.mulTo=So,kt.prototype.sqrTo=xo;function To(){return(this.t>0?this[0]&1:this.s)==0}function Eo(s,o){if(s>4294967295||s<1)return n.ONE;var a=i(),c=i(),p=o.convert(this),h=ut(s)-1;for(p.copyTo(a);--h>=0;)if(o.sqrTo(a,c),(s&1<<h)>0)o.mulTo(c,p,a);else{var b=a;a=c,c=b}return o.revert(a)}function Co(s,o){var a;return s<256||o.isEven()?a=new Pt(o):a=new kt(o),this.exp(s,a)}n.prototype.copyTo=B,n.prototype.fromInt=C,n.prototype.fromString=O,n.prototype.clamp=F,n.prototype.dlShiftTo=ro,n.prototype.drShiftTo=no,n.prototype.lShiftTo=so,n.prototype.rShiftTo=oo,n.prototype.subTo=io,n.prototype.multiplyTo=ao,n.prototype.squareTo=co,n.prototype.divRemTo=uo,n.prototype.invDigit=bo,n.prototype.isEven=To,n.prototype.exp=Eo,n.prototype.toString=tt,n.prototype.negate=J,n.prototype.abs=W,n.prototype.compareTo=Y,n.prototype.bitLength=eo,n.prototype.mod=fo,n.prototype.modPowInt=Co,n.ZERO=I(0),n.ONE=I(1);function Ao(){var s=i();return this.copyTo(s),s}function Io(){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 Bo(){return this.t==0?this.s:this[0]<<24>>24}function Ro(){return this.t==0?this.s:this[0]<<16>>16}function Mo(s){return Math.floor(Math.LN2*this.DB/Math.log(s))}function Do(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function Po(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),c=I(a),p=i(),h=i(),b="";for(this.divRemTo(c,p,h);p.signum()>0;)b=(a+h.intValue()).toString(s).substr(1)+b,p.divRemTo(c,p,h);return h.intValue().toString(s)+b}function ko(s,o){this.fromInt(0),o==null&&(o=10);for(var a=this.chunkSize(o),c=Math.pow(o,a),p=!1,h=0,b=0,y=0;y<s.length;++y){var M=E(s,y);if(M<0){s.charAt(y)=="-"&&this.signum()==0&&(p=!0);continue}b=o*b+M,++h>=a&&(this.dMultiply(c),this.dAddOffset(b,0),h=0,b=0)}h>0&&(this.dMultiply(Math.pow(o,h)),this.dAddOffset(b,0)),p&&n.ZERO.subTo(this,this)}function _o(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),Ye,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 c=new Array,p=s&7;c.length=(s>>3)+1,o.nextBytes(c),p>0?c[0]&=(1<<p)-1:c[0]=0,this.fromString(c,256)}}function Oo(){var s=this.t,o=new Array;o[0]=this.s;var a=this.DB-s*this.DB%8,c,p=0;if(s-- >0)for(a<this.DB&&(c=this[s]>>a)!=(this.s&this.DM)>>a&&(o[p++]=c|this.s<<this.DB-a);s>=0;)a<8?(c=(this[s]&(1<<a)-1)<<8-a,c|=this[--s]>>(a+=this.DB-8)):(c=this[s]>>(a-=8)&255,a<=0&&(a+=this.DB,--s)),c&128&&(c|=-256),p==0&&(this.s&128)!=(c&128)&&++p,(p>0||c!=this.s)&&(o[p++]=c);return o}function Fo(s){return this.compareTo(s)==0}function No(s){return this.compareTo(s)<0?this:s}function Lo(s){return this.compareTo(s)>0?this:s}function Uo(s,o,a){var c,p,h=Math.min(s.t,this.t);for(c=0;c<h;++c)a[c]=o(this[c],s[c]);if(s.t<this.t){for(p=s.s&this.DM,c=h;c<this.t;++c)a[c]=o(this[c],p);a.t=this.t}else{for(p=this.s&this.DM,c=h;c<s.t;++c)a[c]=o(p,s[c]);a.t=s.t}a.s=o(this.s,s.s),a.clamp()}function $o(s,o){return s&o}function jo(s){var o=i();return this.bitwiseTo(s,$o,o),o}function Ye(s,o){return s|o}function Vo(s){var o=i();return this.bitwiseTo(s,Ye,o),o}function ln(s,o){return s^o}function zo(s){var o=i();return this.bitwiseTo(s,ln,o),o}function pn(s,o){return s&~o}function qo(s){var o=i();return this.bitwiseTo(s,pn,o),o}function Go(){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 Ho(s){var o=i();return s<0?this.rShiftTo(-s,o):this.lShiftTo(s,o),o}function Zo(s){var o=i();return s<0?this.lShiftTo(-s,o):this.rShiftTo(s,o),o}function Wo(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 Xo(){for(var s=0;s<this.t;++s)if(this[s]!=0)return s*this.DB+Wo(this[s]);return this.s<0?this.t*this.DB:-1}function Jo(s){for(var o=0;s!=0;)s&=s-1,++o;return o}function Yo(){for(var s=0,o=this.s&this.DM,a=0;a<this.t;++a)s+=Jo(this[a]^o);return s}function Qo(s){var o=Math.floor(s/this.DB);return o>=this.t?this.s!=0:(this[o]&1<<s%this.DB)!=0}function Ko(s,o){var a=n.ONE.shiftLeft(s);return this.bitwiseTo(a,o,a),a}function ti(s){return this.changeBit(s,Ye)}function ei(s){return this.changeBit(s,pn)}function ri(s){return this.changeBit(s,ln)}function ni(s,o){for(var a=0,c=0,p=Math.min(s.t,this.t);a<p;)c+=this[a]+s[a],o[a++]=c&this.DM,c>>=this.DB;if(s.t<this.t){for(c+=s.s;a<this.t;)c+=this[a],o[a++]=c&this.DM,c>>=this.DB;c+=this.s}else{for(c+=this.s;a<s.t;)c+=s[a],o[a++]=c&this.DM,c>>=this.DB;c+=s.s}o.s=c<0?-1:0,c>0?o[a++]=c:c<-1&&(o[a++]=this.DV+c),o.t=a,o.clamp()}function si(s){var o=i();return this.addTo(s,o),o}function oi(s){var o=i();return this.subTo(s,o),o}function ii(s){var o=i();return this.multiplyTo(s,o),o}function ai(){var s=i();return this.squareTo(s),s}function ci(s){var o=i();return this.divRemTo(s,o,null),o}function ui(s){var o=i();return this.divRemTo(s,null,o),o}function fi(s){var o=i(),a=i();return this.divRemTo(s,o,a),new Array(o,a)}function li(s){this[this.t]=this.am(0,s-1,this,0,0,this.t),++this.t,this.clamp()}function pi(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 ce(){}function hn(s){return s}function hi(s,o,a){s.multiplyTo(o,a)}function di(s,o){s.squareTo(o)}ce.prototype.convert=hn,ce.prototype.revert=hn,ce.prototype.mulTo=hi,ce.prototype.sqrTo=di;function mi(s){return this.exp(s,new ce)}function gi(s,o,a){var c=Math.min(this.t+s.t,o);for(a.s=0,a.t=c;c>0;)a[--c]=0;var p;for(p=a.t-this.t;c<p;++c)a[c+this.t]=this.am(0,s[c],a,c,0,this.t);for(p=Math.min(s.t,o);c<p;++c)this.am(0,s[c],a,c,0,o-c);a.clamp()}function bi(s,o,a){--o;var c=a.t=this.t+s.t-o;for(a.s=0;--c>=0;)a[c]=0;for(c=Math.max(o-this.t,0);c<s.t;++c)a[this.t+c-o]=this.am(o-c,s[c],a,0,0,this.t+c-o);a.clamp(),a.drShiftTo(1,a)}function _t(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 wi(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 yi(s){return s}function vi(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 xi(s,o){s.squareTo(o),this.reduce(o)}function Si(s,o,a){s.multiplyTo(o,a),this.reduce(a)}_t.prototype.convert=wi,_t.prototype.revert=yi,_t.prototype.reduce=vi,_t.prototype.mulTo=Si,_t.prototype.sqrTo=xi;function Ti(s,o){var a=s.bitLength(),c,p=I(1),h;if(a<=0)return p;a<18?c=1:a<48?c=3:a<144?c=4:a<768?c=5:c=6,a<8?h=new Pt(o):o.isEven()?h=new _t(o):h=new kt(o);var b=new Array,y=3,M=c-1,$=(1<<c)-1;if(b[1]=h.convert(this),c>1){var it=i();for(h.sqrTo(b[1],it);y<=$;)b[y]=i(),h.mulTo(it,b[y-2],b[y]),y+=2}var rt=s.t-1,wt,xe=!0,lt=i(),pt;for(a=ut(s[rt])-1;rt>=0;){for(a>=M?wt=s[rt]>>a-M&$:(wt=(s[rt]&(1<<a+1)-1)<<M-a,rt>0&&(wt|=s[rt-1]>>this.DB+a-M)),y=c;!(wt&1);)wt>>=1,--y;if((a-=y)<0&&(a+=this.DB,--rt),xe)b[wt].copyTo(p),xe=!1;else{for(;y>1;)h.sqrTo(p,lt),h.sqrTo(lt,p),y-=2;y>0?h.sqrTo(p,lt):(pt=p,p=lt,lt=pt),h.mulTo(lt,b[wt],p)}for(;rt>=0&&!(s[rt]&1<<a);)h.sqrTo(p,lt),pt=p,p=lt,lt=pt,--a<0&&(a=this.DB-1,--rt)}return h.revert(p)}function Ei(s){var o=this.s<0?this.negate():this.clone(),a=s.s<0?s.negate():s.clone();if(o.compareTo(a)<0){var c=o;o=a,a=c}var p=o.getLowestSetBit(),h=a.getLowestSetBit();if(h<0)return o;for(p<h&&(h=p),h>0&&(o.rShiftTo(h,o),a.rShiftTo(h,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 h>0&&a.lShiftTo(h,a),a}function Ci(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 c=this.t-1;c>=0;--c)a=(o*a+this[c])%s;return a}function Ai(s){var o=s.isEven();if(this.isEven()&&o||s.signum()==0)return n.ZERO;for(var a=s.clone(),c=this.clone(),p=I(1),h=I(0),b=I(0),y=I(1);a.signum()!=0;){for(;a.isEven();)a.rShiftTo(1,a),o?((!p.isEven()||!h.isEven())&&(p.addTo(this,p),h.subTo(s,h)),p.rShiftTo(1,p)):h.isEven()||h.subTo(s,h),h.rShiftTo(1,h);for(;c.isEven();)c.rShiftTo(1,c),o?((!b.isEven()||!y.isEven())&&(b.addTo(this,b),y.subTo(s,y)),b.rShiftTo(1,b)):y.isEven()||y.subTo(s,y),y.rShiftTo(1,y);a.compareTo(c)>=0?(a.subTo(c,a),o&&p.subTo(b,p),h.subTo(y,h)):(c.subTo(a,c),o&&b.subTo(p,b),y.subTo(h,y))}if(c.compareTo(n.ONE)!=0)return n.ZERO;if(y.compareTo(s)>=0)return y.subtract(s);if(y.signum()<0)y.addTo(s,y);else return y;return y.signum()<0?y.add(s):y}var X=[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],Ii=(1<<26)/X[X.length-1];function Bi(s){var o,a=this.abs();if(a.t==1&&a[0]<=X[X.length-1]){for(o=0;o<X.length;++o)if(a[0]==X[o])return!0;return!1}if(a.isEven())return!1;for(o=1;o<X.length;){for(var c=X[o],p=o+1;p<X.length&&c<Ii;)c*=X[p++];for(c=a.modInt(c);o<p;)if(c%X[o++]==0)return!1}return a.millerRabin(s)}function Ri(s){var o=this.subtract(n.ONE),a=o.getLowestSetBit();if(a<=0)return!1;var c=o.shiftRight(a);s=s+1>>1,s>X.length&&(s=X.length);for(var p=i(),h=0;h<s;++h){p.fromInt(X[Math.floor(Math.random()*X.length)]);var b=p.modPow(c,this);if(b.compareTo(n.ONE)!=0&&b.compareTo(o)!=0){for(var y=1;y++<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=Mo,n.prototype.toRadix=Po,n.prototype.fromRadix=ko,n.prototype.fromNumber=_o,n.prototype.bitwiseTo=Uo,n.prototype.changeBit=Ko,n.prototype.addTo=ni,n.prototype.dMultiply=li,n.prototype.dAddOffset=pi,n.prototype.multiplyLowerTo=gi,n.prototype.multiplyUpperTo=bi,n.prototype.modInt=Ci,n.prototype.millerRabin=Ri,n.prototype.clone=Ao,n.prototype.intValue=Io,n.prototype.byteValue=Bo,n.prototype.shortValue=Ro,n.prototype.signum=Do,n.prototype.toByteArray=Oo,n.prototype.equals=Fo,n.prototype.min=No,n.prototype.max=Lo,n.prototype.and=jo,n.prototype.or=Vo,n.prototype.xor=zo,n.prototype.andNot=qo,n.prototype.not=Go,n.prototype.shiftLeft=Ho,n.prototype.shiftRight=Zo,n.prototype.getLowestSetBit=Xo,n.prototype.bitCount=Yo,n.prototype.testBit=Qo,n.prototype.setBit=ti,n.prototype.clearBit=ei,n.prototype.flipBit=ri,n.prototype.add=si,n.prototype.subtract=oi,n.prototype.multiply=ii,n.prototype.divide=ci,n.prototype.remainder=ui,n.prototype.divideAndRemainder=fi,n.prototype.modPow=Ti,n.prototype.modInverse=Ai,n.prototype.pow=mi,n.prototype.gcd=Ei,n.prototype.isProbablePrime=Bi,n.prototype.square=ai,n.prototype.Barrett=_t;var ve,et,U;function Mi(s){et[U++]^=s&255,et[U++]^=s>>8&255,et[U++]^=s>>16&255,et[U++]^=s>>24&255,U>=tr&&(U-=tr)}function dn(){Mi(new Date().getTime())}if(et==null){et=new Array,U=0;var ft;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var mn=new Uint8Array(32);for(window.crypto.getRandomValues(mn),ft=0;ft<32;++ft)et[U++]=mn[ft]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var gn=window.crypto.random(32);for(ft=0;ft<gn.length;++ft)et[U++]=gn.charCodeAt(ft)&255}}for(;U<tr;)ft=Math.floor(65536*Math.random()),et[U++]=ft>>>8,et[U++]=ft&255;U=0,dn()}function Di(){if(ve==null){for(dn(),ve=Oi(),ve.init(et),U=0;U<et.length;++U)et[U]=0;U=0}return ve.next()}function Pi(s){var o;for(o=0;o<s.length;++o)s[o]=Di()}function Qe(){}Qe.prototype.nextBytes=Pi;function Ke(){this.i=0,this.j=0,this.S=new Array}function ki(s){var o,a,c;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,c=this.S[o],this.S[o]=this.S[a],this.S[a]=c;this.i=0,this.j=0}function _i(){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]}Ke.prototype.init=ki,Ke.prototype.next=_i;function Oi(){return new Ke}var tr=256;typeof ze<"u"?ze=Ls.exports={default:n,BigInteger:n,SecureRandom:Qe}:this.jsbn={BigInteger:n,SecureRandom:Qe}}).call(ze)});var ye=N(qe=>{(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(u(f),arguments)}function e(f,d){return t.apply(null,[f].concat(d||[]))}function n(f,d){var g=1,A=f.length,l,w="",x,S,m,E,B,C,I,O;for(x=0;x<A;x++)if(typeof f[x]=="string")w+=f[x];else if(typeof f[x]=="object"){if(m=f[x],m.keys)for(l=d[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=d[m.param_no]:l=d[g++];if(r.not_type.test(m.type)&&r.not_primitive.test(m.type)&&l instanceof Function&&(l=l()),r.numeric_arg.test(m.type)&&typeof l!="number"&&isNaN(l))throw new TypeError(t("[sprintf] expecting number but found %T",l));switch(r.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}r.json.test(m.type)?w+=l:(r.number.test(m.type)&&(!I||m.sign)?(O=I?"+":"-",l=l.toString().replace(r.sign,"")):O="",B=m.pad_char?m.pad_char==="0"?"0":m.pad_char.charAt(1):" ",C=m.width-(O+l).length,E=m.width&&C>0?B.repeat(C):"",w+=m.align?O+l+E:B==="0"?O+E+l:E+O+l)}return w}var i=Object.create(null);function u(f){if(i[f])return i[f];for(var d=f,g,A=[],l=0;d;){if((g=r.text.exec(d))!==null)A.push(g[0]);else if((g=r.modulo.exec(d))!==null)A.push("%");else if((g=r.placeholder.exec(d))!==null){if(g[2]){l|=1;var w=[],x=g[2],S=[];if((S=r.key.exec(x))!==null)for(w.push(S[1]);(x=x.substring(S[0].length))!=="";)if((S=r.key_access.exec(x))!==null)w.push(S[1]);else if((S=r.index_access.exec(x))!==null)w.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]=w}else l|=2;if(l===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");d=d.substring(g[0].length)}return i[f]=A}typeof qe<"u"&&(qe.sprintf=t,qe.vsprintf=e),typeof window<"u"&&(window.sprintf=t,window.vsprintf=e,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:e}}))})()});var Pu={};nt(Pu,{tcp:()=>Du});var to=V(yt("net"),1);var It=yt("node:net");function Ee(r){return!!(0,It.isIP)(r)}var ir={};nt(ir,{identity:()=>Zi});function Vi(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 i=0;i<r.length;i++){var u=r.charAt(i),f=u.charCodeAt(0);if(e[f]!==255)throw new TypeError(u+" is ambiguous");e[f]=i}var d=r.length,g=r.charAt(0),A=Math.log(d)/Math.log(256),l=Math.log(256)/Math.log(d);function w(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 E=0,B=0,C=0,I=m.length;C!==I&&m[C]===0;)C++,E++;for(var O=(I-C)*l+1>>>0,F=new Uint8Array(O);C!==I;){for(var tt=m[C],J=0,W=O-1;(tt!==0||J<B)&&W!==-1;W--,J++)tt+=256*F[W]>>>0,F[W]=tt%d>>>0,tt=tt/d>>>0;if(tt!==0)throw new Error("Non-zero carry");B=J,C++}for(var Y=O-B;Y!==O&&F[Y]===0;)Y++;for(var ut=g.repeat(E);Y<O;++Y)ut+=r.charAt(F[Y]);return ut}function x(m){if(typeof m!="string")throw new TypeError("Expected String");if(m.length===0)return new Uint8Array;var E=0;if(m[E]!==" "){for(var B=0,C=0;m[E]===g;)B++,E++;for(var I=(m.length-E)*A+1>>>0,O=new Uint8Array(I);m[E];){var F=e[m.charCodeAt(E)];if(F===255)return;for(var tt=0,J=I-1;(F!==0||tt<C)&&J!==-1;J--,tt++)F+=d*O[J]>>>0,O[J]=F%256>>>0,F=F/256>>>0;if(F!==0)throw new Error("Non-zero carry");C=tt,E++}if(m[E]!==" "){for(var W=I-C;W!==I&&O[W]===0;)W++;for(var Y=new Uint8Array(B+(I-W)),ut=B;W!==I;)Y[ut++]=O[W++];return Y}}}function S(m){var E=x(m);if(E)return E;throw new Error(`Non-${t} character`)}return{encode:w,decodeUnsafe:x,decode:S}}var zi=Vi,qi=zi,wn=qi;var Fu=new Uint8Array(0);var yn=(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 vn=r=>new TextEncoder().encode(r),xn=r=>new TextDecoder().decode(r);var rr=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")}},nr=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 Tn(this,t)}},sr=class{constructor(t){this.decoders=t}or(t){return Tn(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`)}},Tn=(r,t)=>new sr({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),or=class{constructor(t,e,n,i){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=i,this.encoder=new rr(t,e,n),this.decoder=new nr(t,e,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},Vt=({name:r,prefix:t,encode:e,decode:n})=>new or(r,t,e,n),Bt=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:i}=wn(e,t);return Vt({prefix:r,name:t,encode:n,decode:u=>at(i(u))})},Gi=(r,t,e,n)=>{let i={};for(let l=0;l<t.length;++l)i[t[l]]=l;let u=r.length;for(;r[u-1]==="=";)--u;let f=new Uint8Array(u*e/8|0),d=0,g=0,A=0;for(let l=0;l<u;++l){let w=i[r[l]];if(w===void 0)throw new SyntaxError(`Non-${n} character`);g=g<<e|w,d+=e,d>=8&&(d-=8,f[A++]=255&g>>d)}if(d>=e||255&g<<8-d)throw new SyntaxError("Unexpected end of data");return f},Hi=(r,t,e)=>{let n=t[t.length-1]==="=",i=(1<<e)-1,u="",f=0,d=0;for(let g=0;g<r.length;++g)for(d=d<<8|r[g],f+=8;f>e;)f-=e,u+=t[i&d>>f];if(f&&(u+=t[i&d<<e-f]),n)for(;u.length*e&7;)u+="=";return u},k=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>Vt({prefix:t,name:r,encode(i){return Hi(i,n,e)},decode(i){return Gi(i,n,e,r)}});var Zi=Vt({prefix:"\0",name:"identity",encode:r=>xn(r),decode:r=>vn(r)});var ar={};nt(ar,{base2:()=>Wi});var Wi=k({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var cr={};nt(cr,{base8:()=>Xi});var Xi=k({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ur={};nt(ur,{base10:()=>Ji});var Ji=Bt({prefix:"9",name:"base10",alphabet:"0123456789"});var fr={};nt(fr,{base16:()=>Yi,base16upper:()=>Qi});var Yi=k({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Qi=k({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var lr={};nt(lr,{base32:()=>ht,base32hex:()=>ra,base32hexpad:()=>sa,base32hexpadupper:()=>oa,base32hexupper:()=>na,base32pad:()=>ta,base32padupper:()=>ea,base32upper:()=>Ki,base32z:()=>ia});var ht=k({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ki=k({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ta=k({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ea=k({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ra=k({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),na=k({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),sa=k({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),oa=k({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ia=k({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var pr={};nt(pr,{base36:()=>aa,base36upper:()=>ca});var aa=Bt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ca=Bt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var hr={};nt(hr,{base58btc:()=>z,base58flickr:()=>ua});var z=Bt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ua=Bt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var mr={};nt(mr,{base64:()=>dr,base64pad:()=>fa,base64url:()=>la,base64urlpad:()=>pa});var dr=k({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),fa=k({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),la=k({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),pa=k({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var gr={};nt(gr,{base256emoji:()=>ba});var En=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}"),ha=En.reduce((r,t,e)=>(r[e]=t,r),[]),da=En.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function ma(r){return r.reduce((t,e)=>(t+=ha[e],t),"")}function ga(r){let t=[];for(let e of r){let n=da[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var ba=Vt({prefix:"\u{1F680}",name:"base256emoji",encode:ma,decode:ga});var xr={};nt(xr,{sha256:()=>Fa,sha512:()=>Na});var vr=V(yt("crypto"),1);var wa=In,Cn=128,ya=127,va=~ya,xa=Math.pow(2,31);function In(r,t,e){t=t||[],e=e||0;for(var n=e;r>=xa;)t[e++]=r&255|Cn,r/=128;for(;r&va;)t[e++]=r&255|Cn,r>>>=7;return t[e]=r|0,In.bytes=e-n+1,t}var Sa=br,Ta=128,An=127;function br(r,n){var e=0,n=n||0,i=0,u=n,f,d=r.length;do{if(u>=d)throw br.bytes=0,new RangeError("Could not decode varint");f=r[u++],e+=i<28?(f&An)<<i:(f&An)*Math.pow(2,i),i+=7}while(f>=Ta);return br.bytes=u-n,e}var Ea=Math.pow(2,7),Ca=Math.pow(2,14),Aa=Math.pow(2,21),Ia=Math.pow(2,28),Ba=Math.pow(2,35),Ra=Math.pow(2,42),Ma=Math.pow(2,49),Da=Math.pow(2,56),Pa=Math.pow(2,63),ka=function(r){return r<Ea?1:r<Ca?2:r<Aa?3:r<Ia?4:r<Ba?5:r<Ra?6:r<Ma?7:r<Da?8:r<Pa?9:10},_a={encode:wa,decode:Sa,encodingLength:ka},Oa=_a,ue=Oa;var fe=(r,t=0)=>[ue.decode(r,t),ue.decode.bytes],zt=(r,t,e=0)=>(ue.encode(r,t,e),t),qt=r=>ue.encodingLength(r);var Ot=(r,t)=>{let e=t.byteLength,n=qt(r),i=n+qt(e),u=new Uint8Array(i+e);return zt(r,u,0),zt(e,u,n),u.set(t,i),new Gt(r,e,t,u)},Ae=r=>{let t=at(r),[e,n]=fe(t),[i,u]=fe(t.subarray(n)),f=t.subarray(n+u);if(f.byteLength!==i)throw new Error("Incorrect length");return new Gt(e,i,f,t)},Bn=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&yn(r.bytes,e.bytes)}},Gt=class{constructor(t,e,n,i){this.code=t,this.size=e,this.digest=n,this.bytes=i}};var yr=({name:r,code:t,encode:e})=>new wr(r,t,e),wr=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?Ot(this.code,e):e.then(n=>Ot(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Fa=yr({name:"sha2-256",code:18,encode:r=>at(vr.default.createHash("sha256").update(r).digest())}),Na=yr({name:"sha2-512",code:19,encode:r=>at(vr.default.createHash("sha512").update(r).digest())});var Sr={};nt(Sr,{identity:()=>$a});var Mn=0,La="identity",Dn=at,Ua=r=>Ot(Mn,Dn(r)),$a={code:Mn,name:La,encode:Dn,digest:Ua};var sf=new TextEncoder,of=new TextDecoder;var Pn=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return qa(e,Tr(r),t||z.encoder);default:return Ga(e,Tr(r),t||ht.encoder)}};var kn=new WeakMap,Tr=r=>{let t=kn.get(r);if(t==null){let e=new Map;return kn.set(r,e),e}return t},D=class{constructor(t,e,n,i){this.code=e,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:e}=this;if(t!==le)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Ha)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return D.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=Ot(t,e);return D.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 D.equals(this,t)}static equals(t,e){let n=e;return n&&t.code===n.code&&t.version===n.version&&Bn(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 e=t;if(e instanceof D)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:i,multihash:u,bytes:f}=e;return new D(n,i,u,f||_n(n,i,u.bytes))}else if(e[Za]===!0){let{version:n,multihash:i,code:u}=e,f=Ae(i);return D.create(n,u,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!==le)throw new Error(`Version 0 CID must use dag-pb (code: ${le}) block encoding`);return new D(t,e,n,n.bytes)}case 1:{let i=_n(t,e,n.bytes);return new D(t,e,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return D.create(0,le,t)}static createV1(t,e){return D.create(1,t,e)}static decode(t){let[e,n]=D.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=D.inspectBytes(t),n=e.size-e.multihashSize,i=at(t.subarray(n,n+e.multihashSize));if(i.byteLength!==e.multihashSize)throw new Error("Incorrect length");let u=i.subarray(e.multihashSize-e.digestSize),f=new Gt(e.multihashCode,e.digestSize,u,i);return[e.version===0?D.createV0(f):D.createV1(e.codec,f),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[w,x]=fe(t.subarray(e));return e+=x,w},i=n(),u=le;if(i===18?(i=0,e=0):u=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let f=e,d=n(),g=n(),A=e+g,l=A-f;return{version:i,codec:u,multihashCode:d,digestSize:g,multihashSize:l,size:A}}static parse(t,e){let[n,i]=za(t,e),u=D.decode(i);if(u.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Tr(u).set(n,t),u}},za=(r,t)=>{switch(r[0]){case"Q":{let e=t||z;return[z.prefix,e.decode(`${z.prefix}${r}`)]}case z.prefix:{let e=t||z;return[z.prefix,e.decode(r)]}case ht.prefix:{let e=t||ht;return[ht.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)]}}},qa=(r,t,e)=>{let{prefix:n}=e;if(n!==z.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let i=t.get(n);if(i==null){let u=e.encode(r).slice(1);return t.set(n,u),u}else return i},Ga=(r,t,e)=>{let{prefix:n}=e,i=t.get(n);if(i==null){let u=e.encode(r);return t.set(n,u),u}else return i},le=112,Ha=18,_n=(r,t,e)=>{let n=qt(r),i=n+qt(t),u=new Uint8Array(i+e.byteLength);return zt(r,u,0),zt(t,u,n),u.set(e,i),u},Za=Symbol.for("@ipld/js-cid/CID");var pe={...ir,...ar,...cr,...ur,...fr,...lr,...pr,...hr,...mr,...gr},gf={...xr,...Sr};function Zt(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Ie(r=0){return globalThis.Buffer?.allocUnsafe!=null?Zt(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Fn(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var On=Fn("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Er=Fn("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=Ie(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Wa={utf8:On,"utf-8":On,hex:pe.base16,latin1:Er,ascii:Er,binary:Er,...pe},Be=Wa;function Q(r,t="utf8"){let e=Be[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)}var Nn=It.isIPv4,Xa=It.isIPv6,Cr=function(r){let t=0;if(r=r.toString().trim(),Nn(r)){let e=new Uint8Array(t+4);return r.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(Xa(r)){let e=r.split(":",8),n;for(n=0;n<e.length;n++){let u=Nn(e[n]),f;u&&(f=Cr(e[n]),e[n]=Q(f.slice(0,2),"base16")),f!=null&&++n<8&&e.splice(n,0,Q(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 u=[n,1];for(n=9-e.length;n>0;n--)u.push("0");e.splice.apply(e,u)}let i=new Uint8Array(t+16);for(n=0;n<e.length;n++){let u=parseInt(e[n],16);i[t++]=u>>8&255,i[t++]=u&255}return i}throw new Error("invalid ip address")},Ln=function(r,t=0,e){t=~~t,e=e??r.length-t;let n=new DataView(r.buffer);if(e===4){let i=[];for(let u=0;u<e;u++)i.push(r[t+u]);return i.join(".")}if(e===16){let i=[];for(let u=0;u<e;u+=2)i.push(n.getUint16(t+u).toString(16));return i.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var he={},Ar={},Ya=[[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"]];Ya.forEach(r=>{let t=Qa(...r);Ar[t.code]=t,he[t.name]=t});function Qa(r,t,e,n,i){return{code:r,size:t,name:e,resolvable:!!n,path:!!i}}function R(r){if(typeof r=="number"){if(Ar[r]!=null)return Ar[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(he[r]!=null)return he[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var gt=V(Re(),1);function Rr(r,t="utf8"){let e=Be[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Zt(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}function vt(r,t){t==null&&(t=r.reduce((i,u)=>i+u.length,0));let e=Ie(t),n=0;for(let i of r)e.set(i,n),n+=i.length;return Zt(e)}var Me=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,i){return this.readAtomically(()=>{let u=0,f=0,d=this.peekChar();if(d===void 0)return;let g=d==="0",A=2**(8*i)-1;for(;;){let l=this.readAtomically(()=>{let w=this.readChar();if(w===void 0)return;let x=Number.parseInt(w,t);if(!Number.isNaN(x))return x});if(l===void 0)break;if(u*=t,u+=l,u>A||(f+=1,e!==void 0&&f>e))return}if(f!==0)return!n&&g&&f>1?void 0:u})}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 i=n*2;if(n<e.length-3){let f=this.readSeparator(":",n,()=>this.readIPv4Addr());if(f!==void 0)return e[i]=f[0],e[i+1]=f[1],e[i+2]=f[2],e[i+3]=f[3],[i+4,!0]}let u=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(u===void 0)return[i,!1];e[i]=u>>8,e[i+1]=u&255}return[e.length,!1]};return this.readAtomically(()=>{let e=new Uint8Array(16),[n,i]=t(e);if(n===16)return e;if(i||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let u=new Uint8Array(14),f=16-(n+2),[d]=t(u.subarray(0,f));return e.set(u.subarray(0,d),16-d),e})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Vf=new Me;var Jf=parseInt("0xFFFF",16),Yf=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var Ml=R("ip4"),Dl=R("ip6"),Pl=R("ipcidr");function ts(r,t){switch(R(r).code){case 4:case 41:return wc(t);case 42:return Qn(t);case 6:case 273:case 33:case 132:return rs(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Qn(t);case 421:return Sc(t);case 444:return Kn(t);case 445:return Kn(t);case 466:return xc(t);default:return Q(t,"base16")}}function es(r,t){switch(R(r).code){case 4:return Jn(t);case 41:return Jn(t);case 42:return Yn(t);case 6:case 273:case 33:case 132:return Dr(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Yn(t);case 421:return yc(t);case 444:return Tc(t);case 445:return Ec(t);case 466:return vc(t);default:return Rr(t,"base16")}}var Mr=Object.values(pe).map(r=>r.decoder),bc=function(){let r=Mr[0].or(Mr[1]);return Mr.slice(2).forEach(t=>r=r.or(t)),r}();function Jn(r){if(!Ee(r))throw new Error("invalid ip address");return Cr(r)}function wc(r){let t=Ln(r,0,r.length);if(t==null)throw new Error("ipBuff is required");if(!Ee(t))throw new Error("invalid ip address");return t}function Dr(r){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,r),new Uint8Array(t)}function rs(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Yn(r){let t=Rr(r),e=Uint8Array.from(gt.default.encode(t.length));return vt([e,t],e.length+t.length)}function Qn(r){let t=gt.default.decode(r);if(r=r.slice(gt.default.decode.bytes),r.length!==t)throw new Error("inconsistent lengths");return Q(r)}function yc(r){let t;r[0]==="Q"||r[0]==="1"?t=Ae(z.decode(`z${r}`)).bytes:t=D.parse(r).multihash.bytes;let e=Uint8Array.from(gt.default.encode(t.length));return vt([e,t],e.length+t.length)}function vc(r){let t=bc.decode(r),e=Uint8Array.from(gt.default.encode(t.length));return vt([e,t],e.length+t.length)}function xc(r){let t=gt.default.decode(r),e=r.slice(gt.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return"u"+Q(e,"base64url")}function Sc(r){let t=gt.default.decode(r),e=r.slice(gt.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return Q(e,"base58btc")}function Tc(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=ht.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=Dr(n);return vt([e,i],e.length+i.length)}function Ec(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=ht.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=Dr(n);return vt([e,i],e.length+i.length)}function Kn(r){let t=r.slice(0,r.length-2),e=r.slice(r.length-2),n=Q(t,"base32"),i=rs(e);return`${n}:${i}`}var Wt=V(Re(),1);function Cc(r){let t=[],e=r.split("/").slice(1);if(e.length===1&&e[0]==="")return[];for(let n=0;n<e.length;n++){let i=e[n],u=R(i);if(u.size===0){t.push([i]);continue}if(n++,n>=e.length)throw ss("invalid address: "+r);if(u.path===!0){t.push([i,Fr(e.slice(n).join("/"))]);break}t.push([i,e[n]])}return t}function Ac(r){let t=[];return r.map(e=>{let n=ke(e);return t.push(n.name),e.length>1&&e[1]!=null&&t.push(e[1]),null}),Fr(t.join("/"))}function Ic(r){return r.map(t=>{Array.isArray(t)||(t=[t]);let e=ke(t);return t.length>1?[e.code,es(e.code,t[1])]:[e.code]})}function Pr(r){return r.map(t=>{let e=ke(t);return t[1]!=null?[e.code,ts(e.code,t[1])]:[e.code]})}function kr(r){return Pe(vt(r.map(t=>{let e=ke(t),n=Uint8Array.from(Wt.default.encode(e.code));return t.length>1&&t[1]!=null&&(n=vt([n,t[1]])),n})))}function _r(r,t){return r.size>0?r.size/8:r.size===0?0:Wt.default.decode(t)+(Wt.default.decode.bytes??0)}function De(r){let t=[],e=0;for(;e<r.length;){let n=Wt.default.decode(r,e),i=Wt.default.decode.bytes??0,u=R(n),f=_r(u,r.slice(e+i));if(f===0){t.push([n]),e+=i;continue}let d=r.slice(e+i,e+i+f);if(e+=f+i,e>r.length)throw ss("Invalid address Uint8Array: "+Q(r,"base16"));t.push([n,d])}return t}function Or(r){let t=De(r),e=Pr(t);return Ac(e)}function Bc(r){r=Fr(r);let t=Cc(r),e=Ic(t);return kr(e)}function ns(r){return Bc(r)}function Pe(r){let t=Rc(r);if(t!=null)throw t;return Uint8Array.from(r)}function Rc(r){try{De(r)}catch(t){return t}}function Fr(r){return"/"+r.trim().split("/").filter(t=>t).join("/")}function ss(r){return new Error("Error parsing address: "+r)}function ke(r){return R(r[0])}var Lr=V(Re(),1);var xt=class extends Error{constructor(t="The operation was aborted"){super(t),this.code=xt.code,this.type=xt.type}static get code(){return"ABORT_ERR"}static get type(){return"aborted"}},K=class extends Error{constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};function os(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 Xt=function(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)},Nr=function(r,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!i:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,e):i?i.value=e:t.set(r,e),e},de,me,ge,is,Dc=Symbol.for("nodejs.util.inspect.custom"),Pc=[R("dns").code,R("dns4").code,R("dns6").code,R("dnsaddr").code],kc=new Map,as=Symbol.for("@multiformats/js-multiaddr/multiaddr");function _c(r){return!!r?.[as]}var St=class{constructor(t){if(de.set(this,void 0),me.set(this,void 0),ge.set(this,void 0),this[is]=!0,t==null&&(t=""),t instanceof Uint8Array)this.bytes=Pe(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);this.bytes=ns(t)}else if(_c(t))this.bytes=Pe(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return Xt(this,de,"f")==null&&Nr(this,de,Or(this.bytes),"f"),Xt(this,de,"f")}toJSON(){return this.toString()}toOptions(){let t,e,n,i,u="",f=R("tcp"),d=R("udp"),g=R("ip4"),A=R("ip6"),l=R("dns6"),w=R("ip6zone");for(let[S,m]of this.stringTuples())S===w.code&&(u=`%${m??""}`),Pc.includes(S)&&(e=f.name,i=443,n=`${m??""}${u}`,t=S===l.code?6:4),(S===f.code||S===d.code)&&(e=R(S).name,i=parseInt(m??"")),(S===g.code||S===A.code)&&(e=R(S).name,n=`${m??""}${u}`,t=S===A.code?6:4);if(t==null||e==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:e,port:i}}protos(){return this.protoCodes().map(t=>Object.assign({},R(t)))}protoCodes(){let t=[],e=this.bytes,n=0;for(;n<e.length;){let i=Lr.default.decode(e,n),u=Lr.default.decode.bytes??0,f=R(i),d=_r(f,e.slice(n+u));n+=d+u,t.push(i)}return t}protoNames(){return this.protos().map(t=>t.name)}tuples(){return Xt(this,me,"f")==null&&Nr(this,me,De(this.bytes),"f"),Xt(this,me,"f")}stringTuples(){return Xt(this,ge,"f")==null&&Nr(this,ge,Pr(this.tuples()),"f"),Xt(this,ge,"f")}encapsulate(t){return t=new St(t),new St(this.toString()+t.toString())}decapsulate(t){let e=t.toString(),n=this.toString(),i=n.lastIndexOf(e);if(i<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new St(n.slice(0,i))}decapsulateCode(t){let e=this.tuples();for(let n=e.length-1;n>=0;n--)if(e[n][0]===t)return new St(kr(e.slice(0,n)));return this}getPeerId(){try{let e=this.stringTuples().filter(n=>n[0]===he.ipfs.code).pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?Q(z.decode(`z${n}`),"base58btc"):Q(D.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){let t=null;try{t=this.stringTuples().filter(e=>R(e[0]).path===!0)[0][1],t==null&&(t=null)}catch{t=null}return t}equals(t){return os(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(u=>u.resolvable);if(e==null)return[this];let n=kc.get(e.name);if(n==null)throw new K(`no available resolver for ${e.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(u=>new St(u))}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)}[(de=new WeakMap,me=new WeakMap,ge=new WeakMap,is=as,Dc)](){return`Multiaddr(${Or(this.bytes)})`}};function bt(r){return new St(r)}var Oc=v("dns4"),Fc=v("dns6"),Nc=v("dnsaddr"),Ft=L(v("dns"),Nc,Oc,Fc),_e=L(v("ip4"),v("ip6")),Mt=L(T(_e,v("tcp")),T(Ft,v("tcp"))),Oe=T(_e,v("udp")),Lc=T(Oe,v("utp")),Uc=T(Oe,v("quic")),$c=T(Oe,v("quic-v1")),be=L(T(Mt,v("ws")),T(Ft,v("ws"))),we=L(T(Mt,v("wss")),T(Ft,v("wss")),T(Mt,v("tls"),v("ws")),T(Ft,v("tls"),v("ws"))),Ur=L(T(Mt,v("http")),T(_e,v("http")),T(Ft,v("http"))),$r=L(T(Mt,v("https")),T(_e,v("https")),T(Ft,v("https"))),cs=T(Oe,v("webrtc-direct"),v("certhash")),ls=L(T(cs,v("p2p")),cs),us=T($c,v("webtransport"),v("certhash"),v("certhash")),ps=L(T(us,v("p2p")),us),hs=L(T(be,v("p2p-webrtc-star"),v("p2p")),T(we,v("p2p-webrtc-star"),v("p2p")),T(be,v("p2p-webrtc-star")),T(we,v("p2p-webrtc-star"))),tp=L(T(be,v("p2p-websocket-star"),v("p2p")),T(we,v("p2p-websocket-star"),v("p2p")),T(be,v("p2p-websocket-star")),T(we,v("p2p-websocket-star"))),ds=L(T(Ur,v("p2p-webrtc-direct"),v("p2p")),T($r,v("p2p-webrtc-direct"),v("p2p")),T(Ur,v("p2p-webrtc-direct")),T($r,v("p2p-webrtc-direct"))),Yt=L(be,we,Ur,$r,hs,ds,Mt,Lc,Uc,Ft,ls,ps),ep=L(T(Yt,v("p2p-stardust"),v("p2p")),T(Yt,v("p2p-stardust"))),Rt=L(T(Yt,v("p2p")),hs,ds,ls,ps,v("p2p")),fs=L(T(Rt,v("p2p-circuit"),Rt),T(Rt,v("p2p-circuit")),T(v("p2p-circuit"),Rt),T(Yt,v("p2p-circuit")),T(v("p2p-circuit"),Yt),v("p2p-circuit")),ms=()=>L(T(fs,ms),fs),Jt=ms(),rp=L(T(Jt,Rt,Jt),T(Rt,Jt),T(Jt,Rt),Jt,Rt);var np=L(T(Jt,v("webrtc")),T(Yt,v("webrtc")),v("webrtc"));function gs(r){function t(e){let n;try{n=bt(e)}catch{return!1}let i=r(n.protoNames());return i===null?!1:i===!0||i===!1?i:i.length===0}return t}function T(...r){function t(e){if(e.length<r.length)return null;let n=e;return r.some(i=>(n=typeof i=="function"?i().partialMatch(e):i.partialMatch(e),Array.isArray(n)&&(e=n),n===null)),n}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:gs(t),partialMatch:t}}function L(...r){function t(n){let i=null;return r.some(u=>{let f=typeof u=="function"?u().partialMatch(n):u.partialMatch(n);return f!=null?(i=f,!0):!1}),i}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:gs(t),partialMatch:t}}function v(r){let t=r;function e(i){let u;try{u=bt(i)}catch{return!1}let f=u.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:e,partialMatch:n}}var ct=V(Is(),1);ct.default.formatters.b=r=>r==null?"undefined":z.baseEncode(r);ct.default.formatters.t=r=>r==null?"undefined":ht.baseEncode(r);ct.default.formatters.m=r=>r==null?"undefined":dr.baseEncode(r);ct.default.formatters.p=r=>r==null?"undefined":r.toString();ct.default.formatters.c=r=>r==null?"undefined":r.toString();ct.default.formatters.k=r=>r==null?"undefined":r.toString();function lu(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 Dt(r){let t=lu(`${r}:trace`);return ct.default.enabled(`${r}:trace`)&&ct.default.names.map(e=>e.toString()).find(e=>e.includes(":trace"))!=null&&(t=(0,ct.default)(`${r}:trace`)),Object.assign((0,ct.default)(r),{error:(0,ct.default)(`${r}:error`),trace:t})}var Js=V(Os(),1);function je(r){return this.subnetMask<r.subnetMask?!1:this.mask(r.subnetMask)===r.mask()}function Ve(r){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===r&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}var ne=/^(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,Hr=/\/\d{1,2}$/;var G=class extends Error{constructor(t,e){super(t),this.name="AddressError",e!==null&&(this.parseMessage=e)}};var se=V(Zr(),1),Lt=V(ye(),1),P=class{constructor(t){this.groups=4,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=Ve(32),this.isInSubnet=je,this.address=t;let e=Hr.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 G("Invalid subnet mask.");t=t.replace(Hr,"")}this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}static isValid(t){try{return new P(t),!0}catch{return!1}}parse(t){let e=t.split(".");if(!t.match(ne))throw new G("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=[],i;for(i=0;i<8;i+=2){let u=e.slice(i,i+2);n.push(parseInt(u,16))}return new P(n.join("."))}static fromInteger(t){return P.fromHex(t.toString(16))}static fromArpa(t){let n=t.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new P(n)}toHex(){return this.parsedAddress.map(t=>(0,Lt.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,Lt.sprintf)("%02x%02x",parseInt(this.parsedAddress[e],10),parseInt(this.parsedAddress[e+1],10));t.push((0,Lt.sprintf)("%x",parseInt(n,16)))}return t.join(":")}bigInteger(){return new se.BigInteger(this.parsedAddress.map(t=>(0,Lt.sprintf)("%02x",parseInt(t,10))).join(""),16)}_startAddress(){return new se.BigInteger(this.mask()+"0".repeat(32-this.subnetMask),2)}startAddress(){return P.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new se.BigInteger("1");return P.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new se.BigInteger(this.mask()+"1".repeat(32-this.subnetMask),2)}endAddress(){return P.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new se.BigInteger("1");return P.fromBigInteger(this._endAddress().subtract(t))}static fromBigInteger(t){return P.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,Lt.sprintf)("%s.in-addr.arpa.",e)}isMulticast(){return this.isInSubnet(new P("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(32,"0")}groupForV6(){let t=this.parsedAddress;return this.address.replace(ne,(0,Lt.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 $s={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},Wr={"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"},Xr=/([^0-9a-f:/%])/gi,Jr=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,Yr=/\/\d{1,3}(?=%|$)/,Qr=/%.*$/,js=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),Vs=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/);var qs=V(ye(),1);function gu(r){return r.replace(/^(0+)/,'<span class="zero">$1</span>')}function Ge(r,t=0){return r.split(":").map((n,i)=>/group-v4/.test(n)?n:(0,qs.sprintf)('<span class="hover-group group-%d">%s</span>',i+t,gu(n)))}var $t=V(ye(),1);function tn(r){return(0,$t.sprintf)("(%s)",r.join("|"))}function Kr(r){return r.length<4?(0,$t.sprintf)("0{0,%d}%s",4-r.length,r):r}var en="[^A-Fa-f0-9:]";function He(r){let t=[];r.forEach((n,i)=>{parseInt(n,16)===0&&t.push(i)});let e=t.map(n=>r.map((i,u)=>{if(u===n){let f=u===0||u===8-1?":":"";return tn([Kr(i),f])}return Kr(i)}).join(":"));return e.push(r.map(Kr).join(":")),tn(e)}function rn(r,t,e){let n=t?"":":",i=e?"":":",u=[];!t&&!e&&u.push("::"),t&&e&&u.push(""),(e&&!t||!e&&t)&&u.push(":"),u.push((0,$t.sprintf)("%s(:0{1,4}){1,%d}",n,r-1)),u.push((0,$t.sprintf)("(0{1,4}:){1,%d}%s",r-1,i)),u.push((0,$t.sprintf)("(0{1,4}:){%d}0{1,4}",r-1));for(let f=1;f<r-1;f++)for(let d=1;d<r-f;d++)u.push((0,$t.sprintf)("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",d,r-d-f-1));return tn(u)}var H=V(Zr(),1),Z=V(ye(),1);function Ze(r){if(!r)throw new Error("Assertion failed.")}function bu(r){let t=/(\d+)(\d{3})/;for(;t.test(r);)r=r.replace(t,"$1,$2");return r}function wu(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 yu(r,t){let e=[],n=[],i;for(i=0;i<r.length;i++)i<t[0]?e.push(r[i]):i>t[1]&&n.push(r[i]);return e.concat(["compact"]).concat(n)}function Hs(r){return(0,Z.sprintf)("%04x",parseInt(r,16))}function Zs(r){return r&255}var _=class{constructor(t,e){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=je,this.isCorrect=Ve(128),e===void 0?this.groups=8:this.groups=e,this.address=t;let n=Yr.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 G("Invalid subnet mask.");t=t.replace(Yr,"")}else if(/\//.test(t))throw new G("Invalid subnet mask.");let i=Qr.exec(t);i&&(this.zone=i[0],t=t.replace(Qr,"")),this.addressMinusSuffix=t,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(t){try{return new _(t),!0}catch{return!1}}static fromBigInteger(t){let e=t.toString(16).padStart(32,"0"),n=[],i;for(i=0;i<8;i++)n.push(e.slice(i*4,(i+1)*4));return new _(n.join(":"))}static fromURL(t){let e,n=null,i;if(t.indexOf("[")!==-1&&t.indexOf("]:")!==-1){if(i=Vs.exec(t),i===null)return{error:"failed to parse address with port",address:null,port:null};e=i[1],n=i[2]}else if(t.indexOf("/")!==-1){if(t=t.replace(/^[a-z0-9]+:\/\//,""),i=js.exec(t),i===null)return{error:"failed to parse address from URL",address:null,port:null};e=i[1]}else e=t;return n?(n=parseInt(n,10),(n<0||n>65536)&&(n=null)):n=null,{address:new _(e),port:n}}static fromAddress4(t){let e=new P(t),n=128-(32-e.subnetMask);return new _(`::ffff:${e.correctForm()}/${n}`)}static fromArpa(t){let e=t.replace(/(\.ip6\.arpa)?\.$/,""),n=7;if(e.length!==63)throw new G("Invalid 'ip6.arpa' form.");let i=e.split(".").reverse();for(let u=n;u>0;u--){let f=u*4;i.splice(f,0,":")}return e=i.join(""),new _(e)}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 e=128-this.subnetMask,n=Math.abs(t-128),i=e-n;return i<0?"0":bu(new H.BigInteger("2",10).pow(i).toString(10))}_startAddress(){return new H.BigInteger(this.mask()+"0".repeat(128-this.subnetMask),2)}startAddress(){return _.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new H.BigInteger("1");return _.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new H.BigInteger(this.mask()+"1".repeat(128-this.subnetMask),2)}endAddress(){return _.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new H.BigInteger("1");return _.fromBigInteger(this._endAddress().subtract(t))}getScope(){let t=$s[this.getBits(12,16).intValue()];return this.getType()==="Global unicast"&&t!=="Link local"&&(t="Global"),t||"Unknown"}getType(){for(let t of Object.keys(Wr))if(this.isInSubnet(new _(t)))return Wr[t];return"Global unicast"}getBits(t,e){return new H.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,Z.sprintf)("%s.ip6.arpa.",n):t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,e=[],n=0,i=[];for(t=0;t<this.parsedAddress.length;t++){let d=parseInt(this.parsedAddress[t],16);d===0&&n++,d!==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 u=i.map(d=>d[1]-d[0]+1);if(i.length>0){let d=u.indexOf(Math.max(...u));e=yu(this.parsedAddress,i[d])}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(":"),i=e.slice(-1)[0].match(ne);if(i){this.parsedAddress4=i[0],this.address4=new P(this.parsedAddress4);for(let u=0;u<this.address4.groups;u++)if(/^0[0-9]+/.test(this.address4.parsedAddress[u]))throw new G("IPv4 addresses can't have leading zeroes.",t.replace(ne,this.address4.parsedAddress.map(wu).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(Xr);if(e)throw new G((0,Z.sprintf)("Bad character%s detected in address: %s",e.length>1?"s":"",e.join("")),t.replace(Xr,'<span class="parse-error">$1</span>'));let n=t.match(Jr);if(n)throw new G((0,Z.sprintf)("Address failed regex: %s",n.join("")),t.replace(Jr,'<span class="parse-error">$1</span>'));let i=[],u=t.split("::");if(u.length===2){let f=u[0].split(":"),d=u[1].split(":");f.length===1&&f[0]===""&&(f=[]),d.length===1&&d[0]===""&&(d=[]);let g=this.groups-(f.length+d.length);if(!g)throw new G("Error parsing groups");this.elidedGroups=g,this.elisionBegin=f.length,this.elisionEnd=f.length+this.elidedGroups,i=i.concat(f);for(let A=0;A<g;A++)i.push("0");i=i.concat(d)}else if(u.length===1)i=t.split(":"),this.elidedGroups=0;else throw new G("Too many :: groups found");if(i=i.map(f=>(0,Z.sprintf)("%x",parseInt(f,16))),i.length!==this.groups)throw new G("Incorrect number of groups found");return i}canonicalForm(){return this.parsedAddress.map(Hs).join(":")}decimal(){return this.parsedAddress.map(t=>(0,Z.sprintf)("%05d",parseInt(t,16))).join(":")}bigInteger(){return new H.BigInteger(this.parsedAddress.map(Hs).join(""),16)}to4(){let t=this.binaryZeroPad().split("");return P.fromHex(new H.BigInteger(t.slice(96,128).join(""),2).toString(16))}to4in6(){let t=this.to4(),n=new _(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),i="";return/:$/.test(n)||(i=":"),n+i+t.address}inspectTeredo(){let t=this.getBitsBase16(0,32),e=this.getBits(80,96).xor(new H.BigInteger("ffff",16)).toString(),n=P.fromHex(this.getBitsBase16(32,64)),i=P.fromHex(this.getBits(96,128).xor(new H.BigInteger("ffffffff",16)).toString(16)),u=this.getBits(64,80),f=this.getBitsBase2(64,80),d=u.testBit(15),g=u.testBit(14),A=u.testBit(8),l=u.testBit(9),w=new H.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:d,microsoft:{reserved:g,universalLocal:l,groupIndividual:A,nonce:w},udpPort:e}}inspect6to4(){let t=this.getBitsBase16(0,16),e=P.fromHex(this.getBitsBase16(16,48));return{prefix:(0,Z.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 _(t)}toByteArray(){let t=this.bigInteger().toByteArray();return t.length===17&&t[0]===0?t.slice(1):t}toUnsignedByteArray(){return this.toByteArray().map(Zs)}static fromByteArray(t){return this.fromUnsignedByteArray(t.map(Zs))}static fromUnsignedByteArray(t){let e=new H.BigInteger("256",10),n=new H.BigInteger("0",10),i=new H.BigInteger("1",10);for(let u=t.length-1;u>=0;u--)n=n.add(i.multiply(new H.BigInteger(t[u].toString(10),10))),i=i.multiply(e);return _.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 _("2001::/32"))}is6to4(){return this.isInSubnet(new _("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 e=this.correctForm;return t.v4&&(e=this.to4in6),t.className?(0,Z.sprintf)('<a href="%1$s%2$s" class="%3$s">%2$s</a>',t.prefix,e.call(this),t.className):(0,Z.sprintf)('<a href="%1$s%2$s">%2$s</a>',t.prefix,e.call(this))}group(){if(this.elidedGroups===0)return Ge(this.address).join(":");Ze(typeof this.elidedGroups=="number"),Ze(typeof this.elisionBegin=="number");let t=[],[e,n]=this.address.split("::");e.length?t.push(...Ge(e)):t.push("");let i=["hover-group"];for(let u=this.elisionBegin;u<this.elisionBegin+this.elidedGroups;u++)i.push((0,Z.sprintf)("group-%d",u));return t.push((0,Z.sprintf)('<span class="%s"></span>',i.join(" "))),n.length?t.push(...Ge(n,this.elisionEnd)):t.push(""),this.is4()&&(Ze(this.address4 instanceof P),t.pop(),t.push(this.address4.groupForV6())),t.join(":")}regularExpressionString(t=!1){let e=[],n=new _(this.correctForm());if(n.elidedGroups===0)e.push(He(n.parsedAddress));else if(n.elidedGroups===8)e.push(rn(8));else{let i=n.address.split("::");i[0].length&&e.push(He(i[0].split(":"))),Ze(typeof n.elidedGroups=="number"),e.push(rn(n.elidedGroups,i[0].length!==0,i[1].length!==0)),i[1].length&&e.push(He(i[1].split(":"))),e=[e.join(":")]}return t||(e=["(?=^|",en,"|[^\\w\\:])(",...e,")(?=[^\\w\\:]|",en,"|$)"]),e.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};var vu=Dt("libp2p:ip-port-to-multiaddr"),nn={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};function Ws(r,t){if(typeof r!="string")throw new K(`invalid ip provided: ${r}`,nn.ERR_INVALID_IP_PARAMETER);if(typeof t=="string"&&(t=parseInt(t)),isNaN(t))throw new K(`invalid port provided: ${t}`,nn.ERR_INVALID_PORT_PARAMETER);try{return new P(r),bt(`/ip4/${r}/tcp/${t}`)}catch{}try{let e=new _(r);return e.is4()?bt(`/ip4/${e.to4().correctForm()}/tcp/${t}`):bt(`/ip6/${r}/tcp/${t}`)}catch{let n=`invalid ip:port for creating a multiaddr: ${r}:${t}`;throw vu.error(n),new K(n,nn.ERR_INVALID_IP)}}var sn=V(yt("os"),1),Xs=V(yt("path"),1),xu={ip4:"IPv4",ip6:"IPv6"};function ie(r,t={}){let e=r.getPath();return e!=null?sn.default.platform()==="win32"?{path:Xs.default.join("\\\\.\\pipe\\",e)}:{path:e}:{...r.toOptions(),...t}}function on(r,t,e){let n=i=>bt(`/${r}/${i}/tcp/${e}`);return(Su(t)?Eu(xu[r]):[t]).map(n)}function Su(r){return["0.0.0.0","::"].includes(r)}var Tu=sn.default.networkInterfaces();function Eu(r){let t=[];for(let[,e]of Object.entries(Tu))if(e!=null)for(let n of e)n.family===r&&t.push(n.address);return t}var mt=Dt("libp2p:tcp:socket"),We=(r,t)=>{let e=t.metrics,n=t.metricPrefix??"",i=t.socketInactivityTimeout??3e5,u=t.socketCloseTimeout??2e3;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 K("Could not determine remote address or port","ERR_NO_REMOTE_ADDRESS");f=Ws(r.remoteAddress,r.remotePort)}let d=ie(f),g=d.path??`${d.host??""}:${d.port??""}`,{sink:A,source:l}=Js.default.duplex(r);r.setTimeout(i,()=>{mt("%s socket read timeout",g),e?.increment({[`${n}timeout`]:!0});let x;r.readable&&(x=new K("Socket read timeout","ERR_SOCKET_READ_TIMEOUT")),r.destroy(x)}),r.once("close",()=>{mt("%s socket close",g),e?.increment({[`${n}close`]:!0}),w.timeline.close==null&&(w.timeline.close=Date.now())}),r.once("end",()=>{mt("%s socket end",g),e?.increment({[`${n}end`]:!0})});let w={async sink(x){try{await A(x)}catch(S){S.type!=="aborted"&&mt(S)}r.end()},source:l,remoteAddr:f,timeline:{open:Date.now()},async close(){if(r.destroyed){mt("%s socket was already destroyed when trying to close",g);return}mt("%s closing socket",g),await new Promise((x,S)=>{let m=Date.now(),E;r.once("close",()=>{mt("%s socket closed",g),E!==void 0&&clearTimeout(E),x()}),r.once("error",B=>{mt("%s socket error",g,B),w.timeline.close==null&&(w.timeline.close=Date.now()),r.destroyed&&E!==void 0&&clearTimeout(E),S(B)}),r.setTimeout(u),r.end(),r.writableLength>0?(E=setTimeout(()=>{r.destroyed?(mt("%s is already destroyed",g),x()):(mt("%s socket close timeout after %dms, destroying it manually",g,Date.now()-m),r.destroy(new K("Socket close timeout","ERR_SOCKET_CLOSE_TIMEOUT")))},u).unref(),r.once("drain",()=>{mt("%s socket drained",g),r.destroy()})):r.destroy()})}};return w};var Ys=V(yt("net"),1);var jt=function(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)},Et,Xe=class extends EventTarget{constructor(){super(...arguments),Et.set(this,new Map)}listenerCount(t){let e=jt(this,Et,"f").get(t);return e==null?0:e.length}addEventListener(t,e,n){super.addEventListener(t,e,n);let i=jt(this,Et,"f").get(t);i==null&&(i=[],jt(this,Et,"f").set(t,i)),i.push({callback:e,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(t,e,n){super.removeEventListener(t.toString(),e??null,n);let i=jt(this,Et,"f").get(t);i!=null&&(i=i.filter(({callback:u})=>u!==e),jt(this,Et,"f").set(t,i))}dispatchEvent(t){let e=super.dispatchEvent(t),n=jt(this,Et,"f").get(t.type);return n==null||(n=n.filter(({once:i})=>!i),jt(this,Et,"f").set(t.type,n)),e}safeDispatchEvent(t,e){return this.dispatchEvent(new ae(t,e))}};Et=new WeakMap;var an=class extends Event{constructor(t,e){super(t,e),this.detail=e?.detail}},ae=globalThis.CustomEvent??an;var ot=Dt("libp2p:tcp:listener");async function cn(r){try{await r.close()}catch(t){ot.error("an error occurred closing the connection",t)}}var Iu=1,Bu=0,Je=class extends Xe{constructor(t){if(super(),this.context=t,this.connections=new Set,this.status={started:!1},t.keepAlive=t.keepAlive??!0,this.addr="unknown",this.server=Ys.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]:Iu})}this.dispatchEvent(new ae("listening"))}).on("error",e=>{this.metrics?.errors.increment({[`${this.addr} listen_error`]:!0}),this.dispatchEvent(new ae("error",{detail:e}))}).on("close",()=>{this.metrics?.status.update({[this.addr]:Bu}),this.dispatchEvent(new ae("close"))})}onSocket(t){t.on("error",n=>{ot("socket error",n),this.metrics?.events.increment({[`${this.addr} error`]:!0})});let e;try{e=We(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(i=>{ot.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 ae("connection",{detail:n}))}).catch(async n=>{ot.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_upgrade`]:!0}),await cn(e)}).catch(n=>{ot.error("closing inbound connection failed",n)})}catch(n){ot.error("inbound connection failed",n),cn(e).catch(i=>{ot.error("closing inbound connection failed",i),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:i}=this.status;if(e==null)return[];if(typeof e=="string")t=[n];else try{n.toString().startsWith("/ip4")?t=t.concat(on("ip4",e.address,e.port)):e.family==="IPv6"&&(t=t.concat(on("ip6",e.address,e.port)))}catch(u){ot.error("could not turn %s:%s into multiaddr",e.address,e.port,u)}return t.map(u=>i!=null?u.encapsulate(`/p2p/${i}`):u)}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:i}=this.context;this.status={started:!0,listeningAddr:n,peerId:e,netConfig:ie(n,{backlog:i})},await this.netListen()}async close(){await Promise.all(Array.from(this.connections.values()).map(async t=>{await cn(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 Ks=Symbol.for("@libp2p/transport");var Qs;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(Qs||(Qs={}));var Ct=Dt("libp2p:tcp"),fn=class{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"})})}get[Ks](){return!0}get[Symbol.toStringTag](){return"@libp2p/tcp"}async dial(t,e){e.keepAlive=e.keepAlive??!0;let n=await this._connect(t,e);n.on("error",d=>{Ct("socket error",d)});let i=We(n,{remoteAddr:t,socketInactivityTimeout:this.opts.outboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.metrics?.dialerEvents}),u=()=>{i.close().catch(d=>{Ct.error("Error closing maConn after abort",d)})};e.signal?.addEventListener("abort",u,{once:!0}),Ct("new outbound connection %s",i.remoteAddr);let f=await e.upgrader.upgradeOutbound(i);if(Ct("outbound connection %s upgraded",i.remoteAddr),e.signal?.removeEventListener("abort",u),e.signal?.aborted===!0)throw f.close().catch(d=>{Ct.error("Error closing conn after abort",d)}),new xt;return f}async _connect(t,e){if(e.signal?.aborted===!0)throw new xt;return await new Promise((n,i)=>{let u=Date.now(),f=ie(t),d=f.path??`${f.host??""}:${f.port}`;Ct("dialing %j",f);let g=to.default.connect(f),A=m=>{m.message=`connection error ${d}: ${m.message}`,this.metrics?.dialerEvents.increment({error:!0}),S(m)},l=()=>{Ct("connection timeout %s",d),this.metrics?.dialerEvents.increment({timeout:!0});let m=new K(`connection timeout after ${Date.now()-u}ms`,"ERR_CONNECT_TIMEOUT");g.emit("error",m)},w=()=>{Ct("connection opened %j",f),this.metrics?.dialerEvents.increment({connect:!0}),S()},x=()=>{Ct("connection aborted %j",f),this.metrics?.dialerEvents.increment({abort:!0}),g.destroy(),S(new xt)},S=m=>{if(g.removeListener("error",A),g.removeListener("timeout",l),g.removeListener("connect",w),e.signal!=null&&e.signal.removeEventListener("abort",x),m!=null){i(m);return}n(g)};g.on("error",A),g.on("timeout",l),g.on("connect",w),e.signal!=null&&e.signal.addEventListener("abort",x)})}createListener(t){return new Je({...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:Mt.matches(e.decapsulateCode(421)))}};function Du(r={}){return(t={})=>new fn(t,r)}return ji(Pu);})();
4
+ `+u),r.push(i+"m+"+je.exports.humanize(this.diff)+"\x1B[0m")}else r[0]=au()+t+" "+r[0]}function au(){return j.inspectOpts.hideDate?"":new Date().toISOString()+" "}function cu(...r){return process.stderr.write($e.format(...r)+`
5
+ `)}function uu(r){r?process.env.DEBUG=r:delete process.env.DEBUG}function fu(){return process.env.DEBUG}function lu(r){r.inspectOpts={};let t=Object.keys(j.inspectOpts);for(let e=0;e<t.length;e++)r.inspectOpts[t[e]]=j.inspectOpts[t[e]]}je.exports=Vr()(j);var{formatters:As}=je.exports;As.o=function(r){return this.inspectOpts.colors=this.useColors,$e.inspect(r,this.inspectOpts).split(`
6
+ `).map(t=>t.trim()).join(" ")};As.O=function(r){return this.inspectOpts.colors=this.useColors,$e.inspect(r,this.inspectOpts)}});var Bs=N((up,qr)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?qr.exports=xs():qr.exports=Is()});var Ve=N((dp,Rs)=>{Rs.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 Ds=N((mp,Ms)=>{Ms.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 Gr=N((gp,Ps)=>{var hu=Ds();Ps.exports=r=>async t=>{t=hu(t);let e=C=>{typeof C.return=="function"&&C.return()},n=null,i=null,u=C=>{n=C,i&&i(C),e(t)},f=null,d=!1,g=()=>{d=!0,f&&f()},A=null,l=!1,w=()=>{l=!0,A&&A()},x=null,S=()=>{x&&x()},m=()=>new Promise((C,I)=>{f=x=C,i=I,r.once("drain",S)}),E=()=>(e(t),new Promise((C,I)=>{if(d||l||n)return C();A=f=C,i=I})),B=()=>{r.removeListener("error",u),r.removeListener("close",g),r.removeListener("finish",w),r.removeListener("drain",S)};r.once("error",u),r.once("close",g),r.once("finish",w);try{for await(let C of t){if(!r.writable||r.destroyed||n)break;r.write(C)===!1&&await m()}}catch(C){n||r.destroy(),n=C}try{if(r.writable&&r.end(),await E(),n)throw n}finally{B()}}});var Hr=N((bp,ks)=>{var du=Gr(),mu=Ve();ks.exports=r=>({sink:du(r),source:mu(r)})});var Os=N((wp,_s)=>{var gu=Hr();_s.exports=r=>async function*(t){let e=gu(r),n;if(e.sink(t).catch(i=>{n=i}),yield*e.source,n)throw n}});var Fs=N((yp,se)=>{se.exports=Ve();se.exports.source=Ve();se.exports.sink=Gr();se.exports.transform=Os();se.exports.duplex=Hr()});var Zr=N((Ge,Us)=>{(function(){var r,t=0xdeadbeefcafe,e=(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 u(s,o,a,c,p,h){for(;--h>=0;){var b=o*this[s++]+a[c]+p;p=Math.floor(b/67108864),a[c++]=b&67108863}return p}function f(s,o,a,c,p,h){for(var b=o&32767,y=o>>15;--h>=0;){var M=this[s]&32767,$=this[s++]>>15,it=y*M+$*b;M=b*M+((it&32767)<<15)+a[c]+(p&1073741823),p=(M>>>30)+(it>>>15)+y*$+(p>>>30),a[c++]=M&1073741823}return p}function d(s,o,a,c,p,h){for(var b=o&16383,y=o>>14;--h>=0;){var M=this[s]&16383,$=this[s++]>>14,it=y*M+$*b;M=b*M+((it&16383)<<14)+a[c]+p,p=(M>>28)+(it>>14)+y*$,a[c++]=M&268435455}return p}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=u,r=26):(n.prototype.am=d,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 l="0123456789abcdefghijklmnopqrstuvwxyz",w=new Array,x,S;for(x="0".charCodeAt(0),S=0;S<=9;++S)w[x++]=S;for(x="a".charCodeAt(0),S=10;S<36;++S)w[x++]=S;for(x="A".charCodeAt(0),S=10;S<36;++S)w[x++]=S;function m(s){return l.charAt(s)}function E(s,o){var a=w[s.charCodeAt(o)];return a??-1}function B(s){for(var o=this.t-1;o>=0;--o)s[o]=this[o];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 o=i();return o.fromInt(s),o}function O(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 c=s.length,p=!1,h=0;--c>=0;){var b=a==8?s[c]&255:E(s,c);if(b<0){s.charAt(c)=="-"&&(p=!0);continue}p=!1,h==0?this[this.t++]=b:h+a>this.DB?(this[this.t-1]|=(b&(1<<this.DB-h)-1)<<h,this[this.t++]=b>>this.DB-h):this[this.t-1]|=b<<h,h+=a,h>=this.DB&&(h-=this.DB)}a==8&&s[0]&128&&(this.s=-1,h>0&&(this[this.t-1]|=(1<<this.DB-h)-1<<h)),this.clamp(),p&&n.ZERO.subTo(this,this)}function F(){for(var s=this.s&this.DM;this.t>0&&this[this.t-1]==s;)--this.t}function tt(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,c,p=!1,h="",b=this.t,y=this.DB-b*this.DB%o;if(b-- >0)for(y<this.DB&&(c=this[b]>>y)>0&&(p=!0,h=m(c));b>=0;)y<o?(c=(this[b]&(1<<y)-1)<<o-y,c|=this[--b]>>(y+=this.DB-o)):(c=this[b]>>(y-=o)&a,y<=0&&(y+=this.DB,--b)),c>0&&(p=!0),p&&(h+=m(c));return p?h:"0"}function J(){var s=i();return n.ZERO.subTo(this,s),s}function Z(){return this.s<0?this.negate():this}function Y(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 ut(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 ro(){return this.t<=0?0:this.DB*(this.t-1)+ut(this[this.t-1]^this.s&this.DM)}function no(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 so(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 oo(s,o){var a=s%this.DB,c=this.DB-a,p=(1<<c)-1,h=Math.floor(s/this.DB),b=this.s<<a&this.DM,y;for(y=this.t-1;y>=0;--y)o[y+h+1]=this[y]>>c|b,b=(this[y]&p)<<a;for(y=h-1;y>=0;--y)o[y]=0;o[h]=b,o.t=this.t+h+1,o.s=this.s,o.clamp()}function io(s,o){o.s=this.s;var a=Math.floor(s/this.DB);if(a>=this.t){o.t=0;return}var c=s%this.DB,p=this.DB-c,h=(1<<c)-1;o[0]=this[a]>>c;for(var b=a+1;b<this.t;++b)o[b-a-1]|=(this[b]&h)<<p,o[b-a]=this[b]>>c;c>0&&(o[this.t-a-1]|=(this.s&h)<<p),o.t=this.t-a,o.clamp()}function ao(s,o){for(var a=0,c=0,p=Math.min(s.t,this.t);a<p;)c+=this[a]-s[a],o[a++]=c&this.DM,c>>=this.DB;if(s.t<this.t){for(c-=s.s;a<this.t;)c+=this[a],o[a++]=c&this.DM,c>>=this.DB;c+=this.s}else{for(c+=this.s;a<s.t;)c-=s[a],o[a++]=c&this.DM,c>>=this.DB;c-=s.s}o.s=c<0?-1:0,c<-1?o[a++]=this.DV+c:c>0&&(o[a++]=c),o.t=a,o.clamp()}function co(s,o){var a=this.abs(),c=s.abs(),p=a.t;for(o.t=p+c.t;--p>=0;)o[p]=0;for(p=0;p<c.t;++p)o[p+a.t]=a.am(0,c[p],o,p,0,a.t);o.s=0,o.clamp(),this.s!=s.s&&n.ZERO.subTo(o,o)}function uo(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 c=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,c,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 fo(s,o,a){var c=s.abs();if(!(c.t<=0)){var p=this.abs();if(p.t<c.t){o?.fromInt(0),a!=null&&this.copyTo(a);return}a==null&&(a=i());var h=i(),b=this.s,y=s.s,M=this.DB-ut(c[c.t-1]);M>0?(c.lShiftTo(M,h),p.lShiftTo(M,a)):(c.copyTo(h),p.copyTo(a));var $=h.t,it=h[$-1];if(it!=0){var rt=it*(1<<this.F1)+($>1?h[$-2]>>this.F2:0),wt=this.FV/rt,Te=(1<<this.F1)/rt,lt=1<<this.F2,pt=a.t,Ee=pt-$,It=o??i();for(h.dlShiftTo(Ee,It),a.compareTo(It)>=0&&(a[a.t++]=1,a.subTo(It,a)),n.ONE.dlShiftTo($,It),It.subTo(h,h);h.t<$;)h[h.t++]=0;for(;--Ee>=0;){var nr=a[--pt]==it?this.DM:Math.floor(a[pt]*wt+(a[pt-1]+lt)*Te);if((a[pt]+=h.am(0,nr,a,Ee,0,$))<nr)for(h.dlShiftTo(Ee,It),a.subTo(It,a);a[pt]<--nr;)a.subTo(It,a)}o!=null&&(a.drShiftTo($,o),b!=y&&n.ZERO.subTo(o,o)),a.t=$,a.clamp(),M>0&&a.rShiftTo(M,a),b<0&&n.ZERO.subTo(a,a)}}}function lo(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 _t(s){this.m=s}function po(s){return s.s<0||s.compareTo(this.m)>=0?s.mod(this.m):s}function ho(s){return s}function mo(s){s.divRemTo(this.m,null,s)}function go(s,o,a){s.multiplyTo(o,a),this.reduce(a)}function bo(s,o){s.squareTo(o),this.reduce(o)}_t.prototype.convert=po,_t.prototype.revert=ho,_t.prototype.reduce=mo,_t.prototype.mulTo=go,_t.prototype.sqrTo=bo;function wo(){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 Ot(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 yo(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 vo(s){var o=i();return s.copyTo(o),this.reduce(o),o}function xo(s){for(;s.t<=this.mt2;)s[s.t++]=0;for(var o=0;o<this.m.t;++o){var a=s[o]&32767,c=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,c,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 So(s,o){s.squareTo(o),this.reduce(o)}function To(s,o,a){s.multiplyTo(o,a),this.reduce(a)}Ot.prototype.convert=yo,Ot.prototype.revert=vo,Ot.prototype.reduce=xo,Ot.prototype.mulTo=To,Ot.prototype.sqrTo=So;function Eo(){return(this.t>0?this[0]&1:this.s)==0}function Co(s,o){if(s>4294967295||s<1)return n.ONE;var a=i(),c=i(),p=o.convert(this),h=ut(s)-1;for(p.copyTo(a);--h>=0;)if(o.sqrTo(a,c),(s&1<<h)>0)o.mulTo(c,p,a);else{var b=a;a=c,c=b}return o.revert(a)}function Ao(s,o){var a;return s<256||o.isEven()?a=new _t(o):a=new Ot(o),this.exp(s,a)}n.prototype.copyTo=B,n.prototype.fromInt=C,n.prototype.fromString=O,n.prototype.clamp=F,n.prototype.dlShiftTo=no,n.prototype.drShiftTo=so,n.prototype.lShiftTo=oo,n.prototype.rShiftTo=io,n.prototype.subTo=ao,n.prototype.multiplyTo=co,n.prototype.squareTo=uo,n.prototype.divRemTo=fo,n.prototype.invDigit=wo,n.prototype.isEven=Eo,n.prototype.exp=Co,n.prototype.toString=tt,n.prototype.negate=J,n.prototype.abs=Z,n.prototype.compareTo=Y,n.prototype.bitLength=ro,n.prototype.mod=lo,n.prototype.modPowInt=Ao,n.ZERO=I(0),n.ONE=I(1);function Io(){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 Ro(){return this.t==0?this.s:this[0]<<24>>24}function Mo(){return this.t==0?this.s:this[0]<<16>>16}function Do(s){return Math.floor(Math.LN2*this.DB/Math.log(s))}function Po(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function ko(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),c=I(a),p=i(),h=i(),b="";for(this.divRemTo(c,p,h);p.signum()>0;)b=(a+h.intValue()).toString(s).substr(1)+b,p.divRemTo(c,p,h);return h.intValue().toString(s)+b}function _o(s,o){this.fromInt(0),o==null&&(o=10);for(var a=this.chunkSize(o),c=Math.pow(o,a),p=!1,h=0,b=0,y=0;y<s.length;++y){var M=E(s,y);if(M<0){s.charAt(y)=="-"&&this.signum()==0&&(p=!0);continue}b=o*b+M,++h>=a&&(this.dMultiply(c),this.dAddOffset(b,0),h=0,b=0)}h>0&&(this.dMultiply(Math.pow(o,h)),this.dAddOffset(b,0)),p&&n.ZERO.subTo(this,this)}function Oo(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),Ke,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 c=new Array,p=s&7;c.length=(s>>3)+1,o.nextBytes(c),p>0?c[0]&=(1<<p)-1:c[0]=0,this.fromString(c,256)}}function Fo(){var s=this.t,o=new Array;o[0]=this.s;var a=this.DB-s*this.DB%8,c,p=0;if(s-- >0)for(a<this.DB&&(c=this[s]>>a)!=(this.s&this.DM)>>a&&(o[p++]=c|this.s<<this.DB-a);s>=0;)a<8?(c=(this[s]&(1<<a)-1)<<8-a,c|=this[--s]>>(a+=this.DB-8)):(c=this[s]>>(a-=8)&255,a<=0&&(a+=this.DB,--s)),c&128&&(c|=-256),p==0&&(this.s&128)!=(c&128)&&++p,(p>0||c!=this.s)&&(o[p++]=c);return o}function No(s){return this.compareTo(s)==0}function Lo(s){return this.compareTo(s)<0?this:s}function Uo(s){return this.compareTo(s)>0?this:s}function $o(s,o,a){var c,p,h=Math.min(s.t,this.t);for(c=0;c<h;++c)a[c]=o(this[c],s[c]);if(s.t<this.t){for(p=s.s&this.DM,c=h;c<this.t;++c)a[c]=o(this[c],p);a.t=this.t}else{for(p=this.s&this.DM,c=h;c<s.t;++c)a[c]=o(p,s[c]);a.t=s.t}a.s=o(this.s,s.s),a.clamp()}function jo(s,o){return s&o}function Vo(s){var o=i();return this.bitwiseTo(s,jo,o),o}function Ke(s,o){return s|o}function zo(s){var o=i();return this.bitwiseTo(s,Ke,o),o}function pn(s,o){return s^o}function qo(s){var o=i();return this.bitwiseTo(s,pn,o),o}function hn(s,o){return s&~o}function Go(s){var o=i();return this.bitwiseTo(s,hn,o),o}function Ho(){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 Wo(s){var o=i();return s<0?this.rShiftTo(-s,o):this.lShiftTo(s,o),o}function Zo(s){var o=i();return s<0?this.lShiftTo(-s,o):this.rShiftTo(s,o),o}function Xo(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 Jo(){for(var s=0;s<this.t;++s)if(this[s]!=0)return s*this.DB+Xo(this[s]);return this.s<0?this.t*this.DB:-1}function Yo(s){for(var o=0;s!=0;)s&=s-1,++o;return o}function Qo(){for(var s=0,o=this.s&this.DM,a=0;a<this.t;++a)s+=Yo(this[a]^o);return s}function Ko(s){var o=Math.floor(s/this.DB);return o>=this.t?this.s!=0:(this[o]&1<<s%this.DB)!=0}function ti(s,o){var a=n.ONE.shiftLeft(s);return this.bitwiseTo(a,o,a),a}function ei(s){return this.changeBit(s,Ke)}function ri(s){return this.changeBit(s,hn)}function ni(s){return this.changeBit(s,pn)}function si(s,o){for(var a=0,c=0,p=Math.min(s.t,this.t);a<p;)c+=this[a]+s[a],o[a++]=c&this.DM,c>>=this.DB;if(s.t<this.t){for(c+=s.s;a<this.t;)c+=this[a],o[a++]=c&this.DM,c>>=this.DB;c+=this.s}else{for(c+=this.s;a<s.t;)c+=s[a],o[a++]=c&this.DM,c>>=this.DB;c+=s.s}o.s=c<0?-1:0,c>0?o[a++]=c:c<-1&&(o[a++]=this.DV+c),o.t=a,o.clamp()}function oi(s){var o=i();return this.addTo(s,o),o}function ii(s){var o=i();return this.subTo(s,o),o}function ai(s){var o=i();return this.multiplyTo(s,o),o}function ci(){var s=i();return this.squareTo(s),s}function ui(s){var o=i();return this.divRemTo(s,o,null),o}function fi(s){var o=i();return this.divRemTo(s,null,o),o}function li(s){var o=i(),a=i();return this.divRemTo(s,o,a),new Array(o,a)}function pi(s){this[this.t]=this.am(0,s-1,this,0,0,this.t),++this.t,this.clamp()}function hi(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 fe(){}function dn(s){return s}function di(s,o,a){s.multiplyTo(o,a)}function mi(s,o){s.squareTo(o)}fe.prototype.convert=dn,fe.prototype.revert=dn,fe.prototype.mulTo=di,fe.prototype.sqrTo=mi;function gi(s){return this.exp(s,new fe)}function bi(s,o,a){var c=Math.min(this.t+s.t,o);for(a.s=0,a.t=c;c>0;)a[--c]=0;var p;for(p=a.t-this.t;c<p;++c)a[c+this.t]=this.am(0,s[c],a,c,0,this.t);for(p=Math.min(s.t,o);c<p;++c)this.am(0,s[c],a,c,0,o-c);a.clamp()}function wi(s,o,a){--o;var c=a.t=this.t+s.t-o;for(a.s=0;--c>=0;)a[c]=0;for(c=Math.max(o-this.t,0);c<s.t;++c)a[this.t+c-o]=this.am(o-c,s[c],a,0,0,this.t+c-o);a.clamp(),a.drShiftTo(1,a)}function Ft(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 yi(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 vi(s){return s}function xi(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 Si(s,o){s.squareTo(o),this.reduce(o)}function Ti(s,o,a){s.multiplyTo(o,a),this.reduce(a)}Ft.prototype.convert=yi,Ft.prototype.revert=vi,Ft.prototype.reduce=xi,Ft.prototype.mulTo=Ti,Ft.prototype.sqrTo=Si;function Ei(s,o){var a=s.bitLength(),c,p=I(1),h;if(a<=0)return p;a<18?c=1:a<48?c=3:a<144?c=4:a<768?c=5:c=6,a<8?h=new _t(o):o.isEven()?h=new Ft(o):h=new Ot(o);var b=new Array,y=3,M=c-1,$=(1<<c)-1;if(b[1]=h.convert(this),c>1){var it=i();for(h.sqrTo(b[1],it);y<=$;)b[y]=i(),h.mulTo(it,b[y-2],b[y]),y+=2}var rt=s.t-1,wt,Te=!0,lt=i(),pt;for(a=ut(s[rt])-1;rt>=0;){for(a>=M?wt=s[rt]>>a-M&$:(wt=(s[rt]&(1<<a+1)-1)<<M-a,rt>0&&(wt|=s[rt-1]>>this.DB+a-M)),y=c;!(wt&1);)wt>>=1,--y;if((a-=y)<0&&(a+=this.DB,--rt),Te)b[wt].copyTo(p),Te=!1;else{for(;y>1;)h.sqrTo(p,lt),h.sqrTo(lt,p),y-=2;y>0?h.sqrTo(p,lt):(pt=p,p=lt,lt=pt),h.mulTo(lt,b[wt],p)}for(;rt>=0&&!(s[rt]&1<<a);)h.sqrTo(p,lt),pt=p,p=lt,lt=pt,--a<0&&(a=this.DB-1,--rt)}return h.revert(p)}function Ci(s){var o=this.s<0?this.negate():this.clone(),a=s.s<0?s.negate():s.clone();if(o.compareTo(a)<0){var c=o;o=a,a=c}var p=o.getLowestSetBit(),h=a.getLowestSetBit();if(h<0)return o;for(p<h&&(h=p),h>0&&(o.rShiftTo(h,o),a.rShiftTo(h,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 h>0&&a.lShiftTo(h,a),a}function Ai(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 c=this.t-1;c>=0;--c)a=(o*a+this[c])%s;return a}function Ii(s){var o=s.isEven();if(this.isEven()&&o||s.signum()==0)return n.ZERO;for(var a=s.clone(),c=this.clone(),p=I(1),h=I(0),b=I(0),y=I(1);a.signum()!=0;){for(;a.isEven();)a.rShiftTo(1,a),o?((!p.isEven()||!h.isEven())&&(p.addTo(this,p),h.subTo(s,h)),p.rShiftTo(1,p)):h.isEven()||h.subTo(s,h),h.rShiftTo(1,h);for(;c.isEven();)c.rShiftTo(1,c),o?((!b.isEven()||!y.isEven())&&(b.addTo(this,b),y.subTo(s,y)),b.rShiftTo(1,b)):y.isEven()||y.subTo(s,y),y.rShiftTo(1,y);a.compareTo(c)>=0?(a.subTo(c,a),o&&p.subTo(b,p),h.subTo(y,h)):(c.subTo(a,c),o&&b.subTo(p,b),y.subTo(h,y))}if(c.compareTo(n.ONE)!=0)return n.ZERO;if(y.compareTo(s)>=0)return y.subtract(s);if(y.signum()<0)y.addTo(s,y);else return y;return y.signum()<0?y.add(s):y}var X=[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)/X[X.length-1];function Ri(s){var o,a=this.abs();if(a.t==1&&a[0]<=X[X.length-1]){for(o=0;o<X.length;++o)if(a[0]==X[o])return!0;return!1}if(a.isEven())return!1;for(o=1;o<X.length;){for(var c=X[o],p=o+1;p<X.length&&c<Bi;)c*=X[p++];for(c=a.modInt(c);o<p;)if(c%X[o++]==0)return!1}return a.millerRabin(s)}function Mi(s){var o=this.subtract(n.ONE),a=o.getLowestSetBit();if(a<=0)return!1;var c=o.shiftRight(a);s=s+1>>1,s>X.length&&(s=X.length);for(var p=i(),h=0;h<s;++h){p.fromInt(X[Math.floor(Math.random()*X.length)]);var b=p.modPow(c,this);if(b.compareTo(n.ONE)!=0&&b.compareTo(o)!=0){for(var y=1;y++<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=Do,n.prototype.toRadix=ko,n.prototype.fromRadix=_o,n.prototype.fromNumber=Oo,n.prototype.bitwiseTo=$o,n.prototype.changeBit=ti,n.prototype.addTo=si,n.prototype.dMultiply=pi,n.prototype.dAddOffset=hi,n.prototype.multiplyLowerTo=bi,n.prototype.multiplyUpperTo=wi,n.prototype.modInt=Ai,n.prototype.millerRabin=Mi,n.prototype.clone=Io,n.prototype.intValue=Bo,n.prototype.byteValue=Ro,n.prototype.shortValue=Mo,n.prototype.signum=Po,n.prototype.toByteArray=Fo,n.prototype.equals=No,n.prototype.min=Lo,n.prototype.max=Uo,n.prototype.and=Vo,n.prototype.or=zo,n.prototype.xor=qo,n.prototype.andNot=Go,n.prototype.not=Ho,n.prototype.shiftLeft=Wo,n.prototype.shiftRight=Zo,n.prototype.getLowestSetBit=Jo,n.prototype.bitCount=Qo,n.prototype.testBit=Ko,n.prototype.setBit=ei,n.prototype.clearBit=ri,n.prototype.flipBit=ni,n.prototype.add=oi,n.prototype.subtract=ii,n.prototype.multiply=ai,n.prototype.divide=ui,n.prototype.remainder=fi,n.prototype.divideAndRemainder=li,n.prototype.modPow=Ei,n.prototype.modInverse=Ii,n.prototype.pow=gi,n.prototype.gcd=Ci,n.prototype.isProbablePrime=Ri,n.prototype.square=ci,n.prototype.Barrett=Ft;var Se,et,U;function Di(s){et[U++]^=s&255,et[U++]^=s>>8&255,et[U++]^=s>>16&255,et[U++]^=s>>24&255,U>=rr&&(U-=rr)}function mn(){Di(new Date().getTime())}if(et==null){et=new Array,U=0;var ft;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var gn=new Uint8Array(32);for(window.crypto.getRandomValues(gn),ft=0;ft<32;++ft)et[U++]=gn[ft]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var bn=window.crypto.random(32);for(ft=0;ft<bn.length;++ft)et[U++]=bn.charCodeAt(ft)&255}}for(;U<rr;)ft=Math.floor(65536*Math.random()),et[U++]=ft>>>8,et[U++]=ft&255;U=0,mn()}function Pi(){if(Se==null){for(mn(),Se=Fi(),Se.init(et),U=0;U<et.length;++U)et[U]=0;U=0}return Se.next()}function ki(s){var o;for(o=0;o<s.length;++o)s[o]=Pi()}function tr(){}tr.prototype.nextBytes=ki;function er(){this.i=0,this.j=0,this.S=new Array}function _i(s){var o,a,c;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,c=this.S[o],this.S[o]=this.S[a],this.S[a]=c;this.i=0,this.j=0}function Oi(){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]}er.prototype.init=_i,er.prototype.next=Oi;function Fi(){return new er}var rr=256;typeof Ge<"u"?Ge=Us.exports={default:n,BigInteger:n,SecureRandom:tr}:this.jsbn={BigInteger:n,SecureRandom:tr}}).call(Ge)});var xe=N(He=>{(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(u(f),arguments)}function e(f,d){return t.apply(null,[f].concat(d||[]))}function n(f,d){var g=1,A=f.length,l,w="",x,S,m,E,B,C,I,O;for(x=0;x<A;x++)if(typeof f[x]=="string")w+=f[x];else if(typeof f[x]=="object"){if(m=f[x],m.keys)for(l=d[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=d[m.param_no]:l=d[g++];if(r.not_type.test(m.type)&&r.not_primitive.test(m.type)&&l instanceof Function&&(l=l()),r.numeric_arg.test(m.type)&&typeof l!="number"&&isNaN(l))throw new TypeError(t("[sprintf] expecting number but found %T",l));switch(r.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}r.json.test(m.type)?w+=l:(r.number.test(m.type)&&(!I||m.sign)?(O=I?"+":"-",l=l.toString().replace(r.sign,"")):O="",B=m.pad_char?m.pad_char==="0"?"0":m.pad_char.charAt(1):" ",C=m.width-(O+l).length,E=m.width&&C>0?B.repeat(C):"",w+=m.align?O+l+E:B==="0"?O+E+l:E+O+l)}return w}var i=Object.create(null);function u(f){if(i[f])return i[f];for(var d=f,g,A=[],l=0;d;){if((g=r.text.exec(d))!==null)A.push(g[0]);else if((g=r.modulo.exec(d))!==null)A.push("%");else if((g=r.placeholder.exec(d))!==null){if(g[2]){l|=1;var w=[],x=g[2],S=[];if((S=r.key.exec(x))!==null)for(w.push(S[1]);(x=x.substring(S[0].length))!=="";)if((S=r.key_access.exec(x))!==null)w.push(S[1]);else if((S=r.index_access.exec(x))!==null)w.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]=w}else l|=2;if(l===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");d=d.substring(g[0].length)}return i[f]=A}typeof He<"u"&&(He.sprintf=t,He.vsprintf=e),typeof window<"u"&&(window.sprintf=t,window.vsprintf=e,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:e}}))})()});var ku={};nt(ku,{tcp:()=>Pu});var eo=V(yt("net"),1);var Bt=yt("node:net");function Ae(r){return!!(0,Bt.isIP)(r)}var cr={};nt(cr,{identity:()=>Zi});function zi(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 i=0;i<r.length;i++){var u=r.charAt(i),f=u.charCodeAt(0);if(e[f]!==255)throw new TypeError(u+" is ambiguous");e[f]=i}var d=r.length,g=r.charAt(0),A=Math.log(d)/Math.log(256),l=Math.log(256)/Math.log(d);function w(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 E=0,B=0,C=0,I=m.length;C!==I&&m[C]===0;)C++,E++;for(var O=(I-C)*l+1>>>0,F=new Uint8Array(O);C!==I;){for(var tt=m[C],J=0,Z=O-1;(tt!==0||J<B)&&Z!==-1;Z--,J++)tt+=256*F[Z]>>>0,F[Z]=tt%d>>>0,tt=tt/d>>>0;if(tt!==0)throw new Error("Non-zero carry");B=J,C++}for(var Y=O-B;Y!==O&&F[Y]===0;)Y++;for(var ut=g.repeat(E);Y<O;++Y)ut+=r.charAt(F[Y]);return ut}function x(m){if(typeof m!="string")throw new TypeError("Expected String");if(m.length===0)return new Uint8Array;var E=0;if(m[E]!==" "){for(var B=0,C=0;m[E]===g;)B++,E++;for(var I=(m.length-E)*A+1>>>0,O=new Uint8Array(I);m[E];){var F=e[m.charCodeAt(E)];if(F===255)return;for(var tt=0,J=I-1;(F!==0||tt<C)&&J!==-1;J--,tt++)F+=d*O[J]>>>0,O[J]=F%256>>>0,F=F/256>>>0;if(F!==0)throw new Error("Non-zero carry");C=tt,E++}if(m[E]!==" "){for(var Z=I-C;Z!==I&&O[Z]===0;)Z++;for(var Y=new Uint8Array(B+(I-Z)),ut=B;Z!==I;)Y[ut++]=O[Z++];return Y}}}function S(m){var E=x(m);if(E)return E;throw new Error(`Non-${t} character`)}return{encode:w,decodeUnsafe:x,decode:S}}var qi=zi,Gi=qi,yn=Gi;var Nu=new Uint8Array(0);var vn=(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 xn=r=>new TextEncoder().encode(r),Sn=r=>new TextDecoder().decode(r);var sr=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")}},or=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 En(this,t)}},ir=class{constructor(t){this.decoders=t}or(t){return En(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`)}},En=(r,t)=>new ir({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),ar=class{constructor(t,e,n,i){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=i,this.encoder=new sr(t,e,n),this.decoder=new or(t,e,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},qt=({name:r,prefix:t,encode:e,decode:n})=>new ar(r,t,e,n),Rt=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:i}=yn(e,t);return qt({prefix:r,name:t,encode:n,decode:u=>at(i(u))})},Hi=(r,t,e,n)=>{let i={};for(let l=0;l<t.length;++l)i[t[l]]=l;let u=r.length;for(;r[u-1]==="=";)--u;let f=new Uint8Array(u*e/8|0),d=0,g=0,A=0;for(let l=0;l<u;++l){let w=i[r[l]];if(w===void 0)throw new SyntaxError(`Non-${n} character`);g=g<<e|w,d+=e,d>=8&&(d-=8,f[A++]=255&g>>d)}if(d>=e||255&g<<8-d)throw new SyntaxError("Unexpected end of data");return f},Wi=(r,t,e)=>{let n=t[t.length-1]==="=",i=(1<<e)-1,u="",f=0,d=0;for(let g=0;g<r.length;++g)for(d=d<<8|r[g],f+=8;f>e;)f-=e,u+=t[i&d>>f];if(f&&(u+=t[i&d<<e-f]),n)for(;u.length*e&7;)u+="=";return u},k=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>qt({prefix:t,name:r,encode(i){return Wi(i,n,e)},decode(i){return Hi(i,n,e,r)}});var Zi=qt({prefix:"\0",name:"identity",encode:r=>Sn(r),decode:r=>xn(r)});var ur={};nt(ur,{base2:()=>Xi});var Xi=k({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var fr={};nt(fr,{base8:()=>Ji});var Ji=k({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var lr={};nt(lr,{base10:()=>Yi});var Yi=Rt({prefix:"9",name:"base10",alphabet:"0123456789"});var pr={};nt(pr,{base16:()=>Qi,base16upper:()=>Ki});var Qi=k({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ki=k({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var hr={};nt(hr,{base32:()=>ht,base32hex:()=>na,base32hexpad:()=>oa,base32hexpadupper:()=>ia,base32hexupper:()=>sa,base32pad:()=>ea,base32padupper:()=>ra,base32upper:()=>ta,base32z:()=>aa});var ht=k({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ta=k({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ea=k({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ra=k({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),na=k({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),sa=k({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),oa=k({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ia=k({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),aa=k({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var dr={};nt(dr,{base36:()=>ca,base36upper:()=>ua});var ca=Rt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ua=Rt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var mr={};nt(mr,{base58btc:()=>z,base58flickr:()=>fa});var z=Rt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),fa=Rt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var br={};nt(br,{base64:()=>gr,base64pad:()=>la,base64url:()=>pa,base64urlpad:()=>ha});var gr=k({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),la=k({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),pa=k({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ha=k({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var wr={};nt(wr,{base256emoji:()=>wa});var Cn=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}"),da=Cn.reduce((r,t,e)=>(r[e]=t,r),[]),ma=Cn.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function ga(r){return r.reduce((t,e)=>(t+=da[e],t),"")}function ba(r){let t=[];for(let e of r){let n=ma[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var wa=qt({prefix:"\u{1F680}",name:"base256emoji",encode:ga,decode:ba});var Tr={};nt(Tr,{sha256:()=>Na,sha512:()=>La});var Sr=V(yt("crypto"),1);var ya=Bn,An=128,va=127,xa=~va,Sa=Math.pow(2,31);function Bn(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Sa;)t[e++]=r&255|An,r/=128;for(;r&xa;)t[e++]=r&255|An,r>>>=7;return t[e]=r|0,Bn.bytes=e-n+1,t}var Ta=yr,Ea=128,In=127;function yr(r,n){var e=0,n=n||0,i=0,u=n,f,d=r.length;do{if(u>=d)throw yr.bytes=0,new RangeError("Could not decode varint");f=r[u++],e+=i<28?(f&In)<<i:(f&In)*Math.pow(2,i),i+=7}while(f>=Ea);return yr.bytes=u-n,e}var Ca=Math.pow(2,7),Aa=Math.pow(2,14),Ia=Math.pow(2,21),Ba=Math.pow(2,28),Ra=Math.pow(2,35),Ma=Math.pow(2,42),Da=Math.pow(2,49),Pa=Math.pow(2,56),ka=Math.pow(2,63),_a=function(r){return r<Ca?1:r<Aa?2:r<Ia?3:r<Ba?4:r<Ra?5:r<Ma?6:r<Da?7:r<Pa?8:r<ka?9:10},Oa={encode:ya,decode:Ta,encodingLength:_a},Fa=Oa,le=Fa;var pe=(r,t=0)=>[le.decode(r,t),le.decode.bytes],Gt=(r,t,e=0)=>(le.encode(r,t,e),t),Ht=r=>le.encodingLength(r);var Nt=(r,t)=>{let e=t.byteLength,n=Ht(r),i=n+Ht(e),u=new Uint8Array(i+e);return Gt(r,u,0),Gt(e,u,n),u.set(t,i),new Wt(r,e,t,u)},Be=r=>{let t=at(r),[e,n]=pe(t),[i,u]=pe(t.subarray(n)),f=t.subarray(n+u);if(f.byteLength!==i)throw new Error("Incorrect length");return new Wt(e,i,f,t)},Rn=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&vn(r.bytes,e.bytes)}},Wt=class{constructor(t,e,n,i){this.code=t,this.size=e,this.digest=n,this.bytes=i}};var xr=({name:r,code:t,encode:e})=>new vr(r,t,e),vr=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?Nt(this.code,e):e.then(n=>Nt(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Na=xr({name:"sha2-256",code:18,encode:r=>at(Sr.default.createHash("sha256").update(r).digest())}),La=xr({name:"sha2-512",code:19,encode:r=>at(Sr.default.createHash("sha512").update(r).digest())});var Er={};nt(Er,{identity:()=>ja});var Dn=0,Ua="identity",Pn=at,$a=r=>Nt(Dn,Pn(r)),ja={code:Dn,name:Ua,encode:Pn,digest:$a};var of=new TextEncoder,af=new TextDecoder;var kn=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return Ga(e,Cr(r),t||z.encoder);default:return Ha(e,Cr(r),t||ht.encoder)}};var _n=new WeakMap,Cr=r=>{let t=_n.get(r);if(t==null){let e=new Map;return _n.set(r,e),e}return t},D=class{constructor(t,e,n,i){this.code=e,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:e}=this;if(t!==he)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Wa)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return D.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=Nt(t,e);return D.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 D.equals(this,t)}static equals(t,e){let n=e;return n&&t.code===n.code&&t.version===n.version&&Rn(t.multihash,n.multihash)}toString(t){return kn(this,t)}toJSON(){return{"/":kn(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 D)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:i,multihash:u,bytes:f}=e;return new D(n,i,u,f||On(n,i,u.bytes))}else if(e[Za]===!0){let{version:n,multihash:i,code:u}=e,f=Be(i);return D.create(n,u,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!==he)throw new Error(`Version 0 CID must use dag-pb (code: ${he}) block encoding`);return new D(t,e,n,n.bytes)}case 1:{let i=On(t,e,n.bytes);return new D(t,e,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return D.create(0,he,t)}static createV1(t,e){return D.create(1,t,e)}static decode(t){let[e,n]=D.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=D.inspectBytes(t),n=e.size-e.multihashSize,i=at(t.subarray(n,n+e.multihashSize));if(i.byteLength!==e.multihashSize)throw new Error("Incorrect length");let u=i.subarray(e.multihashSize-e.digestSize),f=new Wt(e.multihashCode,e.digestSize,u,i);return[e.version===0?D.createV0(f):D.createV1(e.codec,f),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[w,x]=pe(t.subarray(e));return e+=x,w},i=n(),u=he;if(i===18?(i=0,e=0):u=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let f=e,d=n(),g=n(),A=e+g,l=A-f;return{version:i,codec:u,multihashCode:d,digestSize:g,multihashSize:l,size:A}}static parse(t,e){let[n,i]=qa(t,e),u=D.decode(i);if(u.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Cr(u).set(n,t),u}},qa=(r,t)=>{switch(r[0]){case"Q":{let e=t||z;return[z.prefix,e.decode(`${z.prefix}${r}`)]}case z.prefix:{let e=t||z;return[z.prefix,e.decode(r)]}case ht.prefix:{let e=t||ht;return[ht.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)]}}},Ga=(r,t,e)=>{let{prefix:n}=e;if(n!==z.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let i=t.get(n);if(i==null){let u=e.encode(r).slice(1);return t.set(n,u),u}else return i},Ha=(r,t,e)=>{let{prefix:n}=e,i=t.get(n);if(i==null){let u=e.encode(r);return t.set(n,u),u}else return i},he=112,Wa=18,On=(r,t,e)=>{let n=Ht(r),i=n+Ht(t),u=new Uint8Array(i+e.byteLength);return Gt(r,u,0),Gt(t,u,n),u.set(e,i),u},Za=Symbol.for("@ipld/js-cid/CID");var de={...cr,...ur,...fr,...lr,...pr,...hr,...dr,...mr,...br,...wr},bf={...Tr,...Er};function Xt(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Re(r=0){return globalThis.Buffer?.allocUnsafe!=null?Xt(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Nn(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Fn=Nn("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Ar=Nn("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=Re(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Xa={utf8:Fn,"utf-8":Fn,hex:de.base16,latin1:Ar,ascii:Ar,binary:Ar,...de},Me=Xa;function Q(r,t="utf8"){let e=Me[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)}var Ln=Bt.isIPv4,Ja=Bt.isIPv6,Ir=function(r){let t=0;if(r=r.toString().trim(),Ln(r)){let e=new Uint8Array(t+4);return r.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(Ja(r)){let e=r.split(":",8),n;for(n=0;n<e.length;n++){let u=Ln(e[n]),f;u&&(f=Ir(e[n]),e[n]=Q(f.slice(0,2),"base16")),f!=null&&++n<8&&e.splice(n,0,Q(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 u=[n,1];for(n=9-e.length;n>0;n--)u.push("0");e.splice.apply(e,u)}let i=new Uint8Array(t+16);for(n=0;n<e.length;n++){let u=parseInt(e[n],16);i[t++]=u>>8&255,i[t++]=u&255}return i}throw new Error("invalid ip address")},Un=function(r,t=0,e){t=~~t,e=e??r.length-t;let n=new DataView(r.buffer);if(e===4){let i=[];for(let u=0;u<e;u++)i.push(r[t+u]);return i.join(".")}if(e===16){let i=[];for(let u=0;u<e;u+=2)i.push(n.getUint16(t+u).toString(16));return i.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var me={},Br={},Qa=[[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"]];Qa.forEach(r=>{let t=Ka(...r);Br[t.code]=t,me[t.name]=t});function Ka(r,t,e,n,i){return{code:r,size:t,name:e,resolvable:!!n,path:!!i}}function R(r){if(typeof r=="number"){if(Br[r]!=null)return Br[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(me[r]!=null)return me[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var gt=V(De(),1);function Dr(r,t="utf8"){let e=Me[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Xt(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}function vt(r,t){t==null&&(t=r.reduce((i,u)=>i+u.length,0));let e=Re(t),n=0;for(let i of r)e.set(i,n),n+=i.length;return Xt(e)}var Pe=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,i){return this.readAtomically(()=>{let u=0,f=0,d=this.peekChar();if(d===void 0)return;let g=d==="0",A=2**(8*i)-1;for(;;){let l=this.readAtomically(()=>{let w=this.readChar();if(w===void 0)return;let x=Number.parseInt(w,t);if(!Number.isNaN(x))return x});if(l===void 0)break;if(u*=t,u+=l,u>A||(f+=1,e!==void 0&&f>e))return}if(f!==0)return!n&&g&&f>1?void 0:u})}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 i=n*2;if(n<e.length-3){let f=this.readSeparator(":",n,()=>this.readIPv4Addr());if(f!==void 0)return e[i]=f[0],e[i+1]=f[1],e[i+2]=f[2],e[i+3]=f[3],[i+4,!0]}let u=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(u===void 0)return[i,!1];e[i]=u>>8,e[i+1]=u&255}return[e.length,!1]};return this.readAtomically(()=>{let e=new Uint8Array(16),[n,i]=t(e);if(n===16)return e;if(i||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let u=new Uint8Array(14),f=16-(n+2),[d]=t(u.subarray(0,f));return e.set(u.subarray(0,d),16-d),e})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var zf=new Pe;var Yf=parseInt("0xFFFF",16),Qf=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var Dl=R("ip4"),Pl=R("ip6"),kl=R("ipcidr");function es(r,t){switch(R(r).code){case 4:case 41:return yc(t);case 42:return Kn(t);case 6:case 273:case 33:case 132:return ns(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Kn(t);case 421:return Tc(t);case 444:return ts(t);case 445:return ts(t);case 466:return Sc(t);default:return Q(t,"base16")}}function rs(r,t){switch(R(r).code){case 4:return Yn(t);case 41:return Yn(t);case 42:return Qn(t);case 6:case 273:case 33:case 132:return kr(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Qn(t);case 421:return vc(t);case 444:return Ec(t);case 445:return Cc(t);case 466:return xc(t);default:return Dr(t,"base16")}}var Pr=Object.values(de).map(r=>r.decoder),wc=function(){let r=Pr[0].or(Pr[1]);return Pr.slice(2).forEach(t=>r=r.or(t)),r}();function Yn(r){if(!Ae(r))throw new Error("invalid ip address");return Ir(r)}function yc(r){let t=Un(r,0,r.length);if(t==null)throw new Error("ipBuff is required");if(!Ae(t))throw new Error("invalid ip address");return t}function kr(r){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,r),new Uint8Array(t)}function ns(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Qn(r){let t=Dr(r),e=Uint8Array.from(gt.default.encode(t.length));return vt([e,t],e.length+t.length)}function Kn(r){let t=gt.default.decode(r);if(r=r.slice(gt.default.decode.bytes),r.length!==t)throw new Error("inconsistent lengths");return Q(r)}function vc(r){let t;r[0]==="Q"||r[0]==="1"?t=Be(z.decode(`z${r}`)).bytes:t=D.parse(r).multihash.bytes;let e=Uint8Array.from(gt.default.encode(t.length));return vt([e,t],e.length+t.length)}function xc(r){let t=wc.decode(r),e=Uint8Array.from(gt.default.encode(t.length));return vt([e,t],e.length+t.length)}function Sc(r){let t=gt.default.decode(r),e=r.slice(gt.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return"u"+Q(e,"base64url")}function Tc(r){let t=gt.default.decode(r),e=r.slice(gt.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return Q(e,"base58btc")}function Ec(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=ht.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=kr(n);return vt([e,i],e.length+i.length)}function Cc(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=ht.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=kr(n);return vt([e,i],e.length+i.length)}function ts(r){let t=r.slice(0,r.length-2),e=r.slice(r.length-2),n=Q(t,"base32"),i=ns(e);return`${n}:${i}`}var Jt=V(De(),1);function Ac(r){let t=[],e=r.split("/").slice(1);if(e.length===1&&e[0]==="")return[];for(let n=0;n<e.length;n++){let i=e[n],u=R(i);if(u.size===0){t.push([i]);continue}if(n++,n>=e.length)throw os("invalid address: "+r);if(u.path===!0){t.push([i,Lr(e.slice(n).join("/"))]);break}t.push([i,e[n]])}return t}function Ic(r){let t=[];return r.map(e=>{let n=Oe(e);return t.push(n.name),e.length>1&&e[1]!=null&&t.push(e[1]),null}),Lr(t.join("/"))}function Bc(r){return r.map(t=>{Array.isArray(t)||(t=[t]);let e=Oe(t);return t.length>1?[e.code,rs(e.code,t[1])]:[e.code]})}function _r(r){return r.map(t=>{let e=Oe(t);return t[1]!=null?[e.code,es(e.code,t[1])]:[e.code]})}function Or(r){return _e(vt(r.map(t=>{let e=Oe(t),n=Uint8Array.from(Jt.default.encode(e.code));return t.length>1&&t[1]!=null&&(n=vt([n,t[1]])),n})))}function Fr(r,t){return r.size>0?r.size/8:r.size===0?0:Jt.default.decode(t)+(Jt.default.decode.bytes??0)}function ke(r){let t=[],e=0;for(;e<r.length;){let n=Jt.default.decode(r,e),i=Jt.default.decode.bytes??0,u=R(n),f=Fr(u,r.slice(e+i));if(f===0){t.push([n]),e+=i;continue}let d=r.slice(e+i,e+i+f);if(e+=f+i,e>r.length)throw os("Invalid address Uint8Array: "+Q(r,"base16"));t.push([n,d])}return t}function Nr(r){let t=ke(r),e=_r(t);return Ic(e)}function Rc(r){r=Lr(r);let t=Ac(r),e=Bc(t);return Or(e)}function ss(r){return Rc(r)}function _e(r){let t=Mc(r);if(t!=null)throw t;return Uint8Array.from(r)}function Mc(r){try{ke(r)}catch(t){return t}}function Lr(r){return"/"+r.trim().split("/").filter(t=>t).join("/")}function os(r){return new Error("Error parsing address: "+r)}function Oe(r){return R(r[0])}var Ur=V(De(),1);var xt=class extends Error{constructor(t="The operation was aborted"){super(t),this.code=xt.code,this.type=xt.type}static get code(){return"ABORT_ERR"}static get type(){return"aborted"}},K=class extends Error{constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};function is(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 St=function(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)},Yt=function(r,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!i:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,e):i?i.value=e:t.set(r,e),e},ge,be,we,Mt,as,Pc=Symbol.for("nodejs.util.inspect.custom"),kc=[R("dns").code,R("dns4").code,R("dns6").code,R("dnsaddr").code],_c=new Map,cs=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Oc(r){return!!r?.[cs]}var Tt=class{constructor(t){if(ge.set(this,void 0),be.set(this,void 0),we.set(this,void 0),Mt.set(this,void 0),this[as]=!0,t==null&&(t=""),t instanceof Uint8Array)this.bytes=_e(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);this.bytes=ss(t)}else if(Oc(t))this.bytes=_e(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return St(this,ge,"f")==null&&Yt(this,ge,Nr(this.bytes),"f"),St(this,ge,"f")}toJSON(){return this.toString()}toOptions(){let t,e,n,i,u="",f=R("tcp"),d=R("udp"),g=R("ip4"),A=R("ip6"),l=R("dns6"),w=R("ip6zone");for(let[S,m]of this.stringTuples())S===w.code&&(u=`%${m??""}`),kc.includes(S)&&(e=f.name,i=443,n=`${m??""}${u}`,t=S===l.code?6:4),(S===f.code||S===d.code)&&(e=R(S).name,i=parseInt(m??"")),(S===g.code||S===A.code)&&(e=R(S).name,n=`${m??""}${u}`,t=S===A.code?6:4);if(t==null||e==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:e,port:i}}protos(){return this.protoCodes().map(t=>Object.assign({},R(t)))}protoCodes(){let t=[],e=this.bytes,n=0;for(;n<e.length;){let i=Ur.default.decode(e,n),u=Ur.default.decode.bytes??0,f=R(i),d=Fr(f,e.slice(n+u));n+=d+u,t.push(i)}return t}protoNames(){return this.protos().map(t=>t.name)}tuples(){return St(this,be,"f")==null&&Yt(this,be,ke(this.bytes),"f"),St(this,be,"f")}stringTuples(){return St(this,we,"f")==null&&Yt(this,we,_r(this.tuples()),"f"),St(this,we,"f")}encapsulate(t){return t=new Tt(t),new Tt(this.toString()+t.toString())}decapsulate(t){let e=t.toString(),n=this.toString(),i=n.lastIndexOf(e);if(i<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new Tt(n.slice(0,i))}decapsulateCode(t){let e=this.tuples();for(let n=e.length-1;n>=0;n--)if(e[n][0]===t)return new Tt(Or(e.slice(0,n)));return this}getPeerId(){try{let e=this.stringTuples().filter(n=>n[0]===me.ipfs.code).pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?Q(z.decode(`z${n}`),"base58btc"):Q(D.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){if(St(this,Mt,"f")===void 0)try{Yt(this,Mt,this.stringTuples().filter(t=>R(t[0]).path===!0)[0][1],"f"),St(this,Mt,"f")==null&&Yt(this,Mt,null,"f")}catch{Yt(this,Mt,null,"f")}return St(this,Mt,"f")}equals(t){return is(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(u=>u.resolvable);if(e==null)return[this];let n=_c.get(e.name);if(n==null)throw new K(`no available resolver for ${e.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(u=>new Tt(u))}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)}[(ge=new WeakMap,be=new WeakMap,we=new WeakMap,Mt=new WeakMap,as=cs,Pc)](){return`Multiaddr(${Nr(this.bytes)})`}};function bt(r){return new Tt(r)}var Fc=v("dns4"),Nc=v("dns6"),Lc=v("dnsaddr"),Lt=L(v("dns"),Lc,Fc,Nc),Fe=L(v("ip4"),v("ip6")),Pt=L(T(Fe,v("tcp")),T(Lt,v("tcp"))),Ne=T(Fe,v("udp")),Uc=T(Ne,v("utp")),$c=T(Ne,v("quic")),jc=T(Ne,v("quic-v1")),ye=L(T(Pt,v("ws")),T(Lt,v("ws"))),ve=L(T(Pt,v("wss")),T(Lt,v("wss")),T(Pt,v("tls"),v("ws")),T(Lt,v("tls"),v("ws"))),$r=L(T(Pt,v("http")),T(Fe,v("http")),T(Lt,v("http"))),jr=L(T(Pt,v("https")),T(Fe,v("https")),T(Lt,v("https"))),us=T(Ne,v("webrtc-direct"),v("certhash")),ps=L(T(us,v("p2p")),us),fs=T(jc,v("webtransport"),v("certhash"),v("certhash")),hs=L(T(fs,v("p2p")),fs),ds=L(T(ye,v("p2p-webrtc-star"),v("p2p")),T(ve,v("p2p-webrtc-star"),v("p2p")),T(ye,v("p2p-webrtc-star")),T(ve,v("p2p-webrtc-star"))),ep=L(T(ye,v("p2p-websocket-star"),v("p2p")),T(ve,v("p2p-websocket-star"),v("p2p")),T(ye,v("p2p-websocket-star")),T(ve,v("p2p-websocket-star"))),ms=L(T($r,v("p2p-webrtc-direct"),v("p2p")),T(jr,v("p2p-webrtc-direct"),v("p2p")),T($r,v("p2p-webrtc-direct")),T(jr,v("p2p-webrtc-direct"))),Kt=L(ye,ve,$r,jr,ds,ms,Pt,Uc,$c,Lt,ps,hs),rp=L(T(Kt,v("p2p-stardust"),v("p2p")),T(Kt,v("p2p-stardust"))),Dt=L(T(Kt,v("p2p")),ds,ms,ps,hs,v("p2p")),ls=L(T(Dt,v("p2p-circuit"),Dt),T(Dt,v("p2p-circuit")),T(v("p2p-circuit"),Dt),T(Kt,v("p2p-circuit")),T(v("p2p-circuit"),Kt),v("p2p-circuit")),gs=()=>L(T(ls,gs),ls),Qt=gs(),np=L(T(Qt,Dt,Qt),T(Dt,Qt),T(Qt,Dt),Qt,Dt);var sp=L(T(Qt,v("webrtc")),T(Kt,v("webrtc")),v("webrtc"));function bs(r){function t(e){let n;try{n=bt(e)}catch{return!1}let i=r(n.protoNames());return i===null?!1:i===!0||i===!1?i:i.length===0}return t}function T(...r){function t(e){if(e.length<r.length)return null;let n=e;return r.some(i=>(n=typeof i=="function"?i().partialMatch(e):i.partialMatch(e),Array.isArray(n)&&(e=n),n===null)),n}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:bs(t),partialMatch:t}}function L(...r){function t(n){let i=null;return r.some(u=>{let f=typeof u=="function"?u().partialMatch(n):u.partialMatch(n);return f!=null?(i=f,!0):!1}),i}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:bs(t),partialMatch:t}}function v(r){let t=r;function e(i){let u;try{u=bt(i)}catch{return!1}let f=u.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:e,partialMatch:n}}var ct=V(Bs(),1);ct.default.formatters.b=r=>r==null?"undefined":z.baseEncode(r);ct.default.formatters.t=r=>r==null?"undefined":ht.baseEncode(r);ct.default.formatters.m=r=>r==null?"undefined":gr.baseEncode(r);ct.default.formatters.p=r=>r==null?"undefined":r.toString();ct.default.formatters.c=r=>r==null?"undefined":r.toString();ct.default.formatters.k=r=>r==null?"undefined":r.toString();function pu(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 kt(r){let t=pu(`${r}:trace`);return ct.default.enabled(`${r}:trace`)&&ct.default.names.map(e=>e.toString()).find(e=>e.includes(":trace"))!=null&&(t=(0,ct.default)(`${r}:trace`)),Object.assign((0,ct.default)(r),{error:(0,ct.default)(`${r}:error`),trace:t})}var Ys=V(Fs(),1);function ze(r){return this.subnetMask<r.subnetMask?!1:this.mask(r.subnetMask)===r.mask()}function qe(r){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===r&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}var oe=/^(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,Wr=/\/\d{1,2}$/;var G=class extends Error{constructor(t,e){super(t),this.name="AddressError",e!==null&&(this.parseMessage=e)}};var ie=V(Zr(),1),$t=V(xe(),1),P=class{constructor(t){this.groups=4,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=qe(32),this.isInSubnet=ze,this.address=t;let e=Wr.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 G("Invalid subnet mask.");t=t.replace(Wr,"")}this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}static isValid(t){try{return new P(t),!0}catch{return!1}}parse(t){let e=t.split(".");if(!t.match(oe))throw new G("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=[],i;for(i=0;i<8;i+=2){let u=e.slice(i,i+2);n.push(parseInt(u,16))}return new P(n.join("."))}static fromInteger(t){return P.fromHex(t.toString(16))}static fromArpa(t){let n=t.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new P(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=[],e;for(e=0;e<4;e+=2){let n=(0,$t.sprintf)("%02x%02x",parseInt(this.parsedAddress[e],10),parseInt(this.parsedAddress[e+1],10));t.push((0,$t.sprintf)("%x",parseInt(n,16)))}return t.join(":")}bigInteger(){return new ie.BigInteger(this.parsedAddress.map(t=>(0,$t.sprintf)("%02x",parseInt(t,10))).join(""),16)}_startAddress(){return new ie.BigInteger(this.mask()+"0".repeat(32-this.subnetMask),2)}startAddress(){return P.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new ie.BigInteger("1");return P.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new ie.BigInteger(this.mask()+"1".repeat(32-this.subnetMask),2)}endAddress(){return P.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new ie.BigInteger("1");return P.fromBigInteger(this._endAddress().subtract(t))}static fromBigInteger(t){return P.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,$t.sprintf)("%s.in-addr.arpa.",e)}isMulticast(){return this.isInSubnet(new P("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(32,"0")}groupForV6(){let t=this.parsedAddress;return this.address.replace(oe,(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 js={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},Xr={"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"},Jr=/([^0-9a-f:/%])/gi,Yr=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,Qr=/\/\d{1,3}(?=%|$)/,Kr=/%.*$/,Vs=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),zs=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/);var Gs=V(xe(),1);function bu(r){return r.replace(/^(0+)/,'<span class="zero">$1</span>')}function We(r,t=0){return r.split(":").map((n,i)=>/group-v4/.test(n)?n:(0,Gs.sprintf)('<span class="hover-group group-%d">%s</span>',i+t,bu(n)))}var Vt=V(xe(),1);function en(r){return(0,Vt.sprintf)("(%s)",r.join("|"))}function tn(r){return r.length<4?(0,Vt.sprintf)("0{0,%d}%s",4-r.length,r):r}var rn="[^A-Fa-f0-9:]";function Ze(r){let t=[];r.forEach((n,i)=>{parseInt(n,16)===0&&t.push(i)});let e=t.map(n=>r.map((i,u)=>{if(u===n){let f=u===0||u===8-1?":":"";return en([tn(i),f])}return tn(i)}).join(":"));return e.push(r.map(tn).join(":")),en(e)}function nn(r,t,e){let n=t?"":":",i=e?"":":",u=[];!t&&!e&&u.push("::"),t&&e&&u.push(""),(e&&!t||!e&&t)&&u.push(":"),u.push((0,Vt.sprintf)("%s(:0{1,4}){1,%d}",n,r-1)),u.push((0,Vt.sprintf)("(0{1,4}:){1,%d}%s",r-1,i)),u.push((0,Vt.sprintf)("(0{1,4}:){%d}0{1,4}",r-1));for(let f=1;f<r-1;f++)for(let d=1;d<r-f;d++)u.push((0,Vt.sprintf)("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",d,r-d-f-1));return en(u)}var H=V(Zr(),1),W=V(xe(),1);function Xe(r){if(!r)throw new Error("Assertion failed.")}function wu(r){let t=/(\d+)(\d{3})/;for(;t.test(r);)r=r.replace(t,"$1,$2");return r}function yu(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 vu(r,t){let e=[],n=[],i;for(i=0;i<r.length;i++)i<t[0]?e.push(r[i]):i>t[1]&&n.push(r[i]);return e.concat(["compact"]).concat(n)}function Ws(r){return(0,W.sprintf)("%04x",parseInt(r,16))}function Zs(r){return r&255}var _=class{constructor(t,e){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=ze,this.isCorrect=qe(128),e===void 0?this.groups=8:this.groups=e,this.address=t;let n=Qr.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 G("Invalid subnet mask.");t=t.replace(Qr,"")}else if(/\//.test(t))throw new G("Invalid subnet mask.");let i=Kr.exec(t);i&&(this.zone=i[0],t=t.replace(Kr,"")),this.addressMinusSuffix=t,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(t){try{return new _(t),!0}catch{return!1}}static fromBigInteger(t){let e=t.toString(16).padStart(32,"0"),n=[],i;for(i=0;i<8;i++)n.push(e.slice(i*4,(i+1)*4));return new _(n.join(":"))}static fromURL(t){let e,n=null,i;if(t.indexOf("[")!==-1&&t.indexOf("]:")!==-1){if(i=zs.exec(t),i===null)return{error:"failed to parse address with port",address:null,port:null};e=i[1],n=i[2]}else if(t.indexOf("/")!==-1){if(t=t.replace(/^[a-z0-9]+:\/\//,""),i=Vs.exec(t),i===null)return{error:"failed to parse address from URL",address:null,port:null};e=i[1]}else e=t;return n?(n=parseInt(n,10),(n<0||n>65536)&&(n=null)):n=null,{address:new _(e),port:n}}static fromAddress4(t){let e=new P(t),n=128-(32-e.subnetMask);return new _(`::ffff:${e.correctForm()}/${n}`)}static fromArpa(t){let e=t.replace(/(\.ip6\.arpa)?\.$/,""),n=7;if(e.length!==63)throw new G("Invalid 'ip6.arpa' form.");let i=e.split(".").reverse();for(let u=n;u>0;u--){let f=u*4;i.splice(f,0,":")}return e=i.join(""),new _(e)}microsoftTranscription(){return(0,W.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),i=e-n;return i<0?"0":wu(new H.BigInteger("2",10).pow(i).toString(10))}_startAddress(){return new H.BigInteger(this.mask()+"0".repeat(128-this.subnetMask),2)}startAddress(){return _.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new H.BigInteger("1");return _.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new H.BigInteger(this.mask()+"1".repeat(128-this.subnetMask),2)}endAddress(){return _.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new H.BigInteger("1");return _.fromBigInteger(this._endAddress().subtract(t))}getScope(){let t=js[this.getBits(12,16).intValue()];return this.getType()==="Global unicast"&&t!=="Link local"&&(t="Global"),t||"Unknown"}getType(){for(let t of Object.keys(Xr))if(this.isInSubnet(new _(t)))return Xr[t];return"Global unicast"}getBits(t,e){return new H.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,W.sprintf)("%s.ip6.arpa.",n):t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,e=[],n=0,i=[];for(t=0;t<this.parsedAddress.length;t++){let d=parseInt(this.parsedAddress[t],16);d===0&&n++,d!==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 u=i.map(d=>d[1]-d[0]+1);if(i.length>0){let d=u.indexOf(Math.max(...u));e=vu(this.parsedAddress,i[d])}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(":"),i=e.slice(-1)[0].match(oe);if(i){this.parsedAddress4=i[0],this.address4=new P(this.parsedAddress4);for(let u=0;u<this.address4.groups;u++)if(/^0[0-9]+/.test(this.address4.parsedAddress[u]))throw new G("IPv4 addresses can't have leading zeroes.",t.replace(oe,this.address4.parsedAddress.map(yu).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(Jr);if(e)throw new G((0,W.sprintf)("Bad character%s detected in address: %s",e.length>1?"s":"",e.join("")),t.replace(Jr,'<span class="parse-error">$1</span>'));let n=t.match(Yr);if(n)throw new G((0,W.sprintf)("Address failed regex: %s",n.join("")),t.replace(Yr,'<span class="parse-error">$1</span>'));let i=[],u=t.split("::");if(u.length===2){let f=u[0].split(":"),d=u[1].split(":");f.length===1&&f[0]===""&&(f=[]),d.length===1&&d[0]===""&&(d=[]);let g=this.groups-(f.length+d.length);if(!g)throw new G("Error parsing groups");this.elidedGroups=g,this.elisionBegin=f.length,this.elisionEnd=f.length+this.elidedGroups,i=i.concat(f);for(let A=0;A<g;A++)i.push("0");i=i.concat(d)}else if(u.length===1)i=t.split(":"),this.elidedGroups=0;else throw new G("Too many :: groups found");if(i=i.map(f=>(0,W.sprintf)("%x",parseInt(f,16))),i.length!==this.groups)throw new G("Incorrect number of groups found");return i}canonicalForm(){return this.parsedAddress.map(Ws).join(":")}decimal(){return this.parsedAddress.map(t=>(0,W.sprintf)("%05d",parseInt(t,16))).join(":")}bigInteger(){return new H.BigInteger(this.parsedAddress.map(Ws).join(""),16)}to4(){let t=this.binaryZeroPad().split("");return P.fromHex(new H.BigInteger(t.slice(96,128).join(""),2).toString(16))}to4in6(){let t=this.to4(),n=new _(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),i="";return/:$/.test(n)||(i=":"),n+i+t.address}inspectTeredo(){let t=this.getBitsBase16(0,32),e=this.getBits(80,96).xor(new H.BigInteger("ffff",16)).toString(),n=P.fromHex(this.getBitsBase16(32,64)),i=P.fromHex(this.getBits(96,128).xor(new H.BigInteger("ffffffff",16)).toString(16)),u=this.getBits(64,80),f=this.getBitsBase2(64,80),d=u.testBit(15),g=u.testBit(14),A=u.testBit(8),l=u.testBit(9),w=new H.BigInteger(f.slice(2,6)+f.slice(8,16),2).toString(10);return{prefix:(0,W.sprintf)("%s:%s",t.slice(0,4),t.slice(4,8)),server4:n.address,client4:i.address,flags:f,coneNat:d,microsoft:{reserved:g,universalLocal:l,groupIndividual:A,nonce:w},udpPort:e}}inspect6to4(){let t=this.getBitsBase16(0,16),e=P.fromHex(this.getBitsBase16(16,48));return{prefix:(0,W.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 _(t)}toByteArray(){let t=this.bigInteger().toByteArray();return t.length===17&&t[0]===0?t.slice(1):t}toUnsignedByteArray(){return this.toByteArray().map(Zs)}static fromByteArray(t){return this.fromUnsignedByteArray(t.map(Zs))}static fromUnsignedByteArray(t){let e=new H.BigInteger("256",10),n=new H.BigInteger("0",10),i=new H.BigInteger("1",10);for(let u=t.length-1;u>=0;u--)n=n.add(i.multiply(new H.BigInteger(t[u].toString(10),10))),i=i.multiply(e);return _.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 _("2001::/32"))}is6to4(){return this.isInSubnet(new _("2002::/16"))}isLoopback(){return this.getType()==="Loopback"}href(t){return t===void 0?t="":t=(0,W.sprintf)(":%s",t),(0,W.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,W.sprintf)('<a href="%1$s%2$s" class="%3$s">%2$s</a>',t.prefix,e.call(this),t.className):(0,W.sprintf)('<a href="%1$s%2$s">%2$s</a>',t.prefix,e.call(this))}group(){if(this.elidedGroups===0)return We(this.address).join(":");Xe(typeof this.elidedGroups=="number"),Xe(typeof this.elisionBegin=="number");let t=[],[e,n]=this.address.split("::");e.length?t.push(...We(e)):t.push("");let i=["hover-group"];for(let u=this.elisionBegin;u<this.elisionBegin+this.elidedGroups;u++)i.push((0,W.sprintf)("group-%d",u));return t.push((0,W.sprintf)('<span class="%s"></span>',i.join(" "))),n.length?t.push(...We(n,this.elisionEnd)):t.push(""),this.is4()&&(Xe(this.address4 instanceof P),t.pop(),t.push(this.address4.groupForV6())),t.join(":")}regularExpressionString(t=!1){let e=[],n=new _(this.correctForm());if(n.elidedGroups===0)e.push(Ze(n.parsedAddress));else if(n.elidedGroups===8)e.push(nn(8));else{let i=n.address.split("::");i[0].length&&e.push(Ze(i[0].split(":"))),Xe(typeof n.elidedGroups=="number"),e.push(nn(n.elidedGroups,i[0].length!==0,i[1].length!==0)),i[1].length&&e.push(Ze(i[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 xu=kt("libp2p:ip-port-to-multiaddr"),sn={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};function Xs(r,t){if(typeof r!="string")throw new K(`invalid ip provided: ${r}`,sn.ERR_INVALID_IP_PARAMETER);if(typeof t=="string"&&(t=parseInt(t)),isNaN(t))throw new K(`invalid port provided: ${t}`,sn.ERR_INVALID_PORT_PARAMETER);try{return new P(r),bt(`/ip4/${r}/tcp/${t}`)}catch{}try{let e=new _(r);return e.is4()?bt(`/ip4/${e.to4().correctForm()}/tcp/${t}`):bt(`/ip6/${r}/tcp/${t}`)}catch{let n=`invalid ip:port for creating a multiaddr: ${r}:${t}`;throw xu.error(n),new K(n,sn.ERR_INVALID_IP)}}var on=V(yt("os"),1),Js=V(yt("path"),1),Su={ip4:"IPv4",ip6:"IPv6"};function ce(r,t={}){let e=r.getPath();return e!=null?on.default.platform()==="win32"?{path:Js.default.join("\\\\.\\pipe\\",e)}:{path:e}:{...r.toOptions(),...t}}function an(r,t,e){let n=i=>bt(`/${r}/${i}/tcp/${e}`);return(Tu(t)?Cu(Su[r]):[t]).map(n)}function Tu(r){return["0.0.0.0","::"].includes(r)}var Eu=on.default.networkInterfaces();function Cu(r){let t=[];for(let[,e]of Object.entries(Eu))if(e!=null)for(let n of e)n.family===r&&t.push(n.address);return t}var mt=kt("libp2p:tcp:socket"),Je=(r,t)=>{let e=t.metrics,n=t.metricPrefix??"",i=t.socketInactivityTimeout??3e5,u=t.socketCloseTimeout??2e3;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 K("Could not determine remote address or port","ERR_NO_REMOTE_ADDRESS");f=Xs(r.remoteAddress,r.remotePort)}let d=ce(f),g=d.path??`${d.host??""}:${d.port??""}`,{sink:A,source:l}=Ys.default.duplex(r);r.setTimeout(i,()=>{mt("%s socket read timeout",g),e?.increment({[`${n}timeout`]:!0});let x;r.readable&&(x=new K("Socket read timeout","ERR_SOCKET_READ_TIMEOUT")),r.destroy(x)}),r.once("close",()=>{mt("%s socket close",g),e?.increment({[`${n}close`]:!0}),w.timeline.close==null&&(w.timeline.close=Date.now())}),r.once("end",()=>{mt("%s socket end",g),e?.increment({[`${n}end`]:!0})});let w={async sink(x){try{await A(x)}catch(S){S.type!=="aborted"&&mt(S)}r.end()},source:l,remoteAddr:f,timeline:{open:Date.now()},async close(){if(r.destroyed){mt("%s socket was already destroyed when trying to close",g);return}mt("%s closing socket",g),await new Promise((x,S)=>{let m=Date.now(),E;r.once("close",()=>{mt("%s socket closed",g),E!==void 0&&clearTimeout(E),x()}),r.once("error",B=>{mt("%s socket error",g,B),w.timeline.close==null&&(w.timeline.close=Date.now()),r.destroyed&&E!==void 0&&clearTimeout(E),S(B)}),r.setTimeout(u),r.end(),r.writableLength>0?(E=setTimeout(()=>{r.destroyed?(mt("%s is already destroyed",g),x()):(mt("%s socket close timeout after %dms, destroying it manually",g,Date.now()-m),r.destroy(new K("Socket close timeout","ERR_SOCKET_CLOSE_TIMEOUT")))},u).unref(),r.once("drain",()=>{mt("%s socket drained",g),r.destroy()})):r.destroy()})}};return w};var Qs=V(yt("net"),1);var zt=function(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)},Ct,Ye=class extends EventTarget{constructor(){super(...arguments),Ct.set(this,new Map)}listenerCount(t){let e=zt(this,Ct,"f").get(t);return e==null?0:e.length}addEventListener(t,e,n){super.addEventListener(t,e,n);let i=zt(this,Ct,"f").get(t);i==null&&(i=[],zt(this,Ct,"f").set(t,i)),i.push({callback:e,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(t,e,n){super.removeEventListener(t.toString(),e??null,n);let i=zt(this,Ct,"f").get(t);i!=null&&(i=i.filter(({callback:u})=>u!==e),zt(this,Ct,"f").set(t,i))}dispatchEvent(t){let e=super.dispatchEvent(t),n=zt(this,Ct,"f").get(t.type);return n==null||(n=n.filter(({once:i})=>!i),zt(this,Ct,"f").set(t.type,n)),e}safeDispatchEvent(t,e){return this.dispatchEvent(new ue(t,e))}};Ct=new WeakMap;var cn=class extends Event{constructor(t,e){super(t,e),this.detail=e?.detail}},ue=globalThis.CustomEvent??cn;var ot=kt("libp2p:tcp:listener");async function un(r){try{await r.close()}catch(t){ot.error("an error occurred closing the connection",t)}}var Bu=1,Ru=0,Qe=class extends Ye{constructor(t){if(super(),this.context=t,this.connections=new Set,this.status={started:!1},t.keepAlive=t.keepAlive??!0,this.addr="unknown",this.server=Qs.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]:Bu})}this.dispatchEvent(new ue("listening"))}).on("error",e=>{this.metrics?.errors.increment({[`${this.addr} listen_error`]:!0}),this.dispatchEvent(new ue("error",{detail:e}))}).on("close",()=>{this.metrics?.status.update({[this.addr]:Ru}),this.dispatchEvent(new ue("close"))})}onSocket(t){t.on("error",n=>{ot("socket error",n),this.metrics?.events.increment({[`${this.addr} error`]:!0})});let e;try{e=Je(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(i=>{ot.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 ue("connection",{detail:n}))}).catch(async n=>{ot.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_upgrade`]:!0}),await un(e)}).catch(n=>{ot.error("closing inbound connection failed",n)})}catch(n){ot.error("inbound connection failed",n),un(e).catch(i=>{ot.error("closing inbound connection failed",i),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:i}=this.status;if(e==null)return[];if(typeof e=="string")t=[n];else try{n.toString().startsWith("/ip4")?t=t.concat(an("ip4",e.address,e.port)):e.family==="IPv6"&&(t=t.concat(an("ip6",e.address,e.port)))}catch(u){ot.error("could not turn %s:%s into multiaddr",e.address,e.port,u)}return t.map(u=>i!=null?u.encapsulate(`/p2p/${i}`):u)}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:i}=this.context;this.status={started:!0,listeningAddr:n,peerId:e,netConfig:ce(n,{backlog:i})},await this.netListen()}async close(){await Promise.all(Array.from(this.connections.values()).map(async t=>{await un(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 to=Symbol.for("@libp2p/transport");var Ks;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(Ks||(Ks={}));var At=kt("libp2p:tcp"),ln=class{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"})})}get[to](){return!0}get[Symbol.toStringTag](){return"@libp2p/tcp"}async dial(t,e){e.keepAlive=e.keepAlive??!0;let n=await this._connect(t,e);n.on("error",d=>{At("socket error",d)});let i=Je(n,{remoteAddr:t,socketInactivityTimeout:this.opts.outboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.metrics?.dialerEvents}),u=()=>{i.close().catch(d=>{At.error("Error closing maConn after abort",d)})};e.signal?.addEventListener("abort",u,{once:!0}),At("new outbound connection %s",i.remoteAddr);let f=await e.upgrader.upgradeOutbound(i);if(At("outbound connection %s upgraded",i.remoteAddr),e.signal?.removeEventListener("abort",u),e.signal?.aborted===!0)throw f.close().catch(d=>{At.error("Error closing conn after abort",d)}),new xt;return f}async _connect(t,e){if(e.signal?.aborted===!0)throw new xt;return await new Promise((n,i)=>{let u=Date.now(),f=ce(t),d=f.path??`${f.host??""}:${f.port}`;At("dialing %j",f);let g=eo.default.connect(f),A=m=>{m.message=`connection error ${d}: ${m.message}`,this.metrics?.dialerEvents.increment({error:!0}),S(m)},l=()=>{At("connection timeout %s",d),this.metrics?.dialerEvents.increment({timeout:!0});let m=new K(`connection timeout after ${Date.now()-u}ms`,"ERR_CONNECT_TIMEOUT");g.emit("error",m)},w=()=>{At("connection opened %j",f),this.metrics?.dialerEvents.increment({connect:!0}),S()},x=()=>{At("connection aborted %j",f),this.metrics?.dialerEvents.increment({abort:!0}),g.destroy(),S(new xt)},S=m=>{if(g.removeListener("error",A),g.removeListener("timeout",l),g.removeListener("connect",w),e.signal!=null&&e.signal.removeEventListener("abort",x),m!=null){i(m);return}n(g)};g.on("error",A),g.on("timeout",l),g.on("connect",w),e.signal!=null&&e.signal.addEventListener("abort",x)})}createListener(t){return new Qe({...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:Pt.matches(e.decapsulateCode(421)))}};function Pu(r={}){return(t={})=>new ln(t,r)}return Vi(ku);})();
7
7
  return Libp2PTcp}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/tcp",
3
- "version": "6.2.0",
3
+ "version": "6.2.2",
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-tcp#readme",
@@ -155,8 +155,8 @@
155
155
  "@libp2p/interface-mocks": "^9.1.1",
156
156
  "@libp2p/interface-transport-compliance-tests": "^3.0.0",
157
157
  "aegir": "^38.1.0",
158
- "it-all": "^2.0.0",
159
- "it-pipe": "^2.0.3",
158
+ "it-all": "^3.0.1",
159
+ "it-pipe": "^3.0.1",
160
160
  "p-defer": "^4.0.0",
161
161
  "sinon": "^15.0.0",
162
162
  "uint8arrays": "^4.0.2"