@libp2p/daemon-protocol 7.0.2 → 7.0.4

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
@@ -1,3 +1,5 @@
1
+ # @libp2p/daemon-protocol
2
+
1
3
  [![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
2
4
  [![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)
3
5
  [![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p-daemon.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-daemon)
@@ -19,8 +21,8 @@ $ npm i @libp2p/daemon-protocol
19
21
 
20
22
  Licensed under either of
21
23
 
22
- - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
23
- - MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
24
+ - Apache 2.0, ([LICENSE-APACHE](https://github.com/libp2p/js-libp2p-daemon/blob/main/packages/libp2p-daemon-protocol/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
25
+ - MIT ([LICENSE-MIT](https://github.com/libp2p/js-libp2p-daemon/blob/main/packages/libp2p-daemon-protocol/LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
24
26
 
25
27
  # Contribution
26
28
 
package/dist/index.min.js CHANGED
@@ -1,3 +1,3 @@
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 Je=Object.getOwnPropertyDescriptor;var We=Object.getOwnPropertyNames;var Qe=Object.prototype.hasOwnProperty;var E=(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 We(e))!Qe.call(r,n)&&n!==t&&St(r,n,{get:()=>e[n],enumerable:!(i=Je(e,n))||i.enumerable});return r};var He=r=>Ve(St({},"__esModule",{value:!0}),r);var mr={};E(mr,{ConnManagerRequest:()=>at,ConnectRequest:()=>it,DHTRequest:()=>lt,DHTResponse:()=>dt,DisconnectRequest:()=>ut,ErrorResponse:()=>ct,IdentifyResponse:()=>rt,PSMessage:()=>se,PSRequest:()=>ft,PSResponse:()=>pt,PeerInfo:()=>F,PeerstoreRequest:()=>mt,PeerstoreResponse:()=>xt,Request:()=>ie,Response:()=>oe,StreamHandlerRequest:()=>st,StreamInfo:()=>ht,StreamOpenRequest:()=>ot});function B(r=0){return new Uint8Array(r)}var Ze=Math.pow(2,7),Ye=Math.pow(2,14),qe=Math.pow(2,21),ce=Math.pow(2,28),he=Math.pow(2,35),le=Math.pow(2,42),de=Math.pow(2,49),m=128,O=127;function H(r){if(r<Ze)return 1;if(r<Ye)return 2;if(r<qe)return 3;if(r<ce)return 4;if(r<he)return 5;if(r<le)return 6;if(r<de)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function ae(r,e,t=0){switch(H(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 ue(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)*le,t<m)||(t=r[e+7],i+=(t&O)*de,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 xe(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 je=BigInt(Number.MAX_SAFE_INTEGER),tn=BigInt(Number.MIN_SAFE_INTEGER),g=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 G;if(e<je&&e>tn)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>Ee&&(n=0n,++i>Ee&&(i=0n))),new r(Number(n),Number(i))}static fromNumber(e){if(e===0)return G;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):G}},G=new g(0,0);G.toBigInt=function(){return 0n};G.zzEncode=G.zzDecode=function(){return this};G.length=function(){return 1};var Ee=4294967296n;function ge(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 Ut(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 k(r,e){return RangeError(`index out of range: ${r.pos} + ${e??1} > ${r.len}`)}function bt(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}var wt=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,k(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 k(this,4);return bt(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw k(this,4);return bt(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw k(this,4);let e=pe(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw k(this,4);let e=xe(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 k(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 k(this,e);this.pos+=e}else do if(this.pos>=this.len)throw k(this);while(this.buf[this.pos++]&128);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 g(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 k(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 k(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 k(this,8);let e=bt(this.buf,this.pos+=4),t=bt(this.buf,this.pos+=4);return new g(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=ue(this.buf,this.pos);return this.pos+=H(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 Ct(r){return new wt(r instanceof Uint8Array?r:r.subarray())}function a(r,e,t){let i=Ct(r);return e.decode(i,void 0,t)}var Ot={};E(Ot,{base10:()=>cn});var wr=new Uint8Array(0);function Ne(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function C(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function Ie(r){return new TextEncoder().encode(r)}function ke(r){return new TextDecoder().decode(r)}function en(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),_=Math.log(c)/Math.log(256),b=Math.log(256)/Math.log(c);function $(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var x=0,R=0,N=0,S=l.length;N!==S&&l[N]===0;)N++,x++;for(var A=(S-N)*b+1>>>0,y=new Uint8Array(A);N!==S;){for(var D=l[N],L=0,I=A-1;(D!==0||L<R)&&I!==-1;I--,L++)D+=256*y[I]>>>0,y[I]=D%c>>>0,D=D/c>>>0;if(D!==0)throw new Error("Non-zero carry");R=L,N++}for(var w=A-R;w!==A&&y[w]===0;)w++;for(var gt=h.repeat(x);w<A;++w)gt+=r.charAt(y[w]);return gt}function Et(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var x=0;if(l[x]!==" "){for(var R=0,N=0;l[x]===h;)R++,x++;for(var S=(l.length-x)*_+1>>>0,A=new Uint8Array(S);l[x];){var y=t[l.charCodeAt(x)];if(y===255)return;for(var D=0,L=S-1;(y!==0||D<N)&&L!==-1;L--,D++)y+=c*A[L]>>>0,A[L]=y%256>>>0,y=y/256>>>0;if(y!==0)throw new Error("Non-zero carry");N=D,x++}if(l[x]!==" "){for(var I=S-N;I!==S&&A[I]===0;)I++;for(var w=new Uint8Array(R+(S-I)),gt=R;I!==S;)w[gt++]=A[I++];return w}}}function Ke(l){var x=Et(l);if(x)return x;throw new Error(`Non-${e} character`)}return{encode:$,decodeUnsafe:Et,decode:Ke}}var nn=en,rn=nn,Ae=rn;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")}},Ft=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)}},Lt=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 Lt({...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 Ft(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function X({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 X({prefix:e,name:r,encode:i,decode:o=>C(n(o))})}function on(r,e,t,i){let n={};for(let b=0;b<e.length;++b)n[e[b]]=b;let o=r.length;for(;r[o-1]==="=";)--o;let s=new Uint8Array(o*t/8|0),c=0,h=0,_=0;for(let b=0;b<o;++b){let $=n[r[b]];if($===void 0)throw new SyntaxError(`Non-${i} character`);h=h<<t|$,c+=t,c>=8&&(c-=8,s[_++]=255&h>>c)}if(c>=t||255&h<<8-c)throw new SyntaxError("Unexpected end of data");return s}function sn(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;)o+="=";return o}function d({name:r,prefix:e,bitsPerChar:t,alphabet:i}){return X({prefix:e,name:r,encode(n){return sn(n,i,t)},decode(n){return on(n,i,t,r)}})}var cn=M({prefix:"9",name:"base10",alphabet:"0123456789"});var Pt={};E(Pt,{base16:()=>hn,base16upper:()=>ln});var hn=d({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ln=d({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Mt={};E(Mt,{base2:()=>dn});var dn=d({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Rt={};E(Rt,{base256emoji:()=>mn});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}"),an=Ue.reduce((r,e,t)=>(r[t]=e,r),[]),un=Ue.reduce((r,e,t)=>{let i=e.codePointAt(0);if(i==null)throw new Error(`Invalid character: ${e}`);return r[i]=t,r},[]);function fn(r){return r.reduce((e,t)=>(e+=an[t],e),"")}function pn(r){let e=[];for(let t of r){let i=t.codePointAt(0);if(i==null)throw new Error(`Invalid character: ${t}`);let n=un[i];if(n==null)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var mn=X({prefix:"\u{1F680}",name:"base256emoji",encode:fn,decode:pn});var Gt={};E(Gt,{base32:()=>K,base32hex:()=>bn,base32hexpad:()=>Nn,base32hexpadupper:()=>In,base32hexupper:()=>yn,base32pad:()=>En,base32padupper:()=>gn,base32upper:()=>xn,base32z:()=>kn});var K=d({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),xn=d({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),En=d({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),gn=d({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),bn=d({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),yn=d({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Nn=d({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),In=d({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),kn=d({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var vt={};E(vt,{base36:()=>Z,base36upper:()=>Sn});var Z=M({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Sn=M({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var zt={};E(zt,{base58btc:()=>U,base58flickr:()=>An});var U=M({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),An=M({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var _t={};E(_t,{base64:()=>Dn,base64pad:()=>Un,base64url:()=>wn,base64urlpad:()=>Cn});var Dn=d({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Un=d({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wn=d({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Cn=d({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var $t={};E($t,{base8:()=>Tn});var Tn=d({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Xt={};E(Xt,{identity:()=>Fn});var Fn=X({prefix:"\0",name:"identity",encode:r=>ke(r),decode:r=>Ie(r)});var Kr=new TextEncoder,Jr=new TextDecoder;var Jt={};E(Jt,{identity:()=>tr});var On=Te,we=128,Pn=127,Mn=~Pn,Rn=Math.pow(2,31);function Te(r,e,t){e=e||[],t=t||0;for(var i=t;r>=Rn;)e[t++]=r&255|we,r/=128;for(;r&Mn;)e[t++]=r&255|we,r>>>=7;return e[t]=r|0,Te.bytes=t-i+1,e}var Gn=Kt,vn=128,Ce=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&Ce)<<n:(s&Ce)*Math.pow(2,n),n+=7}while(s>=vn);return Kt.bytes=o-i,t}var zn=Math.pow(2,7),_n=Math.pow(2,14),$n=Math.pow(2,21),Xn=Math.pow(2,28),Kn=Math.pow(2,35),Jn=Math.pow(2,42),Wn=Math.pow(2,49),Qn=Math.pow(2,56),Vn=Math.pow(2,63),Hn=function(r){return r<zn?1:r<_n?2:r<$n?3:r<Xn?4:r<Kn?5:r<Jn?6:r<Wn?7:r<Qn?8:r<Vn?9:10},Zn={encode:On,decode:Gn,encodingLength:Hn},Yn=Zn,Y=Yn;function q(r,e=0){return[Y.decode(r,e),Y.decode.bytes]}function J(r,e,t=0){return Y.encode(r,e,t),e}function W(r){return Y.encodingLength(r)}function v(r,e){let t=e.byteLength,i=W(r),n=i+W(t),o=new Uint8Array(n+t);return J(r,o,0),J(t,o,i),o.set(e,n),new Q(r,t,e,o)}function Fe(r){let e=C(r),[t,i]=q(e),[n,o]=q(e.subarray(i)),s=e.subarray(i+o);if(s.byteLength!==n)throw new Error("Incorrect length");return new Q(t,n,s,e)}function Le(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&Ne(r.bytes,t.bytes)}}var Q=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,qn="identity",Oe=C;function jn(r){return v(Be,Oe(r))}var tr={code:Be,name:qn,encode:Oe,digest:jn};var Vt={};E(Vt,{sha256:()=>er,sha512:()=>nr});function Qt({name:r,code:e,encode:t}){return new Wt(r,e,t)}var Wt=class{name;code;encode;constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?v(this.code,t):t.then(i=>v(this.code,i))}else throw Error("Unknown type, must be binary type")}};function Me(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var er=Qt({name:"sha2-256",code:18,encode:Me("SHA-256")}),nr=Qt({name:"sha2-512",code:19,encode:Me("SHA-512")});function Re(r,e){let{bytes:t,version:i}=r;switch(i){case 0:return ir(t,Ht(r),e??U.encoder);default:return or(t,Ht(r),e??K.encoder)}}var Ge=new WeakMap;function Ht(r){let e=Ge.get(r);if(e==null){let t=new Map;return Ge.set(r,t),t}return e}var Nt=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!==tt)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==sr)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=v(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&&Le(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??ve(i,n,o.bytes))}else if(t[cr]===!0){let{version:i,multihash:n,code:o}=t,s=Fe(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!==tt)throw new Error(`Version 0 CID must use dag-pb (code: ${tt}) block encoding`);return new r(e,t,i,i.bytes)}case 1:{let n=ve(e,t,i.bytes);return new r(e,t,i,n)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,tt,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=C(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 Q(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[$,Et]=q(e.subarray(t));return t+=Et,$},n=i(),o=tt;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(),_=t+h,b=_-s;return{version:n,codec:o,multihashCode:c,digestSize:h,multihashSize:b,size:_}}static parse(e,t){let[i,n]=rr(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 Ht(o).set(i,e),o}};function rr(r,e){switch(r[0]){case"Q":{let t=e??U;return[U.prefix,t.decode(`${U.prefix}${r}`)]}case U.prefix:{let t=e??U;return[U.prefix,t.decode(r)]}case K.prefix:{let t=e??K;return[K.prefix,t.decode(r)]}case Z.prefix:{let t=e??Z;return[Z.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 ir(r,e,t){let{prefix:i}=t;if(i!==U.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 or(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 tt=112,sr=18;function ve(r,e,t){let i=W(r),n=i+W(e),o=new Uint8Array(n+t.byteLength);return J(r,o,0),J(e,o,i),o.set(t,n),o}var cr=Symbol.for("@ipld/js-cid/CID");var Zt={...Xt,...Mt,...$t,...Ot,...Pt,...Gt,...vt,...zt,..._t,...Rt},fi={...Vt,...Jt};function _e(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}var ze=_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}),hr={utf8:ze,"utf-8":ze,hex:Zt.base16,latin1:Yt,ascii:Yt,binary:Yt,...Zt},$e=hr;function Xe(r,e="utf8"){let t=$e[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&&(n=(n|7)+1),c}}var z=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}},lr=qt();function dr(r){return globalThis.Buffer!=null?B(r):lr(r)}var nt=class{len;head;tail;states;constructor(){this.len=0,this.head=new z(jt,0,0),this.tail=this.head,this.states=null}_push(e,t,i){return this.tail=this.tail.next=new z(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,g.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let t=g.fromBigInt(e);return this._push(It,t.length(),t)}uint64Number(e){return this._push(ae,H(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=g.fromBigInt(e).zzEncode();return this._push(It,t.length(),t)}sint64Number(e){let t=g.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(et,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let t=g.fromBigInt(e);return this._push(et,4,t.lo)._push(et,4,t.hi)}fixed64Number(e){let t=g.fromNumber(e);return this._push(et,4,t.lo)._push(et,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(ur,t,e)}string(e){let t=ge(e);return t!==0?this.uint32(t)._push(Ut,t,e):this._push(te,1,0)}fork(){return this.states=new ee(this),this.head=this.tail=new z(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 z(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=dr(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 ar(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}var ne=class extends z{next;constructor(e,t){super(ar,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 et(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 ur(r,e,t){e.set(r,t)}globalThis.Buffer!=null&&(nt.prototype.bytes=function(r){let e=r.length>>>0;return this.uint32(e),e>0&&this._push(fr,e,r),this},nt.prototype.string=function(r){let e=globalThis.Buffer.byteLength(r);return this.uint32(e),e>0&&this._push(pr,e,r),this});function fr(r,e,t){e.set(r,t)}function pr(r,e,t){r.length<40?Ut(r,e,t):e.utf8Write!=null?e.utf8Write(r,t):e.set(Xe(r),t)}function re(){return new nt}function u(r,e){let t=re();return e.encode(r,t,{lengthDelimited:!1}),t.finish()}var V;(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"})(V||(V={}));function kt(r,e,t,i){return{name:r,type:e,encode:t,decode:i}}function T(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 kt("enum",V.VARINT,t,i)}function f(r,e){return kt("message",V.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=()=>T(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),it.codec().encode(n.connect,o)),n.streamOpen!=null&&(o.uint32(26),ot.codec().encode(n.streamOpen,o)),n.streamHandler!=null&&(o.uint32(34),st.codec().encode(n.streamHandler,o)),n.dht!=null&&(o.uint32(42),lt.codec().encode(n.dht,o)),n.connManager!=null&&(o.uint32(50),at.codec().encode(n.connManager,o)),n.disconnect!=null&&(o.uint32(58),ut.codec().encode(n.disconnect,o)),n.pubsub!=null&&(o.uint32(66),ft.codec().encode(n.pubsub,o)),n.peerStore!=null&&(o.uint32(74),mt.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=it.codec().decode(n,n.uint32());break;case 3:s.streamOpen=ot.codec().decode(n,n.uint32());break;case 4:s.streamHandler=st.codec().decode(n,n.uint32());break;case 5:s.dht=lt.codec().decode(n,n.uint32());break;case 6:s.connManager=at.codec().decode(n,n.uint32());break;case 7:s.disconnect=ut.codec().decode(n,n.uint32());break;case 8:s.pubsub=ft.codec().decode(n,n.uint32());break;case 9:s.peerStore=mt.codec().decode(n,n.uint32());break;default:n.skipType(h&7);break}}return s})),i),r.encode=n=>u(n,r.codec()),r.decode=n=>a(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=()=>T(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),ct.codec().encode(n.error,o)),n.streamInfo!=null&&(o.uint32(26),ht.codec().encode(n.streamInfo,o)),n.identify!=null&&(o.uint32(34),rt.codec().encode(n.identify,o)),n.dht!=null&&(o.uint32(42),dt.codec().encode(n.dht,o)),n.peers!=null)for(let c of n.peers)o.uint32(50),F.codec().encode(c,o);n.pubsub!=null&&(o.uint32(58),pt.codec().encode(n.pubsub,o)),n.peerStore!=null&&(o.uint32(66),xt.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=ct.codec().decode(n,n.uint32());break;case 3:s.streamInfo=ht.codec().decode(n,n.uint32());break;case 4:s.identify=rt.codec().decode(n,n.uint32());break;case 5:s.dht=dt.codec().decode(n,n.uint32());break;case 6:s.peers.push(F.codec().decode(n,n.uint32()));break;case 7:s.pubsub=pt.codec().decode(n,n.uint32());break;case 8:s.peerStore=xt.codec().decode(n,n.uint32());break;default:n.skipType(h&7);break}}return s})),i),r.encode=n=>u(n,r.codec()),r.decode=n=>a(n,r.codec())})(oe||(oe={}));var rt;(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=>u(t,r.codec()),r.decode=t=>a(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.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=>u(t,r.codec()),r.decode=t=>a(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.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=>u(t,r.codec()),r.decode=t=>a(t,r.codec())})(ot||(ot={}));var st;(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=>u(t,r.codec()),r.decode=t=>a(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.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=>u(t,r.codec()),r.decode=t=>a(t,r.codec())})(ct||(ct={}));var ht;(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=>u(t,r.codec()),r.decode=t=>a(t,r.codec())})(ht||(ht={}));var lt;(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=()=>T(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=>u(n,r.codec()),r.decode=n=>a(n,r.codec())})(lt||(lt={}));var dt;(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=()=>T(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),F.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=F.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=>u(n,r.codec()),r.decode=n=>a(n,r.codec())})(dt||(dt={}));var F;(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=>u(t,r.codec()),r.decode=t=>a(t,r.codec())})(F||(F={}));var at;(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=()=>T(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=>u(n,r.codec()),r.decode=n=>a(n,r.codec())})(at||(at={}));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=>u(t,r.codec()),r.decode=t=>a(t,r.codec())})(ut||(ut={}));var ft;(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=()=>T(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=>u(n,r.codec()),r.decode=n=>a(n,r.codec())})(ft||(ft={}));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=>u(t,r.codec()),r.decode=t=>a(t,r.codec())})(se||(se={}));var pt;(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=>u(t,r.codec()),r.decode=t=>a(t,r.codec())})(pt||(pt={}));var mt;(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=()=>T(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=>u(n,r.codec()),r.decode=n=>a(n,r.codec())})(mt||(mt={}));var xt;(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),F.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=F.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=>u(t,r.codec()),r.decode=t=>a(t,r.codec())})(xt||(xt={}));return He(mr);})();
2
+ "use strict";var Libp2PDaemonProtocol=(()=>{var St=Object.defineProperty;var Je=Object.getOwnPropertyDescriptor;var We=Object.getOwnPropertyNames;var Qe=Object.prototype.hasOwnProperty;var E=(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 We(e))!Qe.call(r,n)&&n!==t&&St(r,n,{get:()=>e[n],enumerable:!(i=Je(e,n))||i.enumerable});return r};var He=r=>Ve(St({},"__esModule",{value:!0}),r);var mr={};E(mr,{ConnManagerRequest:()=>at,ConnectRequest:()=>it,DHTRequest:()=>lt,DHTResponse:()=>dt,DisconnectRequest:()=>ut,ErrorResponse:()=>ct,IdentifyResponse:()=>rt,PSMessage:()=>se,PSRequest:()=>ft,PSResponse:()=>pt,PeerInfo:()=>F,PeerstoreRequest:()=>mt,PeerstoreResponse:()=>xt,Request:()=>ie,Response:()=>oe,StreamHandlerRequest:()=>st,StreamInfo:()=>ht,StreamOpenRequest:()=>ot});function B(r=0){return new Uint8Array(r)}var Ze=Math.pow(2,7),Ye=Math.pow(2,14),qe=Math.pow(2,21),ce=Math.pow(2,28),he=Math.pow(2,35),le=Math.pow(2,42),de=Math.pow(2,49),m=128,O=127;function H(r){if(r<Ze)return 1;if(r<Ye)return 2;if(r<qe)return 3;if(r<ce)return 4;if(r<he)return 5;if(r<le)return 6;if(r<de)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function ae(r,e,t=0){switch(H(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 ue(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)*le,t<m)||(t=r[e+7],i+=(t&O)*de,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 xe(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 je=BigInt(Number.MAX_SAFE_INTEGER),tn=BigInt(Number.MIN_SAFE_INTEGER),g=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 G;if(e<je&&e>tn)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>Ee&&(n=0n,++i>Ee&&(i=0n))),new r(Number(n),Number(i))}static fromNumber(e){if(e===0)return G;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):G}},G=new g(0,0);G.toBigInt=function(){return 0n};G.zzEncode=G.zzDecode=function(){return this};G.length=function(){return 1};var Ee=4294967296n;function ge(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 Ut(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 k(r,e){return RangeError(`index out of range: ${r.pos} + ${e??1} > ${r.len}`)}function bt(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}var wt=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,k(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 k(this,4);return bt(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw k(this,4);return bt(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw k(this,4);let e=pe(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw k(this,4);let e=xe(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 k(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 k(this,e);this.pos+=e}else do if(this.pos>=this.len)throw k(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 g(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 k(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 k(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 k(this,8);let e=bt(this.buf,this.pos+=4),t=bt(this.buf,this.pos+=4);return new g(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=ue(this.buf,this.pos);return this.pos+=H(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 Ct(r){return new wt(r instanceof Uint8Array?r:r.subarray())}function a(r,e,t){let i=Ct(r);return e.decode(i,void 0,t)}var Ot={};E(Ot,{base10:()=>cn});var wr=new Uint8Array(0);function Ne(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function C(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function Ie(r){return new TextEncoder().encode(r)}function ke(r){return new TextDecoder().decode(r)}function en(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),_=Math.log(c)/Math.log(256),b=Math.log(256)/Math.log(c);function $(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var x=0,R=0,N=0,S=l.length;N!==S&&l[N]===0;)N++,x++;for(var A=(S-N)*b+1>>>0,y=new Uint8Array(A);N!==S;){for(var D=l[N],L=0,I=A-1;(D!==0||L<R)&&I!==-1;I--,L++)D+=256*y[I]>>>0,y[I]=D%c>>>0,D=D/c>>>0;if(D!==0)throw new Error("Non-zero carry");R=L,N++}for(var w=A-R;w!==A&&y[w]===0;)w++;for(var gt=h.repeat(x);w<A;++w)gt+=r.charAt(y[w]);return gt}function Et(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var x=0;if(l[x]!==" "){for(var R=0,N=0;l[x]===h;)R++,x++;for(var S=(l.length-x)*_+1>>>0,A=new Uint8Array(S);l[x];){var y=t[l.charCodeAt(x)];if(y===255)return;for(var D=0,L=S-1;(y!==0||D<N)&&L!==-1;L--,D++)y+=c*A[L]>>>0,A[L]=y%256>>>0,y=y/256>>>0;if(y!==0)throw new Error("Non-zero carry");N=D,x++}if(l[x]!==" "){for(var I=S-N;I!==S&&A[I]===0;)I++;for(var w=new Uint8Array(R+(S-I)),gt=R;I!==S;)w[gt++]=A[I++];return w}}}function Ke(l){var x=Et(l);if(x)return x;throw new Error(`Non-${e} character`)}return{encode:$,decodeUnsafe:Et,decode:Ke}}var nn=en,rn=nn,Ae=rn;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")}},Ft=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)}},Lt=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 Lt({...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 Ft(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function X({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 X({prefix:e,name:r,encode:i,decode:o=>C(n(o))})}function on(r,e,t,i){let n={};for(let b=0;b<e.length;++b)n[e[b]]=b;let o=r.length;for(;r[o-1]==="=";)--o;let s=new Uint8Array(o*t/8|0),c=0,h=0,_=0;for(let b=0;b<o;++b){let $=n[r[b]];if($===void 0)throw new SyntaxError(`Non-${i} character`);h=h<<t|$,c+=t,c>=8&&(c-=8,s[_++]=255&h>>c)}if(c>=t||(255&h<<8-c)!==0)throw new SyntaxError("Unexpected end of data");return s}function sn(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 d({name:r,prefix:e,bitsPerChar:t,alphabet:i}){return X({prefix:e,name:r,encode(n){return sn(n,i,t)},decode(n){return on(n,i,t,r)}})}var cn=M({prefix:"9",name:"base10",alphabet:"0123456789"});var Pt={};E(Pt,{base16:()=>hn,base16upper:()=>ln});var hn=d({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ln=d({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Mt={};E(Mt,{base2:()=>dn});var dn=d({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Rt={};E(Rt,{base256emoji:()=>mn});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}"),an=Ue.reduce((r,e,t)=>(r[t]=e,r),[]),un=Ue.reduce((r,e,t)=>{let i=e.codePointAt(0);if(i==null)throw new Error(`Invalid character: ${e}`);return r[i]=t,r},[]);function fn(r){return r.reduce((e,t)=>(e+=an[t],e),"")}function pn(r){let e=[];for(let t of r){let i=t.codePointAt(0);if(i==null)throw new Error(`Invalid character: ${t}`);let n=un[i];if(n==null)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var mn=X({prefix:"\u{1F680}",name:"base256emoji",encode:fn,decode:pn});var Gt={};E(Gt,{base32:()=>K,base32hex:()=>bn,base32hexpad:()=>Nn,base32hexpadupper:()=>In,base32hexupper:()=>yn,base32pad:()=>En,base32padupper:()=>gn,base32upper:()=>xn,base32z:()=>kn});var K=d({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),xn=d({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),En=d({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),gn=d({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),bn=d({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),yn=d({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Nn=d({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),In=d({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),kn=d({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var vt={};E(vt,{base36:()=>Z,base36upper:()=>Sn});var Z=M({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Sn=M({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var zt={};E(zt,{base58btc:()=>U,base58flickr:()=>An});var U=M({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),An=M({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var _t={};E(_t,{base64:()=>Dn,base64pad:()=>Un,base64url:()=>wn,base64urlpad:()=>Cn});var Dn=d({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Un=d({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wn=d({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Cn=d({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var $t={};E($t,{base8:()=>Tn});var Tn=d({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Xt={};E(Xt,{identity:()=>Fn});var Fn=X({prefix:"\0",name:"identity",encode:r=>ke(r),decode:r=>Ie(r)});var Kr=new TextEncoder,Jr=new TextDecoder;var Jt={};E(Jt,{identity:()=>tr});var On=Te,we=128,Pn=127,Mn=~Pn,Rn=Math.pow(2,31);function Te(r,e,t){e=e||[],t=t||0;for(var i=t;r>=Rn;)e[t++]=r&255|we,r/=128;for(;r&Mn;)e[t++]=r&255|we,r>>>=7;return e[t]=r|0,Te.bytes=t-i+1,e}var Gn=Kt,vn=128,Ce=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&Ce)<<n:(s&Ce)*Math.pow(2,n),n+=7}while(s>=vn);return Kt.bytes=o-i,t}var zn=Math.pow(2,7),_n=Math.pow(2,14),$n=Math.pow(2,21),Xn=Math.pow(2,28),Kn=Math.pow(2,35),Jn=Math.pow(2,42),Wn=Math.pow(2,49),Qn=Math.pow(2,56),Vn=Math.pow(2,63),Hn=function(r){return r<zn?1:r<_n?2:r<$n?3:r<Xn?4:r<Kn?5:r<Jn?6:r<Wn?7:r<Qn?8:r<Vn?9:10},Zn={encode:On,decode:Gn,encodingLength:Hn},Yn=Zn,Y=Yn;function q(r,e=0){return[Y.decode(r,e),Y.decode.bytes]}function J(r,e,t=0){return Y.encode(r,e,t),e}function W(r){return Y.encodingLength(r)}function v(r,e){let t=e.byteLength,i=W(r),n=i+W(t),o=new Uint8Array(n+t);return J(r,o,0),J(t,o,i),o.set(e,n),new Q(r,t,e,o)}function Fe(r){let e=C(r),[t,i]=q(e),[n,o]=q(e.subarray(i)),s=e.subarray(i+o);if(s.byteLength!==n)throw new Error("Incorrect length");return new Q(t,n,s,e)}function Le(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&Ne(r.bytes,t.bytes)}}var Q=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,qn="identity",Oe=C;function jn(r){return v(Be,Oe(r))}var tr={code:Be,name:qn,encode:Oe,digest:jn};var Vt={};E(Vt,{sha256:()=>er,sha512:()=>nr});function Qt({name:r,code:e,encode:t}){return new Wt(r,e,t)}var Wt=class{name;code;encode;constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?v(this.code,t):t.then(i=>v(this.code,i))}else throw Error("Unknown type, must be binary type")}};function Me(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var er=Qt({name:"sha2-256",code:18,encode:Me("SHA-256")}),nr=Qt({name:"sha2-512",code:19,encode:Me("SHA-512")});function Re(r,e){let{bytes:t,version:i}=r;switch(i){case 0:return ir(t,Ht(r),e??U.encoder);default:return or(t,Ht(r),e??K.encoder)}}var Ge=new WeakMap;function Ht(r){let e=Ge.get(r);if(e==null){let t=new Map;return Ge.set(r,t),t}return e}var Nt=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!==tt)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==sr)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=v(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&&Le(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??ve(i,n,o.bytes))}else if(t[cr]===!0){let{version:i,multihash:n,code:o}=t,s=Fe(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!==tt)throw new Error(`Version 0 CID must use dag-pb (code: ${tt}) block encoding`);return new r(e,t,i,i.bytes)}case 1:{let n=ve(e,t,i.bytes);return new r(e,t,i,n)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,tt,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=C(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 Q(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[$,Et]=q(e.subarray(t));return t+=Et,$},n=i(),o=tt;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(),_=t+h,b=_-s;return{version:n,codec:o,multihashCode:c,digestSize:h,multihashSize:b,size:_}}static parse(e,t){let[i,n]=rr(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 Ht(o).set(i,e),o}};function rr(r,e){switch(r[0]){case"Q":{let t=e??U;return[U.prefix,t.decode(`${U.prefix}${r}`)]}case U.prefix:{let t=e??U;return[U.prefix,t.decode(r)]}case K.prefix:{let t=e??K;return[K.prefix,t.decode(r)]}case Z.prefix:{let t=e??Z;return[Z.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 ir(r,e,t){let{prefix:i}=t;if(i!==U.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 or(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 tt=112,sr=18;function ve(r,e,t){let i=W(r),n=i+W(e),o=new Uint8Array(n+t.byteLength);return J(r,o,0),J(e,o,i),o.set(t,n),o}var cr=Symbol.for("@ipld/js-cid/CID");var Zt={...Xt,...Mt,...$t,...Ot,...Pt,...Gt,...vt,...zt,..._t,...Rt},fi={...Vt,...Jt};function _e(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}var ze=_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}),hr={utf8:ze,"utf-8":ze,hex:Zt.base16,latin1:Yt,ascii:Yt,binary:Yt,...Zt},$e=hr;function Xe(r,e="utf8"){let t=$e[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 z=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}},lr=qt();function dr(r){return globalThis.Buffer!=null?B(r):lr(r)}var nt=class{len;head;tail;states;constructor(){this.len=0,this.head=new z(jt,0,0),this.tail=this.head,this.states=null}_push(e,t,i){return this.tail=this.tail.next=new z(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,g.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let t=g.fromBigInt(e);return this._push(It,t.length(),t)}uint64Number(e){return this._push(ae,H(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=g.fromBigInt(e).zzEncode();return this._push(It,t.length(),t)}sint64Number(e){let t=g.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(et,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let t=g.fromBigInt(e);return this._push(et,4,t.lo)._push(et,4,t.hi)}fixed64Number(e){let t=g.fromNumber(e);return this._push(et,4,t.lo)._push(et,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(ur,t,e)}string(e){let t=ge(e);return t!==0?this.uint32(t)._push(Ut,t,e):this._push(te,1,0)}fork(){return this.states=new ee(this),this.head=this.tail=new z(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 z(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=dr(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 ar(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}var ne=class extends z{next;constructor(e,t){super(ar,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 et(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 ur(r,e,t){e.set(r,t)}globalThis.Buffer!=null&&(nt.prototype.bytes=function(r){let e=r.length>>>0;return this.uint32(e),e>0&&this._push(fr,e,r),this},nt.prototype.string=function(r){let e=globalThis.Buffer.byteLength(r);return this.uint32(e),e>0&&this._push(pr,e,r),this});function fr(r,e,t){e.set(r,t)}function pr(r,e,t){r.length<40?Ut(r,e,t):e.utf8Write!=null?e.utf8Write(r,t):e.set(Xe(r),t)}function re(){return new nt}function u(r,e){let t=re();return e.encode(r,t,{lengthDelimited:!1}),t.finish()}var V;(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"})(V||(V={}));function kt(r,e,t,i){return{name:r,type:e,encode:t,decode:i}}function T(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 kt("enum",V.VARINT,t,i)}function f(r,e){return kt("message",V.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=()=>T(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),it.codec().encode(n.connect,o)),n.streamOpen!=null&&(o.uint32(26),ot.codec().encode(n.streamOpen,o)),n.streamHandler!=null&&(o.uint32(34),st.codec().encode(n.streamHandler,o)),n.dht!=null&&(o.uint32(42),lt.codec().encode(n.dht,o)),n.connManager!=null&&(o.uint32(50),at.codec().encode(n.connManager,o)),n.disconnect!=null&&(o.uint32(58),ut.codec().encode(n.disconnect,o)),n.pubsub!=null&&(o.uint32(66),ft.codec().encode(n.pubsub,o)),n.peerStore!=null&&(o.uint32(74),mt.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=it.codec().decode(n,n.uint32());break;case 3:s.streamOpen=ot.codec().decode(n,n.uint32());break;case 4:s.streamHandler=st.codec().decode(n,n.uint32());break;case 5:s.dht=lt.codec().decode(n,n.uint32());break;case 6:s.connManager=at.codec().decode(n,n.uint32());break;case 7:s.disconnect=ut.codec().decode(n,n.uint32());break;case 8:s.pubsub=ft.codec().decode(n,n.uint32());break;case 9:s.peerStore=mt.codec().decode(n,n.uint32());break;default:n.skipType(h&7);break}}return s})),i),r.encode=n=>u(n,r.codec()),r.decode=n=>a(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=()=>T(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),ct.codec().encode(n.error,o)),n.streamInfo!=null&&(o.uint32(26),ht.codec().encode(n.streamInfo,o)),n.identify!=null&&(o.uint32(34),rt.codec().encode(n.identify,o)),n.dht!=null&&(o.uint32(42),dt.codec().encode(n.dht,o)),n.peers!=null)for(let c of n.peers)o.uint32(50),F.codec().encode(c,o);n.pubsub!=null&&(o.uint32(58),pt.codec().encode(n.pubsub,o)),n.peerStore!=null&&(o.uint32(66),xt.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=ct.codec().decode(n,n.uint32());break;case 3:s.streamInfo=ht.codec().decode(n,n.uint32());break;case 4:s.identify=rt.codec().decode(n,n.uint32());break;case 5:s.dht=dt.codec().decode(n,n.uint32());break;case 6:s.peers.push(F.codec().decode(n,n.uint32()));break;case 7:s.pubsub=pt.codec().decode(n,n.uint32());break;case 8:s.peerStore=xt.codec().decode(n,n.uint32());break;default:n.skipType(h&7);break}}return s})),i),r.encode=n=>u(n,r.codec()),r.decode=n=>a(n,r.codec())})(oe||(oe={}));var rt;(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=>u(t,r.codec()),r.decode=t=>a(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.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=>u(t,r.codec()),r.decode=t=>a(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.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=>u(t,r.codec()),r.decode=t=>a(t,r.codec())})(ot||(ot={}));var st;(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=>u(t,r.codec()),r.decode=t=>a(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.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=>u(t,r.codec()),r.decode=t=>a(t,r.codec())})(ct||(ct={}));var ht;(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=>u(t,r.codec()),r.decode=t=>a(t,r.codec())})(ht||(ht={}));var lt;(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=()=>T(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=>u(n,r.codec()),r.decode=n=>a(n,r.codec())})(lt||(lt={}));var dt;(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=()=>T(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),F.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=F.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=>u(n,r.codec()),r.decode=n=>a(n,r.codec())})(dt||(dt={}));var F;(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=>u(t,r.codec()),r.decode=t=>a(t,r.codec())})(F||(F={}));var at;(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=()=>T(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=>u(n,r.codec()),r.decode=n=>a(n,r.codec())})(at||(at={}));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=>u(t,r.codec()),r.decode=t=>a(t,r.codec())})(ut||(ut={}));var ft;(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=()=>T(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=>u(n,r.codec()),r.decode=n=>a(n,r.codec())})(ft||(ft={}));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=>u(t,r.codec()),r.decode=t=>a(t,r.codec())})(se||(se={}));var pt;(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=>u(t,r.codec()),r.decode=t=>a(t,r.codec())})(pt||(pt={}));var mt;(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=()=>T(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=>u(n,r.codec()),r.decode=n=>a(n,r.codec())})(mt||(mt={}));var xt;(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),F.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=F.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=>u(t,r.codec()),r.decode=t=>a(t,r.codec())})(xt||(xt={}));return He(mr);})();
3
3
  return Libp2PDaemonProtocol}));
@@ -5,7 +5,7 @@ export interface OnConnection {
5
5
  export declare class PassThroughUpgrader implements Upgrader {
6
6
  private readonly onConnection?;
7
7
  constructor(handler?: OnConnection);
8
- upgradeInbound(maConn: MultiaddrConnection): Promise<Connection>;
8
+ upgradeInbound(maConn: MultiaddrConnection): Promise<void>;
9
9
  upgradeOutbound(maConn: MultiaddrConnection): Promise<Connection>;
10
10
  }
11
11
  //# sourceMappingURL=upgrader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"upgrader.d.ts","sourceRoot":"","sources":["../../src/upgrader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAElF,MAAM,WAAW,YAAY;IAC3B,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAAA;CAClC;AAED,qBAAa,mBAAoB,YAAW,QAAQ;IAClD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAc;gBAE/B,OAAO,CAAC,EAAE,YAAY;IAI7B,cAAc,CAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;IAMjE,eAAe,CAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;CAIzE"}
1
+ {"version":3,"file":"upgrader.d.ts","sourceRoot":"","sources":["../../src/upgrader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAElF,MAAM,WAAW,YAAY;IAC3B,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAAA;CAClC;AAED,qBAAa,mBAAoB,YAAW,QAAQ;IAClD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAc;gBAE/B,OAAO,CAAC,EAAE,YAAY;IAI7B,cAAc,CAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3D,eAAe,CAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;CAIzE"}
@@ -5,8 +5,6 @@ export class PassThroughUpgrader {
5
5
  }
6
6
  async upgradeInbound(maConn) {
7
7
  this.onConnection?.(maConn);
8
- // @ts-expect-error should return a connection
9
- return maConn;
10
8
  }
11
9
  async upgradeOutbound(maConn) {
12
10
  // @ts-expect-error should return a connection
@@ -1 +1 @@
1
- {"version":3,"file":"upgrader.js","sourceRoot":"","sources":["../../src/upgrader.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,mBAAmB;IACb,YAAY,CAAe;IAE5C,YAAa,OAAsB;QACjC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAA;IAC7B,CAAC;IAED,KAAK,CAAC,cAAc,CAAE,MAA2B;QAC/C,IAAI,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,CAAA;QAC3B,8CAA8C;QAC9C,OAAO,MAAM,CAAA;IACf,CAAC;IAED,KAAK,CAAC,eAAe,CAAE,MAA2B;QAChD,8CAA8C;QAC9C,OAAO,MAAM,CAAA;IACf,CAAC;CACF"}
1
+ {"version":3,"file":"upgrader.js","sourceRoot":"","sources":["../../src/upgrader.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,mBAAmB;IACb,YAAY,CAAe;IAE5C,YAAa,OAAsB;QACjC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAA;IAC7B,CAAC;IAED,KAAK,CAAC,cAAc,CAAE,MAA2B;QAC/C,IAAI,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,CAAA;IAC7B,CAAC;IAED,KAAK,CAAC,eAAe,CAAE,MAA2B;QAChD,8CAA8C;QAC9C,OAAO,MAAM,CAAA;IACf,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/daemon-protocol",
3
- "version": "7.0.2",
3
+ "version": "7.0.4",
4
4
  "description": "Communication protocol between libp2p daemons and clients",
5
5
  "author": "",
6
6
  "license": "Apache-2.0 OR MIT",
@@ -61,6 +61,91 @@
61
61
  "sourceType": "module"
62
62
  }
63
63
  },
64
+ "release": {
65
+ "branches": [
66
+ "main"
67
+ ],
68
+ "plugins": [
69
+ [
70
+ "@semantic-release/commit-analyzer",
71
+ {
72
+ "preset": "conventionalcommits",
73
+ "releaseRules": [
74
+ {
75
+ "breaking": true,
76
+ "release": "major"
77
+ },
78
+ {
79
+ "revert": true,
80
+ "release": "patch"
81
+ },
82
+ {
83
+ "type": "feat",
84
+ "release": "minor"
85
+ },
86
+ {
87
+ "type": "fix",
88
+ "release": "patch"
89
+ },
90
+ {
91
+ "type": "docs",
92
+ "release": "patch"
93
+ },
94
+ {
95
+ "type": "test",
96
+ "release": "patch"
97
+ },
98
+ {
99
+ "type": "deps",
100
+ "release": "patch"
101
+ },
102
+ {
103
+ "scope": "no-release",
104
+ "release": false
105
+ }
106
+ ]
107
+ }
108
+ ],
109
+ [
110
+ "@semantic-release/release-notes-generator",
111
+ {
112
+ "preset": "conventionalcommits",
113
+ "presetConfig": {
114
+ "types": [
115
+ {
116
+ "type": "feat",
117
+ "section": "Features"
118
+ },
119
+ {
120
+ "type": "fix",
121
+ "section": "Bug Fixes"
122
+ },
123
+ {
124
+ "type": "chore",
125
+ "section": "Trivial Changes"
126
+ },
127
+ {
128
+ "type": "docs",
129
+ "section": "Documentation"
130
+ },
131
+ {
132
+ "type": "deps",
133
+ "section": "Dependencies"
134
+ },
135
+ {
136
+ "type": "test",
137
+ "section": "Tests"
138
+ }
139
+ ]
140
+ }
141
+ }
142
+ ],
143
+ "@semantic-release/changelog",
144
+ "@semantic-release/npm",
145
+ "@semantic-release/github",
146
+ "@semantic-release/git"
147
+ ]
148
+ },
64
149
  "scripts": {
65
150
  "clean": "aegir clean",
66
151
  "lint": "aegir lint",
@@ -70,14 +155,14 @@
70
155
  "release": "aegir release"
71
156
  },
72
157
  "dependencies": {
73
- "@libp2p/interface": "^2.0.0",
74
- "@libp2p/logger": "^5.0.0",
75
- "it-length-prefixed-stream": "^1.1.6",
76
- "protons-runtime": "^5.4.0",
158
+ "@libp2p/interface": "^2.2.0",
159
+ "@libp2p/logger": "^5.1.3",
160
+ "it-length-prefixed-stream": "^1.2.0",
161
+ "protons-runtime": "^5.5.0",
77
162
  "uint8arraylist": "^2.4.8"
78
163
  },
79
164
  "devDependencies": {
80
165
  "aegir": "^45.0.1",
81
- "protons": "^7.5.0"
166
+ "protons": "^7.6.0"
82
167
  }
83
168
  }
package/src/upgrader.ts CHANGED
@@ -11,10 +11,8 @@ export class PassThroughUpgrader implements Upgrader {
11
11
  this.onConnection = handler
12
12
  }
13
13
 
14
- async upgradeInbound (maConn: MultiaddrConnection): Promise<Connection> {
14
+ async upgradeInbound (maConn: MultiaddrConnection): Promise<void> {
15
15
  this.onConnection?.(maConn)
16
- // @ts-expect-error should return a connection
17
- return maConn
18
16
  }
19
17
 
20
18
  async upgradeOutbound (maConn: MultiaddrConnection): Promise<Connection> {