@libp2p/daemon-protocol 6.0.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +1 -1
- package/package.json +11 -100
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 It=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var Me=Object.prototype.hasOwnProperty;var b=(i,e)=>{for(var t in e)It(i,t,{get:e[t],enumerable:!0})},ze=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ge(e))!Me.call(i,n)&&n!==t&&It(i,n,{get:()=>e[n],enumerable:!(r=Pe(e,n))||r.enumerable});return i};var Re=i=>ze(It({},"__esModule",{value:!0}),i);var ri={};b(ri,{ConnManagerRequest:()=>lt,ConnectRequest:()=>et,DHTRequest:()=>st,DHTResponse:()=>ct,DisconnectRequest:()=>ht,ErrorResponse:()=>rt,IdentifyResponse:()=>tt,PSMessage:()=>ie,PSRequest:()=>at,PSResponse:()=>ut,PeerInfo:()=>B,PeerstoreRequest:()=>ft,PeerstoreResponse:()=>dt,Request:()=>ee,Response:()=>ne,StreamHandlerRequest:()=>it,StreamInfo:()=>ot,StreamOpenRequest:()=>nt});var kt=new Float32Array([-0]),w=new Uint8Array(kt.buffer);function re(i,e,t){kt[0]=i,e[t]=w[0],e[t+1]=w[1],e[t+2]=w[2],e[t+3]=w[3]}function oe(i,e){return w[0]=i[e],w[1]=i[e+1],w[2]=i[e+2],w[3]=i[e+3],kt[0]}var Nt=new Float64Array([-0]),p=new Uint8Array(Nt.buffer);function se(i,e,t){Nt[0]=i,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 ce(i,e){return p[0]=i[e],p[1]=i[e+1],p[2]=i[e+2],p[3]=i[e+3],p[4]=i[e+4],p[5]=i[e+5],p[6]=i[e+6],p[7]=i[e+7],Nt[0]}var $e=BigInt(Number.MAX_SAFE_INTEGER),_e=BigInt(Number.MIN_SAFE_INTEGER),g=class i{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,r=~this.hi>>>0;return t===0&&(r=r+1>>>0),-(t+r*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,r=~this.hi>>>0;return t===0&&(r=r+1>>>0),-(BigInt(t)+(BigInt(r)<<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,r=this.hi>>>24;return r===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}static fromBigInt(e){if(e===0n)return F;if(e<$e&&e>_e)return this.fromNumber(Number(e));let t=e<0n;t&&(e=-e);let r=e>>32n,n=e-(r<<32n);return t&&(r=~r|0n,n=~n|0n,++n>le&&(n=0n,++r>le&&(r=0n))),new i(Number(n),Number(r))}static fromNumber(e){if(e===0)return F;let t=e<0;t&&(e=-e);let r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)}static from(e){return typeof e=="number"?i.fromNumber(e):typeof e=="bigint"?i.fromBigInt(e):typeof e=="string"?i.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new i(e.low>>>0,e.high>>>0):F}},F=new g(0,0);F.toBigInt=function(){return 0n};F.zzEncode=F.zzDecode=function(){return this};F.length=function(){return 1};var le=4294967296n;function he(i){let e=0,t=0;for(let r=0;r<i.length;++r)t=i.charCodeAt(r),t<128?e+=1:t<2048?e+=2:(t&64512)===55296&&(i.charCodeAt(r+1)&64512)===56320?(++r,e+=4):e+=3;return e}function ae(i,e,t){if(t-e<1)return"";let n,o=[],s=0,c;for(;e<t;)c=i[e++],c<128?o[s++]=c:c>191&&c<224?o[s++]=(c&31)<<6|i[e++]&63:c>239&&c<365?(c=((c&7)<<18|(i[e++]&63)<<12|(i[e++]&63)<<6|i[e++]&63)-65536,o[s++]=55296+(c>>10),o[s++]=56320+(c&1023)):o[s++]=(c&15)<<12|(i[e++]&63)<<6|i[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 St(i,e,t){let r=t,n,o;for(let s=0;s<i.length;++s)n=i.charCodeAt(s),n<128?e[t++]=n:n<2048?(e[t++]=n>>6|192,e[t++]=n&63|128):(n&64512)===55296&&((o=i.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-r}function k(i,e){return RangeError(`index out of range: ${i.pos} + ${e??1} > ${i.len}`)}function gt(i,e){return(i[e-4]|i[e-3]<<8|i[e-2]<<16|i[e-1]<<24)>>>0}var At=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 gt(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw k(this,4);return gt(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw k(this,4);let e=oe(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw k(this,4);let e=ce(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw k(this,e);return this.pos+=e,t===r?new Uint8Array(0):this.buf.subarray(t,r)}string(){let e=this.bytes();return ae(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=gt(this.buf,this.pos+=4),t=gt(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(){return this.readLongVarint().toNumber(!0)}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 Dt(i){return new At(i instanceof Uint8Array?i:i.subarray())}function u(i,e){let t=Dt(i);return e.decode(t)}function bt(i){return globalThis.Buffer!=null?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):i}function P(i=0){return globalThis.Buffer?.allocUnsafe!=null?bt(globalThis.Buffer.allocUnsafe(i)):new Uint8Array(i)}var Lt={};b(Lt,{base10:()=>Qe});function Ke(i,e){if(i.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<i.length;n++){var o=i.charAt(n),s=o.charCodeAt(0);if(t[s]!==255)throw new TypeError(o+" is ambiguous");t[s]=n}var c=i.length,l=i.charAt(0),z=Math.log(c)/Math.log(256),E=Math.log(256)/Math.log(c);function R(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var m=0,O=0,y=0,N=h.length;y!==N&&h[y]===0;)y++,m++;for(var S=(N-y)*E+1>>>0,x=new Uint8Array(S);y!==N;){for(var A=h[y],L=0,I=S-1;(A!==0||L<O)&&I!==-1;I--,L++)A+=256*x[I]>>>0,x[I]=A%c>>>0,A=A/c>>>0;if(A!==0)throw new Error("Non-zero carry");O=L,y++}for(var U=S-O;U!==S&&x[U]===0;)U++;for(var mt=l.repeat(m);U<S;++U)mt+=i.charAt(x[U]);return mt}function pt(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var m=0;if(h[m]!==" "){for(var O=0,y=0;h[m]===l;)O++,m++;for(var N=(h.length-m)*z+1>>>0,S=new Uint8Array(N);h[m];){var x=t[h.charCodeAt(m)];if(x===255)return;for(var A=0,L=N-1;(x!==0||A<y)&&L!==-1;L--,A++)x+=c*S[L]>>>0,S[L]=x%256>>>0,x=x/256>>>0;if(x!==0)throw new Error("Non-zero carry");y=A,m++}if(h[m]!==" "){for(var I=N-y;I!==N&&S[I]===0;)I++;for(var U=new Uint8Array(O+(N-I)),mt=O;I!==N;)U[mt++]=S[I++];return U}}}function Fe(h){var m=pt(h);if(m)return m;throw new Error(`Non-${e} character`)}return{encode:R,decodeUnsafe:pt,decode:Fe}}var Je=Ke,Xe=Je,fe=Xe;var bi=new Uint8Array(0);var de=(i,e)=>{if(i===e)return!0;if(i.byteLength!==e.byteLength)return!1;for(let t=0;t<i.byteLength;t++)if(i[t]!==e[t])return!1;return!0},T=i=>{if(i instanceof Uint8Array&&i.constructor.name==="Uint8Array")return i;if(i instanceof ArrayBuffer)return new Uint8Array(i);if(ArrayBuffer.isView(i))return new Uint8Array(i.buffer,i.byteOffset,i.byteLength);throw new Error("Unknown type, must be binary type")};var pe=i=>new TextEncoder().encode(i),me=i=>new TextDecoder().decode(i);var Ut=class{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Tt=class{constructor(e,t,r){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}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 be(this,e)}},Ct=class{constructor(e){this.decoders=e}or(e){return be(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},be=(i,e)=>new Ct({...i.decoders||{[i.prefix]:i},...e.decoders||{[e.prefix]:e}}),Bt=class{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new Ut(e,t,r),this.decoder=new Tt(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},$=({name:i,prefix:e,encode:t,decode:r})=>new Bt(i,e,t,r),v=({prefix:i,name:e,alphabet:t})=>{let{encode:r,decode:n}=fe(t,e);return $({prefix:i,name:e,encode:r,decode:o=>T(n(o))})},We=(i,e,t,r)=>{let n={};for(let E=0;E<e.length;++E)n[e[E]]=E;let o=i.length;for(;i[o-1]==="=";)--o;let s=new Uint8Array(o*t/8|0),c=0,l=0,z=0;for(let E=0;E<o;++E){let R=n[i[E]];if(R===void 0)throw new SyntaxError(`Non-${r} character`);l=l<<t|R,c+=t,c>=8&&(c-=8,s[z++]=255&l>>c)}if(c>=t||255&l<<8-c)throw new SyntaxError("Unexpected end of data");return s},Ve=(i,e,t)=>{let r=e[e.length-1]==="=",n=(1<<t)-1,o="",s=0,c=0;for(let l=0;l<i.length;++l)for(c=c<<8|i[l],s+=8;s>t;)s-=t,o+=e[n&c>>s];if(s&&(o+=e[n&c<<t-s]),r)for(;o.length*t&7;)o+="=";return o},a=({name:i,prefix:e,bitsPerChar:t,alphabet:r})=>$({prefix:e,name:i,encode(n){return Ve(n,r,t)},decode(n){return We(n,r,t,i)}});var Qe=v({prefix:"9",name:"base10",alphabet:"0123456789"});var wt={};b(wt,{base16:()=>He,base16upper:()=>Ze});var He=a({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ze=a({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var vt={};b(vt,{base2:()=>Ye});var Ye=a({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ot={};b(Ot,{base256emoji:()=>nn});var Ee=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}"),qe=Ee.reduce((i,e,t)=>(i[t]=e,i),[]),je=Ee.reduce((i,e,t)=>(i[e.codePointAt(0)]=t,i),[]);function tn(i){return i.reduce((e,t)=>(e+=qe[t],e),"")}function en(i){let e=[];for(let t of i){let r=je[t.codePointAt(0)];if(r===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(r)}return new Uint8Array(e)}var nn=$({prefix:"\u{1F680}",name:"base256emoji",encode:tn,decode:en});var Ft={};b(Ft,{base32:()=>_,base32hex:()=>cn,base32hexpad:()=>hn,base32hexpadupper:()=>an,base32hexupper:()=>ln,base32pad:()=>on,base32padupper:()=>sn,base32upper:()=>rn,base32z:()=>un});var _=a({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),rn=a({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),on=a({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),sn=a({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),cn=a({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ln=a({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),hn=a({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),an=a({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),un=a({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Pt={};b(Pt,{base36:()=>fn,base36upper:()=>dn});var fn=v({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),dn=v({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Gt={};b(Gt,{base58btc:()=>D,base58flickr:()=>pn});var D=v({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),pn=v({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Mt={};b(Mt,{base64:()=>mn,base64pad:()=>gn,base64url:()=>bn,base64urlpad:()=>En});var mn=a({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),gn=a({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),bn=a({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),En=a({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var zt={};b(zt,{base8:()=>xn});var xn=a({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Rt={};b(Rt,{identity:()=>yn});var yn=$({prefix:"\0",name:"identity",encode:i=>me(i),decode:i=>pe(i)});var wi=new TextEncoder,vi=new TextDecoder;var _t={};b(_t,{identity:()=>Kn});var Nn=Ie,xe=128,Sn=127,An=~Sn,Dn=Math.pow(2,31);function Ie(i,e,t){e=e||[],t=t||0;for(var r=t;i>=Dn;)e[t++]=i&255|xe,i/=128;for(;i&An;)e[t++]=i&255|xe,i>>>=7;return e[t]=i|0,Ie.bytes=t-r+1,e}var Un=$t,Tn=128,ye=127;function $t(i,r){var t=0,r=r||0,n=0,o=r,s,c=i.length;do{if(o>=c)throw $t.bytes=0,new RangeError("Could not decode varint");s=i[o++],t+=n<28?(s&ye)<<n:(s&ye)*Math.pow(2,n),n+=7}while(s>=Tn);return $t.bytes=o-r,t}var Cn=Math.pow(2,7),Bn=Math.pow(2,14),Ln=Math.pow(2,21),wn=Math.pow(2,28),vn=Math.pow(2,35),On=Math.pow(2,42),Fn=Math.pow(2,49),Pn=Math.pow(2,56),Gn=Math.pow(2,63),Mn=function(i){return i<Cn?1:i<Bn?2:i<Ln?3:i<wn?4:i<vn?5:i<On?6:i<Fn?7:i<Pn?8:i<Gn?9:10},zn={encode:Nn,decode:Un,encodingLength:Mn},Rn=zn,V=Rn;var Q=(i,e=0)=>[V.decode(i,e),V.decode.bytes],K=(i,e,t=0)=>(V.encode(i,e,t),e),J=i=>V.encodingLength(i);var G=(i,e)=>{let t=e.byteLength,r=J(i),n=r+J(t),o=new Uint8Array(n+t);return K(i,o,0),K(t,o,r),o.set(e,n),new X(i,t,e,o)},ke=i=>{let e=T(i),[t,r]=Q(e),[n,o]=Q(e.subarray(r)),s=e.subarray(r+o);if(s.byteLength!==n)throw new Error("Incorrect length");return new X(t,n,s,e)},Ne=(i,e)=>{if(i===e)return!0;{let t=e;return i.code===t.code&&i.size===t.size&&t.bytes instanceof Uint8Array&&de(i.bytes,t.bytes)}},X=class{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};var Se=0,$n="identity",Ae=T,_n=i=>G(Se,Ae(i)),Kn={code:Se,name:$n,encode:Ae,digest:_n};var Xt={};b(Xt,{sha256:()=>Jn,sha512:()=>Xn});var Jt=({name:i,code:e,encode:t})=>new Kt(i,e,t),Kt=class{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?G(this.code,t):t.then(r=>G(this.code,r))}else throw Error("Unknown type, must be binary type")}};var Ue=i=>async e=>new Uint8Array(await crypto.subtle.digest(i,e)),Jn=Jt({name:"sha2-256",code:18,encode:Ue("SHA-256")}),Xn=Jt({name:"sha2-512",code:19,encode:Ue("SHA-512")});var Te=(i,e)=>{let{bytes:t,version:r}=i;switch(r){case 0:return Vn(t,Wt(i),e||D.encoder);default:return Qn(t,Wt(i),e||_.encoder)}};var Ce=new WeakMap,Wt=i=>{let e=Ce.get(i);if(e==null){let t=new Map;return Ce.set(i,t),t}return e},xt=class i{constructor(e,t,r,n){this.code=t,this.version=e,this.multihash=r,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!==Z)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Hn)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return i.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,r=G(e,t);return i.createV1(this.code,r)}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 i.equals(this,e)}static equals(e,t){let r=t;return r&&e.code===r.code&&e.version===r.version&&Ne(e.multihash,r.multihash)}toString(e){return Te(this,e)}toJSON(){return{"/":Te(this)}}link(){return this}get[Symbol.toStringTag](){return"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 i)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:r,code:n,multihash:o,bytes:s}=t;return new i(r,n,o,s||Be(r,n,o.bytes))}else if(t[Zn]===!0){let{version:r,multihash:n,code:o}=t,s=ke(n);return i.create(r,o,s)}else return null}static create(e,t,r){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(r.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==Z)throw new Error(`Version 0 CID must use dag-pb (code: ${Z}) block encoding`);return new i(e,t,r,r.bytes)}case 1:{let n=Be(e,t,r.bytes);return new i(e,t,r,n)}default:throw new Error("Invalid version")}}static createV0(e){return i.create(0,Z,e)}static createV1(e,t){return i.create(1,e,t)}static decode(e){let[t,r]=i.decodeFirst(e);if(r.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=i.inspectBytes(e),r=t.size-t.multihashSize,n=T(e.subarray(r,r+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");let o=n.subarray(t.multihashSize-t.digestSize),s=new X(t.multihashCode,t.digestSize,o,n);return[t.version===0?i.createV0(s):i.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0,r=()=>{let[R,pt]=Q(e.subarray(t));return t+=pt,R},n=r(),o=Z;if(n===18?(n=0,t=0):o=r(),n!==0&&n!==1)throw new RangeError(`Invalid CID version ${n}`);let s=t,c=r(),l=r(),z=t+l,E=z-s;return{version:n,codec:o,multihashCode:c,digestSize:l,multihashSize:E,size:z}}static parse(e,t){let[r,n]=Wn(e,t),o=i.decode(n);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Wt(o).set(r,e),o}},Wn=(i,e)=>{switch(i[0]){case"Q":{let t=e||D;return[D.prefix,t.decode(`${D.prefix}${i}`)]}case D.prefix:{let t=e||D;return[D.prefix,t.decode(i)]}case _.prefix:{let t=e||_;return[_.prefix,t.decode(i)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[i[0],e.decode(i)]}}},Vn=(i,e,t)=>{let{prefix:r}=t;if(r!==D.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let n=e.get(r);if(n==null){let o=t.encode(i).slice(1);return e.set(r,o),o}else return n},Qn=(i,e,t)=>{let{prefix:r}=t,n=e.get(r);if(n==null){let o=t.encode(i);return e.set(r,o),o}else return n},Z=112,Hn=18,Be=(i,e,t)=>{let r=J(i),n=r+J(e),o=new Uint8Array(n+t.byteLength);return K(i,o,0),K(e,o,r),o.set(t,n),o},Zn=Symbol.for("@ipld/js-cid/CID");var Vt={...Rt,...vt,...zt,...Lt,...wt,...Ft,...Pt,...Gt,...Mt,...Ot},Hi={...Xt,..._t};function we(i,e,t,r){return{name:i,prefix:e,encoder:{name:i,prefix:e,encode:t},decoder:{decode:r}}}var Le=we("utf8","u",i=>"u"+new TextDecoder("utf8").decode(i),i=>new TextEncoder().encode(i.substring(1))),Qt=we("ascii","a",i=>{let e="a";for(let t=0;t<i.length;t++)e+=String.fromCharCode(i[t]);return e},i=>{i=i.substring(1);let e=P(i.length);for(let t=0;t<i.length;t++)e[t]=i.charCodeAt(t);return e}),Yn={utf8:Le,"utf-8":Le,hex:Vt.base16,latin1:Qt,ascii:Qt,binary:Qt,...Vt},ve=Yn;function Oe(i,e="utf8"){let t=ve[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?bt(globalThis.Buffer.from(i,"utf-8")):t.decoder.decode(`${t.prefix}${i}`)}function Ht(i){let e=i??8192,t=e>>>1,r,n=e;return function(s){if(s<1||s>t)return P(s);n+s>e&&(r=P(e),n=0);let c=r.subarray(n,n+=s);return n&7&&(n=(n|7)+1),c}}var M=class{fn;len;next;val;constructor(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}};function Zt(){}var qt=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},qn=Ht();function jn(i){return globalThis.Buffer!=null?P(i):qn(i)}var j=class{len;head;tail;states;constructor(){this.len=0,this.head=new M(Zt,0,0),this.tail=this.head,this.states=null}_push(e,t,r){return this.tail=this.tail.next=new M(e,t,r),this.len+=t,this}uint32(e){return this.len+=(this.tail=this.tail.next=new jt((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(Y,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(Y,t.length(),t)}uint64Number(e){let t=g.fromNumber(e);return this._push(Y,t.length(),t)}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(Y,t.length(),t)}sint64Number(e){let t=g.fromNumber(e).zzEncode();return this._push(Y,t.length(),t)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(Yt,1,e?1:0)}fixed32(e){return this._push(q,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let t=g.fromBigInt(e);return this._push(q,4,t.lo)._push(q,4,t.hi)}fixed64Number(e){let t=g.fromNumber(e);return this._push(q,4,t.lo)._push(q,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(re,4,e)}double(e){return this._push(se,8,e)}bytes(e){let t=e.length>>>0;return t===0?this._push(Yt,1,0):this.uint32(t)._push(ei,t,e)}string(e){let t=he(e);return t!==0?this.uint32(t)._push(St,t,e):this._push(Yt,1,0)}fork(){return this.states=new qt(this),this.head=this.tail=new M(Zt,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 M(Zt,0,0),this.len=0),this}ldelim(){let e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r!==0&&(this.tail.next=e.next,this.tail=t,this.len+=r),this}finish(){let e=this.head.next,t=jn(this.len),r=0;for(;e!=null;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t}};function Yt(i,e,t){e[t]=i&255}function ti(i,e,t){for(;i>127;)e[t++]=i&127|128,i>>>=7;e[t]=i}var jt=class extends M{next;constructor(e,t){super(ti,e,t),this.next=void 0}};function Y(i,e,t){for(;i.hi!==0;)e[t++]=i.lo&127|128,i.lo=(i.lo>>>7|i.hi<<25)>>>0,i.hi>>>=7;for(;i.lo>127;)e[t++]=i.lo&127|128,i.lo=i.lo>>>7;e[t++]=i.lo}function q(i,e,t){e[t]=i&255,e[t+1]=i>>>8&255,e[t+2]=i>>>16&255,e[t+3]=i>>>24}function ei(i,e,t){e.set(i,t)}globalThis.Buffer!=null&&(j.prototype.bytes=function(i){let e=i.length>>>0;return this.uint32(e),e>0&&this._push(ni,e,i),this},j.prototype.string=function(i){let e=globalThis.Buffer.byteLength(i);return this.uint32(e),e>0&&this._push(ii,e,i),this});function ni(i,e,t){e.set(i,t)}function ii(i,e,t){i.length<40?St(i,e,t):e.utf8Write!=null?e.utf8Write(i,t):e.set(Oe(i),t)}function te(){return new j}function f(i,e){let t=te();return e.encode(i,t,{lengthDelimited:!1}),t.finish()}var W;(function(i){i[i.VARINT=0]="VARINT",i[i.BIT64=1]="BIT64",i[i.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",i[i.START_GROUP=3]="START_GROUP",i[i.END_GROUP=4]="END_GROUP",i[i.BIT32=5]="BIT32"})(W||(W={}));function yt(i,e,t,r){return{name:i,type:e,encode:t,decode:r}}function C(i){function e(n){if(i[n.toString()]==null)throw new Error("Invalid enum value");return i[n]}let t=function(o,s){let c=e(o);s.int32(c)},r=function(o){let s=o.int32();return e(s)};return yt("enum",W.VARINT,t,r)}function d(i,e){return yt("message",W.LENGTH_DELIMITED,i,e)}var ee;(function(i){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=i.Type||(i.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=()=>C(t)}(e=i.Type||(i.Type={}));let r;i.codec=()=>(r==null&&(r=d((n,o,s={})=>{s.lengthDelimited!==!1&&o.fork(),n.type!=null&&(o.uint32(8),i.Type.codec().encode(n.type,o)),n.connect!=null&&(o.uint32(18),et.codec().encode(n.connect,o)),n.streamOpen!=null&&(o.uint32(26),nt.codec().encode(n.streamOpen,o)),n.streamHandler!=null&&(o.uint32(34),it.codec().encode(n.streamHandler,o)),n.dht!=null&&(o.uint32(42),st.codec().encode(n.dht,o)),n.connManager!=null&&(o.uint32(50),lt.codec().encode(n.connManager,o)),n.disconnect!=null&&(o.uint32(58),ht.codec().encode(n.disconnect,o)),n.pubsub!=null&&(o.uint32(66),at.codec().encode(n.pubsub,o)),n.peerStore!=null&&(o.uint32(74),ft.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 l=n.uint32();switch(l>>>3){case 1:s.type=i.Type.codec().decode(n);break;case 2:s.connect=et.codec().decode(n,n.uint32());break;case 3:s.streamOpen=nt.codec().decode(n,n.uint32());break;case 4:s.streamHandler=it.codec().decode(n,n.uint32());break;case 5:s.dht=st.codec().decode(n,n.uint32());break;case 6:s.connManager=lt.codec().decode(n,n.uint32());break;case 7:s.disconnect=ht.codec().decode(n,n.uint32());break;case 8:s.pubsub=at.codec().decode(n,n.uint32());break;case 9:s.peerStore=ft.codec().decode(n,n.uint32());break;default:n.skipType(l&7);break}}return s})),r),i.encode=n=>f(n,i.codec()),i.decode=n=>u(n,i.codec())})(ee||(ee={}));var ne;(function(i){let e;(function(n){n.OK="OK",n.ERROR="ERROR"})(e=i.Type||(i.Type={}));let t;(function(n){n[n.OK=0]="OK",n[n.ERROR=1]="ERROR"})(t||(t={})),function(n){n.codec=()=>C(t)}(e=i.Type||(i.Type={}));let r;i.codec=()=>(r==null&&(r=d((n,o,s={})=>{if(s.lengthDelimited!==!1&&o.fork(),n.type!=null&&(o.uint32(8),i.Type.codec().encode(n.type,o)),n.error!=null&&(o.uint32(18),rt.codec().encode(n.error,o)),n.streamInfo!=null&&(o.uint32(26),ot.codec().encode(n.streamInfo,o)),n.identify!=null&&(o.uint32(34),tt.codec().encode(n.identify,o)),n.dht!=null&&(o.uint32(42),ct.codec().encode(n.dht,o)),n.peers!=null)for(let c of n.peers)o.uint32(50),B.codec().encode(c,o);n.pubsub!=null&&(o.uint32(58),ut.codec().encode(n.pubsub,o)),n.peerStore!=null&&(o.uint32(66),dt.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 l=n.uint32();switch(l>>>3){case 1:s.type=i.Type.codec().decode(n);break;case 2:s.error=rt.codec().decode(n,n.uint32());break;case 3:s.streamInfo=ot.codec().decode(n,n.uint32());break;case 4:s.identify=tt.codec().decode(n,n.uint32());break;case 5:s.dht=ct.codec().decode(n,n.uint32());break;case 6:s.peers.push(B.codec().decode(n,n.uint32()));break;case 7:s.pubsub=ut.codec().decode(n,n.uint32());break;case 8:s.peerStore=dt.codec().decode(n,n.uint32());break;default:n.skipType(l&7);break}}return s})),r),i.encode=n=>f(n,i.codec()),i.decode=n=>u(n,i.codec())})(ne||(ne={}));var tt;(function(i){let e;i.codec=()=>(e==null&&(e=d((t,r,n={})=>{if(n.lengthDelimited!==!1&&r.fork(),t.id!=null&&t.id.byteLength>0&&(r.uint32(10),r.bytes(t.id)),t.addrs!=null)for(let o of t.addrs)r.uint32(18),r.bytes(o);n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={id:new Uint8Array(0),addrs:[]},o=r==null?t.len:t.pos+r;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),i.encode=t=>f(t,i.codec()),i.decode=t=>u(t,i.codec())})(tt||(tt={}));var et;(function(i){let e;i.codec=()=>(e==null&&(e=d((t,r,n={})=>{if(n.lengthDelimited!==!1&&r.fork(),t.peer!=null&&t.peer.byteLength>0&&(r.uint32(10),r.bytes(t.peer)),t.addrs!=null)for(let o of t.addrs)r.uint32(18),r.bytes(o);t.timeout!=null&&(r.uint32(24),r.int64(t.timeout)),n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={peer:new Uint8Array(0),addrs:[]},o=r==null?t.len:t.pos+r;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),i.encode=t=>f(t,i.codec()),i.decode=t=>u(t,i.codec())})(et||(et={}));var nt;(function(i){let e;i.codec=()=>(e==null&&(e=d((t,r,n={})=>{if(n.lengthDelimited!==!1&&r.fork(),t.peer!=null&&t.peer.byteLength>0&&(r.uint32(10),r.bytes(t.peer)),t.proto!=null)for(let o of t.proto)r.uint32(18),r.string(o);t.timeout!=null&&(r.uint32(24),r.int64(t.timeout)),n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={peer:new Uint8Array(0),proto:[]},o=r==null?t.len:t.pos+r;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),i.encode=t=>f(t,i.codec()),i.decode=t=>u(t,i.codec())})(nt||(nt={}));var it;(function(i){let e;i.codec=()=>(e==null&&(e=d((t,r,n={})=>{if(n.lengthDelimited!==!1&&r.fork(),t.addr!=null&&t.addr.byteLength>0&&(r.uint32(10),r.bytes(t.addr)),t.proto!=null)for(let o of t.proto)r.uint32(18),r.string(o);n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={addr:new Uint8Array(0),proto:[]},o=r==null?t.len:t.pos+r;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),i.encode=t=>f(t,i.codec()),i.decode=t=>u(t,i.codec())})(it||(it={}));var rt;(function(i){let e;i.codec=()=>(e==null&&(e=d((t,r,n={})=>{n.lengthDelimited!==!1&&r.fork(),t.msg!=null&&t.msg!==""&&(r.uint32(10),r.string(t.msg)),n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={msg:""},o=r==null?t.len:t.pos+r;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),i.encode=t=>f(t,i.codec()),i.decode=t=>u(t,i.codec())})(rt||(rt={}));var ot;(function(i){let e;i.codec=()=>(e==null&&(e=d((t,r,n={})=>{n.lengthDelimited!==!1&&r.fork(),t.peer!=null&&t.peer.byteLength>0&&(r.uint32(10),r.bytes(t.peer)),t.addr!=null&&t.addr.byteLength>0&&(r.uint32(18),r.bytes(t.addr)),t.proto!=null&&t.proto!==""&&(r.uint32(26),r.string(t.proto)),n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={peer:new Uint8Array(0),addr:new Uint8Array(0),proto:""},o=r==null?t.len:t.pos+r;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),i.encode=t=>f(t,i.codec()),i.decode=t=>u(t,i.codec())})(ot||(ot={}));var st;(function(i){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=i.Type||(i.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=()=>C(t)}(e=i.Type||(i.Type={}));let r;i.codec=()=>(r==null&&(r=d((n,o,s={})=>{s.lengthDelimited!==!1&&o.fork(),n.type!=null&&(o.uint32(8),i.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 l=n.uint32();switch(l>>>3){case 1:s.type=i.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(l&7);break}}return s})),r),i.encode=n=>f(n,i.codec()),i.decode=n=>u(n,i.codec())})(st||(st={}));var ct;(function(i){let e;(function(n){n.BEGIN="BEGIN",n.VALUE="VALUE",n.END="END"})(e=i.Type||(i.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=()=>C(t)}(e=i.Type||(i.Type={}));let r;i.codec=()=>(r==null&&(r=d((n,o,s={})=>{s.lengthDelimited!==!1&&o.fork(),n.type!=null&&(o.uint32(8),i.Type.codec().encode(n.type,o)),n.peer!=null&&(o.uint32(18),B.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 l=n.uint32();switch(l>>>3){case 1:s.type=i.Type.codec().decode(n);break;case 2:s.peer=B.codec().decode(n,n.uint32());break;case 3:s.value=n.bytes();break;default:n.skipType(l&7);break}}return s})),r),i.encode=n=>f(n,i.codec()),i.decode=n=>u(n,i.codec())})(ct||(ct={}));var B;(function(i){let e;i.codec=()=>(e==null&&(e=d((t,r,n={})=>{if(n.lengthDelimited!==!1&&r.fork(),t.id!=null&&t.id.byteLength>0&&(r.uint32(10),r.bytes(t.id)),t.addrs!=null)for(let o of t.addrs)r.uint32(18),r.bytes(o);n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={id:new Uint8Array(0),addrs:[]},o=r==null?t.len:t.pos+r;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),i.encode=t=>f(t,i.codec()),i.decode=t=>u(t,i.codec())})(B||(B={}));var lt;(function(i){let e;(function(n){n.TAG_PEER="TAG_PEER",n.UNTAG_PEER="UNTAG_PEER",n.TRIM="TRIM"})(e=i.Type||(i.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=()=>C(t)}(e=i.Type||(i.Type={}));let r;i.codec=()=>(r==null&&(r=d((n,o,s={})=>{s.lengthDelimited!==!1&&o.fork(),n.type!=null&&(o.uint32(8),i.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 l=n.uint32();switch(l>>>3){case 1:s.type=i.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(l&7);break}}return s})),r),i.encode=n=>f(n,i.codec()),i.decode=n=>u(n,i.codec())})(lt||(lt={}));var ht;(function(i){let e;i.codec=()=>(e==null&&(e=d((t,r,n={})=>{n.lengthDelimited!==!1&&r.fork(),t.peer!=null&&t.peer.byteLength>0&&(r.uint32(10),r.bytes(t.peer)),n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={peer:new Uint8Array(0)},o=r==null?t.len:t.pos+r;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),i.encode=t=>f(t,i.codec()),i.decode=t=>u(t,i.codec())})(ht||(ht={}));var at;(function(i){let e;(function(n){n.GET_TOPICS="GET_TOPICS",n.LIST_PEERS="LIST_PEERS",n.PUBLISH="PUBLISH",n.SUBSCRIBE="SUBSCRIBE"})(e=i.Type||(i.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=()=>C(t)}(e=i.Type||(i.Type={}));let r;i.codec=()=>(r==null&&(r=d((n,o,s={})=>{s.lengthDelimited!==!1&&o.fork(),n.type!=null&&(o.uint32(8),i.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 l=n.uint32();switch(l>>>3){case 1:s.type=i.Type.codec().decode(n);break;case 2:s.topic=n.string();break;case 3:s.data=n.bytes();break;default:n.skipType(l&7);break}}return s})),r),i.encode=n=>f(n,i.codec()),i.decode=n=>u(n,i.codec())})(at||(at={}));var ie;(function(i){let e;i.codec=()=>(e==null&&(e=d((t,r,n={})=>{if(n.lengthDelimited!==!1&&r.fork(),t.from!=null&&(r.uint32(10),r.bytes(t.from)),t.data!=null&&(r.uint32(18),r.bytes(t.data)),t.seqno!=null&&(r.uint32(26),r.bytes(t.seqno)),t.topicIDs!=null)for(let o of t.topicIDs)r.uint32(34),r.string(o);t.signature!=null&&(r.uint32(42),r.bytes(t.signature)),t.key!=null&&(r.uint32(50),r.bytes(t.key)),n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={topicIDs:[]},o=r==null?t.len:t.pos+r;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),i.encode=t=>f(t,i.codec()),i.decode=t=>u(t,i.codec())})(ie||(ie={}));var ut;(function(i){let e;i.codec=()=>(e==null&&(e=d((t,r,n={})=>{if(n.lengthDelimited!==!1&&r.fork(),t.topics!=null)for(let o of t.topics)r.uint32(10),r.string(o);if(t.peerIDs!=null)for(let o of t.peerIDs)r.uint32(18),r.bytes(o);n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={topics:[],peerIDs:[]},o=r==null?t.len:t.pos+r;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),i.encode=t=>f(t,i.codec()),i.decode=t=>u(t,i.codec())})(ut||(ut={}));var ft;(function(i){let e;(function(n){n.UNSPECIFIED="UNSPECIFIED",n.GET_PROTOCOLS="GET_PROTOCOLS",n.GET_PEER_INFO="GET_PEER_INFO"})(e=i.Type||(i.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=()=>C(t)}(e=i.Type||(i.Type={}));let r;i.codec=()=>(r==null&&(r=d((n,o,s={})=>{if(s.lengthDelimited!==!1&&o.fork(),n.type!=null&&(o.uint32(8),i.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 l=n.uint32();switch(l>>>3){case 1:s.type=i.Type.codec().decode(n);break;case 2:s.id=n.bytes();break;case 3:s.protos.push(n.string());break;default:n.skipType(l&7);break}}return s})),r),i.encode=n=>f(n,i.codec()),i.decode=n=>u(n,i.codec())})(ft||(ft={}));var dt;(function(i){let e;i.codec=()=>(e==null&&(e=d((t,r,n={})=>{if(n.lengthDelimited!==!1&&r.fork(),t.peer!=null&&(r.uint32(10),B.codec().encode(t.peer,r)),t.protos!=null)for(let o of t.protos)r.uint32(18),r.string(o);n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={protos:[]},o=r==null?t.len:t.pos+r;for(;t.pos<o;){let s=t.uint32();switch(s>>>3){case 1:n.peer=B.codec().decode(t,t.uint32());break;case 2:n.protos.push(t.string());break;default:t.skipType(s&7);break}}return n})),e),i.encode=t=>f(t,i.codec()),i.decode=t=>u(t,i.codec())})(dt||(dt={}));return Re(ri);})();
|
|
2
|
+
"use strict";var Libp2PDaemonProtocol=(()=>{var kt=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var Je=Object.getOwnPropertyNames;var We=Object.prototype.hasOwnProperty;var E=(i,e)=>{for(var t in e)kt(i,t,{get:e[t],enumerable:!0})},Qe=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Je(e))!We.call(i,n)&&n!==t&&kt(i,n,{get:()=>e[n],enumerable:!(r=Ke(e,n))||r.enumerable});return i};var Ve=i=>Qe(kt({},"__esModule",{value:!0}),i);var mi={};E(mi,{ConnManagerRequest:()=>dt,ConnectRequest:()=>it,DHTRequest:()=>ht,DHTResponse:()=>lt,DisconnectRequest:()=>at,ErrorResponse:()=>st,IdentifyResponse:()=>nt,PSMessage:()=>oe,PSRequest:()=>ut,PSResponse:()=>ft,PeerInfo:()=>F,PeerstoreRequest:()=>pt,PeerstoreResponse:()=>mt,Request:()=>ie,Response:()=>re,StreamHandlerRequest:()=>ot,StreamInfo:()=>ct,StreamOpenRequest:()=>rt});function B(i=0){return new Uint8Array(i)}var He=Math.pow(2,7),Ze=Math.pow(2,14),Ye=Math.pow(2,21),se=Math.pow(2,28),ce=Math.pow(2,35),he=Math.pow(2,42),le=Math.pow(2,49),m=128,O=127;function H(i){if(i<He)return 1;if(i<Ze)return 2;if(i<Ye)return 3;if(i<se)return 4;if(i<ce)return 5;if(i<he)return 6;if(i<le)return 7;if(Number.MAX_SAFE_INTEGER!=null&&i>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function de(i,e,t=0){switch(H(i)){case 8:e[t++]=i&255|m,i/=128;case 7:e[t++]=i&255|m,i/=128;case 6:e[t++]=i&255|m,i/=128;case 5:e[t++]=i&255|m,i/=128;case 4:e[t++]=i&255|m,i>>>=7;case 3:e[t++]=i&255|m,i>>>=7;case 2:e[t++]=i&255|m,i>>>=7;case 1:{e[t++]=i&255,i>>>=7;break}default:throw new Error("unreachable")}return e}function ae(i,e){let t=i[e],r=0;if(r+=t&O,t<m||(t=i[e+1],r+=(t&O)<<7,t<m)||(t=i[e+2],r+=(t&O)<<14,t<m)||(t=i[e+3],r+=(t&O)<<21,t<m)||(t=i[e+4],r+=(t&O)*se,t<m)||(t=i[e+5],r+=(t&O)*ce,t<m)||(t=i[e+6],r+=(t&O)*he,t<m)||(t=i[e+7],r+=(t&O)*le,t<m))return r;throw new RangeError("Could not decode varint")}var St=new Float32Array([-0]),P=new Uint8Array(St.buffer);function ue(i,e,t){St[0]=i,e[t]=P[0],e[t+1]=P[1],e[t+2]=P[2],e[t+3]=P[3]}function fe(i,e){return P[0]=i[e],P[1]=i[e+1],P[2]=i[e+2],P[3]=i[e+3],St[0]}var At=new Float64Array([-0]),p=new Uint8Array(At.buffer);function pe(i,e,t){At[0]=i,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 me(i,e){return p[0]=i[e],p[1]=i[e+1],p[2]=i[e+2],p[3]=i[e+3],p[4]=i[e+4],p[5]=i[e+5],p[6]=i[e+6],p[7]=i[e+7],At[0]}var qe=BigInt(Number.MAX_SAFE_INTEGER),je=BigInt(Number.MIN_SAFE_INTEGER),g=class i{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,r=~this.hi>>>0;return t===0&&(r=r+1>>>0),-(t+r*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,r=~this.hi>>>0;return t===0&&(r=r+1>>>0),-(BigInt(t)+(BigInt(r)<<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,r=this.hi>>>24;return r===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}static fromBigInt(e){if(e===0n)return G;if(e<qe&&e>je)return this.fromNumber(Number(e));let t=e<0n;t&&(e=-e);let r=e>>32n,n=e-(r<<32n);return t&&(r=~r|0n,n=~n|0n,++n>xe&&(n=0n,++r>xe&&(r=0n))),new i(Number(n),Number(r))}static fromNumber(e){if(e===0)return G;let t=e<0;t&&(e=-e);let r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)}static from(e){return typeof e=="number"?i.fromNumber(e):typeof e=="bigint"?i.fromBigInt(e):typeof e=="string"?i.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new i(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 xe=4294967296n;function Ee(i){let e=0,t=0;for(let r=0;r<i.length;++r)t=i.charCodeAt(r),t<128?e+=1:t<2048?e+=2:(t&64512)===55296&&(i.charCodeAt(r+1)&64512)===56320?(++r,e+=4):e+=3;return e}function ge(i,e,t){if(t-e<1)return"";let n,o=[],s=0,c;for(;e<t;)c=i[e++],c<128?o[s++]=c:c>191&&c<224?o[s++]=(c&31)<<6|i[e++]&63:c>239&&c<365?(c=((c&7)<<18|(i[e++]&63)<<12|(i[e++]&63)<<6|i[e++]&63)-65536,o[s++]=55296+(c>>10),o[s++]=56320+(c&1023)):o[s++]=(c&15)<<12|(i[e++]&63)<<6|i[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 Dt(i,e,t){let r=t,n,o;for(let s=0;s<i.length;++s)n=i.charCodeAt(s),n<128?e[t++]=n:n<2048?(e[t++]=n>>6|192,e[t++]=n&63|128):(n&64512)===55296&&((o=i.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-r}function k(i,e){return RangeError(`index out of range: ${i.pos} + ${e??1} > ${i.len}`)}function gt(i,e){return(i[e-4]|i[e-3]<<8|i[e-2]<<16|i[e-1]<<24)>>>0}var Ut=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,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 gt(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw k(this,4);return gt(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw k(this,4);let e=fe(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw k(this,4);let e=me(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw k(this,e);return this.pos+=e,t===r?new Uint8Array(0):this.buf.subarray(t,r)}string(){let e=this.bytes();return ge(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=gt(this.buf,this.pos+=4),t=gt(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=ae(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 wt(i){return new Ut(i instanceof Uint8Array?i:i.subarray())}function a(i,e,t){let r=wt(i);return e.decode(r,void 0,t)}var Bt={};E(Bt,{base10:()=>sn});var wi=new Uint8Array(0);function ye(i,e){if(i===e)return!0;if(i.byteLength!==e.byteLength)return!1;for(let t=0;t<i.byteLength;t++)if(i[t]!==e[t])return!1;return!0}function T(i){if(i instanceof Uint8Array&&i.constructor.name==="Uint8Array")return i;if(i instanceof ArrayBuffer)return new Uint8Array(i);if(ArrayBuffer.isView(i))return new Uint8Array(i.buffer,i.byteOffset,i.byteLength);throw new Error("Unknown type, must be binary type")}function Ne(i){return new TextEncoder().encode(i)}function Ie(i){return new TextDecoder().decode(i)}function tn(i,e){if(i.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<i.length;n++){var o=i.charAt(n),s=o.charCodeAt(0);if(t[s]!==255)throw new TypeError(o+" is ambiguous");t[s]=n}var c=i.length,h=i.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 Et=h.repeat(x);w<A;++w)Et+=i.charAt(y[w]);return Et}function xt(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)),Et=R;I!==S;)w[Et++]=A[I++];return w}}}function Xe(l){var x=xt(l);if(x)return x;throw new Error(`Non-${e} character`)}return{encode:$,decodeUnsafe:xt,decode:Xe}}var en=tn,nn=en,Se=nn;var Tt=class{name;prefix;baseEncode;constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Ct=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,r){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}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 Ae(this,e)}},Ft=class{decoders;constructor(e){this.decoders=e}or(e){return Ae(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Ae(i,e){return new Ft({...i.decoders??{[i.prefix]:i},...e.decoders??{[e.prefix]:e}})}var Lt=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new Tt(e,t,r),this.decoder=new Ct(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function X({name:i,prefix:e,encode:t,decode:r}){return new Lt(i,e,t,r)}function M({name:i,prefix:e,alphabet:t}){let{encode:r,decode:n}=Se(t,i);return X({prefix:e,name:i,encode:r,decode:o=>T(n(o))})}function rn(i,e,t,r){let n={};for(let b=0;b<e.length;++b)n[e[b]]=b;let o=i.length;for(;i[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[i[b]];if($===void 0)throw new SyntaxError(`Non-${r} 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 on(i,e,t){let r=e[e.length-1]==="=",n=(1<<t)-1,o="",s=0,c=0;for(let h=0;h<i.length;++h)for(c=c<<8|i[h],s+=8;s>t;)s-=t,o+=e[n&c>>s];if(s!==0&&(o+=e[n&c<<t-s]),r)for(;o.length*t&7;)o+="=";return o}function d({name:i,prefix:e,bitsPerChar:t,alphabet:r}){return X({prefix:e,name:i,encode(n){return on(n,r,t)},decode(n){return rn(n,r,t,i)}})}var sn=M({prefix:"9",name:"base10",alphabet:"0123456789"});var Ot={};E(Ot,{base16:()=>cn,base16upper:()=>hn});var cn=d({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),hn=d({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Pt={};E(Pt,{base2:()=>ln});var ln=d({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Mt={};E(Mt,{base256emoji:()=>pn});var De=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),dn=De.reduce((i,e,t)=>(i[t]=e,i),[]),an=De.reduce((i,e,t)=>(i[e.codePointAt(0)]=t,i),[]);function un(i){return i.reduce((e,t)=>(e+=dn[t],e),"")}function fn(i){let e=[];for(let t of i){let r=an[t.codePointAt(0)];if(r===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(r)}return new Uint8Array(e)}var pn=X({prefix:"\u{1F680}",name:"base256emoji",encode:un,decode:fn});var Rt={};E(Rt,{base32:()=>K,base32hex:()=>gn,base32hexpad:()=>yn,base32hexpadupper:()=>Nn,base32hexupper:()=>bn,base32pad:()=>xn,base32padupper:()=>En,base32upper:()=>mn,base32z:()=>In});var K=d({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),mn=d({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),xn=d({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),En=d({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),gn=d({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),bn=d({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),yn=d({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Nn=d({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),In=d({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Gt={};E(Gt,{base36:()=>kn,base36upper:()=>Sn});var kn=M({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Sn=M({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var vt={};E(vt,{base58btc:()=>U,base58flickr:()=>An});var U=M({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),An=M({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var zt={};E(zt,{base64:()=>Dn,base64pad:()=>Un,base64url:()=>wn,base64urlpad:()=>Tn});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}),Tn=d({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var _t={};E(_t,{base8:()=>Cn});var Cn=d({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var $t={};E($t,{identity:()=>Fn});var Fn=X({prefix:"\0",name:"identity",encode:i=>Ie(i),decode:i=>Ne(i)});var Ki=new TextEncoder,Ji=new TextDecoder;var Kt={};E(Kt,{identity:()=>ti});var On=Te,Ue=128,Pn=127,Mn=~Pn,Rn=Math.pow(2,31);function Te(i,e,t){e=e||[],t=t||0;for(var r=t;i>=Rn;)e[t++]=i&255|Ue,i/=128;for(;i&Mn;)e[t++]=i&255|Ue,i>>>=7;return e[t]=i|0,Te.bytes=t-r+1,e}var Gn=Xt,vn=128,we=127;function Xt(i,r){var t=0,r=r||0,n=0,o=r,s,c=i.length;do{if(o>=c)throw Xt.bytes=0,new RangeError("Could not decode varint");s=i[o++],t+=n<28?(s&we)<<n:(s&we)*Math.pow(2,n),n+=7}while(s>=vn);return Xt.bytes=o-r,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(i){return i<zn?1:i<_n?2:i<$n?3:i<Xn?4:i<Kn?5:i<Jn?6:i<Wn?7:i<Qn?8:i<Vn?9:10},Zn={encode:On,decode:Gn,encodingLength:Hn},Yn=Zn,Z=Yn;function Y(i,e=0){return[Z.decode(i,e),Z.decode.bytes]}function J(i,e,t=0){return Z.encode(i,e,t),e}function W(i){return Z.encodingLength(i)}function v(i,e){let t=e.byteLength,r=W(i),n=r+W(t),o=new Uint8Array(n+t);return J(i,o,0),J(t,o,r),o.set(e,n),new Q(i,t,e,o)}function Ce(i){let e=T(i),[t,r]=Y(e),[n,o]=Y(e.subarray(r)),s=e.subarray(r+o);if(s.byteLength!==n)throw new Error("Incorrect length");return new Q(t,n,s,e)}function Fe(i,e){if(i===e)return!0;{let t=e;return i.code===t.code&&i.size===t.size&&t.bytes instanceof Uint8Array&&ye(i.bytes,t.bytes)}}var Q=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};var Le=0,qn="identity",Be=T;function jn(i){return v(Le,Be(i))}var ti={code:Le,name:qn,encode:Be,digest:jn};var Qt={};E(Qt,{sha256:()=>ei,sha512:()=>ni});function Wt({name:i,code:e,encode:t}){return new Jt(i,e,t)}var Jt=class{name;code;encode;constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?v(this.code,t):t.then(r=>v(this.code,r))}else throw Error("Unknown type, must be binary type")}};function Pe(i){return async e=>new Uint8Array(await crypto.subtle.digest(i,e))}var ei=Wt({name:"sha2-256",code:18,encode:Pe("SHA-256")}),ni=Wt({name:"sha2-512",code:19,encode:Pe("SHA-512")});function Me(i,e){let{bytes:t,version:r}=i;switch(r){case 0:return ri(t,Vt(i),e??U.encoder);default:return oi(t,Vt(i),e??K.encoder)}}var Re=new WeakMap;function Vt(i){let e=Re.get(i);if(e==null){let t=new Map;return Re.set(i,t),t}return e}var yt=class i{code;version;multihash;bytes;"/";constructor(e,t,r,n){this.code=t,this.version=e,this.multihash=r,this.bytes=n,this["/"]=n}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==j)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==si)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return i.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,r=v(e,t);return i.createV1(this.code,r)}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 i.equals(this,e)}static equals(e,t){let r=t;return r!=null&&e.code===r.code&&e.version===r.version&&Fe(e.multihash,r.multihash)}toString(e){return Me(this,e)}toJSON(){return{"/":Me(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 i)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:r,code:n,multihash:o,bytes:s}=t;return new i(r,n,o,s??Ge(r,n,o.bytes))}else if(t[ci]===!0){let{version:r,multihash:n,code:o}=t,s=Ce(n);return i.create(r,o,s)}else return null}static create(e,t,r){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(r.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==j)throw new Error(`Version 0 CID must use dag-pb (code: ${j}) block encoding`);return new i(e,t,r,r.bytes)}case 1:{let n=Ge(e,t,r.bytes);return new i(e,t,r,n)}default:throw new Error("Invalid version")}}static createV0(e){return i.create(0,j,e)}static createV1(e,t){return i.create(1,e,t)}static decode(e){let[t,r]=i.decodeFirst(e);if(r.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=i.inspectBytes(e),r=t.size-t.multihashSize,n=T(e.subarray(r,r+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?i.createV0(s):i.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0,r=()=>{let[$,xt]=Y(e.subarray(t));return t+=xt,$},n=r(),o=j;if(n===18?(n=0,t=0):o=r(),n!==0&&n!==1)throw new RangeError(`Invalid CID version ${n}`);let s=t,c=r(),h=r(),_=t+h,b=_-s;return{version:n,codec:o,multihashCode:c,digestSize:h,multihashSize:b,size:_}}static parse(e,t){let[r,n]=ii(e,t),o=i.decode(n);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Vt(o).set(r,e),o}};function ii(i,e){switch(i[0]){case"Q":{let t=e??U;return[U.prefix,t.decode(`${U.prefix}${i}`)]}case U.prefix:{let t=e??U;return[U.prefix,t.decode(i)]}case K.prefix:{let t=e??K;return[K.prefix,t.decode(i)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[i[0],e.decode(i)]}}}function ri(i,e,t){let{prefix:r}=t;if(r!==U.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let n=e.get(r);if(n==null){let o=t.encode(i).slice(1);return e.set(r,o),o}else return n}function oi(i,e,t){let{prefix:r}=t,n=e.get(r);if(n==null){let o=t.encode(i);return e.set(r,o),o}else return n}var j=112,si=18;function Ge(i,e,t){let r=W(i),n=r+W(e),o=new Uint8Array(n+t.byteLength);return J(i,o,0),J(e,o,r),o.set(t,n),o}var ci=Symbol.for("@ipld/js-cid/CID");var Ht={...$t,...Pt,..._t,...Bt,...Ot,...Rt,...Gt,...vt,...zt,...Mt},ur={...Qt,...Kt};function ze(i,e,t,r){return{name:i,prefix:e,encoder:{name:i,prefix:e,encode:t},decoder:{decode:r}}}var ve=ze("utf8","u",i=>"u"+new TextDecoder("utf8").decode(i),i=>new TextEncoder().encode(i.substring(1))),Zt=ze("ascii","a",i=>{let e="a";for(let t=0;t<i.length;t++)e+=String.fromCharCode(i[t]);return e},i=>{i=i.substring(1);let e=B(i.length);for(let t=0;t<i.length;t++)e[t]=i.charCodeAt(t);return e}),hi={utf8:ve,"utf-8":ve,hex:Ht.base16,latin1:Zt,ascii:Zt,binary:Zt,...Ht},_e=hi;function $e(i,e="utf8"){let t=_e[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${i}`)}function Yt(i){let e=i??8192,t=e>>>1,r,n=e;return function(s){if(s<1||s>t)return B(s);n+s>e&&(r=B(e),n=0);let c=r.subarray(n,n+=s);return n&7&&(n=(n|7)+1),c}}var z=class{fn;len;next;val;constructor(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}};function qt(){}var te=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},li=Yt();function di(i){return globalThis.Buffer!=null?B(i):li(i)}var et=class{len;head;tail;states;constructor(){this.len=0,this.head=new z(qt,0,0),this.tail=this.head,this.states=null}_push(e,t,r){return this.tail=this.tail.next=new z(e,t,r),this.len+=t,this}uint32(e){return this.len+=(this.tail=this.tail.next=new ee((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(Nt,10,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(Nt,t.length(),t)}uint64Number(e){return this._push(de,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(Nt,t.length(),t)}sint64Number(e){let t=g.fromNumber(e).zzEncode();return this._push(Nt,t.length(),t)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(jt,1,e?1:0)}fixed32(e){return this._push(tt,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let t=g.fromBigInt(e);return this._push(tt,4,t.lo)._push(tt,4,t.hi)}fixed64Number(e){let t=g.fromNumber(e);return this._push(tt,4,t.lo)._push(tt,4,t.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(ue,4,e)}double(e){return this._push(pe,8,e)}bytes(e){let t=e.length>>>0;return t===0?this._push(jt,1,0):this.uint32(t)._push(ui,t,e)}string(e){let t=Ee(e);return t!==0?this.uint32(t)._push(Dt,t,e):this._push(jt,1,0)}fork(){return this.states=new te(this),this.head=this.tail=new z(qt,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(qt,0,0),this.len=0),this}ldelim(){let e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r!==0&&(this.tail.next=e.next,this.tail=t,this.len+=r),this}finish(){let e=this.head.next,t=di(this.len),r=0;for(;e!=null;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t}};function jt(i,e,t){e[t]=i&255}function ai(i,e,t){for(;i>127;)e[t++]=i&127|128,i>>>=7;e[t]=i}var ee=class extends z{next;constructor(e,t){super(ai,e,t),this.next=void 0}};function Nt(i,e,t){for(;i.hi!==0;)e[t++]=i.lo&127|128,i.lo=(i.lo>>>7|i.hi<<25)>>>0,i.hi>>>=7;for(;i.lo>127;)e[t++]=i.lo&127|128,i.lo=i.lo>>>7;e[t++]=i.lo}function tt(i,e,t){e[t]=i&255,e[t+1]=i>>>8&255,e[t+2]=i>>>16&255,e[t+3]=i>>>24}function ui(i,e,t){e.set(i,t)}globalThis.Buffer!=null&&(et.prototype.bytes=function(i){let e=i.length>>>0;return this.uint32(e),e>0&&this._push(fi,e,i),this},et.prototype.string=function(i){let e=globalThis.Buffer.byteLength(i);return this.uint32(e),e>0&&this._push(pi,e,i),this});function fi(i,e,t){e.set(i,t)}function pi(i,e,t){i.length<40?Dt(i,e,t):e.utf8Write!=null?e.utf8Write(i,t):e.set($e(i),t)}function ne(){return new et}function u(i,e){let t=ne();return e.encode(i,t,{lengthDelimited:!1}),t.finish()}var V;(function(i){i[i.VARINT=0]="VARINT",i[i.BIT64=1]="BIT64",i[i.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",i[i.START_GROUP=3]="START_GROUP",i[i.END_GROUP=4]="END_GROUP",i[i.BIT32=5]="BIT32"})(V||(V={}));function It(i,e,t,r){return{name:i,type:e,encode:t,decode:r}}function C(i){function e(n){if(i[n.toString()]==null)throw new Error("Invalid enum value");return i[n]}let t=function(o,s){let c=e(o);s.int32(c)},r=function(o){let s=o.int32();return e(s)};return It("enum",V.VARINT,t,r)}function f(i,e){return It("message",V.LENGTH_DELIMITED,i,e)}var ie;(function(i){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=i.Type||(i.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=()=>C(t)}(e=i.Type||(i.Type={}));let r;i.codec=()=>(r==null&&(r=f((n,o,s={})=>{s.lengthDelimited!==!1&&o.fork(),n.type!=null&&(o.uint32(8),i.Type.codec().encode(n.type,o)),n.connect!=null&&(o.uint32(18),it.codec().encode(n.connect,o)),n.streamOpen!=null&&(o.uint32(26),rt.codec().encode(n.streamOpen,o)),n.streamHandler!=null&&(o.uint32(34),ot.codec().encode(n.streamHandler,o)),n.dht!=null&&(o.uint32(42),ht.codec().encode(n.dht,o)),n.connManager!=null&&(o.uint32(50),dt.codec().encode(n.connManager,o)),n.disconnect!=null&&(o.uint32(58),at.codec().encode(n.disconnect,o)),n.pubsub!=null&&(o.uint32(66),ut.codec().encode(n.pubsub,o)),n.peerStore!=null&&(o.uint32(74),pt.codec().encode(n.peerStore,o)),s.lengthDelimited!==!1&&o.ldelim()},(n,o)=>{let s={},c=o==null?n.len:n.pos+o;for(;n.pos<c;){let h=n.uint32();switch(h>>>3){case 1:s.type=i.Type.codec().decode(n);break;case 2:s.connect=it.codec().decode(n,n.uint32());break;case 3:s.streamOpen=rt.codec().decode(n,n.uint32());break;case 4:s.streamHandler=ot.codec().decode(n,n.uint32());break;case 5:s.dht=ht.codec().decode(n,n.uint32());break;case 6:s.connManager=dt.codec().decode(n,n.uint32());break;case 7:s.disconnect=at.codec().decode(n,n.uint32());break;case 8:s.pubsub=ut.codec().decode(n,n.uint32());break;case 9:s.peerStore=pt.codec().decode(n,n.uint32());break;default:n.skipType(h&7);break}}return s})),r),i.encode=n=>u(n,i.codec()),i.decode=n=>a(n,i.codec())})(ie||(ie={}));var re;(function(i){let e;(function(n){n.OK="OK",n.ERROR="ERROR"})(e=i.Type||(i.Type={}));let t;(function(n){n[n.OK=0]="OK",n[n.ERROR=1]="ERROR"})(t||(t={})),function(n){n.codec=()=>C(t)}(e=i.Type||(i.Type={}));let r;i.codec=()=>(r==null&&(r=f((n,o,s={})=>{if(s.lengthDelimited!==!1&&o.fork(),n.type!=null&&(o.uint32(8),i.Type.codec().encode(n.type,o)),n.error!=null&&(o.uint32(18),st.codec().encode(n.error,o)),n.streamInfo!=null&&(o.uint32(26),ct.codec().encode(n.streamInfo,o)),n.identify!=null&&(o.uint32(34),nt.codec().encode(n.identify,o)),n.dht!=null&&(o.uint32(42),lt.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),ft.codec().encode(n.pubsub,o)),n.peerStore!=null&&(o.uint32(66),mt.codec().encode(n.peerStore,o)),s.lengthDelimited!==!1&&o.ldelim()},(n,o)=>{let s={peers:[]},c=o==null?n.len:n.pos+o;for(;n.pos<c;){let h=n.uint32();switch(h>>>3){case 1:s.type=i.Type.codec().decode(n);break;case 2:s.error=st.codec().decode(n,n.uint32());break;case 3:s.streamInfo=ct.codec().decode(n,n.uint32());break;case 4:s.identify=nt.codec().decode(n,n.uint32());break;case 5:s.dht=lt.codec().decode(n,n.uint32());break;case 6:s.peers.push(F.codec().decode(n,n.uint32()));break;case 7:s.pubsub=ft.codec().decode(n,n.uint32());break;case 8:s.peerStore=mt.codec().decode(n,n.uint32());break;default:n.skipType(h&7);break}}return s})),r),i.encode=n=>u(n,i.codec()),i.decode=n=>a(n,i.codec())})(re||(re={}));var nt;(function(i){let e;i.codec=()=>(e==null&&(e=f((t,r,n={})=>{if(n.lengthDelimited!==!1&&r.fork(),t.id!=null&&t.id.byteLength>0&&(r.uint32(10),r.bytes(t.id)),t.addrs!=null)for(let o of t.addrs)r.uint32(18),r.bytes(o);n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={id:new Uint8Array(0),addrs:[]},o=r==null?t.len:t.pos+r;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),i.encode=t=>u(t,i.codec()),i.decode=t=>a(t,i.codec())})(nt||(nt={}));var it;(function(i){let e;i.codec=()=>(e==null&&(e=f((t,r,n={})=>{if(n.lengthDelimited!==!1&&r.fork(),t.peer!=null&&t.peer.byteLength>0&&(r.uint32(10),r.bytes(t.peer)),t.addrs!=null)for(let o of t.addrs)r.uint32(18),r.bytes(o);t.timeout!=null&&(r.uint32(24),r.int64(t.timeout)),n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={peer:new Uint8Array(0),addrs:[]},o=r==null?t.len:t.pos+r;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),i.encode=t=>u(t,i.codec()),i.decode=t=>a(t,i.codec())})(it||(it={}));var rt;(function(i){let e;i.codec=()=>(e==null&&(e=f((t,r,n={})=>{if(n.lengthDelimited!==!1&&r.fork(),t.peer!=null&&t.peer.byteLength>0&&(r.uint32(10),r.bytes(t.peer)),t.proto!=null)for(let o of t.proto)r.uint32(18),r.string(o);t.timeout!=null&&(r.uint32(24),r.int64(t.timeout)),n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={peer:new Uint8Array(0),proto:[]},o=r==null?t.len:t.pos+r;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),i.encode=t=>u(t,i.codec()),i.decode=t=>a(t,i.codec())})(rt||(rt={}));var ot;(function(i){let e;i.codec=()=>(e==null&&(e=f((t,r,n={})=>{if(n.lengthDelimited!==!1&&r.fork(),t.addr!=null&&t.addr.byteLength>0&&(r.uint32(10),r.bytes(t.addr)),t.proto!=null)for(let o of t.proto)r.uint32(18),r.string(o);n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={addr:new Uint8Array(0),proto:[]},o=r==null?t.len:t.pos+r;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),i.encode=t=>u(t,i.codec()),i.decode=t=>a(t,i.codec())})(ot||(ot={}));var st;(function(i){let e;i.codec=()=>(e==null&&(e=f((t,r,n={})=>{n.lengthDelimited!==!1&&r.fork(),t.msg!=null&&t.msg!==""&&(r.uint32(10),r.string(t.msg)),n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={msg:""},o=r==null?t.len:t.pos+r;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),i.encode=t=>u(t,i.codec()),i.decode=t=>a(t,i.codec())})(st||(st={}));var ct;(function(i){let e;i.codec=()=>(e==null&&(e=f((t,r,n={})=>{n.lengthDelimited!==!1&&r.fork(),t.peer!=null&&t.peer.byteLength>0&&(r.uint32(10),r.bytes(t.peer)),t.addr!=null&&t.addr.byteLength>0&&(r.uint32(18),r.bytes(t.addr)),t.proto!=null&&t.proto!==""&&(r.uint32(26),r.string(t.proto)),n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={peer:new Uint8Array(0),addr:new Uint8Array(0),proto:""},o=r==null?t.len:t.pos+r;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),i.encode=t=>u(t,i.codec()),i.decode=t=>a(t,i.codec())})(ct||(ct={}));var ht;(function(i){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=i.Type||(i.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=()=>C(t)}(e=i.Type||(i.Type={}));let r;i.codec=()=>(r==null&&(r=f((n,o,s={})=>{s.lengthDelimited!==!1&&o.fork(),n.type!=null&&(o.uint32(8),i.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=i.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})),r),i.encode=n=>u(n,i.codec()),i.decode=n=>a(n,i.codec())})(ht||(ht={}));var lt;(function(i){let e;(function(n){n.BEGIN="BEGIN",n.VALUE="VALUE",n.END="END"})(e=i.Type||(i.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=()=>C(t)}(e=i.Type||(i.Type={}));let r;i.codec=()=>(r==null&&(r=f((n,o,s={})=>{s.lengthDelimited!==!1&&o.fork(),n.type!=null&&(o.uint32(8),i.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=i.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})),r),i.encode=n=>u(n,i.codec()),i.decode=n=>a(n,i.codec())})(lt||(lt={}));var F;(function(i){let e;i.codec=()=>(e==null&&(e=f((t,r,n={})=>{if(n.lengthDelimited!==!1&&r.fork(),t.id!=null&&t.id.byteLength>0&&(r.uint32(10),r.bytes(t.id)),t.addrs!=null)for(let o of t.addrs)r.uint32(18),r.bytes(o);n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={id:new Uint8Array(0),addrs:[]},o=r==null?t.len:t.pos+r;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),i.encode=t=>u(t,i.codec()),i.decode=t=>a(t,i.codec())})(F||(F={}));var dt;(function(i){let e;(function(n){n.TAG_PEER="TAG_PEER",n.UNTAG_PEER="UNTAG_PEER",n.TRIM="TRIM"})(e=i.Type||(i.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=()=>C(t)}(e=i.Type||(i.Type={}));let r;i.codec=()=>(r==null&&(r=f((n,o,s={})=>{s.lengthDelimited!==!1&&o.fork(),n.type!=null&&(o.uint32(8),i.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=i.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})),r),i.encode=n=>u(n,i.codec()),i.decode=n=>a(n,i.codec())})(dt||(dt={}));var at;(function(i){let e;i.codec=()=>(e==null&&(e=f((t,r,n={})=>{n.lengthDelimited!==!1&&r.fork(),t.peer!=null&&t.peer.byteLength>0&&(r.uint32(10),r.bytes(t.peer)),n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={peer:new Uint8Array(0)},o=r==null?t.len:t.pos+r;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),i.encode=t=>u(t,i.codec()),i.decode=t=>a(t,i.codec())})(at||(at={}));var ut;(function(i){let e;(function(n){n.GET_TOPICS="GET_TOPICS",n.LIST_PEERS="LIST_PEERS",n.PUBLISH="PUBLISH",n.SUBSCRIBE="SUBSCRIBE"})(e=i.Type||(i.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=()=>C(t)}(e=i.Type||(i.Type={}));let r;i.codec=()=>(r==null&&(r=f((n,o,s={})=>{s.lengthDelimited!==!1&&o.fork(),n.type!=null&&(o.uint32(8),i.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=i.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})),r),i.encode=n=>u(n,i.codec()),i.decode=n=>a(n,i.codec())})(ut||(ut={}));var oe;(function(i){let e;i.codec=()=>(e==null&&(e=f((t,r,n={})=>{if(n.lengthDelimited!==!1&&r.fork(),t.from!=null&&(r.uint32(10),r.bytes(t.from)),t.data!=null&&(r.uint32(18),r.bytes(t.data)),t.seqno!=null&&(r.uint32(26),r.bytes(t.seqno)),t.topicIDs!=null)for(let o of t.topicIDs)r.uint32(34),r.string(o);t.signature!=null&&(r.uint32(42),r.bytes(t.signature)),t.key!=null&&(r.uint32(50),r.bytes(t.key)),n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={topicIDs:[]},o=r==null?t.len:t.pos+r;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),i.encode=t=>u(t,i.codec()),i.decode=t=>a(t,i.codec())})(oe||(oe={}));var ft;(function(i){let e;i.codec=()=>(e==null&&(e=f((t,r,n={})=>{if(n.lengthDelimited!==!1&&r.fork(),t.topics!=null)for(let o of t.topics)r.uint32(10),r.string(o);if(t.peerIDs!=null)for(let o of t.peerIDs)r.uint32(18),r.bytes(o);n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={topics:[],peerIDs:[]},o=r==null?t.len:t.pos+r;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),i.encode=t=>u(t,i.codec()),i.decode=t=>a(t,i.codec())})(ft||(ft={}));var pt;(function(i){let e;(function(n){n.UNSPECIFIED="UNSPECIFIED",n.GET_PROTOCOLS="GET_PROTOCOLS",n.GET_PEER_INFO="GET_PEER_INFO"})(e=i.Type||(i.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=()=>C(t)}(e=i.Type||(i.Type={}));let r;i.codec=()=>(r==null&&(r=f((n,o,s={})=>{if(s.lengthDelimited!==!1&&o.fork(),n.type!=null&&(o.uint32(8),i.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=i.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})),r),i.encode=n=>u(n,i.codec()),i.decode=n=>a(n,i.codec())})(pt||(pt={}));var mt;(function(i){let e;i.codec=()=>(e==null&&(e=f((t,r,n={})=>{if(n.lengthDelimited!==!1&&r.fork(),t.peer!=null&&(r.uint32(10),F.codec().encode(t.peer,r)),t.protos!=null)for(let o of t.protos)r.uint32(18),r.string(o);n.lengthDelimited!==!1&&r.ldelim()},(t,r)=>{let n={protos:[]},o=r==null?t.len:t.pos+r;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),i.encode=t=>u(t,i.codec()),i.decode=t=>a(t,i.codec())})(mt||(mt={}));return Ve(mi);})();
|
|
3
3
|
return Libp2PDaemonProtocol}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/daemon-protocol",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Communication protocol between libp2p daemons and clients",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "Apache-2.0 OR MIT",
|
|
@@ -59,114 +59,25 @@
|
|
|
59
59
|
"parserOptions": {
|
|
60
60
|
"project": true,
|
|
61
61
|
"sourceType": "module"
|
|
62
|
-
}
|
|
63
|
-
"ignorePatterns": [
|
|
64
|
-
"*.d.ts",
|
|
65
|
-
"src/index.js"
|
|
66
|
-
]
|
|
67
|
-
},
|
|
68
|
-
"release": {
|
|
69
|
-
"branches": [
|
|
70
|
-
"main"
|
|
71
|
-
],
|
|
72
|
-
"plugins": [
|
|
73
|
-
[
|
|
74
|
-
"@semantic-release/commit-analyzer",
|
|
75
|
-
{
|
|
76
|
-
"preset": "conventionalcommits",
|
|
77
|
-
"releaseRules": [
|
|
78
|
-
{
|
|
79
|
-
"breaking": true,
|
|
80
|
-
"release": "major"
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"revert": true,
|
|
84
|
-
"release": "patch"
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"type": "feat",
|
|
88
|
-
"release": "minor"
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
"type": "fix",
|
|
92
|
-
"release": "patch"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
"type": "docs",
|
|
96
|
-
"release": "patch"
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
"type": "test",
|
|
100
|
-
"release": "patch"
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
"type": "deps",
|
|
104
|
-
"release": "patch"
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
"scope": "no-release",
|
|
108
|
-
"release": false
|
|
109
|
-
}
|
|
110
|
-
]
|
|
111
|
-
}
|
|
112
|
-
],
|
|
113
|
-
[
|
|
114
|
-
"@semantic-release/release-notes-generator",
|
|
115
|
-
{
|
|
116
|
-
"preset": "conventionalcommits",
|
|
117
|
-
"presetConfig": {
|
|
118
|
-
"types": [
|
|
119
|
-
{
|
|
120
|
-
"type": "feat",
|
|
121
|
-
"section": "Features"
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"type": "fix",
|
|
125
|
-
"section": "Bug Fixes"
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
"type": "chore",
|
|
129
|
-
"section": "Trivial Changes"
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
"type": "docs",
|
|
133
|
-
"section": "Documentation"
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
"type": "deps",
|
|
137
|
-
"section": "Dependencies"
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
"type": "test",
|
|
141
|
-
"section": "Tests"
|
|
142
|
-
}
|
|
143
|
-
]
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
],
|
|
147
|
-
"@semantic-release/changelog",
|
|
148
|
-
"@semantic-release/npm",
|
|
149
|
-
"@semantic-release/github",
|
|
150
|
-
"@semantic-release/git"
|
|
151
|
-
]
|
|
62
|
+
}
|
|
152
63
|
},
|
|
153
64
|
"scripts": {
|
|
154
65
|
"clean": "aegir clean",
|
|
155
66
|
"lint": "aegir lint",
|
|
156
67
|
"generate": "protons ./src/index.proto",
|
|
157
68
|
"build": "aegir build",
|
|
158
|
-
"
|
|
159
|
-
"
|
|
69
|
+
"dep-check": "aegir dep-check",
|
|
70
|
+
"release": "aegir release"
|
|
160
71
|
},
|
|
161
72
|
"dependencies": {
|
|
162
|
-
"@libp2p/interface": "^
|
|
163
|
-
"@libp2p/logger": "^
|
|
164
|
-
"it-length-prefixed-stream": "^1.1.
|
|
165
|
-
"protons-runtime": "^5.
|
|
166
|
-
"uint8arraylist": "^2.4.
|
|
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",
|
|
77
|
+
"uint8arraylist": "^2.4.8"
|
|
167
78
|
},
|
|
168
79
|
"devDependencies": {
|
|
169
|
-
"aegir": "^
|
|
170
|
-
"protons": "^7.0
|
|
80
|
+
"aegir": "^44.1.0",
|
|
81
|
+
"protons": "^7.5.0"
|
|
171
82
|
}
|
|
172
83
|
}
|