@libp2p/daemon-protocol 8.0.5-90100be0c → 8.0.5-b30baa93a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +2 -2
package/dist/index.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PDaemonProtocol = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var Libp2PDaemonProtocol=(()=>{var Ct=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var Ze=Object.getOwnPropertyNames;var He=Object.prototype.hasOwnProperty;var I=(n,e)=>{for(var o in e)Ct(n,o,{get:e[o],enumerable:!0})},qe=(n,e,o,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of Ze(e))!He.call(n,l)&&l!==o&&Ct(n,l,{get:()=>e[l],enumerable:!(c=Ve(e,l))||c.enumerable});return n};var je=n=>qe(Ct({},"__esModule",{value:!0}),n);var ki={};I(ki,{ConnManagerRequest:()=>ct,ConnectRequest:()=>tt,DHTRequest:()=>rt,DHTResponse:()=>st,DisconnectRequest:()=>lt,ErrorResponse:()=>it,IdentifyResponse:()=>j,PSMessage:()=>ae,PSRequest:()=>dt,PSResponse:()=>at,PeerInfo:()=>N,PeerstoreRequest:()=>ut,PeerstoreResponse:()=>ht,Request:()=>le,Response:()=>de,StreamHandlerRequest:()=>nt,StreamInfo:()=>ot,StreamOpenRequest:()=>et});function B(n=0){return new Uint8Array(n)}function G(n=0){return new Uint8Array(n)}var tn=Math.pow(2,7),en=Math.pow(2,14),nn=Math.pow(2,21),ue=Math.pow(2,28),he=Math.pow(2,35),fe=Math.pow(2,42),pe=Math.pow(2,49),k=128,z=127;function ft(n){if(n<tn)return 1;if(n<en)return 2;if(n<nn)return 3;if(n<ue)return 4;if(n<he)return 5;if(n<fe)return 6;if(n<pe)return 7;if(Number.MAX_SAFE_INTEGER!=null&&n>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function me(n,e,o=0){switch(ft(n)){case 8:e[o++]=n&255|k,n/=128;case 7:e[o++]=n&255|k,n/=128;case 6:e[o++]=n&255|k,n/=128;case 5:e[o++]=n&255|k,n/=128;case 4:e[o++]=n&255|k,n>>>=7;case 3:e[o++]=n&255|k,n>>>=7;case 2:e[o++]=n&255|k,n>>>=7;case 1:{e[o++]=n&255,n>>>=7;break}default:throw new Error("unreachable")}return e}function be(n,e){let o=n[e],c=0;if(c+=o&z,o<k||(o=n[e+1],c+=(o&z)<<7,o<k)||(o=n[e+2],c+=(o&z)<<14,o<k)||(o=n[e+3],c+=(o&z)<<21,o<k)||(o=n[e+4],c+=(o&z)*ue,o<k)||(o=n[e+5],c+=(o&z)*he,o<k)||(o=n[e+6],c+=(o&z)*fe,o<k)||(o=n[e+7],c+=(o&z)*pe,o<k))return c;throw new RangeError("Could not decode varint")}var Lt=new Float32Array([-0]),_=new Uint8Array(Lt.buffer);function ye(n,e,o){Lt[0]=n,e[o]=_[0],e[o+1]=_[1],e[o+2]=_[2],e[o+3]=_[3]}function ge(n,e){return _[0]=n[e],_[1]=n[e+1],_[2]=n[e+2],_[3]=n[e+3],Lt[0]}var Ut=new Float64Array([-0]),x=new Uint8Array(Ut.buffer);function Ee(n,e,o){Ut[0]=n,e[o]=x[0],e[o+1]=x[1],e[o+2]=x[2],e[o+3]=x[3],e[o+4]=x[4],e[o+5]=x[5],e[o+6]=x[6],e[o+7]=x[7]}function xe(n,e){return x[0]=n[e],x[1]=n[e+1],x[2]=n[e+2],x[3]=n[e+3],x[4]=n[e+4],x[5]=n[e+5],x[6]=n[e+6],x[7]=n[e+7],Ut[0]}var on=BigInt(Number.MAX_SAFE_INTEGER),rn=BigInt(Number.MIN_SAFE_INTEGER),D=class n{lo;hi;constructor(e,o){this.lo=e|0,this.hi=o|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let o=~this.lo+1>>>0,c=~this.hi>>>0;return o===0&&(c=c+1>>>0),-(o+c*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let o=~this.lo+1>>>0,c=~this.hi>>>0;return o===0&&(c=c+1>>>0),-(BigInt(o)+(BigInt(c)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,o=(this.lo>>>28|this.hi<<4)>>>0,c=this.hi>>>24;return c===0?o===0?e<16384?e<128?1:2:e<2097152?3:4:o<16384?o<128?5:6:o<2097152?7:8:c<128?9:10}static fromBigInt(e){if(e===0n)return Y;if(e<on&&e>rn)return this.fromNumber(Number(e));let o=e<0n;o&&(e=-e);let c=e>>32n,l=e-(c<<32n);return o&&(c=~c|0n,l=~l|0n,++l>ke&&(l=0n,++c>ke&&(c=0n))),new n(Number(l),Number(c))}static fromNumber(e){if(e===0)return Y;let o=e<0;o&&(e=-e);let c=e>>>0,l=(e-c)/4294967296>>>0;return o&&(l=~l>>>0,c=~c>>>0,++c>4294967295&&(c=0,++l>4294967295&&(l=0))),new n(c,l)}static from(e){return typeof e=="number"?n.fromNumber(e):typeof e=="bigint"?n.fromBigInt(e):typeof e=="string"?n.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new n(e.low>>>0,e.high>>>0):Y}},Y=new D(0,0);Y.toBigInt=function(){return 0n};Y.zzEncode=Y.zzDecode=function(){return this};Y.length=function(){return 1};var ke=4294967296n;function we(n){let e=0,o=0;for(let c=0;c<n.length;++c)o=n.charCodeAt(c),o<128?e+=1:o<2048?e+=2:(o&64512)===55296&&(n.charCodeAt(c+1)&64512)===56320?(++c,e+=4):e+=3;return e}function Ie(n,e,o){if(o-e<1)return"";let l,i=[],s=0,t;for(;e<o;)t=n[e++],t<128?i[s++]=t:t>191&&t<224?i[s++]=(t&31)<<6|n[e++]&63:t>239&&t<365?(t=((t&7)<<18|(n[e++]&63)<<12|(n[e++]&63)<<6|n[e++]&63)-65536,i[s++]=55296+(t>>10),i[s++]=56320+(t&1023)):i[s++]=(t&15)<<12|(n[e++]&63)<<6|n[e++]&63,s>8191&&((l??(l=[])).push(String.fromCharCode.apply(String,i)),s=0);return l!=null?(s>0&&l.push(String.fromCharCode.apply(String,i.slice(0,s))),l.join("")):String.fromCharCode.apply(String,i.slice(0,s))}function vt(n,e,o){let c=o,l,i;for(let s=0;s<n.length;++s)l=n.charCodeAt(s),l<128?e[o++]=l:l<2048?(e[o++]=l>>6|192,e[o++]=l&63|128):(l&64512)===55296&&((i=n.charCodeAt(s+1))&64512)===56320?(l=65536+((l&1023)<<10)+(i&1023),++s,e[o++]=l>>18|240,e[o++]=l>>12&63|128,e[o++]=l>>6&63|128,e[o++]=l&63|128):(e[o++]=l>>12|224,e[o++]=l>>6&63|128,e[o++]=l&63|128);return o-c}function C(n,e){return RangeError(`index out of range: ${n.pos} + ${e??1} > ${n.len}`)}function It(n,e){return(n[e-4]|n[e-3]<<8|n[e-2]<<16|n[e-1]<<24)>>>0}var Ft=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,C(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw C(this,4);return It(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw C(this,4);return It(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw C(this,4);let e=ge(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw C(this,4);let e=xe(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),o=this.pos,c=this.pos+e;if(c>this.len)throw C(this,e);return this.pos+=e,o===c?new Uint8Array(0):this.buf.subarray(o,c)}string(){let e=this.bytes();return Ie(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw C(this,e);this.pos+=e}else do if(this.pos>=this.len)throw C(this);while((this.buf[this.pos++]&128)!==0);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new D(0,0),o=0;if(this.len-this.pos>4){for(;o<4;++o)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<o*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;o=0}else{for(;o<3;++o){if(this.pos>=this.len)throw C(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<o*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<o*7)>>>0,e}if(this.len-this.pos>4){for(;o<5;++o)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<o*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;o<5;++o){if(this.pos>=this.len)throw C(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<o*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw C(this,8);let e=It(this.buf,this.pos+=4),o=It(this.buf,this.pos+=4);return new D(e,o)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let e=be(this.buf,this.pos);return this.pos+=ft(e),e}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function pt(n){return new Ft(n instanceof Uint8Array?n:n.subarray())}function b(n,e,o){let c=pt(n);return e.decode(c,void 0,o)}var Pt={};I(Pt,{base10:()=>hn});var Oi=new Uint8Array(0);function Se(n,e){if(n===e)return!0;if(n.byteLength!==e.byteLength)return!1;for(let o=0;o<n.byteLength;o++)if(n[o]!==e[o])return!1;return!0}function $(n){if(n instanceof Uint8Array&&n.constructor.name==="Uint8Array")return n;if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);throw new Error("Unknown type, must be binary type")}function Ne(n){return new TextEncoder().encode(n)}function Ae(n){return new TextDecoder().decode(n)}function sn(n,e){if(n.length>=255)throw new TypeError("Alphabet too long");for(var o=new Uint8Array(256),c=0;c<o.length;c++)o[c]=255;for(var l=0;l<n.length;l++){var i=n.charAt(l),s=i.charCodeAt(0);if(o[s]!==255)throw new TypeError(i+" is ambiguous");o[s]=l}var t=n.length,r=n.charAt(0),d=Math.log(t)/Math.log(256),a=Math.log(256)/Math.log(t);function u(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var w=0,K=0,A=0,L=f.length;A!==L&&f[A]===0;)A++,w++;for(var U=(L-A)*a+1>>>0,S=new Uint8Array(U);A!==L;){for(var v=f[A],P=0,T=U-1;(v!==0||P<K)&&T!==-1;T--,P++)v+=256*S[T]>>>0,S[T]=v%t>>>0,v=v/t>>>0;if(v!==0)throw new Error("Non-zero carry");K=P,A++}for(var O=U-K;O!==U&&S[O]===0;)O++;for(var wt=r.repeat(w);O<U;++O)wt+=n.charAt(S[O]);return wt}function h(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var w=0;if(f[w]!==" "){for(var K=0,A=0;f[w]===r;)K++,w++;for(var L=(f.length-w)*d+1>>>0,U=new Uint8Array(L);f[w];){var S=o[f.charCodeAt(w)];if(S===255)return;for(var v=0,P=L-1;(S!==0||v<A)&&P!==-1;P--,v++)S+=t*U[P]>>>0,U[P]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");A=v,w++}if(f[w]!==" "){for(var T=L-A;T!==L&&U[T]===0;)T++;for(var O=new Uint8Array(K+(L-T)),wt=K;T!==L;)O[wt++]=U[T++];return O}}}function X(f){var w=h(f);if(w)return w;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:h,decode:X}}var cn=sn,ln=cn,Ce=ln;var Ot=class{name;prefix;baseEncode;constructor(e,o,c){this.name=e,this.prefix=o,this.baseEncode=c}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Bt=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,o,c){this.name=e,this.prefix=o;let l=o.codePointAt(0);if(l===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=l,this.baseDecode=c}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Le(this,e)}},$t=class{decoders;constructor(e){this.decoders=e}or(e){return Le(this,e)}decode(e){let o=e[0],c=this.decoders[o];if(c!=null)return c.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Le(n,e){return new $t({...n.decoders??{[n.prefix]:n},...e.decoders??{[e.prefix]:e}})}var Mt=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,o,c,l){this.name=e,this.prefix=o,this.baseEncode=c,this.baseDecode=l,this.encoder=new Ot(e,o,c),this.decoder=new Bt(e,o,l)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function W({name:n,prefix:e,encode:o,decode:c}){return new Mt(n,e,o,c)}function R({name:n,prefix:e,alphabet:o}){let{encode:c,decode:l}=Ce(o,n);return W({prefix:e,name:n,encode:c,decode:i=>$(l(i))})}function dn(n,e,o,c){let l=n.length;for(;n[l-1]==="=";)--l;let i=new Uint8Array(l*o/8|0),s=0,t=0,r=0;for(let d=0;d<l;++d){let a=e[n[d]];if(a===void 0)throw new SyntaxError(`Non-${c} character`);t=t<<o|a,s+=o,s>=8&&(s-=8,i[r++]=255&t>>s)}if(s>=o||(255&t<<8-s)!==0)throw new SyntaxError("Unexpected end of data");return i}function an(n,e,o){let c=e[e.length-1]==="=",l=(1<<o)-1,i="",s=0,t=0;for(let r=0;r<n.length;++r)for(t=t<<8|n[r],s+=8;s>o;)s-=o,i+=e[l&t>>s];if(s!==0&&(i+=e[l&t<<o-s]),c)for(;(i.length*o&7)!==0;)i+="=";return i}function un(n){let e={};for(let o=0;o<n.length;++o)e[n[o]]=o;return e}function m({name:n,prefix:e,bitsPerChar:o,alphabet:c}){let l=un(c);return W({prefix:e,name:n,encode(i){return an(i,c,o)},decode(i){return dn(i,l,o,n)}})}var hn=R({prefix:"9",name:"base10",alphabet:"0123456789"});var Gt={};I(Gt,{base16:()=>fn,base16upper:()=>pn});var fn=m({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),pn=m({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var zt={};I(zt,{base2:()=>mn});var mn=m({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var _t={};I(_t,{base256emoji:()=>xn});var Ue=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),bn=Ue.reduce((n,e,o)=>(n[o]=e,n),[]),yn=Ue.reduce((n,e,o)=>{let c=e.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${e}`);return n[c]=o,n},[]);function gn(n){return n.reduce((e,o)=>(e+=bn[o],e),"")}function En(n){let e=[];for(let o of n){let c=o.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${o}`);let l=yn[c];if(l==null)throw new Error(`Non-base256emoji character: ${o}`);e.push(l)}return new Uint8Array(e)}var xn=W({prefix:"\u{1F680}",name:"base256emoji",encode:gn,decode:En});var Rt={};I(Rt,{base32:()=>Q,base32hex:()=>Dn,base32hexpad:()=>Nn,base32hexpadupper:()=>An,base32hexupper:()=>Sn,base32pad:()=>wn,base32padupper:()=>In,base32upper:()=>kn,base32z:()=>Tn});var Q=m({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),kn=m({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),wn=m({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),In=m({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Dn=m({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Sn=m({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Nn=m({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),An=m({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Tn=m({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Xt={};I(Xt,{base36:()=>mt,base36upper:()=>Cn});var mt=R({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Cn=R({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Kt={};I(Kt,{base58btc:()=>F,base58flickr:()=>Ln});var F=R({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ln=R({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Yt={};I(Yt,{base64:()=>Un,base64pad:()=>vn,base64url:()=>Fn,base64urlpad:()=>On});var Un=m({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),vn=m({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Fn=m({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),On=m({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Jt={};I(Jt,{base8:()=>Bn});var Bn=m({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Wt={};I(Wt,{identity:()=>$n});var $n=W({prefix:"\0",name:"identity",encode:n=>Ae(n),decode:n=>Ne(n)});var Zi=new TextEncoder,Hi=new TextDecoder;var Vt={};I(Vt,{identity:()=>ri});var Gn=Oe,ve=128,zn=127,_n=~zn,Rn=Math.pow(2,31);function Oe(n,e,o){e=e||[],o=o||0;for(var c=o;n>=Rn;)e[o++]=n&255|ve,n/=128;for(;n&_n;)e[o++]=n&255|ve,n>>>=7;return e[o]=n|0,Oe.bytes=o-c+1,e}var Xn=Qt,Kn=128,Fe=127;function Qt(n,c){var o=0,c=c||0,l=0,i=c,s,t=n.length;do{if(i>=t)throw Qt.bytes=0,new RangeError("Could not decode varint");s=n[i++],o+=l<28?(s&Fe)<<l:(s&Fe)*Math.pow(2,l),l+=7}while(s>=Kn);return Qt.bytes=i-c,o}var Yn=Math.pow(2,7),Jn=Math.pow(2,14),Wn=Math.pow(2,21),Qn=Math.pow(2,28),Vn=Math.pow(2,35),Zn=Math.pow(2,42),Hn=Math.pow(2,49),qn=Math.pow(2,56),jn=Math.pow(2,63),ti=function(n){return n<Yn?1:n<Jn?2:n<Wn?3:n<Qn?4:n<Vn?5:n<Zn?6:n<Hn?7:n<qn?8:n<jn?9:10},ei={encode:Gn,decode:Xn,encodingLength:ti},ni=ei,bt=ni;function yt(n,e=0){return[bt.decode(n,e),bt.decode.bytes]}function V(n,e,o=0){return bt.encode(n,e,o),e}function Z(n){return bt.encodingLength(n)}function q(n,e){let o=e.byteLength,c=Z(n),l=c+Z(o),i=new Uint8Array(l+o);return V(n,i,0),V(o,i,c),i.set(e,l),new H(n,o,e,i)}function Be(n){let e=$(n),[o,c]=yt(e),[l,i]=yt(e.subarray(c)),s=e.subarray(c+i);if(s.byteLength!==l)throw new Error("Incorrect length");return new H(o,l,s,e)}function $e(n,e){if(n===e)return!0;{let o=e;return n.code===o.code&&n.size===o.size&&o.bytes instanceof Uint8Array&&Se(n.bytes,o.bytes)}}var H=class{code;size;digest;bytes;constructor(e,o,c,l){this.code=e,this.size=o,this.digest=c,this.bytes=l}};var Me=0,ii="identity",Pe=$;function oi(n,e){if(e?.truncate!=null&&e.truncate!==n.byteLength){if(e.truncate<0||e.truncate>n.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${n.byteLength}`);n=n.subarray(0,e.truncate)}return q(Me,Pe(n))}var ri={code:Me,name:ii,encode:Pe,digest:oi};var qt={};I(qt,{sha256:()=>ci,sha512:()=>li});var si=20;function Ht({name:n,code:e,encode:o,minDigestLength:c,maxDigestLength:l}){return new Zt(n,e,o,c,l)}var Zt=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,o,c,l,i){this.name=e,this.code=o,this.encode=c,this.minDigestLength=l??si,this.maxDigestLength=i}digest(e,o){if(o?.truncate!=null){if(o.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&o.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let c=this.encode(e);return c instanceof Uint8Array?Ge(c,this.code,o?.truncate):c.then(l=>Ge(l,this.code,o?.truncate))}else throw Error("Unknown type, must be binary type")}};function Ge(n,e,o){if(o!=null&&o!==n.byteLength){if(o>n.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${n.byteLength}`);n=n.subarray(0,o)}return q(e,n)}function _e(n){return async e=>new Uint8Array(await crypto.subtle.digest(n,e))}var ci=Ht({name:"sha2-256",code:18,encode:_e("SHA-256")}),li=Ht({name:"sha2-512",code:19,encode:_e("SHA-512")});function Re(n,e){let{bytes:o,version:c}=n;switch(c){case 0:return ai(o,jt(n),e??F.encoder);default:return ui(o,jt(n),e??Q.encoder)}}var Xe=new WeakMap;function jt(n){let e=Xe.get(n);if(e==null){let o=new Map;return Xe.set(n,o),o}return e}var St=class n{code;version;multihash;bytes;"/";constructor(e,o,c,l){this.code=o,this.version=e,this.multihash=c,this.bytes=l,this["/"]=l}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:o}=this;if(e!==Et)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(o.code!==hi)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return n.createV0(o)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:o}=this.multihash,c=q(e,o);return n.createV1(this.code,c)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return n.equals(this,e)}static equals(e,o){let c=o;return c!=null&&e.code===c.code&&e.version===c.version&&$e(e.multihash,c.multihash)}toString(e){return Re(this,e)}toJSON(){return{"/":Re(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let o=e;if(o instanceof n)return o;if(o["/"]!=null&&o["/"]===o.bytes||o.asCID===o){let{version:c,code:l,multihash:i,bytes:s}=o;return new n(c,l,i,s??Ke(c,l,i.bytes))}else if(o[fi]===!0){let{version:c,multihash:l,code:i}=o,s=Be(l);return n.create(c,i,s)}else return null}static create(e,o,c){if(typeof o!="number")throw new Error("String codecs are no longer supported");if(!(c.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(o!==Et)throw new Error(`Version 0 CID must use dag-pb (code: ${Et}) block encoding`);return new n(e,o,c,c.bytes)}case 1:{let l=Ke(e,o,c.bytes);return new n(e,o,c,l)}default:throw new Error("Invalid version")}}static createV0(e){return n.create(0,Et,e)}static createV1(e,o){return n.create(1,e,o)}static decode(e){let[o,c]=n.decodeFirst(e);if(c.length!==0)throw new Error("Incorrect length");return o}static decodeFirst(e){let o=n.inspectBytes(e),c=o.size-o.multihashSize,l=$(e.subarray(c,c+o.multihashSize));if(l.byteLength!==o.multihashSize)throw new Error("Incorrect length");let i=l.subarray(o.multihashSize-o.digestSize),s=new H(o.multihashCode,o.digestSize,i,l);return[o.version===0?n.createV0(s):n.createV1(o.codec,s),e.subarray(o.size)]}static inspectBytes(e){let o=0,c=()=>{let[u,h]=yt(e.subarray(o));return o+=h,u},l=c(),i=Et;if(l===18?(l=0,o=0):i=c(),l!==0&&l!==1)throw new RangeError(`Invalid CID version ${l}`);let s=o,t=c(),r=c(),d=o+r,a=d-s;return{version:l,codec:i,multihashCode:t,digestSize:r,multihashSize:a,size:d}}static parse(e,o){let[c,l]=di(e,o),i=n.decode(l);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return jt(i).set(c,e),i}};function di(n,e){switch(n[0]){case"Q":{let o=e??F;return[F.prefix,o.decode(`${F.prefix}${n}`)]}case F.prefix:{let o=e??F;return[F.prefix,o.decode(n)]}case Q.prefix:{let o=e??Q;return[Q.prefix,o.decode(n)]}case mt.prefix:{let o=e??mt;return[mt.prefix,o.decode(n)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[n[0],e.decode(n)]}}}function ai(n,e,o){let{prefix:c}=o;if(c!==F.prefix)throw Error(`Cannot string encode V0 in ${o.name} encoding`);let l=e.get(c);if(l==null){let i=o.encode(n).slice(1);return e.set(c,i),i}else return l}function ui(n,e,o){let{prefix:c}=o,l=e.get(c);if(l==null){let i=o.encode(n);return e.set(c,i),i}else return l}var Et=112,hi=18;function Ke(n,e,o){let c=Z(n),l=c+Z(e),i=new Uint8Array(l+o.byteLength);return V(n,i,0),V(e,i,c),i.set(o,l),i}var fi=Symbol.for("@ipld/js-cid/CID");var te={...Wt,...zt,...Jt,...Pt,...Gt,...Rt,...Xt,...Kt,...Yt,..._t},xo={...qt,...Vt};function Je(n,e,o,c){return{name:n,prefix:e,encoder:{name:n,prefix:e,encode:o},decoder:{decode:c}}}var Ye=Je("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),ee=Je("ascii","a",n=>{let e="a";for(let o=0;o<n.length;o++)e+=String.fromCharCode(n[o]);return e},n=>{n=n.substring(1);let e=G(n.length);for(let o=0;o<n.length;o++)e[o]=n.charCodeAt(o);return e}),pi={utf8:Ye,"utf-8":Ye,hex:te.base16,latin1:ee,ascii:ee,binary:ee,...te},We=pi;function Qe(n,e="utf8"){let o=We[e];if(o==null)throw new Error(`Unsupported encoding "${e}"`);return o.decoder.decode(`${o.prefix}${n}`)}function ne(n){let e=n??8192,o=e>>>1,c,l=e;return function(s){if(s<1||s>o)return G(s);l+s>e&&(c=G(e),l=0);let t=c.subarray(l,l+=s);return(l&7)!==0&&(l=(l|7)+1),t}}var J=class{fn;len;next;val;constructor(e,o,c){this.fn=e,this.len=o,this.next=void 0,this.val=c}};function ie(){}var re=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},mi=ne();function bi(n){return globalThis.Buffer!=null?G(n):mi(n)}var kt=class{len;head;tail;states;constructor(){this.len=0,this.head=new J(ie,0,0),this.tail=this.head,this.states=null}_push(e,o,c){return this.tail=this.tail.next=new J(e,o,c),this.len+=o,this}uint32(e){return this.len+=(this.tail=this.tail.next=new se((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(Nt,10,D.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let o=D.fromBigInt(e);return this._push(Nt,o.length(),o)}uint64Number(e){return this._push(me,ft(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let o=D.fromBigInt(e).zzEncode();return this._push(Nt,o.length(),o)}sint64Number(e){let o=D.fromNumber(e).zzEncode();return this._push(Nt,o.length(),o)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(oe,1,e?1:0)}fixed32(e){return this._push(xt,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let o=D.fromBigInt(e);return this._push(xt,4,o.lo)._push(xt,4,o.hi)}fixed64Number(e){let o=D.fromNumber(e);return this._push(xt,4,o.lo)._push(xt,4,o.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(ye,4,e)}double(e){return this._push(Ee,8,e)}bytes(e){let o=e.length>>>0;return o===0?this._push(oe,1,0):this.uint32(o)._push(gi,o,e)}string(e){let o=we(e);return o!==0?this.uint32(o)._push(vt,o,e):this._push(oe,1,0)}fork(){return this.states=new re(this),this.head=this.tail=new J(ie,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new J(ie,0,0),this.len=0),this}ldelim(){let e=this.head,o=this.tail,c=this.len;return this.reset().uint32(c),c!==0&&(this.tail.next=e.next,this.tail=o,this.len+=c),this}finish(){let e=this.head.next,o=bi(this.len),c=0;for(;e!=null;)e.fn(e.val,o,c),c+=e.len,e=e.next;return o}};function oe(n,e,o){e[o]=n&255}function yi(n,e,o){for(;n>127;)e[o++]=n&127|128,n>>>=7;e[o]=n}var se=class extends J{next;constructor(e,o){super(yi,e,o),this.next=void 0}};function Nt(n,e,o){for(;n.hi!==0;)e[o++]=n.lo&127|128,n.lo=(n.lo>>>7|n.hi<<25)>>>0,n.hi>>>=7;for(;n.lo>127;)e[o++]=n.lo&127|128,n.lo=n.lo>>>7;e[o++]=n.lo}function xt(n,e,o){e[o]=n&255,e[o+1]=n>>>8&255,e[o+2]=n>>>16&255,e[o+3]=n>>>24}function gi(n,e,o){e.set(n,o)}globalThis.Buffer!=null&&(kt.prototype.bytes=function(n){let e=n.length>>>0;return this.uint32(e),e>0&&this._push(Ei,e,n),this},kt.prototype.string=function(n){let e=globalThis.Buffer.byteLength(n);return this.uint32(e),e>0&&this._push(xi,e,n),this});function Ei(n,e,o){e.set(n,o)}function xi(n,e,o){n.length<40?vt(n,e,o):e.utf8Write!=null?e.utf8Write(n,o):e.set(Qe(n),o)}function ce(){return new kt}function y(n,e){let o=ce();return e.encode(n,o,{lengthDelimited:!1}),o.finish()}function*g(n,e,o){let c=pt(n);yield*e.stream(c,void 0,"$",o)}var At={VARINT:0,BIT64:1,LENGTH_DELIMITED:2,START_GROUP:3,END_GROUP:4,BIT32:5};function Tt(n,e,o,c,l){return{name:n,type:e,encode:o,decode:c,stream:l}}function M(n){function e(i){if(n[i.toString()]==null)throw new Error("Invalid enum value");return n[i]}let o=function(s,t){let r=e(s);t.int32(r)},c=function(s){let t=s.int32();return e(t)},l=function*(s){let t=s.int32();yield e(t)};return Tt("enum",At.VARINT,o,c,l)}function E(n,e,o){return Tt("message",At.LENGTH_DELIMITED,n,e,o)}var p=class extends Error{code="ERR_MAX_LENGTH";name="MaxLengthError"};var le;(function(n){let e;(function(t){t.IDENTIFY="IDENTIFY",t.CONNECT="CONNECT",t.STREAM_OPEN="STREAM_OPEN",t.STREAM_HANDLER="STREAM_HANDLER",t.DHT="DHT",t.LIST_PEERS="LIST_PEERS",t.CONNMANAGER="CONNMANAGER",t.DISCONNECT="DISCONNECT",t.PUBSUB="PUBSUB",t.PEERSTORE="PEERSTORE"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.IDENTIFY=0]="IDENTIFY",t[t.CONNECT=1]="CONNECT",t[t.STREAM_OPEN=2]="STREAM_OPEN",t[t.STREAM_HANDLER=3]="STREAM_HANDLER",t[t.DHT=4]="DHT",t[t.LIST_PEERS=5]="LIST_PEERS",t[t.CONNMANAGER=6]="CONNMANAGER",t[t.DISCONNECT=7]="DISCONNECT",t[t.PUBSUB=8]="PUBSUB",t[t.PEERSTORE=9]="PEERSTORE"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.connect!=null&&(r.uint32(18),tt.codec().encode(t.connect,r)),t.streamOpen!=null&&(r.uint32(26),et.codec().encode(t.streamOpen,r)),t.streamHandler!=null&&(r.uint32(34),nt.codec().encode(t.streamHandler,r)),t.dht!=null&&(r.uint32(42),rt.codec().encode(t.dht,r)),t.connManager!=null&&(r.uint32(50),ct.codec().encode(t.connManager,r)),t.disconnect!=null&&(r.uint32(58),lt.codec().encode(t.disconnect,r)),t.pubsub!=null&&(r.uint32(66),dt.codec().encode(t.pubsub,r)),t.peerStore!=null&&(r.uint32(74),ut.codec().encode(t.peerStore,r)),d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.connect=tt.codec().decode(t,t.uint32(),{limits:d.limits?.connect});break}case 3:{a.streamOpen=et.codec().decode(t,t.uint32(),{limits:d.limits?.streamOpen});break}case 4:{a.streamHandler=nt.codec().decode(t,t.uint32(),{limits:d.limits?.streamHandler});break}case 5:{a.dht=rt.codec().decode(t,t.uint32(),{limits:d.limits?.dht});break}case 6:{a.connManager=ct.codec().decode(t,t.uint32(),{limits:d.limits?.connManager});break}case 7:{a.disconnect=lt.codec().decode(t,t.uint32(),{limits:d.limits?.disconnect});break}case 8:{a.pubsub=dt.codec().decode(t,t.uint32(),{limits:d.limits?.pubsub});break}case 9:{a.peerStore=ut.codec().decode(t,t.uint32(),{limits:d.limits?.peerStore});break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield*tt.codec().stream(t,t.uint32(),`${d}.connect`,{limits:a.limits?.connect});break}case 3:{yield*et.codec().stream(t,t.uint32(),`${d}.streamOpen`,{limits:a.limits?.streamOpen});break}case 4:{yield*nt.codec().stream(t,t.uint32(),`${d}.streamHandler`,{limits:a.limits?.streamHandler});break}case 5:{yield*rt.codec().stream(t,t.uint32(),`${d}.dht`,{limits:a.limits?.dht});break}case 6:{yield*ct.codec().stream(t,t.uint32(),`${d}.connManager`,{limits:a.limits?.connManager});break}case 7:{yield*lt.codec().stream(t,t.uint32(),`${d}.disconnect`,{limits:a.limits?.disconnect});break}case 8:{yield*dt.codec().stream(t,t.uint32(),`${d}.pubsub`,{limits:a.limits?.pubsub});break}case 9:{yield*ut.codec().stream(t,t.uint32(),`${d}.peerStore`,{limits:a.limits?.peerStore});break}default:{t.skipType(h&7);break}}}})),c);function l(t){return y(t,n.codec())}n.encode=l;function i(t,r){return b(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(le||(le={}));var de;(function(n){let e;(function(t){t.OK="OK",t.ERROR="ERROR"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.OK=0]="OK",t[t.ERROR=1]="ERROR"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{if(d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.error!=null&&(r.uint32(18),it.codec().encode(t.error,r)),t.streamInfo!=null&&(r.uint32(26),ot.codec().encode(t.streamInfo,r)),t.identify!=null&&(r.uint32(34),j.codec().encode(t.identify,r)),t.dht!=null&&(r.uint32(42),st.codec().encode(t.dht,r)),t.peers!=null&&t.peers.length>0)for(let a of t.peers)r.uint32(50),N.codec().encode(a,r);t.pubsub!=null&&(r.uint32(58),at.codec().encode(t.pubsub,r)),t.peerStore!=null&&(r.uint32(66),ht.codec().encode(t.peerStore,r)),d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={peers:[]},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.error=it.codec().decode(t,t.uint32(),{limits:d.limits?.error});break}case 3:{a.streamInfo=ot.codec().decode(t,t.uint32(),{limits:d.limits?.streamInfo});break}case 4:{a.identify=j.codec().decode(t,t.uint32(),{limits:d.limits?.identify});break}case 5:{a.dht=st.codec().decode(t,t.uint32(),{limits:d.limits?.dht});break}case 6:{if(d.limits?.peers!=null&&a.peers.length===d.limits.peers)throw new p('Decode error - repeated field "peers" had too many elements');a.peers.push(N.codec().decode(t,t.uint32(),{limits:d.limits?.peers$}));break}case 7:{a.pubsub=at.codec().decode(t,t.uint32(),{limits:d.limits?.pubsub});break}case 8:{a.peerStore=ht.codec().decode(t,t.uint32(),{limits:d.limits?.peerStore});break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u={peers:0},h=r==null?t.len:t.pos+r;for(;t.pos<h;){let X=t.uint32();switch(X>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield*it.codec().stream(t,t.uint32(),`${d}.error`,{limits:a.limits?.error});break}case 3:{yield*ot.codec().stream(t,t.uint32(),`${d}.streamInfo`,{limits:a.limits?.streamInfo});break}case 4:{yield*j.codec().stream(t,t.uint32(),`${d}.identify`,{limits:a.limits?.identify});break}case 5:{yield*st.codec().stream(t,t.uint32(),`${d}.dht`,{limits:a.limits?.dht});break}case 6:{if(a.limits?.peers!=null&&u.peers===a.limits.peers)throw new p('Streaming decode error - repeated field "peers" had too many elements');for(let f of N.codec().stream(t,t.uint32(),`${d}.peers[]`,{limits:a.limits?.peers$}))yield{...f,index:u.peers};u.peers++;break}case 7:{yield*at.codec().stream(t,t.uint32(),`${d}.pubsub`,{limits:a.limits?.pubsub});break}case 8:{yield*ht.codec().stream(t,t.uint32(),`${d}.peerStore`,{limits:a.limits?.peerStore});break}default:{t.skipType(X&7);break}}}})),c);function l(t){return y(t,n.codec())}n.encode=l;function i(t,r){return b(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(de||(de={}));var j;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.id!=null&&i.id.byteLength>0&&(s.uint32(10),s.bytes(i.id)),i.addrs!=null&&i.addrs.length>0)for(let r of i.addrs)s.uint32(18),s.bytes(r);t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={id:B(0),addrs:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.id=i.bytes();break}case 2:{if(t.limits?.addrs!=null&&r.addrs.length===t.limits.addrs)throw new p('Decode error - repeated field "addrs" had too many elements');r.addrs.push(i.bytes());break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={addrs:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${t}.id`,value:i.bytes()};break}case 2:{if(r.limits?.addrs!=null&&d.addrs===r.limits.addrs)throw new p('Streaming decode error - repeated field "addrs" had too many elements');yield{field:`${t}.addrs[]`,index:d.addrs,value:i.bytes()},d.addrs++;break}default:{i.skipType(u&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(j||(j={}));var tt;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.peer!=null&&i.peer.byteLength>0&&(s.uint32(10),s.bytes(i.peer)),i.addrs!=null&&i.addrs.length>0)for(let r of i.addrs)s.uint32(18),s.bytes(r);i.timeout!=null&&(s.uint32(24),s.int64(i.timeout)),t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={peer:B(0),addrs:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.peer=i.bytes();break}case 2:{if(t.limits?.addrs!=null&&r.addrs.length===t.limits.addrs)throw new p('Decode error - repeated field "addrs" had too many elements');r.addrs.push(i.bytes());break}case 3:{r.timeout=i.int64();break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={addrs:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${t}.peer`,value:i.bytes()};break}case 2:{if(r.limits?.addrs!=null&&d.addrs===r.limits.addrs)throw new p('Streaming decode error - repeated field "addrs" had too many elements');yield{field:`${t}.addrs[]`,index:d.addrs,value:i.bytes()},d.addrs++;break}case 3:{yield{field:`${t}.timeout`,value:i.int64()};break}default:{i.skipType(u&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(tt||(tt={}));var et;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.peer!=null&&i.peer.byteLength>0&&(s.uint32(10),s.bytes(i.peer)),i.proto!=null&&i.proto.length>0)for(let r of i.proto)s.uint32(18),s.string(r);i.timeout!=null&&(s.uint32(24),s.int64(i.timeout)),t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={peer:B(0),proto:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.peer=i.bytes();break}case 2:{if(t.limits?.proto!=null&&r.proto.length===t.limits.proto)throw new p('Decode error - repeated field "proto" had too many elements');r.proto.push(i.string());break}case 3:{r.timeout=i.int64();break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={proto:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${t}.peer`,value:i.bytes()};break}case 2:{if(r.limits?.proto!=null&&d.proto===r.limits.proto)throw new p('Streaming decode error - repeated field "proto" had too many elements');yield{field:`${t}.proto[]`,index:d.proto,value:i.string()},d.proto++;break}case 3:{yield{field:`${t}.timeout`,value:i.int64()};break}default:{i.skipType(u&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(et||(et={}));var nt;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.addr!=null&&i.addr.byteLength>0&&(s.uint32(10),s.bytes(i.addr)),i.proto!=null&&i.proto.length>0)for(let r of i.proto)s.uint32(18),s.string(r);t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={addr:B(0),proto:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.addr=i.bytes();break}case 2:{if(t.limits?.proto!=null&&r.proto.length===t.limits.proto)throw new p('Decode error - repeated field "proto" had too many elements');r.proto.push(i.string());break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={proto:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${t}.addr`,value:i.bytes()};break}case 2:{if(r.limits?.proto!=null&&d.proto===r.limits.proto)throw new p('Streaming decode error - repeated field "proto" had too many elements');yield{field:`${t}.proto[]`,index:d.proto,value:i.string()},d.proto++;break}default:{i.skipType(u&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(nt||(nt={}));var it;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{t.lengthDelimited!==!1&&s.fork(),i.msg!=null&&i.msg!==""&&(s.uint32(10),s.string(i.msg)),t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={msg:""},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.msg=i.string();break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{yield{field:`${t}.msg`,value:i.string()};break}default:{i.skipType(a&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(it||(it={}));var ot;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{t.lengthDelimited!==!1&&s.fork(),i.peer!=null&&i.peer.byteLength>0&&(s.uint32(10),s.bytes(i.peer)),i.addr!=null&&i.addr.byteLength>0&&(s.uint32(18),s.bytes(i.addr)),i.proto!=null&&i.proto!==""&&(s.uint32(26),s.string(i.proto)),t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={peer:B(0),addr:B(0),proto:""},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.peer=i.bytes();break}case 2:{r.addr=i.bytes();break}case 3:{r.proto=i.string();break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{yield{field:`${t}.peer`,value:i.bytes()};break}case 2:{yield{field:`${t}.addr`,value:i.bytes()};break}case 3:{yield{field:`${t}.proto`,value:i.string()};break}default:{i.skipType(a&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(ot||(ot={}));var rt;(function(n){let e;(function(t){t.FIND_PEER="FIND_PEER",t.FIND_PEERS_CONNECTED_TO_PEER="FIND_PEERS_CONNECTED_TO_PEER",t.FIND_PROVIDERS="FIND_PROVIDERS",t.GET_CLOSEST_PEERS="GET_CLOSEST_PEERS",t.GET_PUBLIC_KEY="GET_PUBLIC_KEY",t.GET_VALUE="GET_VALUE",t.SEARCH_VALUE="SEARCH_VALUE",t.PUT_VALUE="PUT_VALUE",t.PROVIDE="PROVIDE"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.FIND_PEER=0]="FIND_PEER",t[t.FIND_PEERS_CONNECTED_TO_PEER=1]="FIND_PEERS_CONNECTED_TO_PEER",t[t.FIND_PROVIDERS=2]="FIND_PROVIDERS",t[t.GET_CLOSEST_PEERS=3]="GET_CLOSEST_PEERS",t[t.GET_PUBLIC_KEY=4]="GET_PUBLIC_KEY",t[t.GET_VALUE=5]="GET_VALUE",t[t.SEARCH_VALUE=6]="SEARCH_VALUE",t[t.PUT_VALUE=7]="PUT_VALUE",t[t.PROVIDE=8]="PROVIDE"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.peer!=null&&(r.uint32(18),r.bytes(t.peer)),t.cid!=null&&(r.uint32(26),r.bytes(t.cid)),t.key!=null&&(r.uint32(34),r.bytes(t.key)),t.value!=null&&(r.uint32(42),r.bytes(t.value)),t.count!=null&&(r.uint32(48),r.int32(t.count)),t.timeout!=null&&(r.uint32(56),r.int64(t.timeout)),d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.peer=t.bytes();break}case 3:{a.cid=t.bytes();break}case 4:{a.key=t.bytes();break}case 5:{a.value=t.bytes();break}case 6:{a.count=t.int32();break}case 7:{a.timeout=t.int64();break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield{field:`${d}.peer`,value:t.bytes()};break}case 3:{yield{field:`${d}.cid`,value:t.bytes()};break}case 4:{yield{field:`${d}.key`,value:t.bytes()};break}case 5:{yield{field:`${d}.value`,value:t.bytes()};break}case 6:{yield{field:`${d}.count`,value:t.int32()};break}case 7:{yield{field:`${d}.timeout`,value:t.int64()};break}default:{t.skipType(h&7);break}}}})),c);function l(t){return y(t,n.codec())}n.encode=l;function i(t,r){return b(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(rt||(rt={}));var st;(function(n){let e;(function(t){t.BEGIN="BEGIN",t.VALUE="VALUE",t.END="END"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.BEGIN=0]="BEGIN",t[t.VALUE=1]="VALUE",t[t.END=2]="END"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.peer!=null&&(r.uint32(18),N.codec().encode(t.peer,r)),t.value!=null&&(r.uint32(26),r.bytes(t.value)),d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.peer=N.codec().decode(t,t.uint32(),{limits:d.limits?.peer});break}case 3:{a.value=t.bytes();break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield*N.codec().stream(t,t.uint32(),`${d}.peer`,{limits:a.limits?.peer});break}case 3:{yield{field:`${d}.value`,value:t.bytes()};break}default:{t.skipType(h&7);break}}}})),c);function l(t){return y(t,n.codec())}n.encode=l;function i(t,r){return b(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(st||(st={}));var N;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.id!=null&&i.id.byteLength>0&&(s.uint32(10),s.bytes(i.id)),i.addrs!=null&&i.addrs.length>0)for(let r of i.addrs)s.uint32(18),s.bytes(r);t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={id:B(0),addrs:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.id=i.bytes();break}case 2:{if(t.limits?.addrs!=null&&r.addrs.length===t.limits.addrs)throw new p('Decode error - repeated field "addrs" had too many elements');r.addrs.push(i.bytes());break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={addrs:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${t}.id`,value:i.bytes()};break}case 2:{if(r.limits?.addrs!=null&&d.addrs===r.limits.addrs)throw new p('Streaming decode error - repeated field "addrs" had too many elements');yield{field:`${t}.addrs[]`,index:d.addrs,value:i.bytes()},d.addrs++;break}default:{i.skipType(u&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(N||(N={}));var ct;(function(n){let e;(function(t){t.TAG_PEER="TAG_PEER",t.UNTAG_PEER="UNTAG_PEER",t.TRIM="TRIM"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.TAG_PEER=0]="TAG_PEER",t[t.UNTAG_PEER=1]="UNTAG_PEER",t[t.TRIM=2]="TRIM"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.peer!=null&&(r.uint32(18),r.bytes(t.peer)),t.tag!=null&&(r.uint32(26),r.string(t.tag)),t.weight!=null&&(r.uint32(32),r.int64(t.weight)),d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.peer=t.bytes();break}case 3:{a.tag=t.string();break}case 4:{a.weight=t.int64();break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield{field:`${d}.peer`,value:t.bytes()};break}case 3:{yield{field:`${d}.tag`,value:t.string()};break}case 4:{yield{field:`${d}.weight`,value:t.int64()};break}default:{t.skipType(h&7);break}}}})),c);function l(t){return y(t,n.codec())}n.encode=l;function i(t,r){return b(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(ct||(ct={}));var lt;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{t.lengthDelimited!==!1&&s.fork(),i.peer!=null&&i.peer.byteLength>0&&(s.uint32(10),s.bytes(i.peer)),t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={peer:B(0)},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.peer=i.bytes();break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{yield{field:`${t}.peer`,value:i.bytes()};break}default:{i.skipType(a&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(lt||(lt={}));var dt;(function(n){let e;(function(t){t.GET_TOPICS="GET_TOPICS",t.LIST_PEERS="LIST_PEERS",t.PUBLISH="PUBLISH",t.SUBSCRIBE="SUBSCRIBE"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.GET_TOPICS=0]="GET_TOPICS",t[t.LIST_PEERS=1]="LIST_PEERS",t[t.PUBLISH=2]="PUBLISH",t[t.SUBSCRIBE=3]="SUBSCRIBE"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.topic!=null&&(r.uint32(18),r.string(t.topic)),t.data!=null&&(r.uint32(26),r.bytes(t.data)),d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.topic=t.string();break}case 3:{a.data=t.bytes();break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield{field:`${d}.topic`,value:t.string()};break}case 3:{yield{field:`${d}.data`,value:t.bytes()};break}default:{t.skipType(h&7);break}}}})),c);function l(t){return y(t,n.codec())}n.encode=l;function i(t,r){return b(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(dt||(dt={}));var ae;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.from!=null&&(s.uint32(10),s.bytes(i.from)),i.data!=null&&(s.uint32(18),s.bytes(i.data)),i.seqno!=null&&(s.uint32(26),s.bytes(i.seqno)),i.topicIDs!=null&&i.topicIDs.length>0)for(let r of i.topicIDs)s.uint32(34),s.string(r);i.signature!=null&&(s.uint32(42),s.bytes(i.signature)),i.key!=null&&(s.uint32(50),s.bytes(i.key)),t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={topicIDs:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.from=i.bytes();break}case 2:{r.data=i.bytes();break}case 3:{r.seqno=i.bytes();break}case 4:{if(t.limits?.topicIDs!=null&&r.topicIDs.length===t.limits.topicIDs)throw new p('Decode error - repeated field "topicIDs" had too many elements');r.topicIDs.push(i.string());break}case 5:{r.signature=i.bytes();break}case 6:{r.key=i.bytes();break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={topicIDs:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${t}.from`,value:i.bytes()};break}case 2:{yield{field:`${t}.data`,value:i.bytes()};break}case 3:{yield{field:`${t}.seqno`,value:i.bytes()};break}case 4:{if(r.limits?.topicIDs!=null&&d.topicIDs===r.limits.topicIDs)throw new p('Streaming decode error - repeated field "topicIDs" had too many elements');yield{field:`${t}.topicIDs[]`,index:d.topicIDs,value:i.string()},d.topicIDs++;break}case 5:{yield{field:`${t}.signature`,value:i.bytes()};break}case 6:{yield{field:`${t}.key`,value:i.bytes()};break}default:{i.skipType(u&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(ae||(ae={}));var at;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.topics!=null&&i.topics.length>0)for(let r of i.topics)s.uint32(10),s.string(r);if(i.peerIDs!=null&&i.peerIDs.length>0)for(let r of i.peerIDs)s.uint32(18),s.bytes(r);t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={topics:[],peerIDs:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{if(t.limits?.topics!=null&&r.topics.length===t.limits.topics)throw new p('Decode error - repeated field "topics" had too many elements');r.topics.push(i.string());break}case 2:{if(t.limits?.peerIDs!=null&&r.peerIDs.length===t.limits.peerIDs)throw new p('Decode error - repeated field "peerIDs" had too many elements');r.peerIDs.push(i.bytes());break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={topics:0,peerIDs:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{if(r.limits?.topics!=null&&d.topics===r.limits.topics)throw new p('Streaming decode error - repeated field "topics" had too many elements');yield{field:`${t}.topics[]`,index:d.topics,value:i.string()},d.topics++;break}case 2:{if(r.limits?.peerIDs!=null&&d.peerIDs===r.limits.peerIDs)throw new p('Streaming decode error - repeated field "peerIDs" had too many elements');yield{field:`${t}.peerIDs[]`,index:d.peerIDs,value:i.bytes()},d.peerIDs++;break}default:{i.skipType(u&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(at||(at={}));var ut;(function(n){let e;(function(t){t.UNSPECIFIED="UNSPECIFIED",t.GET_PROTOCOLS="GET_PROTOCOLS",t.GET_PEER_INFO="GET_PEER_INFO"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.GET_PROTOCOLS=1]="GET_PROTOCOLS",t[t.GET_PEER_INFO=2]="GET_PEER_INFO"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{if(d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.id!=null&&(r.uint32(18),r.bytes(t.id)),t.protos!=null&&t.protos.length>0)for(let a of t.protos)r.uint32(26),r.string(a);d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={protos:[]},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.id=t.bytes();break}case 3:{if(d.limits?.protos!=null&&a.protos.length===d.limits.protos)throw new p('Decode error - repeated field "protos" had too many elements');a.protos.push(t.string());break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u={protos:0},h=r==null?t.len:t.pos+r;for(;t.pos<h;){let X=t.uint32();switch(X>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield{field:`${d}.id`,value:t.bytes()};break}case 3:{if(a.limits?.protos!=null&&u.protos===a.limits.protos)throw new p('Streaming decode error - repeated field "protos" had too many elements');yield{field:`${d}.protos[]`,index:u.protos,value:t.string()},u.protos++;break}default:{t.skipType(X&7);break}}}})),c);function l(t){return y(t,n.codec())}n.encode=l;function i(t,r){return b(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(ut||(ut={}));var ht;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.peer!=null&&(s.uint32(10),N.codec().encode(i.peer,s)),i.protos!=null&&i.protos.length>0)for(let r of i.protos)s.uint32(18),s.string(r);t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={protos:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.peer=N.codec().decode(i,i.uint32(),{limits:t.limits?.peer});break}case 2:{if(t.limits?.protos!=null&&r.protos.length===t.limits.protos)throw new p('Decode error - repeated field "protos" had too many elements');r.protos.push(i.string());break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={protos:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield*N.codec().stream(i,i.uint32(),`${t}.peer`,{limits:r.limits?.peer});break}case 2:{if(r.limits?.protos!=null&&d.protos===r.limits.protos)throw new p('Streaming decode error - repeated field "protos" had too many elements');yield{field:`${t}.protos[]`,index:d.protos,value:i.string()},d.protos++;break}default:{i.skipType(u&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(ht||(ht={}));return je(ki);})();
|
|
2
|
+
"use strict";var Libp2PDaemonProtocol=(()=>{var Ct=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var Ze=Object.getOwnPropertyNames;var He=Object.prototype.hasOwnProperty;var I=(n,e)=>{for(var o in e)Ct(n,o,{get:e[o],enumerable:!0})},qe=(n,e,o,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of Ze(e))!He.call(n,l)&&l!==o&&Ct(n,l,{get:()=>e[l],enumerable:!(c=Ve(e,l))||c.enumerable});return n};var je=n=>qe(Ct({},"__esModule",{value:!0}),n);var ki={};I(ki,{ConnManagerRequest:()=>ct,ConnectRequest:()=>tt,DHTRequest:()=>rt,DHTResponse:()=>st,DisconnectRequest:()=>lt,ErrorResponse:()=>it,IdentifyResponse:()=>j,PSMessage:()=>ae,PSRequest:()=>dt,PSResponse:()=>at,PeerInfo:()=>N,PeerstoreRequest:()=>ut,PeerstoreResponse:()=>ht,Request:()=>le,Response:()=>de,StreamHandlerRequest:()=>nt,StreamInfo:()=>ot,StreamOpenRequest:()=>et});function B(n=0){return new Uint8Array(n)}function G(n=0){return new Uint8Array(n)}var tn=Math.pow(2,7),en=Math.pow(2,14),nn=Math.pow(2,21),ue=Math.pow(2,28),he=Math.pow(2,35),fe=Math.pow(2,42),pe=Math.pow(2,49),k=128,z=127;function ft(n){if(n<tn)return 1;if(n<en)return 2;if(n<nn)return 3;if(n<ue)return 4;if(n<he)return 5;if(n<fe)return 6;if(n<pe)return 7;if(Number.MAX_SAFE_INTEGER!=null&&n>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function me(n,e,o=0){switch(ft(n)){case 8:e[o++]=n&255|k,n/=128;case 7:e[o++]=n&255|k,n/=128;case 6:e[o++]=n&255|k,n/=128;case 5:e[o++]=n&255|k,n/=128;case 4:e[o++]=n&255|k,n>>>=7;case 3:e[o++]=n&255|k,n>>>=7;case 2:e[o++]=n&255|k,n>>>=7;case 1:{e[o++]=n&255,n>>>=7;break}default:throw new Error("unreachable")}return e}function be(n,e){let o=n[e],c=0;if(c+=o&z,o<k||(o=n[e+1],c+=(o&z)<<7,o<k)||(o=n[e+2],c+=(o&z)<<14,o<k)||(o=n[e+3],c+=(o&z)<<21,o<k)||(o=n[e+4],c+=(o&z)*ue,o<k)||(o=n[e+5],c+=(o&z)*he,o<k)||(o=n[e+6],c+=(o&z)*fe,o<k)||(o=n[e+7],c+=(o&z)*pe,o<k))return c;throw new RangeError("Could not decode varint")}var Lt=new Float32Array([-0]),_=new Uint8Array(Lt.buffer);function ye(n,e,o){Lt[0]=n,e[o]=_[0],e[o+1]=_[1],e[o+2]=_[2],e[o+3]=_[3]}function ge(n,e){return _[0]=n[e],_[1]=n[e+1],_[2]=n[e+2],_[3]=n[e+3],Lt[0]}var Ut=new Float64Array([-0]),x=new Uint8Array(Ut.buffer);function Ee(n,e,o){Ut[0]=n,e[o]=x[0],e[o+1]=x[1],e[o+2]=x[2],e[o+3]=x[3],e[o+4]=x[4],e[o+5]=x[5],e[o+6]=x[6],e[o+7]=x[7]}function xe(n,e){return x[0]=n[e],x[1]=n[e+1],x[2]=n[e+2],x[3]=n[e+3],x[4]=n[e+4],x[5]=n[e+5],x[6]=n[e+6],x[7]=n[e+7],Ut[0]}var on=BigInt(Number.MAX_SAFE_INTEGER),rn=BigInt(Number.MIN_SAFE_INTEGER),D=class n{lo;hi;constructor(e,o){this.lo=e|0,this.hi=o|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let o=~this.lo+1>>>0,c=~this.hi>>>0;return o===0&&(c=c+1>>>0),-(o+c*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let o=~this.lo+1>>>0,c=~this.hi>>>0;return o===0&&(c=c+1>>>0),-(BigInt(o)+(BigInt(c)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,o=(this.lo>>>28|this.hi<<4)>>>0,c=this.hi>>>24;return c===0?o===0?e<16384?e<128?1:2:e<2097152?3:4:o<16384?o<128?5:6:o<2097152?7:8:c<128?9:10}static fromBigInt(e){if(e===0n)return Y;if(e<on&&e>rn)return this.fromNumber(Number(e));let o=e<0n;o&&(e=-e);let c=e>>32n,l=e-(c<<32n);return o&&(c=~c|0n,l=~l|0n,++l>ke&&(l=0n,++c>ke&&(c=0n))),new n(Number(l),Number(c))}static fromNumber(e){if(e===0)return Y;let o=e<0;o&&(e=-e);let c=e>>>0,l=(e-c)/4294967296>>>0;return o&&(l=~l>>>0,c=~c>>>0,++c>4294967295&&(c=0,++l>4294967295&&(l=0))),new n(c,l)}static from(e){return typeof e=="number"?n.fromNumber(e):typeof e=="bigint"?n.fromBigInt(e):typeof e=="string"?n.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new n(e.low>>>0,e.high>>>0):Y}},Y=new D(0,0);Y.toBigInt=function(){return 0n};Y.zzEncode=Y.zzDecode=function(){return this};Y.length=function(){return 1};var ke=4294967296n;function we(n){let e=0,o=0;for(let c=0;c<n.length;++c)o=n.charCodeAt(c),o<128?e+=1:o<2048?e+=2:(o&64512)===55296&&(n.charCodeAt(c+1)&64512)===56320?(++c,e+=4):e+=3;return e}function Ie(n,e,o){if(o-e<1)return"";let l,i=[],s=0,t;for(;e<o;)t=n[e++],t<128?i[s++]=t:t>191&&t<224?i[s++]=(t&31)<<6|n[e++]&63:t>239&&t<365?(t=((t&7)<<18|(n[e++]&63)<<12|(n[e++]&63)<<6|n[e++]&63)-65536,i[s++]=55296+(t>>10),i[s++]=56320+(t&1023)):i[s++]=(t&15)<<12|(n[e++]&63)<<6|n[e++]&63,s>8191&&((l??(l=[])).push(String.fromCharCode.apply(String,i)),s=0);return l!=null?(s>0&&l.push(String.fromCharCode.apply(String,i.slice(0,s))),l.join("")):String.fromCharCode.apply(String,i.slice(0,s))}function vt(n,e,o){let c=o,l,i;for(let s=0;s<n.length;++s)l=n.charCodeAt(s),l<128?e[o++]=l:l<2048?(e[o++]=l>>6|192,e[o++]=l&63|128):(l&64512)===55296&&((i=n.charCodeAt(s+1))&64512)===56320?(l=65536+((l&1023)<<10)+(i&1023),++s,e[o++]=l>>18|240,e[o++]=l>>12&63|128,e[o++]=l>>6&63|128,e[o++]=l&63|128):(e[o++]=l>>12|224,e[o++]=l>>6&63|128,e[o++]=l&63|128);return o-c}function C(n,e){return RangeError(`index out of range: ${n.pos} + ${e??1} > ${n.len}`)}function It(n,e){return(n[e-4]|n[e-3]<<8|n[e-2]<<16|n[e-1]<<24)>>>0}var Ft=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,C(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw C(this,4);return It(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw C(this,4);return It(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw C(this,4);let e=ge(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw C(this,4);let e=xe(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),o=this.pos,c=this.pos+e;if(c>this.len)throw C(this,e);return this.pos+=e,o===c?new Uint8Array(0):this.buf.subarray(o,c)}string(){let e=this.bytes();return Ie(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw C(this,e);this.pos+=e}else do if(this.pos>=this.len)throw C(this);while((this.buf[this.pos++]&128)!==0);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new D(0,0),o=0;if(this.len-this.pos>4){for(;o<4;++o)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<o*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;o=0}else{for(;o<3;++o){if(this.pos>=this.len)throw C(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<o*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<o*7)>>>0,e}if(this.len-this.pos>4){for(;o<5;++o)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<o*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;o<5;++o){if(this.pos>=this.len)throw C(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<o*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw C(this,8);let e=It(this.buf,this.pos+=4),o=It(this.buf,this.pos+=4);return new D(e,o)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let e=be(this.buf,this.pos);return this.pos+=ft(e),e}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function pt(n){return new Ft(n instanceof Uint8Array?n:n.subarray())}function b(n,e,o){let c=pt(n);return e.decode(c,void 0,o)}var Pt={};I(Pt,{base10:()=>hn});var Oi=new Uint8Array(0);function Se(n,e){if(n===e)return!0;if(n.byteLength!==e.byteLength)return!1;for(let o=0;o<n.byteLength;o++)if(n[o]!==e[o])return!1;return!0}function $(n){if(n instanceof Uint8Array&&n.constructor.name==="Uint8Array")return n;if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);throw new Error("Unknown type, must be binary type")}function Ne(n){return new TextEncoder().encode(n)}function Ae(n){return new TextDecoder().decode(n)}function sn(n,e){if(n.length>=255)throw new TypeError("Alphabet too long");for(var o=new Uint8Array(256),c=0;c<o.length;c++)o[c]=255;for(var l=0;l<n.length;l++){var i=n.charAt(l),s=i.charCodeAt(0);if(o[s]!==255)throw new TypeError(i+" is ambiguous");o[s]=l}var t=n.length,r=n.charAt(0),d=Math.log(t)/Math.log(256),a=Math.log(256)/Math.log(t);function u(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var w=0,K=0,A=0,L=f.length;A!==L&&f[A]===0;)A++,w++;for(var U=(L-A)*a+1>>>0,S=new Uint8Array(U);A!==L;){for(var v=f[A],P=0,T=U-1;(v!==0||P<K)&&T!==-1;T--,P++)v+=256*S[T]>>>0,S[T]=v%t>>>0,v=v/t>>>0;if(v!==0)throw new Error("Non-zero carry");K=P,A++}for(var O=U-K;O!==U&&S[O]===0;)O++;for(var wt=r.repeat(w);O<U;++O)wt+=n.charAt(S[O]);return wt}function h(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var w=0;if(f[w]!==" "){for(var K=0,A=0;f[w]===r;)K++,w++;for(var L=(f.length-w)*d+1>>>0,U=new Uint8Array(L);f[w];){var S=o[f.charCodeAt(w)];if(S===255)return;for(var v=0,P=L-1;(S!==0||v<A)&&P!==-1;P--,v++)S+=t*U[P]>>>0,U[P]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");A=v,w++}if(f[w]!==" "){for(var T=L-A;T!==L&&U[T]===0;)T++;for(var O=new Uint8Array(K+(L-T)),wt=K;T!==L;)O[wt++]=U[T++];return O}}}function X(f){var w=h(f);if(w)return w;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:h,decode:X}}var cn=sn,ln=cn,Ce=ln;var Ot=class{name;prefix;baseEncode;constructor(e,o,c){this.name=e,this.prefix=o,this.baseEncode=c}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Bt=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,o,c){this.name=e,this.prefix=o;let l=o.codePointAt(0);if(l===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=l,this.baseDecode=c}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Le(this,e)}},$t=class{decoders;constructor(e){this.decoders=e}or(e){return Le(this,e)}decode(e){let o=e[0],c=this.decoders[o];if(c!=null)return c.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Le(n,e){return new $t({...n.decoders??{[n.prefix]:n},...e.decoders??{[e.prefix]:e}})}var Mt=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,o,c,l){this.name=e,this.prefix=o,this.baseEncode=c,this.baseDecode=l,this.encoder=new Ot(e,o,c),this.decoder=new Bt(e,o,l)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function W({name:n,prefix:e,encode:o,decode:c}){return new Mt(n,e,o,c)}function R({name:n,prefix:e,alphabet:o}){let{encode:c,decode:l}=Ce(o,n);return W({prefix:e,name:n,encode:c,decode:i=>$(l(i))})}function dn(n,e,o,c){let l=n.length;for(;n[l-1]==="=";)--l;let i=new Uint8Array(l*o/8|0),s=0,t=0,r=0;for(let d=0;d<l;++d){let a=e[n[d]];if(a===void 0)throw new SyntaxError(`Non-${c} character`);t=t<<o|a,s+=o,s>=8&&(s-=8,i[r++]=255&t>>s)}if(s>=o||(255&t<<8-s)!==0)throw new SyntaxError("Unexpected end of data");return i}function an(n,e,o){let c=e[e.length-1]==="=",l=(1<<o)-1,i="",s=0,t=0;for(let r=0;r<n.length;++r)for(t=t<<8|n[r],s+=8;s>o;)s-=o,i+=e[l&t>>s];if(s!==0&&(i+=e[l&t<<o-s]),c)for(;(i.length*o&7)!==0;)i+="=";return i}function un(n){let e={};for(let o=0;o<n.length;++o)e[n[o]]=o;return e}function m({name:n,prefix:e,bitsPerChar:o,alphabet:c}){let l=un(c);return W({prefix:e,name:n,encode(i){return an(i,c,o)},decode(i){return dn(i,l,o,n)}})}var hn=R({prefix:"9",name:"base10",alphabet:"0123456789"});var Gt={};I(Gt,{base16:()=>fn,base16upper:()=>pn});var fn=m({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),pn=m({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var zt={};I(zt,{base2:()=>mn});var mn=m({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var _t={};I(_t,{base256emoji:()=>xn});var Ue=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),bn=Ue.reduce((n,e,o)=>(n[o]=e,n),[]),yn=Ue.reduce((n,e,o)=>{let c=e.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${e}`);return n[c]=o,n},[]);function gn(n){return n.reduce((e,o)=>(e+=bn[o],e),"")}function En(n){let e=[];for(let o of n){let c=o.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${o}`);let l=yn[c];if(l==null)throw new Error(`Non-base256emoji character: ${o}`);e.push(l)}return new Uint8Array(e)}var xn=W({prefix:"\u{1F680}",name:"base256emoji",encode:gn,decode:En});var Rt={};I(Rt,{base32:()=>Q,base32hex:()=>Dn,base32hexpad:()=>Nn,base32hexpadupper:()=>An,base32hexupper:()=>Sn,base32pad:()=>wn,base32padupper:()=>In,base32upper:()=>kn,base32z:()=>Tn});var Q=m({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),kn=m({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),wn=m({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),In=m({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Dn=m({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Sn=m({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Nn=m({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),An=m({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Tn=m({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Xt={};I(Xt,{base36:()=>mt,base36upper:()=>Cn});var mt=R({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Cn=R({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Kt={};I(Kt,{base58btc:()=>F,base58flickr:()=>Ln});var F=R({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ln=R({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Yt={};I(Yt,{base64:()=>Un,base64pad:()=>vn,base64url:()=>Fn,base64urlpad:()=>On});var Un=m({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),vn=m({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Fn=m({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),On=m({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Jt={};I(Jt,{base8:()=>Bn});var Bn=m({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Wt={};I(Wt,{identity:()=>$n});var $n=W({prefix:"\0",name:"identity",encode:n=>Ae(n),decode:n=>Ne(n)});var Zi=new TextEncoder,Hi=new TextDecoder;var Vt={};I(Vt,{identity:()=>ri});var Gn=Oe,ve=128,zn=127,_n=~zn,Rn=Math.pow(2,31);function Oe(n,e,o){e=e||[],o=o||0;for(var c=o;n>=Rn;)e[o++]=n&255|ve,n/=128;for(;n&_n;)e[o++]=n&255|ve,n>>>=7;return e[o]=n|0,Oe.bytes=o-c+1,e}var Xn=Qt,Kn=128,Fe=127;function Qt(n,c){var o=0,c=c||0,l=0,i=c,s,t=n.length;do{if(i>=t)throw Qt.bytes=0,new RangeError("Could not decode varint");s=n[i++],o+=l<28?(s&Fe)<<l:(s&Fe)*Math.pow(2,l),l+=7}while(s>=Kn);return Qt.bytes=i-c,o}var Yn=Math.pow(2,7),Jn=Math.pow(2,14),Wn=Math.pow(2,21),Qn=Math.pow(2,28),Vn=Math.pow(2,35),Zn=Math.pow(2,42),Hn=Math.pow(2,49),qn=Math.pow(2,56),jn=Math.pow(2,63),ti=function(n){return n<Yn?1:n<Jn?2:n<Wn?3:n<Qn?4:n<Vn?5:n<Zn?6:n<Hn?7:n<qn?8:n<jn?9:10},ei={encode:Gn,decode:Xn,encodingLength:ti},ni=ei,bt=ni;function yt(n,e=0){return[bt.decode(n,e),bt.decode.bytes]}function V(n,e,o=0){return bt.encode(n,e,o),e}function Z(n){return bt.encodingLength(n)}function q(n,e){let o=e.byteLength,c=Z(n),l=c+Z(o),i=new Uint8Array(l+o);return V(n,i,0),V(o,i,c),i.set(e,l),new H(n,o,e,i)}function Be(n){let e=$(n),[o,c]=yt(e),[l,i]=yt(e.subarray(c)),s=e.subarray(c+i);if(s.byteLength!==l)throw new Error("Incorrect length");return new H(o,l,s,e)}function $e(n,e){if(n===e)return!0;{let o=e;return n.code===o.code&&n.size===o.size&&o.bytes instanceof Uint8Array&&Se(n.bytes,o.bytes)}}var H=class{code;size;digest;bytes;constructor(e,o,c,l){this.code=e,this.size=o,this.digest=c,this.bytes=l}};var Me=0,ii="identity",Pe=$;function oi(n,e){if(e?.truncate!=null&&e.truncate!==n.byteLength){if(e.truncate<0||e.truncate>n.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${n.byteLength}`);n=n.subarray(0,e.truncate)}return q(Me,Pe(n))}var ri={code:Me,name:ii,encode:Pe,digest:oi};var qt={};I(qt,{sha256:()=>ci,sha512:()=>li});var si=20;function Ht({name:n,code:e,encode:o,minDigestLength:c,maxDigestLength:l}){return new Zt(n,e,o,c,l)}var Zt=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,o,c,l,i){this.name=e,this.code=o,this.encode=c,this.minDigestLength=l??si,this.maxDigestLength=i}digest(e,o){if(o?.truncate!=null){if(o.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&o.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let c=this.encode(e);return c instanceof Uint8Array?Ge(c,this.code,o?.truncate):c.then(l=>Ge(l,this.code,o?.truncate))}else throw Error("Unknown type, must be binary type")}};function Ge(n,e,o){if(o!=null&&o!==n.byteLength){if(o>n.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${n.byteLength}`);n=n.subarray(0,o)}return q(e,n)}function _e(n){return async e=>new Uint8Array(await crypto.subtle.digest(n,e))}var ci=Ht({name:"sha2-256",code:18,encode:_e("SHA-256")}),li=Ht({name:"sha2-512",code:19,encode:_e("SHA-512")});function Re(n,e){let{bytes:o,version:c}=n;return c===0?ai(o,jt(n),e??F.encoder):ui(o,jt(n),e??Q.encoder)}var Xe=new WeakMap;function jt(n){let e=Xe.get(n);if(e==null){let o=new Map;return Xe.set(n,o),o}return e}var St=class n{code;version;multihash;bytes;"/";constructor(e,o,c,l){this.code=o,this.version=e,this.multihash=c,this.bytes=l,this["/"]=l}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:o}=this;if(e!==Et)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(o.code!==hi)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return n.createV0(o)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:o}=this.multihash,c=q(e,o);return n.createV1(this.code,c)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return n.equals(this,e)}static equals(e,o){let c=o;return c!=null&&e.code===c.code&&e.version===c.version&&$e(e.multihash,c.multihash)}toString(e){return Re(this,e)}toJSON(){return{"/":Re(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let o=e;if(o instanceof n)return o;if(o["/"]!=null&&o["/"]===o.bytes||o.asCID===o){let{version:c,code:l,multihash:i,bytes:s}=o;return new n(c,l,i,s??Ke(c,l,i.bytes))}else if(o[fi]===!0){let{version:c,multihash:l,code:i}=o,s=Be(l);return n.create(c,i,s)}else return null}static create(e,o,c){if(typeof o!="number")throw new Error("String codecs are no longer supported");if(!(c.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(o!==Et)throw new Error(`Version 0 CID must use dag-pb (code: ${Et}) block encoding`);return new n(e,o,c,c.bytes)}case 1:{let l=Ke(e,o,c.bytes);return new n(e,o,c,l)}default:throw new Error("Invalid version")}}static createV0(e){return n.create(0,Et,e)}static createV1(e,o){return n.create(1,e,o)}static decode(e){let[o,c]=n.decodeFirst(e);if(c.length!==0)throw new Error("Incorrect length");return o}static decodeFirst(e){let o=n.inspectBytes(e),c=o.size-o.multihashSize,l=$(e.subarray(c,c+o.multihashSize));if(l.byteLength!==o.multihashSize)throw new Error("Incorrect length");let i=l.subarray(o.multihashSize-o.digestSize),s=new H(o.multihashCode,o.digestSize,i,l);return[o.version===0?n.createV0(s):n.createV1(o.codec,s),e.subarray(o.size)]}static inspectBytes(e){let o=0,c=()=>{let[u,h]=yt(e.subarray(o));return o+=h,u},l=c(),i=Et;if(l===18?(l=0,o=0):i=c(),l!==0&&l!==1)throw new RangeError(`Invalid CID version ${l}`);let s=o,t=c(),r=c(),d=o+r,a=d-s;return{version:l,codec:i,multihashCode:t,digestSize:r,multihashSize:a,size:d}}static parse(e,o){let[c,l]=di(e,o),i=n.decode(l);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return jt(i).set(c,e),i}};function di(n,e){switch(n[0]){case"Q":{let o=e??F;return[F.prefix,o.decode(`${F.prefix}${n}`)]}case F.prefix:{let o=e??F;return[F.prefix,o.decode(n)]}case Q.prefix:{let o=e??Q;return[Q.prefix,o.decode(n)]}case mt.prefix:{let o=e??mt;return[mt.prefix,o.decode(n)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[n[0],e.decode(n)]}}}function ai(n,e,o){let{prefix:c}=o;if(c!==F.prefix)throw Error(`Cannot string encode V0 in ${o.name} encoding`);let l=e.get(c);if(l==null){let i=o.encode(n).slice(1);return e.set(c,i),i}else return l}function ui(n,e,o){let{prefix:c}=o,l=e.get(c);if(l==null){let i=o.encode(n);return e.set(c,i),i}else return l}var Et=112,hi=18;function Ke(n,e,o){let c=Z(n),l=c+Z(e),i=new Uint8Array(l+o.byteLength);return V(n,i,0),V(e,i,c),i.set(o,l),i}var fi=Symbol.for("@ipld/js-cid/CID");var te={...Wt,...zt,...Jt,...Pt,...Gt,...Rt,...Xt,...Kt,...Yt,..._t},xo={...qt,...Vt};function Je(n,e,o,c){return{name:n,prefix:e,encoder:{name:n,prefix:e,encode:o},decoder:{decode:c}}}var Ye=Je("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),ee=Je("ascii","a",n=>{let e="a";for(let o=0;o<n.length;o++)e+=String.fromCharCode(n[o]);return e},n=>{n=n.substring(1);let e=G(n.length);for(let o=0;o<n.length;o++)e[o]=n.charCodeAt(o);return e}),pi={utf8:Ye,"utf-8":Ye,hex:te.base16,latin1:ee,ascii:ee,binary:ee,...te},We=pi;function Qe(n,e="utf8"){let o=We[e];if(o==null)throw new Error(`Unsupported encoding "${e}"`);return o.decoder.decode(`${o.prefix}${n}`)}function ne(n){let e=n??8192,o=e>>>1,c,l=e;return function(s){if(s<1||s>o)return G(s);l+s>e&&(c=G(e),l=0);let t=c.subarray(l,l+=s);return(l&7)!==0&&(l=(l|7)+1),t}}var J=class{fn;len;next;val;constructor(e,o,c){this.fn=e,this.len=o,this.next=void 0,this.val=c}};function ie(){}var re=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},mi=ne();function bi(n){return globalThis.Buffer!=null?G(n):mi(n)}var kt=class{len;head;tail;states;constructor(){this.len=0,this.head=new J(ie,0,0),this.tail=this.head,this.states=null}_push(e,o,c){return this.tail=this.tail.next=new J(e,o,c),this.len+=o,this}uint32(e){return this.len+=(this.tail=this.tail.next=new se((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(Nt,10,D.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let o=D.fromBigInt(e);return this._push(Nt,o.length(),o)}uint64Number(e){return this._push(me,ft(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let o=D.fromBigInt(e).zzEncode();return this._push(Nt,o.length(),o)}sint64Number(e){let o=D.fromNumber(e).zzEncode();return this._push(Nt,o.length(),o)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(oe,1,e?1:0)}fixed32(e){return this._push(xt,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let o=D.fromBigInt(e);return this._push(xt,4,o.lo)._push(xt,4,o.hi)}fixed64Number(e){let o=D.fromNumber(e);return this._push(xt,4,o.lo)._push(xt,4,o.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(ye,4,e)}double(e){return this._push(Ee,8,e)}bytes(e){let o=e.length>>>0;return o===0?this._push(oe,1,0):this.uint32(o)._push(gi,o,e)}string(e){let o=we(e);return o!==0?this.uint32(o)._push(vt,o,e):this._push(oe,1,0)}fork(){return this.states=new re(this),this.head=this.tail=new J(ie,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new J(ie,0,0),this.len=0),this}ldelim(){let e=this.head,o=this.tail,c=this.len;return this.reset().uint32(c),c!==0&&(this.tail.next=e.next,this.tail=o,this.len+=c),this}finish(){let e=this.head.next,o=bi(this.len),c=0;for(;e!=null;)e.fn(e.val,o,c),c+=e.len,e=e.next;return o}};function oe(n,e,o){e[o]=n&255}function yi(n,e,o){for(;n>127;)e[o++]=n&127|128,n>>>=7;e[o]=n}var se=class extends J{next;constructor(e,o){super(yi,e,o),this.next=void 0}};function Nt(n,e,o){for(;n.hi!==0;)e[o++]=n.lo&127|128,n.lo=(n.lo>>>7|n.hi<<25)>>>0,n.hi>>>=7;for(;n.lo>127;)e[o++]=n.lo&127|128,n.lo=n.lo>>>7;e[o++]=n.lo}function xt(n,e,o){e[o]=n&255,e[o+1]=n>>>8&255,e[o+2]=n>>>16&255,e[o+3]=n>>>24}function gi(n,e,o){e.set(n,o)}globalThis.Buffer!=null&&(kt.prototype.bytes=function(n){let e=n.length>>>0;return this.uint32(e),e>0&&this._push(Ei,e,n),this},kt.prototype.string=function(n){let e=globalThis.Buffer.byteLength(n);return this.uint32(e),e>0&&this._push(xi,e,n),this});function Ei(n,e,o){e.set(n,o)}function xi(n,e,o){n.length<40?vt(n,e,o):e.utf8Write!=null?e.utf8Write(n,o):e.set(Qe(n),o)}function ce(){return new kt}function y(n,e){let o=ce();return e.encode(n,o,{lengthDelimited:!1}),o.finish()}function*g(n,e,o){let c=pt(n);yield*e.stream(c,void 0,"$",o)}var At={VARINT:0,BIT64:1,LENGTH_DELIMITED:2,START_GROUP:3,END_GROUP:4,BIT32:5};function Tt(n,e,o,c,l){return{name:n,type:e,encode:o,decode:c,stream:l}}function M(n){function e(i){if(n[i.toString()]==null)throw new Error("Invalid enum value");return n[i]}let o=function(s,t){let r=e(s);t.int32(r)},c=function(s){let t=s.int32();return e(t)},l=function*(s){let t=s.int32();yield e(t)};return Tt("enum",At.VARINT,o,c,l)}function E(n,e,o){return Tt("message",At.LENGTH_DELIMITED,n,e,o)}var p=class extends Error{code="ERR_MAX_LENGTH";name="MaxLengthError"};var le;(function(n){let e;(function(t){t.IDENTIFY="IDENTIFY",t.CONNECT="CONNECT",t.STREAM_OPEN="STREAM_OPEN",t.STREAM_HANDLER="STREAM_HANDLER",t.DHT="DHT",t.LIST_PEERS="LIST_PEERS",t.CONNMANAGER="CONNMANAGER",t.DISCONNECT="DISCONNECT",t.PUBSUB="PUBSUB",t.PEERSTORE="PEERSTORE"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.IDENTIFY=0]="IDENTIFY",t[t.CONNECT=1]="CONNECT",t[t.STREAM_OPEN=2]="STREAM_OPEN",t[t.STREAM_HANDLER=3]="STREAM_HANDLER",t[t.DHT=4]="DHT",t[t.LIST_PEERS=5]="LIST_PEERS",t[t.CONNMANAGER=6]="CONNMANAGER",t[t.DISCONNECT=7]="DISCONNECT",t[t.PUBSUB=8]="PUBSUB",t[t.PEERSTORE=9]="PEERSTORE"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.connect!=null&&(r.uint32(18),tt.codec().encode(t.connect,r)),t.streamOpen!=null&&(r.uint32(26),et.codec().encode(t.streamOpen,r)),t.streamHandler!=null&&(r.uint32(34),nt.codec().encode(t.streamHandler,r)),t.dht!=null&&(r.uint32(42),rt.codec().encode(t.dht,r)),t.connManager!=null&&(r.uint32(50),ct.codec().encode(t.connManager,r)),t.disconnect!=null&&(r.uint32(58),lt.codec().encode(t.disconnect,r)),t.pubsub!=null&&(r.uint32(66),dt.codec().encode(t.pubsub,r)),t.peerStore!=null&&(r.uint32(74),ut.codec().encode(t.peerStore,r)),d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.connect=tt.codec().decode(t,t.uint32(),{limits:d.limits?.connect});break}case 3:{a.streamOpen=et.codec().decode(t,t.uint32(),{limits:d.limits?.streamOpen});break}case 4:{a.streamHandler=nt.codec().decode(t,t.uint32(),{limits:d.limits?.streamHandler});break}case 5:{a.dht=rt.codec().decode(t,t.uint32(),{limits:d.limits?.dht});break}case 6:{a.connManager=ct.codec().decode(t,t.uint32(),{limits:d.limits?.connManager});break}case 7:{a.disconnect=lt.codec().decode(t,t.uint32(),{limits:d.limits?.disconnect});break}case 8:{a.pubsub=dt.codec().decode(t,t.uint32(),{limits:d.limits?.pubsub});break}case 9:{a.peerStore=ut.codec().decode(t,t.uint32(),{limits:d.limits?.peerStore});break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield*tt.codec().stream(t,t.uint32(),`${d}.connect`,{limits:a.limits?.connect});break}case 3:{yield*et.codec().stream(t,t.uint32(),`${d}.streamOpen`,{limits:a.limits?.streamOpen});break}case 4:{yield*nt.codec().stream(t,t.uint32(),`${d}.streamHandler`,{limits:a.limits?.streamHandler});break}case 5:{yield*rt.codec().stream(t,t.uint32(),`${d}.dht`,{limits:a.limits?.dht});break}case 6:{yield*ct.codec().stream(t,t.uint32(),`${d}.connManager`,{limits:a.limits?.connManager});break}case 7:{yield*lt.codec().stream(t,t.uint32(),`${d}.disconnect`,{limits:a.limits?.disconnect});break}case 8:{yield*dt.codec().stream(t,t.uint32(),`${d}.pubsub`,{limits:a.limits?.pubsub});break}case 9:{yield*ut.codec().stream(t,t.uint32(),`${d}.peerStore`,{limits:a.limits?.peerStore});break}default:{t.skipType(h&7);break}}}})),c);function l(t){return y(t,n.codec())}n.encode=l;function i(t,r){return b(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(le||(le={}));var de;(function(n){let e;(function(t){t.OK="OK",t.ERROR="ERROR"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.OK=0]="OK",t[t.ERROR=1]="ERROR"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{if(d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.error!=null&&(r.uint32(18),it.codec().encode(t.error,r)),t.streamInfo!=null&&(r.uint32(26),ot.codec().encode(t.streamInfo,r)),t.identify!=null&&(r.uint32(34),j.codec().encode(t.identify,r)),t.dht!=null&&(r.uint32(42),st.codec().encode(t.dht,r)),t.peers!=null&&t.peers.length>0)for(let a of t.peers)r.uint32(50),N.codec().encode(a,r);t.pubsub!=null&&(r.uint32(58),at.codec().encode(t.pubsub,r)),t.peerStore!=null&&(r.uint32(66),ht.codec().encode(t.peerStore,r)),d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={peers:[]},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.error=it.codec().decode(t,t.uint32(),{limits:d.limits?.error});break}case 3:{a.streamInfo=ot.codec().decode(t,t.uint32(),{limits:d.limits?.streamInfo});break}case 4:{a.identify=j.codec().decode(t,t.uint32(),{limits:d.limits?.identify});break}case 5:{a.dht=st.codec().decode(t,t.uint32(),{limits:d.limits?.dht});break}case 6:{if(d.limits?.peers!=null&&a.peers.length===d.limits.peers)throw new p('Decode error - repeated field "peers" had too many elements');a.peers.push(N.codec().decode(t,t.uint32(),{limits:d.limits?.peers$}));break}case 7:{a.pubsub=at.codec().decode(t,t.uint32(),{limits:d.limits?.pubsub});break}case 8:{a.peerStore=ht.codec().decode(t,t.uint32(),{limits:d.limits?.peerStore});break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u={peers:0},h=r==null?t.len:t.pos+r;for(;t.pos<h;){let X=t.uint32();switch(X>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield*it.codec().stream(t,t.uint32(),`${d}.error`,{limits:a.limits?.error});break}case 3:{yield*ot.codec().stream(t,t.uint32(),`${d}.streamInfo`,{limits:a.limits?.streamInfo});break}case 4:{yield*j.codec().stream(t,t.uint32(),`${d}.identify`,{limits:a.limits?.identify});break}case 5:{yield*st.codec().stream(t,t.uint32(),`${d}.dht`,{limits:a.limits?.dht});break}case 6:{if(a.limits?.peers!=null&&u.peers===a.limits.peers)throw new p('Streaming decode error - repeated field "peers" had too many elements');for(let f of N.codec().stream(t,t.uint32(),`${d}.peers[]`,{limits:a.limits?.peers$}))yield{...f,index:u.peers};u.peers++;break}case 7:{yield*at.codec().stream(t,t.uint32(),`${d}.pubsub`,{limits:a.limits?.pubsub});break}case 8:{yield*ht.codec().stream(t,t.uint32(),`${d}.peerStore`,{limits:a.limits?.peerStore});break}default:{t.skipType(X&7);break}}}})),c);function l(t){return y(t,n.codec())}n.encode=l;function i(t,r){return b(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(de||(de={}));var j;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.id!=null&&i.id.byteLength>0&&(s.uint32(10),s.bytes(i.id)),i.addrs!=null&&i.addrs.length>0)for(let r of i.addrs)s.uint32(18),s.bytes(r);t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={id:B(0),addrs:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.id=i.bytes();break}case 2:{if(t.limits?.addrs!=null&&r.addrs.length===t.limits.addrs)throw new p('Decode error - repeated field "addrs" had too many elements');r.addrs.push(i.bytes());break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={addrs:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${t}.id`,value:i.bytes()};break}case 2:{if(r.limits?.addrs!=null&&d.addrs===r.limits.addrs)throw new p('Streaming decode error - repeated field "addrs" had too many elements');yield{field:`${t}.addrs[]`,index:d.addrs,value:i.bytes()},d.addrs++;break}default:{i.skipType(u&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(j||(j={}));var tt;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.peer!=null&&i.peer.byteLength>0&&(s.uint32(10),s.bytes(i.peer)),i.addrs!=null&&i.addrs.length>0)for(let r of i.addrs)s.uint32(18),s.bytes(r);i.timeout!=null&&(s.uint32(24),s.int64(i.timeout)),t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={peer:B(0),addrs:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.peer=i.bytes();break}case 2:{if(t.limits?.addrs!=null&&r.addrs.length===t.limits.addrs)throw new p('Decode error - repeated field "addrs" had too many elements');r.addrs.push(i.bytes());break}case 3:{r.timeout=i.int64();break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={addrs:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${t}.peer`,value:i.bytes()};break}case 2:{if(r.limits?.addrs!=null&&d.addrs===r.limits.addrs)throw new p('Streaming decode error - repeated field "addrs" had too many elements');yield{field:`${t}.addrs[]`,index:d.addrs,value:i.bytes()},d.addrs++;break}case 3:{yield{field:`${t}.timeout`,value:i.int64()};break}default:{i.skipType(u&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(tt||(tt={}));var et;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.peer!=null&&i.peer.byteLength>0&&(s.uint32(10),s.bytes(i.peer)),i.proto!=null&&i.proto.length>0)for(let r of i.proto)s.uint32(18),s.string(r);i.timeout!=null&&(s.uint32(24),s.int64(i.timeout)),t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={peer:B(0),proto:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.peer=i.bytes();break}case 2:{if(t.limits?.proto!=null&&r.proto.length===t.limits.proto)throw new p('Decode error - repeated field "proto" had too many elements');r.proto.push(i.string());break}case 3:{r.timeout=i.int64();break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={proto:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${t}.peer`,value:i.bytes()};break}case 2:{if(r.limits?.proto!=null&&d.proto===r.limits.proto)throw new p('Streaming decode error - repeated field "proto" had too many elements');yield{field:`${t}.proto[]`,index:d.proto,value:i.string()},d.proto++;break}case 3:{yield{field:`${t}.timeout`,value:i.int64()};break}default:{i.skipType(u&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(et||(et={}));var nt;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.addr!=null&&i.addr.byteLength>0&&(s.uint32(10),s.bytes(i.addr)),i.proto!=null&&i.proto.length>0)for(let r of i.proto)s.uint32(18),s.string(r);t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={addr:B(0),proto:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.addr=i.bytes();break}case 2:{if(t.limits?.proto!=null&&r.proto.length===t.limits.proto)throw new p('Decode error - repeated field "proto" had too many elements');r.proto.push(i.string());break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={proto:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${t}.addr`,value:i.bytes()};break}case 2:{if(r.limits?.proto!=null&&d.proto===r.limits.proto)throw new p('Streaming decode error - repeated field "proto" had too many elements');yield{field:`${t}.proto[]`,index:d.proto,value:i.string()},d.proto++;break}default:{i.skipType(u&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(nt||(nt={}));var it;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{t.lengthDelimited!==!1&&s.fork(),i.msg!=null&&i.msg!==""&&(s.uint32(10),s.string(i.msg)),t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={msg:""},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();a>>>3===1?r.msg=i.string():i.skipType(a&7)}return r},function*(i,s,t,r={}){let d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();a>>>3===1?yield{field:`${t}.msg`,value:i.string()}:i.skipType(a&7)}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(it||(it={}));var ot;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{t.lengthDelimited!==!1&&s.fork(),i.peer!=null&&i.peer.byteLength>0&&(s.uint32(10),s.bytes(i.peer)),i.addr!=null&&i.addr.byteLength>0&&(s.uint32(18),s.bytes(i.addr)),i.proto!=null&&i.proto!==""&&(s.uint32(26),s.string(i.proto)),t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={peer:B(0),addr:B(0),proto:""},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.peer=i.bytes();break}case 2:{r.addr=i.bytes();break}case 3:{r.proto=i.string();break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{yield{field:`${t}.peer`,value:i.bytes()};break}case 2:{yield{field:`${t}.addr`,value:i.bytes()};break}case 3:{yield{field:`${t}.proto`,value:i.string()};break}default:{i.skipType(a&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(ot||(ot={}));var rt;(function(n){let e;(function(t){t.FIND_PEER="FIND_PEER",t.FIND_PEERS_CONNECTED_TO_PEER="FIND_PEERS_CONNECTED_TO_PEER",t.FIND_PROVIDERS="FIND_PROVIDERS",t.GET_CLOSEST_PEERS="GET_CLOSEST_PEERS",t.GET_PUBLIC_KEY="GET_PUBLIC_KEY",t.GET_VALUE="GET_VALUE",t.SEARCH_VALUE="SEARCH_VALUE",t.PUT_VALUE="PUT_VALUE",t.PROVIDE="PROVIDE"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.FIND_PEER=0]="FIND_PEER",t[t.FIND_PEERS_CONNECTED_TO_PEER=1]="FIND_PEERS_CONNECTED_TO_PEER",t[t.FIND_PROVIDERS=2]="FIND_PROVIDERS",t[t.GET_CLOSEST_PEERS=3]="GET_CLOSEST_PEERS",t[t.GET_PUBLIC_KEY=4]="GET_PUBLIC_KEY",t[t.GET_VALUE=5]="GET_VALUE",t[t.SEARCH_VALUE=6]="SEARCH_VALUE",t[t.PUT_VALUE=7]="PUT_VALUE",t[t.PROVIDE=8]="PROVIDE"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.peer!=null&&(r.uint32(18),r.bytes(t.peer)),t.cid!=null&&(r.uint32(26),r.bytes(t.cid)),t.key!=null&&(r.uint32(34),r.bytes(t.key)),t.value!=null&&(r.uint32(42),r.bytes(t.value)),t.count!=null&&(r.uint32(48),r.int32(t.count)),t.timeout!=null&&(r.uint32(56),r.int64(t.timeout)),d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.peer=t.bytes();break}case 3:{a.cid=t.bytes();break}case 4:{a.key=t.bytes();break}case 5:{a.value=t.bytes();break}case 6:{a.count=t.int32();break}case 7:{a.timeout=t.int64();break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield{field:`${d}.peer`,value:t.bytes()};break}case 3:{yield{field:`${d}.cid`,value:t.bytes()};break}case 4:{yield{field:`${d}.key`,value:t.bytes()};break}case 5:{yield{field:`${d}.value`,value:t.bytes()};break}case 6:{yield{field:`${d}.count`,value:t.int32()};break}case 7:{yield{field:`${d}.timeout`,value:t.int64()};break}default:{t.skipType(h&7);break}}}})),c);function l(t){return y(t,n.codec())}n.encode=l;function i(t,r){return b(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(rt||(rt={}));var st;(function(n){let e;(function(t){t.BEGIN="BEGIN",t.VALUE="VALUE",t.END="END"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.BEGIN=0]="BEGIN",t[t.VALUE=1]="VALUE",t[t.END=2]="END"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.peer!=null&&(r.uint32(18),N.codec().encode(t.peer,r)),t.value!=null&&(r.uint32(26),r.bytes(t.value)),d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.peer=N.codec().decode(t,t.uint32(),{limits:d.limits?.peer});break}case 3:{a.value=t.bytes();break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield*N.codec().stream(t,t.uint32(),`${d}.peer`,{limits:a.limits?.peer});break}case 3:{yield{field:`${d}.value`,value:t.bytes()};break}default:{t.skipType(h&7);break}}}})),c);function l(t){return y(t,n.codec())}n.encode=l;function i(t,r){return b(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(st||(st={}));var N;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.id!=null&&i.id.byteLength>0&&(s.uint32(10),s.bytes(i.id)),i.addrs!=null&&i.addrs.length>0)for(let r of i.addrs)s.uint32(18),s.bytes(r);t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={id:B(0),addrs:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.id=i.bytes();break}case 2:{if(t.limits?.addrs!=null&&r.addrs.length===t.limits.addrs)throw new p('Decode error - repeated field "addrs" had too many elements');r.addrs.push(i.bytes());break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={addrs:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${t}.id`,value:i.bytes()};break}case 2:{if(r.limits?.addrs!=null&&d.addrs===r.limits.addrs)throw new p('Streaming decode error - repeated field "addrs" had too many elements');yield{field:`${t}.addrs[]`,index:d.addrs,value:i.bytes()},d.addrs++;break}default:{i.skipType(u&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(N||(N={}));var ct;(function(n){let e;(function(t){t.TAG_PEER="TAG_PEER",t.UNTAG_PEER="UNTAG_PEER",t.TRIM="TRIM"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.TAG_PEER=0]="TAG_PEER",t[t.UNTAG_PEER=1]="UNTAG_PEER",t[t.TRIM=2]="TRIM"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.peer!=null&&(r.uint32(18),r.bytes(t.peer)),t.tag!=null&&(r.uint32(26),r.string(t.tag)),t.weight!=null&&(r.uint32(32),r.int64(t.weight)),d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.peer=t.bytes();break}case 3:{a.tag=t.string();break}case 4:{a.weight=t.int64();break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield{field:`${d}.peer`,value:t.bytes()};break}case 3:{yield{field:`${d}.tag`,value:t.string()};break}case 4:{yield{field:`${d}.weight`,value:t.int64()};break}default:{t.skipType(h&7);break}}}})),c);function l(t){return y(t,n.codec())}n.encode=l;function i(t,r){return b(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(ct||(ct={}));var lt;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{t.lengthDelimited!==!1&&s.fork(),i.peer!=null&&i.peer.byteLength>0&&(s.uint32(10),s.bytes(i.peer)),t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={peer:B(0)},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();a>>>3===1?r.peer=i.bytes():i.skipType(a&7)}return r},function*(i,s,t,r={}){let d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();a>>>3===1?yield{field:`${t}.peer`,value:i.bytes()}:i.skipType(a&7)}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(lt||(lt={}));var dt;(function(n){let e;(function(t){t.GET_TOPICS="GET_TOPICS",t.LIST_PEERS="LIST_PEERS",t.PUBLISH="PUBLISH",t.SUBSCRIBE="SUBSCRIBE"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.GET_TOPICS=0]="GET_TOPICS",t[t.LIST_PEERS=1]="LIST_PEERS",t[t.PUBLISH=2]="PUBLISH",t[t.SUBSCRIBE=3]="SUBSCRIBE"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.topic!=null&&(r.uint32(18),r.string(t.topic)),t.data!=null&&(r.uint32(26),r.bytes(t.data)),d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.topic=t.string();break}case 3:{a.data=t.bytes();break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield{field:`${d}.topic`,value:t.string()};break}case 3:{yield{field:`${d}.data`,value:t.bytes()};break}default:{t.skipType(h&7);break}}}})),c);function l(t){return y(t,n.codec())}n.encode=l;function i(t,r){return b(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(dt||(dt={}));var ae;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.from!=null&&(s.uint32(10),s.bytes(i.from)),i.data!=null&&(s.uint32(18),s.bytes(i.data)),i.seqno!=null&&(s.uint32(26),s.bytes(i.seqno)),i.topicIDs!=null&&i.topicIDs.length>0)for(let r of i.topicIDs)s.uint32(34),s.string(r);i.signature!=null&&(s.uint32(42),s.bytes(i.signature)),i.key!=null&&(s.uint32(50),s.bytes(i.key)),t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={topicIDs:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.from=i.bytes();break}case 2:{r.data=i.bytes();break}case 3:{r.seqno=i.bytes();break}case 4:{if(t.limits?.topicIDs!=null&&r.topicIDs.length===t.limits.topicIDs)throw new p('Decode error - repeated field "topicIDs" had too many elements');r.topicIDs.push(i.string());break}case 5:{r.signature=i.bytes();break}case 6:{r.key=i.bytes();break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={topicIDs:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield{field:`${t}.from`,value:i.bytes()};break}case 2:{yield{field:`${t}.data`,value:i.bytes()};break}case 3:{yield{field:`${t}.seqno`,value:i.bytes()};break}case 4:{if(r.limits?.topicIDs!=null&&d.topicIDs===r.limits.topicIDs)throw new p('Streaming decode error - repeated field "topicIDs" had too many elements');yield{field:`${t}.topicIDs[]`,index:d.topicIDs,value:i.string()},d.topicIDs++;break}case 5:{yield{field:`${t}.signature`,value:i.bytes()};break}case 6:{yield{field:`${t}.key`,value:i.bytes()};break}default:{i.skipType(u&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(ae||(ae={}));var at;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.topics!=null&&i.topics.length>0)for(let r of i.topics)s.uint32(10),s.string(r);if(i.peerIDs!=null&&i.peerIDs.length>0)for(let r of i.peerIDs)s.uint32(18),s.bytes(r);t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={topics:[],peerIDs:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{if(t.limits?.topics!=null&&r.topics.length===t.limits.topics)throw new p('Decode error - repeated field "topics" had too many elements');r.topics.push(i.string());break}case 2:{if(t.limits?.peerIDs!=null&&r.peerIDs.length===t.limits.peerIDs)throw new p('Decode error - repeated field "peerIDs" had too many elements');r.peerIDs.push(i.bytes());break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={topics:0,peerIDs:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{if(r.limits?.topics!=null&&d.topics===r.limits.topics)throw new p('Streaming decode error - repeated field "topics" had too many elements');yield{field:`${t}.topics[]`,index:d.topics,value:i.string()},d.topics++;break}case 2:{if(r.limits?.peerIDs!=null&&d.peerIDs===r.limits.peerIDs)throw new p('Streaming decode error - repeated field "peerIDs" had too many elements');yield{field:`${t}.peerIDs[]`,index:d.peerIDs,value:i.bytes()},d.peerIDs++;break}default:{i.skipType(u&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(at||(at={}));var ut;(function(n){let e;(function(t){t.UNSPECIFIED="UNSPECIFIED",t.GET_PROTOCOLS="GET_PROTOCOLS",t.GET_PEER_INFO="GET_PEER_INFO"})(e=n.Type||(n.Type={}));let o;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.GET_PROTOCOLS=1]="GET_PROTOCOLS",t[t.GET_PEER_INFO=2]="GET_PEER_INFO"})(o||(o={})),(function(t){t.codec=()=>M(o)})(e=n.Type||(n.Type={}));let c;n.codec=()=>(c==null&&(c=E((t,r,d={})=>{if(d.lengthDelimited!==!1&&r.fork(),t.type!=null&&(r.uint32(8),n.Type.codec().encode(t.type,r)),t.id!=null&&(r.uint32(18),r.bytes(t.id)),t.protos!=null&&t.protos.length>0)for(let a of t.protos)r.uint32(26),r.string(a);d.lengthDelimited!==!1&&r.ldelim()},(t,r,d={})=>{let a={protos:[]},u=r==null?t.len:t.pos+r;for(;t.pos<u;){let h=t.uint32();switch(h>>>3){case 1:{a.type=n.Type.codec().decode(t);break}case 2:{a.id=t.bytes();break}case 3:{if(d.limits?.protos!=null&&a.protos.length===d.limits.protos)throw new p('Decode error - repeated field "protos" had too many elements');a.protos.push(t.string());break}default:{t.skipType(h&7);break}}}return a},function*(t,r,d,a={}){let u={protos:0},h=r==null?t.len:t.pos+r;for(;t.pos<h;){let X=t.uint32();switch(X>>>3){case 1:{yield{field:`${d}.type`,value:n.Type.codec().decode(t)};break}case 2:{yield{field:`${d}.id`,value:t.bytes()};break}case 3:{if(a.limits?.protos!=null&&u.protos===a.limits.protos)throw new p('Streaming decode error - repeated field "protos" had too many elements');yield{field:`${d}.protos[]`,index:u.protos,value:t.string()},u.protos++;break}default:{t.skipType(X&7);break}}}})),c);function l(t){return y(t,n.codec())}n.encode=l;function i(t,r){return b(t,n.codec(),r)}n.decode=i;function s(t,r){return g(t,n.codec(),r)}n.stream=s})(ut||(ut={}));var ht;(function(n){let e;n.codec=()=>(e==null&&(e=E((i,s,t={})=>{if(t.lengthDelimited!==!1&&s.fork(),i.peer!=null&&(s.uint32(10),N.codec().encode(i.peer,s)),i.protos!=null&&i.protos.length>0)for(let r of i.protos)s.uint32(18),s.string(r);t.lengthDelimited!==!1&&s.ldelim()},(i,s,t={})=>{let r={protos:[]},d=s==null?i.len:i.pos+s;for(;i.pos<d;){let a=i.uint32();switch(a>>>3){case 1:{r.peer=N.codec().decode(i,i.uint32(),{limits:t.limits?.peer});break}case 2:{if(t.limits?.protos!=null&&r.protos.length===t.limits.protos)throw new p('Decode error - repeated field "protos" had too many elements');r.protos.push(i.string());break}default:{i.skipType(a&7);break}}}return r},function*(i,s,t,r={}){let d={protos:0},a=s==null?i.len:i.pos+s;for(;i.pos<a;){let u=i.uint32();switch(u>>>3){case 1:{yield*N.codec().stream(i,i.uint32(),`${t}.peer`,{limits:r.limits?.peer});break}case 2:{if(r.limits?.protos!=null&&d.protos===r.limits.protos)throw new p('Streaming decode error - repeated field "protos" had too many elements');yield{field:`${t}.protos[]`,index:d.protos,value:i.string()},d.protos++;break}default:{i.skipType(u&7);break}}}})),e);function o(i){return y(i,n.codec())}n.encode=o;function c(i,s){return b(i,n.codec(),s)}n.decode=c;function l(i,s){return g(i,n.codec(),s)}n.stream=l})(ht||(ht={}));return je(ki);})();
|
|
3
3
|
return Libp2PDaemonProtocol}));
|
|
4
4
|
//# sourceMappingURL=index.min.js.map
|