@libp2p/daemon-protocol 8.0.10 → 8.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.min.js CHANGED
@@ -1,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 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);})();
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){let o=gt.decode(n,t),c=gt.decode.bytes;if(c>9)throw new RangeError("Invalid varint: too long");if(c>1&&n[t+c-1]===0)throw new RangeError("Invalid varint: not minimally encoded");return[o,c]}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