@libp2p/bootstrap 7.0.1 → 8.0.0-05abd49f
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/README.md +4 -4
- package/dist/index.min.js +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.js +3 -3
- package/dist/src/index.js.map +1 -1
- package/package.json +16 -108
- package/src/index.ts +7 -7
- package/dist/typedoc-urls.json +0 -5
package/README.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
[](http://libp2p.io/)
|
|
4
4
|
[](https://discuss.libp2p.io)
|
|
5
|
-
[](https://codecov.io/gh/libp2p/js-libp2p)
|
|
6
|
+
[](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster)
|
|
7
7
|
|
|
8
|
-
>
|
|
8
|
+
> Peer discovery via a list of bootstrap peers
|
|
9
9
|
|
|
10
10
|
## Table of contents <!-- omit in toc -->
|
|
11
11
|
|
|
@@ -89,7 +89,7 @@ start()
|
|
|
89
89
|
|
|
90
90
|
## API Docs
|
|
91
91
|
|
|
92
|
-
- <https://libp2p.github.io/js-libp2p
|
|
92
|
+
- <https://libp2p.github.io/js-libp2p/modules/_libp2p_bootstrap.html>
|
|
93
93
|
|
|
94
94
|
## License
|
|
95
95
|
|
package/dist/index.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PBootstrap = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var Libp2PBootstrap=(()=>{var en=Object.create;var he=Object.defineProperty;var tn=Object.getOwnPropertyDescriptor;var rn=Object.getOwnPropertyNames;var nn=Object.getPrototypeOf,on=Object.prototype.hasOwnProperty;var sn=(t,e,r)=>e in t?he(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var J=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),P=(t,e)=>{for(var r in e)he(t,r,{get:e[r],enumerable:!0})},Rt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of rn(e))!on.call(t,o)&&o!==r&&he(t,o,{get:()=>e[o],enumerable:!(n=tn(e,o))||n.enumerable});return t};var Ue=(t,e,r)=>(r=t!=null?en(nn(t)):{},Rt(e||!t||!t.__esModule?he(r,"default",{value:t,enumerable:!0}):r,t)),an=t=>Rt(he({},"__esModule",{value:!0}),t);var Xe=(t,e,r)=>(sn(t,typeof e!="symbol"?e+"":e,r),r);var _t=J((ks,$t)=>{var Z=1e3,ee=Z*60,te=ee*60,H=te*24,un=H*7,ln=H*365.25;$t.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return fn(t);if(r==="number"&&isFinite(t))return e.long?pn(t):dn(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function fn(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*ln;case"weeks":case"week":case"w":return r*un;case"days":case"day":case"d":return r*H;case"hours":case"hour":case"hrs":case"hr":case"h":return r*te;case"minutes":case"minute":case"mins":case"min":case"m":return r*ee;case"seconds":case"second":case"secs":case"sec":case"s":return r*Z;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function dn(t){var e=Math.abs(t);return e>=H?Math.round(t/H)+"d":e>=te?Math.round(t/te)+"h":e>=ee?Math.round(t/ee)+"m":e>=Z?Math.round(t/Z)+"s":t+"ms"}function pn(t){var e=Math.abs(t);return e>=H?Ne(t,e,H,"day"):e>=te?Ne(t,e,te,"hour"):e>=ee?Ne(t,e,ee,"minute"):e>=Z?Ne(t,e,Z,"second"):t+" ms"}function Ne(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var jt=J((Ms,Vt)=>{function hn(t){r.debug=r,r.default=r,r.coerce=w,r.disable=s,r.enable=o,r.enabled=i,r.humanize=_t(),r.destroy=I,Object.keys(t).forEach(c=>{r[c]=t[c]}),r.names=[],r.skips=[],r.formatters={};function e(c){let l=0;for(let p=0;p<c.length;p++)l=(l<<5)-l+c.charCodeAt(p),l|=0;return r.colors[Math.abs(l)%r.colors.length]}r.selectColor=e;function r(c){let l,p=null,S,d;function b(...y){if(!b.enabled)return;let x=b,A=Number(new Date),D=A-(l||A);x.diff=D,x.prev=l,x.curr=A,l=A,y[0]=r.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let E=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(N,F)=>{if(N==="%%")return"%";E++;let k=r.formatters[F];if(typeof k=="function"){let Y=y[E];N=k.call(x,Y),y.splice(E,1),E--}return N}),r.formatArgs.call(x,y),(x.log||r.log).apply(x,y)}return b.namespace=c,b.useColors=r.useColors(),b.color=r.selectColor(c),b.extend=n,b.destroy=r.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(S!==r.namespaces&&(S=r.namespaces,d=r.enabled(c)),d),set:y=>{p=y}}),typeof r.init=="function"&&r.init(b),b}function n(c,l){let p=r(this.namespace+(typeof l>"u"?":":l)+c);return p.log=this.log,p}function o(c){r.save(c),r.namespaces=c,r.names=[],r.skips=[];let l,p=(typeof c=="string"?c:"").split(/[\s,]+/),S=p.length;for(l=0;l<S;l++)p[l]&&(c=p[l].replace(/\*/g,".*?"),c[0]==="-"?r.skips.push(new RegExp("^"+c.slice(1)+"$")):r.names.push(new RegExp("^"+c+"$")))}function s(){let c=[...r.names.map(f),...r.skips.map(f).map(l=>"-"+l)].join(",");return r.enable(""),c}function i(c){if(c[c.length-1]==="*")return!0;let l,p;for(l=0,p=r.skips.length;l<p;l++)if(r.skips[l].test(c))return!1;for(l=0,p=r.names.length;l<p;l++)if(r.names[l].test(c))return!0;return!1}function f(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}function w(c){return c instanceof Error?c.stack||c.message:c}function I(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}Vt.exports=hn});var qt=J((U,ke)=>{U.formatArgs=bn;U.save=gn;U.load=wn;U.useColors=mn;U.storage=yn();U.destroy=(()=>{let t=!1;return()=>{t||(t=!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`."))}})();U.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 mn(){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 bn(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+ke.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}U.log=console.debug||console.log||(()=>{});function gn(t){try{t?U.storage.setItem("debug",t):U.storage.removeItem("debug")}catch{}}function wn(){let t;try{t=U.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function yn(){try{return localStorage}catch{}}ke.exports=jt()(U);var{formatters:xn}=ke.exports;xn.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Er=J((Xi,Sr)=>{Sr.exports=At;var Cr=128,Lo=127,zo=~Lo,Ro=Math.pow(2,31);function At(t,e,r){if(Number.MAX_SAFE_INTEGER&&t>Number.MAX_SAFE_INTEGER)throw At.bytes=0,new RangeError("Could not encode varint");e=e||[],r=r||0;for(var n=r;t>=Ro;)e[r++]=t&255|Cr,t/=128;for(;t&zo;)e[r++]=t&255|Cr,t>>>=7;return e[r]=t|0,At.bytes=r-n+1,e}});var Ir=J((Ki,Tr)=>{Tr.exports=Tt;var Oo=128,Ar=127;function Tt(t,n){var r=0,n=n||0,o=0,s=n,i,f=t.length;do{if(s>=f||o>49)throw Tt.bytes=0,new RangeError("Could not decode varint");i=t[s++],r+=o<28?(i&Ar)<<o:(i&Ar)*Math.pow(2,o),o+=7}while(i>=Oo);return Tt.bytes=s-n,r}});var Pr=J((Yi,Fr)=>{var $o=Math.pow(2,7),_o=Math.pow(2,14),Vo=Math.pow(2,21),jo=Math.pow(2,28),qo=Math.pow(2,35),Wo=Math.pow(2,42),Go=Math.pow(2,49),Jo=Math.pow(2,56),Ho=Math.pow(2,63);Fr.exports=function(t){return t<$o?1:t<_o?2:t<Vo?3:t<jo?4:t<qo?5:t<Wo?6:t<Go?7:t<Jo?8:t<Ho?9:10}});var Ve=J((Zi,Ur)=>{Ur.exports={encode:Er(),decode:Ir(),encodingLength:Pr()}});var Fs={};P(Fs,{bootstrap:()=>Is});var Us=Symbol.for("@libp2p/peer-discovery"),Ot=Symbol.for("@libp2p/peer-discovery");var De=class extends EventTarget{#e=new Map;listenerCount(e){let r=this.#e.get(e);return r==null?0:r.length}addEventListener(e,r,n){super.addEventListener(e,r,n);let o=this.#e.get(e);o==null&&(o=[],this.#e.set(e,o)),o.push({callback:r,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,r,n){super.removeEventListener(e.toString(),r??null,n);let o=this.#e.get(e);o!=null&&(o=o.filter(({callback:s})=>s!==r),this.#e.set(e,o))}dispatchEvent(e){let r=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:o})=>!o),this.#e.set(e.type,n)),r}safeDispatchEvent(e,r){return this.dispatchEvent(new cn(e,r))}},Ke=class extends Event{detail;constructor(e,r){super(e,r),this.detail=r?.detail}},cn=globalThis.CustomEvent??Ke;var M=Ue(qt(),1);var rt={};P(rt,{base58btc:()=>v,base58flickr:()=>Tn});function vn(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<t.length;o++){var s=t.charAt(o),i=s.charCodeAt(0);if(r[i]!==255)throw new TypeError(s+" is ambiguous");r[i]=o}var f=t.length,w=t.charAt(0),I=Math.log(f)/Math.log(256),c=Math.log(256)/Math.log(f);function l(d){if(d instanceof Uint8Array||(ArrayBuffer.isView(d)?d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):Array.isArray(d)&&(d=Uint8Array.from(d))),!(d instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(d.length===0)return"";for(var b=0,y=0,x=0,A=d.length;x!==A&&d[x]===0;)x++,b++;for(var D=(A-x)*c+1>>>0,E=new Uint8Array(D);x!==A;){for(var B=d[x],N=0,F=D-1;(B!==0||N<y)&&F!==-1;F--,N++)B+=256*E[F]>>>0,E[F]=B%f>>>0,B=B/f>>>0;if(B!==0)throw new Error("Non-zero carry");y=N,x++}for(var k=D-y;k!==D&&E[k]===0;)k++;for(var Y=w.repeat(b);k<D;++k)Y+=t.charAt(E[k]);return Y}function p(d){if(typeof d!="string")throw new TypeError("Expected String");if(d.length===0)return new Uint8Array;var b=0;if(d[b]!==" "){for(var y=0,x=0;d[b]===w;)y++,b++;for(var A=(d.length-b)*I+1>>>0,D=new Uint8Array(A);d[b];){var E=r[d.charCodeAt(b)];if(E===255)return;for(var B=0,N=A-1;(E!==0||B<x)&&N!==-1;N--,B++)E+=f*D[N]>>>0,D[N]=E%256>>>0,E=E/256>>>0;if(E!==0)throw new Error("Non-zero carry");x=B,b++}if(d[b]!==" "){for(var F=A-x;F!==A&&D[F]===0;)F++;for(var k=new Uint8Array(y+(A-F)),Y=y;F!==A;)k[Y++]=D[F++];return k}}}function S(d){var b=p(d);if(b)return b;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:p,decode:S}}var Cn=vn,Sn=Cn,Wt=Sn;var Ls=new Uint8Array(0);var Gt=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},R=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};var Jt=t=>new TextEncoder().encode(t),Ht=t=>new TextDecoder().decode(t);var Ye=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Ze=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Xt(this,e)}},et=class{constructor(e){this.decoders=e}or(e){return Xt(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Xt=(t,e)=>new et({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),tt=class{constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new Ye(e,r,n),this.decoder=new Ze(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},re=({name:t,prefix:e,encode:r,decode:n})=>new tt(t,e,r,n),V=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:o}=Wt(r,e);return re({prefix:t,name:e,encode:n,decode:s=>R(o(s))})},En=(t,e,r,n)=>{let o={};for(let c=0;c<e.length;++c)o[e[c]]=c;let s=t.length;for(;t[s-1]==="=";)--s;let i=new Uint8Array(s*r/8|0),f=0,w=0,I=0;for(let c=0;c<s;++c){let l=o[t[c]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);w=w<<r|l,f+=r,f>=8&&(f-=8,i[I++]=255&w>>f)}if(f>=r||255&w<<8-f)throw new SyntaxError("Unexpected end of data");return i},An=(t,e,r)=>{let n=e[e.length-1]==="=",o=(1<<r)-1,s="",i=0,f=0;for(let w=0;w<t.length;++w)for(f=f<<8|t[w],i+=8;i>r;)i-=r,s+=e[o&f>>i];if(i&&(s+=e[o&f<<r-i]),n)for(;s.length*r&7;)s+="=";return s},g=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>re({prefix:e,name:t,encode(o){return An(o,n,r)},decode(o){return En(o,n,r,t)}});var v=V({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Tn=V({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var nt={};P(nt,{base32:()=>L,base32hex:()=>Un,base32hexpad:()=>Nn,base32hexpadupper:()=>kn,base32hexupper:()=>Dn,base32pad:()=>Fn,base32padupper:()=>Pn,base32upper:()=>In,base32z:()=>Mn});var L=g({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),In=g({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Fn=g({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Pn=g({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Un=g({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Dn=g({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Nn=g({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),kn=g({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Mn=g({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var st={};P(st,{base64:()=>ot,base64pad:()=>Bn,base64url:()=>Ln,base64urlpad:()=>zn});var ot=g({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Bn=g({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Ln=g({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),zn=g({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});M.default.formatters.b=t=>t==null?"undefined":v.baseEncode(t);M.default.formatters.t=t=>t==null?"undefined":L.baseEncode(t);M.default.formatters.m=t=>t==null?"undefined":ot.baseEncode(t);M.default.formatters.p=t=>t==null?"undefined":t.toString();M.default.formatters.c=t=>t==null?"undefined":t.toString();M.default.formatters.k=t=>t==null?"undefined":t.toString();function Rn(t){let e=()=>{};return e.enabled=!1,e.color="",e.diff=0,e.log=()=>{},e.namespace=t,e.destroy=()=>!0,e.extend=()=>e,e}function Kt(t){let e=Rn(`${t}:trace`);return M.default.enabled(`${t}:trace`)&&M.default.names.map(r=>r.toString()).find(r=>r.includes(":trace"))!=null&&(e=(0,M.default)(`${t}:trace`)),Object.assign((0,M.default)(t),{error:(0,M.default)(`${t}:error`),trace:e})}var On=er,Yt=128,$n=127,_n=~$n,Vn=Math.pow(2,31);function er(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Vn;)e[r++]=t&255|Yt,t/=128;for(;t&_n;)e[r++]=t&255|Yt,t>>>=7;return e[r]=t|0,er.bytes=r-n+1,e}var jn=it,qn=128,Zt=127;function it(t,n){var r=0,n=n||0,o=0,s=n,i,f=t.length;do{if(s>=f)throw it.bytes=0,new RangeError("Could not decode varint");i=t[s++],r+=o<28?(i&Zt)<<o:(i&Zt)*Math.pow(2,o),o+=7}while(i>=qn);return it.bytes=s-n,r}var Wn=Math.pow(2,7),Gn=Math.pow(2,14),Jn=Math.pow(2,21),Hn=Math.pow(2,28),Qn=Math.pow(2,35),Xn=Math.pow(2,42),Kn=Math.pow(2,49),Yn=Math.pow(2,56),Zn=Math.pow(2,63),eo=function(t){return t<Wn?1:t<Gn?2:t<Jn?3:t<Hn?4:t<Qn?5:t<Xn?6:t<Kn?7:t<Yn?8:t<Zn?9:10},to={encode:On,decode:jn,encodingLength:eo},ro=to,me=ro;var be=(t,e=0)=>[me.decode(t,e),me.decode.bytes],ne=(t,e,r=0)=>(me.encode(t,e,r),e),oe=t=>me.encodingLength(t);var j=(t,e)=>{let r=e.byteLength,n=oe(t),o=n+oe(r),s=new Uint8Array(o+r);return ne(t,s,0),ne(r,s,n),s.set(e,o),new se(t,r,e,s)},Q=t=>{let e=R(t),[r,n]=be(e),[o,s]=be(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new se(r,o,i,e)},tr=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Gt(t.bytes,r.bytes)}},se=class{constructor(e,r,n,o){this.code=e,this.size=r,this.digest=n,this.bytes=o}};var rr=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return oo(r,at(t),e||v.encoder);default:return so(r,at(t),e||L.encoder)}};var nr=new WeakMap,at=t=>{let e=nr.get(t);if(e==null){let r=new Map;return nr.set(t,r),r}return e},h=class{constructor(e,r,n,o){this.code=r,this.version=e,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:e,multihash:r}=this;if(e!==ge)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==io)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return h.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=j(e,r);return h.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(e){return h.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&tr(e.multihash,n.multihash)}toString(e){return rr(this,e)}toJSON(){return{"/":rr(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof h)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:s,bytes:i}=r;return new h(n,o,s,i||or(n,o,s.bytes))}else if(r[ao]===!0){let{version:n,multihash:o,code:s}=r,i=Q(o);return h.create(n,s,i)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==ge)throw new Error(`Version 0 CID must use dag-pb (code: ${ge}) block encoding`);return new h(e,r,n,n.bytes)}case 1:{let o=or(e,r,n.bytes);return new h(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return h.create(0,ge,e)}static createV1(e,r){return h.create(1,e,r)}static decode(e){let[r,n]=h.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=h.inspectBytes(e),n=r.size-r.multihashSize,o=R(e.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=o.subarray(r.multihashSize-r.digestSize),i=new se(r.multihashCode,r.digestSize,s,o);return[r.version===0?h.createV0(i):h.createV1(r.codec,i),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[l,p]=be(e.subarray(r));return r+=p,l},o=n(),s=ge;if(o===18?(o=0,r=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=r,f=n(),w=n(),I=r+w,c=I-i;return{version:o,codec:s,multihashCode:f,digestSize:w,multihashSize:c,size:I}}static parse(e,r){let[n,o]=no(e,r),s=h.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return at(s).set(n,e),s}},no=(t,e)=>{switch(t[0]){case"Q":{let r=e||v;return[v.prefix,r.decode(`${v.prefix}${t}`)]}case v.prefix:{let r=e||v;return[v.prefix,r.decode(t)]}case L.prefix:{let r=e||L;return[L.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},oo=(t,e,r)=>{let{prefix:n}=r;if(n!==v.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=e.get(n);if(o==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return o},so=(t,e,r)=>{let{prefix:n}=r,o=e.get(n);if(o==null){let s=r.encode(t);return e.set(n,s),s}else return o},ge=112,io=18,or=(t,e,r)=>{let n=oe(t),o=n+oe(e),s=new Uint8Array(o+r.byteLength);return ne(t,s,0),ne(e,s,n),s.set(r,o),s},ao=Symbol.for("@ipld/js-cid/CID");var ct={};P(ct,{identity:()=>co});var co=re({prefix:"\0",name:"identity",encode:t=>Ht(t),decode:t=>Jt(t)});var ut={};P(ut,{base2:()=>uo});var uo=g({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var lt={};P(lt,{base8:()=>lo});var lo=g({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ft={};P(ft,{base10:()=>fo});var fo=V({prefix:"9",name:"base10",alphabet:"0123456789"});var dt={};P(dt,{base16:()=>po,base16upper:()=>ho});var po=g({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ho=g({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var pt={};P(pt,{base36:()=>mo,base36upper:()=>bo});var mo=V({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),bo=V({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var ht={};P(ht,{base256emoji:()=>vo});var sr=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}"),go=sr.reduce((t,e,r)=>(t[r]=e,t),[]),wo=sr.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function yo(t){return t.reduce((e,r)=>(e+=go[r],e),"")}function xo(t){let e=[];for(let r of t){let n=wo[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var vo=re({prefix:"\u{1F680}",name:"base256emoji",encode:yo,decode:xo});var gt={};P(gt,{sha256:()=>Be,sha512:()=>Co});var bt=({name:t,code:e,encode:r})=>new mt(t,e,r),mt=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?j(this.code,r):r.then(n=>j(this.code,n))}else throw Error("Unknown type, must be binary type")}};var ar=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Be=bt({name:"sha2-256",code:18,encode:ar("SHA-256")}),Co=bt({name:"sha2-512",code:19,encode:ar("SHA-512")});var wt={};P(wt,{identity:()=>Le});var cr=0,So="identity",ur=R,Eo=t=>j(cr,ur(t)),Le={code:cr,name:So,encode:ur,digest:Eo};var di=new TextEncoder,pi=new TextDecoder;var q={...ct,...ut,...lt,...ft,...dt,...nt,...pt,...rt,...st,...ht},wi={...gt,...wt};function we(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}var ye=class extends Error{code;props;constructor(e,r,n){super(e),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var lr=Symbol.for("@libp2p/peer-id");var Io=Symbol.for("nodejs.util.inspect.custom"),fr=Object.values(q).map(t=>t.decoder).reduce((t,e)=>t.or(e),q.identity.decoder),dr=114,pr=36,hr=37,xe=class{constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}get[lr](){return!0}toString(){return this.string==null&&(this.string=v.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return h.createV1(dr,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return we(this.multihash.bytes,e);if(typeof e=="string")return yt(e).equals(this);if(e?.multihash?.bytes!=null)return we(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[Io](){return`PeerId(${this.toString()})`}},ve=class extends xe{constructor(e){super({...e,type:"RSA"}),this.type="RSA",this.publicKey=e.publicKey}},Ce=class extends xe{constructor(e){super({...e,type:"Ed25519"}),this.type="Ed25519",this.publicKey=e.multihash.digest}},Se=class extends xe{constructor(e){super({...e,type:"secp256k1"}),this.type="secp256k1",this.publicKey=e.multihash.digest}};function yt(t,e){if(e=e??fr,t.charAt(0)==="1"||t.charAt(0)==="Q"){let r=Q(v.decode(`z${t}`));return t.startsWith("12D")?new Ce({multihash:r}):t.startsWith("16U")?new Se({multihash:r}):new ve({multihash:r})}return Fo(fr.decode(t))}function Fo(t){try{let e=Q(t);if(e.code===Le.code){if(e.digest.length===pr)return new Ce({multihash:e});if(e.digest.length===hr)return new Se({multihash:e})}if(e.code===Be.code)return new ve({multihash:e})}catch{return Po(h.decode(t))}throw new Error("Supplied PeerID CID is invalid")}function Po(t){if(t==null||t.multihash==null||t.version==null||t.version===1&&t.code!==dr)throw new Error("Supplied PeerID CID is invalid");let e=t.multihash;if(e.code===Be.code)return new ve({multihash:t.multihash});if(e.code===Le.code){if(e.digest.length===pr)return new Ce({multihash:t.multihash});if(e.digest.length===hr)return new Se({multihash:t.multihash})}throw new Error("Supplied PeerID CID is invalid")}var ze=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let r=this.index,n=e();return n===void 0&&(this.index=r),n}parseWith(e){let r=e();if(this.index===this.input.length)return r}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let r=this.readChar();if(r===e)return r})}readSeparator(e,r,n){return this.readAtomically(()=>{if(!(r>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,r,n,o){return this.readAtomically(()=>{let s=0,i=0,f=this.peekChar();if(f===void 0)return;let w=f==="0",I=2**(8*o)-1;for(;;){let c=this.readAtomically(()=>{let l=this.readChar();if(l===void 0)return;let p=Number.parseInt(l,e);if(!Number.isNaN(p))return p});if(c===void 0)break;if(s*=e,s+=c,s>I||(i+=1,r!==void 0&&i>r))return}if(i!==0)return!n&&w&&i>1?void 0:s})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let r=0;r<e.length;r++){let n=this.readSeparator(".",r,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[r]=n}return e})}readIPv6Addr(){let e=r=>{for(let n=0;n<r.length/2;n++){let o=n*2;if(n<r.length-3){let i=this.readSeparator(":",n,()=>this.readIPv4Addr());if(i!==void 0)return r[o]=i[0],r[o+1]=i[1],r[o+2]=i[2],r[o+3]=i[3],[o+4,!0]}let s=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(s===void 0)return[o,!1];r[o]=s>>8,r[o+1]=s&255}return[r.length,!1]};return this.readAtomically(()=>{let r=new Uint8Array(16),[n,o]=e(r);if(n===16)return r;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let s=new Uint8Array(14),i=16-(n+2),[f]=e(s.subarray(0,i));return r.set(s.subarray(0,f),16-f),r})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var mr=45,Uo=15,ie=new ze;function xt(t){if(!(t.length>Uo))return ie.new(t).parseWith(()=>ie.readIPv4Addr())}function vt(t){if(!(t.length>mr))return ie.new(t).parseWith(()=>ie.readIPv6Addr())}function Re(t){if(!(t.length>mr))return ie.new(t).parseWith(()=>ie.readIPAddr())}function br(t){return!!xt(t)}function gr(t){return!!vt(t)}function Oe(t){return!!Re(t)}function ae(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function $e(t=0){return globalThis.Buffer?.allocUnsafe!=null?ae(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function yr(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var wr=yr("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Ct=yr("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=$e(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Do={utf8:wr,"utf-8":wr,hex:q.base16,latin1:Ct,ascii:Ct,binary:Ct,...q},_e=Do;function T(t,e="utf8"){let r=_e[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}var xr=br,No=gr,St=function(t){let e=0;if(t=t.toString().trim(),xr(t)){let r=new Uint8Array(e+4);return t.split(/\./g).forEach(n=>{r[e++]=parseInt(n,10)&255}),r}if(No(t)){let r=t.split(":",8),n;for(n=0;n<r.length;n++){let s=xr(r[n]),i;s&&(i=St(r[n]),r[n]=T(i.slice(0,2),"base16")),i!=null&&++n<8&&r.splice(n,0,T(i.slice(2,4),"base16"))}if(r[0]==="")for(;r.length<8;)r.unshift("0");else if(r[r.length-1]==="")for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&r[n]!=="";n++);let s=[n,1];for(n=9-r.length;n>0;n--)s.push("0");r.splice.apply(r,s)}let o=new Uint8Array(e+16);for(n=0;n<r.length;n++){let s=parseInt(r[n],16);o[e++]=s>>8&255,o[e++]=s&255}return o}throw new Error("invalid ip address")},vr=function(t,e=0,r){e=~~e,r=r??t.length-e;let n=new DataView(t.buffer);if(r===4){let o=[];for(let s=0;s<r;s++)o.push(t[e+s]);return o.join(".")}if(r===16){let o=[];for(let s=0;s<r;s+=2)o.push(n.getUint16(e+s).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Ee={},Et={},Mo=[[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"]];Mo.forEach(t=>{let e=Bo(...t);Et[e.code]=e,Ee[e.name]=e});function Bo(t,e,r,n,o){return{code:t,size:e,name:r,resolvable:!!n,path:!!o}}function m(t){if(typeof t=="number"){if(Et[t]!=null)return Et[t];throw new Error(`no protocol with code: ${t}`)}else if(typeof t=="string"){if(Ee[t]!=null)return Ee[t];throw new Error(`no protocol with name: ${t}`)}throw new Error(`invalid protocol id type: ${typeof t}`)}var z=Ue(Ve(),1);function It(t,e="utf8"){let r=_e[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?ae(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function O(t,e){e==null&&(e=t.reduce((o,s)=>o+s.length,0));let r=$e(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return ae(r)}var da=parseInt("0xFFFF",16),pa=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var qa=m("ip4"),Wa=m("ip6"),Ga=m("ipcidr");function zr(t,e){switch(m(t).code){case 4:case 41:return es(e);case 42:return Br(e);case 6:case 273:case 33:case 132:return Or(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Br(e);case 421:return os(e);case 444:return Lr(e);case 445:return Lr(e);case 466:return ns(e);default:return T(e,"base16")}}function Rr(t,e){switch(m(t).code){case 4:return kr(e);case 41:return kr(e);case 42:return Mr(e);case 6:case 273:case 33:case 132:return Pt(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Mr(e);case 421:return ts(e);case 444:return ss(e);case 445:return is(e);case 466:return rs(e);default:return It(e,"base16")}}var Ft=Object.values(q).map(t=>t.decoder),Zo=function(){let t=Ft[0].or(Ft[1]);return Ft.slice(2).forEach(e=>t=t.or(e)),t}();function kr(t){if(!Oe(t))throw new Error("invalid ip address");return St(t)}function es(t){let e=vr(t,0,t.length);if(e==null)throw new Error("ipBuff is required");if(!Oe(e))throw new Error("invalid ip address");return e}function Pt(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t),new Uint8Array(e)}function Or(t){return new DataView(t.buffer).getUint16(t.byteOffset)}function Mr(t){let e=It(t),r=Uint8Array.from(z.default.encode(e.length));return O([r,e],r.length+e.length)}function Br(t){let e=z.default.decode(t);if(t=t.slice(z.default.decode.bytes),t.length!==e)throw new Error("inconsistent lengths");return T(t)}function ts(t){let e;t[0]==="Q"||t[0]==="1"?e=Q(v.decode(`z${t}`)).bytes:e=h.parse(t).multihash.bytes;let r=Uint8Array.from(z.default.encode(e.length));return O([r,e],r.length+e.length)}function rs(t){let e=Zo.decode(t),r=Uint8Array.from(z.default.encode(e.length));return O([r,e],r.length+e.length)}function ns(t){let e=z.default.decode(t),r=t.slice(z.default.decode.bytes);if(r.length!==e)throw new Error("inconsistent lengths");return"u"+T(r,"base64url")}function os(t){let e=z.default.decode(t),r=t.slice(z.default.decode.bytes);if(r.length!==e)throw new Error("inconsistent lengths");return T(r,"base58btc")}function ss(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let r=L.decode("b"+e[0]),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Pt(n);return O([r,o],r.length+o.length)}function is(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let r=L.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Pt(n);return O([r,o],r.length+o.length)}function Lr(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),n=T(e,"base32"),o=Or(r);return`${n}:${o}`}var ce=Ue(Ve(),1);function as(t){let e=[],r=t.split("/").slice(1);if(r.length===1&&r[0]==="")return[];for(let n=0;n<r.length;n++){let o=r[n],s=m(o);if(s.size===0){e.push([o]);continue}if(n++,n>=r.length)throw _r("invalid address: "+t);if(s.path===!0){e.push([o,Mt(r.slice(n).join("/"))]);break}e.push([o,r[n]])}return e}function cs(t){let e=[];return t.map(r=>{let n=We(r);return e.push(n.name),r.length>1&&r[1]!=null&&e.push(r[1]),null}),Mt(e.join("/"))}function us(t){return t.map(e=>{Array.isArray(e)||(e=[e]);let r=We(e);return e.length>1?[r.code,Rr(r.code,e[1])]:[r.code]})}function Ut(t){return t.map(e=>{let r=We(e);return e[1]!=null?[r.code,zr(r.code,e[1])]:[r.code]})}function Dt(t){return qe(O(t.map(e=>{let r=We(e),n=Uint8Array.from(ce.default.encode(r.code));return e.length>1&&e[1]!=null&&(n=O([n,e[1]])),n})))}function Nt(t,e){return t.size>0?t.size/8:t.size===0?0:ce.default.decode(e)+(ce.default.decode.bytes??0)}function je(t){let e=[],r=0;for(;r<t.length;){let n=ce.default.decode(t,r),o=ce.default.decode.bytes??0,s=m(n),i=Nt(s,t.slice(r+o));if(i===0){e.push([n]),r+=o;continue}let f=t.slice(r+o,r+o+i);if(r+=i+o,r>t.length)throw _r("Invalid address Uint8Array: "+T(t,"base16"));e.push([n,f])}return e}function kt(t){let e=je(t),r=Ut(e);return cs(r)}function ls(t){t=Mt(t);let e=as(t),r=us(e);return Dt(r)}function $r(t){return ls(t)}function qe(t){let e=fs(t);if(e!=null)throw e;return Uint8Array.from(t)}function fs(t){try{je(t)}catch(e){return e}}function Mt(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function _r(t){return new Error("Error parsing address: "+t)}function We(t){return m(t[0])}var Bt=Ue(Ve(),1);var $=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},le=function(t,e,r,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 e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},Ae,Te,Ie,W,Vr,ps=Symbol.for("nodejs.util.inspect.custom"),hs=[m("dns").code,m("dns4").code,m("dns6").code,m("dnsaddr").code],ms=new Map,jr=Symbol.for("@multiformats/js-multiaddr/multiaddr");function bs(t){return!!t?.[jr]}var _=class{constructor(e){if(Ae.set(this,void 0),Te.set(this,void 0),Ie.set(this,void 0),W.set(this,void 0),this[Vr]=!0,e==null&&(e=""),e instanceof Uint8Array)this.bytes=qe(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=$r(e)}else if(bs(e))this.bytes=qe(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return $(this,Ae,"f")==null&&le(this,Ae,kt(this.bytes),"f"),$(this,Ae,"f")}toJSON(){return this.toString()}toOptions(){let e,r,n,o,s="",i=m("tcp"),f=m("udp"),w=m("ip4"),I=m("ip6"),c=m("dns6"),l=m("ip6zone");for(let[S,d]of this.stringTuples())S===l.code&&(s=`%${d??""}`),hs.includes(S)&&(r=i.name,o=443,n=`${d??""}${s}`,e=S===c.code?6:4),(S===i.code||S===f.code)&&(r=m(S).name,o=parseInt(d??"")),(S===w.code||S===I.code)&&(r=m(S).name,n=`${d??""}${s}`,e=S===I.code?6:4);if(e==null||r==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:e,host:n,transport:r,port:o}}protos(){return this.protoCodes().map(e=>Object.assign({},m(e)))}protoCodes(){let e=[],r=this.bytes,n=0;for(;n<r.length;){let o=Bt.default.decode(r,n),s=Bt.default.decode.bytes??0,i=m(o),f=Nt(i,r.slice(n+s));n+=f+s,e.push(o)}return e}protoNames(){return this.protos().map(e=>e.name)}tuples(){return $(this,Te,"f")==null&&le(this,Te,je(this.bytes),"f"),$(this,Te,"f")}stringTuples(){return $(this,Ie,"f")==null&&le(this,Ie,Ut(this.tuples()),"f"),$(this,Ie,"f")}encapsulate(e){return e=new _(e),new _(this.toString()+e.toString())}decapsulate(e){let r=e.toString(),n=this.toString(),o=n.lastIndexOf(r);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new _(n.slice(0,o))}decapsulateCode(e){let r=this.tuples();for(let n=r.length-1;n>=0;n--)if(r[n][0]===e)return new _(Dt(r.slice(0,n)));return this}getPeerId(){try{let r=this.stringTuples().filter(n=>n[0]===Ee.ipfs.code).pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?T(v.decode(`z${n}`),"base58btc"):T(h.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){if($(this,W,"f")===void 0)try{le(this,W,this.stringTuples().filter(e=>m(e[0]).path===!0)[0][1],"f"),$(this,W,"f")==null&&le(this,W,null,"f")}catch{le(this,W,null,"f")}return $(this,W,"f")}equals(e){return we(this.bytes,e.bytes)}async resolve(e){let r=this.protos().find(s=>s.resolvable);if(r==null)return[this];let n=ms.get(r.name);if(n==null)throw new ye(`no available resolver for ${r.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(s=>new _(s))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let r=(e??this).protos();return!(r.length!==2||r[0].code!==4&&r[0].code!==41||r[1].code!==6&&r[1].code!==273)}[(Ae=new WeakMap,Te=new WeakMap,Ie=new WeakMap,W=new WeakMap,Vr=jr,ps)](){return`Multiaddr(${kt(this.bytes)})`}};function ue(t){return new _(t)}var gs=a("dns4"),ws=a("dns6"),ys=a("dnsaddr"),K=C(a("dns"),ys,gs,ws),Ge=C(a("ip4"),a("ip6")),de=C(u(Ge,a("tcp")),u(K,a("tcp"))),Je=u(Ge,a("udp")),xs=u(Je,a("utp")),vs=u(Je,a("quic")),Cs=u(Je,a("quic-v1")),Fe=C(u(de,a("ws")),u(K,a("ws"))),Pe=C(u(de,a("wss")),u(K,a("wss")),u(de,a("tls"),a("ws")),u(K,a("tls"),a("ws"))),Lt=C(u(de,a("http")),u(Ge,a("http")),u(K,a("http"))),zt=C(u(de,a("https")),u(Ge,a("https")),u(K,a("https"))),qr=u(Je,a("webrtc-direct"),a("certhash")),Jr=C(u(qr,a("p2p")),qr),Wr=u(Cs,a("webtransport"),a("certhash"),a("certhash")),Hr=C(u(Wr,a("p2p")),Wr),Qr=C(u(Fe,a("p2p-webrtc-star"),a("p2p")),u(Pe,a("p2p-webrtc-star"),a("p2p")),u(Fe,a("p2p-webrtc-star")),u(Pe,a("p2p-webrtc-star"))),dc=C(u(Fe,a("p2p-websocket-star"),a("p2p")),u(Pe,a("p2p-websocket-star"),a("p2p")),u(Fe,a("p2p-websocket-star")),u(Pe,a("p2p-websocket-star"))),Xr=C(u(Lt,a("p2p-webrtc-direct"),a("p2p")),u(zt,a("p2p-webrtc-direct"),a("p2p")),u(Lt,a("p2p-webrtc-direct")),u(zt,a("p2p-webrtc-direct"))),pe=C(Fe,Pe,Lt,zt,Qr,Xr,de,xs,vs,K,Jr,Hr),pc=C(u(pe,a("p2p-stardust"),a("p2p")),u(pe,a("p2p-stardust"))),G=C(u(pe,a("p2p")),Qr,Xr,Jr,Hr,a("p2p")),Gr=C(u(G,a("p2p-circuit"),G),u(G,a("p2p-circuit")),u(a("p2p-circuit"),G),u(pe,a("p2p-circuit")),u(a("p2p-circuit"),pe),a("p2p-circuit")),Kr=()=>C(u(Gr,Kr),Gr),fe=Kr(),Yr=C(u(fe,G,fe),u(G,fe),u(fe,G),fe,G);var hc=C(u(fe,a("webrtc")),u(pe,a("webrtc")),a("webrtc"));function Zr(t){function e(r){let n;try{n=ue(r)}catch{return!1}let o=t(n.protoNames());return o===null?!1:o===!0||o===!1?o:o.length===0}return e}function u(...t){function e(r){if(r.length<t.length)return null;let n=r;return t.some(o=>(n=typeof o=="function"?o().partialMatch(r):o.partialMatch(r),Array.isArray(n)&&(r=n),n===null)),n}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:Zr(e),partialMatch:e}}function C(...t){function e(n){let o=null;return t.some(s=>{let i=typeof s=="function"?s().partialMatch(n):s.partialMatch(n);return i!=null?(o=i,!0):!1}),o}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:Zr(e),partialMatch:e}}function a(t){let e=t;function r(o){let s;try{s=ue(o)}catch{return!1}let i=s.protoNames();return i.length===1&&i[0]===e}function n(o){return o.length===0?null:o[0]===e?o.slice(1):null}return{toString:function(){return e},matches:r,partialMatch:n}}var He=Kt("libp2p:bootstrap"),Ss="bootstrap",Es=50,As=12e4,Ts=1e3,Qe=class extends De{timer;list;timeout;components;_init;constructor(e,r={list:[]}){if(r.list==null||r.list.length===0)throw new Error("Bootstrap requires a list of peer addresses");super(),this.components=e,this.timeout=r.timeout??Ts,this.list=[];for(let n of r.list){if(!Yr.matches(n)){He.error("Invalid multiaddr");continue}let o=ue(n),s=o.getPeerId();if(s==null){He.error("Invalid bootstrap multiaddr without peer id");continue}let i={id:yt(s),multiaddrs:[o],protocols:[]};this.list.push(i)}this._init=r}[Ot]=!0;[Symbol.toStringTag]="@libp2p/bootstrap";isStarted(){return!!this.timer}start(){this.isStarted()||(He("Starting bootstrap node discovery, discovering peers after %s ms",this.timeout),this.timer=setTimeout(()=>{this._discoverBootstrapPeers().catch(e=>{He.error(e)})},this.timeout))}async _discoverBootstrapPeers(){if(this.timer!=null)for(let e of this.list){if(await this.components.peerStore.merge(e.id,{tags:{[this._init.tagName??Ss]:{value:this._init.tagValue??Es,ttl:this._init.tagTTL??As}}}),this.timer==null)return;this.safeDispatchEvent("peer",{detail:e})}}stop(){this.timer!=null&&clearTimeout(this.timer),this.timer=void 0}};Xe(Qe,"tag","bootstrap");function Is(t){return e=>new Qe(e,t)}return an(Fs);})();
|
|
2
|
+
"use strict";var Libp2PBootstrap=(()=>{var ts=Object.create;var De=Object.defineProperty;var rs=Object.getOwnPropertyDescriptor;var ns=Object.getOwnPropertyNames;var os=Object.getPrototypeOf,ss=Object.prototype.hasOwnProperty;var is=(r,e,t)=>e in r?De(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var re=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),y=(r,e)=>{for(var t in e)De(r,t,{get:e[t],enumerable:!0})},en=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ns(e))!ss.call(r,o)&&o!==t&&De(r,o,{get:()=>e[o],enumerable:!(n=rs(e,o))||n.enumerable});return r};var Qe=(r,e,t)=>(t=r!=null?ts(os(r)):{},en(e||!r||!r.__esModule?De(t,"default",{value:r,enumerable:!0}):t,r)),as=r=>en(De({},"__esModule",{value:!0}),r);var He=(r,e,t)=>(is(r,typeof e!="symbol"?e+"":e,t),t);var nn=re((Gd,rn)=>{var de=1e3,pe=de*60,fe=pe*60,ne=fe*24,ds=ne*7,ps=ne*365.25;rn.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return fs(r);if(t==="number"&&isFinite(r))return e.long?hs(r):us(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function fs(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\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(e){var t=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*ps;case"weeks":case"week":case"w":return t*ds;case"days":case"day":case"d":return t*ne;case"hours":case"hour":case"hrs":case"hr":case"h":return t*fe;case"minutes":case"minute":case"mins":case"min":case"m":return t*pe;case"seconds":case"second":case"secs":case"sec":case"s":return t*de;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function us(r){var e=Math.abs(r);return e>=ne?Math.round(r/ne)+"d":e>=fe?Math.round(r/fe)+"h":e>=pe?Math.round(r/pe)+"m":e>=de?Math.round(r/de)+"s":r+"ms"}function hs(r){var e=Math.abs(r);return e>=ne?Ze(r,e,ne,"day"):e>=fe?Ze(r,e,fe,"hour"):e>=pe?Ze(r,e,pe,"minute"):e>=de?Ze(r,e,de,"second"):r+" ms"}function Ze(r,e,t,n){var o=e>=t*1.5;return Math.round(r/t)+" "+n+(o?"s":"")}});var sn=re((_d,on)=>{function ls(r){t.debug=t,t.default=t,t.coerce=l,t.disable=s,t.enable=o,t.enabled=i,t.humanize=nn(),t.destroy=T,Object.keys(r).forEach(d=>{t[d]=r[d]}),t.names=[],t.skips=[],t.formatters={};function e(d){let f=0;for(let w=0;w<d.length;w++)f=(f<<5)-f+d.charCodeAt(w),f|=0;return t.colors[Math.abs(f)%t.colors.length]}t.selectColor=e;function t(d){let f,w=null,z,c;function u(...v){if(!u.enabled)return;let m=u,g=Number(new Date),C=g-(f||g);m.diff=C,m.prev=f,m.curr=g,f=g,v[0]=t.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let b=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(E,x)=>{if(E==="%%")return"%";b++;let A=t.formatters[x];if(typeof A=="function"){let O=v[b];E=A.call(m,O),v.splice(b,1),b--}return E}),t.formatArgs.call(m,v),(m.log||t.log).apply(m,v)}return u.namespace=d,u.useColors=t.useColors(),u.color=t.selectColor(d),u.extend=n,u.destroy=t.destroy,Object.defineProperty(u,"enabled",{enumerable:!0,configurable:!1,get:()=>w!==null?w:(z!==t.namespaces&&(z=t.namespaces,c=t.enabled(d)),c),set:v=>{w=v}}),typeof t.init=="function"&&t.init(u),u}function n(d,f){let w=t(this.namespace+(typeof f>"u"?":":f)+d);return w.log=this.log,w}function o(d){t.save(d),t.namespaces=d,t.names=[],t.skips=[];let f,w=(typeof d=="string"?d:"").split(/[\s,]+/),z=w.length;for(f=0;f<z;f++)w[f]&&(d=w[f].replace(/\*/g,".*?"),d[0]==="-"?t.skips.push(new RegExp("^"+d.slice(1)+"$")):t.names.push(new RegExp("^"+d+"$")))}function s(){let d=[...t.names.map(a),...t.skips.map(a).map(f=>"-"+f)].join(",");return t.enable(""),d}function i(d){if(d[d.length-1]==="*")return!0;let f,w;for(f=0,w=t.skips.length;f<w;f++)if(t.skips[f].test(d))return!1;for(f=0,w=t.names.length;f<w;f++)if(t.names[f].test(d))return!0;return!1}function a(d){return d.toString().substring(2,d.toString().length-2).replace(/\.\*\?$/,"*")}function l(d){return d instanceof Error?d.stack||d.message:d}function T(){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 t.enable(t.load()),t}on.exports=ls});var an=re((V,et)=>{V.formatArgs=bs;V.save=ws;V.load=gs;V.useColors=ms;V.storage=xs();V.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`."))}})();V.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 ms(){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 bs(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+et.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(t++,o==="%c"&&(n=t))}),r.splice(n,0,e)}V.log=console.debug||console.log||(()=>{});function ws(r){try{r?V.storage.setItem("debug",r):V.storage.removeItem("debug")}catch{}}function gs(){let r;try{r=V.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function xs(){try{return localStorage}catch{}}et.exports=sn()(V);var{formatters:ys}=et.exports;ys.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var mo=re((Zf,lo)=>{lo.exports=Sr;var ho=128,yc=127,vc=~yc,Cc=Math.pow(2,31);function Sr(r,e,t){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw Sr.bytes=0,new RangeError("Could not encode varint");e=e||[],t=t||0;for(var n=t;r>=Cc;)e[t++]=r&255|ho,r/=128;for(;r&vc;)e[t++]=r&255|ho,r>>>=7;return e[t]=r|0,Sr.bytes=t-n+1,e}});var go=re((eu,wo)=>{wo.exports=Ar;var Sc=128,bo=127;function Ar(r,n){var t=0,n=n||0,o=0,s=n,i,a=r.length;do{if(s>=a||o>49)throw Ar.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&bo)<<o:(i&bo)*Math.pow(2,o),o+=7}while(i>=Sc);return Ar.bytes=s-n,t}});var yo=re((tu,xo)=>{var Ac=Math.pow(2,7),Ec=Math.pow(2,14),Tc=Math.pow(2,21),Ic=Math.pow(2,28),Uc=Math.pow(2,35),Fc=Math.pow(2,42),Pc=Math.pow(2,49),Nc=Math.pow(2,56),Dc=Math.pow(2,63);xo.exports=function(r){return r<Ac?1:r<Ec?2:r<Tc?3:r<Ic?4:r<Uc?5:r<Fc?6:r<Pc?7:r<Nc?8:r<Dc?9:10}});var pt=re((ru,vo)=>{vo.exports={encode:mo(),decode:go(),encodingLength:yo()}});var $d={};y($d,{bootstrap:()=>Vd});var Ye=class extends EventTarget{#e=new Map;listenerCount(e){let t=this.#e.get(e);return t==null?0:t.length}addEventListener(e,t,n){super.addEventListener(e,t,n);let o=this.#e.get(e);o==null&&(o=[],this.#e.set(e,o)),o.push({callback:t,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,t,n){super.removeEventListener(e.toString(),t??null,n);let o=this.#e.get(e);o!=null&&(o=o.filter(({callback:s})=>s!==t),this.#e.set(e,o))}dispatchEvent(e){let t=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:o})=>!o),this.#e.set(e.type,n)),t}safeDispatchEvent(e,t){return this.dispatchEvent(new cs(e,t))}},St=class extends Event{detail;constructor(e,t){super(e,t),this.detail=t?.detail}},cs=globalThis.CustomEvent??St;var tn=Symbol.for("@libp2p/peer-discovery");var $=Qe(an(),1);var Ut={};y(Ut,{base32:()=>H,base32hex:()=>Fs,base32hexpad:()=>Ns,base32hexpadupper:()=>Ds,base32hexupper:()=>Ps,base32pad:()=>Is,base32padupper:()=>Us,base32upper:()=>Ts,base32z:()=>zs});function vs(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=o}var a=r.length,l=r.charAt(0),T=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function f(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";for(var u=0,v=0,m=0,g=c.length;m!==g&&c[m]===0;)m++,u++;for(var C=(g-m)*d+1>>>0,b=new Uint8Array(C);m!==g;){for(var S=c[m],E=0,x=C-1;(S!==0||E<v)&&x!==-1;x--,E++)S+=256*b[x]>>>0,b[x]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");v=E,m++}for(var A=C-v;A!==C&&b[A]===0;)A++;for(var O=l.repeat(u);A<C;++A)O+=r.charAt(b[A]);return O}function w(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var u=0;if(c[u]!==" "){for(var v=0,m=0;c[u]===l;)v++,u++;for(var g=(c.length-u)*T+1>>>0,C=new Uint8Array(g);c[u];){var b=t[c.charCodeAt(u)];if(b===255)return;for(var S=0,E=g-1;(b!==0||S<m)&&E!==-1;E--,S++)b+=a*C[E]>>>0,C[E]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");m=S,u++}if(c[u]!==" "){for(var x=g-m;x!==g&&C[x]===0;)x++;for(var A=new Uint8Array(v+(g-x)),O=v;x!==g;)A[O++]=C[x++];return A}}}function z(c){var u=w(c);if(u)return u;throw new Error(`Non-${e} character`)}return{encode:f,decodeUnsafe:w,decode:z}}var Cs=vs,Ss=Cs,cn=Ss;var Xd=new Uint8Array(0);var dn=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},J=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 pn=r=>new TextEncoder().encode(r),fn=r=>new TextDecoder().decode(r);var At=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Et=class{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return hn(this,e)}},Tt=class{constructor(e){this.decoders=e}or(e){return hn(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},hn=(r,e)=>new Tt({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),It=class{constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new At(e,t,n),this.decoder=new Et(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},ue=({name:r,prefix:e,encode:t,decode:n})=>new It(r,e,t,n),Q=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:o}=cn(t,e);return ue({prefix:r,name:e,encode:n,decode:s=>J(o(s))})},As=(r,e,t,n)=>{let o={};for(let d=0;d<e.length;++d)o[e[d]]=d;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*t/8|0),a=0,l=0,T=0;for(let d=0;d<s;++d){let f=o[r[d]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<t|f,a+=t,a>=8&&(a-=8,i[T++]=255&l>>a)}if(a>=t||255&l<<8-a)throw new SyntaxError("Unexpected end of data");return i},Es=(r,e,t)=>{let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,a=0;for(let l=0;l<r.length;++l)for(a=a<<8|r[l],i+=8;i>t;)i-=t,s+=e[o&a>>i];if(i&&(s+=e[o&a<<t-i]),n)for(;s.length*t&7;)s+="=";return s},P=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>ue({prefix:e,name:r,encode(o){return Es(o,n,t)},decode(o){return As(o,n,t,r)}});var H=P({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ts=P({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Is=P({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Us=P({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Fs=P({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ps=P({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Ns=P({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ds=P({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),zs=P({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ft={};y(Ft,{base58btc:()=>k,base58flickr:()=>Ms});var k=Q({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ms=Q({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Nt={};y(Nt,{base64:()=>Pt,base64pad:()=>Bs,base64url:()=>Os,base64urlpad:()=>ks});var Pt=P({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Bs=P({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Os=P({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ks=P({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});$.default.formatters.b=r=>r==null?"undefined":k.baseEncode(r);$.default.formatters.t=r=>r==null?"undefined":H.baseEncode(r);$.default.formatters.m=r=>r==null?"undefined":Pt.baseEncode(r);$.default.formatters.p=r=>r==null?"undefined":r.toString();$.default.formatters.c=r=>r==null?"undefined":r.toString();$.default.formatters.k=r=>r==null?"undefined":r.toString();$.default.formatters.a=r=>r==null?"undefined":r.toString();function Ls(r){let e=()=>{};return e.enabled=!1,e.color="",e.diff=0,e.log=()=>{},e.namespace=r,e.destroy=()=>!0,e.extend=()=>e,e}function ln(r){let e=Ls(`${r}:trace`);return $.default.enabled(`${r}:trace`)&&$.default.names.map(t=>t.toString()).find(t=>t.includes(":trace"))!=null&&(e=(0,$.default)(`${r}:trace`)),Object.assign((0,$.default)(r),{error:(0,$.default)(`${r}:error`),trace:e})}var mn=Symbol.for("@libp2p/peer-id");var Dt={};y(Dt,{identity:()=>Rs});var Rs=ue({prefix:"\0",name:"identity",encode:r=>fn(r),decode:r=>pn(r)});var zt={};y(zt,{base2:()=>Vs});var Vs=P({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Mt={};y(Mt,{base8:()=>$s});var $s=P({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Bt={};y(Bt,{base10:()=>js});var js=Q({prefix:"9",name:"base10",alphabet:"0123456789"});var Ot={};y(Ot,{base16:()=>qs,base16upper:()=>Js});var qs=P({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Js=P({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var kt={};y(kt,{base36:()=>Gs,base36upper:()=>_s});var Gs=Q({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),_s=Q({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Lt={};y(Lt,{base256emoji:()=>Hs});var bn=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}"),Ws=bn.reduce((r,e,t)=>(r[t]=e,r),[]),Xs=bn.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function Ks(r){return r.reduce((e,t)=>(e+=Ws[t],e),"")}function Qs(r){let e=[];for(let t of r){let n=Xs[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var Hs=ue({prefix:"\u{1F680}",name:"base256emoji",encode:Ks,decode:Qs});var jt={};y(jt,{sha256:()=>rt,sha512:()=>bi});var Ys=xn,wn=128,Zs=127,ei=~Zs,ti=Math.pow(2,31);function xn(r,e,t){e=e||[],t=t||0;for(var n=t;r>=ti;)e[t++]=r&255|wn,r/=128;for(;r&ei;)e[t++]=r&255|wn,r>>>=7;return e[t]=r|0,xn.bytes=t-n+1,e}var ri=Rt,ni=128,gn=127;function Rt(r,n){var t=0,n=n||0,o=0,s=n,i,a=r.length;do{if(s>=a)throw Rt.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&gn)<<o:(i&gn)*Math.pow(2,o),o+=7}while(i>=ni);return Rt.bytes=s-n,t}var oi=Math.pow(2,7),si=Math.pow(2,14),ii=Math.pow(2,21),ai=Math.pow(2,28),ci=Math.pow(2,35),di=Math.pow(2,42),pi=Math.pow(2,49),fi=Math.pow(2,56),ui=Math.pow(2,63),hi=function(r){return r<oi?1:r<si?2:r<ii?3:r<ai?4:r<ci?5:r<di?6:r<pi?7:r<fi?8:r<ui?9:10},li={encode:Ys,decode:ri,encodingLength:hi},mi=li,ze=mi;var Me=(r,e=0)=>[ze.decode(r,e),ze.decode.bytes],he=(r,e,t=0)=>(ze.encode(r,e,t),e),le=r=>ze.encodingLength(r);var Y=(r,e)=>{let t=e.byteLength,n=le(r),o=n+le(t),s=new Uint8Array(o+t);return he(r,s,0),he(t,s,n),s.set(e,o),new me(r,t,e,s)},Be=r=>{let e=J(r),[t,n]=Me(e),[o,s]=Me(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new me(t,o,i,e)},yn=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&dn(r.bytes,t.bytes)}},me=class{constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var $t=({name:r,code:e,encode:t})=>new Vt(r,e,t),Vt=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?Y(this.code,t):t.then(n=>Y(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Cn=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),rt=$t({name:"sha2-256",code:18,encode:Cn("SHA-256")}),bi=$t({name:"sha2-512",code:19,encode:Cn("SHA-512")});var qt={};y(qt,{identity:()=>nt});var Sn=0,wi="identity",An=J,gi=r=>Y(Sn,An(r)),nt={code:Sn,name:wi,encode:An,digest:gi};var Cp=new TextEncoder,Sp=new TextDecoder;var En=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return Ci(t,Jt(r),e||k.encoder);default:return Si(t,Jt(r),e||H.encoder)}};var Tn=new WeakMap,Jt=r=>{let e=Tn.get(r);if(e==null){let t=new Map;return Tn.set(r,t),t}return e},F=class{constructor(e,t,n,o){this.code=t,this.version=e,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:e,multihash:t}=this;if(e!==Oe)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Ai)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return F.createV0(t)}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:e,digest:t}=this.multihash,n=Y(e,t);return F.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(e){return F.equals(this,e)}static equals(e,t){let n=t;return n&&e.code===n.code&&e.version===n.version&&yn(e.multihash,n.multihash)}toString(e){return En(this,e)}toJSON(){return{"/":En(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof F)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new F(n,o,s,i||In(n,o,s.bytes))}else if(t[Ei]===!0){let{version:n,multihash:o,code:s}=t,i=Be(o);return F.create(n,s,i)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==Oe)throw new Error(`Version 0 CID must use dag-pb (code: ${Oe}) block encoding`);return new F(e,t,n,n.bytes)}case 1:{let o=In(e,t,n.bytes);return new F(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return F.create(0,Oe,e)}static createV1(e,t){return F.create(1,e,t)}static decode(e){let[t,n]=F.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=F.inspectBytes(e),n=t.size-t.multihashSize,o=J(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new me(t.multihashCode,t.digestSize,s,o);return[t.version===0?F.createV0(i):F.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[f,w]=Me(e.subarray(t));return t+=w,f},o=n(),s=Oe;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,a=n(),l=n(),T=t+l,d=T-i;return{version:o,codec:s,multihashCode:a,digestSize:l,multihashSize:d,size:T}}static parse(e,t){let[n,o]=vi(e,t),s=F.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Jt(s).set(n,e),s}},vi=(r,e)=>{switch(r[0]){case"Q":{let t=e||k;return[k.prefix,t.decode(`${k.prefix}${r}`)]}case k.prefix:{let t=e||k;return[k.prefix,t.decode(r)]}case H.prefix:{let t=e||H;return[H.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},Ci=(r,e,t)=>{let{prefix:n}=t;if(n!==k.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o},Si=(r,e,t)=>{let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o},Oe=112,Ai=18,In=(r,e,t)=>{let n=le(r),o=n+le(e),s=new Uint8Array(o+t.byteLength);return he(r,s,0),he(e,s,n),s.set(t,o),s},Ei=Symbol.for("@ipld/js-cid/CID");var Gt={...Dt,...zt,...Mt,...Bt,...Ot,...Ut,...kt,...Ft,...Nt,...Lt},zp={...jt,...qt};function ke(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}var Ti=Symbol.for("nodejs.util.inspect.custom"),Un=Object.values(Gt).map(r=>r.decoder).reduce((r,e)=>r.or(e),Gt.identity.decoder),Fn=114,Pn=36,Nn=37,Le=class{type;multihash;privateKey;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[mn]=!0;toString(){return this.string==null&&(this.string=k.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return F.createV1(Fn,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return ke(this.multihash.bytes,e);if(typeof e=="string")return _t(e).equals(this);if(e?.multihash?.bytes!=null)return ke(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[Ti](){return`PeerId(${this.toString()})`}},Re=class extends Le{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},Ve=class extends Le{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},$e=class extends Le{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function _t(r,e){if(e=e??Un,r.charAt(0)==="1"||r.charAt(0)==="Q"){let t=Be(k.decode(`z${r}`));return r.startsWith("12D")?new Ve({multihash:t}):r.startsWith("16U")?new $e({multihash:t}):new Re({multihash:t})}return Ii(Un.decode(r))}function Ii(r){try{let e=Be(r);if(e.code===nt.code){if(e.digest.length===Pn)return new Ve({multihash:e});if(e.digest.length===Nn)return new $e({multihash:e})}if(e.code===rt.code)return new Re({multihash:e})}catch{return Ui(F.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function Ui(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==Fn)throw new Error("Supplied PeerID CID is invalid");let e=r.multihash;if(e.code===rt.code)return new Re({multihash:r.multihash});if(e.code===nt.code){if(e.digest.length===Pn)return new Ve({multihash:r.multihash});if(e.digest.length===Nn)return new $e({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}var ot=class extends Error{code;props;constructor(e,t,n){super(e),this.code=t,this.name=n?.name??"CodeError",this.props=n??{}}};var Ht={};y(Ht,{base58btc:()=>L,base58flickr:()=>Mi});function Fi(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=o}var a=r.length,l=r.charAt(0),T=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function f(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";for(var u=0,v=0,m=0,g=c.length;m!==g&&c[m]===0;)m++,u++;for(var C=(g-m)*d+1>>>0,b=new Uint8Array(C);m!==g;){for(var S=c[m],E=0,x=C-1;(S!==0||E<v)&&x!==-1;x--,E++)S+=256*b[x]>>>0,b[x]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");v=E,m++}for(var A=C-v;A!==C&&b[A]===0;)A++;for(var O=l.repeat(u);A<C;++A)O+=r.charAt(b[A]);return O}function w(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var u=0;if(c[u]!==" "){for(var v=0,m=0;c[u]===l;)v++,u++;for(var g=(c.length-u)*T+1>>>0,C=new Uint8Array(g);c[u];){var b=t[c.charCodeAt(u)];if(b===255)return;for(var S=0,E=g-1;(b!==0||S<m)&&E!==-1;E--,S++)b+=a*C[E]>>>0,C[E]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");m=S,u++}if(c[u]!==" "){for(var x=g-m;x!==g&&C[x]===0;)x++;for(var A=new Uint8Array(v+(g-x)),O=v;x!==g;)A[O++]=C[x++];return A}}}function z(c){var u=w(c);if(u)return u;throw new Error(`Non-${e} character`)}return{encode:f,decodeUnsafe:w,decode:z}}var Pi=Fi,Ni=Pi,Dn=Ni;var Kp=new Uint8Array(0);var zn=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},G=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 Mn=r=>new TextEncoder().encode(r),Bn=r=>new TextDecoder().decode(r);var Wt=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Xt=class{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return kn(this,e)}},Kt=class{constructor(e){this.decoders=e}or(e){return kn(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},kn=(r,e)=>new Kt({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),Qt=class{constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new Wt(e,t,n),this.decoder=new Xt(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},we=({name:r,prefix:e,encode:t,decode:n})=>new Qt(r,e,t,n),Z=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:o}=Dn(t,e);return we({prefix:r,name:e,encode:n,decode:s=>G(o(s))})},Di=(r,e,t,n)=>{let o={};for(let d=0;d<e.length;++d)o[e[d]]=d;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*t/8|0),a=0,l=0,T=0;for(let d=0;d<s;++d){let f=o[r[d]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<t|f,a+=t,a>=8&&(a-=8,i[T++]=255&l>>a)}if(a>=t||255&l<<8-a)throw new SyntaxError("Unexpected end of data");return i},zi=(r,e,t)=>{let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,a=0;for(let l=0;l<r.length;++l)for(a=a<<8|r[l],i+=8;i>t;)i-=t,s+=e[o&a>>i];if(i&&(s+=e[o&a<<t-i]),n)for(;s.length*t&7;)s+="=";return s},N=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>we({prefix:e,name:r,encode(o){return zi(o,n,t)},decode(o){return Di(o,n,t,r)}});var L=Z({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Mi=Z({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Bi=Vn,Ln=128,Oi=127,ki=~Oi,Li=Math.pow(2,31);function Vn(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Li;)e[t++]=r&255|Ln,r/=128;for(;r&ki;)e[t++]=r&255|Ln,r>>>=7;return e[t]=r|0,Vn.bytes=t-n+1,e}var Ri=Yt,Vi=128,Rn=127;function Yt(r,n){var t=0,n=n||0,o=0,s=n,i,a=r.length;do{if(s>=a)throw Yt.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&Rn)<<o:(i&Rn)*Math.pow(2,o),o+=7}while(i>=Vi);return Yt.bytes=s-n,t}var $i=Math.pow(2,7),ji=Math.pow(2,14),qi=Math.pow(2,21),Ji=Math.pow(2,28),Gi=Math.pow(2,35),_i=Math.pow(2,42),Wi=Math.pow(2,49),Xi=Math.pow(2,56),Ki=Math.pow(2,63),Qi=function(r){return r<$i?1:r<ji?2:r<qi?3:r<Ji?4:r<Gi?5:r<_i?6:r<Wi?7:r<Xi?8:r<Ki?9:10},Hi={encode:Bi,decode:Ri,encodingLength:Qi},Yi=Hi,je=Yi;var qe=(r,e=0)=>[je.decode(r,e),je.decode.bytes],ge=(r,e,t=0)=>(je.encode(r,e,t),e),xe=r=>je.encodingLength(r);var oe=(r,e)=>{let t=e.byteLength,n=xe(r),o=n+xe(t),s=new Uint8Array(o+t);return ge(r,s,0),ge(t,s,n),s.set(e,o),new ye(r,t,e,s)},it=r=>{let e=G(r),[t,n]=qe(e),[o,s]=qe(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new ye(t,o,i,e)},$n=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&zn(r.bytes,t.bytes)}},ye=class{constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var Zt={};y(Zt,{base32:()=>_,base32hex:()=>ra,base32hexpad:()=>oa,base32hexpadupper:()=>sa,base32hexupper:()=>na,base32pad:()=>ea,base32padupper:()=>ta,base32upper:()=>Zi,base32z:()=>ia});var _=N({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Zi=N({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ea=N({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ta=N({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ra=N({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),na=N({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),oa=N({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),sa=N({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ia=N({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var jn=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return ca(t,er(r),e||L.encoder);default:return da(t,er(r),e||_.encoder)}};var qn=new WeakMap,er=r=>{let e=qn.get(r);if(e==null){let t=new Map;return qn.set(r,t),t}return e},U=class{constructor(e,t,n,o){this.code=t,this.version=e,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:e,multihash:t}=this;if(e!==Je)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==pa)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return U.createV0(t)}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:e,digest:t}=this.multihash,n=oe(e,t);return U.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(e){return U.equals(this,e)}static equals(e,t){let n=t;return n&&e.code===n.code&&e.version===n.version&&$n(e.multihash,n.multihash)}toString(e){return jn(this,e)}toJSON(){return{"/":jn(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof U)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new U(n,o,s,i||Jn(n,o,s.bytes))}else if(t[fa]===!0){let{version:n,multihash:o,code:s}=t,i=it(o);return U.create(n,s,i)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==Je)throw new Error(`Version 0 CID must use dag-pb (code: ${Je}) block encoding`);return new U(e,t,n,n.bytes)}case 1:{let o=Jn(e,t,n.bytes);return new U(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return U.create(0,Je,e)}static createV1(e,t){return U.create(1,e,t)}static decode(e){let[t,n]=U.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=U.inspectBytes(e),n=t.size-t.multihashSize,o=G(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new ye(t.multihashCode,t.digestSize,s,o);return[t.version===0?U.createV0(i):U.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[f,w]=qe(e.subarray(t));return t+=w,f},o=n(),s=Je;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,a=n(),l=n(),T=t+l,d=T-i;return{version:o,codec:s,multihashCode:a,digestSize:l,multihashSize:d,size:T}}static parse(e,t){let[n,o]=aa(e,t),s=U.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return er(s).set(n,e),s}},aa=(r,e)=>{switch(r[0]){case"Q":{let t=e||L;return[L.prefix,t.decode(`${L.prefix}${r}`)]}case L.prefix:{let t=e||L;return[L.prefix,t.decode(r)]}case _.prefix:{let t=e||_;return[_.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},ca=(r,e,t)=>{let{prefix:n}=t;if(n!==L.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o},da=(r,e,t)=>{let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o},Je=112,pa=18,Jn=(r,e,t)=>{let n=xe(r),o=n+xe(e),s=new Uint8Array(o+t.byteLength);return ge(r,s,0),ge(e,s,n),s.set(t,o),s},fa=Symbol.for("@ipld/js-cid/CID");var sr={};y(sr,{identity:()=>wa});function ua(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=o}var a=r.length,l=r.charAt(0),T=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function f(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";for(var u=0,v=0,m=0,g=c.length;m!==g&&c[m]===0;)m++,u++;for(var C=(g-m)*d+1>>>0,b=new Uint8Array(C);m!==g;){for(var S=c[m],E=0,x=C-1;(S!==0||E<v)&&x!==-1;x--,E++)S+=256*b[x]>>>0,b[x]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");v=E,m++}for(var A=C-v;A!==C&&b[A]===0;)A++;for(var O=l.repeat(u);A<C;++A)O+=r.charAt(b[A]);return O}function w(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var u=0;if(c[u]!==" "){for(var v=0,m=0;c[u]===l;)v++,u++;for(var g=(c.length-u)*T+1>>>0,C=new Uint8Array(g);c[u];){var b=t[c.charCodeAt(u)];if(b===255)return;for(var S=0,E=g-1;(b!==0||S<m)&&E!==-1;E--,S++)b+=a*C[E]>>>0,C[E]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");m=S,u++}if(c[u]!==" "){for(var x=g-m;x!==g&&C[x]===0;)x++;for(var A=new Uint8Array(v+(g-x)),O=v;x!==g;)A[O++]=C[x++];return A}}}function z(c){var u=w(c);if(u)return u;throw new Error(`Non-${e} character`)}return{encode:f,decodeUnsafe:w,decode:z}}var ha=ua,la=ha,Gn=la;var ff=new Uint8Array(0);var _n=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},W=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 Wn=r=>new TextEncoder().encode(r),Xn=r=>new TextDecoder().decode(r);var tr=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},rr=class{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Qn(this,e)}},nr=class{constructor(e){this.decoders=e}or(e){return Qn(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Qn=(r,e)=>new nr({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),or=class{constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new tr(e,t,n),this.decoder=new rr(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Ce=({name:r,prefix:e,encode:t,decode:n})=>new or(r,e,t,n),ee=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:o}=Gn(t,e);return Ce({prefix:r,name:e,encode:n,decode:s=>W(o(s))})},ma=(r,e,t,n)=>{let o={};for(let d=0;d<e.length;++d)o[e[d]]=d;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*t/8|0),a=0,l=0,T=0;for(let d=0;d<s;++d){let f=o[r[d]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<t|f,a+=t,a>=8&&(a-=8,i[T++]=255&l>>a)}if(a>=t||255&l<<8-a)throw new SyntaxError("Unexpected end of data");return i},ba=(r,e,t)=>{let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,a=0;for(let l=0;l<r.length;++l)for(a=a<<8|r[l],i+=8;i>t;)i-=t,s+=e[o&a>>i];if(i&&(s+=e[o&a<<t-i]),n)for(;s.length*t&7;)s+="=";return s},D=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>Ce({prefix:e,name:r,encode(o){return ba(o,n,t)},decode(o){return ma(o,n,t,r)}});var wa=Ce({prefix:"\0",name:"identity",encode:r=>Xn(r),decode:r=>Wn(r)});var ir={};y(ir,{base2:()=>ga});var ga=D({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ar={};y(ar,{base8:()=>xa});var xa=D({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var cr={};y(cr,{base10:()=>ya});var ya=ee({prefix:"9",name:"base10",alphabet:"0123456789"});var dr={};y(dr,{base16:()=>va,base16upper:()=>Ca});var va=D({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ca=D({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var pr={};y(pr,{base32:()=>Se,base32hex:()=>Ta,base32hexpad:()=>Ua,base32hexpadupper:()=>Fa,base32hexupper:()=>Ia,base32pad:()=>Aa,base32padupper:()=>Ea,base32upper:()=>Sa,base32z:()=>Pa});var Se=D({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Sa=D({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Aa=D({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ea=D({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ta=D({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ia=D({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Ua=D({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Fa=D({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Pa=D({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var fr={};y(fr,{base36:()=>Na,base36upper:()=>Da});var Na=ee({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Da=ee({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var ur={};y(ur,{base58btc:()=>j,base58flickr:()=>za});var j=ee({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),za=ee({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var hr={};y(hr,{base64:()=>Ma,base64pad:()=>Ba,base64url:()=>Oa,base64urlpad:()=>ka});var Ma=D({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ba=D({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Oa=D({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ka=D({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var lr={};y(lr,{base256emoji:()=>ja});var Hn=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}"),La=Hn.reduce((r,e,t)=>(r[t]=e,r),[]),Ra=Hn.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function Va(r){return r.reduce((e,t)=>(e+=La[t],e),"")}function $a(r){let e=[];for(let t of r){let n=Ra[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var ja=Ce({prefix:"\u{1F680}",name:"base256emoji",encode:Va,decode:$a});var gr={};y(gr,{sha256:()=>ac,sha512:()=>cc});var qa=eo,Yn=128,Ja=127,Ga=~Ja,_a=Math.pow(2,31);function eo(r,e,t){e=e||[],t=t||0;for(var n=t;r>=_a;)e[t++]=r&255|Yn,r/=128;for(;r&Ga;)e[t++]=r&255|Yn,r>>>=7;return e[t]=r|0,eo.bytes=t-n+1,e}var Wa=mr,Xa=128,Zn=127;function mr(r,n){var t=0,n=n||0,o=0,s=n,i,a=r.length;do{if(s>=a)throw mr.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&Zn)<<o:(i&Zn)*Math.pow(2,o),o+=7}while(i>=Xa);return mr.bytes=s-n,t}var Ka=Math.pow(2,7),Qa=Math.pow(2,14),Ha=Math.pow(2,21),Ya=Math.pow(2,28),Za=Math.pow(2,35),ec=Math.pow(2,42),tc=Math.pow(2,49),rc=Math.pow(2,56),nc=Math.pow(2,63),oc=function(r){return r<Ka?1:r<Qa?2:r<Ha?3:r<Ya?4:r<Za?5:r<ec?6:r<tc?7:r<rc?8:r<nc?9:10},sc={encode:qa,decode:Wa,encodingLength:oc},ic=sc,Ge=ic;var _e=(r,e=0)=>[Ge.decode(r,e),Ge.decode.bytes],Ae=(r,e,t=0)=>(Ge.encode(r,e,t),e),Ee=r=>Ge.encodingLength(r);var se=(r,e)=>{let t=e.byteLength,n=Ee(r),o=n+Ee(t),s=new Uint8Array(o+t);return Ae(r,s,0),Ae(t,s,n),s.set(e,o),new Te(r,t,e,s)},to=r=>{let e=W(r),[t,n]=_e(e),[o,s]=_e(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new Te(t,o,i,e)},ro=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&_n(r.bytes,t.bytes)}},Te=class{constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var wr=({name:r,code:e,encode:t})=>new br(r,e,t),br=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?se(this.code,t):t.then(n=>se(this.code,n))}else throw Error("Unknown type, must be binary type")}};var oo=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),ac=wr({name:"sha2-256",code:18,encode:oo("SHA-256")}),cc=wr({name:"sha2-512",code:19,encode:oo("SHA-512")});var xr={};y(xr,{identity:()=>fc});var so=0,dc="identity",io=W,pc=r=>se(so,io(r)),fc={code:so,name:dc,encode:io,digest:pc};var Df=new TextEncoder,zf=new TextDecoder;var ao=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return mc(t,yr(r),e||j.encoder);default:return bc(t,yr(r),e||Se.encoder)}};var co=new WeakMap,yr=r=>{let e=co.get(r);if(e==null){let t=new Map;return co.set(r,t),t}return e},B=class{constructor(e,t,n,o){this.code=t,this.version=e,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:e,multihash:t}=this;if(e!==Xe)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==wc)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return B.createV0(t)}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:e,digest:t}=this.multihash,n=se(e,t);return B.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(e){return B.equals(this,e)}static equals(e,t){let n=t;return n&&e.code===n.code&&e.version===n.version&&ro(e.multihash,n.multihash)}toString(e){return ao(this,e)}toJSON(){return{"/":ao(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof B)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new B(n,o,s,i||po(n,o,s.bytes))}else if(t[gc]===!0){let{version:n,multihash:o,code:s}=t,i=to(o);return B.create(n,s,i)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==Xe)throw new Error(`Version 0 CID must use dag-pb (code: ${Xe}) block encoding`);return new B(e,t,n,n.bytes)}case 1:{let o=po(e,t,n.bytes);return new B(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return B.create(0,Xe,e)}static createV1(e,t){return B.create(1,e,t)}static decode(e){let[t,n]=B.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=B.inspectBytes(e),n=t.size-t.multihashSize,o=W(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new Te(t.multihashCode,t.digestSize,s,o);return[t.version===0?B.createV0(i):B.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[f,w]=_e(e.subarray(t));return t+=w,f},o=n(),s=Xe;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,a=n(),l=n(),T=t+l,d=T-i;return{version:o,codec:s,multihashCode:a,digestSize:l,multihashSize:d,size:T}}static parse(e,t){let[n,o]=lc(e,t),s=B.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return yr(s).set(n,e),s}},lc=(r,e)=>{switch(r[0]){case"Q":{let t=e||j;return[j.prefix,t.decode(`${j.prefix}${r}`)]}case j.prefix:{let t=e||j;return[j.prefix,t.decode(r)]}case Se.prefix:{let t=e||Se;return[Se.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},mc=(r,e,t)=>{let{prefix:n}=t;if(n!==j.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o},bc=(r,e,t)=>{let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o},Xe=112,wc=18,po=(r,e,t)=>{let n=Ee(r),o=n+Ee(e),s=new Uint8Array(o+t.byteLength);return Ae(r,s,0),Ae(e,s,n),s.set(t,o),s},gc=Symbol.for("@ipld/js-cid/CID");var vr={...sr,...ir,...ar,...cr,...dr,...pr,...fr,...ur,...hr,...lr},qf={...gr,...xr};function Ie(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function ct(r=0){return globalThis.Buffer?.allocUnsafe!=null?Ie(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function uo(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var fo=uo("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Cr=uo("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=ct(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),xc={utf8:fo,"utf-8":fo,hex:vr.base16,latin1:Cr,ascii:Cr,binary:Cr,...vr},dt=xc;function R(r,e="utf8"){let t=dt[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}var Kr=Qe(pt(),1);function X(r,e){e==null&&(e=r.reduce((o,s)=>o+s.length,0));let t=ct(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return Ie(t)}var Fe=Qe(pt(),1);var ft=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let t=this.index,n=e();return n===void 0&&(this.index=t),n}parseWith(e){let t=e();if(this.index===this.input.length)return t}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let t=this.readChar();if(t===e)return t})}readSeparator(e,t,n){return this.readAtomically(()=>{if(!(t>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,t,n,o){return this.readAtomically(()=>{let s=0,i=0,a=this.peekChar();if(a===void 0)return;let l=a==="0",T=2**(8*o)-1;for(;;){let d=this.readAtomically(()=>{let f=this.readChar();if(f===void 0)return;let w=Number.parseInt(f,e);if(!Number.isNaN(w))return w});if(d===void 0)break;if(s*=e,s+=d,s>T||(i+=1,t!==void 0&&i>t))return}if(i!==0)return!n&&l&&i>1?void 0:s})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let t=0;t<e.length;t++){let n=this.readSeparator(".",t,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[t]=n}return e})}readIPv6Addr(){let e=t=>{for(let n=0;n<t.length/2;n++){let o=n*2;if(n<t.length-3){let i=this.readSeparator(":",n,()=>this.readIPv4Addr());if(i!==void 0)return t[o]=i[0],t[o+1]=i[1],t[o+2]=i[2],t[o+3]=i[3],[o+4,!0]}let s=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(s===void 0)return[o,!1];t[o]=s>>8,t[o+1]=s&255}return[t.length,!1]};return this.readAtomically(()=>{let t=new Uint8Array(16),[n,o]=e(t);if(n===16)return t;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let s=new Uint8Array(14),i=16-(n+2),[a]=e(s.subarray(0,i));return t.set(s.subarray(0,a),16-a),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Co=45,zc=15,Ue=new ft;function Er(r){if(!(r.length>zc))return Ue.new(r).parseWith(()=>Ue.readIPv4Addr())}function Tr(r){if(!(r.length>Co))return Ue.new(r).parseWith(()=>Ue.readIPv6Addr())}function ut(r){if(!(r.length>Co))return Ue.new(r).parseWith(()=>Ue.readIPAddr())}var mu=parseInt("0xFFFF",16),bu=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var Ir={};y(Ir,{identity:()=>Lc});var Lc=we({prefix:"\0",name:"identity",encode:r=>Bn(r),decode:r=>Mn(r)});var Ur={};y(Ur,{base2:()=>Rc});var Rc=N({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Fr={};y(Fr,{base8:()=>Vc});var Vc=N({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Pr={};y(Pr,{base10:()=>$c});var $c=Z({prefix:"9",name:"base10",alphabet:"0123456789"});var Nr={};y(Nr,{base16:()=>jc,base16upper:()=>qc});var jc=N({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),qc=N({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Dr={};y(Dr,{base36:()=>Jc,base36upper:()=>Gc});var Jc=Z({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Gc=Z({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var zr={};y(zr,{base64:()=>_c,base64pad:()=>Wc,base64url:()=>Xc,base64urlpad:()=>Kc});var _c=N({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Wc=N({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Xc=N({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Kc=N({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Mr={};y(Mr,{base256emoji:()=>ed});var Eo=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}"),Qc=Eo.reduce((r,e,t)=>(r[t]=e,r),[]),Hc=Eo.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function Yc(r){return r.reduce((e,t)=>(e+=Qc[t],e),"")}function Zc(r){let e=[];for(let t of r){let n=Hc[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var ed=we({prefix:"\u{1F680}",name:"base256emoji",encode:Yc,decode:Zc});var kr={};y(kr,{sha256:()=>td,sha512:()=>rd});var Or=({name:r,code:e,encode:t})=>new Br(r,e,t),Br=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?oe(this.code,t):t.then(n=>oe(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Io=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),td=Or({name:"sha2-256",code:18,encode:Io("SHA-256")}),rd=Or({name:"sha2-512",code:19,encode:Io("SHA-512")});var Lr={};y(Lr,{identity:()=>sd});var Uo=0,nd="identity",Fo=G,od=r=>oe(Uo,Fo(r)),sd={code:Uo,name:nd,encode:Fo,digest:od};var Qu=new TextEncoder,Hu=new TextDecoder;var Po={...Ir,...Ur,...Fr,...Pr,...Nr,...Zt,...Dr,...Ht,...zr,...Mr},rh={...kr,...Lr};function Rr(r,e="utf8"){let t=dt[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Ie(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}var q=Qe(pt(),1);function No(r){return!!Er(r)}function Do(r){return!!Tr(r)}function ht(r){return!!ut(r)}var zo=No,cd=Do,Vr=function(r){let e=0;if(r=r.toString().trim(),zo(r)){let t=new Uint8Array(e+4);return r.split(/\./g).forEach(n=>{t[e++]=parseInt(n,10)&255}),t}if(cd(r)){let t=r.split(":",8),n;for(n=0;n<t.length;n++){let s=zo(t[n]),i;s&&(i=Vr(t[n]),t[n]=R(i.slice(0,2),"base16")),i!=null&&++n<8&&t.splice(n,0,R(i.slice(2,4),"base16"))}if(t[0]==="")for(;t.length<8;)t.unshift("0");else if(t[t.length-1]==="")for(;t.length<8;)t.push("0");else if(t.length<8){for(n=0;n<t.length&&t[n]!=="";n++);let s=[n,1];for(n=9-t.length;n>0;n--)s.push("0");t.splice.apply(t,s)}let o=new Uint8Array(e+16);for(n=0;n<t.length;n++){let s=parseInt(t[n],16);o[e++]=s>>8&255,o[e++]=s&255}return o}throw new Error("invalid ip address")},Mo=function(r,e=0,t){e=~~e,t=t??r.length-e;let n=new DataView(r.buffer);if(t===4){let o=[];for(let s=0;s<t;s++)o.push(r[e+s]);return o.join(".")}if(t===16){let o=[];for(let s=0;s<t;s+=2)o.push(n.getUint16(e+s).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Ke={},$r={},pd=[[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"]];pd.forEach(r=>{let e=fd(...r);$r[e.code]=e,Ke[e.name]=e});function fd(r,e,t,n,o){return{code:r,size:e,name:t,resolvable:!!n,path:!!o}}function I(r){if(typeof r=="number"){if($r[r]!=null)return $r[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(Ke[r]!=null)return Ke[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var Ch=I("ip4"),Sh=I("ip6"),Ah=I("ipcidr");function Ro(r,e){switch(I(r).code){case 4:case 41:return hd(e);case 42:return ko(e);case 6:case 273:case 33:case 132:return $o(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return ko(e);case 421:return wd(e);case 444:return Lo(e);case 445:return Lo(e);case 466:return bd(e);default:return R(e,"base16")}}function Vo(r,e){switch(I(r).code){case 4:return Bo(e);case 41:return Bo(e);case 42:return Oo(e);case 6:case 273:case 33:case 132:return qr(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Oo(e);case 421:return ld(e);case 444:return gd(e);case 445:return xd(e);case 466:return md(e);default:return Rr(e,"base16")}}var jr=Object.values(Po).map(r=>r.decoder),ud=function(){let r=jr[0].or(jr[1]);return jr.slice(2).forEach(e=>r=r.or(e)),r}();function Bo(r){if(!ht(r))throw new Error("invalid ip address");return Vr(r)}function hd(r){let e=Mo(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!ht(e))throw new Error("invalid ip address");return e}function qr(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function $o(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Oo(r){let e=Rr(r),t=Uint8Array.from(q.default.encode(e.length));return X([t,e],t.length+e.length)}function ko(r){let e=q.default.decode(r);if(r=r.slice(q.default.decode.bytes),r.length!==e)throw new Error("inconsistent lengths");return R(r)}function ld(r){let e;r[0]==="Q"||r[0]==="1"?e=it(L.decode(`z${r}`)).bytes:e=U.parse(r).multihash.bytes;let t=Uint8Array.from(q.default.encode(e.length));return X([t,e],t.length+e.length)}function md(r){let e=ud.decode(r),t=Uint8Array.from(q.default.encode(e.length));return X([t,e],t.length+e.length)}function bd(r){let e=q.default.decode(r),t=r.slice(q.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return"u"+R(t,"base64url")}function wd(r){let e=q.default.decode(r),t=r.slice(q.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return R(t,"base58btc")}function gd(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let t=_.decode("b"+e[0]),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=qr(n);return X([t,o],t.length+o.length)}function xd(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let t=_.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=qr(n);return X([t,o],t.length+o.length)}function Lo(r){let e=r.slice(0,r.length-2),t=r.slice(r.length-2),n=R(e,"base32"),o=$o(t);return`${n}:${o}`}function yd(r){let e=[],t=r.split("/").slice(1);if(t.length===1&&t[0]==="")return[];for(let n=0;n<t.length;n++){let o=t[n],s=I(o);if(s.size===0){e.push([o]);continue}if(n++,n>=t.length)throw qo("invalid address: "+r);if(s.path===!0){e.push([o,Xr(t.slice(n).join("/"))]);break}e.push([o,t[n]])}return e}function vd(r){let e=[];return r.map(t=>{let n=bt(t);return e.push(n.name),t.length>1&&t[1]!=null&&e.push(t[1]),null}),Xr(e.join("/"))}function Cd(r){return r.map(e=>{Array.isArray(e)||(e=[e]);let t=bt(e);return e.length>1?[t.code,Vo(t.code,e[1])]:[t.code]})}function Jr(r){return r.map(e=>{let t=bt(e);return e[1]!=null?[t.code,Ro(t.code,e[1])]:[t.code]})}function Gr(r){return mt(X(r.map(e=>{let t=bt(e),n=Uint8Array.from(Fe.default.encode(t.code));return e.length>1&&e[1]!=null&&(n=X([n,e[1]])),n})))}function _r(r,e){return r.size>0?r.size/8:r.size===0?0:Fe.default.decode(e)+(Fe.default.decode.bytes??0)}function lt(r){let e=[],t=0;for(;t<r.length;){let n=Fe.default.decode(r,t),o=Fe.default.decode.bytes??0,s=I(n),i=_r(s,r.slice(t+o));if(i===0){e.push([n]),t+=o;continue}let a=r.slice(t+o,t+o+i);if(t+=i+o,t>r.length)throw qo("Invalid address Uint8Array: "+R(r,"base16"));e.push([n,a])}return e}function Wr(r){let e=lt(r),t=Jr(e);return vd(t)}function Sd(r){r=Xr(r);let e=yd(r),t=Cd(e);return Gr(t)}function jo(r){return Sd(r)}function mt(r){let e=Ad(r);if(e!=null)throw e;return Uint8Array.from(r)}function Ad(r){try{lt(r)}catch(e){return e}}function Xr(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function qo(r){return new Error("Error parsing address: "+r)}function bt(r){return I(r[0])}var Td=Symbol.for("nodejs.util.inspect.custom"),Id=[I("dns").code,I("dns4").code,I("dns6").code,I("dnsaddr").code],Ud=new Map,Jo=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Fd(r){return!!r?.[Jo]}var K=class{bytes;#e;#r;#n;#t;[Jo]=!0;constructor(e){if(e==null&&(e=""),e instanceof Uint8Array)this.bytes=mt(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=jo(e)}else if(Fd(e))this.bytes=mt(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return this.#e==null&&(this.#e=Wr(this.bytes)),this.#e}toJSON(){return this.toString()}toOptions(){let e,t,n,o,s="",i=I("tcp"),a=I("udp"),l=I("ip4"),T=I("ip6"),d=I("dns6"),f=I("ip6zone");for(let[z,c]of this.stringTuples())z===f.code&&(s=`%${c??""}`),Id.includes(z)&&(t=i.name,o=443,n=`${c??""}${s}`,e=z===d.code?6:4),(z===i.code||z===a.code)&&(t=I(z).name,o=parseInt(c??"")),(z===l.code||z===T.code)&&(t=I(z).name,n=`${c??""}${s}`,e=z===T.code?6:4);if(e==null||t==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:e,host:n,transport:t,port:o}}protos(){return this.protoCodes().map(e=>Object.assign({},I(e)))}protoCodes(){let e=[],t=this.bytes,n=0;for(;n<t.length;){let o=Kr.default.decode(t,n),s=Kr.default.decode.bytes??0,i=I(o),a=_r(i,t.slice(n+s));n+=a+s,e.push(o)}return e}protoNames(){return this.protos().map(e=>e.name)}tuples(){return this.#r==null&&(this.#r=lt(this.bytes)),this.#r}stringTuples(){return this.#n==null&&(this.#n=Jr(this.tuples())),this.#n}encapsulate(e){return e=new K(e),new K(this.toString()+e.toString())}decapsulate(e){let t=e.toString(),n=this.toString(),o=n.lastIndexOf(t);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new K(n.slice(0,o))}decapsulateCode(e){let t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new K(Gr(t.slice(0,n)));return this}getPeerId(){try{let t=this.stringTuples().filter(n=>n[0]===Ke.ipfs.code).pop();if(t?.[1]!=null){let n=t[1];return n[0]==="Q"||n[0]==="1"?R(L.decode(`z${n}`),"base58btc"):R(U.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){if(this.#t===void 0)try{this.#t=this.stringTuples().filter(e=>I(e[0]).path===!0)[0][1],this.#t==null&&(this.#t=null)}catch{this.#t=null}return this.#t}equals(e){return ke(this.bytes,e.bytes)}async resolve(e){let t=this.protos().find(s=>s.resolvable);if(t==null)return[this];let n=Ud.get(t.name);if(n==null)throw new ot(`no available resolver for ${t.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(s=>new K(s))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let t=(e??this).protos();return!(t.length!==2||t[0].code!==4&&t[0].code!==41||t[1].code!==6&&t[1].code!==273)}[Td](){return`Multiaddr(${Wr(this.bytes)})`}};function Pe(r){return new K(r)}var Pd=p("dns4"),Nd=p("dns6"),Dd=p("dnsaddr"),ae=M(p("dns"),Dd,Pd,Nd),xt=M(p("ip4"),p("ip6")),Ne=M(h(xt,p("tcp")),h(ae,p("tcp"))),yt=h(xt,p("udp")),zd=h(yt,p("utp")),Md=h(yt,p("quic")),Bd=h(yt,p("quic-v1")),Qr=M(h(Ne,p("ws")),h(ae,p("ws"))),wt=M(h(Qr,p("p2p")),Qr),Hr=M(h(Ne,p("wss")),h(ae,p("wss")),h(Ne,p("tls"),p("ws")),h(ae,p("tls"),p("ws"))),gt=M(h(Hr,p("p2p")),Hr),Yr=M(h(Ne,p("http")),h(xt,p("http")),h(ae,p("http"))),Zr=M(h(Ne,p("https")),h(xt,p("https")),h(ae,p("https"))),Go=h(yt,p("webrtc-direct"),p("certhash")),Xo=M(h(Go,p("p2p")),Go),_o=h(Bd,p("webtransport"),p("certhash"),p("certhash")),Ko=M(h(_o,p("p2p")),_o),Qo=M(h(wt,p("p2p-webrtc-star"),p("p2p")),h(gt,p("p2p-webrtc-star"),p("p2p")),h(wt,p("p2p-webrtc-star")),h(gt,p("p2p-webrtc-star"))),Jh=M(h(wt,p("p2p-websocket-star"),p("p2p")),h(gt,p("p2p-websocket-star"),p("p2p")),h(wt,p("p2p-websocket-star")),h(gt,p("p2p-websocket-star"))),Ho=M(h(Yr,p("p2p-webrtc-direct"),p("p2p")),h(Zr,p("p2p-webrtc-direct"),p("p2p")),h(Yr,p("p2p-webrtc-direct")),h(Zr,p("p2p-webrtc-direct"))),ce=M(Qr,Hr,Yr,Zr,Qo,Ho,Ne,zd,Md,ae,Xo,Ko),Gh=M(h(ce,p("p2p-stardust"),p("p2p")),h(ce,p("p2p-stardust"))),te=M(h(ce,p("p2p")),Qo,Ho,Xo,Ko,p("p2p")),Wo=M(h(te,p("p2p-circuit"),te),h(te,p("p2p-circuit")),h(p("p2p-circuit"),te),h(ce,p("p2p-circuit")),h(p("p2p-circuit"),ce),p("p2p-circuit")),Yo=()=>M(h(Wo,Yo),Wo),ie=Yo(),Zo=M(h(ie,te,ie),h(te,ie),h(ie,te),ie,te);var _h=M(h(ie,p("webrtc"),p("p2p")),h(ie,p("webrtc")),h(ce,p("webrtc"),p("p2p")),h(ce,p("webrtc")),p("webrtc"));function es(r){function e(t){let n;try{n=Pe(t)}catch{return!1}let o=r(n.protoNames());return o===null?!1:o===!0||o===!1?o:o.length===0}return e}function h(...r){function e(t){if(t.length<r.length)return null;let n=t;return r.some(o=>(n=typeof o=="function"?o().partialMatch(t):o.partialMatch(t),Array.isArray(n)&&(t=n),n===null)),n}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:es(e),partialMatch:e}}function M(...r){function e(n){let o=null;return r.some(s=>{let i=typeof s=="function"?s().partialMatch(n):s.partialMatch(n);return i!=null?(o=i,!0):!1}),o}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:es(e),partialMatch:e}}function p(r){let e=r;function t(o){let s;try{s=Pe(o)}catch{return!1}let i=s.protoNames();return i.length===1&&i[0]===e}function n(o){return o.length===0?null:o[0]===e?o.slice(1):null}return{toString:function(){return e},matches:t,partialMatch:n}}var vt=ln("libp2p:bootstrap"),Od="bootstrap",kd=50,Ld=12e4,Rd=1e3,Ct=class extends Ye{timer;list;timeout;components;_init;constructor(e,t={list:[]}){if(t.list==null||t.list.length===0)throw new Error("Bootstrap requires a list of peer addresses");super(),this.components=e,this.timeout=t.timeout??Rd,this.list=[];for(let n of t.list){if(!Zo.matches(n)){vt.error("Invalid multiaddr");continue}let o=Pe(n),s=o.getPeerId();if(s==null){vt.error("Invalid bootstrap multiaddr without peer id");continue}let i={id:_t(s),multiaddrs:[o],protocols:[]};this.list.push(i)}this._init=t}[tn]=this;[Symbol.toStringTag]="@libp2p/bootstrap";isStarted(){return!!this.timer}start(){this.isStarted()||(vt("Starting bootstrap node discovery, discovering peers after %s ms",this.timeout),this.timer=setTimeout(()=>{this._discoverBootstrapPeers().catch(e=>{vt.error(e)})},this.timeout))}async _discoverBootstrapPeers(){if(this.timer!=null)for(let e of this.list){if(await this.components.peerStore.merge(e.id,{tags:{[this._init.tagName??Od]:{value:this._init.tagValue??kd,ttl:this._init.tagTTL??Ld}}}),this.timer==null)return;this.safeDispatchEvent("peer",{detail:e})}}stop(){this.timer!=null&&clearTimeout(this.timer),this.timer=void 0}};He(Ct,"tag","bootstrap");function Vd(r){return e=>new Ct(e,r)}return as($d);})();
|
|
3
3
|
return Libp2PBootstrap}));
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PeerDiscovery } from '@libp2p/interface
|
|
2
|
-
import type { PeerStore } from '@libp2p/interface
|
|
1
|
+
import type { PeerDiscovery } from '@libp2p/interface/peer-discovery';
|
|
2
|
+
import type { PeerStore } from '@libp2p/interface/peer-store';
|
|
3
3
|
export interface BootstrapInit {
|
|
4
4
|
/**
|
|
5
5
|
* The list of peer addresses in multi-address format
|
package/dist/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { EventEmitter } from '@libp2p/interface/events';
|
|
2
|
+
import { peerDiscovery } from '@libp2p/interface/peer-discovery';
|
|
3
3
|
import { logger } from '@libp2p/logger';
|
|
4
4
|
import { peerIdFromString } from '@libp2p/peer-id';
|
|
5
5
|
import { P2P } from '@multiformats/mafmt';
|
|
@@ -47,7 +47,7 @@ class Bootstrap extends EventEmitter {
|
|
|
47
47
|
}
|
|
48
48
|
this._init = options;
|
|
49
49
|
}
|
|
50
|
-
[
|
|
50
|
+
[peerDiscovery] = this;
|
|
51
51
|
[Symbol.toStringTag] = '@libp2p/bootstrap';
|
|
52
52
|
isStarted() {
|
|
53
53
|
return Boolean(this.timer);
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAMnD,MAAM,GAAG,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAA;AAEtC,MAAM,0BAA0B,GAAG,WAAW,CAAA;AAC9C,MAAM,2BAA2B,GAAG,EAAE,CAAA;AACtC,MAAM,yBAAyB,GAAG,MAAM,CAAA;AACxC,MAAM,mCAAmC,GAAG,IAAI,CAAA;AAiChD;;GAEG;AACH,MAAM,SAAU,SAAQ,YAAiC;IACvD,MAAM,CAAC,GAAG,GAAG,WAAW,CAAA;IAEhB,KAAK,CAAgC;IAC5B,IAAI,CAAY;IAChB,OAAO,CAAQ;IACf,UAAU,CAAqB;IAC/B,KAAK,CAAe;IAErC,YAAa,UAA+B,EAAE,UAAyB,EAAE,IAAI,EAAE,EAAE,EAAE;QACjF,IAAI,OAAO,CAAC,IAAI,IAAI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;YACrD,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;SAC/D;QACD,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,mCAAmC,CAAA;QACrE,IAAI,CAAC,IAAI,GAAG,EAAE,CAAA;QAEd,KAAK,MAAM,SAAS,IAAI,OAAO,CAAC,IAAI,EAAE;YACpC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;gBAC3B,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAA;gBAC9B,SAAQ;aACT;YAED,MAAM,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC,CAAA;YAC/B,MAAM,SAAS,GAAG,EAAE,CAAC,SAAS,EAAE,CAAA;YAEhC,IAAI,SAAS,IAAI,IAAI,EAAE;gBACrB,GAAG,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAA;gBACxD,SAAQ;aACT;YAED,MAAM,QAAQ,GAAa;gBACzB,EAAE,EAAE,gBAAgB,CAAC,SAAS,CAAC;gBAC/B,UAAU,EAAE,CAAC,EAAE,CAAC;gBAChB,SAAS,EAAE,EAAE;aACd,CAAA;YAED,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;SACzB;QAED,IAAI,CAAC,KAAK,GAAG,OAAO,CAAA;IACtB,CAAC;IAEQ,CAAC,aAAa,CAAC,GAAG,IAAI,CAAA;IAEtB,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,mBAAmB,CAAA;IAEnD,SAAS;QACP,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC5B,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE;YACpB,OAAM;SACP;QAED,GAAG,CAAC,kEAAkE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;QACrF,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC3B,KAAK,IAAI,CAAC,uBAAuB,EAAE;iBAChC,KAAK,CAAC,GAAG,CAAC,EAAE;gBACX,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAChB,CAAC,CAAC,CAAA;QACN,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IAClB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,uBAAuB;QAC3B,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE;YACtB,OAAM;SACP;QAED,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE;YAChC,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE;gBACjD,IAAI,EAAE;oBACJ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,0BAA0B,CAAC,EAAE;wBAClD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,2BAA2B;wBACzD,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,yBAAyB;qBACpD;iBACF;aACF,CAAC,CAAA;YAEF,6BAA6B;YAC7B,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE;gBACtB,OAAM;aACP;YAED,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAA;SACrD;IACH,CAAC;IAED;;OAEG;IACH,IAAI;QACF,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE;YACtB,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;SACzB;QAED,IAAI,CAAC,KAAK,GAAG,SAAS,CAAA;IACxB,CAAC;;AAGH,MAAM,UAAU,SAAS,CAAE,IAAmB;IAC5C,OAAO,CAAC,UAA+B,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;AAC7E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/bootstrap",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "8.0.0-05abd49f",
|
|
4
|
+
"description": "Peer discovery via a list of bootstrap peers",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
|
-
"homepage": "https://github.com/libp2p/js-libp2p-bootstrap#readme",
|
|
6
|
+
"homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/peer-discovery-bootstrap#readme",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/libp2p/js-libp2p
|
|
9
|
+
"url": "git+https://github.com/libp2p/js-libp2p.git"
|
|
10
10
|
},
|
|
11
11
|
"bugs": {
|
|
12
|
-
"url": "https://github.com/libp2p/js-libp2p
|
|
12
|
+
"url": "https://github.com/libp2p/js-libp2p/issues"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
15
|
"IPFS"
|
|
16
16
|
],
|
|
17
|
-
"engines": {
|
|
18
|
-
"node": ">=16.0.0",
|
|
19
|
-
"npm": ">=7.0.0"
|
|
20
|
-
},
|
|
21
17
|
"type": "module",
|
|
22
18
|
"types": "./dist/src/index.d.ts",
|
|
23
19
|
"files": [
|
|
@@ -38,91 +34,6 @@
|
|
|
38
34
|
"sourceType": "module"
|
|
39
35
|
}
|
|
40
36
|
},
|
|
41
|
-
"release": {
|
|
42
|
-
"branches": [
|
|
43
|
-
"master"
|
|
44
|
-
],
|
|
45
|
-
"plugins": [
|
|
46
|
-
[
|
|
47
|
-
"@semantic-release/commit-analyzer",
|
|
48
|
-
{
|
|
49
|
-
"preset": "conventionalcommits",
|
|
50
|
-
"releaseRules": [
|
|
51
|
-
{
|
|
52
|
-
"breaking": true,
|
|
53
|
-
"release": "major"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"revert": true,
|
|
57
|
-
"release": "patch"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"type": "feat",
|
|
61
|
-
"release": "minor"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"type": "fix",
|
|
65
|
-
"release": "patch"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"type": "docs",
|
|
69
|
-
"release": "patch"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"type": "test",
|
|
73
|
-
"release": "patch"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"type": "deps",
|
|
77
|
-
"release": "patch"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"scope": "no-release",
|
|
81
|
-
"release": false
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
}
|
|
85
|
-
],
|
|
86
|
-
[
|
|
87
|
-
"@semantic-release/release-notes-generator",
|
|
88
|
-
{
|
|
89
|
-
"preset": "conventionalcommits",
|
|
90
|
-
"presetConfig": {
|
|
91
|
-
"types": [
|
|
92
|
-
{
|
|
93
|
-
"type": "feat",
|
|
94
|
-
"section": "Features"
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
"type": "fix",
|
|
98
|
-
"section": "Bug Fixes"
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"type": "chore",
|
|
102
|
-
"section": "Trivial Changes"
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
"type": "docs",
|
|
106
|
-
"section": "Documentation"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
"type": "deps",
|
|
110
|
-
"section": "Dependencies"
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
"type": "test",
|
|
114
|
-
"section": "Tests"
|
|
115
|
-
}
|
|
116
|
-
]
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
],
|
|
120
|
-
"@semantic-release/changelog",
|
|
121
|
-
"@semantic-release/npm",
|
|
122
|
-
"@semantic-release/github",
|
|
123
|
-
"@semantic-release/git"
|
|
124
|
-
]
|
|
125
|
-
},
|
|
126
37
|
"scripts": {
|
|
127
38
|
"clean": "aegir clean",
|
|
128
39
|
"lint": "aegir lint",
|
|
@@ -134,24 +45,21 @@
|
|
|
134
45
|
"test:firefox": "aegir test -t browser -- --browser firefox",
|
|
135
46
|
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
|
|
136
47
|
"test:node": "aegir test -t node --cov",
|
|
137
|
-
"test:electron-main": "aegir test -t electron-main"
|
|
138
|
-
"release": "aegir release",
|
|
139
|
-
"docs": "aegir docs"
|
|
48
|
+
"test:electron-main": "aegir test -t electron-main"
|
|
140
49
|
},
|
|
141
50
|
"dependencies": {
|
|
142
|
-
"@libp2p/interface
|
|
143
|
-
"@libp2p/
|
|
144
|
-
"@libp2p/
|
|
145
|
-
"@
|
|
146
|
-
"@
|
|
147
|
-
"@libp2p/peer-id": "^2.0.0",
|
|
148
|
-
"@multiformats/mafmt": "^12.0.0",
|
|
149
|
-
"@multiformats/multiaddr": "^12.0.0"
|
|
51
|
+
"@libp2p/interface": "0.0.1-05abd49f",
|
|
52
|
+
"@libp2p/logger": "2.1.1-05abd49f",
|
|
53
|
+
"@libp2p/peer-id": "2.0.3-05abd49f",
|
|
54
|
+
"@multiformats/mafmt": "^12.1.2",
|
|
55
|
+
"@multiformats/multiaddr": "^12.1.3"
|
|
150
56
|
},
|
|
151
57
|
"devDependencies": {
|
|
152
|
-
"@libp2p/interface-
|
|
153
|
-
"
|
|
154
|
-
"aegir": "^39.0.5",
|
|
58
|
+
"@libp2p/interface-compliance-tests": "3.0.7-05abd49f",
|
|
59
|
+
"aegir": "^39.0.10",
|
|
155
60
|
"sinon-ts": "^1.0.0"
|
|
61
|
+
},
|
|
62
|
+
"typedoc": {
|
|
63
|
+
"entryPoint": "./src/index.ts"
|
|
156
64
|
}
|
|
157
65
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { EventEmitter } from '@libp2p/interface/events'
|
|
2
|
+
import { peerDiscovery } from '@libp2p/interface/peer-discovery'
|
|
3
3
|
import { logger } from '@libp2p/logger'
|
|
4
4
|
import { peerIdFromString } from '@libp2p/peer-id'
|
|
5
5
|
import { P2P } from '@multiformats/mafmt'
|
|
6
6
|
import { multiaddr } from '@multiformats/multiaddr'
|
|
7
|
-
import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interface
|
|
8
|
-
import type { PeerInfo } from '@libp2p/interface
|
|
9
|
-
import type { PeerStore } from '@libp2p/interface
|
|
10
|
-
import type { Startable } from '@libp2p/
|
|
7
|
+
import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interface/peer-discovery'
|
|
8
|
+
import type { PeerInfo } from '@libp2p/interface/peer-info'
|
|
9
|
+
import type { PeerStore } from '@libp2p/interface/peer-store'
|
|
10
|
+
import type { Startable } from '@libp2p/interface/startable'
|
|
11
11
|
|
|
12
12
|
const log = logger('libp2p:bootstrap')
|
|
13
13
|
|
|
@@ -95,7 +95,7 @@ class Bootstrap extends EventEmitter<PeerDiscoveryEvents> implements PeerDiscove
|
|
|
95
95
|
this._init = options
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
readonly [
|
|
98
|
+
readonly [peerDiscovery] = this
|
|
99
99
|
|
|
100
100
|
readonly [Symbol.toStringTag] = '@libp2p/bootstrap'
|
|
101
101
|
|
package/dist/typedoc-urls.json
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"BootstrapComponents": "https://libp2p.github.io/js-libp2p-bootstrap/interfaces/BootstrapComponents.html",
|
|
3
|
-
"BootstrapInit": "https://libp2p.github.io/js-libp2p-bootstrap/interfaces/BootstrapInit.html",
|
|
4
|
-
"bootstrap": "https://libp2p.github.io/js-libp2p-bootstrap/functions/bootstrap.html"
|
|
5
|
-
}
|