@libp2p/daemon-server 4.0.3 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +4 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/pubsub.d.ts +1 -0
- package/dist/src/pubsub.d.ts.map +1 -1
- package/dist/src/pubsub.js +14 -0
- package/dist/src/pubsub.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +7 -0
- package/src/pubsub.ts +14 -0
package/dist/index.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PDaemonServer = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var Libp2PDaemonServer=(()=>{var Bu=Object.create;var Sr=Object.defineProperty;var Du=Object.getOwnPropertyDescriptor;var ku=Object.getOwnPropertyNames;var Ru=Object.getPrototypeOf,Lu=Object.prototype.hasOwnProperty;var Ft=(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 D=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),dt=(r,t)=>{for(var e in t)Sr(r,e,{get:t[e],enumerable:!0})},uo=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ku(t))!Lu.call(r,i)&&i!==e&&Sr(r,i,{get:()=>t[i],enumerable:!(n=Du(t,i))||n.enumerable});return r};var N=(r,t,e)=>(e=r!=null?Bu(Ru(r)):{},uo(t||!r||!r.__esModule?Sr(e,"default",{value:r,enumerable:!0}):e,r)),Ou=r=>uo(Sr({},"__esModule",{value:!0}),r);var Oo=D((Hp,Lo)=>{Lo.exports=Jn;var Ro=128,Hl=127,Wl=~Hl,ql=Math.pow(2,31);function Jn(r,t,e){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw Jn.bytes=0,new RangeError("Could not encode varint");t=t||[],e=e||0;for(var n=e;r>=ql;)t[e++]=r&255|Ro,r/=128;for(;r&Wl;)t[e++]=r&255|Ro,r>>>=7;return t[e]=r|0,Jn.bytes=e-n+1,t}});var Po=D((Wp,Mo)=>{Mo.exports=Qn;var Zl=128,No=127;function Qn(r,n){var e=0,n=n||0,i=0,o=n,a,l=r.length;do{if(o>=l||i>49)throw Qn.bytes=0,new RangeError("Could not decode varint");a=r[o++],e+=i<28?(a&No)<<i:(a&No)*Math.pow(2,i),i+=7}while(a>=Zl);return Qn.bytes=o-n,e}});var Fo=D((qp,Uo)=>{var Kl=Math.pow(2,7),Xl=Math.pow(2,14),Yl=Math.pow(2,21),jl=Math.pow(2,28),Jl=Math.pow(2,35),Ql=Math.pow(2,42),tf=Math.pow(2,49),ef=Math.pow(2,56),rf=Math.pow(2,63);Uo.exports=function(r){return r<Kl?1:r<Xl?2:r<Yl?3:r<jl?4:r<Jl?5:r<Ql?6:r<tf?7:r<ef?8:r<rf?9:10}});var _r=D((Zp,Go)=>{Go.exports={encode:Oo(),decode:Po(),encodingLength:Fo()}});var Rr=D((pd,jo)=>{"use strict";function Yo(r,t){for(let e in t)Object.defineProperty(r,e,{value:t[e],enumerable:!0,configurable:!0});return r}function bf(r,t,e){if(!r||typeof r=="string")throw new TypeError("Please pass an Error to err-code");e||(e={}),typeof t=="object"&&(e=t,t=""),t&&(e.code=t);try{return Yo(r,e)}catch{e.message=r.message,e.stack=r.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(r)),Yo(new i,e)}}jo.exports=bf});var as=D((Ad,cs)=>{var Ne=1e3,Me=Ne*60,Pe=Me*60,me=Pe*24,Bf=me*7,Df=me*365.25;cs.exports=function(r,t){t=t||{};var e=typeof r;if(e==="string"&&r.length>0)return kf(r);if(e==="number"&&isFinite(r))return t.long?Lf(r):Rf(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function kf(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*Df;case"weeks":case"week":case"w":return e*Bf;case"days":case"day":case"d":return e*me;case"hours":case"hour":case"hrs":case"hr":case"h":return e*Pe;case"minutes":case"minute":case"mins":case"min":case"m":return e*Me;case"seconds":case"second":case"secs":case"sec":case"s":return e*Ne;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function Rf(r){var t=Math.abs(r);return t>=me?Math.round(r/me)+"d":t>=Pe?Math.round(r/Pe)+"h":t>=Me?Math.round(r/Me)+"m":t>=Ne?Math.round(r/Ne)+"s":r+"ms"}function Lf(r){var t=Math.abs(r);return t>=me?Or(r,t,me,"day"):t>=Pe?Or(r,t,Pe,"hour"):t>=Me?Or(r,t,Me,"minute"):t>=Ne?Or(r,t,Ne,"second"):r+" ms"}function Or(r,t,e,n){var i=t>=e*1.5;return Math.round(r/e)+" "+n+(i?"s":"")}});var fi=D((Id,us)=>{function Of(r){e.debug=e,e.default=e,e.coerce=f,e.disable=o,e.enable=i,e.enabled=a,e.humanize=as(),e.destroy=d,Object.keys(r).forEach(h=>{e[h]=r[h]}),e.names=[],e.skips=[],e.formatters={};function t(h){let g=0;for(let w=0;w<h.length;w++)g=(g<<5)-g+h.charCodeAt(w),g|=0;return e.colors[Math.abs(g)%e.colors.length]}e.selectColor=t;function e(h){let g,w=null,S,b;function T(...B){if(!T.enabled)return;let I=T,_=Number(new Date),G=_-(g||_);I.diff=G,I.prev=g,I.curr=_,g=_,B[0]=e.coerce(B[0]),typeof B[0]!="string"&&B.unshift("%O");let W=0;B[0]=B[0].replace(/%([a-zA-Z%])/g,(ct,ot)=>{if(ct==="%%")return"%";W++;let at=e.formatters[ot];if(typeof at=="function"){let At=B[W];ct=at.call(I,At),B.splice(W,1),W--}return ct}),e.formatArgs.call(I,B),(I.log||e.log).apply(I,B)}return T.namespace=h,T.useColors=e.useColors(),T.color=e.selectColor(h),T.extend=n,T.destroy=e.destroy,Object.defineProperty(T,"enabled",{enumerable:!0,configurable:!1,get:()=>w!==null?w:(S!==e.namespaces&&(S=e.namespaces,b=e.enabled(h)),b),set:B=>{w=B}}),typeof e.init=="function"&&e.init(T),T}function n(h,g){let w=e(this.namespace+(typeof g>"u"?":":g)+h);return w.log=this.log,w}function i(h){e.save(h),e.namespaces=h,e.names=[],e.skips=[];let g,w=(typeof h=="string"?h:"").split(/[\s,]+/),S=w.length;for(g=0;g<S;g++)w[g]&&(h=w[g].replace(/\*/g,".*?"),h[0]==="-"?e.skips.push(new RegExp("^"+h.slice(1)+"$")):e.names.push(new RegExp("^"+h+"$")))}function o(){let h=[...e.names.map(l),...e.skips.map(l).map(g=>"-"+g)].join(",");return e.enable(""),h}function a(h){if(h[h.length-1]==="*")return!0;let g,w;for(g=0,w=e.skips.length;g<w;g++)if(e.skips[g].test(h))return!1;for(g=0,w=e.names.length;g<w;g++)if(e.names[g].test(h))return!0;return!1}function l(h){return h.toString().substring(2,h.toString().length-2).replace(/\.\*\?$/,"*")}function f(h){return h instanceof Error?h.stack||h.message:h}function d(){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}us.exports=Of});var ls=D((mt,Nr)=>{mt.formatArgs=Mf;mt.save=Pf;mt.load=Uf;mt.useColors=Nf;mt.storage=Ff();mt.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`."))}})();mt.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 Nf(){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 Mf(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Nr.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)}mt.log=console.debug||console.log||(()=>{});function Pf(r){try{r?mt.storage.setItem("debug",r):mt.storage.removeItem("debug")}catch{}}function Uf(){let r;try{r=mt.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function Ff(){try{return localStorage}catch{}}Nr.exports=fi()(mt);var{formatters:Gf}=Nr.exports;Gf.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var hs=D((Cd,fs)=>{"use strict";fs.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 ds=D((_d,ps)=>{"use strict";var $f=Ft("os"),Dt=hs(),tt=process.env,Ue;Dt("no-color")||Dt("no-colors")||Dt("color=false")?Ue=!1:(Dt("color")||Dt("colors")||Dt("color=true")||Dt("color=always"))&&(Ue=!0);"FORCE_COLOR"in tt&&(Ue=tt.FORCE_COLOR.length===0||parseInt(tt.FORCE_COLOR,10)!==0);function zf(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function Vf(r){if(Ue===!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&&Ue!==!0)return 0;let t=Ue?1:0;if(process.platform==="win32"){let e=$f.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 tt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(e=>e in tt)||tt.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in tt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(tt.TEAMCITY_VERSION)?1:0;if(tt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in tt){let e=parseInt((tt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(tt.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(tt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(tt.TERM)||"COLORTERM"in tt?1:(tt.TERM==="dumb",t)}function hi(r){let t=Vf(r);return zf(t)}ps.exports={supportsColor:hi,stdout:hi(process.stdout),stderr:hi(process.stderr)}});var gs=D((j,Pr)=>{var Hf=Ft("tty"),Mr=Ft("util");j.init=jf;j.log=Kf;j.formatArgs=qf;j.save=Xf;j.load=Yf;j.useColors=Wf;j.destroy=Mr.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=ds();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,o)=>o.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 Wf(){return"colors"in j.inspectOpts?Boolean(j.inspectOpts.colors):Hf.isatty(process.stderr.fd)}function qf(r){let{namespace:t,useColors:e}=this;if(e){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),o=` ${i};1m${t} \x1B[0m`;r[0]=o+r[0].split(`
|
|
2
|
+
"use strict";var Libp2PDaemonServer=(()=>{var Uf=Object.create;var Xr=Object.defineProperty;var Ff=Object.getOwnPropertyDescriptor;var $f=Object.getOwnPropertyNames;var zf=Object.getPrototypeOf,Vf=Object.prototype.hasOwnProperty;var Jt=(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 P=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Tt=(r,t)=>{for(var e in t)Xr(r,e,{get:t[e],enumerable:!0})},Bi=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $f(t))!Vf.call(r,o)&&o!==e&&Xr(r,o,{get:()=>t[o],enumerable:!(n=Ff(t,o))||n.enumerable});return r};var R=(r,t,e)=>(e=r!=null?Uf(zf(r)):{},Bi(t||!r||!r.__esModule?Xr(e,"default",{value:r,enumerable:!0}):e,r)),Gf=r=>Bi(Xr({},"__esModule",{value:!0}),r);var Ji=P((lg,Xi)=>{Xi.exports=No;var Qi=128,Yh=127,tp=~Yh,ep=Math.pow(2,31);function No(r,t,e){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw No.bytes=0,new RangeError("Could not encode varint");t=t||[],e=e||0;for(var n=e;r>=ep;)t[e++]=r&255|Qi,r/=128;for(;r&tp;)t[e++]=r&255|Qi,r>>>=7;return t[e]=r|0,No.bytes=e-n+1,t}});var ec=P((fg,tc)=>{tc.exports=Mo;var rp=128,Yi=127;function Mo(r,n){var e=0,n=n||0,o=0,s=n,c,l=r.length;do{if(s>=l||o>49)throw Mo.bytes=0,new RangeError("Could not decode varint");c=r[s++],e+=o<28?(c&Yi)<<o:(c&Yi)*Math.pow(2,o),o+=7}while(c>=rp);return Mo.bytes=s-n,e}});var nc=P((hg,rc)=>{var np=Math.pow(2,7),op=Math.pow(2,14),sp=Math.pow(2,21),ip=Math.pow(2,28),cp=Math.pow(2,35),ap=Math.pow(2,42),up=Math.pow(2,49),lp=Math.pow(2,56),fp=Math.pow(2,63);rc.exports=function(r){return r<np?1:r<op?2:r<sp?3:r<ip?4:r<cp?5:r<ap?6:r<up?7:r<lp?8:r<fp?9:10}});var At=P((pg,oc)=>{oc.exports={encode:Ji(),decode:ec(),encodingLength:nc()}});var Ie=P((Og,mc)=>{"use strict";function dc(r,t){for(let e in t)Object.defineProperty(r,e,{value:t[e],enumerable:!0,configurable:!0});return r}function Ip(r,t,e){if(!r||typeof r=="string")throw new TypeError("Please pass an Error to err-code");e||(e={}),typeof t=="object"&&(e=t,t=""),t&&(e.code=t);try{return dc(r,e)}catch{e.message=r.message,e.stack=r.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(r)),dc(new o,e)}}mc.exports=Ip});var Cc=P((jg,Ic)=>{var We=1e3,Ze=We*60,Ke=Ze*60,Be=Ke*24,Mp=Be*7,Up=Be*365.25;Ic.exports=function(r,t){t=t||{};var e=typeof r;if(e==="string"&&r.length>0)return Fp(r);if(e==="number"&&isFinite(r))return t.long?zp(r):$p(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function Fp(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*Up;case"weeks":case"week":case"w":return e*Mp;case"days":case"day":case"d":return e*Be;case"hours":case"hour":case"hrs":case"hr":case"h":return e*Ke;case"minutes":case"minute":case"mins":case"min":case"m":return e*Ze;case"seconds":case"second":case"secs":case"sec":case"s":return e*We;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function $p(r){var t=Math.abs(r);return t>=Be?Math.round(r/Be)+"d":t>=Ke?Math.round(r/Ke)+"h":t>=Ze?Math.round(r/Ze)+"m":t>=We?Math.round(r/We)+"s":r+"ms"}function zp(r){var t=Math.abs(r);return t>=Be?cn(r,t,Be,"day"):t>=Ke?cn(r,t,Ke,"hour"):t>=Ze?cn(r,t,Ze,"minute"):t>=We?cn(r,t,We,"second"):r+" ms"}function cn(r,t,e,n){var o=t>=e*1.5;return Math.round(r/e)+" "+n+(o?"s":"")}});var Xo=P((qg,Bc)=>{function Vp(r){e.debug=e,e.default=e,e.coerce=f,e.disable=s,e.enable=o,e.enabled=c,e.humanize=Cc(),e.destroy=d,Object.keys(r).forEach(h=>{e[h]=r[h]}),e.names=[],e.skips=[],e.formatters={};function t(h){let y=0;for(let E=0;E<h.length;E++)y=(y<<5)-y+h.charCodeAt(E),y|=0;return e.colors[Math.abs(y)%e.colors.length]}e.selectColor=t;function e(h){let y,E=null,w,g;function T(...O){if(!T.enabled)return;let B=T,k=Number(new Date),q=k-(y||k);B.diff=q,B.prev=y,B.curr=k,y=k,O[0]=e.coerce(O[0]),typeof O[0]!="string"&&O.unshift("%O");let Y=0;O[0]=O[0].replace(/%([a-zA-Z%])/g,(mt,pt)=>{if(mt==="%%")return"%";Y++;let gt=e.formatters[pt];if(typeof gt=="function"){let Lt=O[Y];mt=gt.call(B,Lt),O.splice(Y,1),Y--}return mt}),e.formatArgs.call(B,O),(B.log||e.log).apply(B,O)}return T.namespace=h,T.useColors=e.useColors(),T.color=e.selectColor(h),T.extend=n,T.destroy=e.destroy,Object.defineProperty(T,"enabled",{enumerable:!0,configurable:!1,get:()=>E!==null?E:(w!==e.namespaces&&(w=e.namespaces,g=e.enabled(h)),g),set:O=>{E=O}}),typeof e.init=="function"&&e.init(T),T}function n(h,y){let E=e(this.namespace+(typeof y>"u"?":":y)+h);return E.log=this.log,E}function o(h){e.save(h),e.namespaces=h,e.names=[],e.skips=[];let y,E=(typeof h=="string"?h:"").split(/[\s,]+/),w=E.length;for(y=0;y<w;y++)E[y]&&(h=E[y].replace(/\*/g,".*?"),h[0]==="-"?e.skips.push(new RegExp("^"+h.slice(1)+"$")):e.names.push(new RegExp("^"+h+"$")))}function s(){let h=[...e.names.map(l),...e.skips.map(l).map(y=>"-"+y)].join(",");return e.enable(""),h}function c(h){if(h[h.length-1]==="*")return!0;let y,E;for(y=0,E=e.skips.length;y<E;y++)if(e.skips[y].test(h))return!1;for(y=0,E=e.names.length;y<E;y++)if(e.names[y].test(h))return!0;return!1}function l(h){return h.toString().substring(2,h.toString().length-2).replace(/\.\*\?$/,"*")}function f(h){return h instanceof Error?h.stack||h.message:h}function d(){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}Bc.exports=Vp});var _c=P((Ct,an)=>{Ct.formatArgs=Hp;Ct.save=jp;Ct.load=qp;Ct.useColors=Gp;Ct.storage=Wp();Ct.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`."))}})();Ct.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 Gp(){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 Hp(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+an.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,o=>{o!=="%%"&&(e++,o==="%c"&&(n=e))}),r.splice(n,0,t)}Ct.log=console.debug||console.log||(()=>{});function jp(r){try{r?Ct.storage.setItem("debug",r):Ct.storage.removeItem("debug")}catch{}}function qp(){let r;try{r=Ct.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function Wp(){try{return localStorage}catch{}}an.exports=Xo()(Ct);var{formatters:Zp}=an.exports;Zp.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Rc=P((Wg,Dc)=>{"use strict";Dc.exports=(r,t)=>{t=t||process.argv;let e=r.startsWith("-")?"":r.length===1?"-":"--",n=t.indexOf(e+r),o=t.indexOf("--");return n!==-1&&(o===-1?!0:n<o)}});var Oc=P((Zg,kc)=>{"use strict";var Kp=Jt("os"),Ft=Rc(),at=process.env,Qe;Ft("no-color")||Ft("no-colors")||Ft("color=false")?Qe=!1:(Ft("color")||Ft("colors")||Ft("color=true")||Ft("color=always"))&&(Qe=!0);"FORCE_COLOR"in at&&(Qe=at.FORCE_COLOR.length===0||parseInt(at.FORCE_COLOR,10)!==0);function Qp(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function Xp(r){if(Qe===!1)return 0;if(Ft("color=16m")||Ft("color=full")||Ft("color=truecolor"))return 3;if(Ft("color=256"))return 2;if(r&&!r.isTTY&&Qe!==!0)return 0;let t=Qe?1:0;if(process.platform==="win32"){let e=Kp.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 at)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(e=>e in at)||at.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in at)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(at.TEAMCITY_VERSION)?1:0;if(at.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in at){let e=parseInt((at.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(at.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(at.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(at.TERM)||"COLORTERM"in at?1:(at.TERM==="dumb",t)}function Jo(r){let t=Xp(r);return Qp(t)}kc.exports={supportsColor:Jo,stdout:Jo(process.stdout),stderr:Jo(process.stderr)}});var Lc=P((st,ln)=>{var Jp=Jt("tty"),un=Jt("util");st.init=sd;st.log=rd;st.formatArgs=td;st.save=nd;st.load=od;st.useColors=Yp;st.destroy=un.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");st.colors=[6,2,3,4,5,1];try{let r=Oc();r&&(r.stderr||r).level>=2&&(st.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{}st.inspectOpts=Object.keys(process.env).filter(r=>/^debug_/i.test(r)).reduce((r,t)=>{let e=t.substring(6).toLowerCase().replace(/_([a-z])/g,(o,s)=>s.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 Yp(){return"colors"in st.inspectOpts?!!st.inspectOpts.colors:Jp.isatty(process.stderr.fd)}function td(r){let{namespace:t,useColors:e}=this;if(e){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),s=` ${o};1m${t} \x1B[0m`;r[0]=s+r[0].split(`
|
|
3
3
|
`).join(`
|
|
4
|
-
`+
|
|
5
|
-
`)}function
|
|
6
|
-
`).map(t=>t.trim()).join(" ")};ms.O=function(r){return this.inspectOpts.colors=this.useColors,Mr.inspect(r,this.inspectOpts)}});var ys=D((Bd,pi)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?pi.exports=ls():pi.exports=gs()});var Ur=D((Od,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 Es=D((Nd,ws)=>{ws.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 di=D((Md,vs)=>{var Jf=Es();vs.exports=r=>async t=>{t=Jf(t);let e=I=>{typeof I.return=="function"&&I.return()},n=null,i=null,o=I=>{n=I,i&&i(I),e(t)},a=null,l=!1,f=()=>{l=!0,a&&a()},d=null,h=!1,g=()=>{h=!0,d&&d()},w=null,S=()=>{w&&w()},b=()=>new Promise((I,_)=>{a=w=I,i=_,r.once("drain",S)}),T=()=>(e(t),new Promise((I,_)=>{if(l||h||n)return I();d=a=I,i=_})),B=()=>{r.removeListener("error",o),r.removeListener("close",f),r.removeListener("finish",g),r.removeListener("drain",S)};r.once("error",o),r.once("close",f),r.once("finish",g);try{for await(let I of t){if(!r.writable||r.destroyed||n)break;r.write(I)===!1&&await b()}}catch(I){n||r.destroy(),n=I}try{if(r.writable&&r.end(),await T(),n)throw n}finally{B()}}});var mi=D((Pd,Ss)=>{var Qf=di(),th=Ur();Ss.exports=r=>({sink:Qf(r),source:th(r)})});var xs=D((Ud,Ts)=>{var eh=mi();Ts.exports=r=>async function*(t){let e=eh(r),n;if(e.sink(t).catch(i=>{n=i}),yield*e.source,n)throw n}});var As=D((Fd,Fe)=>{Fe.exports=Ur();Fe.exports.source=Ur();Fe.exports.sink=di();Fe.exports.transform=xs();Fe.exports.duplex=mi()});var yi=D(($r,_s)=>{(function(){var r,t=0xdeadbeefcafe,e=(t&16777215)==15715070;function n(s,c,u){s!=null&&(typeof s=="number"?this.fromNumber(s,c,u):c==null&&typeof s!="string"?this.fromString(s,256):this.fromString(s,c))}function i(){return new n(null)}function o(s,c,u,p,m,y){for(;--y>=0;){var E=c*this[s++]+u[p]+m;m=Math.floor(E/67108864),u[p++]=E&67108863}return m}function a(s,c,u,p,m,y){for(var E=c&32767,v=c>>15;--y>=0;){var L=this[s]&32767,K=this[s++]>>15,bt=v*L+K*E;L=E*L+((bt&32767)<<15)+u[p]+(m&1073741823),m=(L>>>30)+(bt>>>15)+v*K+(m>>>30),u[p++]=L&1073741823}return m}function l(s,c,u,p,m,y){for(var E=c&16383,v=c>>14;--y>=0;){var L=this[s]&16383,K=this[s++]>>14,bt=v*L+K*E;L=E*L+((bt&16383)<<14)+u[p]+m,m=(L>>28)+(bt>>14)+v*K,u[p++]=L&268435455}return m}var f=typeof navigator<"u";f&&e&&navigator.appName=="Microsoft Internet Explorer"?(n.prototype.am=a,r=30):f&&e&&navigator.appName!="Netscape"?(n.prototype.am=o,r=26):(n.prototype.am=l,r=28),n.prototype.DB=r,n.prototype.DM=(1<<r)-1,n.prototype.DV=1<<r;var d=52;n.prototype.FV=Math.pow(2,d),n.prototype.F1=d-r,n.prototype.F2=2*r-d;var h="0123456789abcdefghijklmnopqrstuvwxyz",g=new Array,w,S;for(w="0".charCodeAt(0),S=0;S<=9;++S)g[w++]=S;for(w="a".charCodeAt(0),S=10;S<36;++S)g[w++]=S;for(w="A".charCodeAt(0),S=10;S<36;++S)g[w++]=S;function b(s){return h.charAt(s)}function T(s,c){var u=g[s.charCodeAt(c)];return u??-1}function B(s){for(var c=this.t-1;c>=0;--c)s[c]=this[c];s.t=this.t,s.s=this.s}function I(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 _(s){var c=i();return c.fromInt(s),c}function G(s,c){var u;if(c==16)u=4;else if(c==8)u=3;else if(c==256)u=8;else if(c==2)u=1;else if(c==32)u=5;else if(c==4)u=2;else{this.fromRadix(s,c);return}this.t=0,this.s=0;for(var p=s.length,m=!1,y=0;--p>=0;){var E=u==8?s[p]&255:T(s,p);if(E<0){s.charAt(p)=="-"&&(m=!0);continue}m=!1,y==0?this[this.t++]=E:y+u>this.DB?(this[this.t-1]|=(E&(1<<this.DB-y)-1)<<y,this[this.t++]=E>>this.DB-y):this[this.t-1]|=E<<y,y+=u,y>=this.DB&&(y-=this.DB)}u==8&&s[0]&128&&(this.s=-1,y>0&&(this[this.t-1]|=(1<<this.DB-y)-1<<y)),this.clamp(),m&&n.ZERO.subTo(this,this)}function W(){for(var s=this.s&this.DM;this.t>0&&this[this.t-1]==s;)--this.t}function ft(s){if(this.s<0)return"-"+this.negate().toString(s);var c;if(s==16)c=4;else if(s==8)c=3;else if(s==2)c=1;else if(s==32)c=5;else if(s==4)c=2;else return this.toRadix(s);var u=(1<<c)-1,p,m=!1,y="",E=this.t,v=this.DB-E*this.DB%c;if(E-- >0)for(v<this.DB&&(p=this[E]>>v)>0&&(m=!0,y=b(p));E>=0;)v<c?(p=(this[E]&(1<<v)-1)<<c-v,p|=this[--E]>>(v+=this.DB-c)):(p=this[E]>>(v-=c)&u,v<=0&&(v+=this.DB,--E)),p>0&&(m=!0),m&&(y+=b(p));return m?y:"0"}function ct(){var s=i();return n.ZERO.subTo(this,s),s}function ot(){return this.s<0?this.negate():this}function at(s){var c=this.s-s.s;if(c!=0)return c;var u=this.t;if(c=u-s.t,c!=0)return this.s<0?-c:c;for(;--u>=0;)if((c=this[u]-s[u])!=0)return c;return 0}function At(s){var c=1,u;return(u=s>>>16)!=0&&(s=u,c+=16),(u=s>>8)!=0&&(s=u,c+=8),(u=s>>4)!=0&&(s=u,c+=4),(u=s>>2)!=0&&(s=u,c+=2),(u=s>>1)!=0&&(s=u,c+=1),c}function Xc(){return this.t<=0?0:this.DB*(this.t-1)+At(this[this.t-1]^this.s&this.DM)}function Yc(s,c){var u;for(u=this.t-1;u>=0;--u)c[u+s]=this[u];for(u=s-1;u>=0;--u)c[u]=0;c.t=this.t+s,c.s=this.s}function jc(s,c){for(var u=s;u<this.t;++u)c[u-s]=this[u];c.t=Math.max(this.t-s,0),c.s=this.s}function Jc(s,c){var u=s%this.DB,p=this.DB-u,m=(1<<p)-1,y=Math.floor(s/this.DB),E=this.s<<u&this.DM,v;for(v=this.t-1;v>=0;--v)c[v+y+1]=this[v]>>p|E,E=(this[v]&m)<<u;for(v=y-1;v>=0;--v)c[v]=0;c[y]=E,c.t=this.t+y+1,c.s=this.s,c.clamp()}function Qc(s,c){c.s=this.s;var u=Math.floor(s/this.DB);if(u>=this.t){c.t=0;return}var p=s%this.DB,m=this.DB-p,y=(1<<p)-1;c[0]=this[u]>>p;for(var E=u+1;E<this.t;++E)c[E-u-1]|=(this[E]&y)<<m,c[E-u]=this[E]>>p;p>0&&(c[this.t-u-1]|=(this.s&y)<<m),c.t=this.t-u,c.clamp()}function ta(s,c){for(var u=0,p=0,m=Math.min(s.t,this.t);u<m;)p+=this[u]-s[u],c[u++]=p&this.DM,p>>=this.DB;if(s.t<this.t){for(p-=s.s;u<this.t;)p+=this[u],c[u++]=p&this.DM,p>>=this.DB;p+=this.s}else{for(p+=this.s;u<s.t;)p-=s[u],c[u++]=p&this.DM,p>>=this.DB;p-=s.s}c.s=p<0?-1:0,p<-1?c[u++]=this.DV+p:p>0&&(c[u++]=p),c.t=u,c.clamp()}function ea(s,c){var u=this.abs(),p=s.abs(),m=u.t;for(c.t=m+p.t;--m>=0;)c[m]=0;for(m=0;m<p.t;++m)c[m+u.t]=u.am(0,p[m],c,m,0,u.t);c.s=0,c.clamp(),this.s!=s.s&&n.ZERO.subTo(c,c)}function ra(s){for(var c=this.abs(),u=s.t=2*c.t;--u>=0;)s[u]=0;for(u=0;u<c.t-1;++u){var p=c.am(u,c[u],s,2*u,0,1);(s[u+c.t]+=c.am(u+1,2*c[u],s,2*u+1,p,c.t-u-1))>=c.DV&&(s[u+c.t]-=c.DV,s[u+c.t+1]=1)}s.t>0&&(s[s.t-1]+=c.am(u,c[u],s,2*u,0,1)),s.s=0,s.clamp()}function na(s,c,u){var p=s.abs();if(!(p.t<=0)){var m=this.abs();if(m.t<p.t){c?.fromInt(0),u!=null&&this.copyTo(u);return}u==null&&(u=i());var y=i(),E=this.s,v=s.s,L=this.DB-At(p[p.t-1]);L>0?(p.lShiftTo(L,y),m.lShiftTo(L,u)):(p.copyTo(y),m.copyTo(u));var K=y.t,bt=y[K-1];if(bt!=0){var pt=bt*(1<<this.F1)+(K>1?y[K-2]>>this.F2:0),Ut=this.FV/pt,Er=(1<<this.F1)/pt,Ct=1<<this.F2,_t=u.t,vr=_t-K,Yt=c??i();for(y.dlShiftTo(vr,Yt),u.compareTo(Yt)>=0&&(u[u.t++]=1,u.subTo(Yt,u)),n.ONE.dlShiftTo(K,Yt),Yt.subTo(y,y);y.t<K;)y[y.t++]=0;for(;--vr>=0;){var In=u[--_t]==bt?this.DM:Math.floor(u[_t]*Ut+(u[_t-1]+Ct)*Er);if((u[_t]+=y.am(0,In,u,vr,0,K))<In)for(y.dlShiftTo(vr,Yt),u.subTo(Yt,u);u[_t]<--In;)u.subTo(Yt,u)}c!=null&&(u.drShiftTo(K,c),E!=v&&n.ZERO.subTo(c,c)),u.t=K,u.clamp(),L>0&&u.rShiftTo(L,u),E<0&&n.ZERO.subTo(u,u)}}}function ia(s){var c=i();return this.abs().divRemTo(s,null,c),this.s<0&&c.compareTo(n.ZERO)>0&&s.subTo(c,c),c}function ce(s){this.m=s}function oa(s){return s.s<0||s.compareTo(this.m)>=0?s.mod(this.m):s}function sa(s){return s}function ca(s){s.divRemTo(this.m,null,s)}function aa(s,c,u){s.multiplyTo(c,u),this.reduce(u)}function ua(s,c){s.squareTo(c),this.reduce(c)}ce.prototype.convert=oa,ce.prototype.revert=sa,ce.prototype.reduce=ca,ce.prototype.mulTo=aa,ce.prototype.sqrTo=ua;function la(){if(this.t<1)return 0;var s=this[0];if(!(s&1))return 0;var c=s&3;return c=c*(2-(s&15)*c)&15,c=c*(2-(s&255)*c)&255,c=c*(2-((s&65535)*c&65535))&65535,c=c*(2-s*c%this.DV)%this.DV,c>0?this.DV-c:-c}function ae(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 fa(s){var c=i();return s.abs().dlShiftTo(this.m.t,c),c.divRemTo(this.m,null,c),s.s<0&&c.compareTo(n.ZERO)>0&&this.m.subTo(c,c),c}function ha(s){var c=i();return s.copyTo(c),this.reduce(c),c}function pa(s){for(;s.t<=this.mt2;)s[s.t++]=0;for(var c=0;c<this.m.t;++c){var u=s[c]&32767,p=u*this.mpl+((u*this.mph+(s[c]>>15)*this.mpl&this.um)<<15)&s.DM;for(u=c+this.m.t,s[u]+=this.m.am(0,p,s,c,0,this.m.t);s[u]>=s.DV;)s[u]-=s.DV,s[++u]++}s.clamp(),s.drShiftTo(this.m.t,s),s.compareTo(this.m)>=0&&s.subTo(this.m,s)}function da(s,c){s.squareTo(c),this.reduce(c)}function ma(s,c,u){s.multiplyTo(c,u),this.reduce(u)}ae.prototype.convert=fa,ae.prototype.revert=ha,ae.prototype.reduce=pa,ae.prototype.mulTo=ma,ae.prototype.sqrTo=da;function ga(){return(this.t>0?this[0]&1:this.s)==0}function ya(s,c){if(s>4294967295||s<1)return n.ONE;var u=i(),p=i(),m=c.convert(this),y=At(s)-1;for(m.copyTo(u);--y>=0;)if(c.sqrTo(u,p),(s&1<<y)>0)c.mulTo(p,m,u);else{var E=u;u=p,p=E}return c.revert(u)}function ba(s,c){var u;return s<256||c.isEven()?u=new ce(c):u=new ae(c),this.exp(s,u)}n.prototype.copyTo=B,n.prototype.fromInt=I,n.prototype.fromString=G,n.prototype.clamp=W,n.prototype.dlShiftTo=Yc,n.prototype.drShiftTo=jc,n.prototype.lShiftTo=Jc,n.prototype.rShiftTo=Qc,n.prototype.subTo=ta,n.prototype.multiplyTo=ea,n.prototype.squareTo=ra,n.prototype.divRemTo=na,n.prototype.invDigit=la,n.prototype.isEven=ga,n.prototype.exp=ya,n.prototype.toString=ft,n.prototype.negate=ct,n.prototype.abs=ot,n.prototype.compareTo=at,n.prototype.bitLength=Xc,n.prototype.mod=ia,n.prototype.modPowInt=ba,n.ZERO=_(0),n.ONE=_(1);function wa(){var s=i();return this.copyTo(s),s}function Ea(){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 va(){return this.t==0?this.s:this[0]<<24>>24}function Sa(){return this.t==0?this.s:this[0]<<16>>16}function Ta(s){return Math.floor(Math.LN2*this.DB/Math.log(s))}function xa(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function Aa(s){if(s==null&&(s=10),this.signum()==0||s<2||s>36)return"0";var c=this.chunkSize(s),u=Math.pow(s,c),p=_(u),m=i(),y=i(),E="";for(this.divRemTo(p,m,y);m.signum()>0;)E=(u+y.intValue()).toString(s).substr(1)+E,m.divRemTo(p,m,y);return y.intValue().toString(s)+E}function Ia(s,c){this.fromInt(0),c==null&&(c=10);for(var u=this.chunkSize(c),p=Math.pow(c,u),m=!1,y=0,E=0,v=0;v<s.length;++v){var L=T(s,v);if(L<0){s.charAt(v)=="-"&&this.signum()==0&&(m=!0);continue}E=c*E+L,++y>=u&&(this.dMultiply(p),this.dAddOffset(E,0),y=0,E=0)}y>0&&(this.dMultiply(Math.pow(c,y)),this.dAddOffset(E,0)),m&&n.ZERO.subTo(this,this)}function Ca(s,c,u){if(typeof c=="number")if(s<2)this.fromInt(1);else for(this.fromNumber(s,u),this.testBit(s-1)||this.bitwiseTo(n.ONE.shiftLeft(s-1),Sn,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(c);)this.dAddOffset(2,0),this.bitLength()>s&&this.subTo(n.ONE.shiftLeft(s-1),this);else{var p=new Array,m=s&7;p.length=(s>>3)+1,c.nextBytes(p),m>0?p[0]&=(1<<m)-1:p[0]=0,this.fromString(p,256)}}function _a(){var s=this.t,c=new Array;c[0]=this.s;var u=this.DB-s*this.DB%8,p,m=0;if(s-- >0)for(u<this.DB&&(p=this[s]>>u)!=(this.s&this.DM)>>u&&(c[m++]=p|this.s<<this.DB-u);s>=0;)u<8?(p=(this[s]&(1<<u)-1)<<8-u,p|=this[--s]>>(u+=this.DB-8)):(p=this[s]>>(u-=8)&255,u<=0&&(u+=this.DB,--s)),p&128&&(p|=-256),m==0&&(this.s&128)!=(p&128)&&++m,(m>0||p!=this.s)&&(c[m++]=p);return c}function Ba(s){return this.compareTo(s)==0}function Da(s){return this.compareTo(s)<0?this:s}function ka(s){return this.compareTo(s)>0?this:s}function Ra(s,c,u){var p,m,y=Math.min(s.t,this.t);for(p=0;p<y;++p)u[p]=c(this[p],s[p]);if(s.t<this.t){for(m=s.s&this.DM,p=y;p<this.t;++p)u[p]=c(this[p],m);u.t=this.t}else{for(m=this.s&this.DM,p=y;p<s.t;++p)u[p]=c(m,s[p]);u.t=s.t}u.s=c(this.s,s.s),u.clamp()}function La(s,c){return s&c}function Oa(s){var c=i();return this.bitwiseTo(s,La,c),c}function Sn(s,c){return s|c}function Na(s){var c=i();return this.bitwiseTo(s,Sn,c),c}function no(s,c){return s^c}function Ma(s){var c=i();return this.bitwiseTo(s,no,c),c}function io(s,c){return s&~c}function Pa(s){var c=i();return this.bitwiseTo(s,io,c),c}function Ua(){for(var s=i(),c=0;c<this.t;++c)s[c]=this.DM&~this[c];return s.t=this.t,s.s=~this.s,s}function Fa(s){var c=i();return s<0?this.rShiftTo(-s,c):this.lShiftTo(s,c),c}function Ga(s){var c=i();return s<0?this.lShiftTo(-s,c):this.rShiftTo(s,c),c}function $a(s){if(s==0)return-1;var c=0;return s&65535||(s>>=16,c+=16),s&255||(s>>=8,c+=8),s&15||(s>>=4,c+=4),s&3||(s>>=2,c+=2),s&1||++c,c}function za(){for(var s=0;s<this.t;++s)if(this[s]!=0)return s*this.DB+$a(this[s]);return this.s<0?this.t*this.DB:-1}function Va(s){for(var c=0;s!=0;)s&=s-1,++c;return c}function Ha(){for(var s=0,c=this.s&this.DM,u=0;u<this.t;++u)s+=Va(this[u]^c);return s}function Wa(s){var c=Math.floor(s/this.DB);return c>=this.t?this.s!=0:(this[c]&1<<s%this.DB)!=0}function qa(s,c){var u=n.ONE.shiftLeft(s);return this.bitwiseTo(u,c,u),u}function Za(s){return this.changeBit(s,Sn)}function Ka(s){return this.changeBit(s,io)}function Xa(s){return this.changeBit(s,no)}function Ya(s,c){for(var u=0,p=0,m=Math.min(s.t,this.t);u<m;)p+=this[u]+s[u],c[u++]=p&this.DM,p>>=this.DB;if(s.t<this.t){for(p+=s.s;u<this.t;)p+=this[u],c[u++]=p&this.DM,p>>=this.DB;p+=this.s}else{for(p+=this.s;u<s.t;)p+=s[u],c[u++]=p&this.DM,p>>=this.DB;p+=s.s}c.s=p<0?-1:0,p>0?c[u++]=p:p<-1&&(c[u++]=this.DV+p),c.t=u,c.clamp()}function ja(s){var c=i();return this.addTo(s,c),c}function Ja(s){var c=i();return this.subTo(s,c),c}function Qa(s){var c=i();return this.multiplyTo(s,c),c}function tu(){var s=i();return this.squareTo(s),s}function eu(s){var c=i();return this.divRemTo(s,c,null),c}function ru(s){var c=i();return this.divRemTo(s,null,c),c}function nu(s){var c=i(),u=i();return this.divRemTo(s,c,u),new Array(c,u)}function iu(s){this[this.t]=this.am(0,s-1,this,0,0,this.t),++this.t,this.clamp()}function ou(s,c){if(s!=0){for(;this.t<=c;)this[this.t++]=0;for(this[c]+=s;this[c]>=this.DV;)this[c]-=this.DV,++c>=this.t&&(this[this.t++]=0),++this[c]}}function Ye(){}function oo(s){return s}function su(s,c,u){s.multiplyTo(c,u)}function cu(s,c){s.squareTo(c)}Ye.prototype.convert=oo,Ye.prototype.revert=oo,Ye.prototype.mulTo=su,Ye.prototype.sqrTo=cu;function au(s){return this.exp(s,new Ye)}function uu(s,c,u){var p=Math.min(this.t+s.t,c);for(u.s=0,u.t=p;p>0;)u[--p]=0;var m;for(m=u.t-this.t;p<m;++p)u[p+this.t]=this.am(0,s[p],u,p,0,this.t);for(m=Math.min(s.t,c);p<m;++p)this.am(0,s[p],u,p,0,c-p);u.clamp()}function lu(s,c,u){--c;var p=u.t=this.t+s.t-c;for(u.s=0;--p>=0;)u[p]=0;for(p=Math.max(c-this.t,0);p<s.t;++p)u[this.t+p-c]=this.am(c-p,s[p],u,0,0,this.t+p-c);u.clamp(),u.drShiftTo(1,u)}function ue(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 fu(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 c=i();return s.copyTo(c),this.reduce(c),c}function hu(s){return s}function pu(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 du(s,c){s.squareTo(c),this.reduce(c)}function mu(s,c,u){s.multiplyTo(c,u),this.reduce(u)}ue.prototype.convert=fu,ue.prototype.revert=hu,ue.prototype.reduce=pu,ue.prototype.mulTo=mu,ue.prototype.sqrTo=du;function gu(s,c){var u=s.bitLength(),p,m=_(1),y;if(u<=0)return m;u<18?p=1:u<48?p=3:u<144?p=4:u<768?p=5:p=6,u<8?y=new ce(c):c.isEven()?y=new ue(c):y=new ae(c);var E=new Array,v=3,L=p-1,K=(1<<p)-1;if(E[1]=y.convert(this),p>1){var bt=i();for(y.sqrTo(E[1],bt);v<=K;)E[v]=i(),y.mulTo(bt,E[v-2],E[v]),v+=2}var pt=s.t-1,Ut,Er=!0,Ct=i(),_t;for(u=At(s[pt])-1;pt>=0;){for(u>=L?Ut=s[pt]>>u-L&K:(Ut=(s[pt]&(1<<u+1)-1)<<L-u,pt>0&&(Ut|=s[pt-1]>>this.DB+u-L)),v=p;!(Ut&1);)Ut>>=1,--v;if((u-=v)<0&&(u+=this.DB,--pt),Er)E[Ut].copyTo(m),Er=!1;else{for(;v>1;)y.sqrTo(m,Ct),y.sqrTo(Ct,m),v-=2;v>0?y.sqrTo(m,Ct):(_t=m,m=Ct,Ct=_t),y.mulTo(Ct,E[Ut],m)}for(;pt>=0&&!(s[pt]&1<<u);)y.sqrTo(m,Ct),_t=m,m=Ct,Ct=_t,--u<0&&(u=this.DB-1,--pt)}return y.revert(m)}function yu(s){var c=this.s<0?this.negate():this.clone(),u=s.s<0?s.negate():s.clone();if(c.compareTo(u)<0){var p=c;c=u,u=p}var m=c.getLowestSetBit(),y=u.getLowestSetBit();if(y<0)return c;for(m<y&&(y=m),y>0&&(c.rShiftTo(y,c),u.rShiftTo(y,u));c.signum()>0;)(m=c.getLowestSetBit())>0&&c.rShiftTo(m,c),(m=u.getLowestSetBit())>0&&u.rShiftTo(m,u),c.compareTo(u)>=0?(c.subTo(u,c),c.rShiftTo(1,c)):(u.subTo(c,u),u.rShiftTo(1,u));return y>0&&u.lShiftTo(y,u),u}function bu(s){if(s<=0)return 0;var c=this.DV%s,u=this.s<0?s-1:0;if(this.t>0)if(c==0)u=this[0]%s;else for(var p=this.t-1;p>=0;--p)u=(c*u+this[p])%s;return u}function wu(s){var c=s.isEven();if(this.isEven()&&c||s.signum()==0)return n.ZERO;for(var u=s.clone(),p=this.clone(),m=_(1),y=_(0),E=_(0),v=_(1);u.signum()!=0;){for(;u.isEven();)u.rShiftTo(1,u),c?((!m.isEven()||!y.isEven())&&(m.addTo(this,m),y.subTo(s,y)),m.rShiftTo(1,m)):y.isEven()||y.subTo(s,y),y.rShiftTo(1,y);for(;p.isEven();)p.rShiftTo(1,p),c?((!E.isEven()||!v.isEven())&&(E.addTo(this,E),v.subTo(s,v)),E.rShiftTo(1,E)):v.isEven()||v.subTo(s,v),v.rShiftTo(1,v);u.compareTo(p)>=0?(u.subTo(p,u),c&&m.subTo(E,m),y.subTo(v,y)):(p.subTo(u,p),c&&E.subTo(m,E),v.subTo(y,v))}if(p.compareTo(n.ONE)!=0)return n.ZERO;if(v.compareTo(s)>=0)return v.subtract(s);if(v.signum()<0)v.addTo(s,v);else return v;return v.signum()<0?v.add(s):v}var st=[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],Eu=(1<<26)/st[st.length-1];function vu(s){var c,u=this.abs();if(u.t==1&&u[0]<=st[st.length-1]){for(c=0;c<st.length;++c)if(u[0]==st[c])return!0;return!1}if(u.isEven())return!1;for(c=1;c<st.length;){for(var p=st[c],m=c+1;m<st.length&&p<Eu;)p*=st[m++];for(p=u.modInt(p);c<m;)if(p%st[c++]==0)return!1}return u.millerRabin(s)}function Su(s){var c=this.subtract(n.ONE),u=c.getLowestSetBit();if(u<=0)return!1;var p=c.shiftRight(u);s=s+1>>1,s>st.length&&(s=st.length);for(var m=i(),y=0;y<s;++y){m.fromInt(st[Math.floor(Math.random()*st.length)]);var E=m.modPow(p,this);if(E.compareTo(n.ONE)!=0&&E.compareTo(c)!=0){for(var v=1;v++<u&&E.compareTo(c)!=0;)if(E=E.modPowInt(2,this),E.compareTo(n.ONE)==0)return!1;if(E.compareTo(c)!=0)return!1}}return!0}n.prototype.chunkSize=Ta,n.prototype.toRadix=Aa,n.prototype.fromRadix=Ia,n.prototype.fromNumber=Ca,n.prototype.bitwiseTo=Ra,n.prototype.changeBit=qa,n.prototype.addTo=Ya,n.prototype.dMultiply=iu,n.prototype.dAddOffset=ou,n.prototype.multiplyLowerTo=uu,n.prototype.multiplyUpperTo=lu,n.prototype.modInt=bu,n.prototype.millerRabin=Su,n.prototype.clone=wa,n.prototype.intValue=Ea,n.prototype.byteValue=va,n.prototype.shortValue=Sa,n.prototype.signum=xa,n.prototype.toByteArray=_a,n.prototype.equals=Ba,n.prototype.min=Da,n.prototype.max=ka,n.prototype.and=Oa,n.prototype.or=Na,n.prototype.xor=Ma,n.prototype.andNot=Pa,n.prototype.not=Ua,n.prototype.shiftLeft=Fa,n.prototype.shiftRight=Ga,n.prototype.getLowestSetBit=za,n.prototype.bitCount=Ha,n.prototype.testBit=Wa,n.prototype.setBit=Za,n.prototype.clearBit=Ka,n.prototype.flipBit=Xa,n.prototype.add=ja,n.prototype.subtract=Ja,n.prototype.multiply=Qa,n.prototype.divide=eu,n.prototype.remainder=ru,n.prototype.divideAndRemainder=nu,n.prototype.modPow=gu,n.prototype.modInverse=wu,n.prototype.pow=au,n.prototype.gcd=yu,n.prototype.isProbablePrime=vu,n.prototype.square=tu,n.prototype.Barrett=ue;var wr,ht,Z;function Tu(s){ht[Z++]^=s&255,ht[Z++]^=s>>8&255,ht[Z++]^=s>>16&255,ht[Z++]^=s>>24&255,Z>=An&&(Z-=An)}function so(){Tu(new Date().getTime())}if(ht==null){ht=new Array,Z=0;var It;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var co=new Uint8Array(32);for(window.crypto.getRandomValues(co),It=0;It<32;++It)ht[Z++]=co[It]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var ao=window.crypto.random(32);for(It=0;It<ao.length;++It)ht[Z++]=ao.charCodeAt(It)&255}}for(;Z<An;)It=Math.floor(65536*Math.random()),ht[Z++]=It>>>8,ht[Z++]=It&255;Z=0,so()}function xu(){if(wr==null){for(so(),wr=_u(),wr.init(ht),Z=0;Z<ht.length;++Z)ht[Z]=0;Z=0}return wr.next()}function Au(s){var c;for(c=0;c<s.length;++c)s[c]=xu()}function Tn(){}Tn.prototype.nextBytes=Au;function xn(){this.i=0,this.j=0,this.S=new Array}function Iu(s){var c,u,p;for(c=0;c<256;++c)this.S[c]=c;for(u=0,c=0;c<256;++c)u=u+this.S[c]+s[c%s.length]&255,p=this.S[c],this.S[c]=this.S[u],this.S[u]=p;this.i=0,this.j=0}function Cu(){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]}xn.prototype.init=Iu,xn.prototype.next=Cu;function _u(){return new xn}var An=256;typeof $r<"u"?$r=_s.exports={default:n,BigInteger:n,SecureRandom:Tn}:this.jsbn={BigInteger:n,SecureRandom:Tn}}).call($r)});var ur=D(zr=>{(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(a){return n(o(a),arguments)}function e(a,l){return t.apply(null,[a].concat(l||[]))}function n(a,l){var f=1,d=a.length,h,g="",w,S,b,T,B,I,_,G;for(w=0;w<d;w++)if(typeof a[w]=="string")g+=a[w];else if(typeof a[w]=="object"){if(b=a[w],b.keys)for(h=l[f],S=0;S<b.keys.length;S++){if(h==null)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',b.keys[S],b.keys[S-1]));h=h[b.keys[S]]}else b.param_no?h=l[b.param_no]:h=l[f++];if(r.not_type.test(b.type)&&r.not_primitive.test(b.type)&&h instanceof Function&&(h=h()),r.numeric_arg.test(b.type)&&typeof h!="number"&&isNaN(h))throw new TypeError(t("[sprintf] expecting number but found %T",h));switch(r.number.test(b.type)&&(_=h>=0),b.type){case"b":h=parseInt(h,10).toString(2);break;case"c":h=String.fromCharCode(parseInt(h,10));break;case"d":case"i":h=parseInt(h,10);break;case"j":h=JSON.stringify(h,null,b.width?parseInt(b.width):0);break;case"e":h=b.precision?parseFloat(h).toExponential(b.precision):parseFloat(h).toExponential();break;case"f":h=b.precision?parseFloat(h).toFixed(b.precision):parseFloat(h);break;case"g":h=b.precision?String(Number(h.toPrecision(b.precision))):parseFloat(h);break;case"o":h=(parseInt(h,10)>>>0).toString(8);break;case"s":h=String(h),h=b.precision?h.substring(0,b.precision):h;break;case"t":h=String(!!h),h=b.precision?h.substring(0,b.precision):h;break;case"T":h=Object.prototype.toString.call(h).slice(8,-1).toLowerCase(),h=b.precision?h.substring(0,b.precision):h;break;case"u":h=parseInt(h,10)>>>0;break;case"v":h=h.valueOf(),h=b.precision?h.substring(0,b.precision):h;break;case"x":h=(parseInt(h,10)>>>0).toString(16);break;case"X":h=(parseInt(h,10)>>>0).toString(16).toUpperCase();break}r.json.test(b.type)?g+=h:(r.number.test(b.type)&&(!_||b.sign)?(G=_?"+":"-",h=h.toString().replace(r.sign,"")):G="",B=b.pad_char?b.pad_char==="0"?"0":b.pad_char.charAt(1):" ",I=b.width-(G+h).length,T=b.width&&I>0?B.repeat(I):"",g+=b.align?G+h+T:B==="0"?G+T+h:T+G+h)}return g}var i=Object.create(null);function o(a){if(i[a])return i[a];for(var l=a,f,d=[],h=0;l;){if((f=r.text.exec(l))!==null)d.push(f[0]);else if((f=r.modulo.exec(l))!==null)d.push("%");else if((f=r.placeholder.exec(l))!==null){if(f[2]){h|=1;var g=[],w=f[2],S=[];if((S=r.key.exec(w))!==null)for(g.push(S[1]);(w=w.substring(S[0].length))!=="";)if((S=r.key_access.exec(w))!==null)g.push(S[1]);else if((S=r.index_access.exec(w))!==null)g.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");f[2]=g}else h|=2;if(h===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");d.push({placeholder:f[0],param_no:f[1],keys:f[2],sign:f[3],pad_char:f[4],align:f[5],width:f[6],precision:f[7],type:f[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");l=l.substring(f[0].length)}return i[a]=d}typeof zr<"u"&&(zr.sprintf=t,zr.vsprintf=e),typeof window<"u"&&(window.sprintf=t,window.vsprintf=e,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:e}}))})()});var ec=D((d0,tc)=>{"use strict";tc.exports=kh;function kh(r,t){for(var e=new Array(arguments.length-1),n=0,i=2,o=!0;i<arguments.length;)e[n++]=arguments[i++];return new Promise(function(l,f){e[n]=function(h){if(o)if(o=!1,h)f(h);else{for(var g=new Array(arguments.length-1),w=0;w<g.length;)g[w++]=arguments[w];l.apply(null,g)}};try{r.apply(t||null,e)}catch(d){o&&(o=!1,f(d))}})}});var oc=D(ic=>{"use strict";var rn=ic;rn.length=function(t){var e=t.length;if(!e)return 0;for(var n=0;--e%4>1&&t.charAt(e)==="=";)++n;return Math.ceil(t.length*3)/4-n};var Ze=new Array(64),nc=new Array(123);for(Rt=0;Rt<64;)nc[Ze[Rt]=Rt<26?Rt+65:Rt<52?Rt+71:Rt<62?Rt-4:Rt-59|43]=Rt++;var Rt;rn.encode=function(t,e,n){for(var i=null,o=[],a=0,l=0,f;e<n;){var d=t[e++];switch(l){case 0:o[a++]=Ze[d>>2],f=(d&3)<<4,l=1;break;case 1:o[a++]=Ze[f|d>>4],f=(d&15)<<2,l=2;break;case 2:o[a++]=Ze[f|d>>6],o[a++]=Ze[d&63],l=0;break}a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),a=0)}return l&&(o[a++]=Ze[f],o[a++]=61,l===1&&(o[a++]=61)),i?(a&&i.push(String.fromCharCode.apply(String,o.slice(0,a))),i.join("")):String.fromCharCode.apply(String,o.slice(0,a))};var rc="invalid encoding";rn.decode=function(t,e,n){for(var i=n,o=0,a,l=0;l<t.length;){var f=t.charCodeAt(l++);if(f===61&&o>1)break;if((f=nc[f])===void 0)throw Error(rc);switch(o){case 0:a=f,o=1;break;case 1:e[n++]=a<<2|(f&48)>>4,a=f,o=2;break;case 2:e[n++]=(a&15)<<4|(f&60)>>2,a=f,o=3;break;case 3:e[n++]=(a&3)<<6|f,o=0;break}}if(o===1)throw Error(rc);return n-i};rn.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var cc=D((g0,sc)=>{"use strict";sc.exports=nn;function nn(){this._listeners={}}nn.prototype.on=function(t,e,n){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:n||this}),this};nn.prototype.off=function(t,e){if(t===void 0)this._listeners={};else if(e===void 0)this._listeners[t]=[];else for(var n=this._listeners[t],i=0;i<n.length;)n[i].fn===e?n.splice(i,1):++i;return this};nn.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<e.length;)e[i].fn.apply(e[i++].ctx,n)}return this}});var dc=D((y0,pc)=>{"use strict";pc.exports=ac(ac);function ac(r){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),e=new Uint8Array(t.buffer),n=e[3]===128;function i(f,d,h){t[0]=f,d[h]=e[0],d[h+1]=e[1],d[h+2]=e[2],d[h+3]=e[3]}function o(f,d,h){t[0]=f,d[h]=e[3],d[h+1]=e[2],d[h+2]=e[1],d[h+3]=e[0]}r.writeFloatLE=n?i:o,r.writeFloatBE=n?o:i;function a(f,d){return e[0]=f[d],e[1]=f[d+1],e[2]=f[d+2],e[3]=f[d+3],t[0]}function l(f,d){return e[3]=f[d],e[2]=f[d+1],e[1]=f[d+2],e[0]=f[d+3],t[0]}r.readFloatLE=n?a:l,r.readFloatBE=n?l:a}():function(){function t(n,i,o,a){var l=i<0?1:0;if(l&&(i=-i),i===0)n(1/i>0?0:2147483648,o,a);else if(isNaN(i))n(2143289344,o,a);else if(i>34028234663852886e22)n((l<<31|2139095040)>>>0,o,a);else if(i<11754943508222875e-54)n((l<<31|Math.round(i/1401298464324817e-60))>>>0,o,a);else{var f=Math.floor(Math.log(i)/Math.LN2),d=Math.round(i*Math.pow(2,-f)*8388608)&8388607;n((l<<31|f+127<<23|d)>>>0,o,a)}}r.writeFloatLE=t.bind(null,uc),r.writeFloatBE=t.bind(null,lc);function e(n,i,o){var a=n(i,o),l=(a>>31)*2+1,f=a>>>23&255,d=a&8388607;return f===255?d?NaN:l*(1/0):f===0?l*1401298464324817e-60*d:l*Math.pow(2,f-150)*(d+8388608)}r.readFloatLE=e.bind(null,fc),r.readFloatBE=e.bind(null,hc)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),e=new Uint8Array(t.buffer),n=e[7]===128;function i(f,d,h){t[0]=f,d[h]=e[0],d[h+1]=e[1],d[h+2]=e[2],d[h+3]=e[3],d[h+4]=e[4],d[h+5]=e[5],d[h+6]=e[6],d[h+7]=e[7]}function o(f,d,h){t[0]=f,d[h]=e[7],d[h+1]=e[6],d[h+2]=e[5],d[h+3]=e[4],d[h+4]=e[3],d[h+5]=e[2],d[h+6]=e[1],d[h+7]=e[0]}r.writeDoubleLE=n?i:o,r.writeDoubleBE=n?o:i;function a(f,d){return e[0]=f[d],e[1]=f[d+1],e[2]=f[d+2],e[3]=f[d+3],e[4]=f[d+4],e[5]=f[d+5],e[6]=f[d+6],e[7]=f[d+7],t[0]}function l(f,d){return e[7]=f[d],e[6]=f[d+1],e[5]=f[d+2],e[4]=f[d+3],e[3]=f[d+4],e[2]=f[d+5],e[1]=f[d+6],e[0]=f[d+7],t[0]}r.readDoubleLE=n?a:l,r.readDoubleBE=n?l:a}():function(){function t(n,i,o,a,l,f){var d=a<0?1:0;if(d&&(a=-a),a===0)n(0,l,f+i),n(1/a>0?0:2147483648,l,f+o);else if(isNaN(a))n(0,l,f+i),n(2146959360,l,f+o);else if(a>17976931348623157e292)n(0,l,f+i),n((d<<31|2146435072)>>>0,l,f+o);else{var h;if(a<22250738585072014e-324)h=a/5e-324,n(h>>>0,l,f+i),n((d<<31|h/4294967296)>>>0,l,f+o);else{var g=Math.floor(Math.log(a)/Math.LN2);g===1024&&(g=1023),h=a*Math.pow(2,-g),n(h*4503599627370496>>>0,l,f+i),n((d<<31|g+1023<<20|h*1048576&1048575)>>>0,l,f+o)}}}r.writeDoubleLE=t.bind(null,uc,0,4),r.writeDoubleBE=t.bind(null,lc,4,0);function e(n,i,o,a,l){var f=n(a,l+i),d=n(a,l+o),h=(d>>31)*2+1,g=d>>>20&2047,w=4294967296*(d&1048575)+f;return g===2047?w?NaN:h*(1/0):g===0?h*5e-324*w:h*Math.pow(2,g-1075)*(w+4503599627370496)}r.readDoubleLE=e.bind(null,fc,0,4),r.readDoubleBE=e.bind(null,hc,4,0)}(),r}function uc(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function lc(r,t,e){t[e]=r>>>24,t[e+1]=r>>>16&255,t[e+2]=r>>>8&255,t[e+3]=r&255}function fc(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24)>>>0}function hc(r,t){return(r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3])>>>0}});var mc=D((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}});var yc=D(gc=>{"use strict";var Gi=gc;Gi.length=function(t){for(var e=0,n=0,i=0;i<t.length;++i)n=t.charCodeAt(i),n<128?e+=1:n<2048?e+=2:(n&64512)===55296&&(t.charCodeAt(i+1)&64512)===56320?(++i,e+=4):e+=3;return e};Gi.read=function(t,e,n){var i=n-e;if(i<1)return"";for(var o=null,a=[],l=0,f;e<n;)f=t[e++],f<128?a[l++]=f:f>191&&f<224?a[l++]=(f&31)<<6|t[e++]&63:f>239&&f<365?(f=((f&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,a[l++]=55296+(f>>10),a[l++]=56320+(f&1023)):a[l++]=(f&15)<<12|(t[e++]&63)<<6|t[e++]&63,l>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,a)),l=0);return o?(l&&o.push(String.fromCharCode.apply(String,a.slice(0,l))),o.join("")):String.fromCharCode.apply(String,a.slice(0,l))};Gi.write=function(t,e,n){for(var i=n,o,a,l=0;l<t.length;++l)o=t.charCodeAt(l),o<128?e[n++]=o:o<2048?(e[n++]=o>>6|192,e[n++]=o&63|128):(o&64512)===55296&&((a=t.charCodeAt(l+1))&64512)===56320?(o=65536+((o&1023)<<10)+(a&1023),++l,e[n++]=o>>18|240,e[n++]=o>>12&63|128,e[n++]=o>>6&63|128,e[n++]=o&63|128):(e[n++]=o>>12|224,e[n++]=o>>6&63|128,e[n++]=o&63|128);return n-i}});var wc=D((w0,bc)=>{"use strict";bc.exports=Rh;function Rh(r,t,e){var n=e||8192,i=n>>>1,o=null,a=n;return function(f){if(f<1||f>i)return r(f);a+f>n&&(o=r(n),a=0);var d=t.call(o,a,a+=f);return a&7&&(a=(a|7)+1),d}}});var vc=D((E0,Ec)=>{"use strict";Ec.exports=X;var hr=Te();function X(r,t){this.lo=r>>>0,this.hi=t>>>0}var Se=X.zero=new X(0,0);Se.toNumber=function(){return 0};Se.zzEncode=Se.zzDecode=function(){return this};Se.length=function(){return 1};var Lh=X.zeroHash="\0\0\0\0\0\0\0\0";X.fromNumber=function(t){if(t===0)return Se;var e=t<0;e&&(t=-t);var n=t>>>0,i=(t-n)/4294967296>>>0;return e&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new X(n,i)};X.from=function(t){if(typeof t=="number")return X.fromNumber(t);if(hr.isString(t))if(hr.Long)t=hr.Long.fromString(t);else return X.fromNumber(parseInt(t,10));return t.low||t.high?new X(t.low>>>0,t.high>>>0):Se};X.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=~this.lo+1>>>0,n=~this.hi>>>0;return e||(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296};X.prototype.toLong=function(t){return hr.Long?new hr.Long(this.lo|0,this.hi|0,Boolean(t)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(t)}};var ne=String.prototype.charCodeAt;X.fromHash=function(t){return t===Lh?Se:new X((ne.call(t,0)|ne.call(t,1)<<8|ne.call(t,2)<<16|ne.call(t,3)<<24)>>>0,(ne.call(t,4)|ne.call(t,5)<<8|ne.call(t,6)<<16|ne.call(t,7)<<24)>>>0)};X.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};X.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};X.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};X.prototype.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}});var Te=D($i=>{"use strict";var x=$i;x.asPromise=ec();x.base64=oc();x.EventEmitter=cc();x.float=dc();x.inquire=mc();x.utf8=yc();x.pool=wc();x.LongBits=vc();x.isNode=Boolean(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);x.global=x.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||$i;x.emptyArray=Object.freeze?Object.freeze([]):[];x.emptyObject=Object.freeze?Object.freeze({}):{};x.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};x.isString=function(t){return typeof t=="string"||t instanceof String};x.isObject=function(t){return t&&typeof t=="object"};x.isset=x.isSet=function(t,e){var n=t[e];return n!=null&&t.hasOwnProperty(e)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};x.Buffer=function(){try{var r=x.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();x._Buffer_from=null;x._Buffer_allocUnsafe=null;x.newBuffer=function(t){return typeof t=="number"?x.Buffer?x._Buffer_allocUnsafe(t):new x.Array(t):x.Buffer?x._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};x.Array=typeof Uint8Array<"u"?Uint8Array:Array;x.Long=x.global.dcodeIO&&x.global.dcodeIO.Long||x.global.Long||x.inquire("long");x.key2Re=/^true|false|0|1$/;x.key32Re=/^-?(?:0|[1-9][0-9]*)$/;x.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;x.longToHash=function(t){return t?x.LongBits.from(t).toHash():x.LongBits.zeroHash};x.longFromHash=function(t,e){var n=x.LongBits.fromHash(t);return x.Long?x.Long.fromBits(n.lo,n.hi,e):n.toNumber(Boolean(e))};function Sc(r,t,e){for(var n=Object.keys(t),i=0;i<n.length;++i)(r[n[i]]===void 0||!e)&&(r[n[i]]=t[n[i]]);return r}x.merge=Sc;x.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Tc(r){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&Sc(this,n)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return r},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}x.newError=Tc;x.ProtocolError=Tc("ProtocolError");x.oneOfGetter=function(t){for(var e={},n=0;n<t.length;++n)e[t[n]]=1;return function(){for(var i=Object.keys(this),o=i.length-1;o>-1;--o)if(e[i[o]]===1&&this[i[o]]!==void 0&&this[i[o]]!==null)return i[o]}};x.oneOfSetter=function(t){return function(e){for(var n=0;n<t.length;++n)t[n]!==e&&delete this[t[n]]}};x.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};x._configure=function(){var r=x.Buffer;if(!r){x._Buffer_from=x._Buffer_allocUnsafe=null;return}x._Buffer_from=r.from!==Uint8Array.from&&r.from||function(e,n){return new r(e,n)},x._Buffer_allocUnsafe=r.allocUnsafe||function(e){return new r(e)}}});var Hi=D((S0,_c)=>{"use strict";_c.exports=$;var Mt=Te(),Vi,Ic=Mt.LongBits,Oh=Mt.utf8;function Lt(r,t){return RangeError("index out of range: "+r.pos+" + "+(t||1)+" > "+r.len)}function $(r){this.buf=r,this.pos=0,this.len=r.length}var xc=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new $(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new $(t);throw Error("illegal buffer")},Cc=function(){return Mt.Buffer?function(e){return($.create=function(i){return Mt.Buffer.isBuffer(i)?new Vi(i):xc(i)})(e)}:xc};$.create=Cc();$.prototype._slice=Mt.Array.prototype.subarray||Mt.Array.prototype.slice;$.prototype.uint32=function(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,Lt(this,10);return t}}();$.prototype.int32=function(){return this.uint32()|0};$.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function zi(){var r=new Ic(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(r.lo=(r.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Lt(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,r}if(this.len-this.pos>4){for(;t<5;++t)if(r.hi=(r.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return r}else for(;t<5;++t){if(this.pos>=this.len)throw Lt(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}$.prototype.bool=function(){return this.uint32()!==0};function on(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}$.prototype.fixed32=function(){if(this.pos+4>this.len)throw Lt(this,4);return on(this.buf,this.pos+=4)};$.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Lt(this,4);return on(this.buf,this.pos+=4)|0};function Ac(){if(this.pos+8>this.len)throw Lt(this,8);return new Ic(on(this.buf,this.pos+=4),on(this.buf,this.pos+=4))}$.prototype.float=function(){if(this.pos+4>this.len)throw Lt(this,4);var t=Mt.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};$.prototype.double=function(){if(this.pos+8>this.len)throw Lt(this,4);var t=Mt.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};$.prototype.bytes=function(){var t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw Lt(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(e,n):e===n?new this.buf.constructor(0):this._slice.call(this.buf,e,n)};$.prototype.string=function(){var t=this.bytes();return Oh.read(t,0,t.length)};$.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw Lt(this,t);this.pos+=t}else do if(this.pos>=this.len)throw Lt(this);while(this.buf[this.pos++]&128);return this};$.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};$._configure=function(r){Vi=r,$.create=Cc(),Vi._configure();var t=Mt.Long?"toLong":"toNumber";Mt.merge($.prototype,{int64:function(){return zi.call(this)[t](!1)},uint64:function(){return zi.call(this)[t](!0)},sint64:function(){return zi.call(this).zzDecode()[t](!1)},fixed64:function(){return Ac.call(this)[t](!0)},sfixed64:function(){return Ac.call(this)[t](!1)}})}});var Rc=D((T0,kc)=>{"use strict";kc.exports=xe;var Dc=Hi();(xe.prototype=Object.create(Dc.prototype)).constructor=xe;var Bc=Te();function xe(r){Dc.call(this,r)}xe._configure=function(){Bc.Buffer&&(xe.prototype._slice=Bc.Buffer.prototype.slice)};xe.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};xe._configure()});var ji=D((x0,Mc)=>{"use strict";Mc.exports=k;var St=Te(),Wi,sn=St.LongBits,Lc=St.base64,Oc=St.utf8;function pr(r,t,e){this.fn=r,this.len=t,this.next=void 0,this.val=e}function Zi(){}function Nh(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function k(){this.len=0,this.head=new pr(Zi,0,0),this.tail=this.head,this.states=null}var Nc=function(){return St.Buffer?function(){return(k.create=function(){return new Wi})()}:function(){return new k}};k.create=Nc();k.alloc=function(t){return new St.Array(t)};St.Array!==Array&&(k.alloc=St.pool(k.alloc,St.Array.prototype.subarray));k.prototype._push=function(t,e,n){return this.tail=this.tail.next=new pr(t,e,n),this.len+=e,this};function Ki(r,t,e){t[e]=r&255}function Mh(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}function Xi(r,t){this.len=r,this.next=void 0,this.val=t}Xi.prototype=Object.create(pr.prototype);Xi.prototype.fn=Mh;k.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Xi((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};k.prototype.int32=function(t){return t<0?this._push(Yi,10,sn.fromNumber(t)):this.uint32(t)};k.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Yi(r,t,e){for(;r.hi;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}k.prototype.uint64=function(t){var e=sn.from(t);return this._push(Yi,e.length(),e)};k.prototype.int64=k.prototype.uint64;k.prototype.sint64=function(t){var e=sn.from(t).zzEncode();return this._push(Yi,e.length(),e)};k.prototype.bool=function(t){return this._push(Ki,1,t?1:0)};function qi(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}k.prototype.fixed32=function(t){return this._push(qi,4,t>>>0)};k.prototype.sfixed32=k.prototype.fixed32;k.prototype.fixed64=function(t){var e=sn.from(t);return this._push(qi,4,e.lo)._push(qi,4,e.hi)};k.prototype.sfixed64=k.prototype.fixed64;k.prototype.float=function(t){return this._push(St.float.writeFloatLE,4,t)};k.prototype.double=function(t){return this._push(St.float.writeDoubleLE,8,t)};var Ph=St.Array.prototype.set?function(t,e,n){e.set(t,n)}:function(t,e,n){for(var i=0;i<t.length;++i)e[n+i]=t[i]};k.prototype.bytes=function(t){var e=t.length>>>0;if(!e)return this._push(Ki,1,0);if(St.isString(t)){var n=k.alloc(e=Lc.length(t));Lc.decode(t,n,0),t=n}return this.uint32(e)._push(Ph,e,t)};k.prototype.string=function(t){var e=Oc.length(t);return e?this.uint32(e)._push(Oc.write,e,t):this._push(Ki,1,0)};k.prototype.fork=function(){return this.states=new Nh(this),this.head=this.tail=new pr(Zi,0,0),this.len=0,this};k.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new pr(Zi,0,0),this.len=0),this};k.prototype.ldelim=function(){var t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=e,this.len+=n),this};k.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e};k._configure=function(r){Wi=r,k.create=Nc(),Wi._configure()}});var Fc=D((A0,Uc)=>{"use strict";Uc.exports=Pt;var Pc=ji();(Pt.prototype=Object.create(Pc.prototype)).constructor=Pt;var ie=Te();function Pt(){Pc.call(this)}Pt._configure=function(){Pt.alloc=ie._Buffer_allocUnsafe,Pt.writeBytesBuffer=ie.Buffer&&ie.Buffer.prototype instanceof Uint8Array&&ie.Buffer.prototype.set.name==="set"?function(t,e,n){e.set(t,n)}:function(t,e,n){if(t.copy)t.copy(e,n,0,t.length);else for(var i=0;i<t.length;)e[n++]=t[i++]}};Pt.prototype.bytes=function(t){ie.isString(t)&&(t=ie._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push(Pt.writeBytesBuffer,e,t),this};function Uh(r,t,e){r.length<40?ie.utf8.write(r,t,e):t.utf8Write?t.utf8Write(r,e):t.write(r,e)}Pt.prototype.string=function(t){var e=ie.Buffer.byteLength(t);return this.uint32(e),e&&this._push(Uh,e,t),this};Pt._configure()});var Zh={};dt(Zh,{Server:()=>vn,createServer:()=>qh});var Hs=N(Ft("net"),1);var jt=Ft("node:net");function Tr(r){return Boolean((0,jt.isIP)(r))}var kn={};dt(kn,{identity:()=>Gu});function Nu(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 o=r.charAt(i),a=o.charCodeAt(0);if(e[a]!==255)throw new TypeError(o+" is ambiguous");e[a]=i}var l=r.length,f=r.charAt(0),d=Math.log(l)/Math.log(256),h=Math.log(256)/Math.log(l);function g(b){if(b instanceof Uint8Array||(ArrayBuffer.isView(b)?b=new Uint8Array(b.buffer,b.byteOffset,b.byteLength):Array.isArray(b)&&(b=Uint8Array.from(b))),!(b instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(b.length===0)return"";for(var T=0,B=0,I=0,_=b.length;I!==_&&b[I]===0;)I++,T++;for(var G=(_-I)*h+1>>>0,W=new Uint8Array(G);I!==_;){for(var ft=b[I],ct=0,ot=G-1;(ft!==0||ct<B)&&ot!==-1;ot--,ct++)ft+=256*W[ot]>>>0,W[ot]=ft%l>>>0,ft=ft/l>>>0;if(ft!==0)throw new Error("Non-zero carry");B=ct,I++}for(var at=G-B;at!==G&&W[at]===0;)at++;for(var At=f.repeat(T);at<G;++at)At+=r.charAt(W[at]);return At}function w(b){if(typeof b!="string")throw new TypeError("Expected String");if(b.length===0)return new Uint8Array;var T=0;if(b[T]!==" "){for(var B=0,I=0;b[T]===f;)B++,T++;for(var _=(b.length-T)*d+1>>>0,G=new Uint8Array(_);b[T];){var W=e[b.charCodeAt(T)];if(W===255)return;for(var ft=0,ct=_-1;(W!==0||ft<I)&&ct!==-1;ct--,ft++)W+=l*G[ct]>>>0,G[ct]=W%256>>>0,W=W/256>>>0;if(W!==0)throw new Error("Non-zero carry");I=ft,T++}if(b[T]!==" "){for(var ot=_-I;ot!==_&&G[ot]===0;)ot++;for(var at=new Uint8Array(B+(_-ot)),At=B;ot!==_;)at[At++]=G[ot++];return at}}}function S(b){var T=w(b);if(T)return T;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:w,decode:S}}var Mu=Nu,Pu=Mu,lo=Pu;var jh=new Uint8Array(0);var fo=(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},wt=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 ho=r=>new TextEncoder().encode(r),po=r=>new TextDecoder().decode(r);var Cn=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")}},_n=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 go(this,t)}},Bn=class{constructor(t){this.decoders=t}or(t){return go(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`)}},go=(r,t)=>new Bn({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),Dn=class{constructor(t,e,n,i){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=i,this.encoder=new Cn(t,e,n),this.decoder=new _n(t,e,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},_e=({name:r,prefix:t,encode:e,decode:n})=>new Dn(r,t,e,n),Jt=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:i}=lo(e,t);return _e({prefix:r,name:t,encode:n,decode:o=>wt(i(o))})},Uu=(r,t,e,n)=>{let i={};for(let h=0;h<t.length;++h)i[t[h]]=h;let o=r.length;for(;r[o-1]==="=";)--o;let a=new Uint8Array(o*e/8|0),l=0,f=0,d=0;for(let h=0;h<o;++h){let g=i[r[h]];if(g===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<e|g,l+=e,l>=8&&(l-=8,a[d++]=255&f>>l)}if(l>=e||255&f<<8-l)throw new SyntaxError("Unexpected end of data");return a},Fu=(r,t,e)=>{let n=t[t.length-1]==="=",i=(1<<e)-1,o="",a=0,l=0;for(let f=0;f<r.length;++f)for(l=l<<8|r[f],a+=8;a>e;)a-=e,o+=t[i&l>>a];if(a&&(o+=t[i&l<<e-a]),n)for(;o.length*e&7;)o+="=";return o},U=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>_e({prefix:t,name:r,encode(i){return Fu(i,n,e)},decode(i){return Uu(i,n,e,r)}});var Gu=_e({prefix:"\0",name:"identity",encode:r=>po(r),decode:r=>ho(r)});var Rn={};dt(Rn,{base2:()=>$u});var $u=U({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ln={};dt(Ln,{base8:()=>zu});var zu=U({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var On={};dt(On,{base10:()=>Vu});var Vu=Jt({prefix:"9",name:"base10",alphabet:"0123456789"});var Nn={};dt(Nn,{base16:()=>Hu,base16upper:()=>Wu});var Hu=U({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Wu=U({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Mn={};dt(Mn,{base32:()=>Bt,base32hex:()=>Xu,base32hexpad:()=>ju,base32hexpadupper:()=>Ju,base32hexupper:()=>Yu,base32pad:()=>Zu,base32padupper:()=>Ku,base32upper:()=>qu,base32z:()=>Qu});var Bt=U({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),qu=U({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Zu=U({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ku=U({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Xu=U({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Yu=U({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ju=U({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ju=U({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Qu=U({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Pn={};dt(Pn,{base36:()=>tl,base36upper:()=>el});var tl=Jt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),el=Jt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Un={};dt(Un,{base58btc:()=>q,base58flickr:()=>rl});var q=Jt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),rl=Jt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Gn={};dt(Gn,{base64:()=>Fn,base64pad:()=>nl,base64url:()=>il,base64urlpad:()=>ol});var Fn=U({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),nl=U({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),il=U({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ol=U({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var $n={};dt($n,{base256emoji:()=>ll});var yo=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}"),sl=yo.reduce((r,t,e)=>(r[e]=t,r),[]),cl=yo.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function al(r){return r.reduce((t,e)=>(t+=sl[e],t),"")}function ul(r){let t=[];for(let e of r){let n=cl[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var ll=_e({prefix:"\u{1F680}",name:"base256emoji",encode:al,decode:ul});var qn={};dt(qn,{sha256:()=>Ar,sha512:()=>Bl});var Wn=N(Ft("crypto"),1);var fl=Eo,bo=128,hl=127,pl=~hl,dl=Math.pow(2,31);function Eo(r,t,e){t=t||[],e=e||0;for(var n=e;r>=dl;)t[e++]=r&255|bo,r/=128;for(;r&pl;)t[e++]=r&255|bo,r>>>=7;return t[e]=r|0,Eo.bytes=e-n+1,t}var ml=zn,gl=128,wo=127;function zn(r,n){var e=0,n=n||0,i=0,o=n,a,l=r.length;do{if(o>=l)throw zn.bytes=0,new RangeError("Could not decode varint");a=r[o++],e+=i<28?(a&wo)<<i:(a&wo)*Math.pow(2,i),i+=7}while(a>=gl);return zn.bytes=o-n,e}var yl=Math.pow(2,7),bl=Math.pow(2,14),wl=Math.pow(2,21),El=Math.pow(2,28),vl=Math.pow(2,35),Sl=Math.pow(2,42),Tl=Math.pow(2,49),xl=Math.pow(2,56),Al=Math.pow(2,63),Il=function(r){return r<yl?1:r<bl?2:r<wl?3:r<El?4:r<vl?5:r<Sl?6:r<Tl?7:r<xl?8:r<Al?9:10},Cl={encode:fl,decode:ml,encodingLength:Il},_l=Cl,je=_l;var Je=(r,t=0)=>[je.decode(r,t),je.decode.bytes],Be=(r,t,e=0)=>(je.encode(r,t,e),t),De=r=>je.encodingLength(r);var Qt=(r,t)=>{let e=t.byteLength,n=De(r),i=n+De(e),o=new Uint8Array(i+e);return Be(r,o,0),Be(e,o,n),o.set(t,i),new ke(r,e,t,o)},le=r=>{let t=wt(r),[e,n]=Je(t),[i,o]=Je(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new ke(e,i,a,t)},vo=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&fo(r.bytes,e.bytes)}},ke=class{constructor(t,e,n,i){this.code=t,this.size=e,this.digest=n,this.bytes=i}};var Hn=({name:r,code:t,encode:e})=>new Vn(r,t,e),Vn=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?Qt(this.code,e):e.then(n=>Qt(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Ar=Hn({name:"sha2-256",code:18,encode:r=>wt(Wn.default.createHash("sha256").update(r).digest())}),Bl=Hn({name:"sha2-512",code:19,encode:r=>wt(Wn.default.createHash("sha512").update(r).digest())});var Zn={};dt(Zn,{identity:()=>Ir});var To=0,Dl="identity",xo=wt,kl=r=>Qt(To,xo(r)),Ir={code:To,name:Dl,encode:xo,digest:kl};var wp=new TextEncoder,Ep=new TextDecoder;var Ao=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return Nl(e,Kn(r),t||q.encoder);default:return Ml(e,Kn(r),t||Bt.encoder)}};var Io=new WeakMap,Kn=r=>{let t=Io.get(r);if(t==null){let e=new Map;return Io.set(r,e),e}return t},R=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!==Qe)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Pl)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return R.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,n=Qt(t,e);return R.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return R.equals(this,t)}static equals(t,e){let n=e;return n&&t.code===n.code&&t.version===n.version&&vo(t.multihash,n.multihash)}toString(t){return Ao(this,t)}toJSON(){return{"/":Ao(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof R)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:i,multihash:o,bytes:a}=e;return new R(n,i,o,a||Co(n,i,o.bytes))}else if(e[Ul]===!0){let{version:n,multihash:i,code:o}=e,a=le(i);return R.create(n,o,a)}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!==Qe)throw new Error(`Version 0 CID must use dag-pb (code: ${Qe}) block encoding`);return new R(t,e,n,n.bytes)}case 1:{let i=Co(t,e,n.bytes);return new R(t,e,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return R.create(0,Qe,t)}static createV1(t,e){return R.create(1,t,e)}static decode(t){let[e,n]=R.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=R.inspectBytes(t),n=e.size-e.multihashSize,i=wt(t.subarray(n,n+e.multihashSize));if(i.byteLength!==e.multihashSize)throw new Error("Incorrect length");let o=i.subarray(e.multihashSize-e.digestSize),a=new ke(e.multihashCode,e.digestSize,o,i);return[e.version===0?R.createV0(a):R.createV1(e.codec,a),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[g,w]=Je(t.subarray(e));return e+=w,g},i=n(),o=Qe;if(i===18?(i=0,e=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=e,l=n(),f=n(),d=e+f,h=d-a;return{version:i,codec:o,multihashCode:l,digestSize:f,multihashSize:h,size:d}}static parse(t,e){let[n,i]=Ol(t,e),o=R.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Kn(o).set(n,t),o}},Ol=(r,t)=>{switch(r[0]){case"Q":{let e=t||q;return[q.prefix,e.decode(`${q.prefix}${r}`)]}case q.prefix:{let e=t||q;return[q.prefix,e.decode(r)]}case Bt.prefix:{let e=t||Bt;return[Bt.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)]}}},Nl=(r,t,e)=>{let{prefix:n}=e;if(n!==q.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let i=t.get(n);if(i==null){let o=e.encode(r).slice(1);return t.set(n,o),o}else return i},Ml=(r,t,e)=>{let{prefix:n}=e,i=t.get(n);if(i==null){let o=e.encode(r);return t.set(n,o),o}else return i},Qe=112,Pl=18,Co=(r,t,e)=>{let n=De(r),i=n+De(t),o=new Uint8Array(i+e.byteLength);return Be(r,o,0),Be(t,o,n),o.set(e,i),o},Ul=Symbol.for("@ipld/js-cid/CID");var te={...kn,...Rn,...Ln,...On,...Nn,...Mn,...Pn,...Un,...Gn,...$n},Dp={...qn,...Zn};function he(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Gt(r=0){return globalThis.Buffer?.alloc!=null?he(globalThis.Buffer.alloc(r)):new Uint8Array(r)}function $t(r=0){return globalThis.Buffer?.allocUnsafe!=null?he(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Bo(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var _o=Bo("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Xn=Bo("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=$t(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Fl={utf8:_o,"utf-8":_o,hex:te.base16,latin1:Xn,ascii:Xn,binary:Xn,...te},Cr=Fl;function ut(r,t="utf8"){let e=Cr[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 Do=jt.isIPv4,Gl=jt.isIPv6,Yn=function(r){let t=0;if(r=r.toString().trim(),Do(r)){let e=new Uint8Array(t+4);return r.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(Gl(r)){let e=r.split(":",8),n;for(n=0;n<e.length;n++){let o=Do(e[n]),a;o&&(a=Yn(e[n]),e[n]=ut(a.slice(0,2),"base16")),a!=null&&++n<8&&e.splice(n,0,ut(a.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 o=[n,1];for(n=9-e.length;n>0;n--)o.push("0");e.splice.apply(e,o)}let i=new Uint8Array(t+16);for(n=0;n<e.length;n++){let o=parseInt(e[n],16);i[t++]=o>>8&255,i[t++]=o&255}return i}throw new Error("invalid ip address")},ko=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 o=0;o<e;o++)i.push(r[t+o]);return i.join(".")}if(e===16){let i=[];for(let o=0;o<e;o+=2)i.push(n.getUint16(t+o).toString(16));return i.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var tr={},jn={},zl=[[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"],[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"],[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"]];zl.forEach(r=>{let t=Vl(...r);jn[t.code]=t,tr[t.name]=t});function Vl(r,t,e,n,i){return{code:r,size:t,name:e,resolvable:Boolean(n),path:Boolean(i)}}function O(r){if(typeof r=="number"){if(jn[r]!=null)return jn[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(tr[r]!=null)return tr[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var Ot=N(_r(),1);function er(r,t="utf8"){let e=Cr[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?he(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}function Et(r,t){t==null&&(t=r.reduce((i,o)=>i+o.length,0));let e=$t(t),n=0;for(let i of r)e.set(i,n),n+=i.length;return he(e)}function Wo(r,t){switch(O(r).code){case 4:case 41:return of(t);case 42:return Vo(t);case 6:case 273:case 33:case 132:return Zo(t).toString();case 53:case 54:case 55:case 56:case 400:case 777:return Vo(t);case 421:return uf(t);case 444:return Ho(t);case 445:return Ho(t);case 466:return af(t);default:return ut(t,"base16")}}function qo(r,t){switch(O(r).code){case 4:return $o(t);case 41:return $o(t);case 42:return zo(t);case 6:case 273:case 33:case 132:return ei(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 777:return zo(t);case 421:return sf(t);case 444:return lf(t);case 445:return ff(t);case 466:return cf(t);default:return er(t,"base16")}}var ti=Object.values(te).map(r=>r.decoder),nf=function(){let r=ti[0].or(ti[1]);return ti.slice(2).forEach(t=>r=r.or(t)),r}();function $o(r){if(!Tr(r))throw new Error("invalid ip address");return Yn(r)}function of(r){let t=ko(r,0,r.length);if(t==null)throw new Error("ipBuff is required");if(!Tr(t))throw new Error("invalid ip address");return t}function ei(r){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,r),new Uint8Array(t)}function Zo(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function zo(r){let t=er(r),e=Uint8Array.from(Ot.default.encode(t.length));return Et([e,t],e.length+t.length)}function Vo(r){let t=Ot.default.decode(r);if(r=r.slice(Ot.default.decode.bytes),r.length!==t)throw new Error("inconsistent lengths");return ut(r)}function sf(r){let t;r[0]==="Q"||r[0]==="1"?t=le(q.decode(`z${r}`)).bytes:t=R.parse(r).multihash.bytes;let e=Uint8Array.from(Ot.default.encode(t.length));return Et([e,t],e.length+t.length)}function cf(r){let t=nf.decode(r),e=Uint8Array.from(Ot.default.encode(t.length));return Et([e,t],e.length+t.length)}function af(r){let t=Ot.default.decode(r),e=r.slice(Ot.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return"u"+ut(e,"base64url")}function uf(r){let t=Ot.default.decode(r),e=r.slice(Ot.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return ut(e,"base58btc")}function lf(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=Bt.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=ei(n);return Et([e,i],e.length+i.length)}function ff(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=Bt.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=ei(n);return Et([e,i],e.length+i.length)}function Ho(r){let t=r.slice(0,r.length-2),e=r.slice(r.length-2),n=ut(t,"base32"),i=Zo(e);return`${n}:${i}`}var Re=N(_r(),1);function hf(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],o=O(i);if(o.size===0){t.push([i]);continue}if(n++,n>=e.length)throw Xo("invalid address: "+r);if(o.path===!0){t.push([i,si(e.slice(n).join("/"))]);break}t.push([i,e[n]])}return t}function pf(r){let t=[];return r.map(e=>{let n=kr(e);return t.push(n.name),e.length>1&&e[1]!=null&&t.push(e[1]),null}),si(t.join("/"))}function df(r){return r.map(t=>{Array.isArray(t)||(t=[t]);let e=kr(t);return t.length>1?[e.code,qo(e.code,t[1])]:[e.code]})}function ri(r){return r.map(t=>{let e=kr(t);return t[1]!=null?[e.code,Wo(e.code,t[1])]:[e.code]})}function ni(r){return Dr(Et(r.map(t=>{let e=kr(t),n=Uint8Array.from(Re.default.encode(e.code));return t.length>1&&t[1]!=null&&(n=Et([n,t[1]])),n})))}function ii(r,t){return r.size>0?r.size/8:r.size===0?0:Re.default.decode(t)+(Re.default.decode.bytes??0)}function Br(r){let t=[],e=0;for(;e<r.length;){let n=Re.default.decode(r,e),i=Re.default.decode.bytes??0,o=O(n),a=ii(o,r.slice(e+i));if(a===0){t.push([n]),e+=i;continue}let l=r.slice(e+i,e+i+a);if(e+=a+i,e>r.length)throw Xo("Invalid address Uint8Array: "+ut(r,"base16"));t.push([n,l])}return t}function oi(r){let t=Br(r),e=ri(t);return pf(e)}function mf(r){r=si(r);let t=hf(r),e=df(t);return ni(e)}function Ko(r){return mf(r)}function Dr(r){let t=gf(r);if(t!=null)throw t;return Uint8Array.from(r)}function gf(r){try{Br(r)}catch(t){return t}}function si(r){return"/"+r.trim().split("/").filter(t=>t).join("/")}function Xo(r){return new Error("Error parsing address: "+r)}function kr(r){return O(r[0])}var ai=N(_r(),1);var Qo=N(Rr(),1);function pe(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 Le=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)},ci=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},rr,nr,ir,Jo,wf=Symbol.for("nodejs.util.inspect.custom"),Ef=[O("dns").code,O("dns4").code,O("dns6").code,O("dnsaddr").code],vf=new Map,ts=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Sf(r){return Boolean(r?.[ts])}var zt=class{constructor(t){if(rr.set(this,void 0),nr.set(this,void 0),ir.set(this,void 0),this[Jo]=!0,t==null&&(t=""),t instanceof Uint8Array)this.bytes=Dr(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);this.bytes=Ko(t)}else if(Sf(t))this.bytes=Dr(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return Le(this,rr,"f")==null&&ci(this,rr,oi(this.bytes),"f"),Le(this,rr,"f")}toJSON(){return this.toString()}toOptions(){let t,e,n,i,o="",a=O("tcp"),l=O("udp"),f=O("ip4"),d=O("ip6"),h=O("dns6"),g=O("ip6zone");for(let[S,b]of this.stringTuples())S===g.code&&(o=`%${b??""}`),Ef.includes(S)&&(e=a.name,i=443,n=`${b??""}${o}`,t=S===h.code?6:4),(S===a.code||S===l.code)&&(e=O(S).name,i=parseInt(b??"")),(S===f.code||S===d.code)&&(e=O(S).name,n=`${b??""}${o}`,t=S===d.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({},O(t)))}protoCodes(){let t=[],e=this.bytes,n=0;for(;n<e.length;){let i=ai.default.decode(e,n),o=ai.default.decode.bytes??0,a=O(i),l=ii(a,e.slice(n+o));n+=l+o,t.push(i)}return t}protoNames(){return this.protos().map(t=>t.name)}tuples(){return Le(this,nr,"f")==null&&ci(this,nr,Br(this.bytes),"f"),Le(this,nr,"f")}stringTuples(){return Le(this,ir,"f")==null&&ci(this,ir,ri(this.tuples()),"f"),Le(this,ir,"f")}encapsulate(t){return t=new zt(t),new zt(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 zt(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 zt(ni(e.slice(0,n)));return this}getPeerId(){try{let e=this.stringTuples().filter(n=>n[0]===tr.ipfs.code).pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?ut(q.decode(`z${n}`),"base58btc"):ut(R.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){let t=null;try{t=this.stringTuples().filter(e=>O(e[0]).path===!0)[0][1],t==null&&(t=null)}catch{t=null}return t}equals(t){return pe(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(o=>o.resolvable);if(e==null)return[this];let n=vf.get(e.name);if(n==null)throw(0,Qo.default)(new Error(`no available resolver for ${e.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(o=>new zt(o))}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)}[(rr=new WeakMap,nr=new WeakMap,ir=new WeakMap,Jo=ts,wf)](){return`Multiaddr(${oi(this.bytes)})`}};function vt(r){return new zt(r)}var Tf=A("dns4"),xf=A("dns6"),Af=A("dnsaddr"),Oe=Q(A("dns"),Af,Tf,xf),Lr=Q(A("ip4"),A("ip6")),de=Q(C(Lr,A("tcp")),C(Oe,A("tcp"))),rs=C(Lr,A("udp")),If=C(rs,A("utp")),Cf=C(rs,A("quic")),sr=Q(C(de,A("ws")),C(Oe,A("ws"))),cr=Q(C(de,A("wss")),C(Oe,A("wss"))),ui=Q(C(de,A("http")),C(Lr,A("http")),C(Oe,A("http"))),li=Q(C(de,A("https")),C(Lr,A("https")),C(Oe,A("https"))),ns=Q(C(sr,A("p2p-webrtc-star"),A("p2p")),C(cr,A("p2p-webrtc-star"),A("p2p")),C(sr,A("p2p-webrtc-star")),C(cr,A("p2p-webrtc-star"))),Sd=Q(C(sr,A("p2p-websocket-star"),A("p2p")),C(cr,A("p2p-websocket-star"),A("p2p")),C(sr,A("p2p-websocket-star")),C(cr,A("p2p-websocket-star"))),is=Q(C(ui,A("p2p-webrtc-direct"),A("p2p")),C(li,A("p2p-webrtc-direct"),A("p2p")),C(ui,A("p2p-webrtc-direct")),C(li,A("p2p-webrtc-direct"))),ar=Q(sr,cr,ui,li,ns,is,de,If,Cf,Oe),Td=Q(C(ar,A("p2p-stardust"),A("p2p")),C(ar,A("p2p-stardust"))),ee=Q(C(ar,A("p2p")),ns,is,A("p2p")),es=Q(C(ee,A("p2p-circuit"),ee),C(ee,A("p2p-circuit")),C(A("p2p-circuit"),ee),C(ar,A("p2p-circuit")),C(A("p2p-circuit"),ar),A("p2p-circuit")),os=()=>Q(C(es,os),es),or=os(),xd=Q(C(or,ee,or),C(ee,or),C(or,ee),or,ee);function ss(r){function t(e){let n;try{n=vt(e)}catch{return!1}let i=r(n.protoNames());return i===null?!1:i===!0||i===!1?i:i.length===0}return t}function C(...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:ss(t),partialMatch:t}}function Q(...r){function t(n){let i=null;return r.some(o=>{let a=typeof o=="function"?o().partialMatch(n):o.partialMatch(n);return a!=null?(i=a,!0):!1}),i}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:ss(t),partialMatch:t}}function A(r){let t=r;function e(i){let o;try{o=vt(i)}catch{return!1}let a=o.protoNames();return a.length===1&&a[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 Nt=N(ys(),1);Nt.default.formatters.b=r=>r==null?"undefined":q.baseEncode(r);Nt.default.formatters.t=r=>r==null?"undefined":Bt.baseEncode(r);Nt.default.formatters.m=r=>r==null?"undefined":Fn.baseEncode(r);Nt.default.formatters.p=r=>r==null?"undefined":r.toString();Nt.default.formatters.c=r=>r==null?"undefined":r.toString();Nt.default.formatters.k=r=>r==null?"undefined":r.toString();function et(r){return Object.assign((0,Nt.default)(r),{error:(0,Nt.default)(`${r}:error`),trace:(0,Nt.default)(`${r}:trace`)})}var Gs=N(As(),1);var qr=N(Rr(),1);function Fr(r){return this.subnetMask<r.subnetMask?!1:this.mask(r.subnetMask)===r.mask()}function Gr(r){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===r&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}var Ge=/^(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,gi=/\/\d{1,2}$/;var rt=class extends Error{constructor(t,e){super(t),this.name="AddressError",e!==null&&(this.parseMessage=e)}};var $e=N(yi(),1),ge=N(ur(),1),M=class{constructor(t){this.groups=4,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=Gr(32),this.isInSubnet=Fr,this.address=t;let e=gi.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 rt("Invalid subnet mask.");t=t.replace(gi,"")}this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}static isValid(t){try{return new M(t),!0}catch{return!1}}parse(t){let e=t.split(".");if(!t.match(Ge))throw new rt("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 o=e.slice(i,i+2);n.push(parseInt(o,16))}return new M(n.join("."))}static fromInteger(t){return M.fromHex(t.toString(16))}static fromArpa(t){let n=t.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new M(n)}toHex(){return this.parsedAddress.map(t=>(0,ge.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,ge.sprintf)("%02x%02x",parseInt(this.parsedAddress[e],10),parseInt(this.parsedAddress[e+1],10));t.push((0,ge.sprintf)("%x",parseInt(n,16)))}return t.join(":")}bigInteger(){return new $e.BigInteger(this.parsedAddress.map(t=>(0,ge.sprintf)("%02x",parseInt(t,10))).join(""),16)}_startAddress(){return new $e.BigInteger(this.mask()+"0".repeat(32-this.subnetMask),2)}startAddress(){return M.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new $e.BigInteger("1");return M.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new $e.BigInteger(this.mask()+"1".repeat(32-this.subnetMask),2)}endAddress(){return M.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new $e.BigInteger("1");return M.fromBigInteger(this._endAddress().subtract(t))}static fromBigInteger(t){return M.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,ge.sprintf)("%s.in-addr.arpa.",e)}isMulticast(){return this.isInSubnet(new M("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(32,"0")}groupForV6(){let t=this.parsedAddress;return this.address.replace(Ge,(0,ge.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 Ds={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},bi={"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"},wi=/([^0-9a-f:/%])/gi,Ei=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,vi=/\/\d{1,3}(?=%|$)/,Si=/%.*$/,ks=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),Rs=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/);var Os=N(ur(),1);function rh(r){return r.replace(/^(0+)/,'<span class="zero">$1</span>')}function Vr(r,t=0){return r.split(":").map((n,i)=>/group-v4/.test(n)?n:(0,Os.sprintf)('<span class="hover-group group-%d">%s</span>',i+t,rh(n)))}var be=N(ur(),1);function xi(r){return(0,be.sprintf)("(%s)",r.join("|"))}function Ti(r){return r.length<4?(0,be.sprintf)("0{0,%d}%s",4-r.length,r):r}var Ai="[^A-Fa-f0-9:]";function Hr(r){let t=[];r.forEach((n,i)=>{parseInt(n,16)===0&&t.push(i)});let e=t.map(n=>r.map((i,o)=>{if(o===n){let a=o===0||o===8-1?":":"";return xi([Ti(i),a])}return Ti(i)}).join(":"));return e.push(r.map(Ti).join(":")),xi(e)}function Ii(r,t,e){let n=t?"":":",i=e?"":":",o=[];!t&&!e&&o.push("::"),t&&e&&o.push(""),(e&&!t||!e&&t)&&o.push(":"),o.push((0,be.sprintf)("%s(:0{1,4}){1,%d}",n,r-1)),o.push((0,be.sprintf)("(0{1,4}:){1,%d}%s",r-1,i)),o.push((0,be.sprintf)("(0{1,4}:){%d}0{1,4}",r-1));for(let a=1;a<r-1;a++)for(let l=1;l<r-a;l++)o.push((0,be.sprintf)("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",l,r-l-a-1));return xi(o)}var nt=N(yi(),1),it=N(ur(),1);function Wr(r){if(!r)throw new Error("Assertion failed.")}function nh(r){let t=/(\d+)(\d{3})/;for(;t.test(r);)r=r.replace(t,"$1,$2");return r}function ih(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 oh(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 Ms(r){return(0,it.sprintf)("%04x",parseInt(r,16))}function Ps(r){return r&255}var F=class{constructor(t,e){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=Fr,this.isCorrect=Gr(128),e===void 0?this.groups=8:this.groups=e,this.address=t;let n=vi.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 rt("Invalid subnet mask.");t=t.replace(vi,"")}else if(/\//.test(t))throw new rt("Invalid subnet mask.");let i=Si.exec(t);i&&(this.zone=i[0],t=t.replace(Si,"")),this.addressMinusSuffix=t,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(t){try{return new F(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 F(n.join(":"))}static fromURL(t){let e,n=null,i;if(t.indexOf("[")!==-1&&t.indexOf("]:")!==-1){if(i=Rs.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=ks.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 F(e),port:n}}static fromAddress4(t){let e=new M(t),n=128-(32-e.subnetMask);return new F(`::ffff:${e.correctForm()}/${n}`)}static fromArpa(t){let e=t.replace(/(\.ip6\.arpa)?\.$/,""),n=7;if(e.length!==63)throw new rt("Invalid 'ip6.arpa' form.");let i=e.split(".").reverse();for(let o=n;o>0;o--){let a=o*4;i.splice(a,0,":")}return e=i.join(""),new F(e)}microsoftTranscription(){return(0,it.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":nh(new nt.BigInteger("2",10).pow(i).toString(10))}_startAddress(){return new nt.BigInteger(this.mask()+"0".repeat(128-this.subnetMask),2)}startAddress(){return F.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new nt.BigInteger("1");return F.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new nt.BigInteger(this.mask()+"1".repeat(128-this.subnetMask),2)}endAddress(){return F.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new nt.BigInteger("1");return F.fromBigInteger(this._endAddress().subtract(t))}getScope(){let t=Ds[this.getBits(12,16).intValue()];return this.getType()==="Global unicast"&&t!=="Link local"&&(t="Global"),t||"Unknown"}getType(){for(let t of Object.keys(bi))if(this.isInSubnet(new F(t)))return bi[t];return"Global unicast"}getBits(t,e){return new nt.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,it.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 l=parseInt(this.parsedAddress[t],16);l===0&&n++,l!==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 o=i.map(l=>l[1]-l[0]+1);if(i.length>0){let l=o.indexOf(Math.max(...o));e=oh(this.parsedAddress,i[l])}else e=this.parsedAddress;for(t=0;t<e.length;t++)e[t]!=="compact"&&(e[t]=parseInt(e[t],16).toString(16));let a=e.join(":");return a=a.replace(/^compact$/,"::"),a=a.replace(/^compact|compact$/,":"),a=a.replace(/compact/,""),a}binaryZeroPad(){return this.bigInteger().toString(2).padStart(128,"0")}parse4in6(t){let e=t.split(":"),i=e.slice(-1)[0].match(Ge);if(i){this.parsedAddress4=i[0],this.address4=new M(this.parsedAddress4);for(let o=0;o<this.address4.groups;o++)if(/^0[0-9]+/.test(this.address4.parsedAddress[o]))throw new rt("IPv4 addresses can't have leading zeroes.",t.replace(Ge,this.address4.parsedAddress.map(ih).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(wi);if(e)throw new rt((0,it.sprintf)("Bad character%s detected in address: %s",e.length>1?"s":"",e.join("")),t.replace(wi,'<span class="parse-error">$1</span>'));let n=t.match(Ei);if(n)throw new rt((0,it.sprintf)("Address failed regex: %s",n.join("")),t.replace(Ei,'<span class="parse-error">$1</span>'));let i=[],o=t.split("::");if(o.length===2){let a=o[0].split(":"),l=o[1].split(":");a.length===1&&a[0]===""&&(a=[]),l.length===1&&l[0]===""&&(l=[]);let f=this.groups-(a.length+l.length);if(!f)throw new rt("Error parsing groups");this.elidedGroups=f,this.elisionBegin=a.length,this.elisionEnd=a.length+this.elidedGroups,i=i.concat(a);for(let d=0;d<f;d++)i.push("0");i=i.concat(l)}else if(o.length===1)i=t.split(":"),this.elidedGroups=0;else throw new rt("Too many :: groups found");if(i=i.map(a=>(0,it.sprintf)("%x",parseInt(a,16))),i.length!==this.groups)throw new rt("Incorrect number of groups found");return i}canonicalForm(){return this.parsedAddress.map(Ms).join(":")}decimal(){return this.parsedAddress.map(t=>(0,it.sprintf)("%05d",parseInt(t,16))).join(":")}bigInteger(){return new nt.BigInteger(this.parsedAddress.map(Ms).join(""),16)}to4(){let t=this.binaryZeroPad().split("");return M.fromHex(new nt.BigInteger(t.slice(96,128).join(""),2).toString(16))}to4in6(){let t=this.to4(),n=new F(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 nt.BigInteger("ffff",16)).toString(),n=M.fromHex(this.getBitsBase16(32,64)),i=M.fromHex(this.getBits(96,128).xor(new nt.BigInteger("ffffffff",16)).toString(16)),o=this.getBits(64,80),a=this.getBitsBase2(64,80),l=o.testBit(15),f=o.testBit(14),d=o.testBit(8),h=o.testBit(9),g=new nt.BigInteger(a.slice(2,6)+a.slice(8,16),2).toString(10);return{prefix:(0,it.sprintf)("%s:%s",t.slice(0,4),t.slice(4,8)),server4:n.address,client4:i.address,flags:a,coneNat:l,microsoft:{reserved:f,universalLocal:h,groupIndividual:d,nonce:g},udpPort:e}}inspect6to4(){let t=this.getBitsBase16(0,16),e=M.fromHex(this.getBitsBase16(16,48));return{prefix:(0,it.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 F(t)}toByteArray(){let t=this.bigInteger().toByteArray();return t.length===17&&t[0]===0?t.slice(1):t}toUnsignedByteArray(){return this.toByteArray().map(Ps)}static fromByteArray(t){return this.fromUnsignedByteArray(t.map(Ps))}static fromUnsignedByteArray(t){let e=new nt.BigInteger("256",10),n=new nt.BigInteger("0",10),i=new nt.BigInteger("1",10);for(let o=t.length-1;o>=0;o--)n=n.add(i.multiply(new nt.BigInteger(t[o].toString(10),10))),i=i.multiply(e);return F.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 F("2001::/32"))}is6to4(){return this.isInSubnet(new F("2002::/16"))}isLoopback(){return this.getType()==="Loopback"}href(t){return t===void 0?t="":t=(0,it.sprintf)(":%s",t),(0,it.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,it.sprintf)('<a href="%1$s%2$s" class="%3$s">%2$s</a>',t.prefix,e.call(this),t.className):(0,it.sprintf)('<a href="%1$s%2$s">%2$s</a>',t.prefix,e.call(this))}group(){if(this.elidedGroups===0)return Vr(this.address).join(":");Wr(typeof this.elidedGroups=="number"),Wr(typeof this.elisionBegin=="number");let t=[],[e,n]=this.address.split("::");e.length?t.push(...Vr(e)):t.push("");let i=["hover-group"];for(let o=this.elisionBegin;o<this.elisionBegin+this.elidedGroups;o++)i.push((0,it.sprintf)("group-%d",o));return t.push((0,it.sprintf)('<span class="%s"></span>',i.join(" "))),n.length?t.push(...Vr(n,this.elisionEnd)):t.push(""),this.is4()&&(Wr(this.address4 instanceof M),t.pop(),t.push(this.address4.groupForV6())),t.join(":")}regularExpressionString(t=!1){let e=[],n=new F(this.correctForm());if(n.elidedGroups===0)e.push(Hr(n.parsedAddress));else if(n.elidedGroups===8)e.push(Ii(8));else{let i=n.address.split("::");i[0].length&&e.push(Hr(i[0].split(":"))),Wr(typeof n.elidedGroups=="number"),e.push(Ii(n.elidedGroups,i[0].length!==0,i[1].length!==0)),i[1].length&&e.push(Hr(i[1].split(":"))),e=[e.join(":")]}return t||(e=["(?=^|",Ai,"|[^\\w\\:])(",...e,")(?=[^\\w\\:]|",Ai,"|$)"]),e.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};var sh=et("libp2p:ip-port-to-multiaddr"),Ci={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};function Us(r,t){if(typeof r!="string")throw(0,qr.default)(new Error(`invalid ip provided: ${r}`),Ci.ERR_INVALID_IP_PARAMETER);if(typeof t=="string"&&(t=parseInt(t)),isNaN(t))throw(0,qr.default)(new Error(`invalid port provided: ${t}`),Ci.ERR_INVALID_PORT_PARAMETER);try{return new M(r),vt(`/ip4/${r}/tcp/${t}`)}catch{}try{let e=new F(r);return e.is4()?vt(`/ip4/${e.to4().correctForm()}/tcp/${t}`):vt(`/ip6/${r}/tcp/${t}`)}catch{let n=`invalid ip:port for creating a multiaddr: ${r}:${t}`;throw sh.error(n),(0,qr.default)(new Error(n),Ci.ERR_INVALID_IP)}}var _i=N(Ft("os"),1),Fs=N(Ft("path"),1),ch={ip4:"IPv4",ip6:"IPv6"};function Ve(r){let t=r.getPath();return t!=null?_i.default.platform()==="win32"?{path:Fs.default.join("\\\\.\\pipe\\",t)}:{path:t}:r.toOptions()}function Bi(r,t,e){let n=i=>vt(`/${r}/${i}/tcp/${e}`);return(ah(t)?lh(ch[r]):[t]).map(n)}function ah(r){return["0.0.0.0","::"].includes(r)}var uh=_i.default.networkInterfaces();function lh(r){let t=[];for(let[,e]of Object.entries(uh))if(e!=null)for(let n of e)n.family===r&&t.push(n.address);return t}var Ht=class extends Error{constructor(t="The operation was aborted"){super(t),this.code=Ht.code,this.type=Ht.type}static get code(){return"ABORT_ERR"}static get type(){return"aborted"}},Wt=class extends Error{constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};var kt=et("libp2p:tcp:socket"),Zr=(r,t)=>{let e=t.metrics,n=t.metricPrefix??"",i=t.socketInactivityTimeout??3e5,o=t.socketCloseTimeout??2e3;t.listeningAddr?.getPath()!=null&&(t.remoteAddr=t.listeningAddr),t.remoteAddr?.getPath()!=null&&(t.localAddr=t.remoteAddr);let a;if(t.remoteAddr!=null)a=t.remoteAddr;else{if(r.remoteAddress==null||r.remotePort==null)throw new Wt("Could not determine remote address or port","ERR_NO_REMOTE_ADDRESS");a=Us(r.remoteAddress,r.remotePort)}let l=Ve(a),f=l.path??`${l.host??""}:${l.port??""}`,{sink:d,source:h}=Gs.default.duplex(r);r.setTimeout(i,()=>{kt("%s socket read timeout",f),e?.increment({[`${n}timeout`]:!0});let w;r.readable&&(w=new Wt("Socket read timeout","ERR_SOCKET_READ_TIMEOUT")),r.destroy(w)}),r.once("close",()=>{kt("%s socket close",f),e?.increment({[`${n}close`]:!0}),g.timeline.close==null&&(g.timeline.close=Date.now())}),r.once("end",()=>{kt("%s socket end",f),e?.increment({[`${n}end`]:!0})});let g={async sink(w){try{await d(w)}catch(S){S.type!=="aborted"&&kt(S)}r.end()},source:h,remoteAddr:a,timeline:{open:Date.now()},async close(){if(r.destroyed){kt("%s socket was already destroyed when trying to close",f);return}kt("%s closing socket",f),await new Promise((w,S)=>{let b=Date.now(),T=setTimeout(()=>{r.destroyed?(kt("%s is already destroyed",f),w()):(kt("%s socket close timeout after %dms, destroying it manually",f,Date.now()-b),r.destroy(new Wt("Socket close timeout","ERR_SOCKET_CLOSE_TIMEOUT")))},o).unref();r.once("close",()=>{kt("%s socket closed",f),clearTimeout(T),w()}),r.once("error",B=>{kt("%s socket error",f,B),g.timeline.close==null&&(g.timeline.close=Date.now()),r.destroyed&&clearTimeout(T),S(B)}),r.setTimeout(o),r.end(),r.writableLength>0?r.once("drain",()=>{kt("%s socket drained",f),r.destroy()}):r.destroy()})}};return g};var $s=N(Ft("net"),1);var we=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)},qt,Kr=class extends EventTarget{constructor(){super(...arguments),qt.set(this,new Map)}listenerCount(t){let e=we(this,qt,"f").get(t);return e==null?0:e.length}addEventListener(t,e,n){super.addEventListener(t,e,n);let i=we(this,qt,"f").get(t);i==null&&(i=[],we(this,qt,"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=we(this,qt,"f").get(t);i!=null&&(i=i.filter(({callback:o})=>o!==e),we(this,qt,"f").set(t,i))}dispatchEvent(t){let e=super.dispatchEvent(t),n=we(this,qt,"f").get(t.type);return n==null||(n=n.filter(({once:i})=>!i),we(this,qt,"f").set(t.type,n)),e}safeDispatchEvent(t,e){return this.dispatchEvent(new He(t,e))}};qt=new WeakMap;var Di=class extends Event{constructor(t,e){super(t,e),this.detail=e?.detail}},He=globalThis.CustomEvent??Di;var gt=et("libp2p:tcp:listener");async function ki(r){try{await r.close()}catch(t){gt.error("an error occurred closing the connection",t)}}var ph=1,dh=0,Xr=class extends Kr{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=$s.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]:ph})}this.dispatchEvent(new He("listening"))}).on("error",e=>{this.metrics?.errors.increment({[`${this.addr} listen_error`]:!0}),this.dispatchEvent(new He("error",{detail:e}))}).on("close",()=>{this.metrics?.status.update({[this.addr]:dh}),this.dispatchEvent(new He("close"))})}onSocket(t){t.on("error",n=>{gt("socket error",n),this.metrics?.events.increment({[`${this.addr} error`]:!0})});let e;try{e=Zr(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){gt.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_to_connection`]:!0});return}gt("new inbound connection %s",e.remoteAddr);try{this.context.upgrader.upgradeInbound(e).then(n=>{gt("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=>{gt.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 He("connection",{detail:n}))}).catch(async n=>{gt.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_upgrade`]:!0}),await ki(e)}).catch(n=>{gt.error("closing inbound connection failed",n)})}catch(n){gt.error("inbound connection failed",n),ki(e).catch(i=>{gt.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(Bi("ip4",e.address,e.port)):e.family==="IPv6"&&(t=t.concat(Bi("ip6",e.address,e.port)))}catch(o){gt.error("could not turn %s:%s into multiaddr",e.address,e.port,o)}return t.map(o=>i!=null?o.encapsulate(`/p2p/${i}`):o)}async listen(t){if(this.status.started)throw Error("server is already listening");let e=t.getPeerId(),n=e==null?t.decapsulateCode(421):t;this.status={started:!0,listeningAddr:n,peerId:e,netConfig:Ve(n)},await this.netListen()}async close(){await Promise.all(Array.from(this.connections.values()).map(async t=>{await ki(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)}),gt("Listening on %s",this.server.address())}netClose(){!this.status.started||!this.server.listening||(gt("Closing server on %s",this.server.address()),this.server.close())}};var Vs=Symbol.for("@libp2p/transport");var zs;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(zs||(zs={}));var Zt=et("libp2p:tcp"),Li=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[Vs](){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",l=>{Zt("socket error",l)});let i=Zr(n,{remoteAddr:t,socketInactivityTimeout:this.opts.outboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.metrics?.dialerEvents}),o=()=>{i.close().catch(l=>{Zt.error("Error closing maConn after abort",l)})};e.signal?.addEventListener("abort",o,{once:!0}),Zt("new outbound connection %s",i.remoteAddr);let a=await e.upgrader.upgradeOutbound(i);if(Zt("outbound connection %s upgraded",i.remoteAddr),e.signal?.removeEventListener("abort",o),e.signal?.aborted===!0)throw a.close().catch(l=>{Zt.error("Error closing conn after abort",l)}),new Ht;return a}async _connect(t,e){if(e.signal?.aborted===!0)throw new Ht;return await new Promise((n,i)=>{let o=Date.now(),a=Ve(t),l=a.path??`${a.host??""}:${a.port}`;Zt("dialing %j",a);let f=Hs.default.connect(a),d=b=>{b.message=`connection error ${l}: ${b.message}`,this.metrics?.dialerEvents.increment({error:!0}),S(b)},h=()=>{Zt("connection timeout %s",l),this.metrics?.dialerEvents.increment({timeout:!0});let b=new Wt(`connection timeout after ${Date.now()-o}ms`,"ERR_CONNECT_TIMEOUT");f.emit("error",b)},g=()=>{Zt("connection opened %j",a),this.metrics?.dialerEvents.increment({connect:!0}),S()},w=()=>{Zt("connection aborted %j",a),this.metrics?.dialerEvents.increment({abort:!0}),f.destroy(),S(new Ht)},S=b=>{if(f.removeListener("error",d),f.removeListener("timeout",h),f.removeListener("connect",g),e.signal!=null&&e.signal.removeEventListener("abort",w),b!=null){i(b);return}n(f)};f.on("error",d),f.on("timeout",h),f.on("connect",g),e.signal!=null&&e.signal.addEventListener("abort",w)})}createListener(t){return new Xr({...t,maxConnections:this.opts.maxConnections,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:de.matches(e.decapsulateCode(421)))}};function Ws(r={}){return(t={})=>new Li(t,r)}var Zs=Symbol.for("@achingbrain/uint8arraylist");function qs(r,t){if(t==null||t<0)throw new RangeError("index is out of bounds");let e=0;for(let n of r){let i=e+n.byteLength;if(t<i)return{buf:n,index:t-e};e=i}throw new RangeError("index is out of bounds")}function Yr(r){return Boolean(r?.[Zs])}var lt=class{constructor(...t){Object.defineProperty(this,Zs,{value:!0}),this.bufs=[],this.length=0,t.length>0&&this.appendAll(t)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...t){this.appendAll(t)}appendAll(t){let e=0;for(let n of t)if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.push(n);else if(Yr(n))e+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}prepend(...t){this.prependAll(t)}prependAll(t){let e=0;for(let n of t.reverse())if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.unshift(n);else if(Yr(n))e+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}get(t){let e=qs(this.bufs,t);return e.buf[e.index]}set(t,e){let n=qs(this.bufs,t);n.buf[n.index]=e}write(t,e=0){if(t instanceof Uint8Array)for(let n=0;n<t.length;n++)this.set(e+n,t[n]);else if(Yr(t))for(let n=0;n<t.length;n++)this.set(e+n,t.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(t){if(t=Math.trunc(t),!(Number.isNaN(t)||t<=0)){if(t===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(t>=this.bufs[0].byteLength)t-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(t),this.length-=t;break}}}slice(t,e){let{bufs:n,length:i}=this._subList(t,e);return Et(n,i)}subarray(t,e){let{bufs:n,length:i}=this._subList(t,e);return n.length===1?n[0]:Et(n,i)}sublist(t,e){let{bufs:n,length:i}=this._subList(t,e),o=new lt;return o.length=i,o.bufs=n,o}_subList(t,e){if(t=t??0,e=e??this.length,t<0&&(t=this.length+t),e<0&&(e=this.length+e),t<0||e>this.length)throw new RangeError("index is out of bounds");if(t===e)return{bufs:[],length:0};if(t===0&&e===this.length)return{bufs:[...this.bufs],length:this.length};let n=[],i=0;for(let o=0;o<this.bufs.length;o++){let a=this.bufs[o],l=i,f=l+a.byteLength;if(i=f,t>=f)continue;let d=t>=l&&t<f,h=e>l&&e<=f;if(d&&h){if(t===l&&e===f){n.push(a);break}let g=t-l;n.push(a.subarray(g,g+(e-t)));break}if(d){if(t===0){n.push(a);continue}n.push(a.subarray(t-l));continue}if(h){if(e===f){n.push(a);break}n.push(a.subarray(0,e-l));break}n.push(a)}return{bufs:n,length:e-t}}indexOf(t,e=0){if(!Yr(t)&&!(t instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=t instanceof Uint8Array?t:t.subarray();if(e=Number(e??0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),t.length===0)return e>this.length?this.length:e;let i=n.byteLength;if(i===0)throw new TypeError("search must be at least 1 byte long");let o=256,a=new Int32Array(o);for(let g=0;g<o;g++)a[g]=-1;for(let g=0;g<i;g++)a[n[g]]=g;let l=a,f=this.byteLength-n.byteLength,d=n.byteLength-1,h;for(let g=e;g<=f;g+=h){h=0;for(let w=d;w>=0;w--){let S=this.get(g+w);if(n[w]!==S){h=Math.max(1,w-l[S]);break}}if(h===0)return g}return-1}getInt8(t){let e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt8(0)}setInt8(t,e){let n=$t(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,e),this.write(n,t)}getInt16(t,e){let n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,e)}setInt16(t,e,n){let i=Gt(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,e,n),this.write(i,t)}getInt32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,e)}setInt32(t,e,n){let i=Gt(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,e,n),this.write(i,t)}getBigInt64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,e)}setBigInt64(t,e,n){let i=Gt(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,e,n),this.write(i,t)}getUint8(t){let e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0)}setUint8(t,e){let n=$t(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,e),this.write(n,t)}getUint16(t,e){let n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,e)}setUint16(t,e,n){let i=Gt(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,e,n),this.write(i,t)}getUint32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,e)}setUint32(t,e,n){let i=Gt(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,e,n),this.write(i,t)}getBigUint64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,e)}setBigUint64(t,e,n){let i=Gt(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,e,n),this.write(i,t)}getFloat32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,e)}setFloat32(t,e,n){let i=Gt(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,e,n),this.write(i,t)}getFloat64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,e)}setFloat64(t,e,n){let i=Gt(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,e,n),this.write(i,t)}equals(t){if(t==null||!(t instanceof lt)||t.bufs.length!==this.bufs.length)return!1;for(let e=0;e<this.bufs.length;e++)if(!pe(this.bufs[e],t.bufs[e]))return!1;return!0}static fromUint8Arrays(t,e){let n=new lt;return n.bufs=t,e==null&&(e=t.reduce((i,o)=>i+o.byteLength,0)),n.length=e,n}};function jr(r){return r instanceof Uint8Array?{get(t){return r[t]},set(t,e){r[t]=e}}:{get(t){return r.get(t)},set(t,e){r.set(t,e)}}}var Ks=4294967296,yt=class{constructor(t=0,e=0){this.hi=t,this.lo=e}toBigInt(t){if(t===!0)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(BigInt(e)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toNumber(t){return Number(this.toBigInt(t))}zzDecode(){let t=-(this.lo&1),e=((this.lo>>>1|this.hi<<31)^t)>>>0,n=(this.hi>>>1^t)>>>0;return new yt(n,e)}zzEncode(){let t=this.hi>>31,e=((this.hi<<1|this.lo>>>31)^t)>>>0,n=(this.lo<<1^t)>>>0;return new yt(e,n)}toBytes(t,e=0){let n=jr(t);for(;this.hi>0;)n.set(e++,this.lo&127|128),this.lo=(this.lo>>>7|this.hi<<25)>>>0,this.hi>>>=7;for(;this.lo>127;)n.set(e++,this.lo&127|128),this.lo=this.lo>>>7;n.set(e++,this.lo)}static fromBigInt(t){if(t===0n)return new yt;let e=t<0;e&&(t=-t);let n=Number(t>>32n)|0,i=Number(t-(BigInt(n)<<32n))|0;return e&&(n=~n>>>0,i=~i>>>0,++i>Ks&&(i=0,++n>Ks&&(n=0))),new yt(n,i)}static fromNumber(t){if(t===0)return new yt;let e=t<0;e&&(t=-t);let n=t>>>0,i=(t-n)/4294967296>>>0;return e&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new yt(i,n)}static fromBytes(t,e=0){let n=jr(t),i=new yt,o=0;if(t.length-e>4){for(;o<4;++o)if(i.lo=(i.lo|(n.get(e)&127)<<o*7)>>>0,n.get(e++)<128)return i;if(i.lo=(i.lo|(n.get(e)&127)<<28)>>>0,i.hi=(i.hi|(n.get(e)&127)>>4)>>>0,n.get(e++)<128)return i;o=0}else for(;o<4;++o){if(e>=t.length)throw RangeError(`index out of range: ${e} > ${t.length}`);if(i.lo=(i.lo|(n.get(e)&127)<<o*7)>>>0,n.get(e++)<128)return i}if(t.length-e>4){for(;o<5;++o)if(i.hi=(i.hi|(n.get(e)&127)<<o*7+3)>>>0,n.get(e++)<128)return i}else if(e<t.byteLength)for(;o<5;++o){if(e>=t.length)throw RangeError(`index out of range: ${e} > ${t.length}`);if(i.hi=(i.hi|(n.get(e)&127)<<o*7+3)>>>0,n.get(e++)<128)return i}throw RangeError("invalid varint encoding")}};var yh=Math.pow(2,7),bh=Math.pow(2,14),wh=Math.pow(2,21),Eh=Math.pow(2,28),vh=Math.pow(2,35),Sh=Math.pow(2,42),Th=Math.pow(2,49),xh=Math.pow(2,56),Ah=Math.pow(2,63),Ee={encodingLength(r){return r<yh?1:r<bh?2:r<wh?3:r<Eh?4:r<vh?5:r<Sh?6:r<Th?7:r<xh?8:r<Ah?9:10},encode(r,t,e=0){if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return t==null&&(t=$t(Ee.encodingLength(r))),yt.fromNumber(r).toBytes(t,e),t},decode(r,t=0){return yt.fromBytes(r,t).toNumber(!0)}};function Xs(r){return globalThis?.Buffer?.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}var Jr=r=>{let t=Ee.encodingLength(r),e=Xs(t);return Ee.encode(r,e),Jr.bytes=t,e};Jr.bytes=0;function We(r){r=r??{};let t=r.lengthEncoder??Jr;return async function*(n){for await(let i of n){let o=t(i.byteLength);o instanceof Uint8Array?yield o:yield*o,i instanceof Uint8Array?yield i:yield*i}}}We.single=(r,t)=>{t=t??{};let e=t.lengthEncoder??Jr;return new lt(e(r.byteLength),r)};var lr=N(Rr(),1),Ih=8,Ch=1024*1024*4,ve;(function(r){r[r.LENGTH=0]="LENGTH",r[r.DATA=1]="DATA"})(ve||(ve={}));var Oi=r=>{let t=Ee.decode(r);return Oi.bytes=Ee.encodingLength(t),t};Oi.bytes=0;function fr(r){return async function*(e){let n=new lt,i=ve.LENGTH,o=-1,a=r?.lengthDecoder??Oi,l=r?.maxLengthLength??Ih,f=r?.maxDataLength??Ch;for await(let d of e)for(n.append(d);n.byteLength>0;){if(i===ve.LENGTH)try{if(o=a(n),o<0)throw(0,lr.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(o>f)throw(0,lr.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let h=a.bytes;n.consume(h),r?.onLength!=null&&r.onLength(o),i=ve.DATA}catch(h){if(h instanceof RangeError){if(n.byteLength>l)throw(0,lr.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw h}if(i===ve.DATA){if(n.byteLength<o)break;let h=n.sublist(0,o);n.consume(o),r?.onData!=null&&r.onData(h),yield h,i=ve.LENGTH}}if(n.byteLength>0)throw(0,lr.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}}fr.fromReader=(r,t)=>{let e=1,n=async function*(){for(;;)try{let{done:o,value:a}=await r.next(e);if(o===!0)return;a!=null&&(yield a)}catch(o){if(o.code==="ERR_UNDER_READ")return{done:!0,value:null};throw o}finally{e=1}}();return fr({...t??{},onLength:o=>{e=o}})(n)};var Qr=class{constructor(t){if(!(t>0)||t-1&t)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(t),this.mask=t-1,this.top=0,this.btm=0,this.next=null}push(t){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=t,this.top=this.top+1&this.mask,!0)}shift(){let t=this.buffer[this.btm];if(t!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,t}isEmpty(){return this.buffer[this.btm]===void 0}},qe=class{constructor(t={}){this.hwm=t.splitLimit??16,this.head=new Qr(this.hwm),this.tail=this.head,this.size=0}calculateSize(t){return t?.byteLength!=null?t.byteLength:1}push(t){if(t?.value!=null&&(this.size+=this.calculateSize(t.value)),!this.head.push(t)){let e=this.head;this.head=e.next=new Qr(2*this.head.buffer.length),this.head.push(t)}}shift(){let t=this.tail.shift();if(t===void 0&&this.tail.next!=null){let e=this.tail.next;this.tail.next=null,this.tail=e,t=this.tail.shift()}return t?.value!=null&&(this.size-=this.calculateSize(t.value)),t}isEmpty(){return this.head.isEmpty()}};function re(r={}){return _h(e=>{let n=e.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},r)}function _h(r,t){t=t??{};let e=t.onEnd,n=new qe,i,o,a,l=async()=>n.isEmpty()?a?{done:!0}:await new Promise((T,B)=>{o=I=>{o=null,n.push(I);try{T(r(n))}catch(_){B(_)}return i}}):r(n),f=T=>o!=null?o(T):(n.push(T),i),d=T=>(n=new qe,o!=null?o({error:T}):(n.push({error:T}),i)),h=T=>{if(a)return i;if(t?.objectMode!==!0&&T?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return f({done:!1,value:T})},g=T=>a?i:(a=!0,T!=null?d(T):f({done:!0})),w=()=>(n=new qe,g(),{done:!0}),S=T=>(g(T),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:l,return:w,throw:S,push:h,end:g,get readableLength(){return n.size}},e==null)return i;let b=i;return i={[Symbol.asyncIterator](){return this},next(){return b.next()},throw(T){return b.throw(T),e!=null&&(e(T),e=void 0),{done:!0}},return(){return b.return(),e!=null&&(e(),e=void 0),{done:!0}},push:h,end(T){return b.end(T),e!=null&&(e(T),e=void 0),i},get readableLength(){return b.readableLength}},i}async function*Ni(...r){let t=re({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(r.map(async e=>{for await(let n of e)t.push(n)})),t.end()}catch(e){t.end(e)}}),yield*t}var Bh=(...r)=>{let t;for(;r.length>0;)t=r.shift()(t);return t},js=r=>r!=null&&(typeof r[Symbol.asyncIterator]=="function"||typeof r[Symbol.iterator]=="function"||typeof r.next=="function"),Mi=r=>r!=null&&typeof r.sink=="function"&&js(r.source),Dh=r=>t=>{let e=r.sink(t);if(e.then!=null){let n=re({objectMode:!0});return e.then(()=>{n.end()},o=>{n.end(o)}),Ni(n,async function*(){yield*r.source,n.end()}())}return r.source};function tn(r,...t){if(Mi(r)){let n=r;r=()=>n.source}else if(js(r)){let n=r;r=()=>n}let e=[r,...t];if(e.length>1&&Mi(e[e.length-1])&&(e[e.length-1]=e[e.length-1].sink),e.length>2)for(let n=1;n<e.length-1;n++)Mi(e[n])&&(e[n]=Dh(e[n]));return Bh(...e)}function Js(r){let t=async function*(){let e=yield,n=new lt;for await(let i of r){if(e==null){n.append(i),e=yield n,n=new lt;continue}for(n.append(i);n.length>=e;){let o=n.sublist(0,e);if(n.consume(e),e=yield o,e==null){n.length>0&&(e=yield n,n=new lt);break}}}if(e!=null)throw Object.assign(new Error(`stream ended before ${e} bytes became available`),{code:"ERR_UNDER_READ",buffer:n})}();return t.next(),t}function Pi(){let r={};return r.promise=new Promise((t,e)=>{r.resolve=t,r.reject=e}),r}function Qs(r){let t=re(),e=Js(r.source),n=Pi(),i,o=r.sink(async function*(){yield*t,yield*await n.promise}());return o.catch(l=>{i=l}),{reader:e,writer:t,stream:{sink:async l=>i!=null?await Promise.reject(i):(n.resolve(l),await o),source:e},rest:()=>t.end(),write:t.push,read:async()=>{let l=await e.next();if(l.value!=null)return l.value}}}var Ui=et("libp2p:daemon-protocol:stream-handler"),en=class{constructor(t){let{stream:e,maxLength:n}=t;this.stream=e,this.shake=Qs(this.stream),this.decoder=fr.fromReader(this.shake.reader,{maxDataLength:n??4096})}async read(){let t=await this.decoder.next();if(t.value!=null)return t.value.subarray();Ui("read received no value, closing stream"),await this.close()}write(t){Ui("write message"),this.shake.write(We.single(t).subarray())}rest(){return this.shake.rest(),this.shake.stream}async close(){Ui("closing the stream"),await this.rest().sink([])}};var Fi={upgradeInbound:async r=>r,upgradeOutbound:async r=>r};var Ji=N(Hi(),1),Gc=N(Rc(),1),$c=N(Te(),1),Qi=N(ji(),1),zc=N(Fc(),1);function Fh(){$c.default._configure(),Ji.default._configure(Gc.default),Qi.default._configure(zc.default)}Fh();var Vc=["uint64","int64","sint64","fixed64","sfixed64"];function Gh(r){for(let t of Vc){if(r[t]==null)continue;let e=r[t];r[t]=function(){return BigInt(e.call(this).toString())}}return r}function to(r){return Gh(new Ji.default(r))}function $h(r){for(let t of Vc){if(r[t]==null)continue;let e=r[t];r[t]=function(n){return e.call(this,n.toString())}}return r}function eo(){return $h(Qi.default.create())}function z(r,t){let e=to(r instanceof Uint8Array?r:r.subarray());return t.decode(e)}function V(r,t){let e=eo();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var Ke;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(Ke||(Ke={}));function cn(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function Kt(r){function t(i){if(r[i.toString()]==null)throw new Error("Invalid enum value");return r[i]}let e=function(o,a){let l=t(o);a.int32(l)},n=function(o){let a=o.int32();return t(a)};return cn("enum",Ke.VARINT,e,n)}function H(r,t){return cn("message",Ke.LENGTH_DELIMITED,r,t)}var Tt;(function(r){let t;(function(i){i.IDENTIFY="IDENTIFY",i.CONNECT="CONNECT",i.STREAM_OPEN="STREAM_OPEN",i.STREAM_HANDLER="STREAM_HANDLER",i.DHT="DHT",i.LIST_PEERS="LIST_PEERS",i.CONNMANAGER="CONNMANAGER",i.DISCONNECT="DISCONNECT",i.PUBSUB="PUBSUB",i.PEERSTORE="PEERSTORE"})(t=r.Type||(r.Type={}));let e;(function(i){i[i.IDENTIFY=0]="IDENTIFY",i[i.CONNECT=1]="CONNECT",i[i.STREAM_OPEN=2]="STREAM_OPEN",i[i.STREAM_HANDLER=3]="STREAM_HANDLER",i[i.DHT=4]="DHT",i[i.LIST_PEERS=5]="LIST_PEERS",i[i.CONNMANAGER=6]="CONNMANAGER",i[i.DISCONNECT=7]="DISCONNECT",i[i.PUBSUB=8]="PUBSUB",i[i.PEERSTORE=9]="PEERSTORE"})(e||(e={})),function(i){i.codec=()=>Kt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=H((i,o,a={})=>{a.lengthDelimited!==!1&&o.fork(),i.type!=null&&(o.uint32(8),r.Type.codec().encode(i.type,o)),i.connect!=null&&(o.uint32(18),un.codec().encode(i.connect,o)),i.streamOpen!=null&&(o.uint32(26),ln.codec().encode(i.streamOpen,o)),i.streamHandler!=null&&(o.uint32(34),fn.codec().encode(i.streamHandler,o)),i.dht!=null&&(o.uint32(42),xt.codec().encode(i.dht,o)),i.connManager!=null&&(o.uint32(50),pn.codec().encode(i.connManager,o)),i.disconnect!=null&&(o.uint32(58),dn.codec().encode(i.disconnect,o)),i.pubsub!=null&&(o.uint32(66),se.codec().encode(i.pubsub,o)),i.peerStore!=null&&(o.uint32(74),Ie.codec().encode(i.peerStore,o)),a.lengthDelimited!==!1&&o.ldelim()},(i,o)=>{let a={},l=o==null?i.len:i.pos+o;for(;i.pos<l;){let f=i.uint32();switch(f>>>3){case 1:a.type=r.Type.codec().decode(i);break;case 2:a.connect=un.codec().decode(i,i.uint32());break;case 3:a.streamOpen=ln.codec().decode(i,i.uint32());break;case 4:a.streamHandler=fn.codec().decode(i,i.uint32());break;case 5:a.dht=xt.codec().decode(i,i.uint32());break;case 6:a.connManager=pn.codec().decode(i,i.uint32());break;case 7:a.disconnect=dn.codec().decode(i,i.uint32());break;case 8:a.pubsub=se.codec().decode(i,i.uint32());break;case 9:a.peerStore=Ie.codec().decode(i,i.uint32());break;default:i.skipType(f&7);break}}return a})),n),r.encode=i=>V(i,r.codec()),r.decode=i=>z(i,r.codec())})(Tt||(Tt={}));var Ae;(function(r){let t;(function(i){i.OK="OK",i.ERROR="ERROR"})(t=r.Type||(r.Type={}));let e;(function(i){i[i.OK=0]="OK",i[i.ERROR=1]="ERROR"})(e||(e={})),function(i){i.codec=()=>Kt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=H((i,o,a={})=>{if(a.lengthDelimited!==!1&&o.fork(),i.type!=null&&(o.uint32(8),r.Type.codec().encode(i.type,o)),i.error!=null&&(o.uint32(18),hn.codec().encode(i.error,o)),i.streamInfo!=null&&(o.uint32(26),Xe.codec().encode(i.streamInfo,o)),i.identify!=null&&(o.uint32(34),an.codec().encode(i.identify,o)),i.dht!=null&&(o.uint32(42),J.codec().encode(i.dht,o)),i.peers!=null)for(let l of i.peers)o.uint32(50),oe.codec().encode(l,o);i.pubsub!=null&&(o.uint32(58),mn.codec().encode(i.pubsub,o)),i.peerStore!=null&&(o.uint32(66),gn.codec().encode(i.peerStore,o)),a.lengthDelimited!==!1&&o.ldelim()},(i,o)=>{let a={peers:[]},l=o==null?i.len:i.pos+o;for(;i.pos<l;){let f=i.uint32();switch(f>>>3){case 1:a.type=r.Type.codec().decode(i);break;case 2:a.error=hn.codec().decode(i,i.uint32());break;case 3:a.streamInfo=Xe.codec().decode(i,i.uint32());break;case 4:a.identify=an.codec().decode(i,i.uint32());break;case 5:a.dht=J.codec().decode(i,i.uint32());break;case 6:a.peers.push(oe.codec().decode(i,i.uint32()));break;case 7:a.pubsub=mn.codec().decode(i,i.uint32());break;case 8:a.peerStore=gn.codec().decode(i,i.uint32());break;default:i.skipType(f&7);break}}return a})),n),r.encode=i=>V(i,r.codec()),r.decode=i=>z(i,r.codec())})(Ae||(Ae={}));var an;(function(r){let t;r.codec=()=>(t==null&&(t=H((e,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),e.id!=null&&e.id.byteLength>0&&(n.uint32(10),n.bytes(e.id)),e.addrs!=null)for(let o of e.addrs)n.uint32(18),n.bytes(o);i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={id:new Uint8Array(0),addrs:[]},o=n==null?e.len:e.pos+n;for(;e.pos<o;){let a=e.uint32();switch(a>>>3){case 1:i.id=e.bytes();break;case 2:i.addrs.push(e.bytes());break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>V(e,r.codec()),r.decode=e=>z(e,r.codec())})(an||(an={}));var un;(function(r){let t;r.codec=()=>(t==null&&(t=H((e,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),e.peer!=null&&e.peer.byteLength>0&&(n.uint32(10),n.bytes(e.peer)),e.addrs!=null)for(let o of e.addrs)n.uint32(18),n.bytes(o);e.timeout!=null&&(n.uint32(24),n.int64(e.timeout)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={peer:new Uint8Array(0),addrs:[]},o=n==null?e.len:e.pos+n;for(;e.pos<o;){let a=e.uint32();switch(a>>>3){case 1:i.peer=e.bytes();break;case 2:i.addrs.push(e.bytes());break;case 3:i.timeout=e.int64();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>V(e,r.codec()),r.decode=e=>z(e,r.codec())})(un||(un={}));var ln;(function(r){let t;r.codec=()=>(t==null&&(t=H((e,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),e.peer!=null&&e.peer.byteLength>0&&(n.uint32(10),n.bytes(e.peer)),e.proto!=null)for(let o of e.proto)n.uint32(18),n.string(o);e.timeout!=null&&(n.uint32(24),n.int64(e.timeout)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={peer:new Uint8Array(0),proto:[]},o=n==null?e.len:e.pos+n;for(;e.pos<o;){let a=e.uint32();switch(a>>>3){case 1:i.peer=e.bytes();break;case 2:i.proto.push(e.string());break;case 3:i.timeout=e.int64();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>V(e,r.codec()),r.decode=e=>z(e,r.codec())})(ln||(ln={}));var fn;(function(r){let t;r.codec=()=>(t==null&&(t=H((e,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),e.addr!=null&&e.addr.byteLength>0&&(n.uint32(10),n.bytes(e.addr)),e.proto!=null)for(let o of e.proto)n.uint32(18),n.string(o);i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={addr:new Uint8Array(0),proto:[]},o=n==null?e.len:e.pos+n;for(;e.pos<o;){let a=e.uint32();switch(a>>>3){case 1:i.addr=e.bytes();break;case 2:i.proto.push(e.string());break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>V(e,r.codec()),r.decode=e=>z(e,r.codec())})(fn||(fn={}));var hn;(function(r){let t;r.codec=()=>(t==null&&(t=H((e,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),e.msg!=null&&e.msg!==""&&(n.uint32(10),n.string(e.msg)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={msg:""},o=n==null?e.len:e.pos+n;for(;e.pos<o;){let a=e.uint32();switch(a>>>3){case 1:i.msg=e.string();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>V(e,r.codec()),r.decode=e=>z(e,r.codec())})(hn||(hn={}));var Xe;(function(r){let t;r.codec=()=>(t==null&&(t=H((e,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),e.peer!=null&&e.peer.byteLength>0&&(n.uint32(10),n.bytes(e.peer)),e.addr!=null&&e.addr.byteLength>0&&(n.uint32(18),n.bytes(e.addr)),e.proto!=null&&e.proto!==""&&(n.uint32(26),n.string(e.proto)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={peer:new Uint8Array(0),addr:new Uint8Array(0),proto:""},o=n==null?e.len:e.pos+n;for(;e.pos<o;){let a=e.uint32();switch(a>>>3){case 1:i.peer=e.bytes();break;case 2:i.addr=e.bytes();break;case 3:i.proto=e.string();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>V(e,r.codec()),r.decode=e=>z(e,r.codec())})(Xe||(Xe={}));var xt;(function(r){let t;(function(i){i.FIND_PEER="FIND_PEER",i.FIND_PEERS_CONNECTED_TO_PEER="FIND_PEERS_CONNECTED_TO_PEER",i.FIND_PROVIDERS="FIND_PROVIDERS",i.GET_CLOSEST_PEERS="GET_CLOSEST_PEERS",i.GET_PUBLIC_KEY="GET_PUBLIC_KEY",i.GET_VALUE="GET_VALUE",i.SEARCH_VALUE="SEARCH_VALUE",i.PUT_VALUE="PUT_VALUE",i.PROVIDE="PROVIDE"})(t=r.Type||(r.Type={}));let e;(function(i){i[i.FIND_PEER=0]="FIND_PEER",i[i.FIND_PEERS_CONNECTED_TO_PEER=1]="FIND_PEERS_CONNECTED_TO_PEER",i[i.FIND_PROVIDERS=2]="FIND_PROVIDERS",i[i.GET_CLOSEST_PEERS=3]="GET_CLOSEST_PEERS",i[i.GET_PUBLIC_KEY=4]="GET_PUBLIC_KEY",i[i.GET_VALUE=5]="GET_VALUE",i[i.SEARCH_VALUE=6]="SEARCH_VALUE",i[i.PUT_VALUE=7]="PUT_VALUE",i[i.PROVIDE=8]="PROVIDE"})(e||(e={})),function(i){i.codec=()=>Kt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=H((i,o,a={})=>{a.lengthDelimited!==!1&&o.fork(),i.type!=null&&(o.uint32(8),r.Type.codec().encode(i.type,o)),i.peer!=null&&(o.uint32(18),o.bytes(i.peer)),i.cid!=null&&(o.uint32(26),o.bytes(i.cid)),i.key!=null&&(o.uint32(34),o.bytes(i.key)),i.value!=null&&(o.uint32(42),o.bytes(i.value)),i.count!=null&&(o.uint32(48),o.int32(i.count)),i.timeout!=null&&(o.uint32(56),o.int64(i.timeout)),a.lengthDelimited!==!1&&o.ldelim()},(i,o)=>{let a={},l=o==null?i.len:i.pos+o;for(;i.pos<l;){let f=i.uint32();switch(f>>>3){case 1:a.type=r.Type.codec().decode(i);break;case 2:a.peer=i.bytes();break;case 3:a.cid=i.bytes();break;case 4:a.key=i.bytes();break;case 5:a.value=i.bytes();break;case 6:a.count=i.int32();break;case 7:a.timeout=i.int64();break;default:i.skipType(f&7);break}}return a})),n),r.encode=i=>V(i,r.codec()),r.decode=i=>z(i,r.codec())})(xt||(xt={}));var J;(function(r){let t;(function(i){i.BEGIN="BEGIN",i.VALUE="VALUE",i.END="END"})(t=r.Type||(r.Type={}));let e;(function(i){i[i.BEGIN=0]="BEGIN",i[i.VALUE=1]="VALUE",i[i.END=2]="END"})(e||(e={})),function(i){i.codec=()=>Kt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=H((i,o,a={})=>{a.lengthDelimited!==!1&&o.fork(),i.type!=null&&(o.uint32(8),r.Type.codec().encode(i.type,o)),i.peer!=null&&(o.uint32(18),oe.codec().encode(i.peer,o)),i.value!=null&&(o.uint32(26),o.bytes(i.value)),a.lengthDelimited!==!1&&o.ldelim()},(i,o)=>{let a={},l=o==null?i.len:i.pos+o;for(;i.pos<l;){let f=i.uint32();switch(f>>>3){case 1:a.type=r.Type.codec().decode(i);break;case 2:a.peer=oe.codec().decode(i,i.uint32());break;case 3:a.value=i.bytes();break;default:i.skipType(f&7);break}}return a})),n),r.encode=i=>V(i,r.codec()),r.decode=i=>z(i,r.codec())})(J||(J={}));var oe;(function(r){let t;r.codec=()=>(t==null&&(t=H((e,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),e.id!=null&&e.id.byteLength>0&&(n.uint32(10),n.bytes(e.id)),e.addrs!=null)for(let o of e.addrs)n.uint32(18),n.bytes(o);i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={id:new Uint8Array(0),addrs:[]},o=n==null?e.len:e.pos+n;for(;e.pos<o;){let a=e.uint32();switch(a>>>3){case 1:i.id=e.bytes();break;case 2:i.addrs.push(e.bytes());break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>V(e,r.codec()),r.decode=e=>z(e,r.codec())})(oe||(oe={}));var pn;(function(r){let t;(function(i){i.TAG_PEER="TAG_PEER",i.UNTAG_PEER="UNTAG_PEER",i.TRIM="TRIM"})(t=r.Type||(r.Type={}));let e;(function(i){i[i.TAG_PEER=0]="TAG_PEER",i[i.UNTAG_PEER=1]="UNTAG_PEER",i[i.TRIM=2]="TRIM"})(e||(e={})),function(i){i.codec=()=>Kt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=H((i,o,a={})=>{a.lengthDelimited!==!1&&o.fork(),i.type!=null&&(o.uint32(8),r.Type.codec().encode(i.type,o)),i.peer!=null&&(o.uint32(18),o.bytes(i.peer)),i.tag!=null&&(o.uint32(26),o.string(i.tag)),i.weight!=null&&(o.uint32(32),o.int64(i.weight)),a.lengthDelimited!==!1&&o.ldelim()},(i,o)=>{let a={},l=o==null?i.len:i.pos+o;for(;i.pos<l;){let f=i.uint32();switch(f>>>3){case 1:a.type=r.Type.codec().decode(i);break;case 2:a.peer=i.bytes();break;case 3:a.tag=i.string();break;case 4:a.weight=i.int64();break;default:i.skipType(f&7);break}}return a})),n),r.encode=i=>V(i,r.codec()),r.decode=i=>z(i,r.codec())})(pn||(pn={}));var dn;(function(r){let t;r.codec=()=>(t==null&&(t=H((e,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),e.peer!=null&&e.peer.byteLength>0&&(n.uint32(10),n.bytes(e.peer)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={peer:new Uint8Array(0)},o=n==null?e.len:e.pos+n;for(;e.pos<o;){let a=e.uint32();switch(a>>>3){case 1:i.peer=e.bytes();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>V(e,r.codec()),r.decode=e=>z(e,r.codec())})(dn||(dn={}));var se;(function(r){let t;(function(i){i.GET_TOPICS="GET_TOPICS",i.LIST_PEERS="LIST_PEERS",i.PUBLISH="PUBLISH",i.SUBSCRIBE="SUBSCRIBE"})(t=r.Type||(r.Type={}));let e;(function(i){i[i.GET_TOPICS=0]="GET_TOPICS",i[i.LIST_PEERS=1]="LIST_PEERS",i[i.PUBLISH=2]="PUBLISH",i[i.SUBSCRIBE=3]="SUBSCRIBE"})(e||(e={})),function(i){i.codec=()=>Kt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=H((i,o,a={})=>{a.lengthDelimited!==!1&&o.fork(),i.type!=null&&(o.uint32(8),r.Type.codec().encode(i.type,o)),i.topic!=null&&(o.uint32(18),o.string(i.topic)),i.data!=null&&(o.uint32(26),o.bytes(i.data)),a.lengthDelimited!==!1&&o.ldelim()},(i,o)=>{let a={},l=o==null?i.len:i.pos+o;for(;i.pos<l;){let f=i.uint32();switch(f>>>3){case 1:a.type=r.Type.codec().decode(i);break;case 2:a.topic=i.string();break;case 3:a.data=i.bytes();break;default:i.skipType(f&7);break}}return a})),n),r.encode=i=>V(i,r.codec()),r.decode=i=>z(i,r.codec())})(se||(se={}));var dr;(function(r){let t;r.codec=()=>(t==null&&(t=H((e,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),e.from!=null&&(n.uint32(10),n.bytes(e.from)),e.data!=null&&(n.uint32(18),n.bytes(e.data)),e.seqno!=null&&(n.uint32(26),n.bytes(e.seqno)),e.topicIDs!=null)for(let o of e.topicIDs)n.uint32(34),n.string(o);e.signature!=null&&(n.uint32(42),n.bytes(e.signature)),e.key!=null&&(n.uint32(50),n.bytes(e.key)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={topicIDs:[]},o=n==null?e.len:e.pos+n;for(;e.pos<o;){let a=e.uint32();switch(a>>>3){case 1:i.from=e.bytes();break;case 2:i.data=e.bytes();break;case 3:i.seqno=e.bytes();break;case 4:i.topicIDs.push(e.string());break;case 5:i.signature=e.bytes();break;case 6:i.key=e.bytes();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>V(e,r.codec()),r.decode=e=>z(e,r.codec())})(dr||(dr={}));var mn;(function(r){let t;r.codec=()=>(t==null&&(t=H((e,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),e.topics!=null)for(let o of e.topics)n.uint32(10),n.string(o);if(e.peerIDs!=null)for(let o of e.peerIDs)n.uint32(18),n.bytes(o);i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={topics:[],peerIDs:[]},o=n==null?e.len:e.pos+n;for(;e.pos<o;){let a=e.uint32();switch(a>>>3){case 1:i.topics.push(e.string());break;case 2:i.peerIDs.push(e.bytes());break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>V(e,r.codec()),r.decode=e=>z(e,r.codec())})(mn||(mn={}));var Ie;(function(r){let t;(function(i){i.UNSPECIFIED="UNSPECIFIED",i.GET_PROTOCOLS="GET_PROTOCOLS",i.GET_PEER_INFO="GET_PEER_INFO"})(t=r.Type||(r.Type={}));let e;(function(i){i[i.UNSPECIFIED=0]="UNSPECIFIED",i[i.GET_PROTOCOLS=1]="GET_PROTOCOLS",i[i.GET_PEER_INFO=2]="GET_PEER_INFO"})(e||(e={})),function(i){i.codec=()=>Kt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=H((i,o,a={})=>{if(a.lengthDelimited!==!1&&o.fork(),i.type!=null&&(o.uint32(8),r.Type.codec().encode(i.type,o)),i.id!=null&&(o.uint32(18),o.bytes(i.id)),i.protos!=null)for(let l of i.protos)o.uint32(26),o.string(l);a.lengthDelimited!==!1&&o.ldelim()},(i,o)=>{let a={protos:[]},l=o==null?i.len:i.pos+o;for(;i.pos<l;){let f=i.uint32();switch(f>>>3){case 1:a.type=r.Type.codec().decode(i);break;case 2:a.id=i.bytes();break;case 3:a.protos.push(i.string());break;default:i.skipType(f&7);break}}return a})),n),r.encode=i=>V(i,r.codec()),r.decode=i=>z(i,r.codec())})(Ie||(Ie={}));var gn;(function(r){let t;r.codec=()=>(t==null&&(t=H((e,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),e.peer!=null&&(n.uint32(10),oe.codec().encode(e.peer,n)),e.protos!=null)for(let o of e.protos)n.uint32(18),n.string(o);i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={protos:[]},o=n==null?e.len:e.pos+n;for(;e.pos<o;){let a=e.uint32();switch(a>>>3){case 1:i.peer=oe.codec().decode(e,e.uint32());break;case 2:i.protos.push(e.string());break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>V(e,r.codec()),r.decode=e=>z(e,r.codec())})(gn||(gn={}));function Y(r){return Ae.encode({type:Ae.Type.OK,peers:[],...r}).subarray()}function P(r){return Ae.encode({type:Ae.Type.ERROR,error:{msg:r.message},peers:[]}).subarray()}async function yn(r){for await(let t of r);}var bn=et("libp2p:daemon-server:dht"),wn=class{constructor(t){let{dht:e}=t;this.dht=e}async*provide(t){try{await yn(this.dht.provide(t)),yield Y()}catch(e){bn.error(e),yield P(e)}}async*getClosestPeers(t){yield Y({dht:{type:J.Type.BEGIN}});for await(let e of this.dht.getClosestPeers(t))e.name==="PEER_RESPONSE"&&(yield*e.closer.map(n=>J.encode({type:J.Type.VALUE,value:n.id.toBytes()})));yield J.encode({type:J.Type.END})}async*getPublicKey(t){yield P(new Error("FIX ME: not implemented"))}async*getValue(t){try{for await(let e of this.dht.get(t))e.name==="VALUE"&&(yield Y({dht:{type:J.Type.VALUE,value:e.value}}))}catch(e){bn.error(e),yield P(e)}}async*putValue(t,e){try{await yn(this.dht.put(t,e)),yield Y()}catch(n){bn.error(n),yield P(n)}}async*findPeer(t){try{for await(let e of this.dht.findPeer(t))e.name==="FINAL_PEER"&&(yield Y({dht:{type:J.Type.VALUE,peer:{id:e.peer.id.toBytes(),addrs:e.peer.multiaddrs.map(n=>n.bytes)}}}));throw new Error("Peer not found")}catch(e){bn.error(e),yield P(e)}}async*findProviders(t,e){yield Y({dht:{type:J.Type.BEGIN}});try{let n=e,i=0;for await(let o of this.dht.findProviders(t))if(o.name==="PEER_RESPONSE"){for(let a of o.providers)i++,yield J.encode({type:J.Type.VALUE,peer:{id:a.id.toBytes(),addrs:(a.multiaddrs??[]).map(l=>l.bytes)}});if(n===i)break}}catch(n){yield P(n)}yield J.encode({type:J.Type.END})}};var Hc=Symbol.for("@libp2p/peer-id");var zh=Symbol.for("nodejs.util.inspect.custom"),Wc=Object.values(te).map(r=>r.decoder).reduce((r,t)=>r.or(t),te.identity.decoder),qc=114,Zc=36,Kc=37,mr=class{constructor(t){this.type=t.type,this.multihash=t.multihash,this.privateKey=t.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}get[Hc](){return!0}toString(){return this.string==null&&(this.string=q.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return R.createV1(qc,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(t){if(t instanceof Uint8Array)return pe(this.multihash.bytes,t);if(typeof t=="string")return Vh(t).equals(this);if(t?.multihash?.bytes!=null)return pe(this.multihash.bytes,t.multihash.bytes);throw new Error("not valid Id")}[zh](){return`PeerId(${this.toString()})`}},gr=class extends mr{constructor(t){super({...t,type:"RSA"}),this.type="RSA",this.publicKey=t.publicKey}},yr=class extends mr{constructor(t){super({...t,type:"Ed25519"}),this.type="Ed25519",this.publicKey=t.multihash.digest}},br=class extends mr{constructor(t){super({...t,type:"secp256k1"}),this.type="secp256k1",this.publicKey=t.multihash.digest}};function Vh(r,t){if(t=t??Wc,r.charAt(0)==="1"||r.charAt(0)==="Q"){let e=le(q.decode(`z${r}`));return r.startsWith("12D")?new yr({multihash:e}):r.startsWith("16U")?new br({multihash:e}):new gr({multihash:e})}return Ce(Wc.decode(r))}function Ce(r){try{let t=le(r);if(t.code===Ir.code){if(t.digest.length===Zc)return new yr({multihash:t});if(t.digest.length===Kc)return new br({multihash:t})}if(t.code===Ar.code)return new gr({multihash:t})}catch{return Hh(R.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function Hh(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==qc)throw new Error("Supplied PeerID CID is invalid");let t=r.multihash;if(t.code===Ar.code)return new gr({multihash:r.multihash});if(t.code===Ir.code){if(t.digest.length===Zc)return new yr({multihash:r.multihash});if(t.digest.length===Kc)return new br({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}var ro=et("libp2p:daemon-server:pubsub"),En=class{constructor(t){let{pubsub:e}=t;this.pubsub=e}async*getTopics(){try{yield Y({pubsub:{topics:this.pubsub.getTopics(),peerIDs:[]}})}catch(t){ro.error(t),yield P(t)}}async*subscribe(t){try{let e=re();this.pubsub.subscribe(t),this.pubsub.addEventListener("message",n=>{let i=n.detail;i.topic===t&&(i.type==="signed"?e.push(dr.encode({from:i.from.toBytes(),data:i.data,seqno:i.sequenceNumber==null?void 0:er(i.sequenceNumber.toString(16).padStart(16,"0"),"base16"),topicIDs:[i.topic],signature:i.signature,key:i.key}).subarray()):e.push(dr.encode({data:i.data,topicIDs:[i.topic]}).subarray()))}),yield Y(),yield*e}catch(e){ro.error(e),yield P(e)}}async*publish(t,e){try{await this.pubsub.publish(t,e),yield Y()}catch(n){ro.error(n),yield P(n)}}};var Wh=1<<22,Xt=et("libp2p:daemon-server"),vn=class{constructor(t){let{multiaddr:e,libp2pNode:n}=t;this.multiaddr=e,this.libp2p=n,this.tcp=Ws()(),this.listener=this.tcp.createListener({handler:this.handleConnection.bind(this),upgrader:Fi}),this._onExit=this._onExit.bind(this),n.dht!=null&&(this.dhtOperations=new wn({dht:n.dht})),n.pubsub!=null&&(this.pubsubOperations=new En({pubsub:n.pubsub}))}async connect(t){if(t.connect==null||t.connect.addrs==null)throw new Error("Invalid request");let e=t.connect.peer,n=t.connect.addrs.map(o=>vt(o)),i=Ce(e);return await this.libp2p.peerStore.addressBook.set(i,n),await this.libp2p.dial(i)}async openStream(t){if(t.streamOpen==null||t.streamOpen.proto==null)throw new Error("Invalid request");let{peer:e,proto:n}=t.streamOpen,i=Ce(e),o=await this.libp2p.dial(i),a=await o.newStream(n);return{streamInfo:{peer:i.toBytes(),addr:o.remoteAddr.bytes,proto:a.stat.protocol??""},connection:a}}async registerStreamHandler(t){if(t.streamHandler==null||t.streamHandler.proto==null)throw new Error("Invalid request");let e=t.streamHandler.proto,n=vt(t.streamHandler.addr),i;await this.libp2p.handle(e,({connection:o,stream:a})=>{Promise.resolve().then(async()=>{i=await this.tcp.dial(n,{upgrader:Fi});let l=Xe.encode({peer:o.remotePeer.toBytes(),addr:o.remoteAddr.bytes,proto:a.stat.protocol??""}),f=We.single(l);await tn(async function*(){yield f,yield*a.source}(),async function*(d){for await(let h of d)yield*h},i,a.sink)}).catch(async l=>{Xt.error(l),i!=null&&await i.close(l)}).finally(()=>{i?.close().catch(l=>{Xt.error(l)})})})}_listen(){process.on("SIGTERM",this._onExit),process.on("SIGINT",this._onExit),process.on("SIGHUP",this._onExit)}_onExit(){this.stop({exit:!0}).catch(t=>{Xt.error(t)})}async start(){this._listen(),await this.libp2p.start(),await this.listener.listen(this.multiaddr)}getMultiaddr(){let t=this.listener.getAddrs();if(t.length>0)return t[0];throw new Error("Not started")}async stop(t={exit:!1}){await this.libp2p.stop(),await this.listener.close(),t.exit&&Xt("server closed, exiting"),process.removeListener("SIGTERM",this._onExit),process.removeListener("SIGINT",this._onExit),process.removeListener("SIGHUP",this._onExit)}async*handlePeerStoreRequest(t){try{switch(t.type){case Ie.Type.GET_PROTOCOLS:if(t.id==null)throw new Error("Invalid request");let e=Ce(t.id),i=(await this.libp2p.peerStore.get(e)).protocols;yield Y({peerStore:{protos:i}});return;case Ie.Type.GET_PEER_INFO:throw new Error("ERR_NOT_IMPLEMENTED");default:throw new Error("ERR_INVALID_REQUEST_TYPE")}}catch(e){Xt.error(e),yield P(e)}}async*handlePubsubRequest(t){try{if(this.libp2p.pubsub==null||this.pubsubOperations==null)throw new Error("PubSub not configured");switch(t.type){case se.Type.GET_TOPICS:yield*this.pubsubOperations.getTopics();return;case se.Type.SUBSCRIBE:if(t.topic==null)throw new Error("Invalid request");yield*this.pubsubOperations.subscribe(t.topic);return;case se.Type.PUBLISH:if(t.topic==null||t.data==null)throw new Error("Invalid request");yield*this.pubsubOperations.publish(t.topic,t.data);return;default:throw new Error("ERR_INVALID_REQUEST_TYPE")}}catch(e){Xt.error(e),yield P(e)}}async*handleDHTRequest(t){try{if(this.libp2p.dht==null||this.dhtOperations==null)throw new Error("DHT not configured");switch(t.type){case xt.Type.FIND_PEER:if(t.peer==null)throw new Error("Invalid request");yield*this.dhtOperations.findPeer(Ce(t.peer));return;case xt.Type.FIND_PROVIDERS:if(t.cid==null)throw new Error("Invalid request");yield*this.dhtOperations.findProviders(R.decode(t.cid),t.count??20);return;case xt.Type.PROVIDE:if(t.cid==null)throw new Error("Invalid request");yield*this.dhtOperations.provide(R.decode(t.cid));return;case xt.Type.GET_CLOSEST_PEERS:if(t.key==null)throw new Error("Invalid request");yield*this.dhtOperations.getClosestPeers(t.key);return;case xt.Type.GET_PUBLIC_KEY:if(t.peer==null)throw new Error("Invalid request");yield*this.dhtOperations.getPublicKey(Ce(t.peer));return;case xt.Type.GET_VALUE:if(t.key==null)throw new Error("Invalid request");yield*this.dhtOperations.getValue(t.key);return;case xt.Type.PUT_VALUE:if(t.key==null||t.value==null)throw new Error("Invalid request");yield*this.dhtOperations.putValue(t.key,t.value);return;default:throw new Error("ERR_INVALID_REQUEST_TYPE")}}catch(e){Xt.error(e),yield P(e)}}handleConnection(t){let e=this,n=new en({stream:t,maxLength:Wh});tn(n.decoder,i=>async function*(){let o;for await(let a of i)try{switch(o=Tt.decode(a),o.type){case Tt.Type.CONNECT:{try{await e.connect(o)}catch(l){yield P(l);break}yield Y();break}case Tt.Type.IDENTIFY:{yield Y({identify:{id:e.libp2p.peerId.toBytes(),addrs:e.libp2p.getMultiaddrs().map(l=>l.decapsulateCode(O("p2p").code)).map(l=>l.bytes)}});break}case Tt.Type.LIST_PEERS:{let l=[],f=new Set;for(let d of e.libp2p.getConnections()){let h=d.remotePeer.toString();f.has(h)||(f.add(h),l.push({id:d.remotePeer.toBytes(),addrs:[d.remoteAddr.bytes]}))}yield Y({peers:l});break}case Tt.Type.STREAM_OPEN:{let l;try{l=await e.openStream(o)}catch(d){yield P(d);break}yield Y({streamInfo:l.streamInfo});let f=n.rest();await tn(f,l.connection,async function*(d){for await(let h of d)yield*h},f);return}case Tt.Type.STREAM_HANDLER:{try{await e.registerStreamHandler(o)}catch(l){yield P(l);break}yield Y();break}case Tt.Type.PEERSTORE:{if(o.peerStore==null){yield P(new Error("ERR_INVALID_REQUEST"));break}yield*e.handlePeerStoreRequest(o.peerStore);break}case Tt.Type.PUBSUB:{if(o.pubsub==null){yield P(new Error("ERR_INVALID_REQUEST"));break}yield*e.handlePubsubRequest(o.pubsub);break}case Tt.Type.DHT:{if(o.dht==null){yield P(new Error("ERR_INVALID_REQUEST"));break}yield*e.handleDHTRequest(o.dht);break}default:yield P(new Error("ERR_INVALID_REQUEST_TYPE"));break}}catch(l){Xt.error(l),yield P(l);continue}}(),async function(i){for await(let o of i)n.write(o)}).catch(i=>{Xt(i)})}},qh=(r,t)=>new vn({multiaddr:r,libp2pNode:t});return Ou(Zh);})();
|
|
4
|
+
`+s),r.push(o+"m+"+ln.exports.humanize(this.diff)+"\x1B[0m")}else r[0]=ed()+t+" "+r[0]}function ed(){return st.inspectOpts.hideDate?"":new Date().toISOString()+" "}function rd(...r){return process.stderr.write(un.format(...r)+`
|
|
5
|
+
`)}function nd(r){r?process.env.DEBUG=r:delete process.env.DEBUG}function od(){return process.env.DEBUG}function sd(r){r.inspectOpts={};let t=Object.keys(st.inspectOpts);for(let e=0;e<t.length;e++)r.inspectOpts[t[e]]=st.inspectOpts[t[e]]}ln.exports=Xo()(st);var{formatters:Pc}=ln.exports;Pc.o=function(r){return this.inspectOpts.colors=this.useColors,un.inspect(r,this.inspectOpts).split(`
|
|
6
|
+
`).map(t=>t.trim()).join(" ")};Pc.O=function(r){return this.inspectOpts.colors=this.useColors,un.inspect(r,this.inspectOpts)}});var Nc=P((Kg,Yo)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Yo.exports=_c():Yo.exports=Lc()});var fn=P((ty,Mc)=>{Mc.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 Fc=P((ey,Uc)=>{Uc.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 ts=P((ry,$c)=>{var id=Fc();$c.exports=r=>async t=>{t=id(t);let e=B=>{typeof B.return=="function"&&B.return()},n=null,o=null,s=B=>{n=B,o&&o(B),e(t)},c=null,l=!1,f=()=>{l=!0,c&&c()},d=null,h=!1,y=()=>{h=!0,d&&d()},E=null,w=()=>{E&&E()},g=()=>new Promise((B,k)=>{c=E=B,o=k,r.once("drain",w)}),T=()=>(e(t),new Promise((B,k)=>{if(l||h||n)return B();d=c=B,o=k})),O=()=>{r.removeListener("error",s),r.removeListener("close",f),r.removeListener("finish",y),r.removeListener("drain",w)};r.once("error",s),r.once("close",f),r.once("finish",y);try{for await(let B of t){if(!r.writable||r.destroyed||n)break;r.write(B)===!1&&await g()}}catch(B){n||r.destroy(),n=B}try{if(r.writable&&r.end(),await T(),n)throw n}finally{O()}}});var es=P((ny,zc)=>{var cd=ts(),ad=fn();zc.exports=r=>({sink:cd(r),source:ad(r)})});var Gc=P((oy,Vc)=>{var ud=es();Vc.exports=r=>async function*(t){let e=ud(r),n;if(e.sink(t).catch(o=>{n=o}),yield*e.source,n)throw n}});var Hc=P((sy,Xe)=>{Xe.exports=fn();Xe.exports.source=fn();Xe.exports.sink=ts();Xe.exports.transform=Gc();Xe.exports.duplex=es()});var ds=P((bn,ca)=>{(function(){var r,t=0xdeadbeefcafe,e=(t&16777215)==15715070;function n(i,a,u){i!=null&&(typeof i=="number"?this.fromNumber(i,a,u):a==null&&typeof i!="string"?this.fromString(i,256):this.fromString(i,a))}function o(){return new n(null)}function s(i,a,u,p,m,b){for(;--b>=0;){var v=a*this[i++]+u[p]+m;m=Math.floor(v/67108864),u[p++]=v&67108863}return m}function c(i,a,u,p,m,b){for(var v=a&32767,S=a>>15;--b>=0;){var M=this[i]&32767,rt=this[i++]>>15,Dt=S*M+rt*v;M=v*M+((Dt&32767)<<15)+u[p]+(m&1073741823),m=(M>>>30)+(Dt>>>15)+S*rt+(m>>>30),u[p++]=M&1073741823}return m}function l(i,a,u,p,m,b){for(var v=a&16383,S=a>>14;--b>=0;){var M=this[i]&16383,rt=this[i++]>>14,Dt=S*M+rt*v;M=v*M+((Dt&16383)<<14)+u[p]+m,m=(M>>28)+(Dt>>14)+S*rt,u[p++]=M&268435455}return m}var f=typeof navigator<"u";f&&e&&navigator.appName=="Microsoft Internet Explorer"?(n.prototype.am=c,r=30):f&&e&&navigator.appName!="Netscape"?(n.prototype.am=s,r=26):(n.prototype.am=l,r=28),n.prototype.DB=r,n.prototype.DM=(1<<r)-1,n.prototype.DV=1<<r;var d=52;n.prototype.FV=Math.pow(2,d),n.prototype.F1=d-r,n.prototype.F2=2*r-d;var h="0123456789abcdefghijklmnopqrstuvwxyz",y=new Array,E,w;for(E="0".charCodeAt(0),w=0;w<=9;++w)y[E++]=w;for(E="a".charCodeAt(0),w=10;w<36;++w)y[E++]=w;for(E="A".charCodeAt(0),w=10;w<36;++w)y[E++]=w;function g(i){return h.charAt(i)}function T(i,a){var u=y[i.charCodeAt(a)];return u??-1}function O(i){for(var a=this.t-1;a>=0;--a)i[a]=this[a];i.t=this.t,i.s=this.s}function B(i){this.t=1,this.s=i<0?-1:0,i>0?this[0]=i:i<-1?this[0]=i+this.DV:this.t=0}function k(i){var a=o();return a.fromInt(i),a}function q(i,a){var u;if(a==16)u=4;else if(a==8)u=3;else if(a==256)u=8;else if(a==2)u=1;else if(a==32)u=5;else if(a==4)u=2;else{this.fromRadix(i,a);return}this.t=0,this.s=0;for(var p=i.length,m=!1,b=0;--p>=0;){var v=u==8?i[p]&255:T(i,p);if(v<0){i.charAt(p)=="-"&&(m=!0);continue}m=!1,b==0?this[this.t++]=v:b+u>this.DB?(this[this.t-1]|=(v&(1<<this.DB-b)-1)<<b,this[this.t++]=v>>this.DB-b):this[this.t-1]|=v<<b,b+=u,b>=this.DB&&(b-=this.DB)}u==8&&i[0]&128&&(this.s=-1,b>0&&(this[this.t-1]|=(1<<this.DB-b)-1<<b)),this.clamp(),m&&n.ZERO.subTo(this,this)}function Y(){for(var i=this.s&this.DM;this.t>0&&this[this.t-1]==i;)--this.t}function Et(i){if(this.s<0)return"-"+this.negate().toString(i);var a;if(i==16)a=4;else if(i==8)a=3;else if(i==2)a=1;else if(i==32)a=5;else if(i==4)a=2;else return this.toRadix(i);var u=(1<<a)-1,p,m=!1,b="",v=this.t,S=this.DB-v*this.DB%a;if(v-- >0)for(S<this.DB&&(p=this[v]>>S)>0&&(m=!0,b=g(p));v>=0;)S<a?(p=(this[v]&(1<<S)-1)<<a-S,p|=this[--v]>>(S+=this.DB-a)):(p=this[v]>>(S-=a)&u,S<=0&&(S+=this.DB,--v)),p>0&&(m=!0),m&&(b+=g(p));return m?b:"0"}function mt(){var i=o();return n.ZERO.subTo(this,i),i}function pt(){return this.s<0?this.negate():this}function gt(i){var a=this.s-i.s;if(a!=0)return a;var u=this.t;if(a=u-i.t,a!=0)return this.s<0?-a:a;for(;--u>=0;)if((a=this[u]-i[u])!=0)return a;return 0}function Lt(i){var a=1,u;return(u=i>>>16)!=0&&(i=u,a+=16),(u=i>>8)!=0&&(i=u,a+=8),(u=i>>4)!=0&&(i=u,a+=4),(u=i>>2)!=0&&(i=u,a+=2),(u=i>>1)!=0&&(i=u,a+=1),a}function nl(){return this.t<=0?0:this.DB*(this.t-1)+Lt(this[this.t-1]^this.s&this.DM)}function ol(i,a){var u;for(u=this.t-1;u>=0;--u)a[u+i]=this[u];for(u=i-1;u>=0;--u)a[u]=0;a.t=this.t+i,a.s=this.s}function sl(i,a){for(var u=i;u<this.t;++u)a[u-i]=this[u];a.t=Math.max(this.t-i,0),a.s=this.s}function il(i,a){var u=i%this.DB,p=this.DB-u,m=(1<<p)-1,b=Math.floor(i/this.DB),v=this.s<<u&this.DM,S;for(S=this.t-1;S>=0;--S)a[S+b+1]=this[S]>>p|v,v=(this[S]&m)<<u;for(S=b-1;S>=0;--S)a[S]=0;a[b]=v,a.t=this.t+b+1,a.s=this.s,a.clamp()}function cl(i,a){a.s=this.s;var u=Math.floor(i/this.DB);if(u>=this.t){a.t=0;return}var p=i%this.DB,m=this.DB-p,b=(1<<p)-1;a[0]=this[u]>>p;for(var v=u+1;v<this.t;++v)a[v-u-1]|=(this[v]&b)<<m,a[v-u]=this[v]>>p;p>0&&(a[this.t-u-1]|=(this.s&b)<<m),a.t=this.t-u,a.clamp()}function al(i,a){for(var u=0,p=0,m=Math.min(i.t,this.t);u<m;)p+=this[u]-i[u],a[u++]=p&this.DM,p>>=this.DB;if(i.t<this.t){for(p-=i.s;u<this.t;)p+=this[u],a[u++]=p&this.DM,p>>=this.DB;p+=this.s}else{for(p+=this.s;u<i.t;)p-=i[u],a[u++]=p&this.DM,p>>=this.DB;p-=i.s}a.s=p<0?-1:0,p<-1?a[u++]=this.DV+p:p>0&&(a[u++]=p),a.t=u,a.clamp()}function ul(i,a){var u=this.abs(),p=i.abs(),m=u.t;for(a.t=m+p.t;--m>=0;)a[m]=0;for(m=0;m<p.t;++m)a[m+u.t]=u.am(0,p[m],a,m,0,u.t);a.s=0,a.clamp(),this.s!=i.s&&n.ZERO.subTo(a,a)}function ll(i){for(var a=this.abs(),u=i.t=2*a.t;--u>=0;)i[u]=0;for(u=0;u<a.t-1;++u){var p=a.am(u,a[u],i,2*u,0,1);(i[u+a.t]+=a.am(u+1,2*a[u],i,2*u+1,p,a.t-u-1))>=a.DV&&(i[u+a.t]-=a.DV,i[u+a.t+1]=1)}i.t>0&&(i[i.t-1]+=a.am(u,a[u],i,2*u,0,1)),i.s=0,i.clamp()}function fl(i,a,u){var p=i.abs();if(!(p.t<=0)){var m=this.abs();if(m.t<p.t){a?.fromInt(0),u!=null&&this.copyTo(u);return}u==null&&(u=o());var b=o(),v=this.s,S=i.s,M=this.DB-Lt(p[p.t-1]);M>0?(p.lShiftTo(M,b),m.lShiftTo(M,u)):(p.copyTo(b),m.copyTo(u));var rt=b.t,Dt=b[rt-1];if(Dt!=0){var St=Dt*(1<<this.F1)+(rt>1?b[rt-2]>>this.F2:0),Xt=this.FV/St,Kr=(1<<this.F1)/St,Mt=1<<this.F2,Ut=u.t,Qr=Ut-rt,pe=a??o();for(b.dlShiftTo(Qr,pe),u.compareTo(pe)>=0&&(u[u.t++]=1,u.subTo(pe,u)),n.ONE.dlShiftTo(rt,pe),pe.subTo(b,b);b.t<rt;)b[b.t++]=0;for(;--Qr>=0;){var uo=u[--Ut]==Dt?this.DM:Math.floor(u[Ut]*Xt+(u[Ut-1]+Mt)*Kr);if((u[Ut]+=b.am(0,uo,u,Qr,0,rt))<uo)for(b.dlShiftTo(Qr,pe),u.subTo(pe,u);u[Ut]<--uo;)u.subTo(pe,u)}a!=null&&(u.drShiftTo(rt,a),v!=S&&n.ZERO.subTo(a,a)),u.t=rt,u.clamp(),M>0&&u.rShiftTo(M,u),v<0&&n.ZERO.subTo(u,u)}}}function hl(i){var a=o();return this.abs().divRemTo(i,null,a),this.s<0&&a.compareTo(n.ZERO)>0&&i.subTo(a,a),a}function Se(i){this.m=i}function pl(i){return i.s<0||i.compareTo(this.m)>=0?i.mod(this.m):i}function dl(i){return i}function ml(i){i.divRemTo(this.m,null,i)}function gl(i,a,u){i.multiplyTo(a,u),this.reduce(u)}function yl(i,a){i.squareTo(a),this.reduce(a)}Se.prototype.convert=pl,Se.prototype.revert=dl,Se.prototype.reduce=ml,Se.prototype.mulTo=gl,Se.prototype.sqrTo=yl;function bl(){if(this.t<1)return 0;var i=this[0];if(!(i&1))return 0;var a=i&3;return a=a*(2-(i&15)*a)&15,a=a*(2-(i&255)*a)&255,a=a*(2-((i&65535)*a&65535))&65535,a=a*(2-i*a%this.DV)%this.DV,a>0?this.DV-a:-a}function Te(i){this.m=i,this.mp=i.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<i.DB-15)-1,this.mt2=2*i.t}function wl(i){var a=o();return i.abs().dlShiftTo(this.m.t,a),a.divRemTo(this.m,null,a),i.s<0&&a.compareTo(n.ZERO)>0&&this.m.subTo(a,a),a}function El(i){var a=o();return i.copyTo(a),this.reduce(a),a}function vl(i){for(;i.t<=this.mt2;)i[i.t++]=0;for(var a=0;a<this.m.t;++a){var u=i[a]&32767,p=u*this.mpl+((u*this.mph+(i[a]>>15)*this.mpl&this.um)<<15)&i.DM;for(u=a+this.m.t,i[u]+=this.m.am(0,p,i,a,0,this.m.t);i[u]>=i.DV;)i[u]-=i.DV,i[++u]++}i.clamp(),i.drShiftTo(this.m.t,i),i.compareTo(this.m)>=0&&i.subTo(this.m,i)}function Sl(i,a){i.squareTo(a),this.reduce(a)}function Tl(i,a,u){i.multiplyTo(a,u),this.reduce(u)}Te.prototype.convert=wl,Te.prototype.revert=El,Te.prototype.reduce=vl,Te.prototype.mulTo=Tl,Te.prototype.sqrTo=Sl;function xl(){return(this.t>0?this[0]&1:this.s)==0}function Al(i,a){if(i>4294967295||i<1)return n.ONE;var u=o(),p=o(),m=a.convert(this),b=Lt(i)-1;for(m.copyTo(u);--b>=0;)if(a.sqrTo(u,p),(i&1<<b)>0)a.mulTo(p,m,u);else{var v=u;u=p,p=v}return a.revert(u)}function Il(i,a){var u;return i<256||a.isEven()?u=new Se(a):u=new Te(a),this.exp(i,u)}n.prototype.copyTo=O,n.prototype.fromInt=B,n.prototype.fromString=q,n.prototype.clamp=Y,n.prototype.dlShiftTo=ol,n.prototype.drShiftTo=sl,n.prototype.lShiftTo=il,n.prototype.rShiftTo=cl,n.prototype.subTo=al,n.prototype.multiplyTo=ul,n.prototype.squareTo=ll,n.prototype.divRemTo=fl,n.prototype.invDigit=bl,n.prototype.isEven=xl,n.prototype.exp=Al,n.prototype.toString=Et,n.prototype.negate=mt,n.prototype.abs=pt,n.prototype.compareTo=gt,n.prototype.bitLength=nl,n.prototype.mod=hl,n.prototype.modPowInt=Il,n.ZERO=k(0),n.ONE=k(1);function Cl(){var i=o();return this.copyTo(i),i}function Bl(){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 _l(){return this.t==0?this.s:this[0]<<24>>24}function Dl(){return this.t==0?this.s:this[0]<<16>>16}function Rl(i){return Math.floor(Math.LN2*this.DB/Math.log(i))}function kl(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function Ol(i){if(i==null&&(i=10),this.signum()==0||i<2||i>36)return"0";var a=this.chunkSize(i),u=Math.pow(i,a),p=k(u),m=o(),b=o(),v="";for(this.divRemTo(p,m,b);m.signum()>0;)v=(u+b.intValue()).toString(i).substr(1)+v,m.divRemTo(p,m,b);return b.intValue().toString(i)+v}function Pl(i,a){this.fromInt(0),a==null&&(a=10);for(var u=this.chunkSize(a),p=Math.pow(a,u),m=!1,b=0,v=0,S=0;S<i.length;++S){var M=T(i,S);if(M<0){i.charAt(S)=="-"&&this.signum()==0&&(m=!0);continue}v=a*v+M,++b>=u&&(this.dMultiply(p),this.dAddOffset(v,0),b=0,v=0)}b>0&&(this.dMultiply(Math.pow(a,b)),this.dAddOffset(v,0)),m&&n.ZERO.subTo(this,this)}function Ll(i,a,u){if(typeof a=="number")if(i<2)this.fromInt(1);else for(this.fromNumber(i,u),this.testBit(i-1)||this.bitwiseTo(n.ONE.shiftLeft(i-1),so,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(a);)this.dAddOffset(2,0),this.bitLength()>i&&this.subTo(n.ONE.shiftLeft(i-1),this);else{var p=new Array,m=i&7;p.length=(i>>3)+1,a.nextBytes(p),m>0?p[0]&=(1<<m)-1:p[0]=0,this.fromString(p,256)}}function Nl(){var i=this.t,a=new Array;a[0]=this.s;var u=this.DB-i*this.DB%8,p,m=0;if(i-- >0)for(u<this.DB&&(p=this[i]>>u)!=(this.s&this.DM)>>u&&(a[m++]=p|this.s<<this.DB-u);i>=0;)u<8?(p=(this[i]&(1<<u)-1)<<8-u,p|=this[--i]>>(u+=this.DB-8)):(p=this[i]>>(u-=8)&255,u<=0&&(u+=this.DB,--i)),p&128&&(p|=-256),m==0&&(this.s&128)!=(p&128)&&++m,(m>0||p!=this.s)&&(a[m++]=p);return a}function Ml(i){return this.compareTo(i)==0}function Ul(i){return this.compareTo(i)<0?this:i}function Fl(i){return this.compareTo(i)>0?this:i}function $l(i,a,u){var p,m,b=Math.min(i.t,this.t);for(p=0;p<b;++p)u[p]=a(this[p],i[p]);if(i.t<this.t){for(m=i.s&this.DM,p=b;p<this.t;++p)u[p]=a(this[p],m);u.t=this.t}else{for(m=this.s&this.DM,p=b;p<i.t;++p)u[p]=a(m,i[p]);u.t=i.t}u.s=a(this.s,i.s),u.clamp()}function zl(i,a){return i&a}function Vl(i){var a=o();return this.bitwiseTo(i,zl,a),a}function so(i,a){return i|a}function Gl(i){var a=o();return this.bitwiseTo(i,so,a),a}function Si(i,a){return i^a}function Hl(i){var a=o();return this.bitwiseTo(i,Si,a),a}function Ti(i,a){return i&~a}function jl(i){var a=o();return this.bitwiseTo(i,Ti,a),a}function ql(){for(var i=o(),a=0;a<this.t;++a)i[a]=this.DM&~this[a];return i.t=this.t,i.s=~this.s,i}function Wl(i){var a=o();return i<0?this.rShiftTo(-i,a):this.lShiftTo(i,a),a}function Zl(i){var a=o();return i<0?this.lShiftTo(-i,a):this.rShiftTo(i,a),a}function Kl(i){if(i==0)return-1;var a=0;return i&65535||(i>>=16,a+=16),i&255||(i>>=8,a+=8),i&15||(i>>=4,a+=4),i&3||(i>>=2,a+=2),i&1||++a,a}function Ql(){for(var i=0;i<this.t;++i)if(this[i]!=0)return i*this.DB+Kl(this[i]);return this.s<0?this.t*this.DB:-1}function Xl(i){for(var a=0;i!=0;)i&=i-1,++a;return a}function Jl(){for(var i=0,a=this.s&this.DM,u=0;u<this.t;++u)i+=Xl(this[u]^a);return i}function Yl(i){var a=Math.floor(i/this.DB);return a>=this.t?this.s!=0:(this[a]&1<<i%this.DB)!=0}function tf(i,a){var u=n.ONE.shiftLeft(i);return this.bitwiseTo(u,a,u),u}function ef(i){return this.changeBit(i,so)}function rf(i){return this.changeBit(i,Ti)}function nf(i){return this.changeBit(i,Si)}function of(i,a){for(var u=0,p=0,m=Math.min(i.t,this.t);u<m;)p+=this[u]+i[u],a[u++]=p&this.DM,p>>=this.DB;if(i.t<this.t){for(p+=i.s;u<this.t;)p+=this[u],a[u++]=p&this.DM,p>>=this.DB;p+=this.s}else{for(p+=this.s;u<i.t;)p+=i[u],a[u++]=p&this.DM,p>>=this.DB;p+=i.s}a.s=p<0?-1:0,p>0?a[u++]=p:p<-1&&(a[u++]=this.DV+p),a.t=u,a.clamp()}function sf(i){var a=o();return this.addTo(i,a),a}function cf(i){var a=o();return this.subTo(i,a),a}function af(i){var a=o();return this.multiplyTo(i,a),a}function uf(){var i=o();return this.squareTo(i),i}function lf(i){var a=o();return this.divRemTo(i,a,null),a}function ff(i){var a=o();return this.divRemTo(i,null,a),a}function hf(i){var a=o(),u=o();return this.divRemTo(i,a,u),new Array(a,u)}function pf(i){this[this.t]=this.am(0,i-1,this,0,0,this.t),++this.t,this.clamp()}function df(i,a){if(i!=0){for(;this.t<=a;)this[this.t++]=0;for(this[a]+=i;this[a]>=this.DV;)this[a]-=this.DV,++a>=this.t&&(this[this.t++]=0),++this[a]}}function dr(){}function xi(i){return i}function mf(i,a,u){i.multiplyTo(a,u)}function gf(i,a){i.squareTo(a)}dr.prototype.convert=xi,dr.prototype.revert=xi,dr.prototype.mulTo=mf,dr.prototype.sqrTo=gf;function yf(i){return this.exp(i,new dr)}function bf(i,a,u){var p=Math.min(this.t+i.t,a);for(u.s=0,u.t=p;p>0;)u[--p]=0;var m;for(m=u.t-this.t;p<m;++p)u[p+this.t]=this.am(0,i[p],u,p,0,this.t);for(m=Math.min(i.t,a);p<m;++p)this.am(0,i[p],u,p,0,a-p);u.clamp()}function wf(i,a,u){--a;var p=u.t=this.t+i.t-a;for(u.s=0;--p>=0;)u[p]=0;for(p=Math.max(a-this.t,0);p<i.t;++p)u[this.t+p-a]=this.am(a-p,i[p],u,0,0,this.t+p-a);u.clamp(),u.drShiftTo(1,u)}function xe(i){this.r2=o(),this.q3=o(),n.ONE.dlShiftTo(2*i.t,this.r2),this.mu=this.r2.divide(i),this.m=i}function Ef(i){if(i.s<0||i.t>2*this.m.t)return i.mod(this.m);if(i.compareTo(this.m)<0)return i;var a=o();return i.copyTo(a),this.reduce(a),a}function vf(i){return i}function Sf(i){for(i.drShiftTo(this.m.t-1,this.r2),i.t>this.m.t+1&&(i.t=this.m.t+1,i.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);i.compareTo(this.r2)<0;)i.dAddOffset(1,this.m.t+1);for(i.subTo(this.r2,i);i.compareTo(this.m)>=0;)i.subTo(this.m,i)}function Tf(i,a){i.squareTo(a),this.reduce(a)}function xf(i,a,u){i.multiplyTo(a,u),this.reduce(u)}xe.prototype.convert=Ef,xe.prototype.revert=vf,xe.prototype.reduce=Sf,xe.prototype.mulTo=xf,xe.prototype.sqrTo=Tf;function Af(i,a){var u=i.bitLength(),p,m=k(1),b;if(u<=0)return m;u<18?p=1:u<48?p=3:u<144?p=4:u<768?p=5:p=6,u<8?b=new Se(a):a.isEven()?b=new xe(a):b=new Te(a);var v=new Array,S=3,M=p-1,rt=(1<<p)-1;if(v[1]=b.convert(this),p>1){var Dt=o();for(b.sqrTo(v[1],Dt);S<=rt;)v[S]=o(),b.mulTo(Dt,v[S-2],v[S]),S+=2}var St=i.t-1,Xt,Kr=!0,Mt=o(),Ut;for(u=Lt(i[St])-1;St>=0;){for(u>=M?Xt=i[St]>>u-M&rt:(Xt=(i[St]&(1<<u+1)-1)<<M-u,St>0&&(Xt|=i[St-1]>>this.DB+u-M)),S=p;!(Xt&1);)Xt>>=1,--S;if((u-=S)<0&&(u+=this.DB,--St),Kr)v[Xt].copyTo(m),Kr=!1;else{for(;S>1;)b.sqrTo(m,Mt),b.sqrTo(Mt,m),S-=2;S>0?b.sqrTo(m,Mt):(Ut=m,m=Mt,Mt=Ut),b.mulTo(Mt,v[Xt],m)}for(;St>=0&&!(i[St]&1<<u);)b.sqrTo(m,Mt),Ut=m,m=Mt,Mt=Ut,--u<0&&(u=this.DB-1,--St)}return b.revert(m)}function If(i){var a=this.s<0?this.negate():this.clone(),u=i.s<0?i.negate():i.clone();if(a.compareTo(u)<0){var p=a;a=u,u=p}var m=a.getLowestSetBit(),b=u.getLowestSetBit();if(b<0)return a;for(m<b&&(b=m),b>0&&(a.rShiftTo(b,a),u.rShiftTo(b,u));a.signum()>0;)(m=a.getLowestSetBit())>0&&a.rShiftTo(m,a),(m=u.getLowestSetBit())>0&&u.rShiftTo(m,u),a.compareTo(u)>=0?(a.subTo(u,a),a.rShiftTo(1,a)):(u.subTo(a,u),u.rShiftTo(1,u));return b>0&&u.lShiftTo(b,u),u}function Cf(i){if(i<=0)return 0;var a=this.DV%i,u=this.s<0?i-1:0;if(this.t>0)if(a==0)u=this[0]%i;else for(var p=this.t-1;p>=0;--p)u=(a*u+this[p])%i;return u}function Bf(i){var a=i.isEven();if(this.isEven()&&a||i.signum()==0)return n.ZERO;for(var u=i.clone(),p=this.clone(),m=k(1),b=k(0),v=k(0),S=k(1);u.signum()!=0;){for(;u.isEven();)u.rShiftTo(1,u),a?((!m.isEven()||!b.isEven())&&(m.addTo(this,m),b.subTo(i,b)),m.rShiftTo(1,m)):b.isEven()||b.subTo(i,b),b.rShiftTo(1,b);for(;p.isEven();)p.rShiftTo(1,p),a?((!v.isEven()||!S.isEven())&&(v.addTo(this,v),S.subTo(i,S)),v.rShiftTo(1,v)):S.isEven()||S.subTo(i,S),S.rShiftTo(1,S);u.compareTo(p)>=0?(u.subTo(p,u),a&&m.subTo(v,m),b.subTo(S,b)):(p.subTo(u,p),a&&v.subTo(m,v),S.subTo(b,S))}if(p.compareTo(n.ONE)!=0)return n.ZERO;if(S.compareTo(i)>=0)return S.subtract(i);if(S.signum()<0)S.addTo(i,S);else return S;return S.signum()<0?S.add(i):S}var dt=[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],_f=(1<<26)/dt[dt.length-1];function Df(i){var a,u=this.abs();if(u.t==1&&u[0]<=dt[dt.length-1]){for(a=0;a<dt.length;++a)if(u[0]==dt[a])return!0;return!1}if(u.isEven())return!1;for(a=1;a<dt.length;){for(var p=dt[a],m=a+1;m<dt.length&&p<_f;)p*=dt[m++];for(p=u.modInt(p);a<m;)if(p%dt[a++]==0)return!1}return u.millerRabin(i)}function Rf(i){var a=this.subtract(n.ONE),u=a.getLowestSetBit();if(u<=0)return!1;var p=a.shiftRight(u);i=i+1>>1,i>dt.length&&(i=dt.length);for(var m=o(),b=0;b<i;++b){m.fromInt(dt[Math.floor(Math.random()*dt.length)]);var v=m.modPow(p,this);if(v.compareTo(n.ONE)!=0&&v.compareTo(a)!=0){for(var S=1;S++<u&&v.compareTo(a)!=0;)if(v=v.modPowInt(2,this),v.compareTo(n.ONE)==0)return!1;if(v.compareTo(a)!=0)return!1}}return!0}n.prototype.chunkSize=Rl,n.prototype.toRadix=Ol,n.prototype.fromRadix=Pl,n.prototype.fromNumber=Ll,n.prototype.bitwiseTo=$l,n.prototype.changeBit=tf,n.prototype.addTo=of,n.prototype.dMultiply=pf,n.prototype.dAddOffset=df,n.prototype.multiplyLowerTo=bf,n.prototype.multiplyUpperTo=wf,n.prototype.modInt=Cf,n.prototype.millerRabin=Rf,n.prototype.clone=Cl,n.prototype.intValue=Bl,n.prototype.byteValue=_l,n.prototype.shortValue=Dl,n.prototype.signum=kl,n.prototype.toByteArray=Nl,n.prototype.equals=Ml,n.prototype.min=Ul,n.prototype.max=Fl,n.prototype.and=Vl,n.prototype.or=Gl,n.prototype.xor=Hl,n.prototype.andNot=jl,n.prototype.not=ql,n.prototype.shiftLeft=Wl,n.prototype.shiftRight=Zl,n.prototype.getLowestSetBit=Ql,n.prototype.bitCount=Jl,n.prototype.testBit=Yl,n.prototype.setBit=ef,n.prototype.clearBit=rf,n.prototype.flipBit=nf,n.prototype.add=sf,n.prototype.subtract=cf,n.prototype.multiply=af,n.prototype.divide=lf,n.prototype.remainder=ff,n.prototype.divideAndRemainder=hf,n.prototype.modPow=Af,n.prototype.modInverse=Bf,n.prototype.pow=yf,n.prototype.gcd=If,n.prototype.isProbablePrime=Df,n.prototype.square=uf,n.prototype.Barrett=xe;var Zr,vt,et;function kf(i){vt[et++]^=i&255,vt[et++]^=i>>8&255,vt[et++]^=i>>16&255,vt[et++]^=i>>24&255,et>=ao&&(et-=ao)}function Ai(){kf(new Date().getTime())}if(vt==null){vt=new Array,et=0;var Nt;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var Ii=new Uint8Array(32);for(window.crypto.getRandomValues(Ii),Nt=0;Nt<32;++Nt)vt[et++]=Ii[Nt]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var Ci=window.crypto.random(32);for(Nt=0;Nt<Ci.length;++Nt)vt[et++]=Ci.charCodeAt(Nt)&255}}for(;et<ao;)Nt=Math.floor(65536*Math.random()),vt[et++]=Nt>>>8,vt[et++]=Nt&255;et=0,Ai()}function Of(){if(Zr==null){for(Ai(),Zr=Mf(),Zr.init(vt),et=0;et<vt.length;++et)vt[et]=0;et=0}return Zr.next()}function Pf(i){var a;for(a=0;a<i.length;++a)i[a]=Of()}function io(){}io.prototype.nextBytes=Pf;function co(){this.i=0,this.j=0,this.S=new Array}function Lf(i){var a,u,p;for(a=0;a<256;++a)this.S[a]=a;for(u=0,a=0;a<256;++a)u=u+this.S[a]+i[a%i.length]&255,p=this.S[a],this.S[a]=this.S[u],this.S[u]=p;this.i=0,this.j=0}function Nf(){var i;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,i=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=i,this.S[i+this.S[this.i]&255]}co.prototype.init=Lf,co.prototype.next=Nf;function Mf(){return new co}var ao=256;typeof bn<"u"?bn=ca.exports={default:n,BigInteger:n,SecureRandom:io}:this.jsbn={BigInteger:n,SecureRandom:io}}).call(bn)});var Dr=P(wn=>{(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(c){return n(s(c),arguments)}function e(c,l){return t.apply(null,[c].concat(l||[]))}function n(c,l){var f=1,d=c.length,h,y="",E,w,g,T,O,B,k,q;for(E=0;E<d;E++)if(typeof c[E]=="string")y+=c[E];else if(typeof c[E]=="object"){if(g=c[E],g.keys)for(h=l[f],w=0;w<g.keys.length;w++){if(h==null)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',g.keys[w],g.keys[w-1]));h=h[g.keys[w]]}else g.param_no?h=l[g.param_no]:h=l[f++];if(r.not_type.test(g.type)&&r.not_primitive.test(g.type)&&h instanceof Function&&(h=h()),r.numeric_arg.test(g.type)&&typeof h!="number"&&isNaN(h))throw new TypeError(t("[sprintf] expecting number but found %T",h));switch(r.number.test(g.type)&&(k=h>=0),g.type){case"b":h=parseInt(h,10).toString(2);break;case"c":h=String.fromCharCode(parseInt(h,10));break;case"d":case"i":h=parseInt(h,10);break;case"j":h=JSON.stringify(h,null,g.width?parseInt(g.width):0);break;case"e":h=g.precision?parseFloat(h).toExponential(g.precision):parseFloat(h).toExponential();break;case"f":h=g.precision?parseFloat(h).toFixed(g.precision):parseFloat(h);break;case"g":h=g.precision?String(Number(h.toPrecision(g.precision))):parseFloat(h);break;case"o":h=(parseInt(h,10)>>>0).toString(8);break;case"s":h=String(h),h=g.precision?h.substring(0,g.precision):h;break;case"t":h=String(!!h),h=g.precision?h.substring(0,g.precision):h;break;case"T":h=Object.prototype.toString.call(h).slice(8,-1).toLowerCase(),h=g.precision?h.substring(0,g.precision):h;break;case"u":h=parseInt(h,10)>>>0;break;case"v":h=h.valueOf(),h=g.precision?h.substring(0,g.precision):h;break;case"x":h=(parseInt(h,10)>>>0).toString(16);break;case"X":h=(parseInt(h,10)>>>0).toString(16).toUpperCase();break}r.json.test(g.type)?y+=h:(r.number.test(g.type)&&(!k||g.sign)?(q=k?"+":"-",h=h.toString().replace(r.sign,"")):q="",O=g.pad_char?g.pad_char==="0"?"0":g.pad_char.charAt(1):" ",B=g.width-(q+h).length,T=g.width&&B>0?O.repeat(B):"",y+=g.align?q+h+T:O==="0"?q+T+h:T+q+h)}return y}var o=Object.create(null);function s(c){if(o[c])return o[c];for(var l=c,f,d=[],h=0;l;){if((f=r.text.exec(l))!==null)d.push(f[0]);else if((f=r.modulo.exec(l))!==null)d.push("%");else if((f=r.placeholder.exec(l))!==null){if(f[2]){h|=1;var y=[],E=f[2],w=[];if((w=r.key.exec(E))!==null)for(y.push(w[1]);(E=E.substring(w[0].length))!=="";)if((w=r.key_access.exec(E))!==null)y.push(w[1]);else if((w=r.index_access.exec(E))!==null)y.push(w[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");f[2]=y}else h|=2;if(h===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");d.push({placeholder:f[0],param_no:f[1],keys:f[2],sign:f[3],pad_char:f[4],align:f[5],width:f[6],precision:f[7],type:f[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");l=l.substring(f[0].length)}return o[c]=d}typeof wn<"u"&&(wn.sprintf=t,wn.vsprintf=e),typeof window<"u"&&(window.sprintf=t,window.vsprintf=e,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:e}}))})()});var uu=P((Kw,au)=>{"use strict";au.exports=Xm;function Xm(r,t){for(var e=new Array(arguments.length-1),n=0,o=2,s=!0;o<arguments.length;)e[n++]=arguments[o++];return new Promise(function(l,f){e[n]=function(h){if(s)if(s=!1,h)f(h);else{for(var y=new Array(arguments.length-1),E=0;E<y.length;)y[E++]=arguments[E];l.apply(null,y)}};try{r.apply(t||null,e)}catch(d){s&&(s=!1,f(d))}})}});var pu=P(hu=>{"use strict";var Fn=hu;Fn.length=function(t){var e=t.length;if(!e)return 0;for(var n=0;--e%4>1&&t.charAt(e)==="=";)++n;return Math.ceil(t.length*3)/4-n};var fr=new Array(64),fu=new Array(123);for(zt=0;zt<64;)fu[fr[zt]=zt<26?zt+65:zt<52?zt+71:zt<62?zt-4:zt-59|43]=zt++;var zt;Fn.encode=function(t,e,n){for(var o=null,s=[],c=0,l=0,f;e<n;){var d=t[e++];switch(l){case 0:s[c++]=fr[d>>2],f=(d&3)<<4,l=1;break;case 1:s[c++]=fr[f|d>>4],f=(d&15)<<2,l=2;break;case 2:s[c++]=fr[f|d>>6],s[c++]=fr[d&63],l=0;break}c>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),c=0)}return l&&(s[c++]=fr[f],s[c++]=61,l===1&&(s[c++]=61)),o?(c&&o.push(String.fromCharCode.apply(String,s.slice(0,c))),o.join("")):String.fromCharCode.apply(String,s.slice(0,c))};var lu="invalid encoding";Fn.decode=function(t,e,n){for(var o=n,s=0,c,l=0;l<t.length;){var f=t.charCodeAt(l++);if(f===61&&s>1)break;if((f=fu[f])===void 0)throw Error(lu);switch(s){case 0:c=f,s=1;break;case 1:e[n++]=c<<2|(f&48)>>4,c=f,s=2;break;case 2:e[n++]=(c&15)<<4|(f&60)>>2,c=f,s=3;break;case 3:e[n++]=(c&3)<<6|f,s=0;break}}if(s===1)throw Error(lu);return n-o};Fn.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var mu=P((Xw,du)=>{"use strict";du.exports=$n;function $n(){this._listeners={}}$n.prototype.on=function(t,e,n){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:n||this}),this};$n.prototype.off=function(t,e){if(t===void 0)this._listeners={};else if(e===void 0)this._listeners[t]=[];else for(var n=this._listeners[t],o=0;o<n.length;)n[o].fn===e?n.splice(o,1):++o;return this};$n.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var n=[],o=1;o<arguments.length;)n.push(arguments[o++]);for(o=0;o<e.length;)e[o].fn.apply(e[o++].ctx,n)}return this}});var Su=P((Jw,vu)=>{"use strict";vu.exports=gu(gu);function gu(r){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),e=new Uint8Array(t.buffer),n=e[3]===128;function o(f,d,h){t[0]=f,d[h]=e[0],d[h+1]=e[1],d[h+2]=e[2],d[h+3]=e[3]}function s(f,d,h){t[0]=f,d[h]=e[3],d[h+1]=e[2],d[h+2]=e[1],d[h+3]=e[0]}r.writeFloatLE=n?o:s,r.writeFloatBE=n?s:o;function c(f,d){return e[0]=f[d],e[1]=f[d+1],e[2]=f[d+2],e[3]=f[d+3],t[0]}function l(f,d){return e[3]=f[d],e[2]=f[d+1],e[1]=f[d+2],e[0]=f[d+3],t[0]}r.readFloatLE=n?c:l,r.readFloatBE=n?l:c}():function(){function t(n,o,s,c){var l=o<0?1:0;if(l&&(o=-o),o===0)n(1/o>0?0:2147483648,s,c);else if(isNaN(o))n(2143289344,s,c);else if(o>34028234663852886e22)n((l<<31|2139095040)>>>0,s,c);else if(o<11754943508222875e-54)n((l<<31|Math.round(o/1401298464324817e-60))>>>0,s,c);else{var f=Math.floor(Math.log(o)/Math.LN2),d=Math.round(o*Math.pow(2,-f)*8388608)&8388607;n((l<<31|f+127<<23|d)>>>0,s,c)}}r.writeFloatLE=t.bind(null,yu),r.writeFloatBE=t.bind(null,bu);function e(n,o,s){var c=n(o,s),l=(c>>31)*2+1,f=c>>>23&255,d=c&8388607;return f===255?d?NaN:l*(1/0):f===0?l*1401298464324817e-60*d:l*Math.pow(2,f-150)*(d+8388608)}r.readFloatLE=e.bind(null,wu),r.readFloatBE=e.bind(null,Eu)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),e=new Uint8Array(t.buffer),n=e[7]===128;function o(f,d,h){t[0]=f,d[h]=e[0],d[h+1]=e[1],d[h+2]=e[2],d[h+3]=e[3],d[h+4]=e[4],d[h+5]=e[5],d[h+6]=e[6],d[h+7]=e[7]}function s(f,d,h){t[0]=f,d[h]=e[7],d[h+1]=e[6],d[h+2]=e[5],d[h+3]=e[4],d[h+4]=e[3],d[h+5]=e[2],d[h+6]=e[1],d[h+7]=e[0]}r.writeDoubleLE=n?o:s,r.writeDoubleBE=n?s:o;function c(f,d){return e[0]=f[d],e[1]=f[d+1],e[2]=f[d+2],e[3]=f[d+3],e[4]=f[d+4],e[5]=f[d+5],e[6]=f[d+6],e[7]=f[d+7],t[0]}function l(f,d){return e[7]=f[d],e[6]=f[d+1],e[5]=f[d+2],e[4]=f[d+3],e[3]=f[d+4],e[2]=f[d+5],e[1]=f[d+6],e[0]=f[d+7],t[0]}r.readDoubleLE=n?c:l,r.readDoubleBE=n?l:c}():function(){function t(n,o,s,c,l,f){var d=c<0?1:0;if(d&&(c=-c),c===0)n(0,l,f+o),n(1/c>0?0:2147483648,l,f+s);else if(isNaN(c))n(0,l,f+o),n(2146959360,l,f+s);else if(c>17976931348623157e292)n(0,l,f+o),n((d<<31|2146435072)>>>0,l,f+s);else{var h;if(c<22250738585072014e-324)h=c/5e-324,n(h>>>0,l,f+o),n((d<<31|h/4294967296)>>>0,l,f+s);else{var y=Math.floor(Math.log(c)/Math.LN2);y===1024&&(y=1023),h=c*Math.pow(2,-y),n(h*4503599627370496>>>0,l,f+o),n((d<<31|y+1023<<20|h*1048576&1048575)>>>0,l,f+s)}}}r.writeDoubleLE=t.bind(null,yu,0,4),r.writeDoubleBE=t.bind(null,bu,4,0);function e(n,o,s,c,l){var f=n(c,l+o),d=n(c,l+s),h=(d>>31)*2+1,y=d>>>20&2047,E=4294967296*(d&1048575)+f;return y===2047?E?NaN:h*(1/0):y===0?h*5e-324*E:h*Math.pow(2,y-1075)*(E+4503599627370496)}r.readDoubleLE=e.bind(null,wu,0,4),r.readDoubleBE=e.bind(null,Eu,4,0)}(),r}function yu(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function bu(r,t,e){t[e]=r>>>24,t[e+1]=r>>>16&255,t[e+2]=r>>>8&255,t[e+3]=r&255}function wu(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24)>>>0}function Eu(r,t){return(r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3])>>>0}});var Tu=P((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}});var Au=P(xu=>{"use strict";var ii=xu;ii.length=function(t){for(var e=0,n=0,o=0;o<t.length;++o)n=t.charCodeAt(o),n<128?e+=1:n<2048?e+=2:(n&64512)===55296&&(t.charCodeAt(o+1)&64512)===56320?(++o,e+=4):e+=3;return e};ii.read=function(t,e,n){var o=n-e;if(o<1)return"";for(var s=null,c=[],l=0,f;e<n;)f=t[e++],f<128?c[l++]=f:f>191&&f<224?c[l++]=(f&31)<<6|t[e++]&63:f>239&&f<365?(f=((f&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,c[l++]=55296+(f>>10),c[l++]=56320+(f&1023)):c[l++]=(f&15)<<12|(t[e++]&63)<<6|t[e++]&63,l>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,c)),l=0);return s?(l&&s.push(String.fromCharCode.apply(String,c.slice(0,l))),s.join("")):String.fromCharCode.apply(String,c.slice(0,l))};ii.write=function(t,e,n){for(var o=n,s,c,l=0;l<t.length;++l)s=t.charCodeAt(l),s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=s&63|128):(s&64512)===55296&&((c=t.charCodeAt(l+1))&64512)===56320?(s=65536+((s&1023)<<10)+(c&1023),++l,e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=s&63|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=s&63|128);return n-o}});var Cu=P((t1,Iu)=>{"use strict";Iu.exports=Jm;function Jm(r,t,e){var n=e||8192,o=n>>>1,s=null,c=n;return function(f){if(f<1||f>o)return r(f);c+f>n&&(s=r(n),c=0);var d=t.call(s,c,c+=f);return c&7&&(c=(c|7)+1),d}}});var _u=P((e1,Bu)=>{"use strict";Bu.exports=nt;var zr=Ne();function nt(r,t){this.lo=r>>>0,this.hi=t>>>0}var Le=nt.zero=new nt(0,0);Le.toNumber=function(){return 0};Le.zzEncode=Le.zzDecode=function(){return this};Le.length=function(){return 1};var Ym=nt.zeroHash="\0\0\0\0\0\0\0\0";nt.fromNumber=function(t){if(t===0)return Le;var e=t<0;e&&(t=-t);var n=t>>>0,o=(t-n)/4294967296>>>0;return e&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new nt(n,o)};nt.from=function(t){if(typeof t=="number")return nt.fromNumber(t);if(zr.isString(t))if(zr.Long)t=zr.Long.fromString(t);else return nt.fromNumber(parseInt(t,10));return t.low||t.high?new nt(t.low>>>0,t.high>>>0):Le};nt.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=~this.lo+1>>>0,n=~this.hi>>>0;return e||(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296};nt.prototype.toLong=function(t){return zr.Long?new zr.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var we=String.prototype.charCodeAt;nt.fromHash=function(t){return t===Ym?Le:new nt((we.call(t,0)|we.call(t,1)<<8|we.call(t,2)<<16|we.call(t,3)<<24)>>>0,(we.call(t,4)|we.call(t,5)<<8|we.call(t,6)<<16|we.call(t,7)<<24)>>>0)};nt.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};nt.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};nt.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};nt.prototype.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}});var Ne=P(ci=>{"use strict";var A=ci;A.asPromise=uu();A.base64=pu();A.EventEmitter=mu();A.float=Su();A.inquire=Tu();A.utf8=Au();A.pool=Cu();A.LongBits=_u();A.isNode=!!(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);A.global=A.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||ci;A.emptyArray=Object.freeze?Object.freeze([]):[];A.emptyObject=Object.freeze?Object.freeze({}):{};A.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};A.isString=function(t){return typeof t=="string"||t instanceof String};A.isObject=function(t){return t&&typeof t=="object"};A.isset=A.isSet=function(t,e){var n=t[e];return n!=null&&t.hasOwnProperty(e)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};A.Buffer=function(){try{var r=A.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();A._Buffer_from=null;A._Buffer_allocUnsafe=null;A.newBuffer=function(t){return typeof t=="number"?A.Buffer?A._Buffer_allocUnsafe(t):new A.Array(t):A.Buffer?A._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};A.Array=typeof Uint8Array<"u"?Uint8Array:Array;A.Long=A.global.dcodeIO&&A.global.dcodeIO.Long||A.global.Long||A.inquire("long");A.key2Re=/^true|false|0|1$/;A.key32Re=/^-?(?:0|[1-9][0-9]*)$/;A.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;A.longToHash=function(t){return t?A.LongBits.from(t).toHash():A.LongBits.zeroHash};A.longFromHash=function(t,e){var n=A.LongBits.fromHash(t);return A.Long?A.Long.fromBits(n.lo,n.hi,e):n.toNumber(!!e)};function Du(r,t,e){for(var n=Object.keys(t),o=0;o<n.length;++o)(r[n[o]]===void 0||!e)&&(r[n[o]]=t[n[o]]);return r}A.merge=Du;A.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Ru(r){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&Du(this,n)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return r},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}A.newError=Ru;A.ProtocolError=Ru("ProtocolError");A.oneOfGetter=function(t){for(var e={},n=0;n<t.length;++n)e[t[n]]=1;return function(){for(var o=Object.keys(this),s=o.length-1;s>-1;--s)if(e[o[s]]===1&&this[o[s]]!==void 0&&this[o[s]]!==null)return o[s]}};A.oneOfSetter=function(t){return function(e){for(var n=0;n<t.length;++n)t[n]!==e&&delete this[t[n]]}};A.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};A._configure=function(){var r=A.Buffer;if(!r){A._Buffer_from=A._Buffer_allocUnsafe=null;return}A._Buffer_from=r.from!==Uint8Array.from&&r.from||function(e,n){return new r(e,n)},A._Buffer_allocUnsafe=r.allocUnsafe||function(e){return new r(e)}}});var li=P((n1,Nu)=>{"use strict";Nu.exports=W;var Kt=Ne(),ui,Pu=Kt.LongBits,t0=Kt.utf8;function Vt(r,t){return RangeError("index out of range: "+r.pos+" + "+(t||1)+" > "+r.len)}function W(r){this.buf=r,this.pos=0,this.len=r.length}var ku=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new W(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new W(t);throw Error("illegal buffer")},Lu=function(){return Kt.Buffer?function(e){return(W.create=function(o){return Kt.Buffer.isBuffer(o)?new ui(o):ku(o)})(e)}:ku};W.create=Lu();W.prototype._slice=Kt.Array.prototype.subarray||Kt.Array.prototype.slice;W.prototype.uint32=function(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,Vt(this,10);return t}}();W.prototype.int32=function(){return this.uint32()|0};W.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function ai(){var r=new Pu(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(r.lo=(r.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Vt(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,r}if(this.len-this.pos>4){for(;t<5;++t)if(r.hi=(r.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return r}else for(;t<5;++t){if(this.pos>=this.len)throw Vt(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}W.prototype.bool=function(){return this.uint32()!==0};function zn(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}W.prototype.fixed32=function(){if(this.pos+4>this.len)throw Vt(this,4);return zn(this.buf,this.pos+=4)};W.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Vt(this,4);return zn(this.buf,this.pos+=4)|0};function Ou(){if(this.pos+8>this.len)throw Vt(this,8);return new Pu(zn(this.buf,this.pos+=4),zn(this.buf,this.pos+=4))}W.prototype.float=function(){if(this.pos+4>this.len)throw Vt(this,4);var t=Kt.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};W.prototype.double=function(){if(this.pos+8>this.len)throw Vt(this,4);var t=Kt.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};W.prototype.bytes=function(){var t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw Vt(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(e,n):e===n?new this.buf.constructor(0):this._slice.call(this.buf,e,n)};W.prototype.string=function(){var t=this.bytes();return t0.read(t,0,t.length)};W.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw Vt(this,t);this.pos+=t}else do if(this.pos>=this.len)throw Vt(this);while(this.buf[this.pos++]&128);return this};W.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};W._configure=function(r){ui=r,W.create=Lu(),ui._configure();var t=Kt.Long?"toLong":"toNumber";Kt.merge(W.prototype,{int64:function(){return ai.call(this)[t](!1)},uint64:function(){return ai.call(this)[t](!0)},sint64:function(){return ai.call(this).zzDecode()[t](!1)},fixed64:function(){return Ou.call(this)[t](!0)},sfixed64:function(){return Ou.call(this)[t](!1)}})}});var $u=P((o1,Fu)=>{"use strict";Fu.exports=Me;var Uu=li();(Me.prototype=Object.create(Uu.prototype)).constructor=Me;var Mu=Ne();function Me(r){Uu.call(this,r)}Me._configure=function(){Mu.Buffer&&(Me.prototype._slice=Mu.Buffer.prototype.slice)};Me.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};Me._configure()});var yi=P((s1,Hu)=>{"use strict";Hu.exports=L;var kt=Ne(),fi,Vn=kt.LongBits,zu=kt.base64,Vu=kt.utf8;function Vr(r,t,e){this.fn=r,this.len=t,this.next=void 0,this.val=e}function pi(){}function e0(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function L(){this.len=0,this.head=new Vr(pi,0,0),this.tail=this.head,this.states=null}var Gu=function(){return kt.Buffer?function(){return(L.create=function(){return new fi})()}:function(){return new L}};L.create=Gu();L.alloc=function(t){return new kt.Array(t)};kt.Array!==Array&&(L.alloc=kt.pool(L.alloc,kt.Array.prototype.subarray));L.prototype._push=function(t,e,n){return this.tail=this.tail.next=new Vr(t,e,n),this.len+=e,this};function di(r,t,e){t[e]=r&255}function r0(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}function mi(r,t){this.len=r,this.next=void 0,this.val=t}mi.prototype=Object.create(Vr.prototype);mi.prototype.fn=r0;L.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new mi((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};L.prototype.int32=function(t){return t<0?this._push(gi,10,Vn.fromNumber(t)):this.uint32(t)};L.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function gi(r,t,e){for(;r.hi;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}L.prototype.uint64=function(t){var e=Vn.from(t);return this._push(gi,e.length(),e)};L.prototype.int64=L.prototype.uint64;L.prototype.sint64=function(t){var e=Vn.from(t).zzEncode();return this._push(gi,e.length(),e)};L.prototype.bool=function(t){return this._push(di,1,t?1:0)};function hi(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}L.prototype.fixed32=function(t){return this._push(hi,4,t>>>0)};L.prototype.sfixed32=L.prototype.fixed32;L.prototype.fixed64=function(t){var e=Vn.from(t);return this._push(hi,4,e.lo)._push(hi,4,e.hi)};L.prototype.sfixed64=L.prototype.fixed64;L.prototype.float=function(t){return this._push(kt.float.writeFloatLE,4,t)};L.prototype.double=function(t){return this._push(kt.float.writeDoubleLE,8,t)};var n0=kt.Array.prototype.set?function(t,e,n){e.set(t,n)}:function(t,e,n){for(var o=0;o<t.length;++o)e[n+o]=t[o]};L.prototype.bytes=function(t){var e=t.length>>>0;if(!e)return this._push(di,1,0);if(kt.isString(t)){var n=L.alloc(e=zu.length(t));zu.decode(t,n,0),t=n}return this.uint32(e)._push(n0,e,t)};L.prototype.string=function(t){var e=Vu.length(t);return e?this.uint32(e)._push(Vu.write,e,t):this._push(di,1,0)};L.prototype.fork=function(){return this.states=new e0(this),this.head=this.tail=new Vr(pi,0,0),this.len=0,this};L.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Vr(pi,0,0),this.len=0),this};L.prototype.ldelim=function(){var t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=e,this.len+=n),this};L.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e};L._configure=function(r){fi=r,L.create=Gu(),fi._configure()}});var Wu=P((i1,qu)=>{"use strict";qu.exports=Qt;var ju=yi();(Qt.prototype=Object.create(ju.prototype)).constructor=Qt;var Ee=Ne();function Qt(){ju.call(this)}Qt._configure=function(){Qt.alloc=Ee._Buffer_allocUnsafe,Qt.writeBytesBuffer=Ee.Buffer&&Ee.Buffer.prototype instanceof Uint8Array&&Ee.Buffer.prototype.set.name==="set"?function(t,e,n){e.set(t,n)}:function(t,e,n){if(t.copy)t.copy(e,n,0,t.length);else for(var o=0;o<t.length;)e[n++]=t[o++]}};Qt.prototype.bytes=function(t){Ee.isString(t)&&(t=Ee._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push(Qt.writeBytesBuffer,e,t),this};function o0(r,t,e){r.length<40?Ee.utf8.write(r,t,e):t.utf8Write?t.utf8Write(r,e):t.write(r,e)}Qt.prototype.string=function(t){var e=Ee.Buffer.byteLength(t);return this.uint32(e),e&&this._push(o0,e,t),this};Qt._configure()});var p0={};Tt(p0,{Server:()=>oo,createServer:()=>h0});var Ua=R(Jt("net"),1);var Z=Jt("node:net");function ct(r){return!!(0,Z.isIP)(r)}var mo={};Tt(mo,{identity:()=>Kf});function Hf(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),c=s.charCodeAt(0);if(e[c]!==255)throw new TypeError(s+" is ambiguous");e[c]=o}var l=r.length,f=r.charAt(0),d=Math.log(l)/Math.log(256),h=Math.log(256)/Math.log(l);function y(g){if(g instanceof Uint8Array||(ArrayBuffer.isView(g)?g=new Uint8Array(g.buffer,g.byteOffset,g.byteLength):Array.isArray(g)&&(g=Uint8Array.from(g))),!(g instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(g.length===0)return"";for(var T=0,O=0,B=0,k=g.length;B!==k&&g[B]===0;)B++,T++;for(var q=(k-B)*h+1>>>0,Y=new Uint8Array(q);B!==k;){for(var Et=g[B],mt=0,pt=q-1;(Et!==0||mt<O)&&pt!==-1;pt--,mt++)Et+=256*Y[pt]>>>0,Y[pt]=Et%l>>>0,Et=Et/l>>>0;if(Et!==0)throw new Error("Non-zero carry");O=mt,B++}for(var gt=q-O;gt!==q&&Y[gt]===0;)gt++;for(var Lt=f.repeat(T);gt<q;++gt)Lt+=r.charAt(Y[gt]);return Lt}function E(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return new Uint8Array;var T=0;if(g[T]!==" "){for(var O=0,B=0;g[T]===f;)O++,T++;for(var k=(g.length-T)*d+1>>>0,q=new Uint8Array(k);g[T];){var Y=e[g.charCodeAt(T)];if(Y===255)return;for(var Et=0,mt=k-1;(Y!==0||Et<B)&&mt!==-1;mt--,Et++)Y+=l*q[mt]>>>0,q[mt]=Y%256>>>0,Y=Y/256>>>0;if(Y!==0)throw new Error("Non-zero carry");B=Et,T++}if(g[T]!==" "){for(var pt=k-B;pt!==k&&q[pt]===0;)pt++;for(var gt=new Uint8Array(O+(k-pt)),Lt=O;pt!==k;)gt[Lt++]=q[pt++];return gt}}}function w(g){var T=E(g);if(T)return T;throw new Error(`Non-${t} character`)}return{encode:y,decodeUnsafe:E,decode:w}}var jf=Hf,qf=jf,_i=qf;var y0=new Uint8Array(0);var Di=(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},Rt=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 Ri=r=>new TextEncoder().encode(r),ki=r=>new TextDecoder().decode(r);var lo=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")}},fo=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 Pi(this,t)}},ho=class{constructor(t){this.decoders=t}or(t){return Pi(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`)}},Pi=(r,t)=>new ho({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),po=class{constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new lo(t,e,n),this.decoder=new fo(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},ze=({name:r,prefix:t,encode:e,decode:n})=>new po(r,t,e,n),de=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:o}=_i(e,t);return ze({prefix:r,name:t,encode:n,decode:s=>Rt(o(s))})},Wf=(r,t,e,n)=>{let o={};for(let h=0;h<t.length;++h)o[t[h]]=h;let s=r.length;for(;r[s-1]==="=";)--s;let c=new Uint8Array(s*e/8|0),l=0,f=0,d=0;for(let h=0;h<s;++h){let y=o[r[h]];if(y===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<e|y,l+=e,l>=8&&(l-=8,c[d++]=255&f>>l)}if(l>=e||255&f<<8-l)throw new SyntaxError("Unexpected end of data");return c},Zf=(r,t,e)=>{let n=t[t.length-1]==="=",o=(1<<e)-1,s="",c=0,l=0;for(let f=0;f<r.length;++f)for(l=l<<8|r[f],c+=8;c>e;)c-=e,s+=t[o&l>>c];if(c&&(s+=t[o&l<<e-c]),n)for(;s.length*e&7;)s+="=";return s},H=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>ze({prefix:t,name:r,encode(o){return Zf(o,n,e)},decode(o){return Wf(o,n,e,r)}});var Kf=ze({prefix:"\0",name:"identity",encode:r=>ki(r),decode:r=>Ri(r)});var go={};Tt(go,{base2:()=>Qf});var Qf=H({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var yo={};Tt(yo,{base8:()=>Xf});var Xf=H({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var bo={};Tt(bo,{base10:()=>Jf});var Jf=de({prefix:"9",name:"base10",alphabet:"0123456789"});var wo={};Tt(wo,{base16:()=>Yf,base16upper:()=>th});var Yf=H({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),th=H({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Eo={};Tt(Eo,{base32:()=>K,base32hex:()=>oh,base32hexpad:()=>ih,base32hexpadupper:()=>ch,base32hexupper:()=>sh,base32pad:()=>rh,base32padupper:()=>nh,base32upper:()=>eh,base32z:()=>ah});var K=H({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),eh=H({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),rh=H({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),nh=H({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),oh=H({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),sh=H({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ih=H({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ch=H({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ah=H({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var vo={};Tt(vo,{base36:()=>uh,base36upper:()=>lh});var uh=de({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),lh=de({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var So={};Tt(So,{base58btc:()=>N,base58flickr:()=>fh});var N=de({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),fh=de({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var xo={};Tt(xo,{base64:()=>To,base64pad:()=>hh,base64url:()=>ph,base64urlpad:()=>dh});var To=H({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),hh=H({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ph=H({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),dh=H({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ao={};Tt(Ao,{base256emoji:()=>wh});var Li=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}"),mh=Li.reduce((r,t,e)=>(r[e]=t,r),[]),gh=Li.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function yh(r){return r.reduce((t,e)=>(t+=mh[e],t),"")}function bh(r){let t=[];for(let e of r){let n=gh[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var wh=ze({prefix:"\u{1F680}",name:"base256emoji",encode:yh,decode:bh});var Do={};Tt(Do,{sha256:()=>Yr,sha512:()=>Uh});var _o=R(Jt("crypto"),1);var Eh=Ui,Ni=128,vh=127,Sh=~vh,Th=Math.pow(2,31);function Ui(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Th;)t[e++]=r&255|Ni,r/=128;for(;r&Sh;)t[e++]=r&255|Ni,r>>>=7;return t[e]=r|0,Ui.bytes=e-n+1,t}var xh=Io,Ah=128,Mi=127;function Io(r,n){var e=0,n=n||0,o=0,s=n,c,l=r.length;do{if(s>=l)throw Io.bytes=0,new RangeError("Could not decode varint");c=r[s++],e+=o<28?(c&Mi)<<o:(c&Mi)*Math.pow(2,o),o+=7}while(c>=Ah);return Io.bytes=s-n,e}var Ih=Math.pow(2,7),Ch=Math.pow(2,14),Bh=Math.pow(2,21),_h=Math.pow(2,28),Dh=Math.pow(2,35),Rh=Math.pow(2,42),kh=Math.pow(2,49),Oh=Math.pow(2,56),Ph=Math.pow(2,63),Lh=function(r){return r<Ih?1:r<Ch?2:r<Bh?3:r<_h?4:r<Dh?5:r<Rh?6:r<kh?7:r<Oh?8:r<Ph?9:10},Nh={encode:Eh,decode:xh,encodingLength:Lh},Mh=Nh,mr=Mh;var gr=(r,t=0)=>[mr.decode(r,t),mr.decode.bytes],Ve=(r,t,e=0)=>(mr.encode(r,t,e),t),Ge=r=>mr.encodingLength(r);var me=(r,t)=>{let e=t.byteLength,n=Ge(r),o=n+Ge(e),s=new Uint8Array(o+e);return Ve(r,s,0),Ve(e,s,n),s.set(t,o),new He(r,e,t,s)},xt=r=>{let t=Rt(r),[e,n]=gr(t),[o,s]=gr(t.subarray(n)),c=t.subarray(n+s);if(c.byteLength!==o)throw new Error("Incorrect length");return new He(e,o,c,t)},Fi=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Di(r.bytes,e.bytes)}},He=class{constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};var Bo=({name:r,code:t,encode:e})=>new Co(r,t,e),Co=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?me(this.code,e):e.then(n=>me(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Yr=Bo({name:"sha2-256",code:18,encode:r=>Rt(_o.default.createHash("sha256").update(r).digest())}),Uh=Bo({name:"sha2-512",code:19,encode:r=>Rt(_o.default.createHash("sha512").update(r).digest())});var Ro={};Tt(Ro,{identity:()=>tn});var zi=0,Fh="identity",Vi=Rt,$h=r=>me(zi,Vi(r)),tn={code:zi,name:Fh,encode:Vi,digest:$h};var F0=new TextEncoder,$0=new TextDecoder;var Gi=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return Hh(e,ko(r),t||N.encoder);default:return jh(e,ko(r),t||K.encoder)}};var Hi=new WeakMap,ko=r=>{let t=Hi.get(r);if(t==null){let e=new Map;return Hi.set(r,e),e}return t},_=class{constructor(t,e,n,o){this.code=e,this.version=t,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:e}=this;if(t!==yr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==qh)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return _.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=me(t,e);return _.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 _.equals(this,t)}static equals(t,e){let n=e;return n&&t.code===n.code&&t.version===n.version&&Fi(t.multihash,n.multihash)}toString(t){return Gi(this,t)}toJSON(){return{"/":Gi(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 _)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:o,multihash:s,bytes:c}=e;return new _(n,o,s,c||ji(n,o,s.bytes))}else if(e[Wh]===!0){let{version:n,multihash:o,code:s}=e,c=xt(o);return _.create(n,s,c)}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!==yr)throw new Error(`Version 0 CID must use dag-pb (code: ${yr}) block encoding`);return new _(t,e,n,n.bytes)}case 1:{let o=ji(t,e,n.bytes);return new _(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return _.create(0,yr,t)}static createV1(t,e){return _.create(1,t,e)}static decode(t){let[e,n]=_.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=_.inspectBytes(t),n=e.size-e.multihashSize,o=Rt(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let s=o.subarray(e.multihashSize-e.digestSize),c=new He(e.multihashCode,e.digestSize,s,o);return[e.version===0?_.createV0(c):_.createV1(e.codec,c),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[y,E]=gr(t.subarray(e));return e+=E,y},o=n(),s=yr;if(o===18?(o=0,e=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let c=e,l=n(),f=n(),d=e+f,h=d-c;return{version:o,codec:s,multihashCode:l,digestSize:f,multihashSize:h,size:d}}static parse(t,e){let[n,o]=Gh(t,e),s=_.decode(o);if(s.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ko(s).set(n,t),s}},Gh=(r,t)=>{switch(r[0]){case"Q":{let e=t||N;return[N.prefix,e.decode(`${N.prefix}${r}`)]}case N.prefix:{let e=t||N;return[N.prefix,e.decode(r)]}case K.prefix:{let e=t||K;return[K.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)]}}},Hh=(r,t,e)=>{let{prefix:n}=e;if(n!==N.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let o=t.get(n);if(o==null){let s=e.encode(r).slice(1);return t.set(n,s),s}else return o},jh=(r,t,e)=>{let{prefix:n}=e,o=t.get(n);if(o==null){let s=e.encode(r);return t.set(n,s),s}else return o},yr=112,qh=18,ji=(r,t,e)=>{let n=Ge(r),o=n+Ge(t),s=new Uint8Array(o+e.byteLength);return Ve(r,s,0),Ve(t,s,n),s.set(e,o),s},Wh=Symbol.for("@ipld/js-cid/CID");var yt={...mo,...go,...yo,...bo,...wo,...Eo,...vo,...So,...xo,...Ao},Q0={...Do,...Ro};function Ae(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Yt(r=0){return globalThis.Buffer?.alloc!=null?Ae(globalThis.Buffer.alloc(r)):new Uint8Array(r)}function te(r=0){return globalThis.Buffer?.allocUnsafe!=null?Ae(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Wi(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var qi=Wi("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Oo=Wi("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=te(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Zh={utf8:qi,"utf-8":qi,hex:yt.base16,latin1:Oo,ascii:Oo,binary:Oo,...yt},en=Zh;function I(r,t="utf8"){let e=en[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 Zi=Z.isIPv4,Kh=Z.isIPv6,Po=function(r){let t=0;if(r=r.toString().trim(),Zi(r)){let e=new Uint8Array(t+4);return r.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(Kh(r)){let e=r.split(":",8),n;for(n=0;n<e.length;n++){let s=Zi(e[n]),c;s&&(c=Po(e[n]),e[n]=I(c.slice(0,2),"base16")),c!=null&&++n<8&&e.splice(n,0,I(c.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 s=[n,1];for(n=9-e.length;n>0;n--)s.push("0");e.splice.apply(e,s)}let o=new Uint8Array(t+16);for(n=0;n<e.length;n++){let s=parseInt(e[n],16);o[t++]=s>>8&255,o[t++]=s&255}return o}throw new Error("invalid ip address")},Ki=function(r,t=0,e){t=~~t,e=e??r.length-t;let n=new DataView(r.buffer);if(e===4){let o=[];for(let s=0;s<e;s++)o.push(r[t+s]);return o.join(".")}if(e===16){let o=[];for(let s=0;s<e;s+=2)o.push(n.getUint16(t+s).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var br={},Lo={},Xh=[[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"],[281,0,"webrtc-w3c"],[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"]];Xh.forEach(r=>{let t=Jh(...r);Lo[t.code]=t,br[t.name]=t});function Jh(r,t,e,n,o){return{code:r,size:t,name:e,resolvable:!!n,path:!!o}}function z(r){if(typeof r=="number"){if(Lo[r]!=null)return Lo[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(br[r]!=null)return br[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var Ht=R(At(),1);function bt(r,t="utf8"){let e=en[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Ae(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}function D(r,t){t==null&&(t=r.reduce((o,s)=>o+s.length,0));let e=te(t),n=0;for(let o of r)e.set(o,n),n+=o.length;return Ae(e)}function uc(r,t){switch(z(r).code){case 4:case 41:return pp(t);case 42:return cc(t);case 6:case 273:case 33:case 132:return fc(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return cc(t);case 421:return yp(t);case 444:return ac(t);case 445:return ac(t);case 466:return gp(t);default:return I(t,"base16")}}function lc(r,t){switch(z(r).code){case 4:return sc(t);case 41:return sc(t);case 42:return ic(t);case 6:case 273:case 33:case 132:return Fo(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return ic(t);case 421:return dp(t);case 444:return bp(t);case 445:return wp(t);case 466:return mp(t);default:return bt(t,"base16")}}var Uo=Object.values(yt).map(r=>r.decoder),hp=function(){let r=Uo[0].or(Uo[1]);return Uo.slice(2).forEach(t=>r=r.or(t)),r}();function sc(r){if(!ct(r))throw new Error("invalid ip address");return Po(r)}function pp(r){let t=Ki(r,0,r.length);if(t==null)throw new Error("ipBuff is required");if(!ct(t))throw new Error("invalid ip address");return t}function Fo(r){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,r),new Uint8Array(t)}function fc(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function ic(r){let t=bt(r),e=Uint8Array.from(Ht.default.encode(t.length));return D([e,t],e.length+t.length)}function cc(r){let t=Ht.default.decode(r);if(r=r.slice(Ht.default.decode.bytes),r.length!==t)throw new Error("inconsistent lengths");return I(r)}function dp(r){let t;r[0]==="Q"||r[0]==="1"?t=xt(N.decode(`z${r}`)).bytes:t=_.parse(r).multihash.bytes;let e=Uint8Array.from(Ht.default.encode(t.length));return D([e,t],e.length+t.length)}function mp(r){let t=hp.decode(r),e=Uint8Array.from(Ht.default.encode(t.length));return D([e,t],e.length+t.length)}function gp(r){let t=Ht.default.decode(r),e=r.slice(Ht.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return"u"+I(e,"base64url")}function yp(r){let t=Ht.default.decode(r),e=r.slice(Ht.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return I(e,"base58btc")}function bp(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=K.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Fo(n);return D([e,o],e.length+o.length)}function wp(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=K.decode(`b${t[0]}`),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Fo(n);return D([e,o],e.length+o.length)}function ac(r){let t=r.slice(0,r.length-2),e=r.slice(r.length-2),n=I(t,"base32"),o=fc(e);return`${n}:${o}`}var je=R(At(),1);function Ep(r){let t=[],e=r.split("/").slice(1);if(e.length===1&&e[0]==="")return[];for(let n=0;n<e.length;n++){let o=e[n],s=z(o);if(s.size===0){t.push([o]);continue}if(n++,n>=e.length)throw pc("invalid address: "+r);if(s.path===!0){t.push([o,Ho(e.slice(n).join("/"))]);break}t.push([o,e[n]])}return t}function vp(r){let t=[];return r.map(e=>{let n=on(e);return t.push(n.name),e.length>1&&e[1]!=null&&t.push(e[1]),null}),Ho(t.join("/"))}function Sp(r){return r.map(t=>{Array.isArray(t)||(t=[t]);let e=on(t);return t.length>1?[e.code,lc(e.code,t[1])]:[e.code]})}function $o(r){return r.map(t=>{let e=on(t);return t[1]!=null?[e.code,uc(e.code,t[1])]:[e.code]})}function zo(r){return nn(D(r.map(t=>{let e=on(t),n=Uint8Array.from(je.default.encode(e.code));return t.length>1&&t[1]!=null&&(n=D([n,t[1]])),n})))}function Vo(r,t){return r.size>0?r.size/8:r.size===0?0:je.default.decode(t)+(je.default.decode.bytes??0)}function rn(r){let t=[],e=0;for(;e<r.length;){let n=je.default.decode(r,e),o=je.default.decode.bytes??0,s=z(n),c=Vo(s,r.slice(e+o));if(c===0){t.push([n]),e+=o;continue}let l=r.slice(e+o,e+o+c);if(e+=c+o,e>r.length)throw pc("Invalid address Uint8Array: "+I(r,"base16"));t.push([n,l])}return t}function Go(r){let t=rn(r),e=$o(t);return vp(e)}function Tp(r){r=Ho(r);let t=Ep(r),e=Sp(t);return zo(e)}function hc(r){return Tp(r)}function nn(r){let t=xp(r);if(t!=null)throw t;return Uint8Array.from(r)}function xp(r){try{rn(r)}catch(t){return t}}function Ho(r){return"/"+r.trim().split("/").filter(t=>t).join("/")}function pc(r){return new Error("Error parsing address: "+r)}function on(r){return z(r[0])}var qo=R(At(),1);var yc=R(Ie(),1);function It(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 qe=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)},jo=function(r,t,e,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!o:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(r,e):o?o.value=e:t.set(r,e),e},wr,Er,vr,gc,Cp=Symbol.for("nodejs.util.inspect.custom"),Bp=[z("dns").code,z("dns4").code,z("dns6").code,z("dnsaddr").code],_p=new Map,bc=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Dp(r){return!!r?.[bc]}var ee=class{constructor(t){if(wr.set(this,void 0),Er.set(this,void 0),vr.set(this,void 0),this[gc]=!0,t==null&&(t=""),t instanceof Uint8Array)this.bytes=nn(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);this.bytes=hc(t)}else if(Dp(t))this.bytes=nn(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return qe(this,wr,"f")==null&&jo(this,wr,Go(this.bytes),"f"),qe(this,wr,"f")}toJSON(){return this.toString()}toOptions(){let t,e,n,o,s="",c=z("tcp"),l=z("udp"),f=z("ip4"),d=z("ip6"),h=z("dns6"),y=z("ip6zone");for(let[w,g]of this.stringTuples())w===y.code&&(s=`%${g??""}`),Bp.includes(w)&&(e=c.name,o=443,n=`${g??""}${s}`,t=w===h.code?6:4),(w===c.code||w===l.code)&&(e=z(w).name,o=parseInt(g??"")),(w===f.code||w===d.code)&&(e=z(w).name,n=`${g??""}${s}`,t=w===d.code?6:4);if(t==null||e==null||n==null||o==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:t,host:n,transport:e,port:o}}protos(){return this.protoCodes().map(t=>Object.assign({},z(t)))}protoCodes(){let t=[],e=this.bytes,n=0;for(;n<e.length;){let o=qo.default.decode(e,n),s=qo.default.decode.bytes??0,c=z(o),l=Vo(c,e.slice(n+s));n+=l+s,t.push(o)}return t}protoNames(){return this.protos().map(t=>t.name)}tuples(){return qe(this,Er,"f")==null&&jo(this,Er,rn(this.bytes),"f"),qe(this,Er,"f")}stringTuples(){return qe(this,vr,"f")==null&&jo(this,vr,$o(this.tuples()),"f"),qe(this,vr,"f")}encapsulate(t){return t=new ee(t),new ee(this.toString()+t.toString())}decapsulate(t){let e=t.toString(),n=this.toString(),o=n.lastIndexOf(e);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new ee(n.slice(0,o))}decapsulateCode(t){let e=this.tuples();for(let n=e.length-1;n>=0;n--)if(e[n][0]===t)return new ee(zo(e.slice(0,n)));return this}getPeerId(){try{let e=this.stringTuples().filter(n=>n[0]===br.ipfs.code).pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?I(N.decode(`z${n}`),"base58btc"):I(_.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){let t=null;try{t=this.stringTuples().filter(e=>z(e[0]).path===!0)[0][1],t==null&&(t=null)}catch{t=null}return t}equals(t){return It(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(s=>s.resolvable);if(e==null)return[this];let n=_p.get(e.name);if(n==null)throw(0,yc.default)(new Error(`no available resolver for ${e.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(s=>new ee(s))}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)}[(wr=new WeakMap,Er=new WeakMap,vr=new WeakMap,gc=bc,Cp)](){return`Multiaddr(${Go(this.bytes)})`}};function Wo(r){return new ee(r)}var Rp=x("dns4"),kp=x("dns6"),Op=x("dnsaddr"),Ce=ot(x("dns"),Op,Rp,kp),sn=ot(x("ip4"),x("ip6")),ye=ot(C(sn,x("tcp")),C(Ce,x("tcp"))),Qo=C(sn,x("udp")),Pp=C(Qo,x("utp")),Lp=C(Qo,x("quic")),Tr=ot(C(ye,x("ws")),C(Ce,x("ws"))),xr=ot(C(ye,x("wss")),C(Ce,x("wss")),C(ye,x("tls"),x("ws")),C(Ce,x("tls"),x("ws"))),Zo=ot(C(ye,x("http")),C(sn,x("http")),C(Ce,x("http"))),Ko=ot(C(ye,x("https")),C(sn,x("https")),C(Ce,x("https"))),wc=C(Qo,x("webrtc"),x("certhash")),vc=ot(C(wc,x("p2p")),wc),Sc=ot(C(Tr,x("p2p-webrtc-star"),x("p2p")),C(xr,x("p2p-webrtc-star"),x("p2p")),C(Tr,x("p2p-webrtc-star")),C(xr,x("p2p-webrtc-star"))),Vg=ot(C(Tr,x("p2p-websocket-star"),x("p2p")),C(xr,x("p2p-websocket-star"),x("p2p")),C(Tr,x("p2p-websocket-star")),C(xr,x("p2p-websocket-star"))),Tc=ot(C(Zo,x("p2p-webrtc-direct"),x("p2p")),C(Ko,x("p2p-webrtc-direct"),x("p2p")),C(Zo,x("p2p-webrtc-direct")),C(Ko,x("p2p-webrtc-direct"))),Ar=ot(Tr,xr,Zo,Ko,Sc,Tc,ye,Pp,Lp,Ce,vc),Gg=ot(C(Ar,x("p2p-stardust"),x("p2p")),C(Ar,x("p2p-stardust"))),ge=ot(C(Ar,x("p2p")),Sc,Tc,vc,x("p2p")),Ec=ot(C(ge,x("p2p-circuit"),ge),C(ge,x("p2p-circuit")),C(x("p2p-circuit"),ge),C(Ar,x("p2p-circuit")),C(x("p2p-circuit"),Ar),x("p2p-circuit")),xc=()=>ot(C(Ec,xc),Ec),Sr=xc(),Hg=ot(C(Sr,ge,Sr),C(ge,Sr),C(Sr,ge),Sr,ge);function Ac(r){function t(e){let n;try{n=Wo(e)}catch{return!1}let o=r(n.protoNames());return o===null?!1:o===!0||o===!1?o:o.length===0}return t}function C(...r){function t(e){if(e.length<r.length)return null;let n=e;return r.some(o=>(n=typeof o=="function"?o().partialMatch(e):o.partialMatch(e),Array.isArray(n)&&(e=n),n===null)),n}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:Ac(t),partialMatch:t}}function ot(...r){function t(n){let o=null;return r.some(s=>{let c=typeof s=="function"?s().partialMatch(n):s.partialMatch(n);return c!=null?(o=c,!0):!1}),o}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:Ac(t),partialMatch:t}}function x(r){let t=r;function e(o){let s;try{s=Wo(o)}catch{return!1}let c=s.protoNames();return c.length===1&&c[0]===t}function n(o){return o.length===0?null:o[0]===t?o.slice(1):null}return{toString:function(){return t},matches:e,partialMatch:n}}var jt=R(Nc(),1);jt.default.formatters.b=r=>r==null?"undefined":N.baseEncode(r);jt.default.formatters.t=r=>r==null?"undefined":K.baseEncode(r);jt.default.formatters.m=r=>r==null?"undefined":To.baseEncode(r);jt.default.formatters.p=r=>r==null?"undefined":r.toString();jt.default.formatters.c=r=>r==null?"undefined":r.toString();jt.default.formatters.k=r=>r==null?"undefined":r.toString();function ut(r){return Object.assign((0,jt.default)(r),{error:(0,jt.default)(`${r}:error`),trace:(0,jt.default)(`${r}:trace`)})}var Pa=R(Hc(),1);var jc=Z.isIPv4,ld=Z.isIPv6,rs=function(r){let t=0;if(r=r.toString().trim(),jc(r)){let e=new Uint8Array(t+4);return r.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(ld(r)){let e=r.split(":",8),n;for(n=0;n<e.length;n++){let s=jc(e[n]),c;s&&(c=rs(e[n]),e[n]=I(c.slice(0,2),"base16")),c!=null&&++n<8&&e.splice(n,0,I(c.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 s=[n,1];for(n=9-e.length;n>0;n--)s.push("0");e.splice.apply(e,s)}let o=new Uint8Array(t+16);for(n=0;n<e.length;n++){let s=parseInt(e[n],16);o[t++]=s>>8&255,o[t++]=s&255}return o}throw new Error("invalid ip address")},qc=function(r,t=0,e){t=~~t,e=e??r.length-t;let n=new DataView(r.buffer);if(e===4){let o=[];for(let s=0;s<e;s++)o.push(r[t+s]);return o.join(".")}if(e===16){let o=[];for(let s=0;s<e;s+=2)o.push(n.getUint16(t+s).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Ir={},ns={},hd=[[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"],[281,0,"webrtc-w3c"],[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"]];hd.forEach(r=>{let t=pd(...r);ns[t.code]=t,Ir[t.name]=t});function pd(r,t,e,n,o){return{code:r,size:t,name:e,resolvable:!!n,path:!!o}}function V(r){if(typeof r=="number"){if(ns[r]!=null)return ns[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(Ir[r]!=null)return Ir[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var qt=R(At(),1);function Xc(r,t){switch(V(r).code){case 4:case 41:return md(t);case 42:return Kc(t);case 6:case 273:case 33:case 132:return Yc(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Kc(t);case 421:return wd(t);case 444:return Qc(t);case 445:return Qc(t);case 466:return bd(t);default:return I(t,"base16")}}function Jc(r,t){switch(V(r).code){case 4:return Wc(t);case 41:return Wc(t);case 42:return Zc(t);case 6:case 273:case 33:case 132:return ss(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Zc(t);case 421:return gd(t);case 444:return Ed(t);case 445:return vd(t);case 466:return yd(t);default:return bt(t,"base16")}}var os=Object.values(yt).map(r=>r.decoder),dd=function(){let r=os[0].or(os[1]);return os.slice(2).forEach(t=>r=r.or(t)),r}();function Wc(r){if(!ct(r))throw new Error("invalid ip address");return rs(r)}function md(r){let t=qc(r,0,r.length);if(t==null)throw new Error("ipBuff is required");if(!ct(t))throw new Error("invalid ip address");return t}function ss(r){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,r),new Uint8Array(t)}function Yc(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Zc(r){let t=bt(r),e=Uint8Array.from(qt.default.encode(t.length));return D([e,t],e.length+t.length)}function Kc(r){let t=qt.default.decode(r);if(r=r.slice(qt.default.decode.bytes),r.length!==t)throw new Error("inconsistent lengths");return I(r)}function gd(r){let t;r[0]==="Q"||r[0]==="1"?t=xt(N.decode(`z${r}`)).bytes:t=_.parse(r).multihash.bytes;let e=Uint8Array.from(qt.default.encode(t.length));return D([e,t],e.length+t.length)}function yd(r){let t=dd.decode(r),e=Uint8Array.from(qt.default.encode(t.length));return D([e,t],e.length+t.length)}function bd(r){let t=qt.default.decode(r),e=r.slice(qt.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return"u"+I(e,"base64url")}function wd(r){let t=qt.default.decode(r),e=r.slice(qt.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return I(e,"base58btc")}function Ed(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=K.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=ss(n);return D([e,o],e.length+o.length)}function vd(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=K.decode(`b${t[0]}`),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=ss(n);return D([e,o],e.length+o.length)}function Qc(r){let t=r.slice(0,r.length-2),e=r.slice(r.length-2),n=I(t,"base32"),o=Yc(e);return`${n}:${o}`}var Je=R(At(),1);function Sd(r){let t=[],e=r.split("/").slice(1);if(e.length===1&&e[0]==="")return[];for(let n=0;n<e.length;n++){let o=e[n],s=V(o);if(s.size===0){t.push([o]);continue}if(n++,n>=e.length)throw ea("invalid address: "+r);if(s.path===!0){t.push([o,ls(e.slice(n).join("/"))]);break}t.push([o,e[n]])}return t}function Td(r){let t=[];return r.map(e=>{let n=dn(e);return t.push(n.name),e.length>1&&e[1]!=null&&t.push(e[1]),null}),ls(t.join("/"))}function xd(r){return r.map(t=>{Array.isArray(t)||(t=[t]);let e=dn(t);return t.length>1?[e.code,Jc(e.code,t[1])]:[e.code]})}function is(r){return r.map(t=>{let e=dn(t);return t[1]!=null?[e.code,Xc(e.code,t[1])]:[e.code]})}function cs(r){return pn(D(r.map(t=>{let e=dn(t),n=Uint8Array.from(Je.default.encode(e.code));return t.length>1&&t[1]!=null&&(n=D([n,t[1]])),n})))}function as(r,t){return r.size>0?r.size/8:r.size===0?0:Je.default.decode(t)+(Je.default.decode.bytes??0)}function hn(r){let t=[],e=0;for(;e<r.length;){let n=Je.default.decode(r,e),o=Je.default.decode.bytes??0,s=V(n),c=as(s,r.slice(e+o));if(c===0){t.push([n]),e+=o;continue}let l=r.slice(e+o,e+o+c);if(e+=c+o,e>r.length)throw ea("Invalid address Uint8Array: "+I(r,"base16"));t.push([n,l])}return t}function us(r){let t=hn(r),e=is(t);return Td(e)}function Ad(r){r=ls(r);let t=Sd(r),e=xd(t);return cs(e)}function ta(r){return Ad(r)}function pn(r){let t=Id(r);if(t!=null)throw t;return Uint8Array.from(r)}function Id(r){try{hn(r)}catch(t){return t}}function ls(r){return"/"+r.trim().split("/").filter(t=>t).join("/")}function ea(r){return new Error("Error parsing address: "+r)}function dn(r){return V(r[0])}var hs=R(At(),1);var na=R(Ie(),1);var Ye=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)},fs=function(r,t,e,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!o:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(r,e):o?o.value=e:t.set(r,e),e},Cr,Br,_r,ra,Bd=Symbol.for("nodejs.util.inspect.custom"),_d=[V("dns").code,V("dns4").code,V("dns6").code,V("dnsaddr").code],Dd=new Map,oa=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Rd(r){return!!r?.[oa]}var re=class{constructor(t){if(Cr.set(this,void 0),Br.set(this,void 0),_r.set(this,void 0),this[ra]=!0,t==null&&(t=""),t instanceof Uint8Array)this.bytes=pn(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);this.bytes=ta(t)}else if(Rd(t))this.bytes=pn(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return Ye(this,Cr,"f")==null&&fs(this,Cr,us(this.bytes),"f"),Ye(this,Cr,"f")}toJSON(){return this.toString()}toOptions(){let t,e,n,o,s="",c=V("tcp"),l=V("udp"),f=V("ip4"),d=V("ip6"),h=V("dns6"),y=V("ip6zone");for(let[w,g]of this.stringTuples())w===y.code&&(s=`%${g??""}`),_d.includes(w)&&(e=c.name,o=443,n=`${g??""}${s}`,t=w===h.code?6:4),(w===c.code||w===l.code)&&(e=V(w).name,o=parseInt(g??"")),(w===f.code||w===d.code)&&(e=V(w).name,n=`${g??""}${s}`,t=w===d.code?6:4);if(t==null||e==null||n==null||o==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:t,host:n,transport:e,port:o}}protos(){return this.protoCodes().map(t=>Object.assign({},V(t)))}protoCodes(){let t=[],e=this.bytes,n=0;for(;n<e.length;){let o=hs.default.decode(e,n),s=hs.default.decode.bytes??0,c=V(o),l=as(c,e.slice(n+s));n+=l+s,t.push(o)}return t}protoNames(){return this.protos().map(t=>t.name)}tuples(){return Ye(this,Br,"f")==null&&fs(this,Br,hn(this.bytes),"f"),Ye(this,Br,"f")}stringTuples(){return Ye(this,_r,"f")==null&&fs(this,_r,is(this.tuples()),"f"),Ye(this,_r,"f")}encapsulate(t){return t=new re(t),new re(this.toString()+t.toString())}decapsulate(t){let e=t.toString(),n=this.toString(),o=n.lastIndexOf(e);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new re(n.slice(0,o))}decapsulateCode(t){let e=this.tuples();for(let n=e.length-1;n>=0;n--)if(e[n][0]===t)return new re(cs(e.slice(0,n)));return this}getPeerId(){try{let e=this.stringTuples().filter(n=>n[0]===Ir.ipfs.code).pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?I(N.decode(`z${n}`),"base58btc"):I(_.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){let t=null;try{t=this.stringTuples().filter(e=>V(e[0]).path===!0)[0][1],t==null&&(t=null)}catch{t=null}return t}equals(t){return It(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(s=>s.resolvable);if(e==null)return[this];let n=Dd.get(e.name);if(n==null)throw(0,na.default)(new Error(`no available resolver for ${e.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(s=>new re(s))}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)}[(Cr=new WeakMap,Br=new WeakMap,_r=new WeakMap,ra=oa,Bd)](){return`Multiaddr(${us(this.bytes)})`}};function mn(r){return new re(r)}var Tn=R(Ie(),1);function gn(r){return this.subnetMask<r.subnetMask?!1:this.mask(r.subnetMask)===r.mask()}function yn(r){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===r&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}var tr=/^(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,ps=/\/\d{1,2}$/;var lt=class extends Error{constructor(t,e){super(t),this.name="AddressError",e!==null&&(this.parseMessage=e)}};var er=R(ds(),1),_e=R(Dr(),1),F=class{constructor(t){this.groups=4,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=yn(32),this.isInSubnet=gn,this.address=t;let e=ps.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 lt("Invalid subnet mask.");t=t.replace(ps,"")}this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}static isValid(t){try{return new F(t),!0}catch{return!1}}parse(t){let e=t.split(".");if(!t.match(tr))throw new lt("Invalid IPv4 address.");return e}correctForm(){return this.parsedAddress.map(t=>parseInt(t,10)).join(".")}static fromHex(t){let e=t.replace(/:/g,"").padStart(8,"0"),n=[],o;for(o=0;o<8;o+=2){let s=e.slice(o,o+2);n.push(parseInt(s,16))}return new F(n.join("."))}static fromInteger(t){return F.fromHex(t.toString(16))}static fromArpa(t){let n=t.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new F(n)}toHex(){return this.parsedAddress.map(t=>(0,_e.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,_e.sprintf)("%02x%02x",parseInt(this.parsedAddress[e],10),parseInt(this.parsedAddress[e+1],10));t.push((0,_e.sprintf)("%x",parseInt(n,16)))}return t.join(":")}bigInteger(){return new er.BigInteger(this.parsedAddress.map(t=>(0,_e.sprintf)("%02x",parseInt(t,10))).join(""),16)}_startAddress(){return new er.BigInteger(this.mask()+"0".repeat(32-this.subnetMask),2)}startAddress(){return F.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new er.BigInteger("1");return F.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new er.BigInteger(this.mask()+"1".repeat(32-this.subnetMask),2)}endAddress(){return F.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new er.BigInteger("1");return F.fromBigInteger(this._endAddress().subtract(t))}static fromBigInteger(t){return F.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,_e.sprintf)("%s.in-addr.arpa.",e)}isMulticast(){return this.isInSubnet(new F("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(32,"0")}groupForV6(){let t=this.parsedAddress;return this.address.replace(tr,(0,_e.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 ua={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},ms={"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"},gs=/([^0-9a-f:/%])/gi,ys=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,bs=/\/\d{1,3}(?=%|$)/,ws=/%.*$/,la=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),fa=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/);var pa=R(Dr(),1);function kd(r){return r.replace(/^(0+)/,'<span class="zero">$1</span>')}function En(r,t=0){return r.split(":").map((n,o)=>/group-v4/.test(n)?n:(0,pa.sprintf)('<span class="hover-group group-%d">%s</span>',o+t,kd(n)))}var Re=R(Dr(),1);function vs(r){return(0,Re.sprintf)("(%s)",r.join("|"))}function Es(r){return r.length<4?(0,Re.sprintf)("0{0,%d}%s",4-r.length,r):r}var Ss="[^A-Fa-f0-9:]";function vn(r){let t=[];r.forEach((n,o)=>{parseInt(n,16)===0&&t.push(o)});let e=t.map(n=>r.map((o,s)=>{if(s===n){let c=s===0||s===8-1?":":"";return vs([Es(o),c])}return Es(o)}).join(":"));return e.push(r.map(Es).join(":")),vs(e)}function Ts(r,t,e){let n=t?"":":",o=e?"":":",s=[];!t&&!e&&s.push("::"),t&&e&&s.push(""),(e&&!t||!e&&t)&&s.push(":"),s.push((0,Re.sprintf)("%s(:0{1,4}){1,%d}",n,r-1)),s.push((0,Re.sprintf)("(0{1,4}:){1,%d}%s",r-1,o)),s.push((0,Re.sprintf)("(0{1,4}:){%d}0{1,4}",r-1));for(let c=1;c<r-1;c++)for(let l=1;l<r-c;l++)s.push((0,Re.sprintf)("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",l,r-l-c-1));return vs(s)}var ft=R(ds(),1),ht=R(Dr(),1);function Sn(r){if(!r)throw new Error("Assertion failed.")}function Od(r){let t=/(\d+)(\d{3})/;for(;t.test(r);)r=r.replace(t,"$1,$2");return r}function Pd(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 Ld(r,t){let e=[],n=[],o;for(o=0;o<r.length;o++)o<t[0]?e.push(r[o]):o>t[1]&&n.push(r[o]);return e.concat(["compact"]).concat(n)}function ma(r){return(0,ht.sprintf)("%04x",parseInt(r,16))}function ga(r){return r&255}var j=class{constructor(t,e){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=gn,this.isCorrect=yn(128),e===void 0?this.groups=8:this.groups=e,this.address=t;let n=bs.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 lt("Invalid subnet mask.");t=t.replace(bs,"")}else if(/\//.test(t))throw new lt("Invalid subnet mask.");let o=ws.exec(t);o&&(this.zone=o[0],t=t.replace(ws,"")),this.addressMinusSuffix=t,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(t){try{return new j(t),!0}catch{return!1}}static fromBigInteger(t){let e=t.toString(16).padStart(32,"0"),n=[],o;for(o=0;o<8;o++)n.push(e.slice(o*4,(o+1)*4));return new j(n.join(":"))}static fromURL(t){let e,n=null,o;if(t.indexOf("[")!==-1&&t.indexOf("]:")!==-1){if(o=fa.exec(t),o===null)return{error:"failed to parse address with port",address:null,port:null};e=o[1],n=o[2]}else if(t.indexOf("/")!==-1){if(t=t.replace(/^[a-z0-9]+:\/\//,""),o=la.exec(t),o===null)return{error:"failed to parse address from URL",address:null,port:null};e=o[1]}else e=t;return n?(n=parseInt(n,10),(n<0||n>65536)&&(n=null)):n=null,{address:new j(e),port:n}}static fromAddress4(t){let e=new F(t),n=128-(32-e.subnetMask);return new j(`::ffff:${e.correctForm()}/${n}`)}static fromArpa(t){let e=t.replace(/(\.ip6\.arpa)?\.$/,""),n=7;if(e.length!==63)throw new lt("Invalid 'ip6.arpa' form.");let o=e.split(".").reverse();for(let s=n;s>0;s--){let c=s*4;o.splice(c,0,":")}return e=o.join(""),new j(e)}microsoftTranscription(){return(0,ht.sprintf)("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))}mask(t=this.subnetMask){return this.getBitsBase2(0,t)}possibleSubnets(t=128){let e=128-this.subnetMask,n=Math.abs(t-128),o=e-n;return o<0?"0":Od(new ft.BigInteger("2",10).pow(o).toString(10))}_startAddress(){return new ft.BigInteger(this.mask()+"0".repeat(128-this.subnetMask),2)}startAddress(){return j.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new ft.BigInteger("1");return j.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new ft.BigInteger(this.mask()+"1".repeat(128-this.subnetMask),2)}endAddress(){return j.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new ft.BigInteger("1");return j.fromBigInteger(this._endAddress().subtract(t))}getScope(){let t=ua[this.getBits(12,16).intValue()];return this.getType()==="Global unicast"&&t!=="Link local"&&(t="Global"),t||"Unknown"}getType(){for(let t of Object.keys(ms))if(this.isInSubnet(new j(t)))return ms[t];return"Global unicast"}getBits(t,e){return new ft.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,ht.sprintf)("%s.ip6.arpa.",n):t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,e=[],n=0,o=[];for(t=0;t<this.parsedAddress.length;t++){let l=parseInt(this.parsedAddress[t],16);l===0&&n++,l!==0&&n>0&&(n>1&&o.push([t-n,t-1]),n=0)}n>1&&o.push([this.parsedAddress.length-n,this.parsedAddress.length-1]);let s=o.map(l=>l[1]-l[0]+1);if(o.length>0){let l=s.indexOf(Math.max(...s));e=Ld(this.parsedAddress,o[l])}else e=this.parsedAddress;for(t=0;t<e.length;t++)e[t]!=="compact"&&(e[t]=parseInt(e[t],16).toString(16));let c=e.join(":");return c=c.replace(/^compact$/,"::"),c=c.replace(/^compact|compact$/,":"),c=c.replace(/compact/,""),c}binaryZeroPad(){return this.bigInteger().toString(2).padStart(128,"0")}parse4in6(t){let e=t.split(":"),o=e.slice(-1)[0].match(tr);if(o){this.parsedAddress4=o[0],this.address4=new F(this.parsedAddress4);for(let s=0;s<this.address4.groups;s++)if(/^0[0-9]+/.test(this.address4.parsedAddress[s]))throw new lt("IPv4 addresses can't have leading zeroes.",t.replace(tr,this.address4.parsedAddress.map(Pd).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(gs);if(e)throw new lt((0,ht.sprintf)("Bad character%s detected in address: %s",e.length>1?"s":"",e.join("")),t.replace(gs,'<span class="parse-error">$1</span>'));let n=t.match(ys);if(n)throw new lt((0,ht.sprintf)("Address failed regex: %s",n.join("")),t.replace(ys,'<span class="parse-error">$1</span>'));let o=[],s=t.split("::");if(s.length===2){let c=s[0].split(":"),l=s[1].split(":");c.length===1&&c[0]===""&&(c=[]),l.length===1&&l[0]===""&&(l=[]);let f=this.groups-(c.length+l.length);if(!f)throw new lt("Error parsing groups");this.elidedGroups=f,this.elisionBegin=c.length,this.elisionEnd=c.length+this.elidedGroups,o=o.concat(c);for(let d=0;d<f;d++)o.push("0");o=o.concat(l)}else if(s.length===1)o=t.split(":"),this.elidedGroups=0;else throw new lt("Too many :: groups found");if(o=o.map(c=>(0,ht.sprintf)("%x",parseInt(c,16))),o.length!==this.groups)throw new lt("Incorrect number of groups found");return o}canonicalForm(){return this.parsedAddress.map(ma).join(":")}decimal(){return this.parsedAddress.map(t=>(0,ht.sprintf)("%05d",parseInt(t,16))).join(":")}bigInteger(){return new ft.BigInteger(this.parsedAddress.map(ma).join(""),16)}to4(){let t=this.binaryZeroPad().split("");return F.fromHex(new ft.BigInteger(t.slice(96,128).join(""),2).toString(16))}to4in6(){let t=this.to4(),n=new j(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),o="";return/:$/.test(n)||(o=":"),n+o+t.address}inspectTeredo(){let t=this.getBitsBase16(0,32),e=this.getBits(80,96).xor(new ft.BigInteger("ffff",16)).toString(),n=F.fromHex(this.getBitsBase16(32,64)),o=F.fromHex(this.getBits(96,128).xor(new ft.BigInteger("ffffffff",16)).toString(16)),s=this.getBits(64,80),c=this.getBitsBase2(64,80),l=s.testBit(15),f=s.testBit(14),d=s.testBit(8),h=s.testBit(9),y=new ft.BigInteger(c.slice(2,6)+c.slice(8,16),2).toString(10);return{prefix:(0,ht.sprintf)("%s:%s",t.slice(0,4),t.slice(4,8)),server4:n.address,client4:o.address,flags:c,coneNat:l,microsoft:{reserved:f,universalLocal:h,groupIndividual:d,nonce:y},udpPort:e}}inspect6to4(){let t=this.getBitsBase16(0,16),e=F.fromHex(this.getBitsBase16(16,48));return{prefix:(0,ht.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 j(t)}toByteArray(){let t=this.bigInteger().toByteArray();return t.length===17&&t[0]===0?t.slice(1):t}toUnsignedByteArray(){return this.toByteArray().map(ga)}static fromByteArray(t){return this.fromUnsignedByteArray(t.map(ga))}static fromUnsignedByteArray(t){let e=new ft.BigInteger("256",10),n=new ft.BigInteger("0",10),o=new ft.BigInteger("1",10);for(let s=t.length-1;s>=0;s--)n=n.add(o.multiply(new ft.BigInteger(t[s].toString(10),10))),o=o.multiply(e);return j.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 j("2001::/32"))}is6to4(){return this.isInSubnet(new j("2002::/16"))}isLoopback(){return this.getType()==="Loopback"}href(t){return t===void 0?t="":t=(0,ht.sprintf)(":%s",t),(0,ht.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,ht.sprintf)('<a href="%1$s%2$s" class="%3$s">%2$s</a>',t.prefix,e.call(this),t.className):(0,ht.sprintf)('<a href="%1$s%2$s">%2$s</a>',t.prefix,e.call(this))}group(){if(this.elidedGroups===0)return En(this.address).join(":");Sn(typeof this.elidedGroups=="number"),Sn(typeof this.elisionBegin=="number");let t=[],[e,n]=this.address.split("::");e.length?t.push(...En(e)):t.push("");let o=["hover-group"];for(let s=this.elisionBegin;s<this.elisionBegin+this.elidedGroups;s++)o.push((0,ht.sprintf)("group-%d",s));return t.push((0,ht.sprintf)('<span class="%s"></span>',o.join(" "))),n.length?t.push(...En(n,this.elisionEnd)):t.push(""),this.is4()&&(Sn(this.address4 instanceof F),t.pop(),t.push(this.address4.groupForV6())),t.join(":")}regularExpressionString(t=!1){let e=[],n=new j(this.correctForm());if(n.elidedGroups===0)e.push(vn(n.parsedAddress));else if(n.elidedGroups===8)e.push(Ts(8));else{let o=n.address.split("::");o[0].length&&e.push(vn(o[0].split(":"))),Sn(typeof n.elidedGroups=="number"),e.push(Ts(n.elidedGroups,o[0].length!==0,o[1].length!==0)),o[1].length&&e.push(vn(o[1].split(":"))),e=[e.join(":")]}return t||(e=["(?=^|",Ss,"|[^\\w\\:])(",...e,")(?=[^\\w\\:]|",Ss,"|$)"]),e.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};var Nd=ut("libp2p:ip-port-to-multiaddr"),xs={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};function ya(r,t){if(typeof r!="string")throw(0,Tn.default)(new Error(`invalid ip provided: ${r}`),xs.ERR_INVALID_IP_PARAMETER);if(typeof t=="string"&&(t=parseInt(t)),isNaN(t))throw(0,Tn.default)(new Error(`invalid port provided: ${t}`),xs.ERR_INVALID_PORT_PARAMETER);try{return new F(r),mn(`/ip4/${r}/tcp/${t}`)}catch{}try{let e=new j(r);return e.is4()?mn(`/ip4/${e.to4().correctForm()}/tcp/${t}`):mn(`/ip6/${r}/tcp/${t}`)}catch{let n=`invalid ip:port for creating a multiaddr: ${r}:${t}`;throw Nd.error(n),(0,Tn.default)(new Error(n),xs.ERR_INVALID_IP)}}var ba=Z.isIPv4,Md=Z.isIPv6,As=function(r){let t=0;if(r=r.toString().trim(),ba(r)){let e=new Uint8Array(t+4);return r.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(Md(r)){let e=r.split(":",8),n;for(n=0;n<e.length;n++){let s=ba(e[n]),c;s&&(c=As(e[n]),e[n]=I(c.slice(0,2),"base16")),c!=null&&++n<8&&e.splice(n,0,I(c.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 s=[n,1];for(n=9-e.length;n>0;n--)s.push("0");e.splice.apply(e,s)}let o=new Uint8Array(t+16);for(n=0;n<e.length;n++){let s=parseInt(e[n],16);o[t++]=s>>8&255,o[t++]=s&255}return o}throw new Error("invalid ip address")},wa=function(r,t=0,e){t=~~t,e=e??r.length-t;let n=new DataView(r.buffer);if(e===4){let o=[];for(let s=0;s<e;s++)o.push(r[t+s]);return o.join(".")}if(e===16){let o=[];for(let s=0;s<e;s+=2)o.push(n.getUint16(t+s).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Rr={},Is={},Fd=[[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"],[281,0,"webrtc-w3c"],[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"]];Fd.forEach(r=>{let t=$d(...r);Is[t.code]=t,Rr[t.name]=t});function $d(r,t,e,n,o){return{code:r,size:t,name:e,resolvable:!!n,path:!!o}}function G(r){if(typeof r=="number"){if(Is[r]!=null)return Is[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(Rr[r]!=null)return Rr[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var Wt=R(At(),1);function xa(r,t){switch(G(r).code){case 4:case 41:return Vd(t);case 42:return Sa(t);case 6:case 273:case 33:case 132:return Ia(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Sa(t);case 421:return qd(t);case 444:return Ta(t);case 445:return Ta(t);case 466:return jd(t);default:return I(t,"base16")}}function Aa(r,t){switch(G(r).code){case 4:return Ea(t);case 41:return Ea(t);case 42:return va(t);case 6:case 273:case 33:case 132:return Bs(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return va(t);case 421:return Gd(t);case 444:return Wd(t);case 445:return Zd(t);case 466:return Hd(t);default:return bt(t,"base16")}}var Cs=Object.values(yt).map(r=>r.decoder),zd=function(){let r=Cs[0].or(Cs[1]);return Cs.slice(2).forEach(t=>r=r.or(t)),r}();function Ea(r){if(!ct(r))throw new Error("invalid ip address");return As(r)}function Vd(r){let t=wa(r,0,r.length);if(t==null)throw new Error("ipBuff is required");if(!ct(t))throw new Error("invalid ip address");return t}function Bs(r){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,r),new Uint8Array(t)}function Ia(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function va(r){let t=bt(r),e=Uint8Array.from(Wt.default.encode(t.length));return D([e,t],e.length+t.length)}function Sa(r){let t=Wt.default.decode(r);if(r=r.slice(Wt.default.decode.bytes),r.length!==t)throw new Error("inconsistent lengths");return I(r)}function Gd(r){let t;r[0]==="Q"||r[0]==="1"?t=xt(N.decode(`z${r}`)).bytes:t=_.parse(r).multihash.bytes;let e=Uint8Array.from(Wt.default.encode(t.length));return D([e,t],e.length+t.length)}function Hd(r){let t=zd.decode(r),e=Uint8Array.from(Wt.default.encode(t.length));return D([e,t],e.length+t.length)}function jd(r){let t=Wt.default.decode(r),e=r.slice(Wt.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return"u"+I(e,"base64url")}function qd(r){let t=Wt.default.decode(r),e=r.slice(Wt.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return I(e,"base58btc")}function Wd(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=K.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Bs(n);return D([e,o],e.length+o.length)}function Zd(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=K.decode(`b${t[0]}`),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Bs(n);return D([e,o],e.length+o.length)}function Ta(r){let t=r.slice(0,r.length-2),e=r.slice(r.length-2),n=I(t,"base32"),o=Ia(e);return`${n}:${o}`}var nr=R(At(),1);function Kd(r){let t=[],e=r.split("/").slice(1);if(e.length===1&&e[0]==="")return[];for(let n=0;n<e.length;n++){let o=e[n],s=G(o);if(s.size===0){t.push([o]);continue}if(n++,n>=e.length)throw Ba("invalid address: "+r);if(s.path===!0){t.push([o,Os(e.slice(n).join("/"))]);break}t.push([o,e[n]])}return t}function Qd(r){let t=[];return r.map(e=>{let n=In(e);return t.push(n.name),e.length>1&&e[1]!=null&&t.push(e[1]),null}),Os(t.join("/"))}function Xd(r){return r.map(t=>{Array.isArray(t)||(t=[t]);let e=In(t);return t.length>1?[e.code,Aa(e.code,t[1])]:[e.code]})}function _s(r){return r.map(t=>{let e=In(t);return t[1]!=null?[e.code,xa(e.code,t[1])]:[e.code]})}function Ds(r){return An(D(r.map(t=>{let e=In(t),n=Uint8Array.from(nr.default.encode(e.code));return t.length>1&&t[1]!=null&&(n=D([n,t[1]])),n})))}function Rs(r,t){return r.size>0?r.size/8:r.size===0?0:nr.default.decode(t)+(nr.default.decode.bytes??0)}function xn(r){let t=[],e=0;for(;e<r.length;){let n=nr.default.decode(r,e),o=nr.default.decode.bytes??0,s=G(n),c=Rs(s,r.slice(e+o));if(c===0){t.push([n]),e+=o;continue}let l=r.slice(e+o,e+o+c);if(e+=c+o,e>r.length)throw Ba("Invalid address Uint8Array: "+I(r,"base16"));t.push([n,l])}return t}function ks(r){let t=xn(r),e=_s(t);return Qd(e)}function Jd(r){r=Os(r);let t=Kd(r),e=Xd(t);return Ds(e)}function Ca(r){return Jd(r)}function An(r){let t=Yd(r);if(t!=null)throw t;return Uint8Array.from(r)}function Yd(r){try{xn(r)}catch(t){return t}}function Os(r){return"/"+r.trim().split("/").filter(t=>t).join("/")}function Ba(r){return new Error("Error parsing address: "+r)}function In(r){return G(r[0])}var Ls=R(At(),1);var Da=R(Ie(),1);var or=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)},Ps=function(r,t,e,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!o:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(r,e):o?o.value=e:t.set(r,e),e},kr,Or,Pr,_a,em=Symbol.for("nodejs.util.inspect.custom"),rm=[G("dns").code,G("dns4").code,G("dns6").code,G("dnsaddr").code],nm=new Map,Ra=Symbol.for("@multiformats/js-multiaddr/multiaddr");function om(r){return!!r?.[Ra]}var oe=class{constructor(t){if(kr.set(this,void 0),Or.set(this,void 0),Pr.set(this,void 0),this[_a]=!0,t==null&&(t=""),t instanceof Uint8Array)this.bytes=An(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);this.bytes=Ca(t)}else if(om(t))this.bytes=An(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return or(this,kr,"f")==null&&Ps(this,kr,ks(this.bytes),"f"),or(this,kr,"f")}toJSON(){return this.toString()}toOptions(){let t,e,n,o,s="",c=G("tcp"),l=G("udp"),f=G("ip4"),d=G("ip6"),h=G("dns6"),y=G("ip6zone");for(let[w,g]of this.stringTuples())w===y.code&&(s=`%${g??""}`),rm.includes(w)&&(e=c.name,o=443,n=`${g??""}${s}`,t=w===h.code?6:4),(w===c.code||w===l.code)&&(e=G(w).name,o=parseInt(g??"")),(w===f.code||w===d.code)&&(e=G(w).name,n=`${g??""}${s}`,t=w===d.code?6:4);if(t==null||e==null||n==null||o==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:t,host:n,transport:e,port:o}}protos(){return this.protoCodes().map(t=>Object.assign({},G(t)))}protoCodes(){let t=[],e=this.bytes,n=0;for(;n<e.length;){let o=Ls.default.decode(e,n),s=Ls.default.decode.bytes??0,c=G(o),l=Rs(c,e.slice(n+s));n+=l+s,t.push(o)}return t}protoNames(){return this.protos().map(t=>t.name)}tuples(){return or(this,Or,"f")==null&&Ps(this,Or,xn(this.bytes),"f"),or(this,Or,"f")}stringTuples(){return or(this,Pr,"f")==null&&Ps(this,Pr,_s(this.tuples()),"f"),or(this,Pr,"f")}encapsulate(t){return t=new oe(t),new oe(this.toString()+t.toString())}decapsulate(t){let e=t.toString(),n=this.toString(),o=n.lastIndexOf(e);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new oe(n.slice(0,o))}decapsulateCode(t){let e=this.tuples();for(let n=e.length-1;n>=0;n--)if(e[n][0]===t)return new oe(Ds(e.slice(0,n)));return this}getPeerId(){try{let e=this.stringTuples().filter(n=>n[0]===Rr.ipfs.code).pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?I(N.decode(`z${n}`),"base58btc"):I(_.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){let t=null;try{t=this.stringTuples().filter(e=>G(e[0]).path===!0)[0][1],t==null&&(t=null)}catch{t=null}return t}equals(t){return It(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(s=>s.resolvable);if(e==null)return[this];let n=nm.get(e.name);if(n==null)throw(0,Da.default)(new Error(`no available resolver for ${e.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(s=>new oe(s))}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)}[(kr=new WeakMap,Or=new WeakMap,Pr=new WeakMap,_a=Ra,em)](){return`Multiaddr(${ks(this.bytes)})`}};function ka(r){return new oe(r)}var Ns=R(Jt("os"),1),Oa=R(Jt("path"),1),sm={ip4:"IPv4",ip6:"IPv6"};function sr(r){let t=r.getPath();return t!=null?Ns.default.platform()==="win32"?{path:Oa.default.join("\\\\.\\pipe\\",t)}:{path:t}:r.toOptions()}function Ms(r,t,e){let n=o=>ka(`/${r}/${o}/tcp/${e}`);return(im(t)?am(sm[r]):[t]).map(n)}function im(r){return["0.0.0.0","::"].includes(r)}var cm=Ns.default.networkInterfaces();function am(r){let t=[];for(let[,e]of Object.entries(cm))if(e!=null)for(let n of e)n.family===r&&t.push(n.address);return t}var se=class extends Error{constructor(t="The operation was aborted"){super(t),this.code=se.code,this.type=se.type}static get code(){return"ABORT_ERR"}static get type(){return"aborted"}},ie=class extends Error{constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};var $t=ut("libp2p:tcp:socket"),Cn=(r,t)=>{let e=t.metrics,n=t.metricPrefix??"",o=t.socketInactivityTimeout??3e5,s=t.socketCloseTimeout??2e3;t.listeningAddr?.getPath()!=null&&(t.remoteAddr=t.listeningAddr),t.remoteAddr?.getPath()!=null&&(t.localAddr=t.remoteAddr);let c;if(t.remoteAddr!=null)c=t.remoteAddr;else{if(r.remoteAddress==null||r.remotePort==null)throw new ie("Could not determine remote address or port","ERR_NO_REMOTE_ADDRESS");c=ya(r.remoteAddress,r.remotePort)}let l=sr(c),f=l.path??`${l.host??""}:${l.port??""}`,{sink:d,source:h}=Pa.default.duplex(r);r.setTimeout(o,()=>{$t("%s socket read timeout",f),e?.increment({[`${n}timeout`]:!0});let E;r.readable&&(E=new ie("Socket read timeout","ERR_SOCKET_READ_TIMEOUT")),r.destroy(E)}),r.once("close",()=>{$t("%s socket close",f),e?.increment({[`${n}close`]:!0}),y.timeline.close==null&&(y.timeline.close=Date.now())}),r.once("end",()=>{$t("%s socket end",f),e?.increment({[`${n}end`]:!0})});let y={async sink(E){try{await d(E)}catch(w){w.type!=="aborted"&&$t(w)}r.end()},source:h,remoteAddr:c,timeline:{open:Date.now()},async close(){if(r.destroyed){$t("%s socket was already destroyed when trying to close",f);return}$t("%s closing socket",f),await new Promise((E,w)=>{let g=Date.now(),T=setTimeout(()=>{r.destroyed?($t("%s is already destroyed",f),E()):($t("%s socket close timeout after %dms, destroying it manually",f,Date.now()-g),r.destroy(new ie("Socket close timeout","ERR_SOCKET_CLOSE_TIMEOUT")))},s).unref();r.once("close",()=>{$t("%s socket closed",f),clearTimeout(T),E()}),r.once("error",O=>{$t("%s socket error",f,O),y.timeline.close==null&&(y.timeline.close=Date.now()),r.destroyed&&clearTimeout(T),w(O)}),r.setTimeout(s),r.end(),r.writableLength>0?r.once("drain",()=>{$t("%s socket drained",f),r.destroy()}):r.destroy()})}};return y};var La=R(Jt("net"),1);var ke=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)},ce,Bn=class extends EventTarget{constructor(){super(...arguments),ce.set(this,new Map)}listenerCount(t){let e=ke(this,ce,"f").get(t);return e==null?0:e.length}addEventListener(t,e,n){super.addEventListener(t,e,n);let o=ke(this,ce,"f").get(t);o==null&&(o=[],ke(this,ce,"f").set(t,o)),o.push({callback:e,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(t,e,n){super.removeEventListener(t.toString(),e??null,n);let o=ke(this,ce,"f").get(t);o!=null&&(o=o.filter(({callback:s})=>s!==e),ke(this,ce,"f").set(t,o))}dispatchEvent(t){let e=super.dispatchEvent(t),n=ke(this,ce,"f").get(t.type);return n==null||(n=n.filter(({once:o})=>!o),ke(this,ce,"f").set(t.type,n)),e}safeDispatchEvent(t,e){return this.dispatchEvent(new ir(t,e))}};ce=new WeakMap;var Us=class extends Event{constructor(t,e){super(t,e),this.detail=e?.detail}},ir=globalThis.CustomEvent??Us;var Bt=ut("libp2p:tcp:listener");async function Fs(r){try{await r.close()}catch(t){Bt.error("an error occurred closing the connection",t)}}var fm=1,hm=0,_n=class extends Bn{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=La.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]:fm})}this.dispatchEvent(new ir("listening"))}).on("error",e=>{this.metrics?.errors.increment({[`${this.addr} listen_error`]:!0}),this.dispatchEvent(new ir("error",{detail:e}))}).on("close",()=>{this.metrics?.status.update({[this.addr]:hm}),this.dispatchEvent(new ir("close"))})}onSocket(t){t.on("error",n=>{Bt("socket error",n),this.metrics?.events.increment({[`${this.addr} error`]:!0})});let e;try{e=Cn(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){Bt.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_to_connection`]:!0});return}Bt("new inbound connection %s",e.remoteAddr);try{this.context.upgrader.upgradeInbound(e).then(n=>{Bt("inbound connection upgraded %s",e.remoteAddr),this.connections.add(e),t.once("close",()=>{this.connections.delete(e),this.context.closeServerOnMaxConnections!=null&&this.connections.size<this.context.closeServerOnMaxConnections.listenBelow&&this.netListen().catch(o=>{Bt.error("error attempting to listen server once connection count under limit",o),this.context.closeServerOnMaxConnections?.onListenError?.(o)})}),this.context.handler!=null&&this.context.handler(n),this.context.closeServerOnMaxConnections!=null&&this.connections.size>=this.context.closeServerOnMaxConnections.closeAbove&&this.netClose(),this.dispatchEvent(new ir("connection",{detail:n}))}).catch(async n=>{Bt.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_upgrade`]:!0}),await Fs(e)}).catch(n=>{Bt.error("closing inbound connection failed",n)})}catch(n){Bt.error("inbound connection failed",n),Fs(e).catch(o=>{Bt.error("closing inbound connection failed",o),this.metrics?.errors.increment({[`${this.addr} inbound_closing_failed`]:!0})})}}getAddrs(){if(!this.status.started)return[];let t=[],e=this.server.address(),{listeningAddr:n,peerId:o}=this.status;if(e==null)return[];if(typeof e=="string")t=[n];else try{n.toString().startsWith("/ip4")?t=t.concat(Ms("ip4",e.address,e.port)):e.family==="IPv6"&&(t=t.concat(Ms("ip6",e.address,e.port)))}catch(s){Bt.error("could not turn %s:%s into multiaddr",e.address,e.port,s)}return t.map(s=>o!=null?s.encapsulate(`/p2p/${o}`):s)}async listen(t){if(this.status.started)throw Error("server is already listening");let e=t.getPeerId(),n=e==null?t.decapsulateCode(421):t;this.status={started:!0,listeningAddr:n,peerId:e,netConfig:sr(n)},await this.netListen()}async close(){await Promise.all(Array.from(this.connections.values()).map(async t=>{await Fs(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)}),Bt("Listening on %s",this.server.address())}netClose(){!this.status.started||!this.server.listening||(Bt("Closing server on %s",this.server.address()),this.server.close())}};var Ma=Symbol.for("@libp2p/transport");var Na;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(Na||(Na={}));var ae=ut("libp2p:tcp"),zs=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[Ma](){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",l=>{ae("socket error",l)});let o=Cn(n,{remoteAddr:t,socketInactivityTimeout:this.opts.outboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.metrics?.dialerEvents}),s=()=>{o.close().catch(l=>{ae.error("Error closing maConn after abort",l)})};e.signal?.addEventListener("abort",s,{once:!0}),ae("new outbound connection %s",o.remoteAddr);let c=await e.upgrader.upgradeOutbound(o);if(ae("outbound connection %s upgraded",o.remoteAddr),e.signal?.removeEventListener("abort",s),e.signal?.aborted===!0)throw c.close().catch(l=>{ae.error("Error closing conn after abort",l)}),new se;return c}async _connect(t,e){if(e.signal?.aborted===!0)throw new se;return await new Promise((n,o)=>{let s=Date.now(),c=sr(t),l=c.path??`${c.host??""}:${c.port}`;ae("dialing %j",c);let f=Ua.default.connect(c),d=g=>{g.message=`connection error ${l}: ${g.message}`,this.metrics?.dialerEvents.increment({error:!0}),w(g)},h=()=>{ae("connection timeout %s",l),this.metrics?.dialerEvents.increment({timeout:!0});let g=new ie(`connection timeout after ${Date.now()-s}ms`,"ERR_CONNECT_TIMEOUT");f.emit("error",g)},y=()=>{ae("connection opened %j",c),this.metrics?.dialerEvents.increment({connect:!0}),w()},E=()=>{ae("connection aborted %j",c),this.metrics?.dialerEvents.increment({abort:!0}),f.destroy(),w(new se)},w=g=>{if(f.removeListener("error",d),f.removeListener("timeout",h),f.removeListener("connect",y),e.signal!=null&&e.signal.removeEventListener("abort",E),g!=null){o(g);return}n(f)};f.on("error",d),f.on("timeout",h),f.on("connect",y),e.signal!=null&&e.signal.addEventListener("abort",E)})}createListener(t){return new _n({...t,maxConnections:this.opts.maxConnections,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:ye.matches(e.decapsulateCode(421)))}};function Fa(r={}){return(t={})=>new zs(t,r)}var $a=Z.isIPv4,mm=Z.isIPv6,Vs=function(r){let t=0;if(r=r.toString().trim(),$a(r)){let e=new Uint8Array(t+4);return r.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(mm(r)){let e=r.split(":",8),n;for(n=0;n<e.length;n++){let s=$a(e[n]),c;s&&(c=Vs(e[n]),e[n]=I(c.slice(0,2),"base16")),c!=null&&++n<8&&e.splice(n,0,I(c.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 s=[n,1];for(n=9-e.length;n>0;n--)s.push("0");e.splice.apply(e,s)}let o=new Uint8Array(t+16);for(n=0;n<e.length;n++){let s=parseInt(e[n],16);o[t++]=s>>8&255,o[t++]=s&255}return o}throw new Error("invalid ip address")},za=function(r,t=0,e){t=~~t,e=e??r.length-t;let n=new DataView(r.buffer);if(e===4){let o=[];for(let s=0;s<e;s++)o.push(r[t+s]);return o.join(".")}if(e===16){let o=[];for(let s=0;s<e;s+=2)o.push(n.getUint16(t+s).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Lr={},Gs={},ym=[[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"]];ym.forEach(r=>{let t=bm(...r);Gs[t.code]=t,Lr[t.name]=t});function bm(r,t,e,n,o){return{code:r,size:t,name:e,resolvable:!!n,path:!!o}}function U(r){if(typeof r=="number"){if(Gs[r]!=null)return Gs[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(Lr[r]!=null)return Lr[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var Zt=R(At(),1);function qa(r,t){switch(U(r).code){case 4:case 41:return Em(t);case 42:return Ha(t);case 6:case 273:case 33:case 132:return Za(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Ha(t);case 421:return xm(t);case 444:return ja(t);case 445:return ja(t);case 466:return Tm(t);default:return I(t,"base16")}}function Wa(r,t){switch(U(r).code){case 4:return Va(t);case 41:return Va(t);case 42:return Ga(t);case 6:case 273:case 33:case 132:return js(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Ga(t);case 421:return vm(t);case 444:return Am(t);case 445:return Im(t);case 466:return Sm(t);default:return bt(t,"base16")}}var Hs=Object.values(yt).map(r=>r.decoder),wm=function(){let r=Hs[0].or(Hs[1]);return Hs.slice(2).forEach(t=>r=r.or(t)),r}();function Va(r){if(!ct(r))throw new Error("invalid ip address");return Vs(r)}function Em(r){let t=za(r,0,r.length);if(t==null)throw new Error("ipBuff is required");if(!ct(t))throw new Error("invalid ip address");return t}function js(r){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,r),new Uint8Array(t)}function Za(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Ga(r){let t=bt(r),e=Uint8Array.from(Zt.default.encode(t.length));return D([e,t],e.length+t.length)}function Ha(r){let t=Zt.default.decode(r);if(r=r.slice(Zt.default.decode.bytes),r.length!==t)throw new Error("inconsistent lengths");return I(r)}function vm(r){let t;r[0]==="Q"||r[0]==="1"?t=xt(N.decode(`z${r}`)).bytes:t=_.parse(r).multihash.bytes;let e=Uint8Array.from(Zt.default.encode(t.length));return D([e,t],e.length+t.length)}function Sm(r){let t=wm.decode(r),e=Uint8Array.from(Zt.default.encode(t.length));return D([e,t],e.length+t.length)}function Tm(r){let t=Zt.default.decode(r),e=r.slice(Zt.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return"u"+I(e,"base64url")}function xm(r){let t=Zt.default.decode(r),e=r.slice(Zt.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return I(e,"base58btc")}function Am(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=K.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=js(n);return D([e,o],e.length+o.length)}function Im(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=K.decode(`b${t[0]}`),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=js(n);return D([e,o],e.length+o.length)}function ja(r){let t=r.slice(0,r.length-2),e=r.slice(r.length-2),n=I(t,"base32"),o=Za(e);return`${n}:${o}`}var cr=R(At(),1);function Cm(r){let t=[],e=r.split("/").slice(1);if(e.length===1&&e[0]==="")return[];for(let n=0;n<e.length;n++){let o=e[n],s=U(o);if(s.size===0){t.push([o]);continue}if(n++,n>=e.length)throw Qa("invalid address: "+r);if(s.path===!0){t.push([o,Qs(e.slice(n).join("/"))]);break}t.push([o,e[n]])}return t}function Bm(r){let t=[];return r.map(e=>{let n=kn(e);return t.push(n.name),e.length>1&&e[1]!=null&&t.push(e[1]),null}),Qs(t.join("/"))}function _m(r){return r.map(t=>{Array.isArray(t)||(t=[t]);let e=kn(t);return t.length>1?[e.code,Wa(e.code,t[1])]:[e.code]})}function qs(r){return r.map(t=>{let e=kn(t);return t[1]!=null?[e.code,qa(e.code,t[1])]:[e.code]})}function Ws(r){return Rn(D(r.map(t=>{let e=kn(t),n=Uint8Array.from(cr.default.encode(e.code));return t.length>1&&t[1]!=null&&(n=D([n,t[1]])),n})))}function Zs(r,t){return r.size>0?r.size/8:r.size===0?0:cr.default.decode(t)+(cr.default.decode.bytes??0)}function Dn(r){let t=[],e=0;for(;e<r.length;){let n=cr.default.decode(r,e),o=cr.default.decode.bytes??0,s=U(n),c=Zs(s,r.slice(e+o));if(c===0){t.push([n]),e+=o;continue}let l=r.slice(e+o,e+o+c);if(e+=c+o,e>r.length)throw Qa("Invalid address Uint8Array: "+I(r,"base16"));t.push([n,l])}return t}function Ks(r){let t=Dn(r),e=qs(t);return Bm(e)}function Dm(r){r=Qs(r);let t=Cm(r),e=_m(t);return Ws(e)}function Ka(r){return Dm(r)}function Rn(r){let t=Rm(r);if(t!=null)throw t;return Uint8Array.from(r)}function Rm(r){try{Dn(r)}catch(t){return t}}function Qs(r){return"/"+r.trim().split("/").filter(t=>t).join("/")}function Qa(r){return new Error("Error parsing address: "+r)}function kn(r){return U(r[0])}var Js=R(At(),1);var Ja=R(Ie(),1);var ar=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)},Xs=function(r,t,e,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!o:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(r,e):o?o.value=e:t.set(r,e),e},Nr,Mr,Ur,Xa,Om=Symbol.for("nodejs.util.inspect.custom"),Pm=[U("dns").code,U("dns4").code,U("dns6").code,U("dnsaddr").code],Lm=new Map,Ya=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Nm(r){return!!r?.[Ya]}var ue=class{constructor(t){if(Nr.set(this,void 0),Mr.set(this,void 0),Ur.set(this,void 0),this[Xa]=!0,t==null&&(t=""),t instanceof Uint8Array)this.bytes=Rn(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);this.bytes=Ka(t)}else if(Nm(t))this.bytes=Rn(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return ar(this,Nr,"f")==null&&Xs(this,Nr,Ks(this.bytes),"f"),ar(this,Nr,"f")}toJSON(){return this.toString()}toOptions(){let t,e,n,o,s="",c=U("tcp"),l=U("udp"),f=U("ip4"),d=U("ip6"),h=U("dns6"),y=U("ip6zone");for(let[w,g]of this.stringTuples())w===y.code&&(s=`%${g??""}`),Pm.includes(w)&&(e=c.name,o=443,n=`${g??""}${s}`,t=w===h.code?6:4),(w===c.code||w===l.code)&&(e=U(w).name,o=parseInt(g??"")),(w===f.code||w===d.code)&&(e=U(w).name,n=`${g??""}${s}`,t=w===d.code?6:4);if(t==null||e==null||n==null||o==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:t,host:n,transport:e,port:o}}protos(){return this.protoCodes().map(t=>Object.assign({},U(t)))}protoCodes(){let t=[],e=this.bytes,n=0;for(;n<e.length;){let o=Js.default.decode(e,n),s=Js.default.decode.bytes??0,c=U(o),l=Zs(c,e.slice(n+s));n+=l+s,t.push(o)}return t}protoNames(){return this.protos().map(t=>t.name)}tuples(){return ar(this,Mr,"f")==null&&Xs(this,Mr,Dn(this.bytes),"f"),ar(this,Mr,"f")}stringTuples(){return ar(this,Ur,"f")==null&&Xs(this,Ur,qs(this.tuples()),"f"),ar(this,Ur,"f")}encapsulate(t){return t=new ue(t),new ue(this.toString()+t.toString())}decapsulate(t){let e=t.toString(),n=this.toString(),o=n.lastIndexOf(e);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new ue(n.slice(0,o))}decapsulateCode(t){let e=this.tuples();for(let n=e.length-1;n>=0;n--)if(e[n][0]===t)return new ue(Ws(e.slice(0,n)));return this}getPeerId(){try{let e=this.stringTuples().filter(n=>n[0]===Lr.ipfs.code).pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?I(N.decode(`z${n}`),"base58btc"):I(_.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){let t=null;try{t=this.stringTuples().filter(e=>U(e[0]).path===!0)[0][1],t==null&&(t=null)}catch{t=null}return t}equals(t){return It(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(s=>s.resolvable);if(e==null)return[this];let n=Lm.get(e.name);if(n==null)throw(0,Ja.default)(new Error(`no available resolver for ${e.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(s=>new ue(s))}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)}[(Nr=new WeakMap,Mr=new WeakMap,Ur=new WeakMap,Xa=Ya,Om)](){return`Multiaddr(${Ks(this.bytes)})`}};function Ys(r){return new ue(r)}var eu=Symbol.for("@achingbrain/uint8arraylist");function tu(r,t){if(t==null||t<0)throw new RangeError("index is out of bounds");let e=0;for(let n of r){let o=e+n.byteLength;if(t<o)return{buf:n,index:t-e};e=o}throw new RangeError("index is out of bounds")}function On(r){return!!r?.[eu]}var wt=class{constructor(...t){Object.defineProperty(this,eu,{value:!0}),this.bufs=[],this.length=0,t.length>0&&this.appendAll(t)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...t){this.appendAll(t)}appendAll(t){let e=0;for(let n of t)if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.push(n);else if(On(n))e+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}prepend(...t){this.prependAll(t)}prependAll(t){let e=0;for(let n of t.reverse())if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.unshift(n);else if(On(n))e+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}get(t){let e=tu(this.bufs,t);return e.buf[e.index]}set(t,e){let n=tu(this.bufs,t);n.buf[n.index]=e}write(t,e=0){if(t instanceof Uint8Array)for(let n=0;n<t.length;n++)this.set(e+n,t[n]);else if(On(t))for(let n=0;n<t.length;n++)this.set(e+n,t.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(t){if(t=Math.trunc(t),!(Number.isNaN(t)||t<=0)){if(t===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(t>=this.bufs[0].byteLength)t-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(t),this.length-=t;break}}}slice(t,e){let{bufs:n,length:o}=this._subList(t,e);return D(n,o)}subarray(t,e){let{bufs:n,length:o}=this._subList(t,e);return n.length===1?n[0]:D(n,o)}sublist(t,e){let{bufs:n,length:o}=this._subList(t,e),s=new wt;return s.length=o,s.bufs=n,s}_subList(t,e){if(t=t??0,e=e??this.length,t<0&&(t=this.length+t),e<0&&(e=this.length+e),t<0||e>this.length)throw new RangeError("index is out of bounds");if(t===e)return{bufs:[],length:0};if(t===0&&e===this.length)return{bufs:[...this.bufs],length:this.length};let n=[],o=0;for(let s=0;s<this.bufs.length;s++){let c=this.bufs[s],l=o,f=l+c.byteLength;if(o=f,t>=f)continue;let d=t>=l&&t<f,h=e>l&&e<=f;if(d&&h){if(t===l&&e===f){n.push(c);break}let y=t-l;n.push(c.subarray(y,y+(e-t)));break}if(d){if(t===0){n.push(c);continue}n.push(c.subarray(t-l));continue}if(h){if(e===f){n.push(c);break}n.push(c.subarray(0,e-l));break}n.push(c)}return{bufs:n,length:e-t}}indexOf(t,e=0){if(!On(t)&&!(t instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=t instanceof Uint8Array?t:t.subarray();if(e=Number(e??0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),t.length===0)return e>this.length?this.length:e;let o=n.byteLength;if(o===0)throw new TypeError("search must be at least 1 byte long");let s=256,c=new Int32Array(s);for(let y=0;y<s;y++)c[y]=-1;for(let y=0;y<o;y++)c[n[y]]=y;let l=c,f=this.byteLength-n.byteLength,d=n.byteLength-1,h;for(let y=e;y<=f;y+=h){h=0;for(let E=d;E>=0;E--){let w=this.get(y+E);if(n[E]!==w){h=Math.max(1,E-l[w]);break}}if(h===0)return y}return-1}getInt8(t){let e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt8(0)}setInt8(t,e){let n=te(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,e),this.write(n,t)}getInt16(t,e){let n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,e)}setInt16(t,e,n){let o=Yt(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt16(0,e,n),this.write(o,t)}getInt32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,e)}setInt32(t,e,n){let o=Yt(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt32(0,e,n),this.write(o,t)}getBigInt64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,e)}setBigInt64(t,e,n){let o=Yt(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigInt64(0,e,n),this.write(o,t)}getUint8(t){let e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0)}setUint8(t,e){let n=te(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,e),this.write(n,t)}getUint16(t,e){let n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,e)}setUint16(t,e,n){let o=Yt(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint16(0,e,n),this.write(o,t)}getUint32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,e)}setUint32(t,e,n){let o=Yt(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(0,e,n),this.write(o,t)}getBigUint64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,e)}setBigUint64(t,e,n){let o=Yt(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigUint64(0,e,n),this.write(o,t)}getFloat32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,e)}setFloat32(t,e,n){let o=Yt(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat32(0,e,n),this.write(o,t)}getFloat64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,e)}setFloat64(t,e,n){let o=Yt(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat64(0,e,n),this.write(o,t)}equals(t){if(t==null||!(t instanceof wt)||t.bufs.length!==this.bufs.length)return!1;for(let e=0;e<this.bufs.length;e++)if(!It(this.bufs[e],t.bufs[e]))return!1;return!0}static fromUint8Arrays(t,e){let n=new wt;return n.bufs=t,e==null&&(e=t.reduce((o,s)=>o+s.byteLength,0)),n.length=e,n}};function Pn(r){return r instanceof Uint8Array?{get(t){return r[t]},set(t,e){r[t]=e}}:{get(t){return r.get(t)},set(t,e){r.set(t,e)}}}var ru=4294967296,_t=class{constructor(t=0,e=0){this.hi=t,this.lo=e}toBigInt(t){if(t===!0)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(BigInt(e)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toNumber(t){return Number(this.toBigInt(t))}zzDecode(){let t=-(this.lo&1),e=((this.lo>>>1|this.hi<<31)^t)>>>0,n=(this.hi>>>1^t)>>>0;return new _t(n,e)}zzEncode(){let t=this.hi>>31,e=((this.hi<<1|this.lo>>>31)^t)>>>0,n=(this.lo<<1^t)>>>0;return new _t(e,n)}toBytes(t,e=0){let n=Pn(t);for(;this.hi>0;)n.set(e++,this.lo&127|128),this.lo=(this.lo>>>7|this.hi<<25)>>>0,this.hi>>>=7;for(;this.lo>127;)n.set(e++,this.lo&127|128),this.lo=this.lo>>>7;n.set(e++,this.lo)}static fromBigInt(t){if(t===0n)return new _t;let e=t<0;e&&(t=-t);let n=Number(t>>32n)|0,o=Number(t-(BigInt(n)<<32n))|0;return e&&(n=~n>>>0,o=~o>>>0,++o>ru&&(o=0,++n>ru&&(n=0))),new _t(n,o)}static fromNumber(t){if(t===0)return new _t;let e=t<0;e&&(t=-t);let n=t>>>0,o=(t-n)/4294967296>>>0;return e&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new _t(o,n)}static fromBytes(t,e=0){let n=Pn(t),o=new _t,s=0;if(t.length-e>4){for(;s<4;++s)if(o.lo=(o.lo|(n.get(e)&127)<<s*7)>>>0,n.get(e++)<128)return o;if(o.lo=(o.lo|(n.get(e)&127)<<28)>>>0,o.hi=(o.hi|(n.get(e)&127)>>4)>>>0,n.get(e++)<128)return o;s=0}else for(;s<4;++s){if(e>=t.length)throw RangeError(`index out of range: ${e} > ${t.length}`);if(o.lo=(o.lo|(n.get(e)&127)<<s*7)>>>0,n.get(e++)<128)return o}if(t.length-e>4){for(;s<5;++s)if(o.hi=(o.hi|(n.get(e)&127)<<s*7+3)>>>0,n.get(e++)<128)return o}else if(e<t.byteLength)for(;s<5;++s){if(e>=t.length)throw RangeError(`index out of range: ${e} > ${t.length}`);if(o.hi=(o.hi|(n.get(e)&127)<<s*7+3)>>>0,n.get(e++)<128)return o}throw RangeError("invalid varint encoding")}};var Mm=Math.pow(2,7),Um=Math.pow(2,14),Fm=Math.pow(2,21),$m=Math.pow(2,28),zm=Math.pow(2,35),Vm=Math.pow(2,42),Gm=Math.pow(2,49),Hm=Math.pow(2,56),jm=Math.pow(2,63),Oe={encodingLength(r){return r<Mm?1:r<Um?2:r<Fm?3:r<$m?4:r<zm?5:r<Vm?6:r<Gm?7:r<Hm?8:r<jm?9:10},encode(r,t,e=0){if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return t==null&&(t=te(Oe.encodingLength(r))),_t.fromNumber(r).toBytes(t,e),t},decode(r,t=0){return _t.fromBytes(r,t).toNumber(!0)}};function nu(r){return globalThis?.Buffer?.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}var Ln=r=>{let t=Oe.encodingLength(r),e=nu(t);return Oe.encode(r,e),Ln.bytes=t,e};Ln.bytes=0;function ur(r){r=r??{};let t=r.lengthEncoder??Ln;return async function*(n){for await(let o of n){let s=t(o.byteLength);s instanceof Uint8Array?yield s:yield*s,o instanceof Uint8Array?yield o:yield*o}}}ur.single=(r,t)=>{t=t??{};let e=t.lengthEncoder??Ln;return new wt(e(r.byteLength),r)};var Fr=R(Ie(),1),qm=8,Wm=1024*1024*4,Pe;(function(r){r[r.LENGTH=0]="LENGTH",r[r.DATA=1]="DATA"})(Pe||(Pe={}));var ti=r=>{let t=Oe.decode(r);return ti.bytes=Oe.encodingLength(t),t};ti.bytes=0;function $r(r){return async function*(e){let n=new wt,o=Pe.LENGTH,s=-1,c=r?.lengthDecoder??ti,l=r?.maxLengthLength??qm,f=r?.maxDataLength??Wm;for await(let d of e)for(n.append(d);n.byteLength>0;){if(o===Pe.LENGTH)try{if(s=c(n),s<0)throw(0,Fr.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(s>f)throw(0,Fr.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let h=c.bytes;n.consume(h),r?.onLength!=null&&r.onLength(s),o=Pe.DATA}catch(h){if(h instanceof RangeError){if(n.byteLength>l)throw(0,Fr.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw h}if(o===Pe.DATA){if(n.byteLength<s)break;let h=n.sublist(0,s);n.consume(s),r?.onData!=null&&r.onData(h),yield h,o=Pe.LENGTH}}if(n.byteLength>0)throw(0,Fr.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}}$r.fromReader=(r,t)=>{let e=1,n=async function*(){for(;;)try{let{done:s,value:c}=await r.next(e);if(s===!0)return;c!=null&&(yield c)}catch(s){if(s.code==="ERR_UNDER_READ")return{done:!0,value:null};throw s}finally{e=1}}();return $r({...t??{},onLength:s=>{e=s}})(n)};var Nn=class{constructor(t){if(!(t>0)||t-1&t)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(t),this.mask=t-1,this.top=0,this.btm=0,this.next=null}push(t){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=t,this.top=this.top+1&this.mask,!0)}shift(){let t=this.buffer[this.btm];if(t!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,t}isEmpty(){return this.buffer[this.btm]===void 0}},lr=class{constructor(t={}){this.hwm=t.splitLimit??16,this.head=new Nn(this.hwm),this.tail=this.head,this.size=0}calculateSize(t){return t?.byteLength!=null?t.byteLength:1}push(t){if(t?.value!=null&&(this.size+=this.calculateSize(t.value)),!this.head.push(t)){let e=this.head;this.head=e.next=new Nn(2*this.head.buffer.length),this.head.push(t)}}shift(){let t=this.tail.shift();if(t===void 0&&this.tail.next!=null){let e=this.tail.next;this.tail.next=null,this.tail=e,t=this.tail.shift()}return t?.value!=null&&(this.size-=this.calculateSize(t.value)),t}isEmpty(){return this.head.isEmpty()}};function be(r={}){return Zm(e=>{let n=e.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},r)}function Zm(r,t){t=t??{};let e=t.onEnd,n=new lr,o,s,c,l=async()=>n.isEmpty()?c?{done:!0}:await new Promise((T,O)=>{s=B=>{s=null,n.push(B);try{T(r(n))}catch(k){O(k)}return o}}):r(n),f=T=>s!=null?s(T):(n.push(T),o),d=T=>(n=new lr,s!=null?s({error:T}):(n.push({error:T}),o)),h=T=>{if(c)return o;if(t?.objectMode!==!0&&T?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return f({done:!1,value:T})},y=T=>c?o:(c=!0,T!=null?d(T):f({done:!0})),E=()=>(n=new lr,y(),{done:!0}),w=T=>(y(T),{done:!0});if(o={[Symbol.asyncIterator](){return this},next:l,return:E,throw:w,push:h,end:y,get readableLength(){return n.size}},e==null)return o;let g=o;return o={[Symbol.asyncIterator](){return this},next(){return g.next()},throw(T){return g.throw(T),e!=null&&(e(T),e=void 0),{done:!0}},return(){return g.return(),e!=null&&(e(),e=void 0),{done:!0}},push:h,end(T){return g.end(T),e!=null&&(e(T),e=void 0),o},get readableLength(){return g.readableLength}},o}async function*ei(...r){let t=be({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(r.map(async e=>{for await(let n of e)t.push(n)})),t.end()}catch(e){t.end(e)}}),yield*t}var Km=(...r)=>{let t;for(;r.length>0;)t=r.shift()(t);return t},su=r=>r!=null&&(typeof r[Symbol.asyncIterator]=="function"||typeof r[Symbol.iterator]=="function"||typeof r.next=="function"),ri=r=>r!=null&&typeof r.sink=="function"&&su(r.source),Qm=r=>t=>{let e=r.sink(t);if(e.then!=null){let n=be({objectMode:!0});return e.then(()=>{n.end()},s=>{n.end(s)}),ei(n,async function*(){yield*r.source,n.end()}())}return r.source};function Mn(r,...t){if(ri(r)){let n=r;r=()=>n.source}else if(su(r)){let n=r;r=()=>n}let e=[r,...t];if(e.length>1&&ri(e[e.length-1])&&(e[e.length-1]=e[e.length-1].sink),e.length>2)for(let n=1;n<e.length-1;n++)ri(e[n])&&(e[n]=Qm(e[n]));return Km(...e)}function iu(r){let t=async function*(){let e=yield,n=new wt;for await(let o of r){if(e==null){n.append(o),e=yield n,n=new wt;continue}for(n.append(o);n.length>=e;){let s=n.sublist(0,e);if(n.consume(e),e=yield s,e==null){n.length>0&&(e=yield n,n=new wt);break}}}if(e!=null)throw Object.assign(new Error(`stream ended before ${e} bytes became available`),{code:"ERR_UNDER_READ",buffer:n})}();return t.next(),t}function ni(){let r={};return r.promise=new Promise((t,e)=>{r.resolve=t,r.reject=e}),r}function cu(r){let t=be(),e=iu(r.source),n=ni(),o,s=r.sink(async function*(){yield*t,yield*await n.promise}());return s.catch(l=>{o=l}),{reader:e,writer:t,stream:{sink:async l=>o!=null?await Promise.reject(o):(n.resolve(l),await s),source:e},rest:()=>t.end(),write:t.push,read:async()=>{let l=await e.next();if(l.value!=null)return l.value}}}var oi=ut("libp2p:daemon-protocol:stream-handler"),Un=class{constructor(t){let{stream:e,maxLength:n}=t;this.stream=e,this.shake=cu(this.stream),this.decoder=$r.fromReader(this.shake.reader,{maxDataLength:n??4096})}async read(){let t=await this.decoder.next();if(t.value!=null)return t.value.subarray();oi("read received no value, closing stream"),await this.close()}write(t){oi("write message"),this.shake.write(ur.single(t).subarray())}rest(){return this.shake.rest(),this.shake.stream}async close(){oi("closing the stream"),await this.rest().sink([])}};var si={upgradeInbound:async r=>r,upgradeOutbound:async r=>r};var bi=R(li(),1),Zu=R($u(),1),Ku=R(Ne(),1),wi=R(yi(),1),Qu=R(Wu(),1);function s0(){Ku.default._configure(),bi.default._configure(Zu.default),wi.default._configure(Qu.default)}s0();var Xu=["uint64","int64","sint64","fixed64","sfixed64"];function i0(r){for(let t of Xu){if(r[t]==null)continue;let e=r[t];r[t]=function(){return BigInt(e.call(this).toString())}}return r}function Ei(r){return i0(new bi.default(r))}function c0(r){for(let t of Xu){if(r[t]==null)continue;let e=r[t];r[t]=function(n){return e.call(this,n.toString())}}return r}function vi(){return c0(wi.default.create())}function Q(r,t){let e=Ei(r instanceof Uint8Array?r:r.subarray());return t.decode(e)}function X(r,t){let e=vi();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var hr;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(hr||(hr={}));function Gn(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function le(r){function t(o){if(r[o.toString()]==null)throw new Error("Invalid enum value");return r[o]}let e=function(s,c){let l=t(s);c.int32(l)},n=function(s){let c=s.int32();return t(c)};return Gn("enum",hr.VARINT,e,n)}function J(r,t){return Gn("message",hr.LENGTH_DELIMITED,r,t)}var Ot;(function(r){let t;(function(o){o.IDENTIFY="IDENTIFY",o.CONNECT="CONNECT",o.STREAM_OPEN="STREAM_OPEN",o.STREAM_HANDLER="STREAM_HANDLER",o.DHT="DHT",o.LIST_PEERS="LIST_PEERS",o.CONNMANAGER="CONNMANAGER",o.DISCONNECT="DISCONNECT",o.PUBSUB="PUBSUB",o.PEERSTORE="PEERSTORE"})(t=r.Type||(r.Type={}));let e;(function(o){o[o.IDENTIFY=0]="IDENTIFY",o[o.CONNECT=1]="CONNECT",o[o.STREAM_OPEN=2]="STREAM_OPEN",o[o.STREAM_HANDLER=3]="STREAM_HANDLER",o[o.DHT=4]="DHT",o[o.LIST_PEERS=5]="LIST_PEERS",o[o.CONNMANAGER=6]="CONNMANAGER",o[o.DISCONNECT=7]="DISCONNECT",o[o.PUBSUB=8]="PUBSUB",o[o.PEERSTORE=9]="PEERSTORE"})(e||(e={})),function(o){o.codec=()=>le(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=J((o,s,c={})=>{c.lengthDelimited!==!1&&s.fork(),o.type!=null&&(s.uint32(8),r.Type.codec().encode(o.type,s)),o.connect!=null&&(s.uint32(18),jn.codec().encode(o.connect,s)),o.streamOpen!=null&&(s.uint32(26),qn.codec().encode(o.streamOpen,s)),o.streamHandler!=null&&(s.uint32(34),Wn.codec().encode(o.streamHandler,s)),o.dht!=null&&(s.uint32(42),Pt.codec().encode(o.dht,s)),o.connManager!=null&&(s.uint32(50),Kn.codec().encode(o.connManager,s)),o.disconnect!=null&&(s.uint32(58),Qn.codec().encode(o.disconnect,s)),o.pubsub!=null&&(s.uint32(66),fe.codec().encode(o.pubsub,s)),o.peerStore!=null&&(s.uint32(74),Fe.codec().encode(o.peerStore,s)),c.lengthDelimited!==!1&&s.ldelim()},(o,s)=>{let c={},l=s==null?o.len:o.pos+s;for(;o.pos<l;){let f=o.uint32();switch(f>>>3){case 1:c.type=r.Type.codec().decode(o);break;case 2:c.connect=jn.codec().decode(o,o.uint32());break;case 3:c.streamOpen=qn.codec().decode(o,o.uint32());break;case 4:c.streamHandler=Wn.codec().decode(o,o.uint32());break;case 5:c.dht=Pt.codec().decode(o,o.uint32());break;case 6:c.connManager=Kn.codec().decode(o,o.uint32());break;case 7:c.disconnect=Qn.codec().decode(o,o.uint32());break;case 8:c.pubsub=fe.codec().decode(o,o.uint32());break;case 9:c.peerStore=Fe.codec().decode(o,o.uint32());break;default:o.skipType(f&7);break}}return c})),n),r.encode=o=>X(o,r.codec()),r.decode=o=>Q(o,r.codec())})(Ot||(Ot={}));var Ue;(function(r){let t;(function(o){o.OK="OK",o.ERROR="ERROR"})(t=r.Type||(r.Type={}));let e;(function(o){o[o.OK=0]="OK",o[o.ERROR=1]="ERROR"})(e||(e={})),function(o){o.codec=()=>le(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=J((o,s,c={})=>{if(c.lengthDelimited!==!1&&s.fork(),o.type!=null&&(s.uint32(8),r.Type.codec().encode(o.type,s)),o.error!=null&&(s.uint32(18),Zn.codec().encode(o.error,s)),o.streamInfo!=null&&(s.uint32(26),pr.codec().encode(o.streamInfo,s)),o.identify!=null&&(s.uint32(34),Hn.codec().encode(o.identify,s)),o.dht!=null&&(s.uint32(42),it.codec().encode(o.dht,s)),o.peers!=null)for(let l of o.peers)s.uint32(50),ve.codec().encode(l,s);o.pubsub!=null&&(s.uint32(58),Xn.codec().encode(o.pubsub,s)),o.peerStore!=null&&(s.uint32(66),Jn.codec().encode(o.peerStore,s)),c.lengthDelimited!==!1&&s.ldelim()},(o,s)=>{let c={peers:[]},l=s==null?o.len:o.pos+s;for(;o.pos<l;){let f=o.uint32();switch(f>>>3){case 1:c.type=r.Type.codec().decode(o);break;case 2:c.error=Zn.codec().decode(o,o.uint32());break;case 3:c.streamInfo=pr.codec().decode(o,o.uint32());break;case 4:c.identify=Hn.codec().decode(o,o.uint32());break;case 5:c.dht=it.codec().decode(o,o.uint32());break;case 6:c.peers.push(ve.codec().decode(o,o.uint32()));break;case 7:c.pubsub=Xn.codec().decode(o,o.uint32());break;case 8:c.peerStore=Jn.codec().decode(o,o.uint32());break;default:o.skipType(f&7);break}}return c})),n),r.encode=o=>X(o,r.codec()),r.decode=o=>Q(o,r.codec())})(Ue||(Ue={}));var Hn;(function(r){let t;r.codec=()=>(t==null&&(t=J((e,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),e.id!=null&&e.id.byteLength>0&&(n.uint32(10),n.bytes(e.id)),e.addrs!=null)for(let s of e.addrs)n.uint32(18),n.bytes(s);o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={id:new Uint8Array(0),addrs:[]},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let c=e.uint32();switch(c>>>3){case 1:o.id=e.bytes();break;case 2:o.addrs.push(e.bytes());break;default:e.skipType(c&7);break}}return o})),t),r.encode=e=>X(e,r.codec()),r.decode=e=>Q(e,r.codec())})(Hn||(Hn={}));var jn;(function(r){let t;r.codec=()=>(t==null&&(t=J((e,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),e.peer!=null&&e.peer.byteLength>0&&(n.uint32(10),n.bytes(e.peer)),e.addrs!=null)for(let s of e.addrs)n.uint32(18),n.bytes(s);e.timeout!=null&&(n.uint32(24),n.int64(e.timeout)),o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={peer:new Uint8Array(0),addrs:[]},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let c=e.uint32();switch(c>>>3){case 1:o.peer=e.bytes();break;case 2:o.addrs.push(e.bytes());break;case 3:o.timeout=e.int64();break;default:e.skipType(c&7);break}}return o})),t),r.encode=e=>X(e,r.codec()),r.decode=e=>Q(e,r.codec())})(jn||(jn={}));var qn;(function(r){let t;r.codec=()=>(t==null&&(t=J((e,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),e.peer!=null&&e.peer.byteLength>0&&(n.uint32(10),n.bytes(e.peer)),e.proto!=null)for(let s of e.proto)n.uint32(18),n.string(s);e.timeout!=null&&(n.uint32(24),n.int64(e.timeout)),o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={peer:new Uint8Array(0),proto:[]},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let c=e.uint32();switch(c>>>3){case 1:o.peer=e.bytes();break;case 2:o.proto.push(e.string());break;case 3:o.timeout=e.int64();break;default:e.skipType(c&7);break}}return o})),t),r.encode=e=>X(e,r.codec()),r.decode=e=>Q(e,r.codec())})(qn||(qn={}));var Wn;(function(r){let t;r.codec=()=>(t==null&&(t=J((e,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),e.addr!=null&&e.addr.byteLength>0&&(n.uint32(10),n.bytes(e.addr)),e.proto!=null)for(let s of e.proto)n.uint32(18),n.string(s);o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={addr:new Uint8Array(0),proto:[]},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let c=e.uint32();switch(c>>>3){case 1:o.addr=e.bytes();break;case 2:o.proto.push(e.string());break;default:e.skipType(c&7);break}}return o})),t),r.encode=e=>X(e,r.codec()),r.decode=e=>Q(e,r.codec())})(Wn||(Wn={}));var Zn;(function(r){let t;r.codec=()=>(t==null&&(t=J((e,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),e.msg!=null&&e.msg!==""&&(n.uint32(10),n.string(e.msg)),o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={msg:""},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let c=e.uint32();switch(c>>>3){case 1:o.msg=e.string();break;default:e.skipType(c&7);break}}return o})),t),r.encode=e=>X(e,r.codec()),r.decode=e=>Q(e,r.codec())})(Zn||(Zn={}));var pr;(function(r){let t;r.codec=()=>(t==null&&(t=J((e,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),e.peer!=null&&e.peer.byteLength>0&&(n.uint32(10),n.bytes(e.peer)),e.addr!=null&&e.addr.byteLength>0&&(n.uint32(18),n.bytes(e.addr)),e.proto!=null&&e.proto!==""&&(n.uint32(26),n.string(e.proto)),o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={peer:new Uint8Array(0),addr:new Uint8Array(0),proto:""},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let c=e.uint32();switch(c>>>3){case 1:o.peer=e.bytes();break;case 2:o.addr=e.bytes();break;case 3:o.proto=e.string();break;default:e.skipType(c&7);break}}return o})),t),r.encode=e=>X(e,r.codec()),r.decode=e=>Q(e,r.codec())})(pr||(pr={}));var Pt;(function(r){let t;(function(o){o.FIND_PEER="FIND_PEER",o.FIND_PEERS_CONNECTED_TO_PEER="FIND_PEERS_CONNECTED_TO_PEER",o.FIND_PROVIDERS="FIND_PROVIDERS",o.GET_CLOSEST_PEERS="GET_CLOSEST_PEERS",o.GET_PUBLIC_KEY="GET_PUBLIC_KEY",o.GET_VALUE="GET_VALUE",o.SEARCH_VALUE="SEARCH_VALUE",o.PUT_VALUE="PUT_VALUE",o.PROVIDE="PROVIDE"})(t=r.Type||(r.Type={}));let e;(function(o){o[o.FIND_PEER=0]="FIND_PEER",o[o.FIND_PEERS_CONNECTED_TO_PEER=1]="FIND_PEERS_CONNECTED_TO_PEER",o[o.FIND_PROVIDERS=2]="FIND_PROVIDERS",o[o.GET_CLOSEST_PEERS=3]="GET_CLOSEST_PEERS",o[o.GET_PUBLIC_KEY=4]="GET_PUBLIC_KEY",o[o.GET_VALUE=5]="GET_VALUE",o[o.SEARCH_VALUE=6]="SEARCH_VALUE",o[o.PUT_VALUE=7]="PUT_VALUE",o[o.PROVIDE=8]="PROVIDE"})(e||(e={})),function(o){o.codec=()=>le(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=J((o,s,c={})=>{c.lengthDelimited!==!1&&s.fork(),o.type!=null&&(s.uint32(8),r.Type.codec().encode(o.type,s)),o.peer!=null&&(s.uint32(18),s.bytes(o.peer)),o.cid!=null&&(s.uint32(26),s.bytes(o.cid)),o.key!=null&&(s.uint32(34),s.bytes(o.key)),o.value!=null&&(s.uint32(42),s.bytes(o.value)),o.count!=null&&(s.uint32(48),s.int32(o.count)),o.timeout!=null&&(s.uint32(56),s.int64(o.timeout)),c.lengthDelimited!==!1&&s.ldelim()},(o,s)=>{let c={},l=s==null?o.len:o.pos+s;for(;o.pos<l;){let f=o.uint32();switch(f>>>3){case 1:c.type=r.Type.codec().decode(o);break;case 2:c.peer=o.bytes();break;case 3:c.cid=o.bytes();break;case 4:c.key=o.bytes();break;case 5:c.value=o.bytes();break;case 6:c.count=o.int32();break;case 7:c.timeout=o.int64();break;default:o.skipType(f&7);break}}return c})),n),r.encode=o=>X(o,r.codec()),r.decode=o=>Q(o,r.codec())})(Pt||(Pt={}));var it;(function(r){let t;(function(o){o.BEGIN="BEGIN",o.VALUE="VALUE",o.END="END"})(t=r.Type||(r.Type={}));let e;(function(o){o[o.BEGIN=0]="BEGIN",o[o.VALUE=1]="VALUE",o[o.END=2]="END"})(e||(e={})),function(o){o.codec=()=>le(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=J((o,s,c={})=>{c.lengthDelimited!==!1&&s.fork(),o.type!=null&&(s.uint32(8),r.Type.codec().encode(o.type,s)),o.peer!=null&&(s.uint32(18),ve.codec().encode(o.peer,s)),o.value!=null&&(s.uint32(26),s.bytes(o.value)),c.lengthDelimited!==!1&&s.ldelim()},(o,s)=>{let c={},l=s==null?o.len:o.pos+s;for(;o.pos<l;){let f=o.uint32();switch(f>>>3){case 1:c.type=r.Type.codec().decode(o);break;case 2:c.peer=ve.codec().decode(o,o.uint32());break;case 3:c.value=o.bytes();break;default:o.skipType(f&7);break}}return c})),n),r.encode=o=>X(o,r.codec()),r.decode=o=>Q(o,r.codec())})(it||(it={}));var ve;(function(r){let t;r.codec=()=>(t==null&&(t=J((e,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),e.id!=null&&e.id.byteLength>0&&(n.uint32(10),n.bytes(e.id)),e.addrs!=null)for(let s of e.addrs)n.uint32(18),n.bytes(s);o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={id:new Uint8Array(0),addrs:[]},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let c=e.uint32();switch(c>>>3){case 1:o.id=e.bytes();break;case 2:o.addrs.push(e.bytes());break;default:e.skipType(c&7);break}}return o})),t),r.encode=e=>X(e,r.codec()),r.decode=e=>Q(e,r.codec())})(ve||(ve={}));var Kn;(function(r){let t;(function(o){o.TAG_PEER="TAG_PEER",o.UNTAG_PEER="UNTAG_PEER",o.TRIM="TRIM"})(t=r.Type||(r.Type={}));let e;(function(o){o[o.TAG_PEER=0]="TAG_PEER",o[o.UNTAG_PEER=1]="UNTAG_PEER",o[o.TRIM=2]="TRIM"})(e||(e={})),function(o){o.codec=()=>le(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=J((o,s,c={})=>{c.lengthDelimited!==!1&&s.fork(),o.type!=null&&(s.uint32(8),r.Type.codec().encode(o.type,s)),o.peer!=null&&(s.uint32(18),s.bytes(o.peer)),o.tag!=null&&(s.uint32(26),s.string(o.tag)),o.weight!=null&&(s.uint32(32),s.int64(o.weight)),c.lengthDelimited!==!1&&s.ldelim()},(o,s)=>{let c={},l=s==null?o.len:o.pos+s;for(;o.pos<l;){let f=o.uint32();switch(f>>>3){case 1:c.type=r.Type.codec().decode(o);break;case 2:c.peer=o.bytes();break;case 3:c.tag=o.string();break;case 4:c.weight=o.int64();break;default:o.skipType(f&7);break}}return c})),n),r.encode=o=>X(o,r.codec()),r.decode=o=>Q(o,r.codec())})(Kn||(Kn={}));var Qn;(function(r){let t;r.codec=()=>(t==null&&(t=J((e,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),e.peer!=null&&e.peer.byteLength>0&&(n.uint32(10),n.bytes(e.peer)),o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={peer:new Uint8Array(0)},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let c=e.uint32();switch(c>>>3){case 1:o.peer=e.bytes();break;default:e.skipType(c&7);break}}return o})),t),r.encode=e=>X(e,r.codec()),r.decode=e=>Q(e,r.codec())})(Qn||(Qn={}));var fe;(function(r){let t;(function(o){o.GET_TOPICS="GET_TOPICS",o.LIST_PEERS="LIST_PEERS",o.PUBLISH="PUBLISH",o.SUBSCRIBE="SUBSCRIBE"})(t=r.Type||(r.Type={}));let e;(function(o){o[o.GET_TOPICS=0]="GET_TOPICS",o[o.LIST_PEERS=1]="LIST_PEERS",o[o.PUBLISH=2]="PUBLISH",o[o.SUBSCRIBE=3]="SUBSCRIBE"})(e||(e={})),function(o){o.codec=()=>le(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=J((o,s,c={})=>{c.lengthDelimited!==!1&&s.fork(),o.type!=null&&(s.uint32(8),r.Type.codec().encode(o.type,s)),o.topic!=null&&(s.uint32(18),s.string(o.topic)),o.data!=null&&(s.uint32(26),s.bytes(o.data)),c.lengthDelimited!==!1&&s.ldelim()},(o,s)=>{let c={},l=s==null?o.len:o.pos+s;for(;o.pos<l;){let f=o.uint32();switch(f>>>3){case 1:c.type=r.Type.codec().decode(o);break;case 2:c.topic=o.string();break;case 3:c.data=o.bytes();break;default:o.skipType(f&7);break}}return c})),n),r.encode=o=>X(o,r.codec()),r.decode=o=>Q(o,r.codec())})(fe||(fe={}));var Gr;(function(r){let t;r.codec=()=>(t==null&&(t=J((e,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),e.from!=null&&(n.uint32(10),n.bytes(e.from)),e.data!=null&&(n.uint32(18),n.bytes(e.data)),e.seqno!=null&&(n.uint32(26),n.bytes(e.seqno)),e.topicIDs!=null)for(let s of e.topicIDs)n.uint32(34),n.string(s);e.signature!=null&&(n.uint32(42),n.bytes(e.signature)),e.key!=null&&(n.uint32(50),n.bytes(e.key)),o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={topicIDs:[]},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let c=e.uint32();switch(c>>>3){case 1:o.from=e.bytes();break;case 2:o.data=e.bytes();break;case 3:o.seqno=e.bytes();break;case 4:o.topicIDs.push(e.string());break;case 5:o.signature=e.bytes();break;case 6:o.key=e.bytes();break;default:e.skipType(c&7);break}}return o})),t),r.encode=e=>X(e,r.codec()),r.decode=e=>Q(e,r.codec())})(Gr||(Gr={}));var Xn;(function(r){let t;r.codec=()=>(t==null&&(t=J((e,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),e.topics!=null)for(let s of e.topics)n.uint32(10),n.string(s);if(e.peerIDs!=null)for(let s of e.peerIDs)n.uint32(18),n.bytes(s);o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={topics:[],peerIDs:[]},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let c=e.uint32();switch(c>>>3){case 1:o.topics.push(e.string());break;case 2:o.peerIDs.push(e.bytes());break;default:e.skipType(c&7);break}}return o})),t),r.encode=e=>X(e,r.codec()),r.decode=e=>Q(e,r.codec())})(Xn||(Xn={}));var Fe;(function(r){let t;(function(o){o.UNSPECIFIED="UNSPECIFIED",o.GET_PROTOCOLS="GET_PROTOCOLS",o.GET_PEER_INFO="GET_PEER_INFO"})(t=r.Type||(r.Type={}));let e;(function(o){o[o.UNSPECIFIED=0]="UNSPECIFIED",o[o.GET_PROTOCOLS=1]="GET_PROTOCOLS",o[o.GET_PEER_INFO=2]="GET_PEER_INFO"})(e||(e={})),function(o){o.codec=()=>le(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=J((o,s,c={})=>{if(c.lengthDelimited!==!1&&s.fork(),o.type!=null&&(s.uint32(8),r.Type.codec().encode(o.type,s)),o.id!=null&&(s.uint32(18),s.bytes(o.id)),o.protos!=null)for(let l of o.protos)s.uint32(26),s.string(l);c.lengthDelimited!==!1&&s.ldelim()},(o,s)=>{let c={protos:[]},l=s==null?o.len:o.pos+s;for(;o.pos<l;){let f=o.uint32();switch(f>>>3){case 1:c.type=r.Type.codec().decode(o);break;case 2:c.id=o.bytes();break;case 3:c.protos.push(o.string());break;default:o.skipType(f&7);break}}return c})),n),r.encode=o=>X(o,r.codec()),r.decode=o=>Q(o,r.codec())})(Fe||(Fe={}));var Jn;(function(r){let t;r.codec=()=>(t==null&&(t=J((e,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),e.peer!=null&&(n.uint32(10),ve.codec().encode(e.peer,n)),e.protos!=null)for(let s of e.protos)n.uint32(18),n.string(s);o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={protos:[]},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let c=e.uint32();switch(c>>>3){case 1:o.peer=ve.codec().decode(e,e.uint32());break;case 2:o.protos.push(e.string());break;default:e.skipType(c&7);break}}return o})),t),r.encode=e=>X(e,r.codec()),r.decode=e=>Q(e,r.codec())})(Jn||(Jn={}));function tt(r){return Ue.encode({type:Ue.Type.OK,peers:[],...r}).subarray()}function $(r){return Ue.encode({type:Ue.Type.ERROR,error:{msg:r.message},peers:[]}).subarray()}async function Yn(r){for await(let t of r);}var to=ut("libp2p:daemon-server:dht"),eo=class{constructor(t){let{dht:e}=t;this.dht=e}async*provide(t){try{await Yn(this.dht.provide(t)),yield tt()}catch(e){to.error(e),yield $(e)}}async*getClosestPeers(t){yield tt({dht:{type:it.Type.BEGIN}});for await(let e of this.dht.getClosestPeers(t))e.name==="PEER_RESPONSE"&&(yield*e.closer.map(n=>it.encode({type:it.Type.VALUE,value:n.id.toBytes()})));yield it.encode({type:it.Type.END})}async*getPublicKey(t){yield $(new Error("FIX ME: not implemented"))}async*getValue(t){try{for await(let e of this.dht.get(t))e.name==="VALUE"&&(yield tt({dht:{type:it.Type.VALUE,value:e.value}}))}catch(e){to.error(e),yield $(e)}}async*putValue(t,e){try{await Yn(this.dht.put(t,e)),yield tt()}catch(n){to.error(n),yield $(n)}}async*findPeer(t){try{for await(let e of this.dht.findPeer(t))e.name==="FINAL_PEER"&&(yield tt({dht:{type:it.Type.VALUE,peer:{id:e.peer.id.toBytes(),addrs:e.peer.multiaddrs.map(n=>n.bytes)}}}));throw new Error("Peer not found")}catch(e){to.error(e),yield $(e)}}async*findProviders(t,e){yield tt({dht:{type:it.Type.BEGIN}});try{let n=e,o=0;for await(let s of this.dht.findProviders(t))if(s.name==="PEER_RESPONSE"){for(let c of s.providers)o++,yield it.encode({type:it.Type.VALUE,peer:{id:c.id.toBytes(),addrs:(c.multiaddrs??[]).map(l=>l.bytes)}});if(n===o)break}}catch(n){yield $(n)}yield it.encode({type:it.Type.END})}};var Ju=Symbol.for("@libp2p/peer-id");var a0=Symbol.for("nodejs.util.inspect.custom"),Yu=Object.values(yt).map(r=>r.decoder).reduce((r,t)=>r.or(t),yt.identity.decoder),tl=114,el=36,rl=37,Hr=class{constructor(t){this.type=t.type,this.multihash=t.multihash,this.privateKey=t.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}get[Ju](){return!0}toString(){return this.string==null&&(this.string=N.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return _.createV1(tl,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(t){if(t instanceof Uint8Array)return It(this.multihash.bytes,t);if(typeof t=="string")return u0(t).equals(this);if(t?.multihash?.bytes!=null)return It(this.multihash.bytes,t.multihash.bytes);throw new Error("not valid Id")}[a0](){return`PeerId(${this.toString()})`}},jr=class extends Hr{constructor(t){super({...t,type:"RSA"}),this.type="RSA",this.publicKey=t.publicKey}},qr=class extends Hr{constructor(t){super({...t,type:"Ed25519"}),this.type="Ed25519",this.publicKey=t.multihash.digest}},Wr=class extends Hr{constructor(t){super({...t,type:"secp256k1"}),this.type="secp256k1",this.publicKey=t.multihash.digest}};function u0(r,t){if(t=t??Yu,r.charAt(0)==="1"||r.charAt(0)==="Q"){let e=xt(N.decode(`z${r}`));return r.startsWith("12D")?new qr({multihash:e}):r.startsWith("16U")?new Wr({multihash:e}):new jr({multihash:e})}return $e(Yu.decode(r))}function $e(r){try{let t=xt(r);if(t.code===tn.code){if(t.digest.length===el)return new qr({multihash:t});if(t.digest.length===rl)return new Wr({multihash:t})}if(t.code===Yr.code)return new jr({multihash:t})}catch{return l0(_.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function l0(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==tl)throw new Error("Supplied PeerID CID is invalid");let t=r.multihash;if(t.code===Yr.code)return new jr({multihash:r.multihash});if(t.code===tn.code){if(t.digest.length===el)return new qr({multihash:r.multihash});if(t.digest.length===rl)return new Wr({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}var ro=ut("libp2p:daemon-server:pubsub"),no=class{constructor(t){let{pubsub:e}=t;this.pubsub=e}async*getTopics(){try{yield tt({pubsub:{topics:this.pubsub.getTopics(),peerIDs:[]}})}catch(t){ro.error(t),yield $(t)}}async*subscribe(t){try{let e=be();this.pubsub.subscribe(t),this.pubsub.addEventListener("message",n=>{let o=n.detail;o.topic===t&&(o.type==="signed"?e.push(Gr.encode({from:o.from.toBytes(),data:o.data,seqno:o.sequenceNumber==null?void 0:bt(o.sequenceNumber.toString(16).padStart(16,"0"),"base16"),topicIDs:[o.topic],signature:o.signature,key:o.key}).subarray()):e.push(Gr.encode({data:o.data,topicIDs:[o.topic]}).subarray()))}),yield tt(),yield*e}catch(e){ro.error(e),yield $(e)}}async*publish(t,e){try{await this.pubsub.publish(t,e),yield tt()}catch(n){ro.error(n),yield $(n)}}async*listPeers(t){try{yield tt({pubsub:{topics:[t],peerIDs:this.pubsub.getSubscribers(t).map(e=>e.toBytes())}})}catch(e){ro.error(e),yield $(e)}}};var f0=1<<22,he=ut("libp2p:daemon-server"),oo=class{constructor(t){let{multiaddr:e,libp2pNode:n}=t;this.multiaddr=e,this.libp2p=n,this.tcp=Fa()(),this.listener=this.tcp.createListener({handler:this.handleConnection.bind(this),upgrader:si}),this._onExit=this._onExit.bind(this),n.dht!=null&&(this.dhtOperations=new eo({dht:n.dht})),n.pubsub!=null&&(this.pubsubOperations=new no({pubsub:n.pubsub}))}async connect(t){if(t.connect==null||t.connect.addrs==null)throw new Error("Invalid request");let e=t.connect.peer,n=t.connect.addrs.map(s=>Ys(s)),o=$e(e);return await this.libp2p.peerStore.addressBook.set(o,n),await this.libp2p.dial(o)}async openStream(t){if(t.streamOpen==null||t.streamOpen.proto==null)throw new Error("Invalid request");let{peer:e,proto:n}=t.streamOpen,o=$e(e),s=await this.libp2p.dial(o),c=await s.newStream(n);return{streamInfo:{peer:o.toBytes(),addr:s.remoteAddr.bytes,proto:c.stat.protocol??""},connection:c}}async registerStreamHandler(t){if(t.streamHandler==null||t.streamHandler.proto==null)throw new Error("Invalid request");let e=t.streamHandler.proto,n=Ys(t.streamHandler.addr),o;await this.libp2p.handle(e,({connection:s,stream:c})=>{Promise.resolve().then(async()=>{o=await this.tcp.dial(n,{upgrader:si});let l=pr.encode({peer:s.remotePeer.toBytes(),addr:s.remoteAddr.bytes,proto:c.stat.protocol??""}),f=ur.single(l);await Mn(async function*(){yield f,yield*c.source}(),async function*(d){for await(let h of d)yield*h},o,c.sink)}).catch(async l=>{he.error(l),o!=null&&await o.close(l)}).finally(()=>{o?.close().catch(l=>{he.error(l)})})})}_listen(){process.on("SIGTERM",this._onExit),process.on("SIGINT",this._onExit),process.on("SIGHUP",this._onExit)}_onExit(){this.stop({exit:!0}).catch(t=>{he.error(t)})}async start(){this._listen(),await this.libp2p.start(),await this.listener.listen(this.multiaddr)}getMultiaddr(){let t=this.listener.getAddrs();if(t.length>0)return t[0];throw new Error("Not started")}async stop(t={exit:!1}){await this.libp2p.stop(),await this.listener.close(),t.exit&&he("server closed, exiting"),process.removeListener("SIGTERM",this._onExit),process.removeListener("SIGINT",this._onExit),process.removeListener("SIGHUP",this._onExit)}async*handlePeerStoreRequest(t){try{switch(t.type){case Fe.Type.GET_PROTOCOLS:if(t.id==null)throw new Error("Invalid request");let e=$e(t.id),o=(await this.libp2p.peerStore.get(e)).protocols;yield tt({peerStore:{protos:o}});return;case Fe.Type.GET_PEER_INFO:throw new Error("ERR_NOT_IMPLEMENTED");default:throw new Error("ERR_INVALID_REQUEST_TYPE")}}catch(e){he.error(e),yield $(e)}}async*handlePubsubRequest(t){try{if(this.libp2p.pubsub==null||this.pubsubOperations==null)throw new Error("PubSub not configured");switch(t.type){case fe.Type.GET_TOPICS:yield*this.pubsubOperations.getTopics();return;case fe.Type.SUBSCRIBE:if(t.topic==null)throw new Error("Invalid request");yield*this.pubsubOperations.subscribe(t.topic);return;case fe.Type.PUBLISH:if(t.topic==null||t.data==null)throw new Error("Invalid request");yield*this.pubsubOperations.publish(t.topic,t.data);return;case fe.Type.LIST_PEERS:if(t.topic==null)throw new Error("Invalid request");yield*this.pubsubOperations.listPeers(t.topic);return;default:throw new Error("ERR_INVALID_REQUEST_TYPE")}}catch(e){he.error(e),yield $(e)}}async*handleDHTRequest(t){try{if(this.libp2p.dht==null||this.dhtOperations==null)throw new Error("DHT not configured");switch(t.type){case Pt.Type.FIND_PEER:if(t.peer==null)throw new Error("Invalid request");yield*this.dhtOperations.findPeer($e(t.peer));return;case Pt.Type.FIND_PROVIDERS:if(t.cid==null)throw new Error("Invalid request");yield*this.dhtOperations.findProviders(_.decode(t.cid),t.count??20);return;case Pt.Type.PROVIDE:if(t.cid==null)throw new Error("Invalid request");yield*this.dhtOperations.provide(_.decode(t.cid));return;case Pt.Type.GET_CLOSEST_PEERS:if(t.key==null)throw new Error("Invalid request");yield*this.dhtOperations.getClosestPeers(t.key);return;case Pt.Type.GET_PUBLIC_KEY:if(t.peer==null)throw new Error("Invalid request");yield*this.dhtOperations.getPublicKey($e(t.peer));return;case Pt.Type.GET_VALUE:if(t.key==null)throw new Error("Invalid request");yield*this.dhtOperations.getValue(t.key);return;case Pt.Type.PUT_VALUE:if(t.key==null||t.value==null)throw new Error("Invalid request");yield*this.dhtOperations.putValue(t.key,t.value);return;default:throw new Error("ERR_INVALID_REQUEST_TYPE")}}catch(e){he.error(e),yield $(e)}}handleConnection(t){let e=this,n=new Un({stream:t,maxLength:f0});Mn(n.decoder,o=>async function*(){let s;for await(let c of o)try{switch(s=Ot.decode(c),s.type){case Ot.Type.CONNECT:{try{await e.connect(s)}catch(l){yield $(l);break}yield tt();break}case Ot.Type.IDENTIFY:{yield tt({identify:{id:e.libp2p.peerId.toBytes(),addrs:e.libp2p.getMultiaddrs().map(l=>l.decapsulateCode(U("p2p").code)).map(l=>l.bytes)}});break}case Ot.Type.LIST_PEERS:{let l=[],f=new Set;for(let d of e.libp2p.getConnections()){let h=d.remotePeer.toString();f.has(h)||(f.add(h),l.push({id:d.remotePeer.toBytes(),addrs:[d.remoteAddr.bytes]}))}yield tt({peers:l});break}case Ot.Type.STREAM_OPEN:{let l;try{l=await e.openStream(s)}catch(d){yield $(d);break}yield tt({streamInfo:l.streamInfo});let f=n.rest();await Mn(f,l.connection,async function*(d){for await(let h of d)yield*h},f);return}case Ot.Type.STREAM_HANDLER:{try{await e.registerStreamHandler(s)}catch(l){yield $(l);break}yield tt();break}case Ot.Type.PEERSTORE:{if(s.peerStore==null){yield $(new Error("ERR_INVALID_REQUEST"));break}yield*e.handlePeerStoreRequest(s.peerStore);break}case Ot.Type.PUBSUB:{if(s.pubsub==null){yield $(new Error("ERR_INVALID_REQUEST"));break}yield*e.handlePubsubRequest(s.pubsub);break}case Ot.Type.DHT:{if(s.dht==null){yield $(new Error("ERR_INVALID_REQUEST"));break}yield*e.handleDHTRequest(s.dht);break}default:yield $(new Error("ERR_INVALID_REQUEST_TYPE"));break}}catch(l){he.error(l),yield $(l);continue}}(),async function(o){for await(let s of o)n.write(s)}).catch(o=>{he(o)})}},h0=(r,t)=>new oo({multiaddr:r,libp2pNode:t});return Gf(p0);})();
|
|
7
7
|
return Libp2PDaemonServer}));
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAMxD,OAAO,EACL,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,SAAS,EACT,UAAU,EACX,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EAAE,UAAU,EAAuB,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAC3F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,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,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC;IAwC7F;;OAEG;IACK,gBAAgB,CAAE,OAAO,EAAE,UAAU,GAAG,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC;IAiE3F;;OAEG;IACH,gBAAgB,CAAE,UAAU,EAAE,UAAU,GAAG,IAAI;CAoJhD;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,cAAe,SAAS,cAAc,MAAM,KAAG,YAOvE,CAAA"}
|
package/dist/src/index.js
CHANGED
|
@@ -209,6 +209,12 @@ export class Server {
|
|
|
209
209
|
}
|
|
210
210
|
yield* this.pubsubOperations.publish(request.topic, request.data);
|
|
211
211
|
return;
|
|
212
|
+
case PSRequest.Type.LIST_PEERS:
|
|
213
|
+
if (request.topic == null) {
|
|
214
|
+
throw new Error('Invalid request');
|
|
215
|
+
}
|
|
216
|
+
yield* this.pubsubOperations.listPeers(request.topic);
|
|
217
|
+
return;
|
|
212
218
|
default:
|
|
213
219
|
throw new Error('ERR_INVALID_REQUEST_TYPE');
|
|
214
220
|
}
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAE9D,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,KAAK,EAAE,MAAM,oBAAoB,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAA;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AACtE,OAAO,EACL,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,SAAS,EACT,UAAU,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IAEF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
package/dist/src/pubsub.d.ts
CHANGED
|
@@ -8,5 +8,6 @@ export declare class PubSubOperations {
|
|
|
8
8
|
getTopics(): AsyncGenerator<Uint8Array, void, undefined>;
|
|
9
9
|
subscribe(topic: string): AsyncGenerator<Uint8Array, void, undefined>;
|
|
10
10
|
publish(topic: string, data: Uint8Array): AsyncGenerator<Uint8Array, void, undefined>;
|
|
11
|
+
listPeers(topic: string): AsyncGenerator<Uint8Array, void, undefined>;
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=pubsub.d.ts.map
|
package/dist/src/pubsub.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pubsub.d.ts","sourceRoot":"","sources":["../../src/pubsub.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAOtD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAA;CACf;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;gBAElB,IAAI,EAAE,oBAAoB;IAM/B,SAAS,IAAK,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC;IAczD,SAAS,CAAE,KAAK,EAAE,MAAM,GAAG,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC;IAqCtE,OAAO,CAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"pubsub.d.ts","sourceRoot":"","sources":["../../src/pubsub.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAOtD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAA;CACf;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;gBAElB,IAAI,EAAE,oBAAoB;IAM/B,SAAS,IAAK,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC;IAczD,SAAS,CAAE,KAAK,EAAE,MAAM,GAAG,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC;IAqCtE,OAAO,CAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC;IAUtF,SAAS,CAAE,KAAK,EAAE,MAAM,GAAG,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC;CAa/E"}
|
package/dist/src/pubsub.js
CHANGED
|
@@ -68,5 +68,19 @@ export class PubSubOperations {
|
|
|
68
68
|
yield ErrorResponse(err);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
+
async *listPeers(topic) {
|
|
72
|
+
try {
|
|
73
|
+
yield OkResponse({
|
|
74
|
+
pubsub: {
|
|
75
|
+
topics: [topic],
|
|
76
|
+
peerIDs: this.pubsub.getSubscribers(topic).map(peer => peer.toBytes())
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
log.error(err);
|
|
82
|
+
yield ErrorResponse(err);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
71
85
|
}
|
|
72
86
|
//# sourceMappingURL=pubsub.js.map
|
package/dist/src/pubsub.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pubsub.js","sourceRoot":"","sources":["../../src/pubsub.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,OAAO,EACL,SAAS,EACV,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE1D,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA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AC,CAAE,SAAS,CAAE,KAAa;QAC9B,IAAI;YACF,MAAM,UAAU,CAAC;gBACf,MAAM,EAAE;oBACN,MAAM,EAAE,CAAC,KAAK,CAAC;oBACf,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;iBACvE;aACF,CAAC,CAAA;SACH;QAAC,OAAO,GAAQ,EAAE;YACjB,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YACd,MAAM,aAAa,CAAC,GAAG,CAAC,CAAA;SACzB;IACH,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/daemon-server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "API server for libp2p-daemon instances",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p-daemon/tree/master/packages/libp2p-daemon-server#readme",
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
"@libp2p/logger": "^2.0.0",
|
|
151
151
|
"@libp2p/peer-id": "^2.0.0",
|
|
152
152
|
"@libp2p/tcp": "^6.0.8",
|
|
153
|
-
"@multiformats/multiaddr": "^
|
|
153
|
+
"@multiformats/multiaddr": "^12.0.0",
|
|
154
154
|
"it-drain": "^2.0.0",
|
|
155
155
|
"it-length-prefixed": "^8.0.2",
|
|
156
156
|
"it-pipe": "^2.0.3",
|
package/src/index.ts
CHANGED
|
@@ -297,6 +297,13 @@ export class Server implements Libp2pServer {
|
|
|
297
297
|
|
|
298
298
|
yield * this.pubsubOperations.publish(request.topic, request.data)
|
|
299
299
|
return
|
|
300
|
+
case PSRequest.Type.LIST_PEERS:
|
|
301
|
+
if (request.topic == null) {
|
|
302
|
+
throw new Error('Invalid request')
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
yield * this.pubsubOperations.listPeers(request.topic)
|
|
306
|
+
return
|
|
300
307
|
default:
|
|
301
308
|
throw new Error('ERR_INVALID_REQUEST_TYPE')
|
|
302
309
|
}
|
package/src/pubsub.ts
CHANGED
|
@@ -84,4 +84,18 @@ export class PubSubOperations {
|
|
|
84
84
|
yield ErrorResponse(err)
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
+
|
|
88
|
+
async * listPeers (topic: string): AsyncGenerator<Uint8Array, void, undefined> {
|
|
89
|
+
try {
|
|
90
|
+
yield OkResponse({
|
|
91
|
+
pubsub: {
|
|
92
|
+
topics: [topic],
|
|
93
|
+
peerIDs: this.pubsub.getSubscribers(topic).map(peer => peer.toBytes())
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
} catch (err: any) {
|
|
97
|
+
log.error(err)
|
|
98
|
+
yield ErrorResponse(err)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
87
101
|
}
|