@libp2p/peer-collections 5.1.11 → 5.2.0-a11e135c2

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 CHANGED
@@ -108,6 +108,20 @@ const set = trackedPeerSet({ name: 'my_metric_name', metrics: libp2p.metrics })
108
108
  set.add(peerId)
109
109
  ```
110
110
 
111
+ ## Example - Peer filters
112
+
113
+ ```TypeScript
114
+ import { peerFilter } from '@libp2p/peer-collections'
115
+ import { createEd25519PeerId } from '@libp2p/peer-id-factory'
116
+
117
+ const peerId = await createEd25519PeerId()
118
+
119
+ const filter = peerFilter(1024)
120
+ filter.has(peerId) // false
121
+ filter.add(peerId)
122
+ filter.has(peerId) // true
123
+ ```
124
+
111
125
  # Install
112
126
 
113
127
  ```console
package/dist/index.min.js CHANGED
@@ -1,3 +1,3 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PPeerCollections = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var Libp2PPeerCollections=(()=>{var ee=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var ot=Object.prototype.hasOwnProperty;var d=(r,e)=>{for(var t in e)ee(r,t,{get:e[t],enumerable:!0})},st=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of nt(e))!ot.call(r,o)&&o!==t&&ee(r,o,{get:()=>e[o],enumerable:!(n=rt(e,o))||n.enumerable});return r};var it=r=>st(ee({},"__esModule",{value:!0}),r);var mr={};d(mr,{PeerList:()=>z,PeerMap:()=>M,PeerSet:()=>U,peerList:()=>Ye,peerMap:()=>Xe,peerSet:()=>We,trackedPeerList:()=>et,trackedPeerMap:()=>Ze,trackedPeerSet:()=>_e});var Ie=Symbol.for("@libp2p/peer-id");var se={};d(se,{base58btc:()=>l,base58flickr:()=>ft});var gr=new Uint8Array(0);function De(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}function C(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")}function Me(r){return new TextEncoder().encode(r)}function Ue(r){return new TextDecoder().decode(r)}function at(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 c=r.length,h=r.charAt(0),N=Math.log(c)/Math.log(256),m=Math.log(256)/Math.log(c);function O(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length===0)return"";for(var f=0,L=0,x=0,w=a.length;x!==w&&a[x]===0;)x++,f++;for(var y=(w-x)*m+1>>>0,b=new Uint8Array(y);x!==w;){for(var v=a[x],A=0,g=y-1;(v!==0||A<L)&&g!==-1;g--,A++)v+=256*b[g]>>>0,b[g]=v%c>>>0,v=v/c>>>0;if(v!==0)throw new Error("Non-zero carry");L=A,x++}for(var S=y-L;S!==y&&b[S]===0;)S++;for(var W=h.repeat(f);S<y;++S)W+=r.charAt(b[S]);return W}function X(a){if(typeof a!="string")throw new TypeError("Expected String");if(a.length===0)return new Uint8Array;var f=0;if(a[f]!==" "){for(var L=0,x=0;a[f]===h;)L++,f++;for(var w=(a.length-f)*N+1>>>0,y=new Uint8Array(w);a[f];){var b=t[a.charCodeAt(f)];if(b===255)return;for(var v=0,A=w-1;(b!==0||v<x)&&A!==-1;A--,v++)b+=c*y[A]>>>0,y[A]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");x=v,f++}if(a[f]!==" "){for(var g=w-x;g!==w&&y[g]===0;)g++;for(var S=new Uint8Array(L+(w-g)),W=L;g!==w;)S[W++]=y[g++];return S}}}function tt(a){var f=X(a);if(f)return f;throw new Error(`Non-${e} character`)}return{encode:O,decodeUnsafe:X,decode:tt}}var ct=at,pt=ct,Le=pt;var te=class{name;prefix;baseEncode;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")}},re=class{name;prefix;baseDecode;prefixCodePoint;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 Pe(this,e)}},ne=class{decoders;constructor(e){this.decoders=e}or(e){return Pe(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Pe(r,e){return new ne({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var oe=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new te(e,t,n),this.decoder=new re(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function B({name:r,prefix:e,encode:t,decode:n}){return new oe(r,e,t,n)}function I({name:r,prefix:e,alphabet:t}){let{encode:n,decode:o}=Le(t,r);return B({prefix:e,name:r,encode:n,decode:s=>C(o(s))})}function ut(r,e,t,n){let o={};for(let m=0;m<e.length;++m)o[e[m]]=m;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*t/8|0),c=0,h=0,N=0;for(let m=0;m<s;++m){let O=o[r[m]];if(O===void 0)throw new SyntaxError(`Non-${n} character`);h=h<<t|O,c+=t,c>=8&&(c-=8,i[N++]=255&h>>c)}if(c>=t||255&h<<8-c)throw new SyntaxError("Unexpected end of data");return i}function ht(r,e,t){let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,c=0;for(let h=0;h<r.length;++h)for(c=c<<8|r[h],i+=8;i>t;)i-=t,s+=e[o&c>>i];if(i!==0&&(s+=e[o&c<<t-i]),n)for(;s.length*t&7;)s+="=";return s}function p({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return B({prefix:e,name:r,encode(o){return ht(o,n,t)},decode(o){return ut(o,n,t,r)}})}var l=I({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ft=I({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ie={};d(ie,{base10:()=>dt});var dt=I({prefix:"9",name:"base10",alphabet:"0123456789"});var ae={};d(ae,{base16:()=>lt,base16upper:()=>mt});var lt=p({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),mt=p({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ce={};d(ce,{base2:()=>bt});var bt=p({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var pe={};d(pe,{base256emoji:()=>vt});var Ne=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}"),xt=Ne.reduce((r,e,t)=>(r[t]=e,r),[]),gt=Ne.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function wt(r){return r.reduce((e,t)=>(e+=xt[t],e),"")}function yt(r){let e=[];for(let t of r){let n=gt[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var vt=B({prefix:"\u{1F680}",name:"base256emoji",encode:wt,decode:yt});var ue={};d(ue,{base32:()=>T,base32hex:()=>At,base32hexpad:()=>Dt,base32hexpadupper:()=>Mt,base32hexupper:()=>It,base32pad:()=>Ct,base32padupper:()=>Et,base32upper:()=>St,base32z:()=>Ut});var T=p({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),St=p({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ct=p({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Et=p({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),At=p({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),It=p({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Dt=p({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Mt=p({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Ut=p({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var he={};d(he,{base36:()=>zt,base36upper:()=>Lt});var zt=I({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Lt=I({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var fe={};d(fe,{base64:()=>Pt,base64pad:()=>Nt,base64url:()=>Ot,base64urlpad:()=>Bt});var Pt=p({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Nt=p({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Ot=p({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Bt=p({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var de={};d(de,{base8:()=>Tt});var Tt=p({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var le={};d(le,{identity:()=>kt});var kt=B({prefix:"\0",name:"identity",encode:r=>Ue(r),decode:r=>Me(r)});var Or=new TextEncoder,Br=new TextDecoder;var be={};d(be,{identity:()=>Z});var Vt=Te,Oe=128,qt=127,jt=~qt,$t=Math.pow(2,31);function Te(r,e,t){e=e||[],t=t||0;for(var n=t;r>=$t;)e[t++]=r&255|Oe,r/=128;for(;r&jt;)e[t++]=r&255|Oe,r>>>=7;return e[t]=r|0,Te.bytes=t-n+1,e}var Kt=me,Jt=128,Be=127;function me(r,n){var t=0,n=n||0,o=0,s=n,i,c=r.length;do{if(s>=c)throw me.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&Be)<<o:(i&Be)*Math.pow(2,o),o+=7}while(i>=Jt);return me.bytes=s-n,t}var Gt=Math.pow(2,7),Ht=Math.pow(2,14),Qt=Math.pow(2,21),Xt=Math.pow(2,28),Wt=Math.pow(2,35),Yt=Math.pow(2,42),Zt=Math.pow(2,49),_t=Math.pow(2,56),er=Math.pow(2,63),tr=function(r){return r<Gt?1:r<Ht?2:r<Qt?3:r<Xt?4:r<Wt?5:r<Yt?6:r<Zt?7:r<_t?8:r<er?9:10},rr={encode:Vt,decode:Kt,encodingLength:tr},nr=rr,q=nr;function j(r,e=0){return[q.decode(r,e),q.decode.bytes]}function k(r,e,t=0){return q.encode(r,e,t),e}function R(r){return q.encodingLength(r)}function D(r,e){let t=e.byteLength,n=R(r),o=n+R(t),s=new Uint8Array(o+t);return k(r,s,0),k(t,s,n),s.set(e,o),new F(r,t,e,s)}function $(r){let e=C(r),[t,n]=j(e),[o,s]=j(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new F(t,o,i,e)}function ke(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&De(r.bytes,t.bytes)}}var F=class{code;size;digest;bytes;constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var Re=0,or="identity",Fe=C;function sr(r){return D(Re,Fe(r))}var Z={code:Re,name:or,encode:Fe,digest:sr};var we={};d(we,{sha256:()=>_,sha512:()=>ir});function ge({name:r,code:e,encode:t}){return new xe(r,e,t)}var xe=class{name;code;encode;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?D(this.code,t):t.then(n=>D(this.code,n))}else throw Error("Unknown type, must be binary type")}};function qe(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var _=ge({name:"sha2-256",code:18,encode:qe("SHA-256")}),ir=ge({name:"sha2-512",code:19,encode:qe("SHA-512")});function je(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return cr(t,ye(r),e??l.encoder);default:return pr(t,ye(r),e??T.encoder)}}var $e=new WeakMap;function ye(r){let e=$e.get(r);if(e==null){let t=new Map;return $e.set(r,t),t}return e}var P=class r{code;version;multihash;bytes;"/";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!==K)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==ur)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.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=D(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&ke(e.multihash,n.multihash)}toString(e){return je(this,e)}toJSON(){return{"/":je(this)}}link(){return this}[Symbol.toStringTag]="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 r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new r(n,o,s,i??Ke(n,o,s.bytes))}else if(t[hr]===!0){let{version:n,multihash:o,code:s}=t,i=$(o);return r.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!==K)throw new Error(`Version 0 CID must use dag-pb (code: ${K}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=Ke(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,K,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,o=C(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 F(t.multihashCode,t.digestSize,s,o);return[t.version===0?r.createV0(i):r.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[O,X]=j(e.subarray(t));return t+=X,O},o=n(),s=K;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,c=n(),h=n(),N=t+h,m=N-i;return{version:o,codec:s,multihashCode:c,digestSize:h,multihashSize:m,size:N}}static parse(e,t){let[n,o]=ar(e,t),s=r.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ye(s).set(n,e),s}};function ar(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 T.prefix:{let t=e??T;return[T.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)]}}}function cr(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}function pr(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}var K=112,ur=18;function Ke(r,e,t){let n=R(r),o=n+R(e),s=new Uint8Array(o+t.byteLength);return k(r,s,0),k(e,s,n),s.set(t,o),s}var hr=Symbol.for("@ipld/js-cid/CID");var ve={...le,...ce,...de,...ie,...ae,...ue,...he,...se,...fe,...pe},rn={...we,...be};function Se(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 fr=Symbol.for("nodejs.util.inspect.custom"),Je=Object.values(ve).map(r=>r.decoder).reduce((r,e)=>r.or(e),ve.identity.decoder),Ge=114,He=36,Qe=37,J=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()})`}[Ie]=!0;toString(){return this.string==null&&(this.string=l.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return P.createV1(Ge,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return Se(this.multihash.bytes,e);if(typeof e=="string")return u(e).equals(this);if(e?.multihash?.bytes!=null)return Se(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[fr](){return`PeerId(${this.toString()})`}},G=class extends J{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},H=class extends J{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},Q=class extends J{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function u(r,e){if(e=e??Je,r.charAt(0)==="1"||r.charAt(0)==="Q"){let t=$(l.decode(`z${r}`));return r.startsWith("12D")?new H({multihash:t}):r.startsWith("16U")?new Q({multihash:t}):new G({multihash:t})}return dr(Je.decode(r))}function dr(r){try{let e=$(r);if(e.code===Z.code){if(e.digest.length===He)return new H({multihash:e});if(e.digest.length===Qe)return new Q({multihash:e})}if(e.code===_.code)return new G({multihash:e})}catch{return lr(P.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function lr(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==Ge)throw new Error("Supplied PeerID CID is invalid");let e=r.multihash;if(e.code===_.code)return new G({multihash:r.multihash});if(e.code===Z.code){if(e.digest.length===He)return new H({multihash:r.multihash});if(e.digest.length===Qe)return new Q({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}function E(r,e){let t={[Symbol.iterator]:()=>t,next:()=>{let n=r.next(),o=n.value;return n.done===!0||o==null?{done:!0,value:void 0}:{done:!1,value:e(o)}}};return t}var M=class{map;constructor(e){if(this.map=new Map,e!=null)for(let[t,n]of e.entries())this.map.set(t.toString(),n)}[Symbol.iterator](){return this.entries()}clear(){this.map.clear()}delete(e){return this.map.delete(e.toString())}entries(){return E(this.map.entries(),e=>[u(e[0]),e[1]])}forEach(e){this.map.forEach((t,n)=>{e(t,u(n),this)})}get(e){return this.map.get(e.toString())}has(e){return this.map.has(e.toString())}set(e,t){this.map.set(e.toString(),t)}keys(){return E(this.map.keys(),e=>u(e))}values(){return this.map.values()}get size(){return this.map.size}};function Xe(){return new M}var U=class r{set;constructor(e){if(this.set=new Set,e!=null)for(let t of e)this.set.add(t.toString())}get size(){return this.set.size}[Symbol.iterator](){return this.values()}add(e){this.set.add(e.toString())}clear(){this.set.clear()}delete(e){this.set.delete(e.toString())}entries(){return E(this.set.entries(),e=>{let t=u(e[0]);return[t,t]})}forEach(e){this.set.forEach(t=>{let n=u(t);e(n,n,this)})}has(e){return this.set.has(e.toString())}values(){return E(this.set.values(),e=>u(e))}intersection(e){let t=new r;for(let n of e)this.has(n)&&t.add(n);return t}difference(e){let t=new r;for(let n of this)e.has(n)||t.add(n);return t}union(e){let t=new r;for(let n of e)t.add(n);for(let n of this)t.add(n);return t}};function We(){return new U}var z=class r{list;constructor(e){if(this.list=[],e!=null)for(let t of e)this.list.push(t.toString())}[Symbol.iterator](){return E(this.list.entries(),e=>u(e[1]))}concat(e){let t=new r(this);for(let n of e)t.push(n);return t}entries(){return E(this.list.entries(),e=>[e[0],u(e[1])])}every(e){return this.list.every((t,n)=>e(u(t),n,this))}filter(e){let t=new r;return this.list.forEach((n,o)=>{let s=u(n);e(s,o,this)&&t.push(s)}),t}find(e){let t=this.list.find((n,o)=>e(u(n),o,this));if(t!=null)return u(t)}findIndex(e){return this.list.findIndex((t,n)=>e(u(t),n,this))}forEach(e){this.list.forEach((t,n)=>{e(u(t),n,this)})}includes(e){return this.list.includes(e.toString())}indexOf(e){return this.list.indexOf(e.toString())}pop(){let e=this.list.pop();if(e!=null)return u(e)}push(...e){for(let t of e)this.list.push(t.toString())}shift(){let e=this.list.shift();if(e!=null)return u(e)}unshift(...e){let t=this.list.length;for(let n=e.length-1;n>-1;n--)t=this.list.unshift(e[n].toString());return t}clear(){this.list=[]}get length(){return this.list.length}};function Ye(){return new z}var Ce=class extends M{metric;constructor(e){super();let{name:t,metrics:n}=e;this.metric=n.registerMetric(t),this.updateComponentMetric()}set(e,t){return super.set(e,t),this.updateComponentMetric(),this}delete(e){let t=super.delete(e);return this.updateComponentMetric(),t}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}};function Ze(r){let{name:e,metrics:t}=r,n;return t!=null?n=new Ce({name:e,metrics:t}):n=new M,n}var Ee=class extends U{metric;constructor(e){super();let{name:t,metrics:n}=e;this.metric=n.registerMetric(t),this.updateComponentMetric()}add(e){super.add(e),this.updateComponentMetric()}delete(e){super.delete(e),this.updateComponentMetric()}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}};function _e(r){let{name:e,metrics:t}=r,n;return t!=null?n=new Ee({name:e,metrics:t}):n=new U,n}var Ae=class extends z{metric;constructor(e){super();let{name:t,metrics:n}=e;this.metric=n.registerMetric(t),this.updateComponentMetric()}pop(){let e=super.pop();return this.updateComponentMetric(),e}push(...e){super.push(...e),this.updateComponentMetric()}shift(){let e=super.shift();return this.updateComponentMetric(),e}unshift(...e){let t=super.unshift(...e);return this.updateComponentMetric(),t}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.length)}};function et(r){let{name:e,metrics:t}=r,n;return t!=null?n=new Ae({name:e,metrics:t}):n=new z,n}return it(mr);})();
2
+ "use strict";var Libp2PPeerCollections=(()=>{var Pt=Object.create;var pe=Object.defineProperty;var Tt=Object.getOwnPropertyDescriptor;var Bt=Object.getOwnPropertyNames;var Lt=Object.getPrototypeOf,Rt=Object.prototype.hasOwnProperty;var Ke=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),z=(r,e)=>{for(var t in e)pe(r,t,{get:e[t],enumerable:!0})},Je=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Bt(e))!Rt.call(r,s)&&s!==t&&pe(r,s,{get:()=>e[s],enumerable:!(n=Tt(e,s))||n.enumerable});return r};var Vt=(r,e,t)=>(t=r!=null?Pt(Lt(r)):{},Je(e||!r||!r.__esModule?pe(t,"default",{value:r,enumerable:!0}):t,r)),Ot=r=>Je(pe({},"__esModule",{value:!0}),r);var Ct=Ke((se,_e)=>{(function(r,e){"use strict";var t={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function n(o){if(!Array.isArray(o)&&!ArrayBuffer.isView(o))return!1;for(var i=0;i<o.length;i++)if(!Number.isInteger(o[i])||o[i]<0||o[i]>255)return!1;return!0}function s(o,i){return(o&65535)*i+(((o>>>16)*i&65535)<<16)}function a(o,i){return o<<i|o>>>32-i}function d(o){return o^=o>>>16,o=s(o,2246822507),o^=o>>>13,o=s(o,3266489909),o^=o>>>16,o}function _(o,i){o=[o[0]>>>16,o[0]&65535,o[1]>>>16,o[1]&65535],i=[i[0]>>>16,i[0]&65535,i[1]>>>16,i[1]&65535];var c=[0,0,0,0];return c[3]+=o[3]+i[3],c[2]+=c[3]>>>16,c[3]&=65535,c[2]+=o[2]+i[2],c[1]+=c[2]>>>16,c[2]&=65535,c[1]+=o[1]+i[1],c[0]+=c[1]>>>16,c[1]&=65535,c[0]+=o[0]+i[0],c[0]&=65535,[c[0]<<16|c[1],c[2]<<16|c[3]]}function w(o,i){o=[o[0]>>>16,o[0]&65535,o[1]>>>16,o[1]&65535],i=[i[0]>>>16,i[0]&65535,i[1]>>>16,i[1]&65535];var c=[0,0,0,0];return c[3]+=o[3]*i[3],c[2]+=c[3]>>>16,c[3]&=65535,c[2]+=o[2]*i[3],c[1]+=c[2]>>>16,c[2]&=65535,c[2]+=o[3]*i[2],c[1]+=c[2]>>>16,c[2]&=65535,c[1]+=o[1]*i[3],c[0]+=c[1]>>>16,c[1]&=65535,c[1]+=o[2]*i[2],c[0]+=c[1]>>>16,c[1]&=65535,c[1]+=o[3]*i[1],c[0]+=c[1]>>>16,c[1]&=65535,c[0]+=o[0]*i[3]+o[1]*i[2]+o[2]*i[1]+o[3]*i[0],c[0]&=65535,[c[0]<<16|c[1],c[2]<<16|c[3]]}function C(o,i){return i%=64,i===32?[o[1],o[0]]:i<32?[o[0]<<i|o[1]>>>32-i,o[1]<<i|o[0]>>>32-i]:(i-=32,[o[1]<<i|o[0]>>>32-i,o[0]<<i|o[1]>>>32-i])}function v(o,i){return i%=64,i===0?o:i<32?[o[0]<<i|o[1]>>>32-i,o[1]<<i]:[o[1]<<i-32,0]}function b(o,i){return[o[0]^i[0],o[1]^i[1]]}function R(o){return o=b(o,[0,o[0]>>>1]),o=w(o,[4283543511,3981806797]),o=b(o,[0,o[0]>>>1]),o=w(o,[3301882366,444984403]),o=b(o,[0,o[0]>>>1]),o}t.x86.hash32=function(o,i){if(t.inputValidation&&!n(o))return e;i=i||0;for(var c=o.length%4,I=o.length-c,f=i,u=0,p=3432918353,l=461845907,m=0;m<I;m=m+4)u=o[m]|o[m+1]<<8|o[m+2]<<16|o[m+3]<<24,u=s(u,p),u=a(u,15),u=s(u,l),f^=u,f=a(f,13),f=s(f,5)+3864292196;switch(u=0,c){case 3:u^=o[m+2]<<16;case 2:u^=o[m+1]<<8;case 1:u^=o[m],u=s(u,p),u=a(u,15),u=s(u,l),f^=u}return f^=o.length,f=d(f),f>>>0},t.x86.hash128=function(o,i){if(t.inputValidation&&!n(o))return e;i=i||0;for(var c=o.length%16,I=o.length-c,f=i,u=i,p=i,l=i,m=0,x=0,h=0,S=0,D=597399067,fe=2869860233,ue=951274213,he=2716044179,g=0;g<I;g=g+16)m=o[g]|o[g+1]<<8|o[g+2]<<16|o[g+3]<<24,x=o[g+4]|o[g+5]<<8|o[g+6]<<16|o[g+7]<<24,h=o[g+8]|o[g+9]<<8|o[g+10]<<16|o[g+11]<<24,S=o[g+12]|o[g+13]<<8|o[g+14]<<16|o[g+15]<<24,m=s(m,D),m=a(m,15),m=s(m,fe),f^=m,f=a(f,19),f+=u,f=s(f,5)+1444728091,x=s(x,fe),x=a(x,16),x=s(x,ue),u^=x,u=a(u,17),u+=p,u=s(u,5)+197830471,h=s(h,ue),h=a(h,17),h=s(h,he),p^=h,p=a(p,15),p+=l,p=s(p,5)+2530024501,S=s(S,he),S=a(S,18),S=s(S,D),l^=S,l=a(l,13),l+=f,l=s(l,5)+850148119;switch(m=0,x=0,h=0,S=0,c){case 15:S^=o[g+14]<<16;case 14:S^=o[g+13]<<8;case 13:S^=o[g+12],S=s(S,he),S=a(S,18),S=s(S,D),l^=S;case 12:h^=o[g+11]<<24;case 11:h^=o[g+10]<<16;case 10:h^=o[g+9]<<8;case 9:h^=o[g+8],h=s(h,ue),h=a(h,17),h=s(h,he),p^=h;case 8:x^=o[g+7]<<24;case 7:x^=o[g+6]<<16;case 6:x^=o[g+5]<<8;case 5:x^=o[g+4],x=s(x,fe),x=a(x,16),x=s(x,ue),u^=x;case 4:m^=o[g+3]<<24;case 3:m^=o[g+2]<<16;case 2:m^=o[g+1]<<8;case 1:m^=o[g],m=s(m,D),m=a(m,15),m=s(m,fe),f^=m}return f^=o.length,u^=o.length,p^=o.length,l^=o.length,f+=u,f+=p,f+=l,u+=f,p+=f,l+=f,f=d(f),u=d(u),p=d(p),l=d(l),f+=u,f+=p,f+=l,u+=f,p+=f,l+=f,("00000000"+(f>>>0).toString(16)).slice(-8)+("00000000"+(u>>>0).toString(16)).slice(-8)+("00000000"+(p>>>0).toString(16)).slice(-8)+("00000000"+(l>>>0).toString(16)).slice(-8)},t.x64.hash128=function(o,i){if(t.inputValidation&&!n(o))return e;i=i||0;for(var c=o.length%16,I=o.length-c,f=[0,i],u=[0,i],p=[0,0],l=[0,0],m=[2277735313,289559509],x=[1291169091,658871167],h=0;h<I;h=h+16)p=[o[h+4]|o[h+5]<<8|o[h+6]<<16|o[h+7]<<24,o[h]|o[h+1]<<8|o[h+2]<<16|o[h+3]<<24],l=[o[h+12]|o[h+13]<<8|o[h+14]<<16|o[h+15]<<24,o[h+8]|o[h+9]<<8|o[h+10]<<16|o[h+11]<<24],p=w(p,m),p=C(p,31),p=w(p,x),f=b(f,p),f=C(f,27),f=_(f,u),f=_(w(f,[0,5]),[0,1390208809]),l=w(l,x),l=C(l,33),l=w(l,m),u=b(u,l),u=C(u,31),u=_(u,f),u=_(w(u,[0,5]),[0,944331445]);switch(p=[0,0],l=[0,0],c){case 15:l=b(l,v([0,o[h+14]],48));case 14:l=b(l,v([0,o[h+13]],40));case 13:l=b(l,v([0,o[h+12]],32));case 12:l=b(l,v([0,o[h+11]],24));case 11:l=b(l,v([0,o[h+10]],16));case 10:l=b(l,v([0,o[h+9]],8));case 9:l=b(l,[0,o[h+8]]),l=w(l,x),l=C(l,33),l=w(l,m),u=b(u,l);case 8:p=b(p,v([0,o[h+7]],56));case 7:p=b(p,v([0,o[h+6]],48));case 6:p=b(p,v([0,o[h+5]],40));case 5:p=b(p,v([0,o[h+4]],32));case 4:p=b(p,v([0,o[h+3]],24));case 3:p=b(p,v([0,o[h+2]],16));case 2:p=b(p,v([0,o[h+1]],8));case 1:p=b(p,[0,o[h]]),p=w(p,m),p=C(p,31),p=w(p,x),f=b(f,p)}return f=b(f,[0,o.length]),u=b(u,[0,o.length]),f=_(f,u),u=_(u,f),f=R(f),u=R(u),f=_(f,u),u=_(u,f),("00000000"+(f[0]>>>0).toString(16)).slice(-8)+("00000000"+(f[1]>>>0).toString(16)).slice(-8)+("00000000"+(u[0]>>>0).toString(16)).slice(-8)+("00000000"+(u[1]>>>0).toString(16)).slice(-8)},typeof se<"u"?(typeof _e<"u"&&_e.exports&&(se=_e.exports=t),se.murmurHash3=t):typeof define=="function"&&define.amd?define([],function(){return t}):(t._murmurHash3=r.murmurHash3,t.noConflict=function(){return r.murmurHash3=t._murmurHash3,t._murmurHash3=e,t.noConflict=e,t},r.murmurHash3=t)})(se)});var zt=Ke((bo,It)=>{It.exports=Ct()});var on={};z(on,{PeerFilter:()=>ce,PeerList:()=>L,PeerMap:()=>T,PeerSet:()=>B,peerFilter:()=>Dt,peerList:()=>wt,peerMap:()=>xt,peerSet:()=>gt,trackedPeerList:()=>Nt,trackedPeerMap:()=>Ut,trackedPeerSet:()=>Ft});var Xe=Symbol.for("@libp2p/peer-id");var ve={};z(ve,{base58btc:()=>A,base58flickr:()=>Jt});var cn=new Uint8Array(0);function Ge(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}function U(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")}function Qe(r){return new TextEncoder().encode(r)}function We(r){return new TextDecoder().decode(r)}function qt(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 s=0;s<r.length;s++){var a=r.charAt(s),d=a.charCodeAt(0);if(t[d]!==255)throw new TypeError(a+" is ambiguous");t[d]=s}var _=r.length,w=r.charAt(0),C=Math.log(_)/Math.log(256),v=Math.log(256)/Math.log(_);function b(i){if(i instanceof Uint8Array||(ArrayBuffer.isView(i)?i=new Uint8Array(i.buffer,i.byteOffset,i.byteLength):Array.isArray(i)&&(i=Uint8Array.from(i))),!(i instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(i.length===0)return"";for(var c=0,I=0,f=0,u=i.length;f!==u&&i[f]===0;)f++,c++;for(var p=(u-f)*v+1>>>0,l=new Uint8Array(p);f!==u;){for(var m=i[f],x=0,h=p-1;(m!==0||x<I)&&h!==-1;h--,x++)m+=256*l[h]>>>0,l[h]=m%_>>>0,m=m/_>>>0;if(m!==0)throw new Error("Non-zero carry");I=x,f++}for(var S=p-I;S!==p&&l[S]===0;)S++;for(var D=w.repeat(c);S<p;++S)D+=r.charAt(l[S]);return D}function R(i){if(typeof i!="string")throw new TypeError("Expected String");if(i.length===0)return new Uint8Array;var c=0;if(i[c]!==" "){for(var I=0,f=0;i[c]===w;)I++,c++;for(var u=(i.length-c)*C+1>>>0,p=new Uint8Array(u);i[c];){var l=t[i.charCodeAt(c)];if(l===255)return;for(var m=0,x=u-1;(l!==0||m<f)&&x!==-1;x--,m++)l+=_*p[x]>>>0,p[x]=l%256>>>0,l=l/256>>>0;if(l!==0)throw new Error("Non-zero carry");f=m,c++}if(i[c]!==" "){for(var h=u-f;h!==u&&p[h]===0;)h++;for(var S=new Uint8Array(I+(u-h)),D=I;h!==u;)S[D++]=p[h++];return S}}}function o(i){var c=R(i);if(c)return c;throw new Error(`Non-${e} character`)}return{encode:b,decodeUnsafe:R,decode:o}}var $t=qt,jt=$t,Ze=jt;var ge=class{name;prefix;baseEncode;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")}},we=class{name;prefix;baseDecode;prefixCodePoint;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 et(this,e)}},be=class{decoders;constructor(e){this.decoders=e}or(e){return et(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function et(r,e){return new be({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var Se=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,s){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=s,this.encoder=new ge(e,t,n),this.decoder=new we(e,t,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function $({name:r,prefix:e,encode:t,decode:n}){return new Se(r,e,t,n)}function N({name:r,prefix:e,alphabet:t}){let{encode:n,decode:s}=Ze(t,r);return $({prefix:e,name:r,encode:n,decode:a=>U(s(a))})}function Ht(r,e,t,n){let s={};for(let v=0;v<e.length;++v)s[e[v]]=v;let a=r.length;for(;r[a-1]==="=";)--a;let d=new Uint8Array(a*t/8|0),_=0,w=0,C=0;for(let v=0;v<a;++v){let b=s[r[v]];if(b===void 0)throw new SyntaxError(`Non-${n} character`);w=w<<t|b,_+=t,_>=8&&(_-=8,d[C++]=255&w>>_)}if(_>=t||255&w<<8-_)throw new SyntaxError("Unexpected end of data");return d}function Kt(r,e,t){let n=e[e.length-1]==="=",s=(1<<t)-1,a="",d=0,_=0;for(let w=0;w<r.length;++w)for(_=_<<8|r[w],d+=8;d>t;)d-=t,a+=e[s&_>>d];if(d!==0&&(a+=e[s&_<<t-d]),n)for(;a.length*t&7;)a+="=";return a}function y({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return $({prefix:e,name:r,encode(s){return Kt(s,n,t)},decode(s){return Ht(s,n,t,r)}})}var A=N({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Jt=N({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ye={};z(ye,{base10:()=>Xt});var Xt=N({prefix:"9",name:"base10",alphabet:"0123456789"});var Ee={};z(Ee,{base16:()=>Gt,base16upper:()=>Qt});var Gt=y({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Qt=y({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ce={};z(Ce,{base2:()=>Wt});var Wt=y({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ie={};z(Ie,{base256emoji:()=>rr});var tt=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}"),Yt=tt.reduce((r,e,t)=>(r[t]=e,r),[]),Zt=tt.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function er(r){return r.reduce((e,t)=>(e+=Yt[t],e),"")}function tr(r){let e=[];for(let t of r){let n=Zt[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var rr=$({prefix:"\u{1F680}",name:"base256emoji",encode:er,decode:tr});var ze={};z(ze,{base32:()=>j,base32hex:()=>ir,base32hexpad:()=>cr,base32hexpadupper:()=>fr,base32hexupper:()=>ar,base32pad:()=>or,base32padupper:()=>sr,base32upper:()=>nr,base32z:()=>ur});var j=y({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),nr=y({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),or=y({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),sr=y({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ir=y({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ar=y({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),cr=y({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),fr=y({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ur=y({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ae={};z(Ae,{base36:()=>hr,base36upper:()=>pr});var hr=N({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),pr=N({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var ke={};z(ke,{base64:()=>lr,base64pad:()=>dr,base64url:()=>mr,base64urlpad:()=>_r});var lr=y({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),dr=y({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),mr=y({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),_r=y({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Me={};z(Me,{base8:()=>xr});var xr=y({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var De={};z(De,{identity:()=>gr});var gr=$({prefix:"\0",name:"identity",encode:r=>We(r),decode:r=>Qe(r)});var En=new TextEncoder,Cn=new TextDecoder;var Fe={};z(Fe,{identity:()=>de});var Sr=ot,rt=128,vr=127,yr=~vr,Er=Math.pow(2,31);function ot(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Er;)e[t++]=r&255|rt,r/=128;for(;r&yr;)e[t++]=r&255|rt,r>>>=7;return e[t]=r|0,ot.bytes=t-n+1,e}var Cr=Ue,Ir=128,nt=127;function Ue(r,n){var t=0,n=n||0,s=0,a=n,d,_=r.length;do{if(a>=_)throw Ue.bytes=0,new RangeError("Could not decode varint");d=r[a++],t+=s<28?(d&nt)<<s:(d&nt)*Math.pow(2,s),s+=7}while(d>=Ir);return Ue.bytes=a-n,t}var zr=Math.pow(2,7),Ar=Math.pow(2,14),kr=Math.pow(2,21),Mr=Math.pow(2,28),Dr=Math.pow(2,35),Ur=Math.pow(2,42),Fr=Math.pow(2,49),Nr=Math.pow(2,56),Pr=Math.pow(2,63),Tr=function(r){return r<zr?1:r<Ar?2:r<kr?3:r<Mr?4:r<Dr?5:r<Ur?6:r<Fr?7:r<Nr?8:r<Pr?9:10},Br={encode:Sr,decode:Cr,encodingLength:Tr},Lr=Br,Q=Lr;function W(r,e=0){return[Q.decode(r,e),Q.decode.bytes]}function H(r,e,t=0){return Q.encode(r,e,t),e}function K(r){return Q.encodingLength(r)}function P(r,e){let t=e.byteLength,n=K(r),s=n+K(t),a=new Uint8Array(s+t);return H(r,a,0),H(t,a,n),a.set(e,s),new J(r,t,e,a)}function Y(r){let e=U(r),[t,n]=W(e),[s,a]=W(e.subarray(n)),d=e.subarray(n+a);if(d.byteLength!==s)throw new Error("Incorrect length");return new J(t,s,d,e)}function st(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&Ge(r.bytes,t.bytes)}}var J=class{code;size;digest;bytes;constructor(e,t,n,s){this.code=e,this.size=t,this.digest=n,this.bytes=s}};var it=0,Rr="identity",at=U;function Vr(r){return P(it,at(r))}var de={code:it,name:Rr,encode:at,digest:Vr};var Te={};z(Te,{sha256:()=>me,sha512:()=>Or});function Pe({name:r,code:e,encode:t}){return new Ne(r,e,t)}var Ne=class{name;code;encode;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?P(this.code,t):t.then(n=>P(this.code,n))}else throw Error("Unknown type, must be binary type")}};function ft(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var me=Pe({name:"sha2-256",code:18,encode:ft("SHA-256")}),Or=Pe({name:"sha2-512",code:19,encode:ft("SHA-512")});function ut(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return $r(t,Be(r),e??A.encoder);default:return jr(t,Be(r),e??j.encoder)}}var ht=new WeakMap;function Be(r){let e=ht.get(r);if(e==null){let t=new Map;return ht.set(r,t),t}return e}var V=class r{code;version;multihash;bytes;"/";constructor(e,t,n,s){this.code=t,this.version=e,this.multihash=n,this.bytes=s,this["/"]=s}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!==Z)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Hr)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.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=P(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&st(e.multihash,n.multihash)}toString(e){return ut(this,e)}toJSON(){return{"/":ut(this)}}link(){return this}[Symbol.toStringTag]="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 r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:s,multihash:a,bytes:d}=t;return new r(n,s,a,d??pt(n,s,a.bytes))}else if(t[Kr]===!0){let{version:n,multihash:s,code:a}=t,d=Y(s);return r.create(n,a,d)}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!==Z)throw new Error(`Version 0 CID must use dag-pb (code: ${Z}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let s=pt(e,t,n.bytes);return new r(e,t,n,s)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,Z,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,s=U(e.subarray(n,n+t.multihashSize));if(s.byteLength!==t.multihashSize)throw new Error("Incorrect length");let a=s.subarray(t.multihashSize-t.digestSize),d=new J(t.multihashCode,t.digestSize,a,s);return[t.version===0?r.createV0(d):r.createV1(t.codec,d),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[b,R]=W(e.subarray(t));return t+=R,b},s=n(),a=Z;if(s===18?(s=0,t=0):a=n(),s!==0&&s!==1)throw new RangeError(`Invalid CID version ${s}`);let d=t,_=n(),w=n(),C=t+w,v=C-d;return{version:s,codec:a,multihashCode:_,digestSize:w,multihashSize:v,size:C}}static parse(e,t){let[n,s]=qr(e,t),a=r.decode(s);if(a.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Be(a).set(n,e),a}};function qr(r,e){switch(r[0]){case"Q":{let t=e??A;return[A.prefix,t.decode(`${A.prefix}${r}`)]}case A.prefix:{let t=e??A;return[A.prefix,t.decode(r)]}case j.prefix:{let t=e??j;return[j.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)]}}}function $r(r,e,t){let{prefix:n}=t;if(n!==A.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let s=e.get(n);if(s==null){let a=t.encode(r).slice(1);return e.set(n,a),a}else return s}function jr(r,e,t){let{prefix:n}=t,s=e.get(n);if(s==null){let a=t.encode(r);return e.set(n,a),a}else return s}var Z=112,Hr=18;function pt(r,e,t){let n=K(r),s=n+K(e),a=new Uint8Array(s+t.byteLength);return H(r,a,0),H(e,a,n),a.set(t,s),a}var Kr=Symbol.for("@ipld/js-cid/CID");var G={...De,...Ce,...Me,...ye,...Ee,...ze,...Ae,...ve,...ke,...Ie},Kn={...Te,...Fe};function ee(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 Jr=Symbol.for("nodejs.util.inspect.custom"),lt=Object.values(G).map(r=>r.decoder).reduce((r,e)=>r.or(e),G.identity.decoder),dt=114,mt=36,_t=37,te=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()})`}[Xe]=!0;toString(){return this.string==null&&(this.string=A.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return V.createV1(dt,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return ee(this.multihash.bytes,e);if(typeof e=="string")return E(e).equals(this);if(e?.multihash?.bytes!=null)return ee(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[Jr](){return`PeerId(${this.toString()})`}},re=class extends te{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},ne=class extends te{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},oe=class extends te{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function E(r,e){if(e=e??lt,r.charAt(0)==="1"||r.charAt(0)==="Q"){let t=Y(A.decode(`z${r}`));return r.startsWith("12D")?new ne({multihash:t}):r.startsWith("16U")?new oe({multihash:t}):new re({multihash:t})}return Xr(lt.decode(r))}function Xr(r){try{let e=Y(r);if(e.code===de.code){if(e.digest.length===mt)return new ne({multihash:e});if(e.digest.length===_t)return new oe({multihash:e})}if(e.code===me.code)return new re({multihash:e})}catch{return Gr(V.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function Gr(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==dt)throw new Error("Supplied PeerID CID is invalid");let e=r.multihash;if(e.code===me.code)return new re({multihash:r.multihash});if(e.code===de.code){if(e.digest.length===mt)return new ne({multihash:r.multihash});if(e.digest.length===_t)return new oe({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}function F(r,e){let t={[Symbol.iterator]:()=>t,next:()=>{let n=r.next(),s=n.value;return n.done===!0||s==null?{done:!0,value:void 0}:{done:!1,value:e(s)}}};return t}var T=class{map;constructor(e){if(this.map=new Map,e!=null)for(let[t,n]of e.entries())this.map.set(t.toString(),n)}[Symbol.iterator](){return this.entries()}clear(){this.map.clear()}delete(e){return this.map.delete(e.toString())}entries(){return F(this.map.entries(),e=>[E(e[0]),e[1]])}forEach(e){this.map.forEach((t,n)=>{e(t,E(n),this)})}get(e){return this.map.get(e.toString())}has(e){return this.map.has(e.toString())}set(e,t){this.map.set(e.toString(),t)}keys(){return F(this.map.keys(),e=>E(e))}values(){return this.map.values()}get size(){return this.map.size}};function xt(){return new T}var B=class r{set;constructor(e){if(this.set=new Set,e!=null)for(let t of e)this.set.add(t.toString())}get size(){return this.set.size}[Symbol.iterator](){return this.values()}add(e){this.set.add(e.toString())}clear(){this.set.clear()}delete(e){this.set.delete(e.toString())}entries(){return F(this.set.entries(),e=>{let t=E(e[0]);return[t,t]})}forEach(e){this.set.forEach(t=>{let n=E(t);e(n,n,this)})}has(e){return this.set.has(e.toString())}values(){return F(this.set.values(),e=>E(e))}intersection(e){let t=new r;for(let n of e)this.has(n)&&t.add(n);return t}difference(e){let t=new r;for(let n of this)e.has(n)||t.add(n);return t}union(e){let t=new r;for(let n of e)t.add(n);for(let n of this)t.add(n);return t}};function gt(){return new B}var L=class r{list;constructor(e){if(this.list=[],e!=null)for(let t of e)this.list.push(t.toString())}[Symbol.iterator](){return F(this.list.entries(),e=>E(e[1]))}concat(e){let t=new r(this);for(let n of e)t.push(n);return t}entries(){return F(this.list.entries(),e=>[e[0],E(e[1])])}every(e){return this.list.every((t,n)=>e(E(t),n,this))}filter(e){let t=new r;return this.list.forEach((n,s)=>{let a=E(n);e(a,s,this)&&t.push(a)}),t}find(e){let t=this.list.find((n,s)=>e(E(n),s,this));if(t!=null)return E(t)}findIndex(e){return this.list.findIndex((t,n)=>e(E(t),n,this))}forEach(e){this.list.forEach((t,n)=>{e(E(t),n,this)})}includes(e){return this.list.includes(e.toString())}indexOf(e){return this.list.indexOf(e.toString())}pop(){let e=this.list.pop();if(e!=null)return E(e)}push(...e){for(let t of e)this.list.push(t.toString())}shift(){let e=this.list.shift();if(e!=null)return E(e)}unshift(...e){let t=this.list.length;for(let n=e.length-1;n>-1;n--)t=this.list.unshift(e[n].toString());return t}clear(){this.list=[]}get length(){return this.list.length}};function wt(){return new L}function bt(r=0){return new Uint8Array(r)}function St(r=0){return new Uint8Array(r)}function yt(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var vt=yt("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Le=yt("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=St(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Qr={utf8:vt,"utf-8":vt,hex:G.base16,latin1:Le,ascii:Le,binary:Le,...G},Et=Qr;function M(r,e="utf8"){let t=Et[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}var Re=64,k=class{fp;h;seed;constructor(e,t,n,s=2){if(s>Re)throw new TypeError("Invalid Fingerprint Size");let a=t.hashV(e,n),d=bt(s);for(let _=0;_<d.length;_++)d[_]=a[_];d.length===0&&(d[0]=7),this.fp=d,this.h=t,this.seed=n}hash(){return this.h.hash(this.fp,this.seed)}equals(e){return e?.fp instanceof Uint8Array?ee(this.fp,e.fp):!1}};function O(r,e){return Math.floor(Math.random()*(e-r))+r}var q=class{contents;constructor(e){this.contents=new Array(e).fill(null)}has(e){if(!(e instanceof k))throw new TypeError("Invalid Fingerprint");return this.contents.some(t=>e.equals(t))}add(e){if(!(e instanceof k))throw new TypeError("Invalid Fingerprint");for(let t=0;t<this.contents.length;t++)if(this.contents[t]==null)return this.contents[t]=e,!0;return!0}swap(e){if(!(e instanceof k))throw new TypeError("Invalid Fingerprint");let t=O(0,this.contents.length-1),n=this.contents[t];return this.contents[t]=e,n}remove(e){if(!(e instanceof k))throw new TypeError("Invalid Fingerprint");let t=this.contents.findIndex(n=>e.equals(n));return t>-1?(this.contents[t]=null,!0):!1}};var Ve={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},At={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n},kt=new globalThis.TextEncoder;function Wr(r,e){let t=Ve[e],n=At[e];for(let s=0;s<r.length;s++)n^=BigInt(r[s]),n=BigInt.asUintN(e,n*t);return n}function Yr(r,e,t){if(t.length===0)throw new Error("The `utf8Buffer` option must have a length greater than zero");let n=Ve[e],s=At[e],a=r;for(;a.length>0;){let d=kt.encodeInto(a,t);a=a.slice(d.read);for(let _=0;_<d.written;_++)s^=BigInt(t[_]),s=BigInt.asUintN(e,s*n)}return s}function Oe(r,{size:e=32,utf8Buffer:t}={}){if(!Ve[e])throw new Error("The `size` option must be one of 32, 64, 128, 256, 512, or 1024");if(typeof r=="string"){if(t)return Yr(r,e,t);r=kt.encode(r)}return Wr(r,e)}var Zr=Vt(zt(),1);var ie={hash:r=>Number(Oe(r,{size:32})),hashV:(r,e)=>en(ie.hash(r,e))};function en(r){let e=r.toString(16);return e.length%2===1&&(e=`0${e}`),M(e,"base16")}var tn=500,ae=class{bucketSize;filterSize;fingerprintSize;buckets;count;hash;seed;constructor(e){this.filterSize=e.filterSize,this.bucketSize=e.bucketSize??4,this.fingerprintSize=e.fingerprintSize??2,this.count=0,this.buckets=[],this.hash=e.hash??ie,this.seed=e.seed??O(0,Math.pow(2,10))}add(e){typeof e=="string"&&(e=M(e));let t=new k(e,this.hash,this.seed,this.fingerprintSize),n=this.hash.hash(e,this.seed)%this.filterSize,s=(n^t.hash())%this.filterSize;if(this.buckets[n]==null&&(this.buckets[n]=new q(this.bucketSize)),this.buckets[s]==null&&(this.buckets[s]=new q(this.bucketSize)),this.buckets[n].add(t)||this.buckets[s].add(t))return this.count++,!0;let a=[n,s],d=a[O(0,a.length-1)];this.buckets[d]==null&&(this.buckets[d]=new q(this.bucketSize));for(let _=0;_<tn;_++){let w=this.buckets[d].swap(t);if(w!=null&&(d=(d^w.hash())%this.filterSize,this.buckets[d]==null&&(this.buckets[d]=new q(this.bucketSize)),this.buckets[d].add(w)))return this.count++,!0}return!1}has(e){typeof e=="string"&&(e=M(e));let t=new k(e,this.hash,this.seed,this.fingerprintSize),n=this.hash.hash(e,this.seed)%this.filterSize,s=this.buckets[n]?.has(t)??!1;if(s)return s;let a=(n^t.hash())%this.filterSize;return this.buckets[a]?.has(t)??!1}remove(e){typeof e=="string"&&(e=M(e));let t=new k(e,this.hash,this.seed,this.fingerprintSize),n=this.hash.hash(e,this.seed)%this.filterSize,s=this.buckets[n]?.remove(t)??!1;if(s)return this.count--,s;let a=(n^t.hash())%this.filterSize,d=this.buckets[a]?.remove(t)??!1;return d&&this.count--,d}get reliable(){return Math.floor(100*(this.count/this.filterSize))<=95}},rn={1:.5,2:.84,4:.95,8:.98};function nn(r=.001){return r>.002?2:r>1e-5?4:8}function Mt(r,e=.001){let t=nn(e),n=rn[t],s=Math.round(r/n),a=Math.min(Math.ceil(Math.log(s/t))+2,Re);return{filterSize:s,bucketSize:t,fingerprintSize:a}}var xe=class{filterSize;bucketSize;fingerprintSize;scale;filterSeries;hash;seed;constructor(e){this.bucketSize=e.bucketSize??4,this.filterSize=e.filterSize??(1<<18)/this.bucketSize,this.fingerprintSize=e.fingerprintSize??2,this.scale=e.scale??2,this.hash=e.hash??ie,this.seed=e.seed??O(0,Math.pow(2,10)),this.filterSeries=[new ae({filterSize:this.filterSize,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed})]}add(e){if(typeof e=="string"&&(e=M(e)),this.has(e))return!0;let t=this.filterSeries.find(n=>n.reliable);if(t==null){let n=this.filterSize*Math.pow(this.scale,this.filterSeries.length);t=new ae({filterSize:n,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed}),this.filterSeries.push(t)}return t.add(e)}has(e){typeof e=="string"&&(e=M(e));for(let t=0;t<this.filterSeries.length;t++)if(this.filterSeries[t].has(e))return!0;return!1}remove(e){typeof e=="string"&&(e=M(e));for(let t=0;t<this.filterSeries.length;t++)if(this.filterSeries[t].remove(e))return!0;return!1}get count(){return this.filterSeries.reduce((e,t)=>e+t.count,0)}};function qe(r,e=.001,t){return new xe({...Mt(r,e),...t??{}})}var ce=class{filter;constructor(e,t){this.filter=qe(e,t)}has(e){return this.filter.has(e.toBytes())}add(e){this.filter.add(e.toBytes())}remove(e){this.filter.remove?.(e.toBytes())}};function Dt(r){return new ce(r)}var $e=class extends T{metric;constructor(e){super();let{name:t,metrics:n}=e;this.metric=n.registerMetric(t),this.updateComponentMetric()}set(e,t){return super.set(e,t),this.updateComponentMetric(),this}delete(e){let t=super.delete(e);return this.updateComponentMetric(),t}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}};function Ut(r){let{name:e,metrics:t}=r,n;return t!=null?n=new $e({name:e,metrics:t}):n=new T,n}var je=class extends B{metric;constructor(e){super();let{name:t,metrics:n}=e;this.metric=n.registerMetric(t),this.updateComponentMetric()}add(e){super.add(e),this.updateComponentMetric()}delete(e){super.delete(e),this.updateComponentMetric()}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}};function Ft(r){let{name:e,metrics:t}=r,n;return t!=null?n=new je({name:e,metrics:t}):n=new B,n}var He=class extends L{metric;constructor(e){super();let{name:t,metrics:n}=e;this.metric=n.registerMetric(t),this.updateComponentMetric()}pop(){let e=super.pop();return this.updateComponentMetric(),e}push(...e){super.push(...e),this.updateComponentMetric()}shift(){let e=super.shift();return this.updateComponentMetric(),e}unshift(...e){let t=super.unshift(...e);return this.updateComponentMetric(),t}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.length)}};function Nt(r){let{name:e,metrics:t}=r,n;return t!=null?n=new He({name:e,metrics:t}):n=new L,n}return Ot(on);})();
3
3
  return Libp2PPeerCollections}));
@@ -0,0 +1,14 @@
1
+ import type { PeerId } from '@libp2p/interface';
2
+ /**
3
+ * Uses a Bloom filter to implement a mechansim for deduplicating PeerIds in a
4
+ * way that uses a fixed amount of memory.
5
+ */
6
+ export declare class PeerFilter {
7
+ private readonly filter;
8
+ constructor(size: number, errorRate?: number);
9
+ has(peerId: PeerId): boolean;
10
+ add(peerId: PeerId): void;
11
+ remove(peerId: PeerId): void;
12
+ }
13
+ export declare function peerFilter(size: number): PeerFilter;
14
+ //# sourceMappingURL=filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/filter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAG/C;;;GAGG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;gBAElB,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;IAI7C,GAAG,CAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAI7B,GAAG,CAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAI1B,MAAM,CAAE,MAAM,EAAE,MAAM,GAAG,IAAI;CAG9B;AAED,wBAAgB,UAAU,CAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAEpD"}
@@ -0,0 +1,24 @@
1
+ import { createScalableCuckooFilter } from '@libp2p/utils/filters';
2
+ /**
3
+ * Uses a Bloom filter to implement a mechansim for deduplicating PeerIds in a
4
+ * way that uses a fixed amount of memory.
5
+ */
6
+ export class PeerFilter {
7
+ filter;
8
+ constructor(size, errorRate) {
9
+ this.filter = createScalableCuckooFilter(size, errorRate);
10
+ }
11
+ has(peerId) {
12
+ return this.filter.has(peerId.toBytes());
13
+ }
14
+ add(peerId) {
15
+ this.filter.add(peerId.toBytes());
16
+ }
17
+ remove(peerId) {
18
+ this.filter.remove?.(peerId.toBytes());
19
+ }
20
+ }
21
+ export function peerFilter(size) {
22
+ return new PeerFilter(size);
23
+ }
24
+ //# sourceMappingURL=filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.js","sourceRoot":"","sources":["../../src/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAA;AAIlE;;;GAGG;AACH,MAAM,OAAO,UAAU;IACJ,MAAM,CAAQ;IAE/B,YAAa,IAAY,EAAE,SAAkB;QAC3C,IAAI,CAAC,MAAM,GAAG,0BAA0B,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;IAC3D,CAAC;IAED,GAAG,CAAE,MAAc;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;IAC1C,CAAC;IAED,GAAG,CAAE,MAAc;QACjB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;IACnC,CAAC;IAED,MAAM,CAAE,MAAc;QACpB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;IACxC,CAAC;CACF;AAED,MAAM,UAAU,UAAU,CAAE,IAAY;IACtC,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAA;AAC7B,CAAC"}
@@ -84,10 +84,25 @@
84
84
  * const set = trackedPeerSet({ name: 'my_metric_name', metrics: libp2p.metrics })
85
85
  * set.add(peerId)
86
86
  * ```
87
+ *
88
+ * @example Peer filters
89
+ *
90
+ * ```TypeScript
91
+ * import { peerFilter } from '@libp2p/peer-collections'
92
+ * import { createEd25519PeerId } from '@libp2p/peer-id-factory'
93
+ *
94
+ * const peerId = await createEd25519PeerId()
95
+ *
96
+ * const filter = peerFilter(1024)
97
+ * filter.has(peerId) // false
98
+ * filter.add(peerId)
99
+ * filter.has(peerId) // true
100
+ * ```
87
101
  */
88
102
  export { PeerMap, peerMap } from './map.js';
89
103
  export { PeerSet, peerSet } from './set.js';
90
104
  export { PeerList, peerList } from './list.js';
105
+ export { PeerFilter, peerFilter } from './filter.js';
91
106
  export { trackedPeerMap } from './tracked-map.js';
92
107
  export { trackedPeerSet } from './tracked-set.js';
93
108
  export { trackedPeerList } from './tracked-list.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoGG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
package/dist/src/index.js CHANGED
@@ -84,10 +84,25 @@
84
84
  * const set = trackedPeerSet({ name: 'my_metric_name', metrics: libp2p.metrics })
85
85
  * set.add(peerId)
86
86
  * ```
87
+ *
88
+ * @example Peer filters
89
+ *
90
+ * ```TypeScript
91
+ * import { peerFilter } from '@libp2p/peer-collections'
92
+ * import { createEd25519PeerId } from '@libp2p/peer-id-factory'
93
+ *
94
+ * const peerId = await createEd25519PeerId()
95
+ *
96
+ * const filter = peerFilter(1024)
97
+ * filter.has(peerId) // false
98
+ * filter.add(peerId)
99
+ * filter.has(peerId) // true
100
+ * ```
87
101
  */
88
102
  export { PeerMap, peerMap } from './map.js';
89
103
  export { PeerSet, peerSet } from './set.js';
90
104
  export { PeerList, peerList } from './list.js';
105
+ export { PeerFilter, peerFilter } from './filter.js';
91
106
  export { trackedPeerMap } from './tracked-map.js';
92
107
  export { trackedPeerSet } from './tracked-set.js';
93
108
  export { trackedPeerList } from './tracked-list.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoGG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/peer-collections",
3
- "version": "5.1.11",
3
+ "version": "5.2.0-a11e135c2",
4
4
  "description": "Stores values against a peer id",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/peer-collections#readme",
@@ -54,11 +54,12 @@
54
54
  "test:electron-main": "aegir test -t electron-main"
55
55
  },
56
56
  "dependencies": {
57
- "@libp2p/interface": "^1.3.0",
58
- "@libp2p/peer-id": "^4.1.0"
57
+ "@libp2p/interface": "1.3.1-a11e135c2",
58
+ "@libp2p/peer-id": "4.1.1-a11e135c2",
59
+ "@libp2p/utils": "5.4.0-a11e135c2"
59
60
  },
60
61
  "devDependencies": {
61
- "@libp2p/peer-id-factory": "^4.1.0",
62
+ "@libp2p/peer-id-factory": "4.1.1-a11e135c2",
62
63
  "@types/sinon": "^17.0.3",
63
64
  "aegir": "^42.2.5",
64
65
  "sinon": "^17.0.1",
package/src/filter.ts ADDED
@@ -0,0 +1,31 @@
1
+ import { createScalableCuckooFilter } from '@libp2p/utils/filters'
2
+ import type { PeerId } from '@libp2p/interface'
3
+ import type { Filter } from '@libp2p/utils/filters'
4
+
5
+ /**
6
+ * Uses a Bloom filter to implement a mechansim for deduplicating PeerIds in a
7
+ * way that uses a fixed amount of memory.
8
+ */
9
+ export class PeerFilter {
10
+ private readonly filter: Filter
11
+
12
+ constructor (size: number, errorRate?: number) {
13
+ this.filter = createScalableCuckooFilter(size, errorRate)
14
+ }
15
+
16
+ has (peerId: PeerId): boolean {
17
+ return this.filter.has(peerId.toBytes())
18
+ }
19
+
20
+ add (peerId: PeerId): void {
21
+ this.filter.add(peerId.toBytes())
22
+ }
23
+
24
+ remove (peerId: PeerId): void {
25
+ this.filter.remove?.(peerId.toBytes())
26
+ }
27
+ }
28
+
29
+ export function peerFilter (size: number): PeerFilter {
30
+ return new PeerFilter(size)
31
+ }
package/src/index.ts CHANGED
@@ -84,11 +84,26 @@
84
84
  * const set = trackedPeerSet({ name: 'my_metric_name', metrics: libp2p.metrics })
85
85
  * set.add(peerId)
86
86
  * ```
87
+ *
88
+ * @example Peer filters
89
+ *
90
+ * ```TypeScript
91
+ * import { peerFilter } from '@libp2p/peer-collections'
92
+ * import { createEd25519PeerId } from '@libp2p/peer-id-factory'
93
+ *
94
+ * const peerId = await createEd25519PeerId()
95
+ *
96
+ * const filter = peerFilter(1024)
97
+ * filter.has(peerId) // false
98
+ * filter.add(peerId)
99
+ * filter.has(peerId) // true
100
+ * ```
87
101
  */
88
102
 
89
103
  export { PeerMap, peerMap } from './map.js'
90
104
  export { PeerSet, peerSet } from './set.js'
91
105
  export { PeerList, peerList } from './list.js'
106
+ export { PeerFilter, peerFilter } from './filter.js'
92
107
 
93
108
  export { trackedPeerMap } from './tracked-map.js'
94
109
  export { trackedPeerSet } from './tracked-set.js'
@@ -1,11 +0,0 @@
1
- {
2
- "PeerList": "https://libp2p.github.io/js-libp2p/classes/_libp2p_peer_collections.PeerList.html",
3
- "PeerMap": "https://libp2p.github.io/js-libp2p/classes/_libp2p_peer_collections.PeerMap.html",
4
- "PeerSet": "https://libp2p.github.io/js-libp2p/classes/_libp2p_peer_collections.PeerSet.html",
5
- "peerList": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_collections.peerList-1.html",
6
- "peerMap": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_collections.peerMap-1.html",
7
- "peerSet": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_collections.peerSet-1.html",
8
- "trackedPeerList": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_collections.trackedPeerList.html",
9
- "trackedPeerMap": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_collections.trackedPeerMap.html",
10
- "trackedPeerSet": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_collections.trackedPeerSet.html"
11
- }