@libp2p/daemon-protocol 8.0.3 → 8.0.4-2a3e54738

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