@libp2p/daemon-protocol 8.0.9 → 8.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +3 -3
- package/package.json +3 -3
package/dist/index.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PDaemonProtocol = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var Libp2PDaemonProtocol=(()=>{var Lt=Object.defineProperty;var He=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var je=Object.prototype.hasOwnProperty;var I=(n,e)=>{for(var o in e)Lt(n,o,{get:e[o],enumerable:!0})},tn=(n,e,o,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of qe(e))!je.call(n,l)&&l!==o&&Lt(n,l,{get:()=>e[l],enumerable:!(c=He(e,l))||c.enumerable});return n};var en=n=>tn(Lt({},"__esModule",{value:!0}),n);var Si={};I(Si,{ConnManagerRequest:()=>lt,ConnectRequest:()=>et,DHTRequest:()=>st,DHTResponse:()=>ct,DisconnectRequest:()=>dt,ErrorResponse:()=>ot,IdentifyResponse:()=>tt,PSMessage:()=>ue,PSRequest:()=>at,PSResponse:()=>ut,PeerInfo:()=>N,PeerstoreRequest:()=>ht,PeerstoreResponse:()=>ft,Request:()=>de,Response:()=>ae,StreamHandlerRequest:()=>it,StreamInfo:()=>rt,StreamOpenRequest:()=>nt});function O(n=0){return new Uint8Array(n)}function G(n=0){return new Uint8Array(n)}var nn=Math.pow(2,7),on=Math.pow(2,14),rn=Math.pow(2,21),he=Math.pow(2,28),fe=Math.pow(2,35),pe=Math.pow(2,42),me=Math.pow(2,49),k=128,z=127;function pt(n){if(n<nn)return 1;if(n<on)return 2;if(n<rn)return 3;if(n<he)return 4;if(n<fe)return 5;if(n<pe)return 6;if(n<me)return 7;if(Number.MAX_SAFE_INTEGER!=null&&n>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function ye(n,e,o=0){switch(pt(n)){case 8:e[o++]=n&255|k,n/=128;case 7:e[o++]=n&255|k,n/=128;case 6:e[o++]=n&255|k,n/=128;case 5:e[o++]=n&255|k,n/=128;case 4:e[o++]=n&255|k,n>>>=7;case 3:e[o++]=n&255|k,n>>>=7;case 2:e[o++]=n&255|k,n>>>=7;case 1:{e[o++]=n&255,n>>>=7;break}default:throw new Error("unreachable")}return e}function be(n,e){let o=n[e],c=0;if(c+=o&z,o<k||(o=n[e+1],c+=(o&z)<<7,o<k)||(o=n[e+2],c+=(o&z)<<14,o<k)||(o=n[e+3],c+=(o&z)<<21,o<k)||(o=n[e+4],c+=(o&z)*he,o<k)||(o=n[e+5],c+=(o&z)*fe,o<k)||(o=n[e+6],c+=(o&z)*pe,o<k)||(o=n[e+7],c+=(o&z)*me,o<k))return c;throw new RangeError("Could not decode varint")}function sn(n){return n.buffer instanceof ArrayBuffer}function ge(n){return sn(n)?n:n.slice()}var Ut=new Float32Array([-0]),_=new Uint8Array(Ut.buffer);function Ee(n,e,o){Ut[0]=n,e[o]=_[0],e[o+1]=_[1],e[o+2]=_[2],e[o+3]=_[3]}function xe(n,e){return _[0]=n[e],_[1]=n[e+1],_[2]=n[e+2],_[3]=n[e+3],Ut[0]}var vt=new Float64Array([-0]),x=new Uint8Array(vt.buffer);function ke(n,e,o){vt[0]=n,e[o]=x[0],e[o+1]=x[1],e[o+2]=x[2],e[o+3]=x[3],e[o+4]=x[4],e[o+5]=x[5],e[o+6]=x[6],e[o+7]=x[7]}function we(n,e){return x[0]=n[e],x[1]=n[e+1],x[2]=n[e+2],x[3]=n[e+3],x[4]=n[e+4],x[5]=n[e+5],x[6]=n[e+6],x[7]=n[e+7],vt[0]}var cn=BigInt(Number.MAX_SAFE_INTEGER),ln=BigInt(Number.MIN_SAFE_INTEGER),D=class n{lo;hi;constructor(e,o){this.lo=e|0,this.hi=o|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let o=~this.lo+1>>>0,c=~this.hi>>>0;return o===0&&(c=c+1>>>0),-(o+c*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let o=~this.lo+1>>>0,c=~this.hi>>>0;return o===0&&(c=c+1>>>0),-(BigInt(o)+(BigInt(c)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,o=(this.lo>>>28|this.hi<<4)>>>0,c=this.hi>>>24;return c===0?o===0?e<16384?e<128?1:2:e<2097152?3:4:o<16384?o<128?5:6:o<2097152?7:8:c<128?9:10}static fromBigInt(e){if(e===0n)return Y;if(e<cn&&e>ln)return this.fromNumber(Number(e));let o=e<0n;o&&(e=-e);let c=e>>32n,l=e-(c<<32n);return o&&(c=~c|0n,l=~l|0n,++l>Ie&&(l=0n,++c>Ie&&(c=0n))),new n(Number(l),Number(c))}static fromNumber(e){if(e===0)return Y;let o=e<0;o&&(e=-e);let c=e>>>0,l=(e-c)/4294967296>>>0;return o&&(l=~l>>>0,c=~c>>>0,++c>4294967295&&(c=0,++l>4294967295&&(l=0))),new n(c,l)}static from(e){return typeof e=="number"?n.fromNumber(e):typeof e=="bigint"?n.fromBigInt(e):typeof e=="string"?n.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new n(e.low>>>0,e.high>>>0):Y}},Y=new D(0,0);Y.toBigInt=function(){return 0n};Y.zzEncode=Y.zzDecode=function(){return this};Y.length=function(){return 1};var Ie=4294967296n;function De(n){let e=0,o=0;for(let c=0;c<n.length;++c)o=n.charCodeAt(c),o<128?e+=1:o<2048?e+=2:(o&64512)===55296&&(n.charCodeAt(c+1)&64512)===56320?(++c,e+=4):e+=3;return e}function Se(n,e,o){if(o-e<1)return"";let l,i=[],s=0,t;for(;e<o;)t=n[e++],t<128?i[s++]=t:t>191&&t<224?i[s++]=(t&31)<<6|n[e++]&63:t>239&&t<365?(t=((t&7)<<18|(n[e++]&63)<<12|(n[e++]&63)<<6|n[e++]&63)-65536,i[s++]=55296+(t>>10),i[s++]=56320+(t&1023)):i[s++]=(t&15)<<12|(n[e++]&63)<<6|n[e++]&63,s>8191&&((l??(l=[])).push(String.fromCharCode.apply(String,i)),s=0);return l!=null?(s>0&&l.push(String.fromCharCode.apply(String,i.slice(0,s))),l.join("")):String.fromCharCode.apply(String,i.slice(0,s))}function Bt(n,e,o){let c=o,l,i;for(let s=0;s<n.length;++s)l=n.charCodeAt(s),l<128?e[o++]=l:l<2048?(e[o++]=l>>6|192,e[o++]=l&63|128):(l&64512)===55296&&((i=n.charCodeAt(s+1))&64512)===56320?(l=65536+((l&1023)<<10)+(i&1023),++s,e[o++]=l>>18|240,e[o++]=l>>12&63|128,e[o++]=l>>6&63|128,e[o++]=l&63|128):(e[o++]=l>>12|224,e[o++]=l>>6&63|128,e[o++]=l&63|128);return o-c}function C(n,e){return RangeError(`index out of range: ${n.pos} + ${e??1} > ${n.len}`)}function Dt(n,e){return(n[e-4]|n[e-3]<<8|n[e-2]<<16|n[e-1]<<24)>>>0}var Ft=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=ge(e),this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,C(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw C(this,4);return Dt(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw C(this,4);return Dt(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw C(this,4);let e=xe(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw C(this,4);let e=we(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),o=this.pos,c=this.pos+e;if(c>this.len)throw C(this,e);return this.pos+=e,o===c?new Uint8Array(0):this.buf.subarray(o,c)}string(){let e=this.bytes();return Se(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw C(this,e);this.pos+=e}else do if(this.pos>=this.len)throw C(this);while((this.buf[this.pos++]&128)!==0);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new D(0,0),o=0;if(this.len-this.pos>4){for(;o<4;++o)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<o*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;o=0}else{for(;o<3;++o){if(this.pos>=this.len)throw C(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<o*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<o*7)>>>0,e}if(this.len-this.pos>4){for(;o<5;++o)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<o*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;o<5;++o){if(this.pos>=this.len)throw C(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<o*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw C(this,8);let e=Dt(this.buf,this.pos+=4),o=Dt(this.buf,this.pos+=4);return new D(e,o)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let e=be(this.buf,this.pos);return this.pos+=pt(e),e}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function mt(n){return new Ft(n instanceof Uint8Array?n:n.subarray())}function y(n,e,o){let c=mt(n);return e.decode(c,void 0,o)}var Gt={};I(Gt,{base10:()=>yn});var zi=new Uint8Array(0);function Ae(n,e){if(n===e)return!0;if(n.byteLength!==e.byteLength)return!1;for(let o=0;o<n.byteLength;o++)if(n[o]!==e[o])return!1;return!0}function $(n){if(n instanceof Uint8Array&&n.constructor.name==="Uint8Array")return J(n);if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return J(new Uint8Array(n.buffer,n.byteOffset,n.byteLength));throw new Error("Unknown type, must be binary type")}function Te(n){return new TextEncoder().encode(n)}function Ce(n){return new TextDecoder().decode(n)}function dn(n){return n?.buffer instanceof ArrayBuffer}function J(n){return dn(n)?n:n.slice()}function an(n,e){if(n.length>=255)throw new TypeError("Alphabet too long");for(var o=new Uint8Array(256),c=0;c<o.length;c++)o[c]=255;for(var l=0;l<n.length;l++){var i=n.charAt(l),s=i.charCodeAt(0);if(o[s]!==255)throw new TypeError(i+" is ambiguous");o[s]=l}var t=n.length,r=n.charAt(0),d=Math.log(t)/Math.log(256),a=Math.log(256)/Math.log(t);function u(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var w=0,K=0,A=0,L=f.length;A!==L&&f[A]===0;)A++,w++;for(var U=(L-A)*a+1>>>0,S=new Uint8Array(U);A!==L;){for(var v=f[A],P=0,T=U-1;(v!==0||P<K)&&T!==-1;T--,P++)v+=256*S[T]>>>0,S[T]=v%t>>>0,v=v/t>>>0;if(v!==0)throw new Error("Non-zero carry");K=P,A++}for(var F=U-K;F!==U&&S[F]===0;)F++;for(var It=r.repeat(w);F<U;++F)It+=n.charAt(S[F]);return It}function h(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var w=0;if(f[w]!==" "){for(var K=0,A=0;f[w]===r;)K++,w++;for(var L=(f.length-w)*d+1>>>0,U=new Uint8Array(L);f[w];){var S=o[f.charCodeAt(w)];if(S===255)return;for(var v=0,P=L-1;(S!==0||v<A)&&P!==-1;P--,v++)S+=t*U[P]>>>0,U[P]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");A=v,w++}if(f[w]!==" "){for(var T=L-A;T!==L&&U[T]===0;)T++;for(var F=new Uint8Array(K+(L-T)),It=K;T!==L;)F[It++]=U[T++];return F}}}function X(f){var w=h(f);if(w)return w;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:h,decode:X}}var un=an,hn=un,Ue=hn;var Ot=class{name;prefix;baseEncode;constructor(e,o,c){this.name=e,this.prefix=o,this.baseEncode=c}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},$t=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,o,c){this.name=e,this.prefix=o;let l=o.codePointAt(0);if(l===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=l,this.baseDecode=c}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 ve(this,e)}},Mt=class{decoders;constructor(e){this.decoders=e}or(e){return ve(this,e)}decode(e){let o=e[0],c=this.decoders[o];if(c!=null)return c.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function ve(n,e){return new Mt({...n.decoders??{[n.prefix]:n},...e.decoders??{[e.prefix]:e}})}var Pt=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,o,c,l){this.name=e,this.prefix=o,this.baseEncode=c,this.baseDecode=l,this.encoder=new Ot(e,o,c),this.decoder=new $t(e,o,l)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Q({name:n,prefix:e,encode:o,decode:c}){return new Pt(n,e,o,c)}function R({name:n,prefix:e,alphabet:o}){let{encode:c,decode:l}=Ue(o,n);return Q({prefix:e,name:n,encode:c,decode:i=>$(l(i))})}function fn(n,e,o,c){let l=n.length;for(;n[l-1]==="=";)--l;let i=new Uint8Array(l*o/8|0),s=0,t=0,r=0;for(let d=0;d<l;++d){let a=e[n[d]];if(a===void 0)throw new SyntaxError(`Non-${c} character`);t=t<<o|a,s+=o,s>=8&&(s-=8,i[r++]=255&t>>s)}if(s>=o||(255&t<<8-s)!==0)throw new SyntaxError("Unexpected end of data");return i}function pn(n,e,o){let c=e[e.length-1]==="=",l=(1<<o)-1,i="",s=0,t=0;for(let r=0;r<n.length;++r)for(t=t<<8|n[r],s+=8;s>o;)s-=o,i+=e[l&t>>s];if(s!==0&&(i+=e[l&t<<o-s]),c)for(;(i.length*o&7)!==0;)i+="=";return i}function mn(n){let e={};for(let o=0;o<n.length;++o)e[n[o]]=o;return e}function m({name:n,prefix:e,bitsPerChar:o,alphabet:c}){let l=mn(c);return Q({prefix:e,name:n,encode(i){return pn(i,c,o)},decode(i){return fn(i,l,o,n)}})}var yn=R({prefix:"9",name:"base10",alphabet:"0123456789"});var zt={};I(zt,{base16:()=>bn,base16upper:()=>gn});var bn=m({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),gn=m({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var _t={};I(_t,{base2:()=>En});var En=m({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Rt={};I(Rt,{base256emoji:()=>Dn});var Be=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}"),xn=Be.reduce((n,e,o)=>(n[o]=e,n),[]),kn=Be.reduce((n,e,o)=>{let c=e.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${e}`);return n[c]=o,n},[]);function wn(n){return n.reduce((e,o)=>(e+=xn[o],e),"")}function In(n){let e=[];for(let o of n){let c=o.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${o}`);let l=kn[c];if(l==null)throw new Error(`Non-base256emoji character: ${o}`);e.push(l)}return new Uint8Array(e)}var Dn=Q({prefix:"\u{1F680}",name:"base256emoji",encode:wn,decode:In});var Xt={};I(Xt,{base32:()=>V,base32hex:()=>Tn,base32hexpad:()=>Ln,base32hexpadupper:()=>Un,base32hexupper:()=>Cn,base32pad:()=>Nn,base32padupper:()=>An,base32upper:()=>Sn,base32z:()=>vn});var V=m({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Sn=m({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Nn=m({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),An=m({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Tn=m({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Cn=m({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Ln=m({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Un=m({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),vn=m({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Kt={};I(Kt,{base36:()=>yt,base36upper:()=>Bn});var yt=R({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Bn=R({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Yt={};I(Yt,{base58btc:()=>B,base58flickr:()=>Fn});var B=R({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Fn=R({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Jt={};I(Jt,{base64:()=>On,base64pad:()=>$n,base64url:()=>Mn,base64urlpad:()=>Pn});var On=m({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),$n=m({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Mn=m({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Pn=m({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Wt={};I(Wt,{base8:()=>Gn});var Gn=m({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Qt={};I(Qt,{identity:()=>zn});var zn=Q({prefix:"\0",name:"identity",encode:n=>Ce(n),decode:n=>Te(n)});var no=new TextEncoder,io=new TextDecoder;var Zt={};I(Zt,{identity:()=>di});var Xn=$e,Fe=128,Kn=127,Yn=~Kn,Jn=Math.pow(2,31);function $e(n,e,o){e=e||[],o=o||0;for(var c=o;n>=Jn;)e[o++]=n&255|Fe,n/=128;for(;n&Yn;)e[o++]=n&255|Fe,n>>>=7;return e[o]=n|0,$e.bytes=o-c+1,e}var Wn=Vt,Qn=128,Oe=127;function Vt(n,c){var o=0,c=c||0,l=0,i=c,s,t=n.length;do{if(i>=t)throw Vt.bytes=0,new RangeError("Could not decode varint");s=n[i++],o+=l<28?(s&Oe)<<l:(s&Oe)*Math.pow(2,l),l+=7}while(s>=Qn);return Vt.bytes=i-c,o}var Vn=Math.pow(2,7),Zn=Math.pow(2,14),Hn=Math.pow(2,21),qn=Math.pow(2,28),jn=Math.pow(2,35),ti=Math.pow(2,42),ei=Math.pow(2,49),ni=Math.pow(2,56),ii=Math.pow(2,63),oi=function(n){return n<Vn?1:n<Zn?2:n<Hn?3:n<qn?4:n<jn?5:n<ti?6:n<ei?7:n<ni?8:n<ii?9:10},ri={encode:Xn,decode:Wn,encodingLength:oi},si=ri,bt=si;function gt(n,e=0){return[bt.decode(n,e),bt.decode.bytes]}function Z(n,e,o=0){return bt.encode(n,e,o),e}function H(n){return bt.encodingLength(n)}function j(n,e){let o=e.byteLength,c=H(n),l=c+H(o),i=new Uint8Array(l+o);return Z(n,i,0),Z(o,i,c),i.set(e,l),new q(n,o,e,i)}function Me(n){let e=$(n),[o,c]=gt(e),[l,i]=gt(e.subarray(c)),s=e.subarray(c+i);if(s.byteLength!==l)throw new Error("Incorrect length");return new q(o,l,s,e)}function Pe(n,e){if(n===e)return!0;{let o=e;return n.code===o.code&&n.size===o.size&&o.bytes instanceof Uint8Array&&Ae(n.bytes,o.bytes)}}var q=class{code;size;digest;bytes;constructor(e,o,c,l){this.code=e,this.size=o,this.digest=J(c),this.bytes=J(l)}};var Ge=0,ci="identity",ze=$;function li(n,e){if(e?.truncate!=null&&e.truncate!==n.byteLength){if(e.truncate<0||e.truncate>n.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${n.byteLength}`);n=n.subarray(0,e.truncate)}return j(Ge,ze(n))}var di={code:Ge,name:ci,encode:ze,digest:li};var jt={};I(jt,{sha256:()=>ui,sha512:()=>hi});var ai=20;function qt({name:n,code:e,encode:o,minDigestLength:c,maxDigestLength:l}){return new Ht(n,e,o,c,l)}var Ht=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,o,c,l,i){this.name=e,this.code=o,this.encode=c,this.minDigestLength=l??ai,this.maxDigestLength=i}digest(e,o){if(o?.truncate!=null){if(o.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&o.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let c=this.encode(e);return c instanceof Uint8Array?_e(c,this.code,o?.truncate):c.then(l=>_e(l,this.code,o?.truncate))}else throw Error("Unknown type, must be binary type")}};function _e(n,e,o){if(o!=null&&o!==n.byteLength){if(o>n.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${n.byteLength}`);n=n.subarray(0,o)}return j(e,n)}function Xe(n){return async e=>new Uint8Array(await crypto.subtle.digest(n,e))}var ui=qt({name:"sha2-256",code:18,encode:Xe("SHA-256")}),hi=qt({name:"sha2-512",code:19,encode:Xe("SHA-512")});function Ke(n,e){let{bytes:o,version:c}=n;return c===0?pi(o,te(n),e??B.encoder):mi(o,te(n),e??V.encoder)}var Ye=new WeakMap;function te(n){let e=Ye.get(n);if(e==null){let o=new Map;return Ye.set(n,o),o}return e}var Nt=class n{code;version;multihash;bytes;"/";constructor(e,o,c,l){this.code=o,this.version=e,this.multihash=c,this.bytes=J(l),this["/"]=this.bytes}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:o}=this;if(e!==xt)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(o.code!==yi)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return n.createV0(o)}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:o}=this.multihash,c=j(e,o);return n.createV1(this.code,c)}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 n.equals(this,e)}static equals(e,o){let c=o;return c!=null&&e.code===c.code&&e.version===c.version&&Pe(e.multihash,c.multihash)}toString(e){return Ke(this,e)}toJSON(){return{"/":Ke(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 o=e;if(o instanceof n)return o;if(o["/"]!=null&&o["/"]===o.bytes||o.asCID===o){let{version:c,code:l,multihash:i,bytes:s}=o;return new n(c,l,i,s??Je(c,l,i.bytes))}else if(o[bi]===!0){let{version:c,multihash:l,code:i}=o,s=Me(l);return n.create(c,i,s)}else return null}static create(e,o,c){if(typeof o!="number")throw new Error("String codecs are no longer supported");if(!(c.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(o!==xt)throw new Error(`Version 0 CID must use dag-pb (code: ${xt}) block encoding`);return new n(e,o,c,c.bytes)}case 1:{let l=Je(e,o,c.bytes);return new n(e,o,c,l)}default:throw new Error("Invalid version")}}static createV0(e){return n.create(0,xt,e)}static createV1(e,o){return n.create(1,e,o)}static decode(e){let[o,c]=n.decodeFirst(e);if(c.length!==0)throw new Error("Incorrect length");return o}static decodeFirst(e){let o=n.inspectBytes(e),c=o.size-o.multihashSize,l=$(e.subarray(c,c+o.multihashSize));if(l.byteLength!==o.multihashSize)throw new Error("Incorrect length");let i=l.subarray(o.multihashSize-o.digestSize),s=new q(o.multihashCode,o.digestSize,i,l);return[o.version===0?n.createV0(s):n.createV1(o.codec,s),e.subarray(o.size)]}static inspectBytes(e){let o=0,c=()=>{let[u,h]=gt(e.subarray(o));return o+=h,u},l=c(),i=xt;if(l===18?(l=0,o=0):i=c(),l!==0&&l!==1)throw new RangeError(`Invalid CID version ${l}`);let s=o,t=c(),r=c(),d=o+r,a=d-s;return{version:l,codec:i,multihashCode:t,digestSize:r,multihashSize:a,size:d}}static parse(e,o){let[c,l]=fi(e,o),i=n.decode(l);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return te(i).set(c,e),i}};function fi(n,e){switch(n[0]){case"Q":{let o=e??B;return[B.prefix,o.decode(`${B.prefix}${n}`)]}case B.prefix:{let o=e??B;return[B.prefix,o.decode(n)]}case V.prefix:{let o=e??V;return[V.prefix,o.decode(n)]}case yt.prefix:{let o=e??yt;return[yt.prefix,o.decode(n)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[n[0],e.decode(n)]}}}function pi(n,e,o){let{prefix:c}=o;if(c!==B.prefix)throw Error(`Cannot string encode V0 in ${o.name} encoding`);let l=e.get(c);if(l==null){let i=o.encode(n).slice(1);return e.set(c,i),i}else return l}function mi(n,e,o){let{prefix:c}=o,l=e.get(c);if(l==null){let i=o.encode(n);return e.set(c,i),i}else return l}var xt=112,yi=18;function Je(n,e,o){let c=H(n),l=c+H(e),i=new Uint8Array(l+o.byteLength);return Z(n,i,0),Z(e,i,c),i.set(o,l),i}var bi=Symbol.for("@ipld/js-cid/CID");var ee={...Qt,..._t,...Wt,...Gt,...zt,...Xt,...Kt,...Yt,...Jt,...Rt},No={...jt,...Zt};function Qe(n,e,o,c){return{name:n,prefix:e,encoder:{name:n,prefix:e,encode:o},decoder:{decode:c}}}var We=Qe("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),ne=Qe("ascii","a",n=>{let e="a";for(let o=0;o<n.length;o++)e+=String.fromCharCode(n[o]);return e},n=>{n=n.substring(1);let e=G(n.length);for(let o=0;o<n.length;o++)e[o]=n.charCodeAt(o);return e}),gi={utf8:We,"utf-8":We,hex:ee.base16,latin1:ne,ascii:ne,binary:ne,...ee},Ve=gi;function Ze(n,e="utf8"){let o=Ve[e];if(o==null)throw new Error(`Unsupported encoding "${e}"`);return o.decoder.decode(`${o.prefix}${n}`)}function ie(n){let e=n??8192,o=e>>>1,c,l=e;return function(s){if(s<1||s>o)return G(s);l+s>e&&(c=G(e),l=0);let t=c.subarray(l,l+=s);return(l&7)!==0&&(l=(l|7)+1),t}}var W=class{fn;len;next;val;constructor(e,o,c){this.fn=e,this.len=o,this.next=void 0,this.val=c}};function oe(){}var se=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},Ei=ie();function xi(n){return globalThis.Buffer!=null?G(n):Ei(n)}var wt=class{len;head;tail;states;constructor(){this.len=0,this.head=new W(oe,0,0),this.tail=this.head,this.states=null}_push(e,o,c){return this.tail=this.tail.next=new W(e,o,c),this.len+=o,this}uint32(e){return this.len+=(this.tail=this.tail.next=new ce((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(At,10,D.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let o=D.fromBigInt(e);return this._push(At,o.length(),o)}uint64Number(e){return this._push(ye,pt(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let o=D.fromBigInt(e).zzEncode();return this._push(At,o.length(),o)}sint64Number(e){let o=D.fromNumber(e).zzEncode();return this._push(At,o.length(),o)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(re,1,e?1:0)}fixed32(e){return this._push(kt,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let o=D.fromBigInt(e);return this._push(kt,4,o.lo)._push(kt,4,o.hi)}fixed64Number(e){let o=D.fromNumber(e);return this._push(kt,4,o.lo)._push(kt,4,o.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(Ee,4,e)}double(e){return this._push(ke,8,e)}bytes(e){let o=e.length>>>0;return o===0?this._push(re,1,0):this.uint32(o)._push(wi,o,e)}string(e){let o=De(e);return o!==0?this.uint32(o)._push(Bt,o,e):this._push(re,1,0)}fork(){return this.states=new se(this),this.head=this.tail=new W(oe,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new W(oe,0,0),this.len=0),this}ldelim(){let e=this.head,o=this.tail,c=this.len;return this.reset().uint32(c),c!==0&&(this.tail.next=e.next,this.tail=o,this.len+=c),this}finish(){let e=this.head.next,o=xi(this.len),c=0;for(;e!=null;)e.fn(e.val,o,c),c+=e.len,e=e.next;return o}};function re(n,e,o){e[o]=n&255}function ki(n,e,o){for(;n>127;)e[o++]=n&127|128,n>>>=7;e[o]=n}var ce=class extends W{next;constructor(e,o){super(ki,e,o),this.next=void 0}};function At(n,e,o){for(;n.hi!==0;)e[o++]=n.lo&127|128,n.lo=(n.lo>>>7|n.hi<<25)>>>0,n.hi>>>=7;for(;n.lo>127;)e[o++]=n.lo&127|128,n.lo=n.lo>>>7;e[o++]=n.lo}function kt(n,e,o){e[o]=n&255,e[o+1]=n>>>8&255,e[o+2]=n>>>16&255,e[o+3]=n>>>24}function wi(n,e,o){e.set(n,o)}globalThis.Buffer!=null&&(wt.prototype.bytes=function(n){let e=n.length>>>0;return this.uint32(e),e>0&&this._push(Ii,e,n),this},wt.prototype.string=function(n){let e=globalThis.Buffer.byteLength(n);return this.uint32(e),e>0&&this._push(Di,e,n),this});function Ii(n,e,o){e.set(n,o)}function Di(n,e,o){n.length<40?Bt(n,e,o):e.utf8Write!=null?e.utf8Write(n,o):e.set(Ze(n),o)}function le(){return new wt}function b(n,e){let o=le();return e.encode(n,o,{lengthDelimited:!1}),o.finish()}function*g(n,e,o){let c=mt(n);yield*e.stream(c,void 0,"$",o)}var Tt={VARINT:0,BIT64:1,LENGTH_DELIMITED:2,START_GROUP:3,END_GROUP:4,BIT32:5};function Ct(n,e,o,c,l){return{name:n,type:e,encode:o,decode:c,stream:l}}function M(n){function e(i){if(n[i.toString()]==null)throw new Error("Invalid enum value");return n[i]}let o=function(s,t){let r=e(s);t.int32(r)},c=function(s){let t=s.int32();return e(t)},l=function*(s){let t=s.int32();yield e(t)};return Ct("enum",Tt.VARINT,o,c,l)}function E(n,e,o){return Ct("message",Tt.LENGTH_DELIMITED,n,e,o)}var p=class extends Error{code="ERR_MAX_LENGTH";name="MaxLengthError"};var de;(function(n){let e;(function(t){t.IDENTIFY="IDENTIFY",t.CONNECT="CONNECT",t.STREAM_OPEN="STREAM_OPEN",t.STREAM_HANDLER="STREAM_HANDLER",t.DHT="DHT",t.LIST_PEERS="LIST_PEERS",t.CONNMANAGER="CONNMANAGER",t.DISCONNECT="DISCONNECT",t.PUBSUB="PUBSUB",t.PEERSTORE="PEERSTORE"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.IDENTIFY=0]="IDENTIFY",t[t.CONNECT=1]="CONNECT",t[t.STREAM_OPEN=2]="STREAM_OPEN",t[t.STREAM_HANDLER=3]="STREAM_HANDLER",t[t.DHT=4]="DHT",t[t.LIST_PEERS=5]="LIST_PEERS",t[t.CONNMANAGER=6]="CONNMANAGER",t[t.DISCONNECT=7]="DISCONNECT",t[t.PUBSUB=8]="PUBSUB",t[t.PEERSTORE=9]="PEERSTORE"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.connect!=null&&(r.uint32(18),et.codec().encode(t.connect,r)),t.streamOpen!=null&&(r.uint32(26),nt.codec().encode(t.streamOpen,r)),t.streamHandler!=null&&(r.uint32(34),it.codec().encode(t.streamHandler,r)),t.dht!=null&&(r.uint32(42),st.codec().encode(t.dht,r)),t.connManager!=null&&(r.uint32(50),lt.codec().encode(t.connManager,r)),t.disconnect!=null&&(r.uint32(58),dt.codec().encode(t.disconnect,r)),t.pubsub!=null&&(r.uint32(66),at.codec().encode(t.pubsub,r)),t.peerStore!=null&&(r.uint32(74),ht.codec().encode(t.peerStore,r)),d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.connect=et.codec().decode(t,t.uint32(),{limits:d.limits?.connect});break}case 3:{a.streamOpen=nt.codec().decode(t,t.uint32(),{limits:d.limits?.streamOpen});break}case 4:{a.streamHandler=it.codec().decode(t,t.uint32(),{limits:d.limits?.streamHandler});break}case 5:{a.dht=st.codec().decode(t,t.uint32(),{limits:d.limits?.dht});break}case 6:{a.connManager=lt.codec().decode(t,t.uint32(),{limits:d.limits?.connManager});break}case 7:{a.disconnect=dt.codec().decode(t,t.uint32(),{limits:d.limits?.disconnect});break}case 8:{a.pubsub=at.codec().decode(t,t.uint32(),{limits:d.limits?.pubsub});break}case 9:{a.peerStore=ht.codec().decode(t,t.uint32(),{limits:d.limits?.peerStore});break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield*et.codec().stream(t,t.uint32(),`${d}.connect`,{limits:a.limits?.connect});break}case 3:{yield*nt.codec().stream(t,t.uint32(),`${d}.streamOpen`,{limits:a.limits?.streamOpen});break}case 4:{yield*it.codec().stream(t,t.uint32(),`${d}.streamHandler`,{limits:a.limits?.streamHandler});break}case 5:{yield*st.codec().stream(t,t.uint32(),`${d}.dht`,{limits:a.limits?.dht});break}case 6:{yield*lt.codec().stream(t,t.uint32(),`${d}.connManager`,{limits:a.limits?.connManager});break}case 7:{yield*dt.codec().stream(t,t.uint32(),`${d}.disconnect`,{limits:a.limits?.disconnect});break}case 8:{yield*at.codec().stream(t,t.uint32(),`${d}.pubsub`,{limits:a.limits?.pubsub});break}case 9:{yield*ht.codec().stream(t,t.uint32(),`${d}.peerStore`,{limits:a.limits?.peerStore});break}default:{t.skipType(h&7);break}}}})),c);function l(t){return b(t,n.codec())}n.encode=l;function i(t,r){return y(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(de||(de={}));var ae;(function(n){let e;(function(t){t.OK="OK",t.ERROR="ERROR"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.OK=0]="OK",t[t.ERROR=1]="ERROR"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{if(d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.error!=null&&(r.uint32(18),ot.codec().encode(t.error,r)),t.streamInfo!=null&&(r.uint32(26),rt.codec().encode(t.streamInfo,r)),t.identify!=null&&(r.uint32(34),tt.codec().encode(t.identify,r)),t.dht!=null&&(r.uint32(42),ct.codec().encode(t.dht,r)),t.peers!=null&&t.peers.length>0)for(let a of t.peers)r.uint32(50),N.codec().encode(a,r);t.pubsub!=null&&(r.uint32(58),ut.codec().encode(t.pubsub,r)),t.peerStore!=null&&(r.uint32(66),ft.codec().encode(t.peerStore,r)),d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={peers:[]},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.error=ot.codec().decode(t,t.uint32(),{limits:d.limits?.error});break}case 3:{a.streamInfo=rt.codec().decode(t,t.uint32(),{limits:d.limits?.streamInfo});break}case 4:{a.identify=tt.codec().decode(t,t.uint32(),{limits:d.limits?.identify});break}case 5:{a.dht=ct.codec().decode(t,t.uint32(),{limits:d.limits?.dht});break}case 6:{if(d.limits?.peers!=null&&a.peers.length===d.limits.peers)throw new p('Decode error - repeated field "peers" had too many elements');a.peers.push(N.codec().decode(t,t.uint32(),{limits:d.limits?.peers$}));break}case 7:{a.pubsub=ut.codec().decode(t,t.uint32(),{limits:d.limits?.pubsub});break}case 8:{a.peerStore=ft.codec().decode(t,t.uint32(),{limits:d.limits?.peerStore});break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u={peers:0},h=r==null?t.len:t.pos+r;for(;t.pos<h;){let X=t.uint32();switch(X>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield*ot.codec().stream(t,t.uint32(),`${d}.error`,{limits:a.limits?.error});break}case 3:{yield*rt.codec().stream(t,t.uint32(),`${d}.streamInfo`,{limits:a.limits?.streamInfo});break}case 4:{yield*tt.codec().stream(t,t.uint32(),`${d}.identify`,{limits:a.limits?.identify});break}case 5:{yield*ct.codec().stream(t,t.uint32(),`${d}.dht`,{limits:a.limits?.dht});break}case 6:{if(a.limits?.peers!=null&&u.peers===a.limits.peers)throw new p('Streaming decode error - repeated field "peers" had too many elements');for(let f of N.codec().stream(t,t.uint32(),`${d}.peers[]`,{limits:a.limits?.peers$}))yield{...f,index:u.peers};u.peers++;break}case 7:{yield*ut.codec().stream(t,t.uint32(),`${d}.pubsub`,{limits:a.limits?.pubsub});break}case 8:{yield*ft.codec().stream(t,t.uint32(),`${d}.peerStore`,{limits:a.limits?.peerStore});break}default:{t.skipType(X&7);break}}}})),c);function l(t){return b(t,n.codec())}n.encode=l;function i(t,r){return y(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(ae||(ae={}));var tt;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.id!=null&&i.id.byteLength>0&&(s.uint32(10),s.bytes(i.id)),i.addrs!=null&&i.addrs.length>0)for(let r of i.addrs)s.uint32(18),s.bytes(r);t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={id:O(0),addrs:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.id=i.bytes();break}case 2:{if(t.limits?.addrs!=null&&r.addrs.length===t.limits.addrs)throw new p('Decode error - repeated field "addrs" had too many elements');r.addrs.push(i.bytes());break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={addrs:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${t}.id`,value:i.bytes()};break}case 2:{if(r.limits?.addrs!=null&&d.addrs===r.limits.addrs)throw new p('Streaming decode error - repeated field "addrs" had too many elements');yield{field:`${t}.addrs[]`,index:d.addrs,value:i.bytes()},d.addrs++;break}default:{i.skipType(u&7);break}}}})),e);function o(i){return b(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(tt||(tt={}));var et;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.peer!=null&&i.peer.byteLength>0&&(s.uint32(10),s.bytes(i.peer)),i.addrs!=null&&i.addrs.length>0)for(let r of i.addrs)s.uint32(18),s.bytes(r);i.timeout!=null&&(s.uint32(24),s.int64(i.timeout)),t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={peer:O(0),addrs:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.peer=i.bytes();break}case 2:{if(t.limits?.addrs!=null&&r.addrs.length===t.limits.addrs)throw new p('Decode error - repeated field "addrs" had too many elements');r.addrs.push(i.bytes());break}case 3:{r.timeout=i.int64();break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={addrs:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${t}.peer`,value:i.bytes()};break}case 2:{if(r.limits?.addrs!=null&&d.addrs===r.limits.addrs)throw new p('Streaming decode error - repeated field "addrs" had too many elements');yield{field:`${t}.addrs[]`,index:d.addrs,value:i.bytes()},d.addrs++;break}case 3:{yield{field:`${t}.timeout`,value:i.int64()};break}default:{i.skipType(u&7);break}}}})),e);function o(i){return b(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(et||(et={}));var nt;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.peer!=null&&i.peer.byteLength>0&&(s.uint32(10),s.bytes(i.peer)),i.proto!=null&&i.proto.length>0)for(let r of i.proto)s.uint32(18),s.string(r);i.timeout!=null&&(s.uint32(24),s.int64(i.timeout)),t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={peer:O(0),proto:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.peer=i.bytes();break}case 2:{if(t.limits?.proto!=null&&r.proto.length===t.limits.proto)throw new p('Decode error - repeated field "proto" had too many elements');r.proto.push(i.string());break}case 3:{r.timeout=i.int64();break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={proto:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${t}.peer`,value:i.bytes()};break}case 2:{if(r.limits?.proto!=null&&d.proto===r.limits.proto)throw new p('Streaming decode error - repeated field "proto" had too many elements');yield{field:`${t}.proto[]`,index:d.proto,value:i.string()},d.proto++;break}case 3:{yield{field:`${t}.timeout`,value:i.int64()};break}default:{i.skipType(u&7);break}}}})),e);function o(i){return b(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(nt||(nt={}));var it;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.addr!=null&&i.addr.byteLength>0&&(s.uint32(10),s.bytes(i.addr)),i.proto!=null&&i.proto.length>0)for(let r of i.proto)s.uint32(18),s.string(r);t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={addr:O(0),proto:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.addr=i.bytes();break}case 2:{if(t.limits?.proto!=null&&r.proto.length===t.limits.proto)throw new p('Decode error - repeated field "proto" had too many elements');r.proto.push(i.string());break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={proto:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${t}.addr`,value:i.bytes()};break}case 2:{if(r.limits?.proto!=null&&d.proto===r.limits.proto)throw new p('Streaming decode error - repeated field "proto" had too many elements');yield{field:`${t}.proto[]`,index:d.proto,value:i.string()},d.proto++;break}default:{i.skipType(u&7);break}}}})),e);function o(i){return b(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(it||(it={}));var ot;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{t.lengthDelimited!==!1&&s.fork(),i.msg!=null&&i.msg!==""&&(s.uint32(10),s.string(i.msg)),t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={msg:""},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();a>>>3===1?r.msg=i.string():i.skipType(a&7)}return r},function*(i,s,t,r={}){let d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();a>>>3===1?yield{field:`${t}.msg`,value:i.string()}:i.skipType(a&7)}})),e);function o(i){return b(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(ot||(ot={}));var rt;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{t.lengthDelimited!==!1&&s.fork(),i.peer!=null&&i.peer.byteLength>0&&(s.uint32(10),s.bytes(i.peer)),i.addr!=null&&i.addr.byteLength>0&&(s.uint32(18),s.bytes(i.addr)),i.proto!=null&&i.proto!==""&&(s.uint32(26),s.string(i.proto)),t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={peer:O(0),addr:O(0),proto:""},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.peer=i.bytes();break}case 2:{r.addr=i.bytes();break}case 3:{r.proto=i.string();break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{yield{field:`${t}.peer`,value:i.bytes()};break}case 2:{yield{field:`${t}.addr`,value:i.bytes()};break}case 3:{yield{field:`${t}.proto`,value:i.string()};break}default:{i.skipType(a&7);break}}}})),e);function o(i){return b(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(rt||(rt={}));var st;(function(n){let e;(function(t){t.FIND_PEER="FIND_PEER",t.FIND_PEERS_CONNECTED_TO_PEER="FIND_PEERS_CONNECTED_TO_PEER",t.FIND_PROVIDERS="FIND_PROVIDERS",t.GET_CLOSEST_PEERS="GET_CLOSEST_PEERS",t.GET_PUBLIC_KEY="GET_PUBLIC_KEY",t.GET_VALUE="GET_VALUE",t.SEARCH_VALUE="SEARCH_VALUE",t.PUT_VALUE="PUT_VALUE",t.PROVIDE="PROVIDE"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.FIND_PEER=0]="FIND_PEER",t[t.FIND_PEERS_CONNECTED_TO_PEER=1]="FIND_PEERS_CONNECTED_TO_PEER",t[t.FIND_PROVIDERS=2]="FIND_PROVIDERS",t[t.GET_CLOSEST_PEERS=3]="GET_CLOSEST_PEERS",t[t.GET_PUBLIC_KEY=4]="GET_PUBLIC_KEY",t[t.GET_VALUE=5]="GET_VALUE",t[t.SEARCH_VALUE=6]="SEARCH_VALUE",t[t.PUT_VALUE=7]="PUT_VALUE",t[t.PROVIDE=8]="PROVIDE"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.peer!=null&&(r.uint32(18),r.bytes(t.peer)),t.cid!=null&&(r.uint32(26),r.bytes(t.cid)),t.key!=null&&(r.uint32(34),r.bytes(t.key)),t.value!=null&&(r.uint32(42),r.bytes(t.value)),t.count!=null&&(r.uint32(48),r.int32(t.count)),t.timeout!=null&&(r.uint32(56),r.int64(t.timeout)),d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.peer=t.bytes();break}case 3:{a.cid=t.bytes();break}case 4:{a.key=t.bytes();break}case 5:{a.value=t.bytes();break}case 6:{a.count=t.int32();break}case 7:{a.timeout=t.int64();break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield{field:`${d}.peer`,value:t.bytes()};break}case 3:{yield{field:`${d}.cid`,value:t.bytes()};break}case 4:{yield{field:`${d}.key`,value:t.bytes()};break}case 5:{yield{field:`${d}.value`,value:t.bytes()};break}case 6:{yield{field:`${d}.count`,value:t.int32()};break}case 7:{yield{field:`${d}.timeout`,value:t.int64()};break}default:{t.skipType(h&7);break}}}})),c);function l(t){return b(t,n.codec())}n.encode=l;function i(t,r){return y(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(st||(st={}));var ct;(function(n){let e;(function(t){t.BEGIN="BEGIN",t.VALUE="VALUE",t.END="END"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.BEGIN=0]="BEGIN",t[t.VALUE=1]="VALUE",t[t.END=2]="END"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.peer!=null&&(r.uint32(18),N.codec().encode(t.peer,r)),t.value!=null&&(r.uint32(26),r.bytes(t.value)),d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.peer=N.codec().decode(t,t.uint32(),{limits:d.limits?.peer});break}case 3:{a.value=t.bytes();break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield*N.codec().stream(t,t.uint32(),`${d}.peer`,{limits:a.limits?.peer});break}case 3:{yield{field:`${d}.value`,value:t.bytes()};break}default:{t.skipType(h&7);break}}}})),c);function l(t){return b(t,n.codec())}n.encode=l;function i(t,r){return y(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(ct||(ct={}));var N;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.id!=null&&i.id.byteLength>0&&(s.uint32(10),s.bytes(i.id)),i.addrs!=null&&i.addrs.length>0)for(let r of i.addrs)s.uint32(18),s.bytes(r);t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={id:O(0),addrs:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.id=i.bytes();break}case 2:{if(t.limits?.addrs!=null&&r.addrs.length===t.limits.addrs)throw new p('Decode error - repeated field "addrs" had too many elements');r.addrs.push(i.bytes());break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={addrs:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${t}.id`,value:i.bytes()};break}case 2:{if(r.limits?.addrs!=null&&d.addrs===r.limits.addrs)throw new p('Streaming decode error - repeated field "addrs" had too many elements');yield{field:`${t}.addrs[]`,index:d.addrs,value:i.bytes()},d.addrs++;break}default:{i.skipType(u&7);break}}}})),e);function o(i){return b(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(N||(N={}));var lt;(function(n){let e;(function(t){t.TAG_PEER="TAG_PEER",t.UNTAG_PEER="UNTAG_PEER",t.TRIM="TRIM"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.TAG_PEER=0]="TAG_PEER",t[t.UNTAG_PEER=1]="UNTAG_PEER",t[t.TRIM=2]="TRIM"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.peer!=null&&(r.uint32(18),r.bytes(t.peer)),t.tag!=null&&(r.uint32(26),r.string(t.tag)),t.weight!=null&&(r.uint32(32),r.int64(t.weight)),d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.peer=t.bytes();break}case 3:{a.tag=t.string();break}case 4:{a.weight=t.int64();break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield{field:`${d}.peer`,value:t.bytes()};break}case 3:{yield{field:`${d}.tag`,value:t.string()};break}case 4:{yield{field:`${d}.weight`,value:t.int64()};break}default:{t.skipType(h&7);break}}}})),c);function l(t){return b(t,n.codec())}n.encode=l;function i(t,r){return y(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(lt||(lt={}));var dt;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{t.lengthDelimited!==!1&&s.fork(),i.peer!=null&&i.peer.byteLength>0&&(s.uint32(10),s.bytes(i.peer)),t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={peer:O(0)},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();a>>>3===1?r.peer=i.bytes():i.skipType(a&7)}return r},function*(i,s,t,r={}){let d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();a>>>3===1?yield{field:`${t}.peer`,value:i.bytes()}:i.skipType(a&7)}})),e);function o(i){return b(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(dt||(dt={}));var at;(function(n){let e;(function(t){t.GET_TOPICS="GET_TOPICS",t.LIST_PEERS="LIST_PEERS",t.PUBLISH="PUBLISH",t.SUBSCRIBE="SUBSCRIBE"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.GET_TOPICS=0]="GET_TOPICS",t[t.LIST_PEERS=1]="LIST_PEERS",t[t.PUBLISH=2]="PUBLISH",t[t.SUBSCRIBE=3]="SUBSCRIBE"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.topic!=null&&(r.uint32(18),r.string(t.topic)),t.data!=null&&(r.uint32(26),r.bytes(t.data)),d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.topic=t.string();break}case 3:{a.data=t.bytes();break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield{field:`${d}.topic`,value:t.string()};break}case 3:{yield{field:`${d}.data`,value:t.bytes()};break}default:{t.skipType(h&7);break}}}})),c);function l(t){return b(t,n.codec())}n.encode=l;function i(t,r){return y(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(at||(at={}));var ue;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.from!=null&&(s.uint32(10),s.bytes(i.from)),i.data!=null&&(s.uint32(18),s.bytes(i.data)),i.seqno!=null&&(s.uint32(26),s.bytes(i.seqno)),i.topicIDs!=null&&i.topicIDs.length>0)for(let r of i.topicIDs)s.uint32(34),s.string(r);i.signature!=null&&(s.uint32(42),s.bytes(i.signature)),i.key!=null&&(s.uint32(50),s.bytes(i.key)),t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={topicIDs:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.from=i.bytes();break}case 2:{r.data=i.bytes();break}case 3:{r.seqno=i.bytes();break}case 4:{if(t.limits?.topicIDs!=null&&r.topicIDs.length===t.limits.topicIDs)throw new p('Decode error - repeated field "topicIDs" had too many elements');r.topicIDs.push(i.string());break}case 5:{r.signature=i.bytes();break}case 6:{r.key=i.bytes();break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={topicIDs:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${t}.from`,value:i.bytes()};break}case 2:{yield{field:`${t}.data`,value:i.bytes()};break}case 3:{yield{field:`${t}.seqno`,value:i.bytes()};break}case 4:{if(r.limits?.topicIDs!=null&&d.topicIDs===r.limits.topicIDs)throw new p('Streaming decode error - repeated field "topicIDs" had too many elements');yield{field:`${t}.topicIDs[]`,index:d.topicIDs,value:i.string()},d.topicIDs++;break}case 5:{yield{field:`${t}.signature`,value:i.bytes()};break}case 6:{yield{field:`${t}.key`,value:i.bytes()};break}default:{i.skipType(u&7);break}}}})),e);function o(i){return b(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(ue||(ue={}));var ut;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.topics!=null&&i.topics.length>0)for(let r of i.topics)s.uint32(10),s.string(r);if(i.peerIDs!=null&&i.peerIDs.length>0)for(let r of i.peerIDs)s.uint32(18),s.bytes(r);t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={topics:[],peerIDs:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{if(t.limits?.topics!=null&&r.topics.length===t.limits.topics)throw new p('Decode error - repeated field "topics" had too many elements');r.topics.push(i.string());break}case 2:{if(t.limits?.peerIDs!=null&&r.peerIDs.length===t.limits.peerIDs)throw new p('Decode error - repeated field "peerIDs" had too many elements');r.peerIDs.push(i.bytes());break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={topics:0,peerIDs:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{if(r.limits?.topics!=null&&d.topics===r.limits.topics)throw new p('Streaming decode error - repeated field "topics" had too many elements');yield{field:`${t}.topics[]`,index:d.topics,value:i.string()},d.topics++;break}case 2:{if(r.limits?.peerIDs!=null&&d.peerIDs===r.limits.peerIDs)throw new p('Streaming decode error - repeated field "peerIDs" had too many elements');yield{field:`${t}.peerIDs[]`,index:d.peerIDs,value:i.bytes()},d.peerIDs++;break}default:{i.skipType(u&7);break}}}})),e);function o(i){return b(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(ut||(ut={}));var ht;(function(n){let e;(function(t){t.UNSPECIFIED="UNSPECIFIED",t.GET_PROTOCOLS="GET_PROTOCOLS",t.GET_PEER_INFO="GET_PEER_INFO"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.GET_PROTOCOLS=1]="GET_PROTOCOLS",t[t.GET_PEER_INFO=2]="GET_PEER_INFO"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{if(d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.id!=null&&(r.uint32(18),r.bytes(t.id)),t.protos!=null&&t.protos.length>0)for(let a of t.protos)r.uint32(26),r.string(a);d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={protos:[]},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.id=t.bytes();break}case 3:{if(d.limits?.protos!=null&&a.protos.length===d.limits.protos)throw new p('Decode error - repeated field "protos" had too many elements');a.protos.push(t.string());break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u={protos:0},h=r==null?t.len:t.pos+r;for(;t.pos<h;){let X=t.uint32();switch(X>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield{field:`${d}.id`,value:t.bytes()};break}case 3:{if(a.limits?.protos!=null&&u.protos===a.limits.protos)throw new p('Streaming decode error - repeated field "protos" had too many elements');yield{field:`${d}.protos[]`,index:u.protos,value:t.string()},u.protos++;break}default:{t.skipType(X&7);break}}}})),c);function l(t){return b(t,n.codec())}n.encode=l;function i(t,r){return y(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(ht||(ht={}));var ft;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.peer!=null&&(s.uint32(10),N.codec().encode(i.peer,s)),i.protos!=null&&i.protos.length>0)for(let r of i.protos)s.uint32(18),s.string(r);t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={protos:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.peer=N.codec().decode(i,i.uint32(),{limits:t.limits?.peer});break}case 2:{if(t.limits?.protos!=null&&r.protos.length===t.limits.protos)throw new p('Decode error - repeated field "protos" had too many elements');r.protos.push(i.string());break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={protos:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield*N.codec().stream(i,i.uint32(),`${t}.peer`,{limits:r.limits?.peer});break}case 2:{if(r.limits?.protos!=null&&d.protos===r.limits.protos)throw new p('Streaming decode error - repeated field "protos" had too many elements');yield{field:`${t}.protos[]`,index:d.protos,value:i.string()},d.protos++;break}default:{i.skipType(u&7);break}}}})),e);function o(i){return b(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(ft||(ft={}));return en(Si);})();
|
|
2
|
+
"use strict";var Libp2PDaemonProtocol=(()=>{var Lt=Object.defineProperty;var en=Object.getOwnPropertyDescriptor;var nn=Object.getOwnPropertyNames;var on=Object.prototype.hasOwnProperty;var I=(n,t)=>{for(var o in t)Lt(n,o,{get:t[o],enumerable:!0})},rn=(n,t,o,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of nn(t))!on.call(n,l)&&l!==o&&Lt(n,l,{get:()=>t[l],enumerable:!(c=en(t,l))||c.enumerable});return n};var sn=n=>rn(Lt({},"__esModule",{value:!0}),n);var Ti={};I(Ti,{ConnManagerRequest:()=>lt,ConnectRequest:()=>et,DHTRequest:()=>st,DHTResponse:()=>ct,DisconnectRequest:()=>at,ErrorResponse:()=>ot,IdentifyResponse:()=>tt,PSMessage:()=>he,PSRequest:()=>dt,PSResponse:()=>ut,PeerInfo:()=>A,PeerstoreRequest:()=>ht,PeerstoreResponse:()=>ft,Request:()=>de,Response:()=>ue,StreamHandlerRequest:()=>it,StreamInfo:()=>rt,StreamOpenRequest:()=>nt});function $(n=0){return new Uint8Array(n)}function G(n=0){return new Uint8Array(n)}var cn=Math.pow(2,7),ln=Math.pow(2,14),an=Math.pow(2,21),pe=Math.pow(2,28),me=Math.pow(2,35),ye=Math.pow(2,42),ge=Math.pow(2,49),k=128,z=127;function pt(n){if(n<cn)return 1;if(n<ln)return 2;if(n<an)return 3;if(n<pe)return 4;if(n<me)return 5;if(n<ye)return 6;if(n<ge)return 7;if(Number.MAX_SAFE_INTEGER!=null&&n>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function be(n,t,o=0){switch(pt(n)){case 8:t[o++]=n&255|k,n/=128;case 7:t[o++]=n&255|k,n/=128;case 6:t[o++]=n&255|k,n/=128;case 5:t[o++]=n&255|k,n/=128;case 4:t[o++]=n&255|k,n>>>=7;case 3:t[o++]=n&255|k,n>>>=7;case 2:t[o++]=n&255|k,n>>>=7;case 1:{t[o++]=n&255,n>>>=7;break}default:throw new Error("unreachable")}return t}function Ee(n,t){let o=n[t],c=0;if(c+=o&z,o<k||(o=n[t+1],c+=(o&z)<<7,o<k)||(o=n[t+2],c+=(o&z)<<14,o<k)||(o=n[t+3],c+=(o&z)<<21,o<k)||(o=n[t+4],c+=(o&z)*pe,o<k)||(o=n[t+5],c+=(o&z)*me,o<k)||(o=n[t+6],c+=(o&z)*ye,o<k)||(o=n[t+7],c+=(o&z)*ge,o<k))return c;throw new RangeError("Could not decode varint")}function dn(n){return n.buffer instanceof ArrayBuffer}function xe(n){return dn(n)?n:n.slice()}var Ut=new Float32Array([-0]),_=new Uint8Array(Ut.buffer);function ke(n,t,o){Ut[0]=n,t[o]=_[0],t[o+1]=_[1],t[o+2]=_[2],t[o+3]=_[3]}function we(n,t){return _[0]=n[t],_[1]=n[t+1],_[2]=n[t+2],_[3]=n[t+3],Ut[0]}var Bt=new Float64Array([-0]),x=new Uint8Array(Bt.buffer);function Ie(n,t,o){Bt[0]=n,t[o]=x[0],t[o+1]=x[1],t[o+2]=x[2],t[o+3]=x[3],t[o+4]=x[4],t[o+5]=x[5],t[o+6]=x[6],t[o+7]=x[7]}function De(n,t){return x[0]=n[t],x[1]=n[t+1],x[2]=n[t+2],x[3]=n[t+3],x[4]=n[t+4],x[5]=n[t+5],x[6]=n[t+6],x[7]=n[t+7],Bt[0]}var un=BigInt(Number.MAX_SAFE_INTEGER),hn=BigInt(Number.MIN_SAFE_INTEGER),D=class n{lo;hi;constructor(t,o){this.lo=t|0,this.hi=o|0}toNumber(t=!1){if(!t&&this.hi>>>31>0){let o=~this.lo+1>>>0,c=~this.hi>>>0;return o===0&&(c=c+1>>>0),-(o+c*4294967296)}return this.lo+this.hi*4294967296}toBigInt(t=!1){if(t)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let o=~this.lo+1>>>0,c=~this.hi>>>0;return o===0&&(c=c+1>>>0),-(BigInt(o)+(BigInt(c)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(t=!1){return this.toBigInt(t).toString()}zzEncode(){let t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this}zzDecode(){let t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this}length(){let t=this.lo,o=(this.lo>>>28|this.hi<<4)>>>0,c=this.hi>>>24;return c===0?o===0?t<16384?t<128?1:2:t<2097152?3:4:o<16384?o<128?5:6:o<2097152?7:8:c<128?9:10}static fromBigInt(t){if(t===0n)return Y;if(t<un&&t>hn)return this.fromNumber(Number(t));let o=t<0n;o&&(t=-t);let c=t>>32n,l=t-(c<<32n);return o&&(c=~c|0n,l=~l|0n,++l>Se&&(l=0n,++c>Se&&(c=0n))),new n(Number(l),Number(c))}static fromNumber(t){if(t===0)return Y;let o=t<0;o&&(t=-t);let c=t>>>0,l=(t-c)/4294967296>>>0;return o&&(l=~l>>>0,c=~c>>>0,++c>4294967295&&(c=0,++l>4294967295&&(l=0))),new n(c,l)}static from(t){return typeof t=="number"?n.fromNumber(t):typeof t=="bigint"?n.fromBigInt(t):typeof t=="string"?n.fromBigInt(BigInt(t)):t.low!=null||t.high!=null?new n(t.low>>>0,t.high>>>0):Y}},Y=new D(0,0);Y.toBigInt=function(){return 0n};Y.zzEncode=Y.zzDecode=function(){return this};Y.length=function(){return 1};var Se=4294967296n;function Ne(n){let t=0,o=0;for(let c=0;c<n.length;++c)o=n.charCodeAt(c),o<128?t+=1:o<2048?t+=2:(o&64512)===55296&&(n.charCodeAt(c+1)&64512)===56320?(++c,t+=4):t+=3;return t}function Ae(n,t,o){if(o-t<1)return"";let l,i=[],s=0,e;for(;t<o;)e=n[t++],e<128?i[s++]=e:e>191&&e<224?i[s++]=(e&31)<<6|n[t++]&63:e>239&&e<365?(e=((e&7)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,i[s++]=55296+(e>>10),i[s++]=56320+(e&1023)):i[s++]=(e&15)<<12|(n[t++]&63)<<6|n[t++]&63,s>8191&&((l??(l=[])).push(String.fromCharCode.apply(String,i)),s=0);return l!=null?(s>0&&l.push(String.fromCharCode.apply(String,i.slice(0,s))),l.join("")):String.fromCharCode.apply(String,i.slice(0,s))}function Ft(n,t,o){let c=o,l,i;for(let s=0;s<n.length;++s)l=n.charCodeAt(s),l<128?t[o++]=l:l<2048?(t[o++]=l>>6|192,t[o++]=l&63|128):(l&64512)===55296&&((i=n.charCodeAt(s+1))&64512)===56320?(l=65536+((l&1023)<<10)+(i&1023),++s,t[o++]=l>>18|240,t[o++]=l>>12&63|128,t[o++]=l>>6&63|128,t[o++]=l&63|128):(t[o++]=l>>12|224,t[o++]=l>>6&63|128,t[o++]=l&63|128);return o-c}function v(n,t){return RangeError(`index out of range: ${n.pos} + ${t??1} > ${n.len}`)}function Dt(n,t){return(n[t-4]|n[t-3]<<8|n[t-2]<<16|n[t-1]<<24)>>>0}var Ot=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(t){this.buf=xe(t),this.pos=0,this.len=t.length}uint32(){let t=4294967295;if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,v(this,10);return t}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw v(this,4);return Dt(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw v(this,4);return Dt(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw v(this,4);let t=we(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw v(this,4);let t=De(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),o=this.pos,c=this.pos+t;if(c>this.len)throw v(this,t);return this.pos+=t,o===c?new Uint8Array(0):this.buf.subarray(o,c)}string(){let t=this.bytes();return Ae(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw v(this,t);this.pos+=t}else do if(this.pos>=this.len)throw v(this);while((this.buf[this.pos++]&128)!==0);return this}skipType(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${t} at offset ${this.pos}`)}return this}readLongVarint(){let t=new D(0,0),o=0;if(this.len-this.pos>4){for(;o<4;++o)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<o*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;o=0}else{for(;o<3;++o){if(this.pos>=this.len)throw v(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<o*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<o*7)>>>0,t}if(this.len-this.pos>4){for(;o<5;++o)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<o*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;o<5;++o){if(this.pos>=this.len)throw v(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<o*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw v(this,8);let t=Dt(this.buf,this.pos+=4),o=Dt(this.buf,this.pos+=4);return new D(t,o)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let t=Ee(this.buf,this.pos);return this.pos+=pt(t),t}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function mt(n){return new Ot(n instanceof Uint8Array?n:n.subarray())}function y(n,t,o){let c=mt(n);return t.decode(c,void 0,o)}var zt={};I(zt,{base10:()=>xn});var Ki=new Uint8Array(0);function ve(n,t){if(n===t)return!0;if(n.byteLength!==t.byteLength)return!1;for(let o=0;o<n.byteLength;o++)if(n[o]!==t[o])return!1;return!0}function N(n){if(n instanceof Uint8Array&&n.constructor.name==="Uint8Array")return J(n);if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return J(new Uint8Array(n.buffer,n.byteOffset,n.byteLength));throw new Error("Unknown type, must be binary type")}function Le(n){let t=new Uint8Array(n.length);for(let o=0;o<n.length;o++)t[o]=n.charCodeAt(o);return t}var Te=4096;function Ue(n){let t=n.length;if(t<=Te)return String.fromCharCode.apply(String,n);let o="",c=0;for(;c<t;)o+=String.fromCharCode.apply(String,n.subarray(c,c+=Te));return o}function fn(n){return n?.buffer instanceof ArrayBuffer}function J(n){return fn(n)?n:n.slice()}function pn(n,t,o){if(n.length>=255)throw new TypeError("Alphabet too long");for(var c=new Uint8Array(256),l=0;l<c.length;l++)c[l]=255;for(var i=0;i<n.length;i++){var s=n.charAt(i),e=s.charCodeAt(0);if(c[e]!==255)throw new TypeError(s+" is ambiguous");if(c[e]=i,o){var r=s.toLowerCase().charCodeAt(0),a=s.toUpperCase().charCodeAt(0);r!==e&&(c[r]=i),a!==e&&(c[a]=i)}}var d=n.length,u=n.charAt(0),h=Math.log(d)/Math.log(256),X=Math.log(256)/Math.log(d);function vt(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var w=0,K=0,C=0,L=f.length;C!==L&&f[C]===0;)C++,w++;for(var U=(L-C)*X+1>>>0,S=new Uint8Array(U);C!==L;){for(var B=f[C],P=0,T=U-1;(B!==0||P<K)&&T!==-1;T--,P++)B+=256*S[T]>>>0,S[T]=B%d>>>0,B=B/d>>>0;if(B!==0)throw new Error("Non-zero carry");K=P,C++}for(var O=U-K;O!==U&&S[O]===0;)O++;for(var It=u.repeat(w);O<U;++O)It+=n.charAt(S[O]);return It}function fe(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var w=0;if(f[w]!==" "){for(var K=0,C=0;f[w]===u;)K++,w++;for(var L=(f.length-w)*h+1>>>0,U=new Uint8Array(L);f[w];){var S=c[f.charCodeAt(w)];if(S===255)return;for(var B=0,P=L-1;(S!==0||B<C)&&P!==-1;P--,B++)S+=d*U[P]>>>0,U[P]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");C=B,w++}if(f[w]!==" "){for(var T=L-C;T!==L&&U[T]===0;)T++;for(var O=new Uint8Array(K+(L-T)),It=K;T!==L;)O[It++]=U[T++];return O}}}function tn(f){var w=fe(f);if(w)return w;throw new Error(`Non-${t} character`)}return{encode:vt,decodeUnsafe:fe,decode:tn}}var mn=pn,yn=mn,Fe=yn;var $t=class{name;prefix;baseEncode;constructor(t,o,c){this.name=t,this.prefix=o,this.baseEncode=c}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},Mt=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,o,c){this.name=t,this.prefix=o;let l=o.codePointAt(0);if(l===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=l,this.baseDecode=c}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Oe(this,t)}},Pt=class{decoders;constructor(t){this.decoders=t}or(t){return Oe(this,t)}decode(t){let o=t[0],c=this.decoders[o];if(c!=null)return c.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Oe(n,t){return new Pt({...n.decoders??{[n.prefix]:n},...t.decoders??{[t.prefix]:t}})}var Gt=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,o,c,l){this.name=t,this.prefix=o,this.baseEncode=c,this.baseDecode=l,this.encoder=new $t(t,o,c),this.decoder=new Mt(t,o,l)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function Q({name:n,prefix:t,encode:o,decode:c}){return new Gt(n,t,o,c)}function R({name:n,prefix:t,alphabet:o,caseInsensitive:c=!1}){let{encode:l,decode:i}=Fe(o,n,c);return Q({prefix:t,name:n,encode:l,decode:s=>N(i(s))})}function gn(n,t,o,c){let l=n.length;for(;n[l-1]==="=";)--l;let i=new Uint8Array(l*o/8|0),s=0,e=0,r=0;for(let a=0;a<l;++a){let d=t[n[a]];if(d===void 0)throw new SyntaxError(`Non-${c} character`);e=e<<o|d,s+=o,s>=8&&(s-=8,i[r++]=255&e>>s)}if(s>=o||(255&e<<8-s)!==0)throw new SyntaxError("Unexpected end of data");return i}function bn(n,t,o){let c=t[t.length-1]==="=",l=(1<<o)-1,i="",s=0,e=0;for(let r=0;r<n.length;++r)for(e=e<<8|n[r],s+=8;s>o;)s-=o,i+=t[l&e>>s];if(s!==0&&(i+=t[l&e<<o-s]),c)for(;(i.length*o&7)!==0;)i+="=";return i}function En(n,t){let o={};for(let c=0;c<n.length;++c)if(o[n[c]]=c,t){let l=n[c].toLowerCase(),i=n[c].toUpperCase();l!==n[c]&&(o[l]=c),i!==n[c]&&(o[i]=c)}return o}function m({name:n,prefix:t,bitsPerChar:o,alphabet:c,caseInsensitive:l=!1}){let i=En(c,l);return Q({prefix:t,name:n,encode(s){return bn(s,c,o)},decode(s){return gn(s,i,o,n)}})}var xn=R({prefix:"9",name:"base10",alphabet:"0123456789"});var _t={};I(_t,{base16:()=>kn,base16upper:()=>wn});var kn=m({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4,caseInsensitive:!0}),wn=m({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4,caseInsensitive:!0});var Rt={};I(Rt,{base2:()=>In});var In=m({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Xt={};I(Xt,{base256emoji:()=>Cn});var $e=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}"),Dn=$e.reduce((n,t,o)=>(n[o]=t,n),[]),Sn=$e.reduce((n,t,o)=>{let c=t.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${t}`);return n[c]=o,n},[]);function Nn(n){return n.reduce((t,o)=>(t+=Dn[o],t),"")}function An(n){let t=[];for(let o of n){let c=o.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${o}`);let l=Sn[c];if(l==null)throw new Error(`Non-base256emoji character: ${o}`);t.push(l)}return new Uint8Array(t)}var Cn=Q({prefix:"\u{1F680}",name:"base256emoji",encode:Nn,decode:An});var Kt={};I(Kt,{base32:()=>V,base32hex:()=>Un,base32hexpad:()=>Fn,base32hexpadupper:()=>On,base32hexupper:()=>Bn,base32pad:()=>vn,base32padupper:()=>Ln,base32upper:()=>Tn,base32z:()=>$n});var V=m({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5,caseInsensitive:!0}),Tn=m({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5,caseInsensitive:!0}),vn=m({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5,caseInsensitive:!0}),Ln=m({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5,caseInsensitive:!0}),Un=m({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5,caseInsensitive:!0}),Bn=m({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5,caseInsensitive:!0}),Fn=m({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5,caseInsensitive:!0}),On=m({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5,caseInsensitive:!0}),$n=m({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Yt={};I(Yt,{base36:()=>yt,base36upper:()=>Mn});var yt=R({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz",caseInsensitive:!0}),Mn=R({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",caseInsensitive:!0});var Jt={};I(Jt,{base58btc:()=>F,base58flickr:()=>Pn});var F=R({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Pn=R({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Wt={};I(Wt,{base64:()=>Gn,base64pad:()=>zn,base64url:()=>_n,base64urlpad:()=>Rn});var Gn=m({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zn=m({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),_n=m({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Rn=m({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Qt={};I(Qt,{base8:()=>Xn});var Xn=m({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Vt={};I(Vt,{identity:()=>Kn});var Kn=Q({prefix:"\0",name:"identity",encode:n=>Ue(N(n)),decode:n=>N(Le(n))});var so=new TextEncoder,co=new TextDecoder;var Ht={};I(Ht,{identity:()=>fi});var Wn=Ge,Me=128,Qn=127,Vn=~Qn,Zn=Math.pow(2,31);function Ge(n,t,o){t=t||[],o=o||0;for(var c=o;n>=Zn;)t[o++]=n&255|Me,n/=128;for(;n&Vn;)t[o++]=n&255|Me,n>>>=7;return t[o]=n|0,Ge.bytes=o-c+1,t}var Hn=Zt,qn=128,Pe=127;function Zt(n,c){var o=0,c=c||0,l=0,i=c,s,e=n.length;do{if(i>=e)throw Zt.bytes=0,new RangeError("Could not decode varint");s=n[i++],o+=l<28?(s&Pe)<<l:(s&Pe)*Math.pow(2,l),l+=7}while(s>=qn);return Zt.bytes=i-c,o}var jn=Math.pow(2,7),ti=Math.pow(2,14),ei=Math.pow(2,21),ni=Math.pow(2,28),ii=Math.pow(2,35),oi=Math.pow(2,42),ri=Math.pow(2,49),si=Math.pow(2,56),ci=Math.pow(2,63),li=function(n){return n<jn?1:n<ti?2:n<ei?3:n<ni?4:n<ii?5:n<oi?6:n<ri?7:n<si?8:n<ci?9:10},ai={encode:Wn,decode:Hn,encodingLength:li},di=ai,gt=di;function bt(n,t=0){return[gt.decode(n,t),gt.decode.bytes]}function Z(n,t,o=0){return gt.encode(n,t,o),t}function H(n){return gt.encodingLength(n)}function j(n,t){let o=t.byteLength,c=H(n),l=c+H(o),i=new Uint8Array(l+o);return Z(n,i,0),Z(o,i,c),i.set(t,l),new q(n,o,t,i)}function ze(n){let t=N(n),[o,c]=bt(t),[l,i]=bt(t.subarray(c)),s=t.subarray(c+i);if(s.byteLength!==l)throw new Error("Incorrect length");return new q(o,l,s,t)}function _e(n,t){if(n===t)return!0;{let o=t;return n.code===o.code&&n.size===o.size&&o.bytes instanceof Uint8Array&&ve(n.bytes,o.bytes)}}var q=class{code;size;digest;bytes;constructor(t,o,c,l){this.code=t,this.size=o,this.digest=J(c),this.bytes=J(l)}};var Re=0,ui="identity",Xe=N;function hi(n,t){if(t?.truncate!=null&&t.truncate!==n.byteLength){if(t.truncate<0||t.truncate>n.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${n.byteLength}`);n=n.subarray(0,t.truncate)}return j(Re,Xe(n))}var fi={code:Re,name:ui,encode:Xe,digest:hi};var te={};I(te,{sha256:()=>mi,sha512:()=>yi});var pi=20;function jt({name:n,code:t,encode:o,minDigestLength:c,maxDigestLength:l}){return new qt(n,t,o,c,l)}var qt=class{name;code;encode;minDigestLength;maxDigestLength;constructor(t,o,c,l,i){this.name=t,this.code=o,this.encode=c,this.minDigestLength=l??pi,this.maxDigestLength=i}digest(t,o){if(o?.truncate!=null){if(o.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&o.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(t instanceof Uint8Array){let c=this.encode(t);return c instanceof Uint8Array?Ke(c,this.code,o?.truncate):c.then(l=>Ke(l,this.code,o?.truncate))}else throw Error("Unknown type, must be binary type")}};function Ke(n,t,o){if(o!=null&&o!==n.byteLength){if(o>n.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${n.byteLength}`);n=n.subarray(0,o)}return j(t,n)}function Je(n){return async t=>new Uint8Array(await crypto.subtle.digest(n,t))}var mi=jt({name:"sha2-256",code:18,encode:Je("SHA-256")}),yi=jt({name:"sha2-512",code:19,encode:Je("SHA-512")});function We(n,t){let{bytes:o,version:c}=n;return c===0?bi(o,ee(n),t??F.encoder):Ei(o,ee(n),t??V.encoder)}var Qe=new WeakMap;function ee(n){let t=Qe.get(n);if(t==null){let o=new Map;return Qe.set(n,o),o}return t}var Nt=class n{code;version;multihash;bytes;"/";constructor(t,o,c,l){this.code=o,this.version=t,this.multihash=c,this.bytes=J(l),this["/"]=this.bytes}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:o}=this;if(t!==xt)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(o.code!==xi)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return n.createV0(o)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:o}=this.multihash,c=j(t,o);return n.createV1(this.code,c)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return n.equals(this,t)}static equals(t,o){let c=o;return c!=null&&t.code===c.code&&t.version===c.version&&_e(t.multihash,c.multihash)}toString(t){return We(this,t)}toJSON(){return{"/":We(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let o=t;if(o instanceof n)return o;if(o["/"]!=null&&o["/"]===o.bytes||o.asCID===o){let{version:c,code:l,multihash:i,bytes:s}=o;return new n(c,l,i,s??Ve(c,l,i.bytes))}else if(o[ki]===!0){let{version:c,multihash:l,code:i}=o,s=ze(l);return n.create(c,i,s)}else return null}static create(t,o,c){if(typeof o!="number")throw new Error("String codecs are no longer supported");if(!(c.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(o!==xt)throw new Error(`Version 0 CID must use dag-pb (code: ${xt}) block encoding`);return new n(t,o,c,c.bytes)}case 1:{let l=Ve(t,o,c.bytes);return new n(t,o,c,l)}default:throw new Error("Invalid version")}}static createV0(t){return n.create(0,xt,t)}static createV1(t,o){return n.create(1,t,o)}static decode(t){let[o,c]=n.decodeFirst(t);if(c.length!==0)throw new Error("Incorrect length");return o}static decodeFirst(t){let o=n.inspectBytes(t),c=o.size-o.multihashSize,l=N(t.subarray(c,c+o.multihashSize));if(l.byteLength!==o.multihashSize)throw new Error("Incorrect length");let i=l.subarray(o.multihashSize-o.digestSize),s=new q(o.multihashCode,o.digestSize,i,l);return[o.version===0?n.createV0(s):n.createV1(o.codec,s),t.subarray(o.size)]}static inspectBytes(t){let o=0,c=()=>{let[u,h]=bt(t.subarray(o));return o+=h,u},l=c(),i=xt;if(l===18?(l=0,o=0):i=c(),l!==0&&l!==1)throw new RangeError(`Invalid CID version ${l}`);let s=o,e=c(),r=c(),a=o+r,d=a-s;return{version:l,codec:i,multihashCode:e,digestSize:r,multihashSize:d,size:a}}static parse(t,o){let[c,l]=gi(t,o),i=n.decode(l);if(i.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ee(i).set(c,t),i}};function gi(n,t){switch(n[0]){case"Q":{let o=t??F;return[F.prefix,o.decode(`${F.prefix}${n}`)]}case F.prefix:{let o=t??F;return[F.prefix,o.decode(n)]}case V.prefix:{let o=t??V;return[V.prefix,o.decode(n)]}case yt.prefix:{let o=t??yt;return[yt.prefix,o.decode(n)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[n[0],t.decode(n)]}}}function bi(n,t,o){let{prefix:c}=o;if(c!==F.prefix)throw Error(`Cannot string encode V0 in ${o.name} encoding`);let l=t.get(c);if(l==null){let i=o.encode(n).slice(1);return t.set(c,i),i}else return l}function Ei(n,t,o){let{prefix:c}=o,l=t.get(c);if(l==null){let i=o.encode(n);return t.set(c,i),i}else return l}var xt=112,xi=18;function Ve(n,t,o){let c=H(n),l=c+H(t),i=new Uint8Array(l+o.byteLength);return Z(n,i,0),Z(t,i,c),i.set(o,l),i}var ki=Symbol.for("@ipld/js-cid/CID");var ne={...Vt,...Rt,...Qt,...zt,..._t,...Kt,...Yt,...Jt,...Wt,...Xt},vo={...te,...Ht};function He(n,t,o,c){return{name:n,prefix:t,encoder:{name:n,prefix:t,encode:o},decoder:{decode:c}}}var Ze=He("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),ie=He("ascii","a",n=>{let t="a";for(let o=0;o<n.length;o++)t+=String.fromCharCode(n[o]);return t},n=>{n=n.substring(1);let t=G(n.length);for(let o=0;o<n.length;o++)t[o]=n.charCodeAt(o);return t}),wi={utf8:Ze,"utf-8":Ze,hex:ne.base16,latin1:ie,ascii:ie,binary:ie,...ne},qe=wi;function je(n,t="utf8"){let o=qe[t];if(o==null)throw new Error(`Unsupported encoding "${t}"`);return o.decoder.decode(`${o.prefix}${n}`)}function oe(n){let t=n??8192,o=t>>>1,c,l=t;return function(s){if(s<1||s>o)return G(s);l+s>t&&(c=G(t),l=0);let e=c.subarray(l,l+=s);return(l&7)!==0&&(l=(l|7)+1),e}}var W=class{fn;len;next;val;constructor(t,o,c){this.fn=t,this.len=o,this.next=void 0,this.val=c}};function re(){}var ce=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},Ii=oe();function Di(n){return globalThis.Buffer!=null?G(n):Ii(n)}var wt=class{len;head;tail;states;constructor(){this.len=0,this.head=new W(re,0,0),this.tail=this.head,this.states=null}_push(t,o,c){return this.tail=this.tail.next=new W(t,o,c),this.len+=o,this}uint32(t){return this.len+=(this.tail=this.tail.next=new le((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this}int32(t){return t<0?this._push(At,10,D.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let o=D.fromBigInt(t);return this._push(At,o.length(),o)}uint64Number(t){return this._push(be,pt(t),t)}uint64String(t){return this.uint64(BigInt(t))}int64(t){return this.uint64(t)}int64Number(t){return this.uint64Number(t)}int64String(t){return this.uint64String(t)}sint64(t){let o=D.fromBigInt(t).zzEncode();return this._push(At,o.length(),o)}sint64Number(t){let o=D.fromNumber(t).zzEncode();return this._push(At,o.length(),o)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(se,1,t?1:0)}fixed32(t){return this._push(kt,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let o=D.fromBigInt(t);return this._push(kt,4,o.lo)._push(kt,4,o.hi)}fixed64Number(t){let o=D.fromNumber(t);return this._push(kt,4,o.lo)._push(kt,4,o.hi)}fixed64String(t){return this.fixed64(BigInt(t))}sfixed64(t){return this.fixed64(t)}sfixed64Number(t){return this.fixed64Number(t)}sfixed64String(t){return this.fixed64String(t)}float(t){return this._push(ke,4,t)}double(t){return this._push(Ie,8,t)}bytes(t){let o=t.length>>>0;return o===0?this._push(se,1,0):this.uint32(o)._push(Ni,o,t)}string(t){let o=Ne(t);return o!==0?this.uint32(o)._push(Ft,o,t):this._push(se,1,0)}fork(){return this.states=new ce(this),this.head=this.tail=new W(re,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new W(re,0,0),this.len=0),this}ldelim(){let t=this.head,o=this.tail,c=this.len;return this.reset().uint32(c),c!==0&&(this.tail.next=t.next,this.tail=o,this.len+=c),this}finish(){let t=this.head.next,o=Di(this.len),c=0;for(;t!=null;)t.fn(t.val,o,c),c+=t.len,t=t.next;return o}};function se(n,t,o){t[o]=n&255}function Si(n,t,o){for(;n>127;)t[o++]=n&127|128,n>>>=7;t[o]=n}var le=class extends W{next;constructor(t,o){super(Si,t,o),this.next=void 0}};function At(n,t,o){for(;n.hi!==0;)t[o++]=n.lo&127|128,n.lo=(n.lo>>>7|n.hi<<25)>>>0,n.hi>>>=7;for(;n.lo>127;)t[o++]=n.lo&127|128,n.lo=n.lo>>>7;t[o++]=n.lo}function kt(n,t,o){t[o]=n&255,t[o+1]=n>>>8&255,t[o+2]=n>>>16&255,t[o+3]=n>>>24}function Ni(n,t,o){t.set(n,o)}globalThis.Buffer!=null&&(wt.prototype.bytes=function(n){let t=n.length>>>0;return this.uint32(t),t>0&&this._push(Ai,t,n),this},wt.prototype.string=function(n){let t=globalThis.Buffer.byteLength(n);return this.uint32(t),t>0&&this._push(Ci,t,n),this});function Ai(n,t,o){t.set(n,o)}function Ci(n,t,o){n.length<40?Ft(n,t,o):t.utf8Write!=null?t.utf8Write(n,o):t.set(je(n),o)}function ae(){return new wt}function g(n,t){let o=ae();return t.encode(n,o,{lengthDelimited:!1}),o.finish()}function*b(n,t,o){let c=mt(n);yield*t.stream(c,void 0,"$",o)}var Ct={VARINT:0,BIT64:1,LENGTH_DELIMITED:2,START_GROUP:3,END_GROUP:4,BIT32:5};function Tt(n,t,o,c,l){return{name:n,type:t,encode:o,decode:c,stream:l}}function M(n){function t(i){if(n[i.toString()]==null)throw new Error("Invalid enum value");return n[i]}let o=function(s,e){let r=t(s);e.int32(r)},c=function(s){let e=s.int32();return t(e)},l=function*(s){let e=s.int32();yield t(e)};return Tt("enum",Ct.VARINT,o,c,l)}function E(n,t,o){return Tt("message",Ct.LENGTH_DELIMITED,n,t,o)}var p=class extends Error{code="ERR_MAX_LENGTH";name="MaxLengthError"};var de;(function(n){let t;(function(e){e.IDENTIFY="IDENTIFY",e.CONNECT="CONNECT",e.STREAM_OPEN="STREAM_OPEN",e.STREAM_HANDLER="STREAM_HANDLER",e.DHT="DHT",e.LIST_PEERS="LIST_PEERS",e.CONNMANAGER="CONNMANAGER",e.DISCONNECT="DISCONNECT",e.PUBSUB="PUBSUB",e.PEERSTORE="PEERSTORE"})(t=n.Type||(n.Type={}));let o;(function(e){e[e.IDENTIFY=0]="IDENTIFY",e[e.CONNECT=1]="CONNECT",e[e.STREAM_OPEN=2]="STREAM_OPEN",e[e.STREAM_HANDLER=3]="STREAM_HANDLER",e[e.DHT=4]="DHT",e[e.LIST_PEERS=5]="LIST_PEERS",e[e.CONNMANAGER=6]="CONNMANAGER",e[e.DISCONNECT=7]="DISCONNECT",e[e.PUBSUB=8]="PUBSUB",e[e.PEERSTORE=9]="PEERSTORE"})(o||(o={})),(function(e){e.codec=()=>M(o)})(t=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((e,r,a={})=>{a.lengthDelimited!==!1&&r.fork(),e.type!=null&&(r.uint32(8),n.Type.codec().encode(e.type,r)),e.connect!=null&&(r.uint32(18),et.codec().encode(e.connect,r)),e.streamOpen!=null&&(r.uint32(26),nt.codec().encode(e.streamOpen,r)),e.streamHandler!=null&&(r.uint32(34),it.codec().encode(e.streamHandler,r)),e.dht!=null&&(r.uint32(42),st.codec().encode(e.dht,r)),e.connManager!=null&&(r.uint32(50),lt.codec().encode(e.connManager,r)),e.disconnect!=null&&(r.uint32(58),at.codec().encode(e.disconnect,r)),e.pubsub!=null&&(r.uint32(66),dt.codec().encode(e.pubsub,r)),e.peerStore!=null&&(r.uint32(74),ht.codec().encode(e.peerStore,r)),a.lengthDelimited!==!1&&r.ldelim()},(e,r,a={})=>{let d={},u=r==null?e.len:e.pos+r;for(;e.pos<u;){let h=e.uint32();switch(h>>>3){case 1:{d.type=n.Type.codec().decode(e);break}case 2:{d.connect=et.codec().decode(e,e.uint32(),{limits:a.limits?.connect});break}case 3:{d.streamOpen=nt.codec().decode(e,e.uint32(),{limits:a.limits?.streamOpen});break}case 4:{d.streamHandler=it.codec().decode(e,e.uint32(),{limits:a.limits?.streamHandler});break}case 5:{d.dht=st.codec().decode(e,e.uint32(),{limits:a.limits?.dht});break}case 6:{d.connManager=lt.codec().decode(e,e.uint32(),{limits:a.limits?.connManager});break}case 7:{d.disconnect=at.codec().decode(e,e.uint32(),{limits:a.limits?.disconnect});break}case 8:{d.pubsub=dt.codec().decode(e,e.uint32(),{limits:a.limits?.pubsub});break}case 9:{d.peerStore=ht.codec().decode(e,e.uint32(),{limits:a.limits?.peerStore});break}default:{e.skipType(h&7);break}}}return d},function*(e,r,a,d={}){let u=r==null?e.len:e.pos+r;for(;e.pos<u;){let h=e.uint32();switch(h>>>3){case 1:{yield{field:`${a}.type`,value:n.Type.codec().decode(e)};break}case 2:{yield*et.codec().stream(e,e.uint32(),`${a}.connect`,{limits:d.limits?.connect});break}case 3:{yield*nt.codec().stream(e,e.uint32(),`${a}.streamOpen`,{limits:d.limits?.streamOpen});break}case 4:{yield*it.codec().stream(e,e.uint32(),`${a}.streamHandler`,{limits:d.limits?.streamHandler});break}case 5:{yield*st.codec().stream(e,e.uint32(),`${a}.dht`,{limits:d.limits?.dht});break}case 6:{yield*lt.codec().stream(e,e.uint32(),`${a}.connManager`,{limits:d.limits?.connManager});break}case 7:{yield*at.codec().stream(e,e.uint32(),`${a}.disconnect`,{limits:d.limits?.disconnect});break}case 8:{yield*dt.codec().stream(e,e.uint32(),`${a}.pubsub`,{limits:d.limits?.pubsub});break}case 9:{yield*ht.codec().stream(e,e.uint32(),`${a}.peerStore`,{limits:d.limits?.peerStore});break}default:{e.skipType(h&7);break}}}})),c);function l(e){return g(e,n.codec())}n.encode=l;function i(e,r){return y(e,n.codec(),r)}n.decode=i;function s(e,r){return b(e,n.codec(),r)}n.stream=s})(de||(de={}));var ue;(function(n){let t;(function(e){e.OK="OK",e.ERROR="ERROR"})(t=n.Type||(n.Type={}));let o;(function(e){e[e.OK=0]="OK",e[e.ERROR=1]="ERROR"})(o||(o={})),(function(e){e.codec=()=>M(o)})(t=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((e,r,a={})=>{if(a.lengthDelimited!==!1&&r.fork(),e.type!=null&&(r.uint32(8),n.Type.codec().encode(e.type,r)),e.error!=null&&(r.uint32(18),ot.codec().encode(e.error,r)),e.streamInfo!=null&&(r.uint32(26),rt.codec().encode(e.streamInfo,r)),e.identify!=null&&(r.uint32(34),tt.codec().encode(e.identify,r)),e.dht!=null&&(r.uint32(42),ct.codec().encode(e.dht,r)),e.peers!=null&&e.peers.length>0)for(let d of e.peers)r.uint32(50),A.codec().encode(d,r);e.pubsub!=null&&(r.uint32(58),ut.codec().encode(e.pubsub,r)),e.peerStore!=null&&(r.uint32(66),ft.codec().encode(e.peerStore,r)),a.lengthDelimited!==!1&&r.ldelim()},(e,r,a={})=>{let d={peers:[]},u=r==null?e.len:e.pos+r;for(;e.pos<u;){let h=e.uint32();switch(h>>>3){case 1:{d.type=n.Type.codec().decode(e);break}case 2:{d.error=ot.codec().decode(e,e.uint32(),{limits:a.limits?.error});break}case 3:{d.streamInfo=rt.codec().decode(e,e.uint32(),{limits:a.limits?.streamInfo});break}case 4:{d.identify=tt.codec().decode(e,e.uint32(),{limits:a.limits?.identify});break}case 5:{d.dht=ct.codec().decode(e,e.uint32(),{limits:a.limits?.dht});break}case 6:{if(a.limits?.peers!=null&&d.peers.length===a.limits.peers)throw new p('Decode error - repeated field "peers" had too many elements');d.peers.push(A.codec().decode(e,e.uint32(),{limits:a.limits?.peers$}));break}case 7:{d.pubsub=ut.codec().decode(e,e.uint32(),{limits:a.limits?.pubsub});break}case 8:{d.peerStore=ft.codec().decode(e,e.uint32(),{limits:a.limits?.peerStore});break}default:{e.skipType(h&7);break}}}return d},function*(e,r,a,d={}){let u={peers:0},h=r==null?e.len:e.pos+r;for(;e.pos<h;){let X=e.uint32();switch(X>>>3){case 1:{yield{field:`${a}.type`,value:n.Type.codec().decode(e)};break}case 2:{yield*ot.codec().stream(e,e.uint32(),`${a}.error`,{limits:d.limits?.error});break}case 3:{yield*rt.codec().stream(e,e.uint32(),`${a}.streamInfo`,{limits:d.limits?.streamInfo});break}case 4:{yield*tt.codec().stream(e,e.uint32(),`${a}.identify`,{limits:d.limits?.identify});break}case 5:{yield*ct.codec().stream(e,e.uint32(),`${a}.dht`,{limits:d.limits?.dht});break}case 6:{if(d.limits?.peers!=null&&u.peers===d.limits.peers)throw new p('Streaming decode error - repeated field "peers" had too many elements');for(let vt of A.codec().stream(e,e.uint32(),`${a}.peers[]`,{limits:d.limits?.peers$}))yield{...vt,index:u.peers};u.peers++;break}case 7:{yield*ut.codec().stream(e,e.uint32(),`${a}.pubsub`,{limits:d.limits?.pubsub});break}case 8:{yield*ft.codec().stream(e,e.uint32(),`${a}.peerStore`,{limits:d.limits?.peerStore});break}default:{e.skipType(X&7);break}}}})),c);function l(e){return g(e,n.codec())}n.encode=l;function i(e,r){return y(e,n.codec(),r)}n.decode=i;function s(e,r){return b(e,n.codec(),r)}n.stream=s})(ue||(ue={}));var tt;(function(n){let t;n.codec=()=>(t==null&&(t=E((i,s,e={})=>{if(e.lengthDelimited!==!1&&s.fork(),i.id!=null&&i.id.byteLength>0&&(s.uint32(10),s.bytes(i.id)),i.addrs!=null&&i.addrs.length>0)for(let r of i.addrs)s.uint32(18),s.bytes(r);e.lengthDelimited!==!1&&s.ldelim()},(i,s,e={})=>{let r={id:$(0),addrs:[]},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let d=i.uint32();switch(d>>>3){case 1:{r.id=i.bytes();break}case 2:{if(e.limits?.addrs!=null&&r.addrs.length===e.limits.addrs)throw new p('Decode error - repeated field "addrs" had too many elements');r.addrs.push(i.bytes());break}default:{i.skipType(d&7);break}}}return r},function*(i,s,e,r={}){let a={addrs:0},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${e}.id`,value:i.bytes()};break}case 2:{if(r.limits?.addrs!=null&&a.addrs===r.limits.addrs)throw new p('Streaming decode error - repeated field "addrs" had too many elements');yield{field:`${e}.addrs[]`,index:a.addrs,value:i.bytes()},a.addrs++;break}default:{i.skipType(u&7);break}}}})),t);function o(i){return g(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return b(i,n.codec(),s)}n.stream=l})(tt||(tt={}));var et;(function(n){let t;n.codec=()=>(t==null&&(t=E((i,s,e={})=>{if(e.lengthDelimited!==!1&&s.fork(),i.peer!=null&&i.peer.byteLength>0&&(s.uint32(10),s.bytes(i.peer)),i.addrs!=null&&i.addrs.length>0)for(let r of i.addrs)s.uint32(18),s.bytes(r);i.timeout!=null&&(s.uint32(24),s.int64(i.timeout)),e.lengthDelimited!==!1&&s.ldelim()},(i,s,e={})=>{let r={peer:$(0),addrs:[]},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let d=i.uint32();switch(d>>>3){case 1:{r.peer=i.bytes();break}case 2:{if(e.limits?.addrs!=null&&r.addrs.length===e.limits.addrs)throw new p('Decode error - repeated field "addrs" had too many elements');r.addrs.push(i.bytes());break}case 3:{r.timeout=i.int64();break}default:{i.skipType(d&7);break}}}return r},function*(i,s,e,r={}){let a={addrs:0},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${e}.peer`,value:i.bytes()};break}case 2:{if(r.limits?.addrs!=null&&a.addrs===r.limits.addrs)throw new p('Streaming decode error - repeated field "addrs" had too many elements');yield{field:`${e}.addrs[]`,index:a.addrs,value:i.bytes()},a.addrs++;break}case 3:{yield{field:`${e}.timeout`,value:i.int64()};break}default:{i.skipType(u&7);break}}}})),t);function o(i){return g(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return b(i,n.codec(),s)}n.stream=l})(et||(et={}));var nt;(function(n){let t;n.codec=()=>(t==null&&(t=E((i,s,e={})=>{if(e.lengthDelimited!==!1&&s.fork(),i.peer!=null&&i.peer.byteLength>0&&(s.uint32(10),s.bytes(i.peer)),i.proto!=null&&i.proto.length>0)for(let r of i.proto)s.uint32(18),s.string(r);i.timeout!=null&&(s.uint32(24),s.int64(i.timeout)),e.lengthDelimited!==!1&&s.ldelim()},(i,s,e={})=>{let r={peer:$(0),proto:[]},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let d=i.uint32();switch(d>>>3){case 1:{r.peer=i.bytes();break}case 2:{if(e.limits?.proto!=null&&r.proto.length===e.limits.proto)throw new p('Decode error - repeated field "proto" had too many elements');r.proto.push(i.string());break}case 3:{r.timeout=i.int64();break}default:{i.skipType(d&7);break}}}return r},function*(i,s,e,r={}){let a={proto:0},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${e}.peer`,value:i.bytes()};break}case 2:{if(r.limits?.proto!=null&&a.proto===r.limits.proto)throw new p('Streaming decode error - repeated field "proto" had too many elements');yield{field:`${e}.proto[]`,index:a.proto,value:i.string()},a.proto++;break}case 3:{yield{field:`${e}.timeout`,value:i.int64()};break}default:{i.skipType(u&7);break}}}})),t);function o(i){return g(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return b(i,n.codec(),s)}n.stream=l})(nt||(nt={}));var it;(function(n){let t;n.codec=()=>(t==null&&(t=E((i,s,e={})=>{if(e.lengthDelimited!==!1&&s.fork(),i.addr!=null&&i.addr.byteLength>0&&(s.uint32(10),s.bytes(i.addr)),i.proto!=null&&i.proto.length>0)for(let r of i.proto)s.uint32(18),s.string(r);e.lengthDelimited!==!1&&s.ldelim()},(i,s,e={})=>{let r={addr:$(0),proto:[]},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let d=i.uint32();switch(d>>>3){case 1:{r.addr=i.bytes();break}case 2:{if(e.limits?.proto!=null&&r.proto.length===e.limits.proto)throw new p('Decode error - repeated field "proto" had too many elements');r.proto.push(i.string());break}default:{i.skipType(d&7);break}}}return r},function*(i,s,e,r={}){let a={proto:0},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${e}.addr`,value:i.bytes()};break}case 2:{if(r.limits?.proto!=null&&a.proto===r.limits.proto)throw new p('Streaming decode error - repeated field "proto" had too many elements');yield{field:`${e}.proto[]`,index:a.proto,value:i.string()},a.proto++;break}default:{i.skipType(u&7);break}}}})),t);function o(i){return g(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return b(i,n.codec(),s)}n.stream=l})(it||(it={}));var ot;(function(n){let t;n.codec=()=>(t==null&&(t=E((i,s,e={})=>{e.lengthDelimited!==!1&&s.fork(),i.msg!=null&&i.msg!==""&&(s.uint32(10),s.string(i.msg)),e.lengthDelimited!==!1&&s.ldelim()},(i,s,e={})=>{let r={msg:""},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let d=i.uint32();d>>>3===1?r.msg=i.string():i.skipType(d&7)}return r},function*(i,s,e,r={}){let a=s==null?i.len:i.pos+s;for(;i.pos<a;){let d=i.uint32();d>>>3===1?yield{field:`${e}.msg`,value:i.string()}:i.skipType(d&7)}})),t);function o(i){return g(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return b(i,n.codec(),s)}n.stream=l})(ot||(ot={}));var rt;(function(n){let t;n.codec=()=>(t==null&&(t=E((i,s,e={})=>{e.lengthDelimited!==!1&&s.fork(),i.peer!=null&&i.peer.byteLength>0&&(s.uint32(10),s.bytes(i.peer)),i.addr!=null&&i.addr.byteLength>0&&(s.uint32(18),s.bytes(i.addr)),i.proto!=null&&i.proto!==""&&(s.uint32(26),s.string(i.proto)),e.lengthDelimited!==!1&&s.ldelim()},(i,s,e={})=>{let r={peer:$(0),addr:$(0),proto:""},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let d=i.uint32();switch(d>>>3){case 1:{r.peer=i.bytes();break}case 2:{r.addr=i.bytes();break}case 3:{r.proto=i.string();break}default:{i.skipType(d&7);break}}}return r},function*(i,s,e,r={}){let a=s==null?i.len:i.pos+s;for(;i.pos<a;){let d=i.uint32();switch(d>>>3){case 1:{yield{field:`${e}.peer`,value:i.bytes()};break}case 2:{yield{field:`${e}.addr`,value:i.bytes()};break}case 3:{yield{field:`${e}.proto`,value:i.string()};break}default:{i.skipType(d&7);break}}}})),t);function o(i){return g(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return b(i,n.codec(),s)}n.stream=l})(rt||(rt={}));var st;(function(n){let t;(function(e){e.FIND_PEER="FIND_PEER",e.FIND_PEERS_CONNECTED_TO_PEER="FIND_PEERS_CONNECTED_TO_PEER",e.FIND_PROVIDERS="FIND_PROVIDERS",e.GET_CLOSEST_PEERS="GET_CLOSEST_PEERS",e.GET_PUBLIC_KEY="GET_PUBLIC_KEY",e.GET_VALUE="GET_VALUE",e.SEARCH_VALUE="SEARCH_VALUE",e.PUT_VALUE="PUT_VALUE",e.PROVIDE="PROVIDE"})(t=n.Type||(n.Type={}));let o;(function(e){e[e.FIND_PEER=0]="FIND_PEER",e[e.FIND_PEERS_CONNECTED_TO_PEER=1]="FIND_PEERS_CONNECTED_TO_PEER",e[e.FIND_PROVIDERS=2]="FIND_PROVIDERS",e[e.GET_CLOSEST_PEERS=3]="GET_CLOSEST_PEERS",e[e.GET_PUBLIC_KEY=4]="GET_PUBLIC_KEY",e[e.GET_VALUE=5]="GET_VALUE",e[e.SEARCH_VALUE=6]="SEARCH_VALUE",e[e.PUT_VALUE=7]="PUT_VALUE",e[e.PROVIDE=8]="PROVIDE"})(o||(o={})),(function(e){e.codec=()=>M(o)})(t=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((e,r,a={})=>{a.lengthDelimited!==!1&&r.fork(),e.type!=null&&(r.uint32(8),n.Type.codec().encode(e.type,r)),e.peer!=null&&(r.uint32(18),r.bytes(e.peer)),e.cid!=null&&(r.uint32(26),r.bytes(e.cid)),e.key!=null&&(r.uint32(34),r.bytes(e.key)),e.value!=null&&(r.uint32(42),r.bytes(e.value)),e.count!=null&&(r.uint32(48),r.int32(e.count)),e.timeout!=null&&(r.uint32(56),r.int64(e.timeout)),a.lengthDelimited!==!1&&r.ldelim()},(e,r,a={})=>{let d={},u=r==null?e.len:e.pos+r;for(;e.pos<u;){let h=e.uint32();switch(h>>>3){case 1:{d.type=n.Type.codec().decode(e);break}case 2:{d.peer=e.bytes();break}case 3:{d.cid=e.bytes();break}case 4:{d.key=e.bytes();break}case 5:{d.value=e.bytes();break}case 6:{d.count=e.int32();break}case 7:{d.timeout=e.int64();break}default:{e.skipType(h&7);break}}}return d},function*(e,r,a,d={}){let u=r==null?e.len:e.pos+r;for(;e.pos<u;){let h=e.uint32();switch(h>>>3){case 1:{yield{field:`${a}.type`,value:n.Type.codec().decode(e)};break}case 2:{yield{field:`${a}.peer`,value:e.bytes()};break}case 3:{yield{field:`${a}.cid`,value:e.bytes()};break}case 4:{yield{field:`${a}.key`,value:e.bytes()};break}case 5:{yield{field:`${a}.value`,value:e.bytes()};break}case 6:{yield{field:`${a}.count`,value:e.int32()};break}case 7:{yield{field:`${a}.timeout`,value:e.int64()};break}default:{e.skipType(h&7);break}}}})),c);function l(e){return g(e,n.codec())}n.encode=l;function i(e,r){return y(e,n.codec(),r)}n.decode=i;function s(e,r){return b(e,n.codec(),r)}n.stream=s})(st||(st={}));var ct;(function(n){let t;(function(e){e.BEGIN="BEGIN",e.VALUE="VALUE",e.END="END"})(t=n.Type||(n.Type={}));let o;(function(e){e[e.BEGIN=0]="BEGIN",e[e.VALUE=1]="VALUE",e[e.END=2]="END"})(o||(o={})),(function(e){e.codec=()=>M(o)})(t=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((e,r,a={})=>{a.lengthDelimited!==!1&&r.fork(),e.type!=null&&(r.uint32(8),n.Type.codec().encode(e.type,r)),e.peer!=null&&(r.uint32(18),A.codec().encode(e.peer,r)),e.value!=null&&(r.uint32(26),r.bytes(e.value)),a.lengthDelimited!==!1&&r.ldelim()},(e,r,a={})=>{let d={},u=r==null?e.len:e.pos+r;for(;e.pos<u;){let h=e.uint32();switch(h>>>3){case 1:{d.type=n.Type.codec().decode(e);break}case 2:{d.peer=A.codec().decode(e,e.uint32(),{limits:a.limits?.peer});break}case 3:{d.value=e.bytes();break}default:{e.skipType(h&7);break}}}return d},function*(e,r,a,d={}){let u=r==null?e.len:e.pos+r;for(;e.pos<u;){let h=e.uint32();switch(h>>>3){case 1:{yield{field:`${a}.type`,value:n.Type.codec().decode(e)};break}case 2:{yield*A.codec().stream(e,e.uint32(),`${a}.peer`,{limits:d.limits?.peer});break}case 3:{yield{field:`${a}.value`,value:e.bytes()};break}default:{e.skipType(h&7);break}}}})),c);function l(e){return g(e,n.codec())}n.encode=l;function i(e,r){return y(e,n.codec(),r)}n.decode=i;function s(e,r){return b(e,n.codec(),r)}n.stream=s})(ct||(ct={}));var A;(function(n){let t;n.codec=()=>(t==null&&(t=E((i,s,e={})=>{if(e.lengthDelimited!==!1&&s.fork(),i.id!=null&&i.id.byteLength>0&&(s.uint32(10),s.bytes(i.id)),i.addrs!=null&&i.addrs.length>0)for(let r of i.addrs)s.uint32(18),s.bytes(r);e.lengthDelimited!==!1&&s.ldelim()},(i,s,e={})=>{let r={id:$(0),addrs:[]},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let d=i.uint32();switch(d>>>3){case 1:{r.id=i.bytes();break}case 2:{if(e.limits?.addrs!=null&&r.addrs.length===e.limits.addrs)throw new p('Decode error - repeated field "addrs" had too many elements');r.addrs.push(i.bytes());break}default:{i.skipType(d&7);break}}}return r},function*(i,s,e,r={}){let a={addrs:0},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${e}.id`,value:i.bytes()};break}case 2:{if(r.limits?.addrs!=null&&a.addrs===r.limits.addrs)throw new p('Streaming decode error - repeated field "addrs" had too many elements');yield{field:`${e}.addrs[]`,index:a.addrs,value:i.bytes()},a.addrs++;break}default:{i.skipType(u&7);break}}}})),t);function o(i){return g(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return b(i,n.codec(),s)}n.stream=l})(A||(A={}));var lt;(function(n){let t;(function(e){e.TAG_PEER="TAG_PEER",e.UNTAG_PEER="UNTAG_PEER",e.TRIM="TRIM"})(t=n.Type||(n.Type={}));let o;(function(e){e[e.TAG_PEER=0]="TAG_PEER",e[e.UNTAG_PEER=1]="UNTAG_PEER",e[e.TRIM=2]="TRIM"})(o||(o={})),(function(e){e.codec=()=>M(o)})(t=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((e,r,a={})=>{a.lengthDelimited!==!1&&r.fork(),e.type!=null&&(r.uint32(8),n.Type.codec().encode(e.type,r)),e.peer!=null&&(r.uint32(18),r.bytes(e.peer)),e.tag!=null&&(r.uint32(26),r.string(e.tag)),e.weight!=null&&(r.uint32(32),r.int64(e.weight)),a.lengthDelimited!==!1&&r.ldelim()},(e,r,a={})=>{let d={},u=r==null?e.len:e.pos+r;for(;e.pos<u;){let h=e.uint32();switch(h>>>3){case 1:{d.type=n.Type.codec().decode(e);break}case 2:{d.peer=e.bytes();break}case 3:{d.tag=e.string();break}case 4:{d.weight=e.int64();break}default:{e.skipType(h&7);break}}}return d},function*(e,r,a,d={}){let u=r==null?e.len:e.pos+r;for(;e.pos<u;){let h=e.uint32();switch(h>>>3){case 1:{yield{field:`${a}.type`,value:n.Type.codec().decode(e)};break}case 2:{yield{field:`${a}.peer`,value:e.bytes()};break}case 3:{yield{field:`${a}.tag`,value:e.string()};break}case 4:{yield{field:`${a}.weight`,value:e.int64()};break}default:{e.skipType(h&7);break}}}})),c);function l(e){return g(e,n.codec())}n.encode=l;function i(e,r){return y(e,n.codec(),r)}n.decode=i;function s(e,r){return b(e,n.codec(),r)}n.stream=s})(lt||(lt={}));var at;(function(n){let t;n.codec=()=>(t==null&&(t=E((i,s,e={})=>{e.lengthDelimited!==!1&&s.fork(),i.peer!=null&&i.peer.byteLength>0&&(s.uint32(10),s.bytes(i.peer)),e.lengthDelimited!==!1&&s.ldelim()},(i,s,e={})=>{let r={peer:$(0)},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let d=i.uint32();d>>>3===1?r.peer=i.bytes():i.skipType(d&7)}return r},function*(i,s,e,r={}){let a=s==null?i.len:i.pos+s;for(;i.pos<a;){let d=i.uint32();d>>>3===1?yield{field:`${e}.peer`,value:i.bytes()}:i.skipType(d&7)}})),t);function o(i){return g(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return b(i,n.codec(),s)}n.stream=l})(at||(at={}));var dt;(function(n){let t;(function(e){e.GET_TOPICS="GET_TOPICS",e.LIST_PEERS="LIST_PEERS",e.PUBLISH="PUBLISH",e.SUBSCRIBE="SUBSCRIBE"})(t=n.Type||(n.Type={}));let o;(function(e){e[e.GET_TOPICS=0]="GET_TOPICS",e[e.LIST_PEERS=1]="LIST_PEERS",e[e.PUBLISH=2]="PUBLISH",e[e.SUBSCRIBE=3]="SUBSCRIBE"})(o||(o={})),(function(e){e.codec=()=>M(o)})(t=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((e,r,a={})=>{a.lengthDelimited!==!1&&r.fork(),e.type!=null&&(r.uint32(8),n.Type.codec().encode(e.type,r)),e.topic!=null&&(r.uint32(18),r.string(e.topic)),e.data!=null&&(r.uint32(26),r.bytes(e.data)),a.lengthDelimited!==!1&&r.ldelim()},(e,r,a={})=>{let d={},u=r==null?e.len:e.pos+r;for(;e.pos<u;){let h=e.uint32();switch(h>>>3){case 1:{d.type=n.Type.codec().decode(e);break}case 2:{d.topic=e.string();break}case 3:{d.data=e.bytes();break}default:{e.skipType(h&7);break}}}return d},function*(e,r,a,d={}){let u=r==null?e.len:e.pos+r;for(;e.pos<u;){let h=e.uint32();switch(h>>>3){case 1:{yield{field:`${a}.type`,value:n.Type.codec().decode(e)};break}case 2:{yield{field:`${a}.topic`,value:e.string()};break}case 3:{yield{field:`${a}.data`,value:e.bytes()};break}default:{e.skipType(h&7);break}}}})),c);function l(e){return g(e,n.codec())}n.encode=l;function i(e,r){return y(e,n.codec(),r)}n.decode=i;function s(e,r){return b(e,n.codec(),r)}n.stream=s})(dt||(dt={}));var he;(function(n){let t;n.codec=()=>(t==null&&(t=E((i,s,e={})=>{if(e.lengthDelimited!==!1&&s.fork(),i.from!=null&&(s.uint32(10),s.bytes(i.from)),i.data!=null&&(s.uint32(18),s.bytes(i.data)),i.seqno!=null&&(s.uint32(26),s.bytes(i.seqno)),i.topicIDs!=null&&i.topicIDs.length>0)for(let r of i.topicIDs)s.uint32(34),s.string(r);i.signature!=null&&(s.uint32(42),s.bytes(i.signature)),i.key!=null&&(s.uint32(50),s.bytes(i.key)),e.lengthDelimited!==!1&&s.ldelim()},(i,s,e={})=>{let r={topicIDs:[]},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let d=i.uint32();switch(d>>>3){case 1:{r.from=i.bytes();break}case 2:{r.data=i.bytes();break}case 3:{r.seqno=i.bytes();break}case 4:{if(e.limits?.topicIDs!=null&&r.topicIDs.length===e.limits.topicIDs)throw new p('Decode error - repeated field "topicIDs" had too many elements');r.topicIDs.push(i.string());break}case 5:{r.signature=i.bytes();break}case 6:{r.key=i.bytes();break}default:{i.skipType(d&7);break}}}return r},function*(i,s,e,r={}){let a={topicIDs:0},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${e}.from`,value:i.bytes()};break}case 2:{yield{field:`${e}.data`,value:i.bytes()};break}case 3:{yield{field:`${e}.seqno`,value:i.bytes()};break}case 4:{if(r.limits?.topicIDs!=null&&a.topicIDs===r.limits.topicIDs)throw new p('Streaming decode error - repeated field "topicIDs" had too many elements');yield{field:`${e}.topicIDs[]`,index:a.topicIDs,value:i.string()},a.topicIDs++;break}case 5:{yield{field:`${e}.signature`,value:i.bytes()};break}case 6:{yield{field:`${e}.key`,value:i.bytes()};break}default:{i.skipType(u&7);break}}}})),t);function o(i){return g(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return b(i,n.codec(),s)}n.stream=l})(he||(he={}));var ut;(function(n){let t;n.codec=()=>(t==null&&(t=E((i,s,e={})=>{if(e.lengthDelimited!==!1&&s.fork(),i.topics!=null&&i.topics.length>0)for(let r of i.topics)s.uint32(10),s.string(r);if(i.peerIDs!=null&&i.peerIDs.length>0)for(let r of i.peerIDs)s.uint32(18),s.bytes(r);e.lengthDelimited!==!1&&s.ldelim()},(i,s,e={})=>{let r={topics:[],peerIDs:[]},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let d=i.uint32();switch(d>>>3){case 1:{if(e.limits?.topics!=null&&r.topics.length===e.limits.topics)throw new p('Decode error - repeated field "topics" had too many elements');r.topics.push(i.string());break}case 2:{if(e.limits?.peerIDs!=null&&r.peerIDs.length===e.limits.peerIDs)throw new p('Decode error - repeated field "peerIDs" had too many elements');r.peerIDs.push(i.bytes());break}default:{i.skipType(d&7);break}}}return r},function*(i,s,e,r={}){let a={topics:0,peerIDs:0},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let u=i.uint32();switch(u>>>3){case 1:{if(r.limits?.topics!=null&&a.topics===r.limits.topics)throw new p('Streaming decode error - repeated field "topics" had too many elements');yield{field:`${e}.topics[]`,index:a.topics,value:i.string()},a.topics++;break}case 2:{if(r.limits?.peerIDs!=null&&a.peerIDs===r.limits.peerIDs)throw new p('Streaming decode error - repeated field "peerIDs" had too many elements');yield{field:`${e}.peerIDs[]`,index:a.peerIDs,value:i.bytes()},a.peerIDs++;break}default:{i.skipType(u&7);break}}}})),t);function o(i){return g(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return b(i,n.codec(),s)}n.stream=l})(ut||(ut={}));var ht;(function(n){let t;(function(e){e.UNSPECIFIED="UNSPECIFIED",e.GET_PROTOCOLS="GET_PROTOCOLS",e.GET_PEER_INFO="GET_PEER_INFO"})(t=n.Type||(n.Type={}));let o;(function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.GET_PROTOCOLS=1]="GET_PROTOCOLS",e[e.GET_PEER_INFO=2]="GET_PEER_INFO"})(o||(o={})),(function(e){e.codec=()=>M(o)})(t=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((e,r,a={})=>{if(a.lengthDelimited!==!1&&r.fork(),e.type!=null&&(r.uint32(8),n.Type.codec().encode(e.type,r)),e.id!=null&&(r.uint32(18),r.bytes(e.id)),e.protos!=null&&e.protos.length>0)for(let d of e.protos)r.uint32(26),r.string(d);a.lengthDelimited!==!1&&r.ldelim()},(e,r,a={})=>{let d={protos:[]},u=r==null?e.len:e.pos+r;for(;e.pos<u;){let h=e.uint32();switch(h>>>3){case 1:{d.type=n.Type.codec().decode(e);break}case 2:{d.id=e.bytes();break}case 3:{if(a.limits?.protos!=null&&d.protos.length===a.limits.protos)throw new p('Decode error - repeated field "protos" had too many elements');d.protos.push(e.string());break}default:{e.skipType(h&7);break}}}return d},function*(e,r,a,d={}){let u={protos:0},h=r==null?e.len:e.pos+r;for(;e.pos<h;){let X=e.uint32();switch(X>>>3){case 1:{yield{field:`${a}.type`,value:n.Type.codec().decode(e)};break}case 2:{yield{field:`${a}.id`,value:e.bytes()};break}case 3:{if(d.limits?.protos!=null&&u.protos===d.limits.protos)throw new p('Streaming decode error - repeated field "protos" had too many elements');yield{field:`${a}.protos[]`,index:u.protos,value:e.string()},u.protos++;break}default:{e.skipType(X&7);break}}}})),c);function l(e){return g(e,n.codec())}n.encode=l;function i(e,r){return y(e,n.codec(),r)}n.decode=i;function s(e,r){return b(e,n.codec(),r)}n.stream=s})(ht||(ht={}));var ft;(function(n){let t;n.codec=()=>(t==null&&(t=E((i,s,e={})=>{if(e.lengthDelimited!==!1&&s.fork(),i.peer!=null&&(s.uint32(10),A.codec().encode(i.peer,s)),i.protos!=null&&i.protos.length>0)for(let r of i.protos)s.uint32(18),s.string(r);e.lengthDelimited!==!1&&s.ldelim()},(i,s,e={})=>{let r={protos:[]},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let d=i.uint32();switch(d>>>3){case 1:{r.peer=A.codec().decode(i,i.uint32(),{limits:e.limits?.peer});break}case 2:{if(e.limits?.protos!=null&&r.protos.length===e.limits.protos)throw new p('Decode error - repeated field "protos" had too many elements');r.protos.push(i.string());break}default:{i.skipType(d&7);break}}}return r},function*(i,s,e,r={}){let a={protos:0},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let u=i.uint32();switch(u>>>3){case 1:{yield*A.codec().stream(i,i.uint32(),`${e}.peer`,{limits:r.limits?.peer});break}case 2:{if(r.limits?.protos!=null&&a.protos===r.limits.protos)throw new p('Streaming decode error - repeated field "protos" had too many elements');yield{field:`${e}.protos[]`,index:a.protos,value:i.string()},a.protos++;break}default:{i.skipType(u&7);break}}}})),t);function o(i){return g(i,n.codec())}n.encode=o;function c(i,s){return y(i,n.codec(),s)}n.decode=c;function l(i,s){return b(i,n.codec(),s)}n.stream=l})(ft||(ft={}));return sn(Ti);})();
|
|
3
3
|
return Libp2PDaemonProtocol}));
|
|
4
4
|
//# sourceMappingURL=index.min.js.map
|